From jongretar@REDACTED Sun Jan 3 17:02:58 2010 From: jongretar@REDACTED (Jon Gretar Borgthorsson) Date: Sun, 3 Jan 2010 16:02:58 +0000 Subject: [erlang-questions] ERlang and DVB In-Reply-To: <401d3ba30912290236q76d91464y3856708865a96dfa@mail.gmail.com> References: <4B3974D9.9000603@gmail.com> <401d3ba30912290236q76d91464y3856708865a96dfa@mail.gmail.com> Message-ID: <4ecde87b1001030802kcd09418s4a0bb4b4d17ccea3@mail.gmail.com> Having done a tiny bit of research on IPTV/VOD for a service provider I used to work for I was not aware of coding/encryption being done using a software solutions a lot. This is usually done using dedicated boxes connected directly to the providers feed source. There is also a lot of restrictions on what you can use set by the distributors. This was usually rock solid and most people were happy with this. What is however done in software is all the middleware solution and so on around it. This is mostly RTSP, RTP and HTTP stuff and Erlang could easily be a strong competitor in that field. Especially as IPTV over ADSL is in the domain of the telcos and Erlang has a good rep with them. Currently most of the solutions I saw were Java based (apart from one Ocaml based middleware I noticed) and I remember being worried on how we could do system updates with acceptable downtime. So Erlang's strength would be a welcome thing in this field I think. That all being said I'm not in any way an IPTV expert and this was some years ago. So I may be talking out of my ass here. :) 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. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From kagato@REDACTED Mon Jan 4 03:31:52 2010 From: kagato@REDACTED (Jayson Vantuyl) Date: Sun, 3 Jan 2010 18:31:52 -0800 Subject: OTP Supervisor Question Message-ID: If I'm an OTP-style process (say, a gen_server), and I want to know who my parent is (say, a supervisor), is this possible using any API, or do I need to pass in the Parent explicitly? Is using supervisor:get_child a good way to find a process's sibling? Would it be better to start a single gen_server and have it use normal, linked processes? I have a certain automaton that is represented as a group of three processes. These processes coordinate and there may be multiple automata on a single node. I want to put them under a single supervisor, but I'm struggling a bit to get them to all know each other's PIds without adding code to the supervisor (which is bad, right?) and without having to locally register them (which would prevent multiple automata per node). Thanks, -- Jayson Vantuyl kagato@REDACTED From kagato@REDACTED Mon Jan 4 03:58:40 2010 From: kagato@REDACTED (Jayson Vantuyl) Date: Sun, 3 Jan 2010 18:58:40 -0800 Subject: binary_to_term and leaking atoms Message-ID: <6E7BA120-D842-4907-9A19-9E2602D7394A@souja.net> I've been writing a lot of Erlang lately, and I feel like I'm missing something. Specifically, list_to_existing_atom is awesome for preventing atom leak; binary_to_term is great for easily building flexible network protocols; and {packet,N} makes framing the protocol a breeze. That said, I can't get the safety of list_to_existing_atom with binary_to_term. binary_to_term will automatically create any atoms (as well as funs) that a remote sender wants. This is has necessitated writing custom protocol encoders / decoders, and makes Erlang's external binary term format incredibly useless. It would be very nice to add a version of binary_to_term that has an extra argument which contains options. This would generally useful to allow prohibiting creation of new atoms, prohibiting creation of funs / pids, and maybe even to specify backwards-compatible binary formats (making it easier to interoperate with older versions of Erlang). -- Jayson Vantuyl kagato@REDACTED From chandrashekhar.mullaparthi@REDACTED Mon Jan 4 04:12:40 2010 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Mon, 4 Jan 2010 03:12:40 +0000 Subject: [erlang-questions] OTP Supervisor Question In-Reply-To: References: Message-ID: 2010/1/4 Jayson Vantuyl > If I'm an OTP-style process (say, a gen_server), and I want to know who my > parent is (say, a supervisor), is this possible using any API, or do I need > to pass in the Parent explicitly? Is using supervisor:get_child a good way > to find a process's sibling? Would it be better to start a single > gen_server and have it use normal, linked processes? > I think using supervisor:which_children(Sup_ref) is quite reasonable. But for this, you'll have to store the process id of the supervisor in all the supervised processes. > > I have a certain automaton that is represented as a group of three > processes. These processes coordinate and there may be multiple automata on > a single node. I want to put them under a single supervisor, but I'm > struggling a bit to get them to all know each other's PIds without adding > code to the supervisor (which is bad, right?) and without having to locally > register them (which would prevent multiple automata per node). > As far as I understand, you'll need a two level supervision tree. One supervisor supervising each set of three processes, and those supervisors in turn under a top level supervisor. That way, when any of a set of three processes invoke supervisor:which_children(Sup_ref) on its supervisor, it'll only see that set and nothing else. Chandru From erlang@REDACTED Mon Jan 4 09:17:54 2010 From: erlang@REDACTED (Joe Armstrong) Date: Mon, 4 Jan 2010 09:17:54 +0100 Subject: [erlang-questions] binary_to_term and leaking atoms In-Reply-To: <6E7BA120-D842-4907-9A19-9E2602D7394A@souja.net> References: <6E7BA120-D842-4907-9A19-9E2602D7394A@souja.net> Message-ID: <9b08084c1001040017l4e7603c8lcb3dcc73415c3172@mail.gmail.com> The real problem is that we don't have garbage collection of atoms. lists_to_exiting_atom is a hack to try and get around this. Erlang was designed for an environment of trusted nodes so we never worried about atom garbage collection. The case for adding atom GC has never been compelling enough to do it. On a 64 bit machine the case for atoms seems weak - you could make a new data type "short atoms" and store them in 64 bits, long atoms could be on the local process heap and not in the atom table, You could use some smart pointer scheme to avoid unnecessary string comparisons when comparing atoms ... /Joe On Mon, Jan 4, 2010 at 3:58 AM, Jayson Vantuyl wrote: > I've been writing a lot of Erlang lately, and I feel like I'm missing something. > > Specifically, list_to_existing_atom is awesome for preventing atom leak; binary_to_term is great for easily building flexible network protocols; and {packet,N} makes framing the protocol a breeze. > > That said, I can't get the safety of list_to_existing_atom with binary_to_term. ?binary_to_term will automatically create any atoms (as well as funs) that a remote sender wants. ?This is has necessitated writing custom protocol encoders / decoders, and makes Erlang's external binary term format incredibly useless. ?It would be very nice to add a version of binary_to_term that has an extra argument which contains options. ?This would generally useful to allow prohibiting creation of new atoms, prohibiting creation of funs / pids, and maybe even to specify backwards-compatible binary formats (making it easier to interoperate with older versions of Erlang). > > -- > Jayson Vantuyl > kagato@REDACTED > > > > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From maruthavanan_s@REDACTED Mon Jan 4 09:08:17 2010 From: maruthavanan_s@REDACTED (maruthavanan s) Date: Mon, 4 Jan 2010 03:08:17 -0500 Subject: Installation error Message-ID: Hi, I am using Fedora Core 9 kernel version: 2.6.25-14.fc9.i686gcc version 4.3.0 20080428 (Red Hat 4.3.0-8) (GCC) java version "1.6.0" When I tried installing Erlang R12-B1 when i try to make, I get the following collect2: ld returned 1 exit status make[3]: *** [/usr/symbiotic/otp_src_R12B-1/bin/i686-pc-linux-gnu/beam.smp] Error 1 make[3]: Leaving directory `/usr/symbiotic/otp_src_R12B-1/erts/emulator' make[2]: *** [opt] Error 2 make[2]: Leaving directory `/usr/symbiotic/otp_src_R12B-1/erts/emulator' make[1]: *** [smp] Error 2 make[1]: Leaving directory `/usr/symbiotic/otp_src_R12B-1/erts' make: *** [emulator] Error 2 Appreciate your help. Regards,Marutha From kagato@REDACTED Mon Jan 4 09:28:32 2010 From: kagato@REDACTED (Jayson Vantuyl) Date: Mon, 4 Jan 2010 00:28:32 -0800 Subject: [erlang-questions] binary_to_term and leaking atoms In-Reply-To: <9b08084c1001040017l4e7603c8lcb3dcc73415c3172@mail.gmail.com> References: <6E7BA120-D842-4907-9A19-9E2602D7394A@souja.net> <9b08084c1001040017l4e7603c8lcb3dcc73415c3172@mail.gmail.com> Message-ID: On the up side, short atoms sound like a fantastic idea. On the down side, atom GC sounds like it could easily kill performance. I'd imagine that everything would have to stop when atoms were GC'd. Even if not, I'd also imagine it would be a large and invasive change. I don't suppose I could get a safe binary_to_term in the meantime? What if I submitted a patch? On Jan 4, 2010, at 12:17 AM, Joe Armstrong wrote: > The real problem is that we don't have garbage collection of atoms. > lists_to_exiting_atom is a hack to try and > get around this. > > Erlang was designed for an environment of trusted nodes so we never > worried about atom garbage collection. > The case for adding atom GC has never been compelling enough to do it. > > On a 64 bit machine the case for atoms seems weak - you could make a > new data type "short atoms" and > store them in 64 bits, long atoms could be on the local process heap > and not in the atom table, You could use some > smart pointer scheme to avoid unnecessary string comparisons when > comparing atoms ... > > /Joe > > > > On Mon, Jan 4, 2010 at 3:58 AM, Jayson Vantuyl wrote: >> I've been writing a lot of Erlang lately, and I feel like I'm missing something. >> >> Specifically, list_to_existing_atom is awesome for preventing atom leak; binary_to_term is great for easily building flexible network protocols; and {packet,N} makes framing the protocol a breeze. >> >> That said, I can't get the safety of list_to_existing_atom with binary_to_term. binary_to_term will automatically create any atoms (as well as funs) that a remote sender wants. This is has necessitated writing custom protocol encoders / decoders, and makes Erlang's external binary term format incredibly useless. It would be very nice to add a version of binary_to_term that has an extra argument which contains options. This would generally useful to allow prohibiting creation of new atoms, prohibiting creation of funs / pids, and maybe even to specify backwards-compatible binary formats (making it easier to interoperate with older versions of Erlang). >> >> -- >> Jayson Vantuyl >> kagato@REDACTED >> >> >> >> >> >> >> ________________________________________________________________ >> 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 kagato@REDACTED Mon Jan 4 09:29:47 2010 From: kagato@REDACTED (Jayson Vantuyl) Date: Mon, 4 Jan 2010 00:29:47 -0800 Subject: [erlang-questions] Installation error In-Reply-To: References: Message-ID: <45B5AEB2-ABA6-4CB9-B6BB-166E3B02AB8D@souja.net> I see that ld failed, but I can't tell what the actual error was. Can you give us more error text? Perhaps something involving a missing symbol? On Jan 4, 2010, at 12:08 AM, maruthavanan s wrote: > > Hi, > > I am using Fedora Core 9 > > > > kernel version: 2.6.25-14.fc9.i686gcc > version 4.3.0 20080428 (Red Hat 4.3.0-8) (GCC) > > java version "1.6.0" > When I tried installing Erlang R12-B1 when i try to make, I get the following > > > collect2: > ld returned 1 exit status > > make[3]: > *** [/usr/symbiotic/otp_src_R12B-1/bin/i686-pc-linux-gnu/beam.smp] Error 1 > > make[3]: > Leaving directory `/usr/symbiotic/otp_src_R12B-1/erts/emulator' > > make[2]: > *** [opt] Error 2 > > make[2]: > Leaving directory `/usr/symbiotic/otp_src_R12B-1/erts/emulator' > > make[1]: > *** [smp] Error 2 > > make[1]: > Leaving directory `/usr/symbiotic/otp_src_R12B-1/erts' > > make: > *** [emulator] Error 2 > > > Appreciate your help. > > > > Regards,Marutha > > > > > > > From vasilij.savin@REDACTED Mon Jan 4 09:56:26 2010 From: vasilij.savin@REDACTED (Vasilij Savin) Date: Mon, 4 Jan 2010 10:56:26 +0200 Subject: [erlang-questions] Installation error In-Reply-To: <45B5AEB2-ABA6-4CB9-B6BB-166E3B02AB8D@souja.net> References: <45B5AEB2-ABA6-4CB9-B6BB-166E3B02AB8D@souja.net> Message-ID: Also, do you use package manager or manual install. Finally, I would recommend trying latest erlang version (R13B02), unless it is specifically required to use previous one. Regards, Vasilij Savin On Mon, Jan 4, 2010 at 10:29 AM, Jayson Vantuyl wrote: > I see that ld failed, but I can't tell what the actual error was. Can you > give us more error text? Perhaps something involving a missing symbol? > > On Jan 4, 2010, at 12:08 AM, maruthavanan s wrote: > > > > > Hi, > > > > I am using Fedora Core 9 > > > > > > > > kernel version: 2.6.25-14.fc9.i686gcc > > version 4.3.0 20080428 (Red Hat 4.3.0-8) (GCC) > > > > java version "1.6.0" > > When I tried installing Erlang R12-B1 when i try to make, I get the > following > > > > > > collect2: > > ld returned 1 exit status > > > > make[3]: > > *** [/usr/symbiotic/otp_src_R12B-1/bin/i686-pc-linux-gnu/beam.smp] Error > 1 > > > > make[3]: > > Leaving directory `/usr/symbiotic/otp_src_R12B-1/erts/emulator' > > > > make[2]: > > *** [opt] Error 2 > > > > make[2]: > > Leaving directory `/usr/symbiotic/otp_src_R12B-1/erts/emulator' > > > > make[1]: > > *** [smp] Error 2 > > > > make[1]: > > Leaving directory `/usr/symbiotic/otp_src_R12B-1/erts' > > > > make: > > *** [emulator] Error 2 > > > > > > Appreciate your help. > > > > > > > > Regards,Marutha > > > > > > > > > > > > > > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From nick@REDACTED Mon Jan 4 10:09:57 2010 From: nick@REDACTED (Niclas Eklund) Date: Mon, 4 Jan 2010 10:09:57 +0100 (CET) Subject: [erlang-questions] Installation error In-Reply-To: References: <45B5AEB2-ABA6-4CB9-B6BB-166E3B02AB8D@souja.net> Message-ID: Hello! Or even better - R13B03 (http://www.erlang.org/download.html). I assume that R13B02 was a typo ;-) Best Regards, Niclas @ Erlang/OP On Mon, 4 Jan 2010, Vasilij Savin wrote: > Also, do you use package manager or manual install. > > Finally, I would recommend trying latest erlang version (R13B02), unless it > is specifically required to use previous one. > > Regards, > Vasilij Savin > > > On Mon, Jan 4, 2010 at 10:29 AM, Jayson Vantuyl wrote: > >> I see that ld failed, but I can't tell what the actual error was. Can you >> give us more error text? Perhaps something involving a missing symbol? >> >> On Jan 4, 2010, at 12:08 AM, maruthavanan s wrote: >> >>> >>> Hi, >>> >>> I am using Fedora Core 9 >>> >>> >>> >>> kernel version: 2.6.25-14.fc9.i686gcc >>> version 4.3.0 20080428 (Red Hat 4.3.0-8) (GCC) >>> >>> java version "1.6.0" >>> When I tried installing Erlang R12-B1 when i try to make, I get the >> following >>> >>> >>> collect2: >>> ld returned 1 exit status >>> >>> make[3]: >>> *** [/usr/symbiotic/otp_src_R12B-1/bin/i686-pc-linux-gnu/beam.smp] Error >> 1 >>> >>> make[3]: >>> Leaving directory `/usr/symbiotic/otp_src_R12B-1/erts/emulator' >>> >>> make[2]: >>> *** [opt] Error 2 >>> >>> make[2]: >>> Leaving directory `/usr/symbiotic/otp_src_R12B-1/erts/emulator' >>> >>> make[1]: >>> *** [smp] Error 2 >>> >>> make[1]: >>> Leaving directory `/usr/symbiotic/otp_src_R12B-1/erts' >>> >>> make: >>> *** [emulator] Error 2 >>> >>> >>> Appreciate your help. >>> >>> >>> >>> Regards,Marutha >>> >>> >>> >>> >>> >>> >>> >> >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> > From kenneth.lundin@REDACTED Mon Jan 4 10:54:37 2010 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Mon, 4 Jan 2010 10:54:37 +0100 Subject: [erlang-questions] binary_to_term and leaking atoms In-Reply-To: References: <6E7BA120-D842-4907-9A19-9E2602D7394A@souja.net> <9b08084c1001040017l4e7603c8lcb3dcc73415c3172@mail.gmail.com> Message-ID: I think we will implement atom GC one day. We have discussed this several times and there are solutions with only small performance decrease (10% or maybe less). It is a major thing to implement and we cannot prioritize this for now and unknown when we can. Extended functionality in binary_to_term can be a good compromise in the mean time. The question is how it should work. Assume we introduce: binary_to_term(Bin,Options) What options should we have: 'no_new_atoms' could make the function crash with reason badarg if the binary contains encoded "new" non existing atoms or 'new_atoms_as_binaries' could translate "new" existing atoms to binaries etc. I think the first step is to define how the new function should work, what suggestions do you have here? /Kenneth Erlang/OTP Ericsson On Mon, Jan 4, 2010 at 9:28 AM, Jayson Vantuyl wrote: > On the up side, short atoms sound like a fantastic idea. ?On the down side, atom GC sounds like it could easily kill performance. ?I'd imagine that everything would have to stop when atoms were GC'd. ?Even if not, I'd also imagine it would be a large and invasive change. > > I don't suppose I could get a safe binary_to_term in the meantime? ?What if I submitted a patch? > > On Jan 4, 2010, at 12:17 AM, Joe Armstrong wrote: > >> The real problem is that we don't have garbage collection of atoms. >> lists_to_exiting_atom is a hack to try and >> get around this. >> >> Erlang was designed for an environment of trusted nodes so we never >> worried about atom garbage collection. >> The case for adding atom GC has never been compelling enough to do it. >> >> On a 64 bit machine the case for atoms seems weak - you could make a >> new data type "short atoms" and >> store them in 64 bits, long atoms could be on the local process ?heap >> and not in the atom table, You could use some >> smart pointer scheme to avoid unnecessary string comparisons when >> comparing atoms ... >> >> /Joe >> >> >> >> On Mon, Jan 4, 2010 at 3:58 AM, Jayson Vantuyl wrote: >>> I've been writing a lot of Erlang lately, and I feel like I'm missing something. >>> >>> Specifically, list_to_existing_atom is awesome for preventing atom leak; binary_to_term is great for easily building flexible network protocols; and {packet,N} makes framing the protocol a breeze. >>> >>> That said, I can't get the safety of list_to_existing_atom with binary_to_term. ?binary_to_term will automatically create any atoms (as well as funs) that a remote sender wants. ?This is has necessitated writing custom protocol encoders / decoders, and makes Erlang's external binary term format incredibly useless. ?It would be very nice to add a version of binary_to_term that has an extra argument which contains options. ?This would generally useful to allow prohibiting creation of new atoms, prohibiting creation of funs / pids, and maybe even to specify backwards-compatible binary formats (making it easier to interoperate with older versions of Erlang). >>> >>> -- >>> Jayson Vantuyl >>> kagato@REDACTED >>> >>> >>> >>> >>> >>> >>> ________________________________________________________________ >>> 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 kagato@REDACTED Mon Jan 4 11:23:38 2010 From: kagato@REDACTED (Jayson Vantuyl) Date: Mon, 4 Jan 2010 02:23:38 -0800 Subject: [erlang-questions] binary_to_term and leaking atoms In-Reply-To: References: <6E7BA120-D842-4907-9A19-9E2602D7394A@souja.net> <9b08084c1001040017l4e7603c8lcb3dcc73415c3172@mail.gmail.com> Message-ID: This was exactly what I was thinking. As for naming the option, perhaps you should use "only_existing_atoms" just to make it look similar to list_to_existing_atom/1. Also, their docs should probably refer to each other, just for context. I would also want options to prohibit_funs and prohibit_pids. Both of these would be necessary to safely use binary_to_term with unsafe binaries. Anything else anyone can think of? As an alternative to adding options, you could also just have safe_binary_to_term/1 which prohibited funs, pids, and new atoms. Unless there are other compelling options, an option list might be overkill. I'd imagine that this will get used in a tight loop, so handling the lists for each call might also be a bit of an unnecessary performance hit (although, I find this unlikely). So, specifically, either: %% @spec safe_binary_to_term(binary()) -> term() %% @doc Limited form of binary_to_term which won't create funs, pids, or new atoms. %% To be used to limit danger of decoding untrusted external binaries. Or: %% @spec binary_to_term(binary(), [ only_existing_atoms | prohibit_pid | prohibit_fun | safe ]) -> term() %% @doc Same as binary_to_term/1, but with special decoding options. %% only_existing_atoms: prohibit creation of new atoms %% prohibit_pid: prohibits creation of pids %% prohibit_fun: prohibits creation of funs %% safe: same as above three options, useful when decoding binaries from untrusted sources Take your pick, but either one would make my world much easier. On Jan 4, 2010, at 1:54 AM, Kenneth Lundin wrote: > I think we will implement atom GC one day. We have discussed this > several times and there > are solutions with only small performance decrease (10% or maybe less). > It is a major thing to implement and we cannot prioritize this for now > and unknown when we can. > > Extended functionality in binary_to_term can be a good compromise in > the mean time. > The question is how it should work. > > Assume we introduce: > > binary_to_term(Bin,Options) > > What options should we have: > > 'no_new_atoms' could make the function crash with reason badarg if the > binary contains > encoded "new" non existing atoms > > or > > 'new_atoms_as_binaries' could translate "new" existing atoms to binaries > > etc. > > I think the first step is to define how the new function should work, > what suggestions do you have here? > > /Kenneth Erlang/OTP Ericsson > > On Mon, Jan 4, 2010 at 9:28 AM, Jayson Vantuyl wrote: >> On the up side, short atoms sound like a fantastic idea. On the down side, atom GC sounds like it could easily kill performance. I'd imagine that everything would have to stop when atoms were GC'd. Even if not, I'd also imagine it would be a large and invasive change. >> >> I don't suppose I could get a safe binary_to_term in the meantime? What if I submitted a patch? >> >> On Jan 4, 2010, at 12:17 AM, Joe Armstrong wrote: >> >>> The real problem is that we don't have garbage collection of atoms. >>> lists_to_exiting_atom is a hack to try and >>> get around this. >>> >>> Erlang was designed for an environment of trusted nodes so we never >>> worried about atom garbage collection. >>> The case for adding atom GC has never been compelling enough to do it. >>> >>> On a 64 bit machine the case for atoms seems weak - you could make a >>> new data type "short atoms" and >>> store them in 64 bits, long atoms could be on the local process heap >>> and not in the atom table, You could use some >>> smart pointer scheme to avoid unnecessary string comparisons when >>> comparing atoms ... >>> >>> /Joe >>> >>> >>> >>> On Mon, Jan 4, 2010 at 3:58 AM, Jayson Vantuyl wrote: >>>> I've been writing a lot of Erlang lately, and I feel like I'm missing something. >>>> >>>> Specifically, list_to_existing_atom is awesome for preventing atom leak; binary_to_term is great for easily building flexible network protocols; and {packet,N} makes framing the protocol a breeze. >>>> >>>> That said, I can't get the safety of list_to_existing_atom with binary_to_term. binary_to_term will automatically create any atoms (as well as funs) that a remote sender wants. This is has necessitated writing custom protocol encoders / decoders, and makes Erlang's external binary term format incredibly useless. It would be very nice to add a version of binary_to_term that has an extra argument which contains options. This would generally useful to allow prohibiting creation of new atoms, prohibiting creation of funs / pids, and maybe even to specify backwards-compatible binary formats (making it easier to interoperate with older versions of Erlang). >>>> >>>> -- >>>> Jayson Vantuyl >>>> kagato@REDACTED >>>> >>>> >>>> >>>> >>>> >>>> >>>> ________________________________________________________________ >>>> 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 kagato@REDACTED Mon Jan 4 11:29:22 2010 From: kagato@REDACTED (Jayson Vantuyl) Date: Mon, 4 Jan 2010 02:29:22 -0800 Subject: [erlang-questions] binary_to_term and leaking atoms In-Reply-To: References: <6E7BA120-D842-4907-9A19-9E2602D7394A@souja.net> <9b08084c1001040017l4e7603c8lcb3dcc73415c3172@mail.gmail.com> Message-ID: <7A385E7C-E8BB-40BC-B55B-D75547DC3C50@souja.net> After careful consideration, I may be able to tolerate funs and pids. I usually run the output of binary_to_term into a pattern match before using it, so I guess I could filter funs and pids there (but atoms would still be the main problem). Still, there's probably a use case for filtering them, but it shouldn't hold up handling the real problem (atom leaks). Thanks, On Jan 4, 2010, at 2:23 AM, Jayson Vantuyl wrote: > This was exactly what I was thinking. As for naming the option, perhaps you should use "only_existing_atoms" just to make it look similar to list_to_existing_atom/1. Also, their docs should probably refer to each other, just for context. I would also want options to prohibit_funs and prohibit_pids. Both of these would be necessary to safely use binary_to_term with unsafe binaries. Anything else anyone can think of? > > As an alternative to adding options, you could also just have safe_binary_to_term/1 which prohibited funs, pids, and new atoms. Unless there are other compelling options, an option list might be overkill. I'd imagine that this will get used in a tight loop, so handling the lists for each call might also be a bit of an unnecessary performance hit (although, I find this unlikely). > > So, specifically, either: > > %% @spec safe_binary_to_term(binary()) -> term() > %% @doc Limited form of binary_to_term which won't create funs, pids, or new atoms. > %% To be used to limit danger of decoding untrusted external binaries. > > Or: > > %% @spec binary_to_term(binary(), [ only_existing_atoms | prohibit_pid | prohibit_fun | safe ]) -> term() > %% @doc Same as binary_to_term/1, but with special decoding options. > %% only_existing_atoms: prohibit creation of new atoms > %% prohibit_pid: prohibits creation of pids > %% prohibit_fun: prohibits creation of funs > %% safe: same as above three options, useful when decoding binaries from untrusted sources > > Take your pick, but either one would make my world much easier. > > On Jan 4, 2010, at 1:54 AM, Kenneth Lundin wrote: > >> I think we will implement atom GC one day. We have discussed this >> several times and there >> are solutions with only small performance decrease (10% or maybe less). >> It is a major thing to implement and we cannot prioritize this for now >> and unknown when we can. >> >> Extended functionality in binary_to_term can be a good compromise in >> the mean time. >> The question is how it should work. >> >> Assume we introduce: >> >> binary_to_term(Bin,Options) >> >> What options should we have: >> >> 'no_new_atoms' could make the function crash with reason badarg if the >> binary contains >> encoded "new" non existing atoms >> >> or >> >> 'new_atoms_as_binaries' could translate "new" existing atoms to binaries >> >> etc. >> >> I think the first step is to define how the new function should work, >> what suggestions do you have here? >> >> /Kenneth Erlang/OTP Ericsson >> >> On Mon, Jan 4, 2010 at 9:28 AM, Jayson Vantuyl wrote: >>> On the up side, short atoms sound like a fantastic idea. On the down side, atom GC sounds like it could easily kill performance. I'd imagine that everything would have to stop when atoms were GC'd. Even if not, I'd also imagine it would be a large and invasive change. >>> >>> I don't suppose I could get a safe binary_to_term in the meantime? What if I submitted a patch? >>> >>> On Jan 4, 2010, at 12:17 AM, Joe Armstrong wrote: >>> >>>> The real problem is that we don't have garbage collection of atoms. >>>> lists_to_exiting_atom is a hack to try and >>>> get around this. >>>> >>>> Erlang was designed for an environment of trusted nodes so we never >>>> worried about atom garbage collection. >>>> The case for adding atom GC has never been compelling enough to do it. >>>> >>>> On a 64 bit machine the case for atoms seems weak - you could make a >>>> new data type "short atoms" and >>>> store them in 64 bits, long atoms could be on the local process heap >>>> and not in the atom table, You could use some >>>> smart pointer scheme to avoid unnecessary string comparisons when >>>> comparing atoms ... >>>> >>>> /Joe >>>> >>>> >>>> >>>> On Mon, Jan 4, 2010 at 3:58 AM, Jayson Vantuyl wrote: >>>>> I've been writing a lot of Erlang lately, and I feel like I'm missing something. >>>>> >>>>> Specifically, list_to_existing_atom is awesome for preventing atom leak; binary_to_term is great for easily building flexible network protocols; and {packet,N} makes framing the protocol a breeze. >>>>> >>>>> That said, I can't get the safety of list_to_existing_atom with binary_to_term. binary_to_term will automatically create any atoms (as well as funs) that a remote sender wants. This is has necessitated writing custom protocol encoders / decoders, and makes Erlang's external binary term format incredibly useless. It would be very nice to add a version of binary_to_term that has an extra argument which contains options. This would generally useful to allow prohibiting creation of new atoms, prohibiting creation of funs / pids, and maybe even to specify backwards-compatible binary formats (making it easier to interoperate with older versions of Erlang). >>>>> >>>>> -- >>>>> Jayson Vantuyl >>>>> kagato@REDACTED >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> ________________________________________________________________ >>>>> 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 >>> >>> > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From kiszl@REDACTED Mon Jan 4 11:35:40 2010 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Mon, 4 Jan 2010 11:35:40 +0100 (CET) Subject: [erlang-questions] binary_to_term and leaking atoms In-Reply-To: References: <6E7BA120-D842-4907-9A19-9E2602D7394A@souja.net> <9b08084c1001040017l4e7603c8lcb3dcc73415c3172@mail.gmail.com> Message-ID: <58065.194.237.142.17.1262601340.squirrel@localhost> Just to see this clearly: How can a pid or fun be dangerous? If you don't trust them, don't call them or send messages to them. > This was exactly what I was thinking. As for naming the option, perhaps > you should use "only_existing_atoms" just to make it look similar to > list_to_existing_atom/1. Also, their docs should probably refer to each > other, just for context. I would also want options to prohibit_funs and > prohibit_pids. Both of these would be necessary to safely use > binary_to_term with unsafe binaries. Anything else anyone can think of? > > As an alternative to adding options, you could also just have > safe_binary_to_term/1 which prohibited funs, pids, and new atoms. Unless > there are other compelling options, an option list might be overkill. I'd > imagine that this will get used in a tight loop, so handling the lists for > each call might also be a bit of an unnecessary performance hit (although, > I find this unlikely). > > So, specifically, either: > > %% @spec safe_binary_to_term(binary()) -> term() > %% @doc Limited form of binary_to_term which won't create funs, pids, or > new atoms. > %% To be used to limit danger of decoding untrusted external binaries. > > Or: > > %% @spec binary_to_term(binary(), [ only_existing_atoms | prohibit_pid | > prohibit_fun | safe ]) -> term() > %% @doc Same as binary_to_term/1, but with special decoding options. > %% only_existing_atoms: prohibit creation of new atoms > %% prohibit_pid: prohibits creation of pids > %% prohibit_fun: prohibits creation of funs > %% safe: same as above three options, useful when decoding binaries from > untrusted sources > > Take your pick, but either one would make my world much easier. > > On Jan 4, 2010, at 1:54 AM, Kenneth Lundin wrote: > >> I think we will implement atom GC one day. We have discussed this >> several times and there >> are solutions with only small performance decrease (10% or maybe less). >> It is a major thing to implement and we cannot prioritize this for now >> and unknown when we can. >> >> Extended functionality in binary_to_term can be a good compromise in >> the mean time. >> The question is how it should work. >> >> Assume we introduce: >> >> binary_to_term(Bin,Options) >> >> What options should we have: >> >> 'no_new_atoms' could make the function crash with reason badarg if the >> binary contains >> encoded "new" non existing atoms >> >> or >> >> 'new_atoms_as_binaries' could translate "new" existing atoms to binaries >> >> etc. >> >> I think the first step is to define how the new function should work, >> what suggestions do you have here? >> >> /Kenneth Erlang/OTP Ericsson >> >> On Mon, Jan 4, 2010 at 9:28 AM, Jayson Vantuyl wrote: >>> On the up side, short atoms sound like a fantastic idea. On the down >>> side, atom GC sounds like it could easily kill performance. I'd >>> imagine that everything would have to stop when atoms were GC'd. Even >>> if not, I'd also imagine it would be a large and invasive change. >>> >>> I don't suppose I could get a safe binary_to_term in the meantime? >>> What if I submitted a patch? >>> >>> On Jan 4, 2010, at 12:17 AM, Joe Armstrong wrote: >>> >>>> The real problem is that we don't have garbage collection of atoms. >>>> lists_to_exiting_atom is a hack to try and >>>> get around this. >>>> >>>> Erlang was designed for an environment of trusted nodes so we never >>>> worried about atom garbage collection. >>>> The case for adding atom GC has never been compelling enough to do it. >>>> >>>> On a 64 bit machine the case for atoms seems weak - you could make a >>>> new data type "short atoms" and >>>> store them in 64 bits, long atoms could be on the local process heap >>>> and not in the atom table, You could use some >>>> smart pointer scheme to avoid unnecessary string comparisons when >>>> comparing atoms ... >>>> >>>> /Joe >>>> >>>> >>>> >>>> On Mon, Jan 4, 2010 at 3:58 AM, Jayson Vantuyl >>>> wrote: >>>>> I've been writing a lot of Erlang lately, and I feel like I'm missing >>>>> something. >>>>> >>>>> Specifically, list_to_existing_atom is awesome for preventing atom >>>>> leak; binary_to_term is great for easily building flexible network >>>>> protocols; and {packet,N} makes framing the protocol a breeze. >>>>> >>>>> That said, I can't get the safety of list_to_existing_atom with >>>>> binary_to_term. binary_to_term will automatically create any atoms >>>>> (as well as funs) that a remote sender wants. This is has >>>>> necessitated writing custom protocol encoders / decoders, and makes >>>>> Erlang's external binary term format incredibly useless. It would be >>>>> very nice to add a version of binary_to_term that has an extra >>>>> argument which contains options. This would generally useful to >>>>> allow prohibiting creation of new atoms, prohibiting creation of funs >>>>> / pids, and maybe even to specify backwards-compatible binary formats >>>>> (making it easier to interoperate with older versions of Erlang). >>>>> >>>>> -- >>>>> Jayson Vantuyl >>>>> kagato@REDACTED >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> ________________________________________________________________ >>>>> 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 >>> >>> > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > > From bgustavsson@REDACTED Mon Jan 4 11:41:58 2010 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Mon, 4 Jan 2010 11:41:58 +0100 Subject: [erlang-questions] binary_to_term and leaking atoms In-Reply-To: References: <6E7BA120-D842-4907-9A19-9E2602D7394A@souja.net> <9b08084c1001040017l4e7603c8lcb3dcc73415c3172@mail.gmail.com> Message-ID: <6672d0161001040241r2dbbc238j22a328e21ee91da7@mail.gmail.com> On Mon, Jan 4, 2010 at 11:23 AM, Jayson Vantuyl wrote: > %% @spec binary_to_term(binary(), [ only_existing_atoms | prohibit_pid | prohibit_fun | safe ]) -> term() > %% @doc Same as binary_to_term/1, but with special decoding options. > %% ? only_existing_atoms: prohibit creation of new atoms > %% ? prohibit_pid: prohibits creation of pids > %% ? prohibit_fun: prohibits creation of funs > %% ? safe: same as above three options, useful when decoding binaries from untrusted sources I prefer this version, since it can be extended in the future. (For instance, to limit the size of the decoded term.) If you can submit a production-quality patch, this feature could make it into R13B04. Instructions for submitting patches are here: http://wiki.github.com/erlang/otp/submitting-patches While someone in the Erlang/OTP could implement this feature, it is not likely to happen in time for the R13B04 release. -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From kagato@REDACTED Mon Jan 4 12:01:57 2010 From: kagato@REDACTED (Jayson Vantuyl) Date: Mon, 4 Jan 2010 03:01:57 -0800 Subject: [erlang-questions] binary_to_term and leaking atoms In-Reply-To: <58065.194.237.142.17.1262601340.squirrel@localhost> References: <6E7BA120-D842-4907-9A19-9E2602D7394A@souja.net> <9b08084c1001040017l4e7603c8lcb3dcc73415c3172@mail.gmail.com> <58065.194.237.142.17.1262601340.squirrel@localhost> Message-ID: Yeah, I thought of that after sending it (and followed up cryptically). When data gets passed around, I generally don't expect it to be properly validated, so I was being a bit paranoid. On Jan 4, 2010, at 2:35 AM, Zoltan Lajos Kis wrote: > Just to see this clearly: > How can a pid or fun be dangerous? If you don't trust them, don't call > them or send messages to them. > >> This was exactly what I was thinking. As for naming the option, perhaps >> you should use "only_existing_atoms" just to make it look similar to >> list_to_existing_atom/1. Also, their docs should probably refer to each >> other, just for context. I would also want options to prohibit_funs and >> prohibit_pids. Both of these would be necessary to safely use >> binary_to_term with unsafe binaries. Anything else anyone can think of? >> >> As an alternative to adding options, you could also just have >> safe_binary_to_term/1 which prohibited funs, pids, and new atoms. Unless >> there are other compelling options, an option list might be overkill. I'd >> imagine that this will get used in a tight loop, so handling the lists for >> each call might also be a bit of an unnecessary performance hit (although, >> I find this unlikely). >> >> So, specifically, either: >> >> %% @spec safe_binary_to_term(binary()) -> term() >> %% @doc Limited form of binary_to_term which won't create funs, pids, or >> new atoms. >> %% To be used to limit danger of decoding untrusted external binaries. >> >> Or: >> >> %% @spec binary_to_term(binary(), [ only_existing_atoms | prohibit_pid | >> prohibit_fun | safe ]) -> term() >> %% @doc Same as binary_to_term/1, but with special decoding options. >> %% only_existing_atoms: prohibit creation of new atoms >> %% prohibit_pid: prohibits creation of pids >> %% prohibit_fun: prohibits creation of funs >> %% safe: same as above three options, useful when decoding binaries from >> untrusted sources >> >> Take your pick, but either one would make my world much easier. >> >> On Jan 4, 2010, at 1:54 AM, Kenneth Lundin wrote: >> >>> I think we will implement atom GC one day. We have discussed this >>> several times and there >>> are solutions with only small performance decrease (10% or maybe less). >>> It is a major thing to implement and we cannot prioritize this for now >>> and unknown when we can. >>> >>> Extended functionality in binary_to_term can be a good compromise in >>> the mean time. >>> The question is how it should work. >>> >>> Assume we introduce: >>> >>> binary_to_term(Bin,Options) >>> >>> What options should we have: >>> >>> 'no_new_atoms' could make the function crash with reason badarg if the >>> binary contains >>> encoded "new" non existing atoms >>> >>> or >>> >>> 'new_atoms_as_binaries' could translate "new" existing atoms to binaries >>> >>> etc. >>> >>> I think the first step is to define how the new function should work, >>> what suggestions do you have here? >>> >>> /Kenneth Erlang/OTP Ericsson >>> >>> On Mon, Jan 4, 2010 at 9:28 AM, Jayson Vantuyl wrote: >>>> On the up side, short atoms sound like a fantastic idea. On the down >>>> side, atom GC sounds like it could easily kill performance. I'd >>>> imagine that everything would have to stop when atoms were GC'd. Even >>>> if not, I'd also imagine it would be a large and invasive change. >>>> >>>> I don't suppose I could get a safe binary_to_term in the meantime? >>>> What if I submitted a patch? >>>> >>>> On Jan 4, 2010, at 12:17 AM, Joe Armstrong wrote: >>>> >>>>> The real problem is that we don't have garbage collection of atoms. >>>>> lists_to_exiting_atom is a hack to try and >>>>> get around this. >>>>> >>>>> Erlang was designed for an environment of trusted nodes so we never >>>>> worried about atom garbage collection. >>>>> The case for adding atom GC has never been compelling enough to do it. >>>>> >>>>> On a 64 bit machine the case for atoms seems weak - you could make a >>>>> new data type "short atoms" and >>>>> store them in 64 bits, long atoms could be on the local process heap >>>>> and not in the atom table, You could use some >>>>> smart pointer scheme to avoid unnecessary string comparisons when >>>>> comparing atoms ... >>>>> >>>>> /Joe >>>>> >>>>> >>>>> >>>>> On Mon, Jan 4, 2010 at 3:58 AM, Jayson Vantuyl >>>>> wrote: >>>>>> I've been writing a lot of Erlang lately, and I feel like I'm missing >>>>>> something. >>>>>> >>>>>> Specifically, list_to_existing_atom is awesome for preventing atom >>>>>> leak; binary_to_term is great for easily building flexible network >>>>>> protocols; and {packet,N} makes framing the protocol a breeze. >>>>>> >>>>>> That said, I can't get the safety of list_to_existing_atom with >>>>>> binary_to_term. binary_to_term will automatically create any atoms >>>>>> (as well as funs) that a remote sender wants. This is has >>>>>> necessitated writing custom protocol encoders / decoders, and makes >>>>>> Erlang's external binary term format incredibly useless. It would be >>>>>> very nice to add a version of binary_to_term that has an extra >>>>>> argument which contains options. This would generally useful to >>>>>> allow prohibiting creation of new atoms, prohibiting creation of funs >>>>>> / pids, and maybe even to specify backwards-compatible binary formats >>>>>> (making it easier to interoperate with older versions of Erlang). >>>>>> >>>>>> -- >>>>>> Jayson Vantuyl >>>>>> kagato@REDACTED >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> ________________________________________________________________ >>>>>> 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 >>>> >>>> >> >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> >> > > From clist@REDACTED Mon Jan 4 13:12:36 2010 From: clist@REDACTED (Angel Alvarez) Date: Mon, 4 Jan 2010 13:12:36 +0100 Subject: [erlang-questions] OTP Supervisor Question In-Reply-To: References: Message-ID: <201001041312.37078.clist@uah.es> El Lunes, 4 de Enero de 2010 04:12:40 Chandru escribi?: > 2010/1/4 Jayson Vantuyl > > > If I'm an OTP-style process (say, a gen_server), and I want to know who my > > parent is (say, a supervisor), is this possible using any API, or do I need > > to pass in the Parent explicitly? Is using supervisor:get_child a good way > > to find a process's sibling? Would it be better to start a single > > gen_server and have it use normal, linked processes? > > > > I think using supervisor:which_children(Sup_ref) is quite reasonable. But > for this, you'll have to store the process id of the supervisor in all the > supervised processes. > > > > > > I have a certain automaton that is represented as a group of three > > processes. These processes coordinate and there may be multiple automata on > > a single node. I want to put them under a single supervisor, but I'm > > struggling a bit to get them to all know each other's PIds without adding > > code to the supervisor (which is bad, right?) and without having to locally > > register them (which would prevent multiple automata per node). > > > > As far as I understand, you'll need a two level supervision tree. One > supervisor supervising each set of three processes, and those supervisors in > turn under a top level supervisor. That way, when any of a set of three > processes invoke supervisor:which_children(Sup_ref) on its supervisor, it'll > only see that set and nothing else. > > Chandru > Try aplication docs, maybe thereis some function to traverse aplication supervisors... -- Este correo no tiene dibujos. Las formas extra?as en la pantalla son letras. __________________________________________ Clist UAH a.k.a Angel __________________________________________ El Universo es una de esas cosas que sucede de vez en cuando... From kiszl@REDACTED Mon Jan 4 13:29:27 2010 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Mon, 4 Jan 2010 13:29:27 +0100 (CET) Subject: [erlang-questions] OTP Supervisor Question In-Reply-To: <201001041312.37078.clist@uah.es> References: <201001041312.37078.clist@uah.es> Message-ID: <55202.194.237.142.6.1262608167.squirrel@localhost> > El Lunes, 4 de Enero de 2010 04:12:40 Chandru escribi??: >> 2010/1/4 Jayson Vantuyl >> >> > If I'm an OTP-style process (say, a gen_server), and I want to know >> who my >> > parent is (say, a supervisor), is this possible using any API, or do I >> need >> > to pass in the Parent explicitly? Is using supervisor:get_child a >> good way >> > to find a process's sibling? Would it be better to start a single >> > gen_server and have it use normal, linked processes? >> > >> >> I think using supervisor:which_children(Sup_ref) is quite reasonable. >> But >> for this, you'll have to store the process id of the supervisor in all >> the >> supervised processes. >> >> >> > >> > I have a certain automaton that is represented as a group of three >> > processes. These processes coordinate and there may be multiple >> automata on >> > a single node. I want to put them under a single supervisor, but I'm >> > struggling a bit to get them to all know each other's PIds without >> adding >> > code to the supervisor (which is bad, right?) and without having to >> locally >> > register them (which would prevent multiple automata per node). >> > >> >> As far as I understand, you'll need a two level supervision tree. One >> supervisor supervising each set of three processes, and those >> supervisors in >> turn under a top level supervisor. That way, when any of a set of three >> processes invoke supervisor:which_children(Sup_ref) on its supervisor, >> it'll >> only see that set and nothing else. >> >> Chandru >> > Try aplication docs, maybe thereis some function to traverse aplication > supervisors... > > > -- > Este correo no tiene dibujos. Las formas extra??as en la pantalla son > letras. > __________________________________________ > > Clist UAH a.k.a Angel > __________________________________________ > El Universo es una de esas cosas que sucede de vez en cuando... > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > > Something similar is implemented in process_info:do_get_processes/3 in appmon. From ulf.wiger@REDACTED Mon Jan 4 13:35:01 2010 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Mon, 04 Jan 2010 13:35:01 +0100 Subject: [erlang-questions] OTP Supervisor Question In-Reply-To: References: Message-ID: <4B41E075.1070108@erlang-consulting.com> Chandru wrote: > 2010/1/4 Jayson Vantuyl > >> If I'm an OTP-style process (say, a gen_server), and I want to know who my >> parent is (say, a supervisor), is this possible using any API, or do I need >> to pass in the Parent explicitly? Is using supervisor:get_child a good way >> to find a process's sibling? Would it be better to start a single >> gen_server and have it use normal, linked processes? >> > > I think using supervisor:which_children(Sup_ref) is quite reasonable. But > for this, you'll have to store the process id of the supervisor in all the > supervised processes. The supervisor PID will be the head of get('$ancestors'), provided the child is started using proc_lib (which is true for all OTP behaviors). Eshell V5.6.5 (abort with ^G) 1> proc_lib:spawn(fun() -> io:fwrite(">> ~p~n", [get()]) end). >> [{'$ancestors',[<0.30.0>]},{'$initial_call',{erl_eval,'-expr/5-fun-1-',0}}] <0.32.0> 2> self(). <0.30.0> 3> proc_lib:spawn(fun() -> io:fwrite(">> Parent is ~p~n", [hd(get('$ancestors'))]) end). >> Parent is <0.30.0> <0.35.0> This is not documented, but has been stable since the dawn of OTP, and is unlikely to change anytime soon. Of course, the proc_lib could export some of the helper functions, such as get_ancestors/[0,1] or my_info/0... BR, Ulf W -- Ulf Wiger CTO, Erlang Solutions Ltd, formerly Erlang Training & Consulting Ltd http://www.erlang-solutions.com --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From dima@REDACTED Mon Jan 4 14:01:50 2010 From: dima@REDACTED (Dmitry Vasiliev) Date: Mon, 04 Jan 2010 16:01:50 +0300 Subject: Announce: erlport 0.3 released Message-ID: <4B41E6BE.70004@hlabs.spb.ru> I'm happy to announce that erlport 0.3 has been released. What is it? ----------- The erlport Python library implements Erlang external term format and Erlang port protocol for easier integration of Python and Erlang. For more information please visit the erlport web site at http://pypi.python.org/pypi/erlport/ -- Dmitry Vasiliev http://hlabs.spb.ru http://twitter.com/hdima From kagato@REDACTED Mon Jan 4 15:51:06 2010 From: kagato@REDACTED (Jayson Vantuyl) Date: Mon, 4 Jan 2010 06:51:06 -0800 Subject: Running Test Suites and Generating Docs Message-ID: <861D3D73-4F84-4304-8E7A-4FDBAA39D854@souja.net> Hello all, I use edoc and common_test in my code, but I'm a little lost at how to generate docs and run the tests that come with OTP. How do I run the test suites that come with OTP? How do I generate the OTP docs? i can't seem to find any information in the build tree. Thanks, -- Jayson Vantuyl kagato@REDACTED From bgustavsson@REDACTED Mon Jan 4 17:12:24 2010 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Mon, 4 Jan 2010 17:12:24 +0100 Subject: [erlang-questions] Running Test Suites and Generating Docs In-Reply-To: <861D3D73-4F84-4304-8E7A-4FDBAA39D854@souja.net> References: <861D3D73-4F84-4304-8E7A-4FDBAA39D854@souja.net> Message-ID: <6672d0161001040812o21648218r799fdad9defb1528@mail.gmail.com> On Mon, Jan 4, 2010 at 3:51 PM, Jayson Vantuyl wrote: > How do I run the test suites that come with OTP? See http://wiki.github.com/erlang/otp/running-tests > How do I generate the OTP docs? i can't seem to find any information in the build tree. cd to the source for the documentation for an application/sub-system, for example cd erts/doc/src and then do make html -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From hd2010@REDACTED Mon Jan 4 19:44:58 2010 From: hd2010@REDACTED (Henning Diedrich) Date: Mon, 04 Jan 2010 19:44:58 +0100 Subject: Telnet Client Message-ID: <4B42372A.5020107@eonblast.com> Hello list, could someone point me to the Erlang source of a simple telnet client, complete with prompt? The intention is to start from there to make it into a client to talk in and test a custom protocol. Thanks! Henning From michal.ptaszek@REDACTED Mon Jan 4 19:56:14 2010 From: michal.ptaszek@REDACTED (Michal Ptaszek) Date: Mon, 4 Jan 2010 18:56:14 +0000 (GMT) Subject: erl_nif improvements Message-ID: <1572593381.13991262631374263.JavaMail.root@zimbra> Hi all, First of all I would like to say a big "thank you" to all the people who decided to introduce NIFs into Erlang. Together with the real-time low-level (i.e. assembly) programming it was on my 'most-wanted' list here. Recently I am playing with the Erlang-Python bindings (they are still in a very alpha-version but they are working well - called Pytherl and available at http://bit.ly/7HZBAm) which should allow users to reuse Python libraries in Erlang projects. However, using the very narrow NIF exports it is a tedious task to play with. Moreover I have seen a lot of changes in the official github repository (e.g. added enif_get_double or enif_get_tuple). However, I would like to ask if there are any plans to extend the list of the C functions with e.g.: - enif_get_atom/2 (returning const 'char *') - enif_get/set_tuple_element/4 - enif_make_tuple/list/(ErlNifEnv env, ERL_NIF_TERM erl_term, int count, ERL_NIF_TERM **elements) (not a variadic versions. As far as I read the NIFs implementation it should be a very simple change/copy-paste in the code) Best regards, Michal --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From kiszl@REDACTED Mon Jan 4 22:49:04 2010 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Mon, 04 Jan 2010 22:49:04 +0100 Subject: Compiler to warn on used underscore-variables Message-ID: <4B426250.60301@tmit.bme.hu> Hello all, Currently the compiler outputs a warning if a variable is only used once. The "standard" way to suppress this warning is to put an underscore in front of the variable name. As a result, an underscore-variable in source codes gives us (at least for me) the false notion that it is not a real variable, but only a means to enhance code readability. However the compiler treats them just like ordinary variables, resulting in unexpected (i.e. most astonishing ;-)) no match exceptions. My question is: what is your opinion about / is it possible to modify the compiler so that it outputs a warning if an underscore-variable is used (not unused) in the code ? Thanks, Zoltan. From rvirding@REDACTED Mon Jan 4 23:55:26 2010 From: rvirding@REDACTED (Robert Virding) Date: Mon, 4 Jan 2010 23:55:26 +0100 Subject: [erlang-questions] Compiler to warn on used underscore-variables In-Reply-To: <4B426250.60301@tmit.bme.hu> References: <4B426250.60301@tmit.bme.hu> Message-ID: <3dbc6d1c1001041455k63a4baefw32e9fa55794f36ea@mail.gmail.com> 2010/1/4 Zoltan Lajos Kis > Hello all, > > Currently the compiler outputs a warning if a variable is only used once. > The "standard" way to suppress this warning is to put an underscore in front > of the variable name. > As a result, an underscore-variable in source codes gives us (at least for > me) the false notion that it is not a real variable, but only a means to > enhance code readability. > However the compiler treats them just like ordinary variables, resulting in > unexpected (i.e. most astonishing ;-)) no match exceptions. > They *ARE* ordinary variables! All variables are variables irrespective of whether there name starts with a capital letter or an "_". The *ONLY* exception is the variable '_' which is the anonymous or don't care variable. It always matches and is never bound, which means it can only be used in patterns. Or to be more correct, if it used in a term then the compiler will complain about an unbound variable. The special treatment of variables starting with "_" is a feature/hack in the compiler to get around its feature/hack of warning about variables which are never used. It was included to allow users to to give names to variables they don't intend to use for documentation purposes. I personally don't like and never use them, if I don't want the value I use '_'. My question is: what is your opinion about / is it possible to modify the > compiler so that it outputs a warning if an underscore-variable is used (not > unused) in the code ? > It is of course possible but I thinkt that would be even more counter-intuitive. Robert From tony@REDACTED Tue Jan 5 00:02:03 2010 From: tony@REDACTED (Tony Arcieri) Date: Mon, 4 Jan 2010 16:02:03 -0700 Subject: [erlang-questions] Compiler to warn on used underscore-variables In-Reply-To: <3dbc6d1c1001041455k63a4baefw32e9fa55794f36ea@mail.gmail.com> References: <4B426250.60301@tmit.bme.hu> <3dbc6d1c1001041455k63a4baefw32e9fa55794f36ea@mail.gmail.com> Message-ID: On Mon, Jan 4, 2010 at 3:55 PM, Robert Virding wrote: > They *ARE* ordinary variables! All variables are variables irrespective of > whether there name starts with a capital letter or an "_". The *ONLY* > exception is the variable '_' > This was a really interesting discovery writing Reia, as I soon found out the need for variables to begin with a capital letter is solely an effect of the parser, and I can create a language with lower case variable names and the Erlang compiler has no issue with them. -- Tony Arcieri Medioh! A Kudelski Brand From rvirding@REDACTED Tue Jan 5 00:22:04 2010 From: rvirding@REDACTED (Robert Virding) Date: Tue, 5 Jan 2010 00:22:04 +0100 Subject: [erlang-questions] Compiler to warn on used underscore-variables In-Reply-To: References: <4B426250.60301@tmit.bme.hu> <3dbc6d1c1001041455k63a4baefw32e9fa55794f36ea@mail.gmail.com> Message-ID: <3dbc6d1c1001041522m5f733f96q34f9ba595b7f110e@mail.gmail.com> 2010/1/5 Tony Arcieri > On Mon, Jan 4, 2010 at 3:55 PM, Robert Virding wrote: > >> They *ARE* ordinary variables! All variables are variables irrespective of >> whether there name starts with a capital letter or an "_". The *ONLY* >> exception is the variable '_' >> > > This was a really interesting discovery writing Reia, as I soon found out > the need for variables to begin with a capital letter is solely an effect of > the parser, and I can create a language with lower case variable names and > the Erlang compiler has no issue with them. > No, internally the compiler doesn't care what the name of a variable is as long as it is tagged as a variable in the abstract syntax. It is the lint pass of the compiler which has some knowledge of variables names, whether they start with "_" or not, and issues warnings about their use. You can start all variables with an "_" and keep the compiler quiet. Or use an option. Robert From thomasl_erlang@REDACTED Tue Jan 5 01:11:23 2010 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Mon, 4 Jan 2010 16:11:23 -0800 (PST) Subject: [erlang-questions] binary_to_term and leaking atoms In-Reply-To: References: <6E7BA120-D842-4907-9A19-9E2602D7394A@souja.net> <9b08084c1001040017l4e7603c8lcb3dcc73415c3172@mail.gmail.com> Message-ID: <103577.64659.qm@web111402.mail.gq1.yahoo.com> ----- Original Message ---- > On the down side, atom > GC sounds like it could easily kill performance. I'd imagine that everything > would have to stop when atoms were GC'd. In my opinion, full stops are probably not needed (well, hardly ever). I furthermore think the overhead can be low, e.g., normally not noticeable compared to today, though there are currently no real numbers to back that belief up. (see http://portal.acm.org/citation.cfm?id=1088369 for details) > Even if not, I'd also imagine it would > be a large and invasive change. The atom GC described above would as far as I can see mainly affect scheduling, code loading and regular garbage collection. But regardless of invasiveness, atom GC plugs a hole that leads to trouble (as we can see on this list). I think it's worthwhile. Best, Thomas From maruthavanan_s@REDACTED Tue Jan 5 06:25:57 2010 From: maruthavanan_s@REDACTED (maruthavanan s) Date: Tue, 5 Jan 2010 00:25:57 -0500 Subject: [erlang-questions] Installation error In-Reply-To: References: ,<45B5AEB2-ABA6-4CB9-B6BB-166E3B02AB8D@souja.net>,, Message-ID: Hi, Thanks a lot for your support, Still unsuccessful :( Please find the error we received when we did ./configure command checking for long long... yes checking size of long long... 8 checking if we should add -fno-tree-copyrename to CFLAGS for computed gotos to work properly... yes checking for broken gcc-4.3.0 compiler... yes configure: error: This gcc miscompiles the Erlang runtime system; please use a different version configure: error: /bin/sh '/usr/symbiotic/otp_src_R13B03/erts/configure' failed for erts Thanks, marutha > Date: Mon, 4 Jan 2010 10:09:57 +0100 > From: nick@REDACTED > To: vasilij.savin@REDACTED > CC: maruthavanan_s@REDACTED; erlang-questions@REDACTED > Subject: Re: [erlang-questions] Installation error > > > Hello! > > Or even better - R13B03 (http://www.erlang.org/download.html). I assume > that R13B02 was a typo ;-) > > Best Regards, > > Niclas @ Erlang/OP > > > On Mon, 4 Jan 2010, Vasilij Savin wrote: > > > Also, do you use package manager or manual install. > > > > Finally, I would recommend trying latest erlang version (R13B02), unless it > > is specifically required to use previous one. > > > > Regards, > > Vasilij Savin > > > > > > On Mon, Jan 4, 2010 at 10:29 AM, Jayson Vantuyl wrote: > > > >> I see that ld failed, but I can't tell what the actual error was. Can you > >> give us more error text? Perhaps something involving a missing symbol? > >> > >> On Jan 4, 2010, at 12:08 AM, maruthavanan s wrote: > >> > >>> > >>> Hi, > >>> > >>> I am using Fedora Core 9 > >>> > >>> > >>> > >>> kernel version: 2.6.25-14.fc9.i686gcc > >>> version 4.3.0 20080428 (Red Hat 4.3.0-8) (GCC) > >>> > >>> java version "1.6.0" > >>> When I tried installing Erlang R12-B1 when i try to make, I get the > >> following > >>> > >>> > >>> collect2: > >>> ld returned 1 exit status > >>> > >>> make[3]: > >>> *** [/usr/symbiotic/otp_src_R12B-1/bin/i686-pc-linux-gnu/beam.smp] Error > >> 1 > >>> > >>> make[3]: > >>> Leaving directory `/usr/symbiotic/otp_src_R12B-1/erts/emulator' > >>> > >>> make[2]: > >>> *** [opt] Error 2 > >>> > >>> make[2]: > >>> Leaving directory `/usr/symbiotic/otp_src_R12B-1/erts/emulator' > >>> > >>> make[1]: > >>> *** [smp] Error 2 > >>> > >>> make[1]: > >>> Leaving directory `/usr/symbiotic/otp_src_R12B-1/erts' > >>> > >>> make: > >>> *** [emulator] Error 2 > >>> > >>> > >>> Appreciate your help. > >>> > >>> > >>> > >>> Regards,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 zerthurd@REDACTED Tue Jan 5 07:02:25 2010 From: zerthurd@REDACTED (Maxim Treskin) Date: Tue, 5 Jan 2010 12:02:25 +0600 Subject: [erlang-questions] erlang:exit/1 eats lots of CPU time Message-ID: Hello I have tested software with Eprof. eprof:analyse() prints log which contains following strings: ****** Process <0.229.0> -- 12 % of profiled time *** erlang:exit/1 1 99 % Erlang node whith this process really eats CPU time, so it is not a some bug of eprof. May be it is due to garbage collection of process data on exit? Increasing of min_heap_size up to value which really used by process has no effect. How I can decrease CPU time consumption on exit for this process? Thank you -- Maxim Treskin From egil@REDACTED Tue Jan 5 08:37:39 2010 From: egil@REDACTED (=?ISO-8859-1?Q?Bj=F6rn-Egil_Dahlberg?=) Date: Tue, 05 Jan 2010 08:37:39 +0100 Subject: [erlang-questions] Installation error In-Reply-To: References: ,<45B5AEB2-ABA6-4CB9-B6BB-166E3B02AB8D@souja.net>,, Message-ID: <4B42EC43.5010500@erix.ericsson.se> Hi, GCC version 4.3.0 is considered broken in our eyes. Please use a later version, for instance gcc v4.3.2. Regards, Bj?rn-Egil Erlang/OTP maruthavanan s wrote: > Hi, > > Thanks a lot for your support, > > Still unsuccessful :( > > > Please > find the error we received when we did ./configure command > > > > checking > for long long... yes > > checking > size of long long... 8 > > checking > if we should add -fno-tree-copyrename to CFLAGS for computed gotos to work > properly... yes > > checking > for broken gcc-4.3.0 compiler... yes > > configure: > error: This gcc miscompiles the Erlang runtime system; please use a different > version > > configure: > error: /bin/sh '/usr/symbiotic/otp_src_R13B03/erts/configure' failed for erts > > > Thanks, > marutha > >> Date: Mon, 4 Jan 2010 10:09:57 +0100 >> From: nick@REDACTED >> To: vasilij.savin@REDACTED >> CC: maruthavanan_s@REDACTED; erlang-questions@REDACTED >> Subject: Re: [erlang-questions] Installation error >> >> >> Hello! >> >> Or even better - R13B03 (http://www.erlang.org/download.html). I assume >> that R13B02 was a typo ;-) >> >> Best Regards, >> >> Niclas @ Erlang/OP >> >> >> On Mon, 4 Jan 2010, Vasilij Savin wrote: >> >>> Also, do you use package manager or manual install. >>> >>> Finally, I would recommend trying latest erlang version (R13B02), unless it >>> is specifically required to use previous one. >>> >>> Regards, >>> Vasilij Savin >>> >>> >>> On Mon, Jan 4, 2010 at 10:29 AM, Jayson Vantuyl wrote: >>> >>>> I see that ld failed, but I can't tell what the actual error was. Can you >>>> give us more error text? Perhaps something involving a missing symbol? >>>> >>>> On Jan 4, 2010, at 12:08 AM, maruthavanan s wrote: >>>> >>>>> Hi, >>>>> >>>>> I am using Fedora Core 9 >>>>> >>>>> >>>>> >>>>> kernel version: 2.6.25-14.fc9.i686gcc >>>>> version 4.3.0 20080428 (Red Hat 4.3.0-8) (GCC) >>>>> >>>>> java version "1.6.0" >>>>> When I tried installing Erlang R12-B1 when i try to make, I get the >>>> following >>>>> >>>>> collect2: >>>>> ld returned 1 exit status >>>>> >>>>> make[3]: >>>>> *** [/usr/symbiotic/otp_src_R12B-1/bin/i686-pc-linux-gnu/beam.smp] Error >>>> 1 >>>>> make[3]: >>>>> Leaving directory `/usr/symbiotic/otp_src_R12B-1/erts/emulator' >>>>> >>>>> make[2]: >>>>> *** [opt] Error 2 >>>>> >>>>> make[2]: >>>>> Leaving directory `/usr/symbiotic/otp_src_R12B-1/erts/emulator' >>>>> >>>>> make[1]: >>>>> *** [smp] Error 2 >>>>> >>>>> make[1]: >>>>> Leaving directory `/usr/symbiotic/otp_src_R12B-1/erts' >>>>> >>>>> make: >>>>> *** [emulator] Error 2 >>>>> >>>>> >>>>> Appreciate your help. >>>>> >>>>> >>>>> >>>>> Regards,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 kiszl@REDACTED Tue Jan 5 09:16:01 2010 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Tue, 5 Jan 2010 09:16:01 +0100 (CET) Subject: [erlang-questions] Compiler to warn on used underscore-variables In-Reply-To: <3dbc6d1c1001041455k63a4baefw32e9fa55794f36ea@mail.gmail.com> References: <4B426250.60301@tmit.bme.hu> <3dbc6d1c1001041455k63a4baefw32e9fa55794f36ea@mail.gmail.com> Message-ID: <32645.194.88.55.211.1262679361.squirrel@localhost> > 2010/1/4 Zoltan Lajos Kis > >> Hello all, >> >> Currently the compiler outputs a warning if a variable is only used >> once. >> The "standard" way to suppress this warning is to put an underscore in >> front >> of the variable name. >> As a result, an underscore-variable in source codes gives us (at least >> for >> me) the false notion that it is not a real variable, but only a means to >> enhance code readability. >> However the compiler treats them just like ordinary variables, resulting >> in >> unexpected (i.e. most astonishing ;-)) no match exceptions. >> > > They *ARE* ordinary variables! All variables are variables irrespective of > whether there name starts with a capital letter or an "_". The *ONLY* > exception is the variable '_' which is the anonymous or don't care > variable. > It always matches and is never bound, which means it can only be used in > patterns. Or to be more correct, if it used in a term then the compiler > will > complain about an unbound variable. > > The special treatment of variables starting with "_" is a feature/hack in > the compiler to get around its feature/hack of warning about variables > which > are never used. It was included to allow users to to give names to > variables > they don't intend to use for documentation purposes. I personally don't > like > and never use them, if I don't want the value I use '_'. > > My question is: what is your opinion about / is it possible to modify the >> compiler so that it outputs a warning if an underscore-variable is used >> (not >> unused) in the code ? >> > > It is of course possible but I thinkt that would be even more > counter-intuitive. > > Robert > I understand that they are ordinary variables. But I am certain that all the _Var variables I have seen so far were named so in order to indicate that they are intentionally unused, and not because of some strange naming habit. I also understand that many compiler warnings (unused variable, wrong no. of args in format call, etc.) are output because there is a clear sign of a (semantic) mistake and not because of the source code being invalid. So I believe that the current behavior of not warning about a most probable mistake with _Var variables is the counter-intuitive one. Anyway, such a change would only have a negative effect on those who purposefully use such variable names for "ordinary variables". Would not affect those who only use the anonymous variable, and would help those using these variables as I described. Zoltan. From tony@REDACTED Tue Jan 5 09:34:10 2010 From: tony@REDACTED (Tony Arcieri) Date: Tue, 5 Jan 2010 01:34:10 -0700 Subject: [erlang-questions] Compiler to warn on used underscore-variables In-Reply-To: <32645.194.88.55.211.1262679361.squirrel@localhost> References: <4B426250.60301@tmit.bme.hu> <3dbc6d1c1001041455k63a4baefw32e9fa55794f36ea@mail.gmail.com> <32645.194.88.55.211.1262679361.squirrel@localhost> Message-ID: 2010/1/5 Zoltan Lajos Kis > I also understand that many compiler warnings (unused variable, wrong no. > of args in format call, etc.) are output because there is a clear sign of > a (semantic) mistake and not because of the source code being invalid. > So I believe that the current behavior of not warning about a most > probable mistake with _Var variables is the counter-intuitive one. > Along with single assignment there exists a whole class of errors where you may mistakenly use a previously bound variable in a pattern intending to use an unbound one. This has nothing to do with a '_' prefix on them at all, rather it's simply a class of errors that exist with single assignment and pattern matching. There is no general solution to this problem either, any more than there is a general solution to accidently destructively rebinding a variable then assuming you were referencing a previous version in languages that support destructive assignment. I'm not sure what alternative you're proposing. Would you prefer all variables prefixed with an underscore have the same semantics as '_'? No compiler is going to be able to think for you. -- Tony Arcieri Medioh! A Kudelski Brand From kostis@REDACTED Tue Jan 5 09:43:35 2010 From: kostis@REDACTED (Kostis Sagonas) Date: Tue, 05 Jan 2010 10:43:35 +0200 Subject: [erlang-questions] Compiler to warn on used underscore-variables In-Reply-To: <32645.194.88.55.211.1262679361.squirrel@localhost> References: <4B426250.60301@tmit.bme.hu> <3dbc6d1c1001041455k63a4baefw32e9fa55794f36ea@mail.gmail.com> <32645.194.88.55.211.1262679361.squirrel@localhost> Message-ID: <4B42FBB7.1000902@cs.ntua.gr> Zoltan Lajos Kis wrote: >>> Currently the compiler outputs a warning if a variable is only used >>> once. >>> The "standard" way to suppress this warning is to put an underscore in >>> front >>> of the variable name. >>> As a result, an underscore-variable in source codes gives us (at least >>> for >>> me) the false notion that it is not a real variable, but only a means to >>> enhance code readability. >>> However the compiler treats them just like ordinary variables, resulting >>> in >>> unexpected (i.e. most astonishing ;-)) no match exceptions. >>> >> They *ARE* ordinary variables! All variables are variables irrespective of >> whether there name starts with a capital letter or an "_". The *ONLY* >> exception is the variable '_' which is the anonymous or don't care >> variable. >> It always matches and is never bound, which means it can only be used in >> patterns. Or to be more correct, if it used in a term then the compiler >> will complain about an unbound variable. >> >> The special treatment of variables starting with "_" is a feature/hack in >> the compiler to get around its feature/hack of warning about variables >> which >> are never used. It was included to allow users to to give names to >> variables >> they don't intend to use for documentation purposes. I personally don't >> like and never use them, if I don't want the value I use '_'. >> >>> My question is: what is your opinion about / is it possible to modify the >>> compiler so that it outputs a warning if an underscore-variable is used >>> (not >>> unused) in the code ? >>> >> It is of course possible but I thinkt that would be even more >> counter-intuitive. >> >> Robert >> > > I understand that they are ordinary variables. But I am certain that all > the _Var variables I have seen so far were named so in order to indicate > that they are intentionally unused, and not because of some strange naming > habit. Well, your statement depends on the code that you've seen, but my experience is different. We often use the following coding convention. We define a macro that outputs some debugging information: -ifdef(DEBUG). -define(debug(Str, Vars), io:format(Str, Vars)). -else. -define(debug(Str, Vars), ok). -endif. and use it in code that looks as follows: foo(....) -> case do_something(...) of {X,Y,Z} -> ... _Other -> ?debug("Strange: do_something returned ~p\n", [_Other]), .... end. We want the compiler to be silent about _Other being unused when not debugging and use _Other as an ordinary variable when debugging is on. We definitely do not want the compiler to be warning for used underscore-starting variables in such cases. Kostis From kiszl@REDACTED Tue Jan 5 09:47:44 2010 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Tue, 5 Jan 2010 09:47:44 +0100 (CET) Subject: [erlang-questions] Compiler to warn on used underscore-variables In-Reply-To: References: <4B426250.60301@tmit.bme.hu> <3dbc6d1c1001041455k63a4baefw32e9fa55794f36ea@mail.gmail.com> <32645.194.88.55.211.1262679361.squirrel@localhost> Message-ID: <53070.194.88.55.211.1262681264.squirrel@localhost> > 2010/1/5 Zoltan Lajos Kis > >> I also understand that many compiler warnings (unused variable, wrong >> no. >> of args in format call, etc.) are output because there is a clear sign >> of >> a (semantic) mistake and not because of the source code being invalid. >> So I believe that the current behavior of not warning about a most >> probable mistake with _Var variables is the counter-intuitive one. >> > > Along with single assignment there exists a whole class of errors where > you > may mistakenly use a previously bound variable in a pattern intending to > use > an unbound one. This has nothing to do with a '_' prefix on them at all, > rather it's simply a class of errors that exist with single assignment and > pattern matching. > > There is no general solution to this problem either, any more than there > is > a general solution to accidently destructively rebinding a variable then > assuming you were referencing a previous version in languages that support > destructive assignment. > > I'm not sure what alternative you're proposing. Would you prefer all > variables prefixed with an underscore have the same semantics as '_'? > > No compiler is going to be able to think for you. > > -- > Tony Arcieri > Medioh! A Kudelski Brand > I'm simply proposing that if the compiler sees code like: measure_secs(Fun) -> {_M, S1, _U} = erlang:now(), Fun(), {_M, S2, _U} = erlang:now(), S2 - S1. to output something like: "Warning: variable '_U' is not unused". Zoltan. From kiszl@REDACTED Tue Jan 5 10:01:13 2010 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Tue, 5 Jan 2010 10:01:13 +0100 (CET) Subject: [erlang-questions] Compiler to warn on used underscore-variables In-Reply-To: <4B42FBB7.1000902@cs.ntua.gr> References: <4B426250.60301@tmit.bme.hu> <3dbc6d1c1001041455k63a4baefw32e9fa55794f36ea@mail.gmail.com> <32645.194.88.55.211.1262679361.squirrel@localhost> <4B42FBB7.1000902@cs.ntua.gr> Message-ID: <60984.194.88.55.211.1262682073.squirrel@localhost> > Zoltan Lajos Kis wrote: >>>> Currently the compiler outputs a warning if a variable is only used >>>> once. >>>> The "standard" way to suppress this warning is to put an underscore in >>>> front >>>> of the variable name. >>>> As a result, an underscore-variable in source codes gives us (at least >>>> for >>>> me) the false notion that it is not a real variable, but only a means >>>> to >>>> enhance code readability. >>>> However the compiler treats them just like ordinary variables, >>>> resulting >>>> in >>>> unexpected (i.e. most astonishing ;-)) no match exceptions. >>>> >>> They *ARE* ordinary variables! All variables are variables irrespective >>> of >>> whether there name starts with a capital letter or an "_". The *ONLY* >>> exception is the variable '_' which is the anonymous or don't care >>> variable. >>> It always matches and is never bound, which means it can only be used >>> in >>> patterns. Or to be more correct, if it used in a term then the compiler >>> will complain about an unbound variable. >>> >>> The special treatment of variables starting with "_" is a feature/hack >>> in >>> the compiler to get around its feature/hack of warning about variables >>> which >>> are never used. It was included to allow users to to give names to >>> variables >>> they don't intend to use for documentation purposes. I personally don't >>> like and never use them, if I don't want the value I use '_'. >>> >>>> My question is: what is your opinion about / is it possible to modify >>>> the >>>> compiler so that it outputs a warning if an underscore-variable is >>>> used >>>> (not >>>> unused) in the code ? >>>> >>> It is of course possible but I thinkt that would be even more >>> counter-intuitive. >>> >>> Robert >>> >> >> I understand that they are ordinary variables. But I am certain that all >> the _Var variables I have seen so far were named so in order to indicate >> that they are intentionally unused, and not because of some strange >> naming >> habit. > > Well, your statement depends on the code that you've seen, but my > experience is different. We often use the following coding convention. > We define a macro that outputs some debugging information: > > -ifdef(DEBUG). > -define(debug(Str, Vars), io:format(Str, Vars)). > -else. > -define(debug(Str, Vars), ok). > -endif. > > and use it in code that looks as follows: > > foo(....) -> > case do_something(...) of > {X,Y,Z} -> ... > _Other -> > ?debug("Strange: do_something returned ~p\n", [_Other]), > .... > end. > > We want the compiler to be silent about _Other being unused when not > debugging and use _Other as an ordinary variable when debugging is on. > We definitely do not want the compiler to be warning for used > underscore-starting variables in such cases. > > Kostis > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > You can change that to this, and you will get no warnings: -ifdef(DEBUG). -define(debug(Str, Vars), io:format(Str, Vars)). -else. -define(debug(Str, Vars), Vars=Vars). -endif. Zoltan. From kiszl@REDACTED Tue Jan 5 10:09:37 2010 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Tue, 5 Jan 2010 10:09:37 +0100 (CET) Subject: [erlang-questions] Compiler to warn on used underscore-variables In-Reply-To: <60984.194.88.55.211.1262682073.squirrel@localhost> References: <4B426250.60301@tmit.bme.hu> <3dbc6d1c1001041455k63a4baefw32e9fa55794f36ea@mail.gmail.com> <32645.194.88.55.211.1262679361.squirrel@localhost> <4B42FBB7.1000902@cs.ntua.gr> <60984.194.88.55.211.1262682073.squirrel@localhost> Message-ID: <3199.194.88.55.211.1262682577.squirrel@localhost> > You can change that to this, and you will get no warnings: > > -ifdef(DEBUG). > -define(debug(Str, Vars), io:format(Str, Vars)). > -else. > -define(debug(Str, Vars), Vars=Vars). > -endif. > > Zoltan. > > Oops, sorry, this doesn't work nicely because of the list construction... From axelandren@REDACTED Tue Jan 5 10:22:15 2010 From: axelandren@REDACTED (=?ISO-8859-1?Q?Axel_Andr=E9n?=) Date: Tue, 5 Jan 2010 10:22:15 +0100 Subject: Is there a way to generate PDFs with edoc? Message-ID: <38207731001050122g2e39250bl5d22106ed80b50ad@mail.gmail.com> Hello! I'm part of a student group that has been working on an erlang-based cluster for the half a year or so. We are currently writing the report for both the cluster and the course it was part of, and would like to use the edoc comment documentation in the product report. But edoc makes html files, which is a bit inconvenient for including in a report. Ideally we'd like to put the documentation for each application in one big pdf, but getting one pdf for each app would work fine too. Is there a way we can do this? Best regards, Axel Andr?n, Student at Uppsala University From bgustavsson@REDACTED Tue Jan 5 11:23:25 2010 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Tue, 5 Jan 2010 11:23:25 +0100 Subject: [erlang-questions] erlang:exit/1 eats lots of CPU time In-Reply-To: References: Message-ID: <6672d0161001050223o63feb623g6d0217d25362096c@mail.gmail.com> On Tue, Jan 5, 2010 at 7:02 AM, Maxim Treskin wrote: > > Erlang node whith this process really eats CPU time, so it is not a > some bug of eprof. May be it is due to garbage collection of process > data on exit? Increasing of min_heap_size up to value which really > used by process has no effect. There is not supposed to be any garbage collection when a process exits. However, if exit/1 is called as exit(HugeTerm), HugeTerm will be copied to all linked processes. -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From kagato@REDACTED Tue Jan 5 11:58:12 2010 From: kagato@REDACTED (Jayson Vantuyl) Date: Tue, 5 Jan 2010 02:58:12 -0800 Subject: [erlang-questions] Running Test Suites and Generating Docs In-Reply-To: <6672d0161001040812o21648218r799fdad9defb1528@mail.gmail.com> References: <861D3D73-4F84-4304-8E7A-4FDBAA39D854@souja.net> <6672d0161001040812o21648218r799fdad9defb1528@mail.gmail.com> Message-ID: <538DBDF2-BC94-4DCF-B6C8-0780E9A894F2@souja.net> After running the tests, I've got another patch on the way to fix some brokenness there. As for the docs, this doesn't work when I try to build them. I get the following error: > date=`date +"%B %e %Y"`; \ > xsltproc --noout --stringparam outdir ../html --stringparam docgen "/Users/kagato/otp/lib/erl_docgen" --stringparam topdocdir "../../../doc" \ > --stringparam pdfdir "../pdf" \ > --stringparam gendate "$date" --stringparam appname "erts" --stringparam appver "5.7.5" --xinclude \ > -path /Users/kagato/otp/lib/erl_docgen/priv/docbuilder_dtd -path /Users/kagato/otp/lib/erl_docgen/priv/dtd_html_entities /Users/kagato/otp/lib/erl_docgen/priv/xsl/db_html.xsl book.xml > compilation error: file /Users/kagato/otp/lib/erl_docgen/priv/xsl/db_html.xsl line 659 element param > The value '$curModule' of the attribute 'name' is not a valid QName. > make: *** [../html/index.html] Error 5 Tips? On Jan 4, 2010, at 8:12 AM, Bj?rn Gustavsson wrote: > On Mon, Jan 4, 2010 at 3:51 PM, Jayson Vantuyl wrote: >> How do I run the test suites that come with OTP? > > See http://wiki.github.com/erlang/otp/running-tests > >> How do I generate the OTP docs? i can't seem to find any information in the build tree. > > cd to the source for the documentation for an application/sub-system, > for example > > cd erts/doc/src > > and then do > > make html > > -- > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From zerthurd@REDACTED Tue Jan 5 12:14:16 2010 From: zerthurd@REDACTED (Maxim Treskin) Date: Tue, 5 Jan 2010 17:14:16 +0600 Subject: [erlang-questions] erlang:exit/1 eats lots of CPU time In-Reply-To: <6672d0161001050223o63feb623g6d0217d25362096c@mail.gmail.com> References: <6672d0161001050223o63feb623g6d0217d25362096c@mail.gmail.com> Message-ID: No, theres is no any HugeTerm, just normal reason. 2010/1/5 Bj?rn Gustavsson : > On Tue, Jan 5, 2010 at 7:02 AM, Maxim Treskin wrote: >> >> Erlang node whith this process really eats CPU time, so it is not a >> some bug of eprof. May be it is due to garbage collection of process >> data on exit? Increasing of min_heap_size up to value which really >> used by process has no effect. > > There is not supposed to be any garbage collection > when a process exits. > > However, if exit/1 is called as exit(HugeTerm), > HugeTerm will be copied to all linked processes. > > -- > Bj?rn Gustavsson, Erlang/OTP, Ericsson AB > -- Maxim Treskin From kagato@REDACTED Tue Jan 5 12:19:54 2010 From: kagato@REDACTED (Jayson Vantuyl) Date: Tue, 5 Jan 2010 03:19:54 -0800 Subject: [erlang-questions] erlang:exit/1 eats lots of CPU time In-Reply-To: References: Message-ID: What's the total time here? I see that erlang:exit/1 is 99% of that process's time, and that process is 12% of total time, but how long are we talking about here? I've seen results like that for short tests in a tight loop. So, it's 99% of 12% of what? On Jan 4, 2010, at 10:02 PM, Maxim Treskin wrote: > Hello > > I have tested software with Eprof. eprof:analyse() prints log which > contains following strings: > > ****** Process <0.229.0> -- 12 % of profiled time *** > erlang:exit/1 1 99 % > > Erlang node whith this process really eats CPU time, so it is not a > some bug of eprof. May be it is due to garbage collection of process > data on exit? Increasing of min_heap_size up to value which really > used by process has no effect. > > How I can decrease CPU time consumption on exit for this process? > > Thank you > > -- > Maxim Treskin > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From kdronnqvist@REDACTED Tue Jan 5 12:21:02 2010 From: kdronnqvist@REDACTED (=?ISO-8859-1?Q?Daniel_R=F6nnqvist?=) Date: Tue, 5 Jan 2010 12:21:02 +0100 Subject: [erlang-questions] Is there a way to generate PDFs with edoc? In-Reply-To: <38207731001050122g2e39250bl5d22106ed80b50ad@mail.gmail.com> References: <38207731001050122g2e39250bl5d22106ed80b50ad@mail.gmail.com> Message-ID: <65691fa01001050321h7ba8e26eje3deea4663e6dfa0@mail.gmail.com> Hello, you can generate LaTeX code from your own edoc layout module. Then just run the unix command pdflatex that comes with the latex package, which produces a PDF from latex code. See the edoc_layout module for an example. BR, Daniel 2010/1/5 Axel Andr?n : > Hello! > > I'm part of a student group that has been working on an erlang-based cluster > for the half a year or so. We are currently writing the report for both the > cluster and the course it was part of, and would like to use the edoc > comment documentation in the product report. But edoc makes html files, > which is a bit inconvenient for including in a report. > > Ideally we'd like to put the documentation for each application in one big > pdf, but getting one pdf for each app would work fine too. > > Is there a way we can do this? > > Best regards, > Axel Andr?n, Student at Uppsala University > From zerthurd@REDACTED Tue Jan 5 13:04:59 2010 From: zerthurd@REDACTED (Maxim Treskin) Date: Tue, 5 Jan 2010 18:04:59 +0600 Subject: [erlang-questions] erlang:exit/1 eats lots of CPU time In-Reply-To: References: Message-ID: Yes. This process consumes 12% of total CPU time. erlang:exit/1 consumes 99% of 12% of total CPU time. Whole system contains several such processes which eats CPU on exit. 2010/1/5 Jayson Vantuyl : > What's the total time here? ?I see that erlang:exit/1 is 99% of that process's time, and that process is 12% of total time, but how long are we talking about here? ?I've seen results like that for short tests in a tight loop. ?So, it's 99% of 12% of what? > > On Jan 4, 2010, at 10:02 PM, Maxim Treskin wrote: > >> Hello >> >> I have tested software with Eprof. eprof:analyse() prints log which >> contains following strings: >> >> ****** Process <0.229.0> ? ?-- 12 % of profiled time *** >> erlang:exit/1 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?1 ? ? ? ? ?99 % >> >> Erlang node whith this process really eats CPU time, so it is not a >> some bug of eprof. May be it is due to garbage collection of process >> data on exit? Increasing of min_heap_size up to value which really >> used by process has no effect. >> >> How I can decrease CPU time consumption on exit for this process? >> >> Thank you >> >> -- >> Maxim Treskin >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> > > -- Maxim Treskin From S.J.Thompson@REDACTED Tue Jan 5 13:10:05 2010 From: S.J.Thompson@REDACTED (S.J.Thompson) Date: Tue, 5 Jan 2010 12:10:05 +0000 (GMT) Subject: Book reviews for the Journal of Functional Programming Message-ID: If you would be interested in reviewing books for the journal of functional programming you can find a list of currently available books at http://www.cs.kent.ac.uk/people/staff/sjt/JFP/ Please let me know if you would be interested in taking on any of these reviewing assignments. Kind regards, Simon Thompson Book Reviews Editor Journal of Functional Programming From ola.a.andersson@REDACTED Tue Jan 5 13:55:38 2010 From: ola.a.andersson@REDACTED (Ola Andersson A) Date: Tue, 5 Jan 2010 13:55:38 +0100 Subject: [erlang-questions] Telnet Client In-Reply-To: <4B42372A.5020107@eonblast.com> References: <4B42372A.5020107@eonblast.com> Message-ID: <55F1DD5E09B0FE4FB35D919DAF2127D901AE8E03@esealmw105.eemea.ericsson.se> You could take a look at ct_telnet (part of common test). It contains code that could be used as a model for a simple telnet client. /OLA. > -----Original Message----- > From: erlang-questions@REDACTED > [mailto:erlang-questions@REDACTED] On Behalf Of Henning Diedrich > Sent: den 4 januari 2010 19:45 > To: Erlang Questions > Subject: [erlang-questions] Telnet Client > > Hello list, > > could someone point me to the Erlang source of a simple > telnet client, complete with prompt? > > The intention is to start from there to make it into a client > to talk in and test a custom protocol. > > Thanks! > Henning > > ________________________________________________________________ > erlang-questions mailing list. See > http://www.erlang.org/faq.html erlang-questions (at) erlang.org > > From malcolm@REDACTED Tue Jan 5 14:20:25 2010 From: malcolm@REDACTED (Dowse, Malcolm) Date: Tue, 5 Jan 2010 13:20:25 -0000 Subject: [erlang-questions] More general record syntax? In-Reply-To: <4B32AA47.4010809@tmit.bme.hu> Message-ID: <14DFD46F55E79E45A9FCA338BCE11C4411481B@UKLHREXCL02.activision.com> I guess some sort of versioning could fix the issue with hot-upgrading state. But code would end up being full of version numbers, unless there was an extra way of specifying a default version number. And there would be the (admittedly quite small) overhead of passing these around at runtime. If version numbers were added, I think it would make more sense for the internal representation to be {{record_name, Vsn}, Field1, Field2}, instead of {record_name, Vsn, Field1, Field2}. This would be more backwards compatible, and prevent ambiguities. Take these two records, and a function to extract the name: -record(person, {name, age}). -record(person, "1.0", {name}). get_name(#person{name = N}) -> N; get_name(#person("1.0"){name = N}) -> N. IMO, you should never have to guess that, in the case of get_name({person, "1.0", "am I an age or a name?"}), the ordering of the pattern match would matter. Also, this would mean that record_info/2 could accept a tuple as its second argument, which would be reasonably backwards compatible. Personally, though, I think my suggestion is neater (assuming it makes sense, which I think it does). The record_info/2 call would be completely unchanged, and there would be no run-time overhead. In my proposal, the compile-time vs. run-time distinction is a bit odd, but it's already present in the language. In almost every respect Erlang is a dynamically-typed language, but records are the big exception. Or maybe it's just that at heart I like static typing, and the idea of doing as much work as possible at compile time. :) Malcolm -----Original Message----- From: Zoltan Lajos Kis [mailto:kiszl@REDACTED] Sent: 23 December 2009 23:40 To: Garrett Smith Cc: Dowse, Malcolm; erlang-questions@REDACTED Subject: Re: [erlang-questions] More general record syntax? 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 mazen.harake@REDACTED Tue Jan 5 14:42:27 2010 From: mazen.harake@REDACTED (Mazen Harake) Date: Tue, 05 Jan 2010 15:42:27 +0200 Subject: [erlang-questions] erlang:exit/1 eats lots of CPU time In-Reply-To: References: Message-ID: <4B4341C3.2090107@erlang-consulting.com> Hi, I think what Jayson is trying to say is: How long is "total CPU time"? 1 microsecond or 10 hours or somewhere in between? R, /M On 05/01/2010 14:04, Maxim Treskin wrote: > Yes. This process consumes 12% of total CPU time. erlang:exit/1 > consumes 99% of 12% of total CPU time. Whole system contains several > such processes which eats CPU on exit. > > 2010/1/5 Jayson Vantuyl: > >> What's the total time here? I see that erlang:exit/1 is 99% of that process's time, and that process is 12% of total time, but how long are we talking about here? I've seen results like that for short tests in a tight loop. So, it's 99% of 12% of what? >> >> On Jan 4, 2010, at 10:02 PM, Maxim Treskin wrote: >> >> >>> Hello >>> >>> I have tested software with Eprof. eprof:analyse() prints log which >>> contains following strings: >>> >>> ****** Process<0.229.0> -- 12 % of profiled time *** >>> erlang:exit/1 1 99 % >>> >>> Erlang node whith this process really eats CPU time, so it is not a >>> some bug of eprof. May be it is due to garbage collection of process >>> data on exit? Increasing of min_heap_size up to value which really >>> used by process has no effect. >>> >>> How I can decrease CPU time consumption on exit for this process? >>> >>> Thank you >>> >>> -- >>> Maxim Treskin >>> >>> ________________________________________________________________ >>> erlang-questions mailing list. See http://www.erlang.org/faq.html >>> erlang-questions (at) erlang.org >>> >>> >> >> > > > From kenneth.lundin@REDACTED Tue Jan 5 15:34:46 2010 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Tue, 5 Jan 2010 15:34:46 +0100 Subject: [erlang-questions] Is there a way to generate PDFs with edoc? In-Reply-To: <38207731001050122g2e39250bl5d22106ed80b50ad@mail.gmail.com> References: <38207731001050122g2e39250bl5d22106ed80b50ad@mail.gmail.com> Message-ID: Hi, We are generating pdf via edoc for some of the applications. For example the doc for edoc and syntax_tools are generated this way. We use a layout callback module for edoc which produces XML according to the DTD we use for OTP documentation. The callback module belongs to the docbuilder application and the module name is docb_edoc_xml_cb. You find an example on how to use it in the source of that module. If you use that approach you PDF will look like : http://www.erlang.org/doc/apps/edoc/edoc.pdf See the make files in the doc directory of the edoc and syntax_tools applications. /Kenneth Erlang/OTP, Ericsson On Tue, Jan 5, 2010 at 10:22 AM, Axel Andr?n wrote: > Hello! > > I'm part of a student group that has been working on an erlang-based cluster > for the half a year or so. We are currently writing the report for both the > cluster and the course it was part of, and would like to use the edoc > comment documentation in the product report. But edoc makes html files, > which is a bit inconvenient for including in a report. > > Ideally we'd like to put the documentation for each application in one big > pdf, but getting one pdf for each app would work fine too. > > Is there a way we can do this? > > Best regards, > Axel Andr?n, Student at Uppsala University > From vances@REDACTED Tue Jan 5 16:35:49 2010 From: vances@REDACTED (Vance Shipley) Date: Tue, 5 Jan 2010 10:35:49 -0500 Subject: [erlang-questions] Compiler to warn on used underscore-variables In-Reply-To: References: <4B426250.60301@tmit.bme.hu> <3dbc6d1c1001041455k63a4baefw32e9fa55794f36ea@mail.gmail.com> <32645.194.88.55.211.1262679361.squirrel@localhost> Message-ID: <20100105153549.GC3139@h216-235-12-174.host.egate.net> On Tue, Jan 05, 2010 at 01:34:10AM -0700, Tony Arcieri wrote: } I'm not sure what alternative you're proposing. Would you prefer all } variables prefixed with an underscore have the same semantics as '_'? Yes. The current behaviour, given the purpose of a underscore prefix, violates the principle of least astonishment. IMHO I know it's not going to change but having been burnt by this in my learning phase I still hold that opinion. -- -Vance From rvirding@REDACTED Tue Jan 5 16:58:32 2010 From: rvirding@REDACTED (Robert Virding) Date: Tue, 5 Jan 2010 16:58:32 +0100 Subject: [erlang-questions] Compiler to warn on used underscore-variables In-Reply-To: <20100105153549.GC3139@h216-235-12-174.host.egate.net> References: <4B426250.60301@tmit.bme.hu> <3dbc6d1c1001041455k63a4baefw32e9fa55794f36ea@mail.gmail.com> <32645.194.88.55.211.1262679361.squirrel@localhost> <20100105153549.GC3139@h216-235-12-174.host.egate.net> Message-ID: <3dbc6d1c1001050758g6025eac4y84aaab69ed1763e6@mail.gmail.com> 2010/1/5 Vance Shipley > On Tue, Jan 05, 2010 at 01:34:10AM -0700, Tony Arcieri wrote: > } I'm not sure what alternative you're proposing. Would you prefer all > } variables prefixed with an underscore have the same semantics as '_'? > > Yes. The current behaviour, given the purpose of a underscore > prefix, violates the principle of least astonishment. IMHO > > I know it's not going to change but having been burnt by this > in my learning phase I still hold that opinion. > A change like that would be backwards incompatible and break existing code. Robert From zerthurd@REDACTED Tue Jan 5 17:50:36 2010 From: zerthurd@REDACTED (Maxim Treskin) Date: Tue, 5 Jan 2010 22:50:36 +0600 Subject: [erlang-questions] erlang:exit/1 eats lots of CPU time In-Reply-To: <4B4341C3.2090107@erlang-consulting.com> References: <4B4341C3.2090107@erlang-consulting.com> Message-ID: TOP 5 from total analyse: Total time: 15.98 Measurement overhead: 0.89 FUNCTION CALLS TIME erlang:exit/1 50 80 % megaco_text_scanner:safe_chars/5 2792 1 % log_server_core:process_message/3 929 1 % gen_server:do_cast/2 1008 1 % log:log/6 929 0 % where log_server_core and log is our internal modules. TOP 30 exits from complete eprof log-file: [zert@REDACTED]:/tmp $>> grep 'erlang:exit' pa_megaco-eprof.log | awk '{print $3, "%\t", $1}' | sort -nr | head -n 30 100 % erlang:exit/1 100 % erlang:exit/1 99 % erlang:exit/1 99 % erlang:exit/1 98 % erlang:exit/1 98 % erlang:exit/1 97 % erlang:exit/1 96 % erlang:exit/1 93 % erlang:exit/1 91 % erlang:exit/1 90 % erlang:exit/1 81 % erlang:exit/1 80 % erlang:exit/1 79 % erlang:exit/1 74 % erlang:exit/1 61 % erlang:exit/1 53 % erlang:exit/1 52 % erlang:exit/1 42 % erlang:exit/1 16 % erlang:exit/1 14 % erlang:exit/1 12 % erlang:exit/1 11 % erlang:exit/1 10 % erlang:exit/1 9 % erlang:exit/1 8 % erlang:exit/1 8 % erlang:exit/1 7 % erlang:exit/1 6 % erlang:exit/1 5 % erlang:exit/1 2010/1/5 Mazen Harake : > Hi, > > I think what Jayson is trying to say is: > > How long is "total CPU time"? 1 microsecond or 10 hours or somewhere in > between? > > R, > /M > > On 05/01/2010 14:04, Maxim Treskin wrote: >> >> Yes. This process consumes 12% of total CPU time. erlang:exit/1 >> consumes 99% of 12% of total CPU time. Whole system contains several >> such processes which eats CPU on exit. >> >> 2010/1/5 Jayson Vantuyl: >> >>> >>> What's the total time here? ?I see that erlang:exit/1 is 99% of that >>> process's time, and that process is 12% of total time, but how long are we >>> talking about here? ?I've seen results like that for short tests in a tight >>> loop. ?So, it's 99% of 12% of what? >>> >>> On Jan 4, 2010, at 10:02 PM, Maxim Treskin wrote: >>> >>> >>>> >>>> Hello >>>> >>>> I have tested software with Eprof. eprof:analyse() prints log which >>>> contains following strings: >>>> >>>> ****** Process<0.229.0> ? ? ?-- 12 % of profiled time *** >>>> erlang:exit/1 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?1 ? ? ? ? ?99 % >>>> >>>> Erlang node whith this process really eats CPU time, so it is not a >>>> some bug of eprof. May be it is due to garbage collection of process >>>> data on exit? Increasing of min_heap_size up to value which really >>>> used by process has no effect. >>>> >>>> How I can decrease CPU time consumption on exit for this process? >>>> >>>> Thank you >>>> >>>> -- >>>> Maxim Treskin >>>> >>>> ________________________________________________________________ >>>> erlang-questions mailing list. See http://www.erlang.org/faq.html >>>> erlang-questions (at) erlang.org >>>> >>>> >>> >>> >> >> >> > > -- Maxim Treskin From zerthurd@REDACTED Tue Jan 5 17:51:36 2010 From: zerthurd@REDACTED (Maxim Treskin) Date: Tue, 5 Jan 2010 22:51:36 +0600 Subject: [erlang-questions] erlang:exit/1 eats lots of CPU time In-Reply-To: <4B4341C3.2090107@erlang-consulting.com> References: <4B4341C3.2090107@erlang-consulting.com> Message-ID: May be I have some missinterpretation of this analyse info? 2010/1/5 Mazen Harake : > Hi, > > I think what Jayson is trying to say is: > > How long is "total CPU time"? 1 microsecond or 10 hours or somewhere in > between? > > R, > /M > > On 05/01/2010 14:04, Maxim Treskin wrote: >> >> Yes. This process consumes 12% of total CPU time. erlang:exit/1 >> consumes 99% of 12% of total CPU time. Whole system contains several >> such processes which eats CPU on exit. >> >> 2010/1/5 Jayson Vantuyl: >> >>> >>> What's the total time here? ?I see that erlang:exit/1 is 99% of that >>> process's time, and that process is 12% of total time, but how long are we >>> talking about here? ?I've seen results like that for short tests in a tight >>> loop. ?So, it's 99% of 12% of what? >>> >>> On Jan 4, 2010, at 10:02 PM, Maxim Treskin wrote: >>> >>> >>>> >>>> Hello >>>> >>>> I have tested software with Eprof. eprof:analyse() prints log which >>>> contains following strings: >>>> >>>> ****** Process<0.229.0> ? ? ?-- 12 % of profiled time *** >>>> erlang:exit/1 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?1 ? ? ? ? ?99 % >>>> >>>> Erlang node whith this process really eats CPU time, so it is not a >>>> some bug of eprof. May be it is due to garbage collection of process >>>> data on exit? Increasing of min_heap_size up to value which really >>>> used by process has no effect. >>>> >>>> How I can decrease CPU time consumption on exit for this process? >>>> >>>> Thank you >>>> >>>> -- >>>> Maxim Treskin >>>> >>>> ________________________________________________________________ >>>> erlang-questions mailing list. See http://www.erlang.org/faq.html >>>> erlang-questions (at) erlang.org >>>> >>>> >>> >>> >> >> >> > > -- Maxim Treskin From max.lapshin@REDACTED Wed Jan 6 08:55:55 2010 From: max.lapshin@REDACTED (Max Lapshin) Date: Wed, 6 Jan 2010 10:55:55 +0300 Subject: [erlang-questions] edoc only specific modules In-Reply-To: References: <4B375EEB.5000505@gmail.com> Message-ID: I've tried it and fixed a bit erldoc, so that it read xmls from my modules, but now I cannot make index page from overview.edoc Haven't you seen at it? From tony@REDACTED Wed Jan 6 14:23:08 2010 From: tony@REDACTED (Tony Rogvall) Date: Wed, 6 Jan 2010 14:23:08 +0100 Subject: [erlang-questions] Compiler to warn on used underscore-variables In-Reply-To: <53070.194.88.55.211.1262681264.squirrel@localhost> References: <4B426250.60301@tmit.bme.hu> <3dbc6d1c1001041455k63a4baefw32e9fa55794f36ea@mail.gmail.com> <32645.194.88.55.211.1262679361.squirrel@localhost> <53070.194.88.55.211.1262681264.squirrel@localhost> Message-ID: <09095915-4DE7-4AC4-9AD5-AE2D8B3DA432@rogvall.se> > > I'm simply proposing that if the compiler sees code like: > > measure_secs(Fun) -> > {_M, S1, _U} = erlang:now(), > Fun(), > {_M, S2, _U} = erlang:now(), > S2 - S1. > > to output something like: "Warning: variable '_U' is not unused". > > Zoltan. > > +1 Nice. I think this could reduce the likelihood for some obscure bugs. /Tony From lovei@REDACTED Wed Jan 6 15:36:12 2010 From: lovei@REDACTED (=?ISO-8859-2?Q?L=F6vei_L=E1szl=F3?=) Date: Wed, 06 Jan 2010 15:36:12 +0100 Subject: [erlang-questions] Compiler to warn on used underscore-variables In-Reply-To: <32645.194.88.55.211.1262679361.squirrel@localhost> References: <4B426250.60301@tmit.bme.hu> <3dbc6d1c1001041455k63a4baefw32e9fa55794f36ea@mail.gmail.com> <32645.194.88.55.211.1262679361.squirrel@localhost> Message-ID: <4B449FDC.2000007@elte.hu> Zoltan Lajos Kis wrote: > > I understand that they are ordinary variables. But I am certain that all > the _Var variables I have seen so far were named so in order to indicate > that they are intentionally unused, and not because of some strange naming > habit. It is also useful in generated code, take a look at the output of yecc for an example. Laszlo From hakan@REDACTED Wed Jan 6 16:08:44 2010 From: hakan@REDACTED (=?ISO-8859-1?Q?H=E5kan_Mattsson?=) Date: Wed, 6 Jan 2010 16:08:44 +0100 Subject: [erlang-questions] Compiler to warn on used underscore-variables In-Reply-To: <4B449FDC.2000007@elte.hu> References: <4B426250.60301@tmit.bme.hu> <3dbc6d1c1001041455k63a4baefw32e9fa55794f36ea@mail.gmail.com> <32645.194.88.55.211.1262679361.squirrel@localhost> <4B449FDC.2000007@elte.hu> Message-ID: <922d05851001060708m4b59a180gc32c3cef1bef75b0@mail.gmail.com> 2010/1/6 L?vei L?szl? : > Zoltan Lajos Kis wrote: >> >> I understand that they are ordinary variables. But I am certain that all >> the _Var variables I have seen so far were named so in order to indicate >> that they are intentionally unused, and not because of some strange naming >> habit. > > It is also useful in generated code, take a look at the output of yecc for > an example. For generated code, I think that it makes sense to switch off the compiler warning for unused variables. I second the idea of introducing a new warning for the use of variables beginning with underscore. It is quite easy to make unintentional use of such variables. /H?kan From kiszl@REDACTED Wed Jan 6 16:20:21 2010 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Wed, 6 Jan 2010 16:20:21 +0100 (CET) Subject: [erlang-questions] Compiler to warn on used underscore-variables In-Reply-To: <4B449FDC.2000007@elte.hu> References: <4B426250.60301@tmit.bme.hu> <3dbc6d1c1001041455k63a4baefw32e9fa55794f36ea@mail.gmail.com> <32645.194.88.55.211.1262679361.squirrel@localhost> <4B449FDC.2000007@elte.hu> Message-ID: <49246.194.88.55.211.1262791221.squirrel@localhost> > Zoltan Lajos Kis wrote: >> >> I understand that they are ordinary variables. But I am certain that all >> the _Var variables I have seen so far were named so in order to indicate >> that they are intentionally unused, and not because of some strange >> naming >> habit. > > It is also useful in generated code, take a look at the output of yecc > for an example. > > > Laszlo > I never had a chance to dive into yecc, but from what I have seen, it seems that prepending everything with "__" is an odd way of (not) applying the nowarn_unused_vars switch. Regarding functionality it could pretty much prepend everything with "XYZ123" instead of "__". Anyway, what I proposed could be a switchable feature, so by default it would be off, and whoever likes it, turns it on. The main question is whether it is hard to implement or not. My guess is not, as the "opposite" functionality is already there. But this can be plain wrong. Zoltan. From thomasl_erlang@REDACTED Wed Jan 6 16:48:56 2010 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Wed, 6 Jan 2010 07:48:56 -0800 (PST) Subject: [erlang-questions] Compiler to warn on used underscore-variables In-Reply-To: <32645.194.88.55.211.1262679361.squirrel@localhost> References: <4B426250.60301@tmit.bme.hu> <3dbc6d1c1001041455k63a4baefw32e9fa55794f36ea@mail.gmail.com> <32645.194.88.55.211.1262679361.squirrel@localhost> Message-ID: <476812.25713.qm@web111415.mail.gq1.yahoo.com> ----- Original Message ---- > From: Zoltan Lajos Kis > > I understand that they are ordinary variables. But I am certain that all > the _Var variables I have seen so far were named so in order to indicate > that they are intentionally unused, and not because of some strange naming > habit. > > I also understand that many compiler warnings (unused variable, wrong no. > of args in format call, etc.) are output because there is a clear sign of > a (semantic) mistake and not because of the source code being invalid. > So I believe that the current behavior of not warning about a most > probable mistake with _Var variables is the counter-intuitive one. > > Anyway, such a change would only have a negative effect on those who > purposefully use such variable names for "ordinary variables". Would not > affect those who only use the anonymous variable, and would help those > using these variables as I described. I like this idea, it catches mistakes and the check can presumably be disabled with a flag in the usual manner. Best, Thomas From mog-lists@REDACTED Wed Jan 6 20:32:22 2010 From: mog-lists@REDACTED (mog) Date: Wed, 6 Jan 2010 13:32:22 -0600 Subject: [erlang-questions] Compiler to warn on used underscore-variables In-Reply-To: <09095915-4DE7-4AC4-9AD5-AE2D8B3DA432@rogvall.se> References: <4B426250.60301@tmit.bme.hu> <3dbc6d1c1001041455k63a4baefw32e9fa55794f36ea@mail.gmail.com> <32645.194.88.55.211.1262679361.squirrel@localhost> <53070.194.88.55.211.1262681264.squirrel@localhost> <09095915-4DE7-4AC4-9AD5-AE2D8B3DA432@rogvall.se> Message-ID: <20100106193222.GA32320@woodman.lan> On Wed, Jan 06, 2010 at 02:23:08PM +0100, Tony Rogvall wrote: > > > > I'm simply proposing that if the compiler sees code like: > > > > measure_secs(Fun) -> > > {_M, S1, _U} = erlang:now(), > > Fun(), > > {_M, S2, _U} = erlang:now(), > > S2 - S1. > > > > to output something like: "Warning: variable '_U' is not unused". > > > > Zoltan. > > > > > +1 ++ cant tell you how many times i have bit this one as well. -- Matthew O'Gorman xim: mog@REDACTED email: mog@REDACTED site: http://blog.rldn.net +---------------------------------------------------------------+ One meets his destiny often on the road he takes to avoid it. +---------------------------------------------------------------+ -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 835 bytes Desc: Digital signature URL: From tony@REDACTED Thu Jan 7 01:16:57 2010 From: tony@REDACTED (Tony Rogvall) Date: Thu, 7 Jan 2010 01:16:57 +0100 Subject: erl-config Message-ID: Hi list! How about installing a small script together with the erlang installation called "erl-config" The idea is that it should be used much like the other config scripts "out there". erl-config Options: --prefix --exec-dir --lib-dir (directory leading to erlang application named ) --version (erts version) --nif_libs (libraries if any needed to build a nif shared objec) --nif_ld (command used to link nif shared object) --nif_cflags (complier flags needed to compile a nif file) --drv_libs (same as for nif) --drv_ld --drv_cflags This would simplify the process of building of shared objects like nif and loadable driver shared objects. I guess that people writing code using erl_interface could benefit from options like: --ei-libs --ei-cflags suggestions / alternatives ? Thanks /Tony From kagato@REDACTED Thu Jan 7 01:46:39 2010 From: kagato@REDACTED (Jayson Vantuyl) Date: Wed, 6 Jan 2010 16:46:39 -0800 Subject: [erlang-questions] erl-config In-Reply-To: References: Message-ID: <94514824-866F-4841-81CC-B9F00ADEA9E1@souja.net> I have an escript that I use to gather bits of information from the Erlang environment itself. I would rather have an escript do this than a raw binary, just to ensure that all of this data is available from inside Erlang (which is useful, I think). Alternatively, people have previously discussed ideas for a generic Erlang control program (i.e. ectl or erlctl?) that could provide a CLI to common features or applications in running nodes. This could also provide a way to get at the information if it were available inside of of the runtime (which I suggest it really should be). See my script here: http://github.com/jvantuyl/erl-skel/blob/master/scripts/erl_info On Jan 6, 2010, at 4:16 PM, Tony Rogvall wrote: > Hi list! > > How about installing a small script together with the erlang installation called "erl-config" > The idea is that it should be used much like the other config scripts "out there". > > erl-config > Options: > --prefix > --exec-dir > --lib-dir (directory leading to erlang application named ) > --version (erts version) > --nif_libs (libraries if any needed to build a nif shared objec) > --nif_ld (command used to link nif shared object) > --nif_cflags (complier flags needed to compile a nif file) > > --drv_libs (same as for nif) > --drv_ld > --drv_cflags > > This would simplify the process of building of shared objects like nif and loadable driver shared objects. > I guess that people writing code using erl_interface could benefit from options like: > --ei-libs > --ei-cflags > > suggestions / alternatives ? > > Thanks > > /Tony > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From sam@REDACTED Thu Jan 7 05:13:11 2010 From: sam@REDACTED (Sam Bobroff) Date: Thu, 07 Jan 2010 15:13:11 +1100 Subject: [erlang-questions] Compiler to warn on used underscore-variables In-Reply-To: <20100106193222.GA32320@woodman.lan> References: <4B426250.60301@tmit.bme.hu> <3dbc6d1c1001041455k63a4baefw32e9fa55794f36ea@mail.gmail.com> <32645.194.88.55.211.1262679361.squirrel@localhost> <53070.194.88.55.211.1262681264.squirrel@localhost> <09095915-4DE7-4AC4-9AD5-AE2D8B3DA432@rogvall.se> <20100106193222.GA32320@woodman.lan> Message-ID: <4B455F57.1030409@m5net.com> On 7/01/10 6:32 AM, mog wrote: > On Wed, Jan 06, 2010 at 02:23:08PM +0100, Tony Rogvall wrote: > >>> I'm simply proposing that if the compiler sees code like: >>> >>> measure_secs(Fun) -> >>> {_M, S1, _U} = erlang:now(), >>> Fun(), >>> {_M, S2, _U} = erlang:now(), >>> S2 - S1. >>> >>> to output something like: "Warning: variable '_U' is not unused". >>> >>> Zoltan. >>> >>> >>> >> +1 >> > ++ > cant tell you how many times i have bit this one as well. > > For what it's worth, I also support this idea. (Actually, I was astonished to find that _X was not treated exactly like _, so that would be my preferred solution. However, issuing the "not unused" warning is much better than what happens now.) Sam. -- Sam Bobroff | sam@REDACTED | M5 Networks Why does my email have those funny headers? Because I use PGP to sign my email (and you should too!): that's how you know it's really from me. See: http://en.wikipedia.org/wiki/Pretty_Good_Privacy -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 258 bytes Desc: OpenPGP digital signature URL: From kiszl@REDACTED Thu Jan 7 08:40:28 2010 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Thu, 7 Jan 2010 08:40:28 +0100 (CET) Subject: [erlang-questions] Compiler to warn on used underscore-variables In-Reply-To: <4B455F57.1030409@m5net.com> References: <4B426250.60301@tmit.bme.hu> <3dbc6d1c1001041455k63a4baefw32e9fa55794f36ea@mail.gmail.com> <32645.194.88.55.211.1262679361.squirrel@localhost> <53070.194.88.55.211.1262681264.squirrel@localhost> <09095915-4DE7-4AC4-9AD5-AE2D8B3DA432@rogvall.se> <20100106193222.GA32320@woodman.lan> <4B455F57.1030409@m5net.com> Message-ID: <24231.194.88.55.211.1262850028.squirrel@localhost> > On 7/01/10 6:32 AM, mog wrote: >> On Wed, Jan 06, 2010 at 02:23:08PM +0100, Tony Rogvall wrote: >> >>>> I'm simply proposing that if the compiler sees code like: >>>> >>>> measure_secs(Fun) -> >>>> {_M, S1, _U} = erlang:now(), >>>> Fun(), >>>> {_M, S2, _U} = erlang:now(), >>>> S2 - S1. >>>> >>>> to output something like: "Warning: variable '_U' is not unused". >>>> >>>> Zoltan. >>>> >>>> >>>> >>> +1 >>> >> ++ >> cant tell you how many times i have bit this one as well. >> >> > For what it's worth, I also support this idea. > > (Actually, I was astonished to find that _X was not treated exactly like > _, so that would be my preferred solution. However, issuing the "not > unused" warning is much better than what happens now.) > > Sam. > Well, this behavior has been clearly documented :) http://erlang.org/doc/reference_manual/expressions.html#id2269867 From martti.kuparinen@REDACTED Thu Jan 7 09:15:49 2010 From: martti.kuparinen@REDACTED (Martti Kuparinen) Date: Thu, 07 Jan 2010 10:15:49 +0200 Subject: IP packet manipulation within Erlang Message-ID: <4B459835.4000902@iki.fi> Hi, How suitable is Erlang for a small project where I'd like to - grab all incoming IP packets - perform some IP header manipulation - send out the modified packets I'm aware I need some kind of bpf/pcap driver to get the packets into Erlang (or does Erlang now have something in this front). Do you guys have any idea how fast this whole thing would be compared to doing same in normal userland C program? Or even compared to doing the manipulation within Linux kernel. Martti From leon@REDACTED Thu Jan 7 09:35:34 2010 From: leon@REDACTED (Leon de Rooij) Date: Thu, 7 Jan 2010 09:35:34 +0100 Subject: [erlang-questions] IP packet manipulation within Erlang In-Reply-To: <4B459835.4000902@iki.fi> References: <4B459835.4000902@iki.fi> Message-ID: Hi, I didn't try it myself yet, but I as I understand it, you can use tuntap to route ip traffic into erlang: http://cean.process-one.net/packages/index.yaws?action=detail&name=tuntap regards, Leon On Jan 7, 2010, at 9:15 AM, Martti Kuparinen wrote: > Hi, > > How suitable is Erlang for a small project where I'd like to > > - grab all incoming IP packets > - perform some IP header manipulation > - send out the modified packets > > I'm aware I need some kind of bpf/pcap driver to get the packets > into Erlang (or does Erlang now have something in this front). > > Do you guys have any idea how fast this whole thing would be > compared to doing same in normal userland C program? Or even > compared to doing the manipulation within Linux kernel. > > Martti > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From chandrashekhar.mullaparthi@REDACTED Thu Jan 7 11:16:36 2010 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Thu, 7 Jan 2010 10:16:36 +0000 Subject: [erlang-questions] IP packet manipulation within Erlang In-Reply-To: <4B459835.4000902@iki.fi> References: <4B459835.4000902@iki.fi> Message-ID: 2010/1/7 Martti Kuparinen > Hi, > > How suitable is Erlang for a small project where I'd like to > > - grab all incoming IP packets > - perform some IP header manipulation > - send out the modified packets > > I'm aware I need some kind of bpf/pcap driver to get the packets into > Erlang (or does Erlang now have something in this front). > > Do you guys have any idea how fast this whole thing would be compared to > doing same in normal userland C program? Or even compared to doing the > manipulation within Linux kernel. > I attempted this a few years ago. I tried to write a linked in driver which got packets from libipq [1]. That was painful. So I dumped the idea of using erlang at all, and did it all in C which was pretty straightforward and worked quite well. I didn't put any large load on it, but it was enough for what I was doing at the time. cheers Chandru [1] http://en.wikipedia.org/wiki/Libipq From hans.r.nilsson@REDACTED Thu Jan 7 11:42:50 2010 From: hans.r.nilsson@REDACTED (Hans Nilsson R) Date: Thu, 07 Jan 2010 11:42:50 +0100 Subject: [erlang-questions] IP packet manipulation within Erlang In-Reply-To: References: <4B459835.4000902@iki.fi> Message-ID: <4B45BAAA.7040004@ericsson.com> Hi! I think Erlang binary syntax makes it trivialy straightforward for handling e.g. IP packets. The following example shows the technique. The argument to decode/1 is an Ethernet frame in a binary. I used this for post-processing of a pcap-file so I have no idea of the speed in a "wireline" application, but it was surprisingly fast in my application. I guess that the new NIFs will make it faster than with the built-in driver. decode(<> ) -> #ethernet{dst = {ED1, ED2, ED3, ED4, ED5, ED6}, src = {ES1, ES2, ES3, ES4, ES5, ES6}, type = EtherType, data = dec_pkt(EtherType,Pkt)}. dec_pkt(2048, %% IPv4 <>) -> OptLen = HdrLen*4 - 20, <> = Data, #ipv4{version = Version, hdr_length = HdrLen, tos = TOS, length = TotLen, id = ID, flags = Flg, fragment_offset = FragmentOffset, ttl = TTL, protocol = Protocol, checksum = HdrChkSum, src_ip = {IPsrc1, IPsrc2, IPsrc3, IPsrc4}, dst_ip = {IPdst1, IPdst2, IPdst3, IPdst4}, options = Options, data = case FragmentOffset of 0 -> dec_ipv4(Protocol,PayLoad); _ -> PayLoad end }; dec_pkt(EtherType,X) -> {'??',EtherType,X}. ... and so on for #udp, #tcp, #sctp ..... /Hans Chandru skrev: > 2010/1/7 Martti Kuparinen > > >> Hi, >> >> How suitable is Erlang for a small project where I'd like to >> >> - grab all incoming IP packets >> - perform some IP header manipulation >> - send out the modified packets >> >> I'm aware I need some kind of bpf/pcap driver to get the packets into >> Erlang (or does Erlang now have something in this front). >> >> Do you guys have any idea how fast this whole thing would be compared to >> doing same in normal userland C program? Or even compared to doing the >> manipulation within Linux kernel. >> >> > > I attempted this a few years ago. I tried to write a linked in driver which > got packets from libipq [1]. That was painful. So I dumped the idea of using > erlang at all, and did it all in C which was pretty straightforward and > worked quite well. I didn't put any large load on it, but it was enough for > what I was doing at the time. > > cheers > Chandru > > [1] http://en.wikipedia.org/wiki/Libipq > > From ulf.wiger@REDACTED Thu Jan 7 12:15:14 2010 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Thu, 07 Jan 2010 12:15:14 +0100 Subject: [erlang-questions] IP packet manipulation within Erlang In-Reply-To: <4B459835.4000902@iki.fi> References: <4B459835.4000902@iki.fi> Message-ID: <4B45C242.4060702@erlang-consulting.com> Martti Kuparinen wrote: > > Do you guys have any idea how fast this whole thing would be compared to > doing same in normal userland C program? Or even compared to doing the > manipulation within Linux kernel. For just header manipulation, you shouldn't pay that much overhead, but of course there will be extra costs associated with going into Erlang in the first place. There is a fairly ambitious reference, in the form of a complete TCP/IP stack implemented in Erlang. A high performance Erlang Tcp/Ip stack (Paris, Gulias, Valderruten), ACM SIGPLAN Erlang Workshop, Tallinn, 2005 http://portal.acm.org/citation.cfm?id=1088372&dl=GUIDE&coll=GUIDE&CFID=70015131&CFTOKEN=10074876 Here are some quotes on performance from the paper: "To measure throughput a 1GB file was transmitted between the two machines in both directions, and measured several times (Fig.5), taking the mean of the measures. As expected, the larger the Maximum Tranfer Unit (MTU), the higher the throughput. The total throughput in the best case is around 150Mbps. As a comparison, Linux TCP/IP stack in the same situation gave a total throughput of 615 Mbps, which is around 4 times higher. The costs in copying from userspace and of the virtual machine explain the difference in performance. Linux also takes advantage of advanced features present in the network cards, such as segmentation offload, checksum computing in the card, or scatter-gather copies from memory." (p 58) [...] "Up to 3000 concurrent connections were opened with a remote machine, but this reduced the throughput. A similar test was done with Linux, but opening only 500 connections. Linux showed no reduction in throughput with those connections, but a few connections used all the available bandwidth while the others did nothing. The Erlang stack loses throughput but each of the connections gets the same share of the bandwidth." (p 59) BR, Ulf W -- Ulf Wiger CTO, Erlang Solutions Ltd, formerly Erlang Training & Consulting Ltd http://www.erlang-solutions.com --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From trevorw@REDACTED Thu Jan 7 13:36:47 2010 From: trevorw@REDACTED (Trevor Woollacott) Date: Thu, 7 Jan 2010 14:36:47 +0200 Subject: [erlang-questions] IP packet manipulation within Erlang References: <4B459835.4000902@iki.fi> Message-ID: <003d01ca8f96$170db0c0$991ea8c0@mtn.co.za> > 2010/1/7 Martti Kuparinen > >> Hi, >> >> How suitable is Erlang for a small project where I'd like to >> >> - grab all incoming IP packets >> - perform some IP header manipulation >> - send out the modified packets >> >> I'm aware I need some kind of bpf/pcap driver to get the packets into >> Erlang (or does Erlang now have something in this front). >> >> Do you guys have any idea how fast this whole thing would be compared to >> doing same in normal userland C program? Or even compared to doing the >> manipulation within Linux kernel. >> > > I attempted this a few years ago. I tried to write a linked in driver > which > got packets from libipq [1]. That was painful. So I dumped the idea of > using > erlang at all, and did it all in C which was pretty straightforward and > worked quite well. I didn't put any large load on it, but it was enough > for > what I was doing at the time. > > cheers > Chandru > > [1] http://en.wikipedia.org/wiki/Libipq > Hi Chandru Do you mind elaborating on the issues that you experienced when writing the linked in driver using libipq? Regards, Trevor From martti.kuparinen@REDACTED Thu Jan 7 15:05:20 2010 From: martti.kuparinen@REDACTED (Martti Kuparinen) Date: Thu, 07 Jan 2010 16:05:20 +0200 Subject: [erlang-questions] IP packet manipulation within Erlang In-Reply-To: <4B459835.4000902@iki.fi> References: <4B459835.4000902@iki.fi> Message-ID: <4B45EA20.5070201@iki.fi> Martti Kuparinen wrote: > - grab all incoming IP packets > - perform some IP header manipulation > - send out the modified packets Let's assume I have N hosts (on the same subnet) which perform this. These hosts have a shared database which contains some information how to manipulate the IP header. The database entry is inserted when the first packet arrives to any of the hosts. How fast is Mnesia to make the new information be available on the other hosts? Are we talking about M*100 milliseconds or M seconds or M*10 seconds here? The reason I'm asking this is that, if/when the second packet for the same session arrives on any other host, it can't do anything unless it first finds the information within the database. Martti From james.hague@REDACTED Thu Jan 7 20:54:34 2010 From: james.hague@REDACTED (James Hague) Date: Thu, 7 Jan 2010 13:54:34 -0600 Subject: [erlang-questions] Telnet Client In-Reply-To: <4B42372A.5020107@eonblast.com> References: <4B42372A.5020107@eonblast.com> Message-ID: The classic example is http://ftp.sunet.se/pub/lang/erlang/examples/small_examples/index.html#0 It's hardly complete, but it's easy to understand. From kenneth.lundin@REDACTED Thu Jan 7 22:37:17 2010 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Thu, 7 Jan 2010 22:37:17 +0100 Subject: [erlang-questions] Telnet Client In-Reply-To: References: <4B42372A.5020107@eonblast.com> Message-ID: I just wonder why you are referring to the url of a mirror site instead of the original. By the way I don't even know if we link to this mirror site any more. http://erlang.org/examples/small_examples/index.html#0 /Kenneth On Thu, Jan 7, 2010 at 8:54 PM, James Hague wrote: > The classic example is > http://ftp.sunet.se/pub/lang/erlang/examples/small_examples/index.html#0 > > It's hardly complete, but it's easy to understand. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From james.hague@REDACTED Thu Jan 7 23:32:27 2010 From: james.hague@REDACTED (James Hague) Date: Thu, 7 Jan 2010 16:32:27 -0600 Subject: [erlang-questions] Telnet Client In-Reply-To: References: <4B42372A.5020107@eonblast.com> Message-ID: > I just wonder why you are referring to the url of a mirror site > instead of the original. > By the way I don't even know if we link to this mirror site any more. I remembered that example, googled for it, and just pasted in the link. From kenneth.lundin@REDACTED Thu Jan 7 23:58:10 2010 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Thu, 7 Jan 2010 23:58:10 +0100 Subject: [erlang-questions] Is there a way to generate PDFs with edoc? In-Reply-To: <38207731001070627r4aa2af24g1c0a5ccbca375575@mail.gmail.com> References: <38207731001050122g2e39250bl5d22106ed80b50ad@mail.gmail.com> <38207731001070627r4aa2af24g1c0a5ccbca375575@mail.gmail.com> Message-ID: The way we use to produce html and pdf documentation in Erlang/OTP from R13B-3 works like this: If edoc markup in the sources then run edoc with docb_edoc_xml_cb (from docbuilder app) as layout callback module This produces XML according to the DTDs described in docbuilder feed this XML into erl_docgen (introduced in R13B03) which uses xsltproc and xslt for the transformation to html and xsl-fo the xsl-fo is fed into Apache FOP which produces PDF. I.e there is no use of Latex in this. You don't need to program anything your self. The process is not fully documented yet (will be in later releases) but it should be possible to mimic what we are doing in edoc and syntax tools (in the R13B03 release and onwards). /Kenneth On Thu, Jan 7, 2010 at 3:27 PM, Axel Andr?n wrote: > I'm afraid I have no idea what I'm looking for. I see that it depends on > .tex files, but there are none in the application folder... > > 2010/1/5 Kenneth Lundin >> >> Hi, >> >> We are generating pdf via edoc for some of the applications. >> For example the doc for edoc and syntax_tools are generated this way. >> >> We use a layout callback module for edoc which produces XML according to >> the >> DTD we use for OTP documentation. >> The callback module belongs to the docbuilder application and the module >> name >> is docb_edoc_xml_cb. You find an example on how to use it in the >> source of that module. >> >> If you use that approach you PDF will look like : >> http://www.erlang.org/doc/apps/edoc/edoc.pdf >> >> See the make files in the doc directory of the edoc and syntax_tools >> applications. >> >> /Kenneth Erlang/OTP, Ericsson >> >> >> On Tue, Jan 5, 2010 at 10:22 AM, Axel Andr?n wrote: >> > Hello! >> > >> > I'm part of a student group that has been working on an erlang-based >> > cluster >> > for the half a year or so. We are currently writing the report for both >> > the >> > cluster and the course it was part of, and would like to use the edoc >> > comment documentation in the product report. But edoc makes html files, >> > which is a bit inconvenient for including in a report. >> > >> > Ideally we'd like to put the documentation for each application in one >> > big >> > pdf, but getting one pdf for each app would work fine too. >> > >> > Is there a way we can do this? >> > >> > Best regards, >> > Axel Andr?n, Student at Uppsala University >> > > > From chandrashekhar.mullaparthi@REDACTED Fri Jan 8 00:11:59 2010 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Thu, 7 Jan 2010 23:11:59 +0000 Subject: [erlang-questions] IP packet manipulation within Erlang In-Reply-To: <003d01ca8f96$170db0c0$991ea8c0@mtn.co.za> References: <4B459835.4000902@iki.fi> <003d01ca8f96$170db0c0$991ea8c0@mtn.co.za> Message-ID: Hi Trevor, 2010/1/7 Trevor Woollacott > 2010/1/7 Martti Kuparinen >> >> Hi, >>> >>> How suitable is Erlang for a small project where I'd like to >>> >>> - grab all incoming IP packets >>> - perform some IP header manipulation >>> - send out the modified packets >>> >>> I attempted this a few years ago. I tried to write a linked in driver >> which >> got packets from libipq [1]. That was painful. So I dumped the idea of >> using >> erlang at all, and did it all in C which was pretty straightforward and >> worked quite well. I didn't put any large load on it, but it was enough >> for >> what I was doing at the time. >> >> cheers >> Chandru >> >> [1] http://en.wikipedia.org/wiki/Libipq >> >> > Hi Chandru > > Do you mind elaborating on the issues that you experienced when writing the > linked in driver using libipq? > Sorry Trevor, I tried hard to recollect, but I can't remember. I do remember giving up using Erlang in frustration, and writing it in C, much to my annoyance because I could've done some really complex processing with the packet stream if I could get them into Erlang. Chandru From nem@REDACTED Fri Jan 8 00:32:31 2010 From: nem@REDACTED (Geoff Cant) Date: Fri, 08 Jan 2010 12:32:31 +1300 Subject: [erlang-questions] IP packet manipulation within Erlang In-Reply-To: <4B459835.4000902@iki.fi> (Martti Kuparinen's message of "Thu, 07 Jan 2010 10:15:49 +0200") References: <4B459835.4000902@iki.fi> Message-ID: Martti Kuparinen writes: > Hi, > > How suitable is Erlang for a small project where I'd like to > > - grab all incoming IP packets > - perform some IP header manipulation > - send out the modified packets > > I'm aware I need some kind of bpf/pcap driver to get the packets into > Erlang (or does Erlang now have something in this front). > > Do you guys have any idea how fast this whole thing would be compared > to doing same in normal userland C program? Or even compared to doing > the manipulation within Linux kernel. > > Martti Hi there, I've been working on a project which sounds like it could be suitable for the packet manipulation you want to do. Enet (http://github.com/archaelus/enet) is a very early stage network stack written in Erlang. The project also includes a port program that connects to a TAP device to send and receive raw ethernet frames to and from the host operating system. The tap program I have has only been tested on OS X, but I suspect it could work on Linux with small modifications. Enet can currently handle arp/icmp/ip and some aspects of udp for en/decoding. Cheers, -- Geoff Cant From kiszl@REDACTED Fri Jan 8 08:35:49 2010 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Fri, 8 Jan 2010 08:35:49 +0100 (CET) Subject: [erlang-questions] Telnet Client In-Reply-To: References: <4B42372A.5020107@eonblast.com> Message-ID: <28874.194.88.55.211.1262936149.squirrel@localhost> >> I just wonder why you are referring to the url of a mirror site >> instead of the original. >> By the way I don't even know if we link to this mirror site any more. > > I remembered that example, googled for it, and just pasted in the link. > Yeah, I also noticed that for most Erlang googling the ftp.sunet.se mirror is always the first result. Most of the times erlang.org is not even there... I wonder if Google "thinks" erlang.org is a mirror site of ftp.sunet.se. Zoltan. From kiszl@REDACTED Fri Jan 8 08:48:27 2010 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Fri, 8 Jan 2010 08:48:27 +0100 (CET) Subject: [erlang-questions] IP packet manipulation within Erlang In-Reply-To: References: <4B459835.4000902@iki.fi> Message-ID: <41341.194.88.55.211.1262936907.squirrel@localhost> > Martti Kuparinen writes: > >> Hi, >> >> How suitable is Erlang for a small project where I'd like to >> >> - grab all incoming IP packets >> - perform some IP header manipulation >> - send out the modified packets >> >> I'm aware I need some kind of bpf/pcap driver to get the packets into >> Erlang (or does Erlang now have something in this front). >> >> Do you guys have any idea how fast this whole thing would be compared >> to doing same in normal userland C program? Or even compared to doing >> the manipulation within Linux kernel. >> >> Martti > > Hi there, I've been working on a project which sounds like it could be > suitable for the packet manipulation you want to do. Enet > (http://github.com/archaelus/enet) is a very early stage network stack > written in Erlang. The project also includes a port program that > connects to a TAP device to send and receive raw ethernet frames to and > from the host operating system. > > The tap program I have has only been tested on OS X, but I suspect it > could work on Linux with small modifications. > > Enet can currently handle arp/icmp/ip and some aspects of udp for > en/decoding. > > Cheers, > -- > Geoff Cant > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > Do you have any figures on how the TAP device solution compares to others like PF_RING sockets and MMAP-ing in terms of required CPU power for a given traffic? BTW, how "efficient" is Erlang for IP packet defragmentation (RFC815)? I can't imagine reassembling a packet without some hipe wizardry at least. From toby@REDACTED Fri Jan 8 16:32:17 2010 From: toby@REDACTED (Toby Thain) Date: Fri, 8 Jan 2010 10:32:17 -0500 Subject: [erlang-questions] IP packet manipulation within Erlang In-Reply-To: References: <4B459835.4000902@iki.fi> <003d01ca8f96$170db0c0$991ea8c0@mtn.co.za> Message-ID: <0A9A4D49-5B39-4135-95FF-ADE8F6F14490@telegraphics.com.au> On 7-Jan-10, at 6:11 PM, Chandru wrote: > Hi Trevor, > > 2010/1/7 Trevor Woollacott > >> 2010/1/7 Martti Kuparinen >>> >>> Hi, >>>> >>>> How suitable is Erlang for a small project where I'd like to >>>> >>>> - grab all incoming IP packets >>>> - perform some IP header manipulation >>>> - send out the modified packets >>>> >>>> I attempted this a few years ago. I tried to write a linked in >>>> driver >>> which >>> got packets from libipq [1]. That was painful. So I dumped the >>> idea of >>> using >>> erlang at all, and did it all in C which was pretty >>> straightforward and >>> worked quite well. I didn't put any large load on it, but it was >>> enough >>> for >>> what I was doing at the time. >>> >>> cheers >>> Chandru >>> >>> [1] http://en.wikipedia.org/wiki/Libipq >>> >>> >> Hi Chandru >> >> Do you mind elaborating on the issues that you experienced when >> writing the >> linked in driver using libipq? >> > > Sorry Trevor, I tried hard to recollect, but I can't remember. I do > remember > giving up using Erlang in frustration, and writing it in C, much to my > annoyance because I could've done some really complex processing > with the > packet stream if I could get them into Erlang. Are you saying the complex processing would have been simpler in Erlang? What specifically was impossible in C? --Toby > > Chandru From jarrod@REDACTED Fri Jan 8 17:58:44 2010 From: jarrod@REDACTED (Jarrod Roberson) Date: Fri, 8 Jan 2010 11:58:44 -0500 Subject: [erlang-questions] Compiler to warn on used underscore-variables In-Reply-To: <4B455F57.1030409@m5net.com> References: <4B426250.60301@tmit.bme.hu> <3dbc6d1c1001041455k63a4baefw32e9fa55794f36ea@mail.gmail.com> <32645.194.88.55.211.1262679361.squirrel@localhost> <53070.194.88.55.211.1262681264.squirrel@localhost> <09095915-4DE7-4AC4-9AD5-AE2D8B3DA432@rogvall.se> <20100106193222.GA32320@woodman.lan> <4B455F57.1030409@m5net.com> Message-ID: On Wed, Jan 6, 2010 at 11:13 PM, Sam Bobroff wrote: > > (Actually, I was astonished to find that _X was not treated exactly like > _, so that would be my preferred solution. However, issuing the "not > unused" warning is much better than what happens now.) > > Sam > It is very well documented behvaior, there should be nothing suprising about this. >From the online documentation. "... *Variables starting with underscore (_), for example _Height, are normal variables, not anonymous.* They are however ignored by the compiler in the sense that they will not generate any warnings for unused variables. ..." From v@REDACTED Fri Jan 8 22:06:31 2010 From: v@REDACTED (Valentin Micic) Date: Fri, 8 Jan 2010 23:06:31 +0200 Subject: [erlang-questions] IP packet manipulation within Erlang In-Reply-To: <0A9A4D49-5B39-4135-95FF-ADE8F6F14490@telegraphics.com.au> Message-ID: <20100108210643.6A2D03D0D32@mail.pharos-avantgard.com> > What specifically was impossible in C? Well... when was the last time you've tried to amend the C/C++ code while it was running? V. From chandrashekhar.mullaparthi@REDACTED Fri Jan 8 22:16:07 2010 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Fri, 8 Jan 2010 21:16:07 +0000 Subject: [erlang-questions] IP packet manipulation within Erlang In-Reply-To: <0A9A4D49-5B39-4135-95FF-ADE8F6F14490@telegraphics.com.au> References: <4B459835.4000902@iki.fi> <003d01ca8f96$170db0c0$991ea8c0@mtn.co.za> <0A9A4D49-5B39-4135-95FF-ADE8F6F14490@telegraphics.com.au> Message-ID: 2010/1/8 Toby Thain > > On 7-Jan-10, at 6:11 PM, Chandru wrote: > >> Sorry Trevor, I tried hard to recollect, but I can't remember. I do >> remember >> giving up using Erlang in frustration, and writing it in C, much to my >> annoyance because I could've done some really complex processing with the >> packet stream if I could get them into Erlang. >> > > Are you saying the complex processing would have been simpler in Erlang? > > What specifically was impossible in C? > > I didn't say anything was impossible, it is just that I write code much faster in erlang than in C. It feels like a chore having to write code in C these days. Sure there are good reasons for it, but I can't be bothered. Chandru From hd2010@REDACTED Fri Jan 8 23:39:36 2010 From: hd2010@REDACTED (Henning Diedrich) Date: Fri, 08 Jan 2010 23:39:36 +0100 Subject: microseconds since midnight Message-ID: <4B47B428.4000101@eonblast.com> Hi, are now() and universaltime() incrementing their seconds count at the exact same time? So that the seconds from calendar:time_to_seconds(universaltime()) and the microseconds from now() could simply be added up S*1000000+Ms? Or would that risk having the microseconds going back to zero at different times then when the seconds counter is counted up? Thanks, Henning From ulf.wiger@REDACTED Sat Jan 9 00:33:43 2010 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Sat, 09 Jan 2010 00:33:43 +0100 Subject: [erlang-questions] microseconds since midnight In-Reply-To: <4B47B428.4000101@eonblast.com> References: <4B47B428.4000101@eonblast.com> Message-ID: <4B47C0D7.5080107@erlang-consulting.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Henning Diedrich wrote: > Hi, > > are now() and universaltime() incrementing their seconds count at the > exact same time? > > So that the seconds from calendar:time_to_seconds(universaltime()) and > the microseconds from now() could simply be added up S*1000000+Ms? > > Or would that risk having the microseconds going back to zero at > different times then when the seconds counter is counted up? now() is not guaranteed to show accurate wall-clock time. It is guaranteed to always increment at least by one microsecond for each call. It also normally adjusts its speed by up to 1% if it detects a deviation from the system clock. This is to ensure that the "real-time clock" of Erlang doesn't suddenly make a big leap in time just because some clueless operator changed the system time (or the system clock is in a time zone that obeys DST). As Erlang timers rely on now(), big leaps can either cause all timers to fire at once, or all of them going into deep sleep for a looong time, both of which can be equally disastrous. os:timestamp() looks like a now() object, but reads the system clock, and should behave the way you want. This function is a recent addition - R13, I think. BR, Ulf W -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAktHwNcACgkQtqqFieqzed1W7ACg92GMvW6WaN6vFRjyc3qzcaQM +ZoAn3Obne7EZk2gF2029IEgVgWUFeXv =XIOf -----END PGP SIGNATURE----- --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From hd2010@REDACTED Sat Jan 9 01:11:17 2010 From: hd2010@REDACTED (Henning Diedrich) Date: Sat, 09 Jan 2010 01:11:17 +0100 Subject: [erlang-questions] microseconds since midnight In-Reply-To: <4B47C0D7.5080107@erlang-consulting.com> References: <4B47B428.4000101@eonblast.com> <4B47C0D7.5080107@erlang-consulting.com> Message-ID: <4B47C9A5.40209@eonblast.com> Thanks for the education. I was actually looking for something as reliable as now(), i.e. deriving the milliseconds since midnight (subj line of post was simplifying) to get a relative, reliable four byte sync value to be sent across systems. I came up with the following. Bearing my original question in mind, maybe you can see at a glance if this is safe. Or, since it needs to be done often, could be done cheaper. Thanks a lot! Henning %% Milliseconds since midnight. ------------------ nightsynctime_offset() -> {_, Time_1} = erlang:universaltime(), SSMN_1 = calendar:time_to_seconds(Time_1), {MegaSec_2, Seconds_2, _} = now(), % MidNightOffset = (MegaSec_2 * 1000000) + Seconds_2 - SSMN_1. nightsynctime(MidNightOffset) -> {MegaSec_3, Seconds_3, MicroSec_3} = now(), % NightSyncTime = (MegaSec_3 * 1000000 + Seconds_3 - MidNightOffset) * 1000 + trunc(MicroSec_3 / 1000). %% Test ------------------------------------------------ start() -> secondtimes(), MidNightOffset = nightsynctime_offset(), loop(MidNightOffset, 0). loop(MidNightOffset, LastSync) -> SyncTime = nightsynctime(MidNightOffset), io:format("~p~n", [SyncTime]), % test (do in the day, obviously) if SyncTime < LastSync -> exit("counting backwards") ; true -> ok end, timer:sleep(166), loop(MidNightOffset, SyncTime). Output: 328986 329153 329320 329487 329654 329821 ... Ulf Wiger wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Henning Diedrich wrote: > >> Hi, >> >> are now() and universaltime() incrementing their seconds count at the >> exact same time? >> >> So that the seconds from calendar:time_to_seconds(universaltime()) and >> the microseconds from now() could simply be added up S*1000000+Ms? >> >> Or would that risk having the microseconds going back to zero at >> different times then when the seconds counter is counted up? >> > > now() is not guaranteed to show accurate wall-clock time. It is > guaranteed to always increment at least by one microsecond for each > call. It also normally adjusts its speed by up to 1% if it detects > a deviation from the system clock. This is to ensure that the > "real-time clock" of Erlang doesn't suddenly make a big leap in > time just because some clueless operator changed the system time > (or the system clock is in a time zone that obeys DST). As > Erlang timers rely on now(), big leaps can either cause all timers > to fire at once, or all of them going into deep sleep for a looong > time, both of which can be equally disastrous. > > os:timestamp() looks like a now() object, but reads the system clock, > and should behave the way you want. This function is a recent > addition - R13, I think. > > BR, > Ulf W > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iEYEARECAAYFAktHwNcACgkQtqqFieqzed1W7ACg92GMvW6WaN6vFRjyc3qzcaQM > +ZoAn3Obne7EZk2gF2029IEgVgWUFeXv > =XIOf > -----END PGP SIGNATURE----- > --------------------------------------------------- > > --------------------------------------------------- > > WE'VE CHANGED NAMES! > > Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. > > www.erlang-solutions.com > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > > From kagato@REDACTED Sat Jan 9 01:26:27 2010 From: kagato@REDACTED (Jayson Vantuyl) Date: Fri, 8 Jan 2010 16:26:27 -0800 Subject: [erlang-questions] microseconds since midnight In-Reply-To: <4B47C9A5.40209@eonblast.com> References: <4B47B428.4000101@eonblast.com> <4B47C0D7.5080107@erlang-consulting.com> <4B47C9A5.40209@eonblast.com> Message-ID: Is it important that it reset at midnight? Would it be acceptable to have a 4-byte value that increased but just rolled over occasionally (instead of each morning)? Otherwise, you could just convert the time to an integer and then take the modulus to mask it down. On Jan 8, 2010, at 4:11 PM, Henning Diedrich wrote: > Thanks for the education. > > I was actually looking for something as reliable as now(), i.e. deriving the milliseconds since midnight (subj line of post was simplifying) to get a relative, reliable four byte sync value to be sent across systems. > > I came up with the following. Bearing my original question in mind, maybe you can see at a glance if this is safe. Or, since it needs to be done often, could be done cheaper. Thanks a lot! > > Henning > > > %% Milliseconds since midnight. ------------------ > > nightsynctime_offset() -> {_, Time_1} = erlang:universaltime(), > SSMN_1 = calendar:time_to_seconds(Time_1), > {MegaSec_2, Seconds_2, _} = now(), > % MidNightOffset = > (MegaSec_2 * 1000000) + Seconds_2 - SSMN_1. > nightsynctime(MidNightOffset) -> > > {MegaSec_3, Seconds_3, MicroSec_3} = now(), > % NightSyncTime = > (MegaSec_3 * 1000000 + Seconds_3 - MidNightOffset) * 1000 > + trunc(MicroSec_3 / 1000). > %% Test ------------------------------------------------ > start() -> > > secondtimes(), > MidNightOffset = nightsynctime_offset(), > loop(MidNightOffset, 0). > > loop(MidNightOffset, LastSync) -> > > SyncTime = nightsynctime(MidNightOffset), > io:format("~p~n", [SyncTime]), > % test (do in the day, obviously) > if SyncTime < LastSync -> exit("counting backwards") ; true -> ok end, > timer:sleep(166), > loop(MidNightOffset, SyncTime). > Output: > > 328986 > 329153 > 329320 > 329487 > 329654 > 329821 > ... > > > > Ulf Wiger wrote: >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> Henning Diedrich wrote: >> >>> Hi, >>> >>> are now() and universaltime() incrementing their seconds count at the >>> exact same time? >>> >>> So that the seconds from calendar:time_to_seconds(universaltime()) and >>> the microseconds from now() could simply be added up S*1000000+Ms? >>> >>> Or would that risk having the microseconds going back to zero at >>> different times then when the seconds counter is counted up? >>> >> >> now() is not guaranteed to show accurate wall-clock time. It is >> guaranteed to always increment at least by one microsecond for each >> call. It also normally adjusts its speed by up to 1% if it detects >> a deviation from the system clock. This is to ensure that the >> "real-time clock" of Erlang doesn't suddenly make a big leap in >> time just because some clueless operator changed the system time >> (or the system clock is in a time zone that obeys DST). As >> Erlang timers rely on now(), big leaps can either cause all timers >> to fire at once, or all of them going into deep sleep for a looong >> time, both of which can be equally disastrous. >> >> os:timestamp() looks like a now() object, but reads the system clock, >> and should behave the way you want. This function is a recent >> addition - R13, I think. >> >> BR, >> Ulf W >> -----BEGIN PGP SIGNATURE----- >> Version: GnuPG v1.4.9 (GNU/Linux) >> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org >> >> iEYEARECAAYFAktHwNcACgkQtqqFieqzed1W7ACg92GMvW6WaN6vFRjyc3qzcaQM >> +ZoAn3Obne7EZk2gF2029IEgVgWUFeXv >> =XIOf >> -----END PGP SIGNATURE----- >> --------------------------------------------------- >> >> --------------------------------------------------- >> >> WE'VE CHANGED NAMES! >> >> Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. >> >> www.erlang-solutions.com >> >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> >> > From toby@REDACTED Sat Jan 9 02:39:00 2010 From: toby@REDACTED (Toby Thain) Date: Fri, 8 Jan 2010 20:39:00 -0500 Subject: [erlang-questions] IP packet manipulation within Erlang In-Reply-To: References: <4B459835.4000902@iki.fi> <003d01ca8f96$170db0c0$991ea8c0@mtn.co.za> <0A9A4D49-5B39-4135-95FF-ADE8F6F14490@telegraphics.com.au> Message-ID: <3C8B49E9-17FD-40A6-8FD2-4AC25DA7900D@telegraphics.com.au> On 8-Jan-10, at 4:16 PM, Chandru wrote: > 2010/1/8 Toby Thain > >> >> On 7-Jan-10, at 6:11 PM, Chandru wrote: >> >>> Sorry Trevor, I tried hard to recollect, but I can't remember. I do >>> remember >>> giving up using Erlang in frustration, and writing it in C, much >>> to my >>> annoyance because I could've done some really complex processing >>> with the >>> packet stream if I could get them into Erlang. >>> >> >> Are you saying the complex processing would have been simpler in >> Erlang? >> >> What specifically was impossible in C? >> >> > I didn't say anything was impossible, it is just that I write code > much > faster in erlang than in C. It feels like a chore having to write > code in C > these days. Sure there are good reasons for it, but I can't be > bothered. Right, understood. Just didn't quite parse that from your comment. --T > > Chandru From hd2010@REDACTED Sat Jan 9 11:21:05 2010 From: hd2010@REDACTED (Henning Diedrich) Date: Sat, 09 Jan 2010 11:21:05 +0100 Subject: [erlang-questions] microseconds since midnight In-Reply-To: References: <4B47B428.4000101@eonblast.com> <4B47C0D7.5080107@erlang-consulting.com> <4B47C9A5.40209@eonblast.com> Message-ID: <4B485891.2070107@eonblast.com> Thanks for the suggestion, Jayson. Thinking about it, that simplicity may make it less error prone when coping with a possible one-sided roll over right when two sides compare their timestamps. It may just 'look' less controlled than 'midnight' as the fix point that eventually isn't fixed at all. I'll keep it in mind. Henning Jayson Vantuyl wrote: > Is it important that it reset at midnight? Would it be acceptable to have a 4-byte value that increased but just rolled over occasionally (instead of each morning)? > > Otherwise, you could just convert the time to an integer and then take the modulus to mask it down. > > On Jan 8, 2010, at 4:11 PM, Henning Diedrich wrote: > > >> Thanks for the education. >> >> I was actually looking for something as reliable as now(), i.e. deriving the milliseconds since midnight (subj line of post was simplifying) to get a relative, reliable four byte sync value to be sent across systems. >> >> I came up with the following. Bearing my original question in mind, maybe you can see at a glance if this is safe. Or, since it needs to be done often, could be done cheaper. Thanks a lot! >> >> Henning >> >> >> %% Milliseconds since midnight. ------------------ >> >> nightsynctime_offset() -> {_, Time_1} = erlang:universaltime(), >> SSMN_1 = calendar:time_to_seconds(Time_1), >> {MegaSec_2, Seconds_2, _} = now(), >> % MidNightOffset = >> (MegaSec_2 * 1000000) + Seconds_2 - SSMN_1. >> nightsynctime(MidNightOffset) -> >> >> {MegaSec_3, Seconds_3, MicroSec_3} = now(), >> % NightSyncTime = >> (MegaSec_3 * 1000000 + Seconds_3 - MidNightOffset) * 1000 >> + trunc(MicroSec_3 / 1000). >> %% Test ------------------------------------------------ >> start() -> >> >> secondtimes(), >> MidNightOffset = nightsynctime_offset(), >> loop(MidNightOffset, 0). >> >> loop(MidNightOffset, LastSync) -> >> >> SyncTime = nightsynctime(MidNightOffset), >> io:format("~p~n", [SyncTime]), >> % test (do in the day, obviously) >> if SyncTime < LastSync -> exit("counting backwards") ; true -> ok end, >> timer:sleep(166), >> loop(MidNightOffset, SyncTime). >> Output: >> >> 328986 >> 329153 >> 329320 >> 329487 >> 329654 >> 329821 >> ... >> >> >> >> Ulf Wiger wrote: >> >>> -----BEGIN PGP SIGNED MESSAGE----- >>> Hash: SHA1 >>> >>> Henning Diedrich wrote: >>> >>> >>>> Hi, >>>> >>>> are now() and universaltime() incrementing their seconds count at the >>>> exact same time? >>>> >>>> So that the seconds from calendar:time_to_seconds(universaltime()) and >>>> the microseconds from now() could simply be added up S*1000000+Ms? >>>> >>>> Or would that risk having the microseconds going back to zero at >>>> different times then when the seconds counter is counted up? >>>> >>>> >>> now() is not guaranteed to show accurate wall-clock time. It is >>> guaranteed to always increment at least by one microsecond for each >>> call. It also normally adjusts its speed by up to 1% if it detects >>> a deviation from the system clock. This is to ensure that the >>> "real-time clock" of Erlang doesn't suddenly make a big leap in >>> time just because some clueless operator changed the system time >>> (or the system clock is in a time zone that obeys DST). As >>> Erlang timers rely on now(), big leaps can either cause all timers >>> to fire at once, or all of them going into deep sleep for a looong >>> time, both of which can be equally disastrous. >>> >>> os:timestamp() looks like a now() object, but reads the system clock, >>> and should behave the way you want. This function is a recent >>> addition - R13, I think. >>> >>> BR, >>> Ulf W >>> -----BEGIN PGP SIGNATURE----- >>> Version: GnuPG v1.4.9 (GNU/Linux) >>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org >>> >>> iEYEARECAAYFAktHwNcACgkQtqqFieqzed1W7ACg92GMvW6WaN6vFRjyc3qzcaQM >>> +ZoAn3Obne7EZk2gF2029IEgVgWUFeXv >>> =XIOf >>> -----END PGP SIGNATURE----- >>> --------------------------------------------------- >>> >>> --------------------------------------------------- >>> >>> WE'VE CHANGED NAMES! >>> >>> Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. >>> >>> www.erlang-solutions.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 hd2010@REDACTED Sat Jan 9 11:47:30 2010 From: hd2010@REDACTED (Henning Diedrich) Date: Sat, 09 Jan 2010 11:47:30 +0100 Subject: [erlang-questions] microseconds since midnight In-Reply-To: <8209f741001090023x65c5cabdja0c744568803a944@mail.gmail.com> References: <4B47B428.4000101@eonblast.com> <4B47C0D7.5080107@erlang-consulting.com> <4B47C9A5.40209@eonblast.com> <8209f741001090023x65c5cabdja0c744568803a944@mail.gmail.com> Message-ID: <4B485EC2.3070901@eonblast.com> Hi Ulf, As it is now, I don't poll time twice. But I depend on state,using a constant MidNightOffset. I should stick with now() if I got you right and that's what the code below should allow for. The features you explained about now() are exactly what I need. 1% deviation from wall clock is fine, no jumps are important, being in sync with Erlang timers even opens up a host of extra possibilities I am now looking at. Thanks for pointing that out. The functions below create the offset once (nightsynctime_offset), as rough total seconds between 1.1.70 and last midnight and and then every time I need the 4 byte sync timestamp, a call of nightsynctime(Offset) is made, which simply substracts the Offset from now. Eventually it's not important that the Offset is exact but only that it stays the same. Where Jayson's suggestion comes in, to shave off the entire overhead. Thanks, Henning % Notes % http://ftp.sunet.se/pub//lang/erlang/doc/man/erl.html % % Erl option +c % Disable compensation for sudden changes of system time. % % Normally, erlang:now/0 will not immediately reflect sudden changes in the system % time, in order to keep timers (including receive-after) working. Instead, the time % maintained by erlang:now/0 is slowly adjusted towards the new system time. (Slowly % means in one percent adjustments; if the time is off by one minute, the time % will be % adjusted in 100 minutes.) % % When the +c option is given, this slow adjustment will not take place. Instead % erlang:now/0 will always reflect the current system time. Note that timers are based on % erlang:now/0. If the system time jumps, timers then time out at the wrong time. Ulf Wiger wrote: > Since os:timespamp() and universaltime() are derived from the same > system clock, it would be better to call TS=os:timestamp() and then > calendar:now_to_datetime(TS). This will eliminate the race condition > of having to sample the time twice. > > BR, > Ulf W > > 2010/1/9, Henning Diedrich : > >> Thanks for the education. >> >> I was actually looking for something as reliable as now(), i.e. deriving >> the milliseconds since midnight (subj line of post was simplifying) to >> get a relative, reliable four byte sync value to be sent across systems. >> >> I came up with the following. Bearing my original question in mind, >> maybe you can see at a glance if this is safe. Or, since it needs to be >> done often, could be done cheaper. Thanks a lot! >> >> Henning >> >> >> %% Milliseconds since midnight. ------------------ >> >> nightsynctime_offset() -> >> >> {_, Time_1} = erlang:universaltime(), >> SSMN_1 = calendar:time_to_seconds(Time_1), >> {MegaSec_2, Seconds_2, _} = now(), >> % MidNightOffset = >> (MegaSec_2 * 1000000) + Seconds_2 - SSMN_1. >> >> nightsynctime(MidNightOffset) -> >> >> {MegaSec_3, Seconds_3, MicroSec_3} = now(), >> % NightSyncTime = >> (MegaSec_3 * 1000000 + Seconds_3 - MidNightOffset) * 1000 >> + trunc(MicroSec_3 / 1000). >> >> %% Test ------------------------------------------------ >> >> start() -> >> >> secondtimes(), >> MidNightOffset = nightsynctime_offset(), >> loop(MidNightOffset, 0). >> >> loop(MidNightOffset, LastSync) -> >> >> SyncTime = nightsynctime(MidNightOffset), >> io:format("~p~n", [SyncTime]), >> >> % test (do in the day, obviously) >> if SyncTime < LastSync -> exit("counting backwards") ; true -> ok end, >> >> timer:sleep(166), >> loop(MidNightOffset, SyncTime). >> >> >> Output: >> >> 328986 >> 329153 >> 329320 >> 329487 >> 329654 >> 329821 >> ... >> >> >> >> Ulf Wiger wrote: >> >>> -----BEGIN PGP SIGNED MESSAGE----- >>> Hash: SHA1 >>> >>> Henning Diedrich wrote: >>> >>> >>>> Hi, >>>> >>>> are now() and universaltime() incrementing their seconds count at the >>>> exact same time? >>>> >>>> So that the seconds from calendar:time_to_seconds(universaltime()) and >>>> the microseconds from now() could simply be added up S*1000000+Ms? >>>> >>>> Or would that risk having the microseconds going back to zero at >>>> different times then when the seconds counter is counted up? >>>> >>>> >>> now() is not guaranteed to show accurate wall-clock time. It is >>> guaranteed to always increment at least by one microsecond for each >>> call. It also normally adjusts its speed by up to 1% if it detects >>> a deviation from the system clock. This is to ensure that the >>> "real-time clock" of Erlang doesn't suddenly make a big leap in >>> time just because some clueless operator changed the system time >>> (or the system clock is in a time zone that obeys DST). As >>> Erlang timers rely on now(), big leaps can either cause all timers >>> to fire at once, or all of them going into deep sleep for a looong >>> time, both of which can be equally disastrous. >>> >>> os:timestamp() looks like a now() object, but reads the system clock, >>> and should behave the way you want. This function is a recent >>> addition - R13, I think. >>> >>> BR, >>> Ulf W >>> -----BEGIN PGP SIGNATURE----- >>> Version: GnuPG v1.4.9 (GNU/Linux) >>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org >>> >>> iEYEARECAAYFAktHwNcACgkQtqqFieqzed1W7ACg92GMvW6WaN6vFRjyc3qzcaQM >>> +ZoAn3Obne7EZk2gF2029IEgVgWUFeXv >>> =XIOf >>> -----END PGP SIGNATURE----- >>> --------------------------------------------------- >>> >>> --------------------------------------------------- >>> >>> WE'VE CHANGED NAMES! >>> >>> Since January 1st 2010 Erlang Training and Consulting Ltd. has become >>> ERLANG SOLUTIONS LTD. >>> >>> www.erlang-solutions.com >>> >>> >>> ________________________________________________________________ >>> erlang-questions mailing list. See http://www.erlang.org/faq.html >>> erlang-questions (at) erlang.org >>> >>> >>> >>> >> > > From max.lapshin@REDACTED Sat Jan 9 18:50:37 2010 From: max.lapshin@REDACTED (Max Lapshin) Date: Sat, 9 Jan 2010 20:50:37 +0300 Subject: Web server structure: Rack Message-ID: Hi, I've promised to talk about better structure of web stack. I want to tell about Ruby on Rails experience. Basically Rails application is built according to MVC paradigm: Model, View, Controller. Perhaps everyone here have heard about it. Most interesting here will be speak about structure of View and Controller layers. Web application violates pure MVC structure, because in web application controller must present object of Model layer to template engine. So, after years of development, Rails came to the concept of Rack infrastructure. After parsing HTTP headers request is represented as hash table with http headers. Then this request is passed through configured chain of filters, that is ended with some handler. Let's look at an example config: use ActionController::Failsafe # this is global exception handler, that captures all errors and show 500 in use ActionController::PageCache # tries to find whole page cached map "/advert" do # enables mapping all requests to /advert to special handler. run FastAdvertHandler end map "/" do # all other requests are moving to this section use ActionController::Session::CookieStore, , {:secret=>"some_key", :session_key=>"_rails_session"} # loads session from cookie use ActionController::ParamsParser # decode all params and parses query string use Rack::Head # discard body is HTTP HEAD use Rails::Router # checkout what controller and action will handle request run Rails::Dispatcher end Each filter can store required information in mutable request, which is hash. Lets look at code of such filter: module Rack module Session class Cookie def initialize(app, options = {}) @app = app @key = options[:key] || "rack.session" # Variables, starting from @ in ruby are just object instance variables @secret = options[:secret] end def call(env) # this method is by interface, requred method of each handler load_session(env) # this method take status, headers, body = @app.call(env) # this line is by interface required part of calling further request processing. commit_session(env, status, headers, body) end def load_session(env) env["rack.session"] = load_session_from_cookie(env[@key]) # here we take cookie, named the same as our key and decode it end def commit_session ... # this method packs session to cookie back. end end end end It is very important, that each filter can control, when to call subfilters up to last request handler. Second important thing, that there is defined convention, how to name request keys: env["rack.session"] is for session, env["request.error"] is for backtrace of request exceptions. Let's look, how would it be possible to repeat this structure in Erlang: -module(rack_server). -export([rack_config/0]). rack_config() -> [ controller_failsafe, % name of module controller_cookiestore:new("secretstring", "_example_session"), ... ]. Here is sketch: http://github.com/maxlapshin/erack/blob/master/src/example_server.erl so can look controller_failsafe module: -module(controller_failsafe). -export([call/2]). -behaviour(rack_handler). call(App, Request) -> try App:call(Request) of Reply -> Reply catch error:notfound -> [404, [{"Content-Type", "text/plain"}], "404 Not found"]; _:_ -> [500, [{"Content-Type", "text/plain"}], "500 Server error"++lists:flatten(io_lib:format("~n~p~n", [erlang:get_stacktrace()]))] end. Concept of Rack handlers became a glue idea for most ruby frameworks, making useless many of them, because they appeared to be just a one rack config with some set of handlers =) What do I want? To discuss this api and promote its implementation in erlang web servers. Also it would be great to extract implementation of the whole controller layer out of Zotonic CMS into reusable components. I'm willing to reuse its code in my applications, but it is impossible, because business logic and infrastructure logic are in one repository. From seancribbs@REDACTED Sat Jan 9 19:23:34 2010 From: seancribbs@REDACTED (Sean Cribbs) Date: Sat, 09 Jan 2010 13:23:34 -0500 Subject: [erlang-questions] Web server structure: Rack In-Reply-To: References: Message-ID: <4B48C9A6.6000801@gmail.com> Max, Have you seen ewgi? It's similar to Rack and WSGI. http://code.google.com/p/ewgi/ Sean On 1/9/10 12:50 PM, Max Lapshin wrote: > Hi, I've promised to talk about better structure of web stack. I want > to tell about Ruby on Rails experience. > Basically Rails application is built according to MVC paradigm: Model, > View, Controller. Perhaps everyone here have > heard about it. > > Most interesting here will be speak about structure of View and > Controller layers. Web application violates pure MVC structure, > because in web application controller must present object of Model > layer to template engine. > > So, after years of development, Rails came to the concept of Rack > infrastructure. > > After parsing HTTP headers request is represented as hash table with > http headers. Then this request is passed > through configured chain of filters, that is ended with some handler. > > Let's look at an example config: > > use ActionController::Failsafe # this is global exception handler, > that captures all errors and show 500 in > use ActionController::PageCache # tries to find whole page cached > map "/advert" do # enables mapping all requests to > /advert to special handler. > run FastAdvertHandler > end > > map "/" do # all other requests are > moving to this section > use ActionController::Session::CookieStore, , {:secret=>"some_key", > :session_key=>"_rails_session"} # loads session from cookie > use ActionController::ParamsParser # decode all params and > parses query string > use Rack::Head # discard body is HTTP HEAD > use Rails::Router # checkout what > controller and action will handle request > run Rails::Dispatcher > end > > > Each filter can store required information in mutable request, which > is hash. Lets look at code of such filter: > > > module Rack > module Session > class Cookie > def initialize(app, options = {}) > @app = app > @key = options[:key] || "rack.session" # Variables, > starting from @ in ruby are just object instance variables > @secret = options[:secret] > end > > def call(env) # this method is by interface, requred method > of each handler > load_session(env) # this method take > status, headers, body = @app.call(env) # this line is > by interface required part of calling further request processing. > commit_session(env, status, headers, body) > end > > def load_session(env) > env["rack.session"] = load_session_from_cookie(env[@key]) # > here we take cookie, named the same as our key and decode it > end > > def commit_session > ... # this method packs session to cookie back. > end > end > end > end > > > It is very important, that each filter can control, when to call > subfilters up to last request handler. > Second important thing, that there is defined convention, how to name > request keys: env["rack.session"] is for session, > env["request.error"] is for backtrace of request exceptions. > > Let's look, how would it be possible to repeat this structure in Erlang: > > > -module(rack_server). > -export([rack_config/0]). > > rack_config() -> > [ > controller_failsafe, % name of module > controller_cookiestore:new("secretstring", "_example_session"), > ... > ]. > > Here is sketch: > http://github.com/maxlapshin/erack/blob/master/src/example_server.erl > > so can look controller_failsafe module: > > -module(controller_failsafe). > -export([call/2]). > -behaviour(rack_handler). > > call(App, Request) -> > try App:call(Request) of > Reply -> Reply > catch > error:notfound -> [404, [{"Content-Type", "text/plain"}], "404 Not found"]; > _:_ -> [500, [{"Content-Type", "text/plain"}], "500 Server > error"++lists:flatten(io_lib:format("~n~p~n", > [erlang:get_stacktrace()]))] > end. > > > > Concept of Rack handlers became a glue idea for most ruby frameworks, > making useless many of them, because they appeared to be just a one > rack config with some set of handlers =) > > What do I want? To discuss this api and promote its implementation in > erlang web servers. Also it would be great to extract implementation > of the whole controller layer > out of Zotonic CMS into reusable components. I'm willing to reuse its > code in my applications, but it is impossible, because business logic > and infrastructure logic are in one repository. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > > From tony@REDACTED Sat Jan 9 22:21:16 2010 From: tony@REDACTED (Tony Arcieri) Date: Sat, 9 Jan 2010 14:21:16 -0700 Subject: Can't pass a record to a macro? Message-ID: I was surprised when this didn't work: -module(gib). -export([gib/0]). -define(foo(Bar), Bar#bar.baz). -record(bar, {baz=42}). gib() -> ?foo(#bar{}). I get the following errors when compiling it: ./gib.erl:7: syntax error before: '#' ./gib.erl:2: function gib/0 undefined ./gib.erl:4: Warning: record bar is unused Is this not supported? -- Tony Arcieri Medioh! A Kudelski Brand From kiszl@REDACTED Sat Jan 9 22:25:35 2010 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Sat, 09 Jan 2010 22:25:35 +0100 Subject: [erlang-questions] Can't pass a record to a macro? In-Reply-To: References: Message-ID: <4B48F44F.2030207@tmit.bme.hu> The result of this macro call is #bar{}#bar.baz What's that supposed to mean? Tony Arcieri wrote: > I was surprised when this didn't work: > > -module(gib). > -export([gib/0]). > -define(foo(Bar), Bar#bar.baz). > -record(bar, {baz=42}). > > gib() -> > ?foo(#bar{}). > > I get the following errors when compiling it: > > ./gib.erl:7: syntax error before: '#' > ./gib.erl:2: function gib/0 undefined > ./gib.erl:4: Warning: record bar is unused > > Is this not supported? > > From kiszl@REDACTED Sat Jan 9 22:29:51 2010 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Sat, 09 Jan 2010 22:29:51 +0100 Subject: [erlang-questions] Can't pass a record to a macro? In-Reply-To: <4B48F44F.2030207@tmit.bme.hu> References: <4B48F44F.2030207@tmit.bme.hu> Message-ID: <4B48F54F.5050209@tmit.bme.hu> Nevermind. I got it :) You need to use parentheses: -define(foo(Bar), (Bar)#bar.baz). Zoltan Lajos Kis wrote: > The result of this macro call is > #bar{}#bar.baz > > What's that supposed to mean? > > > Tony Arcieri wrote: >> I was surprised when this didn't work: >> >> -module(gib). >> -export([gib/0]). >> -define(foo(Bar), Bar#bar.baz). >> -record(bar, {baz=42}). >> >> gib() -> >> ?foo(#bar{}). >> >> I get the following errors when compiling it: >> >> ./gib.erl:7: syntax error before: '#' >> ./gib.erl:2: function gib/0 undefined >> ./gib.erl:4: Warning: record bar is unused >> >> Is this not supported? >> >> > > From tony@REDACTED Sun Jan 10 00:48:22 2010 From: tony@REDACTED (Tony Arcieri) Date: Sat, 9 Jan 2010 16:48:22 -0700 Subject: [erlang-questions] Can't pass a record to a macro? In-Reply-To: <4B48F54F.5050209@tmit.bme.hu> References: <4B48F44F.2030207@tmit.bme.hu> <4B48F54F.5050209@tmit.bme.hu> Message-ID: On Sat, Jan 9, 2010 at 2:29 PM, Zoltan Lajos Kis wrote: > You need to use parentheses: > > -define(foo(Bar), (Bar)#bar.baz). > Whoops, my bad. Figured it'd be something silly. -- Tony Arcieri Medioh! A Kudelski Brand From ulf.wiger@REDACTED Sun Jan 10 12:22:13 2010 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Sun, 10 Jan 2010 12:22:13 +0100 Subject: [erlang-questions] microseconds since midnight In-Reply-To: <4B485EC2.3070901@eonblast.com> References: <4B47B428.4000101@eonblast.com> <4B47C0D7.5080107@erlang-consulting.com> <4B47C9A5.40209@eonblast.com> <8209f741001090023x65c5cabdja0c744568803a944@mail.gmail.com> <4B485EC2.3070901@eonblast.com> Message-ID: <4B49B865.6000506@erlang-consulting.com> Henning Diedrich wrote: > Hi Ulf, > > As it is now, I don't poll time twice. But I depend on state,using a > constant MidNightOffset. But you do check it twice: > nightsynctime_offset() -> > > {_, Time_1} = erlang:universaltime(), %% <- HERE > SSMN_1 = calendar:time_to_seconds(Time_1), > {MegaSec_2, Seconds_2, _} = now(), %% <- AND HERE > % MidNightOffset = > (MegaSec_2 * 1000000) + Seconds_2 - SSMN_1. Rather than first calling universaltime() and then calling now, call now() once, and then use calendar:now_to_datetime(Now) to derive the other representation from that one sample. When you run small-scale tests without load, you won't notice a difference, but on a heavily loaded system, the admittedly unlikely event that the process is scheduled out between the call to universaltime() and the call to now() right around midnight, could well give you a situation where the universaltime() call shows {23,59,59}, while the now() call shows a time right after midnight. But as you also talked about sending these values to other nodes, you will of course also have to contend with the fact that the system clocks on different nodes can at best be sychronized to within a few ms using NTP. You should never rely on wall-clock time for synchronization across the network. But perhaps I misunderstood your intent? BR, Ulf W -- Ulf Wiger CTO, Erlang Solutions Ltd, formerly Erlang Training & Consulting Ltd http://www.erlang-solutions.com --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From dmitriid@REDACTED Sun Jan 10 14:19:03 2010 From: dmitriid@REDACTED (Dmitrii Dimandt) Date: Sun, 10 Jan 2010 15:19:03 +0200 Subject: [erlang-questions] Web server structure: Rack In-Reply-To: <4B48C9A6.6000801@gmail.com> References: <4B48C9A6.6000801@gmail.com> Message-ID: It's actually http://github.com/skarab/ewgi now > Max, > > Have you seen ewgi? It's similar to Rack and WSGI. http://code.google.com/p/ewgi/ > > Sean > > On 1/9/10 12:50 PM, Max Lapshin wrote: >> Hi, I've promised to talk about better structure of web stack. I want >> to tell about Ruby on Rails experience. >> Basically Rails application is built according to MVC paradigm: Model, >> View, Controller. Perhaps everyone here have >> heard about it. >> >> Most interesting here will be speak about structure of View and >> Controller layers. Web application violates pure MVC structure, >> because in web application controller must present object of Model >> layer to template engine. >> >> So, after years of development, Rails came to the concept of Rack >> infrastructure. >> >> After parsing HTTP headers request is represented as hash table with >> http headers. Then this request is passed >> through configured chain of filters, that is ended with some handler. >> >> Let's look at an example config: >> >> use ActionController::Failsafe # this is global exception handler, >> that captures all errors and show 500 in >> use ActionController::PageCache # tries to find whole page cached >> map "/advert" do # enables mapping all requests to >> /advert to special handler. >> run FastAdvertHandler >> end >> >> map "/" do # all other requests are >> moving to this section >> use ActionController::Session::CookieStore, , {:secret=>"some_key", >> :session_key=>"_rails_session"} # loads session from cookie >> use ActionController::ParamsParser # decode all params and >> parses query string >> use Rack::Head # discard body is HTTP HEAD >> use Rails::Router # checkout what >> controller and action will handle request >> run Rails::Dispatcher >> end >> >> >> Each filter can store required information in mutable request, which >> is hash. Lets look at code of such filter: >> >> >> module Rack >> module Session >> class Cookie >> def initialize(app, options = {}) >> @app = app >> @key = options[:key] || "rack.session" # Variables, >> starting from @ in ruby are just object instance variables >> @secret = options[:secret] >> end >> >> def call(env) # this method is by interface, requred method >> of each handler >> load_session(env) # this method take >> status, headers, body = @app.call(env) # this line is >> by interface required part of calling further request processing. >> commit_session(env, status, headers, body) >> end >> >> def load_session(env) >> env["rack.session"] = load_session_from_cookie(env[@key]) # >> here we take cookie, named the same as our key and decode it >> end >> >> def commit_session >> ... # this method packs session to cookie back. >> end >> end >> end >> end >> >> >> It is very important, that each filter can control, when to call >> subfilters up to last request handler. >> Second important thing, that there is defined convention, how to name >> request keys: env["rack.session"] is for session, >> env["request.error"] is for backtrace of request exceptions. >> >> Let's look, how would it be possible to repeat this structure in Erlang: >> >> >> -module(rack_server). >> -export([rack_config/0]). >> >> rack_config() -> >> [ >> controller_failsafe, % name of module >> controller_cookiestore:new("secretstring", "_example_session"), >> ... >> ]. >> >> Here is sketch: >> http://github.com/maxlapshin/erack/blob/master/src/example_server.erl >> >> so can look controller_failsafe module: >> >> -module(controller_failsafe). >> -export([call/2]). >> -behaviour(rack_handler). >> >> call(App, Request) -> >> try App:call(Request) of >> Reply -> Reply >> catch >> error:notfound -> [404, [{"Content-Type", "text/plain"}], "404 Not found"]; >> _:_ -> [500, [{"Content-Type", "text/plain"}], "500 Server >> error"++lists:flatten(io_lib:format("~n~p~n", >> [erlang:get_stacktrace()]))] >> end. >> >> >> >> Concept of Rack handlers became a glue idea for most ruby frameworks, >> making useless many of them, because they appeared to be just a one >> rack config with some set of handlers =) >> >> What do I want? To discuss this api and promote its implementation in >> erlang web servers. Also it would be great to extract implementation >> of the whole controller layer >> out of Zotonic CMS into reusable components. I'm willing to reuse its >> code in my applications, but it is impossible, because business logic >> and infrastructure logic are in one repository. >> >> ________________________________________________________________ >> 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 steven.charles.davis@REDACTED Sun Jan 10 15:46:25 2010 From: steven.charles.davis@REDACTED (Steve Davis) Date: Sun, 10 Jan 2010 06:46:25 -0800 (PST) Subject: Web server structure: Rack In-Reply-To: References: Message-ID: <0e24ebfd-1e43-4b1f-9de9-c2dc53724a83@m25g2000yqc.googlegroups.com> Hi Max, IIRC none of this seems to be radically different to what the inets httpd mod_* api does/enables. What's wrong with building on inets? Why do we reinvent the web layer for OTP so often? BTW I am genuinely extremely interested in answers to these questions. /s From max.lapshin@REDACTED Sun Jan 10 15:59:03 2010 From: max.lapshin@REDACTED (Max Lapshin) Date: Sun, 10 Jan 2010 17:59:03 +0300 Subject: [erlang-questions] Re: Web server structure: Rack In-Reply-To: <0e24ebfd-1e43-4b1f-9de9-c2dc53724a83@m25g2000yqc.googlegroups.com> References: <0e24ebfd-1e43-4b1f-9de9-c2dc53724a83@m25g2000yqc.googlegroups.com> Message-ID: On Sun, Jan 10, 2010 at 5:46 PM, Steve Davis wrote: > Hi Max, > > IIRC none of this seems to be radically different to what the inets > httpd mod_* api does/enables. Yes, it does look like mod_*, however there are some questions: 1) as far as I understood, it is impossible to configure different stacks for different vhosts? As you can see in my example, I have added to process chain, module that decodes cookie into session. This decoder should use secret key, which is specific for vhost. 2) I haven't still found API for creating custom modules, so my two questions about specific cases with endless streams are actual. From max.lapshin@REDACTED Sun Jan 10 16:05:29 2010 From: max.lapshin@REDACTED (Max Lapshin) Date: Sun, 10 Jan 2010 18:05:29 +0300 Subject: [erlang-questions] Re: Web server structure: Rack In-Reply-To: References: <0e24ebfd-1e43-4b1f-9de9-c2dc53724a83@m25g2000yqc.googlegroups.com> Message-ID: On Sun, Jan 10, 2010 at 5:59 PM, Max Lapshin wrote: > > 2) I haven't still found API for creating custom modules, so my two > questions about specific cases with endless streams are actual. I type answers faster, than read documentation: module api is on http://www.erlang.org/doc/man/httpd.html. But I can't still understand how to make endless request body streaming. From hd2010@REDACTED Sun Jan 10 16:27:52 2010 From: hd2010@REDACTED (Henning Diedrich) Date: Sun, 10 Jan 2010 16:27:52 +0100 Subject: [erlang-questions] microseconds since midnight In-Reply-To: <4B49B865.6000506@erlang-consulting.com> References: <4B47B428.4000101@eonblast.com> <4B47C0D7.5080107@erlang-consulting.com> <4B47C9A5.40209@eonblast.com> <8209f741001090023x65c5cabdja0c744568803a944@mail.gmail.com> <4B485EC2.3070901@eonblast.com> <4B49B865.6000506@erlang-consulting.com> Message-ID: <4B49F1F8.9060802@eonblast.com> Hi Ulf, thanks a lot for clarifying! I understood now, I think I'd disagree now on other grounds: now() can't fall behind over midnight due to its internal format of Mega seconds. But it could happen to be behind universaltime() if there was a system time change. But I am fine for what I wanted. I also changed the code as you suggested, as shown below. So for completeness, here are my thoughts, skip'em they might not be worth your time: The intent was to have a reference tick for relative comparison. As the basis for approximation in an Internet scenario, with the clients having 10-100ms latencies, so there can never be full synchronization but an understanding of the relative lag any package might have compared to the fastest package ever received before. This will allow for time based corrections of information that are worth the effort even where they only yield something exact to some milliseconds. In occasional moments of congestion they will easily correct for >100ms and to catch these spikes was the main concern. For this, the absolute offset itself is canceled out in the end and it's only important to have it constant. Which is why Jayson has a point that I might as well simply let the bytes roll over! But there was an agreement on a midnight protocol, so I am going for that for this iteration. universaltime() and now() not being in sync could pose a 'thread' to the intended four byte format as that could result in negative or too high offsets. So this should be the safe implementation, like you suggested: nightsynctime_offset() -> {MegaSec, Seconds, _} = Now = now(), {_, Time} = calendar:now_to_datetime(Now), SecSinceMidnight = calendar:time_to_seconds(Time), % MidNightOffset = (MegaSec * 1000000) + Seconds - SecSinceMidnight. But not because now() could be called after midnight, and universaltime before (making for a 24h gap). Because now() is not affected by midnight with it's megasecond format. But the nature of now that you pointed to may entail much more frequent and longer lasting cases where now() may be trailing universaltime so that to the contrary universaltime may be past midnight already and now still before, skewing the offset for 24h in the other direction? Thank you for pointing out the better implementation. No matter how unlikely the cases might be, now it's right. Your notes helped a lot getting a better understanding of the nature of now() and the other time functions. Thanks! Henning Ulf Wiger wrote: > Henning Diedrich wrote: >> Hi Ulf, >> >> As it is now, I don't poll time twice. But I depend on state,using a >> constant MidNightOffset. > > But you do check it twice: > >> nightsynctime_offset() -> >> >> {_, Time_1} = erlang:universaltime(), %% <- HERE >> SSMN_1 = calendar:time_to_seconds(Time_1), >> {MegaSec_2, Seconds_2, _} = now(), %% <- AND HERE >> % MidNightOffset = >> (MegaSec_2 * 1000000) + Seconds_2 - SSMN_1. > > Rather than first calling universaltime() and then calling now, > call now() once, and then use calendar:now_to_datetime(Now) to > derive the other representation from that one sample. > > When you run small-scale tests without load, you won't notice a > difference, but on a heavily loaded system, the admittedly unlikely > event that the process is scheduled out between the call to > universaltime() and the call to now() right around midnight, could > well give you a situation where the universaltime() call shows > {23,59,59}, while the now() call shows a time right after midnight. > > But as you also talked about sending these values to other nodes, > you will of course also have to contend with the fact that the > system clocks on different nodes can at best be sychronized to > within a few ms using NTP. You should never rely on wall-clock > time for synchronization across the network. > > But perhaps I misunderstood your intent? > > BR, > Ulf W From kiszl@REDACTED Sun Jan 10 20:46:46 2010 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Sun, 10 Jan 2010 20:46:46 +0100 Subject: re and newlines Message-ID: <4B4A2EA6.3070203@tmit.bme.hu> Hello all, Can I somehow convince re to treat _all_ kinds of newline characters just like ordinary ones? 1> re:run("\rabc", "(.+)(?=abc)"). {match,[{0,1},{0,1}]} 2> re:run("\nabc", "(.+)(?=abc)"). nomatch I would like both of these (and all alike) to match. I see a {newline, NLSpec} option, but it does not have an 'off' switch, does it? Regards, Zoltan. From seancribbs@REDACTED Sun Jan 10 21:04:44 2010 From: seancribbs@REDACTED (Sean Cribbs) Date: Sun, 10 Jan 2010 15:04:44 -0500 Subject: [erlang-questions] re and newlines In-Reply-To: <4B4A2EA6.3070203@tmit.bme.hu> References: <4B4A2EA6.3070203@tmit.bme.hu> Message-ID: <4B4A32DC.70407@gmail.com> In other PCRE implementations (Ruby, Perl), this is the "m" option on the regexp - that is, allowing '.' to match newlines. The corresponding option in the re module seems to be 'dotall'. In Ruby: >> "\nabc" =~ /(.+)(?=abc)/ => nil >> "\nabc" =~ /(.+)(?=abc)/m => 0 >> "\rabc" =~ /(.+)(?=abc)/m => 0 In Erlang: 1> re:run("\nabc", "(.+)(?=abc)", []). nomatch 2> re:run("\nabc", "(.+)(?=abc)", [dotall]). {match,[{0,1},{0,1}]} 3> re:run("\rabc", "(.+)(?=abc)", [dotall]). {match,[{0,1},{0,1}]} Cheers, Sean On 1/10/10 2:46 PM, Zoltan Lajos Kis wrote: > Hello all, > > Can I somehow convince re to treat _all_ kinds of newline characters > just like ordinary ones? > > 1> re:run("\rabc", "(.+)(?=abc)"). > {match,[{0,1},{0,1}]} > 2> re:run("\nabc", "(.+)(?=abc)"). > nomatch > > I would like both of these (and all alike) to match. I see a {newline, > NLSpec} option, but it does > not have an 'off' switch, does it? > > Regards, > Zoltan. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From kiszl@REDACTED Sun Jan 10 21:12:20 2010 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Sun, 10 Jan 2010 21:12:20 +0100 Subject: [erlang-questions] re and newlines In-Reply-To: <4B4A32DC.70407@gmail.com> References: <4B4A2EA6.3070203@tmit.bme.hu> <4B4A32DC.70407@gmail.com> Message-ID: <4B4A34A4.4050104@tmit.bme.hu> Great, thanks! Sean Cribbs wrote: > In other PCRE implementations (Ruby, Perl), this is the "m" option on > the regexp - that is, allowing '.' to match newlines. The > corresponding option in the re module seems to be 'dotall'. > > In Ruby: > > >> "\nabc" =~ /(.+)(?=abc)/ > => nil > >> "\nabc" =~ /(.+)(?=abc)/m > => 0 > >> "\rabc" =~ /(.+)(?=abc)/m > => 0 > > In Erlang: > > 1> re:run("\nabc", "(.+)(?=abc)", []). > nomatch > 2> re:run("\nabc", "(.+)(?=abc)", [dotall]). > {match,[{0,1},{0,1}]} > 3> re:run("\rabc", "(.+)(?=abc)", [dotall]). > {match,[{0,1},{0,1}]} > > Cheers, > > Sean > > On 1/10/10 2:46 PM, Zoltan Lajos Kis wrote: >> Hello all, >> >> Can I somehow convince re to treat _all_ kinds of newline characters >> just like ordinary ones? >> >> 1> re:run("\rabc", "(.+)(?=abc)"). >> {match,[{0,1},{0,1}]} >> 2> re:run("\nabc", "(.+)(?=abc)"). >> nomatch >> >> I would like both of these (and all alike) to match. I see a >> {newline, NLSpec} option, but it does >> not have an 'off' switch, does it? >> >> Regards, >> Zoltan. From erlangy@REDACTED Sun Jan 10 21:13:30 2010 From: erlangy@REDACTED (Michael McDaniel) Date: Sun, 10 Jan 2010 12:13:30 -0800 Subject: [erlang-questions] re and newlines In-Reply-To: <4B4A2EA6.3070203@tmit.bme.hu> References: <4B4A2EA6.3070203@tmit.bme.hu> Message-ID: <20100110201330.GJ27294@delora.autosys.us> On Sun, Jan 10, 2010 at 08:46:46PM +0100, Zoltan Lajos Kis wrote: > Hello all, > > Can I somehow convince re to treat _all_ kinds of newline characters > just like ordinary ones? > > 1> re:run("\rabc", "(.+)(?=abc)"). > {match,[{0,1},{0,1}]} > 2> re:run("\nabc", "(.+)(?=abc)"). > nomatch > > I would like both of these (and all alike) to match. I see a {newline, > NLSpec} option, but it does > not have an 'off' switch, does it? > > Regards, > Zoltan. > ________________________________________________________________ from re module documentation, in the 'Newline sequences' section, " Outside a character class, by default, the escape sequence \\R matches any Unicode newline sequence. " so perhaps the following would suffice ? Eshell V5.7.4 (abort with ^G) 1> re:run("\rabc", "((\\R|.)+)(?=abc)"). {match,[{0,1},{0,1},{0,1}]} 2> re:run("\nabc", "((\\R|.)+)(?=abc)"). {match,[{0,1},{0,1},{0,1}]} 3> ~Michael From lsearchw@REDACTED Sun Jan 10 22:57:22 2010 From: lsearchw@REDACTED (L. S.) Date: Sun, 10 Jan 2010 13:57:22 -0800 Subject: Shared ETS Access Message-ID: <4B4A4D42.9060001@gmail.com> Where can I find a full, simple example of one Erlang process creating an ETS table and having another process access that table? After looking at the docs, I seem to understand the basic call to create and populate a table... %ErlShellProcess1: TabId = ets:new(food, [public, named_table]). ets:insert(TabId, {drink, cofee}). ... (And I know I may have to use gen_server to create a persistent process) but I don't know the mechanics to make the it work. %ErlShellProcess2: ? ** From vinoski@REDACTED Sun Jan 10 23:30:30 2010 From: vinoski@REDACTED (Steve Vinoski) Date: Sun, 10 Jan 2010 17:30:30 -0500 Subject: [erlang-questions] Shared ETS Access In-Reply-To: <4B4A4D42.9060001@gmail.com> References: <4B4A4D42.9060001@gmail.com> Message-ID: <65b2728e1001101430w35fcc3a2p9b06bf6d6d484525@mail.gmail.com> On Sun, Jan 10, 2010 at 4:57 PM, L. S. wrote: > Where can I find a full, simple example of one Erlang process creating an > ETS table and having another process access that table? > > After looking at the docs, I seem to understand the basic call to create > and populate a table... > > %ErlShellProcess1: > TabId = ets:new(food, [public, named_table]). > ets:insert(TabId, {drink, cofee}). > > > ... (And I know I may have to use gen_server to create a persistent > process) but I don't know the mechanics to make the it work. > > %ErlShellProcess2: > ? > -module(ets_ex). -export([run/0]). run() -> Parent = self(), spawn(fun() -> TblName = my_table, Tbl = ets:new(TblName, [public, named_table]), Parent ! {ready, self(), TblName}, receive stop -> ets:delete(Tbl) end end), receive {ready, Loop, TblNm} -> ets:insert(TblNm, {"key", "value"}), Lookup = ets:lookup(TblNm, "key"), io:format("lookup returned ~p~n", [Lookup]), Loop ! stop end. The spawned anonymous function creates and owns the ets table, and for this example serves essentially the same purpose as a gen_server and its receive loop would. The run() function spawns the loop, waits for the message telling it the table name, then does an insert and a lookup on the table. Note that all the main part of the run() function knows is the name of the table received in the message from the loop. --steve From fjl@REDACTED Sun Jan 10 23:51:49 2010 From: fjl@REDACTED (Felix Lange) Date: Sun, 10 Jan 2010 23:51:49 +0100 (CET) Subject: [erlang-questions] Compiler to warn on used underscore-variables In-Reply-To: <20100105153549.GC3139@h216-235-12-174.host.egate.net> References: <32645.194.88.55.211.1262679361.squirrel@localhost> <20100105153549.GC3139@h216-235-12-174.host.egate.net> Message-ID: <20100110.235149.115963612.fjl@twurst.com> > On Tue, Jan 05, 2010 at 01:34:10AM -0700, Tony Arcieri wrote: > } I'm not sure what alternative you're proposing. Would you prefer all > } variables prefixed with an underscore have the same semantics as '_'? > > Yes. The current behaviour, given the purpose of a underscore > prefix, violates the principle of least astonishment. IMHO > > I know it's not going to change but having been burnt by this > in my learning phase I still hold that opinion. The mere purpose of the underscore prefix is to indicate that a variable is not used while making code easier to read as well as easier to change in the future. If you have a function foo/7 with a clause like foo(_, _, _, _, Bar, _, _) -> ...; it's pretty hard to figure out what these underscores are supposed to mean without looking at the other clauses. Having the compiler warn you that the variable isn't used when you perfectly know that because it's intended is not a viable option either. To my mind, properly documenting this feature is the better alternative. From colm.dougan@REDACTED Mon Jan 11 00:18:24 2010 From: colm.dougan@REDACTED (Colm Dougan) Date: Sun, 10 Jan 2010 23:18:24 +0000 Subject: [erlang-questions] Shared ETS Access In-Reply-To: <4B4A4D42.9060001@gmail.com> References: <4B4A4D42.9060001@gmail.com> Message-ID: <24d4f39c1001101518i22ad6794va64cbbcac7cd3ef0@mail.gmail.com> On Sun, Jan 10, 2010 at 9:57 PM, L. S. wrote: > Where can I find a full, simple example of one Erlang process creating an > ETS table and having another process access that table? > > After looking at the docs, I seem to understand the basic call to create and > populate a table... > > ? ?%ErlShellProcess1: > ? ? ? ?TabId = ets:new(food, [public, named_table]). > ? ? ? ?ets:insert(TabId, {drink, cofee}). > > > ... (And I know I may have to use gen_server to create a persistent process) > but I don't know the mechanics to make the it work. Here is a basic example of a key/value store : ########## -module(my_keystore). -behaviour(gen_server). -export([start_link/0]). -export([get/1, put/2]). %% Internal exports -export([ init/1, handle_call/3, %handle_cast/2, handle_info/2, code_change/3, terminate/2 ]). %% Public start_link() -> gen_server:start_link({local, ?MODULE}, ?MODULE, [], []). get(Key) -> case ets:lookup(?MODULE, Key) of [] -> undefined; [{_Key, Value}] -> Value end. put(Key, Value) -> gen_server:call(?MODULE, {put, Key, Value}). %% context -record(state, { tab }). %% gen_server callbacks init(_Args) -> Tab = ets:new(?MODULE, [named_table, public, set]), io:format("Initing ...~n"), {ok, #state{tab = Tab}}. handle_call({put, Key, Value}, _From, State) -> ets:insert(?MODULE, {Key, Value}), {reply, ok, State}. terminate(Reason, _State) -> io:format("~p is terminating [~p]", [?MODULE, Reason]), ok. code_change(_OldVsn, State, _Extra) -> {ok, State}. ########## (You will get warnings about undefined callbacks with this, but I left those out for brevity). You will notice that the 'get' function uses the fact that the ets table is 'public' and queries it directly in the context of the calling process, and without calling into the gen_server process which created the table. (If the ets table were private then the get function would have to be implemented in the same way as the 'put' function i.e. by "calling into" the process encapsulating the gen_server). HTH, Colm From navaneethanit@REDACTED Mon Jan 11 05:47:17 2010 From: navaneethanit@REDACTED (Navaneethan) Date: Mon, 11 Jan 2010 10:17:17 +0530 Subject: install erlang in fedora Message-ID: <4dde26ad1001102047k213d6003x5c386248ffebb4af@mail.gmail.com> I wanna to install the erlang in my fedora box,but unfortunately i am getting the error message *[root@REDACTED ~]# yum install erlang Loaded plugins: refresh-packagekit Error: Cannot retrieve repository metadata (repomd.xml) for repository: fedora. Please verify its path and try again [root@REDACTED ~]# *as well as i wanna to create a web application using *erlang framework *in my fedora box?what i need to do? -- regards, NavTux It blogs @ http://navaspot.wordpress.com From ciprian.craciun@REDACTED Mon Jan 11 07:16:55 2010 From: ciprian.craciun@REDACTED (Ciprian Dorin, Craciun) Date: Mon, 11 Jan 2010 08:16:55 +0200 Subject: [erlang-questions] Re: Web server structure: Rack In-Reply-To: <0e24ebfd-1e43-4b1f-9de9-c2dc53724a83@m25g2000yqc.googlegroups.com> References: <0e24ebfd-1e43-4b1f-9de9-c2dc53724a83@m25g2000yqc.googlegroups.com> Message-ID: <8e04b5821001102216m70910ef7gab921f08d4502b97@mail.gmail.com> On Sun, Jan 10, 2010 at 4:46 PM, Steve Davis wrote: > > What's wrong with building on inets? Why do we reinvent the web layer > for OTP so often? > > BTW I am genuinely extremely interested in answers to these questions. Maybe there's nothing wrong with inets. But why do we reinvent the web layer? :) * it's a nice and easy task (well known, simple and useful protocol) to write as one of your first OTP applications; (I wrote an Gopher server as my first application; and I've also written my own (almost throw-away) web server;) * it's fun to write a web stack that works **exactly** the way **you** want; (or at least you think you want and then you change your mind ;) ) * it's damn easier than in other languages; (no threading / multi-process / scalability issues); Hope others agree and add other motives. Ciprian. From lsearchw@REDACTED Mon Jan 11 07:27:46 2010 From: lsearchw@REDACTED (L. S.) Date: Sun, 10 Jan 2010 22:27:46 -0800 Subject: [erlang-questions] Shared ETS Access In-Reply-To: <65b2728e1001101430w35fcc3a2p9b06bf6d6d484525@mail.gmail.com> References: <4B4A4D42.9060001@gmail.com> <65b2728e1001101430w35fcc3a2p9b06bf6d6d484525@mail.gmail.com> Message-ID: <15aa2c141001102227j783923dbo6b26f388aba82b25@mail.gmail.com> Thanks! This is the type of clarification I needed. I was thinking of a situation where there is no clear parent-child relationship. I am experimenting with a Yaws appmod setup where each request reads a token from an ETS table (strictly from memory, for speed). On 1/10/10, Steve Vinoski wrote: > On Sun, Jan 10, 2010 at 4:57 PM, L. S. wrote: > >> Where can I find a full, simple example of one Erlang process creating an >> ETS table and having another process access that table? >> >> After looking at the docs, I seem to understand the basic call to create >> and populate a table... >> >> %ErlShellProcess1: >> TabId = ets:new(food, [public, named_table]). >> ets:insert(TabId, {drink, coffee}). >> >> >> ... (And I know I may have to use gen_server to create a persistent >> process) but I don't know the mechanics to make the it work. >> >> %ErlShellProcess2: >> ? >> > > -module(ets_ex). > -export([run/0]). > > run() -> > Parent = self(), > spawn(fun() -> > TblName = my_table, > Tbl = ets:new(TblName, [public, named_table]), > Parent ! {ready, self(), TblName}, > receive > stop -> > ets:delete(Tbl) > end > end), > receive > {ready, Loop, TblNm} -> > ets:insert(TblNm, {"key", "value"}), > Lookup = ets:lookup(TblNm, "key"), > io:format("lookup returned ~p~n", [Lookup]), > Loop ! stop > end. > > The spawned anonymous function creates and owns the ets table, and for this > example serves essentially the same purpose as a gen_server and its receive > loop would. The run() function spawns the loop, waits for the message > telling it the table name, then does an insert and a lookup on the table. > Note that all the main part of the run() function knows is the name of the > table received in the message from the loop. > > --steve > From dmitriid@REDACTED Mon Jan 11 08:53:15 2010 From: dmitriid@REDACTED (Dmitrii Dimandt) Date: Mon, 11 Jan 2010 09:53:15 +0200 Subject: [erlang-questions] Re: Web server structure: Rack In-Reply-To: <8e04b5821001102216m70910ef7gab921f08d4502b97@mail.gmail.com> References: <0e24ebfd-1e43-4b1f-9de9-c2dc53724a83@m25g2000yqc.googlegroups.com> <8e04b5821001102216m70910ef7gab921f08d4502b97@mail.gmail.com> Message-ID: <8D70AAEA-5655-4FB0-9F45-8F72BC70C290@gmail.com> > On Sun, Jan 10, 2010 at 4:46 PM, Steve Davis > wrote: >> >> What's wrong with building on inets? Why do we reinvent the web layer >> for OTP so often? >> >> BTW I am genuinely extremely interested in answers to these questions. > > Maybe there's nothing wrong with inets. > > But why do we reinvent the web layer? :) > * it's a nice and easy task (well known, simple and useful > protocol) to write as one of your first OTP applications; (I wrote an > Gopher server as my first application; and I've also written my own > (almost throw-away) web server;) > * it's fun to write a web stack that works **exactly** the way > **you** want; (or at least you think you want and then you change your > mind ;) ) > * it's damn easier than in other languages; (no threading / > multi-process / scalability issues); > > Hope others agree and add other motives. > Ciprian. Actually, it's not entirely true for the web. - There's ton of information being passed around in HTTP requests - Parsing this information out is a tedious task and needs to be redone for every new web layer you wish to build - Parsing multipart forms is PITA, see http://code.google.com/p/mochiweb/source/browse/trunk/src/mochiweb_multipart.erl and http://bitbucket.org/justin/webmachine/src/tip/src/webmachine_multipart.erl (see esp. the comment about how browsers are fun :) ) - Setting cookies correctly is PITA, see http://code.google.com/p/mochiweb/source/browse/trunk/src/mochiweb_cookies.erl - You can't reliably write generic code that will run across all Erlang web servers, since every web server differs in how it presents information to your code and what it expects from your code - Because of that you can't reliably abstract parts of your functionality (caching, setting etags etc., see e.g. http://rack.rubyforge.org/doc/Rack.html) into truly reusable pieces of code Because of that a common web server interface is actually a blessing and, in my opinion, should be accepted more aggressively. From max.lapshin@REDACTED Mon Jan 11 09:38:06 2010 From: max.lapshin@REDACTED (Max Lapshin) Date: Mon, 11 Jan 2010 11:38:06 +0300 Subject: erlang:decode_packet question Message-ID: I cannot understand: it is buf or feature? erlang:decode_packet(httph_bin, <<"icy-name:Radio Zet\r\n">>, []). returns me {more,undefined} but if I add any useless information in the tail, it works: erlang:decode_packet(httph_bin, <<"icy-name:Radio Zet\r\nzz">>, []). {ok,{http_header,0,<<"Icy-Name">>,undefined,<<"Radio Zet">>}, <<"zz">>} So to parse headers line by line, I have to artificially append some data. From ciprian.craciun@REDACTED Mon Jan 11 10:10:31 2010 From: ciprian.craciun@REDACTED (Ciprian Dorin, Craciun) Date: Mon, 11 Jan 2010 11:10:31 +0200 Subject: [erlang-questions] Re: Web server structure: Rack In-Reply-To: <8D70AAEA-5655-4FB0-9F45-8F72BC70C290@gmail.com> References: <0e24ebfd-1e43-4b1f-9de9-c2dc53724a83@m25g2000yqc.googlegroups.com> <8e04b5821001102216m70910ef7gab921f08d4502b97@mail.gmail.com> <8D70AAEA-5655-4FB0-9F45-8F72BC70C290@gmail.com> Message-ID: <8e04b5821001110110n292d6782t7ebeeed98b3c3b2d@mail.gmail.com> On Mon, Jan 11, 2010 at 9:53 AM, Dmitrii Dimandt wrote: > >> On Sun, Jan 10, 2010 at 4:46 PM, Steve Davis >> wrote: >>> >>> What's wrong with building on inets? Why do we reinvent the web layer >>> for OTP so often? >>> >>> BTW I am genuinely extremely interested in answers to these questions. >> >> ? ?Maybe there's nothing wrong with inets. >> >> ? ?But why do we reinvent the web layer? :) >> ? ?* it's a nice and easy task (well known, simple and useful >> protocol) to write as one of your first OTP applications; (I wrote an >> Gopher server as my first application; and I've also written my own >> (almost throw-away) web server;) >> ? ?* it's fun to write a web stack that works **exactly** the way >> **you** want; (or at least you think you want and then you change your >> mind ;) ) >> ? ?* it's damn easier than in other languages; (no threading / >> multi-process / scalability issues); >> >> ? ?Hope others agree and add other motives. >> ? ?Ciprian. > > > Actually, it's not entirely true for the web. > > - There's ton of information being passed around in HTTP requests > - Parsing this information out is a tedious task and needs to be redone for every new web layer you wish to build > - Parsing multipart forms is PITA, see http://code.google.com/p/mochiweb/source/browse/trunk/src/mochiweb_multipart.erl and http://bitbucket.org/justin/webmachine/src/tip/src/webmachine_multipart.erl (see esp. the comment about how browsers are fun :) ) > - Setting cookies correctly is PITA, see http://code.google.com/p/mochiweb/source/browse/trunk/src/mochiweb_cookies.erl > - You can't reliably write generic code that will run across all Erlang web servers, since every web server differs in how it presents information to your code and what it expects from your code > - Because of that you can't reliably abstract parts of your functionality (caching, setting etags etc., see e.g. http://rack.rubyforge.org/doc/Rack.html) into truly reusable pieces of code I agree with most of the points you have raised above (except the parsing of the HTTP protocol which is already done by the core Erlang modules). Indeed it is really hard to write a good (as in correct) web server, and even harder to write one that works with all the browsers. > Because of that a common web server interface is actually a blessing and, in my opinion, should be accepted more aggressively. Indeed such a <> could be a <> for the enterprise world, where you need something stable and reliable. But there is also a drawback: I remember (maybe I'm wrong because I'm not a web developer, but I've kept a close eye), that a few years ago (5 maybe?) the only usable (as in enterprise ready) web server was Apache (now we have LigHTTPD, Nginx, and of course Apache, thus not too much better in terms of diversity)... What I'm trying to say: a <> leads to (framework) lock-in... > - Parsing multipart forms is PITA, see http://code.google.com/p/mochiweb/source/browse/trunk/src/mochiweb_multipart.erl and http://bitbucket.org/justin/webmachine/src/tip/src/webmachine_multipart.erl (see esp. the comment about how browsers are fun :) ) > - Setting cookies correctly is PITA, see http://code.google.com/p/mochiweb/source/browse/trunk/src/mochiweb_cookies.erl Also we are missing a important point: web servers are not only for (user) web-pages. One important usage is also web-services (I'm not meaning WSDL or REST-like, but anything using HTTP as transport). And in the web-services case, usually there is no multi-part content, no cookies, even no caching (usually). Thus in this case all the above mentioned features (caching, etc.) are useless and usually incur more overhead than needed. But in general I agree: in a production environment we need a stable, commonly accepted web-stack. Ciprian. P.S.: I'm wondering about something: in a (user-centric) web environment isn't string (as in Unicode) support very important? And let's face it Erlang is not the most efficient string manipulation language. (Right?) From cthulahoops@REDACTED Mon Jan 11 11:23:09 2010 From: cthulahoops@REDACTED (Adam Kelly) Date: Mon, 11 Jan 2010 10:23:09 +0000 Subject: [erlang-questions] Shared ETS Access In-Reply-To: <24d4f39c1001101518i22ad6794va64cbbcac7cd3ef0@mail.gmail.com> References: <4B4A4D42.9060001@gmail.com> <24d4f39c1001101518i22ad6794va64cbbcac7cd3ef0@mail.gmail.com> Message-ID: <8d1798e91001110223s245908a9r6e010d1746c97c52@mail.gmail.com> 2010/1/10 Colm Dougan : > You will notice that the 'get' function uses the fact that the ets > table is 'public' and queries it directly in the context of the > calling process, and without calling into the gen_server process which > created the table. ?(If the ets table were private then the get > function would have to be implemented in the same way as the 'put' > function i.e. by "calling into" the process encapsulating the > gen_server). In this case, you can use protected instead of public or private, which allows anyone to read from the table but only the owner to write. This is the default value, probably because it is mostly what you want. Adam. From kiszl@REDACTED Mon Jan 11 11:36:00 2010 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Mon, 11 Jan 2010 11:36:00 +0100 (CET) Subject: [erlang-questions] Shared ETS Access In-Reply-To: <8d1798e91001110223s245908a9r6e010d1746c97c52@mail.gmail.com> References: <4B4A4D42.9060001@gmail.com> <24d4f39c1001101518i22ad6794va64cbbcac7cd3ef0@mail.gmail.com> <8d1798e91001110223s245908a9r6e010d1746c97c52@mail.gmail.com> Message-ID: <37178.194.88.55.211.1263206160.squirrel@localhost> > 2010/1/10 Colm Dougan : >> You will notice that the 'get' function uses the fact that the ets >> table is 'public' and queries it directly in the context of the >> calling process, and without calling into the gen_server process which >> created the table. ?(If the ets table were private then the get >> function would have to be implemented in the same way as the 'put' >> function i.e. by "calling into" the process encapsulating the >> gen_server). > > In this case, you can use protected instead of public or private, > which allows anyone to read from the table but only the owner to > write. This is the default value, probably because it is mostly what > you want. > > Adam. > Is there any advantage in writing to the table through a server process, instead of directly writing to the table (perhaps using the write-concurrency switch) ? From navaneethanit@REDACTED Mon Jan 11 11:53:58 2010 From: navaneethanit@REDACTED (NavTux) Date: Mon, 11 Jan 2010 02:53:58 -0800 (PST) Subject: How to prove the erlang performance? Message-ID: <96e21b62-e870-4b17-9684-57958a89d7a4@q4g2000yqm.googlegroups.com> How to prove the performance of erlang? We know the familiar language java is well developed,in case we are erlang lovers how to prove the erlang's performance and ehat the tools are needed for it? From freza@REDACTED Mon Jan 11 12:05:52 2010 From: freza@REDACTED (Jachym Holecek) Date: Mon, 11 Jan 2010 12:05:52 +0100 Subject: [erlang-questions] Shared ETS Access In-Reply-To: <37178.194.88.55.211.1263206160.squirrel@localhost> References: <4B4A4D42.9060001@gmail.com> <24d4f39c1001101518i22ad6794va64cbbcac7cd3ef0@mail.gmail.com> <8d1798e91001110223s245908a9r6e010d1746c97c52@mail.gmail.com> <37178.194.88.55.211.1263206160.squirrel@localhost> Message-ID: <20100111110552.GA2329@hanele> # Zoltan Lajos Kis 2010-01-11: > Is there any advantage in writing to the table through a server process, > instead of directly writing to the table (perhaps using the > write-concurrency switch) ? [Answering the general question, didn't track the thread closely.] Depends on the problem at hand. Writing through owner process implies table modifications are serialized in time, this is useful in cases where table holds data complex beyond a simple key-value store or when table contents need to stay in sync with some bits of surrounding world. So "consistency" or at least illusion thereof is the answer. Of course, one remembers to think twice before using ETS acrobatically ;-). Regards, -- Jachym From freza@REDACTED Mon Jan 11 12:25:24 2010 From: freza@REDACTED (Jachym Holecek) Date: Mon, 11 Jan 2010 12:25:24 +0100 Subject: [erlang-questions] Parallel Make in OTP In-Reply-To: <38e3b9f40912180614g1a302a6ble46bee0ea960402d@mail.gmail.com> References: <38e3b9f40912170305h5437d21dhac263289ba60506a@mail.gmail.com> <20091218110502.GA1006@hanele> <38e3b9f40912180614g1a302a6ble46bee0ea960402d@mail.gmail.com> Message-ID: <20100111112524.GA805@hanele> Hi Pete, I completely agree with your list of properties a build system should satisfy. # Peter-Henry Mander 2009-12-18: > 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. I recently learnt about rebar[*]. It's a native Erlang solution and looks pretty promising so far, although the documentation amounts to UTSL at this point. I didn't yet have a chance to get to know it more intimately, but that will come sooner or later. Anyway, always nice to see your dreams come true meanwhile you were dreaming. :-) > 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? I've done a lot of daydreaming on the topic since we last talked and came to the conclusion that a dependency processing engine is about the easiest part of build system business, really. The only tricky point is that the existence of certain arrows depends on satisfaction status of some other arrows (yeah, that's .hrl processing). Most of the work lies in locating resources, inferring depends and gluing it all together... Regards, -- Jachym [*] Apologies if I'm ruining what was supposed to be undercover op: http://bitbucket.org/dizzyd/rebar/ From kiszl@REDACTED Mon Jan 11 12:25:35 2010 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Mon, 11 Jan 2010 12:25:35 +0100 (CET) Subject: [erlang-questions] Shared ETS Access In-Reply-To: <20100111110552.GA2329@hanele> References: <4B4A4D42.9060001@gmail.com> <24d4f39c1001101518i22ad6794va64cbbcac7cd3ef0@mail.gmail.com> <8d1798e91001110223s245908a9r6e010d1746c97c52@mail.gmail.com> <37178.194.88.55.211.1263206160.squirrel@localhost> <20100111110552.GA2329@hanele> Message-ID: <33650.194.88.55.211.1263209135.squirrel@localhost> > # Zoltan Lajos Kis 2010-01-11: >> Is there any advantage in writing to the table through a server process, >> instead of directly writing to the table (perhaps using the >> write-concurrency switch) ? > > [Answering the general question, didn't track the thread closely.] > > Depends on the problem at hand. Writing through owner process implies > table > modifications are serialized in time, this is useful in cases where table > holds data complex beyond a simple key-value store or when table contents > need to stay in sync with some bits of surrounding world. So "consistency" > or at least illusion thereof is the answer. > > Of course, one remembers to think twice before using ETS acrobatically > ;-). > > Regards, > -- Jachym > This will only become consistent if reads are also done through the server. But then the table could be set to private as well (if an ets table is needed at all then). From max.lapshin@REDACTED Mon Jan 11 12:26:30 2010 From: max.lapshin@REDACTED (Max Lapshin) Date: Mon, 11 Jan 2010 14:26:30 +0300 Subject: [erlang-questions] erlang:decode_packet question In-Reply-To: References: Message-ID: My fail, thanks! From ulf.wiger@REDACTED Mon Jan 11 12:45:22 2010 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Mon, 11 Jan 2010 12:45:22 +0100 Subject: [erlang-questions] Shared ETS Access In-Reply-To: <33650.194.88.55.211.1263209135.squirrel@localhost> References: <4B4A4D42.9060001@gmail.com> <24d4f39c1001101518i22ad6794va64cbbcac7cd3ef0@mail.gmail.com> <8d1798e91001110223s245908a9r6e010d1746c97c52@mail.gmail.com> <37178.194.88.55.211.1263206160.squirrel@localhost> <20100111110552.GA2329@hanele> <33650.194.88.55.211.1263209135.squirrel@localhost> Message-ID: <4B4B0F52.9000903@erlang-consulting.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Zoltan Lajos Kis wrote: >> # Zoltan Lajos Kis 2010-01-11: >>> Is there any advantage in writing to the table through a server process, >>> instead of directly writing to the table (perhaps using the >>> write-concurrency switch) ? >> [Answering the general question, didn't track the thread closely.] >> >> Depends on the problem at hand. Writing through owner process implies >> table >> modifications are serialized in time, this is useful in cases where table >> holds data complex beyond a simple key-value store or when table contents >> need to stay in sync with some bits of surrounding world. So "consistency" >> or at least illusion thereof is the answer. >> >> Of course, one remembers to think twice before using ETS acrobatically >> ;-). >> >> Regards, >> -- Jachym >> > > This will only become consistent if reads are also done through the > server. But then the table could be set to private as well (if an ets > table is needed at all then). This, as Jachym pointed out, depends on the problem at hand. If reads are atomic, it may well be perfectly acceptable to allow direct concurrent reads to the table while serializing writes. If you need to modify an object in ets, you have to first read the old object, and this cannot be done safely without serializing through a process. You might call this "write consistency" perhaps. A process registry is a simple example of such serialization. You don't have to go to the server to lookup a {Name,Pid} mapping, but you do have to in order to safely register it in the first place. (There is even a paper on this, more or less, from ICFP 2009: http://portal.acm.org/citation.cfm?id=1596550.1596574) BR, Ulf W -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAktLD1IACgkQtqqFieqzed3wKwCg2dPWk3h6mPBKyBHchuT/zXLx V3MAoNUCeOyri2wEVlJAb1LF+iwLf16w =oly0 -----END PGP SIGNATURE----- --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From freza@REDACTED Mon Jan 11 12:48:15 2010 From: freza@REDACTED (Jachym Holecek) Date: Mon, 11 Jan 2010 12:48:15 +0100 Subject: [erlang-questions] Shared ETS Access In-Reply-To: <33650.194.88.55.211.1263209135.squirrel@localhost> References: <4B4A4D42.9060001@gmail.com> <24d4f39c1001101518i22ad6794va64cbbcac7cd3ef0@mail.gmail.com> <8d1798e91001110223s245908a9r6e010d1746c97c52@mail.gmail.com> <37178.194.88.55.211.1263206160.squirrel@localhost> <20100111110552.GA2329@hanele> <33650.194.88.55.211.1263209135.squirrel@localhost> Message-ID: <20100111114815.GA1345@hanele> # Zoltan Lajos Kis 2010-01-11: > > [Answering the general question, didn't track the thread closely.] > > > > Depends on the problem at hand. Writing through owner process implies > > table > > modifications are serialized in time, this is useful in cases where table > > holds data complex beyond a simple key-value store or when table contents > > need to stay in sync with some bits of surrounding world. So "consistency" > > or at least illusion thereof is the answer. > > > > Of course, one remembers to think twice before using ETS acrobatically > > ;-). > > This will only become consistent if reads are also done through the > server. But then the table could be set to private as well (if an ets > table is needed at all then). No, "it will only pass if reads are done _carefully_" is more like it. You'd probably hide all the raw ETS manipulation behind the API of your module, so you're free to employ some particular access protocol and there are assumptions you could make. Pity I can't point at some opensource example of this sort of thing... Regards, -- Jachym From ulf.wiger@REDACTED Mon Jan 11 13:17:44 2010 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Mon, 11 Jan 2010 13:17:44 +0100 Subject: [erlang-questions] Shared ETS Access In-Reply-To: <20100111114815.GA1345@hanele> References: <4B4A4D42.9060001@gmail.com> <24d4f39c1001101518i22ad6794va64cbbcac7cd3ef0@mail.gmail.com> <8d1798e91001110223s245908a9r6e010d1746c97c52@mail.gmail.com> <37178.194.88.55.211.1263206160.squirrel@localhost> <20100111110552.GA2329@hanele> <33650.194.88.55.211.1263209135.squirrel@localhost> <20100111114815.GA1345@hanele> Message-ID: <4B4B16E8.9070401@erlang-consulting.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Jachym Holecek wrote: > > No, "it will only pass if reads are done _carefully_" is more like it. > You'd probably hide all the raw ETS manipulation behind the API of your > module, so you're free to employ some particular access protocol and > there are assumptions you could make. > > Pity I can't point at some opensource example of this sort of thing... If you look at gproc, http://svn.ulf.wiger.net/gproc/branches/experimental-0906/gproc/src/gproc.erl you can see (after deciphering some of the extra complexity) how name lookups are done in the calling process (gproc:where/1), whereas registrations are done in the central gen_server. For registrations, properties (where only the {Name,Pid} pair is unique, and processes can only register their own properties), can be written directly from the calling process, whereas unique names must be written in the central gen_server process. BR, Ulf W -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAktLFugACgkQtqqFieqzed1GnwCfUj+DmhcP8I1VRDpqXSLgS+kA wXQAn08ASJT9YdQwJS1yMED5RDh7ZnED =liuR -----END PGP SIGNATURE----- --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From tony@REDACTED Mon Jan 11 12:17:01 2010 From: tony@REDACTED (Tony Rogvall) Date: Mon, 11 Jan 2010 12:17:01 +0100 Subject: [erlang-questions] erlang:decode_packet question In-Reply-To: References: Message-ID: On 11 jan 2010, at 09.38, Max Lapshin wrote: > I cannot understand: it is buf or feature? > Neither. If you check for example RFC 2616 you will see that there may be multiple lines. In the case of multiple lines, the next line is initiated by a space or a tab. /Tony > erlang:decode_packet(httph_bin, <<"icy-name:Radio Zet\r\n">>, []). > returns me > {more,undefined} > > but if I add any useless information in the tail, it works: > > erlang:decode_packet(httph_bin, <<"icy-name:Radio Zet\r\nzz">>, []). > {ok,{http_header,0,<<"Icy-Name">>,undefined,<<"Radio Zet">>}, > <<"zz">>} > > So to parse headers line by line, I have to artificially append some data. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From ulf.wiger@REDACTED Mon Jan 11 13:39:00 2010 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Mon, 11 Jan 2010 13:39:00 +0100 Subject: [erlang-questions] How to prove the erlang performance? In-Reply-To: <96e21b62-e870-4b17-9684-57958a89d7a4@q4g2000yqm.googlegroups.com> References: <96e21b62-e870-4b17-9684-57958a89d7a4@q4g2000yqm.googlegroups.com> Message-ID: <4B4B1BE4.5000608@erlang-consulting.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 NavTux wrote: > How to prove the performance of erlang? > > We know the familiar language java is well developed,in case we are > erlang lovers how to prove the erlang's performance and ehat the tools > are needed for it? I would say that Erlang is pretty well developed too, to the point where you will find little or no "low-hanging fruit". It is important to realize that there are lots of design decisions and tradeoffs to be made when creating a language and optimizing for performance. Making the fastest possible language was never a design goal with Erlang. The primary goals were to make a language suitable for building non-stop complex control systems. This presents all kinds of obvious tradeoffs: - - soft-real-time scheduling of thousands of concurrent activities is clearly at odds with maximum sequential performance. - - Dynamic typing is superb for dynamic code change in large systems, but has a performance penalty. - - Dynamic call and message tracing is wonderful for debugging of embedded systems, but carry some runtime overhead. - - Share-nothing concurrency will help you stay sane, but may incur unnecessary copying in some cases. - - Dynamic memory management simplifies things greatly, and can often lead to both better performance and less memory usage, but your mileage will vary depending on the problem. BTW, did you really mean "prove performance"? I read it as "improve performance". In either case, the answer depends on what aspects of performance you are interested in, and what your problem domain is. On the topic of proving performance, I would say that the tools for analysing performance in applications with tens of thousand concurrent processes, starting and stopping hundreds of processes every second, are *at least* as well developed for Erlang as they are for Java. This goes both for profiling tools and verification tools. Verifying massively concurrent applications is a research topic, but I daresay that the Erlang crowd is on the leading edge here. Heck, even the Erlang debugger is capable of debugging distributed and massively concurrent systems, even though stop-and- go debugging is often extremely inconvenient in embedded real-time applications. BR, Ulf W -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAktLG+QACgkQtqqFieqzed3oSwCfb8fPILeNH3CBrjpPz7yAhQ90 eEcAoKk0haRwQeufZbiWZPOgh37wZsbI =stHl -----END PGP SIGNATURE----- --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From sverker@REDACTED Mon Jan 11 14:03:46 2010 From: sverker@REDACTED (Sverker Eriksson) Date: Mon, 11 Jan 2010 14:03:46 +0100 Subject: [erlang-questions] erl_nif improvements In-Reply-To: <1572593381.13991262631374263.JavaMail.root@zimbra> References: <1572593381.13991262631374263.JavaMail.root@zimbra> Message-ID: <4B4B21B2.3010505@erix.ericsson.se> Michal Ptaszek wrote: > [...] > Recently I am playing with the Erlang-Python bindings > (they are still in a very alpha-version but they are > working well - called Pytherl and available at > http://bit.ly/7HZBAm) which should allow users to reuse > Python libraries in Erlang projects. However, using > the very narrow NIF exports it is a tedious task to > play with. > > The idea was to get something out for folks to play with and get some useful feedback in return, like this. > Moreover I have seen a lot of changes in the official > github repository (e.g. added enif_get_double or enif_get_tuple). > > However, I would like to ask if there are any plans to > extend the list of the C functions with e.g.: > - enif_get_atom/2 (returning const 'char *') > - enif_get/set_tuple_element/4 > - enif_make_tuple/list/(ErlNifEnv env, ERL_NIF_TERM erl_term, > int count, ERL_NIF_TERM **elements) (not a variadic versions. > As far as I read the NIFs implementation it should be a very > simple change/copy-paste in the code) > Sounds reasonable. Not sure about "set_tuple_element" though. Do you mean to make a copy of a tuple like erlang:setelement/3 or to mutate an existing tuple. Mutating existing terms is something that we probably do not want to do, even if the term has not yet been returned from the NIF. /Sverker, Erlang/OTP Ericsson From mononcqc@REDACTED Mon Jan 11 14:11:47 2010 From: mononcqc@REDACTED (Fred Hebert) Date: Mon, 11 Jan 2010 08:11:47 -0500 Subject: [erlang-questions] Re: Web server structure: Rack In-Reply-To: <8e04b5821001110110n292d6782t7ebeeed98b3c3b2d@mail.gmail.com> References: <0e24ebfd-1e43-4b1f-9de9-c2dc53724a83@m25g2000yqc.googlegroups.com> <8e04b5821001102216m70910ef7gab921f08d4502b97@mail.gmail.com> <8D70AAEA-5655-4FB0-9F45-8F72BC70C290@gmail.com> <8e04b5821001110110n292d6782t7ebeeed98b3c3b2d@mail.gmail.com> Message-ID: <8b9ee55b1001110511p12d9c1aw8a00c3cbb5c80c2c@mail.gmail.com> On Mon, Jan 11, 2010 at 4:10 AM, Ciprian Dorin, Craciun < ciprian.craciun@REDACTED> wrote: > On Mon, Jan 11, 2010 at 9:53 AM, Dmitrii Dimandt > wrote: > > > - You can't reliably write generic code that will run across all Erlang > web servers, since every web server differs in how it presents information > to your code and what it expects from your code > > - Because of that you can't reliably abstract parts of your functionality > (caching, setting etags etc., see e.g. > http://rack.rubyforge.org/doc/Rack.html) into truly reusable pieces of > code > > Because of that a common web server interface is actually a blessing > and, in my opinion, should be accepted more aggressively. > > Indeed such a <> could be a > <> for the enterprise world, where you need something stable > and reliable. But there is also a drawback: I remember (maybe I'm > wrong because I'm not a web developer, but I've kept a close eye), > that a few years ago (5 maybe?) the only usable (as in enterprise > ready) web server was Apache (now we have LigHTTPD, Nginx, and of > course Apache, thus not too much better in terms of diversity)... > > What I'm trying to say: a < should be accepted more aggressively>> leads to (framework) lock-in... > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > You guys might want to take a look at ewgi (Erlang web gateway interface), that aims to make it possible to have the same interface in front of all servers. http://github.com/skarab/ewgi So far it is supported with Yaws, Mochiweb and inets. From tuncer.ayaz@REDACTED Mon Jan 11 14:32:10 2010 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Mon, 11 Jan 2010 14:32:10 +0100 Subject: [erlang-questions] Parallel Make in OTP In-Reply-To: <20100111112524.GA805@hanele> References: <38e3b9f40912170305h5437d21dhac263289ba60506a@mail.gmail.com> <20091218110502.GA1006@hanele> <38e3b9f40912180614g1a302a6ble46bee0ea960402d@mail.gmail.com> <20100111112524.GA805@hanele> Message-ID: <4ac8254d1001110532p4363f984o3d5328be4b4fe542@mail.gmail.com> On Mon, Jan 11, 2010 at 12:25 PM, Jachym Holecek wrote: > Hi Pete, > > I completely agree with your list of properties a build system should > satisfy. > > # Peter-Henry Mander 2009-12-18: >> 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. > > I recently learnt about rebar[*]. It's a native Erlang solution and > looks pretty promising so far, although the documentation amounts to > UTSL at this point. I didn't yet have a chance to get to know it more > intimately, but that will come sooner or later. Anyway, always nice > to see your dreams come true meanwhile you were dreaming. :-) > >> 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? > > I've done a lot of daydreaming on the topic since we last talked and > came to the conclusion that a dependency processing engine is about > the easiest part of build system business, really. The only tricky > point is that the existence of certain arrows depends on satisfaction > status of some other arrows (yeah, that's .hrl processing). Most of > the work lies in locating resources, inferring depends and gluing it > all together... > > Regards, > ? ? ? ?-- Jachym > > [*] Apologies if I'm ruining what was supposed to be undercover op: > > ? ? ?http://bitbucket.org/dizzyd/rebar/ The repo is now hosted at http://bitbucket.org/basho/rebar/ If you have any questions join the mailing-list at http://lists.basho.com/mailman/listinfo/rebar_lists.basho.com or for bug reports go to http://bitbucket.org/basho/rebar/issues/ rebar is under-documented right now and Dave is working on fixing that. To ease the learning curve I've implemented getopt options based on Juan Jose Comellas' getopt.erl and added a completion script for bash users. Additional info: Rebar + ibrowse Demo http://vimeo.com/8309893 http://dizzyd.com/blog/post/194 To see the options just get a copy of rebar as outlined in the above blog post and $ ./rebar without any arguments. From dizzyd@REDACTED Mon Jan 11 14:35:51 2010 From: dizzyd@REDACTED (Dave Smith) Date: Mon, 11 Jan 2010 06:35:51 -0700 Subject: [erlang-questions] Parallel Make in OTP In-Reply-To: <20100111112524.GA805@hanele> References: <38e3b9f40912170305h5437d21dhac263289ba60506a@mail.gmail.com> <20091218110502.GA1006@hanele> <38e3b9f40912180614g1a302a6ble46bee0ea960402d@mail.gmail.com> <20100111112524.GA805@hanele> Message-ID: On Mon, Jan 11, 2010 at 4:25 AM, Jachym Holecek wrote: > > I recently learnt about rebar[*]. It's a native Erlang solution and > looks pretty promising so far, although the documentation amounts to > UTSL at this point. I didn't yet have a chance to get to know it more > intimately, but that will come sooner or later. Anyway, always nice > to see your dreams come true meanwhile you were dreaming. :-) Actually the source repo for rebar is at: http://bitbucket.org/basho/rebar It's not exactly a secret project as I'll be talking about it at Erlang Factory this year, but it is still pretty young yet. I think, in the context of this thread, that rebar is probably not well suited (and may not ever be) to building the Erlang/OTP base distribution. It's more geared for building Erlang projects and relies heavily on conventions for OTP apps and releases. It does build port drivers and such, but that's a different ball game than building a cross platform, large-scale C project. :) I always welcome patches and feedback on rebar. If you have specific questions about using it, I typically hang out in #riak on Freenode. D. From freza@REDACTED Mon Jan 11 16:06:30 2010 From: freza@REDACTED (Jachym Holecek) Date: Mon, 11 Jan 2010 16:06:30 +0100 Subject: [erlang-questions] Parallel Make in OTP In-Reply-To: References: <38e3b9f40912170305h5437d21dhac263289ba60506a@mail.gmail.com> <20091218110502.GA1006@hanele> <38e3b9f40912180614g1a302a6ble46bee0ea960402d@mail.gmail.com> <20100111112524.GA805@hanele> Message-ID: <20100111150630.GA1136@hanele> # Dave Smith 2010-01-11: > On Mon, Jan 11, 2010 at 4:25 AM, Jachym Holecek wrote: > > > > I recently learnt about rebar[*]. It's a native Erlang solution and > > looks pretty promising so far, although the documentation amounts to > > UTSL at this point. I didn't yet have a chance to get to know it more > > intimately, but that will come sooner or later. Anyway, always nice > > to see your dreams come true meanwhile you were dreaming. :-) > > Actually the source repo for rebar is at: > > http://bitbucket.org/basho/rebar Thank you & Tuncer for clarifications. I went with whatever URL there was in firefox at the moment. > It's not exactly a secret project as I'll be talking about it at > Erlang Factory this year, but it is still pretty young yet. I think, > in the context of this thread, that rebar is probably not well suited > (and may not ever be) to building the Erlang/OTP base distribution. My understanding was that Peter was talking about a tool that would deal with whole project lifetime and that it could be assumed target systems had certain version of OTP already available? This just needs to be able to use different versions of OTP system and local apps on the machines, in addition to talking to some version control system. > It's more geared for building Erlang projects and relies heavily on > conventions for OTP apps and releases. It does build port drivers and > such, but that's a different ball game than building a cross platform, > large-scale C project. :) Yep, but see above. It seemed like that was something one could teach rebar about without too much pain? Regards, -- Jachym From mike_k_houghton@REDACTED Mon Jan 11 15:41:56 2010 From: mike_k_houghton@REDACTED (mike h) Date: Mon, 11 Jan 2010 14:41:56 +0000 (GMT) Subject: Erlang ping on the internet Message-ID: <29503.46949.qm@web27803.mail.ukl.yahoo.com> Hi, I'd like to setup two erlang nodes and send messages to them over the internet. I'm having a few problems... The network/hardware is: I have a local PC, behind a firewall, connected to the internet. I have a? remote system, behind a firewall,? hosted on the internet and I can ssh into it. What I want to do is send messages between two erlang nodes, one on each system. My local pc has a /hosts file like this. w.x.y.z????? mypc.home.net???? mypc My remote has a hosts file like this a.b.c.d???? ahost.mysite.co.uk what is the erl incantation needed to start an erlang node on each system such that each can ping the other using net_adm:ping(...)? (I've tried various combinatiions of -name, -sname but failed). And, of course, which ports do I need to open on the firewalls? Going a little farther what other ports (if any) should I open to send messages between processes running on the local and remote nodes? Thanks Mike From tuncer.ayaz@REDACTED Mon Jan 11 19:00:36 2010 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Mon, 11 Jan 2010 19:00:36 +0100 Subject: [erlang-questions] Parallel Make in OTP In-Reply-To: <20100111150630.GA1136@hanele> References: <38e3b9f40912170305h5437d21dhac263289ba60506a@mail.gmail.com> <20091218110502.GA1006@hanele> <38e3b9f40912180614g1a302a6ble46bee0ea960402d@mail.gmail.com> <20100111112524.GA805@hanele> <20100111150630.GA1136@hanele> Message-ID: <4ac8254d1001111000j315a2a11k8dc78d57b5d65cbd@mail.gmail.com> On Mon, Jan 11, 2010 at 4:06 PM, Jachym Holecek wrote: > # Dave Smith 2010-01-11: >> On Mon, Jan 11, 2010 at 4:25 AM, Jachym Holecek >> wrote: >> > >> > I recently learnt about rebar[*]. It's a native Erlang solution and >> > looks pretty promising so far, although the documentation amounts to >> > UTSL at this point. I didn't yet have a chance to get to know it more >> > intimately, but that will come sooner or later. Anyway, always nice >> > to see your dreams come true meanwhile you were dreaming. :-) >> >> Actually the source repo for rebar is at: >> >> http://bitbucket.org/basho/rebar > > Thank you & Tuncer for clarifications. I went with whatever URL there > was in firefox at the moment. > >> It's not exactly a secret project as I'll be talking about it at >> Erlang Factory this year, but it is still pretty young yet. I think, >> in the context of this thread, that rebar is probably not well suited >> (and may not ever be) to building the Erlang/OTP base distribution. > > My understanding was that Peter was talking about a tool that would > deal with whole project lifetime and that it could be assumed target > systems had certain version of OTP already available? This just needs > to be able to use different versions of OTP system and local apps on > the machines, in addition to talking to some version control system. In the context http://github.com/JacobVorreuter/epm might be a complementary tool >> It's more geared for building Erlang projects and relies heavily on >> conventions for OTP apps and releases. It does build port drivers and >> such, but that's a different ball game than building a cross platform, >> large-scale C project. :) > > Yep, but see above. It seemed like that was something one could teach > rebar about without too much pain? > > Regards, > ? ? ? ?-- Jachym From rvirding@REDACTED Mon Jan 11 19:55:31 2010 From: rvirding@REDACTED (Robert Virding) Date: Mon, 11 Jan 2010 19:55:31 +0100 Subject: [erlang-questions] Shared ETS Access In-Reply-To: <20100111110552.GA2329@hanele> References: <4B4A4D42.9060001@gmail.com> <24d4f39c1001101518i22ad6794va64cbbcac7cd3ef0@mail.gmail.com> <8d1798e91001110223s245908a9r6e010d1746c97c52@mail.gmail.com> <37178.194.88.55.211.1263206160.squirrel@localhost> <20100111110552.GA2329@hanele> Message-ID: <3dbc6d1c1001111055g16f1afbcj1321d1d7f19ca5b6@mail.gmail.com> 2010/1/11 Jachym Holecek > # Zoltan Lajos Kis 2010-01-11: > > Is there any advantage in writing to the table through a server process, > > instead of directly writing to the table (perhaps using the > > write-concurrency switch) ? > > [Answering the general question, didn't track the thread closely.] > > Depends on the problem at hand. Writing through owner process implies table > modifications are serialized in time, this is useful in cases where table > holds data complex beyond a simple key-value store or when table contents > need to stay in sync with some bits of surrounding world. So "consistency" > or at least illusion thereof is the answer. > > Of course, one remembers to think twice before using ETS acrobatically ;-). > You have exactly the same problem if you want to do a number of reads which are considered to be atomic. In many ways ETS provides a low-level interface and often you will need to add a layer above it. This is not a bug but definitely a feature and is in accord with a basic principle we had of providing tools rather than solutions. Robert From navaneethanit@REDACTED Mon Jan 11 20:09:20 2010 From: navaneethanit@REDACTED (NavTux) Date: Mon, 11 Jan 2010 11:09:20 -0800 (PST) Subject: How to prove the erlang performance? Message-ID: I am very thankful to your response,friend you have listed out the features or merits of our language just i would like to know how erlang process? what is the erlang process methodology for client's request?i mean what the technique used in erlang for HiPerformance? i ll be very happy for getting the answers from you? Ulf Wiger erlang-consulting.com> writes: > > > NavTux wrote: > > How to prove the performance of erlang? > > > > We know the familiar language java is well developed,in case we are > > erlang lovers how to prove the erlang's performance and ehat the tools > > are needed for it? > > I would say that Erlang is pretty well developed too, to the point > where you will find little or no "low-hanging fruit". It is important > to realize that there are lots of design decisions and tradeoffs > to be made when creating a language and optimizing for performance. > > Making the fastest possible language was never a design goal with > Erlang. The primary goals were to make a language suitable for > building non-stop complex control systems. This presents all kinds > of obvious tradeoffs: > > soft-real-time scheduling of thousands of concurrent activities > is clearly at odds with maximum sequential performance. > Dynamic typing is superb for dynamic code change in large systems, > but has a performance penalty. > Dynamic call and message tracing is wonderful for debugging of > embedded systems, but carry some runtime overhead. > Share-nothing concurrency will help you stay sane, but may > incur unnecessary copying in some cases. > Dynamic memory management simplifies things greatly, and can > often lead to both better performance and less memory usage, > but your mileage will vary depending on the problem. > > BTW, did you really mean "prove performance"? I read it as > "improve performance". In either case, the answer depends on what > aspects of performance you are interested in, and what your > problem domain is. > > On the topic of proving performance, I would say that the tools > for analysing performance in applications with tens of thousand > concurrent processes, starting and stopping hundreds of processes > every second, are *at least* as well developed for Erlang as they > are for Java. This goes both for profiling tools and verification > tools. Verifying massively concurrent applications is a research > topic, but I daresay that the Erlang crowd is on the leading > edge here. Heck, even the Erlang debugger is capable of debugging > distributed and massively concurrent systems, even though stop-and- > go debugging is often extremely inconvenient in embedded real-time > applications. > > BR, -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ From kiszl@REDACTED Mon Jan 11 20:23:47 2010 From: kiszl@REDACTED (Zoltan Lajos Kis) Date: Mon, 11 Jan 2010 20:23:47 +0100 Subject: [erlang-questions] Shared ETS Access In-Reply-To: <3dbc6d1c1001111055g16f1afbcj1321d1d7f19ca5b6@mail.gmail.com> References: <4B4A4D42.9060001@gmail.com> <24d4f39c1001101518i22ad6794va64cbbcac7cd3ef0@mail.gmail.com> <8d1798e91001110223s245908a9r6e010d1746c97c52@mail.gmail.com> <37178.194.88.55.211.1263206160.squirrel@localhost> <20100111110552.GA2329@hanele> <3dbc6d1c1001111055g16f1afbcj1321d1d7f19ca5b6@mail.gmail.com> Message-ID: <4B4B7AC3.8020309@tmit.bme.hu> Robert Virding wrote: > 2010/1/11 Jachym Holecek > > >> # Zoltan Lajos Kis 2010-01-11: >> >>> Is there any advantage in writing to the table through a server process, >>> instead of directly writing to the table (perhaps using the >>> write-concurrency switch) ? >>> >> [Answering the general question, didn't track the thread closely.] >> >> Depends on the problem at hand. Writing through owner process implies table >> modifications are serialized in time, this is useful in cases where table >> holds data complex beyond a simple key-value store or when table contents >> need to stay in sync with some bits of surrounding world. So "consistency" >> or at least illusion thereof is the answer. >> >> Of course, one remembers to think twice before using ETS acrobatically ;-). >> >> > > You have exactly the same problem if you want to do a number of reads which > are considered to be atomic. In many ways ETS provides a low-level interface > and often you will need to add a layer above it. This is not a bug but > definitely a feature and is in accord with a basic principle we had of > providing tools rather than solutions. > > Robert > > It seems like ETS already provides lock-like functionality in the form of atomic multiple-insert/update/delete operations. Is there a reason these locks are not available for direct manipulation? From dmitriid@REDACTED Mon Jan 11 20:43:07 2010 From: dmitriid@REDACTED (Dmitrii Dimandt) Date: Mon, 11 Jan 2010 21:43:07 +0200 Subject: [erlang-questions] Re: Web server structure: Rack In-Reply-To: <8e04b5821001110110n292d6782t7ebeeed98b3c3b2d@mail.gmail.com> References: <0e24ebfd-1e43-4b1f-9de9-c2dc53724a83@m25g2000yqc.googlegroups.com> <8e04b5821001102216m70910ef7gab921f08d4502b97@mail.gmail.com> <8D70AAEA-5655-4FB0-9F45-8F72BC70C290@gmail.com> <8e04b5821001110110n292d6782t7ebeeed98b3c3b2d@mail.gmail.com> Message-ID: >> Actually, it's not entirely true for the web. >> >> - There's ton of information being passed around in HTTP requests >> - Parsing this information out is a tedious task and needs to be redone for every new web layer you wish to build >> - Parsing multipart forms is PITA, see http://code.google.com/p/mochiweb/source/browse/trunk/src/mochiweb_multipart.erl and http://bitbucket.org/justin/webmachine/src/tip/src/webmachine_multipart.erl (see esp. the comment about how browsers are fun :) ) >> - Setting cookies correctly is PITA, see http://code.google.com/p/mochiweb/source/browse/trunk/src/mochiweb_cookies.erl >> - You can't reliably write generic code that will run across all Erlang web servers, since every web server differs in how it presents information to your code and what it expects from your code >> - Because of that you can't reliably abstract parts of your functionality (caching, setting etags etc., see e.g. http://rack.rubyforge.org/doc/Rack.html) into truly reusable pieces of code > > I agree with most of the points you have raised above (except the > parsing of the HTTP protocol which is already done by the core Erlang > modules). Indeed it is really hard to write a good (as in correct) web > server, and even harder to write one that works with all the browsers. > Well, parsing the protocol itself might be easy, but following it surely isn't :) http://webmachine.basho.com/diagram.html And webmachine is only available for mochiweb... > >> Because of that a common web server interface is actually a blessing and, in my opinion, should be accepted more aggressively. > > Indeed such a <> could be a > <> for the enterprise world, where you need something stable > and reliable. But there is also a drawback: I remember (maybe I'm > wrong because I'm not a web developer, but I've kept a close eye), > that a few years ago (5 maybe?) the only usable (as in enterprise > ready) web server was Apache (now we have LigHTTPD, Nginx, and of > course Apache, thus not too much better in terms of diversity)... > > What I'm trying to say: a < should be accepted more aggressively>> leads to (framework) lock-in... > > >> - Parsing multipart forms is PITA, see http://code.google.com/p/mochiweb/source/browse/trunk/src/mochiweb_multipart.erl and http://bitbucket.org/justin/webmachine/src/tip/src/webmachine_multipart.erl (see esp. the comment about how browsers are fun :) ) >> - Setting cookies correctly is PITA, see http://code.google.com/p/mochiweb/source/browse/trunk/src/mochiweb_cookies.erl > > Also we are missing a important point: web servers are not only > for (user) web-pages. One important usage is also web-services (I'm > not meaning WSDL or REST-like, but anything using HTTP as transport). > And in the web-services case, usually there is no multi-part content, > no cookies, even no caching (usually). > Thus in this case all the above mentioned features (caching, etc.) > are useless and usually incur more overhead than needed. > > But in general I agree: in a production environment we need a > stable, commonly accepted web-stack. > > Ciprian. > > > P.S.: I'm wondering about something: in a (user-centric) web > environment isn't string (as in Unicode) support very important? And > let's face it Erlang is not the most efficient string manipulation > language. (Right?) Well, it turns out that it's not such an issue after all. The only problem would be things like transliteration which can be done manually (see to_name in http://code.google.com/p/zotonic/source/browse/src/support/z_string.erl). And as NIFs become stable, someone will surely write an interface to ICU :) From torben.lehoff@REDACTED Mon Jan 11 22:27:18 2010 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Mon, 11 Jan 2010 22:27:18 +0100 Subject: [erlang-questions] Erlang ping on the internet In-Reply-To: <29503.46949.qm@web27803.mail.ukl.yahoo.com> References: <29503.46949.qm@web27803.mail.ukl.yahoo.com> Message-ID: Hi Mike, You are probably behind a NAT, so for this to work Erlang needs to be able to do hole punching using STUN and/or TURN - one could make it work with a more primitive solution, but when there is a standard available... Your problem is that Erlang does not have the ability to do hole punching (in whatever form) - Joe has that on his to-do list for the Erlang library he has just recently started creating. Cheers, Torben On Mon, Jan 11, 2010 at 15:41, mike h wrote: > Hi, > > I'd like to setup two erlang nodes and send messages to them over the > internet. I'm having a few problems... > The network/hardware is: > I have a local PC, behind a firewall, connected to the internet. > I have a remote system, behind a firewall, hosted on the internet and I > can ssh into it. > What I want to do is send messages between two erlang nodes, one on each > system. > > My local pc has a /hosts file like this. > w.x.y.z mypc.home.net mypc > > My remote has a hosts file like this > a.b.c.d ahost.mysite.co.uk > > what is the erl incantation needed to start an erlang node on each system > such that each can > ping the other using net_adm:ping(...)? (I've tried various combinatiions > of -name, -sname but failed). > And, of course, which ports do I need to open on the firewalls? > > Going a little farther what other ports (if any) should I open to send > messages between processes running on the local and remote nodes? > > Thanks > > Mike > > > > -- http://www.linkedin.com/in/torbenhoffmann From mek@REDACTED Mon Jan 11 23:46:26 2010 From: mek@REDACTED (Max E. Kuznecov) Date: Tue, 12 Jan 2010 00:46:26 +0200 Subject: Included applications Message-ID: <732f986d1001111446j37f3362fq647b89539eda430@mail.gmail.com> Hello! I've got a question about included_application option in app file. What I want is to start my system by running single top-level supervisor and let it start all other required applications under its supervision tree. manpage for app(4) says: included_applications: All applications which are included by this application. When this application is started, all included application will automatically be loaded, but not started, by the application controller. It is assumed that the topmost supervisor of the included application is started by a supervisor of this application. I cannot get it how should I actually start those included applications. If I write in toplevel.app: {included_applications, [worker1, worker2]}, And in toplevel_sup.erl: {ok, Included} = application:get_key(included_applications), lists:foreach(fun(App) -> application:start(App) end, Included), I end up with both worker1 and worker2 indeed started. But appmon shows they're both in the same level as my toplevel, i.e. they're not in topelevel's supervision tree (or appmon just doesn't show that relation?) If I instead replace application:start() with App:start_link(), I get supervision tree I was expecting for (both workers under toplevel's tree), but calling application:which_applications() shows only toplevel as being loaded and started. I'm quite confused about all this. Could anyone please explain what is the proper way of achieving my goal here? Thanks. -- ~syhpoon From dennis.novikov@REDACTED Tue Jan 12 00:38:43 2010 From: dennis.novikov@REDACTED (Dennis Novikov) Date: Tue, 12 Jan 2010 01:38:43 +0200 Subject: [erlang-questions] Included applications In-Reply-To: <732f986d1001111446j37f3362fq647b89539eda430@mail.gmail.com> References: <732f986d1001111446j37f3362fq647b89539eda430@mail.gmail.com> Message-ID: <8c412f0c1001111538l5e7a4c2ala5d86526350ae628@mail.gmail.com> Hi. On Tue, Jan 12, 2010 at 12:46 AM, Max E. Kuznecov wrote: > Hello! > > I've got a question about included_application option in app file. > What I want is to start my system by running single top-level > supervisor and let it start all other required applications under its > supervision tree. > manpage for app(4) says: > > included_applications: > ? ? ? ? ? ? All applications which are included by this application. > When ?this ?application ?is ?started, ?all > ? ? ? ? ? ? included ?application will automatically be loaded, but > not started, by the application controller. > ? ? ? ? ? ? It is assumed that the topmost supervisor of the included > application is started by a supervisor of > ? ? ? ? ? ? this application. > > I cannot get it how should I actually start those included applications. > > If I write in toplevel.app: > > {included_applications, [worker1, worker2]}, > > And in toplevel_sup.erl: > > {ok, Included} = application:get_key(included_applications), > > lists:foreach(fun(App) -> ?application:start(App) end, Included), > > I end up with both worker1 and worker2 ?indeed started. But appmon > shows they're both in the same level as my toplevel, i.e. they're not > in topelevel's supervision tree (or appmon just doesn't show that > relation?) > > If I instead replace application:start() with App:start_link(), I get > supervision tree I was expecting for (both workers under toplevel's > tree), but calling application:which_applications() shows only > toplevel as being loaded and started. > I'm quite confused about all this. Could anyone please explain what is > the proper way of achieving my goal here? That's quite logical, as each of your App:start_link() probably starts main supervisor of a corresponding included application. Included application is a part of main one. Try this in included application: application:get_application() In first case it will return {ok, included_app1} while in second case it will return {ok, toplevel} Later variant is how included application supposed to be started. -- WBR, Dennis Novikov From steven.charles.davis@REDACTED Tue Jan 12 02:16:52 2010 From: steven.charles.davis@REDACTED (Steve Davis) Date: Mon, 11 Jan 2010 17:16:52 -0800 (PST) Subject: keys for mnesia Message-ID: <1aac2589-7f79-42e3-954e-e362d68d4d1b@b2g2000yqi.googlegroups.com> Which would be more efficient/recommended to use as the key of a k/v pair for an mnesia table: {myapp, myattr} or "myapp.myattr" or <<"myapp.myattr">> ? BR /s From cw@REDACTED Tue Jan 12 02:39:34 2010 From: cw@REDACTED (Christian Westbrook) Date: Mon, 11 Jan 2010 17:39:34 -0800 Subject: Reminder: ErLounge SF/Bay -- Tue. 7pm @ Pier 38 Message-ID: <17f27c9a1001111739h69471c27u2368f0010f057b96@mail.gmail.com> Happy New Year everyone! A quick reminder for those in the area: The first ErLounge SF/Bay of 2010 is upon us; this Tuesday evening at 7pm, we'll be gathering at Pier 38--home of SocialMedia, CoTweet, True Ventures, and more--upstairs in the SocialMedia space. Drinks and delicious sweets will be provided. Bring a friend! Join us to meet and greet fellow developers interested in the Erlang language and OTP way of life, and share your experiences with Erlang. I'll open with some slides on CoTweet's use of Erlang and open source. The event is open to the public, and I particularly welcome all Erlang developers, functional programming folks and curious to this social event. Tuesday, January 12th, 7:00pm ErLounge SF/Bay @ Pier 38 [SocialMedia space] Embarcadero, between Brennan & Townsend San Francisco, CA 94107 Map link - http://maps.google.com/maps?q=38+pier Please feel free to contact me (Christian Westbrook) at 713.906.4211 if you need directions or need to coordinate. Please RSVP here: http://www.meetup.com/ErLounge/calendar/12067324/ Hope to see you there! Cheers, Christian Westbrook Erlanguatan @ CoTweet cw@REDACTED | cw@REDACTED __ http://meetup.com/erlounge From igorrs@REDACTED Tue Jan 12 02:51:51 2010 From: igorrs@REDACTED (Igor Ribeiro Sucupira) Date: Mon, 11 Jan 2010 23:51:51 -0200 Subject: [erlang-questions] keys for mnesia In-Reply-To: <1aac2589-7f79-42e3-954e-e362d68d4d1b@b2g2000yqi.googlegroups.com> References: <1aac2589-7f79-42e3-954e-e362d68d4d1b@b2g2000yqi.googlegroups.com> Message-ID: Hi. I'd also appreciate an answer to that question. :) My guess is that the more space-efficient would be the smallest in binary format. In that case, your second option would be the best: 1> BS = fun(Term) -> erlang:byte_size(term_to_binary(Term)) end. #Fun 2> BS({myapp, myattr}). 20 3> BS("myapp.myattr"). 16 4> BS(<<"myapp.myattr">>). 18 But I'm not sure. Best regards. Igor. On Mon, Jan 11, 2010 at 11:16 PM, Steve Davis wrote: > Which would be more efficient/recommended to use as the key of a k/v > pair for an mnesia table: > > {myapp, myattr} > > or > > "myapp.myattr" > > or > > <<"myapp.myattr">> > > ? > > BR > /s > > ________________________________________________________________ > 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 hd2010@REDACTED Tue Jan 12 03:05:44 2010 From: hd2010@REDACTED (Henning Diedrich) Date: Tue, 12 Jan 2010 03:05:44 +0100 Subject: Benchmarks Message-ID: <4B4BD8F8.20401@eonblast.com> These benchmarks look somewhat bad. http://shootout.alioth.debian.org/u64q/benchmark.php?test=all&lang=hipe&lang2=gcc Would you have bullet points for me as to how they might be misleading or only a part of a bigger picture - or simply just so? Thanks a lot, Henning From jarrod@REDACTED Tue Jan 12 03:10:26 2010 From: jarrod@REDACTED (Jarrod Roberson) Date: Mon, 11 Jan 2010 21:10:26 -0500 Subject: [erlang-questions] Benchmarks In-Reply-To: <4B4BD8F8.20401@eonblast.com> References: <4B4BD8F8.20401@eonblast.com> Message-ID: On Mon, Jan 11, 2010 at 9:05 PM, Henning Diedrich wrote: > These benchmarks look somewhat bad. > > > http://shootout.alioth.debian.org/u64q/benchmark.php?test=all&lang=hipe&lang2=gcc > > Would you have bullet points for me as to how they might be misleading or > only a part of a bigger picture - or simply just so? > > Thanks a lot, > Henning > > they are irrelevant as none of those things are what Erlang is designed to do REALLY WELL. From hd2010@REDACTED Tue Jan 12 04:00:42 2010 From: hd2010@REDACTED (Henning Diedrich) Date: Tue, 12 Jan 2010 04:00:42 +0100 Subject: [erlang-questions] Benchmarks In-Reply-To: References: <4B4BD8F8.20401@eonblast.com> Message-ID: <4B4BE5DA.6010409@eonblast.com> >> http://shootout.alioth.debian.org/u64q/benchmark.php?test=all&lang=hipe&lang2=gcc >> >> Would you have bullet points for me as to how they might be misleading or >> only a part of a bigger picture - or simply just so? >> >> Thanks a lot, >> Henning >> >> >> > they are irrelevant as none of those things are what Erlang is designed to > do REALLY WELL. > Certainly that's the expected defense. Could you spell that out specifically? And, besides the Yaws / Mochi / Apache shoot outs, are there current benchmarks or any metrics out there that show results of which there is some agreement in the community that they do measure something that IS relevant? And I mean that widely, like, on average 1/4 of code vs. C. That'd be a valid point. Thanks, Henning From vlad@REDACTED Tue Jan 12 04:17:38 2010 From: vlad@REDACTED (Vlad Didenko) Date: Mon, 11 Jan 2010 21:17:38 -0600 Subject: [erlang-questions] Benchmarks In-Reply-To: References: <4B4BD8F8.20401@eonblast.com> Message-ID: <179FD608-4283-483A-9A67-1143D18DC2F9@didenko.com> That is really interesting. Where would I read up on which tasks Erlang fits really well? I have seen the earlier message from Ulf to NavTux about about "non-stop complex control systems". That post, again, lists areas which Erlang is NOT focused on. Is there a specific positive list somewhere? I would really appreciate the guidance as it helps to get a right tool for a project. Thank you! Vlad On Jan 11, 2010, at 8:10 PM, Jarrod Roberson wrote: > On Mon, Jan 11, 2010 at 9:05 PM, Henning Diedrich wrote: > >> These benchmarks look somewhat bad. >> >> >> http://shootout.alioth.debian.org/u64q/benchmark.php?test=all&lang=hipe&lang2=gcc >> >> Would you have bullet points for me as to how they might be misleading or >> only a part of a bigger picture - or simply just so? >> >> Thanks a lot, >> Henning >> >> > they are irrelevant as none of those things are what Erlang is designed to > do REALLY WELL. From luismarianoguerra@REDACTED Tue Jan 12 05:42:00 2010 From: luismarianoguerra@REDACTED (Mariano Guerra) Date: Tue, 12 Jan 2010 01:42:00 -0300 Subject: [ANN] efene programming language 0.1 released Message-ID: efene is a programming language that runs on the erlang virtual machine. the idea is to provide an alternative syntax to erlang that is most suitable for people coming from languages like Java, C, C++, C#, Javascript. the language is almost 100% compatible with erlang (and will be), the compiler allows to translate an efene source file into a readable erlang one. It also adds some syntactic sugar in some places to make some tasks easier. to see how it looks you can go to the examples dir[0] more info at efene?s main site[1] and the efene?s github page[2] [0] http://github.com/marianoguerra/efene/tree/master/examples/ [1] http://marianoguerra.com.ar/efene [2] http://github.com/marianoguerra/efene/ http://efene.tumblr.com/post/329929156/efene-0-1-released From tony@REDACTED Tue Jan 12 06:43:15 2010 From: tony@REDACTED (Tony Arcieri) Date: Mon, 11 Jan 2010 22:43:15 -0700 Subject: [erlang-questions] [ANN] efene programming language 0.1 released In-Reply-To: References: Message-ID: On Mon, Jan 11, 2010 at 9:42 PM, Mariano Guerra wrote: > efene is a programming language that runs on the erlang virtual machine. > > the idea is to provide an alternative syntax to erlang that is most > suitable for people coming from languages like Java, C, C++, C#, > Javascript. > As someone dealing with similar problems in my implementation of Reia ( http://github.com/tarcieri/reia) I have a number of questions about your language: - Do you support destructive assignment? - Do you support the "assign" operators that are found in traditional imperative languages (e.g. += -= *= /= |= &= ^= <<= >>=) - How do you handle objects? Your syntax is inspired by JavaScript. Do you provide a prototype-based object model? - How do you handle concurrency? - How do you handle distribution? - How do you interface back with Erlang? - How do you handle exceptions? -- Tony Arcieri Medioh! A Kudelski Brand From luismarianoguerra@REDACTED Tue Jan 12 06:59:10 2010 From: luismarianoguerra@REDACTED (Mariano Guerra) Date: Tue, 12 Jan 2010 02:59:10 -0300 Subject: [erlang-questions] [ANN] efene programming language 0.1 released In-Reply-To: References: Message-ID: On Tue, Jan 12, 2010 at 2:43 AM, Tony Arcieri wrote: > On Mon, Jan 11, 2010 at 9:42 PM, Mariano Guerra > wrote: >> >> efene is a programming language that runs on the erlang virtual machine. >> >> the idea is to provide an alternative syntax to erlang that is most >> suitable for people coming from languages like Java, C, C++, C#, >> Javascript. as the text says is an alternative syntax to erlang (with some syntactic sugar) so don't expect a lot of innovation :) > As someone dealing with similar problems in my implementation of Reia > (http://github.com/tarcieri/reia) I have a number of questions about your > language: > > Do you support destructive assignment? no > Do you support the "assign" operators that are found in traditional > imperative languages (e.g. += -= *= /= |= &= ^= <<= >>=) no > How do you handle objects?? Your syntax is inspired by JavaScript.? Do you > provide a prototype-based object model? I only implemented some syntactix sugar for records, I don't know if it will stay that way but it's a beginning, here is an example: http://github.com/marianoguerra/efene/blob/master/examples/record.fn as you see you have a way to handle records with a simpler syntax (at least for me) and you don't need to import the record declaration to access it, also you can access the record field at runtime and do something like "duck typing" on records, checking if the record has a field etc. I highly appreciate comments on this one > How do you handle concurrency? exactly like erlang http://github.com/marianoguerra/efene/blob/master/examples/send.fn > How do you handle distribution? code distribution? app distribution? > How do you interface back with Erlang? it's almost 1:1 with erlang code so you just use the erlang modules* > How do you handle exceptions? just like erlang :) http://github.com/marianoguerra/efene/blob/master/examples/trycatch.fn as I said above it's just an alternative syntax with some syntactic sugar. I started it because when I started learning erlang some months ago I found the syntax a little scary (I come from the languages I named above) and as an excuse to learn more erlang and help people as me I decided to start this project. * in fact the compiler has an option to transform any efene source file to erlang, here is an example with the record.fn example so you can see how the code is generated: mariano@REDACTED:~/Proyectos/efene/examples$ ../bin/fnc -t erl record.fn -module(record). -compile(export_all). -record(person, {firstname, lastname, mail}). person(Firstname, Lastname, Mail) -> Obj = #person{firstname = Firstname, lastname = Lastname, mail = Mail}, Wrapper = fun (Self, Person) -> fun (getfirstname) -> Person#person.firstname; (getlastname) -> Person#person.lastname; (getmail) -> Person#person.mail; ({setfirstname, Value}) -> Self(Self, Person#person{firstname = Value}); ({setlastname, Value}) -> Self(Self, Person#person{lastname = Value}); ({setmail, Value}) -> Self(Self, Person#person{mail = Value}); ({has, Field}) -> lists:member(Field, [firstname, lastname, mail]); (record) -> Person; (fields) -> {firstname, lastname, mail}; (name) -> person end end, Wrapper(Wrapper, Obj). run() -> P = person("mariano", "guerra", "mail"), Print = fun (X) -> io:format("~p~n", [X]) end, P = person("mariano", "guerra", "mail"), Print(P(getfirstname)), Print(P(getlastname)), Print(P(getmail)), Print(P(record)), Print(P(fields)), Print(P(name)), Print(P({has, firstname})), Print(P({has, address})), P1 = P({setfirstname, "Mariano"}), Print(P1(record)). From leap@REDACTED Tue Jan 12 07:09:58 2010 From: leap@REDACTED (Michael Turner) Date: Tue, 12 Jan 2010 06:09:58 +0000 Subject: No subject In-Reply-To: <4B4BD8F8.20401@eonblast.com> Message-ID: <3L4fRIJW.1263276598.0600740.leap@gol.com> On 1/12/2010, "Henning Diedrich" wrote: >These benchmarks look somewhat bad. > >http://shootout.alioth.debian.org/u64q/benchmark.php?test=all&lang=hipe&lang2=gcc > > >Would you have bullet points for me as to how they might be misleading >or only a part of a bigger picture - or simply just so? Those C benchmarks might look pretty bad compared to some very carefully optimized assembly code. For some reason, though, the shootout doesn't include any assembler. Huh. Strange. Oh wait -- could *programmer productivity* be a relevant issue, even in benchmarking? Erlang is increasingly being used in productive webwork. COBOL and FORTRAN are still workhorse languages in their niches, and probably compile to native code that's faster than HiPe output, but there's very little webwork being done in either language. So compare the Erlang benchmark against those for PHP, Perl, Python and Ruby. Erlang comes out looking pretty good. How about desktop apps? Fire up Wings 3D. If Erlang is so slow, why am I able to do all these real-time graphic manipulations as (apparently) fast as with other subdivision modelers? Ah: the really compute-intensive stuff is all down in special-purpose hardware or already-optimized graphics primitives in libraries. Just as it would be if Wings 3D were written in C. Or, for that matter, in assembler. The big picture? Here's how I got it, courtesy of a software engineer who was as grey-haired 20 years ago as I am today: "Engineers are always trying to optimize their code for something: speed, space, startup time, fewest lines of code, most self-documenting. Those things are easy. And usually not very important to the paying customer. What's hard is optimizing for getting it done. And that's almost always more important than anything else." Is Erlang helping you get it done? In a world where about 70-80% of software projects fail, decade after decade, no question could be more important. I approached Erlang rather gingerly -- for surely, I thought, it is a prototypical late-'80s ubergeek language, perhaps mired in some dated preconceptions, tired methodology, and ever more confined to narrow, increasingly irrelevant niches? As I scanned the reference manual and began to absorb the underlying paradigms of the languge, my head started to swim: if I could only learn this stuff, I would be able to get so much done .... -michael From max.lapshin@REDACTED Tue Jan 12 08:16:42 2010 From: max.lapshin@REDACTED (Max Lapshin) Date: Tue, 12 Jan 2010 10:16:42 +0300 Subject: Line number in errors: badmatch, case clause, badarith Message-ID: Is it hard to change format of runtime errors to include line number, where error appeared. I understand, that it is impossible to understand, on which line function arguments hasn't matched, but it is clearly determined, on which line badmatch or badarith has happened. Are there hidden problems with such error information? From ulf.wiger@REDACTED Tue Jan 12 09:08:41 2010 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Tue, 12 Jan 2010 09:08:41 +0100 Subject: [erlang-questions] keys for mnesia In-Reply-To: References: <1aac2589-7f79-42e3-954e-e362d68d4d1b@b2g2000yqi.googlegroups.com> Message-ID: <4B4C2E09.7020403@erlang-consulting.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 In this case, you need to differentiate between a ram_copy (or disc_copy) table and a disc_only_copy. The term_to_binary conversion is not done when storing in ets, so there you need to look at the internal format for each term: - - a 2-tuple with two atoms: 2 words + 2 * (1 word) - - a string (list of integers): Length * (2 words) - - a binary: (3..6 words) + data (See the efficiency guide in the Erlang/OTP documentation). But there may be other considerations as well. If you want the table to be an ordered set, sorting efficiency becomes an issue. I can't say whether it is more efficient to sort atoms than it is to sort binaries, as in both cases, you must retrieve the actual content and compare. You may also want to consider copying cost. Strings are copied in full, even when storing in ets, whereas for atoms, only the pointer is copied. Binaries are normally not copied (unless they are small enough that it doesn't matter anyway). Bottom line is that you either measure on your data, with a realistic mix of operations and data sizes, or you assume that it won't make that much difference anyway. Unless you are dealing with massive amounts of data, very large objects and/or have tough performance requirements, I'd go with the latter until reality intervenes and proves the assumption wrong. BR, Ulf W Igor Ribeiro Sucupira wrote: > Hi. > > I'd also appreciate an answer to that question. :) > > My guess is that the more space-efficient would be the smallest in > binary format. In that case, your second option would be the best: > > 1> BS = fun(Term) -> erlang:byte_size(term_to_binary(Term)) end. > #Fun > 2> BS({myapp, myattr}). > 20 > 3> BS("myapp.myattr"). > 16 > 4> BS(<<"myapp.myattr">>). > 18 > > > But I'm not sure. > > Best regards. > Igor. > > On Mon, Jan 11, 2010 at 11:16 PM, Steve Davis > wrote: >> Which would be more efficient/recommended to use as the key of a k/v >> pair for an mnesia table: >> >> {myapp, myattr} >> >> or >> >> "myapp.myattr" >> >> or >> >> <<"myapp.myattr">> >> >> ? >> >> BR >> /s -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAktMLgkACgkQtqqFieqzed3fIwCg9jhXqSPAsFKLmkFsvvWMaWnk WNkAoPQuByJudBlN7J3HH4SkXGGL6DMK =Rt72 -----END PGP SIGNATURE----- --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From hd2010@REDACTED Tue Jan 12 10:36:53 2010 From: hd2010@REDACTED (Henning Diedrich) Date: Tue, 12 Jan 2010 10:36:53 +0100 Subject: [erlang-questions] Benchmarks In-Reply-To: <179FD608-4283-483A-9A67-1143D18DC2F9@didenko.com> References: <4B4BD8F8.20401@eonblast.com> <179FD608-4283-483A-9A67-1143D18DC2F9@didenko.com> Message-ID: <4B4C42B5.2060308@eonblast.com> Vlad Didenko wrote: > as it helps to get a right tool for a project. As for motivation, I am asking for in-house selling if you will. Winning people over to even accept Erlang to the list of valid options. Henning From torben.lehoff@REDACTED Tue Jan 12 11:24:09 2010 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Tue, 12 Jan 2010 11:24:09 +0100 Subject: [erlang-questions] Benchmarks In-Reply-To: <4B4C42B5.2060308@eonblast.com> References: <4B4BD8F8.20401@eonblast.com> <179FD608-4283-483A-9A67-1143D18DC2F9@didenko.com> <4B4C42B5.2060308@eonblast.com> Message-ID: What is the pain? And why would Erlang solve that pain? On the surface anything that matches http://en.citizendium.org/wiki/Erlang%27s_original_domain would probably be nice to do in Erlang. I have done a productivity study on the project where we used it at work (Motorola, Tetra - http://skillsmatter.com/podcast/erlang/introducing-erlang-to-motorola-the-journey-to-success). After maturing the prototype we created in the first place I expect that we will be something like 4-5x compared to C++/Java and even more compared to C (which the comparable products we sell is mostly written in). Why do we get that big a productivity gain? Right tool for the job. Hammer and nail. Erlang was made for the type of application we are doing and hence one can be quite productive since the semantic gap between the domain and what Erlang provides - the downside is that you produce fewer lines of code, so if you are measured by lines of code per hour I would hesitate to use Erlang ;-) Rock? n? roll ?rlang! Torben On Tue, Jan 12, 2010 at 10:36, Henning Diedrich wrote: > Vlad Didenko wrote: > >> as it helps to get a right tool for a project. >> > As for motivation, I am asking for in-house selling if you will. Winning > people over to even accept Erlang to the list of valid options. > > Henning > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > -- http://www.linkedin.com/in/torbenhoffmann From fjl@REDACTED Tue Jan 12 12:18:37 2010 From: fjl@REDACTED (Felix Lange) Date: Tue, 12 Jan 2010 12:18:37 +0100 (CET) Subject: [erlang-questions] Parallel Make in OTP In-Reply-To: <20100111150630.GA1136@hanele> References: <20100111112524.GA805@hanele> <20100111150630.GA1136@hanele> Message-ID: <20100112.121837.140000610.fjl@twurst.com> > My understanding was that Peter was talking about a tool that would > deal with whole project lifetime and that it could be assumed target > systems had certain version of OTP already available? This just needs > to be able to use different versions of OTP system and local apps on > the machines, in addition to talking to some version control system. > If these are requirements, Sinan[1] (and erlware in general) might be the tool for the job. It has some built-in functionality for building against different otp versions and is extensible. In addition, it uses Faxien[2] (the erlware package manager) for dependency tracking. Both of them have been designed to work in a corporate environment. [1]: http://code.google.com/p/sinan/ [2]: http://code.google.com/p/faxien/ From ulf.wiger@REDACTED Tue Jan 12 12:25:24 2010 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Tue, 12 Jan 2010 12:25:24 +0100 Subject: [erlang-questions] Benchmarks In-Reply-To: <179FD608-4283-483A-9A67-1143D18DC2F9@didenko.com> References: <4B4BD8F8.20401@eonblast.com> <179FD608-4283-483A-9A67-1143D18DC2F9@didenko.com> Message-ID: <4B4C5C24.4070609@erlang-consulting.com> Vlad Didenko wrote: > That is really interesting. Where would I read up on which tasks > Erlang fits really well? I have seen the earlier message from Ulf to > NavTux about about "non-stop complex control systems". That post, > again, lists areas which Erlang is NOT focused on. Is there a > specific positive list somewhere? Hmm, I was listing tradeoffs, but in doing so, at least I thought I was also listing some of the areas where Erlang can be expected to (and does indeed) excel: - handling lots of concurrent activitites with low latency - non-stop systems - handling complex control flows - run-time tracing and profiling (even with concurrent activities) The "other side" of micro-benchmarks is that they say precious little of how the programming language holds up under the ever- increasing weight of real-world requirements. My experience is that Erlang is often held up against an ideal view of what a real-world application written in a mainstream language would look like, based on micro-benchmarks and prototypes written by e.g. C++ wizards, the code bearing only superficial resemblance with the would-be finished product (the wizards knowing full well which land mines to avoid in order to write an elegant and blazing fast prototype.) Just to pick an example that feels fairly current, Google's Go is often mentioned in blogs and tweets as an Erlang-like language, since it sports light-weight "processes" and message-passing. These are extremely useful abstractions, and you might as well say that it's inspired by C.A.R. Hoare's CSP model. Notably, however, Go lacks memory protection between its Goroutines (they share memory and can make use of global variables with destructive update semantics), and Go completely lacks support for exceptions. Go may be /perfect/ for many domains where these are reasonable tradeoffs, but it makes it a fundamentally different language from Erlang. Given this fundamental difference in "system semantics", how should one interpret benchmarks comparing Go and Erlang? The answer must be that it depends completely on what you want to do, and how you understand the specific requirements and acceptable tradeoffs of that problem domain. BR, Ulf W -- Ulf Wiger CTO, Erlang Solutions Ltd, formerly Erlang Training & Consulting Ltd http://www.erlang-solutions.com --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From steven.charles.davis@REDACTED Tue Jan 12 12:49:52 2010 From: steven.charles.davis@REDACTED (Steve Davis) Date: Tue, 12 Jan 2010 05:49:52 -0600 Subject: [erlang-questions] keys for mnesia In-Reply-To: <4B4C2E09.7020403@erlang-consulting.com> References: <1aac2589-7f79-42e3-954e-e362d68d4d1b@b2g2000yqi.googlegroups.com> <4B4C2E09.7020403@erlang-consulting.com> Message-ID: <4B4C61E0.2020808@gmail.com> Hi Ulf, Igor, I was trending in my thinking toward binaries as a starting point; and it seems I need to revisit the efficiency guide. I was curious as to whether there would be a definitive answer, and so, Ulf, your guidance on the considerations to apply in this general situation is much appreciated. In the case of this particular table it's unlikely that performance would be an issue, there is value in this instance for using binaries for key parsing with binary matching in the application. I will surely take the advice that when I get far enough, I'll measure, measure, measure. Many thanks both for your responses, Regards, Steve Ulf Wiger wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > > In this case, you need to differentiate between a ram_copy > (or disc_copy) table and a disc_only_copy. > > The term_to_binary conversion is not done when storing in > ets, so there you need to look at the internal format for > each term: > > - - a 2-tuple with two atoms: 2 words + 2 * (1 word) > - - a string (list of integers): Length * (2 words) > - - a binary: (3..6 words) + data > > (See the efficiency guide in the Erlang/OTP documentation). > > But there may be other considerations as well. If you want > the table to be an ordered set, sorting efficiency becomes an > issue. I can't say whether it is more efficient to sort > atoms than it is to sort binaries, as in both cases, you > must retrieve the actual content and compare. > > You may also want to consider copying cost. Strings are copied > in full, even when storing in ets, whereas for atoms, only the > pointer is copied. Binaries are normally not copied (unless > they are small enough that it doesn't matter anyway). > > Bottom line is that you either measure on your data, with a > realistic mix of operations and data sizes, or you assume that > it won't make that much difference anyway. Unless you are > dealing with massive amounts of data, very large objects and/or > have tough performance requirements, I'd go with the latter > until reality intervenes and proves the assumption wrong. > > BR, > Ulf W > > Igor Ribeiro Sucupira wrote: >> Hi. >> >> I'd also appreciate an answer to that question. :) >> >> My guess is that the more space-efficient would be the smallest in >> binary format. In that case, your second option would be the best: >> >> 1> BS = fun(Term) -> erlang:byte_size(term_to_binary(Term)) end. >> #Fun >> 2> BS({myapp, myattr}). >> 20 >> 3> BS("myapp.myattr"). >> 16 >> 4> BS(<<"myapp.myattr">>). >> 18 >> >> >> But I'm not sure. >> >> Best regards. >> Igor. >> >> On Mon, Jan 11, 2010 at 11:16 PM, Steve Davis >> wrote: >>> Which would be more efficient/recommended to use as the key of a k/v >>> pair for an mnesia table: >>> >>> {myapp, myattr} >>> >>> or >>> >>> "myapp.myattr" >>> >>> or >>> >>> <<"myapp.myattr">> >>> >>> ? >>> >>> BR >>> /s > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iEYEARECAAYFAktMLgkACgkQtqqFieqzed3fIwCg9jhXqSPAsFKLmkFsvvWMaWnk > WNkAoPQuByJudBlN7J3HH4SkXGGL6DMK > =Rt72 > -----END PGP SIGNATURE----- > --------------------------------------------------- > > --------------------------------------------------- > > WE'VE CHANGED NAMES! > > Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. > > www.erlang-solutions.com > > From mek@REDACTED Tue Jan 12 13:19:04 2010 From: mek@REDACTED (Max E. Kuznecov) Date: Tue, 12 Jan 2010 14:19:04 +0200 Subject: [erlang-questions] Included applications In-Reply-To: <8c412f0c1001111538l5e7a4c2ala5d86526350ae628@mail.gmail.com> References: <732f986d1001111446j37f3362fq647b89539eda430@mail.gmail.com> <8c412f0c1001111538l5e7a4c2ala5d86526350ae628@mail.gmail.com> Message-ID: <732f986d1001120419i1abb414p615c0db1d05b1b3d@mail.gmail.com> Ok, I see. But what is the reason application:which_applications() doesn't show any applications except from toplevel and standard ones? Or maybe it doesn't suppose to? 2010/1/12 Dennis Novikov : > > That's quite logical, as each of your App:start_link() probably starts > main supervisor of a corresponding included application. > > Included application is a part of main one. Try this in included application: > application:get_application() > In first case it will return {ok, included_app1} > while in second case it will return {ok, toplevel} > > Later variant is how included application supposed to be started. > > -- > WBR, > ?Dennis Novikov > -- ~syhpoon From dennis.novikov@REDACTED Tue Jan 12 13:58:41 2010 From: dennis.novikov@REDACTED (Dennis Novikov) Date: Tue, 12 Jan 2010 14:58:41 +0200 Subject: [erlang-questions] Included applications In-Reply-To: <732f986d1001120419i1abb414p615c0db1d05b1b3d@mail.gmail.com> References: <732f986d1001111446j37f3362fq647b89539eda430@mail.gmail.com> <8c412f0c1001111538l5e7a4c2ala5d86526350ae628@mail.gmail.com> <732f986d1001120419i1abb414p615c0db1d05b1b3d@mail.gmail.com> Message-ID: <8c412f0c1001120458g15a60824pc58bf6d5abfe6eda@mail.gmail.com> > Ok, I see. But what is the reason application:which_applications() > doesn't show any applications except from toplevel and standard ones? > Or maybe it doesn't suppose to? If I understand it correctly, it doesn't supposed to 'know' about included applications, so there's way to have several instances of included application in the system ('system' as OTPdefines it). If included application was coded appropriately, off course. -- WBR, Dennis Novikov From thomasl_erlang@REDACTED Tue Jan 12 13:05:41 2010 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 12 Jan 2010 04:05:41 -0800 (PST) Subject: [erlang-questions] Benchmarks In-Reply-To: <4B4BE5DA.6010409@eonblast.com> References: <4B4BD8F8.20401@eonblast.com> <4B4BE5DA.6010409@eonblast.com> Message-ID: <20608.35401.qm@web111401.mail.gq1.yahoo.com> ----- Original Message ---- > From: Henning Diedrich > > Certainly that's the expected defense. Could you spell that out specifically? > And, besides the Yaws / Mochi / Apache shoot outs, are there current benchmarks > or any metrics out there that show results of which there is some agreement in > the community that they do measure something that IS relevant? And I mean that > widely, like, on average 1/4 of code vs. C. That'd be a valid point. > "Four-fold Increase in Productivity and Quality ?Industrial-Strength Functional Programming in Telecom-Class Products FEmSYS 2001 Deployment on distributed architectures" http://www.erlang.se/publications/Ulf_Wiger.pdf (In particular section 7.) For server benchmarking, I'd also recommend a look at Richard Jones, http://www.metabrew.com/article/a-million-user-comet-application-with-mochiweb-part-1 Judging from this list, performance fairly seldom comes up as an issue, so I guess in the aggregate it's mostly considered good enough. As a testimonial of sorts, we're using an extended Yaws and Erlang to handle substantial simultaneous upload traffic for an online backup service with quite nice results so far, performancewise. I won't go into details, but I think our current setup will be limited by the available network or disk bandwidth rather than CPU, memory, or any software bottlenecks. So switching to nginx or something like that would just be painful without providing much improved performance. (And as a bonus, because the servers just chug along ops love it :-) Best, Thomas From ciprian.craciun@REDACTED Tue Jan 12 14:00:57 2010 From: ciprian.craciun@REDACTED (Ciprian Dorin, Craciun) Date: Tue, 12 Jan 2010 15:00:57 +0200 Subject: Local node worker process pool Message-ID: <8e04b5821001120500y63b47edamdf646fb947f5db02@mail.gmail.com> Hello all! I have the following simple use-case, and I'm not sure how to efficiently implement it: I have some processes that need to send updates to some statistics engine, but I don't want to wait (or receive) the reply. (By processes I mean gen_server implementations, and by update I mean `gen_server:call` like messages) Thus I have the following options: a) send the message just like `gen_server:call` would have done, and then be prepared to ignore the reply; drawbacks: * I would have to hard-code the gen_server call protocol, thus maybe (highly improbable) breaking the backward / forward portability; * I have to ignore all the replies, which increases the source code and might fill the message queue; b) spawn a process in the background that shall send the request (and wait for the reply); drawbacks: * it wight overload the virtual machine with too many processes; c) implement a `pool` like system that allows me to set the number of workers, and then enqueue the requests in a round-robin fashion to the workers; drawbacks: * if there are too many requests they are going to pile up in the queue (actual instance of the `queue` module); advantages: * as the requests are "on best effort" it allows the virtual machine to carry on with the important work, and only a portion of the time (proportional with the number of workers) to be allocated to these requests; d) use the existing `pool` module, but which is designed for distributed Erlang nodes; Also the same problem (which leads only to solutions b and c), would be asynchronous function calls: I have a function, which takes some time to compute something, and I don't want to wait for it to finish, and also it's not that important so I don't want to dedicate an entire process to it. Any ideas? Any already existing solutions? Thanks, Ciprian. From thomasl_erlang@REDACTED Tue Jan 12 13:11:31 2010 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 12 Jan 2010 04:11:31 -0800 (PST) Subject: [erlang-questions] Line number in errors: badmatch, case clause, badarith In-Reply-To: References: Message-ID: <512414.36882.qm@web111407.mail.gq1.yahoo.com> ----- Original Message ---- > From: Max Lapshin > To: Erlang-Questions Questions > Sent: Tue, January 12, 2010 8:16:42 AM > Subject: [erlang-questions] Line number in errors: badmatch, case clause, badarith > > Is it hard to change format of runtime errors to include line number, > where error appeared. > I understand, that it is impossible to understand, on which line > function arguments hasn't matched, > but it is clearly determined, on which line badmatch or badarith has happened. > > Are there hidden problems with such error information? I think the compiler should add such info to exceptions, but it hasn't happened yet. In the meantime, you could try this: git://github.com/thomasl/smart_exceptions.git (The "devel" version seems to work fairly well, but no promises.) Best, Thomas PS. Given that OTP has taken the fantastic step of using github, maybe I ought to submit that patch myself? From steven.charles.davis@REDACTED Tue Jan 12 14:28:44 2010 From: steven.charles.davis@REDACTED (Steve Davis) Date: Tue, 12 Jan 2010 05:28:44 -0800 (PST) Subject: Local node worker process pool In-Reply-To: <8e04b5821001120500y63b47edamdf646fb947f5db02@mail.gmail.com> References: <8e04b5821001120500y63b47edamdf646fb947f5db02@mail.gmail.com> Message-ID: <78155f4c-deb2-4d0f-b24c-949b724a2c0d@a32g2000yqm.googlegroups.com> Hi Ciprian, Take a closer look at gen_server:cast() which is the asynchronous "call" to a gen_server. /s On Jan 12, 7:00?am, "Ciprian Dorin, Craciun" wrote: > ? ? Hello all! > > ? ? I have the following simple use-case, and I'm not sure how to > efficiently implement it: I have some processes that need to send > updates to some statistics engine, but I don't want to wait (or > receive) the reply. (By processes I mean gen_server implementations, > and by update I mean `gen_server:call` like messages) Thus I have the > following options: > > ? ? a) send the message just like `gen_server:call` would have done, > and then be prepared to ignore the reply; drawbacks: > ? ? ? * I would have to hard-code the gen_server call protocol, thus > maybe (highly improbable) breaking the backward / forward portability; > ? ? ? * I have to ignore all the replies, which increases the source > code and might fill the message queue; > > ? ? b) spawn a process in the background that shall send the request > (and wait for the reply); drawbacks: > ? ? ? * it wight overload the virtual machine with too many processes; > > ? ? c) implement a `pool` like system that allows me to set the number > of workers, and then enqueue the requests in a round-robin fashion to > the workers; drawbacks: > ? ? ? * if there are too many requests they are going to pile up in > the queue (actual instance of the `queue` module); > ? ? ?advantages: > ? ? ? ?* as the requests are "on best effort" it allows the virtual > machine to carry on with the important work, and only a portion of the > time (proportional with the number of workers) to be allocated to > these requests; > > ? ? d) use the existing `pool` module, but which is designed for > distributed Erlang nodes; > > ? ? Also the same problem (which leads only to solutions b and c), > would be asynchronous function calls: I have a function, which takes > some time to compute something, and I don't want to wait for it to > finish, and also it's not that important so I don't want to dedicate > an entire process to it. > > ? ? Any ideas? Any already existing solutions? > > ? ? Thanks, > ? ? Ciprian. > > ________________________________________________________________ > erlang-questions mailing list. Seehttp://www.erlang.org/faq.html > erlang-questions (at) erlang.org From ciprian.craciun@REDACTED Tue Jan 12 14:37:36 2010 From: ciprian.craciun@REDACTED (Ciprian Dorin, Craciun) Date: Tue, 12 Jan 2010 15:37:36 +0200 Subject: [erlang-questions] Re: Local node worker process pool In-Reply-To: <78155f4c-deb2-4d0f-b24c-949b724a2c0d@a32g2000yqm.googlegroups.com> References: <8e04b5821001120500y63b47edamdf646fb947f5db02@mail.gmail.com> <78155f4c-deb2-4d0f-b24c-949b724a2c0d@a32g2000yqm.googlegroups.com> Message-ID: <8e04b5821001120537ka68e3e6gf67c7b26b2fb417e@mail.gmail.com> On Tue, Jan 12, 2010 at 3:28 PM, Steve Davis wrote: > Hi Ciprian, > > Take a closer look at gen_server:cast() which is the asynchronous > "call" to a gen_server. Indeed the `gen_server:cast` is one such a solution, but this means that the module you are using was designed to use cast and not call for such updates. (Also it doesn't solve the other (more generic) problem (to which my initial request was only a particularization), that is asynchronous call to a time-consuming function.) And an even more complicated scenario: I want reliable asynchronous call to a gen_server, that is I want to be able to use `gen_server:call(Server,Request,Timeout)` and receive back either the reply or the timeout answer. Of course this could be achieved by using a plain send (thus hard-coding the gen_server protocol), and then set a timer to callback my gen_server in case of timeout, and in the mean-time if I receive the response I should destroy the timer... But you see the complications, and I wouldn't like to implement them over and over again, thus I thought that a simple "local worker process pool" would solve this and other similar problems. Ciprian. P.S.: In the end I'll think I'll just make two interfaces for my statistics collection server: one based on `call`, and the other based on `cast`.... From caio.ariede@REDACTED Tue Jan 12 15:30:00 2010 From: caio.ariede@REDACTED (caio ariede) Date: Tue, 12 Jan 2010 12:30:00 -0200 Subject: [erlang-questions] Line number in errors: badmatch, case clause, badarith In-Reply-To: <512414.36882.qm@web111407.mail.gq1.yahoo.com> References: <512414.36882.qm@web111407.mail.gq1.yahoo.com> Message-ID: <6a9ba5691001120630p4d6691a5t3533483ec3d0ca61@mail.gmail.com> It works with this type of error too? > test:foo(). ** exception error: no function clause matching test:bar(1) ? 1 -module(test). ? 2 -compile(export_all). ? 3 ? 4 foo() -> ? 5???? bar(1). ? 6 ? 7 bar(0) -> 0. There is a way to get what line (5) the error occurred? Caio Ariede http://caioariede.com/ On Tue, Jan 12, 2010 at 10:11 AM, Thomas Lindgren wrote: > > > > > ----- Original Message ---- > > From: Max Lapshin > > To: Erlang-Questions Questions > > Sent: Tue, January 12, 2010 8:16:42 AM > > Subject: [erlang-questions] Line number in errors: badmatch, case clause, badarith > > > > Is it hard to change format of runtime errors to include line number, > > where error appeared. > > I understand, that it is impossible to understand, on which line > > function arguments hasn't matched, > > but it is clearly determined, on which line badmatch or badarith has happened. > > > > Are there hidden problems with such error information? > > > I think the compiler should add such info to exceptions, but it hasn't happened yet. In the meantime, you could try this: git://github.com/thomasl/smart_exceptions.git > > (The "devel" version seems to work fairly well, but no promises.) > > Best, > Thomas > > PS. Given that OTP has taken the fantastic step of using github, maybe I ought to submit that patch myself? > > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From james.hague@REDACTED Tue Jan 12 15:44:39 2010 From: james.hague@REDACTED (James Hague) Date: Tue, 12 Jan 2010 08:44:39 -0600 Subject: [erlang-questions] Benchmarks In-Reply-To: <4B4BE5DA.6010409@eonblast.com> References: <4B4BD8F8.20401@eonblast.com> <4B4BE5DA.6010409@eonblast.com> Message-ID: >> they are irrelevant as none of those things are what Erlang is designed to >> do REALLY WELL. > > Certainly that's the expected defense. Could you spell that out > specifically? There isn't an easy answer to this, but I'll try. The Shootout benchmarks are mostly about doing heavy, straightforward data manipulation. The kind of thing that's a best case for C: static memory allocation, fixed data sizes. In Erlang you pay the price for dynamic typing, garbage collection, data structures full of pointers instead of simple structs, and floating point values boxed on the heap. Where Erlang--and indeed any functional language--shines is when things get messy. When you're building and rebuilding data structures on the fly, when there are lots of complex decisions, when you can often go for a symbolic solution instead of just plowing through blocks of bytes. Often I've found I can implement optimizations that would be too painful in C. And truthfully, C is still faster, usually by a lot, but it doesn't matter. The Erlang code is fast enough and more reliable. You might like this: http://www.dadgum.com/james/performance.html James From hd2010@REDACTED Tue Jan 12 15:46:41 2010 From: hd2010@REDACTED (Henning Diedrich) Date: Tue, 12 Jan 2010 15:46:41 +0100 Subject: [erlang-questions] Benchmarks In-Reply-To: <4B4C5C24.4070609@erlang-consulting.com> References: <4B4BD8F8.20401@eonblast.com> <179FD608-4283-483A-9A67-1143D18DC2F9@didenko.com> <4B4C5C24.4070609@erlang-consulting.com> Message-ID: <4B4C8B51.9000503@eonblast.com> Thanks a lot for elaborating -- ! I am still looking for a briefer expression of the posted answers. Which can't replace the understanding of the right application domain as you are pointing out, but may simply serve different purpose. Maybe there is a link somewhere I don't find and you can point me to it. Maybe not and you could help correct and complete the following? It is guessed and interpolated, trying to describe what I am looking for. And it needs not be exact, it's a matter of magnitudes - and brevity and simplicity of talking points in business situations. Erlang Java C++ C PHP Ruby Python Stackless Haskell Go FORTRAN Max processes/ Threads on an average* machine 100,000 10,000 Time to create a process/thread in us ~10 ~100 Footprint of process/thread in KB 1 8 Expressiveness in LOC per LOC in C 4 1 Performance in Ring Passing Benchmark (1/sec) FLOP/s with built in float format Best known uptime nines of production products 9 Biggest known commercial systems in LOC n*10^7 Biggest known commercial systems in team members n*10^2 Killable by loose pointers no Killable by memory access dead locks no Arguable tendency to run at first compile yo lo Transparent use of multicore architecture yes no no no Built in arbitrary precision math yes ? Easy to use built in string handling no + ...! *whatever that is, obviously only important for comparison of magnitudes and so eventually mostly cancelled out, and let's even use a multicore here playing to the Erlang VM's strengths, where that can make a difference ... ... and clearly designate the weaker sides, too, if you will. Sure, to answer the question for fitness of purpose must rely on clarifying what the purpose is, but benchmarks may still govern what get's on the short list in the first place. Maybe particularily Erlang's strength's defy being measured in numbers? I can't imagine that AT ALL. All the parallel stuff plays into its hands. If it's number crunching that makes Erlang look bad, then the more suitable benchmark tests are of interest. To get out of defensive mode vs. other languages, the matter of the fact is that I'd be on the lookout for something as brief as, and projecting as much science as, a factor or percentile. I am saying projecting science. But of course, not made up, either. Shifting the buts and ifs to the part of the detractors then, preferrably. Who might then go ahead, if they prefer, to point out how the test was skewed, allegedly in favor of Erlang. Someone will always rightly have to explain something. There are findings along the line of "1/4 of code compared to C", even if (or especially if!) not arrived at by a simple formula, but by a hands on experiment like Richard Jones (, Esq.) "Rewriting Playdar: C++ to Erlang, massive savings" http://www.metabrew.com/article/rewriting-playdar-c-to-erlang-massive-savings Certainly any "fact", if benchmark result or anecdotical wisdom, will be debatable. But are there more like http://pseudogreen.org/blog/erlang_vs_stackless_vs_multitask.html http://www.joeandmotorboat.com/2009/01/03/nginx-vs-yaws-vs-mochiweb-web-server-performance-deathmatch-part-2/ http://www.sics.se/~joe/apachevsyaws.html and are the individual, published answers to Joe Armstrong's ring benchmark tasks coalesking into a clear picture? What is Erlang's sure fire, small talk, chocolate benchmark? From the latter link you could come away saying that an Erlang server could do 20 times more sessions than Apache. Did this hold up? I thought it was discussed heatedly but is that 20x factor regarded as valid statement in the Erlang community today? Are there current benchmarks along the lines of "Performance Measurements of Threads in Java and Processes in Erlang" http://www.sics.se/~joe/ericsson/du98024.html which latter would allow to state that Erlang can create processes around a hundred times faster than Java creates new threads and can use ten times more (only??) of them etc. The notion that for an actor model language, a comparison of processes and objects might make more sense than processes and threads sometimes, is then part of the ifs and buts. And rightly so. But anyone listening to anyone evangelizing will add a grain of salt anyway. There are qualifications with every number out there. But what are the Erlang ones? I refrained from studying Armstrong's thesis and the Motorola study, so I am not aware what I may be missing there. Thanks, Henning Ulf Wiger wrote: From hd2010@REDACTED Tue Jan 12 16:03:32 2010 From: hd2010@REDACTED (Henning Diedrich) Date: Tue, 12 Jan 2010 16:03:32 +0100 Subject: [erlang-questions] Benchmarks In-Reply-To: References: <4B4BD8F8.20401@eonblast.com> <4B4BE5DA.6010409@eonblast.com> Message-ID: <4B4C8F44.9030704@eonblast.com> Still reading the link, getting the pun. In the mold you are convincingly outlining below, there could be a benchmark designed to reflect more realistic application of programming than a too-flat benchmark, one that lets Erlang shine without cheating on C in any way -- just being more realistic. I think everbody can understand the point that flat benchmarks may say next to nothing about real life. Yet, thanks for zeroing in on the question in depth there. Henning James Hague wrote: >>> they are irrelevant as none of those things are what Erlang is designed to >>> do REALLY WELL. >>> >> Certainly that's the expected defense. Could you spell that out >> specifically? >> > > There isn't an easy answer to this, but I'll try. > > The Shootout benchmarks are mostly about doing heavy, straightforward > data manipulation. The kind of thing that's a best case for C: static > memory allocation, fixed data sizes. In Erlang you pay the price for > dynamic typing, garbage collection, data structures full of pointers > instead of simple structs, and floating point values boxed on the > heap. > > Where Erlang--and indeed any functional language--shines is when > things get messy. When you're building and rebuilding data structures > on the fly, when there are lots of complex decisions, when you can > often go for a symbolic solution instead of just plowing through > blocks of bytes. Often I've found I can implement optimizations that > would be too painful in C. And truthfully, C is still faster, usually > by a lot, but it doesn't matter. The Erlang code is fast enough and > more reliable. > > You might like this: > http://www.dadgum.com/james/performance.html > > James > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > > From thomasl_erlang@REDACTED Tue Jan 12 16:16:59 2010 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 12 Jan 2010 07:16:59 -0800 (PST) Subject: [erlang-questions] Line number in errors: badmatch, case clause, badarith In-Reply-To: <6a9ba5691001120630p4d6691a5t3533483ec3d0ca61@mail.gmail.com> References: <512414.36882.qm@web111407.mail.gq1.yahoo.com> <6a9ba5691001120630p4d6691a5t3533483ec3d0ca61@mail.gmail.com> Message-ID: <393168.57740.qm@web111408.mail.gq1.yahoo.com> ----- Original Message ---- > From: caio ariede > To: Erlang-Questions Questions > Sent: Tue, January 12, 2010 3:30:00 PM > Subject: Re: [erlang-questions] Line number in errors: badmatch, case clause, badarith > > It works with this type of error too? > > > test:foo(). > ** exception error: no function clause matching test:bar(1) > > 1 -module(test). > 2 -compile(export_all). > 3 > 4 foo() -> > 5 bar(1). > 6 > 7 bar(0) -> 0. > > There is a way to get what line (5) the error occurred? Not quite, the parse transform rewrites bar/1 into something like this (the details may differ somewhat): bar(0) -> 0; bar(N) -> exit({function_clause, {?MODULE, ?LINE}, [N]}). So you can see where the error occurred and what the bad value was. The ?LINE used is that of the first clause of bar/1. The same is done for case, if, funs and wherever possible. For builtin functions (including +) you get the equivalent. The transform is not perfect, however. It only operates on Erlang source code, so some places are impossible to instrument. I guess if you use error/1 instead of exit/1, you will get a backtrace, but not line numbers for the calls in the stack. That would probably need some compiler support and a modification of how error/1 is implemented. Best, Thomas From essiene@REDACTED Tue Jan 12 17:27:38 2010 From: essiene@REDACTED (Essien Essien) Date: Tue, 12 Jan 2010 17:27:38 +0100 Subject: [erlang-questions] [ANN] efene programming language 0.1 released In-Reply-To: References: Message-ID: <88b82c91001120827m4f5d497cg7551a021ba1c684d@mail.gmail.com> Hi, On Tue, Jan 12, 2010 at 5:42 AM, Mariano Guerra wrote: > efene is a programming language that runs on the erlang virtual machine. > > the idea is to provide an alternative syntax to erlang that is most > suitable for people coming from languages like Java, C, C++, C#, > Javascript. > > the language is almost 100% compatible with erlang (and will be), the > compiler allows to translate an efene source file into a readable > erlang one. It also adds some syntactic sugar in some places to make > some tasks easier. > > to see how it looks you can go to the examples dir[0] > > more info at efene?s main site[1] and the efene?s github page[2] > > [0] http://github.com/marianoguerra/efene/tree/master/examples/ > [1] http://marianoguerra.com.ar/efene > [2] http://github.com/marianoguerra/efene/ > > http://efene.tumblr.com/post/329929156/efene-0-1-released I took a look at this and loved it immedietly. The main goal of source to source translation seems to have been met. I'm not too sure of some of the syntax like that for binary, I still think I prefer the native erlang syntax for binary... but that's just me. all in all... very nice! Do you have any other plans for the efene itself? Maybe some interesting features like optional typing syntax with efene functions which could translate to dialyser annotations in the erlang sources?... something like that? That would really make it compelling. Also, do you at any point want to do pure erlang vm bytecode generation? as opposed to erlang source code generation? Ohh... and the Go frontend driver is pretty nice... I see why the language has generated soo much hoolabaloo on da intarwebs! :) cheers, Essien From tony@REDACTED Tue Jan 12 17:53:51 2010 From: tony@REDACTED (Tony Arcieri) Date: Tue, 12 Jan 2010 09:53:51 -0700 Subject: [erlang-questions] [ANN] efene programming language 0.1 released In-Reply-To: References: Message-ID: On Mon, Jan 11, 2010 at 10:59 PM, Mariano Guerra < luismarianoguerra@REDACTED> wrote: > as I said above it's just an alternative syntax with some syntactic > sugar. I started it because when I started learning erlang some months > ago I found the syntax a little scary (I come from the languages I > named above) and as an excuse to learn more erlang and help people as > me I decided to start this project. > Okay, for some reason I guess I got the impression that you were going for something more than just the JavaScript syntax. So Efene is more like LFE, only with a JavaScript-like syntax? -- Tony Arcieri Medioh! A Kudelski Brand From essiene@REDACTED Tue Jan 12 19:09:45 2010 From: essiene@REDACTED (Essien Essien) Date: Tue, 12 Jan 2010 19:09:45 +0100 Subject: [erlang-questions] [ANN] efene programming language 0.1 released In-Reply-To: References: Message-ID: <88b82c91001121009x5ca1561fl8996e115784863c@mail.gmail.com> On Tue, Jan 12, 2010 at 5:53 PM, Tony Arcieri wrote: > On Mon, Jan 11, 2010 at 10:59 PM, Mariano Guerra < > luismarianoguerra@REDACTED> wrote: > >> as I said above it's just an alternative syntax with some syntactic >> sugar. I started it because when I started learning erlang some months >> ago I found the syntax a little scary (I come from the languages I >> named above) and as an excuse to learn more erlang and help people as >> me I decided to start this project. >> > > Okay, for some reason I guess I got the impression that you were going for > something more than just the JavaScript syntax. ?So Efene is more like LFE, > only with a JavaScript-like syntax? > Looking at the code, I'll say yes. cheers, Essien From luismarianoguerra@REDACTED Tue Jan 12 20:11:25 2010 From: luismarianoguerra@REDACTED (Mariano Guerra) Date: Tue, 12 Jan 2010 16:11:25 -0300 Subject: [erlang-questions] [ANN] efene programming language 0.1 released In-Reply-To: <88b82c91001120827m4f5d497cg7551a021ba1c684d@mail.gmail.com> References: <88b82c91001120827m4f5d497cg7551a021ba1c684d@mail.gmail.com> Message-ID: On Tue, Jan 12, 2010 at 1:27 PM, Essien Essien wrote: > Hi, > > On Tue, Jan 12, 2010 at 5:42 AM, Mariano Guerra > wrote: >> efene is a programming language that runs on the erlang virtual machine. >> >> the idea is to provide an alternative syntax to erlang that is most >> suitable for people coming from languages like Java, C, C++, C#, >> Javascript. >> >> the language is almost 100% compatible with erlang (and will be), the >> compiler allows to translate an efene source file into a readable >> erlang one. It also adds some syntactic sugar in some places to make >> some tasks easier. >> >> to see how it looks you can go to the examples dir[0] >> >> more info at efene?s main site[1] and the efene?s github page[2] >> >> [0] http://github.com/marianoguerra/efene/tree/master/examples/ >> [1] http://marianoguerra.com.ar/efene >> [2] http://github.com/marianoguerra/efene/ >> >> http://efene.tumblr.com/post/329929156/efene-0-1-released > > I took a look at this and loved it immedietly. The main goal of source > to source translation seems to have been met. I'm not too sure of some > of the syntax like that for binary, I still think I prefer the native > erlang syntax for binary... but that's just me. all in all... very > nice! at this moment the syntax can be changed so any recommendation is appreciated > Do you have any other plans for the efene itself? Maybe some > interesting features like optional typing syntax with efene functions > which could translate to dialyser annotations in the erlang > sources?... something like that? That would really make it compelling. that would be really nice, if you have some specific idea I will see if I implement it > Also, do you at any point want to do pure erlang vm bytecode > generation? as opposed to erlang source code generation? it already generates .beam files, the -t erl was just to show how translated the code but the default us -t beam :) > Ohh... and the Go frontend driver is pretty nice... I see why the > language has generated soo much hoolabaloo on da intarwebs! :) I wanted to generate a binary and I didn't wanted to fight with C strings :) From thomasl_erlang@REDACTED Tue Jan 12 20:29:20 2010 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 12 Jan 2010 11:29:20 -0800 (PST) Subject: Mochi media Message-ID: <270131.75802.qm@web111401.mail.gq1.yahoo.com> Congrats to Mochi Media! BEIJING?Chinese online game developer Shanda Games Ltd. agreed to acquire U.S. online game network Mochi Media in a deal valued at $80 million, furthering its global expansion ambitions. Under the deal, which the companies expect to announce Tuesday, San Francisco-based privately-held Mochi will receive $60 million in cash and $20 million in shares of Shanda Games, a Nasdaq-listed, Shanghai-based company known for creating some of China's most popular massive multiplayer online games. http://online.wsj.com/article/SB10001424052748704081704574653430020773954.html Best, Thomas From igouy2@REDACTED Tue Jan 12 20:57:42 2010 From: igouy2@REDACTED (Isaac Gouy) Date: Tue, 12 Jan 2010 11:57:42 -0800 (PST) Subject: [erlang-questions] Benchmarks Message-ID: <964636.26256.qm@web65605.mail.ac4.yahoo.com> On Tue, 12 Jan 2010, Henning Diedrich wrote: > As for motivation, I am asking for in-house selling if you will. Winning > people over to even accept Erlang to the list of valid options. You seem to be talking about either Erlang versus C. Shouldn't you be talking about either Erlang plus C versus C plus other infrastructure? On the same page as those benchmarks which "look somewhat bad" is a link to this - http://shootout.alioth.debian.org/flawed-benchmarks.php#scope > "Performance Measurements of Threads in Java and Processes in Erlang" Does Jarrod Roberson's comment about those other benchmarks "they are irrelevant as none of those things are what Erlang is designed to do REALLY WELL" apply to this too? *irrelevant as none of those things are what Java is designed to do REALLY WELL* Having said that, take note of - http://shootout.alioth.debian.org/u64/benchmark.php?test=threadring&lang=java&id=2 as well as http://shootout.alioth.debian.org/u64/benchmark.php?test=threadring From jarrod@REDACTED Tue Jan 12 22:08:28 2010 From: jarrod@REDACTED (Jarrod Roberson) Date: Tue, 12 Jan 2010 16:08:28 -0500 Subject: [erlang-questions] Benchmarks In-Reply-To: <964636.26256.qm@web65605.mail.ac4.yahoo.com> References: <964636.26256.qm@web65605.mail.ac4.yahoo.com> Message-ID: On Tue, Jan 12, 2010 at 2:57 PM, Isaac Gouy wrote: > On Tue, 12 Jan 2010, Henning Diedrich wrote: > > > "Performance Measurements of Threads in Java and Processes in Erlang" > > Does Jarrod Roberson's comment about those other benchmarks "they are > irrelevant as none of those things are what Erlang is designed to do REALLY > WELL" apply to this too? > > *irrelevant as none of those things are what Java is designed to do REALLY > WELL* > > Write some "benchmarks" that measure how long it takes to update a single line of code in a running system. Compare Erlang to C, Java and whatever else you want. I think the results "will look somewhat bad" when comparing C or Java to Erlang. Now do the same thing with distributed function calls across dozens of VM's and try multi-threading those benchmarks in C or Java or doall the other things that Erlang "does REALLY WELL". I am pretty confident that C and Java "will look somewhat bad" as well. I stand by my assertion that those benchmarks are not what Erlang was designed to do REALLY WELL. And like Python and Lua, Erlang is designed to do those things in C if needed very easily. Especially with the new NIF API. That said, I do make my living writing Java code, but I don't think it is appropriate for most of the things people try and do with it, Erlang is much better suited for SOA than Java by a long shot. From hd2010@REDACTED Tue Jan 12 22:48:42 2010 From: hd2010@REDACTED (Henning Diedrich) Date: Tue, 12 Jan 2010 22:48:42 +0100 Subject: [erlang-questions] Benchmarks In-Reply-To: <964636.26256.qm@web65605.mail.ac4.yahoo.com> References: <964636.26256.qm@web65605.mail.ac4.yahoo.com> Message-ID: <4B4CEE3A.40103@eonblast.com> Hi Isaac, I was asking about other performance metrics, with not specific domain prescribed but showing off Erlang's strenght in numbers. Yes, I saw the ring benchmark. Cheers, Henning Isaac Gouy wrote: > On Tue, 12 Jan 2010, Henning Diedrich wrote: > > >> As for motivation, I am asking for in-house selling if you will. Winning >> people over to even accept Erlang to the list of valid options. >> > > You seem to be talking about either Erlang versus C. > > Shouldn't you be talking about either Erlang plus C versus C plus other infrastructure? > > > On the same page as those benchmarks which "look somewhat bad" is a link to this - > > http://shootout.alioth.debian.org/flawed-benchmarks.php#scope > > > > >> "Performance Measurements of Threads in Java and Processes in Erlang" >> > > Does Jarrod Roberson's comment about those other benchmarks "they are irrelevant as none of those things are what Erlang is designed to do REALLY WELL" apply to this too? > > *irrelevant as none of those things are what Java is designed to do REALLY WELL* > > Having said that, take note of - > > http://shootout.alioth.debian.org/u64/benchmark.php?test=threadring&lang=java&id=2 > > as well as > > http://shootout.alioth.debian.org/u64/benchmark.php?test=threadring > > > > > > > > > > > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > > From ulf.wiger@REDACTED Tue Jan 12 22:54:29 2010 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Tue, 12 Jan 2010 22:54:29 +0100 Subject: [erlang-questions] Benchmarks In-Reply-To: <4B4CEE3A.40103@eonblast.com> References: <964636.26256.qm@web65605.mail.ac4.yahoo.com> <4B4CEE3A.40103@eonblast.com> Message-ID: <4B4CEF95.2020505@erlang-consulting.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Henning Diedrich wrote: > Hi Isaac, > > I was asking about other performance metrics, with not specific domain > prescribed but showing off Erlang's strenght in numbers. There were actually some very interesting performance comparisons in the Motorola study: http://www.slideshare.net/Arbow/comparing-cpp-and-erlang-for-motorola-telecoms-software BR, Ulf W -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAktM75QACgkQtqqFieqzed1S2gCfTEC20dgRxeKP+T74LWDviXNR LrsAn0g/KwcIyCoSUDrvnvgj9280NZUQ =+ynM -----END PGP SIGNATURE----- --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From vasilij.savin@REDACTED Tue Jan 12 23:41:43 2010 From: vasilij.savin@REDACTED (Vasilij Savin) Date: Wed, 13 Jan 2010 00:41:43 +0200 Subject: [erlang-questions] Re: Local node worker process pool In-Reply-To: <8e04b5821001120537ka68e3e6gf67c7b26b2fb417e@mail.gmail.com> References: <8e04b5821001120500y63b47edamdf646fb947f5db02@mail.gmail.com> <78155f4c-deb2-4d0f-b24c-949b724a2c0d@a32g2000yqm.googlegroups.com> <8e04b5821001120537ka68e3e6gf67c7b26b2fb417e@mail.gmail.com> Message-ID: Hey Ciprian, I would like to second gen_server:cast as solution for a) case. Regarding case of async server calls, I would go with solution b) initially, as it feels conceptually cleaner and more clear to me. However, forgive me, if I read you wrong, but it feels like you are falling into trap of "pre-mature optimisation". Are you sure it will generated unreasonably many processes, maybe tweaking some parameters (like sending updates more seldom) would solve the problem. There are no universal solutions, I would recommend trying the simple solution that works and then analyse if it satisfies your requirements. Regards, Vasilij Savin From steve.e.123@REDACTED Wed Jan 13 00:03:33 2010 From: steve.e.123@REDACTED (steve) Date: Tue, 12 Jan 2010 18:03:33 -0500 Subject: Takeover troubles Message-ID: <4cb4a7bf1001121503w2bbd122lf90ae93343a87743@mail.gmail.com> Hi Group, I have written a little test distributed app based on the Design Principles of three nodes (n1, n2, and n3). Failover and takeover are working fine except in the following test: n1 and n2 go down. n3 has control. n1 comes back up while n2 is down. When n1 comes back up with n2 down, n1 won't start and take over from n3. Instead I get this report on n1 (and my app on n3 is stopped, although is still loaded and configured): =SUPERVISOR REPORT==== 12-Jan-2010::17:48:32 === Supervisor: {local,dist_sup} Context: start_error Reason: {already_started,<2557.84.0>} Offender: [{pid,undefined}, {name,dist}, {mfa,{dist,start_link,[]}}, {restart_type,permanent}, {shutdown,10000}, {child_type,worker}] However, if I start n2 before I bring n1 up, n1 takes over as it should from n3. I'm on R13B02. My config file looks like this: [{kernel, [{sync_nodes_optional, [n1@REDACTED, n2@REDACTED, n3@REDACTED ]}, {sync_nodes_timeout, 10000}, {distributed, [{dist, [n1@REDACTED, {n2@REDACTED, n3@REDACTED}]}]}]}]. My app file: {application, dist, [{description, "dist test"}, {vsn, "1.0"}, {modules, [dist_app, dist_sup, dist]}, {registered, [dist_app, dist_sup, dist]}, {included_applications, []}, {applications, [kernel, stdlib, sasl]}, {mod, {dist_app,[]}}, {start_phases, [{go, []}]} ]}. TIA, Steve From igouy2@REDACTED Wed Jan 13 00:14:22 2010 From: igouy2@REDACTED (Isaac Gouy) Date: Tue, 12 Jan 2010 15:14:22 -0800 (PST) Subject: [erlang-questions] Benchmarks In-Reply-To: <4B4CEF95.2020505@erlang-consulting.com> Message-ID: <80011.64100.qm@web65604.mail.ac4.yahoo.com> --- On Tue, 1/12/10, Ulf Wiger wrote: -snip- > There were actually some very interesting performance > comparisons in the Motorola study I believe this paper (pdf) is about that study - "Evaluating High-Level Distributed Language Constructs" www.macs.hw.ac.uk/~trinder/papers/ICFP2007.pdf From igouy2@REDACTED Wed Jan 13 00:24:03 2010 From: igouy2@REDACTED (Isaac Gouy) Date: Tue, 12 Jan 2010 15:24:03 -0800 (PST) Subject: [erlang-questions] Benchmarks In-Reply-To: Message-ID: <209525.67663.qm@web65604.mail.ac4.yahoo.com> --- On Tue, 1/12/10, Jarrod Roberson wrote: -snip- > I stand by my assertion that those benchmarks are not what > Erlang was designed to do REALLY WELL. I didn't challenge your assertion. I merely suggested we can make similar assertions for other programming languages. Furthermore, not doing is obviously special pleading. From igouy2@REDACTED Wed Jan 13 00:29:48 2010 From: igouy2@REDACTED (Isaac Gouy) Date: Tue, 12 Jan 2010 15:29:48 -0800 (PST) Subject: [erlang-questions] Benchmarks In-Reply-To: <4B4CEE3A.40103@eonblast.com> Message-ID: <315450.77921.qm@web65613.mail.ac4.yahoo.com> --- On Tue, 1/12/10, Henning Diedrich wrote: > I was asking about other performance metrics, with not > specific domain prescribed but showing off Erlang's strenght in numbers. I don't understand what you mean by - "with not specific domain prescribed but showing off Erlang's strength in numbers" Look at the Motorola paper. From steven.charles.davis@REDACTED Wed Jan 13 02:15:29 2010 From: steven.charles.davis@REDACTED (Steve Davis) Date: Tue, 12 Jan 2010 17:15:29 -0800 (PST) Subject: Benchmarks In-Reply-To: <4B4BD8F8.20401@eonblast.com> References: <4B4BD8F8.20401@eonblast.com> Message-ID: <1d359a85-77cb-41ad-a060-0e5413b01eff@p24g2000yqm.googlegroups.com> I'd like to offer another benchmark: Net income in dollars generated by the application / hours of development and maintenance time. /s From hd2010@REDACTED Wed Jan 13 02:48:40 2010 From: hd2010@REDACTED (Henning Diedrich) Date: Wed, 13 Jan 2010 02:48:40 +0100 Subject: [erlang-questions] Re: Benchmarks In-Reply-To: <1d359a85-77cb-41ad-a060-0e5413b01eff@p24g2000yqm.googlegroups.com> References: <4B4BD8F8.20401@eonblast.com> <1d359a85-77cb-41ad-a060-0e5413b01eff@p24g2000yqm.googlegroups.com> Message-ID: <4B4D2678.4080009@eonblast.com> Accepted on account of today's news. What's the number then, Bob? Henning Steve Davis wrote: > I'd like to offer another benchmark: > > Net income in dollars generated by the application / hours of > development and maintenance time. > > /s > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > > From igouy2@REDACTED Wed Jan 13 02:50:21 2010 From: igouy2@REDACTED (Isaac Gouy) Date: Tue, 12 Jan 2010 17:50:21 -0800 (PST) Subject: [erlang-questions] Re: Benchmarks In-Reply-To: <1d359a85-77cb-41ad-a060-0e5413b01eff@p24g2000yqm.googlegroups.com> Message-ID: <607483.96987.qm@web65607.mail.ac4.yahoo.com> And the audited dollar values and development hours are? --- On Tue, 1/12/10, Steve Davis wrote: > From: Steve Davis > Subject: [erlang-questions] Re: Benchmarks > To: erlang-questions@REDACTED > Date: Tuesday, January 12, 2010, 5:15 PM > I'd like to offer another benchmark: > > Net income in dollars generated by the application / hours > of > development and maintenance time. > > /s > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From hd2010@REDACTED Wed Jan 13 03:29:43 2010 From: hd2010@REDACTED (Henning Diedrich) Date: Wed, 13 Jan 2010 03:29:43 +0100 Subject: Yaws Message-ID: <4B4D3017.7020602@eonblast.com> Hi Thomas, sounds good -- for an online backup service I would have expected mochi web to come into play. What made you opt for Yaws? Regards, Henning > As a testimonial of sorts, we're using an extended Yaws and Erlang to handle substantial simultaneous upload traffic for an online backup service with quite nice results so far, performancewise. I won't go into details, but I think our current setup will be limited by the available network or disk bandwidth rather than CPU, memory, or any software bottlenecks. So switching to nginx or something like that would just be painful without providing much improved performance. > > (And as a bonus, because the servers just chug along ops love it :-) > > Best, > Thomas > > > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > > From bob@REDACTED Wed Jan 13 04:08:11 2010 From: bob@REDACTED (Bob Ippolito) Date: Wed, 13 Jan 2010 11:08:11 +0800 Subject: [erlang-questions] Re: Benchmarks In-Reply-To: <4B4D2678.4080009@eonblast.com> References: <4B4BD8F8.20401@eonblast.com> <1d359a85-77cb-41ad-a060-0e5413b01eff@p24g2000yqm.googlegroups.com> <4B4D2678.4080009@eonblast.com> Message-ID: <6a36e7291001121908y69d32b00h506a551a6b4034b9@mail.gmail.com> It's much lower if you have to spend hours justifying why Erlang is a better choice than X. On Wed, Jan 13, 2010 at 9:48 AM, Henning Diedrich wrote: > Accepted on account of today's news. > > What's the number then, Bob? > > Henning > > Steve Davis wrote: >> >> I'd like to offer another benchmark: >> >> Net income in dollars generated by the application / hours of >> development and maintenance time. >> >> /s >> >> ________________________________________________________________ >> 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 tony@REDACTED Wed Jan 13 04:23:31 2010 From: tony@REDACTED (Tony Arcieri) Date: Tue, 12 Jan 2010 20:23:31 -0700 Subject: [erlang-questions] Benchmarks In-Reply-To: <4B4C5C24.4070609@erlang-consulting.com> References: <4B4BD8F8.20401@eonblast.com> <179FD608-4283-483A-9A67-1143D18DC2F9@didenko.com> <4B4C5C24.4070609@erlang-consulting.com> Message-ID: On Tue, Jan 12, 2010 at 4:25 AM, Ulf Wiger wrote: > Go lacks memory protection between > its Goroutines (they share memory and can make use of global > variables with destructive update semantics) In addition to that, communication between Goroutines is synchronous and lacks selective receive and pattern matching. -- Tony Arcieri Medioh! A Kudelski Brand From vinoski@REDACTED Wed Jan 13 04:25:49 2010 From: vinoski@REDACTED (Steve Vinoski) Date: Tue, 12 Jan 2010 22:25:49 -0500 Subject: [erlang-questions] Yaws In-Reply-To: <4B4D3017.7020602@eonblast.com> References: <4B4D3017.7020602@eonblast.com> Message-ID: <65b2728e1001121925k359f06fdg20a42dc7eac73d3b@mail.gmail.com> I'd like to read Thomas's answer to your question, but I'd also like to understand why you're even asking it -- why do you feel mochiweb would be better than yaws for this application? --steve On Tue, Jan 12, 2010 at 9:29 PM, Henning Diedrich wrote: > Hi Thomas, > > sounds good -- for an online backup service I would have expected mochi web > to come into play. What made you opt for Yaws? > > Regards, > Henning > >> As a testimonial of sorts, we're using an extended Yaws and Erlang to >> handle substantial simultaneous upload traffic for an online backup service >> with quite nice results so far, performancewise. I won't go into details, >> but I think our current setup will be limited by the available network or >> disk bandwidth rather than CPU, memory, or any software bottlenecks. So >> switching to nginx or something like that would just be painful without >> providing much improved performance. >> >> (And as a bonus, because the servers just chug along ops love it :-) >> >> Best, >> Thomas >> >> >> >> >> ________________________________________________________________ >> 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 hd2010@REDACTED Wed Jan 13 04:29:50 2010 From: hd2010@REDACTED (Henning Diedrich) Date: Wed, 13 Jan 2010 04:29:50 +0100 Subject: [erlang-questions] Re: Benchmarks In-Reply-To: <6a36e7291001121908y69d32b00h506a551a6b4034b9@mail.gmail.com> References: <4B4BD8F8.20401@eonblast.com> <1d359a85-77cb-41ad-a060-0e5413b01eff@p24g2000yqm.googlegroups.com> <4B4D2678.4080009@eonblast.com> <6a36e7291001121908y69d32b00h506a551a6b4034b9@mail.gmail.com> Message-ID: <4B4D3E2E.50901@eonblast.com> Your success delivered an even more convincing argument than any benchmark could be. Bob ! [ Thanks | Congratulations ] Where you just punning this thread or did you really have to do the justifying? Even as CTO & co-founder? Henning Bob Ippolito wrote: > It's much lower if you have to spend hours justifying why Erlang is a > better choice than X. > > On Wed, Jan 13, 2010 at 9:48 AM, Henning Diedrich wrote: > >> Accepted on account of today's news. >> >> What's the number then, Bob? >> >> Henning >> >> Steve Davis wrote: >> >>> I'd like to offer another benchmark: >>> >>> Net income in dollars generated by the application / hours of >>> development and maintenance time. >>> >>> /s >>> >>> ________________________________________________________________ >>> 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 bob@REDACTED Wed Jan 13 04:39:33 2010 From: bob@REDACTED (Bob Ippolito) Date: Wed, 13 Jan 2010 11:39:33 +0800 Subject: [erlang-questions] Re: Benchmarks In-Reply-To: <4B4D3E2E.50901@eonblast.com> References: <4B4BD8F8.20401@eonblast.com> <1d359a85-77cb-41ad-a060-0e5413b01eff@p24g2000yqm.googlegroups.com> <4B4D2678.4080009@eonblast.com> <6a36e7291001121908y69d32b00h506a551a6b4034b9@mail.gmail.com> <4B4D3E2E.50901@eonblast.com> Message-ID: <6a36e7291001121939y173eab8dpcc1c8598f32e5bd4@mail.gmail.com> What I'm saying is that the more time you have to battle uphill to use Erlang the bigger the denominator is going to be in that equation. I didn't have that problem. At the time I chose Erlang there were only two of us, I didn't have to justify it to anyone but myself. Obviously no regrets here from me or the team :) On Wed, Jan 13, 2010 at 11:29 AM, Henning Diedrich wrote: > Your success delivered an even more convincing argument than any benchmark > could be. > > Bob ! [ Thanks | Congratulations ] > > Where you just punning this thread or did you really have to do the > justifying? Even as CTO & co-founder? > > Henning > > > Bob Ippolito wrote: >> >> It's much lower if you have to spend hours justifying why Erlang is a >> better choice than X. >> >> On Wed, Jan 13, 2010 at 9:48 AM, Henning Diedrich >> wrote: >> >>> >>> Accepted on account of today's news. >>> >>> What's the number then, Bob? >>> >>> Henning >>> >>> Steve Davis wrote: >>> >>>> >>>> I'd like to offer another benchmark: >>>> >>>> Net income in dollars generated by the application / hours of >>>> development and maintenance time. >>>> >>>> /s >>>> >>>> ________________________________________________________________ >>>> 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 hd2010@REDACTED Wed Jan 13 04:39:50 2010 From: hd2010@REDACTED (Henning Diedrich) Date: Wed, 13 Jan 2010 04:39:50 +0100 Subject: [erlang-questions] Yaws In-Reply-To: <65b2728e1001121925k359f06fdg20a42dc7eac73d3b@mail.gmail.com> References: <4B4D3017.7020602@eonblast.com> <65b2728e1001121925k359f06fdg20a42dc7eac73d3b@mail.gmail.com> Message-ID: <4B4D4086.80701@eonblast.com> Steve Vinoski wrote: > I'd like to read Thomas's answer to your question, but I'd also like > to understand why you're even asking it -- why do you feel mochiweb > would be better than yaws for this application? Sure: because my take had been that mochiweb was clearly a lower level approach, presumably more direct, offering more control, with less overhead? That may be wrong, I test drove both only briefly and did not plumb their depths. But I had made up my mind to start out using mochiweb for our stuff for said reasons. And was wondering what was behind the decision at Thomas' company. Cheers, Henning From bob@REDACTED Wed Jan 13 04:43:36 2010 From: bob@REDACTED (Bob Ippolito) Date: Wed, 13 Jan 2010 11:43:36 +0800 Subject: [erlang-questions] Yaws In-Reply-To: <65b2728e1001121925k359f06fdg20a42dc7eac73d3b@mail.gmail.com> References: <4B4D3017.7020602@eonblast.com> <65b2728e1001121925k359f06fdg20a42dc7eac73d3b@mail.gmail.com> Message-ID: <6a36e7291001121943o1c7fa3f3pec70442f68de32a8@mail.gmail.com> I don't think mochiweb and yaws are different enough for it to matter much in terms of performance, but in this case Yaws was probably a better fit because they support more of the high level features that you would use in an online backup service. Yaws certainly has more field testing for being directly on port 80, where we run all of our mochiweb instances behind a proxy or load balancer. On Wed, Jan 13, 2010 at 11:25 AM, Steve Vinoski wrote: > I'd like to read Thomas's answer to your question, but I'd also like to > understand why you're even asking it -- why do you feel mochiweb would be > better than yaws for this application? > > --steve > > On Tue, Jan 12, 2010 at 9:29 PM, Henning Diedrich wrote: > >> Hi Thomas, >> >> sounds good -- for an online backup service I would have expected mochi web >> to come into play. What made you opt for Yaws? >> >> Regards, >> Henning >> >>> As a testimonial of sorts, we're using an extended Yaws and Erlang to >>> handle substantial simultaneous upload traffic for an online backup service >>> with quite nice results so far, performancewise. I won't go into details, >>> but I think our current setup will be limited by the available network or >>> disk bandwidth rather than CPU, memory, or any software bottlenecks. So >>> switching to nginx or something like that would just be painful without >>> providing much improved performance. >>> >>> (And as a bonus, because the servers just chug along ops love it :-) >>> >>> Best, >>> Thomas >>> >>> >>> >>> >>> ________________________________________________________________ >>> 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 bob@REDACTED Wed Jan 13 04:57:26 2010 From: bob@REDACTED (Bob Ippolito) Date: Wed, 13 Jan 2010 11:57:26 +0800 Subject: [erlang-questions] Mochi media In-Reply-To: <270131.75802.qm@web111401.mail.gq1.yahoo.com> References: <270131.75802.qm@web111401.mail.gq1.yahoo.com> Message-ID: <6a36e7291001121957t7fe02b4fk3a9fdcd6563e528@mail.gmail.com> Thank you everyone! Special thanks to the Erlang OTP team past and present for building such a solid and incredible product and the open source community for extending Erlang far beyond its telecom roots. I hope Mochi's story helps Erlang reach an even wider group of talented programmers and I owe all of you many beers, redeemable next time I see you :) Also, if any of you are interested in helping Mochi dominate we are currently hiring (in San Francisco)! http://www.mochimedia.com/jobs.html On Wed, Jan 13, 2010 at 3:29 AM, Thomas Lindgren wrote: > Congrats to Mochi Media! > > > BEIJING?Chinese online game developer Shanda Games Ltd. agreed to > acquire U.S. online game network Mochi Media in a deal valued at $80 > million, furthering its global expansion ambitions. > Under the > deal, which the companies expect to announce Tuesday, San > Francisco-based privately-held Mochi will receive $60 million in cash > and $20 million in shares of Shanda Games, a Nasdaq-listed, > Shanghai-based company known for creating some of China's most popular > massive multiplayer online games. > http://online.wsj.com/article/SB10001424052748704081704574653430020773954.html > > Best, > Thomas > > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From vinoski@REDACTED Wed Jan 13 06:15:06 2010 From: vinoski@REDACTED (Steve Vinoski) Date: Wed, 13 Jan 2010 00:15:06 -0500 Subject: [erlang-questions] Yaws In-Reply-To: <4B4D4086.80701@eonblast.com> References: <4B4D3017.7020602@eonblast.com> <65b2728e1001121925k359f06fdg20a42dc7eac73d3b@mail.gmail.com> <4B4D4086.80701@eonblast.com> Message-ID: <65b2728e1001122115m743ef069r5ecbe0ae891f736a@mail.gmail.com> On Tue, Jan 12, 2010 at 10:39 PM, Henning Diedrich wrote: > Steve Vinoski wrote: > >> I'd like to read Thomas's answer to your question, but I'd also like to >> understand why you're even asking it -- why do you feel mochiweb would be >> better than yaws for this application? >> > Sure: because my take had been that mochiweb was clearly a lower level > approach, presumably more direct, offering more control, with less overhead? > That may be wrong, I test drove both only briefly and did not plumb their > depths. I'm not sure that's a fair characterization. As Bob said in his response, Yaws provides some higher-level services that may have been a good fit for Thomas's use case, but that doesn't necessarily mean it adds needless overhead to the base case or that it lacks direct control. > But I had made up my mind to start out using mochiweb for our stuff for > said reasons. And was wondering what was behind the decision at Thomas' > company. > At the end of the day, I'm very glad to see anyone using either mochiweb or yaws (or any other Erlang web server for that matter), because it ultimately enhances the Erlang community and development ecosystem. But as someone who works on yaws and also uses it for my own applications (which btw are very low-level as far as web applications go), I'm always interested in learning not only what people are doing with it but also why others choose not to use it. thanks, --steve From hd2010@REDACTED Wed Jan 13 06:49:01 2010 From: hd2010@REDACTED (Henning Diedrich) Date: Wed, 13 Jan 2010 06:49:01 +0100 Subject: [erlang-questions] Yaws In-Reply-To: <65b2728e1001122115m743ef069r5ecbe0ae891f736a@mail.gmail.com> References: <4B4D3017.7020602@eonblast.com> <65b2728e1001121925k359f06fdg20a42dc7eac73d3b@mail.gmail.com> <4B4D4086.80701@eonblast.com> <65b2728e1001122115m743ef069r5ecbe0ae891f736a@mail.gmail.com> Message-ID: <4B4D5ECD.4010003@eonblast.com> Steve, Yaws is awesome to me, in the true sense of the word and if that is of comfort - we are absolutely going to use Yaws to serve web pages and intranet stuff. That kind of went without saying. Already doing so actually by ways of the Scalaris control panel. Cheers! Henning Steve Vinoski wrote: > > > On Tue, Jan 12, 2010 at 10:39 PM, Henning Diedrich > > wrote: > > Steve Vinoski wrote: > > I'd like to read Thomas's answer to your question, but I'd > also like to understand why you're even asking it -- why do > you feel mochiweb would be better than yaws for this application? > > Sure: because my take had been that mochiweb was clearly a lower > level approach, presumably more direct, offering more control, > with less overhead? That may be wrong, I test drove both only > briefly and did not plumb their depths. > > > I'm not sure that's a fair characterization. As Bob said in his > response, Yaws provides some higher-level services that may have been > a good fit for Thomas's use case, but that doesn't necessarily mean it > adds needless overhead to the base case or that it lacks direct control. > > > But I had made up my mind to start out using mochiweb for our > stuff for said reasons. And was wondering what was behind the > decision at Thomas' company. > > > At the end of the day, I'm very glad to see anyone using either > mochiweb or yaws (or any other Erlang web server for that matter), > because it ultimately enhances the Erlang community and development > ecosystem. But as someone who works on yaws and also uses it for my > own applications (which btw are very low-level as far as web > applications go), I'm always interested in learning not only what > people are doing with it but also why others choose not to use it. > > thanks, > --steve From sam@REDACTED Wed Jan 13 07:25:29 2010 From: sam@REDACTED (Sam Bobroff) Date: Wed, 13 Jan 2010 17:25:29 +1100 Subject: Reading the first or last N records from a secondary index in mnesia Message-ID: <4B4D6759.9000709@m5net.com> Hi everyone, I've been trying, unsuccessfully, to work out how to read either the first, (or last) few keys from an mnesia table's secondary index in a reasonably efficient manner. (If I want to read records from a primary index I can make the table ordered_set and use first(), last() and next() or prev().) All I can come up with is something like this: Q = qlc:cursor( qlc:sort( qlc:q( [ R || R <- mnesia:table(blah) ] ), [{order, fun compare_secondary_index/2}] ) ) qlc:next_answers(QC, N). But it seems to cause the entire table to be read and sorted before any records are returned. It doesn't seem to use the secondary index at all. Have I missed some obvious way to do this? Is it possible to iterate over the secondary index? Cheers, Sam. -- Sam Bobroff | sam@REDACTED | M5 Networks Why does my email have those funny headers? Because I use PGP to sign my email (and you should too!): that's how you know it's really from me. See: http://en.wikipedia.org/wiki/Pretty_Good_Privacy -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 258 bytes Desc: OpenPGP digital signature URL: From leap@REDACTED Wed Jan 13 08:08:03 2010 From: leap@REDACTED (Michael Turner) Date: Wed, 13 Jan 2010 07:08:03 +0000 Subject: No subject In-Reply-To: <1d359a85-77cb-41ad-a060-0e5413b01eff@p24g2000yqm.googlegroups.com> Message-ID: On 1/13/2010, "Steve Davis" wrote: >I'd like to offer another benchmark: > >Net income in dollars generated by the application / hours of >development and maintenance time. I'd like to offer a further refinement of that benchmark: leave out "maintenance time" in the denominator. First, because, ultimately, it's unknowable -- especially if you're successful. Measuring it requires time travel into the indefinite future. Second, you should discount highly speculative future hours anyway, since if you're successful, they won't matter as much as you think. If you're aiming for a market window, the cost of missing (usually, total failure) is generally tiny compared to software lifecycle costs down the road. A particularly stomach-turning real-life example: once upon a time (the 1980s), there was this relational database company that routinely shipped database software that didn't work very well. The company nevertheless shamelessly bought lots of advertising claiming all kinds of features that its competitors said they were still working on getting right. Of course, that company should have died. And gone to hell. To burn forever. As a textbook case of How You Shouldn't Develop Software. Recently, however, that same database company bought Sun Microsystems. Perhaps the main strike against Erlang in the niches where it (theoretically) shines is that not many people know it. You might struggle uphill against a significant learning curve for your new hires, if your product hits the market window and achieves orbit. I'm not sure this is a huge problem at the moment, though. For one thing, there are probably 10 times as many people who have learned some Erlang as who are actually making money hacking in Erlang, and many in the first category might jump at any chance to join the second one. For another, Erlang seems readily interfaceable with code written in other languages, so if a function is ancillary rather than core, you could hire programmers to write the function in another, more popular, language. In the meantime, many sales objections are readily overcome by simply pointing to successful interfaces. -michael turner From kenji.rikitake@REDACTED Wed Jan 13 10:06:46 2010 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Wed, 13 Jan 2010 18:06:46 +0900 Subject: [erlang-questions] Benchmarks In-Reply-To: <80011.64100.qm@web65604.mail.ac4.yahoo.com> References: <4B4CEF95.2020505@erlang-consulting.com> <80011.64100.qm@web65604.mail.ac4.yahoo.com> Message-ID: <20100113090646.GA94329@k2r.org> ACM reference for the paper: Nystrom, J., Trinder, P., and King, D. 2007. Evaluating high-level distributed language constructs. SIGPLAN Not. 42, 9 (Oct. 2007), 203-212. DOI= http://doi.acm.org/10.1145/1291220.1291182 FYI Kenji Rikitake In the message <80011.64100.qm@REDACTED> dated Tue, Jan 12, 2010 at 03:13:58PM -0800, Isaac Gouy writes: > --- On Tue, 1/12/10, Ulf Wiger wrote: > -snip- > > There were actually some very interesting performance > > comparisons in the Motorola study > > I believe this paper (pdf) is about that study - > > "Evaluating High-Level Distributed Language Constructs" > > www.macs.hw.ac.uk/~trinder/papers/ICFP2007.pdf From anton.krasovsky@REDACTED Wed Jan 13 11:15:01 2010 From: anton.krasovsky@REDACTED (Anton Krasovsky) Date: Wed, 13 Jan 2010 10:15:01 +0000 Subject: [erlang-questions] Mochi media In-Reply-To: <270131.75802.qm@web111401.mail.gq1.yahoo.com> References: <270131.75802.qm@web111401.mail.gq1.yahoo.com> Message-ID: <46167e6a1001130215v31955f0bh816fd1fe7ef69248@mail.gmail.com> I'd like to join the congratulation as well, especially since it was Bob's "Exploring Erlang @ C4" talk that got me interested in Erlang in the first place! Anton On Tue, Jan 12, 2010 at 7:29 PM, Thomas Lindgren wrote: > Congrats to Mochi Media! > > > BEIJING?Chinese online game developer Shanda Games Ltd. agreed to > acquire U.S. online game network Mochi Media in a deal valued at $80 > million, furthering its global expansion ambitions. > Under the > deal, which the companies expect to announce Tuesday, San > Francisco-based privately-held Mochi will receive $60 million in cash > and $20 million in shares of Shanda Games, a Nasdaq-listed, > Shanghai-based company known for creating some of China's most popular > massive multiplayer online games. > http://online.wsj.com/article/SB10001424052748704081704574653430020773954.html > > Best, > Thomas > > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From ulf.wiger@REDACTED Wed Jan 13 14:28:57 2010 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Wed, 13 Jan 2010 14:28:57 +0100 Subject: type specs to guards, anyone? Message-ID: <4B4DCA99.8050904@erlang-consulting.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Does anyone happen to be sitting on code that generates guard tests from type specs? I'd love to avoid having to write them myself, not least since the abstract representation of type specs seems rather poorly documented. BR, Ulf W -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAktNypkACgkQtqqFieqzed3v8wCfbppRcjDwJg3Dq2+VN8+Iyw9O OLIAmQGsDdCj7XGGgOEuvtB4fM6TWk1w =niA8 -----END PGP SIGNATURE----- --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From thomasl_erlang@REDACTED Wed Jan 13 13:52:24 2010 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Wed, 13 Jan 2010 04:52:24 -0800 (PST) Subject: [erlang-questions] Yaws In-Reply-To: <4B4D3017.7020602@eonblast.com> References: <4B4D3017.7020602@eonblast.com> Message-ID: <780899.26448.qm@web111405.mail.gq1.yahoo.com> ----- Original Message ---- > From: Henning Diedrich > > sounds good -- for an online backup service I would have expected mochi > web to come into play. What made you opt for Yaws? There were no huge technical reasons for choosing Yaws over Mochiweb. Mochiweb actually seems a bit more elegant, but as usual, there was a lack of time, I had more familiarity with Yaws, I know the people developing Yaws (and developing with Yaws), and the extra code fit reasonably well into Yaws. But these are basically incidental rather than fundamental reasons. Best, Thomas From ulf.wiger@REDACTED Wed Jan 13 15:14:51 2010 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Wed, 13 Jan 2010 15:14:51 +0100 Subject: [erlang-questions] Re: Benchmarks In-Reply-To: <1d359a85-77cb-41ad-a060-0e5413b01eff@p24g2000yqm.googlegroups.com> References: <4B4BD8F8.20401@eonblast.com> <1d359a85-77cb-41ad-a060-0e5413b01eff@p24g2000yqm.googlegroups.com> Message-ID: <4B4DD55B.3000102@erlang-consulting.com> Steve Davis wrote: > I'd like to offer another benchmark: > > Net income in dollars generated by the application / hours of > development and maintenance time. The following blog article is trying to formulate a case similar to yours in the form of a simple benchmark: http://journal.dedasys.com/2010/01/12/rough-estimates-of-the-dollar-cost-of-scaling-web-platforms-part-i (and it must be a good and honest benchmark, since it makes Erlang look pretty sensible from a business perspective. ;-) BR, Ulf W --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From igorrs@REDACTED Wed Jan 13 16:18:34 2010 From: igorrs@REDACTED (Igor Ribeiro Sucupira) Date: Wed, 13 Jan 2010 13:18:34 -0200 Subject: [erlang-questions] Reading the first or last N records from a secondary index in mnesia In-Reply-To: <4B4D6759.9000709@m5net.com> References: <4B4D6759.9000709@m5net.com> Message-ID: Hi, Sam. I believe secondary indices are bags, so they are not stored in a way that provides efficient sorted iteration. If you really need that functionality, you can implement your own index, using another ordered_set table. Best regards. Igor. On Wed, Jan 13, 2010 at 4:25 AM, Sam Bobroff wrote: > Hi everyone, > > I've been trying, unsuccessfully, to work out how to read either the > first, (or last) few keys from an mnesia table's secondary index in a > reasonably efficient manner. > > (If I want to read records from a primary index I can make the table > ordered_set and use first(), last() and next() or prev().) > > All I can come up with is something like this: > > Q = qlc:cursor( qlc:sort( qlc:q( [ R || R <- mnesia:table(blah) ] ), > [{order, fun compare_secondary_index/2}] ) ) > qlc:next_answers(QC, N). > > But it seems to cause the entire table to be read and sorted before any > records are returned. It doesn't seem to use the secondary index at all. > > Have I missed some obvious way to do this? > > Is it possible to iterate over the secondary index? > > Cheers, > Sam. > > -- > Sam Bobroff | sam@REDACTED | M5 Networks > Why does my email have those funny headers? Because I use PGP to sign > my email (and you should too!): that's how you know it's really from me. > See: http://en.wikipedia.org/wiki/Pretty_Good_Privacy > > > -- "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 erlang@REDACTED Wed Jan 13 17:19:01 2010 From: erlang@REDACTED (Joe Armstrong) Date: Wed, 13 Jan 2010 17:19:01 +0100 Subject: [erlang-questions] Re: Benchmarks In-Reply-To: <6a36e7291001121908y69d32b00h506a551a6b4034b9@mail.gmail.com> References: <4B4BD8F8.20401@eonblast.com> <1d359a85-77cb-41ad-a060-0e5413b01eff@p24g2000yqm.googlegroups.com> <4B4D2678.4080009@eonblast.com> <6a36e7291001121908y69d32b00h506a551a6b4034b9@mail.gmail.com> Message-ID: <9b08084c1001130819u7d3346aaiaeeb4ac22e74dd2b@mail.gmail.com> Every hour spend arguing for Erlang is an hour wasted - so I must have wasted several years :-) Assume X and Y are different programming languages. I rarely benchmark X against Y to see if X or Y is better I usually *know* which is better before I start. So I'd never benchmarch C against Erlang for doing FFTs since I know that C would win. How do I know? - Gut feeling. Even without running the code I could make a reasonable guess that visual basic is good at making GUIs in windows and that Erlang is not. I *do* benchmark program one in X again program two in X to see which is faster - but this is just engineering. So is this thread about benchmarking or why you choose languages? I'll digress and throw in a couple of arguments. In any *system* the totality of things that must be done to make the system work is the same (this is the problem). Now you can either do these things "in our language" or "somewhere else". C has no memory management and processes (ie no GC) - Erlang has. In C you have to do the memory management yourself (tricky, horrible code) and processes - well C doesn't do processes so we'll pass these over to the OS and hope that it can cope. The C will be super fast - after all it's not doing any processes stuff the OS is doing that - and it's not doing memory management. Problem - the OS self-destructs if we have too many processes --- ooooohhhh. So in our problem - the C bit runs very fast - but the processes are not so good (because we shoved them over to the OS) and we can't do dynamic code upgrade - because neither C nor the OS support this. Now Erlang - the code is slow (compared to C) - every function call is through a pointer (why? - so we can change the code on the fly !) and we emulate processes (why? - so we can have lots of them and do code replacement on the fly, and ...) So In Erlang yes we are slower than in C - but in C we haven't done all the things we need to do to solve our problem. We've pushed some of the tricky things into the OS (like processes) or ignored them altogether (like hot code replacement). So to solve our problem we must do all these things - if you can't do them in one place you must do them somewhere else. Erlang was designed to provide an off-the-shelf solution to all the things we needed to do to build a fault-tolerant, soft real-time distributed telephone switch control software with hot code replacement. Erlang was not designed to be as fast as C at doing things that C is good at. Erlang was designed to make the things that are extremely difficult to do in C but which need doing anyway *possible* to do at all. Not easy to do but *possible*. So if you want "all the goodies" - like hot code replacement - fancy error handling etc. - and you want to do it in C (or some other language) then good luck - if you start now then we'll be 15 years ahead of you Let's change track ... For years I used to argue why Erlang was (technically) great - but the problem is you can *never* win an argument. You cannot convince me of anything - I'm the only person who can convince me. If you totally outargue somebody, they will feel pissed-off and do the opposite of what you had argued for .. Strangely, winning a technical argument, though long careful arguments rarely had the desired results, other forces are at play. So let's look at the most important of these ... Hypothesis: Choice of language has nothing to do with "technical stuff" (ie benchmarks etc), but has to do with "non technical stuff". Arguments for Erlang should be aimed at the "not technical stuff". Programmers *love* the technical arguments - but this leads to an escalation in tech. arguments. Increase the pressure and the resistance will also increase. No movement in an argument (ie away or towards being in favor of Erlang) means you have reached equilibrium. Equilibrium means: Pressure to use Erlang == Resistance to use Erlang (ie is exactly equal to - this is why there is no movement towards or away from Erlang, ie no decision) Increasing the pressure to use Erlang just increases the reasons why you should not use Erlang - the technical arguments just get more and more intense, and you're still in equilibrium. To convince anybody to use Erlang you have to break the equilibrium. Instead of increasing the pressure try reducing the resistance. In my experience most resistance is due to non-spoken non-technical reasons. The primary reason is usually fear of failure (FOF). FOF is a very strong motivating force. One excellent method of reducing FOF is tell "success stories" - tell 'em about the successful Erlang projects - how quickly they wrote the code how quickly they crushed the opposition, the great amounts of money they made (:-)). Tell them about the failures that using *some other language* had in similar circumstances. Perhapse the project will fail if they do not use Erlang, and what if the opposition does it in Erlang before us and we're bankrupt ... there's a thought ... People like stories, so tell then stories of Erlang successes - this will reduce FOF. /Joe On Wed, Jan 13, 2010 at 4:08 AM, Bob Ippolito wrote: > It's much lower if you have to spend hours justifying why Erlang is a > better choice than X. > > On Wed, Jan 13, 2010 at 9:48 AM, Henning Diedrich wrote: >> Accepted on account of today's news. >> >> What's the number then, Bob? >> >> Henning >> >> Steve Davis wrote: >>> >>> I'd like to offer another benchmark: >>> >>> Net income in dollars generated by the application / hours of >>> development and maintenance time. >>> >>> /s >>> >>> ________________________________________________________________ >>> 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 essiene@REDACTED Wed Jan 13 18:07:58 2010 From: essiene@REDACTED (Essien Essien) Date: Wed, 13 Jan 2010 18:07:58 +0100 Subject: [erlang-questions] [ANN] efene programming language 0.1 released In-Reply-To: References: <88b82c91001120827m4f5d497cg7551a021ba1c684d@mail.gmail.com> Message-ID: <88b82c91001130907x345cfb94l260ca3ebfebf8c10@mail.gmail.com> On Tue, Jan 12, 2010 at 8:11 PM, Mariano Guerra wrote: > On Tue, Jan 12, 2010 at 1:27 PM, Essien Essien wrote: >> Hi, >> >> On Tue, Jan 12, 2010 at 5:42 AM, Mariano Guerra >> wrote: >>> efene is a programming language that runs on the erlang virtual machine. >>> >>> the idea is to provide an alternative syntax to erlang that is most >>> suitable for people coming from languages like Java, C, C++, C#, >>> Javascript. >>> >>> the language is almost 100% compatible with erlang (and will be), the >>> compiler allows to translate an efene source file into a readable >>> erlang one. It also adds some syntactic sugar in some places to make >>> some tasks easier. >>> >>> to see how it looks you can go to the examples dir[0] >>> >>> more info at efene?s main site[1] and the efene?s github page[2] >>> >>> [0] http://github.com/marianoguerra/efene/tree/master/examples/ >>> [1] http://marianoguerra.com.ar/efene >>> [2] http://github.com/marianoguerra/efene/ >>> >>> http://efene.tumblr.com/post/329929156/efene-0-1-released >> >> I took a look at this and loved it immedietly. The main goal of source >> to source translation seems to have been met. I'm not too sure of some >> of the syntax like that for binary, I still think I prefer the native >> erlang syntax for binary... but that's just me. all in all... very >> nice! > > at this moment the syntax can be changed so any recommendation is appreciated cool. I've cloned it on github, and will play around with it a bit. > >> Do you have any other plans for the efene itself? Maybe some >> interesting features like optional typing syntax with efene functions >> which could translate to dialyser annotations in the erlang >> sources?... something like that? That would really make it compelling. > > that would be really nice, if you have some specific idea I will see > if I implement it ok... let me wet my feet in the code and then i'll prolly brainstorm some ideas with you by weekend or something. > >> Also, do you at any point want to do pure erlang vm bytecode >> generation? as opposed to erlang source code generation? > > it already generates .beam files, the -t erl was just to show how > translated the code but the default us -t beam :) my bad! missed that. cool! > >> Ohh... and the Go frontend driver is pretty nice... I see why the >> language has generated soo much hoolabaloo on da intarwebs! :) > > I wanted to generate a binary and I didn't wanted to fight with C strings :) hehehe... its a fight you usually make it through to the end, but have a sneaky feeling you've still lost :) cheers, Essien From igouy2@REDACTED Wed Jan 13 18:23:17 2010 From: igouy2@REDACTED (Isaac Gouy) Date: Wed, 13 Jan 2010 09:23:17 -0800 (PST) Subject: [erlang-questions] Re: Benchmarks In-Reply-To: <9b08084c1001130819u7d3346aaiaeeb4ac22e74dd2b@mail.gmail.com> Message-ID: <812137.84315.qm@web65607.mail.ac4.yahoo.com> --- On Wed, 1/13/10, Joe Armstrong wrote: -snip- > Erlang was designed to provide an off-the-shelf solution to > all the > things we needed to do to build a fault-tolerant, soft > real-time > distributed telephone switch control software with hot code > replacement. > > Erlang was not designed to be as fast as C at doing things > that C is good at. That's pretty much what the Erlang FAQ says.. -snip- > Increasing the pressure to use Erlang just increases the > reasons why > you should not use Erlang - the technical arguments just > get more and > more intense, and you're still in equilibrium.. > > To convince anybody to use Erlang you have to break the > equilibrium. > > Instead of increasing the pressure try reducing the > resistance. > > In my experience most resistance is due to non-spoken > non-technical > reasons.? The primary reason is usually fear of > failure (FOF). FOF is > a very strong motivating force. > > One excellent method of reducing FOF is tell "success > stories" - tell > 'em about the successful Erlang projects - how quickly they > wrote the > code how quickly they crushed the opposition, the great > amounts of > money they made (:-)). Tell them about the failures that > using *some > other language* had in similar circumstances. > > Perhapse the project will fail if they do not use Erlang, > and > what if the opposition does it in Erlang before us and > we're bankrupt ... > there's a thought ... > > People like stories, so tell then stories of Erlang > successes - this > will reduce FOF. Yes. From rvirding@REDACTED Wed Jan 13 18:31:34 2010 From: rvirding@REDACTED (Robert Virding) Date: Wed, 13 Jan 2010 18:31:34 +0100 Subject: [erlang-questions] Re: Benchmarks In-Reply-To: <812137.84315.qm@web65607.mail.ac4.yahoo.com> References: <9b08084c1001130819u7d3346aaiaeeb4ac22e74dd2b@mail.gmail.com> <812137.84315.qm@web65607.mail.ac4.yahoo.com> Message-ID: <3dbc6d1c1001130931g53b3f244l128df5201bdd0af1@mail.gmail.com> 2010/1/13 Isaac Gouy > > > --- On Wed, 1/13/10, Joe Armstrong wrote: > -snip- > > Erlang was designed to provide an off-the-shelf solution to > > all the > > things we needed to do to build a fault-tolerant, soft > > real-time > > distributed telephone switch control software with hot code > > replacement. > > > > Erlang was not designed to be as fast as C at doing things > > that C is good at. > > > That's pretty much what the Erlang FAQ says.. > Not surprising really. Who do you think helped write the original FAQ? :-) Robert From kostis@REDACTED Wed Jan 13 18:52:52 2010 From: kostis@REDACTED (Kostis Sagonas) Date: Wed, 13 Jan 2010 19:52:52 +0200 Subject: [erlang-questions] type specs to guards, anyone? In-Reply-To: <4B4DCA99.8050904@erlang-consulting.com> References: <4B4DCA99.8050904@erlang-consulting.com> Message-ID: <4B4E0874.5050001@cs.ntua.gr> Ulf Wiger wrote: > > Does anyone happen to be sitting on code that generates guard > tests from type specs? I am not aware of such code. Moreover, I am not even sure what you want to do here. The language of types allows for more things than what you can express using Erlang guards. For example, you might have a function foo/1 whose argument should be a list of integers. -spec foo([integer()]) -> Using guards the only thing you can express is that foo/1 takes a proper list. You need to be able to employ user-defined functions in guards to do it properly. Erlang currently lacks this. Kostis From toby@REDACTED Wed Jan 13 19:06:30 2010 From: toby@REDACTED (Toby Thain) Date: Wed, 13 Jan 2010 13:06:30 -0500 Subject: [erlang-questions] Benchmarks In-Reply-To: <4B4BE5DA.6010409@eonblast.com> References: <4B4BD8F8.20401@eonblast.com> <4B4BE5DA.6010409@eonblast.com> Message-ID: <77527006-F047-482C-9746-4F061F9F99BB@telegraphics.com.au> On 11-Jan-10, at 10:00 PM, Henning Diedrich wrote: > >>> http://shootout.alioth.debian.org/u64q/benchmark.php? >>> test=all&lang=hipe&lang2=gcc >>> >>> Would you have bullet points for me as to how they might be >>> misleading or >>> only a part of a bigger picture - or simply just so? >>> >>> Thanks a lot, >>> Henning >>> >>> >>> >> they are irrelevant as none of those things are what Erlang is >> designed to >> do REALLY WELL. >> > Certainly that's the expected defense. Could you spell that out > specifically? And, besides the Yaws / Mochi / Apache shoot outs, > are there current benchmarks or any metrics out there that show > results of which there is some agreement in the community that they > do measure something that IS relevant? And I mean that widely, > like, on average 1/4 of code vs. C. The ratio usually quoted is 1/4 - 1/10 code size versus C-like languages. One way to answer all your questions is to actually prototype your problem in Erlang. Abstract benchmarks really are pretty useless, and in this case, are comparing Apples to very small rocks. --Toby > That'd be a valid point. > > Thanks, > Henning From toby@REDACTED Wed Jan 13 19:09:30 2010 From: toby@REDACTED (Toby Thain) Date: Wed, 13 Jan 2010 13:09:30 -0500 Subject: [erlang-questions] Benchmarks In-Reply-To: <209525.67663.qm@web65604.mail.ac4.yahoo.com> References: <209525.67663.qm@web65604.mail.ac4.yahoo.com> Message-ID: On 12-Jan-10, at 6:24 PM, Isaac Gouy wrote: > > > --- On Tue, 1/12/10, Jarrod Roberson wrote: > > -snip- >> I stand by my assertion that those benchmarks are not what >> Erlang was designed to do REALLY WELL. > > I didn't challenge your assertion. > > I merely suggested we can make similar assertions for other > programming languages. > > Furthermore, not doing is obviously special pleading. > The defense is not about Erlang specifically. It is meant to call into question the usefulness of the shootout in general. --Toby > > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From ulf.wiger@REDACTED Wed Jan 13 19:11:29 2010 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Wed, 13 Jan 2010 19:11:29 +0100 Subject: [erlang-questions] type specs to guards, anyone? In-Reply-To: <4B4E0874.5050001@cs.ntua.gr> References: <4B4DCA99.8050904@erlang-consulting.com> <4B4E0874.5050001@cs.ntua.gr> Message-ID: <4B4E0CD1.1000407@erlang-consulting.com> The easy generic solution seems to be erl_types:f_is_instance(erl_types:f_from_term(Value), T), where T = erl_types:f_from_form(Form) at compile-time. My objective is to generate type-checking code from type signatures. It doesn't have to be guards, obviously. I'm quite content with a solution that handles all type specifications, with the option to selectively generate faster code for some commonly used types. BR, Ulf W Kostis Sagonas wrote: > Ulf Wiger wrote: >> >> Does anyone happen to be sitting on code that generates guard >> tests from type specs? > > I am not aware of such code. > > Moreover, I am not even sure what you want to do here. The language of > types allows for more things than what you can express using Erlang > guards. For example, you might have a function foo/1 whose argument > should be a list of integers. > > -spec foo([integer()]) -> > > Using guards the only thing you can express is that foo/1 takes a proper > list. You need to be able to employ user-defined functions in guards to > do it properly. Erlang currently lacks this. > > Kostis --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From ulf.wiger@REDACTED Wed Jan 13 19:14:27 2010 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Wed, 13 Jan 2010 19:14:27 +0100 Subject: [erlang-questions] type specs to guards, anyone? In-Reply-To: <4B4E0CD1.1000407@erlang-consulting.com> References: <4B4DCA99.8050904@erlang-consulting.com> <4B4E0874.5050001@cs.ntua.gr> <4B4E0CD1.1000407@erlang-consulting.com> Message-ID: <4B4E0D83.2060502@erlang-consulting.com> Sorry, I jotted that down from memory, and didn't quite get it right. It should have been t_is_instance/2, t_from_term/1 and t_from_form/1. Br, Ulf W Ulf Wiger wrote: > > The easy generic solution seems to be > > erl_types:f_is_instance(erl_types:f_from_term(Value), T), > > where T = erl_types:f_from_form(Form) at compile-time. > > My objective is to generate type-checking code from > type signatures. It doesn't have to be guards, obviously. > I'm quite content with a solution that handles all type > specifications, with the option to selectively generate > faster code for some commonly used types. > > BR, > Ulf W > > Kostis Sagonas wrote: >> Ulf Wiger wrote: >>> >>> Does anyone happen to be sitting on code that generates guard >>> tests from type specs? >> >> I am not aware of such code. >> >> Moreover, I am not even sure what you want to do here. The language >> of types allows for more things than what you can express using Erlang >> guards. For example, you might have a function foo/1 whose argument >> should be a list of integers. >> >> -spec foo([integer()]) -> >> >> Using guards the only thing you can express is that foo/1 takes a >> proper list. You need to be able to employ user-defined functions in >> guards to do it properly. Erlang currently lacks this. >> >> Kostis > > --------------------------------------------------- > > --------------------------------------------------- > > WE'VE CHANGED NAMES! > > Since January 1st 2010 Erlang Training and Consulting Ltd. has become > ERLANG SOLUTIONS LTD. > > www.erlang-solutions.com > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > --------------------------------------------------- > > --------------------------------------------------- > > WE'VE CHANGED NAMES! > > Since January 1st 2010 Erlang Training and Consulting Ltd. has become > ERLANG SOLUTIONS LTD. > > www.erlang-solutions.com > --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From mononcqc@REDACTED Wed Jan 13 19:31:17 2010 From: mononcqc@REDACTED (Fred Hebert) Date: Wed, 13 Jan 2010 13:31:17 -0500 Subject: [erlang-questions] Benchmarks In-Reply-To: <8b9ee55b1001131030g8bb561du66c5d1cadef1d52e@mail.gmail.com> References: <4B4BD8F8.20401@eonblast.com> <1d359a85-77cb-41ad-a060-0e5413b01eff@p24g2000yqm.googlegroups.com> <4B4D2678.4080009@eonblast.com> <6a36e7291001121908y69d32b00h506a551a6b4034b9@mail.gmail.com> <9b08084c1001130819u7d3346aaiaeeb4ac22e74dd2b@mail.gmail.com> <8b9ee55b1001131030g8bb561du66c5d1cadef1d52e@mail.gmail.com> Message-ID: <8b9ee55b1001131031i4317534x15b02c1f8683d99b@mail.gmail.com> On Wed, Jan 13, 2010 at 11:19 AM, Joe Armstrong wrote: > > In my experience most resistance is due to non-spoken non-technical > reasons. The primary reason is usually fear of failure (FOF). FOF is > a very strong motivating force. > > One excellent method of reducing FOF is tell "success stories" - tell > 'em about the successful Erlang projects - how quickly they wrote the > code how quickly they crushed the opposition, the great amounts of > money they made (:-)). Tell them about the failures that using *some > other language* had in similar circumstances. > > Perhapse the project will fail if they do not use Erlang, and > what if the opposition does it in Erlang before us and we're bankrupt ... > there's a thought ... > > People like stories, so tell then stories of Erlang successes - this > will reduce FOF. > > /Joe > > I must agree with that. Success stories do play a big role, if not the biggest of all. Some of my bosses started telling me they'd like me to learn about Erlang because facebook used it for their chat system. And they're facebook, so it works, right? There is another level that is more about the developer, which is the environment: how modern is the language (I don't care if your 80s mainframe was programmed in whatever language, I want to know what's going on right now), what the community is like, what libraries are available, how easy it is to get into, etc. I think Erlang is trailing behind a bit in that respect. The site looks outdated (at least there's a new one being prepared), the doc still uses frames (see http://erldocs.com for a modern model), etc. These subjects have been mentioned many times and things are getting done. The language is a bit hard to get into, maybe because of the lack of free information except for countless ring benchmarks in blog posts. This is why I've spent hours adding examples to rosettacode.org and it's why I'm writing Learn You Some Erlang. This is why other people are writing books/guides like Luke Venediger's Erlang for Skeptics, too. Some users spend a lot of time answering questions on stackoverflow to help to. As a whole, I believe the Erlang community is doing a great job at making things better. Moving to github has been a huge move, the old guard is awesome for answers on the mailing list and the guys on the irc channels are helpful. CEAN and trapexit are other excellent sources for programmers. The guys at http://ideone.com/ has a feature to run Erlang code from the web (? la codepad.org), there are countless interesting products and tools. I do believe this is the way to really make Erlang a better choice for developing new products. One of the only things missing in the adoption of Erlang, I think, is the amount of job offers for it. I've learned Erlang out of sheer interest, but I'm unlikely to work anywhere using that skill except if I were to move a few hundred kilometers away from everyone I know. Now, nobody's going to start hiring for Erlang devs in my region if there's nobody to hire... I don't think the community itself can do much about that though. From igouy2@REDACTED Wed Jan 13 19:38:24 2010 From: igouy2@REDACTED (Isaac Gouy) Date: Wed, 13 Jan 2010 10:38:24 -0800 (PST) Subject: [erlang-questions] Re: Benchmarks In-Reply-To: <3dbc6d1c1001130931g53b3f244l128df5201bdd0af1@mail.gmail.com> Message-ID: <73820.89397.qm@web65616.mail.ac4.yahoo.com> --- On Wed, 1/13/10, Robert Virding wrote: > From: Robert Virding > Subject: Re: [erlang-questions] Re: Benchmarks > To: igouy2@REDACTED > Cc: "Erlang Questions" > Date: Wednesday, January 13, 2010, 9:31 AM > 2010/1/13 Isaac Gouy > > > > > > > --- On Wed, 1/13/10, Joe Armstrong > wrote: > > -snip- > > > Erlang was designed to provide an off-the-shelf > solution to > > > all the > > > things we needed to do to build a fault-tolerant, > soft > > > real-time > > > distributed telephone switch control software > with hot code > > > replacement. > > > > > > Erlang was not designed to be as fast as C at > doing things > > > that C is good at. > > > > > > That's pretty much what the Erlang FAQ says.. > > > > Not surprising really. Who do you think helped write the > original FAQ? :-) And it's also not really surprising that although the FAQ is quite clear, it's still necessary to continually restate what the FAQ says in different ways and in different forums. You can lead a horse to FAQs but you can't make him read :-) From igouy2@REDACTED Wed Jan 13 19:43:35 2010 From: igouy2@REDACTED (Isaac Gouy) Date: Wed, 13 Jan 2010 10:43:35 -0800 (PST) Subject: [erlang-questions] Benchmarks In-Reply-To: Message-ID: <692103.38458.qm@web65609.mail.ac4.yahoo.com> --- On Wed, 1/13/10, Toby Thain wrote: -snip- > The defense is not about Erlang specifically. It is meant > to call into question the usefulness of the shootout in general. 1) That will rapidly take us off-topic for this list. 2) "usefulness" for what? http://shootout.alioth.debian.org/help.php#why 3) Is that "calling into question" missing http://shootout.alioth.debian.org/flawed-benchmarks.php From vasilij.savin@REDACTED Wed Jan 13 20:15:45 2010 From: vasilij.savin@REDACTED (Vasilij Savin) Date: Wed, 13 Jan 2010 21:15:45 +0200 Subject: [erlang-questions] Benchmarks In-Reply-To: <8b9ee55b1001131031i4317534x15b02c1f8683d99b@mail.gmail.com> References: <4B4BD8F8.20401@eonblast.com> <1d359a85-77cb-41ad-a060-0e5413b01eff@p24g2000yqm.googlegroups.com> <4B4D2678.4080009@eonblast.com> <6a36e7291001121908y69d32b00h506a551a6b4034b9@mail.gmail.com> <9b08084c1001130819u7d3346aaiaeeb4ac22e74dd2b@mail.gmail.com> <8b9ee55b1001131030g8bb561du66c5d1cadef1d52e@mail.gmail.com> <8b9ee55b1001131031i4317534x15b02c1f8683d99b@mail.gmail.com> Message-ID: Hello, I would like to comment on a few points mentioned by Fred. Regards, Vasilij Savin I think Erlang is trailing behind a bit in that respect. The site looks > outdated (at least there's a new one being prepared), the doc still uses > frames (see http://erldocs.com for a modern model), etc. Javadocs use them as well. I do not think it is that big issue though. > These subjects have > been mentioned many times and things are getting done. The language is a > bit > hard to get into, maybe because of the lack of free information except for > countless ring benchmarks in blog posts. This is why I've spent hours > adding > examples to rosettacode.org and it's why I'm writing Learn You Some > Erlang. > This is why other people are writing books/guides like Luke Venediger's > Erlang for Skeptics, too. Some users spend a lot of time answering > questions > on stackoverflow to help to. > I think the problem is rooted much deeper. There is another issue, sometimes companies are scared to use particular technology or language due to lack of developers and community behind it, so they might be held hostage by few key people who know this technology and unable to maintain their product in the long run. And this is where functional programming languages run quite short, I think. A lot of people get exposed to programming at school and universities. However, during last decades there was a significant erosion of functional programming courses from curricula. Many universities never ever teach any functional language. Even in MIT (according to some old article) they switched several courses from Scheme to Java. As recent Erlang convert without prior functional programming expertise, I can only assure that leap from C/Java paradigm to functional is far from negligible. Perhaps, if youngsters could be taught some functional programming in school or university, more people would have been more open towards Erlang. Just some on-topic reading about Perils of Java in Schools by Joel on Software: http://www.joelonsoftware.com/articles/ThePerilsofJavaSchools.html So perhaps, we should invest some of our time teaching Erlang and functional programming in universities, so we grow crop of Erlang developers. Regards, Vasilij Savin From jderick@REDACTED Wed Jan 13 21:25:46 2010 From: jderick@REDACTED (John Erickson) Date: Wed, 13 Jan 2010 12:25:46 -0800 Subject: missing debug info Message-ID: <4de34f3b1001131225r3b62348et49cc89348e3ae2f0@mail.gmail.com> I have compiled all my files with +debug_info, but I still see processes in "undefined" functions when I use i() or bt(). Also, I have tried to get stack traces from gdb. I notice that I also get ?? functions in those traces, in places where I would expect to see my erlang functions. Does erlang generate GDB debug info for user code? I do see parts of the trace that call into the erlang system. Also, when I try to open a debugger with ia(pid(0,71,0)) it says 'no_proc', even though that process is shown in the i() listing. John From bernie@REDACTED Wed Jan 13 23:31:14 2010 From: bernie@REDACTED (Bernard Duggan) Date: Wed, 13 Jan 2010 17:31:14 -0500 Subject: Mnesia activity callback system context Message-ID: <4B4E49B2.9070501@m5net.com> Hi List, Is it the case that mnesia activity callbacks are guaranteed to execute in the same process that is performing the transaction? I can't find any mention of it in the docs. I ask because if it's not, it doesn't seem like there's any way to get an arbitrary piece of information from the latter process to the one in which the callbacks execute, and that significantly limits their usefulness for a couple of things I'd like to do. (I had written a long email explaining those things, but if the answer to this question is "yes" then I can save us all a lot of time :)) Even if the answer is "yes", it still seems like the only way would be to use the process dictionary - fine if that's the case, but it seems like there "should" be a neater way. Cheers, Bernard From paul-trapexit@REDACTED Wed Jan 13 23:47:39 2010 From: paul-trapexit@REDACTED (Paul Mineiro) Date: Wed, 13 Jan 2010 14:47:39 -0800 (PST) Subject: [erlang-questions] Mnesia activity callback system context In-Reply-To: <4B4E49B2.9070501@m5net.com> References: <4B4E49B2.9070501@m5net.com> Message-ID: On Wed, 13 Jan 2010, Bernard Duggan wrote: > Hi List, > Is it the case that mnesia activity callbacks are guaranteed to > execute in the same process that is performing the transaction? I can't > find any mention of it in the docs. I ask because if it's not, it > doesn't seem like there's any way to get an arbitrary piece of > information from the latter process to the one in which the callbacks > execute, and that significantly limits their usefulness for a couple of > things I'd like to do. (I had written a long email explaining those > things, but if the answer to this question is "yes" then I can save us > all a lot of time :)) > Even if the answer is "yes", it still seems like the only way would > be to use the process dictionary - fine if that's the case, but it seems > like there "should" be a neater way. I don't have a strong aversion to the process dictionary, but mnesia:activity/3,4 take a Fun (closure) and an Args (direct information passing) both of which would facilitate passing information to the callback. So I suspect you're trying to do something unusual or interesting; maybe the details would help? -- p From paul-trapexit@REDACTED Wed Jan 13 23:57:14 2010 From: paul-trapexit@REDACTED (Paul Mineiro) Date: Wed, 13 Jan 2010 14:57:14 -0800 (PST) Subject: [erlang-questions] Mnesia activity callback system context In-Reply-To: References: <4B4E49B2.9070501@m5net.com> Message-ID: On Wed, 13 Jan 2010, Paul Mineiro wrote: > On Wed, 13 Jan 2010, Bernard Duggan wrote: > > > Hi List, > > Is it the case that mnesia activity callbacks are guaranteed to > > execute in the same process that is performing the transaction? I can't > > find any mention of it in the docs. I ask because if it's not, it > > doesn't seem like there's any way to get an arbitrary piece of > > information from the latter process to the one in which the callbacks > > execute, and that significantly limits their usefulness for a couple of > > things I'd like to do. (I had written a long email explaining those > > things, but if the answer to this question is "yes" then I can save us > > all a lot of time :)) > > Even if the answer is "yes", it still seems like the only way would > > be to use the process dictionary - fine if that's the case, but it seems > > like there "should" be a neater way. > > I don't have a strong aversion to the process dictionary, but > mnesia:activity/3,4 take a Fun (closure) and an Args (direct > information passing) both of which would facilitate passing information to > the callback. > > So I suspect you're trying to do something unusual or interesting; maybe > the details would help? This makes more since if you are talking about the AccessMod. You want to somehow change the behaviour of the mnesia_access callback module by passing some information to mnesia:activity/3,4. Well, you could try leveraging the AccessMod argument itself, via parametrized modules. -- p From bernie@REDACTED Thu Jan 14 00:03:22 2010 From: bernie@REDACTED (Bernard Duggan) Date: Wed, 13 Jan 2010 18:03:22 -0500 Subject: [erlang-questions] Mnesia activity callback system context In-Reply-To: References: <4B4E49B2.9070501@m5net.com> Message-ID: <4B4E513A.4070201@m5net.com> Paul Mineiro wrote: > Well, you could try leveraging the AccessMod argument itself, via > parametrized modules Sorry, I probably didn't make myself clear. I /am/ using the AccessMod argument - it's the callbacks /within/ that AccessMod (AccessMod:write et al) that I want to get arbitrary information into - the parameters they have do not allow for extra information beyond what you'd usually pass to mnesia:write etc. (Well, they have some extra information, but it's largely opaque mnesia-specific information - ActitviyID and Opaque). I haven't encountered parametrised modules before - on the face of it it sounds like exactly what I want...I'll have a look further, thanks. Cheers, Bernard From ulf.wiger@REDACTED Thu Jan 14 00:12:26 2010 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Thu, 14 Jan 2010 00:12:26 +0100 Subject: [erlang-questions] Mnesia activity callback system context In-Reply-To: <4B4E49B2.9070501@m5net.com> References: <4B4E49B2.9070501@m5net.com> Message-ID: <4B4E535A.7030003@erlang-consulting.com> Bernard Duggan wrote: > Hi List, > Is it the case that mnesia activity callbacks are guaranteed to > execute in the same process that is performing the transaction? Yes. > I can't > find any mention of it in the docs. I ask because if it's not, it > doesn't seem like there's any way to get an arbitrary piece of > information from the latter process to the one in which the callbacks > execute, and that significantly limits their usefulness for a couple of > things I'd like to do. (I had written a long email explaining those > things, but if the answer to this question is "yes" then I can save us > all a lot of time :)) > Even if the answer is "yes", it still seems like the only way would > be to use the process dictionary - fine if that's the case, but it seems > like there "should" be a neater way. The rdbms contrib (Jungerl) is probably one of the more ambitious examples of mnesia AccessMod exploits out there, and it makes heavy use of the process dictionary. I also did use parameterized modules once (I don't think I ever committed it to jungerl, though), when I wanted to make mnesia support writing to a table in the same (schema) transaction that was used to create the table. That required some rewrites of mnesia.erl and mnesia_tm.erl, though. Using the process dictionary is less invasive. BR, Ulf W --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From paul-trapexit@REDACTED Thu Jan 14 00:20:02 2010 From: paul-trapexit@REDACTED (Paul Mineiro) Date: Wed, 13 Jan 2010 15:20:02 -0800 (PST) Subject: [erlang-questions] Mnesia activity callback system context In-Reply-To: <4B4E535A.7030003@erlang-consulting.com> References: <4B4E49B2.9070501@m5net.com> <4B4E535A.7030003@erlang-consulting.com> Message-ID: On Thu, 14 Jan 2010, Ulf Wiger wrote: > I also did use parameterized modules once (I don't think I ever > committed it to jungerl, though), when I wanted to make mnesia > support writing to a table in the same (schema) transaction > that was used to create the table. That required some rewrites of > mnesia.erl and mnesia_tm.erl, though. Using the process dictionary > is less invasive. yes sadly, just looking at it, mnesia does pattern match on Mod being an atom in a few places, which would frustrate the use of parametrized modules. that's not cool! -- p From steven.charles.davis@REDACTED Thu Jan 14 03:11:45 2010 From: steven.charles.davis@REDACTED (Steve Davis) Date: Wed, 13 Jan 2010 20:11:45 -0600 Subject: [erlang-questions] Re: Benchmarks In-Reply-To: <4B4DD55B.3000102@erlang-consulting.com> References: <4B4BD8F8.20401@eonblast.com> <1d359a85-77cb-41ad-a060-0e5413b01eff@p24g2000yqm.googlegroups.com> <4B4DD55B.3000102@erlang-consulting.com> Message-ID: <4B4E7D61.1040901@gmail.com> Neat. "...adding users for Mochiweb is essentially free" ...yep, and I suspect the much same for Yaws. /s Ulf Wiger wrote: > Steve Davis wrote: >> I'd like to offer another benchmark: >> >> Net income in dollars generated by the application / hours of >> development and maintenance time. > > The following blog article is trying to formulate a case similar > to yours in the form of a simple benchmark: > > http://journal.dedasys.com/2010/01/12/rough-estimates-of-the-dollar-cost-of-scaling-web-platforms-part-i > > > (and it must be a good and honest benchmark, since it makes Erlang look > pretty sensible from a business perspective. ;-) > > BR, > Ulf W > --------------------------------------------------- > > --------------------------------------------------- > > WE'VE CHANGED NAMES! > > Since January 1st 2010 Erlang Training and Consulting Ltd. has become > ERLANG SOLUTIONS LTD. > > www.erlang-solutions.com > > From steven.charles.davis@REDACTED Thu Jan 14 03:24:29 2010 From: steven.charles.davis@REDACTED (Steve Davis) Date: Wed, 13 Jan 2010 18:24:29 -0800 (PST) Subject: Benchmarks In-Reply-To: <9b08084c1001130819u7d3346aaiaeeb4ac22e74dd2b@mail.gmail.com> References: <4B4BD8F8.20401@eonblast.com> <1d359a85-77cb-41ad-a060-0e5413b01eff@p24g2000yqm.googlegroups.com> <4B4D2678.4080009@eonblast.com> <6a36e7291001121908y69d32b00h506a551a6b4034b9@mail.gmail.com> <9b08084c1001130819u7d3346aaiaeeb4ac22e74dd2b@mail.gmail.com> Message-ID: <6c206738-8b6c-486e-b608-5653f3915fb0@r24g2000yqd.googlegroups.com> "In Erlang yes we are slower than in C - but in C we haven't done all the things we need to do to solve our problem." ...so beautifully and concisely spoken. I will use that quote! /s On Jan 13, 10:19?am, Joe Armstrong wrote: > So In Erlang yes we are slower than in C - but in C we haven't done all > the things we need to do to solve our problem. We've pushed some of > the tricky things into the OS (like processes) or ignored them > altogether (like hot code replacement). > > So to solve our problem we must do all these things - if you can't do > them in one place you must do them somewhere else. From kaiduanx@REDACTED Thu Jan 14 04:09:50 2010 From: kaiduanx@REDACTED (Kaiduan Xie) Date: Wed, 13 Jan 2010 22:09:50 -0500 Subject: Non-reproducible bug on a live erlang system Message-ID: Hi, all, Consider the following case, you have a live/busy Erlang system in production which handles thousands of transactions per second and millions of users, and customer reported a non-reproducible bug. The problem is non-reproducible, or intermittent, or very hard to reproduce in live system and in lab. You can not turn on the debug log that will bring the system down, and Erlang trace will not help since the problem is non-reproducible or hard to reproduce. How to resolve this kind problem? Can you shed light on this? Thanks, kaiduan From kagato@REDACTED Thu Jan 14 05:05:39 2010 From: kagato@REDACTED (Jayson Vantuyl) Date: Wed, 13 Jan 2010 20:05:39 -0800 Subject: [erlang-questions] Non-reproducible bug on a live erlang system In-Reply-To: References: Message-ID: <9D51CAD3-E6C4-4944-AB28-A40AD9CE9265@souja.net> Selective debugging is one of Erlang's high points. If the bug often bites the a particular user, seqtoken allows debugging to follow a single request. Use that infrastructure to debug just that user. Otherwise, you can also attach a matchspec to debug patterns, so you may be able to carefully craft a match to catch the broken behavior at some point in the system. Sent from my iPhone On Jan 13, 2010, at 7:09 PM, Kaiduan Xie wrote: > Hi, all, > > Consider the following case, you have a live/busy Erlang system in > production which handles thousands of transactions per second and > millions of users, and customer reported a non-reproducible bug. The > problem is non-reproducible, or intermittent, or very hard to > reproduce in live system and in lab. > > You can not turn on the debug log that will bring the system down, and > Erlang trace will not help since the problem is non-reproducible or > hard to reproduce. > > How to resolve this kind problem? Can you shed light on this? > > Thanks, > > kaiduan > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From sysop@REDACTED Thu Jan 14 08:55:28 2010 From: sysop@REDACTED (Matt Stancliff) Date: Wed, 13 Jan 2010 23:55:28 -0800 Subject: [erlang-questions] Benchmarks In-Reply-To: <8b9ee55b1001131031i4317534x15b02c1f8683d99b@mail.gmail.com> References: <4B4BD8F8.20401@eonblast.com> <1d359a85-77cb-41ad-a060-0e5413b01eff@p24g2000yqm.googlegroups.com> <4B4D2678.4080009@eonblast.com> <6a36e7291001121908y69d32b00h506a551a6b4034b9@mail.gmail.com> <9b08084c1001130819u7d3346aaiaeeb4ac22e74dd2b@mail.gmail.com> <8b9ee55b1001131030g8bb561du66c5d1cadef1d52e@mail.gmail.com> <8b9ee55b1001131031i4317534x15b02c1f8683d99b@mail.gmail.com> Message-ID: <87C1686C-ED2A-4C5C-9ACD-508BBBA8DDB3@mindspring.com> On Jan 13, 2010, at 10:31 AM, Fred Hebert wrote: > helpful. CEAN and trapexit are other excellent sources for > programmers. The > guys at http://ideone.com/ has a feature to run Erlang code from the > web (? > la codepad.org), there are countless interesting products and tools. > I do > believe this is the way to really make Erlang a better choice for > developing > new products. I can't let mentions of online code doohickeys go by without mentioning my recent project: http://runroot.com/ runroot is a web-based live REPL system. You can run a very responsive erlang shell right in your browser with full access to the underlying system. Backstory: runroot was made with the intention of creating a web- based, low barrier to entry erlang tutoring system. To increase the appeal I added another handful of languages at the last minute. It's still very early in the project's life, but so far everything is coming together nicely. Some people have been talking about C vs. Erlang again recently. I wrote the first runroot backend[1] as a cnode + libevent. After months of chasing bugs and subtle race conditions, it still didn't work properly. I rewrote the ten month old project in eight hours. It went from 2k LOC in C to less than 600 LOC in Erlang (and it has more features than the 2k LOC C version!). [1]: Released at: http://bitbucket.org/mattsta/runroot-eco/ Don't repeat my mistakes. -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 peppe@REDACTED Thu Jan 14 12:02:00 2010 From: peppe@REDACTED (Peter Andersson) Date: Thu, 14 Jan 2010 12:02:00 +0100 Subject: [erlang-questions] Common Test questions In-Reply-To: References: <02b00857-cd8c-47e3-a741-766cda5d32a3@d20g2000yqh.googlegroups.com> Message-ID: <4B4EF9A8.8030607@erix.ericsson.se> Hi guys, Sorry for not replying sooner! 1) Common Test doesn't have a feature to "transparently" perform rpc calls, or spawn test case functions on a remote node. (Not currently anyway. The underlying Test Server has support for it, so it shouldn't actually be too hard to implement in CT.) You'd have to use rpc like you suggest (take a look at the ct_rpc module), or write test cases as stub functions that execute the tests on the target node (by means of spawn or rpc call). The latter requires that the suite module can be loaded on the target node though, and also, getting line number info at exit won't work. Another possibility, could maybe be to use the "Large Scale Testing" support (i.e. the ct_master interface). This runs distributed Common Test servers on arbitrary nodes in a network - controlled from one central master node. Read about it in the user's guide (and/or contact me with questions). 2) There are two ways to do this: Use the end_per_testcase/2 function, like Vasilij suggests. This is the best choice if you need to get the result of your operation into the logs (or even have it fail the test case). The second option would be to plug in an event handler that receives tc_done events and performs your operation after each test case (see the Event Handling chapter in the user's guide). /Peter Erlang/OTP, Ericsson AB Vasilij Savin wrote: > 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 B.Candler@REDACTED Thu Jan 14 12:02:50 2010 From: B.Candler@REDACTED (Brian Candler) Date: Thu, 14 Jan 2010 11:02:50 +0000 Subject: crypt(3) password hashing? Message-ID: <20100114110250.GA7065@uk.tiscali.com> Does erlang have an equivalent to crypt(3), to calculate password hashes like these? >> "test".crypt("aa") => "aaqPiZY5xR5l." >> "test".crypt("$1$aaaaaaaa") => "$1$aaaaaaaa$lWxWtPmiNjS/cwJnGm6fe0" I can't find it in the crypto app. I also googled around; I found the same question asked at http://forums.pragprog.com/forums/27/topics/391 but unfortunately no direct answer was given. Thanks, Brian. From lucevers@REDACTED Thu Jan 14 12:24:10 2010 From: lucevers@REDACTED (Luc Evers) Date: Thu, 14 Jan 2010 12:24:10 +0100 Subject: SSH client example Message-ID: I'm looking for a working Erlang example: 'SSH request to a server (Linux) en starts a shell command' . Found one example: http://easyerl.blogspot.com/2007/11/experimenting-with-erlang-ssh-support.htmlbut this is not working. I got a question from the system to connect [y/n] , than the console blocked. Before starting the SSH client I needed to start: crypto:start(). ssh:start(). Has somebody experience with the SSH modules? Luc. From anton.krasovsky@REDACTED Thu Jan 14 12:48:19 2010 From: anton.krasovsky@REDACTED (Anton Krasovsky) Date: Thu, 14 Jan 2010 11:48:19 +0000 Subject: [erlang-questions] SSH client example In-Reply-To: References: Message-ID: <46167e6a1001140348g48ca820cy30c580d88c085e73@mail.gmail.com> I played a bit with ssh module. Have a look at the source attached. Regards, Anton On Thu, Jan 14, 2010 at 11:24 AM, Luc Evers wrote: > ? I'm looking for a working Erlang example: ?'SSH request to a server > (Linux) en starts a shell command' . > ? Found one example: > http://easyerl.blogspot.com/2007/11/experimenting-with-erlang-ssh-support.htmlbut > this is not working. > ?I got a question from the system to connect [y/n] , than the console > blocked. > > ? Before starting the SSH client I needed to start: > > ?crypto:start(). > ?ssh:start(). > > > ?Has somebody experience with the SSH modules? > > > ?Luc. > -------------- next part -------------- A non-text attachment was scrubbed... Name: mm_ssh.erl Type: application/octet-stream Size: 11162 bytes Desc: not available URL: From peppe@REDACTED Thu Jan 14 15:01:05 2010 From: peppe@REDACTED (Peter Andersson) Date: Thu, 14 Jan 2010 15:01:05 +0100 Subject: [erlang-questions] reading config value from system env in common test In-Reply-To: References: Message-ID: <4B4F23A1.1080406@erix.ericsson.se> Hi Aeolus, Sorry, I don't really understand what it is you want to do. The CT_INCLUDE_PATH variable is used to specify directories with header files (for the test suite compilation) and has nothing to do with config files. When you say config values, do you mean Common Test start options, like the terms in a test specification? Could you provide an example maybe? Best regards, Peter Erlang/OTP, Ericsson AB Aeolus wrote: > 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 > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From bernie@REDACTED Thu Jan 14 16:01:45 2010 From: bernie@REDACTED (Bernard Duggan) Date: Thu, 14 Jan 2010 10:01:45 -0500 Subject: [erlang-questions] Mnesia activity callback system context In-Reply-To: References: <4B4E49B2.9070501@m5net.com> <4B4E535A.7030003@erlang-consulting.com> Message-ID: <4B4F31D9.4010404@m5net.com> Great, thanks for the answers Ulf and Paul :) Looks like the process dictionary is the way to go for the moment. Cheers, Bernard From bernie@REDACTED Thu Jan 14 16:01:59 2010 From: bernie@REDACTED (Bernard Duggan) Date: Thu, 14 Jan 2010 10:01:59 -0500 Subject: [erlang-questions] Mnesia activity callback system context In-Reply-To: References: <4B4E49B2.9070501@m5net.com> <4B4E535A.7030003@erlang-consulting.com> Message-ID: <4B4F31E7.90608@m5net.com> Great, thanks for the answers Ulf and Paul :) Looks like the process dictionary is the way to go for the moment. Cheers, Bernard From attila.r.nohl@REDACTED Thu Jan 14 16:35:31 2010 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Thu, 14 Jan 2010 16:35:31 +0100 Subject: [erlang-questions] Non-reproducible bug on a live erlang system In-Reply-To: References: Message-ID: <401d3ba31001140735v690c3f44l9fa6969d315eb502@mail.gmail.com> 2010/1/14, Kaiduan Xie : > Hi, all, > > Consider the following case, you have a live/busy Erlang system in > production which handles thousands of transactions per second and > millions of users, and customer reported a non-reproducible bug. The > problem is non-reproducible, or intermittent, or very hard to > reproduce in live system and in lab. Does this bug involve a crash report with a stack trace? You can always add some assert-like statements (i.e. if you know that a variable must not bound to the 'undefined' atom at a certain point in the code, you can add something like 'Variable /= undefined') where you think something is wrong. From michael.santos@REDACTED Thu Jan 14 16:50:17 2010 From: michael.santos@REDACTED (Michael Santos) Date: Thu, 14 Jan 2010 10:50:17 -0500 Subject: [erlang-questions] crypt(3) password hashing? In-Reply-To: <20100114110250.GA7065@uk.tiscali.com> References: <20100114110250.GA7065@uk.tiscali.com> Message-ID: <20100114155017.GA32613@ecn.lan> On Thu, Jan 14, 2010 at 11:02:50AM +0000, Brian Candler wrote: > Does erlang have an equivalent to crypt(3), to calculate password hashes > like these? > > >> "test".crypt("aa") > => "aaqPiZY5xR5l." > >> "test".crypt("$1$aaaaaaaa") > => "$1$aaaaaaaa$lWxWtPmiNjS/cwJnGm6fe0" > > I can't find it in the crypto app. I also googled around; I found the same > question asked at > http://forums.pragprog.com/forums/27/topics/391 > but unfortunately no direct answer was given. Not that I know of (which isn't saying much). But using NIF's, you can create an Erlang wrapper around crypt(): http://github.com/msantos/crypt 1> crypt:crypt("test","aa"). "aaqPiZY5xR5l." 2> crypt:crypt("test","$1$aaaaaaaa"). "$1$aaaaaaaa$lWxWtPmiNjS/cwJnGm6fe0" 3> crypt:crypt("test","$6$aaaaaaaa"). "$6$aaaaaaaa$HREHv6TuSmUS/7spCDO5Js3ssSZ6.iwVkUoVtatJUhJDKVmERrRKBTolrPMub2s5dX6IEjZg6d6wZzFRlidV41" It'd be nice to have an Erlang version though, maybe a project for another time. From gsmyth@REDACTED Thu Jan 14 16:59:42 2010 From: gsmyth@REDACTED (Greg Smyth) Date: Thu, 14 Jan 2010 15:59:42 +0000 Subject: Use of http:request Message-ID: <361b4e9d1001140759j1379999dqea4f383fa212bd59@mail.gmail.com> Hi all, I'm having a bit of a problem understanding why http:request is returning "{error,nxdomain}" - whenever the box seems to resolve properly via inet:gethostbyname:- 5> inet:gethostbyname("webserver001.cluster1.company.com"). {ok,{hostent,"webserver001.cluster1.company.com",[],inet,4, [{10,129,21,101}]}} 6> http:request("http://webserver001.cluster1.company.com"). {error,nxdomain} other addresses (such as google.com), seem to request fine, as does requesting directly via IP:- 7> http:request("http://10.129.21.101"). {ok,{{"HTTP/1.1",200,"OK"}, [{"cache-control", I've checked my /etc/hosts file - no entries in there apart from localhost.... Any ideas? Cheers, Greg From kaiduanx@REDACTED Thu Jan 14 17:25:47 2010 From: kaiduanx@REDACTED (Kaiduan Xie) Date: Thu, 14 Jan 2010 11:25:47 -0500 Subject: [erlang-questions] Non-reproducible bug on a live erlang system In-Reply-To: <401d3ba31001140735v690c3f44l9fa6969d315eb502@mail.gmail.com> References: <401d3ba31001140735v690c3f44l9fa6969d315eb502@mail.gmail.com> Message-ID: Thanks Jayson and Attila for throwing light on this. To be more specific, this is a call processing system, it processes incoming message, and sends messages out. Customer reports call failure, and it does not generate crash report, it is a programming logic error. As I mentioned, this is a non-reproducible issue, or hard reproducible issue. 1. If this only happens to a particular user, then erlang built-in trace can help on this. 2. Otherwise, what to do? Has anyone encountered this before? How you solve it? Thanks, kaiduan On Thu, Jan 14, 2010 at 10:35 AM, Attila Rajmund Nohl wrote: > 2010/1/14, Kaiduan Xie : >> Hi, all, >> >> Consider the following case, you have a live/busy Erlang system in >> production which handles thousands of transactions per second and >> millions of users, and customer reported a non-reproducible bug. The >> problem is non-reproducible, or intermittent, or very hard to >> reproduce in live system and in lab. > > Does this bug involve a crash report with a stack trace? You can > always add some assert-like statements (i.e. if you know that a > variable must not bound to the 'undefined' atom at a certain point in > the code, you can add something like 'Variable /= undefined') where > you think something is wrong. > From clist@REDACTED Thu Jan 14 17:56:28 2010 From: clist@REDACTED (Angel J. Alvarez Miguel) Date: Thu, 14 Jan 2010 17:56:28 +0100 Subject: [erlang-questions] Non-reproducible bug on a live erlang system In-Reply-To: References: <401d3ba31001140735v690c3f44l9fa6969d315eb502@mail.gmail.com> Message-ID: <201001141756.29014.clist@uah.es> On Jueves, 14 de Enero de 2010 17:25:47 Kaiduan Xie escribi?: > Thanks Jayson and Attila for throwing light on this. > > To be more specific, this is a call processing system, it processes > incoming message, and sends messages out. Customer reports call > failure, and it does not generate crash report, it is a programming > logic error. As I mentioned, this is a non-reproducible issue, or hard > reproducible issue. > > 1. If this only happens to a particular user, then erlang built-in > trace can help on this. > > 2. Otherwise, what to do? > > Has anyone encountered this before? How you solve it? > > Thanks, > > kaiduan > > On Thu, Jan 14, 2010 at 10:35 AM, Attila Rajmund Nohl > > wrote: > > 2010/1/14, Kaiduan Xie : > >> Hi, all, > >> > >> Consider the following case, you have a live/busy Erlang system in > >> production which handles thousands of transactions per second and > >> millions of users, and customer reported a non-reproducible bug. The > >> problem is non-reproducible, or intermittent, or very hard to > >> reproduce in live system and in lab. > > > > Does this bug involve a crash report with a stack trace? You can > > always add some assert-like statements (i.e. if you know that a > > variable must not bound to the 'undefined' atom at a certain point in > > the code, you can add something like 'Variable /= undefined') where > > you think something is wrong. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org "A software bug is the common term used to describe an error, flaw, mistake, failure, or fault in a computer program or system that produces an incorrect or unexpected result, or causes it to behave in unintended ways." A missbehaving system can still be (or pretend to be ) fully funtional in the sense that no exceptions are triggered. Im with others that you need to make more assertions on the code just to let the erlang runtime trigger the faulty condition. Holes in the software specifications allow (Type 1?) errors that are dificult to trap. The mere fact that the system still handle millions of users without severe degradati?n makes clear this is the case. I just remember some discussion on patterns like case file:open(..) of {ok,Fd} -> ... true; -> end vs the (I think) more idiomatic (prolog inherited?) {ok,Fd} = file:open()... where the former is more perhaps more flexible (and prone to missbehaving) the latter is rigid and safer (and needs a "try ... catch" container to deal with errors on the same process or another process to wath for errors). /Angel From tuncer.ayaz@REDACTED Thu Jan 14 18:37:14 2010 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Thu, 14 Jan 2010 18:37:14 +0100 Subject: [erlang-questions] crypt(3) password hashing? In-Reply-To: <20100114155017.GA32613@ecn.lan> References: <20100114110250.GA7065@uk.tiscali.com> <20100114155017.GA32613@ecn.lan> Message-ID: <4ac8254d1001140937k55514b65nc99e73f2a3f649ef@mail.gmail.com> On Thu, Jan 14, 2010 at 4:50 PM, Michael Santos wrote: > On Thu, Jan 14, 2010 at 11:02:50AM +0000, Brian Candler wrote: >> Does erlang have an equivalent to crypt(3), to calculate password hashes >> like these? >> >> >> "test".crypt("aa") >> => "aaqPiZY5xR5l." >> >> "test".crypt("$1$aaaaaaaa") >> => "$1$aaaaaaaa$lWxWtPmiNjS/cwJnGm6fe0" >> >> I can't find it in the crypto app. I also googled around; I found the same >> question asked at >> http://forums.pragprog.com/forums/27/topics/391 >> but unfortunately no direct answer was given. > > Not that I know of (which isn't saying much). But using NIF's, you can > create an Erlang wrapper around crypt(): > > http://github.com/msantos/crypt As an alternative take a look at Hunter Morris' bcrypt wrapper: http://github.com/skarab/erlang-bcrypt > 1> crypt:crypt("test","aa"). > "aaqPiZY5xR5l." > 2> crypt:crypt("test","$1$aaaaaaaa"). > "$1$aaaaaaaa$lWxWtPmiNjS/cwJnGm6fe0" > 3> crypt:crypt("test","$6$aaaaaaaa"). > "$6$aaaaaaaa$HREHv6TuSmUS/7spCDO5Js3ssSZ6.iwVkUoVtatJUhJDKVmERrRKBTolrPMub2s5dX6IEjZg6d6wZzFRlidV41" > > It'd be nice to have an Erlang version though, maybe a project for > another time. From kaiduanx@REDACTED Thu Jan 14 19:38:55 2010 From: kaiduanx@REDACTED (Kaiduan Xie) Date: Thu, 14 Jan 2010 13:38:55 -0500 Subject: [erlang-questions] Non-reproducible bug on a live erlang system In-Reply-To: <201001141756.29014.clist@uah.es> References: <401d3ba31001140735v690c3f44l9fa6969d315eb502@mail.gmail.com> <201001141756.29014.clist@uah.es> Message-ID: "Im with others that you need to make more assertions on the code just to let the erlang runtime trigger the faulty condition." Very good point, Angel, just let it crash! kaiduan 2010/1/14 Angel J. Alvarez Miguel : > On Jueves, 14 de Enero de 2010 17:25:47 Kaiduan Xie escribi?: >> Thanks Jayson and Attila for throwing light on this. >> >> To be more specific, this is a call processing system, it processes >> incoming message, and sends messages out. Customer reports call >> failure, and it does not generate crash report, it is a programming >> logic error. As I mentioned, this is a non-reproducible issue, or hard >> reproducible issue. >> >> 1. If this only happens to a particular user, then erlang built-in >> trace can help on this. >> >> 2. Otherwise, what to do? >> >> Has anyone encountered this before? How you solve it? >> >> Thanks, >> >> kaiduan >> >> On Thu, Jan 14, 2010 at 10:35 AM, Attila Rajmund Nohl >> >> wrote: >> > 2010/1/14, Kaiduan Xie : >> >> Hi, all, >> >> >> >> Consider the following case, you have a live/busy Erlang system in >> >> production which handles thousands of transactions per second and >> >> millions of users, and customer reported a non-reproducible bug. The >> >> problem is non-reproducible, or intermittent, or very hard to >> >> reproduce in live system and in lab. >> > >> > Does this bug involve a crash report with a stack trace? You can >> > always add some assert-like statements (i.e. if you know that a >> > variable must not bound to the 'undefined' atom at a certain point in >> > the code, you can add something like 'Variable /= undefined') where >> > you think something is wrong. >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org > > "A software bug is the common term used to describe an error, flaw, mistake, > failure, or fault in a computer program or system that produces an incorrect > or unexpected result, or causes it to behave in unintended ways." > > > A missbehaving system can still be (or pretend to be ) fully funtional in the > sense that no exceptions are triggered. Im with others that you need to make > more assertions on the code just to let the erlang runtime trigger the faulty > condition. > > Holes in the software specifications allow (Type 1?) errors that are dificult > to trap. The mere fact that the system still handle millions of users without > severe degradati?n makes clear this is the case. > > I just remember some discussion on patterns like > > case file:open(..) of > ? ? ? ?{ok,Fd} -> ... > ? ? ? ?true; -> > end > > vs the (I think) more idiomatic (prolog inherited?) > {ok,Fd} = file:open()... > > where the former is more perhaps more flexible (and prone to missbehaving) the > latter is rigid and safer (and needs a "try ... catch" container to deal with > errors on the same process or another process to wath for errors). > > /Angel > > > > > > > > > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From steve.e.123@REDACTED Thu Jan 14 20:12:56 2010 From: steve.e.123@REDACTED (steve) Date: Thu, 14 Jan 2010 14:12:56 -0500 Subject: Bug in OTP distributed app failover/takeover? Message-ID: <4cb4a7bf1001141112t6d71f61cnae2effce3074b7c6@mail.gmail.com> Hi all, Posted this one a few days ago and got no takers. I'm upping the ante and suggesting that there is a bug in how OTP application takeover currently behaves and giving some sample code (see attached). As I mentioned before (can it truly be that nobody was listening to this super duper important topic?): it appears that application takeover requires that all nodes be up for takeover to work without crashing the node that is attempting the takeover. Which would imply that takeover doesn't tolerate network partitions. Or to say it another way: In a 3 node OTP distributed application: if n1 and n2 are down and n1 (the high priority node) comes back up, n1 crashes saying that one of its supervised gen_servers is already started (which really shouldn't be true). Heart won't help us because n1 does something really bad to n3 when it crashes: it stops the application on n3. Ouch. But, if n3 and n2 are both up and n1 comes back online, takeover happens perfectly. Wouldn't most agree that the expected behavior would be that takeover would happen without a crash if one of the nodes was still down or partitioned (it's kinda the whole point)? I've attached a sample app. To see the the trouble in action start three shells and run the start script in each like this ./start.sh n1, ./start.sh n2 etc.. Kill n1 and n2 and restart n1. You should see n1 crash and n3 stop the app. It's worth noting that heart would eventually restart the application on n1 and n3 does eventually rejoin without having to be restarted, but it would appear that the whole app would be down for some time. Bug? Feature? Bug that was once a feature? I'm still holding out hope that I've misunderstood something or misconfigured something. Or is there something simple I can do to make this work the way one would expect? Someone please enlighten me. Your erlang comrade, Steve -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: dist.tar.gz Type: application/x-gzip Size: 56165 bytes Desc: not available URL: From B.Candler@REDACTED Thu Jan 14 21:00:55 2010 From: B.Candler@REDACTED (Brian Candler) Date: Thu, 14 Jan 2010 20:00:55 +0000 Subject: [erlang-questions] crypt(3) password hashing? In-Reply-To: <20100114155017.GA32613@ecn.lan> References: <20100114155017.GA32613@ecn.lan> Message-ID: <20100114200055.GA7951@uk.tiscali.com> On Thu, Jan 14, 2010 at 10:50:17AM -0500, Michael Santos wrote: > Not that I know of (which isn't saying much). But using NIF's, you can > create an Erlang wrapper around crypt(): > > http://github.com/msantos/crypt That's a very nice example of NIFs, thank you. From clist@REDACTED Thu Jan 14 22:01:50 2010 From: clist@REDACTED (Angel J. Alvarez Miguel) Date: Thu, 14 Jan 2010 22:01:50 +0100 Subject: [erlang-questions] Non-reproducible bug on a live erlang system In-Reply-To: References: <201001141756.29014.clist@uah.es> Message-ID: <201001142201.50258.clist@uah.es> Well, erlang is aimed at "a let it crash" if its sounds hard to you just blame Joe!! The well know second part should be "and let it recover" (Joe said). Consider your call manager acepting calls where the billing information (provided form some other external system) is inacurate or incomplete. Well, the users will be happily able to make conference calls with being charged for and the system is pretty usable so "where is the problem?? :-P ?Why is this still running?" because unintendended behaviour has to be handled as exceptions so you can recover in a structured manner. Before erlang, you have to program defensively, trying to catch faulty conditions before they catch you. yesterday ive to restart a OC4j container because a "max process reached" strange error from ORACLE JDBC unhandled trougth a very deep nested class Java App. No one developer care to catch those exceptions... Just blame the DBA for lacking infinite file descriptors available!!! After erlang only you have to recover appropiately from those situations not covered on the intended behaviour by converting them on proper exceptions or runtime-failures. Proper error handling becomes a tool just like IDEs and you have to learn how to use them properly. /Angel On Jueves, 14 de Enero de 2010 19:38:55 Kaiduan Xie escribi?: > "Im with others that you need to make > more assertions on the code just to let the erlang runtime trigger the > faulty condition." > > Very good point, Angel, just let it crash! > > kaiduan > > 2010/1/14 Angel J. Alvarez Miguel : > > On Jueves, 14 de Enero de 2010 17:25:47 Kaiduan Xie escribi?: > >> Thanks Jayson and Attila for throwing light on this. > >> > >> To be more specific, this is a call processing system, it processes > >> incoming message, and sends messages out. Customer reports call > >> failure, and it does not generate crash report, it is a programming > >> logic error. As I mentioned, this is a non-reproducible issue, or hard > >> reproducible issue. > >> > >> 1. If this only happens to a particular user, then erlang built-in > >> trace can help on this. > >> > >> 2. Otherwise, what to do? > >> > >> Has anyone encountered this before? How you solve it? > >> > >> Thanks, > >> > >> kaiduan > >> > >> On Thu, Jan 14, 2010 at 10:35 AM, Attila Rajmund Nohl > >> > >> wrote: > >> > 2010/1/14, Kaiduan Xie : > >> >> Hi, all, > >> >> > >> >> Consider the following case, you have a live/busy Erlang system in > >> >> production which handles thousands of transactions per second and > >> >> millions of users, and customer reported a non-reproducible bug. The > >> >> problem is non-reproducible, or intermittent, or very hard to > >> >> reproduce in live system and in lab. > >> > > >> > Does this bug involve a crash report with a stack trace? You can > >> > always add some assert-like statements (i.e. if you know that a > >> > variable must not bound to the 'undefined' atom at a certain point in > >> > the code, you can add something like 'Variable /= undefined') where > >> > you think something is wrong. > >> > >> ________________________________________________________________ > >> erlang-questions mailing list. See http://www.erlang.org/faq.html > >> erlang-questions (at) erlang.org > > > > "A software bug is the common term used to describe an error, flaw, > > mistake, failure, or fault in a computer program or system that produces > > an incorrect or unexpected result, or causes it to behave in unintended > > ways." > > > > > > A missbehaving system can still be (or pretend to be ) fully funtional in > > the sense that no exceptions are triggered. Im with others that you need > > to make more assertions on the code just to let the erlang runtime > > trigger the faulty condition. > > > > Holes in the software specifications allow (Type 1?) errors that are > > dificult to trap. The mere fact that the system still handle millions of > > users without severe degradati?n makes clear this is the case. > > > > I just remember some discussion on patterns like > > > > case file:open(..) of > > {ok,Fd} -> ... > > true; -> > > end > > > > vs the (I think) more idiomatic (prolog inherited?) > > {ok,Fd} = file:open()... > > > > where the former is more perhaps more flexible (and prone to > > missbehaving) the latter is rigid and safer (and needs a "try ... catch" > > container to deal with errors on the same process or another process to > > wath for errors). > > > > /Angel > > > > > > > > > > > > > > > > > > > > > > > > ________________________________________________________________ > > erlang-questions mailing list. See http://www.erlang.org/faq.html > > erlang-questions (at) erlang.org > From paul.mason@REDACTED Thu Jan 14 22:37:00 2010 From: paul.mason@REDACTED (Paul Mason) Date: Thu, 14 Jan 2010 15:37:00 -0600 Subject: Mnesia transform_table during release Message-ID: <8023A44E-5D79-483E-9EF4-3A39457D5D6A@epicadvertising.com> What is the correct method for transforming an mnesia table during a release? What would the appup / relup entry look like? Where does the mnesia:transform_table() call get executed (either conceptually .. or actually)? Are there any documentation on this process? From tomas.abrahamsson@REDACTED Thu Jan 14 23:52:01 2010 From: tomas.abrahamsson@REDACTED (Tomas Abrahamsson) Date: Thu, 14 Jan 2010 23:52:01 +0100 Subject: [erlang-questions] Use of http:request In-Reply-To: <361b4e9d1001140759j1379999dqea4f383fa212bd59@mail.gmail.com> References: <361b4e9d1001140759j1379999dqea4f383fa212bd59@mail.gmail.com> Message-ID: > I'm having a bit of a problem understanding why http:request is > returning "{error,nxdomain}" - whenever the box seems to resolve > properly via inet:gethostbyname:- What version of Erlang are you running? This has happened to me with R12B-5 (inets-5.0.12), I think, but I cannot reproduce it with the R13B02 (inets-5.1.3) I currently have at hand. The problem in my case was that the web server had both an ipv6 address and an ipv4 address, and I didn't have any ipv6 networking properly set up, and the http:request in R12B-5 by default tried first ipv6 then ipv4. So it found an ipv6 address, couldn't reach it and ended up with an {error,enetunreach}. You could try to run "dig AAAA webserver001.cluster1.company.com" or inet:gethostbyname("webserver001.cluster1.company.com", inet6). to see if it has an ipv6 address. In my case it was the www.ida.liu.se that I tried to reach. If this is the problem for you, then you may try http:set_options([{ipv6,disabled}]). BRs Tomas From vasilij.savin@REDACTED Fri Jan 15 09:10:18 2010 From: vasilij.savin@REDACTED (Vasilij Savin) Date: Fri, 15 Jan 2010 09:10:18 +0100 Subject: Running Erlang on Android Message-ID: Hello everyone, I have tried googling, but could not find anything remotely related. So have you tried to run Erlang on Android or there are some limitations that prevent that? Regards, Vasilij Savin From gsmyth@REDACTED Fri Jan 15 12:06:12 2010 From: gsmyth@REDACTED (Greg Smyth) Date: Fri, 15 Jan 2010 11:06:12 +0000 Subject: [erlang-questions] Use of http:request In-Reply-To: References: <361b4e9d1001140759j1379999dqea4f383fa212bd59@mail.gmail.com> Message-ID: <361b4e9d1001150306v1755f165r41e2886cc8d7f0ba@mail.gmail.com> On Thu, Jan 14, 2010 at 10:52 PM, Tomas Abrahamsson wrote: >> I'm having a bit of a problem understanding why http:request is >> returning "{error,nxdomain}" - whenever the box seems to resolve >> properly via inet:gethostbyname:- > > What version of Erlang are you running? I have access to 2 machines, one running R12B-5 (inets-5.0.12), and one running R13B-1 (inets-5.0.13) - both are currently exhibiting the same failure with http:request.... > > This has happened to me with R12B-5 (inets-5.0.12), I think, but I cannot > reproduce it with the R13B02 (inets-5.1.3) I currently have at hand. > > The problem in my case was that the web server had both an ipv6 > address and an ipv4 address, and I didn't have any ipv6 networking > properly set up, and the http:request in R12B-5 by default tried first ipv6 > then ipv4. So it found an ipv6 address, couldn't reach it and ended up > with an {error,enetunreach}. > > You could try to run "dig AAAA webserver001.cluster1.company.com" > or inet:gethostbyname("webserver001.cluster1.company.com", inet6). > to see if it has an ipv6 address. In my case it was the www.ida.liu.se > that I tried to reach. This is where it gets interesting... :) I get an ipv6 address for the webserver returned from inet:gethostbyname in R13 - but not in R12 (and interestingly, not from a "dig AAAA" on either machine) > > If this is the problem for you, then you may try > http:set_options([{ipv6,disabled}]). Tried this on both machines - doesn't seem to make a difference for this particular case... Thanks for the help, Greg > > BRs > Tomas > From leap@REDACTED Fri Jan 15 12:56:01 2010 From: leap@REDACTED (Michael Turner) Date: Fri, 15 Jan 2010 11:56:01 +0000 Subject: Running Erlang on Android (like running sheep on electricity) In-Reply-To: Message-ID: Erlang needs something adequately Unix-like. Erlang is a C-coded app, so you pretty much need some approximation of the standard C library. Does Android deliver? Android is Linux, but not really. Android is a Java platform. But not even that, in the "write once run anywhere" sense. http://arstechnica.com/open-source/reviews/2009/02/an-introduction-to-google-android-for-developers.ars "Although Android is built on top of the Linux kernel, the platform has very little in common with the conventional desktop Linux stack. In fact, during a presentation at the Google IO conference, Google engineer Patrick Brady stated unambiguously that Android is not Linux. "Much of the Android userspace operates within the constraints of Dalvik, Google's own custom Java virtual machine. Dalvik uses its own bytecode format called Dex, and is not compatible with J2ME or other Java runtime environments. Third-party Android applications are written in Java using Android's official APIs and widget toolkit. The Android SDK includes special compilation tools that will translate Java class files into Dex bytecode and generate an installation package that can be deployed on Android devices." Baffled? Call me a cynic, but have you looked at Google's P/E? It's ridiculously high. Something's gotta give eventually, and I think it'll be the numerator. But imagine you're high up in Google, with lots of stock options. Of course, you want your options to vest with a handsome profit. But that can't happen if the P part of the P/E drops down to something rational and un-exuberant. So you might promote all kinds of unlikely projects if you noticed (and how could you not?) that any thrusty new project associated with Google made many investors continue to think that Google might have The Next Big Thing. They all want to believe that anyway, of course, but spending what *seems* like lots of money signals to those investors that their belief is almost certainly justified. Maybe Ericcson should come out with an Erlang over TRON over ARM, for phones. They could call it Ndroid, right? When Google sued them for that name (a legal move that would do little more than generate valuable publicity for Ericsson), they could quickly change the name to ARMsTRONg. (After all, Intel *couldn't* sue them for that -- it's too late, Intel gave up on ARM, which they never really wanted anyway, since it just came as part of their winnings in some lawsuit.) Why, yes, I *did* used to work in Silicon Valley until I got sick to death of marketing/stock-manipulation/patent-infringement-claim headgames. How did you guess? -michael From max.lapshin@REDACTED Fri Jan 15 16:15:30 2010 From: max.lapshin@REDACTED (Max Lapshin) Date: Fri, 15 Jan 2010 18:15:30 +0300 Subject: Control erlang server under OS X Message-ID: I'm writing now Preference Pane for erlyvideo and think, how to control node. I need to start/stop it, restart and reconfigure. It seems to me, that easiest way is to connect to running erlang process via erl_interface and run commands via rpc:call From stondage123@REDACTED Fri Jan 15 18:17:25 2010 From: stondage123@REDACTED (Andrew Stone) Date: Fri, 15 Jan 2010 09:17:25 -0800 (PST) Subject: [erlang-questions] Re: Running Erlang on Android (like running sheep on electricity) In-Reply-To: References: Message-ID: <568324.84022.qm@web35906.mail.mud.yahoo.com> If you want a real Linux phone that can run Erlang, check out the Nokia N900. It runs the maemo platform which uses .deb packages. Of course Erlang needs to be ported but it looks like plenty of work is in progress. Here's one page I found with a quick search. http://thomas.apestaart.org/log/?p=1086 -Andrew ----- Original Message ---- From: Michael Turner To: Vasilij Savin ; Erlang-Questions Questions Sent: Fri, January 15, 2010 6:56:01 AM Subject: [erlang-questions] Re: Running Erlang on Android (like running sheep on electricity) Erlang needs something adequately Unix-like. Erlang is a C-coded app, so you pretty much need some approximation of the standard C library. Does Android deliver? Android is Linux, but not really. Android is a Java platform. But not even that, in the "write once run anywhere" sense. http://arstechnica.com/open-source/reviews/2009/02/an-introduction-to-google-android-for-developers.ars "Although Android is built on top of the Linux kernel, the platform has very little in common with the conventional desktop Linux stack. In fact, during a presentation at the Google IO conference, Google engineer Patrick Brady stated unambiguously that Android is not Linux. "Much of the Android userspace operates within the constraints of Dalvik, Google's own custom Java virtual machine. Dalvik uses its own bytecode format called Dex, and is not compatible with J2ME or other Java runtime environments. Third-party Android applications are written in Java using Android's official APIs and widget toolkit. The Android SDK includes special compilation tools that will translate Java class files into Dex bytecode and generate an installation package that can be deployed on Android devices." Baffled? Call me a cynic, but have you looked at Google's P/E? It's ridiculously high. Something's gotta give eventually, and I think it'll be the numerator. But imagine you're high up in Google, with lots of stock options. Of course, you want your options to vest with a handsome profit. But that can't happen if the P part of the P/E drops down to something rational and un-exuberant. So you might promote all kinds of unlikely projects if you noticed (and how could you not?) that any thrusty new project associated with Google made many investors continue to think that Google might have The Next Big Thing. They all want to believe that anyway, of course, but spending what *seems* like lots of money signals to those investors that their belief is almost certainly justified. Maybe Ericcson should come out with an Erlang over TRON over ARM, for phones. They could call it Ndroid, right? When Google sued them for that name (a legal move that would do little more than generate valuable publicity for Ericsson), they could quickly change the name to ARMsTRONg. (After all, Intel *couldn't* sue them for that -- it's too late, Intel gave up on ARM, which they never really wanted anyway, since it just came as part of their winnings in some lawsuit.) Why, yes, I *did* used to work in Silicon Valley until I got sick to death of marketing/stock-manipulation/patent-infringement-claim headgames. How did you guess? -michael ________________________________________________________________ erlang-questions mailing list. See http://www.erlang.org/faq.html erlang-questions (at) erlang.org From kagato@REDACTED Fri Jan 15 19:40:20 2010 From: kagato@REDACTED (Jayson Vantuyl) Date: Fri, 15 Jan 2010 10:40:20 -0800 Subject: [erlang-questions] Re: Running Erlang on Android (like running sheep on electricity) In-Reply-To: References: Message-ID: It appears that there is something that approximates libc on Android (even called libc.so). Here's a link to a guy that first built a minimal Debian install, then later figured out how to patch a project (in this case, Mono) to run natively. http://www.koushikdutta.com/2009/01/compiling-mono-under-android-build.html As much as I don't particularly care for what Google has done, Java, Python, Ruby, and .NET can run on Android. If Erlang doesn't, I don't think the reasons are so much technical as they are more a lack of time and desire to do it. In either case, let's not blame Google. That's an unnecessary excuse. Sent from my iPhone On Jan 15, 2010, at 3:56 AM, "Michael Turner" wrote: > > Erlang needs something adequately Unix-like. Erlang is a C-coded > app, so > you pretty much need some approximation of the standard C library. > Does > Android deliver? > > Android is Linux, but not really. Android is a Java platform. But > not > even that, in the "write once run anywhere" sense. > > http://arstechnica.com/open-source/reviews/2009/02/an-introduction-to-google-android-for-developers.ars > > "Although Android is built on top of the Linux kernel, the platform > has > very little in common with the conventional desktop Linux stack. In > fact, during a presentation at the Google IO conference, Google > engineer > Patrick Brady stated unambiguously that Android is not Linux. > > "Much of the Android userspace operates within the constraints of > Dalvik, Google's own custom Java virtual machine. Dalvik uses its own > bytecode format called Dex, and is not compatible with J2ME or other > Java runtime environments. Third-party Android applications are > written > in Java using Android's official APIs and widget toolkit. The Android > SDK includes special compilation tools that will translate Java class > files into Dex bytecode and generate an installation package that > can be > deployed on Android devices." > > Baffled? > > Call me a cynic, but have you looked at Google's P/E? It's > ridiculously high. Something's gotta give eventually, and I think > it'll be the numerator. But imagine you're high up in Google, with > lots of stock options. Of course, you want your options to vest > with a > handsome profit. But that can't happen if the P part of the P/E drops > down to something rational and un-exuberant. So you might promote all > kinds of unlikely projects if you noticed (and how could you not?) > that > any thrusty new project associated with Google made many investors > continue to think that Google might have The Next Big Thing. They all > want to believe that anyway, of course, but spending what *seems* like > lots of money signals to those investors that their belief is almost > certainly justified. > > Maybe Ericcson should come out with an Erlang over TRON over ARM, for > phones. They could call it Ndroid, right? When Google sued them for > that name (a legal move that would do little more than generate > valuable > publicity for Ericsson), they could quickly change the name to > ARMsTRONg. (After all, Intel *couldn't* sue them for that -- it's too > late, Intel gave up on ARM, which they never really wanted anyway, > since > it just came as part of their winnings in some lawsuit.) > > Why, yes, I *did* used to work in Silicon Valley until I got sick to > death of marketing/stock-manipulation/patent-infringement-claim > headgames. How did you guess? > > -michael > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From yogishb@REDACTED Fri Jan 15 22:24:28 2010 From: yogishb@REDACTED (Yogish Baliga) Date: Fri, 15 Jan 2010 13:24:28 -0800 (PST) Subject: inet:gethostbyname question Message-ID: <682273.7692.qm@web112607.mail.gq1.yahoo.com> Strange thing is happening with inet:gethostbyname(inet_db:gethostname()) in R13 release. inet_db:res_option(lookup). [dns,native,file]. inet:gethostbyname(inet_db:gethostname()) {error,nxdomain} inet_db:set_lookup([dns]). inet:gethostbyname(inet_db:gethostname()) {ok,{hostent,"gw06",[],inet,4,[{127,0,0,1}]}} Having lookup method to 3 elements [dns,native,file] is not working. If I set it to only "dns", it is working. Also noticed that inet_db:res_option(search). [] inet_db:res_option(domain). "example.com" Then I execute, inet_config:init(). This function is called by inet_db:start_link(), which is called by kernel:init(). After executing inet_config:init(), inet_db:res_option(search). ["sk1.example.com"]. inet_db:res_option(domain). "example.com". After executing inet_config:init(), order of lookup methods doesn't matter. As long as I have dns in the list, it works. inet:gethostbyname(inet_db:gethostname()). {ok,{hostent,"gw06.sk1.example.com",[],inet,4,[{127,0,0,1}]}} Any idea, why inet_config:init() called by kernel->inet_db:start_link() is not working as expected? Thanx, -- baliga "Point of view is worth 80 IQ points" --Alan Kay http://dudefrommangalore.blogspot.com/ From g@REDACTED Sat Jan 16 01:21:03 2010 From: g@REDACTED (Garrett Smith) Date: Fri, 15 Jan 2010 18:21:03 -0600 Subject: gen_event event handlers and supervisors Message-ID: It seems that in order to hook gen_event event handlers into an OTP supervisory tree, one must "wrap" them in a gen_server, adding them using the add_sup_handler and then handling the EXIT message by crashing, letting the supervisor handle the crash. Is the recommended approach for building fault tolerance into gen_event event handlers? If this is the case, it strikes me as something one would do 100% of the time in production settings -- i.e. who would ever tolerate the silent failure and unregistration of an event handler?? I'm curious how others handle this problem. Do you routinely create a gen_server to effectively plug the event handler into a supervisory tree? Or is there another predominating pattern that bypasses gen_event and accomplishes something similar (i.e. broadcast style event handling)? Garrett From kagato@REDACTED Sat Jan 16 02:17:32 2010 From: kagato@REDACTED (Jayson Vantuyl) Date: Fri, 15 Jan 2010 17:17:32 -0800 Subject: [erlang-questions] gen_event event handlers and supervisors In-Reply-To: References: Message-ID: I think part of the disconnect here is that gen_event is usually used across subsystems. For example, take the log handlers. The logging system doesn't know what the failure conditions are for any log handler that is plugged into it. In terms of maintaining system integrity, it's rarely a good idea to let another buggy module kill a central subsystem. Instead, you have the mechanism to notify the other subsystem and let it handle it. You'll rarely see the gen_event itself running under the same supervisor as one of these coordinating gen_server you describe. More concretely, take a look at LIBDIR/kernel-*/src/error_logger.erl and LIBDIR/sasl-*/src/sasl.erl. They don't use supervised handlers, but it illustrates how the gen_event (in this case registered as error_logger) is the nexus of a number of other systems (sasl, the default console handler, any logfiles you install). A logfile is a good example of why silently removing the logger makes sense. If the disk is full or becomes unavailable, that handler crashes, and removal is the only option that makes sense. I think that this use-case makes it pretty clear why there's that behavior. Interestingly, I don't see any supervised handlers (registered with add_sup_handler) in OTP itself, so I can't really refer you to any other cases where it's used. On Jan 15, 2010, at 4:21 PM, Garrett Smith wrote: > It seems that in order to hook gen_event event handlers into an OTP > supervisory tree, one must "wrap" them in a gen_server, adding them > using the add_sup_handler and then handling the EXIT message by > crashing, letting the supervisor handle the crash. > > Is the recommended approach for building fault tolerance into > gen_event event handlers? > > If this is the case, it strikes me as something one would do 100% of > the time in production settings -- i.e. who would ever tolerate the > silent failure and unregistration of an event handler?? > > I'm curious how others handle this problem. Do you routinely create a > gen_server to effectively plug the event handler into a supervisory > tree? Or is there another predominating pattern that bypasses > gen_event and accomplishes something similar (i.e. broadcast style > event handling)? > > Garrett > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From kagato@REDACTED Sat Jan 16 03:52:04 2010 From: kagato@REDACTED (Jayson Vantuyl) Date: Fri, 15 Jan 2010 18:52:04 -0800 Subject: Erlang and Event-Driven Programming Message-ID: <01FE96CA-9383-42FB-A1D6-D92B700AEE34@souja.net> One of the things that drove me to Erlang was that it neatly encapsulates event-driven programming. I loved writing code in Twisted and EventMachine, but I hated the mess of little blocks of code that it created. I realized during a discussion recently that the relation may not be obvious to someone who hasn't done either of those things before. So, I blogged about it. Enjoy: http://ta.gd/erlang_evented -- Jayson Vantuyl kagato@REDACTED From g@REDACTED Sat Jan 16 20:55:38 2010 From: g@REDACTED (Garrett Smith) Date: Sat, 16 Jan 2010 13:55:38 -0600 Subject: [erlang-questions] gen_event event handlers and supervisors In-Reply-To: References: Message-ID: Heh, I also missed the fact that event handlers /are not processes/ :) The look an awful lot like OTP process behaviors from the callback API, which threw me. So, nevermind ;) On Fri, Jan 15, 2010 at 7:17 PM, Jayson Vantuyl wrote: > I think part of the disconnect here is that gen_event is usually used across subsystems. ?For example, take the log handlers. ?The logging system doesn't know what the failure conditions are for any log handler that is plugged into it. ?In terms of maintaining system integrity, it's rarely a good idea to let another buggy module kill a central subsystem. ?Instead, you have the mechanism to notify the other subsystem and let it handle it. ?You'll rarely see the gen_event itself running under the same supervisor as one of these coordinating gen_server you describe. > > More concretely, take a look at LIBDIR/kernel-*/src/error_logger.erl and LIBDIR/sasl-*/src/sasl.erl. ?They don't use supervised handlers, but it illustrates how the gen_event (in this case registered as error_logger) is the nexus of a number of other systems (sasl, the default console handler, any logfiles you install). ?A logfile is a good example of why silently removing the logger makes sense. ?If the disk is full or becomes unavailable, that handler crashes, and removal is the only option that makes sense. ?I think that this use-case makes it pretty clear why there's that behavior. ?Interestingly, I don't see any supervised handlers (registered with add_sup_handler) in OTP itself, so I can't really refer you to any other cases where it's used. > > On Jan 15, 2010, at 4:21 PM, Garrett Smith wrote: > >> It seems that in order to hook gen_event event handlers into an OTP >> supervisory tree, one must "wrap" them in a gen_server, adding them >> using the add_sup_handler and then handling the EXIT message by >> crashing, letting the supervisor handle the crash. >> >> Is the recommended approach for building fault tolerance into >> gen_event event handlers? >> >> If this is the case, it strikes me as something one would do 100% of >> the time in production settings -- i.e. who would ever tolerate the >> silent failure and unregistration of an event handler?? >> >> I'm curious how others handle this problem. Do you routinely create a >> gen_server to effectively plug the event handler into a supervisory >> tree? Or is there another predominating pattern that bypasses >> gen_event and accomplishes something similar (i.e. broadcast style >> event handling)? >> >> Garrett >> >> ________________________________________________________________ >> 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 yoursurrogategod@REDACTED Sun Jan 17 07:30:02 2010 From: yoursurrogategod@REDACTED (Yves S. Garret) Date: Sat, 16 Jan 2010 22:30:02 -0800 (PST) Subject: Erlang and Event-Driven Programming In-Reply-To: <01FE96CA-9383-42FB-A1D6-D92B700AEE34@souja.net> References: <01FE96CA-9383-42FB-A1D6-D92B700AEE34@souja.net> Message-ID: Well, Erlang certainly does a good job of taking care of those details. On Jan 15, 9:52?pm, Jayson Vantuyl wrote: > One of the things that drove me to Erlang was that it neatly encapsulates event-driven programming. ?I loved writing code in Twisted and EventMachine, but I hated the mess of little blocks of code that it created. ?I realized during a discussion recently that the relation may not be obvious to someone who hasn't done either of those things before. ?So, I blogged about it. ?Enjoy: > > http://ta.gd/erlang_evented > > -- > Jayson Vantuyl > kag...@REDACTED From yoursurrogategod@REDACTED Sun Jan 17 07:31:24 2010 From: yoursurrogategod@REDACTED (Yves S. Garret) Date: Sat, 16 Jan 2010 22:31:24 -0800 (PST) Subject: Issues with compiling R13B03 Message-ID: <293b4141-e64f-4601-889f-a59e4451fe7c@k35g2000yqb.googlegroups.com> Hi, I posted about this in here before: http://forum.trapexit.org/viewtopic.php?t=17587 Here's the whole post: Ok, I tried configuring it and keep getting the same warning about not having ODBC (if possible, I'd like it to use PostgreSQL.) I found the below link and simply forged ahead, figuring that I could just set up a connection to a database client later on. https://www.cs.tcd.ie/~htewari/4D1/erlang/lib/odbc-0.9.4/doc/html/OdbcCompileUnix.html I did make and was greeted with this mess: Errors: make[3]: Entering directory `/home/ysg/Desktop/Documents/Development/ Erlang/VirtualMachines/otp_src_R13B03/lib/jinterface/java_src' set -e; set -x; \ case "make" in *clearmake*) tflag="-T";; *) tflag="";; esac; \ if test -f com/ericsson/otp/erlang/ignore_config_record.inf; then xflag=$tflag; fi; \ (cd com/ericsson/otp/erlang && make -f Makefile.otp $xflag opt) + tflag= + test -f com/ericsson/otp/erlang/ignore_config_record.inf + xflag= + cd com/ericsson/otp/erlang + make -f Makefile.otp opt make[4]: Entering directory `/home/ysg/Desktop/Documents/Development/ Erlang/VirtualMachines/otp_src_R13B03/lib/jinterface/java_src/com/ ericsson/otp/erlang' if [ ! -d "/home/ysg/Desktop/Documents/Development/Erlang/ VirtualMachines/otp_src_R13B03/lib/jinterface/priv/" ];then mkdir "/ home/ysg/Desktop/Documents/Development/Erlang/VirtualMachines/ otp_src_R13B03/lib/jinterface/priv/"; fi CLASSPATH=/home/ysg/Desktop/Documents/Development/Erlang/ VirtualMachines/otp_src_R13B03/lib/jinterface/java_src/ javac -d / home/ysg/Desktop/Documents/Development/Erlang/VirtualMachines/ otp_src_R13B03/lib/jinterface/priv/ OtpAuthException.java /home/ysg/Desktop/Documents/Development/Erlang/VirtualMachines/ otp_src_R13B03/lib/jinterface/java_src/com/ericsson/otp/erlang/ OtpException.java:24: warning: The serializable class OtpException does not declare a static final serialVersionUID field of type long public abstract class OtpException extends Exception { ^^^^^^^^^^^^ 1 problem (1 warning) CLASSPATH=/home/ysg/Desktop/Documents/Development/Erlang/ VirtualMachines/otp_src_R13B03/lib/jinterface/java_src/ javac -d / home/ysg/Desktop/Documents/Development/Erlang/VirtualMachines/ otp_src_R13B03/lib/jinterface/priv/ OtpErlangDecodeException.java OtpErlangDecodeException.java:28: warning: The serializable class OtpErlangDecodeException does not declare a static final serialVersionUID field of type long public class OtpErlangDecodeException extends OtpErlangException { ^^^^^^^^^^^^^^^^^^^^^^^^ /home/ysg/Desktop/Documents/Development/Erlang/VirtualMachines/ otp_src_R13B03/lib/jinterface/java_src/com/ericsson/otp/erlang/ OtpException.java:24: warning: The serializable class OtpException does not declare a static final serialVersionUID field of type long public abstract class OtpException extends Exception { ^^^^^^^^^^^^ 2 problems (2 warnings) CLASSPATH=/home/ysg/Desktop/Documents/Development/Erlang/ VirtualMachines/otp_src_R13B03/lib/jinterface/java_src/ javac -d / home/ysg/Desktop/Documents/Development/Erlang/VirtualMachines/ otp_src_R13B03/lib/jinterface/priv/ OtpErlangExit.java /home/ysg/Desktop/Documents/Development/Erlang/VirtualMachines/ otp_src_R13B03/lib/jinterface/java_src/com/ericsson/otp/erlang/ OtpException.java:24: warning: The serializable class OtpException does not declare a static final serialVersionUID field of type long public abstract class OtpException extends Exception { ^^^^^^^^^^^^ /home/ysg/Desktop/Documents/Development/Erlang/VirtualMachines/ otp_src_R13B03/lib/jinterface/java_src/com/ericsson/otp/erlang/ OtpErlangObject.java:174: warning: Unnecessary cast from byte to int abc[k] += ((int)b[j+0] & 0xFF) + ((int)b[j+1]<<8 & 0xFF00) ^^^^^^^^^^^ /home/ysg/Desktop/Documents/Development/Erlang/VirtualMachines/ otp_src_R13B03/lib/jinterface/java_src/com/ericsson/otp/erlang/ OtpErlangObject.java:174: warning: Unnecessary cast from byte to int abc[k] += ((int)b[j+0] & 0xFF) + ((int)b[j+1]<<8 & 0xFF00) ^^^^^^^^^^^ /home/ysg/Desktop/Documents/Development/Erlang/VirtualMachines/ otp_src_R13B03/lib/jinterface/java_src/com/ericsson/otp/erlang/ OtpErlangObject.java:175: warning: Unnecessary cast from byte to int + ((int)b[j+2]<<16 & 0xFF0000) + ((int)b[j+3]<<24); ^^^^^^^^^^^ /home/ysg/Desktop/Documents/Development/Erlang/VirtualMachines/ otp_src_R13B03/lib/jinterface/java_src/com/ericsson/otp/erlang/ OtpErlangObject.java:175: warning: Unnecessary cast from byte to int + ((int)b[j+2]<<16 & 0xFF0000) + ((int)b[j+3]<<24); ^^^^^^^^^^^ /home/ysg/Desktop/Documents/Development/Erlang/VirtualMachines/ otp_src_R13B03/lib/jinterface/java_src/com/ericsson/otp/erlang/ OtpErlangObject.java:181: warning: Unnecessary cast from byte to int abc[k] += (int)b[j]< References: <01FE96CA-9383-42FB-A1D6-D92B700AEE34@souja.net> Message-ID: <4B52DAEC.1070202@tmit.bme.hu> I agree that this certainly looks nicer than defining a callback. However this is not "event-driven", but more like "wait-for-that-driven". Code like this also results in all concurrent activities being blocked, as the selective receives involved will make all other messages queue up and wait. As soon as you need to handle concurrent events, you will end up implementing a common dispatcher with callbacks, just like in gen_servers. Zoltan. Yves S. Garret wrote: > Well, Erlang certainly does a good job of taking care of those > details. > > On Jan 15, 9:52 pm, Jayson Vantuyl wrote: > >> One of the things that drove me to Erlang was that it neatly encapsulates event-driven programming. I loved writing code in Twisted and EventMachine, but I hated the mess of little blocks of code that it created. I realized during a discussion recently that the relation may not be obvious to someone who hasn't done either of those things before. So, I blogged about it. Enjoy: >> >> http://ta.gd/erlang_evented >> >> -- >> Jayson Vantuyl >> kag...@REDACTED >> > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > > From kagato@REDACTED Sun Jan 17 10:42:34 2010 From: kagato@REDACTED (Jayson Vantuyl) Date: Sun, 17 Jan 2010 01:42:34 -0800 Subject: [erlang-questions] Re: Erlang and Event-Driven Programming In-Reply-To: <4B52DAEC.1070202@tmit.bme.hu> References: <01FE96CA-9383-42FB-A1D6-D92B700AEE34@souja.net> <4B52DAEC.1070202@tmit.bme.hu> Message-ID: <123ECCCA-5B63-4FAD-BA3F-9CAF1527BA12@souja.net> I suppose it's a matter of semantics. The vast majority of "event-driven" code you see these days isn't the "interrupt handler" pattern so much as reactor+deferred. I certainly didn't try to make much of a distinction. Good point nonetheless. On Jan 17, 2010, at 1:39 AM, Zoltan Lajos Kis wrote: > I agree that this certainly looks nicer than defining a callback. However this is not "event-driven", but more like "wait-for-that-driven". Code like this also results in all concurrent activities being blocked, as the selective receives involved will make all other messages queue up and wait. As soon as you need to handle concurrent events, you will end up implementing a common dispatcher with callbacks, just like in gen_servers. > > Zoltan. > > Yves S. Garret wrote: >> Well, Erlang certainly does a good job of taking care of those >> details. >> >> On Jan 15, 9:52 pm, Jayson Vantuyl wrote: >> >>> One of the things that drove me to Erlang was that it neatly encapsulates event-driven programming. I loved writing code in Twisted and EventMachine, but I hated the mess of little blocks of code that it created. I realized during a discussion recently that the relation may not be obvious to someone who hasn't done either of those things before. So, I blogged about it. Enjoy: >>> >>> http://ta.gd/erlang_evented >>> >>> -- >>> Jayson Vantuyl >>> kag...@REDACTED >>> >> >> ________________________________________________________________ >> 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 nick@REDACTED Sun Jan 17 19:32:30 2010 From: nick@REDACTED (Nick Gerakines) Date: Sun, 17 Jan 2010 10:32:30 -0800 Subject: SF Erlounge hosted by Powerset/Microsoft Message-ID: Thursday, February 11th, 2009 from 7:00 pm to 8:30 pm. The next SF Erlounge is just around the corner thanks to Powerset/Microsoft for providing the space. 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. Powerset A Microsoft Company 475 Brannan Street, Suite 330 San Francisco, CA 94107 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. Plan on parking in the street or taking public transit. 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 billtohara@REDACTED Mon Jan 18 05:10:11 2010 From: billtohara@REDACTED (Bill O'Hara) Date: Sun, 17 Jan 2010 20:10:11 -0800 Subject: remote message send latencies on low-latency 10Gb/s hardware Message-ID: Hi, I wonder if anyone has benchmarked Erlang messaging performance on low-latency 10Gb setups, such as machines with Solarflare NICs using OpenOnload talking via Arista 10Gb switches? Given server to switch to server latencies in the single digit microseconds, can Erlang remote messaging achieve near this? I guess a ping-pong of 15ms or so would be the best case (assuming 6ms one-way latency plus some processing time). Thanks B. From fritchie@REDACTED Mon Jan 18 07:26:40 2010 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Mon, 18 Jan 2010 00:26:40 -0600 Subject: [erlang-questions] Non-reproducible bug on a live erlang system In-Reply-To: Message of "Thu, 14 Jan 2010 16:35:31 +0100." <401d3ba31001140735v690c3f44l9fa6969d315eb502@mail.gmail.com> Message-ID: <91206.1263796000@snookles.snookles.com> Attila Rajmund Nohl wrote: arn> You can always add some assert-like statements (i.e. if you know arn> that a variable must not bound to the 'undefined' atom at a certain arn> point in the code, you can add something like 'Variable /= arn> undefined') where you think something is wrong. Er, a small correction, I think you meant 'Variable = undefined'. I fyou use '/=', you end up with a boolean expression and nothing to cause a crash if the value is false. You could use: true = (Variable /= undefined) ... but that's nearly 48% more code. :-) -Scott From navaneethanit@REDACTED Mon Jan 18 10:35:54 2010 From: navaneethanit@REDACTED (Navaneethan) Date: Mon, 18 Jan 2010 15:05:54 +0530 Subject: Installation problem in fedora 9 Message-ID: <4dde26ad1001180135p69f25df0na726759dd4d80e7b@mail.gmail.com> Hi friends, I wanna to install the erlang in my fedora 9 but unfortunately i am getting an error *[root@REDACTED ~]# yum install erlang > Loaded plugins: refresh-packagekit > Could not retrieve mirrorlist > http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-9&arch=i386 error > was > [Errno 4] IOError: resolution')> > Error: Cannot retrieve repository metadata (repomd.xml) for repository: > fedora. Please verify its path and try again > [root@REDACTED ~]# > * i couldn't able to find the solution .. -- regards, NavaTux It blogs @ http://navaspot.wordpress.com From lemenkov@REDACTED Mon Jan 18 10:42:39 2010 From: lemenkov@REDACTED (Peter Lemenkov) Date: Mon, 18 Jan 2010 12:42:39 +0300 Subject: [erlang-questions] Installation problem in fedora 9 In-Reply-To: <4dde26ad1001180135p69f25df0na726759dd4d80e7b@mail.gmail.com> References: <4dde26ad1001180135p69f25df0na726759dd4d80e7b@mail.gmail.com> Message-ID: Hello All! 2010/1/18 Navaneethan : > Hi friends, > > ? ? ? ? ?I wanna to install the erlang in my fedora 9 but unfortunately i > am getting an error Fedora 9 is deprecated and no longer supported by the community. -- With best regards, Peter Lemenkov. From seancribbs@REDACTED Mon Jan 18 15:15:58 2010 From: seancribbs@REDACTED (Sean Cribbs) Date: Mon, 18 Jan 2010 09:15:58 -0500 Subject: proplists vs. dicts memory usage Message-ID: <4B546D1E.4040203@gmail.com> Is there information somewhere on the memory requirements of proplists vs. dicts for small numbers of keys (< 100)? If not, is there a nice way to measure memory usage at runtime? I'm trying to determine whether switching from a dict to a proplist will save space. If the difference is negligible, I'll have to figure out some other solution (I'm guessing this is the answer). Cheers, Sean Cribbs From kenneth.lundin@REDACTED Mon Jan 18 15:33:26 2010 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Mon, 18 Jan 2010 15:33:26 +0100 Subject: [erlang-questions] proplists vs. dicts memory usage In-Reply-To: <4B546D1E.4040203@gmail.com> References: <4B546D1E.4040203@gmail.com> Message-ID: You can measure how much space an Erlang term takes internally in the Erlang VM with the function erts_debug:flat_size(Term). It takes any Erlang term as input and returns the number of machine-words needed to store the term. I.e each word is 32 bits in a 32bit VM and 64 bits in a 64 bit VM. /Kenneth Erlang/OTP Ericsson On Mon, Jan 18, 2010 at 3:15 PM, Sean Cribbs wrote: > Is there information somewhere on the memory requirements of proplists vs. > dicts for small numbers of keys (< 100)? ?If not, is there a nice way to > measure memory usage at runtime? ?I'm trying to determine whether switching > from a dict to a proplist will save space. > > If the difference is negligible, I'll have to figure out some other solution > (I'm guessing this is the answer). > > Cheers, > > Sean Cribbs > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From raimo+erlang-questions@REDACTED Mon Jan 18 16:24:18 2010 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Mon, 18 Jan 2010 16:24:18 +0100 Subject: [erlang-questions] inet:gethostbyname question In-Reply-To: <682273.7692.qm@web112607.mail.gq1.yahoo.com> References: <682273.7692.qm@web112607.mail.gq1.yahoo.com> Message-ID: <20100118152418.GD10908@erix.ericsson.se> On Fri, Jan 15, 2010 at 01:24:28PM -0800, Yogish Baliga wrote: > Strange thing is happening with inet:gethostbyname(inet_db:gethostname()) in R13 release. Which R13 release is it? The code involved was extensively rewritten in R13B02. And what does inet_db:gethostname() acutally return? > > inet_db:res_option(lookup). > [dns,native,file]. > inet:gethostbyname(inet_db:gethostname()) > {error,nxdomain} > inet_db:set_lookup([dns]). > inet:gethostbyname(inet_db:gethostname()) > {ok,{hostent,"gw06",[],inet,4,[{127,0,0,1}]}} > > Having lookup method to 3 elements [dns,native,file] is not working. If I set it to only "dns", it is working. Also noticed that > > inet_db:res_option(search). > [] > inet_db:res_option(domain). > "example.com" > > Then I execute, > > inet_config:init(). > > This function is called by inet_db:start_link(), which is called by kernel:init(). > > After executing inet_config:init(), > > inet_db:res_option(search). > ["sk1.example.com"]. > inet_db:res_option(domain). > "example.com". > > > After executing inet_config:init(), order of lookup methods doesn't matter. As long as I have dns in the list, it works. > > inet:gethostbyname(inet_db:gethostname()). > {ok,{hostent,"gw06.sk1.example.com",[],inet,4,[{127,0,0,1}]}} > > Any idea, why inet_config:init() called by kernel->inet_db:start_link() is not working as expected? > > Thanx, > -- baliga > > "Point of view is worth 80 IQ points" --Alan Kay > > http://dudefrommangalore.blogspot.com/ -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From ishwar@REDACTED Mon Jan 18 16:26:13 2010 From: ishwar@REDACTED (Ish Rattan) Date: Mon, 18 Jan 2010 10:26:13 -0500 (EST) Subject: code sample request Message-ID: I am trying to write the code for "Create N processes in a ring. Send a message around the ring M times so that a total of N*M messages get sent." problem from Armstrong's book. A solution code wiil be appreciated. -ishwar From mononcqc@REDACTED Mon Jan 18 16:54:11 2010 From: mononcqc@REDACTED (Fred Hebert) Date: Mon, 18 Jan 2010 10:54:11 -0500 Subject: [erlang-questions] code sample request In-Reply-To: References: Message-ID: <8b9ee55b1001180754w2732e945t4121aeac558d105a@mail.gmail.com> On Mon, Jan 18, 2010 at 10:26 AM, Ish Rattan wrote: > > I am trying to write the code for > "Create N processes in a ring. Send a message > around the ring M times so that a total of N*M > messages get sent." problem from Armstrong's book. > > A solution code wiil be appreciated. > > -ishwar > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > See http://shootout.alioth.debian.org/u64/benchmark.php?test=threadring&lang=hipe&id=1for a common efficient implementation. From wallentin.dahlberg@REDACTED Mon Jan 18 17:45:40 2010 From: wallentin.dahlberg@REDACTED (Wallentin Dahlberg) Date: Mon, 18 Jan 2010 17:45:40 +0100 Subject: [erlang-questions] code sample request In-Reply-To: <8b9ee55b1001180754w2732e945t4121aeac558d105a@mail.gmail.com> References: <8b9ee55b1001180754w2732e945t4121aeac558d105a@mail.gmail.com> Message-ID: Another one, -module(ring). -export([run/2, run/3]). run(N, M) -> run(N, M, msg). run(N, M, Msg) -> run(N - 1, M, Msg, self()). run(0, 0, _, _) -> ok; run(0, M, Msg, Pid) -> Pid ! {self(), Msg}, receive {_From, Msg} -> run(0, M - 1, Msg, Pid) end; run(N, M, Msg, Pid) -> run(N - 1, M, Msg, spawn_link(fun() -> loop(Pid) end)). loop(To) -> receive {From, Msg} -> io:format("~p -> (Me:~p) -> ~p~n", [From, self(), To]), To ! {self(), Msg}, loop(To) end. Beware of typos and other confusing errors. =) // egil 2010/1/18 Fred Hebert > On Mon, Jan 18, 2010 at 10:26 AM, Ish Rattan >wrote: > > > > > I am trying to write the code for > > "Create N processes in a ring. Send a message > > around the ring M times so that a total of N*M > > messages get sent." problem from Armstrong's book. > > > > A solution code wiil be appreciated. > > > > -ishwar > > > > > > ________________________________________________________________ > > erlang-questions mailing list. See http://www.erlang.org/faq.html > > erlang-questions (at) erlang.org > > > > See > > http://shootout.alioth.debian.org/u64/benchmark.php?test=threadring&lang=hipe&id=1for > a common efficient implementation. > From gsmyth@REDACTED Mon Jan 18 17:59:39 2010 From: gsmyth@REDACTED (Greg Smyth) Date: Mon, 18 Jan 2010 16:59:39 +0000 Subject: [erlang-questions] Use of http:request In-Reply-To: <361b4e9d1001150306v1755f165r41e2886cc8d7f0ba@mail.gmail.com> References: <361b4e9d1001140759j1379999dqea4f383fa212bd59@mail.gmail.com> <361b4e9d1001150306v1755f165r41e2886cc8d7f0ba@mail.gmail.com> Message-ID: <361b4e9d1001180859tdb57e27o2f8c2f2e5e4cfb25@mail.gmail.com> To anyone following along, this was basically a mixture of me failing to set the Host header explicitly for the HTTP/1.1 request, the http:request client trying to helpfully do this for me, the server trying a redirect for this "Host:" form to an address that didn't exist... And the client doing an autoredirect... :) Cheers, Greg On Fri, Jan 15, 2010 at 11:06 AM, Greg Smyth wrote: > On Thu, Jan 14, 2010 at 10:52 PM, Tomas Abrahamsson > wrote: >>> I'm having a bit of a problem understanding why http:request is >>> returning "{error,nxdomain}" - whenever the box seems to resolve >>> properly via inet:gethostbyname:- >> >> What version of Erlang are you running? > > I have access to 2 machines, one running R12B-5 (inets-5.0.12), and > one running R13B-1 (inets-5.0.13) - both are currently exhibiting the > same failure with http:request.... > >> >> This has happened to me with R12B-5 (inets-5.0.12), I think, but I cannot >> reproduce it with the R13B02 (inets-5.1.3) I currently have at hand. >> >> The problem in my case was that the web server had both an ipv6 >> address and an ipv4 address, and I didn't have any ipv6 networking >> properly set up, and the http:request in R12B-5 by default tried first ipv6 >> then ipv4. So it found an ipv6 address, couldn't reach it and ended up >> with an {error,enetunreach}. >> >> You could try to run "dig AAAA webserver001.cluster1.company.com" >> or inet:gethostbyname("webserver001.cluster1.company.com", inet6). >> to see if it has an ipv6 address. In my case it was the www.ida.liu.se >> that I tried to reach. > > This is where it gets interesting... :) > > I get an ipv6 address for the webserver returned from > inet:gethostbyname in R13 - but not in R12 (and interestingly, not > from a "dig AAAA" on either machine) > >> >> If this is the problem for you, then you may try >> http:set_options([{ipv6,disabled}]). > > Tried this on both machines - doesn't seem to make a difference for > this particular case... > > Thanks for the help, > Greg > >> >> BRs >> Tomas >> > From g9414002.pccu.edu.tw@REDACTED Mon Jan 18 19:00:22 2010 From: g9414002.pccu.edu.tw@REDACTED (=?UTF-8?B?6buD6ICA6LOiIChZYXUtSHNpZW4gSHVhbmcp?=) Date: Tue, 19 Jan 2010 02:00:22 +0800 Subject: [erlang-questions] code sample request In-Reply-To: References: <8b9ee55b1001180754w2732e945t4121aeac558d105a@mail.gmail.com> Message-ID: And my solution: *** The Code -export([round_nodes/3]). round_nodes(M, N, Msg) -> Pids = get_nodes(M, [N, Msg]), [P|Ps] = Pids, Pids1 = lists:append(Ps, [P]), Pids2 = lists:zip(Pids, Pids1), [ S ! T || {S, T} <- Pids2 ]. get_nodes(0, _Args) -> []; get_nodes(N, [Times, Msg]) -> P = spawn(test, node, [Times, Msg]), Ps = get_nodes(N-1, [Times, Msg]), [P|Ps]. node(N, Msg) -> Pid = target_node(), traffic(N, self(), Pid, Msg). target_node() -> receive Pid -> Pid end. traffic(0, _Pid1, _Pid2, _Msg) -> true; traffic(N, Pid1, Pid2, Msg) -> Pid2 ! {Pid1, Msg}, receive {Pid, Msg1} when Pid /= Pid2 -> Pid ! {Pid1, {Msg1, ok}} end, receive {Pid2, Response} -> error_logger:info_msg("~w reveived \"~w\" from ~w.~n", [self(), Response, Pid2]) end, traffic(N-1, Pid1, Pid2, Msg). *** Execution > test:round_nodes(3, 2, "HELLO"). =INFO REPORT==== 19-Jan-2010::01:58:54 === <0.35.0> reveived "{[72,69,76,76,79],ok}" from <0.36.0>. =INFO REPORT==== 19-Jan-2010::01:58:54 === <0.36.0> reveived "{[72,69,76,76,79],ok}" from <0.37.0>. [<0.36.0>,<0.37.0>,<0.35.0>] =INFO REPORT==== 19-Jan-2010::01:58:54 === <0.37.0> reveived "{[72,69,76,76,79],ok}" from <0.35.0>. =INFO REPORT==== 19-Jan-2010::01:58:54 === <0.35.0> reveived "{[72,69,76,76,79],ok}" from <0.36.0>. 3> =INFO REPORT==== 19-Jan-2010::01:58:54 === <0.36.0> reveived "{[72,69,76,76,79],ok}" from <0.37.0>. =INFO REPORT==== 19-Jan-2010::01:58:54 === <0.37.0> reveived "{[72,69,76,76,79],ok}" from <0.35.0>. On Tue, Jan 19, 2010 at 12:45 AM, Wallentin Dahlberg < wallentin.dahlberg@REDACTED> wrote: > Another one, > > -module(ring). > -export([run/2, run/3]). > > run(N, M) -> run(N, M, msg). > run(N, M, Msg) -> run(N - 1, M, Msg, self()). > > run(0, 0, _, _) -> ok; > run(0, M, Msg, Pid) -> > Pid ! {self(), Msg}, > receive {_From, Msg} -> run(0, M - 1, Msg, Pid) end; > run(N, M, Msg, Pid) -> run(N - 1, M, Msg, spawn_link(fun() -> loop(Pid) > end)). > > loop(To) -> > receive > {From, Msg} -> > io:format("~p -> (Me:~p) -> ~p~n", [From, self(), To]), > To ! {self(), Msg}, > loop(To) > end. > > > Beware of typos and other confusing errors. =) > > // egil > > 2010/1/18 Fred Hebert > > > On Mon, Jan 18, 2010 at 10:26 AM, Ish Rattan > >wrote: > > > > > > > > I am trying to write the code for > > > "Create N processes in a ring. Send a message > > > around the ring M times so that a total of N*M > > > messages get sent." problem from Armstrong's book. > > > > > > A solution code wiil be appreciated. > > > > > > -ishwar > > > > > > > > > ________________________________________________________________ > > > erlang-questions mailing list. See http://www.erlang.org/faq.html > > > erlang-questions (at) erlang.org > > > > > > See > > > > > http://shootout.alioth.debian.org/u64/benchmark.php?test=threadring&lang=hipe&id=1for > > a common efficient implementation. > > > From zabrane3@REDACTED Mon Jan 18 19:26:32 2010 From: zabrane3@REDACTED (zabrane Mikael) Date: Mon, 18 Jan 2010 19:26:32 +0100 Subject: Mnesia: beyond the 2GB limit on 32bits arch Message-ID: <18a1db031001181026m6836ab40k699f0e46a7fa847d@mail.gmail.com> Hi list, I'd like to use Mnesia with "disc_copies" schema to store 17 millions pairs. Each key is uniq 160B string. The overall datasize is ~1.3TB. How could I solve that knowing that Mnesia uses DETS behind the scene and the latter has a 2GB limit? N.B: I'm aware of "tcerl", "dbd" drivers for Erlang, but I'm only looking for pure Erlang solution. Regards Zabrane From seancribbs@REDACTED Mon Jan 18 19:57:29 2010 From: seancribbs@REDACTED (Sean Cribbs) Date: Mon, 18 Jan 2010 13:57:29 -0500 Subject: [erlang-questions] Mnesia: beyond the 2GB limit on 32bits arch In-Reply-To: <18a1db031001181026m6836ab40k699f0e46a7fa847d@mail.gmail.com> References: <18a1db031001181026m6836ab40k699f0e46a7fa847d@mail.gmail.com> Message-ID: <4B54AF19.5090206@gmail.com> Riak would be a good solution for this. You can choose a backend appropriate to your needs and spread the storage across a cluster of nodes. Sean On 1/18/10 1:26 PM, zabrane Mikael wrote: > Hi list, > > I'd like to use Mnesia with "disc_copies" schema to store 17 > millions pairs. > Each key is uniq 160B string. The overall datasize is ~1.3TB. > > How could I solve that knowing that Mnesia uses DETS behind the scene and > the latter > has a 2GB limit? > > N.B: I'm aware of "tcerl", "dbd" drivers for Erlang, but I'm only looking > for pure Erlang solution. > > Regards > Zabrane > > From zabrane3@REDACTED Mon Jan 18 20:17:44 2010 From: zabrane3@REDACTED (zabrane Mikael) Date: Mon, 18 Jan 2010 20:17:44 +0100 Subject: [erlang-questions] Mnesia: beyond the 2GB limit on 32bits arch In-Reply-To: <4B54AF19.5090206@gmail.com> References: <18a1db031001181026m6836ab40k699f0e46a7fa847d@mail.gmail.com> <4B54AF19.5090206@gmail.com> Message-ID: <18a1db031001181117o59feb5c1gd5adc0c6c2c0932c@mail.gmail.com> Hi Sean, Is there a RIAK doc somewhere? Regards Zabrane. 2010/1/18 Sean Cribbs > Riak would be a good solution for this. You can choose a backend > appropriate to your needs and spread the storage across a cluster of nodes. > > Sean > > > On 1/18/10 1:26 PM, zabrane Mikael wrote: > >> Hi list, >> >> I'd like to use Mnesia with "disc_copies" schema to store 17 >> millions pairs. >> Each key is uniq 160B string. The overall datasize is ~1.3TB. >> >> How could I solve that knowing that Mnesia uses DETS behind the scene and >> the latter >> has a 2GB limit? >> >> N.B: I'm aware of "tcerl", "dbd" drivers for Erlang, but I'm only looking >> for pure Erlang solution. >> >> Regards >> Zabrane >> >> >> > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From seancribbs@REDACTED Mon Jan 18 20:57:55 2010 From: seancribbs@REDACTED (Sean Cribbs) Date: Mon, 18 Jan 2010 14:57:55 -0500 Subject: [erlang-questions] Mnesia: beyond the 2GB limit on 32bits arch In-Reply-To: <18a1db031001181117o59feb5c1gd5adc0c6c2c0932c@mail.gmail.com> References: <18a1db031001181026m6836ab40k699f0e46a7fa847d@mail.gmail.com> <4B54AF19.5090206@gmail.com> <18a1db031001181117o59feb5c1gd5adc0c6c2c0932c@mail.gmail.com> Message-ID: <4B54BD43.4060005@gmail.com> riak.basho.com is the project site. Also, see blog.basho.com for some screencasts and other informal information. To be fair, Riak does not have mnesia's transaction semantics or qlc, but you do have map-reduce. Sean On 1/18/10 2:17 PM, zabrane Mikael wrote: > Hi Sean, > > Is there a RIAK doc somewhere? > > Regards > Zabrane. > > 2010/1/18 Sean Cribbs > > > Riak would be a good solution for this. You can choose a backend > appropriate to your needs and spread the storage across a cluster > of nodes. > > Sean > > > On 1/18/10 1:26 PM, zabrane Mikael wrote: > > Hi list, > > I'd like to use Mnesia with "disc_copies" schema to store 17 > millions pairs. > Each key is uniq 160B string. The overall datasize is ~1.3TB. > > How could I solve that knowing that Mnesia uses DETS behind > the scene and > the latter > has a 2GB limit? > > N.B: I'm aware of "tcerl", "dbd" drivers for Erlang, but I'm > only looking > for pure Erlang solution. > > Regards > Zabrane > > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From g@REDACTED Mon Jan 18 21:04:16 2010 From: g@REDACTED (Garrett Smith) Date: Mon, 18 Jan 2010 14:04:16 -0600 Subject: MySQL interface Message-ID: Is http://github.com/dizzyd/erlang-mysql-driver generally considered the "go to" driver for Erlang/MySQL? Garrett From igorrs@REDACTED Mon Jan 18 21:26:48 2010 From: igorrs@REDACTED (Igor Ribeiro Sucupira) Date: Mon, 18 Jan 2010 18:26:48 -0200 Subject: [erlang-questions] Mnesia: beyond the 2GB limit on 32bits arch In-Reply-To: <18a1db031001181026m6836ab40k699f0e46a7fa847d@mail.gmail.com> References: <18a1db031001181026m6836ab40k699f0e46a7fa847d@mail.gmail.com> Message-ID: Hi, Zabrane. Are you planning to use disc_copies (you will need about 1.3 TB of RAM on your cluster) or disc_only_copies tables? Igor. On Mon, Jan 18, 2010 at 4:26 PM, zabrane Mikael wrote: > Hi list, > > I'd like to use Mnesia with "disc_copies" schema to store 17 > millions pairs. > Each key is uniq 160B string. The overall datasize is ~1.3TB. > > How could I solve that knowing that Mnesia uses DETS behind the scene and > the latter > has a 2GB limit? > > N.B: I'm aware of "tcerl", "dbd" drivers for Erlang, but I'm only looking > for pure Erlang solution. > > Regards > Zabrane -- "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 zabrane3@REDACTED Mon Jan 18 21:59:25 2010 From: zabrane3@REDACTED (zabrane Mikael) Date: Mon, 18 Jan 2010 21:59:25 +0100 Subject: [erlang-questions] Mnesia: beyond the 2GB limit on 32bits arch In-Reply-To: References: <18a1db031001181026m6836ab40k699f0e46a7fa847d@mail.gmail.com> Message-ID: <18a1db031001181259g4ef562dfo1462eb8ca315e9e@mail.gmail.com> Hi Igor, Are you planning to use disc_copies (you will need about 1.3 TB of RAM > on your cluster) or disc_only_copies tables? Reading speed isn't important for the moment. So "disc_only_copies" should be fine. Zabrane. From chandrashekhar.mullaparthi@REDACTED Mon Jan 18 22:30:20 2010 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Mon, 18 Jan 2010 21:30:20 +0000 Subject: [erlang-questions] Use of http:request In-Reply-To: <361b4e9d1001180859tdb57e27o2f8c2f2e5e4cfb25@mail.gmail.com> References: <361b4e9d1001140759j1379999dqea4f383fa212bd59@mail.gmail.com> <361b4e9d1001150306v1755f165r41e2886cc8d7f0ba@mail.gmail.com> <361b4e9d1001180859tdb57e27o2f8c2f2e5e4cfb25@mail.gmail.com> Message-ID: 2010/1/18 Greg Smyth > To anyone following along, this was basically a mixture of me failing > to set the Host header explicitly for the HTTP/1.1 request, the > http:request client trying to helpfully do this for me, the server > trying a redirect for this "Host:" form to an address that didn't > exist... And the client doing an autoredirect... :) > Which is why ibrowse doesn't support autoredirects :-) Chandru From igorrs@REDACTED Tue Jan 19 00:51:54 2010 From: igorrs@REDACTED (Igor Ribeiro Sucupira) Date: Mon, 18 Jan 2010 21:51:54 -0200 Subject: [erlang-questions] Mnesia: beyond the 2GB limit on 32bits arch In-Reply-To: <18a1db031001181259g4ef562dfo1462eb8ca315e9e@mail.gmail.com> References: <18a1db031001181026m6836ab40k699f0e46a7fa847d@mail.gmail.com> <18a1db031001181259g4ef562dfo1462eb8ca315e9e@mail.gmail.com> Message-ID: Hi, Zabrane. If you are going to store 1.3 TB of data in a fragmented Mnesia disc_only_copies table, I would recommend that you create AT LEAST 1024 fragments for your data (use a power of 2 for better distribution of data among fragments). Each table fragment can hold up to 2 GB of data, but the performance gets really bad way before you reach that limit. About table fragmentation in Mnesia: http://www.trapexit.org/Mnesia_Table_Fragmentation Depending on your performance requirements, you should think twice (and run a lot of experiments) before you choose Mnesia to store terabytes of data. Good luck. Igor. On Mon, Jan 18, 2010 at 6:59 PM, zabrane Mikael wrote: > Hi Igor, >> >> Are you planning to use disc_copies (you will need about 1.3 TB of RAM >> on your cluster) or disc_only_copies tables? > > Reading speed isn't important for the moment. So "disc_only_copies" should > be fine. > Zabrane. -- "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 yogishb@REDACTED Tue Jan 19 06:21:06 2010 From: yogishb@REDACTED (Yogish Baliga) Date: Mon, 18 Jan 2010 21:21:06 -0800 (PST) Subject: [erlang-questions] inet:gethostbyname question In-Reply-To: <20100118152418.GD10908@erix.ericsson.se> References: <682273.7692.qm@web112607.mail.gq1.yahoo.com> <20100118152418.GD10908@erix.ericsson.se> Message-ID: <992517.64629.qm@web112617.mail.gq1.yahoo.com> "Point of view is worth 80 IQ points" --Alan Kay http://dudefrommangalore.blogspot.com/ ________________________________ From: Raimo Niskanen To: Yogish Baliga ; erlang-questions@REDACTED Sent: Mon, January 18, 2010 7:24:18 AM Subject: Re: [erlang-questions] inet:gethostbyname question On Fri, Jan 15, 2010 at 01:24:28PM -0800, Yogish Baliga wrote: > Strange thing is happening with inet:gethostbyname(inet_db:gethostname()) in R13 release. Which R13 release is it? The code involved was extensively rewritten in R13B02. Using latest version of R13. And what does inet_db:gethostname() acutally return? inet_db:gethostname() return gw06 > > inet_db:res_option(lookup). > [dns,native,file]. > inet:gethostbyname(inet_db:gethostname()) > {error,nxdomain} > inet_db:set_lookup([dns]). > inet:gethostbyname(inet_db:gethostname()) > {ok,{hostent,"gw06",[],inet,4,[{127,0,0,1}]}} > > Having lookup method to 3 elements [dns,native,file] is not working. If I set it to only "dns", it is working. Also noticed that > > inet_db:res_option(search). > [] > inet_db:res_option(domain). > "example.com" > > Then I execute, > > inet_config:init(). > > This function is called by inet_db:start_link(), which is called by kernel:init(). > > After executing inet_config:init(), > > inet_db:res_option(search). > ["sk1.example.com"]. > inet_db:res_option(domain). > "example.com". > > > After executing inet_config:init(), order of lookup methods doesn't matter. As long as I have dns in the list, it works. > > inet:gethostbyname(inet_db:gethostname()). > {ok,{hostent,"gw06.sk1.example.com",[],inet,4,[{127,0,0,1}]}} > > Any idea, why inet_config:init() called by kernel->inet_db:start_link() is not working as expected? > > Thanx, > -- baliga > > "Point of view is worth 80 IQ points" --Alan Kay > > http://dudefrommangalore.blogspot.com/ -- / Raimo Niskanen, Erlang/OTP, Ericsson AB ________________________________________________________________ erlang-questions mailing list. See http://www.erlang.org/faq.html erlang-questions (at) erlang.org From yarsanukaev@REDACTED Tue Jan 19 08:14:43 2010 From: yarsanukaev@REDACTED (kingping) Date: Mon, 18 Jan 2010 23:14:43 -0800 (PST) Subject: gen_*(3) + pool(3) Message-ID: <00473e40-16ff-4efb-a7c6-dcfc97dd67d7@k19g2000yqc.googlegroups.com> I wonder if it's possible to start gen_{fsm,server} instances within pool(3). gen_server(3) refers to spawn_opts, but appears these don't describe anything relevant to pool(3). I think it would possibly work if I'd use e. g. pspawn[_link](gen_server, start_link, ARGS), but not sure whether it's correct and/or safe. From hynek@REDACTED Tue Jan 19 10:45:39 2010 From: hynek@REDACTED (Hynek Vychodil) Date: Tue, 19 Jan 2010 10:45:39 +0100 Subject: [erlang-questions] remote message send latencies on low-latency 10Gb/s hardware In-Reply-To: References: Message-ID: <4d08db371001190145ibcd0c2erf14f48f237805325@mail.gmail.com> I have measured 50-60us (yes, it is microseconds) ping-pong on absolutely ordinary 1GB switch and absolutely ordinary endpoints (low level laptop and 7 years old desktop). It was probably working in 100MB mode ;-) On Mon, Jan 18, 2010 at 5:10 AM, Bill O'Hara wrote: > Hi, > > I wonder if anyone has benchmarked Erlang messaging performance on > low-latency 10Gb setups, such as machines with Solarflare NICs using > OpenOnload talking via Arista 10Gb switches? > > Given server to switch to server latencies in the single digit > microseconds, can Erlang remote messaging achieve near this? I guess > a ping-pong of 15ms or so would be the best case (assuming 6ms one-way > latency plus some processing time). > > Thanks > B. > > ________________________________________________________________ > 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 GoodData now for free: www.gooddata.com From mazen.harake@REDACTED Tue Jan 19 10:46:09 2010 From: mazen.harake@REDACTED (Mazen Harake) Date: Tue, 19 Jan 2010 11:46:09 +0200 Subject: [erlang-questions] code sample request In-Reply-To: References: <8b9ee55b1001180754w2732e945t4121aeac558d105a@mail.gmail.com> Message-ID: <4B557F61.3070506@erlang-consulting.com> Interesting, I did something similar a while back. Check this out: http://www.trapexit.org/index.php?title=Process_Ring_Across_Nodes /Mazen On 18/01/2010 20:00, ??? (Yau-Hsien Huang) wrote: > And my solution: > > *** The Code > > -export([round_nodes/3]). > > round_nodes(M, N, Msg) -> > Pids = get_nodes(M, [N, Msg]), > [P|Ps] = Pids, > Pids1 = lists:append(Ps, [P]), > Pids2 = lists:zip(Pids, Pids1), > [ S ! T || {S, T}<- Pids2 ]. > > get_nodes(0, _Args) -> > []; > get_nodes(N, [Times, Msg]) -> > P = spawn(test, node, [Times, Msg]), > Ps = get_nodes(N-1, [Times, Msg]), > [P|Ps]. > > node(N, Msg) -> > Pid = target_node(), > traffic(N, self(), Pid, Msg). > > target_node() -> > receive > Pid -> Pid > end. > > traffic(0, _Pid1, _Pid2, _Msg) -> > true; > traffic(N, Pid1, Pid2, Msg) -> > Pid2 ! {Pid1, Msg}, > receive > {Pid, Msg1} when Pid /= Pid2 -> > Pid ! {Pid1, {Msg1, ok}} > end, > receive > {Pid2, Response} -> > error_logger:info_msg("~w reveived \"~w\" from ~w.~n", > [self(), Response, Pid2]) > end, > traffic(N-1, Pid1, Pid2, Msg). > > *** Execution > > >> test:round_nodes(3, 2, "HELLO"). >> > =INFO REPORT==== 19-Jan-2010::01:58:54 === > <0.35.0> reveived "{[72,69,76,76,79],ok}" from<0.36.0>. > > =INFO REPORT==== 19-Jan-2010::01:58:54 === > <0.36.0> reveived "{[72,69,76,76,79],ok}" from<0.37.0>. > [<0.36.0>,<0.37.0>,<0.35.0>] > > =INFO REPORT==== 19-Jan-2010::01:58:54 === > <0.37.0> reveived "{[72,69,76,76,79],ok}" from<0.35.0>. > > =INFO REPORT==== 19-Jan-2010::01:58:54 === > <0.35.0> reveived "{[72,69,76,76,79],ok}" from<0.36.0>. > 3> > =INFO REPORT==== 19-Jan-2010::01:58:54 === > <0.36.0> reveived "{[72,69,76,76,79],ok}" from<0.37.0>. > > =INFO REPORT==== 19-Jan-2010::01:58:54 === > <0.37.0> reveived "{[72,69,76,76,79],ok}" from<0.35.0>. > > > On Tue, Jan 19, 2010 at 12:45 AM, Wallentin Dahlberg< > wallentin.dahlberg@REDACTED> wrote: > > >> Another one, >> >> -module(ring). >> -export([run/2, run/3]). >> >> run(N, M) -> run(N, M, msg). >> run(N, M, Msg) -> run(N - 1, M, Msg, self()). >> >> run(0, 0, _, _) -> ok; >> run(0, M, Msg, Pid) -> >> Pid ! {self(), Msg}, >> receive {_From, Msg} -> run(0, M - 1, Msg, Pid) end; >> run(N, M, Msg, Pid) -> run(N - 1, M, Msg, spawn_link(fun() -> loop(Pid) >> end)). >> >> loop(To) -> >> receive >> {From, Msg} -> >> io:format("~p -> (Me:~p) -> ~p~n", [From, self(), To]), >> To ! {self(), Msg}, >> loop(To) >> end. >> >> >> Beware of typos and other confusing errors. =) >> >> // egil >> >> 2010/1/18 Fred Hebert >> >> >>> On Mon, Jan 18, 2010 at 10:26 AM, Ish Rattan>> >>>> wrote: >>>> >>> >>>> I am trying to write the code for >>>> "Create N processes in a ring. Send a message >>>> around the ring M times so that a total of N*M >>>> messages get sent." problem from Armstrong's book. >>>> >>>> A solution code wiil be appreciated. >>>> >>>> -ishwar >>>> >>>> >>>> ________________________________________________________________ >>>> erlang-questions mailing list. See http://www.erlang.org/faq.html >>>> erlang-questions (at) erlang.org >>>> >>>> See >>>> >>> >>> >> http://shootout.alioth.debian.org/u64/benchmark.php?test=threadring&lang=hipe&id=1for >> >>> a common efficient implementation. >>> >>> >> > From g9414002.pccu.edu.tw@REDACTED Tue Jan 19 15:11:02 2010 From: g9414002.pccu.edu.tw@REDACTED (=?UTF-8?B?6buD6ICA6LOiIChZYXUtSHNpZW4gSHVhbmcp?=) Date: Tue, 19 Jan 2010 22:11:02 +0800 Subject: [erlang-questions] code sample request In-Reply-To: References: <8b9ee55b1001180754w2732e945t4121aeac558d105a@mail.gmail.com> <4B557F61.3070506@erlang-consulting.com> Message-ID: Great work! And, I think that the processes-ring problem can be extended to several alternatives, including a sequential message ring and an asynchronous one. 2010/1/19 Mazen Harake Interesting, I did something similar a while back. > > Check this out: > http://www.trapexit.org/index.php?title=Process_Ring_Across_Nodes > > /Mazen > > > On 18/01/2010 20:00, ??? (Yau-Hsien Huang) wrote: > >> And my solution: >> >> *** The Code >> >> -export([round_nodes/3]). >> >> round_nodes(M, N, Msg) -> >> Pids = get_nodes(M, [N, Msg]), >> [P|Ps] = Pids, >> Pids1 = lists:append(Ps, [P]), >> Pids2 = lists:zip(Pids, Pids1), >> [ S ! T || {S, T}<- Pids2 ]. >> >> From anton.krasovsky@REDACTED Tue Jan 19 15:55:29 2010 From: anton.krasovsky@REDACTED (Anton Krasovsky) Date: Tue, 19 Jan 2010 14:55:29 +0000 Subject: Amazon S3 / streaming HTTP upload Message-ID: <46167e6a1001190655g296e7298uee27645c57ad88f@mail.gmail.com> I'm looking for a way to upload/download largish binary files (photos/videos) to Amazon S3. Thanks to streaming option in inets http client, downloading these files seems pretty straitforward. However uploading to S3 is more problematic because streaming is not supported for put/post requests and entire file has to be read into memory before I can post it. Would anyone know about http client/Amazon S3 library that would work without buffering of the entire file? Regards, Anton From rapsey@REDACTED Tue Jan 19 17:40:51 2010 From: rapsey@REDACTED (Rapsey) Date: Tue, 19 Jan 2010 17:40:51 +0100 Subject: [erlang-questions] Amazon S3 / streaming HTTP upload In-Reply-To: <46167e6a1001190655g296e7298uee27645c57ad88f@mail.gmail.com> References: <46167e6a1001190655g296e7298uee27645c57ad88f@mail.gmail.com> Message-ID: <97619b171001190840laeef808kf42a636756284a2d@mail.gmail.com> I would just write my own http client in your situation. All you need to do is use gen_tcp to connect to the server, send an appropriate header and upload the file by chunks. Easy as pie. Sergej On Tue, Jan 19, 2010 at 3:55 PM, Anton Krasovsky wrote: > I'm looking for a way to upload/download largish binary files > (photos/videos) to Amazon S3. > > Thanks to streaming option in inets http client, downloading these > files seems pretty straitforward. > However uploading to S3 is more problematic because streaming is not > supported for put/post requests > and entire file has to be read into memory before I can post it. > > Would anyone know about http client/Amazon S3 library that would work > without buffering of the entire file? > > Regards, > Anton > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From g@REDACTED Tue Jan 19 17:51:12 2010 From: g@REDACTED (Garrett Smith) Date: Tue, 19 Jan 2010 10:51:12 -0600 Subject: [erlang-questions] Amazon S3 / streaming HTTP upload In-Reply-To: <97619b171001190840laeef808kf42a636756284a2d@mail.gmail.com> References: <46167e6a1001190655g296e7298uee27645c57ad88f@mail.gmail.com> <97619b171001190840laeef808kf42a636756284a2d@mail.gmail.com> Message-ID: This looks like something you might be able to use out of the box... http://code.google.com/p/erls3/ Additionally, this is an actively maintained project that can provide psuedo code (Python :) for just about any AWS operation you might need: http://code.google.com/p/boto/ On Tue, Jan 19, 2010 at 10:40 AM, Rapsey wrote: > I would just write my own http client in your situation. All you need to do > is use gen_tcp to connect to the server, send an appropriate header and > upload the file by chunks. Easy as pie. > > > Sergej > > > On Tue, Jan 19, 2010 at 3:55 PM, Anton Krasovsky > wrote: > >> I'm looking for a way to upload/download largish binary files >> (photos/videos) to Amazon S3. >> >> Thanks to streaming option in inets http client, downloading these >> files seems pretty straitforward. >> However uploading to S3 is more problematic because streaming is not >> supported for put/post requests >> and entire file has to be read into memory before I can post it. >> >> Would anyone know about http client/Amazon S3 library that would work >> without buffering of the entire file? >> >> Regards, >> Anton >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> > From chandrashekhar.mullaparthi@REDACTED Wed Jan 20 02:26:20 2010 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Wed, 20 Jan 2010 01:26:20 +0000 Subject: [erlang-questions] Amazon S3 / streaming HTTP upload In-Reply-To: <46167e6a1001190655g296e7298uee27645c57ad88f@mail.gmail.com> References: <46167e6a1001190655g296e7298uee27645c57ad88f@mail.gmail.com> Message-ID: 2010/1/19 Anton Krasovsky > I'm looking for a way to upload/download largish binary files > (photos/videos) to Amazon S3. > > Thanks to streaming option in inets http client, downloading these > files seems pretty straitforward. > However uploading to S3 is more problematic because streaming is not > supported for put/post requests > and entire file has to be read into memory before I can post it. > > Would anyone know about http client/Amazon S3 library that would work > without buffering of the entire file? > > ibrowse supports streaming for requests by taking a fun as input for the Body. ibrowse:send_req(Url, Headers, Method, Body). An example invocation would be: -record(stream_state, {iod, filename}). stream_file(#stream_state{iod = undefined, filename = Filename} = State) -> {ok, Iod} = file:open(Filename, [read, raw]), stream_file(State#stream_state{iod = Iod}); stream_file(#stream_state{iod = Iod}) -> case file:read(Iod, 8192) of {ok, Data} -> {ok, Data, State}; eof -> file:close(Iod), eof end. Body = {fun stream_file/1, #stream_state{filename = "/file/to/stream"}}, ibrowse:send_req("http://blah/blah", [], put, Body). cheers Chandru From raimo+erlang-questions@REDACTED Wed Jan 20 09:23:38 2010 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Wed, 20 Jan 2010 09:23:38 +0100 Subject: [erlang-questions] inet:gethostbyname question In-Reply-To: <992517.64629.qm@web112617.mail.gq1.yahoo.com> References: <682273.7692.qm@web112607.mail.gq1.yahoo.com> <20100118152418.GD10908@erix.ericsson.se> <992517.64629.qm@web112617.mail.gq1.yahoo.com> Message-ID: <20100120082338.GB19148@erix.ericsson.se> On Mon, Jan 18, 2010 at 09:21:06PM -0800, Yogish Baliga wrote: > > Which R13 release is it? The code involved was > extensively rewritten in R13B02. > > Using latest version of R13. > > And what does inet_db:gethostname() acutally return? > > > inet_db:gethostname() return gw06 > Then we continue with these commands: erlang:system_info(system_version). application:get_env(kernel, inetrc). node(). inet_db:gethostname(). io:format("~p~n", [ets:tab2list(inet_db)]). immediately after starting a node, and then after your fix by calling inet_config:init(): inet_db:gethostname(). io:format("~p~n", [ets:tab2list(inet_db)]). again, and we'll see what changed... Try also to start a fresh node, check ets:i(inet_db) to see that the table is as above. Then call inet_res:gethostbyname("gw06") and then: inet_db:gethostname(). io:format("~p~n", [ets:tab2list(inet_db)]). to see if that call changes something... > > > > inet_db:res_option(lookup). > > [dns,native,file]. > > inet:gethostbyname(inet_db:gethostname()) > > {error,nxdomain} > > inet_db:set_lookup([dns]). > > inet:gethostbyname(inet_db:gethostname()) > > {ok,{hostent,"gw06",[],inet,4,[{127,0,0,1}]}} Try the individual resolver components: inet_res:gethostbyname("gw06"). inet_gethost_native:gethostbyname("gw06"). inet_hosts:gethostbyname("gw06"). and we'll see what they think. > > > > Having lookup method to 3 elements [dns,native,file] is not working. If I set it to only "dns", it is working. Also noticed that > > > > inet_db:res_option(search). > > [] > > inet_db:res_option(domain). > > "example.com" > > > > Then I execute, > > > > inet_config:init(). > > > > This function is called by inet_db:start_link(), which is called by kernel:init(). > > > > After executing inet_config:init(), > > > > inet_db:res_option(search). > > ["sk1.example.com"]. > > inet_db:res_option(domain). > > "example.com". > > > > > > After executing inet_config:init(), order of lookup methods doesn't matter. As long as I have dns in the list, it works. > > > > inet:gethostbyname(inet_db:gethostname()). > > {ok,{hostent,"gw06.sk1.example.com",[],inet,4,[{127,0,0,1}]}} > > > > Any idea, why inet_config:init() called by kernel->inet_db:start_link() is not working as expected? > > > > Thanx, > > -- baliga > > > > "Point of view is worth 80 IQ points" --Alan Kay > > > > http://dudefrommangalore.blogspot.com/ > -- > > / 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 oscar@REDACTED Wed Jan 20 11:14:13 2010 From: oscar@REDACTED (=?UTF-8?Q?Oscar_Hellstr=C3=B6m?=) Date: Wed, 20 Jan 2010 10:14:13 +0000 Subject: [erlang-questions] Amazon S3 / streaming HTTP upload In-Reply-To: <46167e6a1001190655g296e7298uee27645c57ad88f@mail.gmail.com> References: <46167e6a1001190655g296e7298uee27645c57ad88f@mail.gmail.com> Message-ID: <3e5c3f6aa6f7c27844ba5f67e622f9ce@hellstrom.st> Hi, You could also try lhttpc. Non of the released versions currently support streaming/partial upload but it's in the main branch of the repository and I think someone (or several ppl.) are already using it and claiming it works well. There will be a realese when we've done some additional testing for the streaming changes, such as the simple load test to see if we're hurting performance too much with it. You can find lhttpc either at bitbucket (hg): http://bitbucket.org/etc/lhttpc/ or github (git): http://github.com/oscarh/lhttpc You can find examples of how it's done in test/lhttpc_tests.erl. Look for partial_upload_*/0 Cheers On Tue, 19 Jan 2010 14:55:29 +0000, Anton Krasovsky wrote: > I'm looking for a way to upload/download largish binary files > (photos/videos) to Amazon S3. > > Thanks to streaming option in inets http client, downloading these > files seems pretty straitforward. > However uploading to S3 is more problematic because streaming is not > supported for put/post requests > and entire file has to be read into memory before I can post it. > > Would anyone know about http client/Amazon S3 library that would work > without buffering of the entire file? > > Regards, > Anton > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org -- Oscar Hellstr?m, oscar@REDACTED web: http://oscar.hellstrom.st xmpp: oscar@REDACTED From anton.krasovsky@REDACTED Wed Jan 20 11:55:50 2010 From: anton.krasovsky@REDACTED (Anton Krasovsky) Date: Wed, 20 Jan 2010 10:55:50 +0000 Subject: [erlang-questions] Amazon S3 / streaming HTTP upload In-Reply-To: <3e5c3f6aa6f7c27844ba5f67e622f9ce@hellstrom.st> References: <46167e6a1001190655g296e7298uee27645c57ad88f@mail.gmail.com> <3e5c3f6aa6f7c27844ba5f67e622f9ce@hellstrom.st> Message-ID: <46167e6a1001200255n21e53ca3ud343a01c5fdcc089@mail.gmail.com> Thanks for all pointers! I had a look at lhttpc before, but didn't see it does streaming, erls3 looks very interesting too, as it signs S3 requests - something I forgot I had to do as well. So, given that there are some project that support streaming I'll look into using one of them, I see no point rolling my own code. Regards, Anton From micha-1@REDACTED Wed Jan 20 12:44:27 2010 From: micha-1@REDACTED (michael) Date: Wed, 20 Jan 2010 12:44:27 +0100 Subject: split - splitting at \x00 Message-ID: <201001201244.27263.micha-1@fantasymail.de> Hi, if I want to split two string at ascii 0 ( <<"one",0:8, "two", 0:8>> ) then this worked: regexp:split(Str, "\x00") it gives : {ok, ["one","two",[]]} But I cannot get it to work with the new re module. It seems to insert \x00 between all the letters, it gives: ["o","n","e",[0],"t","w","o",[0],[]] am I overlooking something? Michael From rumata-estor@REDACTED Wed Jan 20 12:50:08 2010 From: rumata-estor@REDACTED (Dmitry Belayev) Date: Wed, 20 Jan 2010 14:50:08 +0300 Subject: file:open with O_EXCL mode Message-ID: <4B56EDF0.7090907@nm.ru> I have a problem creating unique files on linux in Erlang. In current version I cannot be sure that file I am creating is really unique because even if I check it's existense with filelib:is_regular and call file:open(..., [write,...]) some other process (not only from withing Erlang) can create file with the same name. What I need is atomically create file if it does not exist or get error if it exists. I found old mail with workaround: http://www.erlang.org/pipermail/erlang-questions/2009-February/041654.html This solution works fine but I'd like not to spawn external commands. So, is there any way to open file with O_EXCL mode from Erlang? Or will it be possible in next releases? From micha-1@REDACTED Wed Jan 20 13:33:02 2010 From: micha-1@REDACTED (michael) Date: Wed, 20 Jan 2010 13:33:02 +0100 Subject: [erlang-questions] re:split - splitting at \x00 In-Reply-To: <201001201244.27263.micha-1@fantasymail.de> References: <201001201244.27263.micha-1@fantasymail.de> Message-ID: <201001201333.02755.micha-1@fantasymail.de> On Wednesday 20 January 2010 12:44:27 michael wrote: > Hi, > > if I want to split two string at ascii 0 ( <<"one",0:8, "two", 0:8>> ) then > this worked: sorry for the noise, right after posting a realized the error :-) Michael From micha-1@REDACTED Wed Jan 20 14:15:42 2010 From: micha-1@REDACTED (michael) Date: Wed, 20 Jan 2010 14:15:42 +0100 Subject: [erlang-questions] re:split - splitting at \x00 In-Reply-To: <201001201333.02755.micha-1@fantasymail.de> References: <201001201244.27263.micha-1@fantasymail.de> <201001201333.02755.micha-1@fantasymail.de> Message-ID: <201001201415.42516.micha-1@fantasymail.de> the solution is that backslashes in regular expressions should be escaped itself by a backslash, since the erlang string handling consumes one backslash and inserts the resulting char into the string. So in a string \x00 is replaced by ascii zero and \\x00 results in \x00 Michael From michael.santos@REDACTED Wed Jan 20 14:36:02 2010 From: michael.santos@REDACTED (Michael Santos) Date: Wed, 20 Jan 2010 08:36:02 -0500 Subject: [erlang-questions] file:open with O_EXCL mode In-Reply-To: <4B56EDF0.7090907@nm.ru> References: <4B56EDF0.7090907@nm.ru> Message-ID: <20100120133602.GA14362@ecn.lan> On Wed, Jan 20, 2010 at 02:50:08PM +0300, Dmitry Belayev wrote: > I have a problem creating unique files on linux in Erlang. > > In current version I cannot be sure that file I am creating is really > unique because even if I check it's existense with filelib:is_regular > and call file:open(..., [write,...]) some other process (not only from > withing Erlang) can create file with the same name. What I need is > atomically create file if it does not exist or get error if it exists. > > I found old mail with workaround: > http://www.erlang.org/pipermail/erlang-questions/2009-February/041654.html > This solution works fine but I'd like not to spawn external commands. > > So, is there any way to open file with O_EXCL mode from Erlang? Or will > it be possible in next releases? While this doesn't answer your question directly, under Unix you can guarantee atomicity by creating a directory and then the temp file inside of the directory. For example: http://github.com/msantos/procket/blob/master/src/mktmp.erl The example spawns chmod, since Erlang doesn't seem to provide a way of setting permissions. Instead, you could write to a private directory or set your umask before starting beam. From carlo.cabanilla@REDACTED Wed Jan 20 14:41:15 2010 From: carlo.cabanilla@REDACTED (Carlo Cabanilla) Date: Wed, 20 Jan 2010 08:41:15 -0500 Subject: html parsing in erlang? Message-ID: <1af9aae31001200541m4dd8b8fara193a42bf8bd2e9d@mail.gmail.com> Hey, Can someone recommend a good html parser in Erlang? Something like Python's BeautifulSoup that won't choke on bad markup. Saw this thread on Trap Exit: http://www.trapexit.org/forum/viewtopic.php?p=38529 but didn't sound promising. -- .Carlo syntacticbayleaves.com From rumata-estor@REDACTED Wed Jan 20 14:59:52 2010 From: rumata-estor@REDACTED (Dmitry Belayev) Date: Wed, 20 Jan 2010 16:59:52 +0300 Subject: [erlang-questions] html parsing in erlang? In-Reply-To: <1af9aae31001200541m4dd8b8fara193a42bf8bd2e9d@mail.gmail.com> References: <1af9aae31001200541m4dd8b8fara193a42bf8bd2e9d@mail.gmail.com> Message-ID: <4B570C58.2040703@nm.ru> Carlo Cabanilla wrote: > Hey, > > Can someone recommend a good html parser in Erlang? Something like Python's > BeautifulSoup that won't choke on bad markup. Saw this thread on Trap Exit: > http://www.trapexit.org/forum/viewtopic.php?p=38529 but didn't sound > promising. > > > http://code.google.com/p/mochiweb/ mochiweb_html module From dale@REDACTED Wed Jan 20 15:00:27 2010 From: dale@REDACTED (Dale Harvey) Date: Wed, 20 Jan 2010 14:00:27 +0000 Subject: [erlang-questions] html parsing in erlang? In-Reply-To: <1af9aae31001200541m4dd8b8fara193a42bf8bd2e9d@mail.gmail.com> References: <1af9aae31001200541m4dd8b8fara193a42bf8bd2e9d@mail.gmail.com> Message-ID: the mochiweb server has mochiweb_html:parse(Body) I havent personally tested it though 2010/1/20 Carlo Cabanilla > Hey, > > Can someone recommend a good html parser in Erlang? Something like Python's > BeautifulSoup that won't choke on bad markup. Saw this thread on Trap Exit: > http://www.trapexit.org/forum/viewtopic.php?p=38529 but didn't sound > promising. > > > -- > > > .Carlo > syntacticbayleaves.com > From rumata-estor@REDACTED Wed Jan 20 14:53:04 2010 From: rumata-estor@REDACTED (Dmitry Belayev) Date: Wed, 20 Jan 2010 16:53:04 +0300 Subject: [erlang-questions] file:open with O_EXCL mode In-Reply-To: <20100120133602.GA14362@ecn.lan> References: <4B56EDF0.7090907@nm.ru> <20100120133602.GA14362@ecn.lan> Message-ID: <4B570AC0.205@nm.ru> Yes, I know about directories. But I have to create new files in one directory without any subdirectories. I've looked through mailing list archive and found out that people meet this problem once a year since 2004 year. And nothing changed since then. Michael Santos wrote: > On Wed, Jan 20, 2010 at 02:50:08PM +0300, Dmitry Belayev wrote: > >> I have a problem creating unique files on linux in Erlang. >> >> So, is there any way to open file with O_EXCL mode from Erlang? Or will >> it be possible in next releases? >> > > While this doesn't answer your question directly, under Unix you can > guarantee atomicity by creating a directory and then the temp file inside > of the directory. For example: > > http://github.com/msantos/procket/blob/master/src/mktmp.erl > > The example spawns chmod, since Erlang doesn't seem to provide a way of > setting permissions. Instead, you could write to a private directory or > set your umask before starting beam From roberto@REDACTED Wed Jan 20 15:57:00 2010 From: roberto@REDACTED (Roberto Ostinelli) Date: Wed, 20 Jan 2010 15:57:00 +0100 Subject: misultin adds websocket support Message-ID: dear all, after the well-known and inspiring post from joe, i've just finished adding websocket support to misultin http://code.google.com/p/misultin/ usage is pretty straightforward, and a brief explanation can be found here: http://www.ostinelli.net/misultin-erlang-and-websockets/ basically, all you need to define is a function which is spawned by misultin when websocket requests are received, such as handle_websocket/1: handle_websocket(Ws) -> receive {browser, Data} -> Ws:send(["received '", Data, "'"]), handle_websocket(Ws); _Ignore -> handle_websocket(Ws) after 5000 -> Ws:send("pushing!"), handle_websocket(Ws) end. Data coming from a browser will be sent to this process and will have the message format {browser, Data}, where Data is a string(). If you need to send data to the browser, you may do so by using the parametrized function Ws:send(Data), Data being a string() or an iolist(). comments welcomed, as usual. cheers, r. From tino.breddin@REDACTED Wed Jan 20 16:51:47 2010 From: tino.breddin@REDACTED (Tino Breddin) Date: Wed, 20 Jan 2010 15:51:47 +0000 Subject: Erlang Development Process Survey Message-ID: <4e80e3c11001200751j2314c9cdt7cefb534db1618b4@mail.gmail.com> Hi all, As part of my diploma thesis I'm conduction a survey about the development process of Erlang. The survey is very short by intention and should only take up 5 minutes to complete. I'm trying to get data to support the motivation for my thesis "Development of a autonomous build and distribution system for software with hybrid development models". I'd very much appreciate your participation in this survey. I will make the results publicly available later. To take the survey, please go to: http://surveys.erlang-consulting.com/index.php?sid=51149&newtest=Y&lang=en If you have questions or suggestions you are welcome to contact me via email. Cheers, Tino Breddin From koug@REDACTED Wed Jan 20 18:05:23 2010 From: koug@REDACTED (John Kougoulos) Date: Wed, 20 Jan 2010 19:05:23 +0200 (EET) Subject: [erlang-questions] file:open with O_EXCL mode In-Reply-To: <4B570AC0.205@nm.ru> References: <4B56EDF0.7090907@nm.ru> <20100120133602.GA14362@ecn.lan> <4B570AC0.205@nm.ru> Message-ID: As far as I know Unix "ln" is atomic too, which can be used to provide locks for files. On Wed, 20 Jan 2010, Dmitry Belayev wrote: > Yes, I know about directories. But I have to create new files in one > directory without any subdirectories. > > I've looked through mailing list archive and found out that people meet this > problem once a year since 2004 year. > And nothing changed since then. > > Michael Santos wrote: >>> I have a problem creating unique files on linux in Erlang. >>> >>> So, is there any way to open file with O_EXCL mode from Erlang? Or will >>> it be possible in next releases? >>> >> >> While this doesn't answer your question directly, under Unix you can >> guarantee atomicity by creating a directory and then the temp file inside >> of the directory. For example: >> >> http://github.com/msantos/procket/blob/master/src/mktmp.erl >> >> The example spawns chmod, since Erlang doesn't seem to provide a way of >> setting permissions. Instead, you could write to a private directory or >> set your umask before starting beam > From chan.sisowath@REDACTED Wed Jan 20 18:21:16 2010 From: chan.sisowath@REDACTED (chan sisowath) Date: Wed, 20 Jan 2010 18:21:16 +0100 Subject: =?ISO-8859-1?Q?=5Berlang=2Dquestions=5D_Probl=E8me_Compilation_Error_on_AI?= =?ISO-8859-1?Q?X_5=2E2?= Message-ID: <57d992fd1001200921l4d3d9863h2470db05f8152baf@mail.gmail.com> *Hello everyone,* * i read all post about compilling erlang on AIX platform from the mailling-list archive i m trying to compile otp_src_R13B03 on AIX 5.2 i patched my version following this post http://www.erlang.org/pipermail/erlang-questions/2008-June/035962.html **i have some trouble during the compilation, i don't know how to solve them. *** ENV: LIBPATH=/tools/list/oracle/ product/9.2.0/lib32:/applis/list/oasis/oasis/adt/odbc/lib:/tools/list/oracle/product/9.2.0/lib32:.:/lib:/usr/lib:/applis/list/oasis/oasis/adt/pec/lib/rs6000_aix:/applis/list/oasis/oasis/adt/bin:/usr/lpp/cobol/lib:/usr/lpp/cobol/dynload:/tools/list/oracle/product/9.2.0/lib:/tools/list/oracle/product/9.2.0/lib:/tools/list/oracle/product/9.2.0/lib:/opt/freeware/lib GCC -v: Reading specs from /opt/freeware/lib/gcc-lib/powerpc-ibm-aix5.2.0.0/3.3.2/specs Configured with: ../configure --with-as=/usr/bin/as --with-ld=/usr/bin/ld --disable-nls --enable-languages=c,c++ --prefix=/opt/freeware --enable-threads --enable-version-specific-runtime-libs --host=powerpc-ibm-aix5.2.0.0 Thread model: aix gcc version 3.3.2 configure: $>sh configure --prefix=$NX_ROOT/temp/tmpc/SRC/root ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by configure, which was generated by GNU Autoconf 2.59. Invocation command line was $ configure --prefix=/applis/list/oasis/oasis/produit/temp/tmpc/SRC/root ## --------- ## ## Platform. ## ## --------- ## hostname = clappdev uname -m = 0033C2AF4C00 uname -r = 2 uname -s = AIX uname -v = 5 /usr/bin/uname -p = powerpc /bin/uname -X = unknown /bin/arch = unknown /usr/bin/arch -k = unknown /usr/convex/getsysinfo = unknown hostinfo = unknown /bin/machine = unknown /usr/bin/oslevel = 5.2.0.0 /bin/universe = unknown PATH: /applis/list/oasis/oasis/produit/temp/tmpc/SRC/bin PATH: /usr/bin PATH: /etc PATH: /usr/sbin PATH: /usr/ucb PATH: /applis/list/oasis/oasis/users/oasisadm/bin PATH: /usr/bin/X11 PATH: /sbin PATH: /tools/list/oracle/product/9.2.0/bin PATH: /applis/list/oasis/oasis/adt/bin PATH: /applis/list/oasis/oasis/produit/scripts PATH: . ## ----------- ## ## Core tests. ## ## ----------- ## configure:1358: checking build system type configure:1376: result: powerpc-ibm-aix5.2.0.0 configure:1384: checking host system type configure:1398: result: powerpc-ibm-aix5.2.0.0 configure:1459: checking for gcc configure:1475: found /usr/bin/gcc configure:1485: result: gcc configure:1729: checking for C compiler version configure:1732: gcc --version &5 gcc (GCC) 3.3.2 Copyright (C) 2003 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. configure:1735: $? = 0 configure:1737: gcc -v &5 Reading specs from /opt/freeware/lib/gcc-lib/powerpc-ibm-aix5.2.0.0/3.3.2/specs Configured with: ../configure --with-as=/usr/bin/as --with-ld=/usr/bin/ld --disable-nls --enable-languages=c,c++ --prefix=/opt/freeware --enable-threads --enable-version-specific-runtime-libs --host=powerpc-ibm-aix5.2.0.0 Thread model: aix gcc version 3.3.2 configure:1740: $? = 0 configure:1742: gcc -V &5 gcc: `-V' option must have argument configure:1745: $? = 1 configure:1768: checking for C compiler default output file name configure:1771: gcc -I/usr/include -I/opt/freeware/include -I//applis/list/oasis/oasis/produit/temp/tmpc/SRC/openssl-0.9.7l/include/openssl -L/opt/freeware/lib conftest.c >&5 configure:1774: $? = 0 configure:1820: result: a.out configure:1825: checking whether the C compiler works configure:1831: ./a.out configure:1834: $? = 0 configure:1851: result: yes configure:1858: checking whether we are cross compiling configure:1860: result: no configure:1863: checking for suffix of executables configure:1865: gcc -o conftest -I/usr/include -I/opt/freeware/include -I//applis/list/oasis/oasis/produit/temp/tmpc/SRC/openssl-0.9.7l/include/openssl -L/opt/freeware/lib conftest.c >&5 configure:1868: $? = 0 configure:1893: result: configure:1899: checking for suffix of object files configure:1920: gcc -c -I/usr/include -I/opt/freeware/include -I//applis/list/oasis/oasis/produit/temp/tmpc/SRC/openssl-0.9.7l/include/openssl conftest.c >&5 configure:1923: $? = 0 configure:1945: result: o configure:1949: checking whether we are using the GNU C compiler configure:1973: gcc -c -I/usr/include -I/opt/freeware/include -I//applis/list/oasis/oasis/produit/temp/tmpc/SRC/openssl-0.9.7l/include/openssl conftest.c >&5 configure:1979: $? = 0 configure:1983: test -z || test ! -s conftest.err configure:1986: $? = 0 configure:1989: test -s conftest.o configure:1992: $? = 0 configure:2005: result: yes configure:2011: checking whether gcc accepts -g configure:2032: gcc -c -g -I/usr/include -I/opt/freeware/include -I//applis/list/oasis/oasis/produit/temp/tmpc/SRC/openssl-0.9.7l/include/openssl conftest.c >&5 configure:2038: $? = 0 configure:2042: test -z || test ! -s conftest.err configure:2045: $? = 0 configure:2048: test -s conftest.o configure:2051: $? = 0 configure:2062: result: yes configure:2079: checking for gcc option to accept ANSI C configure:2149: gcc -c -g -O2 -I/usr/include -I/opt/freeware/include -I//applis/list/oasis/oasis/produit/temp/tmpc/SRC/openssl-0.9.7l/include/openssl conftest.c >&5 configure:2155: $? = 0 configure:2159: test -z || test ! -s conftest.err configure:2162: $? = 0 configure:2165: test -s conftest.o configure:2168: $? = 0 configure:2186: result: none needed configure:2204: gcc -c -g -O2 -I/usr/include -I/opt/freeware/include -I//applis/list/oasis/oasis/produit/temp/tmpc/SRC/openssl-0.9.7l/include/openssl conftest.c >&5 conftest.c:2: error: parse error before "me" configure:2210: $? = 1 configure: failed program was: | #ifndef __cplusplus | choke me | #endif configure:2348: checking for GNU make configure:2386: result: yes (make) configure:2405: checking for a BSD-compatible install configure:2460: result: /applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/erts/autoconf/install-sh -c configure:2478: checking whether ln -s works configure:2482: result: yes configure:2530: checking for ranlib configure:2546: found /usr/bin/ranlib configure:2557: result: ranlib configure:2872: creating ./config.status ## ---------------------- ## ## Running config.status. ## ## ---------------------- ## This file was extended by config.status, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = CONFIG_HEADERS = CONFIG_LINKS = CONFIG_COMMANDS = $ ./config.status on clappdev config.status:656: creating Makefile configure:3724: configuring in lib configure:3841: running /bin/sh '/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/configure' --prefix=/applis/list/oasis/oasis/produit/temp/tmpc/SRC/root '--prefix=/applis/list/oasis/oasis/produit/temp/tmpc/SRC/root' 'CPPFLAGS=-I/usr/include -I/opt/freeware/include -I//applis/list/oasis/oasis/produit/temp/tmpc/SRC/openssl-0.9.7l/include/openssl' 'LDFLAGS=-L/opt/freeware/lib' --cache-file=/dev/null --srcdir=/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib configure:3724: configuring in erts configure:3841: running /bin/sh '/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/erts/configure' --prefix=/applis/list/oasis/oasis/produit/temp/tmpc/SRC/root '--prefix=/applis/list/oasis/oasis/produit/temp/tmpc/SRC/root' 'CPPFLAGS=-I/usr/include -I/opt/freeware/include -I//applis/list/oasis/oasis/produit/temp/tmpc/SRC/openssl-0.9.7l/include/openssl' 'LDFLAGS=-L/opt/freeware/lib' --cache-file=/dev/null --srcdir=/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/erts ## ---------------- ## ## Cache variables. ## ## ---------------- ## ac_cv_build=powerpc-ibm-aix5.2.0.0 ac_cv_build_alias=powerpc-ibm-aix5.2.0.0 ac_cv_c_compiler_gnu=yes ac_cv_env_CC_set='' ac_cv_env_CC_value='' ac_cv_env_CFLAGS_set='' ac_cv_env_CFLAGS_value='' ac_cv_env_CPPFLAGS_set=set ac_cv_env_CPPFLAGS_value='-I/usr/include -I/opt/freeware/include -I//applis/list/oasis/oasis/produit/temp/tmpc/SRC/openssl-0.9.7l/include/openssl' ac_cv_env_LDFLAGS_set=set ac_cv_env_LDFLAGS_value=-L/opt/freeware/lib ac_cv_env_build_alias_set='' ac_cv_env_build_alias_value='' ac_cv_env_host_alias_set='' ac_cv_env_host_alias_value='' ac_cv_env_target_alias_set='' ac_cv_env_target_alias_value='' ac_cv_exeext='' ac_cv_host=powerpc-ibm-aix5.2.0.0 ac_cv_host_alias=powerpc-ibm-aix5.2.0.0 ac_cv_objext=o ac_cv_prog_ac_ct_CC=gcc ac_cv_prog_ac_ct_RANLIB=ranlib ac_cv_prog_cc_g=yes ac_cv_prog_cc_stdc='' ## ----------------- ## ## Output variables. ## ## ----------------- ## CC='gcc' CFLAGS='-g -O2' CPPFLAGS='-I/usr/include -I/opt/freeware/include -I//applis/list/oasis/oasis/produit/temp/tmpc/SRC/openssl-0.9.7l/include/openssl' DEFS='-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" ' ECHO_C='ECHO_N='' ECHO_T='' ERL_TOP='/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03' ERTS='erts-5.7.4' EXEEXT='' INSTALL_DATA='${INSTALL} -m 644' INSTALL_PROGRAM='${INSTALL}' INSTALL_SCRIPT='${INSTALL}' LDFLAGS='-L/opt/freeware/lib' LIBOBJS='' LIBS='' LN_S='ln -s' LTLIBOBJS='' MAKE_PROG='make' OBJEXT='o' PACKAGE_BUGREPORT='' PACKAGE_NAME='' PACKAGE_STRING='' PACKAGE_TARNAME='' PACKAGE_VERSION='' PATH_SEPARATOR=':' RANLIB='ranlib' SHELL='/bin/sh' TARGET='powerpc-ibm-aix5.2.0.0' ac_ct_CC='gcc' ac_ct_RANLIB='ranlib' bindir='${exec_prefix}/bin' build='powerpc-ibm-aix5.2.0.0' build_alias='' build_cpu='powerpc' build_os='aix5.2.0.0' build_vendor='ibm' datadir='${prefix}/share' erl_mandir='$(ERLANG_ILIBDIR)/man' exec_prefix='${prefix}' host='powerpc-ibm-aix5.2.0.0' host_alias='' host_cpu='powerpc' host_os='aix5.2.0.0' host_vendor='ibm' includedir='${prefix}/include' infodir='${prefix}/info' libdir='${exec_prefix}/lib' libexecdir='${exec_prefix}/libexec' localstatedir='${prefix}/var' mandir='${prefix}/man' oldincludedir='/usr/include' prefix='/applis/list/oasis/oasis/produit/temp/tmpc/SRC/root' program_transform_name='s,x,x,' sbindir='${exec_prefix}/sbin' sharedstatedir='${prefix}/com' subdirs=' lib erts' sysconfdir='${prefix}/etc' target_alias='' ## ----------- ## ## confdefs.h. ## ## ----------- ## #define PACKAGE_BUGREPORT "" #define PACKAGE_NAME "" #define PACKAGE_STRING "" #define PACKAGE_TARNAME "" #define PACKAGE_VERSION "" configure: exit 0 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ *during the compilation i had 2 error: * ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ drivers/common/inet_drv.c: In function `inet_ctl_fdopen': drivers/common/inet_drv.c:3755: warning: passing arg 3 of `ngetsockname' from incompatible pointer type drivers/common/inet_drv.c:3767: warning: passing arg 3 of `ngetpeername' from incompatible pointer type drivers/common/inet_drv.c: In function `inet_ctl_ifget': drivers/common/inet_drv.c:4276: error: `IFF_MULTICAST' undeclared (first use in this function) drivers/common/inet_drv.c:4276: error: (Each undeclared identifier is reported only once drivers/common/inet_drv.c:4276: error: for each function it appears in.) drivers/common/inet_drv.c: In function `inet_fill_opts': drivers/common/inet_drv.c:5698: warning: passing arg 5 of `getsockopt' from incompatible pointer type drivers/common/inet_drv.c:5716: warning: passing arg 5 of `getsockopt' from incompatible pointer type drivers/common/inet_drv.c: In function `inet_ctl': drivers/common/inet_drv.c:6799: warning: passing arg 3 of `ngetpeername' from incompatible pointer type drivers/common/inet_drv.c:6836: warning: passing arg 3 of `ngetsockname' from incompatible pointer type drivers/common/inet_drv.c:6882: warning: passing arg 3 of `ngetsockname' from incompatible pointer type drivers/common/inet_drv.c: In function `tcp_inet_ctl': drivers/common/inet_drv.c:7429: warning: passing arg 3 of `naccept' from incompatible pointer type drivers/common/inet_drv.c: In function `tcp_inet_input': drivers/common/inet_drv.c:8267: warning: passing arg 3 of `naccept' from incompatible pointer type drivers/common/inet_drv.c:8333: warning: passing arg 3 of `naccept' from incompatible pointer type drivers/common/inet_drv.c: In function `tcp_inet_output': drivers/common/inet_drv.c:8699: warning: passing arg 5 of `getsockopt' from incompatible pointer type drivers/common/inet_drv.c: In function `packet_inet_input': drivers/common/inet_drv.c:9371: warning: passing arg 6 of `nrecvfrom' from incompatible pointer type drivers/common/inet_drv.c: In function `packet_inet_output': drivers/common/inet_drv.c:9502: warning: passing arg 5 of `getsockopt' from incompatible pointer type *and * gcc -g -O2 -I/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/erts/powerpc-ibm-aix5.2.0.0 -I/usr/include -DHAVE_CONFIG_H -Wall -Wstrict-prototypes -Wmissing-prototypes -I/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/erts/emulator/sys/unix -I/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/erts/emulator/beam -I/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/erts/include -I/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/erts/include/powerpc-ibm-aix5.2.0.0 -I/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/erts/include/internal -I/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/erts/include/internal/powerpc-ibm-aix5.2.0.0 -DOTP_SYSTEM_VERSION=\"R13B03\" -o /applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/erts/obj/powerpc-ibm-aix5.2.0.0/run_erl.o -c ../unix/run_erl.c ../unix/run_erl.c: In function `open_pty_master': ../unix/run_erl.c:868: warning: implicit declaration of function `posix_openpt' ../unix/run_erl.c: In function `set_window_size': ../unix/run_erl.c:1258: error: storage size of `ws' isn't known ../unix/run_erl.c:1261: warning: implicit declaration of function `ioctl' ../unix/run_erl.c:1261: error: invalid application of `sizeof' to an incomplete type ../unix/run_erl.c:1258: warning: unused variable `ws' make[4]: *** [/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/erts/obj/powerpc-ibm-aix5.2.0.0/run_erl.o] Error 1 make[4]: Leaving directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/erts/etc/common' make[3]: *** [opt] Error 2 make[3]: Leaving directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/erts/etc/common' make[2]: *** [opt] Error 2 make[2]: Leaving directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/erts/etc' make[1]: *** [opt] Error 2 make[1]: Leaving directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/erts' make: *** [emulator] Error 2 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ *i solve the first by a define in the file erts/emulator/drivers/common/inet_drv.c *#ifndef _OSE_ *#ifdef HAVE_MULTICAST_SUPPORT #define IP_MULTICAST 1 #endif* #include #else #define IFF_MULTICAST 0x00000800 #endif *for the second error: in the file erts/etc/unix/run_erl.c* #ifdef HAVE_SYS_IOCTL_H *#ifndef _ALL_SOURCE #define _ALL_SOURCE 1 #endif* #include #endif *i don't know if it is the right thing todo. after that i have this one I don't know what to do*. make[2]: Leaving directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/otp_mibs' make[2]: Entering directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/appmon' === Entering application appmon make[3]: Entering directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/appmon/src' make[3]: Nothing to be done for `opt'. make[3]: Leaving directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/appmon/src' make[3]: Entering directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/appmon/priv' make[3]: Nothing to be done for `opt'. make[3]: Leaving directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/appmon/priv' make[3]: Entering directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/appmon/doc/src' make[3]: Nothing to be done for `opt'. make[3]: Leaving directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/appmon/doc/src' === Leaving application appmon make[2]: Leaving directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/appmon' make[2]: Entering directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/erl_interface' === Entering application erl_interface make[3]: Entering directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/erl_interface/src' make -f powerpc-ibm-aix5.2.0.0/Makefile TYPE=opt make[4]: Entering directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/erl_interface/src' make[4]: Nothing to be done for `debug'. make[4]: Leaving directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/erl_interface/src' make[3]: Leaving directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/erl_interface/src' make[3]: Entering directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/erl_interface/doc/src' make[3]: Nothing to be done for `opt'. make[3]: Leaving directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/erl_interface/doc/src' === Leaving application erl_interface make[2]: Leaving directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/erl_interface' make[2]: Entering directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/asn1' === Entering application asn1 make[3]: Entering directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/asn1/src' make[3]: Nothing to be done for `opt'. make[3]: Leaving directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/asn1/src' make[3]: Entering directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/asn1/doc/src' make[3]: Nothing to be done for `opt'. make[3]: Leaving directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/asn1/doc/src' make[3]: Entering directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/asn1/c_src' make -f powerpc-ibm-aix5.2.0.0/Makefile TYPE=opt make[4]: Entering directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/asn1/c_src' gcc -bnoentry -bexpall -G -L/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/erl_interface/obj/powerpc-ibm-aix5.2.0.0 -o /applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/asn1/priv/lib/powerpc-ibm-aix5.2.0.0/asn1_erl_drv.so /applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/asn1/priv/obj/powerpc-ibm-aix5.2.0.0/asn1_erl_drv.o -lei -lc -ldl -lm *gcc: couldn't run `expall-gcc-3.3.2': No such file or directory make[4]: *** [/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/asn1/priv/lib/powerpc-ibm-aix5.2.0.0/asn1_erl_drv.so] Error 1* make[4]: Leaving directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/asn1/c_src' make[3]: *** [opt] Error 2 make[3]: Leaving directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/asn1/c_src' make[2]: *** [opt] Error 2 make[2]: Leaving directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/asn1' make[1]: *** [opt] Error 2 make[1]: Leaving directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib' make: *** [libs] Error 2 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ * THX. for your help.* From p-news@REDACTED Wed Jan 20 17:16:42 2010 From: p-news@REDACTED (P) Date: Wed, 20 Jan 2010 17:16:42 +0100 Subject: duplication crash Message-ID: <201001201716.42886.p-news@telia.com> Suddenly one afternoon I could not start my old trusty erlang node (which had worked previously for a long long time). Eventually I realised that I already had started a erlang node with the same name and this crash was due to a name clash which was not entirely obvious at first (panic, panic, neck hears on end). I wonder if there is some way to present this simple handling error in a way more obvious for the newcomer or is there something in the crash dump viewer I have missed ? ----------------------------------------------------------------------------------------- Starting in Windows XP like this: C:\Program\Erlang\R13B\R13B03\erl5.7.4\bin\werl.exe -sname humle - setcookie abc -smp auto +S 2 +A 4 gave the following in the erlang console : {error_logger,{{2010,1,20},{15,54,30}},"Protocol: ~p: register error: ~p~n",["inet_tcp",{{badmatch,{error,duplicate_name}},[{inet_tcp_dist, listen,1},{net_kernel,start_protos,4},{net_kernel,start_protos,3}, {net_kernel,init_node,2},{net_kernel,init,1},{gen_server,init_it,6}, {proc_lib,init_p_do_apply,3}]}]} {error_logger,{{2010,1,20},{15,54,30}},crash_report,[[{initial_call, {net_kernel,init,['Argument__1']}},{pid,<0.21.0>},{registered_name,[]}, {error_info,{exit,{error,badarg},[{gen_server,init_it,6},{proc_lib, init_p_do_apply,3}]}},{ancestors,[net_sup,kernel_sup,<0.10.0>]}, {messages,[]},{links,[#Port<0.50>,<0.18.0>]},{dictionary,[{longnames, false}]},{trap_exit,true},{status,running},{heap_size,377},{stack_size, 24},{reductions,457}],[]]} {error_logger,{{2010,1,20},{15,54,30}},supervisor_report,[{supervisor, {local,net_sup}},{errorContext,start_error},{reason,{'EXIT', nodistribution}},{offender,[{pid,undefined},{name,net_kernel},{mfa, {net_kernel,start_link,[[humle,shortnames]]}},{restart_type,permanent}, {shutdown,2000},{child_type,worker}]}]} {error_logger,{{2010,1,20},{15,54,30}},supervisor_report,[{supervisor, {local,kernel_sup}},{errorContext,start_error},{reason,shutdown}, {offender,[{pid,undefined},{name,net_sup},{mfa,{erl_distribution, start_link,[]}},{restart_type,permanent},{shutdown,infinity}, {child_type,supervisor}]}]} {error_logger,{{2010,1,20},{15,54,30}},std_info,[{application,kernel}, {exited,{shutdown,{kernel,start,[normal,[]]}}},{type,permanent}]} {"Kernel pid terminated",application_controller," {application_start_failure,kernel,{shutdown,{kernel,start,[normal, []]}}}"} Crash dump was written to: erl_crash.dump Kernel pid terminated (application_controller) ({application_start_failure,kernel,{shutdown,{kernel,start,[normal, []]}}}) ----------------------------------------------------------------------------------------- By chance I noticed I had one erlang node already started (puhhh) so I managed to start a crashdump_viewer. This was on a node with another name... >1 crashdump_viewer:start(). WebTool is available at http://localhost:8888/Or http://127.0.0.1:8888/ ok WARNING: Found unexpected line in index table information: entries The information below (with the atom: duplicate_name in it) made me realise what might be going on: {info_msg,<0.8.0>, {<0.20.0>,"Protocol: ~p: register error: ~p~n", ["inet_tcp", {{badmatch,{error,duplicate_name}}, [{inet_tcp_dist,listen,1}, {net_kernel,start_protos,4}, {net_kernel,start_protos,3}, {net_kernel,init_node,2}, {net_kernel,init,1}, {gen_server,init_it,6}, {proc_lib,init_p_do_apply,3}]}]}}}]}, false}] ----------------------------------------------------------------------------------------- Regards P From g@REDACTED Wed Jan 20 20:23:18 2010 From: g@REDACTED (Garrett Smith) Date: Wed, 20 Jan 2010 13:23:18 -0600 Subject: [erlang-questions] html parsing in erlang? In-Reply-To: <1af9aae31001200541m4dd8b8fara193a42bf8bd2e9d@mail.gmail.com> References: <1af9aae31001200541m4dd8b8fara193a42bf8bd2e9d@mail.gmail.com> Message-ID: On Wed, Jan 20, 2010 at 7:41 AM, Carlo Cabanilla wrote: > Hey, > > Can someone recommend a good html parser in Erlang? Something like Python's > BeautifulSoup that won't choke on bad markup. Saw this thread on Trap Exit: > http://www.trapexit.org/forum/viewtopic.php?p=38529 but didn't sound > promising. I'm a Python guy and love the web tools in that ecosystem. lxml is another library that rocks! I haven't found anything like this in Erlang. I did play around the the mochiweb parse html routine, but didn't use it (can't remember why). However, I'm do a fair amount of web scraping and have reverted to regular expressions in Erlang (re module is fine for that). If your application can process the web content in batch, or using a disk based queue/spool, you could use this: - Grab + parse web content in Python - Dump your output (presumably trees, maps, etc.) to an Erlang term (see the erl_term module in py-interface http://www.lysator.liu.se/~tab/erlang/py_interface/ - or BERT http://bert-rpc.org/) - Read the terms on disk from Erlang To avoid the intermediary phase of writing to disk, you could setup your Python app as a port, which I've found to work very well. Of course, if you can get by with regular expressions, that's presents the fewest moving parts. Garrett From anton.krasovsky@REDACTED Wed Jan 20 21:05:51 2010 From: anton.krasovsky@REDACTED (Anton Krasovsky) Date: Wed, 20 Jan 2010 20:05:51 +0000 Subject: [erlang-questions] Amazon S3 / streaming HTTP upload In-Reply-To: <46167e6a1001200255n21e53ca3ud343a01c5fdcc089@mail.gmail.com> References: <46167e6a1001190655g296e7298uee27645c57ad88f@mail.gmail.com> <3e5c3f6aa6f7c27844ba5f67e622f9ce@hellstrom.st> <46167e6a1001200255n21e53ca3ud343a01c5fdcc089@mail.gmail.com> Message-ID: <46167e6a1001201205i69f1a5ccq958725e718401600@mail.gmail.com> Just came across http://github.com/cstar/erls3/ - which seems to be a perfect fit. It's built on top of ibrowse and supports file upload/download to Amazon S3 without reading entire file to RAM. Anton From michael.santos@REDACTED Wed Jan 20 21:40:04 2010 From: michael.santos@REDACTED (Michael Santos) Date: Wed, 20 Jan 2010 15:40:04 -0500 Subject: [erlang-questions] file:open with O_EXCL mode In-Reply-To: <4B570AC0.205@nm.ru> References: <4B56EDF0.7090907@nm.ru> <20100120133602.GA14362@ecn.lan> <4B570AC0.205@nm.ru> Message-ID: <20100120204004.GA14683@ecn.lan> On Wed, Jan 20, 2010 at 04:53:04PM +0300, Dmitry Belayev wrote: > Yes, I know about directories. But I have to create new files in one > directory without any subdirectories. > > I've looked through mailing list archive and found out that people meet > this problem once a year since 2004 year. > And nothing changed since then. Yeah, it's sort of a wtf moment, but I wonder if O_EXCL was even supported on whatever Linux versions were commonly used in 2004 (manpage says 2.6+). Are you allowed to use C? A linked in driver or an NIF might be an option then. Something like (untested): static ERL_NIF_TERM nif_tmpfile(ErlNifEnv *env, ERL_NIF_TERM _path) { char path[MAXPATHLEN]; int fd = -1; (void)memset(&path, '\0', sizeof(path)); if (!my_enif_get_string(env, _path, path, sizeof(path))) return enif_make_badarg(env); errno = 0; if ( (fd = open(path, O_WRONLY|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR)) == -1) return enif_make_tuple(env, 2, enif_make_atom(env, "error"), enif_make_string(env, strerror(errno))); /* Unlike gen_tcp/udp, file module doesn't support passing in an {fd,FD} arg */ (void)close(fd); return enif_make_atom(env, "ok"); } Then (assuming nif_tmpfile maps to open/1): Tmp = "/tmp/foo.bar", ok = tmpfile:open(Tmp), {ok, FD} = file:open(Tmp, [read,write,binary]). From kaiduanx@REDACTED Wed Jan 20 22:30:23 2010 From: kaiduanx@REDACTED (Kaiduan Xie) Date: Wed, 20 Jan 2010 16:30:23 -0500 Subject: Big difference between runtime and wall_clock time Message-ID: Hi, I am surprised by the big difference between run time and wall_clock time. The following result shows the performance to parse SDP (Session Description Protocol). kaiduanx@REDACTED:~/learn-erlang$ 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> sdp:sdp_parse_performance(100000). SDP parse time: 8.5/56.92 micro-seconds ok 2> sdp_parse_performance(N) -> statistics(runtime), statistics(wall_clock), sdp_performance_test(N), {_, Time1} = statistics(runtime), {_, Time2} = statistics(wall_clock), U1 = Time1 * 1000 /N, U2 = Time2 * 1000 /N, io:format("SDP parse time: ~p/~p micro-seconds~n", [U1, U2]), ok. sdp_performance_test(0) -> ok; sdp_performance_test(N) -> parse_sdp_test(), sdp_performance_test(N-1). How to explain this? Thanks, kaiduan From jderick@REDACTED Wed Jan 20 22:59:44 2010 From: jderick@REDACTED (John Erickson) Date: Wed, 20 Jan 2010 13:59:44 -0800 Subject: Missing Debug Info Message-ID: <4de34f3b1001201359x1abfecb9od808777fc0c11f99@mail.gmail.com> I have compiled all my files with +debug_info, but I still see processes in "undefined" functions when I use i() or bt(). What could these be? Also, I have tried to get stack traces from gdb. I notice that I also get ?? functions in those traces, in places where I would expect to see my erlang functions. Does erlang generate GDB debug info for user code? I do see parts of the trace that call into the erlang system. Also, when I try to open a debugger with ia(pid(0,71,0)) it says 'no_proc', even though that process is shown in the i() listing. John From carlo.cabanilla@REDACTED Wed Jan 20 23:06:21 2010 From: carlo.cabanilla@REDACTED (Carlo Cabanilla) Date: Wed, 20 Jan 2010 17:06:21 -0500 Subject: [erlang-questions] html parsing in erlang? In-Reply-To: References: <1af9aae31001200541m4dd8b8fara193a42bf8bd2e9d@mail.gmail.com> Message-ID: <1af9aae31001201406v4e6bffffhb9df4fc9d30fc2cf@mail.gmail.com> On Wed, Jan 20, 2010 at 2:23 PM, Garrett Smith wrote: > On Wed, Jan 20, 2010 at 7:41 AM, Carlo Cabanilla > If your application can process the web content in batch, or using a > disk based queue/spool, you could use this: > > - Grab + parse web content in Python > - Dump your output (presumably trees, maps, etc.) to an Erlang term > (see the erl_term module in py-interface > http://www.lysator.liu.se/~tab/erlang/py_interface/ - or BERT > http://bert-rpc.org/) > - Read the terms on disk from Erlang > > To avoid the intermediary phase of writing to disk, you could setup > your Python app as a port, which I've found to work very well. > > I was actually considering this design, have you implemented this before? What's the overhead for the serialization/deserialization over the wire like? .Carlo From g@REDACTED Wed Jan 20 23:53:11 2010 From: g@REDACTED (Garrett Smith) Date: Wed, 20 Jan 2010 16:53:11 -0600 Subject: [erlang-questions] html parsing in erlang? In-Reply-To: <1af9aae31001201406v4e6bffffhb9df4fc9d30fc2cf@mail.gmail.com> References: <1af9aae31001200541m4dd8b8fara193a42bf8bd2e9d@mail.gmail.com> <1af9aae31001201406v4e6bffffhb9df4fc9d30fc2cf@mail.gmail.com> Message-ID: On Wed, Jan 20, 2010 at 4:06 PM, Carlo Cabanilla wrote: > On Wed, Jan 20, 2010 at 2:23 PM, Garrett Smith wrote: >> >> On Wed, Jan 20, 2010 at 7:41 AM, Carlo Cabanilla >> If your application can process the web content in batch, or using a >> disk based queue/spool, you could use this: >> >> - Grab + parse web content in Python >> - Dump your output (presumably trees, maps, etc.) to an Erlang term >> (see the erl_term module in py-interface >> http://www.lysator.liu.se/~tab/erlang/py_interface/ - or BERT >> http://bert-rpc.org/) >> - Read the terms on disk from Erlang >> >> To avoid the intermediary phase of writing to disk, you could setup >> your Python app as a port, which I've found to work very well. >> > > ?I was actually considering this design, have you implemented this before? > What's the?overhead for the?serialization/deserialization over the wire > like? It's an OS pipe, so no socket IO. If you're encoding Erlang terms, the overhead in serializing Python data should be relatively low, when compared to JSON, XML, etc. It's tempting to over architect for performance, but your app may be very happy even with something that's not terribly efficient. If you're crunching through a lot of web content, lxml is probably a better option (performance wise) than b-soup. If you can pair your data down by pre-processing it in Python, you can minimize the work in serializing/deserializing over the port. Here's a step-by-step that uses Python to implement a simple Erlang port friendly app: http://www.kazmier.com/computer/port-howto/ I've warmed to the port architecture. While I haven't had a ton of VMs crash from linked in processes (totally endemic in Python world), the idea of strict message passing over a pipe certainly feels nice :) To answer your question, I'm using ports in Python, bash, and Java. My only qualm about Erlang ports is that it's not hard to orphan your external processes. You need to be careful to close your app once stdin is closed, else the OS process will hang around until killed. From torben.lehoff@REDACTED Thu Jan 21 00:00:29 2010 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Thu, 21 Jan 2010 00:00:29 +0100 Subject: From xml to html - with a bit of context Message-ID: Hi, If my need simply was to transform some xml to html I think the xmerl suite would suffice, but there are some extra things that might affect the choice of tool for this job. First off, the solution has to be shippable as pure Erlang to the end user which should be able to run the application on his own machine - i.e., no server to hide non-Erlang things. (Trying to stay off platform specific things). Now the full context: I am working on a Wiki using WikiCreole as the markup language. So the job is to do a WikiCreole -> html transformation and allowing for some dynamic data in the process. My first attempt was to do WikiCreole -> ehtml and run it through yaws, but I would like to avoid shipping yaws with my product. Furthermore, I would like to be able to tailor my final output to not only different variants of html depending on what the browser application is capable of showing, but also allow for something else than html in the future. So I would like to implement this chain: WikiCreole -> AST (abstract syntax tree) -> My AST is not fixed (yet) so I can alter it to make the job easier. Right now I am thinking that an AST that uses the xmerl internal data structure is an okay choice since I could use some XSLT transformation on that and get a variety of outputs by using different transformations. So my chain becomes: WikeCreole -> AST(xmerl) + XSLT -> So my question to the guru is if this is the right approach of if there is something smarter out there that meets my needs? Let me know if you need more details to answer my question. Thanks in advance, Torben -- http://www.linkedin.com/in/torbenhoffmann From clist@REDACTED Thu Jan 21 00:44:07 2010 From: clist@REDACTED (Angel J. Alvarez Miguel) Date: Thu, 21 Jan 2010 00:44:07 +0100 Subject: OT: Please highlight me about JAVA C++ as high level languages just like erlang. Message-ID: <201001210044.07822.clist@uah.es> Hi I little quiestion please: Wikipedia (!) shows a bunch of computer languages as "high level" http://en.wikipedia.org/wiki/High-level_programming_language c2.com sais "A HighLevelLanguage is a ProgrammingLanguage that supports system development at a high LevelOfAbstraction, thereby freeing the developer from keeping in his head lots of details that are irrelevant to the problem at hand." and wikipedia concludes that C, C++, C#, Java, VB(Visual basic), COBOL, FORTRAN, Pascal. Spanish version also cites haskell as highlevel in the same list!! Can be Java High level on the same category as C (pointers, arrays), no closures, bad generics, even no OOP with mehods calls as messages also like C++? can be a poor OOP paradigm (simple dispatch vtables) worth be called high level abstraction today that we have higher forms of OOP with many even higher constructs as native types in other languages and concurrency between object and process (well almost since 80 smalltak isn' it?)??? So then what category erlang, haskell, lisp are? Very high level? DSL's? it seems to me that C++, and Java poorly manage to scape 2G paradigms and do deserve to loose this "enligthed view as highlevel languages" in favor of more recent an modern pythons, rybies, haskell and of course erlang. what's your opinion, please tell me. Thanks!! Some "folks" view C++ or Java as High level languages very capable languages even with lots of people questioning now if OOP has failed again From geoffrey.biggs@REDACTED Thu Jan 21 01:07:19 2010 From: geoffrey.biggs@REDACTED (Geoffrey Biggs) Date: Thu, 21 Jan 2010 09:07:19 +0900 Subject: [erlang-questions] OT: Please highlight me about JAVA C++ as high level languages just like erlang. In-Reply-To: <201001210044.07822.clist@uah.es> References: <201001210044.07822.clist@uah.es> Message-ID: <4B579AB7.8090906@aist.go.jp> It entirely depends on what your definition of "high-level language" is. http://www.paulgraham.com/avg.html Geoff On 21/01/10 08:44, Angel J. Alvarez Miguel wrote: > Hi > > I little quiestion please: > > Wikipedia (!) shows a bunch of computer languages as "high level" > http://en.wikipedia.org/wiki/High-level_programming_language > > c2.com sais > > "A HighLevelLanguage is a ProgrammingLanguage that supports system development > at a high LevelOfAbstraction, thereby freeing the developer from keeping in > his head lots of details that are irrelevant to the problem at hand." > > > and wikipedia concludes that C, C++, C#, Java, VB(Visual basic), COBOL, > FORTRAN, Pascal. > > Spanish version also cites haskell as highlevel in the same list!! > > Can be Java High level on the same category as C (pointers, arrays), no > closures, bad generics, even no OOP with mehods calls as messages also like > C++? > > can be a poor OOP paradigm (simple dispatch vtables) worth be called high > level abstraction today that we have higher forms of OOP with many even higher > constructs as native types in other languages and concurrency between object > and process (well almost since 80 smalltak isn' it?)??? > > So then what category erlang, haskell, lisp are? Very high level? DSL's? > > it seems to me that C++, and Java poorly manage to scape 2G paradigms and do > deserve to loose this "enligthed view as highlevel languages" in favor of more > recent an modern pythons, rybies, haskell and of course erlang. > > what's your opinion, please tell me. > > Thanks!! > > Some "folks" view C++ or Java as High level languages very capable languages > even with lots of people questioning now if OOP has failed again > From clist@REDACTED Thu Jan 21 01:38:47 2010 From: clist@REDACTED (Angel J. Alvarez Miguel) Date: Thu, 21 Jan 2010 01:38:47 +0100 Subject: [erlang-questions] OT: Please highlight me about JAVA C++ as high level languages just like erlang. In-Reply-To: <4B579AB7.8090906@aist.go.jp> References: <201001210044.07822.clist@uah.es> <4B579AB7.8090906@aist.go.jp> Message-ID: <201001210138.47347.clist@uah.es> yeah!! ive read paul some months ago!! Over the last year, reading this list and the archives i was able to rediscover a whole new glossary of computers concepts that i was poorly teached at university or simply i lacked at all. Well, in fact i was considering learning lisp when i discovered erlang... Paul cites "the continuum of computer languages" over where you seat with your language and see up and down... Still many people a ive meet are today positioned at C like languages so they tend to lookup upper in the continuum where they "see" C++ and Java. Pual says "You can see that machine language is very low level. But, at least as a kind of social convention, high-level languages are often all treated as equivalent. They're no" C++ "the generic C++" C99?, C2k3? and C0x? who knows?, people doesnt care about and treat all of them as a unique language. can be stiil those C++ stiill be considered High level, maybe java can retain her majesty, has generics, garbage collector but C++??? It so where is erlang?? for me clearly is even higher than those, more now that people begins to seriously consider processes a better abstractions than objects at least the minimun suppport needed to leverage good real world objects... it seems to me that more and more people begins to see those languages not so "high level" but nobody stills states that clearly (despite paul's efforts). Well maybe Joe and some others here think this way since long time... On Jueves, 21 de Enero de 2010 01:07:19 usted escribi?: > It entirely depends on what your definition of "high-level language" is. > > http://www.paulgraham.com/avg.html > > > Geoff > > On 21/01/10 08:44, Angel J. Alvarez Miguel wrote: > > Hi > > > > I little quiestion please: > > > > Wikipedia (!) shows a bunch of computer languages as "high level" > > http://en.wikipedia.org/wiki/High-level_programming_language > > > > c2.com sais > > > > "A HighLevelLanguage is a ProgrammingLanguage that supports system > > development at a high LevelOfAbstraction, thereby freeing the developer > > from keeping in his head lots of details that are irrelevant to the > > problem at hand." > > > > > > and wikipedia concludes that C, C++, C#, Java, VB(Visual basic), COBOL, > > FORTRAN, Pascal. > > > > Spanish version also cites haskell as highlevel in the same list!! > > > > Can be Java High level on the same category as C (pointers, arrays), no > > closures, bad generics, even no OOP with mehods calls as messages also > > like C++? > > > > can be a poor OOP paradigm (simple dispatch vtables) worth be called high > > level abstraction today that we have higher forms of OOP with many even > > higher constructs as native types in other languages and concurrency > > between object and process (well almost since 80 smalltak isn' it?)??? > > > > So then what category erlang, haskell, lisp are? Very high level? DSL's? > > > > it seems to me that C++, and Java poorly manage to scape 2G paradigms and > > do deserve to loose this "enligthed view as highlevel languages" in favor > > of more recent an modern pythons, rybies, haskell and of course erlang. > > > > what's your opinion, please tell me. > > > > Thanks!! > > > > Some "folks" view C++ or Java as High level languages very capable > > languages even with lots of people questioning now if OOP has failed > > again > From raould@REDACTED Thu Jan 21 01:57:22 2010 From: raould@REDACTED (Raoul Duke) Date: Wed, 20 Jan 2010 16:57:22 -0800 Subject: [erlang-questions] OT: Please highlight me about JAVA C++ as high level languages just like erlang. In-Reply-To: <201001210138.47347.clist@uah.es> References: <201001210044.07822.clist@uah.es> <4B579AB7.8090906@aist.go.jp> <201001210138.47347.clist@uah.es> Message-ID: <91a2ba3e1001201657n5e76f5c9n36f72aa940f8578@mail.gmail.com> >> It entirely depends on what your definition of "high-level language" is. >> >> http://www.paulgraham.com/avg.html see also CTM excerpt. http://lambda-the-ultimate.org/node/3465 sincerely. From fritchie@REDACTED Thu Jan 21 02:19:44 2010 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Wed, 20 Jan 2010 19:19:44 -0600 Subject: [erlang-questions] file:open with O_EXCL mode In-Reply-To: Message of "Wed, 20 Jan 2010 08:36:02 EST." <20100120133602.GA14362@ecn.lan> Message-ID: <44135.1264036784@snookles.snookles.com> Michael Santos wrote: ms> The example spawns chmod, since Erlang doesn't seem to provide a way ms> of setting permissions. See file:write_file_info/2. -Scott From michael.santos@REDACTED Thu Jan 21 03:07:37 2010 From: michael.santos@REDACTED (Michael Santos) Date: Wed, 20 Jan 2010 21:07:37 -0500 Subject: [erlang-questions] file:open with O_EXCL mode In-Reply-To: <44135.1264036784@snookles.snookles.com> References: <20100120133602.GA14362@ecn.lan> <44135.1264036784@snookles.snookles.com> Message-ID: <20100121020737.GB14683@ecn.lan> On Wed, Jan 20, 2010 at 07:19:44PM -0600, Scott Lystig Fritchie wrote: > Michael Santos wrote: > > ms> The example spawns chmod, since Erlang doesn't seem to provide a way > ms> of setting permissions. > > See file:write_file_info/2. Very cool, thanks! From raimo+erlang-questions@REDACTED Thu Jan 21 09:43:26 2010 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Thu, 21 Jan 2010 09:43:26 +0100 Subject: [erlang-questions] inet:gethostbyname question In-Reply-To: <308310.6917.qm@web112608.mail.gq1.yahoo.com> References: <682273.7692.qm@web112607.mail.gq1.yahoo.com> <20100118152418.GD10908@erix.ericsson.se> <992517.64629.qm@web112617.mail.gq1.yahoo.com> <20100120082338.GB19148@erix.ericsson.se> <308310.6917.qm@web112608.mail.gq1.yahoo.com> Message-ID: <20100121084326.GA10030@erix.ericsson.se> On Wed, Jan 20, 2010 at 10:11:39AM -0800, Yogish Baliga wrote: > > On Mon, Jan 18, 2010 at 09:21:06PM -0800, Yogish Baliga wrote: > > > > Which R13 release is it? The code involved was > > extensively rewritten in R13B02. > > > > Using latest version of R13. > > > > And what does inet_db:gethostname() acutally return? > > > > > > inet_db:gethostname() return gw06 > > > > Then we continue with these commands: > erlang:system_info(system_version). > application:get_env(kernel, inetrc). > node(). > inet_db:gethostname(). > io:format("~p~n", [ets:tab2list(inet_db)]). Oh, I was unclear, I wanted to see the output of those commands... > immediately after starting a node, and then after > your fix by calling inet_config:init(): > inet_db:gethostname(). > io:format("~p~n", [ets:tab2list(inet_db)]). And those... > again, and we'll see what changed... > > > ***** Nothing changed after inet_config:init(). Previously you stated that the return values of inet_db:res_option(search) and inet_db:res_option(domain) changed after calling inet_config:init(), and those are among the entries in the ets table inet_db, so now you are contradicting yourself or just missed that little change... Can I see the complete outputs, please? > > Try also to start a fresh node, check ets:i(inet_db) > to see that the table is as above. Then call > inet_res:gethostbyname("gw06") and then: > inet_db:gethostname(). > io:format("~p~n", [ets:tab2list(inet_db)]). > to see if that call changes something... > > ************* Nothing changed after this too. > > > > > > > inet_db:res_option(lookup). > > > [dns,native,file]. > > > inet:gethostbyname(inet_db:gethostname()) > > > {error,nxdomain} > > > inet_db:set_lookup([dns]). > > > inet:gethostbyname(inet_db:gethostname()) > > > {ok,{hostent,"gw06",[],inet,4,[{127,0,0,1}]}} > > Try the individual resolver components: > inet_res:gethostbyname("gw06"). > {ok, {hostent.....}} [works] > > inet_gethost_native:gethostbyname("gw06"). > {error, not_found}. > > inet_hosts:gethostbyname("gw06"). > {error,nxdomain} > > and we'll see what they think. > > Looks like dns resolver work but the native and file resolver does not work. > > For the native resolver, I tried remvoing "domain" line from /etc/resolv.conf. It seems to be working. And the contents of /etc/resolv.conf is also interesting to explain the native resolver and on some systems /etc/nsswitc.conf. As is the contents of /etc/hosts... And, of course, what is your operating system: 1> os:type() and $ uname -a > > In R13, default lookup is [native] and in R12 is [native,file]. > > Setting lookup to [native,file] in R13 does not work either. > > In both versions, dns resolver works. > > For the time being, I am removing domain entry from /etc/resolv.conf file. > > Thanx, > -- baliga > > > > > > > Having lookup method to 3 elements [dns,native,file] is not working. If I set it to only "dns", it is working. Also noticed that > > > > > > inet_db:res_option(search). > > > [] > > > inet_db:res_option(domain). > > > "example.com" > > > > > > Then I execute, > > > > > > inet_config:init(). > > > > > > This function is called by inet_db:start_link(), which is called by kernel:init(). > > > > > > After executing inet_config:init(), > > > > > > inet_db:res_option(search). > > > ["sk1.example.com"]. > > > inet_db:res_option(domain). > > > "example.com". > > > > > > > > > After executing inet_config:init(), order of lookup methods doesn't matter. As long as I have dns in the list, it works. > > > > > > inet:gethostbyname(inet_db:gethostname()). > > > {ok,{hostent,"gw06.sk1.example.com",[],inet,4,[{127,0,0,1}]}} > > > > > > Any idea, why inet_config:init() called by kernel->inet_db:start_link() is not working as expected? > > > > > > Thanx, > > > -- baliga > > > > > > "Point of view is worth 80 IQ points" --Alan Kay > > > > > > http://dudefrommangalore.blogspot.com/ > > -- > > > > / 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 -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From kiran.khaladkar@REDACTED Thu Jan 21 12:00:00 2010 From: kiran.khaladkar@REDACTED (Kiran Khaladkar) Date: Thu, 21 Jan 2010 16:30:00 +0530 Subject: Creating records dynamically Message-ID: <4B5833B0.8010201@geodesic.com> hi all, I have record name in a variable how do i create variable of that. e.g. (just a rough example of what the intention is) -record(sample, {a,b}). put_vals(T) -> V = #T{a =1,b=2}. now when i call put_vals like put_vals(sample). it will fill the record and return the variable The values may be passed as list to put vals like [{a,1}, {b,2}] there is a way i found but want to know if there is any better way .. One can write several put_vals, one each record precisely. -- Kiran Khaladkar | Software Engineer Geodesic Limited | www.geodesic.com Tel: +91 22 4031 5800 - ext - 225 Mob: 9870587508 From david_holz@REDACTED Thu Jan 21 13:13:44 2010 From: david_holz@REDACTED (David Holz) Date: Thu, 21 Jan 2010 05:13:44 -0700 Subject: Safety of closing & moving Dets files Message-ID: I've got a single process managing a journal message stream, which feeds into Dets. This process is the only user of that dets file. I found bchunk/2 and init_table/3 and got them making a snapshot backup of the in-use dets file. However, when I call dets:close on the new backup file, is this new file itself guaranteed to be actually closed and safe for copying/moving/deleting after the close/1 call completes, given that there is only the 1 process working on it? The docs aren't clear on exactly when the dets file's close actually happens (only that it's after the last user closes/dies), and there's no async message response for any sort of completion. Thanks! _________________________________________________________________ Hotmail: Powerful Free email with security by Microsoft. http://clk.atdmt.com/GBL/go/196390710/direct/01/ From clist@REDACTED Thu Jan 21 13:40:11 2010 From: clist@REDACTED (Angel) Date: Thu, 21 Jan 2010 13:40:11 +0100 Subject: changes in native functions for the next otp release. Message-ID: <201001211340.11272.clist@uah.es> Hi Some months ago, i discovered that square root of bignums is not implemented in erlang. So i developed a tiny C port program to do this math stuff. Now im considering making a NIF implementation.... i dont know if int enif_get_int(ErlNifEnv* env, ERL_NIF_TERM term, int* ip) will allow me to manipulate bignums or i have to resort on binaries. ?is erl_nif subject for big changes for the next release? any changes for bignums? Thanks, Angel From sverker@REDACTED Thu Jan 21 14:12:42 2010 From: sverker@REDACTED (Sverker Eriksson) Date: Thu, 21 Jan 2010 14:12:42 +0100 Subject: [erlang-questions] changes in native functions for the next otp release. In-Reply-To: <201001211340.11272.clist@uah.es> References: <201001211340.11272.clist@uah.es> Message-ID: <4B5852CA.9080809@erix.ericsson.se> Angel wrote: > Hi > > Some months ago, i discovered that square root of bignums is not implemented > in erlang. So i developed a tiny C port program to do this math stuff. > > Now im considering making a NIF implementation.... > > i dont know if > > int enif_get_int(ErlNifEnv* env, ERL_NIF_TERM term, int* ip) > > will allow me to manipulate bignums or i have to resort on binaries. > > No, enif_get_int will only give you integers within the bounds of the C-type "int". I guess you have to resort to binaries. > ?is erl_nif subject for big changes for the next release? any changes for > bignums? > > There will be changes and additions but I don't think bignums will make it to next release. The main problem is to choose a good bignum representation to use and support for ever. /Sverker, Erlang/OTP Ericsson From attila.r.nohl@REDACTED Thu Jan 21 14:19:08 2010 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Thu, 21 Jan 2010 14:19:08 +0100 Subject: [erlang-questions] OT: Please highlight me about JAVA C++ as high level languages just like erlang. In-Reply-To: <201001210044.07822.clist@uah.es> References: <201001210044.07822.clist@uah.es> Message-ID: <401d3ba31001210519k40a0ecccwe1540c81e686e4f3@mail.gmail.com> 2010/1/21, Angel J. Alvarez Miguel : [...] > Can be Java High level on the same category as C (pointers, arrays), no > closures, bad generics, even no OOP with mehods calls as messages also like > C++? In my experience everything other than the assembler is considered to be a "high level" language. This is probably a couple of decades old definition of high level language, created at a time when FORTRAN, COBOL and Lisp were the high level languages. From attila.r.nohl@REDACTED Thu Jan 21 14:30:14 2010 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Thu, 21 Jan 2010 14:30:14 +0100 Subject: [erlang-questions] Creating records dynamically In-Reply-To: <4B5833B0.8010201@geodesic.com> References: <4B5833B0.8010201@geodesic.com> Message-ID: <401d3ba31001210530w74c43c12x7e69229418b46c0d@mail.gmail.com> 2010/1/21, Kiran Khaladkar : > hi all, > I have record name in a variable how do i create variable of that. > e.g. (just a rough example of what the intention is) > -record(sample, {a,b}). > put_vals(T) -> > V = #T{a =1,b=2}. > > now when i call put_vals like > put_vals(sample). > it will fill the record and return the variable > The values may be passed as list to put vals like [{a,1}, {b,2}] > > there is a way i found but want to know if there is any better way .. > One can write several put_vals, one each record precisely. I don't really understand what you want to achieve, but keep in mind that the Erlang records are nothing but compile time hacks, internally they are tuples, so your function would look like this: put_vals(T) -> {T, 1, 2}. Of course, this breaks if the internal representation of the records change, and it's generally ugly. From g9414002.pccu.edu.tw@REDACTED Thu Jan 21 14:37:29 2010 From: g9414002.pccu.edu.tw@REDACTED (=?UTF-8?B?6buD6ICA6LOiIChZYXUtSHNpZW4gSHVhbmcp?=) Date: Thu, 21 Jan 2010 21:37:29 +0800 Subject: [erlang-questions] OT: Please highlight me about JAVA C++ as high level languages just like erlang. In-Reply-To: <201001210044.07822.clist@uah.es> References: <201001210044.07822.clist@uah.es> Message-ID: In general, all languages but assembly are at higher level than assembly, all languages but assembly and native languages are at higher level than assembly and native languages, and DSLs are at higher level than languages constructed with virtual machines. Does the abstract machine of Erlang, JAM, belong to virtual machines? I'm still not sure. 2010/1/21 Angel J. Alvarez Miguel > So then what category erlang, haskell, lisp are? Very high level? DSL's? > > it seems to me that C++, and Java poorly manage to scape 2G paradigms and > do > deserve to loose this "enligthed view as highlevel languages" in favor of > more > recent an modern pythons, rybies, haskell and of course erlang. > > what's your opinion, please tell me. > > Thanks!! > > Some "folks" view C++ or Java as High level languages very capable > languages > even with lots of people questioning now if OOP has failed again > From g9414002.pccu.edu.tw@REDACTED Thu Jan 21 14:47:57 2010 From: g9414002.pccu.edu.tw@REDACTED (=?UTF-8?B?6buD6ICA6LOiIChZYXUtSHNpZW4gSHVhbmcp?=) Date: Thu, 21 Jan 2010 21:47:57 +0800 Subject: [erlang-questions] Creating records dynamically In-Reply-To: <401d3ba31001210530w74c43c12x7e69229418b46c0d@mail.gmail.com> References: <4B5833B0.8010201@geodesic.com> <401d3ba31001210530w74c43c12x7e69229418b46c0d@mail.gmail.com> Message-ID: For a remark: -module(test). -record(sample, {a, b}). test(T) -> case put_vals(T) of #sample{a=X, b=Y} -> [sample, X, Y]; Any -> Any end. put_vals(T) -> {T, 1, 2}. When executing, > test:test(a). {a,1,2} > test:test(sample). [sample,1,2] On Thu, Jan 21, 2010 at 9:30 PM, Attila Rajmund Nohl < attila.r.nohl@REDACTED> wrote: > 2010/1/21, Kiran Khaladkar : > > hi all, > > I have record name in a variable how do i create variable of that. > > e.g. (just a rough example of what the intention is) > > -record(sample, {a,b}). > > put_vals(T) -> > > V = #T{a =1,b=2}. > > > > now when i call put_vals like > > put_vals(sample). > > it will fill the record and return the variable > > The values may be passed as list to put vals like [{a,1}, {b,2}] > > > > there is a way i found but want to know if there is any better way .. > > One can write several put_vals, one each record precisely. > > I don't really understand what you want to achieve, but keep in mind > that the Erlang records are nothing but compile time hacks, internally > they are tuples, so your function would look like this: > > put_vals(T) -> > {T, 1, 2}. > > Of course, this breaks if the internal representation of the records > change, and it's generally ugly. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From clist@REDACTED Thu Jan 21 15:41:22 2010 From: clist@REDACTED (Angel) Date: Thu, 21 Jan 2010 15:41:22 +0100 Subject: [erlang-questions] changes in native functions for the next otp release. In-Reply-To: <4B5852CA.9080809@erix.ericsson.se> References: <201001211340.11272.clist@uah.es> <4B5852CA.9080809@erix.ericsson.se> Message-ID: <201001211541.22696.clist@uah.es> On Jueves, 21 de Enero de 2010 14:12:42 Sverker Eriksson escribi?: > Angel wrote: > > Hi > > > > Some months ago, i discovered that square root of bignums is not > > implemented in erlang. So i developed a tiny C port program to do this > > math stuff. > > > > Now im considering making a NIF implementation.... > > > > i dont know if > > > > int enif_get_int(ErlNifEnv* env, ERL_NIF_TERM term, int* ip) > > > > will allow me to manipulate bignums or i have to resort on binaries. > > No, enif_get_int will only give you integers within the bounds of the > C-type "int". > I guess you have to resort to binaries. > > > ?is erl_nif subject for big changes for the next release? any changes for > > bignums? > > There will be changes and additions but I don't think bignums will make > it to next release. The main problem is to choose a good bignum > representation to use and support for ever. > > > /Sverker, Erlang/OTP Ericsson > > Does erlang convert between internal format to gmp formats over and over when processing bignums, or the structure for erlang bignums are not binary compatible with gmp? maybe you could do just a memcpy over existing bignum to erl_nif space? This would allow direct manipulaton on the C side with gmp. i saw the sources and dont seem very gmpishh... /angel From clist@REDACTED Thu Jan 21 16:26:47 2010 From: clist@REDACTED (Angel) Date: Thu, 21 Jan 2010 16:26:47 +0100 Subject: [erlang-questions] OT: Please highlight me about JAVA C++ as high level languages just like erlang. In-Reply-To: <401d3ba31001210519k40a0ecccwe1540c81e686e4f3@mail.gmail.com> References: <201001210044.07822.clist@uah.es> <401d3ba31001210519k40a0ecccwe1540c81e686e4f3@mail.gmail.com> Message-ID: <201001211626.48093.clist@uah.es> So im really displeased to see everyone still closely tied to the "old classic high level definition". its dificult to place erlang over a plethora of not certainly better languages if all of them are considered equal. As Paul rants i think the long lisp reluctance is mainly based on such a missconception about language expresivennes provided that all being equal level so the more C'ish the better. /Angel On Jueves, 21 de Enero de 2010 14:19:08 Attila Rajmund Nohl escribi?: > 2010/1/21, Angel J. Alvarez Miguel : > [...] > > > Can be Java High level on the same category as C (pointers, arrays), no > > closures, bad generics, even no OOP with mehods calls as messages also > > like C++? > > In my experience everything other than the assembler is considered to > be a "high level" language. This is probably a couple of decades old > definition of high level language, created at a time when FORTRAN, > COBOL and Lisp were the high level languages. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From attila.r.nohl@REDACTED Thu Jan 21 16:38:18 2010 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Thu, 21 Jan 2010 16:38:18 +0100 Subject: [erlang-questions] OT: Please highlight me about JAVA C++ as high level languages just like erlang. In-Reply-To: <201001211626.48093.clist@uah.es> References: <201001210044.07822.clist@uah.es> <401d3ba31001210519k40a0ecccwe1540c81e686e4f3@mail.gmail.com> <201001211626.48093.clist@uah.es> Message-ID: <401d3ba31001210738k285263d1oddc7a88f4d3b4651@mail.gmail.com> I think there's no such thing as "better language". There is a "more feasible language for a certain task", but generally no language is better than the other. 2010/1/21, Angel : > > So im really displeased to see everyone still closely tied to the "old > classic > high level definition". its dificult to place erlang over a plethora of not > certainly better languages if all of them are considered equal. > > As Paul rants i think the long lisp reluctance is mainly based on such a > missconception about language expresivennes provided that all being equal > level so the more C'ish the better. > > /Angel > On Jueves, 21 de Enero de 2010 14:19:08 Attila Rajmund Nohl escribi?: >> 2010/1/21, Angel J. Alvarez Miguel : >> [...] >> >> > Can be Java High level on the same category as C (pointers, arrays), no >> > closures, bad generics, even no OOP with mehods calls as messages also >> > like C++? >> >> In my experience everything other than the assembler is considered to >> be a "high level" language. This is probably a couple of decades old >> definition of high level language, created at a time when FORTRAN, >> COBOL and Lisp were the high level languages. >> >> ________________________________________________________________ >> 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 g9414002.pccu.edu.tw@REDACTED Thu Jan 21 16:39:06 2010 From: g9414002.pccu.edu.tw@REDACTED (=?UTF-8?B?6buD6ICA6LOiIChZYXUtSHNpZW4gSHVhbmcp?=) Date: Thu, 21 Jan 2010 23:39:06 +0800 Subject: [erlang-questions] OT: Please highlight me about JAVA C++ as high level languages just like erlang. In-Reply-To: <201001211626.48093.clist@uah.es> References: <201001210044.07822.clist@uah.es> <401d3ba31001210519k40a0ecccwe1540c81e686e4f3@mail.gmail.com> <201001211626.48093.clist@uah.es> Message-ID: If the level of a language depends on its place in architectures, classification results will be different between scripting Erlang, compiled Erlang, and Erlang on top-level. On Thu, Jan 21, 2010 at 11:26 PM, Angel wrote: > > So im really displeased to see everyone still closely tied to the "old > classic > high level definition". its dificult to place erlang over a plethora of not > certainly better languages if all of them are considered equal. > > As Paul rants i think the long lisp reluctance is mainly based on such a > missconception about language expresivennes provided that all being equal > level so the more C'ish the better. > > /Angel > On Jueves, 21 de Enero de 2010 14:19:08 Attila Rajmund Nohl escribi?: > > 2010/1/21, Angel J. Alvarez Miguel : > > [...] > > > > > Can be Java High level on the same category as C (pointers, arrays), no > > > closures, bad generics, even no OOP with mehods calls as messages also > > > like C++? > > > > In my experience everything other than the assembler is considered to > > be a "high level" language. This is probably a couple of decades old > > definition of high level language, created at a time when FORTRAN, > > COBOL and Lisp were the high level languages. > > > > ________________________________________________________________ > > 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 jonas.falkevik@REDACTED Thu Jan 21 18:35:51 2010 From: jonas.falkevik@REDACTED (Jonas Falkevik) Date: Thu, 21 Jan 2010 18:35:51 +0100 Subject: os:timestamp() uses mutex lock Message-ID: <099150C7-197E-43F2-91CF-2A436D557121@mobilearts.com> Using erlang:now() for taking time stamps is slowing things down if you try to do it in parallell due to the guarantee of uniqueness hence a mutex lock and serialization of the execution. But what if you don't need the uniqueness and would like to trade it to be able to run things in parallell and with smaller overhead? In R12 you would need to implement a new BIF. In R13 with the introduction of NIF's it is easy to implement and deploy your own modified now(). But in R13 the function os:timestamp() seems to have been introduced as well, which does not have the uniqueness but still the mutex lock. What is the need of the mutex lock in this function? Any other way? From kimmo@REDACTED Thu Jan 21 20:41:07 2010 From: kimmo@REDACTED (=?ISO-8859-1?Q?Kimmo_Gl=E4borg?=) Date: Thu, 21 Jan 2010 20:41:07 +0100 Subject: [erlang-questions] Amazon S3 / streaming HTTP upload In-Reply-To: <46167e6a1001201205i69f1a5ccq958725e718401600@mail.gmail.com> References: <46167e6a1001190655g296e7298uee27645c57ad88f@mail.gmail.com> <3e5c3f6aa6f7c27844ba5f67e622f9ce@hellstrom.st> <46167e6a1001200255n21e53ca3ud343a01c5fdcc089@mail.gmail.com> <46167e6a1001201205i69f1a5ccq958725e718401600@mail.gmail.com> Message-ID: On 20 jan 2010, at 21.05, Anton Krasovsky wrote: > Just came across http://github.com/cstar/erls3/ - which seems to be a > perfect fit. It's built on top of ibrowse and supports file > upload/download to Amazon S3 without reading entire file to RAM. That is really cool, does it work to upload to CloudFront also? // kimmo From anton.krasovsky@REDACTED Thu Jan 21 23:27:09 2010 From: anton.krasovsky@REDACTED (Anton Krasovsky) Date: Thu, 21 Jan 2010 22:27:09 +0000 Subject: [erlang-questions] Amazon S3 / streaming HTTP upload In-Reply-To: References: <46167e6a1001190655g296e7298uee27645c57ad88f@mail.gmail.com> <3e5c3f6aa6f7c27844ba5f67e622f9ce@hellstrom.st> <46167e6a1001200255n21e53ca3ud343a01c5fdcc089@mail.gmail.com> <46167e6a1001201205i69f1a5ccq958725e718401600@mail.gmail.com> Message-ID: <46167e6a1001211427h2e628556j1e359104dcd4a40e@mail.gmail.com> Is there any difference? I thought you'd have to upload content to S3 bucket even if you use CloudFront? Anton On Thu, Jan 21, 2010 at 7:41 PM, Kimmo Gl?borg wrote: > On 20 jan 2010, at 21.05, Anton Krasovsky wrote: > >> Just came across http://github.com/cstar/erls3/ - which seems to be a >> perfect fit. It's built on top of ibrowse and supports file >> upload/download to Amazon S3 without reading entire file to RAM. > > That is really cool, does it work to upload to CloudFront also? > > // kimmo > From ok@REDACTED Fri Jan 22 02:09:52 2010 From: ok@REDACTED (Richard O'Keefe) Date: Fri, 22 Jan 2010 14:09:52 +1300 Subject: [erlang-questions] changes in native functions for the next otp release. In-Reply-To: <201001211340.11272.clist@uah.es> References: <201001211340.11272.clist@uah.es> Message-ID: <8E1F9D5A-C8D5-4F2D-AD0D-294069B6D5E6@cs.otago.ac.nz> On Jan 22, 2010, at 1:40 AM, Angel wrote: > Hi > > Some months ago, i discovered that square root of bignums is not > implemented > in erlang. ? 1> math:sqrt(1 bsl 801). 3.65185e+120 math:sqrt is just as much implemented for bignums as it is for fixnums. Or do you mean "the greatest integer X such that X**2 <= Y", the "integer square root"? I didn't think Erlang had that for fixnums either. From ok@REDACTED Fri Jan 22 02:23:26 2010 From: ok@REDACTED (Richard O'Keefe) Date: Fri, 22 Jan 2010 14:23:26 +1300 Subject: [erlang-questions] Creating records dynamically In-Reply-To: References: <4B5833B0.8010201@geodesic.com> <401d3ba31001210530w74c43c12x7e69229418b46c0d@mail.gmail.com> Message-ID: <1269EAB4-5BB0-49F4-8DDD-001A8E254B2A@cs.otago.ac.nz> I'm trying to think of a good use for a function that takes a record name as an argument and uses it for construction. I have had good success imagining square circles, but not this. Amongst other things, - "unwarranted chumminess" with the compiler's representation of records - how come there are lots of record types with the same field names? - what is supposed to happen if you pass an atom that is NOT the name of a record, or is the name of a record but not one visible in this module, or is the name of a record visible in this module that doesn't have all those fields - how would you write a type specification for the put_vals function? - why not pass a constructor *function* instead of a record name, so that you aren't crippled by a restriction to constructing records? E.g., put_vals(F) -> F(1, 2). ... put_vals(fun (X,Y) -> #sample{a = X, b = Y} end) ... Of course, if you find yourself passing the same constructor function more than once, you would do well to give it a name: mk_sample_a_b(A, B) -> #sample{a = A, b = B}. ... put_vals(fun mk_sample_a_b/2) ... Convention: mk_{_}... The horrible thing about Yau-Hsien Huang's sample code -module(test). -record(sample, {a, b}). test(T) -> case put_vals(T) of #sample{a=X, b=Y} -> [sample, X, Y]; Any -> Any end. put_vals(T) -> {T, 1, 2}. is that it breaks if the -record declaration is changed, say to -record(sample, {b, a}). % change order or -record(sample, {a, b, c}). % change size BOA constructors have no place in Erlang. From ok@REDACTED Fri Jan 22 03:13:22 2010 From: ok@REDACTED (Richard O'Keefe) Date: Fri, 22 Jan 2010 15:13:22 +1300 Subject: [erlang-questions] OT: Please highlight me about JAVA C++ as high level languages just like erlang. In-Reply-To: <201001211626.48093.clist@uah.es> References: <201001210044.07822.clist@uah.es> <401d3ba31001210519k40a0ecccwe1540c81e686e4f3@mail.gmail.com> <201001211626.48093.clist@uah.es> Message-ID: <6C36C74E-B8D9-4567-B70C-85A17631B3B0@cs.otago.ac.nz> On Jan 22, 2010, at 4:26 AM, Angel wrote: > > So im really displeased to see everyone still closely tied to the > "old classic > high level definition". its dificult to place erlang over a plethora > of not > certainly better languages if all of them are considered equal. It doesn't matter what we call them, it's STILL difficult to place Erlang amongst a vast range of other languages. Erlang isn't even close to APL2 as a notation for matrix calculations. APL2 isn't even close to Erlang as a notation for concurrency. Neither of them can hold a candle to C as a notation for programming 16-bit microcontrollers, although one could imagine a derivative of Concurrent Pascal that would have been even better. There simply isn't a linear ordering. The most you can say is that one language is higher level than another for certain things. Mind you, it is clearly possible to classify some languages as bad for any practical purpose. Intercal, Brainf*ck, and the whitespace language spring to mind. I recently solved a problem by writing - a data file - an AWK program to compile that into C and running the C program. Doing the whole thing in C would have been slow, because it would have been doing at run time decisions that were better made at meta-compilation time. This kind of thing blurs the "level of a language" idea even further. C on its own: bad. AWK on its own: worse. AWK+C: excellent. I think it gets us further to say "Language X does this, language Y does that, for problem P, what language X does helped me get my program working quicker". The Grand Convergence (where Java and C# and Eiffel and others are borrowing ideas from the functional world and from each other) means that "language Y is no good because it doesn't have feature F" is a permanent truth only for dead languages. From g@REDACTED Fri Jan 22 03:32:47 2010 From: g@REDACTED (Garrett Smith) Date: Thu, 21 Jan 2010 20:32:47 -0600 Subject: [erlang-questions] Creating records dynamically In-Reply-To: <4B5833B0.8010201@geodesic.com> References: <4B5833B0.8010201@geodesic.com> Message-ID: On Thu, Jan 21, 2010 at 5:00 AM, Kiran Khaladkar wrote: > hi all, > I have record name in a variable how do i create variable of that. > e.g. ?(just a rough example of what the intention is) > -record(sample, {a,b}). > put_vals(T) -> > ? ? ?V = #T{a =1,b=2}. > > now when i call put_vals like > put_vals(sample). > it will fill the record and return the variable > The values may be passed as list to put vals like [{a,1}, {b,2}] > > there is a way i found but want to know if there is any better way .. > One can write several put_vals, one each record precisely. The dynamic behavior you're looking for is generally accommodated by proplists, though I presume you have a reason for using records. You might also create a module that provides an API for the data you're looking to manage. In that case you can hide the implementation (use records, dicts, whatever). Garrett From jevin.xu@REDACTED Fri Jan 22 06:28:14 2010 From: jevin.xu@REDACTED (Jevin Xu) Date: Fri, 22 Jan 2010 13:28:14 +0800 Subject: [erlang-questions] calculating memory consumption In-Reply-To: References: <4B5833B0.8010201@geodesic.com> Message-ID: <7C126FDA42E66D4793A28BFAE7A3B14E279B241B81@ESGSCCMS0001.eapac.ericsson.se> Hi, How to calculate the memory consumption by below record in a 64-bit machine: -record(aaa , {bb :: 0..16#fff, % 3 * 4bit BCD cc :: 0..16#fff, % 3 * 4bit BCD dd :: 0..16#ffff, % 16bit ee :: 0..16#ff}). % 8bit Thanks ________________________________________________________________ erlang-questions mailing list. See http://www.erlang.org/faq.html erlang-questions (at) erlang.org From ok@REDACTED Fri Jan 22 07:07:09 2010 From: ok@REDACTED (Richard O'Keefe) Date: Fri, 22 Jan 2010 19:07:09 +1300 Subject: [erlang-questions] calculating memory consumption In-Reply-To: <7C126FDA42E66D4793A28BFAE7A3B14E279B241B81@ESGSCCMS0001.eapac.ericsson.se> References: <4B5833B0.8010201@geodesic.com> <7C126FDA42E66D4793A28BFAE7A3B14E279B241B81@ESGSCCMS0001.eapac.ericsson.se> Message-ID: <0DEC7C5C-EF7F-4FB4-A953-BD26628C14FC@cs.otago.ac.nz> On Jan 22, 2010, at 6:28 PM, Jevin Xu wrote: > Hi, > > How to calculate the memory consumption by below record in a 64-bit > machine: > > -record(aaa , {bb :: 0..16#fff, % 3 * 4bit BCD > cc :: 0..16#fff, % 3 * 4bit BCD > dd :: 0..16#ffff, % 16bit > ee :: 0..16#ff}). % 8bit It's a tuple with five slots, one for each field + one for the tag. According to the efficiency guide, tuples take 2 words + the size of each element, so this is 7 words, or 56 bytes. (Plus of course the word needed to point to it.) On a 32-bit machine, it would be 28 bytes. You actually have 6 bytes of data. I would hope that a 6-byte integer would be held as a single word on a 64-bit machine. Is that so? If so, by holding this as a number, you'd save 56 bytes per "record". (The efficiency guide says that the range of fixnums is (-16#7FFFFFF < i <16#7FFFFFF), or 28 bits. I've always hoped that that was simply an incomplete edit, and that 64-bit Erlang allowed 60-bit fixnums. If not, why not? From bgustavsson@REDACTED Fri Jan 22 07:17:10 2010 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Fri, 22 Jan 2010 07:17:10 +0100 Subject: [erlang-questions] calculating memory consumption In-Reply-To: <0DEC7C5C-EF7F-4FB4-A953-BD26628C14FC@cs.otago.ac.nz> References: <4B5833B0.8010201@geodesic.com> <7C126FDA42E66D4793A28BFAE7A3B14E279B241B81@ESGSCCMS0001.eapac.ericsson.se> <0DEC7C5C-EF7F-4FB4-A953-BD26628C14FC@cs.otago.ac.nz> Message-ID: <6672d0161001212217u5f8e42efic054cc00700a563c@mail.gmail.com> On Fri, Jan 22, 2010 at 7:07 AM, Richard O'Keefe wrote: > (The efficiency guide says that the range of fixnums is > (-16#7FFFFFF < i <16#7FFFFFF), or 28 bits. ?I've always > hoped that that was simply an incomplete edit, and that > 64-bit Erlang allowed 60-bit fixnums. ?If not, why not? It is an incomplete edit. Fixnums *are* 60 bits on a 64-bit machine. -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From leap@REDACTED Fri Jan 22 09:02:15 2010 From: leap@REDACTED (Michael Turner) Date: Fri, 22 Jan 2010 08:02:15 +0000 Subject: [erlang-questions] OT: Please highlight me about JAVA C++ as high level languages just like erlang. In-Reply-To: <6C36C74E-B8D9-4567-B70C-85A17631B3B0@cs.otago.ac.nz> Message-ID: I'd always assumed that the "level" in "high level language" was a measure of abstraction in some software concept domain, not of performance or suitability for some particular purpose. If C is good when a 16-bit microcontroller is the target, it's because C can get you quite close to the bare metal, which is how you typically extract the use-value of such a part. The *costs* and *risks* of being so close to bare metal should go without saying -- "close", in this case, means "almost down to". (Wasn't it Dennis Ritchie himself who quipped "C combines the flexibility of assembly language with the power of assembly language"?) Admittedly, this picture is complicated by the metaprogramming aspects of languages. Take BLISS -- it was a bare-metal programming language with a Turing-complete macro facility. C++ can also be used near bare metal (indeed, when I taught a course in it I was amused to see how many of my students were embedded systems developers) but its template syntax rivals or exceeds the power of BLISS macros and continues to reach higher. However, one might consider metaprogrammability simply yet another of several possible domains for a language -- the reflexive one. I'd say that Erlang and the LISPs, Smalltalk and some others (even Forth, IIRC) are higher level than C++ in metaprogrammability, even if C++ is still relatively high in that way. Yes, the Boost library provides a kind of lambda for C++, but only in a way that's so clunky as to clearly not be a "part of" C++; more an argument for Greenspun's Tenth Law if anything. -michael On 1/22/2010, "Richard O'Keefe" wrote: > >On Jan 22, 2010, at 4:26 AM, Angel wrote: > >> >> So im really displeased to see everyone still closely tied to the >> "old classic >> high level definition". its dificult to place erlang over a plethora >> of not >> certainly better languages if all of them are considered equal. > >It doesn't matter what we call them, it's STILL difficult to place >Erlang amongst a vast range of other languages. > >Erlang isn't even close to APL2 as a notation for matrix calculations. >APL2 isn't even close to Erlang as a notation for concurrency. >Neither of them can hold a candle to C as a notation for programming >16-bit microcontrollers, although one could imagine a derivative of >Concurrent Pascal that would have been even better. > >There simply isn't a linear ordering. >The most you can say is that one language is higher level than >another for certain things. > >Mind you, it is clearly possible to classify some languages as bad >for any practical purpose. Intercal, Brainf*ck, and the whitespace >language spring to mind. > >I recently solved a problem by writing > - a data file > - an AWK program to compile that into C >and running the C program. Doing the whole thing in C would have >been slow, because it would have been doing at run time decisions >that were better made at meta-compilation time. > >This kind of thing blurs the "level of a language" idea even >further. C on its own: bad. AWK on its own: worse. AWK+C: excellent. > >I think it gets us further to say "Language X does this, language Y >does that, for problem P, what language X does helped me get my >program working quicker". The Grand Convergence (where Java and C# >and Eiffel and others are borrowing ideas from the functional world >and from each other) means that "language Y is no good because it >doesn't have feature F" is a permanent truth only for dead languages. > > >________________________________________________________________ >erlang-questions mailing list. See http://www.erlang.org/faq.html >erlang-questions (at) erlang.org > > From yogishb@REDACTED Fri Jan 22 08:53:57 2010 From: yogishb@REDACTED (Yogish Baliga) Date: Thu, 21 Jan 2010 23:53:57 -0800 (PST) Subject: Reading disc_copies table into memory upon starting mnesia Message-ID: <56717.23486.qm@web112612.mail.gq1.yahoo.com> Hello all, Recently I noticed that disc_copies will try to read everything from the table into memory during startup. Even though the table size is around 20MB, memory consumed is around 500MB. As the size of the table increases, there is a high chance that it is not possible to start mnesia anymore as all memory is consumed by mnesia disc_copies table and before it could successfully start, VM crashes. Is there any plan to re-implement disc_copies table without reading whole table into memory, instead read only partial data into memory. And also to specify the max. memory that can be allocated for mnesia tables [as in MySQL innodb_buffer_pool_size parameter]. -- baliga "Point of view is worth 80 IQ points" --Alan Kay http://dudefrommangalore.blogspot.com/ From ad.sergey@REDACTED Fri Jan 22 10:18:57 2010 From: ad.sergey@REDACTED (Sergey Samokhin) Date: Fri, 22 Jan 2010 12:18:57 +0300 Subject: [erlang-questions] passing an include path to escript In-Reply-To: <18a1db030912010937y51eac9b6rb399631e6064cc3e@mail.gmail.com> References: <18a1db030912010937y51eac9b6rb399631e6064cc3e@mail.gmail.com> Message-ID: On Tue, Dec 1, 2009 at 8:37 PM, zabrane Mikael wrote: > 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"? Does anybody know, are there any plans on allowing "include" to be used inside escripts? I'm writing a small library for parsing CLI arguments. I think specifications looks much simplier to understand, if they a list of records: Specs = [ #opt{long_name = help, short_name = h, type = boolean}, #opt{long_name = version, short_name = v, type = boolean, validator = fun(_Val) -> ok end} ] than a list of tuples: Specs = [{help, [{short_name, h}, {type, boolean}]}, {version, [{short_name, v}, {type, boolean}, {validator, fun(_Val) -> ok end}]] Currently the only way to specify which options to get is by using list of tuples. -- Sergey From dangud@REDACTED Fri Jan 22 10:24:02 2010 From: dangud@REDACTED (Dan Gudmundsson) Date: Fri, 22 Jan 2010 10:24:02 +0100 Subject: [erlang-questions] Reading disc_copies table into memory upon starting mnesia In-Reply-To: <56717.23486.qm@web112612.mail.gq1.yahoo.com> References: <56717.23486.qm@web112612.mail.gq1.yahoo.com> Message-ID: <93df43b61001220124w6cb411bcva23696a4523474ea@mail.gmail.com> There are no such plans, mnesia is mostly (except for disc_only) a ram based database. /Dan On Fri, Jan 22, 2010 at 8:53 AM, Yogish Baliga wrote: > Hello all, > > ?Recently I noticed that disc_copies will try to read everything from the table into memory during startup. Even though the table size is around 20MB, memory consumed is around 500MB. As the size of the table increases, there is a high chance that it is not possible to start mnesia anymore as all memory is consumed by mnesia disc_copies table and before it could successfully start, VM crashes. > > ?Is there any plan to re-implement disc_copies table without reading whole table into memory, instead read only partial data into memory. And also to specify the max. memory that can be allocated for mnesia tables [as in MySQL innodb_buffer_pool_size parameter]. > > -- baliga > > > "Point of view is worth 80 IQ points" --Alan Kay > > http://dudefrommangalore.blogspot.com/ From zabrane3@REDACTED Fri Jan 22 10:38:22 2010 From: zabrane3@REDACTED (zabrane Mikael) Date: Fri, 22 Jan 2010 10:38:22 +0100 Subject: [erlang-questions] passing an include path to escript In-Reply-To: References: <18a1db030912010937y51eac9b6rb399631e6064cc3e@mail.gmail.com> Message-ID: <18a1db031001220138o68cfd680qe0089632edefb19a@mail.gmail.com> Hi Sergey, As "Nick Genrakines" show me the trick, here is a working solution: 1. assume your code lives inside "mycode" directory 2. assume your .hrl lives inside an "include" directory mycode |________include: my.hrl 3. Then, your escript could simply include that .hrl like this: #!/usr/bin/env escript %% -*- erlang -*- %%! -pz ../mycode ebin -include_lib("mycode/include/my.hrl"). Regards Zabrane 2010/1/22 Sergey Samokhin > On Tue, Dec 1, 2009 at 8:37 PM, zabrane Mikael wrote: > > 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"? > > Does anybody know, are there any plans on allowing "include" to be > used inside escripts? > > I'm writing a small library for parsing CLI arguments. I think > specifications looks much simplier to understand, > if they a list of records: > > Specs = > [ > #opt{long_name = help, > short_name = h, > type = boolean}, > #opt{long_name = version, > short_name = v, > type = boolean, > validator = fun(_Val) -> ok end} > ] > > than a list of tuples: > > Specs = > [{help, [{short_name, h}, {type, boolean}]}, > {version, [{short_name, v}, {type, boolean}, {validator, > fun(_Val) -> ok end}]] > > Currently the only way to specify which options to get is by using > list of tuples. > > -- > Sergey > From ad.sergey@REDACTED Fri Jan 22 10:42:43 2010 From: ad.sergey@REDACTED (Sergey Samokhin) Date: Fri, 22 Jan 2010 12:42:43 +0300 Subject: [erlang-questions] passing an include path to escript In-Reply-To: <18a1db031001220138o68cfd680qe0089632edefb19a@mail.gmail.com> References: <18a1db030912010937y51eac9b6rb399631e6064cc3e@mail.gmail.com> <18a1db031001220138o68cfd680qe0089632edefb19a@mail.gmail.com> Message-ID: > Hi Sergey, > As "Nick Genrakines" show me the trick, here is a working solution: > 1. assume your code lives inside "mycode" directory > 2. assume your .hrl lives inside an "include" directory > mycode > |________include: my.hrl > 3. Then, your escript could simply include that .hrl like this: > #!/usr/bin/env escript > %% -*- erlang -*- > %%! -pz ../mycode ebin > -include_lib("mycode/include/my.hrl"). Thanks a lot! -- ?????? ??????? ?-??????????? MadGroup jabber: sergey@REDACTED e-mail: sergey@REDACTED ???.: +7 (916) 740-31-86 From ulf.wiger@REDACTED Fri Jan 22 10:56:42 2010 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Fri, 22 Jan 2010 10:56:42 +0100 Subject: [erlang-questions] Creating records dynamically In-Reply-To: <4B5833B0.8010201@geodesic.com> References: <4B5833B0.8010201@geodesic.com> Message-ID: <4B59765A.6070704@erlang-solutions.com> Kiran Khaladkar wrote: > hi all, > I have record name in a variable how do i create variable of that. > e.g. (just a rough example of what the intention is) > -record(sample, {a,b}). > put_vals(T) -> > V = #T{a =1,b=2}. > > now when i call put_vals like > put_vals(sample). > it will fill the record and return the variable > The values may be passed as list to put vals like [{a,1}, {b,2}] > > there is a way i found but want to know if there is any better way .. > One can write several put_vals, one each record precisely. The exprecs parse transform does this automatically for selected records. http://forum.trapexit.org/viewtopic.php?p=21790#21790 FWIW, the very latest version can be found as part of http://svn.ulf.wiger.net/parse_trans/ BR, Ulf W -- Ulf Wiger CTO, Erlang Solutions Ltd, formerly Erlang Training & Consulting Ltd http://www.erlang-solutions.com --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From chan.sisowath@REDACTED Fri Jan 22 11:09:27 2010 From: chan.sisowath@REDACTED (chan sisowath) Date: Fri, 22 Jan 2010 11:09:27 +0100 Subject: [erlang-questions] Compiling otp_src_R13B03 on AIX 5.2 Message-ID: <57d992fd1001220209x251c21b5gd2baf7a7f57a114e@mail.gmail.com> hi, i patched otp_src_R13B03 following this http://old.nabble.com/attachment/17957627/0/erlang-aix.diff (patch for R12B-2) my env: GCC -v: Reading specs from /opt/freeware/lib/gcc-lib/powerpc-ibm-aix5.2.0.0/3.3.2/specs Configured with: ../configure --with-as=/usr/bin/as --with-ld=/usr/bin/ld --disable-nls --enable-languages=c,c++ --prefix=/opt/freeware --enable-threads --enable-version-specific-runtime-libs --host=powerpc-ibm-aix5.2.0.0 Thread model: aix gcc version 3.3.2 configure: $>sh configure --prefix=$NX_ROOT/temp/tmpc/SRC/root i had 2 error durring the compilation: drivers/common/inet_drv.c: In function `inet_ctl_fdopen': drivers/common/inet_drv.c:3755: warning: passing arg 3 of `ngetsockname' from incompatible pointer type drivers/common/inet_drv.c:3767: warning: passing arg 3 of `ngetpeername' from incompatible pointer type drivers/common/inet_drv.c: In function `inet_ctl_ifget': drivers/common/inet_drv.c:4276: error: `IFF_MULTICAST' undeclared (first use in this function) drivers/common/inet_drv.c:4276: error: (Each undeclared identifier is reported only once drivers/common/inet_drv.c:4276: error: for each function it appears in.) drivers/common/inet_drv.c: In function `inet_fill_opts': ... and ... ../unix/run_erl.c: In function `open_pty_master': ../unix/run_erl.c:868: warning: implicit declaration of function `posix_openpt' ../unix/run_erl.c: In function `set_window_size': ../unix/run_erl.c:1258: error: storage size of `ws' isn't known ../unix/run_erl.c:1261: warning: implicit declaration of function `ioctl' ../unix/run_erl.c:1261: error: invalid application of `sizeof' to an incomplete type ../unix/run_erl.c:1258: warning: unused variable `ws' make[4]: *** [/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/erts/obj/powerpc-ibm-aix5.2.0.0/run_erl.o] Error 1 make[4]: Leaving directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/erts/etc/common' make[3]: *** [opt] Error 2 make[3]: Leaving directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/erts/etc/common' make[2]: *** [opt] Error 2 make[2]: Leaving directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/erts/etc' make[1]: *** [opt] Error 2 make[1]: Leaving directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/erts' make: *** [emulator] Error 2 i solve the first one by adding a define in the file erts/emulator/drivers/common/inet_drv.c #ifndef _OSE_ #ifdef HAVE_MULTICAST_SUPPORT #define IP_MULTICAST 1 #endif #include #else #define IFF_MULTICAST 0x00000800 #endif for the second error: in the file erts/etc/unix/run_erl.c #ifdef HAVE_SYS_IOCTL_H #ifndef _ALL_SOURCE #define _ALL_SOURCE 1 #endif #include #endif i don't know if it is the right thing to do. (if you have a better solution i m a ware) after that i have this one I don't know what to do. make[3]: Entering directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/asn1/src' make[3]: Nothing to be done for `opt'. make[3]: Leaving directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/asn1/src' make[3]: Entering directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/asn1/doc/src' make[3]: Nothing to be done for `opt'. make[3]: Leaving directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/asn1/doc/src' make[3]: Entering directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/asn1/c_src' make -f powerpc-ibm-aix5.2.0.0/Makefile TYPE=opt make[4]: Entering directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/asn1/c_src' gcc -bnoentry -bexpall -G -L/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/erl_interface/obj/powerpc-ibm-aix5.2.0.0 -o /applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/asn1/priv/lib/powerpc-ibm-aix5.2.0.0/asn1_erl_drv.so /applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/asn1/priv/obj/powerpc-ibm-aix5.2.0.0/asn1_erl_drv.o -lei -lc -ldl -lm gcc: couldn't run `expall-gcc-3.3.2': No such file or directory make[4]: *** [/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/asn1/priv/lib/powerpc-ibm-aix5.2.0.0/asn1_erl_drv.so] Error 1 make[4]: Leaving directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/asn1/c_src' make[3]: *** [opt] Error 2 make[3]: Leaving directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/asn1/c_src' make[2]: *** [opt] Error 2 make[2]: Leaving directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib/asn1' make[1]: *** [opt] Error 2 make[1]: Leaving directory `/applis/list/oasis/oasis/produit/temp/tmpc/SRC/otp_src_R13B03/lib' make: *** [libs] Error 2 if you have any suggestion, it would be nice. thx. From ft@REDACTED Fri Jan 22 10:31:34 2010 From: ft@REDACTED (Fredrik Thulin) Date: Fri, 22 Jan 2010 10:31:34 +0100 Subject: finding hard to find bugs in production systems Message-ID: <1264152694.903.9.camel@ft-laptop.thulin.net> Hi I have a rather large user of YXA that are experiencing problems with beam consuming 100% CPU until they restart it, about once a month. What are people doing to find this kind of bugs? I seem to remember someone writing that they dump state of all processes periodically in their production systems - does anyone has code to that effect to share? I suspect the bug they are experiencing appears to be something similar to http://old.nabble.com/100--CPU-usage-on-Mac-OS-X-Leopard-after-peer-closes-socket-td16731178.html although it might of course be something in YXA... It is not that particular problem although there are similarities, they are running R12 and on BSD (FreeBSD). I don't think my user is really capable of attaching to the running nodes and performing very much fault isolation when this happens, partly because of lack of Erlang wizard status, and also because of urgency to get the node back up running. Any ideas (and especially code ;) ) will be greatly appreciated. /Fredrik From kenneth.lundin@REDACTED Fri Jan 22 11:46:21 2010 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Fri, 22 Jan 2010 11:46:21 +0100 Subject: [erlang-questions] os:timestamp() uses mutex lock In-Reply-To: <099150C7-197E-43F2-91CF-2A436D557121@mobilearts.com> References: <099150C7-197E-43F2-91CF-2A436D557121@mobilearts.com> Message-ID: Hi Jonas, We have checked, and it is actually unnecessary to have the mutex lock in the os:timestamp case. The fastest way for you to get this changed is to do it yourself and provide it as a patch to the pu branch at github. See instructions for how to provide patch at http://wiki.github.com/erlang/otp/ /Kenneth Erlang/OTP Ericsson On Thu, Jan 21, 2010 at 6:35 PM, Jonas Falkevik wrote: > Using erlang:now() for taking time stamps is slowing things down if you try > to do it in parallell due to the guarantee of uniqueness hence a mutex lock > and serialization of the execution. > > But what if you don't need the uniqueness and would like to trade it to be > able to run things in parallell and with smaller overhead? > > In R12 you would need to implement a new BIF. > > In R13 with the introduction of NIF's it is easy to implement and deploy > your own modified now(). > > But in R13 the function os:timestamp() seems to have been introduced as > well, which does not have the uniqueness but still the mutex lock. > What is the need of the mutex lock in this function? > > Any other way? > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From kenneth.lundin@REDACTED Fri Jan 22 11:56:09 2010 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Fri, 22 Jan 2010 11:56:09 +0100 Subject: [erlang-questions] Reading disc_copies table into memory upon starting mnesia In-Reply-To: <56717.23486.qm@web112612.mail.gq1.yahoo.com> References: <56717.23486.qm@web112612.mail.gq1.yahoo.com> Message-ID: Hi, As already answered by Dan disc_copies means storing the table inram but with copy on disc. If you mean that the tables take 20MB on disc but blows up to 500MB in RAM I think that seems strange. What kind of data do you have in that case? And are you running a 64 bit system? Having strings as lists can give an expansion from the external format (used on disc) to the internal format by a factor of 16. But there are other datatypes like atoms which are more compact in the internal format than in the external. By changing strings from lists to binaries you can avoid the expansion , they will take similar space in extenal and internal representation. /Kenneth Erlang/OTP Ericsson On Fri, Jan 22, 2010 at 8:53 AM, Yogish Baliga wrote: > Hello all, > > ?Recently I noticed that disc_copies will try to read everything from the table into memory during startup. Even though the table size is around 20MB, memory consumed is around 500MB. As the size of the table increases, there is a high chance that it is not possible to start mnesia anymore as all memory is consumed by mnesia disc_copies table and before it could successfully start, VM crashes. > > ?Is there any plan to re-implement disc_copies table without reading whole table into memory, instead read only partial data into memory. And also to specify the max. memory that can be allocated for mnesia tables [as in MySQL innodb_buffer_pool_size parameter]. > > -- baliga > > > "Point of view is worth 80 IQ points" --Alan Kay > > http://dudefrommangalore.blogspot.com/ From raimo+erlang-questions@REDACTED Fri Jan 22 16:31:25 2010 From: raimo+erlang-questions@REDACTED (Raimo Niskanen) Date: Fri, 22 Jan 2010 16:31:25 +0100 Subject: [erlang-questions] inet:gethostbyname question In-Reply-To: <276141.49747.qm@web112617.mail.gq1.yahoo.com> References: <682273.7692.qm@web112607.mail.gq1.yahoo.com> <20100118152418.GD10908@erix.ericsson.se> <992517.64629.qm@web112617.mail.gq1.yahoo.com> <20100120082338.GB19148@erix.ericsson.se> <308310.6917.qm@web112608.mail.gq1.yahoo.com> <20100121084326.GA10030@erix.ericsson.se> <276141.49747.qm@web112617.mail.gq1.yahoo.com> Message-ID: <20100122153125.GA4818@erix.ericsson.se> Alright, I think I have figured this one out... R13 relies very much on the native resolver. If it fails it is considered to be right. It is not even tried to see if the lookup is for the own name and this is a bug. You are supposed to always be able to look up your own hostname at least into the loopback address. We will correct this while taking a look at translation of IP address string hostnames. There was a change I think sometime during R13 into not using the inet_hosts file mechanism for this fallback and this odd case where the native resolver fails fools the new fallback. If you manage to configure your native resolver you will be fine. These are the configuration files involved: /etc/hosts /etc/resolv.con /etc/nsswich.conf You can test the native resolver with inet_gethost_native:gethostbyname(Host). And almost the same from the Unix shell: $ getent hosts Host The symptom of the changing resolver search option is unimportant. I bet you have no "search" line, but possibly a "domain" line. The normal pass through inet_config:init() will manage to figure out your domain and sets the search option but at the very end of the function when it finds the resolver option resolv_conf is not set it reads the /etc/resolv.conf file but first clears nameservers and search list, and since there is no "search" line it stays cleared. Your fix call of inet_config:init() will find do the same but find that the resolv_conf option is set and not clear the search list. That the search option is empty is no problem for inet_res (the [dns] lookup method) since if it is empty inet_res uses the domain option as search option. And if you do not have the [naitive] lookup method the fallback of translating the local hostname into 127.0.0.1 will not be fooled. / Raimo On Thu, Jan 21, 2010 at 11:43:31PM -0800, Yogish Baliga wrote: > Attaching the output between "********************************" > > Thanx, > -- baliga > > > ________________________________ > From: Raimo Niskanen > To: Yogish Baliga ; erlang-questions@REDACTED > Sent: Thu, January 21, 2010 12:43:26 AM > Subject: Re: [erlang-questions] inet:gethostbyname question > > On Wed, Jan 20, 2010 at 10:11:39AM -0800, Yogish Baliga wrote: > > > > On Mon, Jan 18, 2010 at 09:21:06PM -0800, Yogish Baliga wrote: > > > > > > Which R13 release is it? The code involved was > > > extensively rewritten in R13B02. > > > > > > Using latest version of R13. > > > > > > And what does inet_db:gethostname() acutally return? > > > > > > > > > inet_db:gethostname() return gw06 > > > > > > > Then we continue with these commands: > > erlang:system_info(system_version). > > application:get_env(kernel, inetrc). > > node(). > > inet_db:gethostname(). > > io:format("~p~n", [ets:tab2list(inet_db)]). > > Oh, I was unclear, I wanted to see the output of those commands... > > *************************************************** > (baliga@REDACTED)1> erlang:system_info(system_version). > "Erlang R13B03 (erts-5.7.4) [source] [64-bit] [smp:8:8] [rq:8] [async-threads:0] [hipe] [kernel-poll:false]\n" > (baliga@REDACTED)2> application:get_env(kernel, inetrc). > undefined > (baliga@REDACTED)3> node(). > 'baliga@REDACTED' > (baliga@REDACTED)4> inet_db:gethostname(). > "gw06" > (baliga@REDACTED)5> io:format("~p~n", [ets:tab2list(inet_db)]). > [{res_resolv_conf_info,{file_info,254,regular,undefined,undefined, > {{2010,1,21},{23,24,59}}, > {{2010,1,21},{23,24,59}}, > 33188,1,64769,0,39458288,0,0}}, > {res_hosts_file_info,{file_info,155,regular,undefined,undefined, > {{2010,1,19},{12,24,24}}, > {{2010,1,19},{12,24,24}}, > 33188,1,64769,0,39454378,0,0}}, > {res_domain,"yahoo.com"}, > {res_hosts_file_tm,1264145110}, > {res_resolv_conf_tm,1264145110}, > {cache_refresh_interval,3600000}, > {socks5_noproxy,[]}, > {res_retry,3}, > {res_search,[]}, > {res_resolv_conf,"/etc/resolv.conf"}, > {res_inet6,false}, > {res_recurse,true}, > {hostname,"gw06"}, > {res_udp_payload_size,1280}, > {cache_size,100}, > {sctp_module,inet_sctp}, > {udp_module,inet_udp}, > {tcp_module,inet_tcp}, > {res_hosts_file,"/etc/hosts"}, > {res_id,0}, > {socks5_port,1080}, > {res_timeout,2000}, > {res_edns,false}, > {res_alt_ns,[]}, > {socks5_methods,[none]}, > {res_ns,[{{68,180,184,17},53},{{68,180,184,18},53},{{68,180,184,19},53}]}, > {res_usevc,false}, > {socks5_server,[]}, > {res_lookup,[native]}] > ok > **************************************************************** > > immediately after starting a node, and then after > > your fix by calling inet_config:init(): > > inet_db:gethostname(). > > io:format("~p~n", [ets:tab2list(inet_db)]). > > And those... > > ************************************************************** > (baliga@REDACTED)5> inet_db:gethostname(). > "gw06" > (baliga@REDACTED)6> io:format("~p~n", [ets:tab2list(inet_db)]). > [{res_resolv_conf_info,{file_info,254,regular,undefined,undefined, > {{2010,1,21},{23,24,59}}, > {{2010,1,21},{23,24,59}}, > 33188,1,64769,0,39458288,0,0}}, > {res_hosts_file_info,{file_info,155,regular,undefined,undefined, > {{2010,1,19},{12,24,24}}, > {{2010,1,19},{12,24,24}}, > 33188,1,64769,0,39454378,0,0}}, > {res_domain,"yahoo.com"}, > {res_hosts_file_tm,1264145922}, > {res_resolv_conf_tm,1264145922}, > {cache_refresh_interval,3600000}, > {socks5_noproxy,[]}, > {res_retry,3}, > {res_search,["oss.search.sk1.yahoo.com"]}, > {res_resolv_conf,"/etc/resolv.conf"}, > {res_inet6,false}, > {res_recurse,true}, > {hostname,"gw06"}, > {res_udp_payload_size,1280}, > {cache_size,100}, > {sctp_module,inet_sctp}, > {udp_module,inet_udp}, > {tcp_module,inet_tcp}, > {res_hosts_file,"/etc/hosts"}, > {res_id,0}, > {socks5_port,1080}, > {res_timeout,2000}, > {res_edns,false}, > {res_alt_ns,[]}, > {socks5_methods,[none]}, > {res_ns,[{{68,180,184,17},53},{{68,180,184,18},53},{{68,180,184,19},53}]}, > {res_usevc,false}, > {socks5_server,[]}, > {res_lookup,[native]}] > ok > ************************************************************** > > > again, and we'll see what changed... > > > > > > ***** Nothing changed after inet_config:init(). > > Previously you stated that the return values of > inet_db:res_option(search) and inet_db:res_option(domain) > changed after calling inet_config:init(), and those > are among the entries in the ets table inet_db, so > now you are contradicting yourself or just missed > that little change... Can I see the complete outputs, please? > > I take my words back on "nothing changed after inet_config:init(). Actually res_search changed in inet_db ets table. > > > > > Try also to start a fresh node, check ets:i(inet_db) > > to see that the table is as above. Then call > > inet_res:gethostbyname("gw06") and then: > > inet_db:gethostname(). > > io:format("~p~n", [ets:tab2list(inet_db)]). > > to see if that call changes something... > > > > ************* Nothing changed after this too. > > > > > > > > > > inet_db:res_option(lookup). > > > > [dns,native,file]. > > > > inet:gethostbyname(inet_db:gethostname()) > > > > {error,nxdomain} > > > > inet_db:set_lookup([dns]). > > > > inet:gethostbyname(inet_db:gethostname()) > > > > {ok,{hostent,"gw06",[],inet,4,[{127,0,0,1}]}} > > > > Try the individual resolver components: > > inet_res:gethostbyname("gw06"). > > {ok, {hostent.....}} [works] > > > > inet_gethost_native:gethostbyname("gw06"). > > {error, not_found}. > > > > inet_hosts:gethostbyname("gw06"). > > {error,nxdomain} > > > > and we'll see what they think. > > > > Looks like dns resolver work but the native and file resolver does not work. > > > > For the native resolver, I tried remvoing "domain" line from /etc/resolv.conf. It seems to be working. > > And the contents of /etc/resolv.conf is also interesting > to explain the native resolver and on some systems > /etc/nsswitc.conf. As is the contents of /etc/hosts... > > And, of course, what is your operating system: > 1> os:type() > and > $ uname -a > > ******************************** > > (baliga@REDACTED)8> os:type(). > {unix,linux} > > [baliga@REDACTED etc]$ uname -a > Linux gw06.oss.search.sk1.yahoo.com 2.6.9-67.ELsmp #1 SMP Wed Nov 7 13:56:44 EST 2007 x86_64 > > ******************************** > > > > In R13, default lookup is [native] and in R12 is [native,file]. > > > > Setting lookup to [native,file] in R13 does not work either. > > > > In both versions, dns resolver works. > > > > For the time being, I am removing domain entry from /etc/resolv.conf file. > > > > Thanx, > > -- baliga > > > > > > > > > > Having lookup method to 3 elements [dns,native,file] is not working. If I set it to only "dns", it is working. Also noticed that > > > > > > > > inet_db:res_option(search). > > > > [] > > > > inet_db:res_option(domain). > > > > "example.com" > > > > > > > > Then I execute, > > > > > > > > inet_config:init(). > > > > > > > > This function is called by inet_db:start_link(), which is called by kernel:init(). > > > > > > > > After executing inet_config:init(), > > > > > > > > inet_db:res_option(search). > > > > ["sk1.example.com"]. > > > > inet_db:res_option(domain). > > > > "example.com". > > > > > > > > > > > > After executing inet_config:init(), order of lookup methods doesn't matter. As long as I have dns in the list, it works. > > > > > > > > inet:gethostbyname(inet_db:gethostname()). > > > > {ok,{hostent,"gw06.sk1.example.com",[],inet,4,[{127,0,0,1}]}} > > > > > > > > Any idea, why inet_config:init() called by kernel->inet_db:start_link() is not working as expected? > > > > > > > > Thanx, > > > > -- baliga > > > > > > > > "Point of view is worth 80 IQ points" --Alan Kay > > > > > > > > http://dudefrommangalore.blogspot.com/ > > > -- > > > > > > / 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 > > -- > > / Raimo Niskanen, Erlang/OTP, Ericsson AB -- / Raimo Niskanen, Erlang/OTP, Ericsson AB From eodbat@REDACTED Sat Jan 23 00:26:23 2010 From: eodbat@REDACTED (eolo999) Date: Fri, 22 Jan 2010 15:26:23 -0800 (PST) Subject: wx on Linux x86_64 crashes In-Reply-To: <4B1FDA8B.4040503@ernovation.com> References: <4B1FDA8B.4040503@ernovation.com> Message-ID: <32ee96e8-0876-4ebf-a9cd-f8a15bfea62d@p24g2000yqm.googlegroups.com> Same issue here. Did you find a solution? My real problem is that also debugger:start() seems to rely on wx. Any help would be appreciated. On Dec 9 2009, 6:12?pm, Erik Reitsma wrote: > 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. > > ________________________________________________________________ > erlang-questions mailing list. Seehttp://www.erlang.org/faq.html > erlang-questions (at) erlang.org From clist@REDACTED Sat Jan 23 04:09:42 2010 From: clist@REDACTED (Angel) Date: Sat, 23 Jan 2010 04:09:42 +0100 Subject: [erlang-questions] OT: Please highlight me about JAVA C++ as high level languages just like erlang. In-Reply-To: References: Message-ID: <201001230409.43130.clist@uah.es> Thanks Michael, and all people. Definitely (just for helping newbies choose where to spent their time) My vision about computer languages is something along this: - Wassup men!! ?i have some spare time You know? , Im considering learning to program computers!! Now boy, come on!! tell me whats best language!!! - Sure!! Leptons is your color!!! that kinda funny lang men!! the best!!!! trust me is damn fast, bare metal ??you know!! zwwwipppp!! - So fast!! i can't wait - Sure dude, all people know leptons!! They do!!! I almost spent last two months hacking a kind of thing i call STRING!! is cool, millions and millions of leptons, muons and mesons you know! -- Gauu i see, im impressed!! - Sure!! da thing its cool, so i managed later to make still more milliion of them and make atoms!! yeahh i tell you, those BIG atoms allowed me to to logic gates!!! - Macho macho men !! -Wait!!! its not the end, those funky gates... store bits!! and some of them bytes... -IM DISMAYED!! -Take easy men,!!! you'll learn this soon!! so i managed again to make caracters to make words!!! trust me, i dont cheat!! and ITS BLAZING FAST!!! - You are the ONE guy!! i almost go wrong on trying to learng BRICKS.. - BRICKS!! Are you mad!! this is for academic freaks nobody else will even think using it!! Hear me, it is no way men HOUSES!!! what's that? almost all you can make with this are HOUSES terrible boring. - Yeahh, full of shit!!! i saw they have also electric outlets!!... -Yeahh men you told it ??SHITTT!! ???OUTLETS!!! what is cool.... ... is to make the electrons yourself!! /Angel Sorry for my english!! On Viernes, 22 de Enero de 2010 09:02:15 usted escribi?: > I'd always assumed that the "level" in "high level language" was a > measure of abstraction in some software concept domain, not of > performance or suitability for some particular purpose. If C is good > when a 16-bit microcontroller is the target, it's because C can get you > quite close to the bare metal, which is how you typically extract the > use-value of such a part. The *costs* and *risks* of being so close to > bare metal should go without saying -- "close", in this case, means > "almost down to". (Wasn't it Dennis Ritchie himself who quipped "C > combines the flexibility of assembly language with the power of assembly > language"?) > > Admittedly, this picture is complicated by the metaprogramming aspects of > languages. Take BLISS -- it was a bare-metal programming language with > a Turing-complete macro facility. C++ can also be used near bare metal > (indeed, when I taught a course in it I was amused to see how many of my > students were embedded systems developers) but its template syntax > rivals or exceeds the power of BLISS macros and continues to reach > higher. > > However, one might consider metaprogrammability simply yet another of > several possible domains for a language -- the reflexive one. I'd say > that Erlang and the LISPs, Smalltalk and some others (even Forth, IIRC) > are higher level than C++ in metaprogrammability, even if C++ is still > relatively high in that way. Yes, the Boost library provides a kind of > lambda for C++, but only in a way that's so clunky as to clearly not be > a "part of" C++; more an argument for Greenspun's Tenth Law if > anything. > > -michael > > On 1/22/2010, "Richard O'Keefe" wrote: > >On Jan 22, 2010, at 4:26 AM, Angel wrote: > >> So im really displeased to see everyone still closely tied to the > >> "old classic > >> high level definition". its dificult to place erlang over a plethora > >> of not > >> certainly better languages if all of them are considered equal. > > > >It doesn't matter what we call them, it's STILL difficult to place > >Erlang amongst a vast range of other languages. > > > >Erlang isn't even close to APL2 as a notation for matrix calculations. > >APL2 isn't even close to Erlang as a notation for concurrency. > >Neither of them can hold a candle to C as a notation for programming > >16-bit microcontrollers, although one could imagine a derivative of > >Concurrent Pascal that would have been even better. > > > >There simply isn't a linear ordering. > >The most you can say is that one language is higher level than > >another for certain things. > > > >Mind you, it is clearly possible to classify some languages as bad > >for any practical purpose. Intercal, Brainf*ck, and the whitespace > >language spring to mind. > > > >I recently solved a problem by writing > > - a data file > > - an AWK program to compile that into C > >and running the C program. Doing the whole thing in C would have > >been slow, because it would have been doing at run time decisions > >that were better made at meta-compilation time. > > > >This kind of thing blurs the "level of a language" idea even > >further. C on its own: bad. AWK on its own: worse. AWK+C: excellent. > > > >I think it gets us further to say "Language X does this, language Y > >does that, for problem P, what language X does helped me get my > >program working quicker". The Grand Convergence (where Java and C# > >and Eiffel and others are borrowing ideas from the functional world > >and from each other) means that "language Y is no good because it > >doesn't have feature F" is a permanent truth only for dead languages. > > > > > >________________________________________________________________ > >erlang-questions mailing list. See http://www.erlang.org/faq.html > >erlang-questions (at) erlang.org > From v@REDACTED Sat Jan 23 06:58:55 2010 From: v@REDACTED (Valentin Micic) Date: Sat, 23 Jan 2010 07:58:55 +0200 Subject: [erlang-questions] finding hard to find bugs in production systems In-Reply-To: <1264152694.903.9.camel@ft-laptop.thulin.net> Message-ID: <20100123055912.0E51A3D0D5B@mail.pharos-avantgard.com> Fredrik, In my experience, the behavior you're describing could be related to process message queue -- say, you have a process which is using selective receive targeting one pattern but ignoring the other. Such a process may accumulate substantial amount of messages over the time and cause increased CPU utilization (as it gets busier and busier processing selective receive). It can certainly help your debugging effort to narrow down the problem scope, so I suggest that you login to the system and issue regs() which may indicate which process has more messages than it ought to. V/ -----Original Message----- From: erlang-questions@REDACTED [mailto:erlang-questions@REDACTED] On Behalf Of Fredrik Thulin Sent: 22 January 2010 11:32 AM To: erlang-questions@REDACTED Subject: [erlang-questions] finding hard to find bugs in production systems Hi I have a rather large user of YXA that are experiencing problems with beam consuming 100% CPU until they restart it, about once a month. What are people doing to find this kind of bugs? I seem to remember someone writing that they dump state of all processes periodically in their production systems - does anyone has code to that effect to share? I suspect the bug they are experiencing appears to be something similar to http://old.nabble.com/100--CPU-usage-on-Mac-OS-X-Leopard-after-peer-closes-s ocket-td16731178.html although it might of course be something in YXA... It is not that particular problem although there are similarities, they are running R12 and on BSD (FreeBSD). I don't think my user is really capable of attaching to the running nodes and performing very much fault isolation when this happens, partly because of lack of Erlang wizard status, and also because of urgency to get the node back up running. Any ideas (and especially code ;) ) will be greatly appreciated. /Fredrik ________________________________________________________________ erlang-questions mailing list. See http://www.erlang.org/faq.html erlang-questions (at) erlang.org From clist@REDACTED Sat Jan 23 11:01:30 2010 From: clist@REDACTED (Angel) Date: Sat, 23 Jan 2010 11:01:30 +0100 Subject: [erlang-questions] changes in native functions for the next otp release. In-Reply-To: <8E1F9D5A-C8D5-4F2D-AD0D-294069B6D5E6@cs.otago.ac.nz> References: <201001211340.11272.clist@uah.es> <8E1F9D5A-C8D5-4F2D-AD0D-294069B6D5E6@cs.otago.ac.nz> Message-ID: <201001231101.30788.clist@uah.es> On Viernes, 22 de Enero de 2010 02:09:52 Richard O'Keefe escribi?: > On Jan 22, 2010, at 1:40 AM, Angel wrote: > > Hi > > > > Some months ago, i discovered that square root of bignums is not > > implemented > > in erlang. > > ? > > 1> math:sqrt(1 bsl 801). > 3.65185e+120 > > math:sqrt is just as much implemented for bignums as it is for fixnums. > > Or do you mean "the greatest integer X such that X**2 <= Y", > the "integer square root"? I didn't think Erlang had that for fixnums > either. > i mean sqrt for bignums was broken. 25-08-2009 "bignum sqrt broken in erlang?" See my message on that ocasi?n: --- Hi Iet ab=N let M=(a+1)(b+1); M=ab+a+b+1 that is N +a +b +1 so M > N Ok but in erlang... Erlang R13B01 (erts-5.7.2) [source] [rq:1] [async-threads:0] [hipe] [kernel- poll:false] Eshell V5.7.2 (abort with ^G) 1> N=71641520761751435455133616475667090434063332228247871795429. 71641520761751435455133616475667090434063332228247871795429 2> R0=trunc(math:sqrt(N)). 267659337146589062070609641472 3> R1=R0+1. 267659337146589062070609641473 4> M=R1*R1. 71641520761751431352030800763682813030352458120945601609729 5> M -N > 0. false where is the problem? That's erlang or the gmp library? /Angel" this was on R13B1 i think (have to re-test on current versi?n) is still broken. Im probing some supeesecrete variations of "fermat little's theorem" on RSA numbers clearly is a problem if native math:sqrt still broken and port latencies (serialitation and parsing) of my actual code begin to annoy me. So it is worth a NIF? Thanks in advance, Angel From clist@REDACTED Sat Jan 23 11:43:46 2010 From: clist@REDACTED (Angel) Date: Sat, 23 Jan 2010 11:43:46 +0100 Subject: [erlang-questions] passing an include path to escript In-Reply-To: <18a1db031001220138o68cfd680qe0089632edefb19a@mail.gmail.com> References: <18a1db030912010937y51eac9b6rb399631e6064cc3e@mail.gmail.com> <18a1db031001220138o68cfd680qe0089632edefb19a@mail.gmail.com> Message-ID: <201001231143.46852.clist@uah.es> Hi When a i run an "escript" script many times I use an static erlang node where the codepaths cover all my needs and delegate all work to it so escript rol is just to parse arguments, and call remote functions. Being new i was simple for me and also enough complex to learng new aspects of erlang. Some other experiments incluyed using remote code server facilities, avoiding to manage NFS paths for erlang directories and the need to load modified code on all nodes sending binaries if NFS was not available. Notice for everyone testing remote code server. (tested on R12) If you spawn erlag nodes via ssh with remote code loading options, some nodes can timeout before finish startup sequence. (On R12..) The slave module currently didnt allow you to change timeout (default 30 sec), so you have to make a custom versi?n. /angel On Viernes, 22 de Enero de 2010 10:38:22 zabrane Mikael escribi?: > Hi Sergey, > > As "Nick Genrakines" show me the trick, here is a working solution: > > 1. assume your code lives inside "mycode" directory > 2. assume your .hrl lives inside an "include" directory > mycode > > |________include: my.hrl > > 3. Then, your escript could simply include that .hrl like this: > > #!/usr/bin/env escript > %% -*- erlang -*- > %%! -pz ../mycode ebin > > -include_lib("mycode/include/my.hrl"). > > Regards > Zabrane > > > 2010/1/22 Sergey Samokhin > > > On Tue, Dec 1, 2009 at 8:37 PM, zabrane Mikael wrote: > > > Hi List ! > > > > > > I'm facing the same issue as "Wojtek" here: > > > > http://forum.trapexit.org/viewtopic.php?p=48544&sid=d7fe0c082bbea7b130d30 > >713a2925491 > > > > > Could someone please, show us a clean way to add relative paths to our > > > ".hrl"files which are outside "lib_dir"? > > > > Does anybody know, are there any plans on allowing "include" to be > > used inside escripts? > > > > I'm writing a small library for parsing CLI arguments. I think > > specifications looks much simplier to understand, > > if they a list of records: > > > > Specs = > > [ > > #opt{long_name = help, > > short_name = h, > > type = boolean}, > > #opt{long_name = version, > > short_name = v, > > type = boolean, > > validator = fun(_Val) -> ok end} > > ] > > > > than a list of tuples: > > > > Specs = > > [{help, [{short_name, h}, {type, boolean}]}, > > {version, [{short_name, v}, {type, boolean}, {validator, > > fun(_Val) -> ok end}]] > > > > Currently the only way to specify which options to get is by using > > list of tuples. > > > > -- > > Sergey > From pablo.platt@REDACTED Sat Jan 23 15:44:32 2010 From: pablo.platt@REDACTED (Pablo Platt) Date: Sat, 23 Jan 2010 06:44:32 -0800 (PST) Subject: list of updates in mnesia Message-ID: <845089.15285.qm@web112612.mail.gq1.yahoo.com> Hi, My erlang server sends an http request to several remote server every minute. The remote servers respond with a list of updates to user profiles and rosters. The erlang server needs to process the list of updates and apply it to the mneisa database. The updates might contain syntax errors or wrong info. For example, it is possible that the remote server will refer to a missing user id. It's not an e-commerce application so transactions are not critical. What is the best way to handle the list of updates? Do I need to use transactions when writing data to the mnesia table? Is it better to create one transaction for the whole list or one transaction per item? What is the risk in using dirty_write? Maybe it is better to use one process per list item so even if there are syntax errors the rest of the list will be used? Thanks From igorrs@REDACTED Sat Jan 23 16:57:01 2010 From: igorrs@REDACTED (Igor Ribeiro Sucupira) Date: Sat, 23 Jan 2010 13:57:01 -0200 Subject: [erlang-questions] list of updates in mnesia In-Reply-To: <845089.15285.qm@web112612.mail.gq1.yahoo.com> References: <845089.15285.qm@web112612.mail.gq1.yahoo.com> Message-ID: Hello. Mnesia User's Guide might help in your decision: http://www.erlang.org/doc/apps/mnesia/Mnesia_chap4.html Good luck. Igor. On Sat, Jan 23, 2010 at 12:44 PM, Pablo Platt wrote: > Hi, > > My erlang server sends an http request to several remote server every minute. > The remote servers respond with a list of updates to user profiles and rosters. > The erlang server needs to process the list of updates and apply it to the mneisa database. > > The updates might contain syntax errors or wrong info. > For example, it is possible that the remote server will refer to a missing user id. > It's not an e-commerce application so transactions are not critical. > > What is the best way to handle the list of updates? > Do I need to use transactions when writing data to the mnesia table? > Is it better to create one transaction for the whole list or one transaction per item? > What is the risk in using dirty_write? > Maybe it is better to use one process per list item so even if there are syntax errors the rest of the list will be used? > > Thanks -- "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 Sun Jan 24 18:33:49 2010 From: g@REDACTED (Garrett Smith) Date: Sun, 24 Jan 2010 11:33:49 -0600 Subject: Documentation Message-ID: Are any of the sinan commands documented, beyond the high level descriptions in the sinan reference here: http://www.erlware.org/tools/sinan/reference.html Garrett From hakan@REDACTED Sun Jan 24 20:21:41 2010 From: hakan@REDACTED (=?ISO-8859-1?Q?H=E5kan_Mattsson?=) Date: Sun, 24 Jan 2010 20:21:41 +0100 Subject: [erlang-questions] Re: wx on Linux x86_64 crashes In-Reply-To: <32ee96e8-0876-4ebf-a9cd-f8a15bfea62d@p24g2000yqm.googlegroups.com> References: <4B1FDA8B.4040503@ernovation.com> <32ee96e8-0876-4ebf-a9cd-f8a15bfea62d@p24g2000yqm.googlegroups.com> Message-ID: <922d05851001241121m42f5a268n7c8b87dafba9b899@mail.gmail.com> On Sat, Jan 23, 2010 at 12:26 AM, eolo999 wrote: > My real problem is that also debugger:start() seems to rely on wx. In that case you can run the old GS based debugger. It is started with debugger:start(gs). /H?kan From klas.johansson@REDACTED Sun Jan 24 20:39:02 2010 From: klas.johansson@REDACTED (Klas Johansson) Date: Sun, 24 Jan 2010 20:39:02 +0100 Subject: [erlang-patches] Re: [erlang-questions] Bug in epmd_srv.c? In-Reply-To: <6672d0160912220016w7f8120edg28ce2b29d56b5a42@mail.gmail.com> References: <6672d0160912210306y43ebcc4dg63ea136b6a573bea@mail.gmail.com> <6672d0160912220016w7f8120edg28ce2b29d56b5a42@mail.gmail.com> Message-ID: Hi, Sorry for the delay... 2009/12/22 Bj?rn Gustavsson : > 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'. I've seen that it has graduated now, great! > 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 see what you're asking for here, but I was just fooling around with the distribution protocol and another programming language. Perhaps Dave has some input here? >> 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've done a new commit here (where I've added two more testcases to epmd_SUITE.erl): git fetch git://github.com/klajo/otp.git epmd_port2resp_trunc_extra I didn't amend my previous commit, since it had already graduated from 'pu'. Thanks and Regards, Klas From eodbat@REDACTED Sun Jan 24 20:54:39 2010 From: eodbat@REDACTED (Edoardo Batini) Date: Sun, 24 Jan 2010 20:54:39 +0100 Subject: [erlang-questions] Re: wx on Linux x86_64 crashes In-Reply-To: <922d05851001241121m42f5a268n7c8b87dafba9b899@mail.gmail.com> References: <4B1FDA8B.4040503@ernovation.com> <32ee96e8-0876-4ebf-a9cd-f8a15bfea62d@p24g2000yqm.googlegroups.com> <922d05851001241121m42f5a268n7c8b87dafba9b899@mail.gmail.com> Message-ID: <20100124195439.GA3072@jetzback> On Sun, Jan 24, 2010 at 08:21:41PM +0100, H?kan Mattsson wrote: > On Sat, Jan 23, 2010 at 12:26 AM, eolo999 wrote: > > > My real problem is that also debugger:start() seems to rely on wx. > > In that case you can run the old GS based debugger. It is started with > > debugger:start(gs). > > /H?kan Thx, "debugger:start(gs)." worked out. {edoardo} From rory@REDACTED Mon Jan 25 03:56:25 2010 From: rory@REDACTED (Rory Byrne) Date: Mon, 25 Jan 2010 03:56:25 +0100 Subject: [ANN] Etcher - Another Django template language implementation Message-ID: <20100125025625.GB30071@almeida.jinsky.com> Hi Everyone, I've just uploaded an implementation of the Django Template Language to github: http://github.com/jinsky/etcher This project shouldn't be seen as any kind of reflection on ErlyDTL. I haven't done any tests, but I suspect that ErlyDTL is faster and more efficient that Etcher. (I'm re-using their date formatting code, so at least that part of Etcher should be quick! ;-)) The purpose of Etcher, is to provide a flexible, feature complete, implementation of the Django Template Language. An implementation that is highly compatible with Django's own version. Developers should be able to switch between Python and Erlang without touching their web templates. That's the goal. For non-tech reasons, I'm releasing this project a little earlier than I would have liked. It's currently about 90% feature complete but it's still quite rough around the edges. What's Done? ------------ * Supports 19 of the 24 standard tags. * Supports all 56 standard filters. The date formatting code was taken from the ErlyDTL project (http://code.google.com/p/erlydtl/), so Roberto and Evan deserve full credit for this. * Full unicode support. * (X)HTML Auto-Escaping is handled just like in Django. * Supports custom tags and filters. You can even override the standard ones if you want/need to. Note that the 'load' tag isn't implemented yet, and the API related to custom tags and filters will likely to change when it is. * The context you pass in can contain a mix of nested records, lists and proplists. To use records you will need to inform the etcher application about these records in advance. This is simple to do, you can just pass it the name of a hrl file containing your record definitions. What's NOT Done Yet? -------------------- * 5 standard tags, mostly related to template inheritence and template/file inclusion. The tags are: 'block', 'extends', 'include', 'load' and 'ssi'. * Error Reporting. Yeah, error reporting is abysmal at the moment. It certain needs to be improved. * Documentation. The vast bulk of Etcher's functionality is covered by Django's excellent documentation, specifically this page: http://docs.djangoproject.com/en/1.1/ref/templates/builtins/ However, there is still lots of Etcher specific stuff that needs to be documented. * More testing (both unit and system testing) is needed. Thanks to the OTP team, and to anyone else who was involved in bringing the new Regular Expressions, and Unicode, functionality to Erlang. It's made the world of difference in programming web-related stuff like this. Cheers, Rory From fritchie@REDACTED Mon Jan 25 06:51:01 2010 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Sun, 24 Jan 2010 23:51:01 -0600 Subject: [erlang-questions] finding hard to find bugs in production systems In-Reply-To: Message of "Fri, 22 Jan 2010 10:31:34 +0100." <1264152694.903.9.camel@ft-laptop.thulin.net> Message-ID: <88776.1264398661@snookles.snookles.com> Fredrik, have you tried using etop? It's easy enough to find the CPU pig, though identifying exactly what that pig is doing isn't always so easy. /path/to/lib/observer-*/priv/bin/etop -node name@REDACTED \ [-lines N] [-interval 1] [-tracing off] [...] The "-tracing off" is helpful if the target system is extremely overloaded, since tracing all processes is very intrusive. If the target system is extremely overloaded anyway, it may interfere with the inter-node communication between the target node and the etop node, which can make the reports incomplete or impossible. :-( Give it a try. Oh, and make certain that the correct cookie is available to the etop node. -Scott From ok@REDACTED Mon Jan 25 07:17:33 2010 From: ok@REDACTED (Richard O'Keefe) Date: Mon, 25 Jan 2010 19:17:33 +1300 Subject: [erlang-questions] changes in native functions for the next otp release. In-Reply-To: <201001231101.30788.clist@uah.es> References: <201001211340.11272.clist@uah.es> <8E1F9D5A-C8D5-4F2D-AD0D-294069B6D5E6@cs.otago.ac.nz> <201001231101.30788.clist@uah.es> Message-ID: <53CA7566-8AF7-40CB-97F7-D5AC6F616990@cs.otago.ac.nz> On Jan 23, 2010, at 11:01 PM, Angel wrote: > Iet ab=N > let M=(a+1)(b+1); > > M=ab+a+b+1 that is N +a +b +1 so M > N > > Ok but in erlang... > > Erlang R13B01 (erts-5.7.2) [source] [rq:1] [async-threads:0] [hipe] > [kernel- > poll:false] > > Eshell V5.7.2 (abort with ^G) > 1> N=71641520761751435455133616475667090434063332228247871795429. > 71641520761751435455133616475667090434063332228247871795429 > > 2> R0=trunc(math:sqrt(N)). > 267659337146589062070609641472 At this point you have said "please, Erlang, calculate a 53-bit APPROXIMATION to the square root of my 197-bit[%] integer, and then chop that back to the next smaller integer." [%] I haven't counted the bits exactly, this is ceiling(59*(10/3)). The integer square root of N is 267659337146589069735395147283 and Erlang returned 267659337146589062070609641472 ^^^^^^^^^^^^^ which is NOT the integer square root of N, because YOU NEVER ASKED FOR THE INTEGER SQUARE ROOT OF N. Convert the integer square root of N to a floating point number and you get 26765933714658906............. which is as accurate as math:sqrt/1 can possibly make it, because that's as precise as an IEEE double-precision floating point number (which is what math:sqrt/1 is DEFINED to return) can possibly be. > where is the problem? That's erlang or the gmp library? Neither. The problem is that you are confusing a DOUBLE PRECISION FLOATING POINT square root (which is what math:sqrt/1 is) with an INTEGER SQUARE ROOT (the integer-sqrt function in Gambit Scheme). Erlang is correctly doing *precisely* what you told it to do. > > this was on R13B1 i think (have to re-test on current versi?n) is > still > broken. Nothing is broken. As far as I know, Erlang doesn't offer, and nowhere claims to offer, an integer square root function. What is broken is the belief that math:sqrt/1 is such a function. You will have to program your own integer square root function. > > > Im probing some supeesecrete variations of "fermat little's theorem" > on RSA > numbers clearly is a problem if native math:sqrt still broken and port > latencies (serialitation and parsing) of my actual code begin to > annoy me. You have not yet shown that an integer square root function programmed in Erlang is too inefficient to use. While truncate(math:sqrt(N)) may not be the right answer, it is surely a good start for a (careful!) Newton-style iteration. > > From ok@REDACTED Mon Jan 25 07:33:27 2010 From: ok@REDACTED (Richard O'Keefe) Date: Mon, 25 Jan 2010 19:33:27 +1300 Subject: [erlang-questions] changes in native functions for the next otp release. In-Reply-To: <53CA7566-8AF7-40CB-97F7-D5AC6F616990@cs.otago.ac.nz> References: <201001211340.11272.clist@uah.es> <8E1F9D5A-C8D5-4F2D-AD0D-294069B6D5E6@cs.otago.ac.nz> <201001231101.30788.clist@uah.es> <53CA7566-8AF7-40CB-97F7-D5AC6F616990@cs.otago.ac.nz> Message-ID: <73BF5BD8-2DBB-44E3-BD45-C658B4059206@cs.otago.ac.nz> Didn't we have exactly this conversation several months ago? At the time I said that it is straightforward to write an integer square root function, and by that I meant >> in Erlang <<, no port programs needed. From ft@REDACTED Mon Jan 25 09:31:59 2010 From: ft@REDACTED (Fredrik Thulin) Date: Mon, 25 Jan 2010 09:31:59 +0100 Subject: [erlang-questions] finding hard to find bugs in production systems In-Reply-To: <88776.1264398661@snookles.snookles.com> References: <88776.1264398661@snookles.snookles.com> Message-ID: <1264408319.903.61.camel@ft-laptop.thulin.net> On Sun, 2010-01-24 at 23:51 -0600, Scott Lystig Fritchie wrote: > Fredrik, have you tried using etop? It's easy enough to find the CPU > pig, though identifying exactly what that pig is doing isn't always so > easy. No, it was several years since I looked at etop. Thanks for reminding me about it, I should have thought of that myself. How would a bug in some low level function like the one discussed in http://old.nabble.com/100--CPU-usage-on-Mac-OS-X-Leopard-after-peer-closes-socket-td16731178.html look in etop? Does anyone know? Etop isn't ideal though since it requires some knowledge to use, and also might not be practically usable in a situation where everyone wants the production system back to normal state as soon as possible... /Fredrik From dangud@REDACTED Mon Jan 25 10:13:42 2010 From: dangud@REDACTED (Dan Gudmundsson) Date: Mon, 25 Jan 2010 10:13:42 +0100 Subject: [erlang-questions] wx on Linux x86_64 crashes In-Reply-To: <4B1FDA8B.4040503@ernovation.com> References: <4B1FDA8B.4040503@ernovation.com> Message-ID: <93df43b61001250113l50d92313w6a6064c34a183288@mail.gmail.com> This works for me... until I noticed I have installed the i386 version of ubuntu, sigh. /Dan On Wed, Dec 9, 2009 at 6:12 PM, Erik Reitsma wrote: > 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. > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From chandrashekhar.mullaparthi@REDACTED Mon Jan 25 10:35:39 2010 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Mon, 25 Jan 2010 09:35:39 +0000 Subject: [erlang-questions] finding hard to find bugs in production systems In-Reply-To: <1264408319.903.61.camel@ft-laptop.thulin.net> References: <88776.1264398661@snookles.snookles.com> <1264408319.903.61.camel@ft-laptop.thulin.net> Message-ID: 2010/1/25 Fredrik Thulin > On Sun, 2010-01-24 at 23:51 -0600, Scott Lystig Fritchie wrote: > > Fredrik, have you tried using etop? It's easy enough to find the CPU > > pig, though identifying exactly what that pig is doing isn't always so > > easy. > > No, it was several years since I looked at etop. Thanks for reminding me > about it, I should have thought of that myself. > > How would a bug in some low level function like the one discussed in > > > http://old.nabble.com/100--CPU-usage-on-Mac-OS-X-Leopard-after-peer-closes-socket-td16731178.html > > look in etop? Does anyone know? > > Etop isn't ideal though since it requires some knowledge to use, and > also might not be practically usable in a situation where everyone wants > the production system back to normal state as soon as possible... > > Maybe you could ask your client to shutdown the node using erlang:halt/1. That should force an erl_crash.dump to be written which might give you clues about the 'pig'. Chandru From marc@REDACTED Mon Jan 25 16:06:47 2010 From: marc@REDACTED (Marc Worrell) Date: Mon, 25 Jan 2010 16:06:47 +0100 Subject: [ANN] Zotonic now supports WebSockets Message-ID: Hello, We just added WebSockets support to the Zotonic CMS/framework. It is used as an alternative transport layer to Comet and is fully integrated. The system automatically chooses between using Comet or WebSockets for the server push support. Server push support is enabled using the {% stream %} tag in the page template. The browser sends urlencoded forms to the server and the server sends javascript to the browser. This enables a very flexible way of communication with minimal programming on the browser side. WebSockets support will be part of the upcoming 0.3 release. Regards, Marc Worrell From clist@REDACTED Mon Jan 25 16:42:56 2010 From: clist@REDACTED (Angel Alvarez) Date: Mon, 25 Jan 2010 16:42:56 +0100 Subject: [erlang-questions] changes in native functions for the next otp release. In-Reply-To: <53CA7566-8AF7-40CB-97F7-D5AC6F616990@cs.otago.ac.nz> References: <201001211340.11272.clist@uah.es> <201001231101.30788.clist@uah.es> <53CA7566-8AF7-40CB-97F7-D5AC6F616990@cs.otago.ac.nz> Message-ID: <201001251642.56195.clist@uah.es> El Lunes, 25 de Enero de 2010 Richard O'Keefe escribi?: > > On Jan 23, 2010, at 11:01 PM, Angel wrote: > > Iet ab=N > > let M=(a+1)(b+1); > > > > M=ab+a+b+1 that is N +a +b +1 so M > N > > > > Ok but in erlang... > > > > Erlang R13B01 (erts-5.7.2) [source] [rq:1] [async-threads:0] [hipe] > > [kernel- > > poll:false] > > > > Eshell V5.7.2 (abort with ^G) > > 1> N=71641520761751435455133616475667090434063332228247871795429. > > 71641520761751435455133616475667090434063332228247871795429 > > > > 2> R0=trunc(math:sqrt(N)). > > 267659337146589062070609641472 > > At this point you have said > "please, Erlang, calculate a 53-bit APPROXIMATION to the square > root of my 197-bit[%] integer, and then chop that back to the > next smaller integer." > [%] I haven't counted the bits exactly, this is ceiling(59*(10/3)). > > The integer square root of N is > 267659337146589069735395147283 and Erlang returned > 267659337146589062070609641472 > ^^^^^^^^^^^^^ > which is NOT the integer square root of N, because YOU NEVER ASKED > FOR THE INTEGER SQUARE ROOT OF N. Convert the integer square root > of N to a floating point number and you get > 26765933714658906............. > which is as accurate as math:sqrt/1 can possibly make it, > because that's as precise as an IEEE double-precision floating > point number (which is what math:sqrt/1 is DEFINED to return) > can possibly be. > > > where is the problem? That's erlang or the gmp library? > > Neither. The problem is that you are confusing a DOUBLE PRECISION > FLOATING POINT square root (which is what math:sqrt/1 is) with an > INTEGER SQUARE ROOT (the integer-sqrt function in Gambit Scheme). > Erlang is correctly doing *precisely* what you told it to do. > > > > > this was on R13B1 i think (have to re-test on current versi?n) is > > still > > broken. > > Nothing is broken. As far as I know, Erlang doesn't offer, and > nowhere claims to offer, an integer square root function. What is > broken is the belief that math:sqrt/1 is such a function. > > You will have to program your own integer square root function. > > > > > > Im probing some supeesecrete variations of "fermat little's theorem" > > on RSA > > numbers clearly is a problem if native math:sqrt still broken and port > > latencies (serialitation and parsing) of my actual code begin to > > annoy me. > > You have not yet shown that an integer square root function programmed > in Erlang is too inefficient to use. While truncate(math:sqrt(N)) may > not be the right answer, it is surely a good start for a (careful!) > Newton-style iteration. > > > > > > Ok! Ok! My fault!! Sometime we dont see some BIG elefants in front of us... C Port was easy at that moment, a kind "Welcome Back to your old habits!!" for the insecure newbie across the erlang lands... and a lazy gmp use. Thanks!! /angel -- 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 scott.brooks@REDACTED Mon Jan 25 16:50:27 2010 From: scott.brooks@REDACTED (Scott Brooks) Date: Mon, 25 Jan 2010 09:50:27 -0600 Subject: Changing HEART_COMMAND on the fly Message-ID: <8ADA7D0E-2CB5-439A-911F-0F2E17BC28CC@epicadvertising.com> We have a system in production using heart to monitor it. We have a bug in our startup scripts that we want to fix, but we don't want to take down the running node. Using heart:set_cmd(NewCmd) and then killing the existing server, I can get it to startup successfully with the new command, but unfortunately it retains the existing HEART_COMMAND environment variable, and so when the new node starts up, and I check heart:get_cmd(). It returns the old command. I tried a os:putenv(HEAT_COMMAND, NewCmd), and that looks like it adjusts the existing nodes environment fine, but since heart is what restarts the erlang node, it's using the HEART_COMMAND as it exists for the heart process, not the erlang node environment. I also tried killing off heart so I could restart it with a new environment, but that takes down the existing node. Any thoughts as to how we can accomplish this? Thanks --------------------- Scott Brooks Web Developer Epic Advertising - New York, Toronto, San Francisco, London www.EpicAdvertising.com 60 Columbia Way, Suite 310 Markham, ON L3R 0C9 (905) 946-0300 x2356 - phone (888) 666-3120 - fax scott.brooks@REDACTED From bgustavsson@REDACTED Mon Jan 25 18:05:54 2010 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Mon, 25 Jan 2010 18:05:54 +0100 Subject: [erlang-patches] Re: [erlang-questions] Bug in epmd_srv.c? In-Reply-To: References: <6672d0160912210306y43ebcc4dg63ea136b6a573bea@mail.gmail.com> <6672d0160912220016w7f8120edg28ce2b29d56b5a42@mail.gmail.com> Message-ID: <6672d0161001250905s779a316w35fdfa6c567875dd@mail.gmail.com> 2010/1/24 Klas Johansson : > I've done a new commit here (where I've added two more testcases to > epmd_SUITE.erl): > > git fetch git://github.com/klajo/otp.git epmd_port2resp_trunc_extra > Thanks! I have added your commit directly to ccase/r13b04. -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From chandrashekhar.mullaparthi@REDACTED Mon Jan 25 18:15:22 2010 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Mon, 25 Jan 2010 17:15:22 +0000 Subject: [erlang-questions] Changing HEART_COMMAND on the fly In-Reply-To: <8ADA7D0E-2CB5-439A-911F-0F2E17BC28CC@epicadvertising.com> References: <8ADA7D0E-2CB5-439A-911F-0F2E17BC28CC@epicadvertising.com> Message-ID: 2010/1/25 Scott Brooks > We have a system in production using heart to monitor it. > > We have a bug in our startup scripts that we want to fix, but we don't want > to take down the running node. > > Using heart:set_cmd(NewCmd) and then killing the existing server, I can get > it to startup successfully with the new command, but unfortunately it > retains the existing HEART_COMMAND environment variable, and so when the new > node starts up, and I check heart:get_cmd(). It returns the old command. > > I tried a os:putenv(HEAT_COMMAND, NewCmd), and that looks like it adjusts > the existing nodes environment fine, but since heart is what restarts the > erlang node, it's using the HEART_COMMAND as it exists for the heart > process, not the erlang node environment. > > I also tried killing off heart so I could restart it with a new > environment, but that takes down the existing node. > Can you symlink the old heart command script to something which invokes the new script? cheers Chandru From yogishb@REDACTED Mon Jan 25 18:12:31 2010 From: yogishb@REDACTED (Yogish Baliga) Date: Mon, 25 Jan 2010 09:12:31 -0800 (PST) Subject: [erlang-questions] Changing HEART_COMMAND on the fly In-Reply-To: <8ADA7D0E-2CB5-439A-911F-0F2E17BC28CC@epicadvertising.com> References: <8ADA7D0E-2CB5-439A-911F-0F2E17BC28CC@epicadvertising.com> Message-ID: <964002.94704.qm@web112606.mail.gq1.yahoo.com> Hello Scott, When a erlang process dies, heart monitor start a new process using HEART_COMMAND and kill itself. So a new "heart" process is spawned. Assuming that your HEART_COMMAND is a shell script, you have to change the HEART_COMMAND in the shell script. -- baliga "Point of view is worth 80 IQ points" --Alan Kay http://dudefrommangalore.blogspot.com/ ________________________________ From: Scott Brooks To: "erlang-questions@REDACTED" Sent: Mon, January 25, 2010 7:50:27 AM Subject: [erlang-questions] Changing HEART_COMMAND on the fly We have a system in production using heart to monitor it. We have a bug in our startup scripts that we want to fix, but we don't want to take down the running node. Using heart:set_cmd(NewCmd) and then killing the existing server, I can get it to startup successfully with the new command, but unfortunately it retains the existing HEART_COMMAND environment variable, and so when the new node starts up, and I check heart:get_cmd(). It returns the old command. I tried a os:putenv(HEAT_COMMAND, NewCmd), and that looks like it adjusts the existing nodes environment fine, but since heart is what restarts the erlang node, it's using the HEART_COMMAND as it exists for the heart process, not the erlang node environment. I also tried killing off heart so I could restart it with a new environment, but that takes down the existing node. Any thoughts as to how we can accomplish this? Thanks --------------------- Scott Brooks Web Developer Epic Advertising - New York, Toronto, San Francisco, London www.EpicAdvertising.com 60 Columbia Way, Suite 310 Markham, ON L3R 0C9 (905) 946-0300 x2356 - phone (888) 666-3120 - fax scott.brooks@REDACTED ________________________________________________________________ erlang-questions mailing list. See http://www.erlang.org/faq.html erlang-questions (at) erlang.org From clist@REDACTED Mon Jan 25 20:12:13 2010 From: clist@REDACTED (Angel) Date: Mon, 25 Jan 2010 20:12:13 +0100 Subject: [erlang-questions] changes in native functions for the next otp release. In-Reply-To: <73BF5BD8-2DBB-44E3-BD45-C658B4059206@cs.otago.ac.nz> References: <201001211340.11272.clist@uah.es> <53CA7566-8AF7-40CB-97F7-D5AC6F616990@cs.otago.ac.nz> <73BF5BD8-2DBB-44E3-BD45-C658B4059206@cs.otago.ac.nz> Message-ID: <201001252012.13232.clist@uah.es> On Lunes, 25 de Enero de 2010 07:33:27 Richard O'Keefe escribi?: > Didn't we have exactly this conversation several months ago? > At the time I said that it is straightforward to write an > integer square root function, and by that I meant >> in Erlang <<, > no port programs needed. > Thanks again!! Richard you are right: It happens that i missed your message and continue so eventually a forgot "the floating point" issue with sqrt. (just the port program also served me to touch more erlang aspects). The case was i tought that there were no point on fighting against GMP library on the erlang side so it kept me happy for the last months... In fact the aproach i took on "fermat factoring" is not cleary interesting but a sort of erlang joy. Also i never did more that a sqrt() for a semiprime P because i move on the line b^2-a^2=N using a simple math: let B1 the square of b let B2 the square of (b+1) Now we can see that B2=B1+(2*b1+1) So for a Semiprime P we start on the first square above the square root of P and move on without checking squareness for the big term. Clearly dont deserve any consideration... you know! "supersecrete" was a warning !! /Angel -- Most people know C is not so high level.... ...Everybody else just got assembler overdose From arjan@REDACTED Mon Jan 25 20:51:15 2010 From: arjan@REDACTED (Arjan Scherpenisse) Date: Mon, 25 Jan 2010 20:51:15 +0100 Subject: Zotonic 0.3.0 released Message-ID: <4B5DF633.6050703@scherpenisse.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello Erlang users, After a month and a bit, I'm very pleased to announce the third release of Zotonic, the Erlang CMS [1]. As usual, 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 [1] More info on Zotonic: http://zotonic.com Release 0.3.0, released on 2010-01-25 - ------------------------------------- * New modules: ** mod_comment Enables a simple commenting system on your site using mod_comment. * New core features ** A new default site The default site of a vanilla Zotonic install is now modelled after a simple blog-style website, complete with an archive section, keywords, navigation to previous and next posts, atom feeds and comments. ** Speed improvements The Webmachine code was restructured to be more lean-and-mean, yielding up to 20% more performance on page requests. ** WebSockets support When WebSockets is available in the browser, then it is used as a replacement for the Comet long poll. Currently only Google Chrome supports this feature but it is expected to arrive in other browsers soon. ** Admin updates Support for editing a location (Google map picker), a new collection type "query" was added for creating "saved searches". ** EUnit support A start has been made to put the core functionality of Zotonic in unit tests using the EUnit testing framework. As of yet, only a small fraction of the code has been covered, but we'll keep working on increasing the code coverage of the tests. * Bugfixes: ** Resizing animated GIFs (#28) ** Determining EXIF orientation for images (#27) ** OAuth API key management interface is now available in admin (#35) ** Hiding "meta" pages from the admin overview (#12) ** And dozens of small fixes which did not go through the issue tracker. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAktd9jMACgkQigE4AbflYerGWwCglsYS25Nd9zxwC3VPcLpah8Hi CrEAoIRp8HUU37LtiJjCBGNdrYMXEwAd =7YBm -----END PGP SIGNATURE----- From kenji.rikitake@REDACTED Tue Jan 26 02:26:47 2010 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Tue, 26 Jan 2010 10:26:47 +0900 Subject: Integer square root In-Reply-To: <73BF5BD8-2DBB-44E3-BD45-C658B4059206@cs.otago.ac.nz> References: <201001211340.11272.clist@uah.es> <8E1F9D5A-C8D5-4F2D-AD0D-294069B6D5E6@cs.otago.ac.nz> <201001231101.30788.clist@uah.es> <53CA7566-8AF7-40CB-97F7-D5AC6F616990@cs.otago.ac.nz> <73BF5BD8-2DBB-44E3-BD45-C658B4059206@cs.otago.ac.nz> Message-ID: <20100126012647.GA46364@k2r.org> Very long time ago I was trying to solve the square root problem, but I didn't because handling in the float numbers gave the sufficient precision for me. In general, a quick method of solving X when Y = X * X and Y is given (X, Y are bignums) as: 1) Obtain approximation of X by float sqrt of Y separately to significand and exponent (note: IEEE754 format has its own limits in the digits of exponent too) 2) applying Newton-Raphson method so that Xnew = (X + (Y / X)) / 2 3) Repeat finding Xnew on 2) until Xnew =:= X Things you need to invent: * bignum integer dividing program (bignum / bignum -> bignum (+ remainder, maybe)) (This is NOT provided by Erlang) FYI Kenji Rikitake In the message <73BF5BD8-2DBB-44E3-BD45-C658B4059206@REDACTED> dated Mon, Jan 25, 2010 at 07:33:03PM +1300, Richard O'Keefe writes: > Didn't we have exactly this conversation several months ago? > At the time I said that it is straightforward to write an > integer square root function, and by that I meant >> in Erlang <<, > no port programs needed. From bob@REDACTED Tue Jan 26 02:46:00 2010 From: bob@REDACTED (Bob Ippolito) Date: Mon, 25 Jan 2010 17:46:00 -0800 Subject: [erlang-questions] Integer square root In-Reply-To: <20100126012647.GA46364@k2r.org> References: <201001211340.11272.clist@uah.es> <8E1F9D5A-C8D5-4F2D-AD0D-294069B6D5E6@cs.otago.ac.nz> <201001231101.30788.clist@uah.es> <53CA7566-8AF7-40CB-97F7-D5AC6F616990@cs.otago.ac.nz> <73BF5BD8-2DBB-44E3-BD45-C658B4059206@cs.otago.ac.nz> <20100126012647.GA46364@k2r.org> Message-ID: <6a36e7291001251746q5d13dd6ei17d0d5e2cb234a0b@mail.gmail.com> On Mon, Jan 25, 2010 at 5:26 PM, Kenji Rikitake wrote: > Very long time ago I was trying to solve the square root > problem, but I didn't because handling in the float numbers > gave the sufficient precision for me. > > In general, a quick method of > solving X when Y = X * X and Y is given (X, Y are bignums) as: > > 1) Obtain approximation of X by float sqrt of Y > ? separately to significand and exponent > ? (note: IEEE754 format has its own limits in > ? ? ? ? ?the digits of exponent too) > > 2) applying Newton-Raphson method so that > ? Xnew = (X + (Y / X)) / 2 > > 3) Repeat finding Xnew on 2) until Xnew =:= X > > Things you need to invent: > > * bignum integer dividing program > ?(bignum / bignum -> bignum (+ remainder, maybe)) > ?(This is NOT provided by Erlang) Sure it is, div and rem work with bignums. Not sure about how efficient it is relative to other bignum implementations but it works. -bob From kenji.rikitake@REDACTED Tue Jan 26 02:54:36 2010 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Tue, 26 Jan 2010 10:54:36 +0900 Subject: [erlang-questions] Integer square root In-Reply-To: <6a36e7291001251746q5d13dd6ei17d0d5e2cb234a0b@mail.gmail.com> References: <201001211340.11272.clist@uah.es> <8E1F9D5A-C8D5-4F2D-AD0D-294069B6D5E6@cs.otago.ac.nz> <201001231101.30788.clist@uah.es> <53CA7566-8AF7-40CB-97F7-D5AC6F616990@cs.otago.ac.nz> <73BF5BD8-2DBB-44E3-BD45-C658B4059206@cs.otago.ac.nz> <20100126012647.GA46364@k2r.org> <6a36e7291001251746q5d13dd6ei17d0d5e2cb234a0b@mail.gmail.com> Message-ID: <20100126015436.GA47313@k2r.org> My mistake. I didn't explore the operators "div" and "rem". I confirmed those two operators worked. Thanks Bob. (So it's relatively easier now to do this...) Kenji Rikitake In the message <6a36e7291001251746q5d13dd6ei17d0d5e2cb234a0b@REDACTED> dated Mon, Jan 25, 2010 at 05:45:36PM -0800, Bob Ippolito writes: > On Mon, Jan 25, 2010 at 5:26 PM, Kenji Rikitake wrote: > > Very long time ago I was trying to solve the square root > > problem, but I didn't because handling in the float numbers > > gave the sufficient precision for me. > > > > In general, a quick method of > > solving X when Y = X * X and Y is given (X, Y are bignums) as: > > > > 1) Obtain approximation of X by float sqrt of Y > > ?? separately to significand and exponent > > ?? (note: IEEE754 format has its own limits in > > ?? ?? ?? ?? ??the digits of exponent too) > > > > 2) applying Newton-Raphson method so that > > ?? Xnew = (X + (Y / X)) / 2 > > > > 3) Repeat finding Xnew on 2) until Xnew =:= X > > > > Things you need to invent: > > > > * bignum integer dividing program > > ??(bignum / bignum -> bignum (+ remainder, maybe)) > > ??(This is NOT provided by Erlang) > > Sure it is, div and rem work with bignums. Not sure about how > efficient it is relative to other bignum implementations but it works. > > -bob From kenji.rikitake@REDACTED Tue Jan 26 06:16:48 2010 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Tue, 26 Jan 2010 14:16:48 +0900 Subject: Integer nth-root (Re: [erlang-questions] Integer square root) In-Reply-To: <20100126012647.GA46364@k2r.org> References: <201001211340.11272.clist@uah.es> <8E1F9D5A-C8D5-4F2D-AD0D-294069B6D5E6@cs.otago.ac.nz> <201001231101.30788.clist@uah.es> <53CA7566-8AF7-40CB-97F7-D5AC6F616990@cs.otago.ac.nz> <73BF5BD8-2DBB-44E3-BD45-C658B4059206@cs.otago.ac.nz> <20100126012647.GA46364@k2r.org> Message-ID: <20100126051648.GA50404@k2r.org> %% This is a quick hack of code for Integer nth-root in Erlang. %% Power function (X ^ Y) and root function (X ^ (1/Y)) for %% integers in Erlang %% by Kenji Rikitake 26-JAN-2010 %% Distributed under MIT license at the end of the source code. -module(bignum_root). -export([power/2, root/2]). %% significand digits for float estimation -define(DIGITS, 10). %% computing N ^ E power(N, E) when (is_integer(N) and (is_integer(E) and (E >= 0))) -> power(N, E, 1, N). power(_, 0, Acc, _) -> Acc; power(N, E, Acc, Nsq) when (E rem 2 =:= 1) -> power(N, E - 1, Acc * Nsq, Nsq); power(N, E, Acc, Nsq) -> power(N, E div 2, Acc, Nsq * Nsq). %% computing N ^ (1/E) %% with Newton-Raphson method root(N, E) when ((is_integer(N) and (N > 0)) and (is_integer(E) and (E >= 2))) -> % estimation of the root by the float calc L = integer_to_list(N), Len = length(L), case Len > ?DIGITS of true -> Exp = Len - ?DIGITS, M = list_to_integer(lists:sublist(L, ?DIGITS)), XM = math:exp(math:log(M) / E) * math:pow(10, (Exp rem E) / E), XE = list_to_integer([$1] ++ lists:duplicate(Exp div E, $0)), X = trunc(XM) * XE; false -> X = trunc(math:exp(math:log(N) / E)) end, root(N, E, X). root(N, E, X) -> % Newton-Raphson method of solving (E)th-root X2 = ((N div (power(X, E - 1))) + (X * (E - 1))) div E, case X2 =/= X of true -> root(N, E, X2); false -> X end. %% MIT License: %% Copyright (c) 2010 by Kenji Rikitake. %% %% 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. From kenji.rikitake@REDACTED Tue Jan 26 06:44:01 2010 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Tue, 26 Jan 2010 14:44:01 +0900 Subject: [erlang-questions] Integer nth-root (Re: [erlang-questions] Integer square root) In-Reply-To: <20100126051648.GA50404@k2r.org> References: <201001211340.11272.clist@uah.es> <8E1F9D5A-C8D5-4F2D-AD0D-294069B6D5E6@cs.otago.ac.nz> <201001231101.30788.clist@uah.es> <53CA7566-8AF7-40CB-97F7-D5AC6F616990@cs.otago.ac.nz> <73BF5BD8-2DBB-44E3-BD45-C658B4059206@cs.otago.ac.nz> <20100126012647.GA46364@k2r.org> <20100126051648.GA50404@k2r.org> Message-ID: <20100126054401.GA50849@k2r.org> http://gist.github.com/286576 for the GitHub users. Kenji Rikitake > %% This is a quick hack of code for Integer nth-root in Erlang. > > %% Power function (X ^ Y) and root function (X ^ (1/Y)) for > %% integers in Erlang > %% by Kenji Rikitake 26-JAN-2010 > %% Distributed under MIT license at the end of the source code. From kenji.rikitake@REDACTED Tue Jan 26 08:48:40 2010 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Tue, 26 Jan 2010 16:48:40 +0900 Subject: [erlang-questions] Integer nth-root (Re: [erlang-questions] Integer square root) In-Reply-To: <20100126054401.GA50849@k2r.org> References: <201001211340.11272.clist@uah.es> <8E1F9D5A-C8D5-4F2D-AD0D-294069B6D5E6@cs.otago.ac.nz> <201001231101.30788.clist@uah.es> <53CA7566-8AF7-40CB-97F7-D5AC6F616990@cs.otago.ac.nz> <73BF5BD8-2DBB-44E3-BD45-C658B4059206@cs.otago.ac.nz> <20100126012647.GA46364@k2r.org> <20100126051648.GA50404@k2r.org> <20100126054401.GA50849@k2r.org> Message-ID: <20100126074840.GA52966@k2r.org> An example integer square root module (which does not include the power function) at: http://gist.github.com/286650 Kenji Rikitake From zvi.avraham@REDACTED Tue Jan 26 09:35:26 2010 From: zvi.avraham@REDACTED (ZZZZZZZZZZZZZZZZ) Date: Tue, 26 Jan 2010 00:35:26 -0800 (PST) Subject: Logging in distributed OTP applications Message-ID: <858e9a8c-7216-4a5f-bd04-ccecd5888653@l19g2000yqb.googlegroups.com> Hi, I have two OTP applications: "master" and "worker", both depend on log4erl in their .app files. SIngle "master" application and multiple "worker" applications running on different hosts/Erlang nodes. I was able to configure each one to write to it's own log file, but I need all instances of OTP applications to write to single log file. Can this be done with log4erl ? Can standard Erlang logging be used here, i.e. SASL? Any other logging packages / solutions? The simplest idea is two create globally registered logger gen_server in the "master" application/node and let all others to use gen_server:cast to send messages to log. But cast seems to be not guaranteed, while gen_server:call will introduce delays in the applications. Any ideas? thanks in advance. Zvi From zvi.avraham@REDACTED Tue Jan 26 09:36:53 2010 From: zvi.avraham@REDACTED (ZZZZZZZZZZZZZZZZ) Date: Tue, 26 Jan 2010 00:36:53 -0800 (PST) Subject: Interfaces between distributed OTP applications Message-ID: <8fc32993-3915-43eb-a4e4-d1d17b9aeea5@c29g2000yqd.googlegroups.com> Hi, the OTP Design Principles states, that OTP Applications are set of loosely-coupled components, while modules inside single application are tightly coupled. Let's say I have two distributed OTP applications: "client" and "server", both running on different Erlang nodes/hosts. Let's say "server" application uses gen_server, which exposes public function API. The "client" applications calling functions in public API of gen_server in "server" application. What's the proper way to express this in OTP? 1. For simplicity, just add dependency on "server" application in "client" application's .app file. Start both on "server" node. 2. Don't use public API functions in "server". Send messages directly to "server" using gen_server:call / cast. 3. Add third application: "server_api" or "server_if" with single module defining public API wrappers around gen_server messages protocol. Then "client" application will be depended on "server_api" application, and not the "server" itself. 4. Any other ideas? thanks in advance, Zvi From clist@REDACTED Tue Jan 26 09:56:46 2010 From: clist@REDACTED (Angel Alvarez) Date: Tue, 26 Jan 2010 09:56:46 +0100 Subject: [erlang-questions] Integer square root In-Reply-To: <20100126012647.GA46364@k2r.org> References: <201001211340.11272.clist@uah.es> <73BF5BD8-2DBB-44E3-BD45-C658B4059206@cs.otago.ac.nz> <20100126012647.GA46364@k2r.org> Message-ID: <201001260956.47065.clist@uah.es> El Martes, 26 de Enero de 2010 02:26:47 Kenji Rikitake escribi?: > Very long time ago I was trying to solve the square root > problem, but I didn't because handling in the float numbers > gave the sufficient precision for me. > > In general, a quick method of > solving X when Y = X * X and Y is given (X, Y are bignums) as: > > 1) Obtain approximation of X by float sqrt of Y > separately to significand and exponent > (note: IEEE754 format has its own limits in > the digits of exponent too) > > 2) applying Newton-Raphson method so that > Xnew = (X + (Y / X)) / 2 > > 3) Repeat finding Xnew on 2) until Xnew =:= X > > Things you need to invent: > > * bignum integer dividing program > (bignum / bignum -> bignum (+ remainder, maybe)) > (This is NOT provided by Erlang) > > FYI > Kenji Rikitake In fact after Richard's call of atention, (How could I made this!!??) I approached a naive Newton version , but after all Now Its clear for me that isqrt() is probably of use in cripto (!) so lloking erlang sources (as i use to do for lerarnign porpouses...) that's it... The app SSH uses: isqrt(0) -> 0; isqrt(1) -> 1; isqrt(X) when X >= 0 -> ? ? R = X div 2, ? ? isqrt(X div R, R, X). isqrt(Q,R,X) when Q < R -> ? ? R1 = (R+Q) div 2, ? ? isqrt(X div R1, R1, X); isqrt(_, R, _) -> R. that its entirely on integer domain and supposely handled well by erlang bignums routines. I tested this with some nig numbers and seems correct. it doesnt deserve more attention where the fundamental subject its to avoid making NOVICE MISTAKES (This is me!!!) like forgetting what is not integer arithmetic. Again Thaks to all!!, for you advice and sugestions > > In the message <73BF5BD8-2DBB-44E3-BD45-C658B4059206@REDACTED> > dated Mon, Jan 25, 2010 at 07:33:03PM +1300, > Richard O'Keefe writes: > > Didn't we have exactly this conversation several months ago? > > At the time I said that it is straightforward to write an > > integer square root function, and by that I meant >> in Erlang <<, > > no port programs needed. > > ________________________________________________________________ > 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 __________________________________________ MySQL5: Vale, corromper los datos de forma silente no era una buena idea despues de todo. From erlang@REDACTED Tue Jan 26 14:52:00 2010 From: erlang@REDACTED (Joe Armstrong) Date: Tue, 26 Jan 2010 14:52:00 +0100 Subject: packet sniffing Message-ID: <9b08084c1001260552w294228e1q9869fe65308bc94c@mail.gmail.com> Can I use the standard socket libraries to sniff all packets from an interface? I have a C driver that does rawsock = socket(PF_PACKET, SOCK_RAW, htons(p ETH_P_IP)) and then binds rawsock to "eth0" Can I do the equivalent directly in Erlang and throw away my C code? Also can I bind a listening socket to an arbitrary interface? /Joe From kenji.rikitake@REDACTED Tue Jan 26 16:17:20 2010 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Wed, 27 Jan 2010 00:17:20 +0900 Subject: [erlang-questions] Integer square root In-Reply-To: <201001260956.47065.clist@uah.es> References: <201001211340.11272.clist@uah.es> <73BF5BD8-2DBB-44E3-BD45-C658B4059206@cs.otago.ac.nz> <20100126012647.GA46364@k2r.org> <201001260956.47065.clist@uah.es> Message-ID: <20100126151720.GA59657@k2r.org> Hmmmm. It looks like I reinvented the wheel :p The isqrt/1 (commented out) function is at lib/ssh/src/ssh_math.erl Lessons: read the code before you try to write :p Kenji Rikitake From bob@REDACTED Tue Jan 26 17:07:07 2010 From: bob@REDACTED (Bob Ippolito) Date: Tue, 26 Jan 2010 08:07:07 -0800 Subject: [erlang-questions] Integer square root In-Reply-To: <20100126151720.GA59657@k2r.org> References: <201001211340.11272.clist@uah.es> <73BF5BD8-2DBB-44E3-BD45-C658B4059206@cs.otago.ac.nz> <20100126012647.GA46364@k2r.org> <201001260956.47065.clist@uah.es> <20100126151720.GA59657@k2r.org> Message-ID: <6a36e7291001260807t43fee474xd331d7797b64a5a5@mail.gmail.com> There's a copy of integer exponentiation in mochiweb's mochinum module (int_pow) and also in recent versions of io_lib_format (but this one is not exported). The crypto module has modular exponentiation too as mod_exp but that doesn't use native erlang integers. On Tue, Jan 26, 2010 at 7:17 AM, Kenji Rikitake wrote: > Hmmmm. It looks like I reinvented the wheel :p > > The isqrt/1 (commented out) function is at > lib/ssh/src/ssh_math.erl > > Lessons: read the code before you try to write :p > > Kenji Rikitake > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From freza@REDACTED Tue Jan 26 17:07:59 2010 From: freza@REDACTED (Jachym Holecek) Date: Tue, 26 Jan 2010 17:07:59 +0100 Subject: [erlang-questions] packet sniffing In-Reply-To: <9b08084c1001260552w294228e1q9869fe65308bc94c@mail.gmail.com> References: <9b08084c1001260552w294228e1q9869fe65308bc94c@mail.gmail.com> Message-ID: <20100126160759.GA1602@hanele.ig.cas.cz> # Joe Armstrong 2010-01-26: > Can I use the standard socket libraries to sniff all packets from an interface? > > I have a C driver that does > > rawsock = socket(PF_PACKET, SOCK_RAW, htons(p ETH_P_IP)) You're certainly aware of this, but for the record: this is Linux specific code. For a portable solution, one would have create a port driver on top of libpcap[*]. I don't know if that has been done though. Regards, -- Jachym [*] http://www.tcpdump.org/ From acton@REDACTED Tue Jan 26 20:04:47 2010 From: acton@REDACTED (Brian Acton) Date: Tue, 26 Jan 2010 11:04:47 -0800 Subject: understanding the scaleability limits of erlang and mnesia Message-ID: <7a9fe0201001261104y77ba93h4cabbb0f58fe5be@mail.gmail.com> Hi Guys, I'm fairly new to erlang and I'm trying to understand better how erlang and mnesia deal with large scale. I'm wondering if anyone could provide some examples where they have been using erlang in a very large configuration (i.e. more than 10 machines / more than 100 machines). I specifically am interested where people are running in a clustered configuration with an mnesia backing store to their application. It's been my experience that as much as a technology claims to be scalable, operability issues usually surface that make it bad in practice to simply just add more machines to the cluster. As an example, in my current configuration, I am experiencing a 10 minute mnesia recovery / verification time during node startup. If I try to bring up two nodes at the same time, I see even longer times and sometimes even failure during bring up. And my cluster is only four nodes in size. Of course, when the system is at steady state (i.e. all nodes up and running), it's awesome. However, when I have to go through a crash / recovery cycle, I usually want to shoot myself.... Anyone got any war stories to share? Any papers or presentations that I should look at? Thanks muchly, --b From acton@REDACTED Tue Jan 26 21:19:10 2010 From: acton@REDACTED (Brian Acton) Date: Tue, 26 Jan 2010 12:19:10 -0800 Subject: [erlang-questions] understanding the scaleability limits of erlang and mnesia In-Reply-To: <1264535171.3733.4.camel@pfisher-laptop> References: <7a9fe0201001261104y77ba93h4cabbb0f58fe5be@mail.gmail.com> <1264535171.3733.4.camel@pfisher-laptop> Message-ID: <7a9fe0201001261219m4f9db787rd68c7a633cf2232@mail.gmail.com> I have a mix of ram, disc, and disc_only table configurations. My hardware config is mixed. One box with single drive (to be end of lifed) and 3 boxes with raid 5 to help with overall throughput of disk i/o. My disc_only tables: do1 : with 777805 records occupying 111980141 bytes on disc do2 : with 594324 records occupying 639543647 bytes on disc do3 : with 1837761 records occupying 512674458 bytes on disc My disc tables: d1 : with 1112655 records occupying 73119677 words of mem d2 : with 1117441 records occupying 143819464 words of mem My ram tables: r1 : with 3493 records occupying 791941 words of mem r2 : with 10482 records occupying 1976194 words of mem r3 : with 14160 records occupying 520918 words of mem r4 : with 3759 records occupying 79983 words of mem Overall, it looks like about 1-2GB of data that would need to be replicated / xferred during startup. Is that correct? Can you explain more about how index uniqueness affects recover / startup times ? Thx, --b On Tue, Jan 26, 2010 at 11:46 AM, Paul Fisher wrote: > First of all, you need to specify the type of mnesia tables you are > using. I am going to assume you are using disk_copies, since disk_only > and ram_only should not act the way you describe. > > Second, with disk_copies the tables should recover at the speed the file > can be read from disk. Typically this is 80M/s+ for even a single SATA > drive, so even large tables should be fast. While the size of the > dataset does affect the table start time, it is more likely that you are > seeing a problem with the uniqueness of either the index of the table, > or of a secondary index. If you have a good unique index for the table, > but also have a secondary index with a limited number of values, the > table will recover as you describe. > > On Tue, 2010-01-26 at 13:04 -0600, Brian Acton wrote: > > Hi Guys, > > > > I'm fairly new to erlang and I'm trying to understand better how erlang > and > > mnesia deal with large scale. I'm wondering if anyone could provide some > > examples where they have been using erlang in a very large configuration > > (i.e. more than 10 machines / more than 100 machines). I specifically am > > interested where people are running in a clustered configuration with an > > mnesia backing store to their application. > > > > It's been my experience that as much as a technology claims to be > scalable, > > operability issues usually surface that make it bad in practice to simply > > just add more machines to the cluster. As an example, in my current > > configuration, I am experiencing a 10 minute mnesia recovery / > verification > > time during node startup. If I try to bring up two nodes at the same > time, I > > see even longer times and sometimes even failure during bring up. And my > > cluster is only four nodes in size. Of course, when the system is at > steady > > state (i.e. all nodes up and running), it's awesome. However, when I have > to > > go through a crash / recovery cycle, I usually want to shoot myself.... > > > > Anyone got any war stories to share? Any papers or presentations that I > > should look at? > > > > Thanks muchly, > > > > --b > > > From paul-trapexit@REDACTED Tue Jan 26 22:37:16 2010 From: paul-trapexit@REDACTED (Paul Mineiro) Date: Tue, 26 Jan 2010 13:37:16 -0800 (PST) Subject: [erlang-questions] understanding the scaleability limits of erlang and mnesia In-Reply-To: <7a9fe0201001261104y77ba93h4cabbb0f58fe5be@mail.gmail.com> References: <7a9fe0201001261104y77ba93h4cabbb0f58fe5be@mail.gmail.com> Message-ID: Hey it's an email by me from back in the day ... http://www.erlang.org/cgi-bin/ezmlm-cgi/4/36604 In particular, the no_table_loaders setting is very important. Also, setting master nodes on a table can elide the sync ... of course this only works for static data, or data whose replication is managed in another fashion, but it was a trick I found useful. Also, if data is emphemeral in nature, local_copies is also a useful trick. -- p On Tue, 26 Jan 2010, Brian Acton wrote: > Hi Guys, > > I'm fairly new to erlang and I'm trying to understand better how erlang and > mnesia deal with large scale. I'm wondering if anyone could provide some > examples where they have been using erlang in a very large configuration > (i.e. more than 10 machines / more than 100 machines). I specifically am > interested where people are running in a clustered configuration with an > mnesia backing store to their application. > > It's been my experience that as much as a technology claims to be scalable, > operability issues usually surface that make it bad in practice to simply > just add more machines to the cluster. As an example, in my current > configuration, I am experiencing a 10 minute mnesia recovery / verification > time during node startup. If I try to bring up two nodes at the same time, I > see even longer times and sometimes even failure during bring up. And my > cluster is only four nodes in size. Of course, when the system is at steady > state (i.e. all nodes up and running), it's awesome. However, when I have to > go through a crash / recovery cycle, I usually want to shoot myself.... > > Anyone got any war stories to share? Any papers or presentations that I > should look at? > > Thanks muchly, > > --b > From acton@REDACTED Tue Jan 26 23:23:06 2010 From: acton@REDACTED (Brian Acton) Date: Tue, 26 Jan 2010 14:23:06 -0800 Subject: [erlang-questions] understanding the scaleability limits of erlang and mnesia In-Reply-To: <1264539046.3733.6.camel@pfisher-laptop> References: <7a9fe0201001261104y77ba93h4cabbb0f58fe5be@mail.gmail.com> <1264535171.3733.4.camel@pfisher-laptop> <7a9fe0201001261219m4f9db787rd68c7a633cf2232@mail.gmail.com> <1264539046.3733.6.camel@pfisher-laptop> Message-ID: <7a9fe0201001261423p650e04c9k4f60ef2c3912cd92@mail.gmail.com> I understand that inserts would take longer in the former example than in the latter. However, I don't understand why this would so greatly impact restart / recovery time ? Is this because mnesia is effectively reinserting the records, rather than blatting the file from another node over the wire ? Presumably, the latter would be much much faster... Any references (besides what is on erlang.org) that you use that details this info ? Also, rewriting my app to lessen the uniqueness of the indexes is virtually impossible. I'm dealing with user ids which are inherently unique. --b On Tue, Jan 26, 2010 at 12:50 PM, Paul Fisher wrote: > On Tue, 2010-01-26 at 14:19 -0600, Brian Acton wrote: > > Can you explain more about how index uniqueness affects recover / > > startup times ? > > Fundamentally, this comes down to the way that ets tables work... Try to > insert 100000 records with unique index values into a table, then try to > do 100000 records with either the atoms 'true' or 'false'. You will see > the problem in the runtime results. > > -- > paul > > From acton@REDACTED Tue Jan 26 23:31:49 2010 From: acton@REDACTED (Brian Acton) Date: Tue, 26 Jan 2010 14:31:49 -0800 Subject: [erlang-questions] understanding the scaleability limits of erlang and mnesia In-Reply-To: References: <7a9fe0201001261104y77ba93h4cabbb0f58fe5be@mail.gmail.com> Message-ID: <7a9fe0201001261431m1ac723f9o2330acde2f966044@mail.gmail.com> Thank you. That is quite helpful. Our no_table_loader value is set to the default 2. We'll start testing and raising the value. I don't think that I can use the master node trick as our data is fairly dynamic (basically a function of user activity - 25% of user base active per day). Is there reference to "local_copies" somewhere on the net. A quick search for 'mnesia local_copies' did not turn up very much. Maybe, I'm not understanding the reference correctly? It's also good to hear from someone with a cluster > 5 nodes. I was sure that people were running larger clusters but had not seen much activity on this list regarding the topic. Thx! --b On Tue, Jan 26, 2010 at 1:37 PM, Paul Mineiro wrote: > Hey it's an email by me from back in the day ... > > http://www.erlang.org/cgi-bin/ezmlm-cgi/4/36604 > > In particular, the no_table_loaders setting is very important. > > Also, setting master nodes on a table can elide the sync ... of course > this only works for static data, or data whose replication is managed in > another fashion, but it was a trick I found useful. > > Also, if data is emphemeral in nature, local_copies is also a useful > trick. > > -- p > > On Tue, 26 Jan 2010, Brian Acton wrote: > > > Hi Guys, > > > > I'm fairly new to erlang and I'm trying to understand better how erlang > and > > mnesia deal with large scale. I'm wondering if anyone could provide some > > examples where they have been using erlang in a very large configuration > > (i.e. more than 10 machines / more than 100 machines). I specifically am > > interested where people are running in a clustered configuration with an > > mnesia backing store to their application. > > > > It's been my experience that as much as a technology claims to be > scalable, > > operability issues usually surface that make it bad in practice to simply > > just add more machines to the cluster. As an example, in my current > > configuration, I am experiencing a 10 minute mnesia recovery / > verification > > time during node startup. If I try to bring up two nodes at the same > time, I > > see even longer times and sometimes even failure during bring up. And my > > cluster is only four nodes in size. Of course, when the system is at > steady > > state (i.e. all nodes up and running), it's awesome. However, when I have > to > > go through a crash / recovery cycle, I usually want to shoot myself.... > > > > Anyone got any war stories to share? Any papers or presentations that I > > should look at? > > > > Thanks muchly, > > > > --b > > > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From paul-trapexit@REDACTED Tue Jan 26 23:49:23 2010 From: paul-trapexit@REDACTED (Paul Mineiro) Date: Tue, 26 Jan 2010 14:49:23 -0800 (PST) Subject: [erlang-questions] understanding the scaleability limits of erlang and mnesia In-Reply-To: <7a9fe0201001261431m1ac723f9o2330acde2f966044@mail.gmail.com> References: <7a9fe0201001261104y77ba93h4cabbb0f58fe5be@mail.gmail.com> <7a9fe0201001261431m1ac723f9o2330acde2f966044@mail.gmail.com> Message-ID: On Tue, 26 Jan 2010, Brian Acton wrote: > Is there reference to "local_copies" somewhere on the net. A quick search > for 'mnesia local_copies' did not turn up very much. Maybe, I'm not > understanding the reference correctly? sorry, that's "local_content" http://dukesoferl.blogspot.com/2008/08/scaling-mnesia-with-localcontent.html -- p From rpettit@REDACTED Tue Jan 26 23:58:53 2010 From: rpettit@REDACTED (Rick Pettit) Date: Tue, 26 Jan 2010 16:58:53 -0600 Subject: [erlang-questions] understanding the scaleability limits of erlang and mnesia In-Reply-To: <7a9fe0201001261431m1ac723f9o2330acde2f966044@mail.gmail.com> References: <7a9fe0201001261104y77ba93h4cabbb0f58fe5be@mail.gmail.com> <7a9fe0201001261431m1ac723f9o2330acde2f966044@mail.gmail.com> Message-ID: <9d872ef41c1967b76e01dc3d96e22843.squirrel@squirrelmail.vail> On Tue, January 26, 2010 4:31 pm, Brian Acton wrote: > Thank you. That is quite helpful. Our no_table_loader value is set to the > default 2. We'll start testing and raising the value. > > I don't think that I can use the master node trick as our data is fairly > dynamic (basically a function of user activity - 25% of user base active > per > day). > > Is there reference to "local_copies" somewhere on the net. A quick search > for 'mnesia local_copies' did not turn up very much. Maybe, I'm not > understanding the reference correctly? I believe the poster was referring to "local_content" tables. If you do "erl -man mnesia" and search for local_content you will find: * local_content When an application requires tables whose contents is local to each node, local_content tables may be used. The name of the table is known to all Mnesia nodes, but its contents is unique on each node. This means that access to such a table must be done locally. Set the local_content field to true if you want to enable the local_content behavior. The default is false. In using local_content tables the contents are not replicated across all nodes which have the table. > It's also good to hear from someone with a cluster > 5 nodes. I was sure > that people were running larger clusters but had not seen much activity on > this list regarding the topic. We have some clusters of 12+ nodes running in production with much success. There have been a number of tricks used over the years to make this work reliable in the face of various recovery scenarios--if I get time later to dig up some info on the specifics I'll post it to the list. -Rick > On Tue, Jan 26, 2010 at 1:37 PM, Paul Mineiro > wrote: > >> Hey it's an email by me from back in the day ... >> >> http://www.erlang.org/cgi-bin/ezmlm-cgi/4/36604 >> >> In particular, the no_table_loaders setting is very important. >> >> Also, setting master nodes on a table can elide the sync ... of course >> this only works for static data, or data whose replication is managed in >> another fashion, but it was a trick I found useful. >> >> Also, if data is emphemeral in nature, local_copies is also a useful >> trick. >> >> -- p >> >> On Tue, 26 Jan 2010, Brian Acton wrote: >> >> > Hi Guys, >> > >> > I'm fairly new to erlang and I'm trying to understand better how >> erlang >> and >> > mnesia deal with large scale. I'm wondering if anyone could provide >> some >> > examples where they have been using erlang in a very large >> configuration >> > (i.e. more than 10 machines / more than 100 machines). I specifically >> am >> > interested where people are running in a clustered configuration with >> an >> > mnesia backing store to their application. >> > >> > It's been my experience that as much as a technology claims to be >> scalable, >> > operability issues usually surface that make it bad in practice to >> simply >> > just add more machines to the cluster. As an example, in my current >> > configuration, I am experiencing a 10 minute mnesia recovery / >> verification >> > time during node startup. If I try to bring up two nodes at the same >> time, I >> > see even longer times and sometimes even failure during bring up. And >> my >> > cluster is only four nodes in size. Of course, when the system is at >> steady >> > state (i.e. all nodes up and running), it's awesome. However, when I >> have >> to >> > go through a crash / recovery cycle, I usually want to shoot >> myself.... >> > >> > Anyone got any war stories to share? Any papers or presentations that >> I >> > should look at? >> > >> > Thanks muchly, >> > >> > --b >> > >> >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> > From kaiduanx@REDACTED Wed Jan 27 00:35:23 2010 From: kaiduanx@REDACTED (Kaiduan Xie) Date: Tue, 26 Jan 2010 18:35:23 -0500 Subject: [erlang-questions] packet sniffing In-Reply-To: <20100126160759.GA1602@hanele.ig.cas.cz> References: <9b08084c1001260552w294228e1q9869fe65308bc94c@mail.gmail.com> <20100126160759.GA1602@hanele.ig.cas.cz> Message-ID: Is it possible to open raw socket and to send/recv packet in pure Erlang? Thanks, kaiduan On Tue, Jan 26, 2010 at 11:07 AM, Jachym Holecek wrote: > # Joe Armstrong 2010-01-26: >> Can I use the standard socket libraries to sniff all packets from an interface? >> >> I have a C driver that does >> >> ? ? ? ? ? rawsock = socket(PF_PACKET, SOCK_RAW, htons(p ETH_P_IP)) > > You're certainly aware of this, but for the record: this is Linux specific > code. For a portable solution, one would have create a port driver on top > of libpcap[*]. I don't know if that has been done though. > > Regards, > ? ? ? ?-- Jachym > > [*] http://www.tcpdump.org/ > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From acton@REDACTED Wed Jan 27 02:40:13 2010 From: acton@REDACTED (Brian Acton) Date: Tue, 26 Jan 2010 17:40:13 -0800 Subject: [erlang-questions] understanding the scaleability limits of erlang and mnesia In-Reply-To: <1264545239.3733.9.camel@pfisher-laptop> References: <7a9fe0201001261104y77ba93h4cabbb0f58fe5be@mail.gmail.com> <1264535171.3733.4.camel@pfisher-laptop> <7a9fe0201001261219m4f9db787rd68c7a633cf2232@mail.gmail.com> <1264539046.3733.6.camel@pfisher-laptop> <7a9fe0201001261423p650e04c9k4f60ef2c3912cd92@mail.gmail.com> <1264545239.3733.9.camel@pfisher-laptop> Message-ID: <7a9fe0201001261740r55ec9817tdd7a83bac1fddd42@mail.gmail.com> Disk and Network activity are good. In fact, after I made Paul M's change to no_table_loaders (raise to 20), I see the network interface pretty much peg out at 12 MB/s. Doing the math, this hits 96 Mbs which is pretty good for a 100Mbs interface. I guess at this point, I've got to go to a gigabit interface to improve startup time / throughput ? As it stands, my app takes about 7 minutes to startup. 5 of those minutes are lost in mnesia startup. --b On Tue, Jan 26, 2010 at 2:33 PM, Paul Fisher wrote: > You misunderstood me... uniqueness is good. Non-unique keys is bad. > > And for disk_copies tables it is effectively inserting into ets tables, > yes. Extremely, non-unique keys really slows down loads of tables at > startup. You should be able to test this by monitoring disk and network > i/o while it is starting the tables. If both are low, but while it > takes forever to start you table(s), then the keys are probably the > problem. > > On Tue, 2010-01-26 at 16:23 -0600, Brian Acton wrote: > > I understand that inserts would take longer in the former example than > > in the latter. However, I don't understand why this would so greatly > > impact restart / recovery time ? Is this because mnesia is effectively > > reinserting the records, rather than blatting the file from another > > node over the wire ? Presumably, the latter would be much much > > faster... > > > > Any references (besides what is on erlang.org) that you use that > > details this info ? > > > > Also, rewriting my app to lessen the uniqueness of the indexes is > > virtually impossible. I'm dealing with user ids which are inherently > > unique. > > > > --b > > > > > > On Tue, Jan 26, 2010 at 12:50 PM, Paul Fisher > > wrote: > > On Tue, 2010-01-26 at 14:19 -0600, Brian Acton wrote: > > > Can you explain more about how index uniqueness affects > > recover / > > > startup times ? > > > > > > Fundamentally, this comes down to the way that ets tables > > work... Try to > > insert 100000 records with unique index values into a table, > > then try to > > do 100000 records with either the atoms 'true' or 'false'. > > You will see > > the problem in the runtime results. > > > > -- > > paul > > > > > > > From igorrs@REDACTED Wed Jan 27 03:23:04 2010 From: igorrs@REDACTED (Igor Ribeiro Sucupira) Date: Wed, 27 Jan 2010 00:23:04 -0200 Subject: [erlang-questions] understanding the scaleability limits of erlang and mnesia In-Reply-To: <7a9fe0201001261740r55ec9817tdd7a83bac1fddd42@mail.gmail.com> References: <7a9fe0201001261104y77ba93h4cabbb0f58fe5be@mail.gmail.com> <1264535171.3733.4.camel@pfisher-laptop> <7a9fe0201001261219m4f9db787rd68c7a633cf2232@mail.gmail.com> <1264539046.3733.6.camel@pfisher-laptop> <7a9fe0201001261423p650e04c9k4f60ef2c3912cd92@mail.gmail.com> <1264545239.3733.9.camel@pfisher-laptop> <7a9fe0201001261740r55ec9817tdd7a83bac1fddd42@mail.gmail.com> Message-ID: You might want to try this patch, which is in the branch of proposed updates: http://www.erlang.org/cgi-bin/ezmlm-cgi/3/684 If network bandwidth is your botteneck (and not disk I/O nor CPU), it might help. It would also be a good test for the patch. Thanks. Igor. On Tue, Jan 26, 2010 at 11:40 PM, Brian Acton wrote: > Disk and Network activity are good. > > In fact, after I made Paul M's change to no_table_loaders (raise to 20), I > see the network interface pretty much peg out at 12 MB/s. Doing the math, > this hits 96 Mbs which is pretty good for a 100Mbs interface. > > I guess at this point, I've got to go to a gigabit interface to improve > startup time / throughput ? As it stands, my app takes about 7 minutes to > startup. 5 of those minutes are lost in mnesia startup. > > --b > > > On Tue, Jan 26, 2010 at 2:33 PM, Paul Fisher wrote: > >> You misunderstood me... uniqueness is good. ?Non-unique keys is bad. >> >> And for disk_copies tables it is effectively inserting into ets tables, >> yes. ?Extremely, non-unique keys really slows down loads of tables at >> startup. ?You should be able to test this by monitoring disk and network >> i/o while it is starting the tables. ?If both are low, but while it >> takes forever to start you table(s), then the keys are probably the >> problem. >> >> On Tue, 2010-01-26 at 16:23 -0600, Brian Acton wrote: >> > I understand that inserts would take longer in the former example than >> > in the latter. However, I don't understand why this would so greatly >> > impact restart / recovery time ? Is this because mnesia is effectively >> > reinserting the records, rather than blatting the file from another >> > node over the wire ? Presumably, the latter would be much much >> > faster... >> > >> > Any references (besides what is on erlang.org) that you use that >> > details this info ? >> > >> > Also, rewriting my app to lessen the uniqueness of the indexes is >> > virtually impossible. I'm dealing with user ids which are inherently >> > unique. >> > >> > --b >> > >> > >> > On Tue, Jan 26, 2010 at 12:50 PM, Paul Fisher >> > wrote: >> > ? ? ? ? On Tue, 2010-01-26 at 14:19 -0600, Brian Acton wrote: >> > ? ? ? ? > Can you explain more about how index uniqueness affects >> > ? ? ? ? recover / >> > ? ? ? ? > startup times ? >> > >> > >> > ? ? ? ? Fundamentally, this comes down to the way that ets tables >> > ? ? ? ? work... Try to >> > ? ? ? ? insert 100000 records with unique index values into a table, >> > ? ? ? ? then try to >> > ? ? ? ? do 100000 records with either the atoms 'true' or 'false'. >> > ? ? ? ? ?You will see >> > ? ? ? ? the problem in the runtime results. >> > >> > ? ? ? ? -- >> > ? ? ? ? paul >> > -- "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 amit.murthy@REDACTED Wed Jan 27 08:14:53 2010 From: amit.murthy@REDACTED (Amit Murthy) Date: Wed, 27 Jan 2010 12:44:53 +0530 Subject: build of R13B03 failing on Ubuntu 8.04 Message-ID: <4f5fdb631001262314n2c7c698cyb7b61495882d4d9a@mail.gmail.com> Hi, The configure-make-install cycle is failing in the make phase on my Ubuntu 8.04.1 box. The error I am seeing is make[3]: Entering directory `/home/amitm/Downloads/erlang/otp_src_R13B03/lib/hipe/sparc' erlc -W +debug_info +warn_exported_vars -o../ebin hipe_sparc_assemble.erl ./hipe_sparc_assemble.erl:none: internal error in core_module; crash reason: {{case_clause,{{var,380,'Word'},[]}}, [{v3_core,'-constant_bin_1/1-anonymous-0-',2}, {eval_bits,eval_field,3}, {eval_bits,expr_grp,4}, {v3_core,constant_bin_1,1}, {v3_core,constant_bin,1}, {v3_core,expr_bin,3}, {v3_core,expr,2}, {v3_core,novars,2}]} make[3]: *** [../ebin/hipe_sparc_assemble.beam] Error 1 make[3]: Leaving directory `/home/amitm/Downloads/erlang/otp_src_R13B03/lib/hipe/sparc' make[2]: *** [opt] Error 2 make[2]: Leaving directory `/home/amitm/Downloads/erlang/otp_src_R13B03/lib/hipe' make[1]: *** [opt] Error 2 make[1]: Leaving directory `/home/amitm/Downloads/erlang/otp_src_R13B03/lib' make: *** [secondary_bootstrap_build] Error 2 FWIW, I tried the following: If I execute directly the command ./bin/i686-pc-linux-gnu/erlc -W +debug_info +warn_exported_vars -o../ebin ./lib/hipe/sparc/hipe_sparc_assemble.erl it compiles but ./bootstrap/bin/erlc -W +debug_info +warn_exported_vars -o../ebin ./lib/hipe/sparc/hipe_sparc_assemble.erl gives the same error as above. In the first case, the erlc command will be using erl from my currently system installed erlang (version R13A). Any help will be much appreciated. Regards, Amit From clist@REDACTED Wed Jan 27 09:54:40 2010 From: clist@REDACTED (Angel Alvarez) Date: Wed, 27 Jan 2010 09:54:40 +0100 Subject: [erlang-questions] packet sniffing In-Reply-To: References: <9b08084c1001260552w294228e1q9869fe65308bc94c@mail.gmail.com> <20100126160759.GA1602@hanele.ig.cas.cz> Message-ID: <201001270954.40945.clist@uah.es> Hi This remembered me some quiestion whether the inet driver is multihreaded or not. Id dont really know if port solutions are taking benefit from the file driver (using the Async Pool) where the inet driver relies directly select/poll and OS Kernel to leverage SMP support. So the a driver with a libpcap interface would naturally have to make use of the async pool. On the other side the aproach of patching inet to allow raw ports would not I was thinking that on RAW mode a simple socket can produce a ton of bits (a lot of more than is usual usage on a TCP socket?) I think Joe wants to avoid C code at all so the SOCK_RAW question, either a C driver poses the same C dependences... so (im not sure the above statemente are all true) what's the best case? /Angel El Mi?rcoles, 27 de Enero de 2010 00:35:23 Kaiduan Xie escribi?: > Is it possible to open raw socket and to send/recv packet in pure Erlang? > > Thanks, > > kaiduan > > On Tue, Jan 26, 2010 at 11:07 AM, Jachym Holecek wrote: > > # Joe Armstrong 2010-01-26: > >> Can I use the standard socket libraries to sniff all packets from an interface? > >> > >> I have a C driver that does > >> > >> ? ? ? ? ? rawsock = socket(PF_PACKET, SOCK_RAW, htons(p ETH_P_IP)) > > > > You're certainly aware of this, but for the record: this is Linux specific > > code. For a portable solution, one would have create a port driver on top > > of libpcap[*]. I don't know if that has been done though. > > > > Regards, > > ? ? ? ?-- Jachym > > > > [*] http://www.tcpdump.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 > > -- No imprima este correo si no es necesario. El medio ambiente est? en nuestras manos. ->>---------------------------------------------------------- Angel J. Alvarez Miguel, Servicios Inform?ticos Edificio Torre de Control, Campus Externo UAH Alcal? de Henares 28806, Madrid ** ESPA?A ** RedIRIS Jabber: angel.uah.es@REDACTED --------------------------------------------[www.uah.es]-<<-- HONEY BUNNY - Any of you *uckin' pricks move and I'll execute every mother*ucking last one of you. -- No imprima este correo si no es necesario. El medio ambiente est? en nuestras manos. __________________________________________ Clist UAH a.k.a Angel __________________________________________ Te has metido en un hipoteca de 70M y encima te roban una panda de Ninjas... Crisis Ninja para Dummies. From fritchie@REDACTED Wed Jan 27 12:42:57 2010 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Wed, 27 Jan 2010 05:42:57 -0600 Subject: [erlang-questions] understanding the scaleability limits of erlang and mnesia In-Reply-To: Message of "Tue, 26 Jan 2010 17:40:13 PST." <7a9fe0201001261740r55ec9817tdd7a83bac1fddd42@mail.gmail.com> Message-ID: <95604.1264592577@snookles.snookles.com> If I recall correctly, a single modification to a Mnesia table (or Mnesia fragment) while a replica is down will trigger the transfer of the entire table/fragment from an always-alive -> now-recovering nodes. For the sake of a thought experiment, if the 2GB size limit on a dets table were removed, and if you stored 2TB of data in a table ... ... then deleting a single 1KB record in that table while a replica was unavailable would require transferring 2TB of data to resync, plus whatever would be required to "catch up" with table modifications that were made during the re-sync. -Scott From kaiduanx@REDACTED Wed Jan 27 15:34:30 2010 From: kaiduanx@REDACTED (Kaiduan Xie) Date: Wed, 27 Jan 2010 09:34:30 -0500 Subject: [erlang-questions] packet sniffing In-Reply-To: <201001270954.40945.clist@uah.es> References: <9b08084c1001260552w294228e1q9869fe65308bc94c@mail.gmail.com> <20100126160759.GA1602@hanele.ig.cas.cz> <201001270954.40945.clist@uah.es> Message-ID: I also want to get rid of C code to operate on raw mode, that means port/linked-in driver is not an option. But it looks like Erlang does not provide the module now. Thanks, kaiduan On Wed, Jan 27, 2010 at 3:54 AM, Angel Alvarez wrote: > Hi > > This remembered me some quiestion whether the inet driver is multihreaded or not. > > Id dont really know if port solutions are taking benefit from the file driver (using the Async Pool) > where the inet driver relies directly select/poll and OS Kernel to leverage SMP support. > > So the a driver with a libpcap interface would naturally have to make use of the async pool. > > On the other side the aproach of patching inet to allow raw ports would not > > I was thinking that on RAW mode a simple socket can produce a ton of bits (a lot of more than > is usual usage on a TCP socket?) > > I think Joe wants to avoid C code at all so the SOCK_RAW question, either a C driver poses the > same C dependences... > > so (im not sure the above statemente are all true) what's the best case? > > > > /Angel > > El Mi?rcoles, 27 de Enero de 2010 00:35:23 Kaiduan Xie escribi?: >> Is it possible to open raw socket and to send/recv packet in pure Erlang? >> >> Thanks, >> >> kaiduan >> >> On Tue, Jan 26, 2010 at 11:07 AM, Jachym Holecek wrote: >> > # Joe Armstrong 2010-01-26: >> >> Can I use the standard socket libraries to sniff all packets from an interface? >> >> >> >> I have a C driver that does >> >> >> >> ? ? ? ? ? rawsock = socket(PF_PACKET, SOCK_RAW, htons(p ETH_P_IP)) >> > >> > You're certainly aware of this, but for the record: this is Linux specific >> > code. For a portable solution, one would have create a port driver on top >> > of libpcap[*]. I don't know if that has been done though. >> > >> > Regards, >> > ? ? ? ?-- Jachym >> > >> > [*] http://www.tcpdump.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 >> >> > > > > -- > No imprima este correo si no es necesario. El medio ambiente est? en nuestras manos. > ->>---------------------------------------------------------- > > ?Angel J. Alvarez Miguel, Servicios Inform?ticos > ?Edificio Torre de Control, Campus Externo UAH > ?Alcal? de Henares 28806, Madrid ? ?** ESPA?A ** > > ?RedIRIS Jabber: angel.uah.es@REDACTED > --------------------------------------------[www.uah.es]-<<-- > HONEY BUNNY - Any of you *uckin' pricks move and I'll execute every mother*ucking last one of you. > -- > No imprima este correo si no es necesario. El medio ambiente est? en nuestras manos. > __________________________________________ > > Clist UAH a.k.a Angel > __________________________________________ > Te has metido en un hipoteca de 70M y encima te roban una panda de Ninjas... Crisis Ninja para Dummies. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From matthias@REDACTED Wed Jan 27 21:12:13 2010 From: matthias@REDACTED (Matthias Lang) Date: Wed, 27 Jan 2010 21:12:13 +0100 Subject: [erlang-questions] packet sniffing In-Reply-To: <20100126160759.GA1602@hanele.ig.cas.cz> References: <9b08084c1001260552w294228e1q9869fe65308bc94c@mail.gmail.com> <20100126160759.GA1602@hanele.ig.cas.cz> Message-ID: <20100127201213.GA5632@corelatus.se> On Tuesday, January 26, Jachym Holecek wrote: > # Joe Armstrong 2010-01-26: > > Can I use the standard socket libraries to sniff all packets from an interface? > > > > I have a C driver that does > > > > rawsock = socket(PF_PACKET, SOCK_RAW, htons(p ETH_P_IP)) > You're certainly aware of this, but for the record: this is Linux specific > code. For a portable solution, one would have create a port driver on top > of libpcap[*]. I don't know if that has been done though. I have not looked at it myself, but the EDTK driver toolkit appears to contain a libpcap driver http://www.snookles.com/erlang/edtk/ I'm guessing Joe's currently using the tuntap library Luke Gorrie wrote a long time ago. It gets the job done, though probably not on BSD. Matt From pablo.platt@REDACTED Thu Jan 28 14:00:39 2010 From: pablo.platt@REDACTED (Pablo Platt) Date: Thu, 28 Jan 2010 05:00:39 -0800 (PST) Subject: gen_server with a dict vs mnesia table vs ets Message-ID: <479945.36656.qm@web112606.mail.gq1.yahoo.com> Hi, I'm building an erlang server. Users sends http requests to the server to update their status. The http request process on the server saves the user status message in memory. Every minute the server sends all messages to a remote server and clear the memory. If a user update his status several times in a minute, the last message overrides the previous one. It is important that between reading all the messages and clearing them no other process will be able to write a status message. What is the best way to implement it? 1. gen_server with a dict. The key will be the userid. dict:store/3 will update or create the status. The gen_server solves the 'transaction' issue. 2. mnesia table with ram_copies. Handle transactions and I don't need to implement a gen_server. Is there too much overhead with this solution? 3. ETS table which is more light weight and have a gen_server. Is it possible to do the transaction in ETS? To lock the table between reading all the messages and clearing them? Thanks From max.lapshin@REDACTED Thu Jan 28 14:03:26 2010 From: max.lapshin@REDACTED (Max Lapshin) Date: Thu, 28 Jan 2010 16:03:26 +0300 Subject: [erlang-questions] gen_server with a dict vs mnesia table vs ets In-Reply-To: <479945.36656.qm@web112606.mail.gq1.yahoo.com> References: <479945.36656.qm@web112606.mail.gq1.yahoo.com> Message-ID: What for do you need transaction for ETS, if you can make it private to one process? From pablo.platt@REDACTED Thu Jan 28 14:09:37 2010 From: pablo.platt@REDACTED (Pablo Platt) Date: Thu, 28 Jan 2010 05:09:37 -0800 (PST) Subject: [erlang-questions] gen_server with a dict vs mnesia table vs ets In-Reply-To: References: <479945.36656.qm@web112606.mail.gq1.yahoo.com> Message-ID: <438177.22287.qm@web112606.mail.gq1.yahoo.com> If ETS is private to one table I guess I need to implement a gen_server on top of it. In that case wouldn't a dict in the gen_server state do the same? Is there a number of items above which is it better to use ETS and not a dict? ________________________________ From: Max Lapshin To: Pablo Platt Cc: erlang-questions@REDACTED Sent: Thu, January 28, 2010 3:03:26 PM Subject: Re: [erlang-questions] gen_server with a dict vs mnesia table vs ets What for do you need transaction for ETS, if you can make it private to one process? From max.lapshin@REDACTED Thu Jan 28 14:14:41 2010 From: max.lapshin@REDACTED (Max Lapshin) Date: Thu, 28 Jan 2010 16:14:41 +0300 Subject: [erlang-questions] gen_server with a dict vs mnesia table vs ets In-Reply-To: <438177.22287.qm@web112606.mail.gq1.yahoo.com> References: <479945.36656.qm@web112606.mail.gq1.yahoo.com> <438177.22287.qm@web112606.mail.gq1.yahoo.com> Message-ID: On Thu, Jan 28, 2010 at 4:09 PM, Pablo Platt wrote: > If ETS is private to one table I guess I need to implement a gen_server on > top of it. > In that case wouldn't a dict in the gen_server state do the same? > Is there a number of items above which is it better to use ETS and not a > dict? I don't know such number, but there is clearly told, that data in ETS doesn't take part in garbage collection. From max.lapshin@REDACTED Thu Jan 28 14:29:48 2010 From: max.lapshin@REDACTED (Max Lapshin) Date: Thu, 28 Jan 2010 16:29:48 +0300 Subject: [erlang-questions] gen_server with a dict vs mnesia table vs ets In-Reply-To: <178315.40375.qm@web112611.mail.gq1.yahoo.com> References: <479945.36656.qm@web112606.mail.gq1.yahoo.com> <438177.22287.qm@web112606.mail.gq1.yahoo.com> <178315.40375.qm@web112611.mail.gq1.yahoo.com> Message-ID: On Thu, Jan 28, 2010 at 4:28 PM, Pablo Platt wrote: > The fact that ETS doesn't take part in garbage collection is a good or bad > feature in my case? Good, of course: you can control by yourself, when to clean objects, so there will be no GC-penalty on each loop From pablo.platt@REDACTED Thu Jan 28 14:28:46 2010 From: pablo.platt@REDACTED (Pablo Platt) Date: Thu, 28 Jan 2010 05:28:46 -0800 (PST) Subject: [erlang-questions] gen_server with a dict vs mnesia table vs ets In-Reply-To: References: <479945.36656.qm@web112606.mail.gq1.yahoo.com> <438177.22287.qm@web112606.mail.gq1.yahoo.com> Message-ID: <178315.40375.qm@web112611.mail.gq1.yahoo.com> The fact that ETS doesn't take part in garbage collection is a good or bad feature in my case? ________________________________ From: Max Lapshin To: Pablo Platt Cc: erlang-questions@REDACTED Sent: Thu, January 28, 2010 3:14:41 PM Subject: Re: [erlang-questions] gen_server with a dict vs mnesia table vs ets On Thu, Jan 28, 2010 at 4:09 PM, Pablo Platt wrote: > If ETS is private to one table I guess I need to implement a gen_server on > top of it. > In that case wouldn't a dict in the gen_server state do the same? > Is there a number of items above which is it better to use ETS and not a > dict? I don't know such number, but there is clearly told, that data in ETS doesn't take part in garbage collection. From ishwar@REDACTED Thu Jan 28 15:25:40 2010 From: ishwar@REDACTED (Ish Rattan) Date: Thu, 28 Jan 2010 09:25:40 -0500 (EST) Subject: A silly one? Message-ID: I can't figure out how to print a term, assume tht factorial(N) is given and print_it(N) -> Fac = factorial(N), io:format("fac of ~p is ~p~n", N, Fac). -ishwar From pablo.platt@REDACTED Thu Jan 28 14:31:24 2010 From: pablo.platt@REDACTED (Pablo Platt) Date: Thu, 28 Jan 2010 05:31:24 -0800 (PST) Subject: [erlang-questions] gen_server with a dict vs mnesia table vs ets In-Reply-To: References: <479945.36656.qm@web112606.mail.gq1.yahoo.com> <438177.22287.qm@web112606.mail.gq1.yahoo.com> <178315.40375.qm@web112611.mail.gq1.yahoo.com> Message-ID: <635371.73235.qm@web112619.mail.gq1.yahoo.com> So I'll use a gen_server that controls the ETS table with private access. Thanks ________________________________ From: Max Lapshin To: Pablo Platt Cc: erlang-questions@REDACTED Sent: Thu, January 28, 2010 3:29:48 PM Subject: Re: [erlang-questions] gen_server with a dict vs mnesia table vs ets On Thu, Jan 28, 2010 at 4:28 PM, Pablo Platt wrote: > The fact that ETS doesn't take part in garbage collection is a good or bad > feature in my case? Good, of course: you can control by yourself, when to clean objects, so there will be no GC-penalty on each loop ________________________________________________________________ erlang-questions mailing list. See http://www.erlang.org/faq.html erlang-questions (at) erlang.org From kaiduanx@REDACTED Thu Jan 28 15:34:55 2010 From: kaiduanx@REDACTED (Kaiduan Xie) Date: Thu, 28 Jan 2010 09:34:55 -0500 Subject: [erlang-questions] A silly one? In-Reply-To: References: Message-ID: io:format("fac of ~p is ~p`n", [N, Fac]). On Thu, Jan 28, 2010 at 9:25 AM, Ish Rattan wrote: > > I can't figure out how to print a term, > assume tht factorial(N) is given and > > print_it(N) -> > ? Fac = factorial(N), > ? io:format("fac of ~p is ~p~n", N, Fac). > > -ishwar > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From kaiduanx@REDACTED Thu Jan 28 15:36:35 2010 From: kaiduanx@REDACTED (Kaiduan Xie) Date: Thu, 28 Jan 2010 09:36:35 -0500 Subject: [erlang-questions] A silly one? In-Reply-To: References: Message-ID: sorry, a typo io:format("fac of ~p is ~p~n", [N, Fac]). On Thu, Jan 28, 2010 at 9:34 AM, Kaiduan Xie wrote: > io:format("fac of ~p is ~p`n", [N, Fac]). > > On Thu, Jan 28, 2010 at 9:25 AM, Ish Rattan wrote: >> >> I can't figure out how to print a term, >> assume tht factorial(N) is given and >> >> print_it(N) -> >> ? Fac = factorial(N), >> ? io:format("fac of ~p is ~p~n", N, Fac). >> >> -ishwar >> >> >> ________________________________________________________________ >> erlang-questions mailing list. See http://www.erlang.org/faq.html >> erlang-questions (at) erlang.org >> >> > From mononcqc@REDACTED Thu Jan 28 15:37:19 2010 From: mononcqc@REDACTED (Fred Hebert) Date: Thu, 28 Jan 2010 09:37:19 -0500 Subject: [erlang-questions] A silly one? In-Reply-To: References: Message-ID: <8b9ee55b1001280637n41d8817av46150fbc4ec5c070@mail.gmail.com> The problem here is that you're using the function wrong. io:format("fac of ~p is ~p~n", N, Fac). should be io:format("fac of ~p is ~p~n", [N, Fac]). io:format takes only two arguments in your case, so the parameters to the string need to be wrapped in a list. On Thu, Jan 28, 2010 at 9:25 AM, Ish Rattan wrote: > > I can't figure out how to print a term, > assume tht factorial(N) is given and > > print_it(N) -> > Fac = factorial(N), > io:format("fac of ~p is ~p~n", N, Fac). > > -ishwar > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From john.hughes@REDACTED Thu Jan 28 15:38:06 2010 From: john.hughes@REDACTED (John Hughes) Date: Thu, 28 Jan 2010 15:38:06 +0100 Subject: [erlang-questions] A silly one? In-Reply-To: References: Message-ID: <5D484E07CDCB4CA68D040A3D149589B8@JohnsTablet2009> You put the terms to print in a list: print_it(N) -> Fac = factorial(N), io:format("fac of ~p is ~p~n", [N, Fac]). ----- Original Message ----- From: "Ish Rattan" To: Sent: Thursday, January 28, 2010 3:25 PM Subject: [erlang-questions] A silly one? > > I can't figure out how to print a term, > assume tht factorial(N) is given and > > print_it(N) -> > Fac = factorial(N), > io:format("fac of ~p is ~p~n", N, Fac). > > -ishwar > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > > From eodbat@REDACTED Thu Jan 28 15:42:53 2010 From: eodbat@REDACTED (Edoardo Batini) Date: Thu, 28 Jan 2010 15:42:53 +0100 Subject: [erlang-questions] A silly one? In-Reply-To: References: Message-ID: <20100128144253.GA10852@jetzback> On Thu, Jan 28, 2010 at 09:25:40AM -0500, Ish Rattan wrote: > > I can't figure out how to print a term, > assume tht factorial(N) is given and > > print_it(N) -> > Fac = factorial(N), > io:format("fac of ~p is ~p~n", N, Fac). the right one is: io:format("fac of ~p is ~p~n", [N, Fac]). > > -ishwar > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From rvirding@REDACTED Thu Jan 28 16:44:13 2010 From: rvirding@REDACTED (Robert Virding) Date: Thu, 28 Jan 2010 16:44:13 +0100 Subject: [erlang-questions] gen_server with a dict vs mnesia table vs ets In-Reply-To: <635371.73235.qm@web112619.mail.gq1.yahoo.com> References: <479945.36656.qm@web112606.mail.gq1.yahoo.com> <438177.22287.qm@web112606.mail.gq1.yahoo.com> <178315.40375.qm@web112611.mail.gq1.yahoo.com> <635371.73235.qm@web112619.mail.gq1.yahoo.com> Message-ID: <3dbc6d1c1001280744t2b846193p156d8e40525cb7fe@mail.gmail.com> It really depends very much on your app which is better: - An ETS table will generally allow you to hold more data. - An ETS table is external to processes so there is no cost in process GC. - BUT there is still an ETS data GC cost every time you add or remove data. - Since ETS data not in process there are copying costs every time you access table. This can make some operations very expensive, but match_object and select_object can help alot. - A dict allows easy roll back to previous state if you keep old reference. - ETS and dicts provide slightly different interfaces. You could use a public ETS table, but this would not allow for more complex atomic transactions and is not accessible over distribution. It really does depend on what you are doing. The best is to test it with realistic data amounts and operations. As an alternative to dicts there are gb_trees which are also in the process memory but have different properties compared to dicts. Robert 2010/1/28 Pablo Platt : > So I'll use a gen_server that controls the ETS table with private access. > Thanks > > > > > ________________________________ > From: Max Lapshin > To: Pablo Platt > Cc: erlang-questions@REDACTED > Sent: Thu, January 28, 2010 3:29:48 PM > Subject: Re: [erlang-questions] gen_server with a dict vs mnesia table vs ets > > On Thu, Jan 28, 2010 at 4:28 PM, Pablo Platt wrote: >> The fact that ETS doesn't take part in garbage collection is a good or bad >> feature in my case? > > Good, of course: you can control by yourself, when to clean objects, > so there will be no GC-penalty on each loop > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > > From kvs@REDACTED Thu Jan 28 19:36:02 2010 From: kvs@REDACTED (Konstantin Sorokin) Date: Thu, 28 Jan 2010 21:36:02 +0300 Subject: http:request() and HTTP redirects Message-ID: <9dfb3ec1001281036l51aa32a9u6daf07f086128094@mail.gmail.com> Hello! When using synchronous http:request() is there a way to know the final url retrieved if there were several HTTP redirects ? -- Konstantin Sorokin From nick@REDACTED Thu Jan 28 22:01:10 2010 From: nick@REDACTED (Nick Gerakines) Date: Thu, 28 Jan 2010 13:01:10 -0800 Subject: Reminder: SF Erlounge hosted by Powerset/Microsoft on February 11th Message-ID: Thursday, February 11th, 2009 from 7:00 pm to 8:30 pm. The next SF Erlounge is just around the corner thanks to Powerset/Microsoft for providing the space. 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. Powerset A Microsoft Company 475 Brannan Street, Suite 330 San Francisco, CA 94107 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. Plan on parking in the street or taking public transit. 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 pablo.platt@REDACTED Thu Jan 28 22:18:42 2010 From: pablo.platt@REDACTED (Pablo Platt) Date: Thu, 28 Jan 2010 13:18:42 -0800 (PST) Subject: sending a json body with http:request Message-ID: <966030.96419.qm@web112607.mail.gq1.yahoo.com> Hi, I'm using mochijson2 to encode json and I need to send it with an http request. I'm using SampleData = [<<"a">>, <<"b">>], Data = mochijson2:encode(SampleData), Params = lists:append(["param1=", Data]), URL = "http://localhost/path/", http:request(post, { URL, [], "application/x-www-form-urlencoded", Params }, [], []). mochijson2:encode/1 returns binary so do I need to use binary_to_list on it? Do I need to url encode the Params? Is there a url encoding function in erlang other then edoc_lib:escape_uri/1? Thanks From zabrane3@REDACTED Thu Jan 28 23:19:24 2010 From: zabrane3@REDACTED (zabrane Mikael) Date: Thu, 28 Jan 2010 23:19:24 +0100 Subject: URL normalization module Message-ID: <18a1db031001281419p36456911t899d96183fd30bd4@mail.gmail.com> Hi, Is there a free to use URL normalization module which respect the following process: http://en.wikipedia.org/wiki/URL_normalization Thanks Zabrane From chandrashekhar.mullaparthi@REDACTED Thu Jan 28 23:19:33 2010 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Thu, 28 Jan 2010 22:19:33 +0000 Subject: [erlang-questions] http:request() and HTTP redirects In-Reply-To: <9dfb3ec1001281036l51aa32a9u6daf07f086128094@mail.gmail.com> References: <9dfb3ec1001281036l51aa32a9u6daf07f086128094@mail.gmail.com> Message-ID: On 28 January 2010 18:36, Konstantin Sorokin wrote: > > Hello! > > When using synchronous http:request() is there a way to know the final > url retrieved if there were several HTTP redirects ? I guess the only way would be to disable autoredirect, and your code follows redirects as it sees them. That way you'll know which URL gave you the non-redirect response. cheers Chandru From pablo.platt@REDACTED Thu Jan 28 22:22:36 2010 From: pablo.platt@REDACTED (Pablo Platt) Date: Thu, 28 Jan 2010 13:22:36 -0800 (PST) Subject: [erlang-questions] gen_server with a dict vs mnesia table vs ets In-Reply-To: <3dbc6d1c1001280744t2b846193p156d8e40525cb7fe@mail.gmail.com> References: <479945.36656.qm@web112606.mail.gq1.yahoo.com> <438177.22287.qm@web112606.mail.gq1.yahoo.com> <178315.40375.qm@web112611.mail.gq1.yahoo.com> <635371.73235.qm@web112619.mail.gq1.yahoo.com> <3dbc6d1c1001280744t2b846193p156d8e40525cb7fe@mail.gmail.com> Message-ID: <316958.35358.qm@web112610.mail.gq1.yahoo.com> @Robert My use case is simple: - a list of key/value records ({user_id, msg_type}, msg_body) - several processes needs to create/update records. - one process needs to get all the records and clear the list in an 'atomic' operation once per 1 minute. - number of records per minutes expected to be <1K at start. - No need for replication/distribution. The list will be only in memory. ________________________________ From: Robert Virding To: Pablo Platt Cc: Max Lapshin ; erlang-questions@REDACTED Sent: Thu, January 28, 2010 5:44:13 PM Subject: Re: [erlang-questions] gen_server with a dict vs mnesia table vs ets It really depends very much on your app which is better: - An ETS table will generally allow you to hold more data. - An ETS table is external to processes so there is no cost in process GC. - BUT there is still an ETS data GC cost every time you add or remove data. - Since ETS data not in process there are copying costs every time you access table. This can make some operations very expensive, but match_object and select_object can help alot. - A dict allows easy roll back to previous state if you keep old reference. - ETS and dicts provide slightly different interfaces. You could use a public ETS table, but this would not allow for more complex atomic transactions and is not accessible over distribution. It really does depend on what you are doing. The best is to test it with realistic data amounts and operations. As an alternative to dicts there are gb_trees which are also in the process memory but have different properties compared to dicts. Robert 2010/1/28 Pablo Platt : > So I'll use a gen_server that controls the ETS table with private access. > Thanks > > > > > ________________________________ > From: Max Lapshin > To: Pablo Platt > Cc: erlang-questions@REDACTED > Sent: Thu, January 28, 2010 3:29:48 PM > Subject: Re: [erlang-questions] gen_server with a dict vs mnesia table vs ets > > On Thu, Jan 28, 2010 at 4:28 PM, Pablo Platt wrote: >> The fact that ETS doesn't take part in garbage collection is a good or bad >> feature in my case? > > Good, of course: you can control by yourself, when to clean objects, > so there will be no GC-penalty on each loop > > ________________________________________________________________ > 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 Thu Jan 28 23:36:36 2010 From: kagato@REDACTED (Jayson Vantuyl) Date: Thu, 28 Jan 2010 14:36:36 -0800 Subject: [erlang-questions] gen_server with a dict vs mnesia table vs ets In-Reply-To: <316958.35358.qm@web112610.mail.gq1.yahoo.com> References: <479945.36656.qm@web112606.mail.gq1.yahoo.com> <438177.22287.qm@web112606.mail.gq1.yahoo.com> <178315.40375.qm@web112611.mail.gq1.yahoo.com> <635371.73235.qm@web112619.mail.gq1.yahoo.com> <3dbc6d1c1001280744t2b846193p156d8e40525cb7fe@mail.gmail.com> <316958.35358.qm@web112610.mail.gq1.yahoo.com> Message-ID: Use ETS, managed by a gen_server. The gen_server will serialize all operations, so there will be no concurrency against the ETS table. If you need to scale this further, you might have one table and gen_server per message type, or even more split up by a hash on the user_id. When splitting, if your need for an atomic update is global across processes, you can either collect them as batches in another process or use a gen_fsm to temporarily lock them all, then flush them, then unlock them. While ETS does cause some extra copying, for what it is good at it can be blazingly fast. Just test it, as variations between systems make it nearly impossible to say which is better without actual testing. eprof and fprof are your friends. Or you could just use Mnesia, as you can use its transactions to get your atomicity. On Jan 28, 2010, at 1:22 PM, Pablo Platt wrote: > @Robert > > My use case is simple: > - a list of key/value records ({user_id, msg_type}, msg_body) > - several processes needs to create/update records. > - one process needs to get all the records and clear the list in an 'atomic' operation once per 1 minute. > - number of records per minutes expected to be <1K at start. > - No need for replication/distribution. The list will be only in memory. > > > > ________________________________ > From: Robert Virding > To: Pablo Platt > Cc: Max Lapshin ; erlang-questions@REDACTED > Sent: Thu, January 28, 2010 5:44:13 PM > Subject: Re: [erlang-questions] gen_server with a dict vs mnesia table vs ets > > It really depends very much on your app which is better: > > - An ETS table will generally allow you to hold more data. > - An ETS table is external to processes so there is no cost in process GC. > - BUT there is still an ETS data GC cost every time you add or remove data. > - Since ETS data not in process there are copying costs every time you > access table. This can make some operations very expensive, but > match_object and select_object can help alot. > - A dict allows easy roll back to previous state if you keep old reference. > - ETS and dicts provide slightly different interfaces. > > You could use a public ETS table, but this would not allow for more > complex atomic transactions and is not accessible over distribution. > > It really does depend on what you are doing. The best is to test it > with realistic data amounts and operations. As an alternative to dicts > there are gb_trees which are also in the process memory but have > different properties compared to dicts. > > Robert > > 2010/1/28 Pablo Platt : >> So I'll use a gen_server that controls the ETS table with private access. >> Thanks >> >> >> >> >> ________________________________ >> From: Max Lapshin >> To: Pablo Platt >> Cc: erlang-questions@REDACTED >> Sent: Thu, January 28, 2010 3:29:48 PM >> Subject: Re: [erlang-questions] gen_server with a dict vs mnesia table vs ets >> >> On Thu, Jan 28, 2010 at 4:28 PM, Pablo Platt wrote: >>> The fact that ETS doesn't take part in garbage collection is a good or bad >>> feature in my case? >> >> Good, of course: you can control by yourself, when to clean objects, >> so there will be no GC-penalty on each loop >> >> ________________________________________________________________ >> 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 pablo.platt@REDACTED Thu Jan 28 23:45:41 2010 From: pablo.platt@REDACTED (Pablo Platt) Date: Thu, 28 Jan 2010 14:45:41 -0800 (PST) Subject: [erlang-questions] gen_server with a dict vs mnesia table vs ets In-Reply-To: References: <479945.36656.qm@web112606.mail.gq1.yahoo.com> <438177.22287.qm@web112606.mail.gq1.yahoo.com> <178315.40375.qm@web112611.mail.gq1.yahoo.com> <635371.73235.qm@web112619.mail.gq1.yahoo.com> <3dbc6d1c1001280744t2b846193p156d8e40525cb7fe@mail.gmail.com> <316958.35358.qm@web112610.mail.gq1.yahoo.com> Message-ID: <417009.68935.qm@web112612.mail.gq1.yahoo.com> Thanks ________________________________ From: Jayson Vantuyl To: Pablo Platt ; Erlang-Questions Questions Sent: Fri, January 29, 2010 12:36:36 AM Subject: Re: [erlang-questions] gen_server with a dict vs mnesia table vs ets Use ETS, managed by a gen_server. The gen_server will serialize all operations, so there will be no concurrency against the ETS table. If you need to scale this further, you might have one table and gen_server per message type, or even more split up by a hash on the user_id. When splitting, if your need for an atomic update is global across processes, you can either collect them as batches in another process or use a gen_fsm to temporarily lock them all, then flush them, then unlock them. While ETS does cause some extra copying, for what it is good at it can be blazingly fast. Just test it, as variations between systems make it nearly impossible to say which is better without actual testing. eprof and fprof are your friends. Or you could just use Mnesia, as you can use its transactions to get your atomicity. On Jan 28, 2010, at 1:22 PM, Pablo Platt wrote: > @Robert > > My use case is simple: > - a list of key/value records ({user_id, msg_type}, msg_body) > - several processes needs to create/update records. > - one process needs to get all the records and clear the list in an 'atomic' operation once per 1 minute. > - number of records per minutes expected to be <1K at start. > - No need for replication/distribution. The list will be only in memory. > > > > ________________________________ > From: Robert Virding > To: Pablo Platt > Cc: Max Lapshin ; erlang-questions@REDACTED > Sent: Thu, January 28, 2010 5:44:13 PM > Subject: Re: [erlang-questions] gen_server with a dict vs mnesia table vs ets > > It really depends very much on your app which is better: > > - An ETS table will generally allow you to hold more data. > - An ETS table is external to processes so there is no cost in process GC. > - BUT there is still an ETS data GC cost every time you add or remove data. > - Since ETS data not in process there are copying costs every time you > access table. This can make some operations very expensive, but > match_object and select_object can help alot. > - A dict allows easy roll back to previous state if you keep old reference. > - ETS and dicts provide slightly different interfaces. > > You could use a public ETS table, but this would not allow for more > complex atomic transactions and is not accessible over distribution. > > It really does depend on what you are doing. The best is to test it > with realistic data amounts and operations. As an alternative to dicts > there are gb_trees which are also in the process memory but have > different properties compared to dicts. > > Robert > > 2010/1/28 Pablo Platt : >> So I'll use a gen_server that controls the ETS table with private access. >> Thanks >> >> >> >> >> ________________________________ >> From: Max Lapshin >> To: Pablo Platt >> Cc: erlang-questions@REDACTED >> Sent: Thu, January 28, 2010 3:29:48 PM >> Subject: Re: [erlang-questions] gen_server with a dict vs mnesia table vs ets >> >> On Thu, Jan 28, 2010 at 4:28 PM, Pablo Platt wrote: >>> The fact that ETS doesn't take part in garbage collection is a good or bad >>> feature in my case? >> >> Good, of course: you can control by yourself, when to clean objects, >> so there will be no GC-penalty on each loop >> >> ________________________________________________________________ >> 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 twoggle@REDACTED Thu Jan 28 23:55:25 2010 From: twoggle@REDACTED (Tim Fletcher) Date: Thu, 28 Jan 2010 14:55:25 -0800 (PST) Subject: sending a json body with http:request In-Reply-To: <966030.96419.qm@web112607.mail.gq1.yahoo.com> References: <966030.96419.qm@web112607.mail.gq1.yahoo.com> Message-ID: > mochijson2:encode/1 returns binary so do I need to use binary_to_list on it? I think mochijson2:encode/1 returns an iolist, not a binary. You can use the iolist_to_binary function to convert to binary. > Do I need to url encode the Params? If you're sending content as "application/x-www-form-urlencoded", then it should be encoded appropriately: http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1 Note that this is different to the URI encoding defined in RFC 3986. > Is there a url encoding function in erlang other then edoc_lib:escape_uri/1? AFAIK, no. That doesn't appear to encode as application/x-www-form- urlencoded though. I put together a comparison of several different encoding implementations here: http://github.com/tim/erlang-percent-encoding Is there a reason the server expects a mixture of JSON *and* form urlencoded params? Surely it would be easier to just send a JSON encoded body... Tim From bob@REDACTED Fri Jan 29 01:32:41 2010 From: bob@REDACTED (Bob Ippolito) Date: Thu, 28 Jan 2010 16:32:41 -0800 Subject: [erlang-questions] URL normalization module In-Reply-To: <18a1db031001281419p36456911t899d96183fd30bd4@mail.gmail.com> References: <18a1db031001281419p36456911t899d96183fd30bd4@mail.gmail.com> Message-ID: <6a36e7291001281632r77d5dae9nebed75ca0b36f4a@mail.gmail.com> Not that I'm aware of, but writing one should be pretty trivial. You can use urlsplit and urlunsplit from mochiweb_util to do most of the work. On Thu, Jan 28, 2010 at 2:19 PM, zabrane Mikael wrote: > Hi, > > Is there a free to use URL normalization module which respect the following > process: > http://en.wikipedia.org/wiki/URL_normalization > > Thanks > Zabrane > From pablo.platt@REDACTED Fri Jan 29 00:56:25 2010 From: pablo.platt@REDACTED (Pablo Platt) Date: Thu, 28 Jan 2010 15:56:25 -0800 (PST) Subject: [erlang-questions] Re: sending a json body with http:request In-Reply-To: References: <966030.96419.qm@web112607.mail.gq1.yahoo.com> Message-ID: <872382.78291.qm@web112616.mail.gq1.yahoo.com> I've tried: binary_to_list(iolist_to_binary(mochijson2:encode(Data))) It works but there is probably a better way. You are right about mixing form encoding and json. ________________________________ From: Tim Fletcher To: erlang-questions@REDACTED Sent: Fri, January 29, 2010 12:55:25 AM Subject: [erlang-questions] Re: sending a json body with http:request > mochijson2:encode/1 returns binary so do I need to use binary_to_list on it? I think mochijson2:encode/1 returns an iolist, not a binary. You can use the iolist_to_binary function to convert to binary. > Do I need to url encode the Params? If you're sending content as "application/x-www-form-urlencoded", then it should be encoded appropriately: http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1 Note that this is different to the URI encoding defined in RFC 3986. > Is there a url encoding function in erlang other then edoc_lib:escape_uri/1? AFAIK, no. That doesn't appear to encode as application/x-www-form- urlencoded though. I put together a comparison of several different encoding implementations here: http://github.com/tim/erlang-percent-encoding Is there a reason the server expects a mixture of JSON *and* form urlencoded params? Surely it would be easier to just send a JSON encoded body... Tim ________________________________________________________________ erlang-questions mailing list. See http://www.erlang.org/faq.html erlang-questions (at) erlang.org From senthilkumar.peelikkampatti@REDACTED Fri Jan 29 03:19:56 2010 From: senthilkumar.peelikkampatti@REDACTED (Senthilkumar Peelikkampatti) Date: Thu, 28 Jan 2010 20:19:56 -0600 Subject: [erlang-questions] [ANN] Zotonic now supports WebSockets In-Reply-To: References: Message-ID: <45d8e23d1001281819l385d9a36yf311f2fdfa0a4dbd@mail.gmail.com> Very nice to hear, good work you guys. Keep it up. Any plan to support Riak or Couchdb? On Mon, Jan 25, 2010 at 9:06 AM, Marc Worrell wrote: > Hello, > > We just added WebSockets support to the Zotonic CMS/framework. > It is used as an alternative transport layer to Comet and is fully integrated. > > The system automatically chooses between using Comet or WebSockets for the server push support. > Server push support is enabled using the {% stream %} tag in the page template. > > The browser sends urlencoded forms to the server and the server sends javascript to the browser. > This enables a very flexible way of communication with minimal programming on the browser side. > > WebSockets support will be part of the upcoming 0.3 release. > > Regards, > > Marc Worrell > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > -- Regards, Senthilkumar Peelikkampatti, http://pmsenthilkumar.blogspot.com/ From corticalcomputer@REDACTED Fri Jan 29 03:51:19 2010 From: corticalcomputer@REDACTED (G.S.) Date: Thu, 28 Jan 2010 18:51:19 -0800 Subject: Graphics, and 2d display. Message-ID: <2a67d3ff1001281851n7f6d5611t3cb934549014f1e3@mail.gmail.com> Hi, Is there anyway to display something like moving 2d ASCII art... I'm trying to simulate server/client systems and show connections and movements of data in ASCII... so Clients are Os and Servers are X, and I would like to show a plane with Xs and Os, and lines going from one to another to demonstrate data-flow, but this has to be updatable live, on a fixed screen, so that when another Server or Client goes live, it is right away demonstrated graphically on this plane. something like the top command, only instead of the columns of data, I would show the Xs and Os and data flow between them... If that makes any sense. Regards, -Gene From jeffm@REDACTED Fri Jan 29 05:03:00 2010 From: jeffm@REDACTED (jm) Date: Fri, 29 Jan 2010 15:03:00 +1100 Subject: [erlang-questions] Graphics, and 2d display. In-Reply-To: <2a67d3ff1001281851n7f6d5611t3cb934549014f1e3@mail.gmail.com> References: <2a67d3ff1001281851n7f6d5611t3cb934549014f1e3@mail.gmail.com> Message-ID: <4B625DF4.3030500@ghostgun.com> Sounds like your looking for a curses library. The most common C one that comes to mind is ncurses. I don't know of one for Erlang. Possible take a look at http://www.erlang.org/user.html#gdc-1.0 but it dates from 1999 so things may be different now. Jeff. On 29/01/10 1:51 PM, G.S. wrote: > Hi, > > Is there anyway to display something like moving 2d ASCII art... I'm trying > to simulate server/client systems and show connections and movements of data > in ASCII... so Clients are Os and Servers are X, and I would like to show a > plane with Xs and Os, and lines going from one to another to demonstrate > data-flow, but this has to be updatable live, on a fixed screen, so that > when another Server or Client goes live, it is right away demonstrated > graphically on this plane. something like the top command, only instead of > the columns of data, I would show the Xs and Os and data flow between > them... If that makes any sense. > > Regards, > -Gene > > From Jim@REDACTED Fri Jan 29 07:48:35 2010 From: Jim@REDACTED (Jim Tittsler) Date: Fri, 29 Jan 2010 19:48:35 +1300 Subject: MediaWiki API client library for Erlang? Message-ID: <4B6284C3.1070203@OnNZ.net> Is there a client library for the MediaWiki API[1] in Erlang? Jim [1] http://www.mediawiki.org/wiki/API -- Jim Tittsler Open Education Resource Foundation From twoggle@REDACTED Fri Jan 29 09:56:55 2010 From: twoggle@REDACTED (Tim Fletcher) Date: Fri, 29 Jan 2010 00:56:55 -0800 (PST) Subject: sending a json body with http:request In-Reply-To: <872382.78291.qm@web112616.mail.gq1.yahoo.com> References: <966030.96419.qm@web112607.mail.gq1.yahoo.com> <872382.78291.qm@web112616.mail.gq1.yahoo.com> Message-ID: > I've tried: > binary_to_list(iolist_to_binary(mochijson2:encode(Data))) > > It works but there is probably a better way. The http request body can be a string or a binary, so no need to call binary_to_list. From clist@REDACTED Fri Jan 29 11:26:33 2010 From: clist@REDACTED (Angel) Date: Fri, 29 Jan 2010 11:26:33 +0100 Subject: [erlang-questions] Graphics, and 2d display. In-Reply-To: <2a67d3ff1001281851n7f6d5611t3cb934549014f1e3@mail.gmail.com> References: <2a67d3ff1001281851n7f6d5611t3cb934549014f1e3@mail.gmail.com> Message-ID: <201001291126.33847.clist@uah.es> On Viernes, 29 de Enero de 2010 03:51:19 G.S. escribi?: > Hi, > > Is there anyway to display something like moving 2d ASCII art... I'm trying > to simulate server/client systems and show connections and movements of > data in ASCII... so Clients are Os and Servers are X, and I would like to > show a plane with Xs and Os, and lines going from one to another to > demonstrate data-flow, but this has to be updatable live, on a fixed > screen, so that when another Server or Client goes live, it is right away > demonstrated graphically on this plane. something like the top command, > only instead of the columns of data, I would show the Xs and Os and data > flow between them... If that makes any sense. > > Regards, > -Gene > I would search a port curses approach. Just a few routines to receive data from erlang (the whole list of objects or maybe update) and display them. Curses will care of screen repainting and effcient updates. If you want to prototype fast there is a ascii art screensaver made in Perl you can try control it from erlang... asciiaquarium: http://www.robobunny.com/projects/asciiquarium/html/ well your are not constrained to 2D :-) http://www.algorithm.co.il/blogs/index.php/programming/python/python-curses- numpy-ascii-art-rotating-cube YMMV.. /angel -- Most people know C is not so high level.... ...Everybody else just got assembler overdose From tuncer.ayaz@REDACTED Fri Jan 29 12:45:53 2010 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Fri, 29 Jan 2010 12:45:53 +0100 Subject: [erlang-questions] URL normalization module In-Reply-To: <6a36e7291001281632r77d5dae9nebed75ca0b36f4a@mail.gmail.com> References: <18a1db031001281419p36456911t899d96183fd30bd4@mail.gmail.com> <6a36e7291001281632r77d5dae9nebed75ca0b36f4a@mail.gmail.com> Message-ID: <4ac8254d1001290345t5764997anfe8109f0ad0abe1@mail.gmail.com> On Fri, Jan 29, 2010 at 1:32 AM, Bob Ippolito wrote: > Not that I'm aware of, but writing one should be pretty > trivial. > You can use urlsplit and urlunsplit from mochiweb_util > to do most of the work. for splitting you can also use http_uri:parse/1 from inets' http_client. > On Thu, Jan 28, 2010 at 2:19 PM, zabrane Mikael wrote: >> Hi, >> >> Is there a free to use URL normalization module which >> respect the following process: >> http://en.wikipedia.org/wiki/URL_normalization From clist@REDACTED Fri Jan 29 13:18:15 2010 From: clist@REDACTED (Angel) Date: Fri, 29 Jan 2010 13:18:15 +0100 Subject: [erlang-questions] Graphics, and 2d display. In-Reply-To: <4B62BF21.80205@eonblast.com> References: <2a67d3ff1001281851n7f6d5611t3cb934549014f1e3@mail.gmail.com> <201001291126.33847.clist@uah.es> <4B62BF21.80205@eonblast.com> Message-ID: <201001291318.15480.clist@uah.es> hehe obviously for a more serious work i would recommend you Curses Development Kit: http://www.vexus.ca/products/CDK/ seems better than crude curses... But youll not find happy living whales anymore... :-( Regards, Angel On Viernes, 29 de Enero de 2010 11:57:37 usted escribi?: > :-D > > Angel wrote: > > On Viernes, 29 de Enero de 2010 03:51:19 G.S. escribi?: > >> Hi, > >> > >> Is there anyway to display something like moving 2d ASCII art... I'm > >> trying to simulate server/client systems and show connections and > >> movements of data in ASCII... so Clients are Os and Servers are X, and I > >> would like to show a plane with Xs and Os, and lines going from one to > >> another to demonstrate data-flow, but this has to be updatable live, on > >> a fixed screen, so that when another Server or Client goes live, it is > >> right away demonstrated graphically on this plane. something like the > >> top command, only instead of the columns of data, I would show the Xs > >> and Os and data flow between them... If that makes any sense. > >> > >> Regards, > >> -Gene > > > > I would search a port curses approach. Just a few routines to receive > > data from erlang (the whole list of objects or maybe update) and display > > them. Curses will care of screen repainting and effcient updates. > > > > If you want to prototype fast there is a ascii art screensaver made in > > Perl you can try control it from erlang... > > > > asciiaquarium: http://www.robobunny.com/projects/asciiquarium/html/ > > > > well your are not constrained to 2D :-) > > > > http://www.algorithm.co.il/blogs/index.php/programming/python/python-curs > >es- numpy-ascii-art-rotating-cube > > > > > > YMMV.. > > > > /angel > -- Most people know C is not so high level.... ...Everybody else just got assembler overdose From erlang@REDACTED Fri Jan 29 13:23:58 2010 From: erlang@REDACTED (Stefan Marr) Date: Fri, 29 Jan 2010 13:23:58 +0100 Subject: How to compiler Erlang for the TILEPro64? Message-ID: <0CC413D7-081D-472C-A22C-71B00D4C2C8D@stefan-marr.de> Hi: I have tried to compile Erlang (otp_src_R13B03) for the TILEPro64. I was starting from the following bits of information: http://www.erlang.org/cgi-bin/ezmlm-cgi/4/44766 http://www.trapexit.org/Cross_compiling When I tried to execute: ./otp_build env_cross $ERL_TOP/xcomp/erl-xcomp-TileraMDE2.0-tilepro.conf I got an error asking me to do a "eval `./otp_build env_cross $ERL_TOP/xcomp/erl-xcomp-TileraMDE2.0-tilepro.conf`" instead, but this command didn't generate any output. The wiki article on the other hand, asks me to choose a target "TARGET=mips-linux" and I am not sure where to find out the right target. Would be great, if someone could point me at some documentation, or could give me advice on how to compile Erlang for the Tilera card. Many thanks and best regards Stefan -- Stefan Marr Software Languages Lab Vrije Universiteit Brussel Pleinlaan 2 / B-1050 Brussels / Belgium http://soft.vub.ac.be/~smarr Phone: +32 2 629 3956 Fax: +32 2 629 3525 From clist@REDACTED Fri Jan 29 13:37:40 2010 From: clist@REDACTED (Angel) Date: Fri, 29 Jan 2010 13:37:40 +0100 Subject: [erlang-questions] How to compiler Erlang for the TILEPro64? In-Reply-To: <0CC413D7-081D-472C-A22C-71B00D4C2C8D@stefan-marr.de> References: <0CC413D7-081D-472C-A22C-71B00D4C2C8D@stefan-marr.de> Message-ID: <201001291337.40692.clist@uah.es> Plese tell me How easy is to adquire some of these? afordable prices (for individuals)??? /Angel On Viernes, 29 de Enero de 2010 13:23:58 Stefan Marr escribi?: > Hi: > > I have tried to compile Erlang (otp_src_R13B03) for the TILEPro64. > > I was starting from the following bits of information: > http://www.erlang.org/cgi-bin/ezmlm-cgi/4/44766 > http://www.trapexit.org/Cross_compiling > > > When I tried to execute: ./otp_build env_cross > $ERL_TOP/xcomp/erl-xcomp-TileraMDE2.0-tilepro.conf > > I got an error asking me to do a > "eval `./otp_build env_cross > $ERL_TOP/xcomp/erl-xcomp-TileraMDE2.0-tilepro.conf`" instead, but this > command didn't generate any output. > > The wiki article on the other hand, asks me to choose a target > "TARGET=mips-linux" and I am not sure where to find out the right target. > > Would be great, if someone could point me at some documentation, or could > give me advice on how to compile Erlang for the Tilera card. > > Many thanks and best regards > Stefan > -- Most people know C is not so high level.... ...Everybody else just got assembler overdose From zabrane3@REDACTED Fri Jan 29 14:29:22 2010 From: zabrane3@REDACTED (zabrane Mikael) Date: Fri, 29 Jan 2010 14:29:22 +0100 Subject: [erlang-questions] URL normalization module In-Reply-To: <4ac8254d1001290345t5764997anfe8109f0ad0abe1@mail.gmail.com> References: <18a1db031001281419p36456911t899d96183fd30bd4@mail.gmail.com> <6a36e7291001281632r77d5dae9nebed75ca0b36f4a@mail.gmail.com> <4ac8254d1001290345t5764997anfe8109f0ad0abe1@mail.gmail.com> Message-ID: <18a1db031001290529l26a05cc4x84ada58f1a96b03d@mail.gmail.com> Thanks guys !!! 2010/1/29 Tuncer Ayaz > On Fri, Jan 29, 2010 at 1:32 AM, Bob Ippolito wrote: > > Not that I'm aware of, but writing one should be pretty > > trivial. > > You can use urlsplit and urlunsplit from mochiweb_util > > to do most of the work. > > for splitting you can also use http_uri:parse/1 > from inets' http_client. > > > On Thu, Jan 28, 2010 at 2:19 PM, zabrane Mikael wrote: > >> Hi, > >> > >> Is there a free to use URL normalization module which > >> respect the following process: > >> http://en.wikipedia.org/wiki/URL_normalization > From egil@REDACTED Fri Jan 29 15:45:29 2010 From: egil@REDACTED (=?ISO-8859-1?Q?Bj=F6rn-Egil_Dahlberg?=) Date: Fri, 29 Jan 2010 15:45:29 +0100 Subject: [erlang-questions] How to compiler Erlang for the TILEPro64? In-Reply-To: <0CC413D7-081D-472C-A22C-71B00D4C2C8D@stefan-marr.de> References: <0CC413D7-081D-472C-A22C-71B00D4C2C8D@stefan-marr.de> Message-ID: <4B62F489.2080605@erix.ericsson.se> Hi Stefan, To compile Erlang for Tilera you can do the following, 1) Setup the Tilera Environment. For example for me it is: export TILERA_ROOT=/ldisk/tilera/TileraMDE-2.0.1.78377/tilepro export PATH=$TILERA_ROOT/bin:$PATH This is the cross compile environment supplied to you by Tilera Corp. 2) Setup The Erlang Build Environment: tar -zxvf otp_src_R13B03.tar.gz cd otp_src_R13B03 export ERL_TOP=`pwd` eval `./otp_build env_cross $ERL_TOP/xcomp/erl-xcomp-TileraMDE2.0-tilepro.conf` Crypto (and its dependencies) will not work so you need to SKIP those. 3) Build Erlang/OTP touch lib/crypto/SKIP touch lib/ssl/SKIP touch lib/ssh/SKIP ./otp_build configure ./otp_build boot -a ./otp_build release -a 4) Start Erlang, cd ./Install `pwd` tile-monitor --pci --here -- bin/erl Of course you would probably want to upload everything to the card, just like other applications you need to upload. Contact Tilera Corp. for optimal settings and hardware configuration. This should work on R13B03. However, from R13B04 this way will change and it will be better support cross compilation. Regards, Bj?rn-Egil Erlang/OTP Stefan Marr wrote: > Hi: > > I have tried to compile Erlang (otp_src_R13B03) for the TILEPro64. > > I was starting from the following bits of information: > http://www.erlang.org/cgi-bin/ezmlm-cgi/4/44766 > http://www.trapexit.org/Cross_compiling > > > When I tried to execute: ./otp_build env_cross $ERL_TOP/xcomp/erl-xcomp-TileraMDE2.0-tilepro.conf > > I got an error asking me to do a > "eval `./otp_build env_cross $ERL_TOP/xcomp/erl-xcomp-TileraMDE2.0-tilepro.conf`" instead, but this command didn't generate any output. > > The wiki article on the other hand, asks me to choose a target "TARGET=mips-linux" and I am not sure where to find out the right target. > > Would be great, if someone could point me at some documentation, or could give me advice on how to compile Erlang for the Tilera card. > > Many thanks and best regards > Stefan > > From kostis@REDACTED Fri Jan 29 16:48:46 2010 From: kostis@REDACTED (Kostis Sagonas) Date: Fri, 29 Jan 2010 17:48:46 +0200 Subject: [ANN] tidier website Message-ID: <4B63035E.3000102@cs.ntua.gr> We are very happy to announce the website of Tidier, an automatic refactoring tool for Erlang programs. Tidier cleans up Erlang source code and suggests to its user a sequence of transformations that improve the quality and performance of code. More information about tidier can be found at its website (*): http://tidier.softlab.ntua.gr/ We welcome feedback and suggestions! Kostis Sagonas and Thanassis Avgerinos (*) The website is using Erlang tools (ErlyWeb/Yaws). In principle it should be robust under heavy load, but it has never been tested in such conditions. From erlang@REDACTED Fri Jan 29 16:57:02 2010 From: erlang@REDACTED (Stefan Marr) Date: Fri, 29 Jan 2010 16:57:02 +0100 Subject: [erlang-questions] How to compiler Erlang for the TILEPro64? In-Reply-To: <4B62F489.2080605@erix.ericsson.se> References: <0CC413D7-081D-472C-A22C-71B00D4C2C8D@stefan-marr.de> <4B62F489.2080605@erix.ericsson.se> Message-ID: <656C7C6E-9244-4DE7-97F3-2B9CDD58C8F6@stefan-marr.de> Hi Bj?rn-Egil: Thanks a lot, worked great! Here some notes, about things I had "trouble" with. The SKIP files seem to be deleted by the configure step, thus I had to recreate them afterwards. Otherwise I get linker errors, since the tile-gcc tried to link some IA32 files. Think it was complaining about crypto.a or something similar. For the release step, I also had to do a "touch lib/mnesia/SKIP" for some reason, I haven't investigated further. It is also good to know, that has to be an absolute path :) Afterwards, you can have a very happy helloworld with tile-monitor --pci --here -- bin/erl -noshell -s hello_world start -s init stop I have not yet looked anywhere into the actual support provided for the Tilera chips, but is there something like printing the core id the process is running on? Are there any parameters to erl to specify how many hardware cores to use? And, are there some benchmarks or examples which are using the tiles explicitly? Thanks Stefan On 29 Jan 2010, at 15:45, Bj?rn-Egil Dahlberg wrote: > Hi Stefan, > > To compile Erlang for Tilera you can do the following, > > 1) Setup the Tilera Environment. > For example for me it is: > > export TILERA_ROOT=/ldisk/tilera/TileraMDE-2.0.1.78377/tilepro > export PATH=$TILERA_ROOT/bin:$PATH > > This is the cross compile environment supplied to you by Tilera Corp. > > 2) Setup The Erlang Build Environment: > > tar -zxvf otp_src_R13B03.tar.gz > cd otp_src_R13B03 > export ERL_TOP=`pwd` > eval `./otp_build env_cross > $ERL_TOP/xcomp/erl-xcomp-TileraMDE2.0-tilepro.conf` > > Crypto (and its dependencies) will not work so you need to SKIP those. > > 3) Build Erlang/OTP > touch lib/crypto/SKIP > touch lib/ssl/SKIP > touch lib/ssh/SKIP > ./otp_build configure > ./otp_build boot -a > ./otp_build release -a > > 4) Start Erlang, > > cd > ./Install `pwd` > tile-monitor --pci --here -- bin/erl > > Of course you would probably want to upload everything to the card, just > like other applications you need to upload. > > Contact Tilera Corp. for optimal settings and hardware configuration. > > This should work on R13B03. However, from R13B04 this way will change > and it will be better support cross compilation. > > Regards, > Bj?rn-Egil > Erlang/OTP > > > Stefan Marr wrote: >> Hi: >> >> I have tried to compile Erlang (otp_src_R13B03) for the TILEPro64. >> >> I was starting from the following bits of information: >> http://www.erlang.org/cgi-bin/ezmlm-cgi/4/44766 >> http://www.trapexit.org/Cross_compiling >> >> >> When I tried to execute: ./otp_build env_cross $ERL_TOP/xcomp/erl-xcomp-TileraMDE2.0-tilepro.conf >> >> I got an error asking me to do a >> "eval `./otp_build env_cross $ERL_TOP/xcomp/erl-xcomp-TileraMDE2.0-tilepro.conf`" instead, but this command didn't generate any output. >> >> The wiki article on the other hand, asks me to choose a target "TARGET=mips-linux" and I am not sure where to find out the right target. >> >> Would be great, if someone could point me at some documentation, or could give me advice on how to compile Erlang for the Tilera card. >> >> Many thanks and best regards >> Stefan >> >> > -- Stefan Marr Software Languages Lab Vrije Universiteit Brussel Pleinlaan 2 / B-1050 Brussels / Belgium http://soft.vub.ac.be/~smarr Phone: +32 2 629 3956 Fax: +32 2 629 3525 From mickael.remond@REDACTED Fri Jan 29 16:59:53 2010 From: mickael.remond@REDACTED (=?iso-8859-1?Q?Micka=EBl_R=E9mond?=) Date: Fri, 29 Jan 2010 16:59:53 +0100 Subject: [erlang-questions] [ANN] tidier website In-Reply-To: <4B63035E.3000102@cs.ntua.gr> References: <4B63035E.3000102@cs.ntua.gr> Message-ID: <5A89B121-3FC6-4AD6-972D-AD7CA139E4C3@process-one.net> Very good news. Congratulations, Kostis ! Le 29 janv. 2010 ? 16:48, Kostis Sagonas a ?crit : > We are very happy to announce the website of Tidier, an automatic refactoring tool for Erlang programs. > > Tidier cleans up Erlang source code and suggests to its user a sequence of transformations that improve the quality and performance of code. > > More information about tidier can be found at its website (*): > > http://tidier.softlab.ntua.gr/ > > We welcome feedback and suggestions! > > Kostis Sagonas and Thanassis Avgerinos > > > (*) The website is using Erlang tools (ErlyWeb/Yaws). In principle it > should be robust under heavy load, but it has never been tested in > such conditions. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > From g@REDACTED Fri Jan 29 17:24:10 2010 From: g@REDACTED (Garrett Smith) Date: Fri, 29 Jan 2010 10:24:10 -0600 Subject: [erlang-questions] gen_server with a dict vs mnesia table vs ets In-Reply-To: References: <479945.36656.qm@web112606.mail.gq1.yahoo.com> <438177.22287.qm@web112606.mail.gq1.yahoo.com> <178315.40375.qm@web112611.mail.gq1.yahoo.com> <635371.73235.qm@web112619.mail.gq1.yahoo.com> <3dbc6d1c1001280744t2b846193p156d8e40525cb7fe@mail.gmail.com> <316958.35358.qm@web112610.mail.gq1.yahoo.com> Message-ID: I suspect this is a pretty common set of requirements -- I have something similar for an app. I currently use a dict in gen_server state. I was curious about the actual performance of the non-mnesia scenarios (dict, gb_trees, and private ets) so ran some tests. The module is below. The timings are from timer:tc. The standout result for me is that dict insert performance starts to trail off non-linearly and gets obviously "costly" somewhere between 100K and 1M values. Of course this is totally non-scientific and I'll attempt no explanation for this :) My personal preference is to use gen_server state for this type of requirement if I can get away with it. It looks like for smallish record sets (<100K) dict is perfectly fine, assuming your latency requirements aren't measured in microseconds. gb_trees appears to scale better than dict and allows you to "keep things simple" by using gen_server state. So, perhaps it's suitable for record sets in the millions, though not sure if there's a performance tipping point with gb_trees as there appears to be with dict. ETS looks like it would be the struct of choice for larger record sets -- millions and beyond. But to heartily reiterate what others have said in this thread, the best approach to resolve this issue is to measure per application. There are too many variables involved to apply generalized performance characteristics to any given problem. I.e. the numbers below are merely curiosities, IMO. Garrett {{{ -module(test_dict). -export([go_dict/1, go_ets/1, go_gbtree/1]). %% %% Timings (microseconds): %% %% go_dict(100) : 450 %% go_dict(1000) : 5000 %% go_dict(10000) : 120000 %% go_dict(100000) : 2100000 %% go_dict(1000000) : 176000000 go_dict(N) -> go_dict(dict:new(), N). go_dict(D, 0) -> D; go_dict(D, N) -> Key = lists:concat(["key-", N]), Val = {state, 12345, "this is a string", [1,2,3,4], 45.6789, atom1, atom2}, go_dict(dict:store(Key, Val, D), N-1). %% %% Timings (microseconds): %% %% go_ets(100) : 240 %% go_ets(1000) : 2400 %% go_ets(10000) : 35000 %% go_ets(100000) : 460000 %% go_ets(1000000) : 6000000 go_ets(N) -> go_ets(ets:new(ets_test, [private]), N). go_ets(Ets, 0) -> Ets; go_ets(Ets, N) -> Key = lists:concat(["key-", N]), Val = {state, 12345, "this is a string", [1,2,3,4], 45.6789, atom1, atom2}, ets:insert(Ets, {Key, Val}), go_ets(Ets, N - 1). %% %% Timings (microseconds): %% %% go_gbtree(100) : 450 %% go_gbtree(1000) : 7000 %% go_gbtree(10000) : 140000 %% go_gbtree(100000) : 2000000 %% go_gbtree(1000000) : 25000000 go_gbtree(N) -> go_gbtree(gb_trees:empty(), N). go_gbtree(Tree, 0) -> Tree; go_gbtree(Tree, N) -> Key = lists:concat(["key-", N]), Val = {state, 12345, "this is a string", [1,2,3,4], 45.6789, atom1, atom2}, go_gbtree(gb_trees:insert(Key, Val, Tree), N - 1). }}} On Thu, Jan 28, 2010 at 4:36 PM, Jayson Vantuyl wrote: > Use ETS, managed by a gen_server. ?The gen_server will serialize all operations, so there will be no concurrency against the ETS table. > > If you need to scale this further, you might have one table and gen_server per message type, or even more split up by a hash on the user_id. ?When splitting, if your need for an atomic update is global across processes, you can either collect them as batches in another process or use a gen_fsm to temporarily lock them all, then flush them, then unlock them. > > While ETS does cause some extra copying, for what it is good at it can be blazingly fast. ?Just test it, as variations between systems make it nearly impossible to say which is better without actual testing. ?eprof and fprof are your friends. > > Or you could just use Mnesia, as you can use its transactions to get your atomicity. > > On Jan 28, 2010, at 1:22 PM, Pablo Platt wrote: > >> @Robert >> >> My use case is simple: >> - a list of key/value records ({user_id, msg_type}, msg_body) >> - several processes needs to create/update records. >> - one process needs to get all the records and clear the list in an 'atomic' operation once per 1 minute. >> - number of records per minutes expected to be <1K at start. >> - No need for replication/distribution. The list will be only in memory. >> >> >> >> ________________________________ >> From: Robert Virding >> To: Pablo Platt >> Cc: Max Lapshin ; erlang-questions@REDACTED >> Sent: Thu, January 28, 2010 5:44:13 PM >> Subject: Re: [erlang-questions] gen_server with a dict vs mnesia table vs ets >> >> It really depends very much on your app which is better: >> >> - An ETS table will generally allow you to hold more data. >> - An ETS table is external to processes so there is no cost in process GC. >> - BUT there is still an ETS data GC cost every time you add or remove data. >> - Since ETS data not in process there are copying costs every time you >> access table. This can make some operations very expensive, but >> match_object and select_object can help alot. >> - A dict allows easy roll back to previous state if you keep old reference. >> - ETS and dicts provide slightly different interfaces. >> >> You could use a public ETS table, but this would not allow for more >> complex atomic transactions and is not accessible over distribution. >> >> It really does depend on what you are doing. The best is to test it >> with realistic data amounts and operations. As an alternative to dicts >> there are gb_trees which are also in the process memory but have >> different properties compared to dicts. >> >> Robert >> >> 2010/1/28 Pablo Platt : >>> So I'll use a gen_server that controls the ETS table with private access. >>> Thanks >>> >>> >>> >>> >>> ________________________________ >>> From: Max Lapshin >>> To: Pablo Platt >>> Cc: erlang-questions@REDACTED >>> Sent: Thu, January 28, 2010 3:29:48 PM >>> Subject: Re: [erlang-questions] gen_server with a dict vs mnesia table vs ets >>> >>> On Thu, Jan 28, 2010 at 4:28 PM, Pablo Platt wrote: >>>> The fact that ETS doesn't take part in garbage collection is a good or bad >>>> feature in my case? >>> >>> Good, of course: you can control by yourself, when to clean objects, >>> so there will be no GC-penalty on each loop >>> >>> ________________________________________________________________ >>> 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 zvi.avraham@REDACTED Fri Jan 29 17:27:20 2010 From: zvi.avraham@REDACTED (ZZZZZZZZZZZZZZZZ) Date: Fri, 29 Jan 2010 08:27:20 -0800 (PST) Subject: Interfaces between distributed OTP applications In-Reply-To: <8fc32993-3915-43eb-a4e4-d1d17b9aeea5@c29g2000yqd.googlegroups.com> References: <8fc32993-3915-43eb-a4e4-d1d17b9aeea5@c29g2000yqd.googlegroups.com> Message-ID: <863bad11-7ee9-4aac-a1c6-c175a5538b10@m25g2000yqc.googlegroups.com> I hate to repost, but maybe somebody can answer? thanks in advance Zvi On Jan 26, 10:36?am, ZZZZZZZZZZZZZZZZ wrote: > Hi, > > the OTP Design Principles states, that OTP Applications are set of > loosely-coupled components, while modules inside single application > are tightly coupled. > Let's say I have two distributed OTP applications: ?"client" and > "server", both running on different Erlang nodes/hosts. > Let's say "server" application uses gen_server, which exposes public > function API. > The "client" applications calling functions in public API of > gen_server in "server" application. > What's the proper way to express this in OTP? > > 1. For simplicity, just add dependency on "server" application in > "client" application's .app file. Start both on "server" node. > > 2. Don't use public API functions in "server". Send messages directly > to "server" using gen_server:call / cast. > > 3. Add third application: "server_api" or "server_if" with single > module defining public API wrappers around gen_server messages > protocol. Then "client" application will be depended on "server_api" > application, and not the "server" itself. > > 4. Any other ideas? > > thanks in advance, > Zvi > > ________________________________________________________________ > erlang-questions mailing list. Seehttp://www.erlang.org/faq.html > erlang-questions (at) erlang.org From zvi.avraham@REDACTED Fri Jan 29 17:29:24 2010 From: zvi.avraham@REDACTED (ZZZZZZZZZZZZZZZZ) Date: Fri, 29 Jan 2010 08:29:24 -0800 (PST) Subject: Logging in distributed OTP applications In-Reply-To: <858e9a8c-7216-4a5f-bd04-ccecd5888653@l19g2000yqb.googlegroups.com> References: <858e9a8c-7216-4a5f-bd04-ccecd5888653@l19g2000yqb.googlegroups.com> Message-ID: no answer? On Jan 26, 10:35?am, ZZZZZZZZZZZZZZZZ wrote: > Hi, > > I have two OTP applications: "master" and "worker", > both depend on log4erl in their .app files. > SIngle "master" application and multiple "worker" applications running > on different hosts/Erlang nodes. > I was able to configure each one to write to it's own log file, but I > need all instances of OTP applications to write to single log file. > Can this be done with log4erl ? > Can standard Erlang logging be used here, i.e. SASL? > Any other logging packages / solutions? > > The simplest idea is two create globally registered logger gen_server > in the "master" application/node and let all others to use > gen_server:cast to send messages to log. But ?cast seems to be not > guaranteed, while gen_server:call will introduce delays in the > applications. > > Any ideas? > thanks in advance. > Zvi > > ________________________________________________________________ > erlang-questions mailing list. Seehttp://www.erlang.org/faq.html > erlang-questions (at) erlang.org From egil@REDACTED Fri Jan 29 17:49:59 2010 From: egil@REDACTED (=?ISO-8859-1?Q?Bj=F6rn-Egil_Dahlberg?=) Date: Fri, 29 Jan 2010 17:49:59 +0100 Subject: [erlang-questions] How to compiler Erlang for the TILEPro64? In-Reply-To: <656C7C6E-9244-4DE7-97F3-2B9CDD58C8F6@stefan-marr.de> References: <0CC413D7-081D-472C-A22C-71B00D4C2C8D@stefan-marr.de> <4B62F489.2080605@erix.ericsson.se> <656C7C6E-9244-4DE7-97F3-2B9CDD58C8F6@stefan-marr.de> Message-ID: <4B6311B7.8060403@erix.ericsson.se> Stefan Marr wrote: > Hi Bj?rn-Egil: > > Thanks a lot, worked great! Great to hear! =) > Here some notes, about things I had "trouble" with. > > The SKIP files seem to be deleted by the configure step, thus I had to recreate them afterwards. Otherwise I get linker errors, since the tile-gcc tried to link some IA32 files. Think it was complaining about crypto.a or something similar. Yes, this is unfortunate and a bug. The boostrap configure step is done after the tile-configuration and thus removes the skip-files in the setup step. This worked in R13B02-1, probably because of another bug in configure or otp_build. These bugs will not, per se, be corrected. The whole cross compile build step is redone to r13b04. > > For the release step, I also had to do a "touch lib/mnesia/SKIP" for some reason, I haven't investigated further. Ok, when testing it here it works. > > It is also good to know, that has to be an absolute path :) Right. I think this will also be addressed in r13b04. > Afterwards, you can have a very happy helloworld with > tile-monitor --pci --here -- bin/erl -noshell -s hello_world start -s init stop > I have not yet looked anywhere into the actual support provided for the Tilera chips, but is there something like printing the core id the process is running on? > Are there any parameters to erl to specify how many hardware cores to use? Yes. There are several settings you can specify. Firstly you can specify how many schedulers you want to use, this is done via +S switch. Secondly if you want to bind schedulers to tile cores you need to set a cpu topology which corresponds to the actual topology on your card (if it is not detected automatically). This can be done from erlang or on the command line using the +sct switch. Please read, http://www.erlang.org/doc/man/erlang.html#system_info_cpu_topology http://www.erlang.org/doc/man/erlang.html#system_flag_cpu_topology To bind schedulers use command line switch +sbt db for instance. Further reading, http://www.erlang.org/doc/man/erlang.html#system_flag_scheduler_bind_type Putting it all together. An example, ... upload-tile setup things ... $TILERA_ROOT/bin/tile-monitor --pci-resume \ --upload otp /tmp/otp \ --upload tests /tmp/tests \ --quit tile_erl="$TILERA_ROOT/bin/tile-monitor --pci-resume --tunnel 2023 23 \ --env HOME=/tmp \ --cd /tmp/tests \ --tiles - all ^0 - -- /tmp/otp/bin/erl" Using 58 schedulers ... $tile_erl +sct L10-18,1-9,19-55,57,58,61c1-55,57,58,61 +sbt db \ -noshell\ +S 58 \ -s run_test test1 \ -s init stop I cannot guarantee that this will work on your card though. But hopefully you can get some useful information from this. Regards, Bj?rn-Egil Erlang/OTP > > > On 29 Jan 2010, at 15:45, Bj?rn-Egil Dahlberg wrote: > >> Hi Stefan, >> >> To compile Erlang for Tilera you can do the following, >> >> 1) Setup the Tilera Environment. >> For example for me it is: >> >> export TILERA_ROOT=/ldisk/tilera/TileraMDE-2.0.1.78377/tilepro >> export PATH=$TILERA_ROOT/bin:$PATH >> >> This is the cross compile environment supplied to you by Tilera Corp. >> >> 2) Setup The Erlang Build Environment: >> >> tar -zxvf otp_src_R13B03.tar.gz >> cd otp_src_R13B03 >> export ERL_TOP=`pwd` >> eval `./otp_build env_cross >> $ERL_TOP/xcomp/erl-xcomp-TileraMDE2.0-tilepro.conf` >> >> Crypto (and its dependencies) will not work so you need to SKIP those. >> >> 3) Build Erlang/OTP >> touch lib/crypto/SKIP >> touch lib/ssl/SKIP >> touch lib/ssh/SKIP >> ./otp_build configure >> ./otp_build boot -a >> ./otp_build release -a >> >> 4) Start Erlang, >> >> cd >> ./Install `pwd` >> tile-monitor --pci --here -- bin/erl >> >> Of course you would probably want to upload everything to the card, just >> like other applications you need to upload. >> >> Contact Tilera Corp. for optimal settings and hardware configuration. >> >> This should work on R13B03. However, from R13B04 this way will change >> and it will be better support cross compilation. >> >> Regards, >> Bj?rn-Egil >> Erlang/OTP >> >> >> Stefan Marr wrote: >>> Hi: >>> >>> I have tried to compile Erlang (otp_src_R13B03) for the TILEPro64. >>> >>> I was starting from the following bits of information: >>> http://www.erlang.org/cgi-bin/ezmlm-cgi/4/44766 >>> http://www.trapexit.org/Cross_compiling >>> >>> >>> When I tried to execute: ./otp_build env_cross $ERL_TOP/xcomp/erl-xcomp-TileraMDE2.0-tilepro.conf >>> >>> I got an error asking me to do a >>> "eval `./otp_build env_cross $ERL_TOP/xcomp/erl-xcomp-TileraMDE2.0-tilepro.conf`" instead, but this command didn't generate any output. >>> >>> The wiki article on the other hand, asks me to choose a target "TARGET=mips-linux" and I am not sure where to find out the right target. >>> >>> Would be great, if someone could point me at some documentation, or could give me advice on how to compile Erlang for the Tilera card. >>> >>> Many thanks and best regards >>> Stefan >>> >>> > From g@REDACTED Fri Jan 29 17:57:13 2010 From: g@REDACTED (Garrett Smith) Date: Fri, 29 Jan 2010 10:57:13 -0600 Subject: [erlang-questions] Re: Interfaces between distributed OTP applications In-Reply-To: <863bad11-7ee9-4aac-a1c6-c175a5538b10@m25g2000yqc.googlegroups.com> References: <8fc32993-3915-43eb-a4e4-d1d17b9aeea5@c29g2000yqd.googlegroups.com> <863bad11-7ee9-4aac-a1c6-c175a5538b10@m25g2000yqc.googlegroups.com> Message-ID: On Fri, Jan 29, 2010 at 10:27 AM, ZZZZZZZZZZZZZZZZ wrote: > I hate to repost, but maybe somebody can answer? > thanks in advance FWIW, when I first saw your post, I casually interpreted your all-caps name as spam that got through the filter. You might want to tweak your mail client. > Zvi > > On Jan 26, 10:36?am, ZZZZZZZZZZZZZZZZ wrote: >> Hi, >> >> the OTP Design Principles states, that OTP Applications are set of >> loosely-coupled components, while modules inside single application >> are tightly coupled. >> Let's say I have two distributed OTP applications: ?"client" and >> "server", both running on different Erlang nodes/hosts. >> Let's say "server" application uses gen_server, which exposes public >> function API. >> The "client" applications calling functions in public API of >> gen_server in "server" application. >> What's the proper way to express this in OTP? >> >> 1. For simplicity, just add dependency on "server" application in >> "client" application's .app file. Start both on "server" node. Yes, though I'm not sure why the client would need to run on the server node. The server would typically be registered globally and then accessed from the client through a public API in the server module (or an application level module). >> 2. Don't use public API functions in "server". Send messages directly >> to "server" using gen_server:call / cast. No. Look over the API docs for other gen_server implementations in OTP -- there's always a public API that wraps the call/cast to the server. >> 3. Add third application: "server_api" or "server_if" with single >> module defining public API wrappers around gen_server messages >> protocol. Then "client" application will be depended on "server_api" >> application, and not the "server" itself. It's common to provide an application level module that provides all public APIs. E.g. look over the mnesia application. That said, you still want to provide an API per gen_server, even if it's only used within your app. >> 4. Any other ideas? For learning OTP principles, there's no substitute for reading and understanding the way existing OTP apps are implemented. I'd recommend spending some time looking over apps (source, .app file, directory structure, etc.) like inets and mnesia. I do this all the time to get ideas for structuring my Erlang code. Garrett From anders.nygren@REDACTED Fri Jan 29 18:29:39 2010 From: anders.nygren@REDACTED (Anders Nygren) Date: Fri, 29 Jan 2010 11:29:39 -0600 Subject: [erlang-questions] [ANN] tidier website In-Reply-To: <4B63035E.3000102@cs.ntua.gr> References: <4B63035E.3000102@cs.ntua.gr> Message-ID: 2010/1/29 Kostis Sagonas : > We are very happy to announce the website of Tidier, an automatic > refactoring tool for Erlang programs. > > Tidier cleans up Erlang source code and suggests to its user a sequence of > transformations that improve the quality and performance of code. > > More information about tidier can be found at its website (*): > > ? ?http://tidier.softlab.ntua.gr/ > > We welcome feedback and suggestions! > > Kostis Sagonas and Thanassis Avgerinos > This is great news, I have been waiting eagerly for tidier since I read about it the first time. A quick test have found two small issues. 1, If tider does not make any transformations it does not tell you that, it just brings You to the "here is your transformed file" page. So it took me some time to figure out if it was working or not. It would be nice with a message that says "no transformations performed" or something like that. 2, If I try to analyze a file that is not erlang code, it crashes, and gives a yaws crash page. the same happens if I dont specify a file and just press the "upload code and start refactoring" button. /Anders From zvi.avraham@REDACTED Fri Jan 29 18:37:25 2010 From: zvi.avraham@REDACTED (Zvi) Date: Fri, 29 Jan 2010 09:37:25 -0800 (PST) Subject: Interfaces between distributed OTP applications In-Reply-To: References: <8fc32993-3915-43eb-a4e4-d1d17b9aeea5@c29g2000yqd.googlegroups.com> <863bad11-7ee9-4aac-a1c6-c175a5538b10@m25g2000yqc.googlegroups.com> Message-ID: On Jan 29, 6:57?pm, Garrett Smith wrote: > FWIW, when I first saw your post, I casually interpreted your all-caps > name as spam that got through the filter. You might want to tweak your > mail client. Yes, I figured it out - changed the nickname > > Yes, though I'm not sure why the client would need to run on the > server node. The server would typically be registered globally and > then accessed from the client through a public API in the server > module (or an application level module). > my servers are registered locally, since I have several nodes with the same gen_server. Then I can communicate with them using gen_server:call/cast to {node1@REDACTED, my_server} {node2@REDACTED, my_server} ... {nodeN@REDACTED, my_server} I see that the best solution will be to put all public APIs into separate application with single module with protocol wrapper functions. Zvi From francesco@REDACTED Fri Jan 29 18:57:36 2010 From: francesco@REDACTED (Francesco Cesarini (Erlang Solutions)) Date: Fri, 29 Jan 2010 17:57:36 +0000 Subject: SF Bay Area Erlang Factory Programme (& Very Early Bird Registration Deadline) Message-ID: <4B632190.6020808@erlang-solutions.com> Hi All, a note to say that we are almost done with the programme for the 2010 SF Bay Area Erlang Factory. This year, we are lucky to have keynote speakers such as Joe Armstrong, Bjarne Dacker, Kenneth Lundin and Steve Vinoski. They will be giving four of the 35 scheduled talks on the 25th and 26th of March in the San Francisco Bay Area. The almost complete programme is available here: http://erlang-factory.com/conference/SFBay2010/programme The conference will be preceded by three days of University courses taught by experts such as Simon Thompson, John Hughes, Thomas Arts, Henry Nystrom and Kevin Smith. Come and learn Erlang, OTP, QuickCheck or Web Development with Erlang. More information on the courses are here: http://erlang-factory.com/conference/SFBay2010/university This *Sunday* is the deadline for the very early bird deadline. Register by Sunday night and save $400 on the on-site registration price. The conference hotel and venue is the SF Airport Hilton, a short BART / Caltrain ride from SF and the Valley. We have secured a very competitive price of 109$ per room and night at the conference hotel, this being one of the reasons for us choosing it. The other is the lower price of the venue, allowing us to pass on the savings to the delegates through a higher very early bird discount. We are planing an ErlLounge open to everyone who can't make the two days on the 25th, and hope we will be able to surpass last year's success. If you have thoughts or questions, you are welcome to drop me a line. Hope to see you all there! Francesco -- http://www.erlang-solutions.com --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From roberto.aloi@REDACTED Fri Jan 29 19:00:16 2010 From: roberto.aloi@REDACTED (Roberto Aloi) Date: Fri, 29 Jan 2010 18:00:16 +0000 (GMT) Subject: [erlang-questions] [ANN] tidier website In-Reply-To: <1275508071.82811264787766284.JavaMail.root@zimbra> Message-ID: <1302821392.82841264788016005.JavaMail.root@zimbra> Hi Kostis, many thanks for this tool. I couldn't find any privacy policy for the uploaded code, though. Do you store them? Do you log the applied transformations? It would be nice to have some statistics at a certain point, showing which "errors" Erlang developers do more often. As a graphical note, the top of the page is broken under Firefox 3.0 (the buttons on the top are split in two lines). I guess you could just reduce the width of the "li" items to take count of the borders. Regards, Roberto Aloi ----- "Kostis Sagonas" wrote: > We are very happy to announce the website of Tidier, an automatic > refactoring tool for Erlang programs. > > Tidier cleans up Erlang source code and suggests to its user a > sequence > of transformations that improve the quality and performance of code. > > More information about tidier can be found at its website (*): > > http://tidier.softlab.ntua.gr/ > > We welcome feedback and suggestions! > > Kostis Sagonas and Thanassis Avgerinos > > > (*) The website is using Erlang tools (ErlyWeb/Yaws). In principle it > should be robust under heavy load, but it has never been tested > in > such conditions. > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org -- Roberto Aloi --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From kostis@REDACTED Fri Jan 29 19:05:50 2010 From: kostis@REDACTED (Kostis Sagonas) Date: Fri, 29 Jan 2010 20:05:50 +0200 Subject: [erlang-questions] [ANN] tidier website In-Reply-To: <1302821392.82841264788016005.JavaMail.root@zimbra> References: <1302821392.82841264788016005.JavaMail.root@zimbra> Message-ID: <4B63237E.4020402@cs.ntua.gr> Roberto Aloi wrote: > Hi Kostis, > > many thanks for this tool. I couldn't find any privacy policy for the uploaded code, though. Do you store them? Do you log the applied transformations? Did you read this? http://tidier.softlab.ntua.gr/mediawiki/index.php/Important_notice_and_disclaimer which the front page, explicitly mentions that one should read ;-) "First time users please take some time to read the following important notice and disclaimer before you start using tidier" > It would be nice to have some statistics at a certain point, showing which "errors" Erlang developers do more often. That's the idea for storing the code. > As a graphical note, the top of the page is broken under Firefox 3.0 (the buttons on the top are split in two lines). I guess you could just reduce the width of the "li" items to take count of the borders. Hmmm... I do not think we've ever used Firefox 3 (we mostly use chrome these days). Thanks for bringing this up to our attention. Kostis From anders.nygren@REDACTED Fri Jan 29 19:07:12 2010 From: anders.nygren@REDACTED (Anders Nygren) Date: Fri, 29 Jan 2010 12:07:12 -0600 Subject: [erlang-questions] [ANN] tidier website In-Reply-To: <1302821392.82841264788016005.JavaMail.root@zimbra> References: <1275508071.82811264787766284.JavaMail.root@zimbra> <1302821392.82841264788016005.JavaMail.root@zimbra> Message-ID: On Fri, Jan 29, 2010 at 12:00 PM, Roberto Aloi wrote: > Hi Kostis, > > many thanks for this tool. I couldn't find any privacy policy for the uploaded code, though. Do you store them? Do you log the applied transformations? > It would be nice to have some statistics at a certain point, showing which "errors" Erlang developers do more often. > Its on http://tidier.softlab.ntua.gr/mediawiki/index.php/Important_notice_and_disclaimer /Anders From roberto.aloi@REDACTED Fri Jan 29 19:12:27 2010 From: roberto.aloi@REDACTED (Roberto Aloi) Date: Fri, 29 Jan 2010 18:12:27 +0000 (GMT) Subject: [erlang-questions] [ANN] tidier website In-Reply-To: <4B63237E.4020402@cs.ntua.gr> Message-ID: <652180976.82881264788747156.JavaMail.root@zimbra> > Did you read this? > > http://tidier.softlab.ntua.gr/mediawiki/index.php/Important_notice_and_disclaimer > > which the front page, explicitly mentions that one should read ;-) > > "First time users please take some time to read the following > important notice and disclaimer before you start using tidier" > lol. Sorry about that. I missed it completely. I was expecting a direct link somewhere in the web interface and I didn't think about the Manual Wiki Page. Good to know. Regards, -- Roberto Aloi --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From clist@REDACTED Fri Jan 29 20:17:19 2010 From: clist@REDACTED (Angel) Date: Fri, 29 Jan 2010 20:17:19 +0100 Subject: [erlang-questions] Re: Interfaces between distributed OTP applications In-Reply-To: References: <8fc32993-3915-43eb-a4e4-d1d17b9aeea5@c29g2000yqd.googlegroups.com> <863bad11-7ee9-4aac-a1c6-c175a5538b10@m25g2000yqc.googlegroups.com> Message-ID: <201001292017.20062.clist@uah.es> On Viernes, 29 de Enero de 2010 17:57:13 Garrett Smith escribi?: > On Fri, Jan 29, 2010 at 10:27 AM, ZZZZZZZZZZZZZZZZ > > wrote: > > I hate to repost, but maybe somebody can answer? > > thanks in advance > > FWIW, when I first saw your post, I casually interpreted your all-caps > name as spam that got through the filter. You might want to tweak your > mail client. Yeahhh! please change your address format if posible. > > > Zvi > > > > On Jan 26, 10:36 am, ZZZZZZZZZZZZZZZZ wrote: > >> Hi, > >> > >> the OTP Design Principles states, that OTP Applications are set of > >> loosely-coupled components, while modules inside single application > >> are tightly coupled. > >> Let's say I have two distributed OTP applications: "client" and > >> "server", both running on different Erlang nodes/hosts. > >> Let's say "server" application uses gen_server, which exposes public > >> function API. > >> The "client" applications calling functions in public API of > >> gen_server in "server" application. > >> What's the proper way to express this in OTP? > >> > >> 1. For simplicity, just add dependency on "server" application in > >> "client" application's .app file. Start both on "server" node. > > Yes, though I'm not sure why the client would need to run on the > server node. The server would typically be registered globally and > then accessed from the client through a public API in the server > module (or an application level module). > > >> 2. Don't use public API functions in "server". Send messages directly > >> to "server" using gen_server:call / cast. > > No. Look over the API docs for other gen_server implementations in OTP > -- there's always a public API that wraps the call/cast to the server. > > >> 3. Add third application: "server_api" or "server_if" with single > >> module defining public API wrappers around gen_server messages > >> protocol. Then "client" application will be depended on "server_api" > >> application, and not the "server" itself. > > It's common to provide an application level module that provides all > public APIs. E.g. look over the mnesia application. > > That said, you still want to provide an API per gen_server, even if > it's only used within your app. > > >> 4. Any other ideas? > > For learning OTP principles, there's no substitute for reading and > understanding the way existing OTP apps are implemented. I'd recommend > spending some time looking over apps (source, .app file, directory > structure, etc.) like inets and mnesia. I do this all the time to get > ideas for structuring my Erlang code. > > Garrett > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > -- Most people know C is not so high level.... ...Everybody else just got assembler overdose From jeraymond@REDACTED Fri Jan 29 21:58:57 2010 From: jeraymond@REDACTED (Jeremy Raymond) Date: Fri, 29 Jan 2010 15:58:57 -0500 Subject: [erlang-questions] [ANN] tidier website In-Reply-To: <652180976.82881264788747156.JavaMail.root@zimbra> References: <4B63237E.4020402@cs.ntua.gr> <652180976.82881264788747156.JavaMail.root@zimbra> Message-ID: <59da11981001291258s1cd1d58ax87552220771e2f97@mail.gmail.com> Hi, This seems neat, but isn't much use (to me anyhow) without being able to download and run the tool standalone locally. Not sure how many companies would really allow their IP to be uploaded to a third party. Maybe useful for some Open Source Erlang projects. Regards, Jeremy On Fri, Jan 29, 2010 at 1:12 PM, Roberto Aloi < roberto.aloi@REDACTED> wrote: > > Did you read this? > > > > > http://tidier.softlab.ntua.gr/mediawiki/index.php/Important_notice_and_disclaimer > > > > which the front page, explicitly mentions that one should read ;-) > > > > "First time users please take some time to read the following > > important notice and disclaimer before you start using tidier" > > > > lol. Sorry about that. I missed it completely. > I was expecting a direct link somewhere in the web interface and I didn't > think about the Manual Wiki Page. > Good to know. > > Regards, > > -- > Roberto Aloi > --------------------------------------------------- > > --------------------------------------------------- > > WE'VE CHANGED NAMES! > > Since January 1st 2010 Erlang Training and Consulting Ltd. has become > ERLANG SOLUTIONS LTD. > > www.erlang-solutions.com > > > ________________________________________________________________ > erlang-questions mailing list. See http://www.erlang.org/faq.html > erlang-questions (at) erlang.org > > From smith.winston.101@REDACTED Fri Jan 29 22:22:17 2010 From: smith.winston.101@REDACTED (Winston Smith) Date: Fri, 29 Jan 2010 16:22:17 -0500 Subject: Problems cross compiling: eheap_alloc: Cannot reallocate 3480006320 bytes of memory Message-ID: Trying to run a cross compiled version of R13B03 on an AVR32-Linux system (NGW100/buildroot-2.3.0) I get the following: /home/avr32 # erl Crash dump was written to: erl_crash.dump eheap_alloc: Cannot reallocate 3480006320 bytes of memory (of type "heap"). Aborted I've had this working before (I think with R13B01) but I've since upgraded my build host from Ubuntu 9.04 to 9.10. I actually had this same issue originally, and I somehow solved it, but I can't for the life of me remember what I did. I am setting up an xconf file with the proper values for size_t, off_t, big endian etc; in fact I based my build script on Brian Zhou's script for building Erlang on NSLU2 Linux: http://svn.nslu2-linux.org/svnroot/optware/trunk/make/erlang.mk Any thoughts on where to start debugging/diagnosing this? (the embedded gdb doesn't work) Is the erl_crash.dump useful (and how do I interpret it!)? Many thanks in advance! From g@REDACTED Fri Jan 29 22:38:49 2010 From: g@REDACTED (Garrett Smith) Date: Fri, 29 Jan 2010 15:38:49 -0600 Subject: simple_one_for_one use case and docs Message-ID: >From what I can tell, a simple_one_for_one supervisor is used to simplify house keeping on a group of related processes. - In init, provide a "prototype" child spec, which is used on calls to start_child - Use start_child to start a new child process using the child spec from init - When the child process terminates, either restart it or remove it as a child depending on restart policy: - temporary - remove it regardless of exit status - transient - restart it if abnormally terminated, remove if normally terminated - permanent - always restart, never remove This provides a "fire and forget" facility, so to speak, eliminating the need to deal with messy links, etc. to cleanup/restart terminated processes. It seems that, if you use any of the other restart types (e.g. one_for_one, etc.) you assume responsibility for deleting children if you add them dynamically. If you want the "auto delete on terminate" features of simple_one_for_one, you, well, need to use that supervisor type. Assuming I have this right, this took me a while to sort out. I can't find this (I think very important) point in any of the official Erlang docs. I think a line or two in the man docs for supervisor would help clarify why someone would use simple_one_for_one. Garrett P.S. Official docs are, IMO, quite good. This is just one feature that I think is worth highlighting. From kostis@REDACTED Fri Jan 29 23:04:56 2010 From: kostis@REDACTED (Kostis Sagonas) Date: Sat, 30 Jan 2010 00:04:56 +0200 Subject: [erlang-questions] [ANN] tidier website In-Reply-To: <59da11981001291258s1cd1d58ax87552220771e2f97@mail.gmail.com> References: <4B63237E.4020402@cs.ntua.gr> <652180976.82881264788747156.JavaMail.root@zimbra> <59da11981001291258s1cd1d58ax87552220771e2f97@mail.gmail.com> Message-ID: <4B635B88.3000206@cs.ntua.gr> Jeremy Raymond wrote: > Hi, > > This seems neat, but isn't much use (to me anyhow) without being able to > download and run the tool standalone locally. Not sure how many companies > would really allow their IP to be uploaded to a third party. Maybe useful > for some Open Source Erlang projects. This is exactly what we what our intention is! We want to: encourage and allow free use of tidier in Open Source Erlang projects and at the same time: give closed source projects the possibility to evaluate tidier on non-sensitive parts of their code as a "teaser" for obtaining a license for the tool which, by the way, it is possible to obtain. Hope this makes sense, Kostis From ulf.wiger@REDACTED Fri Jan 29 23:22:13 2010 From: ulf.wiger@REDACTED (Ulf Wiger) Date: Fri, 29 Jan 2010 23:22:13 +0100 Subject: SV: [erlang-questions] Re: Interfaces between distributed OTP applications Message-ID: (1) is the proper way to do it, but it also requires that 'server' is able to find its own processes. One way to do this is to register them globally. A possibility is also to have the API assume that the caller is local, and for 'client' to use rpc:call(...). In some cases, it actually makes sense to have the client explicitly choose the server node. ...and you should definitely add the dependency in the .app file. BR, Ulf W (in transit, waiting for a train that is more than 1hr delayed, due to the cold) -- originalmedd. -- ?mne: [erlang-questions] Re: Interfaces between distributed OTP applications Fr?n: ZZZZZZZZZZZZZZZZ Datum: 2010.01.29 17.31 I hate to repost, but maybe somebody can answer? thanks in advance Zvi On Jan 26, 10:36 am, ZZZZZZZZZZZZZZZZ wrote: > Hi, > > the OTP Design Principles states, that OTP Applications are set of > loosely-coupled components, while modules inside single application > are tightly coupled. > Let's say I have two distributed OTP applications: "client" and > "server", both running on different Erlang nodes/hosts. > Let's say "server" application uses gen_server, which exposes public > function API. > The "client" applications calling functions in public API of > gen_server in "server" application. > What's the proper way to express this in OTP? > > 1. For simplicity, just add dependency on "server" application in > "client" application's .app file. Start both on "server" node. > > 2. Don't use public API functions in "server". Send messages directly > to "server" using gen_server:call / cast. > > 3. Add third application: "server_api" or "server_if" with single > module defining public API wrappers around gen_server messages > protocol. Then "client" application will be depended on "server_api" > application, and not the "server" itself. > > 4. Any other ideas? > > thanks in advance, > Zvi > > ________________________________________________________________ > 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 --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com From v@REDACTED Sat Jan 30 10:39:25 2010 From: v@REDACTED (Valentin Micic) Date: Sat, 30 Jan 2010 11:39:25 +0200 Subject: [erlang-questions] [ANN] tidier website In-Reply-To: <4B635B88.3000206@cs.ntua.gr> Message-ID: <20100130093938.6A0F73D0D3C@mail.pharos-avantgard.com> It definitely does. So... what's the cost of such a license? Is the pricing model transparent, or is it a case of "how much is it worth to you"? V/ -----Original Message----- From: erlang-questions@REDACTED [mailto:erlang-questions@REDACTED] On Behalf Of Kostis Sagonas Sent: 30 January 2010 12:05 AM To: Erlang Cc: Jeremy Raymond; Thanassis Avgerinos Subject: Re: [erlang-questions] [ANN] tidier website Jeremy Raymond wrote: > Hi, > > This seems neat, but isn't much use (to me anyhow) without being able to > download and run the tool standalone locally. Not sure how many companies > would really allow their IP to be uploaded to a third party. Maybe useful > for some Open Source Erlang projects. This is exactly what we what our intention is! We want to: encourage and allow free use of tidier in Open Source Erlang projects and at the same time: give closed source projects the possibility to evaluate tidier on non-sensitive parts of their code as a "teaser" for obtaining a license for the tool which, by the way, it is possible to obtain. Hope this makes sense, Kostis ________________________________________________________________ erlang-questions mailing list. See http://www.erlang.org/faq.html erlang-questions (at) erlang.org From olivier.boudeville@REDACTED Sun Jan 31 21:49:04 2010 From: olivier.boudeville@REDACTED (Olivier Boudeville) Date: Sun, 31 Jan 2010 21:49:04 +0100 Subject: Emacs Erlang mode Message-ID: <4B65ECC0.6080605@online.fr> Hello, With Emacs, when using the erlang.el file (from R13B03), indenting apparently results in aligning the first parameter of a function, if that parameter has been put on next line, with a 2-character offset compared to the beginning of the function name, like in: (use fixed width characters to view the snippet layout correctly) """ get_textual_duration(FirstTimestamp,SecondTimestamp) -> {Days,{Hour, Minute, Second}} = calendar:seconds_to_daystime( get_duration( FirstTimestamp, SecondTimestamp) ), """ It leads, when using long variable names and respecting a max line width of, say, 80 characters, to a kind of piling in the rightmost part of the text. I know that these must be OTP formatting rules, but, for the ones that would prefer another layout, would there be a simple tweak to erlang.el so that the 2-character offset is applied to the indentation level of the previous line instead, like in: """ get_textual_duration(FirstTimestamp,SecondTimestamp) -> {Days,{Hour, Minute, Second}} = calendar:seconds_to_daystime( get_duration( FirstTimestamp, SecondTimestamp) ), """ (i.e. like when using "(arglist-intro . 2)" in emacs cc-mode) Similarly, if a first parameter is specified and a new line is added, currently next parameter will be put just below it (ex: see SecondTimestamp in the original example), whereas one may prefer that again a 2-character offset is applied to the indentation level of the previous line instead, resulting in a more compact statement (it would be "(arglist-cont-nonempty . 2)" in emacs cc-mode) I suspect that the solution would lie, in erlang.el, in the erlang-calculate-stack-indent function but it exceeds my elisp knowledge. Any idea? I am reluctant either to define in functions too many intermediate variables that would be used only once, or to shorten my variable names, because I think it would obfuscate the code. Thanks in advance for any information, Best regards, Olivier.