From fhoerni@REDACTED Sun Apr 1 08:12:16 2012 From: fhoerni@REDACTED (Frederic Hoerni) Date: Sun, 1 Apr 2012 08:12:16 +0200 Subject: [erlang-questions] ttb:get_et_handler In-Reply-To: <20120331092304.GB22828@fredbox> References: <20120331092304.GB22828@fredbox> Message-ID: <20120401061216.GA1762@fredbox> Finally I found ttb:get_et_handler() in OTP R15B. It is probably a new feature of version R15. Frederic On Sat, Mar 31, 2012 at 11:23:04AM +0200, Frederic Hoerni wrote: > Date: Sat, 31 Mar 2012 11:23:04 +0200 > From: Frederic Hoerni > To: erlang-questions@REDACTED > Subject: ttb:get_et_handler > > Hello all, > > The Erlang documentation of module ttb mentions > ttb:get_et_handler(), that would format traces for et_viewer. But it > looks like that this function does not exist. > > What is the history about this ? Is the documentation osbolete ? Or am I > missing the correct version of the tbb module ? (I tried with R13B03 and > R14B01) > > What other easy way is there for viewing with et_viewer ? (viewing > sequence charts is a reather interesting feature, I think) > > Frederic From emeka_1978@REDACTED Sun Apr 1 18:27:48 2012 From: emeka_1978@REDACTED (eigenfunction) Date: Sun, 1 Apr 2012 09:27:48 -0700 (PDT) Subject: [erlang-questions] snmp deployment Message-ID: <37b6feb3-1e71-488c-a4a7-436fea4eff53@m13g2000yqi.googlegroups.com> i would like to package a standalone application that depends on snmp. Packaging does not work as expected. Starting snmp return the following error: 3> application:start(snmp). {error, {bad_return, {{snmp_app,start,[normal,[]]}, {'EXIT', {{badmatch, {error, {shutdown, {child,undefined,snmpm_supervisor, {snmpm_supervisor,start_link, [normal,[{config,[{dir,...}, {...}]}]]}, transient,2000,supervisor, [snmpm_supervisor,supervisor]}}}}, [{snmp_app,start,2,[{file,"snmp_app.erl"},{line,40}]}, {application_master,start_it_old,4, [{file,"application_master.erl"},{line, 274}]}]}}}}}. Actually i am only interesting in the manager. I tried to start the system with: erl -config manager where manager: [ {snmp, [{manager, [{config, [{dir, "C:/snmp"}, {db_dir, "C:/snmp/db/"}]}]}]} ]. 4> snmp:start(). {error, {bad_return, {{snmp_app,start,[normal,[]]}, {'EXIT', {{badmatch, {error, {shutdown, {child,undefined,snmpm_supervisor, {snmpm_supervisor,start_link, [normal,[{config,[{dir,...}, {...}]}]]}, transient,2000,supervisor, [snmpm_supervisor,supervisor]}}}}, [{snmp_app,start,2,[{file,"snmp_app.erl"},{line,40}]}, {application_master,start_it_old,4, [{file,"application_master.erl"},{line,274}]}]}}}}} No luck ;-( Any idea? From vances@REDACTED Sun Apr 1 19:47:26 2012 From: vances@REDACTED (Vance Shipley) Date: Sun, 1 Apr 2012 23:17:26 +0530 Subject: [erlang-questions] snmp deployment In-Reply-To: <37b6feb3-1e71-488c-a4a7-436fea4eff53@m13g2000yqi.googlegroups.com> References: <37b6feb3-1e71-488c-a4a7-436fea4eff53@m13g2000yqi.googlegroups.com> Message-ID: <20120401174725.GD14994@aluminum.wavenet.lk> That is the error you get when the path to the config directory isn't found. Try just using the file module(*) to check the path: 1> file:consult("C:/snmp/manager.config"). Also you did name the system configuration file "manager.config" right? Whne you say `erl -config manager` it adds the .config suffix to the argument to the config parameter. -- -Vance (*) http://www.erlang.org/doc/man/file.html On Sun, Apr 01, 2012 at 09:27:48AM -0700, eigenfunction wrote: } Actually i am only interesting in the manager. I tried to start the } system with: erl -config manager } where manager: } [ } {snmp, } [{manager, } [{config, [{dir, "C:/snmp"}, } {db_dir, "C:/snmp/db/"}]}]}]} } ]. } } 4> snmp:start(). } {error, } {bad_return, } {{snmp_app,start,[normal,[]]}, } {'EXIT', } {{badmatch, } {error, } {shutdown, } {child,undefined,snmpm_supervisor, } {snmpm_supervisor,start_link, } [normal,[{config,[{dir,...}, } {...}]}]]}, } transient,2000,supervisor, } [snmpm_supervisor,supervisor]}}}}, } [{snmp_app,start,2,[{file,"snmp_app.erl"},{line,40}]}, } {application_master,start_it_old,4, } [{file,"application_master.erl"},{line,274}]}]}}}}} } } No luck ;-( } } Any idea? From emeka_1978@REDACTED Sun Apr 1 19:53:09 2012 From: emeka_1978@REDACTED (eigenfunction) Date: Sun, 1 Apr 2012 10:53:09 -0700 (PDT) Subject: [erlang-questions] snmp deployment In-Reply-To: <37b6feb3-1e71-488c-a4a7-436fea4eff53@m13g2000yqi.googlegroups.com> References: <37b6feb3-1e71-488c-a4a7-436fea4eff53@m13g2000yqi.googlegroups.com> Message-ID: <173f6ada-34d5-434c-a05b-505e51e4b6d5@u5g2000yqu.googlegroups.com> It turns out, i was not using reltool properly it seems. Packaging under linux with sinan was working. So i went back on windows and used the minimum config for reltool: {sys, [ {lib_dirs, ["c:/cygwin/home/snmptest/_build/snmptest/lib"]}, {rel, "snmpest", "1.0.0", [kernel ,stdlib ,{snmptest,load} ,{wx,load} ,snmp ]}, {boot_rel, "snmptest"} % ,{relocatable, true} % ,{profile, embedded} % ,{app_file, strip} % ,{debug_info, strip} % ,{incl_cond, exclude} % ,{app, stdlib, [{mod_cond, derived}, {incl_cond, include}]} % ,{app, kernel, [{incl_cond, include}]} % ,{app, snmp, [{incl_cond, include}]} % ,{app,mnesia,[{incl_cond, include}]} % ,{app, wx, [ {incl_cond, include}]} % ,{app, snmptest, [{vsn, "0.0.1"}, {incl_cond, include}]} ]}. It seems i was removing some snmp dependencies, which i am not sure what they actually are. Since the target system is Windows embedded, i will have to deploy the whole erlang system until i can find out a better way of stripping unused packages. Thanks. On Apr 1, 6:27?pm, eigenfunction wrote: > i would like to package a standalone application that depends on snmp. > Packaging does not work as expected. Starting snmp return the > following error: > > 3> application:start(snmp). > {error, > ? ? {bad_return, > ? ? ? ? {{snmp_app,start,[normal,[]]}, > ? ? ? ? ?{'EXIT', > ? ? ? ? ? ? ?{{badmatch, > ? ? ? ? ? ? ? ? ? {error, > ? ? ? ? ? ? ? ? ? ? ? {shutdown, > ? ? ? ? ? ? ? ? ? ? ? ? ? {child,undefined,snmpm_supervisor, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? {snmpm_supervisor,start_link, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [normal,[{config,[{dir,...}, > {...}]}]]}, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? transient,2000,supervisor, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [snmpm_supervisor,supervisor]}}}}, > ? ? ? ? ? ? ? [{snmp_app,start,2,[{file,"snmp_app.erl"},{line,40}]}, > ? ? ? ? ? ? ? ?{application_master,start_it_old,4, > ? ? ? ? ? ? ? ? ? ?[{file,"application_master.erl"},{line, > 274}]}]}}}}}. > Actually i am only interesting in the manager. I tried to start the > system with: erl -config manager > where manager: > [ > ? {snmp, > ? ? ? ? [{manager, > ? ? ? ? ? ? [{config, [{dir, "C:/snmp"}, > ? ? ? ? ? ? ? ? {db_dir, "C:/snmp/db/"}]}]}]} > ]. > > 4> snmp:start(). > {error, > ? ? {bad_return, > ? ? ? ? {{snmp_app,start,[normal,[]]}, > ? ? ? ? ?{'EXIT', > ? ? ? ? ? ? ?{{badmatch, > ? ? ? ? ? ? ? ? ? {error, > ? ? ? ? ? ? ? ? ? ? ? {shutdown, > ? ? ? ? ? ? ? ? ? ? ? ? ? {child,undefined,snmpm_supervisor, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? {snmpm_supervisor,start_link, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [normal,[{config,[{dir,...}, > {...}]}]]}, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? transient,2000,supervisor, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [snmpm_supervisor,supervisor]}}}}, > ? ? ? ? ? ? ? [{snmp_app,start,2,[{file,"snmp_app.erl"},{line,40}]}, > ? ? ? ? ? ? ? ?{application_master,start_it_old,4, > ? ? ? ? ? ? ? ? ? ?[{file,"application_master.erl"},{line,274}]}]}}}}} > > No luck ;-( > > Any idea? > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From emeka_1978@REDACTED Sun Apr 1 19:57:24 2012 From: emeka_1978@REDACTED (eigenfunction) Date: Sun, 1 Apr 2012 10:57:24 -0700 (PDT) Subject: [erlang-questions] snmp deployment In-Reply-To: <20120401174725.GD14994@aluminum.wavenet.lk> References: <37b6feb3-1e71-488c-a4a7-436fea4eff53@m13g2000yqi.googlegroups.com> <20120401174725.GD14994@aluminum.wavenet.lk> Message-ID: hmmmmmmm, interesting. I just created a new package using the whole erlang runtime and i didn't even need to configure the manager, everything was working fine. From the source code, when there is no configuration, it creates a default one it seems. Anyway, i am going to check that again to be sure. Thanks. On Apr 1, 7:47?pm, Vance Shipley wrote: > That is the error you get when the path to the config directory isn't found. > > Try just using the file module(*) to check the path: > > ? ? ? ? 1> file:consult("C:/snmp/manager.config"). > > Also you did name the system configuration file "manager.config" right? > Whne you say `erl -config manager` it adds the .config suffix to the > argument to the config parameter. > > -- > ? ? ? ? -Vance > > (*) ?http://www.erlang.org/doc/man/file.html > > > > > > > > > > On Sun, Apr 01, 2012 at 09:27:48AM -0700, eigenfunction wrote: > } ?Actually i am only interesting in the manager. I tried to start the > } ?system with: erl -config manager > } ?where manager: > } ?[ > } ? ?{snmp, > } ? ? ? ? ?[{manager, > } ? ? ? ? ? ? ?[{config, [{dir, "C:/snmp"}, > } ? ? ? ? ? ? ? ? ?{db_dir, "C:/snmp/db/"}]}]}]} > } ?]. > } > } ?4> snmp:start(). > } ?{error, > } ? ? ?{bad_return, > } ? ? ? ? ?{{snmp_app,start,[normal,[]]}, > } ? ? ? ? ? {'EXIT', > } ? ? ? ? ? ? ? {{badmatch, > } ? ? ? ? ? ? ? ? ? ?{error, > } ? ? ? ? ? ? ? ? ? ? ? ?{shutdown, > } ? ? ? ? ? ? ? ? ? ? ? ? ? ?{child,undefined,snmpm_supervisor, > } ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?{snmpm_supervisor,start_link, > } ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[normal,[{config,[{dir,...}, > } ?{...}]}]]}, > } ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?transient,2000,supervisor, > } ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[snmpm_supervisor,supervisor]}}}}, > } ? ? ? ? ? ? ? ?[{snmp_app,start,2,[{file,"snmp_app.erl"},{line,40}]}, > } ? ? ? ? ? ? ? ? {application_master,start_it_old,4, > } ? ? ? ? ? ? ? ? ? ? [{file,"application_master.erl"},{line,274}]}]}}}}} > } > } ?No luck ;-( > } > } ?Any idea? > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From emeka_1978@REDACTED Sun Apr 1 20:15:56 2012 From: emeka_1978@REDACTED (eigenfunction) Date: Sun, 1 Apr 2012 11:15:56 -0700 (PDT) Subject: [erlang-questions] snmp deployment In-Reply-To: <20120401174725.GD14994@aluminum.wavenet.lk> References: <37b6feb3-1e71-488c-a4a7-436fea4eff53@m13g2000yqi.googlegroups.com> <20120401174725.GD14994@aluminum.wavenet.lk> Message-ID: <6e8f82a1-2726-407b-b2aa-5ee7a6e3fb77@s27g2000yqd.googlegroups.com> I just restested everything and the packaging seems to be the problem. I just package the app with the full erlang runtime system. Thanks again. On Apr 1, 7:47?pm, Vance Shipley wrote: > That is the error you get when the path to the config directory isn't found. > > Try just using the file module(*) to check the path: > > ? ? ? ? 1> file:consult("C:/snmp/manager.config"). > > Also you did name the system configuration file "manager.config" right? > Whne you say `erl -config manager` it adds the .config suffix to the > argument to the config parameter. > > -- > ? ? ? ? -Vance > > (*) ?http://www.erlang.org/doc/man/file.html > > > > > > > > > > On Sun, Apr 01, 2012 at 09:27:48AM -0700, eigenfunction wrote: > } ?Actually i am only interesting in the manager. I tried to start the > } ?system with: erl -config manager > } ?where manager: > } ?[ > } ? ?{snmp, > } ? ? ? ? ?[{manager, > } ? ? ? ? ? ? ?[{config, [{dir, "C:/snmp"}, > } ? ? ? ? ? ? ? ? ?{db_dir, "C:/snmp/db/"}]}]}]} > } ?]. > } > } ?4> snmp:start(). > } ?{error, > } ? ? ?{bad_return, > } ? ? ? ? ?{{snmp_app,start,[normal,[]]}, > } ? ? ? ? ? {'EXIT', > } ? ? ? ? ? ? ? {{badmatch, > } ? ? ? ? ? ? ? ? ? ?{error, > } ? ? ? ? ? ? ? ? ? ? ? ?{shutdown, > } ? ? ? ? ? ? ? ? ? ? ? ? ? ?{child,undefined,snmpm_supervisor, > } ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?{snmpm_supervisor,start_link, > } ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[normal,[{config,[{dir,...}, > } ?{...}]}]]}, > } ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?transient,2000,supervisor, > } ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[snmpm_supervisor,supervisor]}}}}, > } ? ? ? ? ? ? ? ?[{snmp_app,start,2,[{file,"snmp_app.erl"},{line,40}]}, > } ? ? ? ? ? ? ? ? {application_master,start_it_old,4, > } ? ? ? ? ? ? ? ? ? ? [{file,"application_master.erl"},{line,274}]}]}}}}} > } > } ?No luck ;-( > } > } ?Any idea? > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From tejaswi.h@REDACTED Mon Apr 2 00:17:58 2012 From: tejaswi.h@REDACTED (schwarzenblitz) Date: Sun, 1 Apr 2012 15:17:58 -0700 (PDT) Subject: [erlang-questions] Resources for QuickCheck and TyPer Message-ID: <1333318678711-4524580.post@n4.nabble.com> Hi, I am new to the world of Erlang, and I just started reading about quickcheck and typer, but was unable to find a lot of resources online. This was the best link i found for quickcheck http://www.erlang-factory.com/upload/presentations/193/EUC2009-QuickCheck.pdf However, I still have many unanswered questions...also, I tried to download QuickCheck from this location (official website). But it retruns a page with junk characters. Can someone kindly guide me to a location where I can download quickcheck ? -Tej -- View this message in context: http://erlang.2086793.n4.nabble.com/Resources-for-QuickCheck-and-TyPer-tp4524580p4524580.html Sent from the Erlang Questions mailing list archive at Nabble.com. From tilman.holschuh@REDACTED Mon Apr 2 00:28:39 2012 From: tilman.holschuh@REDACTED (Tilman Holschuh) Date: Sun, 1 Apr 2012 15:28:39 -0700 Subject: [erlang-questions] Resources for QuickCheck and TyPer In-Reply-To: <1333318678711-4524580.post@n4.nabble.com> References: <1333318678711-4524580.post@n4.nabble.com> Message-ID: <6BED26C5-6809-4EA7-9184-4EACFB27F90D@gmail.com> Hi Tej, Have you looked into Proper yet? It's an open source QuickCheck clone you can find here: https://github.com/manopapad/proper or here http://proper.softlab.ntua.gr/ There are some examples and guides on the web page. Helped me to get going with property based testing. Cheers - Tilman On 2012-04-01, at 3:17 PM, schwarzenblitz wrote: > Hi, > > I am new to the world of Erlang, and I just started reading about quickcheck > and typer, but was unable to find a lot of resources online. > > This was the best link i found for quickcheck > http://www.erlang-factory.com/upload/presentations/193/EUC2009-QuickCheck.pdf > > However, I still have many unanswered questions...also, I tried to download > QuickCheck from this location (official website). But it retruns a page with > junk characters. Can someone kindly guide me to a location where I can > download quickcheck ? > > -Tej > > -- > View this message in context: http://erlang.2086793.n4.nabble.com/Resources-for-QuickCheck-and-TyPer-tp4524580p4524580.html > Sent from the Erlang Questions mailing list archive at Nabble.com. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From aschultz@REDACTED Mon Apr 2 01:56:46 2012 From: aschultz@REDACTED (Andreas Schultz) Date: Mon, 2 Apr 2012 01:56:46 +0200 (CEST) Subject: [erlang-questions] how to flush a gen_tcp socket on close? In-Reply-To: <231844824.1089345.1333324256785.JavaMail.root@office> Message-ID: <224514067.1089376.1333324606640.JavaMail.root@office> Hi, gen_tcp sockets do buffer sends internaly. It seems, when calling close on them, the buffered data is not flushed out, but simply discarded . I was expecting that a close on an socket with outstanding send data would block until that data has been send, but that seems not to happen. In fact, that might be a bug???? So, how do I force a gen_tcp socket so flush it's send queue before closing it? Andreas -- -- Dipl. Inform. Andreas Schultz email: as@REDACTED phone: +49-391-819099-224 mobil: +49-170-2226073 ------------------ managed broadband access ------------------ Travelping GmbH phone: +49-391-8190990 Roentgenstr. 13 fax: +49-391-819099299 D-39108 Magdeburg email: info@REDACTED GERMANY web: http://www.travelping.com Company Registration: HRB21276 Handelsregistergericht Chemnitz Geschaeftsfuehrer: Holger Winkelmann | VAT ID No.: DE236673780 -------------------------------------------------------------- From onlyafly@REDACTED Mon Apr 2 09:49:04 2012 From: onlyafly@REDACTED (Kevin Albrecht) Date: Mon, 2 Apr 2012 09:49:04 +0200 Subject: [erlang-questions] Erlang jobs In-Reply-To: References: <541B3180-27E3-4D68-8502-9460CC7DD34F@nexttolast.com> <4709741893507721794@unknownmsgid> Message-ID: Because Erlang is not one of the more widely used languages, at least some companies are willing to hire without Erlang experience and then train you. Of course, it won't hurt to already have some experience. Kevin Albrecht http://www.kevinalbrecht.com/ 2012/3/30 Yves S. Garret : > Hmm, good answer indeed :-) . ?But to be honest -- and I will go off the > rails for a sec -- I love the Erlang language. ?The syntax is quirky, but of > all the programming languages that I've tried and messed with, this is the > only one that has grabbed my attention and that is Erlang. ?I just have fun > making and breaking Erlang apps. ?The last time I've had this much fun was > when I discovered VB .NET (hold the flaming, the process of writing the code > was actually very pleasant). ?I don't have much time to do Erlang coding at > the moment (although I am beginning to make more time for it), I just wake > up and run to my PC when I know I'll be doing Erlang coding. > > Call me a fan boy, but it's fun hacking away code in Erlang :-) . > > > On Thu, Mar 29, 2012 at 4:56 PM, Max Bourinov wrote: >> >> +1 >> >> Good that Erlang is right for my needs. It is pleasure to work with >> Erlang! >> >> Sent from my iPhone >> >> On 29.03.2012, at 20:32, AD wrote: >> >> love that answer. >> >> On Thu, Mar 29, 2012 at 10:27 AM, David Goehrig >> wrote: >>> >>> You don't get a job programming Erlang. You get a job solving problems >>> and just happen to implement the solutions in Erlang. :) >>> >>> That said I'm taking resumes. >>> >>> Dave >>> >>> -=-=- dave@REDACTED -=-=- >>> >>> On Mar 28, 2012, at 2:52 PM, "Yves S. Garret" >>> wrote: >>> >>> > Hi all, I'm just curious if there are any Erlang employment >>> > opportunities out there. ?I have a job at the moment, but I'm not optimistic >>> > as to how much I can grow here. ?I do PHP web-development and would like to >>> > do more non-web-development, but wouldn't balk at working with Yaws and >>> > Erlang (it would be fun in its own way). >>> > >>> > What are your thoughts and inputs? >>> > _______________________________________________ >>> > erlang-questions mailing list >>> > erlang-questions@REDACTED >>> > http://erlang.org/mailman/listinfo/erlang-questions >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From vasdeveloper@REDACTED Mon Apr 2 10:30:39 2012 From: vasdeveloper@REDACTED (Kannan) Date: Mon, 2 Apr 2012 14:00:39 +0530 Subject: [erlang-questions] Erlang based Web Stack Message-ID: Dear List, We are planning to build a social network -- certainly different from FB -- using Linux/ YAWS / MongoDB / Erlang. We are looking at using Erlang based Web frameworks too. If any body of you have similar experience in dealing with TBs of data, dynamic scalability and the above mentioned stack, please be kind to give your inputs. Thank you. Kannan. -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthias@REDACTED Mon Apr 2 14:52:39 2012 From: matthias@REDACTED (Matthias Lang) Date: Mon, 2 Apr 2012 14:52:39 +0200 Subject: [erlang-questions] how to flush a gen_tcp socket on close? In-Reply-To: <224514067.1089376.1333324606640.JavaMail.root@office> References: <231844824.1089345.1333324256785.JavaMail.root@office> <224514067.1089376.1333324606640.JavaMail.root@office> Message-ID: <20120402125239.GA4970@corelatus.se> On Monday, April 02, Andreas Schultz wrote: > gen_tcp sockets do buffer sends internaly. It seems, when > calling close on them, the buffered data is not flushed out, > but simply discarded . > I was expecting that a close on an socket with outstanding > send data would block until that data has been send, but that > seems not to happen. In fact, that might be a bug???? I would also expect a socket to send all data. So your description of what actually happens is surprising. Can you provide a minimal but complete code which demonstrates what you're seeing? Matt From als@REDACTED Mon Apr 2 16:19:48 2012 From: als@REDACTED (Anthony Shipman) Date: Tue, 3 Apr 2012 00:19:48 +1000 Subject: [erlang-questions] how to flush a gen_tcp socket on close? In-Reply-To: <224514067.1089376.1333324606640.JavaMail.root@office> References: <224514067.1089376.1333324606640.JavaMail.root@office> Message-ID: <201204030019.48989.als@iinet.net.au> On Mon, 2 Apr 2012 09:56:46 am Andreas Schultz wrote: > So, how do I force a gen_tcp socket so flush it's send queue > before closing it? > > Andreas > I think doing a shutdown(, read_write) should ensure it is flushed. -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From torben.lehoff@REDACTED Mon Apr 2 16:32:15 2012 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Mon, 02 Apr 2012 16:32:15 +0200 Subject: [erlang-questions] Problem installing Agner on Mac OS X with R15B Message-ID: <4F79B86F.1090103@gmail.com> Hi, I am running R15B on a Mac OS X 10.7.3 and I get the following problem: $ curl https://raw.github.com/agner/agner/master/scripts/oneliner | sh ... ... ... ==> agner.vuXd7p (escriptize) Uncaught error in rebar_core: {'EXIT', {undef, [{rebar_utils,get_deprecated_list, [{config,"/private/tmp/agner.vuXd7p", [{require_otp_vsn,"R14|R15"}, {lib_dirs,["deps"]}, {escript_incl_apps, [getopt,gproc,rebar,plists,gen_fsm2, jsx]}, {erl_opts,[{i,"deps"}]}, {plugins,[agner_rebar_plugin]}, local, {require_otp_vsn,"R14|R15"}, {lib_dirs,["deps"]}, {escript_incl_apps, [getopt,gproc,rebar,plists,gen_fsm2, jsx]}, make: *** [compile] Error 1 $ erl Erlang R15B (erts-5.9) [source] [64-bit] [smp:4:4] [async-threads:0] [hipe] [kernel-poll:false] Any clues on what I might be doing wrong? Cheers, Torben -- http://www.linkedin.com/in/torbenhoffmann From witeman.g@REDACTED Mon Apr 2 18:08:34 2012 From: witeman.g@REDACTED (Zheng Zhibin) Date: Tue, 3 Apr 2012 00:08:34 +0800 Subject: [erlang-questions] Erlang based Web Stack In-Reply-To: References: Message-ID: I would suggest to let Riak instead of MongoDB BR, Zheng Zhibin ???? iPhone ? 2012-4-2???4:30?Kannan ??? > Dear List, > > We are planning to build a social network -- certainly different from FB -- using Linux/ YAWS / MongoDB / Erlang. We are looking at using Erlang based Web frameworks too. > > If any body of you have similar experience in dealing with TBs of data, dynamic scalability and the above mentioned stack, please be kind to give your inputs. > > > Thank you. > > Kannan. > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From john.hughes@REDACTED Mon Apr 2 18:22:34 2012 From: john.hughes@REDACTED (John Hughes) Date: Mon, 2 Apr 2012 18:22:34 +0200 Subject: [erlang-questions] Resources for QuickCheck and TyPer In-Reply-To: <1333318678711-4524580.post@n4.nabble.com> References: <1333318678711-4524580.post@n4.nabble.com> Message-ID: <1D73A2F30E9B4989B509E940873206E9@JohnsTablet2012> Hi, Thanks for reporting this... it's fixed now. Frustrating when things don't work. It's an inets/nitrogen/Firefox and Safari gotcha. We recently moved our we site onto nitrogen on inets, and at least out-of-the-box the combination serves almost all file types with content type text/plain! That screws up pdfs, zip files, htm files if you have them, etc etc etc. But Chrome and IE do the right thing anyway, making the problem invisible *unless* you try to download the file with Firefox or Safari. Then you just see a mass of junk characters. It would be nice if the nitrogen download set the right content type for more file types from the word go... John -----Ursprungligt meddelande----- From: schwarzenblitz Sent: Monday, April 02, 2012 12:17 AM To: erlang-questions@REDACTED Subject: [erlang-questions] Resources for QuickCheck and TyPer Hi, I am new to the world of Erlang, and I just started reading about quickcheck and typer, but was unable to find a lot of resources online. This was the best link i found for quickcheck http://www.erlang-factory.com/upload/presentations/193/EUC2009-QuickCheck.pdf However, I still have many unanswered questions...also, I tried to download QuickCheck from this location (official website). But it retruns a page with junk characters. Can someone kindly guide me to a location where I can download quickcheck ? -Tej -- View this message in context: http://erlang.2086793.n4.nabble.com/Resources-for-QuickCheck-and-TyPer-tp4524580p4524580.html Sent from the Erlang Questions mailing list archive at Nabble.com. _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions From vivek.ayer@REDACTED Mon Apr 2 19:23:41 2012 From: vivek.ayer@REDACTED (Vivek Ayer) Date: Mon, 2 Apr 2012 10:23:41 -0700 Subject: [erlang-questions] escript and ctrl+c Message-ID: Hi List, I've been using escripts to prototype erlang code. It's really great and you can have something functional (no pun intended) very quick, similar to prototyping in python. Anyways, escript serves all my needs except for shutdown signals. I can't quite figure out how make an exit action like 'Ctrl+C' trigger something like an 'exit' or 'stop' routine in my scripts. How would I go about accomplishing this? Help appreciated. Thanks, Vivek From vivek.ayer@REDACTED Mon Apr 2 20:08:58 2012 From: vivek.ayer@REDACTED (Vivek Ayer) Date: Mon, 2 Apr 2012 11:08:58 -0700 Subject: [erlang-questions] escript and ctrl+c In-Reply-To: References: Message-ID: Hi Dmitry, So you're saying ctrl+c just throws some error code and I have to write a halt function that handles that? Basically, I just want do something similar to: try: except Exception: that you'd see in python. Thanks for the quick reply! Vivek On Mon, Apr 2, 2012 at 10:32 AM, Dmitry Kolesnikov wrote: > Hello, > > erlang:halt(ErrorCode) make the trick for you. > > - Dmitry > > On Apr 2, 2012, at 8:23 PM, Vivek Ayer wrote: > >> Hi List, >> >> I've been using escripts to prototype erlang code. It's really great >> and you can have something functional (no pun intended) very quick, >> similar to prototyping in python. >> >> Anyways, escript serves all my needs except for shutdown signals. I >> can't quite figure out how make an exit action like 'Ctrl+C' trigger >> something like an 'exit' or 'stop' routine in my scripts. How would I >> go about accomplishing this? Help appreciated. >> >> Thanks, >> Vivek >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > From per@REDACTED Mon Apr 2 21:30:06 2012 From: per@REDACTED (Per Hedeland) Date: Mon, 2 Apr 2012 21:30:06 +0200 (CEST) Subject: [erlang-questions] how to flush a gen_tcp socket on close? In-Reply-To: <20120402125239.GA4970@corelatus.se> Message-ID: <201204021930.q32JU6GE055083@pluto.hedeland.org> Matthias Lang wrote: > >On Monday, April 02, Andreas Schultz wrote: > >> gen_tcp sockets do buffer sends internaly. It seems, when >> calling close on them, the buffered data is not flushed out, >> but simply discarded . >> I was expecting that a close on an socket with outstanding >> send data would block until that data has been send, but that >> seems not to happen. In fact, that might be a bug???? > >I would also expect a socket to send all data. So your description >of what actually happens is surprising. +1. I would actually go as far as saying that gen_tcp would be unusable for many applications if close/1 discarded buffered data. *Blocking* on close is another thing though, I don't expect that - the C API doesn't block on close either, you can ask for it via setsockopt(SO_LINGER), but it isn't the default. >Can you provide a minimal but complete code which demonstrates what >you're seeing? +1 again. And to comment on the other reply, using shutdown/2 should most certainly not be needed for this - the only purpose of using that is to do a "half close". --Per Hedeland From phil.toland@REDACTED Mon Apr 2 21:59:46 2012 From: phil.toland@REDACTED (Phillip Toland) Date: Mon, 2 Apr 2012 12:59:46 -0700 Subject: [erlang-questions] Erlang jobs In-Reply-To: References: <541B3180-27E3-4D68-8502-9460CC7DD34F@nexttolast.com> <4709741893507721794@unknownmsgid> Message-ID: On Mon, Apr 2, 2012 at 12:49 AM, Kevin Albrecht wrote: > Because Erlang is not one of the more widely used languages, at least > some companies are willing to hire without Erlang experience and then > train you. Of course, it won't hurt to already have some experience. My team takes this approach to hiring. We look for solid Ruby and Python programmers and if they show an aptitude and desire to learn Erlang we will train them. If not we have plenty of Ruby and Python projects for them to work on. This approach has worked out very well for us, but we do prefer candidates who at least know some Erlang. We also prefer candidates who have contributed to open source and have public repos on Github. -- ~p From g@REDACTED Mon Apr 2 23:29:15 2012 From: g@REDACTED (Garrett Smith) Date: Mon, 2 Apr 2012 16:29:15 -0500 Subject: [erlang-questions] escript and ctrl+c In-Reply-To: References: Message-ID: Hi Vivek, On Mon, Apr 2, 2012 at 12:23 PM, Vivek Ayer wrote: > Hi List, > > I've been using escripts to prototype erlang code. It's really great > and you can have something functional (no pun intended) very quick, > similar to prototyping in python. > > Anyways, escript serves all my needs except for shutdown signals. I > can't quite figure out how make an exit action like 'Ctrl+C' trigger > something like an 'exit' or 'stop' routine in my scripts. How would I > go about accomplishing this? Help appreciated. Not possible, sadly. There are different approaches, but they're messy. If you just need to perform some simple cleanup work after Ctrl-C -- you could write a wrapper in Python that handles the signal and perform the cleanup. You'd call the escript using subprocess.Popen, e.g. If it's not so simple, I'd look at still using Python (or anything that handles signals) as a front end -- and setup Erlang as a server-of-sorts (e.g. distributed Erlang, run_erl/to_erl, sockets, etc.) Garrett From eriksoe@REDACTED Mon Apr 2 23:33:21 2012 From: eriksoe@REDACTED (=?ISO-8859-1?Q?Erik_S=F8e_S=F8rensen?=) Date: Mon, 02 Apr 2012 23:33:21 +0200 Subject: [erlang-questions] escript and ctrl+c In-Reply-To: References: Message-ID: <4F7A1B21.2030405@gmail.com> Not quite. I believe Dmitry misunderstood the question; this is not about how to make the escript program exit, but how to catch when a user makes it exit - presumably for some cleanup work. Well, here's the bad news: it appears that the treatment of the SIGINT signal is rather hardcoded - to either making the Erlang VM shut down, or escaping to an options menu, depending on how Erlang was started. (At least that's what I got out of looking at unix/sys.c, break.c, and erl_check_io.c.) I suppose that given Erlang's server-side origins, enabling custom signal handling hasn't been a priority... As for a solution, it probably depends a lot on what you're trying to accomplish. The possibilities I see: a) using sigaction() directly - probably not a good solution; hard to make thread-safe. b) using NIFs to install a cleanup handler with at_exit(). c) writing a wrapper script which handles cleanup. d) writing a wrapper script in bash or similar, for catching the signal and passing in to the escript in a suitable way. /Erik Den 02-04-2012 20:08, Vivek Ayer skrev: > Hi Dmitry, > > So you're saying ctrl+c just throws some error code and I have to > write a halt function that handles that? Basically, I just want do > something similar to: > > try: > > except Exception: > > that you'd see in python. > > Thanks for the quick reply! > Vivek > > On Mon, Apr 2, 2012 at 10:32 AM, Dmitry Kolesnikov wrote: >> Hello, >> >> erlang:halt(ErrorCode) make the trick for you. >> >> - Dmitry >> >> On Apr 2, 2012, at 8:23 PM, Vivek Ayer wrote: >> >>> Hi List, >>> >>> I've been using escripts to prototype erlang code. It's really great >>> and you can have something functional (no pun intended) very quick, >>> similar to prototyping in python. >>> >>> Anyways, escript serves all my needs except for shutdown signals. I >>> can't quite figure out how make an exit action like 'Ctrl+C' trigger >>> something like an 'exit' or 'stop' routine in my scripts. How would I >>> go about accomplishing this? Help appreciated. >>> >>> Thanks, >>> Vivek >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From vivek.ayer@REDACTED Mon Apr 2 23:39:51 2012 From: vivek.ayer@REDACTED (Vivek Ayer) Date: Mon, 2 Apr 2012 14:39:51 -0700 Subject: [erlang-questions] escript and ctrl+c In-Reply-To: References: Message-ID: Looks like the zeromq community has already solved this: http://zguide.zeromq.org/es:interrupt If I'm not mistaken, this should do what I want. Can you all confirm? Vivek On Mon, Apr 2, 2012 at 10:23 AM, Vivek Ayer wrote: > Hi List, > > I've been using escripts to prototype erlang code. It's really great > and you can have something functional (no pun intended) very quick, > similar to prototyping in python. > > Anyways, escript serves all my needs except for shutdown signals. I > can't quite figure out how make an exit action like 'Ctrl+C' trigger > something like an 'exit' or 'stop' routine in my scripts. How would I > go about accomplishing this? Help appreciated. > > Thanks, > Vivek From g@REDACTED Tue Apr 3 00:13:18 2012 From: g@REDACTED (Garrett Smith) Date: Mon, 2 Apr 2012 17:13:18 -0500 Subject: [erlang-questions] escript and ctrl+c In-Reply-To: References: Message-ID: Heh, I wrote that :) No, that's definitely not what you're asking for. It's the most misleading title imaginable! The title is generic across all 0MQ language examples -- but Erlang doesn't support "handling ctrl-c cleanly". The example shows what the equivalent shutdown handler might look like. Sorry about that. I'd still suggest a wrapper script in something like Python, which handles signals well. Btw, given Erlang's server side heritage, I'm surprised it *does not* handle signals. Most background OS processes do. On Mon, Apr 2, 2012 at 4:39 PM, Vivek Ayer wrote: > Looks like the zeromq community has already solved this: > > http://zguide.zeromq.org/es:interrupt > > If I'm not mistaken, this should do what I want. Can you all confirm? > > Vivek > > On Mon, Apr 2, 2012 at 10:23 AM, Vivek Ayer wrote: >> Hi List, >> >> I've been using escripts to prototype erlang code. It's really great >> and you can have something functional (no pun intended) very quick, >> similar to prototyping in python. >> >> Anyways, escript serves all my needs except for shutdown signals. I >> can't quite figure out how make an exit action like 'Ctrl+C' trigger >> something like an 'exit' or 'stop' routine in my scripts. How would I >> go about accomplishing this? Help appreciated. >> >> Thanks, >> Vivek > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From vivek.ayer@REDACTED Tue Apr 3 00:35:11 2012 From: vivek.ayer@REDACTED (Vivek Ayer) Date: Mon, 2 Apr 2012 15:35:11 -0700 Subject: [erlang-questions] escript and ctrl+c In-Reply-To: References: Message-ID: Let's propose it for R16! :) On Mon, Apr 2, 2012 at 3:13 PM, Garrett Smith wrote: > Heh, I wrote that :) > > No, that's definitely not what you're asking for. It's the most > misleading title imaginable! > > The title is generic across all 0MQ language examples -- but Erlang > doesn't support "handling ctrl-c cleanly". The example shows what the > equivalent shutdown handler might look like. > > Sorry about that. > > I'd still suggest a wrapper script in something like Python, which > handles signals well. > > Btw, given Erlang's server side heritage, I'm surprised it *does not* > handle signals. Most background OS processes do. > > On Mon, Apr 2, 2012 at 4:39 PM, Vivek Ayer wrote: >> Looks like the zeromq community has already solved this: >> >> http://zguide.zeromq.org/es:interrupt >> >> If I'm not mistaken, this should do what I want. Can you all confirm? >> >> Vivek >> >> On Mon, Apr 2, 2012 at 10:23 AM, Vivek Ayer wrote: >>> Hi List, >>> >>> I've been using escripts to prototype erlang code. It's really great >>> and you can have something functional (no pun intended) very quick, >>> similar to prototyping in python. >>> >>> Anyways, escript serves all my needs except for shutdown signals. I >>> can't quite figure out how make an exit action like 'Ctrl+C' trigger >>> something like an 'exit' or 'stop' routine in my scripts. How would I >>> go about accomplishing this? Help appreciated. >>> >>> Thanks, >>> Vivek >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions From wmknapik@REDACTED Tue Apr 3 03:39:22 2012 From: wmknapik@REDACTED (Wojciech Knapik) Date: Tue, 3 Apr 2012 03:39:22 +0200 Subject: [erlang-questions] Support for newcomers and the popularity of Erlang In-Reply-To: <9BCC5755-3F74-471D-A810-22C96981C652@feuerlabs.com> References: <20120321013825.GA3889@h82-143-167-72-static.e-wro.net.pl> <4AF16C06-60D5-47DF-B69C-CBB6E5CE1FA2@feuerlabs.com> <20120330084407.GA873@h82-143-167-72-static.e-wro.net.pl> <9BCC5755-3F74-471D-A810-22C96981C652@feuerlabs.com> Message-ID: <20120403013922.GA16669@h82-143-167-72-static.e-wro.net.pl> On Fri, Mar 30, 2012 at 02:08:39AM -0700, Ulf Wiger wrote: > You can start mnesia with {extra_db_nodes, KnownNodes]}. This will > establish a ram-only schema on the current node, containing all > meta-data about the database (assuming KnownNodes contains actual > schema nodes). After starting, you can call > mnesia:change_table_copy_type(schema, node(), disc_copies), to make > the schema on the current node persistent. Ok, here's what I came up with. This function is called from gen_server's init callback. The code is run on multiple identical nodes (code-wise). Any hints/comments/suggestions would be appreciated. setup_database() -> DBBootstrap = fun() -> mnesia:change_table_copy_type(schema, node(), disc_copies), mnesia:create_table(data, [{attributes, record_info(fields, data)}, {disc_copies, [node()]}]) end, mnesia:start([{extra_db_nodes, nodes()}]), case lists:member(data, mnesia:system_info(tables)) of true -> case lists:member(node(), mnesia:table_info(data, active_replicas)) of true -> ok; false -> mnesia:change_table_copy_type(schema, node(), disc_copies), mnesia:add_table_copy(data, node(), disc_copies) end; false -> case global:trans({db_bootstrap, self()}, DBBootstrap, [node()|nodes()], 0) of aborted -> mnesia:wait_for_tables([data], 5000), setup_database(); {aborted, Reason} -> erlang:error(Reason); _ -> ok end end. From vasdeveloper@REDACTED Tue Apr 3 07:58:02 2012 From: vasdeveloper@REDACTED (Kannan) Date: Tue, 3 Apr 2012 11:28:02 +0530 Subject: [erlang-questions] Erlang based Web Stack In-Reply-To: References: Message-ID: Thanks Zheng for your suggestion. The application that we are building is a strong candidate for using a document database. As you, and others in private, mentioned, we will do a study on the suitability of Riak for our application. I appreciate the time you all have spend to give your inputs. Regards, Kannan. On Mon, Apr 2, 2012 at 9:38 PM, Zheng Zhibin wrote: > I would suggest to let Riak instead of MongoDB > > BR, > Zheng Zhibin > ???? iPhone > > ? 2012-4-2???4:30?Kannan ??? > > > Dear List, > > > > We are planning to build a social network -- certainly different from FB > -- using Linux/ YAWS / MongoDB / Erlang. We are looking at using Erlang > based Web frameworks too. > > > > If any body of you have similar experience in dealing with TBs of data, > dynamic scalability and the above mentioned stack, please be kind to give > your inputs. > > > > > > Thank you. > > > > Kannan. > > > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From onlyafly@REDACTED Tue Apr 3 10:20:06 2012 From: onlyafly@REDACTED (Kevin Albrecht) Date: Tue, 3 Apr 2012 10:20:06 +0200 Subject: [erlang-questions] Jenkins + dialyzer Message-ID: Does anyone have advice on integrating Dialyzer checks into Jenkins? Thanks, Kevin Albrecht http://www.kevinalbrecht.com/ From jose.valim@REDACTED Tue Apr 3 12:02:59 2012 From: jose.valim@REDACTED (=?ISO-8859-1?Q?Jos=E9_Valim?=) Date: Tue, 3 Apr 2012 07:02:59 -0300 Subject: [erlang-questions] io:getopts() possibly unset when evaluating code Message-ID: It seems that, when evaluating code via -eval (or -s or -run), the standard IO options are not yet set. In my case, what happens is that the encoding is still set to latin1, while it should be unicode. Here is how I reproduce the issue: $ erl -eval 'io:format("~p~n", [io:getopts()]), halt().' [{expand_fun,#Fun}, {echo,true}, {binary,false}, {encoding,latin1}] However, invoking io:getopts() inside the shell returns the proper result: Eshell V5.9 (abort with ^G) 1> io:getopts(). [{expand_fun,#Fun}, {echo,true}, {binary,false}, {encoding,unicode}] This means that, if I print any unicode value during -eval (or -s or -run), it will fail by printing question marks instead of the accented words. This can be verified with: $ erl -eval 'io:put_chars(<<"jos?"/utf8>>), halt().' The same inside the console prints correctly. Is this a bug? Regardless if it is a bug or not, should I just set io:setopts([{encoding,unicode}]) for now? Thanks, * Jos? Valim www.plataformatec.com.br Founder and Lead Developer * -------------- next part -------------- An HTML attachment was scrubbed... URL: From hvjunk@REDACTED Tue Apr 3 12:33:55 2012 From: hvjunk@REDACTED (Hendrik Visage) Date: Tue, 3 Apr 2012 12:33:55 +0200 Subject: [erlang-questions] Troll bait: If your code really matters, you'll write it in C++ Message-ID: http://blog.achrissmith.com/2012/03/if-your-software-matters-you-will-write.html No, I didn't say it, I just snickered at the "definition": Definition: "software which matters" "Software which matters" is defined as: - Software which is used by hundreds of millions of people daily. - Software which generates billions of dollars in income annually. Yours not converted to the plus side Hendrik From richardprideauxevans@REDACTED Tue Apr 3 13:08:52 2012 From: richardprideauxevans@REDACTED (Richard Evans) Date: Tue, 3 Apr 2012 12:08:52 +0100 Subject: [erlang-questions] Erlang-C port not working on some unix machines Message-ID: I am using the standard erlang-c port code as described in the tutorial?http://www.erlang.org/doc/tutorial/c_port.html#id63121 and in Joe Armstrong's book. On my macbook, the erlang code and c-code communicate happily using write_exact and read_exact. (I have not touched any of that standard code). But when running exactly the same code on a unix pdp machine, the communication from c to erlang breaks down. Specifically, in the server's loop: loop(Port) -> receive {call, Caller, Msg} -> Port ! {self(), {command, encode(Msg)}}, receive {Port, {data, Data}} -> <---- WE NEVER GET HERE !!! Caller ! {complex, decode(Data)} end, loop(Port); stop -> Port ! {self(), close}, receive {Port, closed} -> exit(normal) end; {'EXIT', Port, Reason} -> exit(port_terminated) end. The c-code receives the encoded-message successfully from the erlang code. The c-code then writes back a response using write_exact (in this case, an extremely simple OK response with a two byte header). But the erlang code never receives this message. The c-code for writing the response is the standard code (write_cmd and write_exact). I have not touched any of this standard code: int write_exact(byte* buff, int len) { assert(len < BUFF_SIZE); int i, wrote = 0; do { if ((i = (int)write(1, buff+wrote, len-wrote)) <= 0) { return (i); } wrote += i; } while (wrote < len); return len; } Debugging the c-side, the write() function gets called - but somehow the erlang side never receives the message back from the port. Do you guys know have any ideas what might be causing this message to fail to get back from c to erlang in this case on this machine? (It used to work on the very same pdp machine - and I haven't touched the erlang code since it last worked). Could it be something to do with permissions or something, preventing the write in write_exact from actually writing anything? I am at a loss. thanks, Richard From essen@REDACTED Tue Apr 3 13:35:05 2012 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Tue, 03 Apr 2012 13:35:05 +0200 Subject: [erlang-questions] Split Cowboy's acceptor and HTTP code Message-ID: <4F7AE069.1030904@ninenines.eu> Hello, I have received a lot of feedback on Cowboy recently, especially at the Erlang Factory. The main concern people seem to have today is that many of you seem to want to use Cowboy's acceptor code and transport abstraction, but don't want to include the HTTP components. I argued until now that you can always remove the HTTP modules from the release if you want, and that it's easier to work on improving both sides at the same time without the dependency, while still keeping in mind that the two parts would eventually get split before 1.0. Considering the feedback, I'm wondering if now would be the time to split them. Most people use rebar nowadays, so the dependency should be handled automatically. But I did receive a few comments before from people who liked the fact that Cowboy was a single package. If the split happens, it will be right after the next version tag, 0.6.0, and will most likely include a renaming of most modules all in a single commit. People who follow master will need to update their code immediately (I'll give a script to do that automatically), while others staying at 0.6.0 will have some time to make it happen. If you don't want the split to happen at this point, you should probably reply to this mail so we can all discuss what should happen and when. I hope it won't be too much trouble on everyone, the module renaming script should take care of most of it. Thanks for your feedback, as always! -- Lo?c Hoguin Erlang Cowboy Nine Nines From bourinov@REDACTED Tue Apr 3 14:49:41 2012 From: bourinov@REDACTED (Max Bourinov) Date: Tue, 3 Apr 2012 16:49:41 +0400 Subject: [erlang-questions] Troll bait: If your code really matters, you'll write it in C++ In-Reply-To: References: Message-ID: Is is 1-st April joke? Best regards, Max On Tue, Apr 3, 2012 at 2:33 PM, Hendrik Visage wrote: > > http://blog.achrissmith.com/2012/03/if-your-software-matters-you-will-write.html > > No, I didn't say it, I just snickered at the "definition": > > > Definition: "software which matters" > > "Software which matters" is defined as: > - Software which is used by hundreds of millions of people daily. > - Software which generates billions of dollars in income annually. > > > Yours not converted to the plus side > Hendrik > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mfidelman@REDACTED Tue Apr 3 14:54:56 2012 From: mfidelman@REDACTED (Miles Fidelman) Date: Tue, 03 Apr 2012 08:54:56 -0400 Subject: [erlang-questions] Troll bait: If your code really matters, you'll write it in C++ In-Reply-To: References: Message-ID: <4F7AF320.4020601@meetinghouse.net> > Definition: "software which matters" > > "Software which matters" is defined as: > - Software which is used by hundreds of millions of people daily. > - Software which generates billions of dollars in income annually. > Troll bait or not, isn't the obvious answer - at least in this group - telephone switching software, and financial transaction processing software. Oh wait, isn't a lot of that stuff written in erlang? -- In theory, there is no difference between theory and practice. In practice, there is. .... Yogi Berra From max.lapshin@REDACTED Tue Apr 3 15:35:02 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Tue, 3 Apr 2012 17:35:02 +0400 Subject: [erlang-questions] Split Cowboy's acceptor and HTTP code In-Reply-To: <4F7AE069.1030904@ninenines.eu> References: <4F7AE069.1030904@ninenines.eu> Message-ID: Loic. I think that splitting cowboy into two repositories is a bad idea. It will make your life a nightmare if you need git bisect This is exactly why erlyvideo is monolitic in single repo. Just keep your http code in separate subfolder src/http. This is really enough. From aschultz@REDACTED Tue Apr 3 15:38:41 2012 From: aschultz@REDACTED (Andreas Schultz) Date: Tue, 3 Apr 2012 15:38:41 +0200 (CEST) Subject: [erlang-questions] how to flush a gen_tcp socket on close? In-Reply-To: <201204021930.q32JU6GE055083@pluto.hedeland.org> References: <201204021930.q32JU6GE055083@pluto.hedeland.org> Message-ID: Am 02.04.2012 um 12:30 schrieb Per Hedeland : > Matthias Lang wrote: >> >> On Monday, April 02, Andreas Schultz wrote: >> >>> gen_tcp sockets do buffer sends internaly. It seems, when >>> calling close on them, the buffered data is not flushed out, >>> but simply discarded . >>> I was expecting that a close on an socket with outstanding >>> send data would block until that data has been send, but that >>> seems not to happen. In fact, that might be a bug???? >> >> I would also expect a socket to send all data. So your description >> of what actually happens is surprising. > > +1. I would actually go as far as saying that gen_tcp would be unusable > for many applications if close/1 discarded buffered data. *Blocking* on > close is another thing though, I don't expect that - the C API doesn't > block on close either, you can ask for it via setsockopt(SO_LINGER), but > it isn't the default. Prim_inet has an internal send buffer and it has to make sure that this is flushed, so I think close should block. I found the part where it does this in the erlang part of inet, however there seems to be a timeout of 5 seconds. In my case the receiver is to slow to process all the data, sender does 10k packets of 1k size, the receiver only gets the first 2000 packets. It might well be that I hit the close timeout and inet discards the rest of the send queue. The fix should be simple, limit the send queue size. > >> Can you provide a minimal but complete code which demonstrates what >> you're seeing? I'm on vacation for a few day, I will build a demo next week. > > +1 again. > > And to comment on the other reply, using shutdown/2 should most > certainly not be needed for this - the only purpose of using that is to > do a "half close". Shutdown seems not to process the send queue. > > --Per Hedeland > Andreas From essen@REDACTED Tue Apr 3 15:46:06 2012 From: essen@REDACTED (=?UTF-8?B?TG/Dr2MgSG9ndWlu?=) Date: Tue, 03 Apr 2012 15:46:06 +0200 Subject: [erlang-questions] Split Cowboy's acceptor and HTTP code In-Reply-To: References: <4F7AE069.1030904@ninenines.eu> Message-ID: <4F7AFF1E.8030602@ninenines.eu> Cowboy *will* be split in two eventually. It has always been the intent. The only question is when. I'm not a fan of monolithic architectures. :) On 04/03/2012 03:35 PM, Max Lapshin wrote: > Loic. I think that splitting cowboy into two repositories is a bad idea. > > It will make your life a nightmare if you need git bisect This is > exactly why erlyvideo is monolitic in single repo. > > Just keep your http code in separate subfolder src/http. This is really enough. -- Lo?c Hoguin Erlang Cowboy Nine Nines From kenneth.lundin@REDACTED Tue Apr 3 16:31:47 2012 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Tue, 3 Apr 2012 16:31:47 +0200 Subject: [erlang-questions] Erlang/OTP R15B01 has been released Message-ID: Erlang/OTP R15B01 has been released. This release is mainly a stabilization of the R15B release (but as usual there are some new functionality as well). *Highlights: * - Added erlang:statistics(scheduler_wall_time) to ensure correct determination of scheduler utilization. Measuring scheduler utilization is strongly preferred over CPU utilization, since CPU utilization gives very poor indications of actual scheduler/vm usage. - Changed ssh implementation to use the public_key application for all public key handling. This is also a first step for enabling a callback API for supplying public keys and handling keys protected with password phrases. Additionally the test suites where improved so that they do not copy the users keys to test server directories as this is a security liability. Also ipv6 and file access issues found in the process has been fixed. - When an escript ends now all printout to standard output and standard error gets out on the terminal. This bug has been corrected by changing the behaviour of erlang:halt/0,1, which should fix the same problem for other escript-like applications, i.e. that data stored in the output port driver buffers got lost when printing on a TTY and exiting through erlang:halt/0,1. The BIF:s erlang:halt/0,1 has gotten improved semantics and there is a new BIF erlang:halt/2 to accomplish something like the old semantics. See the documentation. - The DTrace source patch from Scott Lystig Fritchie is integrated in the source tree. Using an emulator with dtrace probe is still not supported for production use, but may be a valuable debugging tool. Configure with --with-dynamic-trace=dtrace (or --with-dynamic-trace=systemtap) to create a build with dtrace probes enabled. See runtime_tools for documentation and examples - Added Torbj?rn T?rnkvists LDAP client as a new application called eldap. - Added options for the ssh client to support user keys files that are password protected. You can find the README file with more detailed info at http://www.erlang.org/download/otp_src_R15B01.readme You can download the full source distribution from http://www.erlang.org/download/otp_src_R15B01.tar.gz http://www.erlang.org/download/otp_src_R15B01.readme (this file) Note: To unpack the TAR archive you need a GNU TAR compatible program. For installation instructions please read the README that is part of the distribution. You can also find this release at the official Erlang/OTP Git-repository at Github here: https://github.com/erlang/otp/tree/OTP_R15B01 (i.e. on the maint branch tag= OTP_R15B01) The Windows binary distribution can be downloaded from http://www.erlang.org/download/otp_win32_R15B01.exe http://www.erlang.org/download/otp_win64_R15B01.exe On-line documentation can be found at http://www.erlang.org/doc/. You can also download the complete HTML documentation or the Unix manual files http://www.erlang.org/download/otp_doc_html_R15B01.tar.gz http://www.erlang.org/download/otp_doc_man_R15B01.tar.gz We also want to thank those that sent us patches, suggestions and bug reports, The OTP Team at Ericsson -------------- next part -------------- An HTML attachment was scrubbed... URL: From g@REDACTED Tue Apr 3 17:08:54 2012 From: g@REDACTED (Garrett Smith) Date: Tue, 3 Apr 2012 10:08:54 -0500 Subject: [erlang-questions] Troll bait: If your code really matters, you'll write it in C++ In-Reply-To: References: Message-ID: On Tue, Apr 3, 2012 at 5:33 AM, Hendrik Visage wrote: > http://blog.achrissmith.com/2012/03/if-your-software-matters-you-will-write.html > > No, I didn't say it, I just snickered at the "definition": > > > Definition: "software which matters" > > "Software which matters" is defined as: > - Software which is used by hundreds of millions of people daily. > - Software which generates billions of dollars in income annually. > His premise is that if you can optimize you will and that optimization equals performance. With those axioms, I think the conclusion is sound. The first commenter cited this excellent summary of the architectural approaches that YouTube takes: http://highscalability.com/blog/2012/3/26/7-years-of-youtube-scalability-lessons-in-30-minutes.html Some interesting quotes (many worthy of sacred text status): - Choose the simplest solution possible with the loosest guarantees that are practical - Whole process is what scalability is about - YouTube is not asynchronous, everything is blocking - Things change over time - If a user can?t tell a part of the system is skewing and inconsistent, then it?s not - Not every comment is a financial transaction. So know when you can cheat - A component might last a month or six months, who knows - The most efficient thing is to write it in C and cram it into one process, but that?s not scalable - The more magical the code is the harder is to figure out how it works - The fastest function call is the one that doesn?t happen I'm of course cherry picking the quotes to emphasize my own impression, but the YouTube approach seems more about managing constant change than making things go fast. It seems that "software that matters" is "software that's subject to intense pressure by users". It's also hard to imagine software as single applications these days. It tends to quickly become "systems". So C++ could certainly be the Right Choice for part of what matters. Garrett From watson.timothy@REDACTED Tue Apr 3 17:10:34 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Tue, 3 Apr 2012 16:10:34 +0100 Subject: [erlang-questions] Split Cowboy's acceptor and HTTP code In-Reply-To: <4F7AFF1E.8030602@ninenines.eu> References: <4F7AE069.1030904@ninenines.eu> <4F7AFF1E.8030602@ninenines.eu> Message-ID: +1 for splitting it out. I'm definitely one of those wanting to use the acceptor code stand alone. On 3 April 2012 14:46, Lo?c Hoguin wrote: > Cowboy *will* be split in two eventually. It has always been the intent. The > only question is when. > > I'm not a fan of monolithic architectures. :) > > > On 04/03/2012 03:35 PM, Max Lapshin wrote: >> >> Loic. ?I think that splitting cowboy into two repositories is a bad idea. >> >> It will make your life a nightmare if you need git bisect ? This is >> exactly why erlyvideo is monolitic in single repo. >> >> Just keep your http code in separate subfolder ?src/http. This is really >> enough. > > > > -- > Lo?c Hoguin > Erlang Cowboy > Nine Nines > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From bchesneau@REDACTED Tue Apr 3 17:18:40 2012 From: bchesneau@REDACTED (Benoit Chesneau) Date: Tue, 3 Apr 2012 17:18:40 +0200 Subject: [erlang-questions] Split Cowboy's acceptor and HTTP code In-Reply-To: <4F7AE069.1030904@ninenines.eu> References: <4F7AE069.1030904@ninenines.eu> Message-ID: +1 for splitting it out. It will make the life easier for people who are using only the acceptor part . Also it's better to do that early I guess. On Tue, Apr 3, 2012 at 1:35 PM, Lo?c Hoguin wrote: > Hello, > > I have received a lot of feedback on Cowboy recently, especially at the > Erlang Factory. The main concern people seem to have today is that many of > you seem to want to use Cowboy's acceptor code and transport abstraction, > but don't want to include the HTTP components. > > I argued until now that you can always remove the HTTP modules from the > release if you want, and that it's easier to work on improving both sides at > the same time without the dependency, while still keeping in mind that the > two parts would eventually get split before 1.0. > > Considering the feedback, I'm wondering if now would be the time to split > them. > > Most people use rebar nowadays, so the dependency should be handled > automatically. But I did receive a few comments before from people who liked > the fact that Cowboy was a single package. > > If the split happens, it will be right after the next version tag, 0.6.0, > and will most likely include a renaming of most modules all in a single > commit. People who follow master will need to update their code immediately > (I'll give a script to do that automatically), while others staying at 0.6.0 > will have some time to make it happen. > > If you don't want the split to happen at this point, you should probably > reply to this mail so we can all discuss what should happen and when. > > I hope it won't be too much trouble on everyone, the module renaming script > should take care of most of it. > > Thanks for your feedback, as always! > > -- > Lo?c Hoguin > Erlang Cowboy > Nine Nines > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From wmknapik@REDACTED Tue Apr 3 17:22:52 2012 From: wmknapik@REDACTED (Wojciech Knapik) Date: Tue, 3 Apr 2012 17:22:52 +0200 Subject: [erlang-questions] Support for newcomers and the popularity of Erlang In-Reply-To: <20120403013922.GA16669@h82-143-167-72-static.e-wro.net.pl> References: <20120321013825.GA3889@h82-143-167-72-static.e-wro.net.pl> <4AF16C06-60D5-47DF-B69C-CBB6E5CE1FA2@feuerlabs.com> <20120330084407.GA873@h82-143-167-72-static.e-wro.net.pl> <9BCC5755-3F74-471D-A810-22C96981C652@feuerlabs.com> <20120403013922.GA16669@h82-143-167-72-static.e-wro.net.pl> Message-ID: <20120403152252.GA30397@h82-143-167-72-static.e-wro.net.pl> On Tue, Apr 03, 2012 at 03:39:22AM +0200, Wojciech Knapik wrote: > On Fri, Mar 30, 2012 at 02:08:39AM -0700, Ulf Wiger wrote: > > > You can start mnesia with {extra_db_nodes, KnownNodes]}. This will > > establish a ram-only schema on the current node, containing all > > meta-data about the database (assuming KnownNodes contains actual > > schema nodes). After starting, you can call > > mnesia:change_table_copy_type(schema, node(), disc_copies), to make > > the schema on the current node persistent. > > Ok, here's what I came up with. > This function is called from gen_server's init callback. > The code is run on multiple identical nodes (code-wise). > Any hints/comments/suggestions would be appreciated. I added some code to limit the number of replicas to ?MAX_REPLICAS. I'd appreciate it if someone could tell me if this code is ok, or if I'm doing something fundamentally wrong or in a non-erlangy way ;] setup_database() -> DBBootstrap = fun() -> mnesia:change_table_copy_type(schema, node(), disc_copies), mnesia:create_table(?TABLE_NAME, [{attributes, record_info(fields, ?TABLE_NAME)}, {disc_copies, [node()]}]) end, mnesia:start([{extra_db_nodes, nodes()}]), case lists:member(?TABLE_NAME, mnesia:system_info(tables)) of true -> case lists:member(node(), mnesia:table_info(?TABLE_NAME, active_replicas)) of true -> ok; false -> case length(mnesia:system_info(db_nodes)) of N when N > ?MAX_REPLICAS -> ok; _ -> mnesia:change_table_copy_type(schema, node(), disc_copies), mnesia:add_table_copy(?TABLE_NAME, node(), disc_copies) end end; false -> case global:trans({db_bootstrap, self()}, DBBootstrap, [node()|nodes()], 0) of aborted -> mnesia:wait_for_tables([?TABLE_NAME], 5000), setup_database(); {aborted, Reason} -> erlang:error(Reason); _ -> ok end end. From max.lapshin@REDACTED Tue Apr 3 17:36:58 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Tue, 3 Apr 2012 19:36:58 +0400 Subject: [erlang-questions] Split Cowboy's acceptor and HTTP code In-Reply-To: References: <4F7AE069.1030904@ninenines.eu> Message-ID: It does not do your life easier. Three files of 20kbytes are not a problem. But splitting will make impossible using git bisect and will bring exponential number of combinations of cowboy and cowboy-www with exponential number of bugs. I can promise that in two months after splitting cowboy into two parts will appear next webserver, which is "fast and convenient to use, not like that bloated cowboy, which doesn't fit into one package". I understand an idea to push some good part of cowboy into OTP. But plain splitting will bring nothing but pain. There is really no problem in checkouting several http-related files if you are just using cowboys acceptor. On Tuesday, April 3, 2012, Benoit Chesneau wrote: > +1 for splitting it out. It will make the life easier for people who > are using only the acceptor part . Also it's better to do that early I > guess. > > On Tue, Apr 3, 2012 at 1:35 PM, Lo?c Hoguin > > wrote: > > Hello, > > > > I have received a lot of feedback on Cowboy recently, especially at the > > Erlang Factory. The main concern people seem to have today is that many > of > > you seem to want to use Cowboy's acceptor code and transport abstraction, > > but don't want to include the HTTP components. > > > > I argued until now that you can always remove the HTTP modules from the > > release if you want, and that it's easier to work on improving both > sides at > > the same time without the dependency, while still keeping in mind that > the > > two parts would eventually get split before 1.0. > > > > Considering the feedback, I'm wondering if now would be the time to split > > them. > > > > Most people use rebar nowadays, so the dependency should be handled > > automatically. But I did receive a few comments before from people who > liked > > the fact that Cowboy was a single package. > > > > If the split happens, it will be right after the next version tag, 0.6.0, > > and will most likely include a renaming of most modules all in a single > > commit. People who follow master will need to update their code > immediately > > (I'll give a script to do that automatically), while others staying at > 0.6.0 > > will have some time to make it happen. > > > > If you don't want the split to happen at this point, you should probably > > reply to this mail so we can all discuss what should happen and when. > > > > I hope it won't be too much trouble on everyone, the module renaming > script > > should take care of most of it. > > > > Thanks for your feedback, as always! > > > > -- > > Lo?c Hoguin > > Erlang Cowboy > > Nine Nines > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Tue Apr 3 17:43:51 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Tue, 3 Apr 2012 19:43:51 +0400 Subject: [erlang-questions] Split Cowboy's acceptor and HTTP code In-Reply-To: References: <4F7AE069.1030904@ninenines.eu> Message-ID: If someone thinks that splitting single product into many infrastructure packages is "convenient", I want to mention horror with debian packaging of erlang: erlang, erlang-base, erlang-tools, erlang-mnesia, etc Nothing but problems and as a result conflicting packages when you try to remove all that stuff and install package from esl. -------------- next part -------------- An HTML attachment was scrubbed... URL: From thomas.burdick@REDACTED Tue Apr 3 19:12:43 2012 From: thomas.burdick@REDACTED (Tom Burdick) Date: Tue, 3 Apr 2012 12:12:43 -0500 Subject: [erlang-questions] Deputy: Type Conversion and Validation Message-ID: After not finding a validation/conversion library I felt worked well for what I wanted (REST interface) I made my own. Would greatly appreciate any feedback! http://github.com/treetopllc/deputy Thanks! Tom From als@REDACTED Tue Apr 3 19:12:51 2012 From: als@REDACTED (Anthony Shipman) Date: Wed, 4 Apr 2012 03:12:51 +1000 Subject: [erlang-questions] how to flush a gen_tcp socket on close? In-Reply-To: References: <201204021930.q32JU6GE055083@pluto.hedeland.org> Message-ID: <201204040312.52011.als@iinet.net.au> On Tue, 3 Apr 2012 11:38:41 pm Andreas Schultz wrote: > > And to comment on the other reply, using shutdown/2 should most > > certainly not be needed for this - the only purpose of using that is to > > do a "half close". > > Shutdown seems not to process the send queue. > If close() called shutdown(, read_write) which blocked until the data was fully flushed then it would all make sense. -- Anthony Shipman Mamas don't let your babies als@REDACTED grow up to be outsourced. From andrew@REDACTED Tue Apr 3 19:48:05 2012 From: andrew@REDACTED (Andrew Thompson) Date: Tue, 3 Apr 2012 13:48:05 -0400 Subject: [erlang-questions] Split Cowboy's acceptor and HTTP code In-Reply-To: References: <4F7AE069.1030904@ninenines.eu> Message-ID: <20120403174805.GA26966@hijacked.us> On Tue, Apr 03, 2012 at 07:43:51PM +0400, Max Lapshin wrote: > If someone thinks that splitting single product into many infrastructure > packages is "convenient", I want to mention horror with debian packaging of > erlang: erlang, erlang-base, erlang-tools, erlang-mnesia, etc > > Nothing but problems and as a result conflicting packages when you try to > remove all that stuff and install package from esl. As a counterpoint, consider how riak is packaged, 25 deps, 19 of which we maintain. In practice, we lock all the dependancies at release time, people running HEAD might run into some temporary issues with out of sync deps, but its not a common problem we see. You're also conflating erlang packaging with erlang *library* packaging. I agree that erlang is often packaged extremely badly by distributions, but if cowboy-acceptor is a version-locked dependancy of cowboy, there should be little chance of them getting out of sync. Andrew From lenartlad@REDACTED Tue Apr 3 20:37:06 2012 From: lenartlad@REDACTED (Ladislav Lenart) Date: Tue, 03 Apr 2012 20:37:06 +0200 Subject: [erlang-questions] Deputy: Type Conversion and Validation In-Reply-To: References: Message-ID: <4F7B4352.8030007@volny.cz> Hello. Nice little work :-) Just a few notes: * Documentation typo in Proplist Usage - Rules is defined but later RuleSet is used. * Documentation about Addon Type Conversion seems unfinished. * Why the advanced API needs to be exported at all? * I would modify interface of convert/2 to either: * return the result value directly | raise an error, * use tagged tuples {ok, Value} | error. * I think check/3 returns errors in reversed order when stop is used. * I would suggest to extend (both) {func,...} to check_rule(Value, {func, Fun}) when is_function(Fun, 1) -> try Fun(Value) catch _:_ -> error end; This will enable you to write shorter rules. Instead of Test = fun (Value) -> case Value > 1 andalso Value < 10 of true -> ok; false -> error end end you will be able to write Test = fun (Value) -> true = Value > 1 andalso Value < 10, ok end or (in a different style) Test = fun (Value) -> true = Value > 1, true = Value < 10, ok end and if you allow true as synonym for ok and false as synonym for error, you can omit ok at the end. HTH, Ladislav Lenart On 3.4.2012 19:12, Tom Burdick wrote: > After not finding a validation/conversion library I felt worked well > for what I wanted (REST interface) I made my own. > > Would greatly appreciate any feedback! > > http://github.com/treetopllc/deputy > > Thanks! > > Tom > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From michal.niec@REDACTED Tue Apr 3 21:21:35 2012 From: michal.niec@REDACTED (Michal Niec) Date: Tue, 3 Apr 2012 21:21:35 +0200 Subject: [erlang-questions] Erlang OTP R15B01 packages Message-ID: Hi, You can find our Erlang R15B01 packages for CentOS 6, Mac OS X Snow Leopard and Lion, Debian 6, Ubuntu 10.04, Ubuntu 11.10 and Fedora 16 at http://www.erlang-solutions.com/section/132/download-erlang-otp . Best Regards, Michal Niec From comptekki@REDACTED Tue Apr 3 21:50:35 2012 From: comptekki@REDACTED (Wes James) Date: Tue, 3 Apr 2012 13:50:35 -0600 Subject: [erlang-questions] Erlang OTP R15B01 packages In-Reply-To: References: Message-ID: Awesome! Thanks! Wes On Tue, Apr 3, 2012 at 1:21 PM, Michal Niec wrote: > Hi, > > You can find our Erlang R15B01 packages for CentOS 6, Mac OS X Snow Leopard and Lion, Debian 6, Ubuntu 10.04, Ubuntu 11.10 and Fedora 16 ?at http://www.erlang-solutions.com/section/132/download-erlang-otp . > > Best Regards, > Michal Niec From thomas.burdick@REDACTED Tue Apr 3 23:30:50 2012 From: thomas.burdick@REDACTED (Tom Burdick) Date: Tue, 3 Apr 2012 16:30:50 -0500 Subject: [erlang-questions] Deputy: Type Conversion and Validation In-Reply-To: <4F7B4352.8030007@volny.cz> References: <4F7B4352.8030007@volny.cz> Message-ID: I like the idea of making true/false synonymous with ok/false. I'm not sure wrapping the fun handler with a try/catch clause is the right thing to do though, in that case I believe it should be left as a programming error. I fixed the readme to reflect your comments, though I have not bothered to actually test whats in the readme which is horrible I know! Maybe later this week I'll do both! Thank you for the comments. Tom On Tue, Apr 3, 2012 at 1:37 PM, Ladislav Lenart wrote: > Hello. > > Nice little work :-) > > Just a few notes: > * Documentation typo in Proplist Usage - Rules is defined but later > ?RuleSet is used. > * Documentation about Addon Type Conversion seems unfinished. > * Why the advanced API needs to be exported at all? > * I would modify interface of convert/2 to either: > ?* return the result value directly | raise an error, > ?* use tagged tuples {ok, Value} | error. > * I think check/3 returns errors in reversed order when stop is used. > * I would suggest to extend (both) {func,...} to > > ? ? ?check_rule(Value, {func, Fun}) when is_function(Fun, 1) -> > ? ? ? ? ?try > ? ? ? ? ? ? ?Fun(Value) > ? ? ? ? ?catch > ? ? ? ? ? ? ?_:_ -> > ? ? ? ? ? ? ? ? ?error > ? ? ? ? ?end; > > ?This will enable you to write shorter rules. Instead of > > ? ? ?Test = fun (Value) -> > ? ? ? ? ?case Value > 1 andalso Value < 10 of > ? ? ? ? ? ? ?true -> ok; > ? ? ? ? ? ? ?false -> error > ? ? ? ? ?end > ? ? ?end > > ?you will be able to write > > ? ? ?Test = fun (Value) -> true = Value > 1 andalso Value < 10, ok end > > ?or (in a different style) > > ? ? ?Test = fun (Value) -> > ? ? ? ? ?true = Value > 1, > ? ? ? ? ?true = Value < 10, > ? ? ? ? ?ok > ? ? ?end > > ?and if you allow true as synonym for ok and false as synonym for error, > ?you can omit ok at the end. > > > HTH, > > Ladislav Lenart > > > > On 3.4.2012 19:12, Tom Burdick wrote: >> >> After not finding a validation/conversion library I felt worked well >> for what I wanted (REST interface) I made my own. >> >> Would greatly appreciate any feedback! >> >> http://github.com/treetopllc/deputy >> >> Thanks! >> >> Tom >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > > From ok@REDACTED Wed Apr 4 00:05:03 2012 From: ok@REDACTED (Richard O'Keefe) Date: Wed, 4 Apr 2012 10:05:03 +1200 Subject: [erlang-questions] Troll bait: If your code really matters, you'll write it in C++ In-Reply-To: References: Message-ID: On 3/04/2012, at 10:33 PM, Hendrik Visage wrote: > http://blog.achrissmith.com/2012/03/if-your-software-matters-you-will-write.html > > No, I didn't say it, I just snickered at the "definition": > > > Definition: "software which matters" > > "Software which matters" is defined as: > - Software which is used by hundreds of millions of people daily. > - Software which generates billions of dollars in income annually. > The justification given for "if it matters ... you will use C++" is > The point isn't to claim that C++ is the "one true language", > but rather that any benefit a programming language has for the > programmer doesn't matter. If writing code in language X makes > you 100x more productive but produces slow code, then all your > users will notice is that your programs are slow. As the Spartans famously said, "IF!" The article appears to be a joke. C++ is indeed *capable* of producing very good performance (as are Fortran and Ada) but you have to be careful to write very simple very clean obvious code to get there, and it really pays to use things like objects (easily hidden huge memory management overheads) and templates (easily hidden mind-numbingly vast code bloat) with vigilant trepidation (thanks for that phrase, Rex Stout). Jon Harrop of Flying Frog never tires of pointing out benchmarks where a "managed" language produces code *faster* than C++. Me, I'm just tired of people saying how efficient C++ is who look blank when you ask them "what optimisation options did you use? what profiler did you use?" From toby@REDACTED Wed Apr 4 01:43:35 2012 From: toby@REDACTED (Toby Thain) Date: Tue, 03 Apr 2012 19:43:35 -0400 Subject: [erlang-questions] Troll bait: If your code really matters, you'll write it in C++ In-Reply-To: References: Message-ID: <4F7B8B27.6090702@telegraphics.com.au> On 03/04/12 8:49 AM, Max Bourinov wrote: > Is is 1-st April joke? > > It can't be anything else :) --T > Best regards, > Max > > > > > On Tue, Apr 3, 2012 at 2:33 PM, Hendrik Visage > wrote: > > http://blog.achrissmith.com/2012/03/if-your-software-matters-you-will-write.html > > No, I didn't say it, I just snickered at the "definition": > > > Definition: "software which matters" > > "Software which matters" is defined as: > - Software which is used by hundreds of millions of people daily. > - Software which generates billions of dollars in income annually. > > > Yours not converted to the plus side > Hendrik > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From vivek.ayer@REDACTED Wed Apr 4 02:23:40 2012 From: vivek.ayer@REDACTED (Vivek Ayer) Date: Tue, 3 Apr 2012 17:23:40 -0700 Subject: [erlang-questions] escript and ctrl+c In-Reply-To: References: Message-ID: Hey guys, I think the bash script is the easiest route. --- #!/bin/bash trap ctrl_c INT function ctrl_c() { ?? ?escript?kill.es exit 0 } escript yourscript.es while true do sleep 1 done --- This is what I had planned: Start a UDP server in yourscript.es and have a receive block that waits for a 'shutdown' message from kill.es. Once it receives it 'shutdown' from the kill.es UDP client, it executes erlang:halt(). What do you guys think? Vivek On Mon, Apr 2, 2012 at 3:35 PM, Vivek Ayer wrote: > > Let's propose it for R16! :) > > On Mon, Apr 2, 2012 at 3:13 PM, Garrett Smith wrote: > > Heh, I wrote that :) > > > > No, that's definitely not what you're asking for. It's the most > > misleading title imaginable! > > > > The title is generic across all 0MQ language examples -- but Erlang > > doesn't support "handling ctrl-c cleanly". The example shows what the > > equivalent shutdown handler might look like. > > > > Sorry about that. > > > > I'd still suggest a wrapper script in something like Python, which > > handles signals well. > > > > Btw, given Erlang's server side heritage, I'm surprised it *does not* > > handle signals. Most background OS processes do. > > > > On Mon, Apr 2, 2012 at 4:39 PM, Vivek Ayer wrote: > >> Looks like the zeromq community has already solved this: > >> > >> http://zguide.zeromq.org/es:interrupt > >> > >> If I'm not mistaken, this should do what I want. Can you all confirm? > >> > >> Vivek > >> > >> On Mon, Apr 2, 2012 at 10:23 AM, Vivek Ayer wrote: > >>> Hi List, > >>> > >>> I've been using escripts to prototype erlang code. It's really great > >>> and you can have something functional (no pun intended) very quick, > >>> similar to prototyping in python. > >>> > >>> Anyways, escript serves all my needs except for shutdown signals. I > >>> can't quite figure out how make an exit action like 'Ctrl+C' trigger > >>> something like an 'exit' or 'stop' routine in my scripts. How would I > >>> go about accomplishing this? Help appreciated. > >>> > >>> Thanks, > >>> Vivek > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://erlang.org/mailman/listinfo/erlang-questions From rapsey@REDACTED Wed Apr 4 08:02:16 2012 From: rapsey@REDACTED (Rapsey) Date: Wed, 4 Apr 2012 08:02:16 +0200 Subject: [erlang-questions] Erlang based Web Stack In-Reply-To: References: Message-ID: I would suggest using a framework like chicago boss http://www.chicagoboss.org/ I don't speak from experience by using chicago boss, but it is the closest to what I actually use, which was developed in house and quite lightweight. If you don't use a framework and just use a webserver, there will be a lot of really unnecessary code in everything. Also take a look at erlydtl. Some people like nitrogen http://nitrogenproject.com/ but their way of writing html is not my cup of tea. Sergej 2012/4/3 Kannan > Thanks Zheng for your suggestion. The application that we are building is > a strong candidate for using a document database. As you, and others in > private, mentioned, we will do a study on the suitability of Riak for our > application. > > I appreciate the time you all have spend to give your inputs. > > Regards, > Kannan. > > > > On Mon, Apr 2, 2012 at 9:38 PM, Zheng Zhibin wrote: > >> I would suggest to let Riak instead of MongoDB >> >> BR, >> Zheng Zhibin >> ???? iPhone >> >> ? 2012-4-2???4:30?Kannan ??? >> >> > Dear List, >> > >> > We are planning to build a social network -- certainly different from >> FB -- using Linux/ YAWS / MongoDB / Erlang. We are looking at using Erlang >> based Web frameworks too. >> > >> > If any body of you have similar experience in dealing with TBs of data, >> dynamic scalability and the above mentioned stack, please be kind to give >> your inputs. >> > >> > >> > Thank you. >> > >> > Kannan. >> > >> > >> > >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://erlang.org/mailman/listinfo/erlang-questions >> > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lenartlad@REDACTED Wed Apr 4 08:23:58 2012 From: lenartlad@REDACTED (Ladislav Lenart) Date: Wed, 04 Apr 2012 08:23:58 +0200 Subject: [erlang-questions] Deputy: Type Conversion and Validation In-Reply-To: References: <4F7B4352.8030007@volny.cz> Message-ID: <4F7BE8FE.4010802@volny.cz> You're welcome :-) You can also add two more options - protected versions of {func,...}. You are right that my concept can mask programming errors as input errors. Personally, I don't see this as a problem in this context, because all this is very easy to (unit) test. Hence I think I would quickly discover such an omission. Nevertheless making true/false synonyms may turn to be good enough. Happy Erlang hacking, Ladislav Lenart On 3.4.2012 23:30, Tom Burdick wrote: > I like the idea of making true/false synonymous with ok/false. I'm not > sure wrapping the fun handler with a try/catch clause is the right > thing to do though, in that case I believe it should be left as a > programming error. > > I fixed the readme to reflect your comments, though I have not > bothered to actually test whats in the readme which is horrible I > know! > > Maybe later this week I'll do both! Thank you for the comments. > > Tom > > > On Tue, Apr 3, 2012 at 1:37 PM, Ladislav Lenart wrote: >> Hello. >> >> Nice little work :-) >> >> Just a few notes: >> * Documentation typo in Proplist Usage - Rules is defined but later >> RuleSet is used. >> * Documentation about Addon Type Conversion seems unfinished. >> * Why the advanced API needs to be exported at all? >> * I would modify interface of convert/2 to either: >> * return the result value directly | raise an error, >> * use tagged tuples {ok, Value} | error. >> * I think check/3 returns errors in reversed order when stop is used. >> * I would suggest to extend (both) {func,...} to >> >> check_rule(Value, {func, Fun}) when is_function(Fun, 1) -> >> try >> Fun(Value) >> catch >> _:_ -> >> error >> end; >> >> This will enable you to write shorter rules. Instead of >> >> Test = fun (Value) -> >> case Value> 1 andalso Value< 10 of >> true -> ok; >> false -> error >> end >> end >> >> you will be able to write >> >> Test = fun (Value) -> true = Value> 1 andalso Value< 10, ok end >> >> or (in a different style) >> >> Test = fun (Value) -> >> true = Value> 1, >> true = Value< 10, >> ok >> end >> >> and if you allow true as synonym for ok and false as synonym for error, >> you can omit ok at the end. >> >> >> HTH, >> >> Ladislav Lenart >> >> >> >> On 3.4.2012 19:12, Tom Burdick wrote: >>> >>> After not finding a validation/conversion library I felt worked well >>> for what I wanted (REST interface) I made my own. >>> >>> Would greatly appreciate any feedback! >>> >>> http://github.com/treetopllc/deputy >>> >>> Thanks! >>> >>> Tom >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> >> >> > From vladdu55@REDACTED Wed Apr 4 09:22:31 2012 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 4 Apr 2012 09:22:31 +0200 Subject: [erlang-questions] erlang.org site not updated with R15B-1 Message-ID: Hi, I'd like to point out that there is no notice and there are no downloads for R15B-1 on the site. best regards, Vlad From vasdeveloper@REDACTED Wed Apr 4 12:59:32 2012 From: vasdeveloper@REDACTED (Kannan) Date: Wed, 4 Apr 2012 16:29:32 +0530 Subject: [erlang-questions] Erlang based Web Stack In-Reply-To: References: Message-ID: Thank you Serge. We are evaluating some frameworks and surely your input is a good addition. Thanks you guys, all your inputs give us a great boost. Regards, Kannan. On Wed, Apr 4, 2012 at 11:32 AM, Rapsey wrote: > I would suggest using a framework like chicago boss > http://www.chicagoboss.org/ > I don't speak from experience by using chicago boss, but it is the closest > to what I actually use, which was developed in house and quite lightweight. > If you don't use a framework and just use a webserver, there will be a lot > of really unnecessary code in everything. > > Also take a look at erlydtl. Some people like nitrogen > http://nitrogenproject.com/ but their way of writing html is not my cup > of tea. > > > Sergej > > 2012/4/3 Kannan > >> Thanks Zheng for your suggestion. The application that we are building is >> a strong candidate for using a document database. As you, and others in >> private, mentioned, we will do a study on the suitability of Riak for our >> application. >> >> I appreciate the time you all have spend to give your inputs. >> >> Regards, >> Kannan. >> >> >> >> On Mon, Apr 2, 2012 at 9:38 PM, Zheng Zhibin wrote: >> >>> I would suggest to let Riak instead of MongoDB >>> >>> BR, >>> Zheng Zhibin >>> ???? iPhone >>> >>> ? 2012-4-2???4:30?Kannan ??? >>> >>> > Dear List, >>> > >>> > We are planning to build a social network -- certainly different from >>> FB -- using Linux/ YAWS / MongoDB / Erlang. We are looking at using Erlang >>> based Web frameworks too. >>> > >>> > If any body of you have similar experience in dealing with TBs of >>> data, dynamic scalability and the above mentioned stack, please be kind to >>> give your inputs. >>> > >>> > >>> > Thank you. >>> > >>> > Kannan. >>> > >>> > >>> > >>> > _______________________________________________ >>> > erlang-questions mailing list >>> > erlang-questions@REDACTED >>> > http://erlang.org/mailman/listinfo/erlang-questions >>> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From prof3ta@REDACTED Wed Apr 4 13:04:05 2012 From: prof3ta@REDACTED (Roberto Aloi) Date: Wed, 4 Apr 2012 13:04:05 +0200 Subject: [erlang-questions] Erlang based Web Stack In-Reply-To: References: Message-ID: Hi, there's a really accurate comparison among Erlang Web Frameworks at: https://github.com/evanmiller/ChicagoBoss/wiki/Comparison-of-Erlang-Web-Frameworks Cheers, Roberto Aloi @robertoaloi 2012/4/4 Kannan : > Thank you Serge. We are evaluating some frameworks and surely your input is > a good addition. Thanks you guys, all your inputs give us a great boost. > > Regards, > Kannan. > > > On Wed, Apr 4, 2012 at 11:32 AM, Rapsey wrote: >> >> I would suggest using a framework like chicago >> boss http://www.chicagoboss.org/ >> I don't speak from experience by using chicago boss, but it is the closest >> to what I actually use, which was developed in house and quite lightweight. >> If you don't use a framework and just use a webserver, there will be a lot >> of really unnecessary code in everything. >> >> Also take a look at erlydtl. Some people like >> nitrogen http://nitrogenproject.com/ but their way of writing html is not my >> cup of tea. >> >> >> Sergej >> >> 2012/4/3 Kannan >>> >>> Thanks Zheng for your suggestion. The application that we are building is >>> a strong candidate for using a document database. As you, and others in >>> private, mentioned, we will do a study on the suitability of Riak for our >>> application. >>> >>> I appreciate the time you all have spend to give your inputs. >>> >>> Regards, >>> Kannan. >>> >>> >>> >>> On Mon, Apr 2, 2012 at 9:38 PM, Zheng Zhibin wrote: >>>> >>>> I would suggest to let Riak instead of MongoDB >>>> >>>> BR, >>>> Zheng Zhibin >>>> ???? iPhone >>>> >>>> ? 2012-4-2???4:30?Kannan ??? >>>> >>>> > Dear List, >>>> > >>>> > We are planning to build a social network -- certainly different from >>>> > FB -- using Linux/ YAWS / MongoDB / Erlang. We are looking at using Erlang >>>> > based Web frameworks too. >>>> > >>>> > If any body of you have similar experience in dealing with TBs of >>>> > data, dynamic scalability and the above mentioned stack, please be kind to >>>> > give your inputs. >>>> > >>>> > >>>> > Thank you. >>>> > >>>> > Kannan. >>>> > >>>> > >>>> > >>>> > _______________________________________________ >>>> > erlang-questions mailing list >>>> > erlang-questions@REDACTED >>>> > http://erlang.org/mailman/listinfo/erlang-questions >>> >>> >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> >> > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Roberto Aloi --- Website: http://roberto-aloi.com Twitter: @robertoaloi From marc@REDACTED Wed Apr 4 13:12:13 2012 From: marc@REDACTED (Marc Worrell) Date: Wed, 4 Apr 2012 13:12:13 +0200 Subject: [erlang-questions] Erlang based Web Stack In-Reply-To: References: Message-ID: Hi, That comparison is behind regarding Zotonic. And I guess also regarding the other projects, as the last update was 5 months ago. And it is more a comparison of the features of Chicago Boss to the others, not the other way around. Some extra categories could be considered. But then, no comparison is ever complete. - Marc On 4 apr 2012, at 13:04, Roberto Aloi wrote: > Hi, > > there's a really accurate comparison among Erlang Web Frameworks at: > > https://github.com/evanmiller/ChicagoBoss/wiki/Comparison-of-Erlang-Web-Frameworks > > Cheers, > > Roberto Aloi > @robertoaloi > > 2012/4/4 Kannan : >> Thank you Serge. We are evaluating some frameworks and surely your input is >> a good addition. Thanks you guys, all your inputs give us a great boost. >> >> Regards, >> Kannan. >> >> >> On Wed, Apr 4, 2012 at 11:32 AM, Rapsey wrote: >>> >>> I would suggest using a framework like chicago >>> boss http://www.chicagoboss.org/ >>> I don't speak from experience by using chicago boss, but it is the closest >>> to what I actually use, which was developed in house and quite lightweight. >>> If you don't use a framework and just use a webserver, there will be a lot >>> of really unnecessary code in everything. >>> >>> Also take a look at erlydtl. Some people like >>> nitrogen http://nitrogenproject.com/ but their way of writing html is not my >>> cup of tea. >>> >>> >>> Sergej >>> >>> 2012/4/3 Kannan >>>> >>>> Thanks Zheng for your suggestion. The application that we are building is >>>> a strong candidate for using a document database. As you, and others in >>>> private, mentioned, we will do a study on the suitability of Riak for our >>>> application. >>>> >>>> I appreciate the time you all have spend to give your inputs. >>>> >>>> Regards, >>>> Kannan. >>>> >>>> >>>> >>>> On Mon, Apr 2, 2012 at 9:38 PM, Zheng Zhibin wrote: >>>>> >>>>> I would suggest to let Riak instead of MongoDB >>>>> >>>>> BR, >>>>> Zheng Zhibin >>>>> ???? iPhone >>>>> >>>>> ? 2012-4-2???4:30?Kannan ??? >>>>> >>>>>> Dear List, >>>>>> >>>>>> We are planning to build a social network -- certainly different from >>>>>> FB -- using Linux/ YAWS / MongoDB / Erlang. We are looking at using Erlang >>>>>> based Web frameworks too. >>>>>> >>>>>> If any body of you have similar experience in dealing with TBs of >>>>>> data, dynamic scalability and the above mentioned stack, please be kind to >>>>>> give your inputs. >>>>>> >>>>>> >>>>>> Thank you. >>>>>> >>>>>> Kannan. >>>>>> >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> erlang-questions mailing list >>>>>> erlang-questions@REDACTED >>>>>> http://erlang.org/mailman/listinfo/erlang-questions >>>> >>>> >>>> >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-questions >>>> >>> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > > > > -- > Roberto Aloi > --- > Website: http://roberto-aloi.com > Twitter: @robertoaloi > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From prof3ta@REDACTED Wed Apr 4 13:46:40 2012 From: prof3ta@REDACTED (Roberto Aloi) Date: Wed, 4 Apr 2012 13:46:40 +0200 Subject: [erlang-questions] Erlang based Web Stack In-Reply-To: References: Message-ID: Hi Marc, > That comparison is behind regarding Zotonic. > And I guess also regarding the other projects, as the last update was 5 months ago. True. I couldn't find any other so-detailed comparison, thought. It would probably be worth to update that page with the latest changes in the other frameworks. > And it is more a comparison of the features of Chicago Boss to the others, not the other way around. > Some extra categories could be considered. Well, that page belongs to the Chicago Boss project, so no big surprise about that. It's good that you made that point clear, though. > But then, no comparison is ever complete. I guess we should have a third-party one. Suggestion for a talk at the next Erlang Factory? ;) -- Roberto Aloi --- Website: http://roberto-aloi.com Twitter: @robertoaloi From marc@REDACTED Wed Apr 4 13:49:04 2012 From: marc@REDACTED (Marc Worrell) Date: Wed, 4 Apr 2012 13:49:04 +0200 Subject: [erlang-questions] Erlang based Web Stack In-Reply-To: References: Message-ID: <5D201C66-9A9B-4066-A5B4-8870566E49D7@worrell.nl> On 4 apr 2012, at 13:46, Roberto Aloi wrote: > I guess we should have a third-party one. Suggestion for a talk at the > next Erlang Factory? ;) Maybe we need a flow chart "if you want this then you should try that" :) The existing frameworks are quite complimentary. - Marc From zabrane3@REDACTED Wed Apr 4 13:56:06 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Wed, 4 Apr 2012 13:56:06 +0200 Subject: [erlang-questions] Erlang based Web Stack In-Reply-To: References: Message-ID: <4025530D-7B4A-4FD4-AEDE-0FA6017DE9F0@gmail.com> http://lenary.co.uk/erlang/2011/08/erlang-web-libraries/ Regards, Zabrane On Apr 4, 2012, at 1:46 PM, Roberto Aloi wrote: > Hi Marc, > >> That comparison is behind regarding Zotonic. >> And I guess also regarding the other projects, as the last update was 5 months ago. > > True. I couldn't find any other so-detailed comparison, thought. It > would probably be worth to update that page with the latest changes in > the other frameworks. > >> And it is more a comparison of the features of Chicago Boss to the others, not the other way around. >> Some extra categories could be considered. > > Well, that page belongs to the Chicago Boss project, so no big > surprise about that. It's good that you made that point clear, though. > >> But then, no comparison is ever complete. > > I guess we should have a third-party one. Suggestion for a talk at the > next Erlang Factory? ;) > > -- > Roberto Aloi > --- > Website: http://roberto-aloi.com > Twitter: @robertoaloi > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan@REDACTED Wed Apr 4 14:46:17 2012 From: ivan@REDACTED (Ivan Uemlianin) Date: Wed, 04 Apr 2012 13:46:17 +0100 Subject: [erlang-questions] Troll bait: If your code really matters, you'll write it in C++ In-Reply-To: References: Message-ID: <4F7C4299.5040009@llaisdy.com> On 03/04/2012 23:05, Richard O'Keefe wrote: >... > Jon Harrop of Flying Frog never tires of pointing out benchmarks > where a "managed" language produces code *faster* than C++. Interesting, thanks. His blog has a couple of examples of this: Boost's shared_ptr up to 10? slower than OCaml's garbage collection http://flyingfrogblog.blogspot.co.uk/2011/01/boosts-sharedptr-up-to-10-slower-than.html The "C++ renaissance" http://flyingfrogblog.blogspot.co.uk/2012/01/c-renaissance.html Best wishes Ivan -- ============================================================ Ivan A. Uemlianin Llaisdy Speech Technology Research and Development ivan@REDACTED www.llaisdy.com llaisdy.wordpress.com github.com/llaisdy www.linkedin.com/in/ivanuemlianin "Froh, froh! Wie seine Sonnen, seine Sonnen fliegen" (Schiller, Beethoven) ============================================================ From lukas@REDACTED Wed Apr 4 15:25:25 2012 From: lukas@REDACTED (Lukas Larsson) Date: Wed, 4 Apr 2012 15:25:25 +0200 Subject: [erlang-questions] Jenkins + dialyzer In-Reply-To: References: Message-ID: Hello! I use warnings parser which comes with jekins to parse the stdout log and generate warnings for a lot of tools. I'm sure it would be possible to do the same with dialyzer warnings if you know your regexp and Groovy! Lukas On Tue, Apr 3, 2012 at 10:20 AM, Kevin Albrecht wrote: > Does anyone have advice on integrating Dialyzer checks into Jenkins? > > Thanks, > Kevin Albrecht > http://www.kevinalbrecht.com/ > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From hynek@REDACTED Wed Apr 4 15:47:03 2012 From: hynek@REDACTED (Hynek Vychodil) Date: Wed, 4 Apr 2012 15:47:03 +0200 Subject: [erlang-questions] erlang.org site not updated with R15B-1 In-Reply-To: References: Message-ID: http://www.erlang.org/news/30 and download is there as usual. On Wed, Apr 4, 2012 at 9:22 AM, Vlad Dumitrescu wrote: > Hi, > > I'd like to point out that there is no notice and there are no > downloads for R15B-1 on the site. > > best regards, > Vlad > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- Hynek Vychodil BI consultant GoodData n?m?st? 28. ??jna 1104/17, 602 00, Brno - ?ern? Pole Office: ? +420 530 50 7704 E-mail: ?hynek@REDACTED Web: ? ? www.gooddata.com From francesquini@REDACTED Wed Apr 4 17:54:26 2012 From: francesquini@REDACTED (Emilio De Camargo Francesquini) Date: Wed, 4 Apr 2012 17:54:26 +0200 Subject: [erlang-questions] Reduction count Message-ID: Hello everyone, I am trying to find out more about the work distribution between the processes of my application. The number of reductions executed by a process is, among others, one of the things I am interested. So I am looking for a means of reading the number of reductions of a process when it exits. While it is be quite straightforward to get this kind of info while the processes is still executing, getting them just before (or rightly after) they exit is another story. I have looked all over the documentation, specially dbg:* functions, unfortunately, to no avail. Mostly because whenever I am notified about the exit of a process it is already too late to do anything about it. Changing the code of the entire application to read these values before the processes exit is unfeasible. Is there some way to do it other than diving into the VM code and instrumenting it? Thanks Emilio From tristan.sloughter@REDACTED Wed Apr 4 18:51:59 2012 From: tristan.sloughter@REDACTED (Tristan Sloughter) Date: Wed, 4 Apr 2012 09:51:59 -0700 Subject: [erlang-questions] Erlang based Web Stack In-Reply-To: <4025530D-7B4A-4FD4-AEDE-0FA6017DE9F0@gmail.com> References: <4025530D-7B4A-4FD4-AEDE-0FA6017DE9F0@gmail.com> Message-ID: My suggestion is Webmachine or Cowboy speaking only JSON with a heavy Javascript frontend, like Backbone.js, Spine.js or my favorite Batman.js This provides a lot of advantages, especially if you have people on the frontend who know html/css/javascript but don't want to deal with Erlang. Now they simply have a RESTful API to deal with and can develop on ahead using fixtures or a basic backend in any quick tool that can build REST apps like Sinatra or Node.js returning stock responses. Plus, you then are already ready to develop other interfaces besides a web frontend for you backend with no changes. And while I've fallen behind on keeping it going, I'm creating apps for using with Webmachine to make things faster when you know you are just dealing with JSON->Erlang https://github.com/tsloughter/maru Tristan On Wed, Apr 4, 2012 at 4:56 AM, Zabrane Mickael wrote: > http://lenary.co.uk/erlang/2011/08/erlang-web-libraries/ > > Regards, > Zabrane > > > On Apr 4, 2012, at 1:46 PM, Roberto Aloi wrote: > > Hi Marc, > > That comparison is behind regarding Zotonic. > > And I guess also regarding the other projects, as the last update was 5 > months ago. > > > True. I couldn't find any other so-detailed comparison, thought. It > would probably be worth to update that page with the latest changes in > the other frameworks. > > And it is more a comparison of the features of Chicago Boss to the others, > not the other way around. > > Some extra categories could be considered. > > > Well, that page belongs to the Chicago Boss project, so no big > surprise about that. It's good that you made that point clear, though. > > But then, no comparison is ever complete. > > > I guess we should have a third-party one. Suggestion for a talk at the > next Erlang Factory? ;) > > -- > Roberto Aloi > --- > Website: http://roberto-aloi.com > Twitter: @robertoaloi > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From g@REDACTED Wed Apr 4 19:49:55 2012 From: g@REDACTED (Garrett Smith) Date: Wed, 4 Apr 2012 12:49:55 -0500 Subject: [erlang-questions] Fear and Loathing in Programming La La Land In-Reply-To: References: Message-ID: Hi Richard, On Thu, Mar 29, 2012 at 2:32 AM, Richard O'Keefe wrote: > I'm to the Psychology of Programming Interest Group mailing list. > In a discussion of naming, reference was made to a body of work > containing > ? ? ? ?Usability Implications of Requiring Parameters > ? ? ? ?in Objects' Constructors > ? ? ? ?by Jeffrey Stylos of CMU > ? ? ? ?and Steven Clarke of Microsoft > at ? ? ?http://www.cs.cmu.edu/~NatProg/papers/Stylos2007CreateSetCall.pdf > > The abstract reads > ? ? ? ?The usability of APIs is increasingly important to programmer > ? ? ? ?productivity. ?Based on experience with usability studies of > ? ? ? ?specific APIs, techniques were explored for studying the usability > ? ? ? ?of design choices common to many APIs. ?A comparative study was > ? ? ? ?performed to assess how professional programmers use APIs with > ? ? ? ?required parameters in objects? constructors as opposed to > ? ? ? ?parameterless ?default? constructors. ?It was hypothesized that > ? ? ? ?required parameters would create more usable and self-documenting > ? ? ? ?APIs by guiding programmers toward the correct use of objects and > ? ? ? ?preventing errors. ?However, in the study, it was found that, > ? ? ? ?contrary to expectations, programmers strongly preferred and > ? ? ? ?were more effective with APIs that did not require constructor > ? ? ? ?parameters. ?Participants? behavior was analyzed using the > ? ? ? ?cognitive dimensions framework, and revealing that required > ? ? ? ?constructor parameters interfere with common learning strategies, > ? ? ? ?causing undesirable premature commitment. > > The study was done in 2005. > We're talking about the difference between > > ? ? ? ?fs = new FileReader("foo/bar.txt", Sharing.NONE); > ? ? ? ?ln = fs.ReadLine(); > ? ? ? ?... > > and > > ? ? ? ?fs = new FileReader(); > ? ? ? ?fs.SetFileName("foo/bar.txt"); > ? ? ? ?fs.SetSharing(Sharing.NONE); > ? ? ? ?ln = fs.ReadLine(); > ? ? ? ?... > > I think this is worth bringing up here because if functional programming > is about anything at all, it's certainly about NOT setting up a value one > field at a time! > A lengthy discussion has followed in which I've felt rather lonely. > I'm being beaten about the head for not noticing things in the study > that I did notice, and for being rather elitist. ?One quote: > > ? ? ? ?We don?t have the luxury of dismissing these types of programmers. > ? ? ? ?While it might strike you with terror that these programmers exist, > > It doesn't frighten me that they _exist_, > it frightens me that they are _programming_. This is study is understandable in light of this: To increase the usability of these and future APIs, and to improve the productivity of the programmers who use them, the *Visual Studio* User Experience group conducts user studies of APIs before they are finalized. My emphasis. Visual Studio has always been built on GUI features -- in particular object based "property sheets" [1]. I think this is one of drivers historically for "object oriented" development models -- they're pretty easy to build graphical tools around. Functional memes just require a text editor. It's hard to charge > $200 for a text editor. Java "beans" also work this way -- they are designed to fit neatly into graphical IDEs. You get this set of requirements based on the tooling: - Objects must be instantiated with a zero argument constructor -- that way IDEs can set them up easily in the UI - Modifications to the objects are made through property accessors -- also something easy to support in UI - Once configured by setting properties, objects can be used for whatever purpose they're designed It's no surprise at all to me that developers in these communities prefer zero arg constructors and property configuration. These are just two totally, totally different world views. Almost certainly dangerous to cross the streams [2]. Garrett [1] http://bit.ly/HhQ3Em [2] http://bit.ly/Hgr97q From gleber.p@REDACTED Wed Apr 4 21:28:44 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Wed, 4 Apr 2012 21:28:44 +0200 Subject: [erlang-questions] Erlang at Google Message-ID: Hello I believe there was once an Erlang Factory talk about some minor use of Erlang at Google in some side project. I can't find the link to that talk now, can you? Thanks, Gleb -------------- next part -------------- An HTML attachment was scrubbed... URL: From spawn.think@REDACTED Wed Apr 4 22:21:17 2012 From: spawn.think@REDACTED (Ahmed Omar) Date: Wed, 4 Apr 2012 22:21:17 +0200 Subject: [erlang-questions] Erlang at Google In-Reply-To: References: Message-ID: It was at Erlang User Conference 2010, Jacoby Thwaites used it for his 20% time project at Google http://www.erlang-factory.com/conference/ErlangUserConference2010/speakers/JacobyThwaites On Wed, Apr 4, 2012 at 9:28 PM, Gleb Peregud wrote: > Hello > > I believe there was once an Erlang Factory talk about some minor use of > Erlang at Google in some side project. I can't find the link to that talk > now, can you? > > Thanks, > Gleb > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From roberto@REDACTED Wed Apr 4 22:23:41 2012 From: roberto@REDACTED (Roberto Ostinelli) Date: Wed, 4 Apr 2012 13:23:41 -0700 Subject: [erlang-questions] current xml parsers In-Reply-To: <2956113b-1784-4c2c-bba1-f46a98437faf@knuth> References: <2956113b-1784-4c2c-bba1-f46a98437faf@knuth> Message-ID: thank you all for these precious inputs. :) r. On Tue, Mar 27, 2012 at 6:25 AM, Micha? Ptaszek < michal.ptaszek@REDACTED> wrote: > There was a bug in exml that has been fixed a couple of weeks > ago (buffer overflow in the NIF function), I tried it on WURFL > today and the results are as follows: > > {ok, XML} = file:read_file("/tmp/wurfl.xml"). > timer:tc(exml, parse, [XML]). > {3796645, > {ok,{xmlelement,<<"wurfl">>,[], > [{xmlcdata,<<"\n ">>}, > {xmlelement,<<"version">>,[], > [{xmlcdata,<<"\n ">>}, > {xmlelement,<<"ver">>,[], > [{xmlcdata,<<"2.3, > db.scientiamobile.c"...>>}]}, > {xmlcdata,<<"\n ">>}, > {xmlelement,<<"last_updated">>,[], > [{xmlcdata,<<"Thu Nov 17 > 18:01"...>>}]}, > {xmlcdata,<<"\n ">>}, > {xmlelement,<<"official_url">>,[], > [{xmlcdata,<<"http://w"...>>}]}, > {xmlcdata,<<"\n\t ">>}, > {xmlelement,<<"maintainers">>,[], > > [{xmlcdata,<<...>>},{xmlelement,...},{...}|...]}, > {xmlcdata,<<"\n\t ">>}, > ... > > Best regards, > Michal Ptaszek > > > ----- Original Message ----- > > I think I tried that lib once, because I had the requirement to parse > > WURFL > > http://wurfl.sourceforge.net/ > > It is a giant XML that has info about mobile devices. It worked fine > > with > > normal sized XMLs, but WURFL crashed it (and erlang along with it). > > > > > > Sergej > > > > On Mon, Mar 26, 2012 at 3:34 PM, Micha? Ptaszek < > > michal.ptaszek@REDACTED> wrote: > > > > > Hi Roberto, > > > > > > you might want to be interested in looking at exml: > > > it's a very simple NIF-based parser built around > > > expat library: > > > https://github.com/paulgray/exml > > > > > > Basing on some of the simple benchmarks of my own it > > > should be 2-3 times faster than xmerl. > > > > > > Best regards, > > > Michal Ptaszek > > > > > > ----- Original Message ----- > > > > Dear list, > > > > > > > > does someone have recent considerations on xml parsers in terms > > > > of > > > > memory > > > > footprint, parsing speed and stability? > > > > > > > > The ones I'm aware of are xmerl, erlsom [1] and the driver used > > > > in > > > > ejabberd > > > > (which unfortunately is GPL). > > > > > > > > I don't care about DTD validation. > > > > > > > > Thank you, > > > > > > > > r. > > > > > > > > [1] http://erlsom.sourceforge.net/erlsom.htm > > > > > > > > _______________________________________________ > > > > erlang-questions mailing list > > > > erlang-questions@REDACTED > > > > http://erlang.org/mailman/listinfo/erlang-questions > > > > > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questions@REDACTED > > > http://erlang.org/mailman/listinfo/erlang-questions > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From james@REDACTED Wed Apr 4 22:44:07 2012 From: james@REDACTED (james) Date: Wed, 04 Apr 2012 21:44:07 +0100 Subject: [erlang-questions] Troll bait: If your code really matters, you'll write it in C++ In-Reply-To: <4F7CAAE5.8000706@meetinghouse.net> References: <4F7AF320.4020601@meetinghouse.net> <4F7B55BE.2080000@mansionfamily.plus.com> <4F7B62FC.7090203@meetinghouse.net> <4F7CA805.9090803@mansionfamily.plus.com> <4F7CAAE5.8000706@meetinghouse.net> Message-ID: <4F7CB297.1010401@mansionfamily.plus.com> > A question here, though. As I understand it, AQMP is primarily used in the financial world, or at least particularly favored there. Is this true? And if so, which implementations are particularly popular? > Well, its hard to say. I've never seen it used, but then I don't work at JPMorgan. RedHat's sponsorship of Apache AMQP should help, but it doesn't seem widely used. I did have interest in it (from a 'bet I could write one of those' hobby perspective) but the history seems unfortunate and the very significant changes between the definition between 0.8, 0.9 and 1.0 don't bode well IMO. Maybe its a sleeper - its certainly nice to see something specified with a wire format rather than a borken API in a language you don't want to use (for everything). iMatix throwing their toys around and doing zeromq didn't help, though they seem to be having 'issues' with process on that too. Maybe it will gain some traction once there are multiple 1.0 broker and client implementations and a compatibility festival can be had the same way the IIOP CORBA compatibility was demonstrated. There are more Solace jobs on CWJobs than AMQP (more than zero isn't hard!). From janburse@REDACTED Wed Apr 4 23:24:04 2012 From: janburse@REDACTED (Jan Burse) Date: Wed, 04 Apr 2012 23:24:04 +0200 Subject: [erlang-questions] Fear and Loathing in Programming La La Land In-Reply-To: <4CBF96FC-146A-4611-806C-170DDA6B14B0@cs.otago.ac.nz> References: <2d0196bdcd67d52bf35e867014547278.squirrel@chasm.otago.ac.nz> <7555E388-0993-4133-8AFF-F9199891A83C@nexttolast.com> <4CBF96FC-146A-4611-806C-170DDA6B14B0@cs.otago.ac.nz> Message-ID: <4F7CBBF4.3000104@fastmail.fm> Richard O'Keefe schrieb: > Continuing with the file stream example, it*might* make sense for > > r := FileReader new. > r read: 'foo/bar.txt'. > > to work by initially connecting r to /dev/null and having #read: be > like C's freopen(): close the current connection and establish a new > one. That would be default-but-FULL-initialisation, not partial > initialisation. It is possible to make even more pathological examples. Assume we have a dictionary, where we place key-value pairs. Further assume that the dictionary uses the hash function of the key to organize its data. The dictionary can be imparied by using a setter on a key after a key-value pair has been put into the dictionary. A hash based dictionary is for example the HashMap class in Java. So assume our keys are: class myKey { int alfa; int beta; int hashCode() { return alfa*31+beta; } void setAlfa(int a) { alfa=a; } void setBeta(int b) { beta=b; } /* getter */ } Then what result should the following code give? myKey mykey = new myKey(); mykey.setAlfa(123); mykey.setBeta(456); HashMap map=new HashMap(); map.put(mykey,"Hello World!"); mykey.setBeta(789); Systen.out.println("map.get(mykey)="+map.get(mykey)); Actually it turns out that the HashMap is not that impaird, since in JDK 1.7 (maybe already in previous versions), the hash is computed once and then stored inside the dictionary. The Entry has a separate hash field: class Entry { int hash; <<< here Object key; Object value; Entry next; ... } But generally there are two dimensions that now determine how the setter/getters should be designed of an object. We have already seen the synchronized/ unsynchronized dimension. When an object does not leak a thread, no synchronization is needed. An additional dimension is the muttable/immutable category. Sometimes it can be desirable to make an object immutable. The easiest to make an object immutable is to not provide any setters. So basically we have the following matrice: +---------------------------------+ | Sync | Unsync | +-----------+---------------+-----------------+ | Mutable | Sync Getter | Getter | | | Sync Setter | Setter | +-----------+---------------+-----------------+ | Immutable | Sync Getter | Getter | | | No Setter | No Setter | +-----------+---------------------------------+ But how does an immutable object get its attribute values when it doesn't have setters? Well one solution is to have a (public) constructor. So we could provide a class that corresponds to the above myKey class, but that is immutable: class myKeyImmutableByConstructor { int alfa; int beta; myKeyImmutableByConstructor(int a, int b) { alfa = a; beta = b; } /* getter */ } An other approach is to have both a mutable object class and an immutable object class. And then create the immutable object from the mutable object: class myKeyImmutableByCopy { int alfa; int beta; myKeyImmutableByCopy(myKey k) { alfa = k.getAlfa(); beta = k.getBeta(); } /* getter */ } There are a lot of variations to the above them. But bottom line is that in Java there are a lot of immutable classes or semi immutable classes on purpose. A wide class of immutable classes are value objects. Classes such as Complex that bundle a pair of reals come to mind. But the Java runtime system has already a couple of value objects: String BigInteger BigDecimal File URL The above are all immutable and don't have setters. Microsoft should know about immutables. C# has the readonly keyword. And in F# fields are by default immutable, one needs the mutable keyword for the reverse. In Java the immutable stuff works since it has information hinding. There are the modifiers public, private, etc.. If a field is private it cannot be accessed from the outside, putting aside special reflection which overrides modifiers and native code. Now the question is why does the paper "Usability Implications of Requiring Parameter in Objects' Constructors" not address the idea of immutable objects. Eventually there is a problem when they want to cover C++. On wikipedia one can read: Notice that in C++ it is not necessary ? and in fact impossible ? to provide a specialized constructor for const instances. I am not an expert for C++, but when the above is true, then it is clear why setters are needed and everything goes havoc. For example Java doesn't have the above restriction, an immutable object can have multiple constructors: class myKeyImmutableByConstructor { int alfa; int beta; myKeyImmutableByConstructor(int a, int b) { alfa = a; beta = b; } myKeyImmutableByConstructor() { alfa = 0; beta = 0; } } The above solves the problem of convenience and evolvability: - Convenience: Shorter constructors can be defined and co-exist for convenience. - Evolvability: Newer longer constructores can be defined and co-exist for evolvability. For example to cover late requirements or simply new attributes that are added over the time. So I guess it is invalid when the study says: "Based on a study of 30 programmers of three different personas, we have found that APIs that required constructor parameters did not prevent errors as expected and that APIs that instead used the create- set-call pattern of object construction were more usable." In the sense that their results are not applicable to Java, since this would mean comparing apples with oranges. And in general that their results make a too broad generalization from MS APIs to APIs in general. At least if one is not careful in reading the paper, one might get the impression that something is said about APIs in general. But such a study woud require a broader testing of different API approaches. Bye From comptekki@REDACTED Thu Apr 5 00:01:05 2012 From: comptekki@REDACTED (Wes James) Date: Wed, 4 Apr 2012 16:01:05 -0600 Subject: [erlang-questions] error compiling R14B04 on snow leopard Message-ID: I'm trying to compile erlang R14B04 on snow leopard, but I'm getting this error. Is there something I can do to fix this? gcc -mdynamic-no-pic -m32 -g -O3 -fomit-frame-pointer -I/usr/local/src/otp_src_R14B04/erts/i386-apple-darwin10.8.0 -no-cpp-precomp -I/opt/local/include -D_XOPEN_SOURCE -DERTS_SMP -DHAVE_CONFIG_H -Wall -Wstrict-prototypes -Wmissing-prototypes -Wdeclaration-after-statement -DUSE_THREADS -D_THREAD_SAFE -D_REENTRANT -DPOSIX_THREADS -Ii386-apple-darwin10.8.0/opt/smp -Ibeam -Isys/unix -Isys/common -Ii386-apple-darwin10.8.0 -Izlib -Ipcre -Ihipe -I../include -I../include/i386-apple-darwin10.8.0 -I../include/internal -I../include/internal/i386-apple-darwin10.8.0 -c beam/erl_bif_re.c -o obj/i386-apple-darwin10.8.0/opt/smp/erl_bif_re.o beam/erl_bif_re.c: In function 'erts_init_bif_re': beam/erl_bif_re.c:67: error: 'erts_pcre_malloc' undeclared (first use in this function) beam/erl_bif_re.c:67: error: (Each undeclared identifier is reported only once beam/erl_bif_re.c:67: error: for each function it appears in.) beam/erl_bif_re.c:68: error: 'erts_pcre_free' undeclared (first use in this function) beam/erl_bif_re.c:69: error: 'erts_pcre_stack_malloc' undeclared (first use in this function) beam/erl_bif_re.c:70: error: 'erts_pcre_stack_free' undeclared (first use in this function) beam/erl_bif_re.c: In function 'build_compile_result': beam/erl_bif_re.c:397: warning: implicit declaration of function 'erts_pcre_fullinfo' beam/erl_bif_re.c:402: warning: implicit declaration of function 'erts_pcre_free' beam/erl_bif_re.c: In function 're_compile_2': beam/erl_bif_re.c:456: warning: implicit declaration of function 'erts_pcre_compile2' beam/erl_bif_re.c:457: warning: assignment makes pointer from integer without a cast beam/erl_bif_re.c: In function 'cleanup_restart_context': beam/erl_bif_re.c:506: warning: implicit declaration of function 'erts_pcre_free_restart_data' beam/erl_bif_re.c: In function 'build_capture': beam/erl_bif_re.c:815: warning: implicit declaration of function 'erts_pcre_get_stringnumber' beam/erl_bif_re.c: In function 're_run_3': beam/erl_bif_re.c:903: warning: assignment makes pointer from integer without a cast beam/erl_bif_re.c:981: error: 'PCRE_EXTRA_LOOP_LIMIT' undeclared (first use in this function) beam/erl_bif_re.c:983: error: 'pcre_extra' has no member named 'loop_limit' beam/erl_bif_re.c:986: error: 'pcre_extra' has no member named 'loop_limit' beam/erl_bif_re.c:987: error: 'pcre_extra' has no member named 'loop_limit' beam/erl_bif_re.c:990: error: 'pcre_extra' has no member named 'restart_data' beam/erl_bif_re.c:991: error: 'pcre_extra' has no member named 'restart_flags' beam/erl_bif_re.c:992: error: 'pcre_extra' has no member named 'loop_counter_return' beam/erl_bif_re.c:1056: warning: implicit declaration of function 'erts_pcre_exec' beam/erl_bif_re.c:1060: error: 'PCRE_ERROR_LOOP_LIMIT' undeclared (first use in this function) beam/erl_bif_re.c: In function 're_exec_trap': beam/erl_bif_re.c:1115: error: 'pcre_extra' has no member named 'loop_limit' beam/erl_bif_re.c:1118: error: 'pcre_extra' has no member named 'loop_limit' beam/erl_bif_re.c:1119: error: 'pcre_extra' has no member named 'loop_limit' beam/erl_bif_re.c:1121: error: 'pcre_extra' has no member named 'loop_counter_return' beam/erl_bif_re.c:1122: error: 'pcre_extra' has no member named 'restart_data' beam/erl_bif_re.c:1123: error: 'pcre_extra' has no member named 'restart_flags' beam/erl_bif_re.c:1131: error: 'PCRE_ERROR_LOOP_LIMIT' undeclared (first use in this function) make[3]: *** [obj/i386-apple-darwin10.8.0/opt/smp/erl_bif_re.o] Error 1 make[2]: *** [opt] Error 2 make[1]: *** [smp] Error 2 make: *** [emulator] Error 2 In the mean time, I'll try the erlang solutions version. Thanks, Wes From matthias@REDACTED Thu Apr 5 00:13:34 2012 From: matthias@REDACTED (Matthias Lang) Date: Thu, 5 Apr 2012 00:13:34 +0200 Subject: [erlang-questions] how to flush a gen_tcp socket on close? In-Reply-To: References: <201204021930.q32JU6GE055083@pluto.hedeland.org> Message-ID: <20120404221334.GA3266@corelatus.se> On Tuesday, April 03, Andreas Schultz wrote: > In my case the receiver is to slow to process all the data, sender > does 10k packets of 1k size, the receiver only gets the first 2000 > packets. It might well be that I hit the close timeout and inet > discards the rest of the send queue. Ok, that's something to go on. I had a go at reproducing what you're doing based on that description. I see something unexpected which seems similar to what you reported. The output of my program (at the bottom of this mail) running on R15B is: 30> as_tcp:go(). calling close on TX at {23,35,35} read 1000 octets read 1000 octets read 1000 octets read 1000 octets read 1000 octets read 1000 octets read 1000 octets read 1000 octets read 1000 octets close returned at {23,35,45}, 10002ms later ok read 1000 octets 31> =ERROR REPORT==== 4-Apr-2012::23:35:45 === Error in process <0.120.0> with exit value: {{badmatch,{error,closed}},[{as_tcp,slow_read,1,[{file,"as_tcp.erl"},{line,31}]}]} I had a bit of a dig in prim_inet.erl. It sounds like you've looked there too. That code looks like it's intended to loop 'forever' trying to send the queued data, as long as some progress is made every so often (always sends at least something in every 5s timeout period). But running my program suggests that isn't happening as intended. Instrumenting prim_inet, it looks like the {subs_empty_out_q,0 } message is coming up from inet_drv.c even though the queue isn't empty. Looking in there, I noticed this: static void tcp_inet_flush(ErlDrvData e) { tcp_descriptor* desc = (tcp_descriptor*)e; if (!(desc->inet.event_mask & FD_WRITE)) { /* Discard send queue to avoid hanging port (OTP-7615) */ tcp_clear_output(desc); } } but I think that change was introduced sometime after R11B-5, and R11B-5 fails the same way. So probably a red herring. Out of time looking at this for now. > The fix should be simple, limit the send queue size. To what? Zero seems to be the only value that will work even for arbitrarily slow clients. And that defeats the point of having a send queue. --- A likely _workaround_ is to call inet:getstat(Tx, [send_pend]) if the answer is zero, then you know that you can call close() without _erlang_ tossing data. I haven't tried this. --- It's late, I might have outsmarted myself, but my current feeling is that erlang is quietly tossing data and it shouldn't be. Waiting for as long as it takes in close() seems like the right thing, though Per might disagree. Waiting for N seconds in close() and then returning an error if the queue didn't empty would also be better than just quietly tossing it. (And: yes, I know, application-level ACKs would avoid this problem. But I'm not quite ready to say that this problem can't be fixed.) Matt ---------------------------------------------------------------------- %% Throwaway module: attempt to reproduce TCP problem reported to %% erlang-questions 2012-04-02 by Andreas Schultz. %% %% He elaborated on 2012-04-04: gen_tcp drops data when close is called %% with data buffered if the receiver is sufficiently slow. -module(as_tcp). -export([go/0]). go() -> {ok, L} = gen_tcp:listen(0, [{active, false}, binary]), {ok, Portno} = inet:port(L), {ok, Tx} = gen_tcp:connect(localhost, Portno, []), {ok, Rx} = gen_tcp:accept(L), ok = gen_tcp:close(L), One_hundred_k = list_to_binary(lists:duplicate(100000, 0)), ok = gen_tcp:send(Tx, [lists:duplicate(40, One_hundred_k), "end of data"]), spawn(fun() -> slow_read(Rx) end), io:fwrite("calling close on TX at ~p\n", [time()]), Before = now(), ok = gen_tcp:close(Tx), After = now(), io:fwrite("close returned at ~p, ~pms later\n", [time(), timer:now_diff(After, Before) div 1000]), ok = gen_tcp:close(Rx). slow_read(Rx) -> {ok, _Bin} = gen_tcp:recv(Rx, 10000), timer:sleep(1000), io:fwrite("read 1000 octets\n"), slow_read(Rx). From janburse@REDACTED Thu Apr 5 01:50:42 2012 From: janburse@REDACTED (Jan Burse) Date: Thu, 05 Apr 2012 01:50:42 +0200 Subject: [erlang-questions] Fear and Loathing in Programming La La Land In-Reply-To: References: Message-ID: <4F7CDE52.6030903@fastmail.fm> Garrett Smith schrieb: > It's no surprise at all to me that developers in these communities > prefer zero arg constructors and property configuration. > > These are just two totally, totally different world views. Almost > certainly dangerous to cross the streams [2]. > > Garrett Either you are relatively young that you don't know, or you haven't been around much. Widgets with attributes are in existence before Visual C and Java. For example we find <1988 the Athena Widget set for X11 (*). These Widget sets have a different kind of API. For the programmer there are generic constructors and generic setters, which make use of varargs. These varargs are supposed to be lists of key value pairs. createXXX(.., KEY1, VALUE1, ..., KEYn, VALUEn). set(.., KEY1, VALUE1, ..., KEYn, VALUEn). Since widgets have a state and are supposed to be muttable, it is perfectly valid to have setters beside an initial constructor. The setters can be used to change the features of the widgets in the course of the interaction with the end-user in the user interface. There existence is not determined by some GUI builders. I don't think we can make a case against setters. But we can make a case against the research paper that has spun this thread: varargs are a third option in creating an API. But I guess there are possibly even further options, maybe already found in some widget sets for X11, that come with their own programming paradigms. Not sure. (**) Bye (*) X Toolkit - Intrinsics & Athena Widgets by McCormack, Asente, Swick, & Weissman ISBN 0-929306-04-X, 1988 http://www.silicon-press.com/books/isbn.0-929306-04-X/index.html (**) Here is a furth approach, its not X11, its QNX. Building an array, and passing it. The array holds key, value-ptr, value-size tripples: PtSetArg(&args[0], Pt_ARG_TEXT_STRING, "Press to exit", 0); PtCreateWidget(PtButton, window, 1, args); http://www.qnx.com/developers/docs/qnx_4.25_docs/photon114/prog_guide/nonphab.html From kenji.rikitake@REDACTED Thu Apr 5 02:12:03 2012 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Thu, 5 Apr 2012 09:12:03 +0900 Subject: [erlang-questions] Unofficial FreeBSD Port for R15B01 Message-ID: <20120405001203.GB84356@k2r.org> This time I decided to put it on GitHub. https://github.com/jj1bdx/erlang-freebsd-port I've tagged it as R15B01 as the initial version. Regards, Kenji Rikitake From g@REDACTED Thu Apr 5 02:21:37 2012 From: g@REDACTED (Garrett Smith) Date: Wed, 4 Apr 2012 19:21:37 -0500 Subject: [erlang-questions] Fear and Loathing in Programming La La Land In-Reply-To: <4F7CDE52.6030903@fastmail.fm> References: <4F7CDE52.6030903@fastmail.fm> Message-ID: On Wed, Apr 4, 2012 at 6:50 PM, Jan Burse wrote: > Garrett Smith schrieb: > >> It's no surprise at all to me that developers in these communities >> prefer zero arg constructors and property configuration. >> >> These are just two totally, totally different world views. Almost >> certainly dangerous to cross the streams [2]. >> >> Garrett > > > Either you are relatively young that you don't > know, or you haven't been around much. Alas, I wish I was younger. Upside is that I've learned manners along the way. As for being around, I ran a Java tools product line back in the nineties and can assure you that GUI tools drive underlying software design. Like it or not. > Widgets with attributes are in existence before > Visual C and Java. For example we find <1988 the > Athena Widget set for X11 (*). > > These Widget sets have a different kind of API. > For the programmer there are generic constructors > and generic setters, which make use of varargs. > These varargs are supposed to be lists of key > value pairs. > > ? ?createXXX(.., KEY1, VALUE1, ..., KEYn, VALUEn). > > ? ?set(.., KEY1, VALUE1, ..., KEYn, VALUEn). > > Since widgets have a state and are supposed to be > muttable, it is perfectly valid to have setters > beside an initial constructor. > > The setters can be used to change the features of > the widgets in the course of the interaction with > the end-user in the user interface. There existence > is not determined by some GUI builders. > > I don't think we can make a case against setters. > But we can make a case against the research paper > that has spun this thread: varargs are a third option > in creating an API. > > But I guess there are possibly even further options, > maybe already found in some widget sets for X11, that > come with their own programming paradigms. > Not sure. (**) I'm quite happy with the functional model. I think the rather horrible practice of creating an object, manipulating its properties, and then setting it lose on the world by calling methods is a recipe for Really Bad Software. If the study had targeted F# developers, it might have had another result. Perhaps there are some amazing graphical tools in support of that language. I haven't used it. Regardless, my point was that tools drive developer models. It's unfortunate I think in this case. But I think it's a sound explanation for the paper's findings. Garrett From ok@REDACTED Thu Apr 5 02:39:32 2012 From: ok@REDACTED (Richard O'Keefe) Date: Thu, 5 Apr 2012 12:39:32 +1200 Subject: [erlang-questions] Fear and Loathing in Programming La La Land In-Reply-To: <4F7CDE52.6030903@fastmail.fm> References: <4F7CDE52.6030903@fastmail.fm> Message-ID: On 5/04/2012, at 11:50 AM, Jan Burse wrote: > I don't think we can make a case against setters. The thing is that the interface needs to be designed based on the needs of clients; what is the thing _for_? A lot of existing Smalltalk code is riddled with setters, perhaps because of the ideology called 'self-encapsulation' which says that an object should even get or set its *own* fields directly, but always through getters and setters so that they can be overridden in subclasses &c. For me, the question is always "does it make sense for *client* code to change *just* this one property." I have consistently found that it pays to remove every other setter. For example, if you look at the Simulation example in the Smalltalk Blue Book, you'll find numerical integrators with plenty of setters. Taking those out led to a cleaner design, in which integrators could be applied as functions, and in which it was possible to compute integrals in parallel. > But we can make a case against the research paper > that has spun this thread: varargs are a third option > in creating an API. Varargs, Python-style dictionaries, JSON objects, XML, ..., Prolog and Erlang option lists, ... If you look at the OpenJDK Parser class, you'll see that it uses a Factory object and the Factory object has a Context parameter holding all sorts of stuff. A particularly noteworthy example of 'Configuration Parameter' is the POSIX threads interface, where for each pthread_FOO major type there is a pthread_FOO_attr type; you initialise an attribute object, set any fields you like (OK, because it _is_ at this stage just a loose bundle of properties), and then pass it to the creation function for pthread_FOO. What this does is to make the set of configuration options *open*, so that different implementations can add different extensions, and new versions of the standard can add new options, both of which have happened. The alternating keys and values thing was found in SunView. From toby@REDACTED Thu Apr 5 04:39:26 2012 From: toby@REDACTED (Toby Thain) Date: Wed, 04 Apr 2012 22:39:26 -0400 Subject: [erlang-questions] 0mq - Re: Troll bait: If your code really matters, you'll write it in C++ In-Reply-To: <4F7CB297.1010401@mansionfamily.plus.com> References: <4F7AF320.4020601@meetinghouse.net> <4F7B55BE.2080000@mansionfamily.plus.com> <4F7B62FC.7090203@meetinghouse.net> <4F7CA805.9090803@mansionfamily.plus.com> <4F7CAAE5.8000706@meetinghouse.net> <4F7CB297.1010401@mansionfamily.plus.com> Message-ID: <4F7D05DE.9000702@telegraphics.com.au> On 04/04/12 4:44 PM, james wrote: >> A question here, though. As I understand it, AQMP is primarily used in >> the financial world, or at least particularly favored there. Is this >> true? And if so, which implementations are particularly popular? >> > > Well, its hard to say. I've never seen it used, but then I don't work at > JPMorgan. RedHat's sponsorship of Apache AMQP should help, but it > doesn't seem widely used. > > I did have interest in it (from a 'bet I could write one of those' hobby > perspective) but the history seems unfortunate and the very significant > changes between the definition between 0.8, 0.9 and 1.0 don't bode well > IMO. Maybe its a sleeper - its certainly nice to see something specified > with a wire format rather than a borken API in a language you don't want > to use (for everything). iMatix throwing their toys around and doing > zeromq didn't help, though they seem to be having 'issues' with process > on that too. > > Maybe it will gain some traction once there are multiple 1.0 broker and > client implementations and a compatibility festival can be had the same > way the IIOP CORBA compatibility was demonstrated. Pardon me butting in from an uninformed perspective, but isn't 0mq highly regarded in this area? --Toby > > There are more Solace jobs on CWJobs than AMQP (more than zero isn't > hard!). > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From mfidelman@REDACTED Thu Apr 5 04:59:15 2012 From: mfidelman@REDACTED (Miles Fidelman) Date: Wed, 04 Apr 2012 22:59:15 -0400 Subject: [erlang-questions] problems with trapexit.org? Message-ID: <4F7D0A83.9090304@meetinghouse.net> Anybody else having problems reaching trapexit.org? -- In theory, there is no difference between theory and practice. In practice, there is. .... Yogi Berra From comptekki@REDACTED Thu Apr 5 05:00:58 2012 From: comptekki@REDACTED (Wes James) Date: Wed, 4 Apr 2012 21:00:58 -0600 Subject: [erlang-questions] problems with trapexit.org? In-Reply-To: <4F7D0A83.9090304@meetinghouse.net> References: <4F7D0A83.9090304@meetinghouse.net> Message-ID: Can't get there from Utah, USA.... -wes On Wed, Apr 4, 2012 at 8:59 PM, Miles Fidelman wrote: > Anybody else having problems reaching trapexit.org? > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ngocdaothanh@REDACTED Thu Apr 5 05:09:33 2012 From: ngocdaothanh@REDACTED (Ngoc Dao) Date: Thu, 5 Apr 2012 12:09:33 +0900 Subject: [erlang-questions] problems with trapexit.org? In-Reply-To: References: <4F7D0A83.9090304@meetinghouse.net> Message-ID: phpBB : Critical Error Could not connect to the database On Thu, Apr 5, 2012 at 12:00 PM, Wes James wrote: > Can't get there from Utah, USA.... > > -wes > > > On Wed, Apr 4, 2012 at 8:59 PM, Miles Fidelman > wrote: >> >> Anybody else having problems reaching trapexit.org? >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From mfidelman@REDACTED Thu Apr 5 05:13:20 2012 From: mfidelman@REDACTED (Miles Fidelman) Date: Wed, 04 Apr 2012 23:13:20 -0400 Subject: [erlang-questions] research program into scaling erlang? Message-ID: <4F7D0DD0.1020402@meetinghouse.net> I seem to recall reading about a multi-sponsor research program that was looking at scaling Erlang to lots of nodes, along with some related issues. Maybe at INRIA? I can't seem to find the reference. Anybody able to point me in the right direction? (I thought I'd saved it away, but what I thought was the link gives me a 404 error (can't search the erlang-questions archive right now - trapexit seems to be down.) Thanks! Miles Fidelman -- In theory, there is no difference between theory and practice. In practice, there is. .... Yogi Berra From jack@REDACTED Thu Apr 5 05:57:36 2012 From: jack@REDACTED (Jack Moffitt) Date: Wed, 4 Apr 2012 21:57:36 -0600 Subject: [erlang-questions] research program into scaling erlang? In-Reply-To: <4F7D0DD0.1020402@meetinghouse.net> References: <4F7D0DD0.1020402@meetinghouse.net> Message-ID: > I can't seem to find the reference. ?Anybody able to point me in the right > direction? ?(I thought I'd saved it away, but what I thought was the link > gives me a 404 error (can't search the erlang-questions archive right now - > trapexit seems to be down.) Kostis gave an update on this work at Erlang Factory SF. You can see the abstract listed here: http://www.erlang-factory.com/conference/SFBay2012/speakers/KostisSagonas Unfortunately it does not have a reference, but I'm sure the slides will be up soon. jack. From mjtruog@REDACTED Thu Apr 5 06:00:43 2012 From: mjtruog@REDACTED (Michael Truog) Date: Wed, 04 Apr 2012 21:00:43 -0700 Subject: [erlang-questions] research program into scaling erlang? In-Reply-To: <4F7D0DD0.1020402@meetinghouse.net> References: <4F7D0DD0.1020402@meetinghouse.net> Message-ID: <4F7D18EB.9040607@gmail.com> On 04/04/2012 08:13 PM, Miles Fidelman wrote: > I seem to recall reading about a multi-sponsor research program that was looking at scaling Erlang to lots of nodes, along with some related issues. Maybe at INRIA? > > I can't seem to find the reference. Anybody able to point me in the right direction? (I thought I'd saved it away, but what I thought was the link gives me a 404 error (can't search the erlang-questions archive right now - trapexit seems to be down.) > > Thanks! > > Miles Fidelman > You are looking for the discussion here: http://groups.google.com/group/erlang-programming/msg/4eb315731e19f2e6 That has the links here: http://www.release-project.eu/ http://www.release-project.eu/documents/RELEASEfactsheetv6.pdf -------------- next part -------------- An HTML attachment was scrubbed... URL: From mfidelman@REDACTED Thu Apr 5 06:50:13 2012 From: mfidelman@REDACTED (Miles Fidelman) Date: Thu, 05 Apr 2012 00:50:13 -0400 Subject: [erlang-questions] research program into scaling erlang? - THANKS! In-Reply-To: References: <4F7D0DD0.1020402@meetinghouse.net> Message-ID: <4F7D2485.9050608@meetinghouse.net> Michael Truog wrote: > On 04/04/2012 08:13 PM, Miles Fidelman wrote: >> I seem to recall reading about a multi-sponsor research program that >> was looking at scaling Erlang to lots of nodes, along with some >> related issues. Maybe at INRIA? > You are looking for the discussion here: > http://groups.google.com/group/erlang-programming/msg/4eb315731e19f2e6 > > That has the links here: > http://www.release-project.eu/ > > > http://www.release-project.eu/documents/RELEASEfactsheetv6.pdf > and Jack Moffitt wrote: > Kostis gave an update on this work at Erlang Factory SF. You can see > the abstract listed here: > http://www.erlang-factory.com/conference/SFBay2012/speakers/KostisSagonas > > Unfortunately it does not have a reference, but I'm sure the slides > will be up soon. > Thanks guys - that's what I was looking for. Sort of embarrassing that I couldn't find it, in that I kicked off the original thread. Sigh... Sure would like to see some details. Cheers, Miles -- In theory, there is no difference between theory and practice. In practice, there is. .... Yogi Berra From k4t3r1n4@REDACTED Thu Apr 5 08:38:42 2012 From: k4t3r1n4@REDACTED (Katerina Roukounaki) Date: Thu, 5 Apr 2012 09:38:42 +0300 Subject: [erlang-questions] 0mq - Re: Troll bait: If your code really matters, you'll write it in C++ In-Reply-To: <4F7D05DE.9000702@telegraphics.com.au> References: <4F7AF320.4020601@meetinghouse.net> <4F7B55BE.2080000@mansionfamily.plus.com> <4F7B62FC.7090203@meetinghouse.net> <4F7CA805.9090803@mansionfamily.plus.com> <4F7CAAE5.8000706@meetinghouse.net> <4F7CB297.1010401@mansionfamily.plus.com> <4F7D05DE.9000702@telegraphics.com.au> Message-ID: <5688EDD2-3A65-4065-8239-58D298E420D9@gmail.com> Toby, I was going to ask the same thing... This is a post by Pieter Hitjens. He is the CEO of iMatix, a company that was among the original designers of AMQP and later built 0MQ. http://lists.openamq.org/pipermail/openamq-dev/2010-March/001598.html Katerina On Apr 5, 2012, at 5:39 AM, Toby Thain wrote: > On 04/04/12 4:44 PM, james wrote: >>> A question here, though. As I understand it, AQMP is primarily used in >>> the financial world, or at least particularly favored there. Is this >>> true? And if so, which implementations are particularly popular? >>> >> >> Well, its hard to say. I've never seen it used, but then I don't work at >> JPMorgan. RedHat's sponsorship of Apache AMQP should help, but it >> doesn't seem widely used. >> >> I did have interest in it (from a 'bet I could write one of those' hobby >> perspective) but the history seems unfortunate and the very significant >> changes between the definition between 0.8, 0.9 and 1.0 don't bode well >> IMO. Maybe its a sleeper - its certainly nice to see something specified >> with a wire format rather than a borken API in a language you don't want >> to use (for everything). iMatix throwing their toys around and doing >> zeromq didn't help, though they seem to be having 'issues' with process >> on that too. >> >> Maybe it will gain some traction once there are multiple 1.0 broker and >> client implementations and a compatibility festival can be had the same >> way the IIOP CORBA compatibility was demonstrated. > > Pardon me butting in from an uninformed perspective, but isn't 0mq highly regarded in this area? > > --Toby > >> >> There are more Solace jobs on CWJobs than AMQP (more than zero isn't >> hard!). >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From vasdeveloper@REDACTED Thu Apr 5 09:17:19 2012 From: vasdeveloper@REDACTED (Kannan) Date: Thu, 5 Apr 2012 12:47:19 +0530 Subject: [erlang-questions] Erlang based Web Stack In-Reply-To: References: <4025530D-7B4A-4FD4-AEDE-0FA6017DE9F0@gmail.com> Message-ID: Thanks guys, that is a lot of input. How is the support of OTP for multimedia content manipulation, transcoding etc? Or you advice to do it at the C level and communicate it to Erlang? Also, if someone has already invented the wheel of how good Erlang is compared to PHP, please share it with us. We would like to have a mega site purely on Erlang and C. Thank you. On Wed, Apr 4, 2012 at 10:21 PM, Tristan Sloughter < tristan.sloughter@REDACTED> wrote: > My suggestion is Webmachine or Cowboy speaking only JSON with a heavy > Javascript frontend, like Backbone.js, Spine.js or my favorite Batman.js > > This provides a lot of advantages, especially if you have people on the > frontend who know html/css/javascript but don't want to deal with Erlang. > Now they simply have a RESTful API to deal with and can develop on ahead > using fixtures or a basic backend in any quick tool that can build REST > apps like Sinatra or Node.js returning stock responses. Plus, you then are > already ready to develop other interfaces besides a web frontend for you > backend with no changes. > > And while I've fallen behind on keeping it going, I'm creating apps for > using with Webmachine to make things faster when you know you are just > dealing with JSON->Erlang https://github.com/tsloughter/maru > > Tristan > > On Wed, Apr 4, 2012 at 4:56 AM, Zabrane Mickael wrote: > >> http://lenary.co.uk/erlang/2011/08/erlang-web-libraries/ >> >> Regards, >> Zabrane >> >> >> On Apr 4, 2012, at 1:46 PM, Roberto Aloi wrote: >> >> Hi Marc, >> >> That comparison is behind regarding Zotonic. >> >> And I guess also regarding the other projects, as the last update was 5 >> months ago. >> >> >> True. I couldn't find any other so-detailed comparison, thought. It >> would probably be worth to update that page with the latest changes in >> the other frameworks. >> >> And it is more a comparison of the features of Chicago Boss to the >> others, not the other way around. >> >> Some extra categories could be considered. >> >> >> Well, that page belongs to the Chicago Boss project, so no big >> surprise about that. It's good that you made that point clear, though. >> >> But then, no comparison is ever complete. >> >> >> I guess we should have a third-party one. Suggestion for a talk at the >> next Erlang Factory? ;) >> >> -- >> Roberto Aloi >> --- >> Website: http://roberto-aloi.com >> Twitter: @robertoaloi >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From richardprideauxevans@REDACTED Thu Apr 5 10:47:18 2012 From: richardprideauxevans@REDACTED (Richard Evans) Date: Thu, 5 Apr 2012 09:47:18 +0100 Subject: [erlang-questions] Erlang-C port not working on some unix machines In-Reply-To: References: Message-ID: If you guys have any pointers or suggestions or anything, I would be very grateful. On Tue, Apr 3, 2012 at 12:08 PM, Richard Evans wrote: > I am using the standard erlang-c port code as described in the > tutorial?http://www.erlang.org/doc/tutorial/c_port.html#id63121 and in > Joe Armstrong's book. > > On my macbook, the erlang code and c-code communicate happily using > write_exact and read_exact. (I have not touched any of that standard > code). > > But when running exactly the same code on a unix pdp machine, the > communication from c to erlang breaks down. Specifically, in the > server's loop: > > loop(Port) -> > ? ?receive > ? ? ? ?{call, Caller, Msg} -> > ? ? ? ? ? ?Port ! {self(), {command, encode(Msg)}}, > ? ? ? ? ? ?receive > ? ? ? ? ? ? ? ?{Port, {data, Data}} -> ?<---- WE NEVER GET HERE !!! > ? ? ? ? ? ? ? ? ? ?Caller ! {complex, decode(Data)} > ? ? ? ? ? ?end, > ? ? ? ? ? ?loop(Port); > ? ? ? ?stop -> > ? ? ? ? ? ?Port ! {self(), close}, > ? ? ? ? ? ?receive > ? ? ? ? ? ? ? ?{Port, closed} -> > ? ? ? ? ? ? ? ? ? ?exit(normal) > ? ? ? ? ? ?end; > ? ? ? ?{'EXIT', Port, Reason} -> > ? ? ? ? ? ?exit(port_terminated) > ? ?end. > > The c-code receives the encoded-message successfully from the erlang > code. The c-code then writes back a response using write_exact (in > this case, an extremely simple OK response with a two byte header). > But the erlang code never receives this message. > > The c-code for writing the response is the standard code (write_cmd > and write_exact). I have not touched any of this standard code: > > int write_exact(byte* buff, int len) > { > ? ?assert(len < BUFF_SIZE); > ? ?int i, wrote = 0; > ? ?do > ? ?{ > ? ? ? ?if ((i = (int)write(1, buff+wrote, len-wrote)) <= 0) > ? ? ? ?{ > ? ? ? ? ? ?return (i); > ? ? ? ?} > ? ? ? ?wrote += i; > ? ?} while (wrote < len); > ? ?return len; > } > > Debugging the c-side, the write() function gets called - but somehow > the erlang side never receives the message back from the port. > > Do you guys know have any ideas what might be causing this message to > fail to get back from c to erlang in this case on this machine? (It > used to work on the very same pdp machine - and I haven't touched the > erlang code since it last worked). Could it be something to do with > permissions or something, preventing the write in write_exact from > actually writing anything? I am at a loss. > > thanks, > Richard From janburse@REDACTED Thu Apr 5 10:53:47 2012 From: janburse@REDACTED (Jan Burse) Date: Thu, 05 Apr 2012 10:53:47 +0200 Subject: [erlang-questions] Fear and Loathing in Programming La La Land In-Reply-To: References: <4F7CDE52.6030903@fastmail.fm> Message-ID: <4F7D5D9B.9030806@fastmail.fm> Garrett Smith schrieb: > As for being around, I ran a Java tools product line back in the > nineties and can assure you that GUI tools drive underlying software > design. Like it or not. Could be. One of the early GUI Builders for Java, that used reflection, came from Borland. It was not only using naming conventions for setter/getters but also for event handlers. A precoursor of this was probably the VisualAge line from OTI which is already around since <1993. But the impact of these GUI Builders is not extreme on the software design. If you don't adhere with the naming conventions you will loose that the GUI Builder can work with your widget. But you will not loose that you can still code your widget and use it manually in your application. Also I guess these GUI builders are pretty dead now. Especially with the advent of XML based markup GUIs, mash up and scripting GUIs, style sheets, etc.. The Borland GUI Builder did modify the application code. It did not generate some separate artefact for the presentation object. And it did some strange things sometimes, which one could only get rid off by switching to manual mode. But the naming conventions have survived beyond the GUI Builders. Since they are useful in itself for memorizing the API etc.. But it is too easy to say setters/getters, events etc.. are in existence because of GUI Builders. I would like to give you my argument again why they are in existence: Setters/getters, events, etc.. are not in existence because of GUI Builders, but because a GUI application needs to modify the presentation layer and to react on user interactions at runtime. This is why there are setters and events. To say setters are there because of GUI Builders, is the same as saying a car has an engine because the manifacturer can modify it. Which is utterly bullshit, a car has an engine since a car needs something that moves it. Bye From janburse@REDACTED Thu Apr 5 11:01:41 2012 From: janburse@REDACTED (Jan Burse) Date: Thu, 05 Apr 2012 11:01:41 +0200 Subject: [erlang-questions] Fear and Loathing in Programming La La Land In-Reply-To: <4F7D5D9B.9030806@fastmail.fm> References: <4F7CDE52.6030903@fastmail.fm> <4F7D5D9B.9030806@fastmail.fm> Message-ID: <4F7D5F75.8020200@fastmail.fm> Jan Burse schrieb: > To say setters are there because of GUI Builders, > is the same as saying a car has an engine because > the manifacturer can modify it. Which is utterly > bullshit, a car has an engine since a car needs > something that moves it. Tools are typically developed along the following priorities: 1. Architecture 2. Methods 3. Tools And not the other way around. I still think the above list is valid, since the same architecture can have different methods, and the same method can have different tools. Bye From toby@REDACTED Thu Apr 5 13:57:02 2012 From: toby@REDACTED (Toby Thain) Date: Thu, 05 Apr 2012 07:57:02 -0400 Subject: [erlang-questions] Erlang based Web Stack In-Reply-To: References: <4025530D-7B4A-4FD4-AEDE-0FA6017DE9F0@gmail.com> Message-ID: <4F7D888E.5060608@telegraphics.com.au> On 05/04/12 3:17 AM, Kannan wrote: > Thanks guys, that is a lot of input. > > How is the support of OTP for multimedia content manipulation, > transcoding etc? Or you advice to do it at the C level and communicate > it to Erlang? > > Also, if someone has already invented the wheel of how good Erlang is > compared to PHP, please share it with us. Erlang and PHP cannot really be directly compared; they solve different problems. PHP is a basic web templating system with OO bolted on. Erlang is a sophisticated modern language and runtime with extraordinary scaling capability, and built-in distribution mechanisms. Their sweet spots barely overlap, so if you *need* Erlang, you are unlikely to be satisfied with PHP. As for which parts of your system might need to be in C - benchmarking on your actual application will answer that. --Toby > > We would like to have a mega site purely on Erlang and C. > > Thank you. > > > > On Wed, Apr 4, 2012 at 10:21 PM, Tristan Sloughter > > wrote: > > My suggestion is Webmachine or Cowboy speaking only JSON with a > heavy Javascript frontend, like Backbone.js, Spine.js or my favorite > Batman.js > > This provides a lot of advantages, especially if you have people on > the frontend who know html/css/javascript but don't want to deal > with Erlang. Now they simply have a RESTful API to deal with and can > develop on ahead using fixtures or a basic backend in any quick tool > that can build REST apps like Sinatra or Node.js returning stock > responses. Plus, you then are already ready to develop other > interfaces besides a web frontend for you backend with no changes. > > And while I've fallen behind on keeping it going, I'm creating apps > for using with Webmachine to make things faster when you know you > are just dealing with JSON->Erlang https://github.com/tsloughter/maru > > Tristan > > On Wed, Apr 4, 2012 at 4:56 AM, Zabrane Mickael > wrote: > > http://lenary.co.uk/erlang/2011/08/erlang-web-libraries/ > > Regards, > Zabrane > > > On Apr 4, 2012, at 1:46 PM, Roberto Aloi wrote: > >> Hi Marc, >> >>> That comparison is behind regarding Zotonic. >>> And I guess also regarding the other projects, as the last >>> update was 5 months ago. >> >> True. I couldn't find any other so-detailed comparison, >> thought. It >> would probably be worth to update that page with the latest >> changes in >> the other frameworks. >> >>> And it is more a comparison of the features of Chicago Boss >>> to the others, not the other way around. >>> Some extra categories could be considered. >> >> Well, that page belongs to the Chicago Boss project, so no big >> surprise about that. It's good that you made that point clear, >> though. >> >>> But then, no comparison is ever complete. >> >> I guess we should have a third-party one. Suggestion for a >> talk at the >> next Erlang Factory? ;) >> >> -- >> Roberto Aloi >> --- >> Website: http://roberto-aloi.com >> Twitter: @robertoaloi >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From dave@REDACTED Thu Apr 5 14:29:57 2012 From: dave@REDACTED (David Goehrig) Date: Thu, 5 Apr 2012 08:29:57 -0400 Subject: [erlang-questions] Erlang based Web Stack In-Reply-To: References: <4025530D-7B4A-4FD4-AEDE-0FA6017DE9F0@gmail.com> Message-ID: <966FF007-C8D8-42F3-9103-445B54EF7056@nexttolast.com> OTP doesn't have built in support for multimedia. The company I work for does have an advanced editing suite written in Erlang + C. If you are willing to write NIF code reusing most existing C code is a matter of doing a few bindings. Dave -=-=- dave@REDACTED -=-=- On Apr 5, 2012, at 3:17 AM, Kannan wrote: > Thanks guys, that is a lot of input. > > How is the support of OTP for multimedia content manipulation, transcoding etc? Or you advice to do it at the C level and communicate it to Erlang? > > Also, if someone has already invented the wheel of how good Erlang is compared to PHP, please share it with us. > > We would like to have a mega site purely on Erlang and C. > > Thank you. > > > > On Wed, Apr 4, 2012 at 10:21 PM, Tristan Sloughter wrote: > My suggestion is Webmachine or Cowboy speaking only JSON with a heavy Javascript frontend, like Backbone.js, Spine.js or my favorite Batman.js > > This provides a lot of advantages, especially if you have people on the frontend who know html/css/javascript but don't want to deal with Erlang. Now they simply have a RESTful API to deal with and can develop on ahead using fixtures or a basic backend in any quick tool that can build REST apps like Sinatra or Node.js returning stock responses. Plus, you then are already ready to develop other interfaces besides a web frontend for you backend with no changes. > > And while I've fallen behind on keeping it going, I'm creating apps for using with Webmachine to make things faster when you know you are just dealing with JSON->Erlang https://github.com/tsloughter/maru > > Tristan > > On Wed, Apr 4, 2012 at 4:56 AM, Zabrane Mickael wrote: > http://lenary.co.uk/erlang/2011/08/erlang-web-libraries/ > > Regards, > Zabrane > > > On Apr 4, 2012, at 1:46 PM, Roberto Aloi wrote: > >> Hi Marc, >> >>> That comparison is behind regarding Zotonic. >>> And I guess also regarding the other projects, as the last update was 5 months ago. >> >> True. I couldn't find any other so-detailed comparison, thought. It >> would probably be worth to update that page with the latest changes in >> the other frameworks. >> >>> And it is more a comparison of the features of Chicago Boss to the others, not the other way around. >>> Some extra categories could be considered. >> >> Well, that page belongs to the Chicago Boss project, so no big >> surprise about that. It's good that you made that point clear, though. >> >>> But then, no comparison is ever complete. >> >> I guess we should have a third-party one. Suggestion for a talk at the >> next Erlang Factory? ;) >> >> -- >> Roberto Aloi >> --- >> Website: http://roberto-aloi.com >> Twitter: @robertoaloi >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From mfidelman@REDACTED Thu Apr 5 14:41:21 2012 From: mfidelman@REDACTED (Miles Fidelman) Date: Thu, 05 Apr 2012 08:41:21 -0400 Subject: [erlang-questions] Fear and Loathing in Programming La La Land In-Reply-To: <4F7D5F75.8020200@fastmail.fm> References: <4F7CDE52.6030903@fastmail.fm> <4F7D5D9B.9030806@fastmail.fm> <4F7D5F75.8020200@fastmail.fm> Message-ID: <4F7D92F1.3070507@meetinghouse.net> Jan Burse wrote: > Jan Burse schrieb: >> To say setters are there because of GUI Builders, >> is the same as saying a car has an engine because >> the manifacturer can modify it. Which is utterly >> bullshit, a car has an engine since a car needs >> something that moves it. Isn't it more like, we have this new tool, let's see what we can do with it? Cars have engines because somebody said "gee, I wonder if we can put this steam engine on that horse-drawn car." :-) > > Tools are typically developed along > the following priorities: > > 1. Architecture > 2. Methods > 3. Tools > > And not the other way around. I'd kind of beg to differ on this. New tools lead to new methods lead to new architectures. ("Gee, we have a steam engine, let's see what we can do with it." Or, "hmm... nails and a hammer, I bet we could build bigger, taller buildings.") New tools and building blocks enable new methods and architectures. (Granted that there's a bit of co-evolution going on as well... "... I think we're going to need a bigger boat.") -- In theory, there is no difference between theory and practice. In practice, there is. .... Yogi Berra From mattevans123@REDACTED Thu Apr 5 15:57:40 2012 From: mattevans123@REDACTED (Matthew Evans) Date: Thu, 5 Apr 2012 09:57:40 -0400 Subject: [erlang-questions] Erlang SF Conference 2012 slides Message-ID: Hi, Any chance we can get more of the slides published online for us poor folks who couldn't make it? Especially Patrik Nyblom and Lukas Larsson's slides? Many thanks Matt -------------- next part -------------- An HTML attachment was scrubbed... URL: From mrtndimitrov@REDACTED Thu Apr 5 16:45:42 2012 From: mrtndimitrov@REDACTED (Martin Dimitrov) Date: Thu, 05 Apr 2012 17:45:42 +0300 Subject: [erlang-questions] lists bifs vs list comprehensions Message-ID: <4F7DB016.4080209@gmail.com> Hello, Several days ago I used the tidier tool on a module I wrote and I noticed that it translates lists:foreach/2 and lists:map/2 to list comprehensions. I did some tests and came to the conclusion that list comprehension is executed faster than lists:map/2. Also for lists less than 50 000 items lists:foreach/2 is again slower than list comprehension. But for bigger lists - it is the reverse. Why is that so? I thought lists:map/2 and list comprehensions are compiled to equivalent code. Many thanks. Martin From koops.j@REDACTED Thu Apr 5 17:00:31 2012 From: koops.j@REDACTED (Jeroen Koops) Date: Thu, 5 Apr 2012 17:00:31 +0200 Subject: [erlang-questions] Erlang User Group NL Meetup in Amsterdam, April 19th Message-ID: On Thursday April 19, the Erlang User Group NL will organize a get-together in Amsterdam. Location: Erlang Experts Offices "Boven de Balie" Kleine Gartmanplantsoen 10 1017 RR Amsterdam Time: 19:00 More information: http://www.erlang-experts.nl/EUG-NL-meetup/ The following speakers will give a presentation: Nikolaos Bezirgiannis about a research project done in Erlang, called EcoTruck Michel Rijnders about a search-engine developed by TTY Internet Solutions in Erlang Ward Bekker about Erltricity, a human brain-to-Erlang interface (no, seriously!) In between the presentations, there will be plenty of time for networking and meeting fellow Erlang-programmers. Everyone with an interest in Erlang is invited to come along, but please drop me an e-mail if you plan to attend so I have an idea how many people to count on. See you all there! -- Jeroen Koops M: koops.j@REDACTED T: +31-6-55590300 -------------- next part -------------- An HTML attachment was scrubbed... URL: From smith.winston.101@REDACTED Thu Apr 5 17:03:15 2012 From: smith.winston.101@REDACTED (Winston Smith) Date: Thu, 5 Apr 2012 11:03:15 -0400 Subject: [erlang-questions] Erlang-C port not working on some unix machines In-Reply-To: References: Message-ID: On Thu, Apr 5, 2012 at 4:47 AM, Richard Evans wrote: > If you guys have any pointers or suggestions or anything, I would be > very grateful. Since you've proven you're writing all of the data on the C side, I would guess that somehow the data is getting buffered between C and Erlang. You've said you're using the standard example, so you're not using stdout (which is buffered by libc and would need an fflush()). I believe Erlang uses a pipe() to communicate with a standard port drive and pipes aren't buffered, so fsync() wouldn't help ... although I suppose you should look at the docs on your "unix pdp" to see that there are no non-POSIX gotchas. I'm not 100% sure what you mean by "unix pdp" (I think they stopped making PDP's in the 80's) However, look for a tool called strace, if you start up your Erlang process you can use ps to find the pid of both the beam process and your port driver. Attach an strace to each and you'll be able to see the I/O going back and forth between Erlang and the C program. Most importantly, you should see Erlang do the "read" of your response. If your "unix pdp" doesn't have strace, there are a few alternatives, truss (Solaris?) and dtrace (newer UNIXes) that will do the same thing. Hope this helps. W. From pablo.platt@REDACTED Thu Apr 5 17:22:59 2012 From: pablo.platt@REDACTED (Pablo Platt) Date: Thu, 5 Apr 2012 08:22:59 -0700 (PDT) Subject: [erlang-questions] flash clauses vs nested clauses Message-ID: <1333639379.63901.YahooMailNeo@web112618.mail.gq1.yahoo.com> Hi, Is there a difference in performance between using nested clauses and flat clauses or is the compiler smart enough to produce the same optimizations? For example: somefun(a1, b1, c1) -> ??? res1; somefun(a1, b1, c2) -> ??? res2; somefun(a1, b1, c3) -> ??? res3; somefun(a1, b2, c1) -> ??? res4; somefun(a1, b2, c2) -> ??? res5; somefun(a2, b1, c1) -> ??? res6; somefun(a2, b1, c2) -> ??? res7; ... somefun(a10, b10, c10) -> ??? res10. and somefun(a1, B, C) -> ??? case B of ??? ??? b1 -> ??? ??? ??? case C of ??? ??? ??? ??? c1 -> res1; ??? ??? ??? ??? c2 -> res2; ??? ??? ??? ??? c3 -> res3 ??? ??? ??? end; ??? ??? b2 -> ??? ??? ??? case C of ??? ??? ??? ??? C1 -> res4; ??? ??? ??? ??? C2 -> res5 ??? ??? ??? end ???? end; somefun(a2, B, C) -> ??? ... Thanks From kostis@REDACTED Thu Apr 5 17:29:43 2012 From: kostis@REDACTED (Kostis Sagonas) Date: Thu, 05 Apr 2012 18:29:43 +0300 Subject: [erlang-questions] lists bifs vs list comprehensions In-Reply-To: <4F7DB016.4080209@gmail.com> References: <4F7DB016.4080209@gmail.com> Message-ID: <4F7DBA67.9040000@cs.ntua.gr> On 04/05/12 17:45, Martin Dimitrov wrote: > Hello, > > Several days ago I used the tidier tool on a module I wrote and I > noticed that it translates lists:foreach/2 and lists:map/2 to list > comprehensions. I did some tests and came to the conclusion that list > comprehension is executed faster than lists:map/2. Also for lists less > than 50 000 items lists:foreach/2 is again slower than list > comprehension. But for bigger lists - it is the reverse. A bit unrelated to your actual question, but AFAIK tidier does not transform any lists:foreach/2 to a list comprehension. (If you have such a case, I am definitely interested in seeing this.) Instead it transforms lists:filter/2 to list comprehensions. Kostis From g@REDACTED Thu Apr 5 17:33:10 2012 From: g@REDACTED (Garrett Smith) Date: Thu, 5 Apr 2012 10:33:10 -0500 Subject: [erlang-questions] Erlang based Web Stack In-Reply-To: References: <4025530D-7B4A-4FD4-AEDE-0FA6017DE9F0@gmail.com> Message-ID: On Thu, Apr 5, 2012 at 2:17 AM, Kannan wrote: > Thanks guys, that is a lot of input. > > How is the support of OTP for multimedia content manipulation, transcoding > etc? Or you advice to do it at the C level and communicate it to Erlang? > > Also, if someone has already invented the wheel of how good Erlang is > compared to PHP, please share it with us. Stats are sirens - they lure you in with lies and deceit and are almost always dangerous! That said, I ran some basic ab tests against a host of web servers a few years ago. With these simplistic, flawed results, I came to the rock solid conclusion that the only web platform that matched PHP for performance and stability was Erlang. https://github.com/gar1t/landshark/blob/master/doc/benchmarks.txt The Erlang HTTP server was Mochiweb. But I've seen similar performance characteristics with other Erlang servers. > We would like to have a mega site purely on Erlang and C. I think you're in very good hands with Erlang. I'd also disagree with the comment that comparing Erlang and PHP is comparing apples and oranges. Maybe at a very high, abstract level -- but you can certainly compare the two for building HTTP based applications. If it matters enough to your business to get this absolutely right -- you might want to build a benchmark app for your cases and measure the various stacks you're curious about. But anecdotally, I think Erlang is an *outstanding* platform for "mega" sites :) Garrett From g@REDACTED Thu Apr 5 17:42:21 2012 From: g@REDACTED (Garrett Smith) Date: Thu, 5 Apr 2012 10:42:21 -0500 Subject: [erlang-questions] 0mq - Re: Troll bait: If your code really matters, you'll write it in C++ In-Reply-To: <4F7D05DE.9000702@telegraphics.com.au> References: <4F7AF320.4020601@meetinghouse.net> <4F7B55BE.2080000@mansionfamily.plus.com> <4F7B62FC.7090203@meetinghouse.net> <4F7CA805.9090803@mansionfamily.plus.com> <4F7CAAE5.8000706@meetinghouse.net> <4F7CB297.1010401@mansionfamily.plus.com> <4F7D05DE.9000702@telegraphics.com.au> Message-ID: On Wed, Apr 4, 2012 at 9:39 PM, Toby Thain wrote: > On 04/04/12 4:44 PM, james wrote: >>> >>> A question here, though. As I understand it, AQMP is primarily used in >>> the financial world, or at least particularly favored there. Is this >>> true? And if so, which implementations are particularly popular? >>> >> >> Well, its hard to say. I've never seen it used, but then I don't work at >> JPMorgan. RedHat's sponsorship of Apache AMQP should help, but it >> doesn't seem widely used. >> >> I did have interest in it (from a 'bet I could write one of those' hobby >> perspective) but the history seems unfortunate and the very significant >> changes between the definition between 0.8, 0.9 and 1.0 don't bode well >> IMO. Maybe its a sleeper - its certainly nice to see something specified >> with a wire format rather than a borken API in a language you don't want >> to use (for everything). iMatix throwing their toys around and doing >> zeromq didn't help, though they seem to be having 'issues' with process >> on that too. >> >> Maybe it will gain some traction once there are multiple 1.0 broker and >> client implementations and a compatibility festival can be had the same >> way the IIOP CORBA compatibility was demonstrated. > > > Pardon me butting in from an uninformed perspective, but isn't 0mq highly > regarded in this area? I read James' comment to mean that 0MQ is undermining AMQP and that the 0MQ has been challenged with "process problems". I think both comments are fair. I'd +1 the undermining of AMQP, so I don't see that as a knock on 0MQ at all :) As for the 0MQ process problems (issues with breaking backward compatibility, a project fork, etc.) I think that's largely settled down (keeping this intentionally vague because this isn't the place for a 0MQ discussion). My impression of the project is that it's quite robust and I personally have confidence in the iMatix leadership. In any event, I think people will find excellent Erlang support for AMQP and 0MQ, whichever you want to explore. Garrett From matthew@REDACTED Thu Apr 5 18:00:00 2012 From: matthew@REDACTED (Matthew Sackman) Date: Thu, 5 Apr 2012 17:00:00 +0100 Subject: [erlang-questions] Troll bait: If your code really matters, you'll write it in C++ In-Reply-To: <4F7CB297.1010401@mansionfamily.plus.com> References: <4F7AF320.4020601@meetinghouse.net> <4F7B55BE.2080000@mansionfamily.plus.com> <4F7B62FC.7090203@meetinghouse.net> <4F7CA805.9090803@mansionfamily.plus.com> <4F7CAAE5.8000706@meetinghouse.net> <4F7CB297.1010401@mansionfamily.plus.com> Message-ID: <20120405160000.GA29635@wellquite.org> On Wed, Apr 04, 2012 at 09:44:07PM +0100, james wrote: > I did have interest in it (from a 'bet I could write one of those' hobby > perspective) but the history seems unfortunate and the very significant > changes between the definition between 0.8, 0.9 and 1.0 don't bode well > IMO. 0.8 and 0.9 are similar. 0.10 is rather different. 0.9.1 is the most widely used version and is a tidy-up of 0.9. 1.0 is a *completely new protocol* and ideally should not have used the "AMQP" label at all. It is utterly different and, for example, does not define any sort of broker semantics. > Maybe its a sleeper - its certainly nice to see something > specified with a wire format rather than a borken API in a language you > don't want to use (for everything). iMatix throwing their toys around > and doing zeromq didn't help, though they seem to be having 'issues' > with process on that too. I'd say 0mq is excellent at solving a different problem to AMQP. These things can very happily coexist and even cooperate. They do address slightly different problems though. > Maybe it will gain some traction once there are multiple 1.0 broker and > client implementations and a compatibility festival can be had the same > way the IIOP CORBA compatibility was demonstrated. Yes, well that would require multiple people to understand the 1.0 spec. 0.9.1 and 0.8 benefitted from a relatively small spec that people in the community as a whole could fairly easily implement - it was feasible in a weekend to sit down and write a client in your pet language and have it be able to talk to, eg, RabbitMQ. Thus the vast majority of clients you'll find in the wild, not written by companies, are for 0.8 or 0.9.1. 1.0 is a massive spec and I'm yet to see any evidence of community motivation to write clients for it. That's not to say it doesn't exist, just that I've not seen it. > There are more Solace jobs on CWJobs than AMQP (more than zero isn't > hard!). Currently 4 hits for AMQP for me, but if you search for RabbitMQ, there are currently 7. 2 hits for Qpid. Rabbit has essentially been so successful that most people think of "oh let's use Rabbit to solve this problem" rather than "let's use AMQP". I.e. the Rabbit brand is more important and meaningful than the AMQP brand. Matthew From g@REDACTED Thu Apr 5 18:45:05 2012 From: g@REDACTED (Garrett Smith) Date: Thu, 5 Apr 2012 11:45:05 -0500 Subject: [erlang-questions] Troll bait: If your code really matters, you'll write it in C++ In-Reply-To: <20120405160000.GA29635@wellquite.org> References: <4F7AF320.4020601@meetinghouse.net> <4F7B55BE.2080000@mansionfamily.plus.com> <4F7B62FC.7090203@meetinghouse.net> <4F7CA805.9090803@mansionfamily.plus.com> <4F7CAAE5.8000706@meetinghouse.net> <4F7CB297.1010401@mansionfamily.plus.com> <20120405160000.GA29635@wellquite.org> Message-ID: On Thu, Apr 5, 2012 at 11:00 AM, Matthew Sackman wrote: > > Currently 4 hits for AMQP for me, but if you search for RabbitMQ, there > are currently 7. 2 hits for Qpid. Rabbit has essentially been so > successful that most people think of "oh let's use Rabbit to solve this > problem" rather than "let's use AMQP". I.e. the Rabbit brand is more > important and meaningful than the AMQP brand. I think this is exactly right! The project has been moving away from AMQP for a while now. E.g. AMQP doesn't even appear up on the Rabbit home page. Garrett From janburse@REDACTED Thu Apr 5 19:25:27 2012 From: janburse@REDACTED (Jan Burse) Date: Thu, 05 Apr 2012 19:25:27 +0200 Subject: [erlang-questions] Fear and Loathing in Programming La La Land In-Reply-To: <4F7D92F1.3070507@meetinghouse.net> References: <4F7CDE52.6030903@fastmail.fm> <4F7D5D9B.9030806@fastmail.fm> <4F7D5F75.8020200@fastmail.fm> <4F7D92F1.3070507@meetinghouse.net> Message-ID: <4F7DD587.4000805@fastmail.fm> Miles Fidelman schrieb: > I'd kind of beg to differ on this. New tools lead to new methods lead > to new architectures. ("Gee, we have a steam engine, let's see what we > can do with it." Or, "hmm... nails and a hammer, I bet we could build > bigger, taller buildings.") How I use the term "architecture" in information technology: Architecture == Fabric, Architecture != Building You cannot just build a new tool. First there has to be an architecture already in place, where the tool can work on. And second there has to be some method around, which gives the tool a place in a process. The end product that you are building with a particular tool are applications. And they will share the same architecture, independent whether they are innovative or conservative, small or tall, etc.. The method is not so much part of the end product. But yes I guess the relationship architecture - method - tool is not a DAG. It can be a mesh, so the same tool could be used for different methods. Of course you can also build new tools or also new architectures with old tools. This is called bootstrapping. But the dependency between a new tool and its architecture remains the same. Eventually the same tool could be used for different architectures. But this is quite difficult. First of all the tool must allow plugability of the architecture. Second the tool must be generic enough to support different architectures. For the later situation I would rather see each different instance of the generic tool as a separate tool. What these tools share is a certain tool design or somesuch. But generic plugable tools are currently omnipresent, systems such es Eclipse, IntelliJ come to mind. These tools combine for example frameworks for syntax high- lighting with plugins for various languages. So they are multiple tools in one. Like one of those (swiss or not) multi-tools: http://en.wikipedia.org/wiki/Multitool Bye From tony@REDACTED Thu Apr 5 19:39:17 2012 From: tony@REDACTED (Tony Rogvall) Date: Thu, 5 Apr 2012 19:39:17 +0200 Subject: [erlang-questions] how to flush a gen_tcp socket on close? In-Reply-To: <20120404221334.GA3266@corelatus.se> References: <201204021930.q32JU6GE055083@pluto.hedeland.org> <20120404221334.GA3266@corelatus.se> Message-ID: <28A532E8-F31D-45F0-810B-E04C4CAE5344@rogvall.se> Hi! I want to add some clues to this puzzle. First of all the right way: send, shutdown wait for close is not working here as would have been my first answer :-) Then I moved the subscription code to just wait for the empty queue event, and NOT do the timeout. This worked well. My interpretation is that the reader is so slow, so that the write side "write ready" is not signaled and no more data goes down to kernel space (probably some threshold.) This will keep the pending data at the same level, and hence timeout. My scheme looked like: fill output buffer 1K at a time until send_pend > 0 start reader subscribe for empty_q (code from prim inet) wait for empty_q send shutdown wait for close So how would a workaround look like ? One way is to make sure that the kernel buffer is smaller (now I can send 160K). Use what ever size that make sense with the knowledge of the inet built in time out timer (5 secs) An other way to fix this could be to try to add kernel buffer space to send_pend but that is pretty os dependent :-) /Tony On 5 apr 2012, at 00:13, Matthias Lang wrote: > On Tuesday, April 03, Andreas Schultz wrote: > >> In my case the receiver is to slow to process all the data, sender >> does 10k packets of 1k size, the receiver only gets the first 2000 >> packets. It might well be that I hit the close timeout and inet >> discards the rest of the send queue. > > Ok, that's something to go on. > > I had a go at reproducing what you're doing based on that description. > I see something unexpected which seems similar to what you reported. > > The output of my program (at the bottom of this mail) running on R15B is: > > 30> as_tcp:go(). > calling close on TX at {23,35,35} > read 1000 octets > read 1000 octets > read 1000 octets > read 1000 octets > read 1000 octets > read 1000 octets > read 1000 octets > read 1000 octets > read 1000 octets > close returned at {23,35,45}, 10002ms later > ok > read 1000 octets > 31> > =ERROR REPORT==== 4-Apr-2012::23:35:45 === > Error in process <0.120.0> with exit value: {{badmatch,{error,closed}},[{as_tcp,slow_read,1,[{file,"as_tcp.erl"},{line,31}]}]} > > I had a bit of a dig in prim_inet.erl. It sounds like you've looked > there too. That code looks like it's intended to loop 'forever' trying > to send the queued data, as long as some progress is made every so often > (always sends at least something in every 5s timeout period). But running > my program suggests that isn't happening as intended. > > Instrumenting prim_inet, it looks like the {subs_empty_out_q,0 } message > is coming up from inet_drv.c even though the queue isn't empty. Looking > in there, I noticed this: > > static void tcp_inet_flush(ErlDrvData e) > { > tcp_descriptor* desc = (tcp_descriptor*)e; > if (!(desc->inet.event_mask & FD_WRITE)) { > /* Discard send queue to avoid hanging port (OTP-7615) */ > tcp_clear_output(desc); > } > } > > but I think that change was introduced sometime after R11B-5, and > R11B-5 fails the same way. So probably a red herring. > > Out of time looking at this for now. > >> The fix should be simple, limit the send queue size. > > To what? > > Zero seems to be the only value that will work even for arbitrarily slow > clients. And that defeats the point of having a send queue. > > --- > > A likely _workaround_ is to call > > inet:getstat(Tx, [send_pend]) > > if the answer is zero, then you know that you can call close() without > _erlang_ tossing data. I haven't tried this. > > --- > > It's late, I might have outsmarted myself, but my current feeling is > that erlang is quietly tossing data and it shouldn't be. > > Waiting for as long as it takes in close() seems like the right thing, > though Per might disagree. Waiting for N seconds in close() and then > returning an error if the queue didn't empty would also be better than > just quietly tossing it. > > (And: yes, I know, application-level ACKs would avoid this > problem. But I'm not quite ready to say that this problem can't be > fixed.) > > Matt > > ---------------------------------------------------------------------- > %% Throwaway module: attempt to reproduce TCP problem reported to > %% erlang-questions 2012-04-02 by Andreas Schultz. > %% > %% He elaborated on 2012-04-04: gen_tcp drops data when close is called > %% with data buffered if the receiver is sufficiently slow. > -module(as_tcp). > -export([go/0]). > > go() -> > {ok, L} = gen_tcp:listen(0, [{active, false}, binary]), > {ok, Portno} = inet:port(L), > {ok, Tx} = gen_tcp:connect(localhost, Portno, []), > {ok, Rx} = gen_tcp:accept(L), > ok = gen_tcp:close(L), > > One_hundred_k = list_to_binary(lists:duplicate(100000, 0)), > ok = gen_tcp:send(Tx, [lists:duplicate(40, One_hundred_k), "end of data"]), > > spawn(fun() -> slow_read(Rx) end), > > io:fwrite("calling close on TX at ~p\n", [time()]), > Before = now(), > ok = gen_tcp:close(Tx), > After = now(), > io:fwrite("close returned at ~p, ~pms later\n", > [time(), timer:now_diff(After, Before) div 1000]), > > ok = gen_tcp:close(Rx). > > slow_read(Rx) -> > {ok, _Bin} = gen_tcp:recv(Rx, 10000), > timer:sleep(1000), > io:fwrite("read 1000 octets\n"), > slow_read(Rx). > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions "Installing applications can lead to corruption over time. Applications gradually write over each other's libraries, partial upgrades occur, user and system errors happen, and minute changes may be unnoticeable and difficult to fix" -------------- next part -------------- An HTML attachment was scrubbed... URL: From smith.winston.101@REDACTED Thu Apr 5 19:56:07 2012 From: smith.winston.101@REDACTED (Winston Smith) Date: Thu, 5 Apr 2012 13:56:07 -0400 Subject: [erlang-questions] Status of HARDDEBUG code (doesn't compile, seems to be outdated) Message-ID: The process of attempting to track down the cause of a TYPE ASSERTION FAILED error stopping Mnesia in R15B* has lead me down the path of creating a debug build of beam and now on to building a version of beam with HARDDEBUG defined which should enable a fair bit of internal sanity checking and debug output. However, turning on -DHARDDEBUG results in quite a few compile errors, it's pretty obvious that the HARDDEBUG code is quite out of date. I have spent some time yesterday fixing these errors (I will submit patches separately to erlang-patches) but now I find that it's aborting during startup with: # ./erts-5.9.1/bin/erl -minimal size_object: matchstate term not allowedAborted (core dumped) This is the line in beam/copy.c that it's failing at: case BIN_MATCHSTATE_SUBTAG: erl_exit(ERTS_ABORT_EXIT, "size_object: matchstate term not allowed"); Again, I'm working on a cross compile to the AVR32 platform, so it's a bit tedious to debug this as I have some issues with gdb not being able to produce a stack dump, so I have to do it myself. From the core dump generated by the abort(), I was able to recover the following stack trace: 0 - ?? (should be erl_exit_vv(), but $pc seems corrupted, could be an artefact of the SIGABORT) 1 - erl_exit() -- erl_init.c:1627 2 - size_object() -- copy.c:174 3 - process_main() -- beam_emu.c:4109 4 - erl_start() -- erl_init.c:1493 5 - main() -- erl_main.c:30 So onto my question: is HARDDEBUG still supported? Is it abandonware, or has it just gotten a little out of date? Am I wasting my time here, or should I dig into it? Thanks! W. From mfidelman@REDACTED Thu Apr 5 20:42:08 2012 From: mfidelman@REDACTED (Miles Fidelman) Date: Thu, 05 Apr 2012 14:42:08 -0400 Subject: [erlang-questions] Fear and Loathing in Programming La La Land In-Reply-To: <4F7DD587.4000805@fastmail.fm> References: <4F7CDE52.6030903@fastmail.fm> <4F7D5D9B.9030806@fastmail.fm> <4F7D5F75.8020200@fastmail.fm> <4F7D92F1.3070507@meetinghouse.net> <4F7DD587.4000805@fastmail.fm> Message-ID: <4F7DE780.1020703@meetinghouse.net> Mind you, we're discussing how many angels can fit on the head of a pin, but.... for arguments sake (and to avoid doing real work...)... Jan Burse wrote: > Miles Fidelman schrieb: >> I'd kind of beg to differ on this. New tools lead to new methods lead >> to new architectures. ("Gee, we have a steam engine, let's see what we >> can do with it." Or, "hmm... nails and a hammer, I bet we could build >> bigger, taller buildings.") > > How I use the term "architecture" > in information technology: > Architecture == Fabric, Architecture != Building Well, that's a fairly limited use of the term. I generally understand the term to mean "the manner in which the components of a computer or computer system are organized and integrated" That's from Merriam-Webster, by the way, but it's consistent with more precise technical uses of the term. (I'm not going to get pedantic and start quoting from the systems engineering literature or anything like that. :-) Fabric may be an architectural model, and a pretty loosely defined one at that ("protocol fabric," platform, SOA, ....) but it's far from the only one. Fabric =\= Architecture > > You cannot just build a new tool. First there has to be an > architecture already in place, where the tool can work on. > And second there has to be some method around, which gives > the tool a place in a process. Unless you're considering general-purpose computer == architecture, of course one can, and we do it all the time. (And, given that general-purpose computers are Turing-equivalent, that's a pretty unconstrained architecture.) Yes, tools are built in a context - say a bash script that searches through a text file and pipes output into another script (context = Unix, text files, pipes) - but again, that's pretty unconstrained. Do you really have to have a client-server architecture before you implement a database? Or does having a database capability begat client-server architectures, and more tools (e.g., clients). Ok, sure, if we're talking about IDEs (which I believe we are), is Emacs a tool, or an architecture, or both? What about Emacs + a set of Erlang-specific plugins? Most general purpose computer languages are Turing-equivalent - but emphasize different world views (LISP is great for some problems, horrible fr others. Same again for APL, or, of course Erlang). Is a language a tool or an embodiment of an architectural approach? (To my mind, the answer is "yes."). Which comes first? Kind of depends on the language, its history, and its influences. > > The end product that you are building with a particular > tool are applications. And they will share the same > architecture, independent whether they are innovative > or conservative, small or tall, etc.. Again, depends on your point of view. Do all programs ultimately execute as machine code... yes. Do all programs written in C (or in Emacs) share the same structure... definitely not. I've seen systems with a lot of different architectures built in Java, Erlang, Fortran, ..... Architecture (e.g., client-server vs. P2P) is orthogonal to tools. If anything, choice of tools can drive the architecture of a system (Erlang begats even-driven actor architectures, Java begats object-oriented ones.) -- In theory, there is no difference between theory and practice. In practice, there is. .... Yogi Berra From rapsey@REDACTED Thu Apr 5 20:51:42 2012 From: rapsey@REDACTED (Rapsey) Date: Thu, 5 Apr 2012 20:51:42 +0200 Subject: [erlang-questions] Erlang based Web Stack In-Reply-To: References: <4025530D-7B4A-4FD4-AEDE-0FA6017DE9F0@gmail.com> Message-ID: Depends on what kind of transcoding. My work is in streaming servers and we do a lot of transcoding (VOD files and live streams). We never needed anything other than executing VLC or ffmpeg with os:cmd or open_port. One thing I really love about erlang that no other technology has is that you can run your servers in a console. We execute erlang with dtach. This means we can at any time, log in to a machine, attach to the erlang server and see what is going on. Sergej On Thu, Apr 5, 2012 at 9:17 AM, Kannan wrote: > Thanks guys, that is a lot of input. > > How is the support of OTP for multimedia content manipulation, transcoding > etc? Or you advice to do it at the C level and communicate it to Erlang? > > Also, if someone has already invented the wheel of how good Erlang is > compared to PHP, please share it with us. > > We would like to have a mega site purely on Erlang and C. > > Thank you. > > > > On Wed, Apr 4, 2012 at 10:21 PM, Tristan Sloughter < > tristan.sloughter@REDACTED> wrote: > >> My suggestion is Webmachine or Cowboy speaking only JSON with a heavy >> Javascript frontend, like Backbone.js, Spine.js or my favorite Batman.js >> >> This provides a lot of advantages, especially if you have people on the >> frontend who know html/css/javascript but don't want to deal with Erlang. >> Now they simply have a RESTful API to deal with and can develop on ahead >> using fixtures or a basic backend in any quick tool that can build REST >> apps like Sinatra or Node.js returning stock responses. Plus, you then are >> already ready to develop other interfaces besides a web frontend for you >> backend with no changes. >> >> And while I've fallen behind on keeping it going, I'm creating apps for >> using with Webmachine to make things faster when you know you are just >> dealing with JSON->Erlang https://github.com/tsloughter/maru >> >> Tristan >> >> On Wed, Apr 4, 2012 at 4:56 AM, Zabrane Mickael wrote: >> >>> http://lenary.co.uk/erlang/2011/08/erlang-web-libraries/ >>> >>> Regards, >>> Zabrane >>> >>> >>> On Apr 4, 2012, at 1:46 PM, Roberto Aloi wrote: >>> >>> Hi Marc, >>> >>> That comparison is behind regarding Zotonic. >>> >>> And I guess also regarding the other projects, as the last update was 5 >>> months ago. >>> >>> >>> True. I couldn't find any other so-detailed comparison, thought. It >>> would probably be worth to update that page with the latest changes in >>> the other frameworks. >>> >>> And it is more a comparison of the features of Chicago Boss to the >>> others, not the other way around. >>> >>> Some extra categories could be considered. >>> >>> >>> Well, that page belongs to the Chicago Boss project, so no big >>> surprise about that. It's good that you made that point clear, though. >>> >>> But then, no comparison is ever complete. >>> >>> >>> I guess we should have a third-party one. Suggestion for a talk at the >>> next Erlang Factory? ;) >>> >>> -- >>> Roberto Aloi >>> --- >>> Website: http://roberto-aloi.com >>> Twitter: @robertoaloi >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> >>> >>> >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> >>> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From janburse@REDACTED Thu Apr 5 22:33:24 2012 From: janburse@REDACTED (Jan Burse) Date: Thu, 05 Apr 2012 22:33:24 +0200 Subject: [erlang-questions] Fear and Loathing in Programming La La Land In-Reply-To: <4F7DE780.1020703@meetinghouse.net> References: <4F7CDE52.6030903@fastmail.fm> <4F7D5D9B.9030806@fastmail.fm> <4F7D5F75.8020200@fastmail.fm> <4F7D92F1.3070507@meetinghouse.net> <4F7DD587.4000805@fastmail.fm> <4F7DE780.1020703@meetinghouse.net> Message-ID: <4F7E0194.9030902@fastmail.fm> Miles Fidelman schrieb: > If anything, choice of tools can drive the architecture of a system > (Erlang begats even-driven actor architectures, Java begats > object-oriented ones.) ?? Do you think Erlang is a tool ?? The language Erlang comes with a tool-set (top-level, compilers, etc..) and the language Erlang supports a special runtime architecture. I have only put three angels on the pin, at least this is how I see the world. One has to distinguish between: - The Erlang language. - The Erlang tool-set. - The Erlang runtime. - What else? Right? Same for other languages such as Java, C++, etc.. Usually language is the interface between tool and architecture. Bye BTW: One can easily build and run code written in the Erlang language with other tool-sets and runtimes. Here is a very small experiment: https://plus.google.com/u/0/b/103259555581227445618/103259555581227445618/posts/KQrBA5yECpq From mfidelman@REDACTED Thu Apr 5 22:47:30 2012 From: mfidelman@REDACTED (Miles Fidelman) Date: Thu, 05 Apr 2012 16:47:30 -0400 Subject: [erlang-questions] Fear and Loathing in Programming La La Land In-Reply-To: <4F7E0194.9030902@fastmail.fm> References: <4F7CDE52.6030903@fastmail.fm> <4F7D5D9B.9030806@fastmail.fm> <4F7D5F75.8020200@fastmail.fm> <4F7D92F1.3070507@meetinghouse.net> <4F7DD587.4000805@fastmail.fm> <4F7DE780.1020703@meetinghouse.net> <4F7E0194.9030902@fastmail.fm> Message-ID: <4F7E04E2.3040901@meetinghouse.net> Jan Burse wrote: > Miles Fidelman schrieb: >> If anything, choice of tools can drive the architecture of a system >> (Erlang begats even-driven actor architectures, Java begats >> object-oriented ones.) > > ?? Do you think Erlang is a tool ?? Well... more like a toolbox containing a collection of tools for for building and executing systems - comprised of one-or-more instances of a run-time environment, a compiler, a language, a collection of pre-written components (OTP), and a variety of user-facing tools for putting pieces together and executing them. And it happens that this particular toolbox is good for building systems with some particular architectural characteristics: massive concurrency, message passing, shared nothing. I.e., it's a toolbox that's particularly suited to the actor design pattern (architecture). > > The language Erlang comes with a tool-set > (top-level, compilers, etc..) and the > language Erlang supports a special runtime > architecture. > > I have only put three angels on the pin, > at least this is how I see the world. One > has to distinguish between: > - The Erlang language. > - The Erlang tool-set. > - The Erlang runtime. > - What else? I think you miss the point: Arguing about which comes first, architecture or tools, (or chicken or egg), is akin to arguing about how man angels can fit on the head of a pin. The answer is "yes." > Same for other languages such as Java, > C++, etc.. Usually language is the > interface between tool and architecture. > I'd frame it as language is the way one represents an architecture so that it can be implemented. -- In theory, there is no difference between theory and practice. In practice, there is. .... Yogi Berra From freza@REDACTED Fri Apr 6 00:29:05 2012 From: freza@REDACTED (Jachym Holecek) Date: Thu, 5 Apr 2012 18:29:05 -0400 Subject: [erlang-questions] flash clauses vs nested clauses In-Reply-To: <1333639379.63901.YahooMailNeo@web112618.mail.gq1.yahoo.com> References: <1333639379.63901.YahooMailNeo@web112618.mail.gq1.yahoo.com> Message-ID: <20120405222905.GA8949@circlewave.net> # Pablo Platt 2012-04-05: > Is there a difference in performance between using nested clauses and flat clauses > or is the compiler smart enough to produce the same optimizations? Check out the 'foo.S' resulting from 'erlc +to_asm foo.erl'. BEAM instructions aren't documented anywhere (correct me if I'm wrong), but the output tends to be easy to follow; at least at the higher level of "what happened to my pattern matching?". HTH, -- Jachym From janburse@REDACTED Fri Apr 6 01:04:48 2012 From: janburse@REDACTED (Jan Burse) Date: Fri, 06 Apr 2012 01:04:48 +0200 Subject: [erlang-questions] Fear and Loathing in Programming La La Land In-Reply-To: <4F7E04E2.3040901@meetinghouse.net> References: <4F7CDE52.6030903@fastmail.fm> <4F7D5D9B.9030806@fastmail.fm> <4F7D5F75.8020200@fastmail.fm> <4F7D92F1.3070507@meetinghouse.net> <4F7DD587.4000805@fastmail.fm> <4F7DE780.1020703@meetinghouse.net> <4F7E0194.9030902@fastmail.fm> <4F7E04E2.3040901@meetinghouse.net> Message-ID: <4F7E2510.2020203@fastmail.fm> Miles Fidelman schrieb: > it's a toolbox that's particularly suited > to the actor design pattern (architecture). Design pattern or architecture? A design pattern is usually implemented on top of an architecture. A main characteristic of an architecture is ubiquity in an application. So the same architecture elements will be used over an over for different use cases. These use case might be designed with the help of design patterns. And I cannot agree that the Java suite begets "object orientation" as architecture. I rather see the fundamental architecture as: - multi threaded - single class inheritance (extends) - multiple interface inheritance (implements) - What else? The actor design pattern is not that difficult to implement in the above architecture. And it is also not that difficult to elevate the fundamental architecture by actor like elements. Many of such attempts are modelled after Erlang. http://www.javaworld.com/javaworld/jw-03-2009/jw-03-actor-concurrency2.html Bye From janburse@REDACTED Fri Apr 6 01:34:19 2012 From: janburse@REDACTED (Jan Burse) Date: Fri, 06 Apr 2012 01:34:19 +0200 Subject: [erlang-questions] Fear and Loathing in Programming La La Land In-Reply-To: <4F7E2510.2020203@fastmail.fm> References: <4F7CDE52.6030903@fastmail.fm> <4F7D5D9B.9030806@fastmail.fm> <4F7D5F75.8020200@fastmail.fm> <4F7D92F1.3070507@meetinghouse.net> <4F7DD587.4000805@fastmail.fm> <4F7DE780.1020703@meetinghouse.net> <4F7E0194.9030902@fastmail.fm> <4F7E04E2.3040901@meetinghouse.net> <4F7E2510.2020203@fastmail.fm> Message-ID: <4F7E2BFB.7080806@fastmail.fm> Jan Burse schrieb: > Many of such attempts are modelled after Erlang. > http://www.javaworld.com/javaworld/jw-03-2009/jw-03-actor-concurrency2.html But I agree, most of the attempts are ugly and I have the feeling by using the JVM one on one its not possible to do actors properly. On the other hand when implementing some interpreter it should be possible to do so more or less. Bye From mfidelman@REDACTED Fri Apr 6 01:36:42 2012 From: mfidelman@REDACTED (Miles Fidelman) Date: Thu, 05 Apr 2012 19:36:42 -0400 Subject: [erlang-questions] Fear and Loathing in Programming La La Land In-Reply-To: <4F7E2510.2020203@fastmail.fm> References: <4F7CDE52.6030903@fastmail.fm> <4F7D5D9B.9030806@fastmail.fm> <4F7D5F75.8020200@fastmail.fm> <4F7D92F1.3070507@meetinghouse.net> <4F7DD587.4000805@fastmail.fm> <4F7DE780.1020703@meetinghouse.net> <4F7E0194.9030902@fastmail.fm> <4F7E04E2.3040901@meetinghouse.net> <4F7E2510.2020203@fastmail.fm> Message-ID: <4F7E2C8A.30001@meetinghouse.net> Jan Burse wrote: > Miles Fidelman schrieb: >> it's a toolbox that's particularly suited >> to the actor design pattern (architecture). > > Design pattern or architecture? A design > pattern is usually implemented on top of > an architecture. To my mind, a design pattern IS an architecture, with a specific system's architecture being a specialization of that general architecture. E.g.,. a specific client-server system design. > > A main characteristic of an architecture > is ubiquity in an application. So the > same architecture elements will be used > over an over for different use cases. > These use case might be designed with > the help of design patterns. Huh? A use case sets the requirements for a system (or application), a design pattern defines an overall architectural approach (e.g., client server), the system's architecture identifies the major components of a specific system and their inter-relationships (notably their interfaces). (Of course there are other uses of the word, such as a specific service oriented architecture, or a protocol architecture), but I believe we're talking software/system architecture at the moment. > > And I cannot agree that the Java suite > begets "object orientation" as architecture. > I rather see the fundamental architecture as: > - multi threaded > - single class inheritance (extends) > - multiple interface inheritance (implements) > - What else? Well, most of the folks I know who build Java-based systems, seem to build object-oriented systems. By contrast, most of the folks I know who use Erlang build actor type systems. > > The actor design pattern is not that difficult > to implement in the above architecture. And > it is also not that difficult to elevate > the fundamental architecture by actor like > elements. Unless you actually want your system to perform. Show me 20,000 concurrent actors in Java and I'll show you a grid-locked system. And, last time I looked, Java is far more oriented toward invoking methods on objects - leaving it to you to design your control flows - where Erlang/OTP provides all kinds of pre-defined components for managing actors, actor states, and messaging among actors. Real-world example: I used to work at a firm that built CGF (Computer Generated Forces) simulators - think "game engine simulating 2000 tanks on a battlefield." Coming from a network background, I simply assumed that the system spawned a process for each tank (the same way a protocol engine spawns a process for each connection or transaction). Nope... I was assured that context switching overhead made that impossible. Instead, each tank is an object, and every 1/20th second, 4 different main threads wind their way through each and every object in the system. Very ugly. I discovered Erlang when I went searching for a run-time environment that COULD support an actor-oriented approach to simulation (not that I went and rebuilt all that code, mind you). (Note: This is a slightly contrived example, as most of the core simulation code was in C++, but the same model and constraints apply.) Give me 20,000 things to manage in Java, I'll probably create 20,000 objects and come up with some kind serialization code to manage the flow of events. In Erland, I'll just spawn 20,000 state machines and let the OTP infrastructure deal with eventing. Available tools are a primary set of constraints that drive system architecture decisions. -- In theory, there is no difference between theory and practice. In practice, there is. .... Yogi Berra From janburse@REDACTED Fri Apr 6 01:58:50 2012 From: janburse@REDACTED (Jan Burse) Date: Fri, 06 Apr 2012 01:58:50 +0200 Subject: [erlang-questions] Fear and Loathing in Programming La La Land In-Reply-To: <4F7E2C8A.30001@meetinghouse.net> References: <4F7CDE52.6030903@fastmail.fm> <4F7D5D9B.9030806@fastmail.fm> <4F7D5F75.8020200@fastmail.fm> <4F7D92F1.3070507@meetinghouse.net> <4F7DD587.4000805@fastmail.fm> <4F7DE780.1020703@meetinghouse.net> <4F7E0194.9030902@fastmail.fm> <4F7E04E2.3040901@meetinghouse.net> <4F7E2510.2020203@fastmail.fm> <4F7E2C8A.30001@meetinghouse.net> Message-ID: <4F7E31BA.1020805@fastmail.fm> Miles Fidelman schrieb: > Give me 20,000 things to manage in Java, I'll probably create 20,000 > objects and come up with some kind serialization code to manage the flow > of events. In Erland, I'll just spawn 20,000 state machines and let the > OTP infrastructure deal with eventing. Concurrency is in the eye of the beholder. I am currently working on a forward chainer where you can have as many as you like states in a knowledge base. And the rules can detect combinations of states and then fire new states and/or remove old states. No notion of an actor needed, and can be easily implemented in a single thread, and can probably single handedly used to solve the same stuff as with an actor model. Under some suitable ordering of the firing of the foward chainer (not yet done). But I guess I need a new "tool", that splices up an Erlang definition of an actor into forward rules, so that we can think "sequentially" about what the actor does. Hm. Bye From janburse@REDACTED Fri Apr 6 02:01:15 2012 From: janburse@REDACTED (Jan Burse) Date: Fri, 06 Apr 2012 02:01:15 +0200 Subject: [erlang-questions] Fear and Loathing in Programming La La Land In-Reply-To: <4F7E31BA.1020805@fastmail.fm> References: <4F7CDE52.6030903@fastmail.fm> <4F7D5D9B.9030806@fastmail.fm> <4F7D5F75.8020200@fastmail.fm> <4F7D92F1.3070507@meetinghouse.net> <4F7DD587.4000805@fastmail.fm> <4F7DE780.1020703@meetinghouse.net> <4F7E0194.9030902@fastmail.fm> <4F7E04E2.3040901@meetinghouse.net> <4F7E2510.2020203@fastmail.fm> <4F7E2C8A.30001@meetinghouse.net> <4F7E31BA.1020805@fastmail.fm> Message-ID: <4F7E324B.9030700@fastmail.fm> Jan Burse schrieb: > I am currently working on a forward chainer where > you can have as many as you like states in a knowledge > base. Actually it will be designed to have millions of states. > And the rules can detect combinations of states > and then fire new states and/or remove old states. Some multi argument indexing will hopefully give the necessary speed. (not yet done) Bye From witeman.g@REDACTED Fri Apr 6 03:29:05 2012 From: witeman.g@REDACTED (Zheng Zhibin) Date: Fri, 6 Apr 2012 09:29:05 +0800 Subject: [erlang-questions] flash clauses vs nested clauses In-Reply-To: <1333639379.63901.YahooMailNeo@web112618.mail.gq1.yahoo.com> References: <1333639379.63901.YahooMailNeo@web112618.mail.gq1.yahoo.com> Message-ID: <274B3AD4-1A7A-4CCC-8573-30642CA5BBE0@gmail.com> I think the first style of coding would be faster. Thanks and regards, ???(Witeman) ? 2012-4-5???11:22? Pablo Platt ??? > Hi, > > Is there a difference in performance between using nested clauses and flat clauses > or is the compiler smart enough to produce the same optimizations? > > For example: > > somefun(a1, b1, c1) -> > res1; > somefun(a1, b1, c2) -> > res2; > somefun(a1, b1, c3) -> > res3; > somefun(a1, b2, c1) -> > res4; > somefun(a1, b2, c2) -> > res5; > somefun(a2, b1, c1) -> > res6; > somefun(a2, b1, c2) -> > res7; > ... > somefun(a10, b10, c10) -> > res10. > > > and > > somefun(a1, B, C) -> > case B of > b1 -> > case C of > c1 -> res1; > > c2 -> res2; > > c3 -> res3 > > end; > b2 -> > case C of > C1 -> res4; > > C2 -> res5 > end > > end; > somefun(a2, B, C) -> > ... > > Thanks > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From kaiduanx@REDACTED Fri Apr 6 04:46:53 2012 From: kaiduanx@REDACTED (Kaiduan Xie) Date: Thu, 5 Apr 2012 22:46:53 -0400 Subject: [erlang-questions] Deploy Erlang based application on Windows Message-ID: Hi all, I am considering to use Erlang/Yaws/Another Erlang application for a project on Windows platform. The major obstacle is to roll out an all-in-one installer which installs Erlang/Yaws/Another Erlang application in ONE step. It seems this is not that easy. Any idea on how to make the installation easy for end user? Thanks for sharing your experience and thought, /Kaiduan From rapsey@REDACTED Fri Apr 6 07:17:35 2012 From: rapsey@REDACTED (Rapsey) Date: Fri, 6 Apr 2012 07:17:35 +0200 Subject: [erlang-questions] Deploy Erlang based application on Windows In-Reply-To: References: Message-ID: I have a QT based app that runs erlang in the background. Installer is done with inno setup: http://www.jrsoftware.org/isinfo.php I just took a regular windows install of erlang, removed the source code files, I think I removed some .ini files from the bin folders so that erlang can be run from any directory not just program files. In inno setup I just configure it to copy that erlang directory into the program install directory and that is that. Source: "e:\Path\To\erlang\*"; DestDir: "{app}\erlang"; Flags: ignoreversion recursesubdirs createallsubdirs Sergej On Fri, Apr 6, 2012 at 4:46 AM, Kaiduan Xie wrote: > Hi all, > > I am considering to use Erlang/Yaws/Another Erlang application for a > project on Windows platform. The major obstacle is to roll out an > all-in-one installer which installs Erlang/Yaws/Another Erlang > application in ONE step. It seems this is not that easy. Any idea on > how to make the installation easy for end user? > > Thanks for sharing your experience and thought, > > /Kaiduan > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From avinash@REDACTED Fri Apr 6 09:36:16 2012 From: avinash@REDACTED (Avinash Dhumane) Date: Fri, 06 Apr 2012 13:06:16 +0530 Subject: [erlang-questions] Becoming distributed on Windows Message-ID: When Windows is booted up, below undesirable is observed. Please. Thanks. ----------------------------- Krishna@REDACTED ~ $ erl Eshell V5.8.3 (abort with ^G) 1> net_kernel:start([abc, shortnames]). =INFO REPORT==== 6-Apr-2012::12:47:29 === Protocol: "inet_tcp": register error: {{badmatch,{error,econnrefused}}, [{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,{shutdown,{child,undefined,net_sup_dynamic, {erl_distribution,start_link,[[abc,shortnames]]}, permanent,1000,supervisor, [erl_distribution]}}} 2> q(). ok 3> Krishna@REDACTED ~ $ erl -sname abc Eshell V5.8.3 (abort with ^G) (abc@REDACTED)1> q(). ok (abc@REDACTED)2> Krishna@REDACTED ~ $ erl Eshell V5.8.3 (abort with ^G) 1> net_kernel:start([abc, shortnames]). {ok,<0.32.0>} (abc@REDACTED)2> q(). ok 3> Krishna@REDACTED ~ $ erl Eshell V5.8.3 (abort with ^G) 1> net_kernel:start([foo, shortnames]). {ok,<0.32.0>} (foo@REDACTED)2> net_kernel:stop(). ok 3> q(). ok 4> Krishna@REDACTED ~ $ ----------------------------- PS: Erlang is installed using the default binary executable installer for Windows. From dave@REDACTED Fri Apr 6 09:59:40 2012 From: dave@REDACTED (Dave Cottlehuber) Date: Fri, 6 Apr 2012 09:59:40 +0200 Subject: [erlang-questions] Becoming distributed on Windows In-Reply-To: References: Message-ID: On 6 April 2012 09:36, Avinash Dhumane wrote: > When Windows is booted up, below undesirable is observed. Please. Thanks. > > ----------------------------- > Krishna@REDACTED ~ > $ erl > Eshell V5.8.3 ?(abort with ^G) > 1> net_kernel:start([abc, shortnames]). > > =INFO REPORT==== 6-Apr-2012::12:47:29 === > Protocol: "inet_tcp": register error: {{badmatch,{error,econnrefused}}, You'll likely need to allow epmd and erl*.exe permissions through windows firewall. Depending on your setup & if you've a custom firewall installed there are other erl* binaries that might require it. Let us know what works in the end. Thanks Dave From dm.klionsky@REDACTED Fri Apr 6 10:10:34 2012 From: dm.klionsky@REDACTED (Dmitry Klionsky) Date: Fri, 06 Apr 2012 11:10:34 +0300 Subject: [erlang-questions] Becoming distributed on Windows In-Reply-To: References: Message-ID: <4F7EA4FA.3000009@gmail.com> On 04/06/2012 10:59 AM, Dave Cottlehuber wrote: > On 6 April 2012 09:36, Avinash Dhumane wrote: >> When Windows is booted up, below undesirable is observed. Please. Thanks. >> >> ----------------------------- >> Krishna@REDACTED ~ >> $ erl >> Eshell V5.8.3 (abort with ^G) >> 1> net_kernel:start([abc, shortnames]). >> >> =INFO REPORT==== 6-Apr-2012::12:47:29 === >> Protocol: "inet_tcp": register error: {{badmatch,{error,econnrefused}}, > You'll likely need to allow epmd and erl*.exe permissions through > windows firewall. > Depending on your setup& if you've a custom firewall installed there are other > erl* binaries that might require it. > > Let us know what works in the end. > > Thanks > Dave > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions I'd say this isn't the firewall who causes the problem, because the net_kernel:start succeeds eventually. Seems like the epmd isn't yet started and this is why you get the {error,econnrefused}. -- Best regards, Dmitry Klionsky From avinash@REDACTED Fri Apr 6 12:23:08 2012 From: avinash@REDACTED (Avinash Dhumane) Date: Fri, 06 Apr 2012 15:53:08 +0530 Subject: [erlang-questions] Becoming distributed on Windows In-Reply-To: <4F7EA4FA.3000009@gmail.com> References: <4F7EA4FA.3000009@gmail.com> Message-ID: On my Windows system (with Cygwin shell started as "Run As Administrator"), "epmd -daemon" does not seem to work: ------------------- $ netstat -a |grep 4369 Krishna@REDACTED ~ $ epmd -daemon Krishna@REDACTED ~ $ netstat -a |grep 4369 Krishna@REDACTED ~ $ epmd -names epmd: Cannot connect to local epmd ------------------- If started without -daemon option (or, with -sname to erl), it does work: --------- Krishna@REDACTED ~ $ epmd& [1] 4908 Krishna@REDACTED ~ $ netstat -a |grep 4369 TCP 0.0.0.0:4369 Karma:0 LISTENING Krishna@REDACTED ~ $ epmd -names epmd: up and running on port 4369 with data: Krishna@REDACTED ~ $ ------------ So, the 'econnrefused' error occurs when 'erl' is started without distributed mode (which is a requirement of the application) and when net_kernel:start() is called to become distributed (again, a requirement of the application, which controls the degree of distribution). Currently, I will live with running epmd without -daemon option (but in the background) as a step of the startup sequence in setting up the application environment and preconditions, till further understanding arrives. Thanks On Fri, 06 Apr 2012 13:40:34 +0530, Dmitry Klionsky wrote: > On 04/06/2012 10:59 AM, Dave Cottlehuber wrote: >> On 6 April 2012 09:36, Avinash Dhumane wrote: >>> When Windows is booted up, below undesirable is observed. Please. >>> Thanks. >>> >>> ----------------------------- >>> Krishna@REDACTED ~ >>> $ erl >>> Eshell V5.8.3 (abort with ^G) >>> 1> net_kernel:start([abc, shortnames]). >>> >>> =INFO REPORT==== 6-Apr-2012::12:47:29 === >>> Protocol: "inet_tcp": register error: {{badmatch,{error,econnrefused}}, >> You'll likely need to allow epmd and erl*.exe permissions through >> windows firewall. >> Depending on your setup& if you've a custom firewall installed there >> are other >> erl* binaries that might require it. >> >> Let us know what works in the end. >> >> Thanks >> Dave >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > I'd say this isn't the firewall who causes the problem, because the > net_kernel:start succeeds eventually. > Seems like the epmd isn't yet started and this is why you get the > {error,econnrefused}. > -- Using Opera's revolutionary email client: http://www.opera.com/mail/ From per@REDACTED Fri Apr 6 12:39:03 2012 From: per@REDACTED (Per Hedeland) Date: Fri, 6 Apr 2012 12:39:03 +0200 (CEST) Subject: [erlang-questions] how to flush a gen_tcp socket on close? In-Reply-To: <20120404221334.GA3266@corelatus.se> Message-ID: <201204061039.q36Ad3GT051945@pluto.hedeland.org> Matthias Lang wrote: > >On Tuesday, April 03, Andreas Schultz wrote: > >> In my case the receiver is to slow to process all the data, sender >> does 10k packets of 1k size, the receiver only gets the first 2000 >> packets. It might well be that I hit the close timeout and inet >> discards the rest of the send queue. > >Ok, that's something to go on. And I note that we have moved from the initial suspicion of "buffered data is not flushed out, but simply discarded" to an observation of the flushing doing a less than stellar job in specific circumstances. But I'll admit to being unaware that it did such a bad job in circumstances that aren't extremely unusual. Those circumstances being roughly "our sending is so far ahead of the receiver's consumption of data that a) the TCP window is closed, b) the kernel-level socket send buffer is full, and c) inet_drv has written data into its user-level queue". >I had a bit of a dig in prim_inet.erl. It sounds like you've looked >there too. That code looks like it's intended to loop 'forever' trying >to send the queued data, as long as some progress is made every so often >(always sends at least something in every 5s timeout period). But running >my program suggests that isn't happening as intended. Yes, that code looks sort-of reasonable (modulo the bug you possibly found), but it isn't really. I think we want to define "progress" as "the receiver read *something* off his end of the connection". But the check for progress is the size of the user-level queue, i.e. c) above, and that is pretty far removed from this definition of progress: Reading of data is not immediately reflected in opening of the TCP window (see "silly window syndrome" - this is true for any non-broken TCP implementation), and sending of data from the socket send buffer, once the window *has* opened, may not immediately trigger poll(POLLOUT) (this is true at least for the Linux version I experimented with, but is probably common) - and this is what is required for the user-level queue to shrink. Finally, requiring progress at all is a rather arbitrary decision. We might want to keep trying as long as we have evidence that the receiver is even alive and possibly willing to read more at some point in the future. This is what TCP/kernel does when you close(2) the OS-level TCP socket with unsent data - even if the TCP window remains closed, it will retain the buffer and keep sending window probes, as long as those probes elicit ACKs from the other end. In fact this behavior is pretty much spelled out in the venerable RFC 793, so it could be argued that gen_tcp violates the TCP spec when it "gives up" on the close. >> The fix should be simple, limit the send queue size. > >To what? > >Zero seems to be the only value that will work even for arbitrarily slow >clients. And that defeats the point of having a send queue. Exactly - which raises the question, what *is* the point of having a send queue? I.e. the user-level queue that inet_drv maintains, and which is causing these problems. I don't know, but since Tony has joined the discussion, maybe he can answer.:-) >It's late, I might have outsmarted myself, but my current feeling is >that erlang is quietly tossing data and it shouldn't be. I agree. >Waiting for as long as it takes in close() seems like the right thing, >though Per might disagree. Well, as I wrote earlier, I don't expect close() to block until all data is sent - in fact I don't expect it to block at all. We already have a potentially-blocking send() call, with an optional timeout even (unlike close()), why shouldn't that be enough? Your suggestion should get the job done, but it would block until the user-level queue has drained, which may in principle be forever. > Waiting for N seconds in close() and then >returning an error if the queue didn't empty would also be better than >just quietly tossing it. Maybe - but when you close(2) the OS-level socket (without SO_LINGER), you are anyway saying that you don't want to be informed about the final outcome, and if the receiver dies before reading all the data, you won't be told. I don't think it makes a lot of sense to inform specifically about the failure to drain the user-level queue - it might even give the false impression that you will always be told about failures. >(And: yes, I know, application-level ACKs would avoid this >problem. But I'm not quite ready to say that this problem can't be >fixed.) I'm tempted to refer to the FAQ entry about Erlang message passing where you quote other ramblings of mine - how much reliability do you want? If someone's life depends on the receiver consuming all the data and acting on it, you'd better have application-level ACKs despite the fact that TCP (like Erlang message passing) is "reliable". If it's just a question about whether a jpeg gets displayed in a web browser, probably not. But it's reasonable to expect that if the networks, hosts, and applications keep running, and the user doesn't close the tab in his browser, that jpeg *should* eventually be displayed in full even if the user is on a slow dialup and the sender has long since completed his close() call and gone on to other business (or even called it a day). gen_tcp:close/1 doesn't meet this expectation. --Per From erlang@REDACTED Fri Apr 6 13:41:03 2012 From: erlang@REDACTED (Joe Armstrong) Date: Fri, 6 Apr 2012 13:41:03 +0200 Subject: [erlang-questions] flash clauses vs nested clauses In-Reply-To: <1333639379.63901.YahooMailNeo@web112618.mail.gq1.yahoo.com> References: <1333639379.63901.YahooMailNeo@web112618.mail.gq1.yahoo.com> Message-ID: On Thu, Apr 5, 2012 at 5:22 PM, Pablo Platt wrote: > Hi, > > Is there a difference in performance between using nested clauses and flat clauses > or is the compiler smart enough to produce the same optimizations? It's smart :-) If you take the first code and compile with erlc -S you'll see that I mean. If we compile: somefun(a1, b1, c1) -> res1; somefun(a1, b1, c2) -> res2; somefun(a1, b1, c3) -> res3; somefun(a1, b2, c1) -> res4; somefun(a1, b2, c2) -> res5; somefun(a2, b1, c1) -> res6; somefun(a2, b1, c2) -> res7. The generated code is {function, somefun, 3, 2}. {label,1}. {line,[{location,"try1.erl",4}]}. {func_info,{atom,try1},{atom,somefun},3}. {label,2}. {test,is_atom,{f,1},[{x,0}]}. {select_val,{x,0},{f,1},{list,[{atom,a2},{f,3},{atom,a1},{f,6}]}}. <======= Look at this {label,3}. {test,is_eq_exact,{f,1},[{x,1},{atom,b1}]}. {test,is_atom,{f,1},[{x,2}]}. {select_val,{x,2},{f,1},{list,[{atom,c2},{f,4},{atom,c1},{f,5}]}}. ... etc The important line is {select_val,{x,0},{f,1},{list,[{atom,a2},{f,3},{atom,a1},{f,6}]}}. Which means if the first argument of the function is is a2 jump to label 3 or if it's a1 jump to label 6 - and this in turn is essentially what the second form of the code is. The a1 value is only tested once. The beam loader will in turn this into some efficient code when it is loaded. In general the pattern matching compiler tries to produce an optimal decision tree from the set of patterns you give it. Trying to outguess the compiler is a waste of effort. Your should always aim for the code that expresses your intent as clearly as possible. Optimisation is usually best performed by changing the algorithms and not messing with the details of exactly how the pattern matching works. Even if there were to be a in performance between the two methods you chose you could never guarantee that this would persist into the future the compiler could be changed in the future in a way that reversed your results. /Joe > > For example: > > somefun(a1, b1, c1) -> > ??? res1; > somefun(a1, b1, c2) -> > ??? res2; > somefun(a1, b1, c3) -> > ??? res3; > somefun(a1, b2, c1) -> > ??? res4; > somefun(a1, b2, c2) -> > ??? res5; > somefun(a2, b1, c1) -> > ??? res6; > somefun(a2, b1, c2) -> > ??? res7; > ... > somefun(a10, b10, c10) -> > ??? res10. > > > and > > somefun(a1, B, C) -> > ??? case B of > ??? ??? b1 -> > ??? ??? ??? case C of > ??? ??? ??? ??? c1 -> res1; > > ??? ??? ??? ??? c2 -> res2; > > ??? ??? ??? ??? c3 -> res3 > > ??? ??? ??? end; > ??? ??? b2 -> > ??? ??? ??? case C of > ??? ??? ??? ??? C1 -> res4; > > ??? ??? ??? ??? C2 -> res5 > ??? ??? ??? end > > ???? end; > somefun(a2, B, C) -> > ??? ... > > Thanks > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From ulf@REDACTED Fri Apr 6 13:42:32 2012 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 6 Apr 2012 13:42:32 +0200 Subject: [erlang-questions] how to flush a gen_tcp socket on close? In-Reply-To: <201204061039.q36Ad3GT051945@pluto.hedeland.org> References: <201204061039.q36Ad3GT051945@pluto.hedeland.org> Message-ID: <8FE4C965-67FF-4803-BA87-169F02B6EE79@feuerlabs.com> On 6 Apr 2012, at 12:39, Per Hedeland wrote: > Exactly - which raises the question, what *is* the point of having a > send queue? I.e. the user-level queue that inet_drv maintains, and which > is causing these problems. I don't know, but since Tony has joined the > discussion, maybe he can answer.:-) Far enough removed from the question - not having looked into the code - I may end up with egg on my face for butting in, but? I recall diskussions about the send queue being there to make sending non-blocking from the erlang side, even if the socket returns EAGAIN. This was taken a step further when trying to optimize e.g. the AXD 301 & co, such that one could opt to always enter the send queue directly. This achieved a 'bulking' effect which significantly (10-20%, if I recall) improved throughput. (This would be the {delay_send, boolean()} option. If this isn't relevant to the discussion at hand, my apologies). BR, Ulf W -------------- next part -------------- An HTML attachment was scrubbed... URL: From per@REDACTED Fri Apr 6 15:23:05 2012 From: per@REDACTED (Per Hedeland) Date: Fri, 6 Apr 2012 15:23:05 +0200 (CEST) Subject: [erlang-questions] how to flush a gen_tcp socket on close? In-Reply-To: <28A532E8-F31D-45F0-810B-E04C4CAE5344@rogvall.se> Message-ID: <201204061323.q36DN5ZS054940@pluto.hedeland.org> Tony Rogvall wrote: > >First of all the right way: send, shutdown wait for close is not working here as would have been >my first answer :-) Hm, why do you (too) bring shutdown into this discussion? Surely you are not suggesting that it should be a requirement to call gen_tcp:shutdown/2 before gen_tcp:close/1 in order to get buffered data delivered? The gen_tcp interface is a very nice simplification of the low-level socket API - why should it be *more* complex than the low-level API in this particular case? I will maintain that the only reason to use shutdown is when you want to do a "half close", or even only when you want to do a "half close in the send direction". What's the point otherwise? >Then I moved the subscription code to just wait for the empty queue event, and NOT do the timeout. >This worked well. But will potentially block forever. > My interpretation is that the reader is so slow, so that the write side >"write ready" is not signaled and no more data goes down to kernel space (probably some threshold.) >This will keep the pending data at the same level, and hence timeout. Agreed. >So how would a workaround look like ? IMO the *fix* is to not have a user-level queue at all, and thus always have gen_tcp:send/2 block until everything has been written to the socket. I don't expect this fix to happen though, but it should at least be possible to disable the user-level queue, by passing options {high_watermark, 1}, {low_watermark, 0}. However this doesn't work the way the code is currently written - send() will never block if the queue is empty before the call. The patch below fixes this, and with it I can run Matt's test successfully (after fixing some "bad" assumptions) if I use the watermark-setting. >One way is to make sure that the kernel buffer is smaller (now I can send 160K). Use what ever size that >make sense with the knowledge of the inet built in time out timer (5 secs) > >An other way to fix this could be to try to add kernel buffer space to send_pend but that is >pretty os dependent :-) Both of these suffer from the effect of "silly window avoidance" - i.e. even if they improve the coupling "more data is sent" => "send queue shrinks", they do not help with the coupling "more data is read" => "more data is sent". And they don't at all address the "keep trying as long as the receiver is alive" goal. --Per --- otp_src_R15B01/erts/emulator/drivers/common/inet_drv.c.ORIG 2012-04-01 20:15:00.000000000 +0200 +++ otp_src_R15B01/erts/emulator/drivers/common/inet_drv.c 2012-04-06 13:18:59.000000000 +0200 @@ -9396,6 +9396,19 @@ return -1; } +static void tcp_set_busy(tcp_descriptor* desc) +{ + DEBUGF(("tcp_sendv(%ld): s=%d, sender forced busy\r\n", + (long)desc->inet.port, desc->inet.s)); + desc->inet.state |= INET_F_BUSY; /* mark for low-watermark */ + desc->inet.busy_caller = desc->inet.caller; + set_busy_port(desc->inet.port, 1); + if (desc->send_timeout != INET_INFINITY) { + desc->busy_on_send = 1; + driver_set_timer(desc->inet.port, desc->send_timeout); + } +} + /* ** Send non-blocking vector data */ @@ -9439,15 +9452,7 @@ if ((sz = driver_sizeq(ix)) > 0) { driver_enqv(ix, ev, 0); if (sz+ev->size >= desc->high) { - DEBUGF(("tcp_sendv(%ld): s=%d, sender forced busy\r\n", - (long)desc->inet.port, desc->inet.s)); - desc->inet.state |= INET_F_BUSY; /* mark for low-watermark */ - desc->inet.busy_caller = desc->inet.caller; - set_busy_port(desc->inet.port, 1); - if (desc->send_timeout != INET_INFINITY) { - desc->busy_on_send = 1; - driver_set_timer(desc->inet.port, desc->send_timeout); - } + tcp_set_busy(desc); return 1; } } @@ -9490,8 +9495,13 @@ DEBUGF(("tcp_sendv(%ld): s=%d, Send failed, queuing\r\n", (long)desc->inet.port, desc->inet.s)); driver_enqv(ix, ev, n); - if (!INETP(desc)->is_ignored) + if (!INETP(desc)->is_ignored) { sock_select(INETP(desc),(FD_WRITE|FD_CLOSE), 1); + if (driver_sizeq(ix) >= desc->high) { + tcp_set_busy(desc); + return 1; + } + } } return 0; } @@ -9536,15 +9546,7 @@ driver_enq(ix, buf, h_len); driver_enq(ix, ptr, len); if (sz+h_len+len >= desc->high) { - DEBUGF(("tcp_send(%ld): s=%d, sender forced busy\r\n", - (long)desc->inet.port, desc->inet.s)); - desc->inet.state |= INET_F_BUSY; /* mark for low-watermark */ - desc->inet.busy_caller = desc->inet.caller; - set_busy_port(desc->inet.port, 1); - if (desc->send_timeout != INET_INFINITY) { - desc->busy_on_send = 1; - driver_set_timer(desc->inet.port, desc->send_timeout); - } + tcp_set_busy(desc); return 1; } } @@ -9590,8 +9592,13 @@ n -= h_len; driver_enq(ix, ptr+n, len-n); } - if (!INETP(desc)->is_ignored) + if (!INETP(desc)->is_ignored) { sock_select(INETP(desc),(FD_WRITE|FD_CLOSE), 1); + if (driver_sizeq(ix) >= desc->high) { + tcp_set_busy(desc); + return 1; + } + } } return 0; } From tony@REDACTED Fri Apr 6 16:01:28 2012 From: tony@REDACTED (Tony Rogvall) Date: Fri, 6 Apr 2012 16:01:28 +0200 Subject: [erlang-questions] how to flush a gen_tcp socket on close? In-Reply-To: <201204061039.q36Ad3GT051945@pluto.hedeland.org> References: <201204061039.q36Ad3GT051945@pluto.hedeland.org> Message-ID: <75E45F4B-CFEB-4496-9A14-6D5249F836A1@rogvall.se> On 6 apr 2012, at 12:39, Per Hedeland wrote: > Matthias Lang wrote: >> >> On Tuesday, April 03, Andreas Schultz wrote: >> >>> In my case the receiver is to slow to process all the data, sender >>> does 10k packets of 1k size, the receiver only gets the first 2000 >>> packets. It might well be that I hit the close timeout and inet >>> discards the rest of the send queue. >> >> Ok, that's something to go on. > > And I note that we have moved from the initial suspicion of "buffered > data is not flushed out, but simply discarded" to an observation of the > flushing doing a less than stellar job in specific circumstances. But > I'll admit to being unaware that it did such a bad job in circumstances > that aren't extremely unusual. Those circumstances being roughly "our > sending is so far ahead of the receiver's consumption of data that a) > the TCP window is closed, b) the kernel-level socket send buffer is > full, and c) inet_drv has written data into its user-level queue". > I had to do some digging myself to realize the same fact :-) >> I had a bit of a dig in prim_inet.erl. It sounds like you've looked >> there too. That code looks like it's intended to loop 'forever' trying >> to send the queued data, as long as some progress is made every so often >> (always sends at least something in every 5s timeout period). But running >> my program suggests that isn't happening as intended. > > Yes, that code looks sort-of reasonable (modulo the bug you possibly > found), but it isn't really. I think we want to define "progress" as > "the receiver read *something* off his end of the connection". But the > check for progress is the size of the user-level queue, i.e. c) above, > and that is pretty far removed from this definition of progress: Reading > of data is not immediately reflected in opening of the TCP window (see > "silly window syndrome" - this is true for any non-broken TCP > implementation), and sending of data from the socket send buffer, once > the window *has* opened, may not immediately trigger poll(POLLOUT) (this > is true at least for the Linux version I experimented with, but is > probably common) - and this is what is required for the user-level queue > to shrink. > That is pretty much what I found as well. > Finally, requiring progress at all is a rather arbitrary decision. We > might want to keep trying as long as we have evidence that the receiver > is even alive and possibly willing to read more at some point in the > future. This is what TCP/kernel does when you close(2) the OS-level TCP > socket with unsent data - even if the TCP window remains closed, it will > retain the buffer and keep sending window probes, as long as those > probes elicit ACKs from the other end. In fact this behavior is pretty > much spelled out in the venerable RFC 793, so it could be argued that > gen_tcp violates the TCP spec when it "gives up" on the close. > Maybe reading some stats about the socket to mimic the TCP behavior is needed then? >>> The fix should be simple, limit the send queue size. >> >> To what? >> >> Zero seems to be the only value that will work even for arbitrarily slow >> clients. And that defeats the point of having a send queue. > > Exactly - which raises the question, what *is* the point of having a > send queue? I.e. the user-level queue that inet_drv maintains, and which > is causing these problems. I don't know, but since Tony has joined the > discussion, maybe he can answer.:-) > I remember us hacking a proxy more that 10 years ago, then we had to tweak sndbuf size inorder to keep Windows not killing buffers with RST.Iif I remember correctly we also had to keep a low memory footprint per connection in order to have plenty of them. (too many dialup clients at that time) Remember that inet_drv is not only used by gen_tcp but is also used by distribution. The internal port queues are a great place to push stuff when you should be blocking, but are not really ready to do that yet :-) To push wouldblock back to Erlang could be a way of handling the problem and let Erlang get the POLLOUT signal etc. But WE did not design it that way :-) Plenty of history around the inet_drv, not saying it is doing the correct thing or even close but it is an explanation. >> It's late, I might have outsmarted myself, but my current feeling is >> that erlang is quietly tossing data and it shouldn't be. > > I agree. > >> Waiting for as long as it takes in close() seems like the right thing, >> though Per might disagree. > > Well, as I wrote earlier, I don't expect close() to block until all data > is sent - in fact I don't expect it to block at all. We already have a > potentially-blocking send() call, with an optional timeout even (unlike > close()), why shouldn't that be enough? Your suggestion should get the > job done, but it would block until the user-level queue has drained, > which may in principle be forever. > While data is queued in user land and some stop the node (init:stop or ^C ...) This data will be discarded, while if data made it into kernel it will not, I do not see how this can be fixed (except using queues in user land) >> Waiting for N seconds in close() and then >> returning an error if the queue didn't empty would also be better than >> just quietly tossing it. > > Maybe - but when you close(2) the OS-level socket (without SO_LINGER), > you are anyway saying that you don't want to be informed about the final > outcome, and if the receiver dies before reading all the data, you won't > be told. I don't think it makes a lot of sense to inform specifically > about the failure to drain the user-level queue - it might even give the > false impression that you will always be told about failures. > >> (And: yes, I know, application-level ACKs would avoid this >> problem. But I'm not quite ready to say that this problem can't be >> fixed.) > > I'm tempted to refer to the FAQ entry about Erlang message passing where > you quote other ramblings of mine - how much reliability do you want? > If someone's life depends on the receiver consuming all the data and > acting on it, you'd better have application-level ACKs despite the fact > that TCP (like Erlang message passing) is "reliable". If it's just a > question about whether a jpeg gets displayed in a web browser, probably > not. > > But it's reasonable to expect that if the networks, hosts, and > applications keep running, and the user doesn't close the tab in his > browser, that jpeg *should* eventually be displayed in full even if the > user is on a slow dialup and the sender has long since completed his > close() call and gone on to other business (or even called it a day). > gen_tcp:close/1 doesn't meet this expectation. > Agreed. /Tony > --Per > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions "Installing applications can lead to corruption over time. Applications gradually write over each other's libraries, partial upgrades occur, user and system errors happen, and minute changes may be unnoticeable and difficult to fix" -------------- next part -------------- An HTML attachment was scrubbed... URL: From tony@REDACTED Fri Apr 6 16:18:56 2012 From: tony@REDACTED (Tony Rogvall) Date: Fri, 6 Apr 2012 16:18:56 +0200 Subject: [erlang-questions] how to flush a gen_tcp socket on close? In-Reply-To: <201204061323.q36DN5ZS054940@pluto.hedeland.org> References: <201204061323.q36DN5ZS054940@pluto.hedeland.org> Message-ID: <16EB20EF-9BBE-4268-BD9A-3A8B28667CCE@rogvall.se> On 6 apr 2012, at 15:23, Per Hedeland wrote: > Tony Rogvall wrote: >> >> First of all the right way: send, shutdown wait for close is not working here as would have been >> my first answer :-) > > Hm, why do you (too) bring shutdown into this discussion? Surely you are > not suggesting that it should be a requirement to call > gen_tcp:shutdown/2 before gen_tcp:close/1 in order to get buffered data > delivered? The gen_tcp interface is a very nice simplification of the > low-level socket API - why should it be *more* complex than the > low-level API in this particular case? > I was only trying an alternative to close that would not stop the reading side just to check if shutdown had the same problem. And it had. Simple as that. > I will maintain that the only reason to use shutdown is when you want to > do a "half close", or even only when you want to do a "half close in the > send direction". What's the point otherwise? > Of course, I do not see your point ? I will maintain that if you want to be sure that the other side actually got all your data then use shutdown followed by "wait for close". >> Then I moved the subscription code to just wait for the empty queue event, and NOT do the timeout. >> This worked well. > > But will potentially block forever. > I know that! I was still looking for the "bug". >> My interpretation is that the reader is so slow, so that the write side >> "write ready" is not signaled and no more data goes down to kernel space (probably some threshold.) >> This will keep the pending data at the same level, and hence timeout. > > Agreed. > >> So how would a workaround look like ? > > IMO the *fix* is to not have a user-level queue at all, and thus always > have gen_tcp:send/2 block until everything has been written to the > socket. I don't expect this fix to happen though, but it should at least > be possible to disable the user-level queue, by passing options > {high_watermark, 1}, {low_watermark, 0}. However this doesn't work the > way the code is currently written - send() will never block if the queue > is empty before the call. The patch below fixes this, and with it I can > run Matt's test successfully (after fixing some "bad" assumptions) if I > use the watermark-setting. > Cool. Lets see if this "remove inet_drv queue" is reasonable, did you check the effects on erlang distribution ? >> One way is to make sure that the kernel buffer is smaller (now I can send 160K). Use what ever size that >> make sense with the knowledge of the inet built in time out timer (5 secs) >> >> An other way to fix this could be to try to add kernel buffer space to send_pend but that is >> pretty os dependent :-) > > Both of these suffer from the effect of "silly window avoidance" - i.e. > even if they improve the coupling "more data is sent" => "send queue > shrinks", they do not help with the coupling "more data is read" => > "more data is sent". And they don't at all address the "keep trying as > long as the receiver is alive" goal. > Is there any way of mimic the kernel in this sense ? /Tony > --Per > > > --- otp_src_R15B01/erts/emulator/drivers/common/inet_drv.c.ORIG 2012-04-01 20:15:00.000000000 +0200 > +++ otp_src_R15B01/erts/emulator/drivers/common/inet_drv.c 2012-04-06 13:18:59.000000000 +0200 > @@ -9396,6 +9396,19 @@ > return -1; > } > > +static void tcp_set_busy(tcp_descriptor* desc) > +{ > + DEBUGF(("tcp_sendv(%ld): s=%d, sender forced busy\r\n", > + (long)desc->inet.port, desc->inet.s)); > + desc->inet.state |= INET_F_BUSY; /* mark for low-watermark */ > + desc->inet.busy_caller = desc->inet.caller; > + set_busy_port(desc->inet.port, 1); > + if (desc->send_timeout != INET_INFINITY) { > + desc->busy_on_send = 1; > + driver_set_timer(desc->inet.port, desc->send_timeout); > + } > +} > + > /* > ** Send non-blocking vector data > */ > @@ -9439,15 +9452,7 @@ > if ((sz = driver_sizeq(ix)) > 0) { > driver_enqv(ix, ev, 0); > if (sz+ev->size >= desc->high) { > - DEBUGF(("tcp_sendv(%ld): s=%d, sender forced busy\r\n", > - (long)desc->inet.port, desc->inet.s)); > - desc->inet.state |= INET_F_BUSY; /* mark for low-watermark */ > - desc->inet.busy_caller = desc->inet.caller; > - set_busy_port(desc->inet.port, 1); > - if (desc->send_timeout != INET_INFINITY) { > - desc->busy_on_send = 1; > - driver_set_timer(desc->inet.port, desc->send_timeout); > - } > + tcp_set_busy(desc); > return 1; > } > } > @@ -9490,8 +9495,13 @@ > DEBUGF(("tcp_sendv(%ld): s=%d, Send failed, queuing\r\n", > (long)desc->inet.port, desc->inet.s)); > driver_enqv(ix, ev, n); > - if (!INETP(desc)->is_ignored) > + if (!INETP(desc)->is_ignored) { > sock_select(INETP(desc),(FD_WRITE|FD_CLOSE), 1); > + if (driver_sizeq(ix) >= desc->high) { > + tcp_set_busy(desc); > + return 1; > + } > + } > } > return 0; > } > @@ -9536,15 +9546,7 @@ > driver_enq(ix, buf, h_len); > driver_enq(ix, ptr, len); > if (sz+h_len+len >= desc->high) { > - DEBUGF(("tcp_send(%ld): s=%d, sender forced busy\r\n", > - (long)desc->inet.port, desc->inet.s)); > - desc->inet.state |= INET_F_BUSY; /* mark for low-watermark */ > - desc->inet.busy_caller = desc->inet.caller; > - set_busy_port(desc->inet.port, 1); > - if (desc->send_timeout != INET_INFINITY) { > - desc->busy_on_send = 1; > - driver_set_timer(desc->inet.port, desc->send_timeout); > - } > + tcp_set_busy(desc); > return 1; > } > } > @@ -9590,8 +9592,13 @@ > n -= h_len; > driver_enq(ix, ptr+n, len-n); > } > - if (!INETP(desc)->is_ignored) > + if (!INETP(desc)->is_ignored) { > sock_select(INETP(desc),(FD_WRITE|FD_CLOSE), 1); > + if (driver_sizeq(ix) >= desc->high) { > + tcp_set_busy(desc); > + return 1; > + } > + } > } > return 0; > } "Installing applications can lead to corruption over time. Applications gradually write over each other's libraries, partial upgrades occur, user and system errors happen, and minute changes may be unnoticeable and difficult to fix" -------------- next part -------------- An HTML attachment was scrubbed... URL: From pablo.platt@REDACTED Fri Apr 6 18:19:21 2012 From: pablo.platt@REDACTED (Pablo Platt) Date: Fri, 6 Apr 2012 09:19:21 -0700 (PDT) Subject: [erlang-questions] flash clauses vs nested clauses In-Reply-To: References: <1333639379.63901.YahooMailNeo@web112618.mail.gq1.yahoo.com> Message-ID: <1333729161.59202.YahooMailNeo@web112617.mail.gq1.yahoo.com> Thank you Jachym for the top about erlc -S and Joe for the excellent explanation. ----- Original Message ----- From: Joe Armstrong To: Pablo Platt Cc: Erlang Sent: Friday, April 6, 2012 2:41 PM Subject: Re: [erlang-questions] flash clauses vs nested clauses On Thu, Apr 5, 2012 at 5:22 PM, Pablo Platt wrote: > Hi, > > Is there a difference in performance between using nested clauses and flat clauses > or is the compiler smart enough to produce the same optimizations? It's smart :-) If you take the first code and compile with erlc -S you'll see that I mean. If we compile: somefun(a1, b1, c1) -> ? ? res1; somefun(a1, b1, c2) -> ? ? res2; somefun(a1, b1, c3) -> ? ? res3; somefun(a1, b2, c1) -> ? ? res4; somefun(a1, b2, c2) -> ? ? res5; somefun(a2, b1, c1) -> ? ? res6; somefun(a2, b1, c2) -> ? ? res7. The generated code is {function, somefun, 3, 2}. ? {label,1}. ? ? {line,[{location,"try1.erl",4}]}. ? ? {func_info,{atom,try1},{atom,somefun},3}. ? {label,2}. ? ? {test,is_atom,{f,1},[{x,0}]}. ? ? {select_val,{x,0},{f,1},{list,[{atom,a2},{f,3},{atom,a1},{f,6}]}}. ? ? ? <======= Look at this ? {label,3}. ? ? {test,is_eq_exact,{f,1},[{x,1},{atom,b1}]}. ? ? {test,is_atom,{f,1},[{x,2}]}. ? ? {select_val,{x,2},{f,1},{list,[{atom,c2},{f,4},{atom,c1},{f,5}]}}. ? ... etc The important line is {select_val,{x,0},{f,1},{list,[{atom,a2},{f,3},{atom,a1},{f,6}]}}. Which means if the first argument of the function is is a2 jump to label 3 or if it's a1 jump to label 6 - and this in turn is essentially what the second form of the code is. The a1 value is only tested once. The beam loader will in turn this into some efficient code when it is loaded. In general the pattern matching compiler tries to produce an optimal decision tree from the set of patterns you give it. Trying to outguess the compiler is a waste of effort. Your should always aim for the code that expresses your intent as clearly as possible. Optimisation is usually best performed by changing the algorithms and not messing with the details of exactly how the pattern matching works. Even if there were to be a in performance between the two methods you chose you could never guarantee that this would persist into the future the compiler could be changed in the future in a way that reversed your results. /Joe > > For example: > > somefun(a1, b1, c1) -> > ??? res1; > somefun(a1, b1, c2) -> > ??? res2; > somefun(a1, b1, c3) -> > ??? res3; > somefun(a1, b2, c1) -> > ??? res4; > somefun(a1, b2, c2) -> > ??? res5; > somefun(a2, b1, c1) -> > ??? res6; > somefun(a2, b1, c2) -> > ??? res7; > ... > somefun(a10, b10, c10) -> > ??? res10. > > > and > > somefun(a1, B, C) -> > ??? case B of > ??? ??? b1 -> > ??? ??? ??? case C of > ??? ??? ??? ??? c1 -> res1; > > ??? ??? ??? ??? c2 -> res2; > > ??? ??? ??? ??? c3 -> res3 > > ??? ??? ??? end; > ??? ??? b2 -> > ??? ??? ??? case C of > ??? ??? ??? ??? C1 -> res4; > > ??? ??? ??? ??? C2 -> res5 > ??? ??? ??? end > > ???? end; > somefun(a2, B, C) -> > ??? ... > > Thanks > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From comptekki@REDACTED Fri Apr 6 22:42:45 2012 From: comptekki@REDACTED (Wes James) Date: Fri, 6 Apr 2012 14:42:45 -0600 Subject: [erlang-questions] character output problems Message-ID: When putting some data in to riak or postgresql the data coming out isn't right. For instance the text going in to the database is: Ekologie lu?n?ch porost? But when a search is done on the data (via cowboy), the results coming out look like: Ekologie lu??n??ch porost?? When I was working with lists in the past (using yaws), it seemed to work, but the results coming out are binaries and I think the binary representation is causing the problem or converting from binary is causing the problem. ?Is there a way to fix this? When looking at the data in psql it looks right. Thanks, -wes From rexxe98@REDACTED Fri Apr 6 23:08:12 2012 From: rexxe98@REDACTED (Andrew Berman) Date: Fri, 6 Apr 2012 14:08:12 -0700 Subject: [erlang-questions] Split Cowboy's acceptor and HTTP code In-Reply-To: <20120403174805.GA26966@hijacked.us> References: <4F7AE069.1030904@ninenines.eu> <20120403174805.GA26966@hijacked.us> Message-ID: Loic, I think there are arguments for either approach, but I think way more important than doing this is to keep things the way they are and work on documentation. It's probably the single most important thing to help projects become "standard." I, for one, would really appreciate seeing more documentation and samples for Cowboy rather than more code changes. --Andrew On Tue, Apr 3, 2012 at 10:48 AM, Andrew Thompson wrote: > On Tue, Apr 03, 2012 at 07:43:51PM +0400, Max Lapshin wrote: > > If someone thinks that splitting single product into many infrastructure > > packages is "convenient", I want to mention horror with debian packaging > of > > erlang: erlang, erlang-base, erlang-tools, erlang-mnesia, etc > > > > Nothing but problems and as a result conflicting packages when you try to > > remove all that stuff and install package from esl. > > As a counterpoint, consider how riak is packaged, 25 deps, 19 of which > we maintain. > > In practice, we lock all the dependancies at release time, people > running HEAD might run into some temporary issues with out of sync deps, > but its not a common problem we see. > > You're also conflating erlang packaging with erlang *library* packaging. > I agree that erlang is often packaged extremely badly by distributions, > but if cowboy-acceptor is a version-locked dependancy of cowboy, there > should be little chance of them getting out of sync. > > Andrew > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From essen@REDACTED Fri Apr 6 23:51:27 2012 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Fri, 06 Apr 2012 23:51:27 +0200 Subject: [erlang-questions] Split Cowboy's acceptor and HTTP code In-Reply-To: References: <4F7AE069.1030904@ninenines.eu> <20120403174805.GA26966@hijacked.us> Message-ID: <4F7F655F.4030705@ninenines.eu> These are being worked on independently from any code change. And to be honest, most code changes these days do not come from me, as I spend most of my time thinking on how to best fit the remaining work into Cowboy rather than writing code. Of course I do that not by sitting there doing nothing, but by working on other things, including user guides. Cowboy already has a lot of documentation, everything is entirely explained through edoc (make docs). What it is lacking is user guides and tutorials to build real applications. It shouldn't take much longer to have something that can be pushed. However all the user guides written are post-0.6, meaning after the split occurs, even if it hasn't happened yet at this time. So the user guides will be on my github account for a while before we can merge it into Cowboy proper. As for the examples, someone has started porting misultin examples here: https://github.com/robertmeta/cowboy-examples and I'm hoping we can consolidate our and these examples into one repository later on. On 04/06/2012 11:08 PM, Andrew Berman wrote: > Loic, > > I think there are arguments for either approach, but I think way more > important than doing this is to keep things the way they are and work on > documentation. It's probably the single most important thing to help > projects become "standard." I, for one, would really appreciate seeing > more documentation and samples for Cowboy rather than more code changes. > > --Andrew > > On Tue, Apr 3, 2012 at 10:48 AM, Andrew Thompson wrote: > >> On Tue, Apr 03, 2012 at 07:43:51PM +0400, Max Lapshin wrote: >>> If someone thinks that splitting single product into many infrastructure >>> packages is "convenient", I want to mention horror with debian packaging >> of >>> erlang: erlang, erlang-base, erlang-tools, erlang-mnesia, etc >>> >>> Nothing but problems and as a result conflicting packages when you try to >>> remove all that stuff and install package from esl. >> >> As a counterpoint, consider how riak is packaged, 25 deps, 19 of which >> we maintain. >> >> In practice, we lock all the dependancies at release time, people >> running HEAD might run into some temporary issues with out of sync deps, >> but its not a common problem we see. >> >> You're also conflating erlang packaging with erlang *library* packaging. >> I agree that erlang is often packaged extremely badly by distributions, >> but if cowboy-acceptor is a version-locked dependancy of cowboy, there >> should be little chance of them getting out of sync. >> >> Andrew >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- Lo?c Hoguin Erlang Cowboy Nine Nines From rexxe98@REDACTED Sat Apr 7 00:28:20 2012 From: rexxe98@REDACTED (Andrew Berman) Date: Fri, 6 Apr 2012 15:28:20 -0700 Subject: [erlang-questions] Split Cowboy's acceptor and HTTP code In-Reply-To: <4F7F655F.4030705@ninenines.eu> References: <4F7AE069.1030904@ninenines.eu> <20120403174805.GA26966@hijacked.us> <4F7F655F.4030705@ninenines.eu> Message-ID: Cool, yeah I meant User Docs and Tutorials. They would be an amazing help! --Andrew On Fri, Apr 6, 2012 at 2:51 PM, Lo?c Hoguin wrote: > These are being worked on independently from any code change. And to be > honest, most code changes these days do not come from me, as I spend most > of my time thinking on how to best fit the remaining work into Cowboy > rather than writing code. Of course I do that not by sitting there doing > nothing, but by working on other things, including user guides. > > Cowboy already has a lot of documentation, everything is entirely > explained through edoc (make docs). What it is lacking is user guides and > tutorials to build real applications. > > It shouldn't take much longer to have something that can be pushed. > However all the user guides written are post-0.6, meaning after the split > occurs, even if it hasn't happened yet at this time. So the user guides > will be on my github account for a while before we can merge it into Cowboy > proper. > > As for the examples, someone has started porting misultin examples here: > https://github.com/robertmeta/**cowboy-examplesand I'm hoping we can consolidate our and these examples into one > repository later on. > > > On 04/06/2012 11:08 PM, Andrew Berman wrote: > >> Loic, >> >> I think there are arguments for either approach, but I think way more >> important than doing this is to keep things the way they are and work on >> documentation. It's probably the single most important thing to help >> projects become "standard." I, for one, would really appreciate seeing >> more documentation and samples for Cowboy rather than more code changes. >> >> --Andrew >> >> On Tue, Apr 3, 2012 at 10:48 AM, Andrew Thompson >> wrote: >> >> On Tue, Apr 03, 2012 at 07:43:51PM +0400, Max Lapshin wrote: >>> >>>> If someone thinks that splitting single product into many infrastructure >>>> packages is "convenient", I want to mention horror with debian packaging >>>> >>> of >>> >>>> erlang: erlang, erlang-base, erlang-tools, erlang-mnesia, etc >>>> >>>> Nothing but problems and as a result conflicting packages when you try >>>> to >>>> remove all that stuff and install package from esl. >>>> >>> >>> As a counterpoint, consider how riak is packaged, 25 deps, 19 of which >>> we maintain. >>> >>> In practice, we lock all the dependancies at release time, people >>> running HEAD might run into some temporary issues with out of sync deps, >>> but its not a common problem we see. >>> >>> You're also conflating erlang packaging with erlang *library* packaging. >>> I agree that erlang is often packaged extremely badly by distributions, >>> but if cowboy-acceptor is a version-locked dependancy of cowboy, there >>> should be little chance of them getting out of sync. >>> >>> Andrew >>> ______________________________**_________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/**listinfo/erlang-questions >>> >>> >> >> >> ______________________________**_________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/**listinfo/erlang-questions >> > > > -- > Lo?c Hoguin > Erlang Cowboy > Nine Nines > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tejaswi.h@REDACTED Sat Apr 7 00:33:26 2012 From: tejaswi.h@REDACTED (Tejaswi Haramurali) Date: Fri, 6 Apr 2012 15:33:26 -0700 Subject: [erlang-questions] Resources for QuickCheck and TyPer Message-ID: Thanks for your replies John and Tilman... I tried downloading Quickcheck from the link provided and run it, but however I was unable to. I followed the instructions in the ReadMe file and pasted the eqc- folder to the "lib" folder inside my Erlang installation folder, but still the "eqc:quickcheck" command doesnt work. Can you kindly help me out ? Is there anything I am missing ? regards, Tej -------------- next part -------------- An HTML attachment was scrubbed... URL: From magnus.klaar@REDACTED Sat Apr 7 01:20:20 2012 From: magnus.klaar@REDACTED (Magnus Klaar) Date: Sat, 7 Apr 2012 01:20:20 +0200 Subject: [erlang-questions] character output problems In-Reply-To: References: Message-ID: Hi! It looks like your input is being converted to a multibyte character encoding (such as utf-8, which we're most likely looking at in the second version) on its way from your brower, via the database and back to your browser. I must admit that i'm no expert and i did have to double check the terminology on wikipedia, but both the ? and ? characters in the output has an extra character tucked on, coincidentally these two characters are encoded as 196 and 197 in latin1, both valid values for a "leading byte" which are expected to be followed by one "continuation byte". TLDR; Are you declaring the correct charset in your markup? MVH Magnus On Fri, Apr 6, 2012 at 10:42 PM, Wes James wrote: > When putting some data in to riak or postgresql the data coming out > isn't right. For instance the text going in to the database is: > > Ekologie lu?n?ch porost? > > But when a search is done on the data (via cowboy), the results coming > out look like: > > Ekologie lu? n??ch porost?? > > When I was working with lists in the past (using yaws), it seemed to > work, but the results coming out are binaries and I think the binary > representation is causing the problem or converting from binary is > causing the problem. Is there a way to fix this? > > When looking at the data in psql it looks right. > > Thanks, > > -wes > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From comptekki@REDACTED Sat Apr 7 04:16:22 2012 From: comptekki@REDACTED (Wes James) Date: Fri, 6 Apr 2012 20:16:22 -0600 Subject: [erlang-questions] link in erlang.org FAQ Message-ID: In the FAQ http://www.erlang.org/faq/how_do_i.html#id51336 on unicode there is a link to "alpha code" that is broken. Anyone know where this code is? -wes From freeakk@REDACTED Sat Apr 7 11:01:17 2012 From: freeakk@REDACTED (Michael Uvarov) Date: Sat, 7 Apr 2012 13:01:17 +0400 Subject: [erlang-questions] link in erlang.org FAQ In-Reply-To: References: Message-ID: Hello, it is here. https://github.com/hypernumbers/starling These links can be also interesting: https://github.com/freeakk/ux https://github.com/freeakk/i18n -- Best regards, Uvarov Michael From gordon@REDACTED Sat Apr 7 13:10:33 2012 From: gordon@REDACTED (Gordon Guthrie) Date: Sat, 7 Apr 2012 12:10:33 +0100 Subject: [erlang-questions] link in erlang.org FAQ In-Reply-To: References: Message-ID: I just spoke to Hasan who used to work at Hypernumbers. He says that he no longer owns the 12 monkeys domain anymore so the FAQ should really just point to hypernumbers on github. Bit snarky that is is 'alpha' though, been in production for years :) Gordon On 7 April 2012 10:01, Michael Uvarov wrote: > Hello, > > it is here. > https://github.com/hypernumbers/starling > > These links can be also interesting: > > https://github.com/freeakk/ux > https://github.com/freeakk/i18n > > -- > Best regards, > Uvarov Michael > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- Gordon Guthrie CEO hypernumbers http://hypernumbers.com t: hypernumbers +44 7776 251669 -- Gordon Guthrie CEO hypernumbers http://hypernumbers.com t: hypernumbers +44 7776 251669 From grimlog@REDACTED Sat Apr 7 14:30:36 2012 From: grimlog@REDACTED (Michael Schreckenbauer) Date: Sat, 07 Apr 2012 14:30:36 +0200 Subject: [erlang-questions] Fear and Loathing in Programming La La Land In-Reply-To: <4F7CBBF4.3000104@fastmail.fm> References: <4CBF96FC-146A-4611-806C-170DDA6B14B0@cs.otago.ac.nz> <4F7CBBF4.3000104@fastmail.fm> Message-ID: <4682428.YCr9WW0CrR@pc> On Wednesday 04 April 2012 23:24:04 Jan Burse wrote: > Notice that in C++ it is not necessary ? > and in fact impossible ? to provide a > specialized constructor for const instances. > > I am not an expert for C++, but when the above > is true, then it is clear why setters are needed > and everything goes havoc. For example Java > doesn't have the above restriction, an immutable > object can have multiple constructors: > > class myKeyImmutableByConstructor { > int alfa; > int beta; > > myKeyImmutableByConstructor(int a, int b) { > alfa = a; > beta = b; > } > > myKeyImmutableByConstructor() { > alfa = 0; > beta = 0; > } > } > you are misreading the statement. Of course you can have multiple-constructors for immutable objects in C++ as in java. The statement talks about const *instances*, myKeyImmutableByConstructor and const myKeyImmutableByConstructor have the same constructors available,so you can write myKeyImmutableByConstructor inst; myKeyImmutableByConstructor inst(1, 2); const myKeyImmutableByConstructor const_inst; const myKeyImmutableByConstructor const_inst(1, 2); You cannot restrict constructors to be usable only with const_inst. > Bye Best, Michael From per@REDACTED Sat Apr 7 14:48:35 2012 From: per@REDACTED (Per Hedeland) Date: Sat, 7 Apr 2012 14:48:35 +0200 (CEST) Subject: [erlang-questions] how to flush a gen_tcp socket on close? In-Reply-To: <75E45F4B-CFEB-4496-9A14-6D5249F836A1@rogvall.se> Message-ID: <201204071248.q37CmZhv080715@pluto.hedeland.org> Sheesh, once again I find that if you want something done properly, you have to do it yourself.:-) Here I have three people, including the author of inet_drv, and a demo program, (and OK, some manual send()/recv()/close()-calling of mine in the shell seemed to confirm it) telling me that gen_tcp may lose data on close() - and it's simply not true! Short summary: It seems that the loop-wait in prim_inet is just smoke and mirrors, and should be removed - because inet_drv will *not* discard the user-level queue and close the OS socket when the port is closed. It faithfully keeps on sending from the queue as long as the OS socket is working. And as long as the node isn't stopped, of course - maybe that was the OP's problem? In which case I think the question should have been "how to know when all buffered data is sent and acked by the receiver?". Some more comments below for those that aren't fed up with the subject already. Tony Rogvall wrote: > >Remember that inet_drv is not only used by gen_tcp but is also used by distribution. >The internal port queues are a great place to push stuff when you should be blocking, >but are not really ready to do that yet :-) But I still find the way they are currently working to be strange / unexpected. If the socket buffer is "almost full", and we do two send() with ~ 5kB each, the second one will block and mark the port busy (due to the default 8kB high-water mark) - while doing a single send() with 10 *MB* will *not* block. My patch, which I still think is good, changes this - send() will block and the port be marked busy as soon as the high-water mark is reached, regardless of the state of the queue before the send(). >To push wouldblock back to Erlang could be a way of handling the problem >and let Erlang get the POLLOUT signal etc. But WE did not design it that way :-) Ouch no, we certainly don't want that! >Plenty of history around the inet_drv, not saying it is doing the correct thing or even close >but it is an explanation. I now - just as before this thread - think it is doing very close to the right thing. But I'm not sure if anyone really understands all the details of *how* it does it anymore... >While data is queued in user land and some stop the node (init:stop or ^C ...) >This data will be discarded, while if data made it into kernel it will not, >I do not see how this can be fixed (except using queues in user land) Hm, did you leave out a "not", i.e. "except not using queues in user land"? Otherwise I can't quite follow you. Anyway, at least having the choice to not use queues in user land would be good, I think - and with my patch you have it, by setting the high/low-water marks to 1/0. >On 6 apr 2012, at 12:39, Per Hedeland wrote: > >> But it's reasonable to expect that if the networks, hosts, and >> applications keep running, and the user doesn't close the tab in his >> browser, that jpeg *should* eventually be displayed in full even if the >> user is on a slow dialup and the sender has long since completed his >> close() call and gone on to other business (or even called it a day). >> gen_tcp:close/1 doesn't meet this expectation. >> >Agreed. Not by me anymore.:-) Well, except for "called it a day" I guess. >> I will maintain that the only reason to use shutdown is when you want to >> do a "half close", or even only when you want to do a "half close in the >> send direction". What's the point otherwise? >> >Of course, I do not see your point ? >I will maintain that if you want to be sure that the other side actually got all your data >then use shutdown followed by "wait for close". I *think* that you are talking about doing shutdown(write) + an expectation that the receiver will close when he gets tcp_closed/EOF + waiting for the tcp_closed resulting from that. That's a nice way to make sure that you aren't discarding anything due to stopping the node prematurely, but I'm not sure it guarantees that the other side got everything (e.g. is it possible to distinguish the case that he crashed before that?). But anyway my point was that it is completely point*less* to do a shutdown(read_write) before the close(), or even to *ever* do a shutdown(read_write) - and you didn't say otherwise, I just read something that wasn't there. >> IMO the *fix* is to not have a user-level queue at all, and thus always >> have gen_tcp:send/2 block until everything has been written to the >> socket. I don't expect this fix to happen though, but it should at least >> be possible to disable the user-level queue, by passing options >> {high_watermark, 1}, {low_watermark, 0}. However this doesn't work the >> way the code is currently written - send() will never block if the queue >> is empty before the call. The patch below fixes this, and with it I can >> run Matt's test successfully (after fixing some "bad" assumptions) if I >> use the watermark-setting. >> >Cool. Lets see if this "remove inet_drv queue" is reasonable, did you >check the effects on erlang distribution ? No - but the patch does *not* "remove inet_drv queue", only makes it possible to disable it if you really want to. And it changes the blocking behavior of send() per above. I don't *think* that the patch per se should have any significant effect on the distribution - having the distribution disable the queue may well have some bad effect, but I don't see any reason to do that. >> Both of these suffer from the effect of "silly window avoidance" - i.e. >> even if they improve the coupling "more data is sent" => "send queue >> shrinks", they do not help with the coupling "more data is read" => >> "more data is sent". And they don't at all address the "keep trying as >> long as the receiver is alive" goal. >> >Is there any way of mimic the kernel in this sense ? Not that I know of. --Per From barcojie@REDACTED Sat Apr 7 15:50:48 2012 From: barcojie@REDACTED (Barco You) Date: Sat, 7 Apr 2012 21:50:48 +0800 Subject: [erlang-questions] Push a message to cowboy websockets In-Reply-To: References: <4F636831.1020204@ninenines.eu> <4F638141.4040405@ninenines.eu> <4F63A004.7030802@ninenines.eu> Message-ID: Hi AD, I also tried to implement a websocket broadcast as you did in this mail. but I got crash in websocket_info as following. Could you please show me your complete code? thanks! my code is: websocket_init(_Any, Req, []) -> gproc:reg({p, l,{?MODULE, ?BC}}), Req2 = cowboy_http_req:compact(Req), {ok, Req2, undefined, hibernate}. websocket_handle({text, Msg}, Req, State) -> broadcast(Msg), {reply, {text, << "You said: ", Msg/binary >>}, Req, State, hibernate}; websocket_handle(_Any, Req, State) -> {ok, Req, State}. websocket_info({_Pid, {_Module, ?BC}, Msg}, Req, State) -> {reply, {text, <>}, Req, State, hibernate}. broadcast(Msg) -> gproc:send({p, l, {?MODULE, ?BC}}, {self(), {?MODULE, ?BC}, Msg}). ** Handler websocket_handler terminating in websocket_info/3 for the reason error:badarg ** Message was {<0.113.0>,{websocket_handler, "broadcast"},<<"hello server!">>} ** Options were [] ** Handler state was undefined ** Request was [{socket,#Port<0.940>}, {transport,cowboy_tcp_transport}, {connection,keepalive}, {pid,<0.113.0>}, {method,'GET'}, {version,{1,1}}, {peer,undefined}, {host,undefined}, {host_info,undefined}, {raw_host,<<"localhost">>}, {port,80}, {path,undefined}, {path_info,undefined}, {raw_path,<<"/websocket">>}, {qs_vals,undefined}, {raw_qs,<<>>}, {bindings,undefined}, {headers,[]}, {p_headers,[]}, {cookies,[]}, {meta,[{websocket_version,13}]}, {body_state,waiting}, {buffer,<<>>}, {resp_state,done}, {resp_headers,[]}, {resp_body,<<>>}, {urldecode,{#Fun,crash}}] ** Stacktrace: [{websocket_handler,websocket_info,3, [{file,"src/websocket_handler.erl"},{line,39}]}, {cowboy_http_websocket,handler_call,7, [{file,"src/cowboy_http_websocket.erl"},{line,389}]}] On Sat, Mar 17, 2012 at 4:56 AM, AD wrote: > Sigh, no. Thanks, its working perfectly now. > > -AD > > > On Fri, Mar 16, 2012 at 4:18 PM, Lo?c Hoguin wrote: > >> Did you start gproc? application:start(gproc) >> >> >> On 03/16/2012 09:05 PM, AD wrote: >> >>> Thanks, getting some stacktraces though... >>> >>> ** Handler ad_test terminating in websocket_init/3 >>> for the reason error:badarg >>> >>> i have >>> >>> /-define(WSBroadcast,"**wsbroadcast")./ >>> >>> then in websocket_init >>> >>> /gproc:reg({p, l, {?MODULE, ?WSBroadcast}})/ >>> / >>> >>> / >>> then in my handle() method in cowboy for a certain path >>> >>> /{URLPath,_Req2} = cowboy_http_req:path(Req),/ >>> / case lists:nth(1,URLPath) of/ >>> /<<"sendit">> -> / >>> /%io:format("Sending websocket !!~n"),/ >>> /Msg = "Test broadcast",/ >>> /gproc:send({p, l, {?MODULE,?WSBroadcast}}, {self(), >>> {?MODULE,?WSBroadcast}, Msg});/ >>> / >>> / >>> then in websocket_info >>> >>> w/ebsocket_info({_PID,{_**MODULE,_WSBroadcast},Msg},Req,**State) ->/ >>> /{reply, {text, <>}, Req, State, hibernate}./ >>> >>> >>> Any thoughts ? Looks like something with ets:insert >>> >>> ** Stacktrace: [{ets,insert_new, >>> [gproc, >>> [{{{p,l,{ad_test,"wsbroadcast"**}},<0.153.0>}, >>> <0.153.0>,undefined}, >>> {{<0.153.0>,{p,l,{ad_test,"** >>> wsbroadcast"}}},[]}]], >>> []}, >>> >>> Thanks again for the help >>> -AD >>> >>> On Fri, Mar 16, 2012 at 2:06 PM, Lo?c Hoguin >> > wrote: >>> >>> Just like you would catch any message, you match: >>> >>> websocket_info({Pid, {Module, WSBroadcast}, Msg}, Req, State) >>> >>> When using gproc:send/2, the second arg is what you want to match in >>> the first arg of websocket_info/3. All messages the websocket >>> process receives are given to you in websocket_info/3. >>> >>> Didn't try the new pubsub, it looks interesting though. >>> >>> >>> On 03/16/2012 07:01 PM, AD wrote: >>> >>> Thanks, so in websocket/init >>> >>> gproc:reg({p, l, {?MODULE, WSBroadcast}}). >>> >>> Then in my webservice i can do >>> >>> Msg = "Test broadcast". >>> gproc:send({p, l, {?MODULE,WSBroadcast}}, {self(), >>> {?MODULE,WSBroadcast}, Msg}). >>> >>> How do you catch this in websocket_info/3 to formulate a reply? >>> >>> Also noticed a new pub/sub module for gproc not sure if this helps >>> simplify some of this >>> https://github.com/uwiger/__**gproc/blob/master/src/gproc___** >>> ps.erl >>> >>> >>> > >>> >>> Thanks! >>> -AD >>> >>> On Fri, Mar 16, 2012 at 12:20 PM, Lo?c Hoguin >>> >>> >> wrote: >>> >>> Hey! >>> >>> The general idea is to have your websocket handler register >>> itself >>> using gproc[1] (or through a central gen_server) inside the >>> websocket_init/3 callback, and then have your service push >>> messages >>> to all registered handlers which you can then catch in >>> websocket_info/3. >>> >>> I mention gproc because it's infinitely easier with it, as >>> you only >>> have to register all your processes under one property and >>> then send >>> a message to that property which will multicast it to all >>> registered >>> processes. And when your websocket closes, gproc takes care of >>> removing your process from the list of registered processes, >>> so you >>> really have to worry only about 2 lines of code to do >>> everything you >>> need. >>> >>> Good luck! >>> >>> [1] https://github.com/uwiger/____**gproc >>> >>> > >>> >>> >>> >>> >> >>> >>> >>> >>> On 03/16/2012 05:11 PM, AD wrote: >>> >>> Hello, >>> >>> I have cowboy setup and working to send/receive >>> websockets over a >>> socket connection. I am trying to figure out how to >>> initiate a >>> message >>> server side over that channel (without it just being a >>> reply). I am >>> envisioning exposing a webservice on the cowboy service >>> that >>> would then >>> push a message to all connected users (or maybe a subset >>> based >>> on some >>> criteria). >>> >>> Does anyone know if this is possible and if so how to >>> implement? >>> >>> Cheers, >>> -AD >>> >>> >>> ______________________________**_____________________ >>> >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> > >>> >>> >>> >> >>> http://erlang.org/mailman/____**listinfo/erlang-questions >>> >>> > >>> >>> >>> >>> >>> >> >>> >>> >>> >>> -- >>> Lo?c Hoguin >>> Erlang Cowboy >>> Nine Nines >>> >>> >>> >>> >>> -- >>> Lo?c Hoguin >>> Erlang Cowboy >>> Nine Nines >>> >>> >>> >> >> -- >> Lo?c Hoguin >> Erlang Cowboy >> Nine Nines >> > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From magnus.klaar@REDACTED Sat Apr 7 16:02:09 2012 From: magnus.klaar@REDACTED (Magnus Klaar) Date: Sat, 7 Apr 2012 16:02:09 +0200 Subject: [erlang-questions] Push a message to cowboy websockets In-Reply-To: References: <4F636831.1020204@ninenines.eu> <4F638141.4040405@ninenines.eu> <4F63A004.7030802@ninenines.eu> Message-ID: Hi! This is the line where the crash is occuring at: {reply, {text, <>}, Req, State, hibernate}. The last message in was: {<0.113.0>, {websocket_handler, "broadcast"},<<"hello server!">>} Where Msg is bound to the <<"hello server!">> term in the message. The <> expression attempts to pack this binary as a one-byte value which will not work. Remove the <<>>-s around Msg and you should be good to go. I also don't see why you have defined the ?BC macro/constant as a string, an atom would suffice. TLDR; replace {reply, {text, <>}, Req, State, hibernate}. with {reply, {text, Msg}, Req, State, hibernate}. MVH Magnus On Sat, Apr 7, 2012 at 3:50 PM, Barco You wrote: > Hi AD, > > I also tried to implement a websocket broadcast as you did in this mail. > but I got crash in websocket_info as following. Could you please show me > your complete code? thanks! > > my code is: > > websocket_init(_Any, Req, []) -> > gproc:reg({p, l,{?MODULE, ?BC}}), > Req2 = cowboy_http_req:compact(Req), > {ok, Req2, undefined, hibernate}. > > websocket_handle({text, Msg}, Req, State) -> > broadcast(Msg), > {reply, {text, << "You said: ", Msg/binary >>}, Req, State, hibernate}; > websocket_handle(_Any, Req, State) -> > {ok, Req, State}. > > websocket_info({_Pid, {_Module, ?BC}, Msg}, Req, State) -> > > {reply, {text, <>}, Req, State, hibernate}. > > broadcast(Msg) -> > gproc:send({p, l, {?MODULE, ?BC}}, {self(), {?MODULE, ?BC}, Msg}). > > > > ** Handler websocket_handler terminating in websocket_info/3 > > for the reason error:badarg > ** Message was {<0.113.0>,{websocket_handler, > "broadcast"},<<"hello server!">>} > ** Options were [] > ** Handler state was undefined > ** Request was [{socket,#Port<0.940>}, > {transport,cowboy_tcp_transport}, > {connection,keepalive}, > {pid,<0.113.0>}, > {method,'GET'}, > {version,{1,1}}, > {peer,undefined}, > {host,undefined}, > {host_info,undefined}, > {raw_host,<<"localhost">>}, > {port,80}, > {path,undefined}, > {path_info,undefined}, > {raw_path,<<"/websocket">>}, > {qs_vals,undefined}, > {raw_qs,<<>>}, > {bindings,undefined}, > {headers,[]}, > {p_headers,[]}, > {cookies,[]}, > {meta,[{websocket_version,13}]}, > {body_state,waiting}, > {buffer,<<>>}, > {resp_state,done}, > {resp_headers,[]}, > {resp_body,<<>>}, > {urldecode,{#Fun,crash}}] > ** Stacktrace: [{websocket_handler,websocket_info,3, > [{file,"src/websocket_handler.erl"},{line,39}]}, > {cowboy_http_websocket,handler_call,7, > [{file,"src/cowboy_http_websocket.erl"},{line,389}]}] > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From barcojie@REDACTED Sat Apr 7 16:13:23 2012 From: barcojie@REDACTED (Barco You) Date: Sat, 7 Apr 2012 22:13:23 +0800 Subject: [erlang-questions] Push a message to cowboy websockets In-Reply-To: References: <4F636831.1020204@ninenines.eu> <4F638141.4040405@ninenines.eu> <4F63A004.7030802@ninenines.eu> Message-ID: Hi Magnus, Thank you very much! Then, if broadcasting to all other clients except self, how to do it with gproc? Regards, Barco On Sat, Apr 7, 2012 at 10:02 PM, Magnus Klaar wrote: > Hi! > > This is the line where the crash is occuring at: {reply, {text, > <>}, Req, State, hibernate}. The last message in was: {<0.113.0>, > {websocket_handler, "broadcast"},<<"hello server!">>} Where Msg is bound to > the <<"hello server!">> term in the message. The <> expression > attempts to pack this binary as a one-byte value which will not work. > Remove the <<>>-s around Msg and you should be good to go. I also don't see > why you have defined the ?BC macro/constant as a string, an atom would > suffice. > > TLDR; replace {reply, {text, <>}, Req, State, hibernate}. > with {reply, {text, Msg}, Req, State, hibernate}. > > MVH Magnus > > On Sat, Apr 7, 2012 at 3:50 PM, Barco You wrote: > >> Hi AD, >> >> I also tried to implement a websocket broadcast as you did in this mail. >> but I got crash in websocket_info as following. Could you please show me >> your complete code? thanks! >> >> my code is: >> >> websocket_init(_Any, Req, []) -> >> gproc:reg({p, l,{?MODULE, ?BC}}), >> Req2 = cowboy_http_req:compact(Req), >> {ok, Req2, undefined, hibernate}. >> >> websocket_handle({text, Msg}, Req, State) -> >> broadcast(Msg), >> {reply, {text, << "You said: ", Msg/binary >>}, Req, State, >> hibernate}; >> websocket_handle(_Any, Req, State) -> >> {ok, Req, State}. >> >> websocket_info({_Pid, {_Module, ?BC}, Msg}, Req, State) -> >> >> {reply, {text, <>}, Req, State, hibernate}. >> >> broadcast(Msg) -> >> gproc:send({p, l, {?MODULE, ?BC}}, {self(), {?MODULE, ?BC}, Msg}). >> >> >> >> ** Handler websocket_handler terminating in websocket_info/3 >> >> for the reason error:badarg >> ** Message was {<0.113.0>,{websocket_handler, >> "broadcast"},<<"hello server!">>} >> ** Options were [] >> ** Handler state was undefined >> ** Request was [{socket,#Port<0.940>}, >> {transport,cowboy_tcp_transport}, >> {connection,keepalive}, >> {pid,<0.113.0>}, >> {method,'GET'}, >> {version,{1,1}}, >> {peer,undefined}, >> {host,undefined}, >> {host_info,undefined}, >> {raw_host,<<"localhost">>}, >> {port,80}, >> {path,undefined}, >> {path_info,undefined}, >> {raw_path,<<"/websocket">>}, >> {qs_vals,undefined}, >> {raw_qs,<<>>}, >> {bindings,undefined}, >> {headers,[]}, >> {p_headers,[]}, >> {cookies,[]}, >> {meta,[{websocket_version,13}]}, >> {body_state,waiting}, >> {buffer,<<>>}, >> {resp_state,done}, >> {resp_headers,[]}, >> {resp_body,<<>>}, >> {urldecode,{#Fun,crash}}] >> ** Stacktrace: [{websocket_handler,websocket_info,3, >> [{file,"src/websocket_handler.erl"},{line,39}]}, >> {cowboy_http_websocket,handler_call,7, >> [{file,"src/cowboy_http_websocket.erl"},{line,389}]}] >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From essen@REDACTED Sat Apr 7 16:23:36 2012 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Sat, 07 Apr 2012 16:23:36 +0200 Subject: [erlang-questions] Push a message to cowboy websockets In-Reply-To: References: <4F636831.1020204@ninenines.eu> <4F638141.4040405@ninenines.eu> <4F63A004.7030802@ninenines.eu> Message-ID: <4F804DE8.30006@ninenines.eu> Broadcast to all the clients and discard the message you receive in websocket_info if it's coming from you, by attaching your Pid on the message broadcasted and matching on it for example. On 04/07/2012 04:13 PM, Barco You wrote: > Hi Magnus, > > Thank you very much! > > Then, if broadcasting to all other clients except self, how to do it with > gproc? > > Regards, > Barco > > On Sat, Apr 7, 2012 at 10:02 PM, Magnus Klaarwrote: > >> Hi! >> >> This is the line where the crash is occuring at: {reply, {text, >> <>}, Req, State, hibernate}. The last message in was: {<0.113.0>, >> {websocket_handler, "broadcast"},<<"hello server!">>} Where Msg is bound to >> the<<"hello server!">> term in the message. The<> expression >> attempts to pack this binary as a one-byte value which will not work. >> Remove the<<>>-s around Msg and you should be good to go. I also don't see >> why you have defined the ?BC macro/constant as a string, an atom would >> suffice. >> >> TLDR; replace {reply, {text,<>}, Req, State, hibernate}. >> with {reply, {text, Msg}, Req, State, hibernate}. >> >> MVH Magnus >> >> On Sat, Apr 7, 2012 at 3:50 PM, Barco You wrote: >> >>> Hi AD, >>> >>> I also tried to implement a websocket broadcast as you did in this mail. >>> but I got crash in websocket_info as following. Could you please show me >>> your complete code? thanks! >>> >>> my code is: >>> >>> websocket_init(_Any, Req, []) -> >>> gproc:reg({p, l,{?MODULE, ?BC}}), >>> Req2 = cowboy_http_req:compact(Req), >>> {ok, Req2, undefined, hibernate}. >>> >>> websocket_handle({text, Msg}, Req, State) -> >>> broadcast(Msg), >>> {reply, {text,<< "You said: ", Msg/binary>>}, Req, State, >>> hibernate}; >>> websocket_handle(_Any, Req, State) -> >>> {ok, Req, State}. >>> >>> websocket_info({_Pid, {_Module, ?BC}, Msg}, Req, State) -> >>> >>> {reply, {text,<>}, Req, State, hibernate}. >>> >>> broadcast(Msg) -> >>> gproc:send({p, l, {?MODULE, ?BC}}, {self(), {?MODULE, ?BC}, Msg}). >>> >>> >>> >>> ** Handler websocket_handler terminating in websocket_info/3 >>> >>> for the reason error:badarg >>> ** Message was {<0.113.0>,{websocket_handler, >>> "broadcast"},<<"hello server!">>} >>> ** Options were [] >>> ** Handler state was undefined >>> ** Request was [{socket,#Port<0.940>}, >>> {transport,cowboy_tcp_transport}, >>> {connection,keepalive}, >>> {pid,<0.113.0>}, >>> {method,'GET'}, >>> {version,{1,1}}, >>> {peer,undefined}, >>> {host,undefined}, >>> {host_info,undefined}, >>> {raw_host,<<"localhost">>}, >>> {port,80}, >>> {path,undefined}, >>> {path_info,undefined}, >>> {raw_path,<<"/websocket">>}, >>> {qs_vals,undefined}, >>> {raw_qs,<<>>}, >>> {bindings,undefined}, >>> {headers,[]}, >>> {p_headers,[]}, >>> {cookies,[]}, >>> {meta,[{websocket_version,13}]}, >>> {body_state,waiting}, >>> {buffer,<<>>}, >>> {resp_state,done}, >>> {resp_headers,[]}, >>> {resp_body,<<>>}, >>> {urldecode,{#Fun,crash}}] >>> ** Stacktrace: [{websocket_handler,websocket_info,3, >>> [{file,"src/websocket_handler.erl"},{line,39}]}, >>> {cowboy_http_websocket,handler_call,7, >>> [{file,"src/cowboy_http_websocket.erl"},{line,389}]}] >>> >>> >> > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- Lo?c Hoguin Erlang Cowboy Nine Nines From magnus.klaar@REDACTED Sat Apr 7 16:26:02 2012 From: magnus.klaar@REDACTED (Magnus Klaar) Date: Sat, 7 Apr 2012 16:26:02 +0200 Subject: [erlang-questions] Push a message to cowboy websockets In-Reply-To: References: <4F636831.1020204@ninenines.eu> <4F638141.4040405@ninenines.eu> <4F63A004.7030802@ninenines.eu> Message-ID: Hi! Insert a function clause to filter out these messages to the websocket_info/3 function. You are already including the process-id of the sending process in your broadcast/1 function, we can use that to filters out messages sent from self(). In practice, you _may_ want to use a logical id to perform this filtering rather than reusing the process-id of the connection that happened to be connected to a client at the time. websocket_info({Pid, {_Module, ?BC}, _Msg}, Req, State) when Pid =:= self() -> {ok, Req, State, hibernate}; websocket_info({_Pid, {_Module, ?BC}, Msg}, Req, State) -> {reply, {text, <>}, Req, State, hibernate}. MVH Magnus On Sat, Apr 7, 2012 at 4:13 PM, Barco You wrote: > Hi Magnus, > > Thank you very much! > > Then, if broadcasting to all other clients except self, how to do it with > gproc? > > Regards, > Barco > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From barcojie@REDACTED Sat Apr 7 16:56:46 2012 From: barcojie@REDACTED (Barco You) Date: Sat, 7 Apr 2012 22:56:46 +0800 Subject: [erlang-questions] Push a message to cowboy websockets In-Reply-To: References: <4F636831.1020204@ninenines.eu> <4F638141.4040405@ninenines.eu> <4F63A004.7030802@ninenines.eu> Message-ID: thank you very much you all. But next question: how can I delete a client from the broadcast pool, because the gproc has only the API to unregister a process by "key" - unreg(Key) - and can not find unregister by Pid(). Best regards, Barco On Sat, Apr 7, 2012 at 10:26 PM, Magnus Klaar wrote: > Hi! > > Insert a function clause to filter out these messages to the > websocket_info/3 function. You are already including the process-id of the > sending process in your broadcast/1 function, we can use that to filters > out messages sent from self(). In practice, you _may_ want to use a logical > id to perform this filtering rather than reusing the process-id of the > connection that happened to be connected to a client at the time. > > websocket_info({Pid, {_Module, ?BC}, _Msg}, Req, State) when Pid =:= > self() -> > {ok, Req, State, hibernate}; > websocket_info({_Pid, {_Module, ?BC}, Msg}, Req, State) -> > {reply, {text, <>}, Req, State, hibernate}. > > MVH Magnus > > On Sat, Apr 7, 2012 at 4:13 PM, Barco You wrote: > >> Hi Magnus, >> >> Thank you very much! >> >> Then, if broadcasting to all other clients except self, how to do it with >> gproc? >> >> Regards, >> Barco >> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From comptekki@REDACTED Sat Apr 7 17:20:23 2012 From: comptekki@REDACTED (Wes James) Date: Sat, 7 Apr 2012 09:20:23 -0600 Subject: [erlang-questions] character output problems In-Reply-To: References: Message-ID: I found it. I thought if any web site might be able to handle unicode, it would be erlang.org, so I went and grabbed some of the header text: test and it works correctly now. thanks On Fri, Apr 6, 2012 at 5:20 PM, Magnus Klaar wrote: > Hi! > > It looks like your input is being converted to a multibyte character > encoding (such as utf-8, which we're most likely looking at in the second > version) on its way from your brower, via the database and back to your > browser. I must admit that i'm no expert and i did have to double check the > terminology on wikipedia, but both the ? and ? characters in the output has > an extra character tucked on, coincidentally these two characters are > encoded as 196 and 197 in latin1, both valid values for a "leading byte" > which are expected to be followed by one "continuation byte". > > TLDR; Are you declaring the correct charset in your markup? > > MVH Magnus > > On Fri, Apr 6, 2012 at 10:42 PM, Wes James wrote: >> >> When putting some data in to riak or postgresql the data coming out >> isn't right. For instance the text going in to the database is: >> >> Ekologie lu?n?ch porost? >> >> But when a search is done on the data (via cowboy), the results coming >> out look like: >> >> Ekologie lu? n??ch porost?? >> >> When I was working with lists in the past (using yaws), it seemed to >> work, but the results coming out are binaries and I think the binary >> representation is causing the problem or converting from binary is >> causing the problem. ?Is there a way to fix this? >> >> When looking at the data in psql it looks right. >> >> Thanks, >> >> -wes >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > From magnus.klaar@REDACTED Sat Apr 7 18:20:51 2012 From: magnus.klaar@REDACTED (Magnus Klaar) Date: Sat, 7 Apr 2012 18:20:51 +0200 Subject: [erlang-questions] Push a message to cowboy websockets In-Reply-To: References: <4F636831.1020204@ninenines.eu> <4F638141.4040405@ninenines.eu> <4F63A004.7030802@ninenines.eu> Message-ID: Hi! All names registered for a process will be cleaned up when the process exits. Unless you need to switch between receiving broadcasted messages and not mid-flight there is no need to unregister the property/name manually. If you're looking for the same effect in the middle of the lifetime of a process the gproc:goodbye function can be used to unregister all names. MVH Magnus On Sat, Apr 7, 2012 at 4:56 PM, Barco You wrote: > thank you very much you all. > > But next question: how can I delete a client from the broadcast pool, > because the gproc has only the API to unregister a process by "key" - > unreg(Key) - and can not find unregister by Pid(). > > Best regards, > Barco > > > On Sat, Apr 7, 2012 at 10:26 PM, Magnus Klaar wrote: > >> Hi! >> >> Insert a function clause to filter out these messages to the >> websocket_info/3 function. You are already including the process-id of the >> sending process in your broadcast/1 function, we can use that to filters >> out messages sent from self(). In practice, you _may_ want to use a logical >> id to perform this filtering rather than reusing the process-id of the >> connection that happened to be connected to a client at the time. >> >> websocket_info({Pid, {_Module, ?BC}, _Msg}, Req, State) when Pid =:= >> self() -> >> {ok, Req, State, hibernate}; >> websocket_info({_Pid, {_Module, ?BC}, Msg}, Req, State) -> >> {reply, {text, <>}, Req, State, hibernate}. >> >> MVH Magnus >> >> On Sat, Apr 7, 2012 at 4:13 PM, Barco You wrote: >> >>> Hi Magnus, >>> >>> Thank you very much! >>> >>> Then, if broadcasting to all other clients except self, how to do it >>> with gproc? >>> >>> Regards, >>> Barco >>> >>> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Sat Apr 7 20:07:29 2012 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 7 Apr 2012 20:07:29 +0200 Subject: [erlang-questions] Push a message to cowboy websockets In-Reply-To: References: <4F636831.1020204@ninenines.eu> <4F638141.4040405@ninenines.eu> <4F63A004.7030802@ninenines.eu> Message-ID: <7E57692D-7D58-44AD-B8B2-1D0919766694@feuerlabs.com> On 7 Apr 2012, at 16:56, Barco You wrote: > thank you very much you all. > > But next question: how can I delete a client from the broadcast pool, because the gproc has only the API to unregister a process by "key" - unreg(Key) - and can not find unregister by Pid(). A process can remove itself from the gproc registry using the function gproc:goodbye(). It is not possible to have a gproc:goodbye(Pid), since this would violate the rule that you can only register/unregister unique names for yourself. BR, Ulf W Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From straightflush@REDACTED Mon Apr 9 02:27:57 2012 From: straightflush@REDACTED (AD) Date: Sun, 8 Apr 2012 20:27:57 -0400 Subject: [erlang-questions] Push a message to cowboy websockets In-Reply-To: <7E57692D-7D58-44AD-B8B2-1D0919766694@feuerlabs.com> References: <4F636831.1020204@ninenines.eu> <4F638141.4040405@ninenines.eu> <4F63A004.7030802@ninenines.eu> <7E57692D-7D58-44AD-B8B2-1D0919766694@feuerlabs.com> Message-ID: Barco, Looks you got it by just in case my websocket_info looks like websocket_info(Info, Req, State) -> io:format("cowboy: got a websocket message ~p~n",[Info]), case Info of {_PID,?WSKey,Msg} -> {reply, {text, Msg}, Req, State, hibernate}; ........ ........ And then in my gen_servers to send a message to all clients i just do gproc:send({p, l, ?WSKey}, {self(), ?WSKey, Msg}) Hope that helps. -AD On Sat, Apr 7, 2012 at 2:07 PM, Ulf Wiger wrote: > > On 7 Apr 2012, at 16:56, Barco You wrote: > > thank you very much you all. > > But next question: how can I delete a client from the broadcast pool, > because the gproc has only the API to unregister a process by "key" - > unreg(Key) - and can not find unregister by Pid(). > > > A process can remove itself from the gproc registry using the function > gproc:goodbye(). > > It is not possible to have a gproc:goodbye(Pid), since this would violate > the rule that you can only register/unregister unique names for yourself. > > BR, > Ulf W > > Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. > http://feuerlabs.com > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthias@REDACTED Mon Apr 9 10:29:56 2012 From: matthias@REDACTED (Matthias Lang) Date: Mon, 9 Apr 2012 10:29:56 +0200 Subject: [erlang-questions] link in erlang.org FAQ In-Reply-To: References: Message-ID: <20120409082956.GA2482@corelatus.se> On Friday, April 06, Wes James wrote: > In the FAQ > > http://www.erlang.org/faq/how_do_i.html#id51336 > > on unicode there is a link to "alpha code" that is broken. Anyone know > where this code is? I think it's here now: https://github.com/hypernumbers/starling More generally, I must update that question in the FAQ, a lot has happened since it was written. A stab at reasonable advice: - As of R13A, Erlang includes basic unicode support. It's discussed in the documentation (http://erlang.org/doc/apps/stdlib/unicode_usage.html) - Some of the background to the implementation is discussed in EEP10: http://www.erlang.org/eeps/eep-0010.html But: I have no experience with unicode. I once looked at it but stopped reading when I saw there was a thing called a "supplementary multilingual control plane". I imagine such a plane has strange food and in-flight announcements in four languages, one of which is meant to be English, but you can't hear which. It is not a pleasant place. Anyway, it'd be nice if someone with a decent amount of unicode experience could either confirm the above or tell me it's crap (and suggest something better). The current entry has to go. Matt From kenji.rikitake@REDACTED Mon Apr 9 11:35:17 2012 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Mon, 9 Apr 2012 18:35:17 +0900 Subject: [erlang-questions] Erlang SF Conference 2012 slides In-Reply-To: References: Message-ID: <20120409093517.GA37117@k2r.org> Erlang Solutions will eventually put the slides on the Erlang Factory Talk pages, but mine is there at: https://github.com/jj1bdx/v6hex/raw/master/reference_texts/efsfbay2012-rikitake-ipv6-v1.pdf I remember some speakers have already put theirs in public too. Kenji Rikitake ++> Matthew Evans [2012-04-05 09:57:40 -0400]: > Hi, > Any chance we can get more of the slides published online for us poor folks who couldn't make it? > Especially Patrik Nyblom and Lukas Larsson's slides? > Many thanks > Matt From tony@REDACTED Mon Apr 9 13:34:21 2012 From: tony@REDACTED (Tony Rogvall) Date: Mon, 9 Apr 2012 13:34:21 +0200 Subject: [erlang-questions] rebar make Message-ID: <2C605D3C-BB52-4F00-831B-2BF7E1AAABAD@rogvall.se> Hi list! I have a little work process problem. Since I switch to using rebar more and more, I want to be able to run to run simple "make command" from Emacs while in current directory (normally the src directory) How can this be achieved while getting the error messages and warnings in a form that emacs can parse (from the correct directory) I currently (and for a long time) use this little .emacs binding (global-set-key "^Xc" 'compile) Thanks /Tony "Installing applications can lead to corruption over time. Applications gradually write over each other's libraries, partial upgrades occur, user and system errors happen, and minute changes may be unnoticeable and difficult to fix" -------------- next part -------------- An HTML attachment was scrubbed... URL: From gleber.p@REDACTED Mon Apr 9 13:39:41 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Mon, 9 Apr 2012 13:39:41 +0200 Subject: [erlang-questions] rebar make In-Reply-To: <2C605D3C-BB52-4F00-831B-2BF7E1AAABAD@rogvall.se> References: <2C605D3C-BB52-4F00-831B-2BF7E1AAABAD@rogvall.se> Message-ID: On Mon, Apr 9, 2012 at 13:34, Tony Rogvall wrote: > Hi list! > > I have a little work process problem. > Since I switch to using rebar more and more, I want to be able to run to run simple > "make command" from Emacs while in current directory (normally the src directory) > How can this be achieved while getting the error messages and warnings in > a form that emacs can parse (from the correct directory) > > I currently (and for a long time) use this little .emacs binding > > (global-set-key "^Xc" 'compile) Hi Tony Here's my solution to this problem based on emacs-Prelude, erlang-mode and projectile (which is part of Emacs-prelude): https://github.com/gleber/emacs-prelude/blob/master/modules/prelude-erlang.el#L50 https://github.com/gleber/emacs-prelude/blob/master/modules/prelude-erlang.el#L64 I think the code is self-explanatory. Essentially it runs "rebar compile" or "make" depending on what type of support file it is able to find in project root (rebar.config or Makefile). I just hit to run compile and run to go through through errors. To make it work nicely with sub-projects in rebar, Tuncer made the following change in rebar upon my request: https://github.com/basho/rebar/commit/4a9dae76a41cf963a56f73ea5a7933f285802fec Works like a charm! Best regards, Gleb From tony@REDACTED Mon Apr 9 14:04:47 2012 From: tony@REDACTED (Tony Rogvall) Date: Mon, 9 Apr 2012 14:04:47 +0200 Subject: [erlang-questions] rebar make In-Reply-To: References: <2C605D3C-BB52-4F00-831B-2BF7E1AAABAD@rogvall.se> Message-ID: On 9 apr 2012, at 13:39, Gleb Peregud wrote: > On Mon, Apr 9, 2012 at 13:34, Tony Rogvall wrote: >> Hi list! >> >> I have a little work process problem. >> Since I switch to using rebar more and more, I want to be able to run to run simple >> "make command" from Emacs while in current directory (normally the src directory) >> How can this be achieved while getting the error messages and warnings in >> a form that emacs can parse (from the correct directory) >> >> I currently (and for a long time) use this little .emacs binding >> >> (global-set-key "^Xc" 'compile) > > Hi Tony > > Here's my solution to this problem based on emacs-Prelude, erlang-mode > and projectile (which is part of Emacs-prelude): > > https://github.com/gleber/emacs-prelude/blob/master/modules/prelude-erlang.el#L50 > https://github.com/gleber/emacs-prelude/blob/master/modules/prelude-erlang.el#L64 > What is emacs-prelude ? Could you please explain what is needed to run this ? wrangler ? projectile ? A (kind of) standalone solution would be great. Thanks /Tony From francesquini@REDACTED Mon Apr 9 19:49:45 2012 From: francesquini@REDACTED (Emilio De Camargo Francesquini) Date: Mon, 9 Apr 2012 19:49:45 +0200 Subject: [erlang-questions] erlang:trace/3 Message-ID: Hello, I'm having some trouble understanding the exact meaning of two of the flags for the erlang:trace/3 function. Flag: - running Trace scheduling of processes. Message tags: in, and out. I imagine that a message tagged "in" means that the process was chosen by a scheduler and will begin/resume execution and a tag "out" means that the processes has been preempted. Is that correct? - exiting Trace scheduling of an exiting processes. Message tags: in_exiting, out_exiting, and out_exited. I guess that these messages are sent when the proccess is about to exit or has already exited. Am I right? What is the exact difference between each one of them? Moreover, what is the difference between "exiting" flag with the tag "out_exited" and "procs" flag with the tag "exit"? Thanks! From robert.virding@REDACTED Tue Apr 10 00:07:39 2012 From: robert.virding@REDACTED (Robert Virding) Date: Mon, 09 Apr 2012 23:07:39 +0100 (BST) Subject: [erlang-questions] Deputy: Type Conversion and Validation In-Reply-To: Message-ID: Why on earth would you want to make ok/false (or perhaps you mean ok/error) synonymous with true/false? They mean completely different things and tell different things so they should not be synonymous. Robert ----- Original Message ----- > I like the idea of making true/false synonymous with ok/false. I'm > not > sure wrapping the fun handler with a try/catch clause is the right > thing to do though, in that case I believe it should be left as a > programming error. > > I fixed the readme to reflect your comments, though I have not > bothered to actually test whats in the readme which is horrible I > know! > > Maybe later this week I'll do both! Thank you for the comments. > > Tom > > > On Tue, Apr 3, 2012 at 1:37 PM, Ladislav Lenart > wrote: > > Hello. > > > > Nice little work :-) > > > > Just a few notes: > > * Documentation typo in Proplist Usage - Rules is defined but later > > ?RuleSet is used. > > * Documentation about Addon Type Conversion seems unfinished. > > * Why the advanced API needs to be exported at all? > > * I would modify interface of convert/2 to either: > > ?* return the result value directly | raise an error, > > ?* use tagged tuples {ok, Value} | error. > > * I think check/3 returns errors in reversed order when stop is > > used. > > * I would suggest to extend (both) {func,...} to > > > > ? ? ?check_rule(Value, {func, Fun}) when is_function(Fun, 1) -> > > ? ? ? ? ?try > > ? ? ? ? ? ? ?Fun(Value) > > ? ? ? ? ?catch > > ? ? ? ? ? ? ?_:_ -> > > ? ? ? ? ? ? ? ? ?error > > ? ? ? ? ?end; > > > > ?This will enable you to write shorter rules. Instead of > > > > ? ? ?Test = fun (Value) -> > > ? ? ? ? ?case Value > 1 andalso Value < 10 of > > ? ? ? ? ? ? ?true -> ok; > > ? ? ? ? ? ? ?false -> error > > ? ? ? ? ?end > > ? ? ?end > > > > ?you will be able to write > > > > ? ? ?Test = fun (Value) -> true = Value > 1 andalso Value < 10, ok > > ? ? ?end > > > > ?or (in a different style) > > > > ? ? ?Test = fun (Value) -> > > ? ? ? ? ?true = Value > 1, > > ? ? ? ? ?true = Value < 10, > > ? ? ? ? ?ok > > ? ? ?end > > > > ?and if you allow true as synonym for ok and false as synonym for > > ?error, > > ?you can omit ok at the end. > > > > > > HTH, > > > > Ladislav Lenart > > > > > > > > On 3.4.2012 19:12, Tom Burdick wrote: > >> > >> After not finding a validation/conversion library I felt worked > >> well > >> for what I wanted (REST interface) I made my own. > >> > >> Would greatly appreciate any feedback! > >> > >> http://github.com/treetopllc/deputy > >> > >> Thanks! > >> > >> Tom > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://erlang.org/mailman/listinfo/erlang-questions > >> > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From moxford@REDACTED Tue Apr 10 03:04:43 2012 From: moxford@REDACTED (Mike Oxford) Date: Mon, 9 Apr 2012 18:04:43 -0700 Subject: [erlang-questions] fprof analysis question Message-ID: Am I reading this correctly? 0 calls of proc_lib:init_p_do_apply/3 but taking up sometimes, 30 seconds? Calling into gen_server:loop/6 which actually does the work (buy why 0 calls, above, if it's in the trace?) Which then calls into gen_server:decode_msg/8 Correct? I'm new at this... :) (and, not shown here, further into gen_server:handle_msg/8 -> gen_server:handle_msg/5 ->gen_server:handle_common_reply/6 calling into gen_server:loop/6...) If I am correct, what's the recommended way to debug those gen_server messages to find out why they are taking so darn long, besides just being large? (When we start pushing 380kB+ sized messages through the system it starts crying.) Thanks! -mox {[{{proc_lib,init_p_do_apply,3}, 0,30283.167, 0.007}, {{proc_lib,init_p_do_apply,3}, 0,29494.168, 0.007}, {{proc_lib,init_p_do_apply,3}, 0,29484.167, 0.006}, {{proc_lib,init_p_do_apply,3}, 0,29479.170, 0.007}, {{proc_lib,init_p_do_apply,3}, 0,29370.168, 0.005}, {{proc_lib,init_p_do_apply,3}, 0,29359.169, 0.006}, {{proc_lib,init_p_do_apply,3}, 0,29356.220, 0.006}, {{proc_lib,init_p_do_apply,3}, 0,24698.223, 0.061}, {{proc_lib,init_p_do_apply,3}, 0,24698.040, 0.003}, {{proc_lib,init_p_do_apply,3}, 0,17498.139, 0.005}, {{proc_lib,init_p_do_apply,3}, 0,12391.071, 0.003}, {{proc_lib,init_p_do_apply,3}, 0,12389.865, 0.004}, {{proc_lib,init_p_do_apply,3}, 0,12389.406, 0.003}, {{proc_lib,init_p_do_apply,3}, 0,12389.060, 0.006}, {undefined, 0,12388.011, 0.003}, {{gen_server,handle_common_reply,6}, 3,12357.349, 0.014}, {{proc_lib,init_p_do_apply,3}, 0, 31.961, 0.004}, {{gen_server,handle_msg,5}, 2, 0.000, 0.031}, {{gen_server,handle_msg,5}, 1, 0.000, 0.009}, {{gen_server,handle_msg,5}, 1, 0.000, 0.007}, {{gen_server,handle_msg,5}, 1, 0.000, 0.003}, {{gen_server,handle_common_reply,6}, 497, 0.000, 5.803}, {{gen_server,handle_common_reply,6}, 30, 0.000, 0.333}, {{gen_server,handle_common_reply,6}, 30, 0.000, 0.307}, {{gen_server,handle_common_reply,6}, 30, 0.000, 0.306}, {{gen_server,handle_common_reply,6}, 30, 0.000, 0.290}, {{gen_server,handle_common_reply,6}, 30, 0.000, 0.285}, {{gen_server,handle_common_reply,6}, 30, 0.000, 0.277}, {{gen_server,handle_common_reply,6}, 6, 0.000, 0.039}, {{gen_server,handle_common_reply,6}, 4, 0.000, 0.018}, {{gen_server,handle_common_reply,6}, 3, 0.000, 0.081}, {{gen_server,handle_common_reply,6}, 2, 0.000, 0.009}, {{gen_server,handle_common_reply,6}, 2, 0.000, 0.008}, {{gen_server,handle_common_reply,6}, 1, 0.000, 0.003}], { {gen_server,loop,6}, 703,348057.354, 7.959}, % [{{gen_server,decode_msg,8}, 497,30283.160, 4.056}, {suspend, 497,30151.291, 0.000}, {{gen_server,decode_msg,8}, 30,29494.161, 0.167}, {suspend, 30,29492.573, 0.000}, {{gen_server,decode_msg,8}, 30,29484.161, 0.219}, {suspend, 30,29482.507, 0.000}, {{gen_server,decode_msg,8}, 30,29479.163, 0.163}, {suspend, 30,29477.584, 0.000}, {{gen_server,decode_msg,8}, 30,29370.163, 0.166}, {suspend, 30,29368.534, 0.000}, {{gen_server,decode_msg,8}, 30,29359.163, 0.146}, {suspend, 30,29357.584, 0.000}, {{gen_server,decode_msg,8}, 30,29356.214, 0.202}, {suspend, 30,29354.670, 0.000}, {{gen_server,decode_msg,8}, 3,24698.162, 0.012}, {{gen_server,decode_msg,8}, 4,24698.037, 0.014}, {suspend, 3,24697.710, 0.000}, {suspend, 3,24697.567, 0.000}, {{gen_server,decode_msg,8}, 7,17498.134, 0.036}, {suspend, 7,17497.461, 0.000}, {{gen_server,decode_msg,8}, 1,12391.068, 0.003}, {suspend, 1,12391.030, 0.000}, {{gen_server,decode_msg,8}, 2,12389.861, 0.007}, {suspend, 2,12389.754, 0.000}, {{gen_server,decode_msg,8}, 2,12389.403, 0.006}, {suspend, 2,12389.338, 0.000}, {{gen_server,decode_msg,8}, 2,12389.054, 0.007}, {suspend, 3,12388.945, 0.000}, {suspend, 2,12388.932, 0.000}, {{gen_server,decode_msg,8}, 2,12388.008, 0.032}, {suspend, 2,12387.777, 0.000}, {{gen_server,decode_msg,8}, 3, 31.957, 0.037}, {garbage_collect, 10, 0.100, 0.100}]}. -------------- next part -------------- An HTML attachment was scrubbed... URL: From moxford@REDACTED Tue Apr 10 03:30:10 2012 From: moxford@REDACTED (Mike Oxford) Date: Mon, 9 Apr 2012 18:30:10 -0700 Subject: [erlang-questions] research program into scaling erlang? In-Reply-To: <4F7D18EB.9040607@gmail.com> References: <4F7D0DD0.1020402@meetinghouse.net> <4F7D18EB.9040607@gmail.com> Message-ID: I ended up rolling my own clustering and routing code which works alongside the Erlang stuff. I cannot release it :( but from someone who's worked on it, having a bigger clustering/routing capacity built directly into OTP would be amazing. -mox On Wed, Apr 4, 2012 at 9:00 PM, Michael Truog wrote: > ** > On 04/04/2012 08:13 PM, Miles Fidelman wrote: > > I seem to recall reading about a multi-sponsor research program that was > looking at scaling Erlang to lots of nodes, along with some related > issues. Maybe at INRIA? > > I can't seem to find the reference. Anybody able to point me in the right > direction? (I thought I'd saved it away, but what I thought was the link > gives me a 404 error (can't search the erlang-questions archive right now - > trapexit seems to be down.) > > Thanks! > > Miles Fidelman > > You are looking for the discussion here: > http://groups.google.com/group/erlang-programming/msg/4eb315731e19f2e6 > > That has the links here: > http://www.release-project.eu/ > http://www.release-project.eu/documents/RELEASEfactsheetv6.pdf > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ngocdaothanh@REDACTED Tue Apr 10 04:26:12 2012 From: ngocdaothanh@REDACTED (ngocdaothanh) Date: Mon, 9 Apr 2012 19:26:12 -0700 (PDT) Subject: [erlang-questions] BERT encoding and WebSocket Message-ID: <3516e246-0cf8-4748-8646-6b4ce1f57557@z3g2000pbn.googlegroups.com> What is the best way to use BERT encoding (http://bert-rpc.org/) with WebSocket? BERT is binary but WebSocket does not support binary at this moment. Should I use base64 to encode BERT binary to normal string? Base64 has 33% overhead (http://en.wikipedia.org/wiki/Base64). How much space can BERT save compared to JSON? From jixiuf@REDACTED Tue Apr 10 04:45:34 2012 From: jixiuf@REDACTED (jixiuf) Date: Tue, 10 Apr 2012 10:45:34 +0800 (CST) Subject: [erlang-questions] rebar make In-Reply-To: References: <2C605D3C-BB52-4F00-831B-2BF7E1AAABAD@rogvall.se> Message-ID: <20120410.104534.322218505.jixiuf@gmail.com> how about : (defun erlang-root-by-makefile () "Look for Makefile file to find project root of erlang application. if found return the directory or nil " (let ((erlang-root (locate-dominating-file default-directory "Makefile"))) (if erlang-root (expand-file-name erlang-root) (setq erlang-root (locate-dominating-file default-directory "makefile")) (if erlang-root (expand-file-name erlang-root) nil )))) (defun erlang-make() "run make command at project root directory" (interactive) (let ((project-root ( erlang-root-by-makefile)) (compile-command compile-command)) (when project-root (setq compile-command (concat "make --directory=" project-root)) ;; copy src/*.app.src to ebin/*.app ;; if you do this in your Makefile ,you may delete the (dolist) (dolist (filename (directory-files (expand-file-name "src/" project-root))) (cond ((string= (file-name-extension filename) "app") (copy-file (expand-file-name (concat "src/" filename) project-root) (expand-file-name (concat "ebin/" filename) project-root) t) ) ((string= (file-name-extension filename) "src") (copy-file (expand-file-name (concat "src/" filename) project-root) (expand-file-name (concat "ebin/" (file-name-sans-extension filename)) project-root) t)))) ) (call-interactively 'compile) ) ) From bgustavsson@REDACTED Tue Apr 10 07:18:55 2012 From: bgustavsson@REDACTED (=?UTF-8?Q?Bj=C3=B6rn_Gustavsson?=) Date: Tue, 10 Apr 2012 07:18:55 +0200 Subject: [erlang-questions] Status of HARDDEBUG code (doesn't compile, seems to be outdated) In-Reply-To: References: Message-ID: On Thu, Apr 5, 2012 at 7:56 PM, Winston Smith wrote: > So onto my question: ?is HARDDEBUG still supported? ?Is it > abandonware, or has it just gotten a little out of date? The way we use HARDDEBUG is to insert a "#define HARDDEBUG" into a single source code file, when we are debugging a specific problem or updating that part of the code. Turning on HARDDEBUG for the entire emulator will make it very slow. That probably means that some HARDDEBUG code is very stale. I don't think it's worth spending a lot of time fixing it. -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From dmkolesnikov@REDACTED Tue Apr 10 07:40:40 2012 From: dmkolesnikov@REDACTED (dmitry kolesnikov) Date: Tue, 10 Apr 2012 08:40:40 +0300 Subject: [erlang-questions] BERT encoding and WebSocket In-Reply-To: <3516e246-0cf8-4748-8646-6b4ce1f57557@z3g2000pbn.googlegroups.com> References: <3516e246-0cf8-4748-8646-6b4ce1f57557@z3g2000pbn.googlegroups.com> Message-ID: <-2550939688550643107@unknownmsgid> Hello, I would not recommend to use BERT to integrate erlang FE with JavaScript app. Yes, it works perfectly... But we had so much pain with it on JS side. Eventually, we started to use base64 due to some browser behavior... Another Major issue was to maintain interface compatibility... We rolled back to JSON. I would recommend jsx library on erlang, it is fast and light. Best Regards, Dmitry >-|-|-*> On 10.4.2012, at 5.26, ngocdaothanh wrote: > What is the best way to use BERT encoding (http://bert-rpc.org/) with > WebSocket? > > BERT is binary but WebSocket does not support binary at this moment. > Should I use base64 to encode BERT binary to normal string? Base64 has > 33% overhead (http://en.wikipedia.org/wiki/Base64). How much space can > BERT save compared to JSON? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From ngocdaothanh@REDACTED Tue Apr 10 08:10:21 2012 From: ngocdaothanh@REDACTED (Ngoc Dao) Date: Tue, 10 Apr 2012 15:10:21 +0900 Subject: [erlang-questions] BERT encoding and WebSocket In-Reply-To: <-2550939688550643107@unknownmsgid> References: <3516e246-0cf8-4748-8646-6b4ce1f57557@z3g2000pbn.googlegroups.com> <-2550939688550643107@unknownmsgid> Message-ID: Thanks for sharing your experience. I thought BERT would help saving some bandwidth, but the outputs at https://github.com/rustyio/BERT-JS seem to say that BERT does not help saving much. On Tue, Apr 10, 2012 at 2:40 PM, dmitry kolesnikov wrote: > Hello, > > I would not recommend to use BERT to integrate erlang FE with > JavaScript app. Yes, it works perfectly... But we had so much pain > with it on JS side. Eventually, we started to use base64 due to some > browser behavior... Another Major issue was to maintain interface > compatibility... > > We rolled back to JSON. I would recommend jsx library on erlang, it is > fast and light. > > Best Regards, > Dmitry >-|-|-*> > > > On 10.4.2012, at 5.26, ngocdaothanh wrote: > >> What is the best way to use BERT encoding (http://bert-rpc.org/) with >> WebSocket? >> >> BERT is binary but WebSocket does not support binary at this moment. >> Should I use base64 to encode BERT binary to normal string? Base64 has >> 33% overhead (http://en.wikipedia.org/wiki/Base64). How much space can >> BERT save compared to JSON? >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions From vasdeveloper@REDACTED Tue Apr 10 10:25:55 2012 From: vasdeveloper@REDACTED (Kannan) Date: Tue, 10 Apr 2012 13:55:55 +0530 Subject: [erlang-questions] Erlang based Web Stack In-Reply-To: <4F7D888E.5060608@telegraphics.com.au> References: <4025530D-7B4A-4FD4-AEDE-0FA6017DE9F0@gmail.com> <4F7D888E.5060608@telegraphics.com.au> Message-ID: Dear Toby, IMHO, PHP is a proper subset of Erlang, when it comes to solving real world problems. You are right in saying "benchmark the parts for performance", but we are not only about performance, but also about reusing the tools that are already available in the domain, which are written in C/C++. Kind Regards, Kannan. On Thu, Apr 5, 2012 at 5:27 PM, Toby Thain wrote: > On 05/04/12 3:17 AM, Kannan wrote: > >> Thanks guys, that is a lot of input. >> >> How is the support of OTP for multimedia content manipulation, >> transcoding etc? Or you advice to do it at the C level and communicate >> it to Erlang? >> >> Also, if someone has already invented the wheel of how good Erlang is >> compared to PHP, please share it with us. >> > > > Erlang and PHP cannot really be directly compared; they solve different > problems. > > PHP is a basic web templating system with OO bolted on. > > Erlang is a sophisticated modern language and runtime with extraordinary > scaling capability, and built-in distribution mechanisms. > > Their sweet spots barely overlap, so if you *need* Erlang, you are > unlikely to be satisfied with PHP. > > As for which parts of your system might need to be in C - benchmarking on > your actual application will answer that. > > --Toby > > >> We would like to have a mega site purely on Erlang and C. >> >> Thank you. >> >> >> >> On Wed, Apr 4, 2012 at 10:21 PM, Tristan Sloughter >> >> >> wrote: >> >> My suggestion is Webmachine or Cowboy speaking only JSON with a >> heavy Javascript frontend, like Backbone.js, Spine.js or my favorite >> Batman.js >> >> This provides a lot of advantages, especially if you have people on >> the frontend who know html/css/javascript but don't want to deal >> with Erlang. Now they simply have a RESTful API to deal with and can >> develop on ahead using fixtures or a basic backend in any quick tool >> that can build REST apps like Sinatra or Node.js returning stock >> responses. Plus, you then are already ready to develop other >> interfaces besides a web frontend for you backend with no changes. >> >> And while I've fallen behind on keeping it going, I'm creating apps >> for using with Webmachine to make things faster when you know you >> are just dealing with JSON->Erlang https://github.com/tsloughter/** >> maru >> >> Tristan >> >> On Wed, Apr 4, 2012 at 4:56 AM, Zabrane Mickael > > wrote: >> >> http://lenary.co.uk/erlang/**2011/08/erlang-web-libraries/ >> >> Regards, >> Zabrane >> >> >> On Apr 4, 2012, at 1:46 PM, Roberto Aloi wrote: >> >> Hi Marc, >>> >>> That comparison is behind regarding Zotonic. >>>> And I guess also regarding the other projects, as the last >>>> update was 5 months ago. >>>> >>> >>> True. I couldn't find any other so-detailed comparison, >>> thought. It >>> would probably be worth to update that page with the latest >>> changes in >>> the other frameworks. >>> >>> And it is more a comparison of the features of Chicago Boss >>>> to the others, not the other way around. >>>> Some extra categories could be considered. >>>> >>> >>> Well, that page belongs to the Chicago Boss project, so no big >>> surprise about that. It's good that you made that point clear, >>> though. >>> >>> But then, no comparison is ever complete. >>>> >>> >>> I guess we should have a third-party one. Suggestion for a >>> talk at the >>> next Erlang Factory? ;) >>> >>> -- >>> Roberto Aloi >>> --- >>> Website: http://roberto-aloi.com >>> Twitter: @robertoaloi >>> ______________________________**_________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> > >>> http://erlang.org/mailman/**listinfo/erlang-questions >>> >> >> >> >> ______________________________**_________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> > >> >> http://erlang.org/mailman/**listinfo/erlang-questions >> >> >> >> ______________________________**_________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> > >> >> http://erlang.org/mailman/**listinfo/erlang-questions >> >> >> >> >> ______________________________**_________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/**listinfo/erlang-questions >> > > ______________________________**_________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/**listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vasdeveloper@REDACTED Tue Apr 10 10:32:44 2012 From: vasdeveloper@REDACTED (Kannan) Date: Tue, 10 Apr 2012 14:02:44 +0530 Subject: [erlang-questions] Erlang based Web Stack In-Reply-To: <966FF007-C8D8-42F3-9103-445B54EF7056@nexttolast.com> References: <4025530D-7B4A-4FD4-AEDE-0FA6017DE9F0@gmail.com> <966FF007-C8D8-42F3-9103-445B54EF7056@nexttolast.com> Message-ID: Dear Dave, That sounds interesting. Currently we are doing a comprehensive research on the open source tools available that cater to our transcoding needs. I will revert to you once it is done. Kind Regards, Kannan. On Thu, Apr 5, 2012 at 5:59 PM, David Goehrig wrote: > OTP doesn't have built in support for multimedia. The company I work for > does have an advanced editing suite written in Erlang + C. If you are > willing to write NIF code reusing most existing C code is a matter of doing > a few bindings. > > Dave > > -=-=- dave@REDACTED -=-=- > > On Apr 5, 2012, at 3:17 AM, Kannan wrote: > > Thanks guys, that is a lot of input. > > How is the support of OTP for multimedia content manipulation, transcoding > etc? Or you advice to do it at the C level and communicate it to Erlang? > > Also, if someone has already invented the wheel of how good Erlang is > compared to PHP, please share it with us. > > We would like to have a mega site purely on Erlang and C. > > Thank you. > > > > On Wed, Apr 4, 2012 at 10:21 PM, Tristan Sloughter < > tristan.sloughter@REDACTED> wrote: > >> My suggestion is Webmachine or Cowboy speaking only JSON with a heavy >> Javascript frontend, like Backbone.js, Spine.js or my favorite Batman.js >> >> This provides a lot of advantages, especially if you have people on the >> frontend who know html/css/javascript but don't want to deal with Erlang. >> Now they simply have a RESTful API to deal with and can develop on ahead >> using fixtures or a basic backend in any quick tool that can build REST >> apps like Sinatra or Node.js returning stock responses. Plus, you then are >> already ready to develop other interfaces besides a web frontend for you >> backend with no changes. >> >> And while I've fallen behind on keeping it going, I'm creating apps for >> using with Webmachine to make things faster when you know you are just >> dealing with JSON->Erlang https://github.com/tsloughter/maru >> >> Tristan >> >> On Wed, Apr 4, 2012 at 4:56 AM, Zabrane Mickael wrote: >> >>> http://lenary.co.uk/erlang/2011/08/erlang-web-libraries/ >>> >>> Regards, >>> Zabrane >>> >>> >>> On Apr 4, 2012, at 1:46 PM, Roberto Aloi wrote: >>> >>> Hi Marc, >>> >>> That comparison is behind regarding Zotonic. >>> >>> And I guess also regarding the other projects, as the last update was 5 >>> months ago. >>> >>> >>> True. I couldn't find any other so-detailed comparison, thought. It >>> would probably be worth to update that page with the latest changes in >>> the other frameworks. >>> >>> And it is more a comparison of the features of Chicago Boss to the >>> others, not the other way around. >>> >>> Some extra categories could be considered. >>> >>> >>> Well, that page belongs to the Chicago Boss project, so no big >>> surprise about that. It's good that you made that point clear, though. >>> >>> But then, no comparison is ever complete. >>> >>> >>> I guess we should have a third-party one. Suggestion for a talk at the >>> next Erlang Factory? ;) >>> >>> -- >>> Roberto Aloi >>> --- >>> Website: http://roberto-aloi.com >>> Twitter: @robertoaloi >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> >>> >>> >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> >>> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vasdeveloper@REDACTED Tue Apr 10 10:55:52 2012 From: vasdeveloper@REDACTED (Kannan) Date: Tue, 10 Apr 2012 14:25:52 +0530 Subject: [erlang-questions] Erlang based Web Stack In-Reply-To: References: <4025530D-7B4A-4FD4-AEDE-0FA6017DE9F0@gmail.com> Message-ID: Dear Garrett, It is indeed a nice email address is your's :) Your benchmark data is helpful for us, and we will do a final benchmark before we come to any decision on adoption of tools. Yes, we reap the real benefit of Erlang, only if we use it in "mega" solutions. Thank you, your inputs have given us a great motivation. Kind Regards, Kannan. On Thu, Apr 5, 2012 at 9:03 PM, Garrett Smith wrote: > On Thu, Apr 5, 2012 at 2:17 AM, Kannan wrote: > > Thanks guys, that is a lot of input. > > > > How is the support of OTP for multimedia content manipulation, > transcoding > > etc? Or you advice to do it at the C level and communicate it to Erlang? > > > > Also, if someone has already invented the wheel of how good Erlang is > > compared to PHP, please share it with us. > > Stats are sirens - they lure you in with lies and deceit and are > almost always dangerous! > > That said, I ran some basic ab tests against a host of web servers a > few years ago. With these simplistic, flawed results, I came to the > rock solid conclusion that the only web platform that matched PHP for > performance and stability was Erlang. > > https://github.com/gar1t/landshark/blob/master/doc/benchmarks.txt > > The Erlang HTTP server was Mochiweb. But I've seen similar performance > characteristics with other Erlang servers. > > > We would like to have a mega site purely on Erlang and C. > > I think you're in very good hands with Erlang. > > I'd also disagree with the comment that comparing Erlang and PHP is > comparing apples and oranges. Maybe at a very high, abstract level -- > but you can certainly compare the two for building HTTP based > applications. > > If it matters enough to your business to get this absolutely right -- > you might want to build a benchmark app for your cases and measure the > various stacks you're curious about. > > But anecdotally, I think Erlang is an *outstanding* platform for "mega" > sites :) > > Garrett > -------------- next part -------------- An HTML attachment was scrubbed... URL: From swetha.2112@REDACTED Tue Apr 10 11:12:29 2012 From: swetha.2112@REDACTED (Swetha Raj) Date: Tue, 10 Apr 2012 14:42:29 +0530 Subject: [erlang-questions] How to remove the old installation of erlang ? Message-ID: Hi all, I had erlang R11B-5 installed and then upgraded it to R13B04 and now i tried installing R11B-5 and am facing issues.I was looking at ways to clean up the erlang installation and do a fresh install. I tried make uninstall,but it failed as shown below - root@REDACTED:/space/otp_src_R11B-5# make uninstall make: *** No rule to make target `uninstall'. Stop Any ideas how to do this ? Thanks, Swetha -------------- next part -------------- An HTML attachment was scrubbed... URL: From vasdeveloper@REDACTED Tue Apr 10 11:38:21 2012 From: vasdeveloper@REDACTED (Kannan) Date: Tue, 10 Apr 2012 15:08:21 +0530 Subject: [erlang-questions] Erlang based Web Stack In-Reply-To: References: <4025530D-7B4A-4FD4-AEDE-0FA6017DE9F0@gmail.com> Message-ID: Dear Serge, Depends on what kind of transcoding. My work is in streaming servers and we > do a lot of transcoding (VOD files and live streams). We never needed > anything other than executing VLC or ffmpeg with os:cmd or open_port. There you hit the nail on the head. ffmpeg is a great tool for transcoding, and it is on top our options list. It is used by Mbuni, an opensource MMS gateway, too. > > One thing I really love about erlang that no other technology has is that > you can run your servers in a console. We execute erlang with dtach. This > means we can at any time, log in to a machine, attach to the erlang server > and see what is going on. > Definitely connecting to the VM shell through the pipe is something unique to Erlang, and most of the time we used it to execute commands that are special. We always discouraged our developers from using pipe for monitoring live commercial systems, as it huts the performance of the systems. Instead we used erlang.logs. For debugging a test system, certainly, this is a great thing. Thanks for your inputs, and you are all about a good solution, even with the previous post on the same thread. Kind Regards, Kannan. -------------- next part -------------- An HTML attachment was scrubbed... URL: From vasdeveloper@REDACTED Tue Apr 10 11:58:52 2012 From: vasdeveloper@REDACTED (Kannan) Date: Tue, 10 Apr 2012 15:28:52 +0530 Subject: [erlang-questions] How to remove the old installation of erlang ? In-Reply-To: References: Message-ID: Swetha, If you are using *X platforms, please go to the Erlang home directory and just delete the relevant folder. If you are using the default home directory, it is under /usr/local/erlang/. Additional cleanup might me required, if you had manually copied libraries or executable to other folders, like */lib or */bin. People often do this as a quick measure to over come "path problems". If you are using releases for your application, you will have to re-create the release. Kannan. On Tue, Apr 10, 2012 at 2:42 PM, Swetha Raj wrote: > Hi all, > I had erlang R11B-5 installed and then upgraded it to R13B04 and > now i tried installing R11B-5 and am facing issues.I was looking at ways to > clean up the erlang installation and do a fresh install. > I tried make uninstall,but it failed as shown below - > root@REDACTED:/space/otp_src_R11B-5# make uninstall > make: *** No rule to make target `uninstall'. Stop > > Any ideas how to do this ? > > Thanks, > Swetha > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From pablo.vb80@REDACTED Tue Apr 10 12:13:39 2012 From: pablo.vb80@REDACTED (Pablo Vieytes) Date: Tue, 10 Apr 2012 12:13:39 +0200 Subject: [erlang-questions] pattern matching with records in a function Message-ID: Hi, I'm trying to use records in functions pattern matching but I'm not able. I want something like that: handle_cast(Msg = #inputmsg{_='_'}, State) -> do_something(Msg), {noreply, State}; Any idea? thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From attila.r.nohl@REDACTED Tue Apr 10 12:23:48 2012 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Tue, 10 Apr 2012 12:23:48 +0200 Subject: [erlang-questions] pattern matching with records in a function In-Reply-To: References: Message-ID: 2012/4/10 Pablo Vieytes : > Hi, > I'm trying to use records in functions pattern matching but I'm not able.?I > want something like that: > > handle_cast(Msg = #inputmsg{_='_'}, State) -> > ? ?do_something(Msg), > ? ? {noreply, State}; > > Any idea? One idea: handle_cast( #inputmsg{} = Msg, State) -> ? ?do_something(Msg), ? ? {noreply, State}; Although I'm not quite sure what you want to achieve... > thanks. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From smith.winston.101@REDACTED Tue Apr 10 14:15:13 2012 From: smith.winston.101@REDACTED (Winston Smith) Date: Tue, 10 Apr 2012 08:15:13 -0400 Subject: [erlang-questions] Status of HARDDEBUG code (doesn't compile, seems to be outdated) In-Reply-To: References: Message-ID: 2012/4/10 Bj?rn Gustavsson : > On Thu, Apr 5, 2012 at 7:56 PM, Winston Smith > wrote: >> So onto my question: ?is HARDDEBUG still supported? ?Is it >> abandonware, or has it just gotten a little out of date? > > The way we use HARDDEBUG is to insert > a "#define HARDDEBUG" into a single source > code file, when we are debugging a specific > problem or updating that part of the code. > Turning on HARDDEBUG for the entire emulator > will make it very slow. I'm trying to use HARDDEBUG to track down a TYPE ASSERTION FAILED in mnesia:stop(), so I don't actually know where the problem is originating. I was kind of hoping that HARDDEBUG would help find the issue earlier on -- all I need to do to reproduce it is mnesia:start(), mnesia:stop() so it doesn't matter if the emulator is slow. > That probably means that some HARDDEBUG > code is very stale. I don't think it's worth spending > a lot of time fixing it. I have some patches to at least get it compile, I'll submit those to erlang-patches. Thanks! W. From robert.virding@REDACTED Tue Apr 10 14:44:35 2012 From: robert.virding@REDACTED (Robert Virding) Date: Tue, 10 Apr 2012 13:44:35 +0100 (BST) Subject: [erlang-questions] pattern matching with records in a function In-Reply-To: Message-ID: As Attila has said the way to do this: handle_cast(#inputmsg{}=Msg, State) -> ... ; The reason your example doesn't work is that #inputmsg{_='_'} expands so that all the fields will get the value of the ATOM '_' which is definitely not the same as the VARIABLE _. In this case there is actually no need to do anything as the compiler automatically puts the variable _ for all fields which aren't explicitly mentioned. The main use of the _='_' construct is when you want to create a match pattern for ets/mnesia which is tuple which is INTEPRETED as a pattern. Then it is useful to have a construct which sets all unmentioned fields to the value of the atom '_' which is interpreted as the don't care variable. It is irrelevant whether you write #inputmsg{}=Msg or Msg=#inputmsg{} , they are equivalent. I prefer the former, but many prefer the latter. Robert ----- Original Message ----- Hi, I'm trying to use records in functions pattern matching but I'm not able. I want something like that: handle_cast(Msg = #inputmsg{_='_'}, State) -> do_something(Msg), {noreply, State}; Any idea? thanks. _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From egil@REDACTED Tue Apr 10 14:46:52 2012 From: egil@REDACTED (=?ISO-8859-1?Q?Bj=F6rn-Egil_Dahlberg?=) Date: Tue, 10 Apr 2012 14:46:52 +0200 Subject: [erlang-questions] erlang:trace/3 In-Reply-To: References: Message-ID: <4F842BBC.9050201@erlang.org> On 2012-04-09 19:49, Emilio De Camargo Francesquini wrote: > Hello, > > I'm having some trouble understanding the exact meaning of two of the > flags for the erlang:trace/3 function. > > Flag: > > - running > Trace scheduling of processes. > Message tags: in, and out. > > I imagine that a message tagged "in" means that the process was chosen > by a scheduler and will begin/resume execution and a tag "out" means > that the processes has been preempted. Is that correct? Correct but, to be clear, not only preempted. The tag "out" will be sent if the process is scheduled out for any reason. > - exiting > Trace scheduling of an exiting processes. > Message tags: in_exiting, out_exiting, and out_exited. > > I guess that these messages are sent when the proccess is about to > exit or has already exited. Am I right? What is the exact difference > between each one of them? With "in_exiting" and "out_exiting" the process is scheduled as normal but it is in limbo. This means the process is dead but has to be scheduled in order to terminate and cleanup internally in the runtime. In other words, it will not execute beam-code any more just terminate. Why? It simplifies things internally. > Moreover, what is the difference between "exiting" flag with the tag > "out_exited" and "procs" flag with the tag "exit"? The tag "exit" from procs is sent when the process is deemed dead, i.e. it is exiting. The last chunk of beam code the process executed was some form of exit. At this moment in time process has the state EXITING but will potentially be scheduled again. The trace will after this be out_exited or, if more has to be done to terminate it, out_exiting and in_exiting. Ex: Eshell V5.9 (abort with ^G) 1> P = spawn(fun() -> receive Ok -> ok end end). <0.34.0> 2> erlang:trace(P, true, [running, procs, exiting]). 1 3> P ! ok. ok 4> flush(). Shell got {trace,<0.34.0>,in,{erl_eval,receive_clauses,6}} Shell got {trace,<0.34.0>,exit,normal} Shell got {trace,<0.34.0>,out_exited,0} ok I hope this clarifies things. Regards, Bj?rn-Egil Erlang/OTP From toby@REDACTED Tue Apr 10 15:09:07 2012 From: toby@REDACTED (Toby Thain) Date: Tue, 10 Apr 2012 09:09:07 -0400 Subject: [erlang-questions] Erlang based Web Stack In-Reply-To: References: <4025530D-7B4A-4FD4-AEDE-0FA6017DE9F0@gmail.com> <4F7D888E.5060608@telegraphics.com.au> Message-ID: <4F8430F3.1030808@telegraphics.com.au> On 10/04/12 4:25 AM, Kannan wrote: > Dear Toby, > > IMHO, PHP is a proper subset of Erlang, when it comes to solving real > world problems. You are right in saying "benchmark the parts for > performance", but we are not only about performance, but also about > reusing the tools that are already available in the domain, which are > written in C/C++. I agree, it would be hard or impossible to justify a rewrite in this case. --Toby > > Kind Regards, > Kannan. From antoine.koener@REDACTED Tue Apr 10 15:54:55 2012 From: antoine.koener@REDACTED (Antoine Koener) Date: Tue, 10 Apr 2012 15:54:55 +0200 Subject: [erlang-questions] BERT encoding and WebSocket In-Reply-To: <3516e246-0cf8-4748-8646-6b4ce1f57557@z3g2000pbn.googlegroups.com> References: <3516e246-0cf8-4748-8646-6b4ce1f57557@z3g2000pbn.googlegroups.com> Message-ID: <8171494D-0839-45AE-9935-81084F77CFA9@gmail.com> Are you sure that websockets does not support binary data ? The data type is "blob", or "arraybuffer". See w3c for more information. (sorry for not giving you Uris about that, I'm conferencing :)) -- Was in mobile mode ... On 10 avr. 2012, at 04:26, ngocdaothanh wrote: > What is the best way to use BERT encoding (http://bert-rpc.org/) with > WebSocket? > > BERT is binary but WebSocket does not support binary at this moment. > Should I use base64 to encode BERT binary to normal string? Base64 has > 33% overhead (http://en.wikipedia.org/wiki/Base64). How much space can > BERT save compared to JSON? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From antoine.koener@REDACTED Tue Apr 10 16:17:31 2012 From: antoine.koener@REDACTED (Antoine Koener) Date: Tue, 10 Apr 2012 16:17:31 +0200 Subject: [erlang-questions] BERT encoding and WebSocket In-Reply-To: <8171494D-0839-45AE-9935-81084F77CFA9@gmail.com> References: <3516e246-0cf8-4748-8646-6b4ce1f57557@z3g2000pbn.googlegroups.com> <8171494D-0839-45AE-9935-81084F77CFA9@gmail.com> Message-ID: Here's a link: http://autobahn.ws/testsuite/reports/clients/index.html :-) On Tue, Apr 10, 2012 at 3:54 PM, Antoine Koener wrote: > Are you sure that websockets does not support binary data ? > > The data type is "blob", or "arraybuffer". > > See w3c for more information. > > (sorry for not giving you Uris about that, I'm conferencing :)) > > -- > Was in mobile mode ... > > On 10 avr. 2012, at 04:26, ngocdaothanh wrote: > >> What is the best way to use BERT encoding (http://bert-rpc.org/) with >> WebSocket? >> >> BERT is binary but WebSocket does not support binary at this moment. >> Should I use base64 to encode BERT binary to normal string? Base64 has >> 33% overhead (http://en.wikipedia.org/wiki/Base64). How much space can >> BERT save compared to JSON? >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions From pablo.vb80@REDACTED Tue Apr 10 16:25:49 2012 From: pablo.vb80@REDACTED (Pablo Vieytes) Date: Tue, 10 Apr 2012 16:25:49 +0200 Subject: [erlang-questions] pattern matching with records in a function In-Reply-To: References: Message-ID: thanks, now it works. >>Although I'm not quite sure what you want to achieve... I didn't write all code I needed. I needed something like this: -record(inputmsg, {action, data1, ..., datan}). handle_cast(#inputmsg{action=a}=Msg, State) -> action_a(Msg), {noreply, State}; handle_cast(#inputmsg{action=b}=Msg, State) -> action_b(Msg), {noreply, State}; handle_cast(#inputmsg{}=Msg, State) -> action_default(Msg), {noreply, State}; and I needed data1...datan in action_x(). thanks. 2012/4/10 Robert Virding > As Attila has said the way to do this: > > handle_cast(#inputmsg{}=Msg, State) -> > ... ; > > The reason your example doesn't work is that #inputmsg{_='_'} expands so > that all the fields will get the value of the ATOM '_' which is definitely > not the same as the VARIABLE _. In this case there is actually no need to > do anything as the compiler automatically puts the variable _ for all > fields which aren't explicitly mentioned. > > The main use of the _='_' construct is when you want to create a match > pattern for ets/mnesia which is tuple which is INTEPRETED as a pattern. > Then it is useful to have a construct which sets all unmentioned fields to > the value of the atom '_' which is interpreted as the don't care variable. > > It is irrelevant whether you write #inputmsg{}=Msg or Msg=#inputmsg{}, > they are equivalent. I prefer the former, but many prefer the latter. > > Robert > > ------------------------------ > > Hi, > I'm trying to use records in functions pattern matching but I'm not > able. I want something like that: > > handle_cast(Msg = #inputmsg{_='_'}, State) -> > do_something(Msg), > {noreply, State}; > > Any idea? > thanks. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rtrlists@REDACTED Tue Apr 10 16:46:22 2012 From: rtrlists@REDACTED (Robert Raschke) Date: Tue, 10 Apr 2012 15:46:22 +0100 Subject: [erlang-questions] pattern matching with records in a function In-Reply-To: References: Message-ID: On Tue, Apr 10, 2012 at 3:25 PM, Pablo Vieytes wrote: > thanks, > now it works. > > > >>Although I'm not quite sure what you want to achieve... > > I didn't write all code I needed. > > I needed something like this: > > > -record(inputmsg, {action, data1, ..., datan}). > > handle_cast(#inputmsg{action=a}=Msg, State) -> > action_a(Msg), > {noreply, State}; > > > handle_cast(#inputmsg{action=b}=Msg, State) -> > action_b(Msg), > {noreply, State}; > > handle_cast(#inputmsg{}=Msg, State) -> > action_default(Msg), > {noreply, State}; > > > > and I needed data1...datan in action_x(). > > > thanks. > > You can simplify this ever so slightly: handle_cast(#inputmsg{action=Action} = Msg, State) -> action(Action, Msg), {noreply, State}. action(a, Msg) -> action_a(Msg); action(b, Msg) -> action_b(Msg); action(_, Msg) -> action_default(Msg). Robby -------------- next part -------------- An HTML attachment was scrubbed... URL: From s.j.thompson@REDACTED Tue Apr 10 17:11:40 2012 From: s.j.thompson@REDACTED (Simon Thompson) Date: Tue, 10 Apr 2012 16:11:40 +0100 Subject: [erlang-questions] Wrangler 1.0 released Message-ID: Wrangler 1.0 http://www.cs.kent.ac.uk/projects/wrangler We are pleased to announce the release of Wrangler 1.0, the refactoring tool for Erlang. New in this release: - template-based API, which allows users to define their own refactorings using Erlang concrete syntax; - a domain-specific language supporting scripting of composite refactorings from built-in and user defined refactorings; - an API upgrade facility, which automatically builds refactorings to replace calls to an old API with calls to a new one, based on a "adapter" module defining the old API in terms of the new (example regexp to re in Erlang standard libraries) This release also supports - built-in refactorings (code structure, module structure, macros, tests) - clone detection and removal - module "bad smell" location and improvement - testing framework aware Huiqing and Simon The Wrangler team Simon Thompson | Professor of Logic and Computation School of Computing | University of Kent | Canterbury, CT2 7NF, UK s.j.thompson@REDACTED | M +44 7986 085754 | W www.cs.kent.ac.uk/~sjt From s.j.thompson@REDACTED Tue Apr 10 17:12:36 2012 From: s.j.thompson@REDACTED (Simon Thompson) Date: Tue, 10 Apr 2012 16:12:36 +0100 Subject: [erlang-questions] Wrangler User Survey Message-ID: Wrangler User Survey With the release of Wrangler 1.0 we are keen to find out users' experience of the Wrangler refactoring tool for Erlang, and about ways in which Wrangler can be developed in the future. http://www.cs.kent.ac.uk/projects/wrangler/User_Survey.html Thanks very much for taking the time to fill this in. Huiqing and SImon The Wrangler team Simon Thompson | Professor of Logic and Computation School of Computing | University of Kent | Canterbury, CT2 7NF, UK s.j.thompson@REDACTED | M +44 7986 085754 | W www.cs.kent.ac.uk/~sjt From essen@REDACTED Tue Apr 10 17:20:08 2012 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Tue, 10 Apr 2012 17:20:08 +0200 Subject: [erlang-questions] Wrangler 1.0 released In-Reply-To: References: Message-ID: <4F844FA8.1030305@ninenines.eu> Congratulations on the release! Is there any chance to have vim support later on? Thanks. On 04/10/2012 05:11 PM, Simon Thompson wrote: > > Wrangler 1.0 > > http://www.cs.kent.ac.uk/projects/wrangler > > We are pleased to announce the release of Wrangler 1.0, the refactoring tool for Erlang. New in this release: > > - template-based API, which allows users to define their own refactorings using Erlang concrete syntax; > - a domain-specific language supporting scripting of composite refactorings from built-in and user defined refactorings; > - an API upgrade facility, which automatically builds refactorings to replace calls to an old API with calls to a new one, based on a "adapter" module defining the old API in terms of the new (example regexp to re in Erlang standard libraries) > > This release also supports > > - built-in refactorings (code structure, module structure, macros, tests) > - clone detection and removal > - module "bad smell" location and improvement > - testing framework aware > > Huiqing and Simon > The Wrangler team > > > Simon Thompson | Professor of Logic and Computation > School of Computing | University of Kent | Canterbury, CT2 7NF, UK > s.j.thompson@REDACTED | M +44 7986 085754 | W www.cs.kent.ac.uk/~sjt > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- Lo?c Hoguin Erlang Cowboy Nine Nines From msegalis@REDACTED Tue Apr 10 17:27:44 2012 From: msegalis@REDACTED (SEGALIS Morgan) Date: Tue, 10 Apr 2012 17:27:44 +0200 Subject: [erlang-questions] Erlang accepting SSL connection is really slow (comparing to C++) Message-ID: Hi all, I first asked my question on stack overflow. Unfortunately with no lock so far. This is my last hope finding an clear answer. Here's it is : I'm currently testing extreme condition on a piece of code written with Erlang. I have implemented learnyousomeerlang.com's technique of supervisor to have multiple accept capability. Here the code slightly modified to handle SSL connections of the supervisor: -module(mymodule). -behaviour(supervisor). -export([start/0, start_socket/0]). -define(SSL_OPTIONS, [{active, true}, {mode, list}, {reuseaddr, true}, {cacertfile, "./ssl_key/server/gd_bundle.crt"}, {certfile, "./ssl_key/server/cert.pem"}, {keyfile, "./ssl_key/server/key.pem"}, {password, "********"} ]). -export([init/1]). start_link() -> application:start(crypto), crypto:start(), application:start(public_key), application:start(ssl), supervisor:start_link({local, ?MODULE}, ?MODULE, []). init([]) -> {ok, LSocket} = ssl:listen(4242, ?SSL_OPTIONS), spawn_link(fun empty_listeners/0), {ok, {{simple_one_for_one, 60, 3600}, [{socket, {mymodule_serv, start_link, [LSocket]}, % pass the socket! temporary, 1000, worker, [mymodule_serv]} ]}}. empty_listeners() -> [start_socket() || _ <- lists:seq(1,100)], ok. start_socket() -> supervisor:start_child(?MODULE, []). Here's the code for gen_server which will represent every client connecting : -module(mymodule_serv). -behaviour(gen_server). -export([start_link/1]). -export([init/1, handle_call/3, handle_cast/2, terminate/2, code_change/3, handle_info/2]). start_link(Socket) -> gen_server:start_link(?MODULE, Socket, []). init(Socket) -> gen_server:cast(self(), accept), {ok, #client{socket=Socket, pid=self()}}. handle_call(_E, _From, Client) -> {noreply, Client}. handle_cast(accept, C = #client{socket=ListenSocket}) -> {ok, AcceptSocket} = ssl:transport_accept(ListenSocket), mymodule:start_socket(), ssl:ssl_accept(AcceptSocket), ssl:setopts(AcceptSocket, [{active, true}, {mode, list}]), {noreply, C#client{socket=AcceptSocket, state=connecting}}. [...] I have the ability to launch close to 10.000 connections at once from multiple server. While it will take 10 second to a ssl accepting bit of C++ code to accept all of them (which don't even have multiple accept pending), in Erlang this is quite different. It will accept at most 20 connections a second (according to netstat info, whilst C++ accept more like 1K connection per seconds) While the 10K connections are awaiting for acceptance, I'm manually trying to connect as well. openssl s_client -ssl3 -ign_eof -connect myserver.com:4242 3 cases happen when I do : - Connection simply timeout - Connection will connect after waiting for it 30 sec. at least - Connection will occur almost directly When I try connecting manually with 2 consoles, the first done handshaking will not always be the first which tried to connect... Which I found particular. The server configuration is : - 2 x Intel? Xeon? E5620 - 8x 2.4GHz - 24 Go RAM I'm starting the Erlang shell with : $erl +S 8:8 I have even tried to accept the connection with gen_tcp, and upgrading afterwards the connection to a SSL one. Still the same issue, it won't accept more than 10 connections a second... Is ssl:ssl_accept is doing this ? does it lock anything that would prevent Erlang to scale this ? After looking around on other SSL server created in erlang, it seems that they use some kind of driver for SSL/TLS connection, my examples are RabbitMQ and EjabberD. Nowhere there is ssl:ssl_accept in their Erlang code, I haven't investigate a lot, but it seems they have created their own driver in order to upgrade the TCP Socket to a SSL/TLS one. Is that because there is an issue with Erlang's module SSL ? Does anyone know why they are using custom driver for SSL/TLS ? Any thoughts on this ? -- Morgan -------------- next part -------------- An HTML attachment was scrubbed... URL: From comptekki@REDACTED Tue Apr 10 17:36:56 2012 From: comptekki@REDACTED (Wes James) Date: Tue, 10 Apr 2012 09:36:56 -0600 Subject: [erlang-questions] Wrangler 1.0 released In-Reply-To: <4F844FA8.1030305@ninenines.eu> References: <4F844FA8.1030305@ninenines.eu> Message-ID: Hey Lo?c, I used vi for years and in many cases, I tried to use screen to access remote vi sessions, etc., but I started getting in to emacs and with emacs running in daemon mode you can do about anything you want from there. View already loaded edit sessions on numerous files (and move between them), compile, do shell stuff all from inside emacs. No, this isn't the start of a thread for bashing vi, just my input to a different workflow I learned :) Good luck! Wes On Tue, Apr 10, 2012 at 9:20 AM, Lo?c Hoguin wrote: > Congratulations on the release! > > Is there any chance to have vim support later on? > > Thanks. > > > On 04/10/2012 05:11 PM, Simon Thompson wrote: >> >> >> Wrangler 1.0 >> >> ? http://www.cs.kent.ac.uk/projects/wrangler >> >> We are pleased to announce the release of Wrangler 1.0, the refactoring >> tool for Erlang. New in this release: >> >> - template-based API, which allows users to define their own refactorings >> using Erlang concrete syntax; >> - a domain-specific language supporting scripting of composite >> refactorings from built-in and user defined refactorings; >> - an API upgrade facility, which automatically builds refactorings to >> replace calls to an old API with calls to a new one, based on a "adapter" >> module defining the old API in terms of the new ? (example regexp to re in >> Erlang standard libraries) >> >> This release also supports >> >> - built-in refactorings (code structure, module structure, macros, tests) >> - clone detection and removal >> - module "bad smell" location and improvement >> - testing framework aware >> >> Huiqing and Simon >> The Wrangler team >> >> >> Simon Thompson | Professor of Logic and Computation >> School of Computing | University of Kent | Canterbury, CT2 7NF, UK >> s.j.thompson@REDACTED | M +44 7986 085754 | W www.cs.kent.ac.uk/~sjt >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > > > -- > Lo?c Hoguin > Erlang Cowboy > Nine Nines > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From essen@REDACTED Tue Apr 10 17:40:26 2012 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Tue, 10 Apr 2012 17:40:26 +0200 Subject: [erlang-questions] Wrangler 1.0 released In-Reply-To: References: <4F844FA8.1030305@ninenines.eu> Message-ID: <4F84546A.5090301@ninenines.eu> Great that it works out for you, but I went from learning unix with emacs to using vim later on and I'm not willing to go back. :) On 04/10/2012 05:36 PM, Wes James wrote: > Hey Lo?c, > > I used vi for years and in many cases, I tried to use screen to access > remote vi sessions, etc., but I started getting in to emacs and with > emacs running in daemon mode you can do about anything you want from > there. View already loaded edit sessions on numerous files (and move > between them), compile, do shell stuff all from inside emacs. No, > this isn't the start of a thread for bashing vi, just my input to a > different workflow I learned :) > > Good luck! > > Wes > > On Tue, Apr 10, 2012 at 9:20 AM, Lo?c Hoguin wrote: >> Congratulations on the release! >> >> Is there any chance to have vim support later on? >> >> Thanks. >> >> >> On 04/10/2012 05:11 PM, Simon Thompson wrote: >>> >>> >>> Wrangler 1.0 >>> >>> http://www.cs.kent.ac.uk/projects/wrangler >>> >>> We are pleased to announce the release of Wrangler 1.0, the refactoring >>> tool for Erlang. New in this release: >>> >>> - template-based API, which allows users to define their own refactorings >>> using Erlang concrete syntax; >>> - a domain-specific language supporting scripting of composite >>> refactorings from built-in and user defined refactorings; >>> - an API upgrade facility, which automatically builds refactorings to >>> replace calls to an old API with calls to a new one, based on a "adapter" >>> module defining the old API in terms of the new (example regexp to re in >>> Erlang standard libraries) >>> >>> This release also supports >>> >>> - built-in refactorings (code structure, module structure, macros, tests) >>> - clone detection and removal >>> - module "bad smell" location and improvement >>> - testing framework aware >>> >>> Huiqing and Simon >>> The Wrangler team >>> >>> >>> Simon Thompson | Professor of Logic and Computation >>> School of Computing | University of Kent | Canterbury, CT2 7NF, UK >>> s.j.thompson@REDACTED | M +44 7986 085754 | W www.cs.kent.ac.uk/~sjt >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >> >> >> >> -- >> Lo?c Hoguin >> Erlang Cowboy >> Nine Nines >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions -- Lo?c Hoguin Erlang Cowboy Nine Nines From comptekki@REDACTED Tue Apr 10 17:45:14 2012 From: comptekki@REDACTED (Wes James) Date: Tue, 10 Apr 2012 09:45:14 -0600 Subject: [erlang-questions] Erlang accepting SSL connection is really slow (comparing to C++) In-Reply-To: References: Message-ID: Hi SEGALIS, On Tue, Apr 10, 2012 at 9:27 AM, SEGALIS Morgan wrote: > Hi all, > > I first asked my question on stack overflow. Unfortunately with no lock so > far. > This is my last hope finding an clear answer. Here's it is : I'd recommend taking a look at: https://github.com/extend/cowboy_examples download it, run make, start it up and you can go to either http:localhost:8080 or https://localhost:8443 . Take a peak at the code to see how it works :) Wes From essen@REDACTED Tue Apr 10 17:56:53 2012 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Tue, 10 Apr 2012 17:56:53 +0200 Subject: [erlang-questions] Erlang accepting SSL connection is really slow (comparing to C++) In-Reply-To: References: Message-ID: <4F845845.5030805@ninenines.eu> Hello! On 04/10/2012 05:27 PM, SEGALIS Morgan wrote: [...] > While it will take 10 second to a ssl accepting bit of C++ code to accept > all of them (which don't even have multiple accept pending), in Erlang this > is quite different. It will accept at most 20 connections a second > (according to netstat info, whilst C++ accept more like 1K connection per > seconds) > > While the 10K connections are awaiting for acceptance, I'm manually trying > to connect as well. > > openssl s_client -ssl3 -ign_eof -connect myserver.com:4242 > > 3 cases happen when I do : > > - Connection simply timeout > - Connection will connect after waiting for it 30 sec. at least > - Connection will occur almost directly The OTP SSL code is just very slow, and AFAIK the reason for this is that it's done in full Erlang. Here's a quick and dirty comparison between HTTP and HTTPS in Cowboy, where only the transport used differs: HTTP: % siege -b -c 100 http://localhost:8080/ ** SIEGE 2.70 ** Preparing 100 concurrent users for battle. The server is now under siege...^C Lifting the server siege... done. Transactions: 49266 hits Availability: 100.00 % Elapsed time: 5.94 secs Data transferred: 0.56 MB Response time: 0.01 secs Transaction rate: 8293.94 trans/sec Throughput: 0.09 MB/sec Concurrency: 99.36 Successful transactions: 49266 Failed transactions: 0 Longest transaction: 0.06 Shortest transaction: 0.00 HTTPS: % siege -b -c 100 https://localhost:8443/ ** SIEGE 2.70 ** Preparing 100 concurrent users for battle. The server is now under siege...^C Lifting the server siege... done. Transactions: 698 hits Availability: 100.00 % Elapsed time: 4.50 secs Data transferred: 0.01 MB Response time: 0.59 secs Transaction rate: 155.11 trans/sec Throughput: 0.00 MB/sec Concurrency: 92.15 Successful transactions: 698 Failed transactions: 0 Longest transaction: 1.14 Shortest transaction: 0.07 This is on a Zenbook UX31E which is a damn good machine but it still shows a huge difference between both of them. And the more you try to accept at the same time, the longest time it can take to accept. -- Lo?c Hoguin Erlang Cowboy Nine Nines From msegalis@REDACTED Tue Apr 10 18:11:19 2012 From: msegalis@REDACTED (SEGALIS Morgan) Date: Tue, 10 Apr 2012 18:11:19 +0200 Subject: [erlang-questions] Erlang accepting SSL connection is really slow (comparing to C++) In-Reply-To: References: Message-ID: Hi James, I'm not sure what you trying to make me do... Do you suggest I try cowboy pool of acceptor ? 2012/4/10 Wes James > Hi SEGALIS, > > On Tue, Apr 10, 2012 at 9:27 AM, SEGALIS Morgan > wrote: > > Hi all, > > > > I first asked my question on stack overflow. Unfortunately with no lock > so > > far. > > This is my last hope finding an clear answer. Here's it is : > > > > I'd recommend taking a look at: > > https://github.com/extend/cowboy_examples > > download it, run make, start it up and you can go to either > http:localhost:8080 or https://localhost:8443 . > > Take a peak at the code to see how it works :) > > Wes > -- Morgan SEGALIS -------------- next part -------------- An HTML attachment was scrubbed... URL: From gleber.p@REDACTED Tue Apr 10 18:17:18 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Tue, 10 Apr 2012 18:17:18 +0200 Subject: [erlang-questions] Erlang formatting with Vim (was Wrangler 1.0 release) Message-ID: 10 kwi 2012 17:40, "Lo?c Hoguin" napisa?(a): > > Great that it works out for you, but I went from learning unix with emacs to using vim later on and I'm not willing to go back. :) > Too bad Vim has non-standard Erlang formatting. It's hard to work (especially contribute to) with Erlang files created with Vim :( > > On 04/10/2012 05:36 PM, Wes James wrote: >> >> Hey Lo?c, >> >> I used vi for years and in many cases, I tried to use screen to access >> remote vi sessions, etc., but I started getting in to emacs and with >> emacs running in daemon mode you can do about anything you want from >> there. View already loaded edit sessions on numerous files (and move >> between them), compile, do shell stuff all from inside emacs. No, >> this isn't the start of a thread for bashing vi, just my input to a >> different workflow I learned :) >> >> Good luck! >> >> Wes >> >> On Tue, Apr 10, 2012 at 9:20 AM, Lo?c Hoguin wrote: >>> >>> Congratulations on the release! >>> >>> Is there any chance to have vim support later on? >>> >>> Thanks. >>> >>> >>> On 04/10/2012 05:11 PM, Simon Thompson wrote: >>>> >>>> >>>> >>>> Wrangler 1.0 >>>> >>>> http://www.cs.kent.ac.uk/projects/wrangler >>>> >>>> We are pleased to announce the release of Wrangler 1.0, the refactoring >>>> tool for Erlang. New in this release: >>>> >>>> - template-based API, which allows users to define their own refactorings >>>> using Erlang concrete syntax; >>>> - a domain-specific language supporting scripting of composite >>>> refactorings from built-in and user defined refactorings; >>>> - an API upgrade facility, which automatically builds refactorings to >>>> replace calls to an old API with calls to a new one, based on a "adapter" >>>> module defining the old API in terms of the new (example regexp to re in >>>> Erlang standard libraries) >>>> >>>> This release also supports >>>> >>>> - built-in refactorings (code structure, module structure, macros, tests) >>>> - clone detection and removal >>>> - module "bad smell" location and improvement >>>> - testing framework aware >>>> >>>> Huiqing and Simon >>>> The Wrangler team >>>> >>>> >>>> Simon Thompson | Professor of Logic and Computation >>>> School of Computing | University of Kent | Canterbury, CT2 7NF, UK >>>> s.j.thompson@REDACTED | M +44 7986 085754 | W www.cs.kent.ac.uk/~sjt >>>> >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-questions >>> >>> >>> >>> >>> -- >>> Lo?c Hoguin >>> Erlang Cowboy >>> Nine Nines >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions > > > > -- > Lo?c Hoguin > Erlang Cowboy > Nine Nines > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From msegalis@REDACTED Tue Apr 10 18:19:42 2012 From: msegalis@REDACTED (Morgan Segalis) Date: Tue, 10 Apr 2012 18:19:42 +0200 Subject: [erlang-questions] Erlang accepting SSL connection is really slow (comparing to C++) In-Reply-To: <4F845845.5030805@ninenines.eu> References: <4F845845.5030805@ninenines.eu> Message-ID: <0E123757-6D98-4496-B190-61C4008CA594@gmail.com> Hi Lo?c, That's what I was afraid of. Then what would be the best workaround in order to outcome this slowness of Erlang's SSL ? Using a C++ Driver ? would that be even possible to pass a Socket to the driver for it to upgrade it into a SSL one ? Thanks. Le 10 avr. 2012 ? 17:56, Lo?c Hoguin a ?crit : > Hello! > > On 04/10/2012 05:27 PM, SEGALIS Morgan wrote: > [...] >> While it will take 10 second to a ssl accepting bit of C++ code to accept >> all of them (which don't even have multiple accept pending), in Erlang this >> is quite different. It will accept at most 20 connections a second >> (according to netstat info, whilst C++ accept more like 1K connection per >> seconds) >> >> While the 10K connections are awaiting for acceptance, I'm manually trying >> to connect as well. >> >> openssl s_client -ssl3 -ign_eof -connect myserver.com:4242 >> >> 3 cases happen when I do : >> >> - Connection simply timeout >> - Connection will connect after waiting for it 30 sec. at least >> - Connection will occur almost directly > > The OTP SSL code is just very slow, and AFAIK the reason for this is that it's done in full Erlang. Here's a quick and dirty comparison between HTTP and HTTPS in Cowboy, where only the transport used differs: > > HTTP: > > % siege -b -c 100 http://localhost:8080/ > ** SIEGE 2.70 > ** Preparing 100 concurrent users for battle. > The server is now under siege...^C > Lifting the server siege... done. > Transactions: 49266 hits > Availability: 100.00 % > Elapsed time: 5.94 secs > Data transferred: 0.56 MB > Response time: 0.01 secs > Transaction rate: 8293.94 trans/sec > Throughput: 0.09 MB/sec > Concurrency: 99.36 > Successful transactions: 49266 > Failed transactions: 0 > Longest transaction: 0.06 > Shortest transaction: 0.00 > > HTTPS: > > % siege -b -c 100 https://localhost:8443/ > ** SIEGE 2.70 > ** Preparing 100 concurrent users for battle. > The server is now under siege...^C > Lifting the server siege... done. > Transactions: 698 hits > Availability: 100.00 % > Elapsed time: 4.50 secs > Data transferred: 0.01 MB > Response time: 0.59 secs > Transaction rate: 155.11 trans/sec > Throughput: 0.00 MB/sec > Concurrency: 92.15 > Successful transactions: 698 > Failed transactions: 0 > Longest transaction: 1.14 > Shortest transaction: 0.07 > > This is on a Zenbook UX31E which is a damn good machine but it still shows a huge difference between both of them. And the more you try to accept at the same time, the longest time it can take to accept. > > -- > Lo?c Hoguin > Erlang Cowboy > Nine Nines From ali.sabil@REDACTED Tue Apr 10 18:50:29 2012 From: ali.sabil@REDACTED (Ali Sabil) Date: Tue, 10 Apr 2012 18:50:29 +0200 Subject: [erlang-questions] Erlang accepting SSL connection is really slow (comparing to C++) In-Reply-To: <0E123757-6D98-4496-B190-61C4008CA594@gmail.com> References: <4F845845.5030805@ninenines.eu> <0E123757-6D98-4496-B190-61C4008CA594@gmail.com> Message-ID: Hi Morgan, Did you check which cipher is being used in your c++ server vs the erlang server? DHE ciphers are notably slow. You can check which cipher suite is being used with: openssl s_client -host HOST -port PORT On Tue, Apr 10, 2012 at 6:19 PM, Morgan Segalis wrote: > Hi Lo?c, > > That's what I was afraid of. > > Then what would be the best workaround in order to outcome this slowness of Erlang's SSL ? > Using a C++ Driver ? would that be even possible to pass a Socket to the driver for it to upgrade it into a SSL one ? > > Thanks. > > Le 10 avr. 2012 ? 17:56, Lo?c Hoguin a ?crit : > >> Hello! >> >> On 04/10/2012 05:27 PM, SEGALIS Morgan wrote: >> [...] >>> While it will take 10 second to a ssl accepting bit of C++ code to accept >>> all of them (which don't even have multiple accept pending), in Erlang this >>> is quite different. It will accept at most 20 connections a second >>> (according to netstat info, whilst C++ accept more like 1K connection per >>> seconds) >>> >>> While the 10K connections are awaiting for acceptance, I'm manually trying >>> to connect as well. >>> >>> ? ? openssl s_client -ssl3 -ign_eof -connect myserver.com:4242 >>> >>> 3 cases happen when I do : >>> >>> ?- Connection simply timeout >>> ?- Connection will connect after waiting for it 30 sec. at least >>> ?- Connection will occur almost directly >> >> The OTP SSL code is just very slow, and AFAIK the reason for this is that it's done in full Erlang. Here's a quick and dirty comparison between HTTP and HTTPS in Cowboy, where only the transport used differs: >> >> HTTP: >> >> % siege -b -c 100 http://localhost:8080/ >> ** SIEGE 2.70 >> ** Preparing 100 concurrent users for battle. >> The server is now under siege...^C >> Lifting the server siege... ? ? ?done. >> Transactions: ? ? ? ? ? ? ? ?49266 hits >> Availability: ? ? ? ? ? ? ? 100.00 % >> Elapsed time: ? ? ? ? ? ? ? ? 5.94 secs >> Data transferred: ? ? ? ? ? ? 0.56 MB >> Response time: ? ? ? ? ? ? ? ? ? ? ? ?0.01 secs >> Transaction rate: ? ? ? ? ?8293.94 trans/sec >> Throughput: ? ? ? ? ? ? ? ? ? 0.09 MB/sec >> Concurrency: ? ? ? ? ? ? ? ? 99.36 >> Successful transactions: ? ? ? 49266 >> Failed transactions: ? ? ? ? ? ? 0 >> Longest transaction: ? ? ? ? ?0.06 >> Shortest transaction: ? ? ? ? 0.00 >> >> HTTPS: >> >> % siege -b -c 100 https://localhost:8443/ >> ** SIEGE 2.70 >> ** Preparing 100 concurrent users for battle. >> The server is now under siege...^C >> Lifting the server siege... ? ? ?done. >> Transactions: ? ? ? ? ? ? ? ? ?698 hits >> Availability: ? ? ? ? ? ? ? 100.00 % >> Elapsed time: ? ? ? ? ? ? ? ? 4.50 secs >> Data transferred: ? ? ? ? ? ? 0.01 MB >> Response time: ? ? ? ? ? ? ? ? ? ? ? ?0.59 secs >> Transaction rate: ? ? ? ? ? 155.11 trans/sec >> Throughput: ? ? ? ? ? ? ? ? ? 0.00 MB/sec >> Concurrency: ? ? ? ? ? ? ? ? 92.15 >> Successful transactions: ? ? ? ? 698 >> Failed transactions: ? ? ? ? ? ? 0 >> Longest transaction: ? ? ? ? ?1.14 >> Shortest transaction: ? ? ? ? 0.07 >> >> This is on a Zenbook UX31E which is a damn good machine but it still shows a huge difference between both of them. And the more you try to accept at the same time, the longest time it can take to accept. >> >> -- >> Lo?c Hoguin >> Erlang Cowboy >> Nine Nines > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From andre@REDACTED Tue Apr 10 19:03:02 2012 From: andre@REDACTED (=?ISO-8859-1?Q?Andr=E9_Graf?=) Date: Tue, 10 Apr 2012 19:03:02 +0200 Subject: [erlang-questions] Wrangler 1.0 released In-Reply-To: <4F84546A.5090301@ninenines.eu> References: <4F844FA8.1030305@ninenines.eu> <4F84546A.5090301@ninenines.eu> Message-ID: Hello congrats to 1.0, unfortunately not on vim! how much work would it be to port wrangler to vim? I guess there are several vim users who would like to see wrangler support in vim and might also contribute. On 10 April 2012 17:40, Lo?c Hoguin wrote: > Great that it works out for you, but I went from learning unix with emacs to > using vim later on and I'm not willing to go back. :) > > > On 04/10/2012 05:36 PM, Wes James wrote: >> >> Hey Lo?c, >> >> I used vi for years and in many cases, I tried to use screen to access >> remote vi sessions, etc., but I started getting in to emacs and with >> emacs running in daemon mode you can do about anything you want from >> there. View already loaded edit sessions on numerous files (and move >> between them), compile, do shell stuff all from inside emacs. ?No, >> this isn't the start of a thread for bashing vi, just my input to a >> different workflow I learned :) >> >> Good luck! >> >> Wes >> >> On Tue, Apr 10, 2012 at 9:20 AM, Lo?c Hoguin ?wrote: >>> >>> Congratulations on the release! >>> >>> Is there any chance to have vim support later on? >>> >>> Thanks. >>> >>> >>> On 04/10/2012 05:11 PM, Simon Thompson wrote: >>>> >>>> >>>> >>>> Wrangler 1.0 >>>> >>>> ? http://www.cs.kent.ac.uk/projects/wrangler >>>> >>>> We are pleased to announce the release of Wrangler 1.0, the refactoring >>>> tool for Erlang. New in this release: >>>> >>>> - template-based API, which allows users to define their own >>>> refactorings >>>> using Erlang concrete syntax; >>>> - a domain-specific language supporting scripting of composite >>>> refactorings from built-in and user defined refactorings; >>>> - an API upgrade facility, which automatically builds refactorings to >>>> replace calls to an old API with calls to a new one, based on a >>>> "adapter" >>>> module defining the old API in terms of the new ? (example regexp to re >>>> in >>>> Erlang standard libraries) >>>> >>>> This release also supports >>>> >>>> - built-in refactorings (code structure, module structure, macros, >>>> tests) >>>> - clone detection and removal >>>> - module "bad smell" location and improvement >>>> - testing framework aware >>>> >>>> Huiqing and Simon >>>> The Wrangler team >>>> >>>> >>>> Simon Thompson | Professor of Logic and Computation >>>> School of Computing | University of Kent | Canterbury, CT2 7NF, UK >>>> s.j.thompson@REDACTED | M +44 7986 085754 | W www.cs.kent.ac.uk/~sjt >>>> >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-questions >>> >>> >>> >>> >>> -- >>> Lo?c Hoguin >>> Erlang Cowboy >>> Nine Nines >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions > > > > -- > Lo?c Hoguin > Erlang Cowboy > Nine Nines > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From msegalis@REDACTED Tue Apr 10 19:16:54 2012 From: msegalis@REDACTED (Morgan Segalis) Date: Tue, 10 Apr 2012 19:16:54 +0200 Subject: [erlang-questions] Erlang accepting SSL connection is really slow (comparing to C++) In-Reply-To: References: <4F845845.5030805@ninenines.eu> <0E123757-6D98-4496-B190-61C4008CA594@gmail.com> Message-ID: <6DAF988C-E7DD-4E7B-AA9C-1BE354A14139@gmail.com> Hi Ali, It is indeed. Cipher : DHE-RSA-AES256-SHA What would be the fastest Cipher, knowing that I don't really care about 128 or 256 encoding. And How can I change the Cipher on the SSL options ? Le 10 avr. 2012 ? 18:50, Ali Sabil a ?crit : > Hi Morgan, > > Did you check which cipher is being used in your c++ server vs the > erlang server? DHE ciphers are notably slow. > > You can check which cipher suite is being used with: > openssl s_client -host HOST -port PORT > > On Tue, Apr 10, 2012 at 6:19 PM, Morgan Segalis wrote: >> Hi Lo?c, >> >> That's what I was afraid of. >> >> Then what would be the best workaround in order to outcome this slowness of Erlang's SSL ? >> Using a C++ Driver ? would that be even possible to pass a Socket to the driver for it to upgrade it into a SSL one ? >> >> Thanks. >> >> Le 10 avr. 2012 ? 17:56, Lo?c Hoguin a ?crit : >> >>> Hello! >>> >>> On 04/10/2012 05:27 PM, SEGALIS Morgan wrote: >>> [...] >>>> While it will take 10 second to a ssl accepting bit of C++ code to accept >>>> all of them (which don't even have multiple accept pending), in Erlang this >>>> is quite different. It will accept at most 20 connections a second >>>> (according to netstat info, whilst C++ accept more like 1K connection per >>>> seconds) >>>> >>>> While the 10K connections are awaiting for acceptance, I'm manually trying >>>> to connect as well. >>>> >>>> openssl s_client -ssl3 -ign_eof -connect myserver.com:4242 >>>> >>>> 3 cases happen when I do : >>>> >>>> - Connection simply timeout >>>> - Connection will connect after waiting for it 30 sec. at least >>>> - Connection will occur almost directly >>> >>> The OTP SSL code is just very slow, and AFAIK the reason for this is that it's done in full Erlang. Here's a quick and dirty comparison between HTTP and HTTPS in Cowboy, where only the transport used differs: >>> >>> HTTP: >>> >>> % siege -b -c 100 http://localhost:8080/ >>> ** SIEGE 2.70 >>> ** Preparing 100 concurrent users for battle. >>> The server is now under siege...^C >>> Lifting the server siege... done. >>> Transactions: 49266 hits >>> Availability: 100.00 % >>> Elapsed time: 5.94 secs >>> Data transferred: 0.56 MB >>> Response time: 0.01 secs >>> Transaction rate: 8293.94 trans/sec >>> Throughput: 0.09 MB/sec >>> Concurrency: 99.36 >>> Successful transactions: 49266 >>> Failed transactions: 0 >>> Longest transaction: 0.06 >>> Shortest transaction: 0.00 >>> >>> HTTPS: >>> >>> % siege -b -c 100 https://localhost:8443/ >>> ** SIEGE 2.70 >>> ** Preparing 100 concurrent users for battle. >>> The server is now under siege...^C >>> Lifting the server siege... done. >>> Transactions: 698 hits >>> Availability: 100.00 % >>> Elapsed time: 4.50 secs >>> Data transferred: 0.01 MB >>> Response time: 0.59 secs >>> Transaction rate: 155.11 trans/sec >>> Throughput: 0.00 MB/sec >>> Concurrency: 92.15 >>> Successful transactions: 698 >>> Failed transactions: 0 >>> Longest transaction: 1.14 >>> Shortest transaction: 0.07 >>> >>> This is on a Zenbook UX31E which is a damn good machine but it still shows a huge difference between both of them. And the more you try to accept at the same time, the longest time it can take to accept. >>> >>> -- >>> Lo?c Hoguin >>> Erlang Cowboy >>> Nine Nines >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions From smith.winston.101@REDACTED Tue Apr 10 19:32:44 2012 From: smith.winston.101@REDACTED (Winston Smith) Date: Tue, 10 Apr 2012 13:32:44 -0400 Subject: [erlang-questions] Erlang accepting SSL connection is really slow (comparing to C++) In-Reply-To: <0E123757-6D98-4496-B190-61C4008CA594@gmail.com> References: <4F845845.5030805@ninenines.eu> <0E123757-6D98-4496-B190-61C4008CA594@gmail.com> Message-ID: On Tue, Apr 10, 2012 at 12:19 PM, Morgan Segalis wrote: > Then what would be the best workaround in order to outcome this slowness of Erlang's SSL ? > Using a C++ Driver ? would that be even possible to pass a Socket to the driver for it to upgrade it into a SSL one ? You might want to take a look at Richard Jones' excellent articles about scaling Erlang up to 1 million [comet] users with mochiweb -- in the 3rd part he develops a C-node using libevent: http://www.metabrew.com/article/a-million-user-comet-application-with-mochiweb-part-3#an_erlang_cnode_using_libevent Although you'd need to use libevent2 to get the https support. Hope this helps, W. From msegalis@REDACTED Tue Apr 10 19:38:25 2012 From: msegalis@REDACTED (Morgan Segalis) Date: Tue, 10 Apr 2012 19:38:25 +0200 Subject: [erlang-questions] Erlang accepting SSL connection is really slow (comparing to C++) In-Reply-To: References: <4F845845.5030805@ninenines.eu> <0E123757-6D98-4496-B190-61C4008CA594@gmail.com> Message-ID: Actually I have read a while back this excellent article (I still have it in my favorite bookmark)? The thing is I wasn't coding in Erlang when I first read it. I'll take a second round, now that I do. Thanks. Le 10 avr. 2012 ? 19:32, Winston Smith a ?crit : > On Tue, Apr 10, 2012 at 12:19 PM, Morgan Segalis wrote: >> Then what would be the best workaround in order to outcome this slowness of Erlang's SSL ? >> Using a C++ Driver ? would that be even possible to pass a Socket to the driver for it to upgrade it into a SSL one ? > > You might want to take a look at Richard Jones' excellent articles > about scaling Erlang up to 1 million [comet] users with mochiweb -- in > the 3rd part he develops a C-node using libevent: > > http://www.metabrew.com/article/a-million-user-comet-application-with-mochiweb-part-3#an_erlang_cnode_using_libevent > > Although you'd need to use libevent2 to get the https support. > > Hope this helps, > > > W. From comptekki@REDACTED Tue Apr 10 19:54:53 2012 From: comptekki@REDACTED (Wes James) Date: Tue, 10 Apr 2012 11:54:53 -0600 Subject: [erlang-questions] replace question Message-ID: I have the following code: f(). S = <<"! *`-=[];',./~@#$%^&()_+{}|:\"<>?\\">>. RE = ["&","\\("]. io:format("~n~s~n",[RE]). R="00&(00". io:format("~n~s~n",[R]). S2=re:replace(S, RE, R, [{return,list}, global, caseless]). io:format("~n~s~n",[S2]). produces "00&((00" instead of "00&(00" inside the string returned. f(). S = <<"! *`-=[];',./~@#$%^&()_+{}|:\"<>?\\">>. RE = ["\\^","&"]. io:format("~n~s~n",[RE]). R="00^&00". io:format("~n~s~n",[R]). S2=re:replace(S, RE, R, [{return,list}, global, caseless]). io:format("~n~s~n",[S2]). produces "00^^&00", instead of "00^&00" in the string returned. Can someone explain what I'm not escaping properly for this? Thanks, -wes From ingela@REDACTED Tue Apr 10 20:04:59 2012 From: ingela@REDACTED (Ingela Andin) Date: Tue, 10 Apr 2012 20:04:59 +0200 Subject: [erlang-questions] Erlang accepting SSL connection is really slow (comparing to C++) In-Reply-To: References: Message-ID: Hi! > After looking around on other SSL server created in erlang, it seems that > they use some kind of driver for SSL/TLS connection, my examples are > RabbitMQ and EjabberD. > Nowhere there is ssl:ssl_accept in their Erlang code, I haven't investigate > a lot, but it seems they have created their own driver in order to upgrade > the TCP Socket to a SSL/TLS one. > Is that because there is an issue with Erlang's module SSL ? Does anyone > know why they are using custom driver for SSL/TLS ? I am pretty sure this is because the old ssl-implementation did not support SSL/TLS upgrade. Regards Ingela Erlang/OTP team Ericsson AB From msegalis@REDACTED Tue Apr 10 20:14:03 2012 From: msegalis@REDACTED (Morgan Segalis) Date: Tue, 10 Apr 2012 20:14:03 +0200 Subject: [erlang-questions] Erlang accepting SSL connection is really slow (comparing to C++) In-Reply-To: References: Message-ID: Hi Ingela ! Le 10 avr. 2012 ? 20:04, Ingela Andin a ?crit : > Hi! > >> After looking around on other SSL server created in erlang, it seems that >> they use some kind of driver for SSL/TLS connection, my examples are >> RabbitMQ and EjabberD. >> Nowhere there is ssl:ssl_accept in their Erlang code, I haven't investigate >> a lot, but it seems they have created their own driver in order to upgrade >> the TCP Socket to a SSL/TLS one. >> Is that because there is an issue with Erlang's module SSL ? Does anyone >> know why they are using custom driver for SSL/TLS ? > > I am pretty sure this is because the old ssl-implementation did not > support SSL/TLS upgrade. > > Regards Ingela Erlang/OTP team Ericsson AB Thank you for answering, I guess you are right, I have not thought about old implementation. However it seems that using C for SSL is faster, don't you think, or maybe the issue is coming from something else. -- Morgan From noiddicle@REDACTED Tue Apr 10 20:37:31 2012 From: noiddicle@REDACTED (Red Davies) Date: Tue, 10 Apr 2012 14:37:31 -0400 Subject: [erlang-questions] Erlang accepting SSL connection is really slow (comparing to C++) In-Reply-To: References: <4F845845.5030805@ninenines.eu> <0E123757-6D98-4496-B190-61C4008CA594@gmail.com> Message-ID: Greetings! On Tue, Apr 10, 2012 at 12:50 PM, Ali Sabil wrote: > Hi Morgan, > > Did you check which cipher is being used in your c++ server vs the > erlang server? DHE ciphers are notably slow. > > You can check which cipher suite is being used with: > openssl s_client -host HOST -port PORT > Actually - this isn't completely true. What the above command gives you is the specific cipher that openssl and your server negotiated FOR THAT SESSION. Both clients and servers typically support multiple ciphers and versions. During the SSL setup the two parties negotiate to find the most secure algorithm that they both support. There is every chance that openssl and your benchmarking software are utilising two different algorithms. To identify which algorithms are supported you need to use a tool such as THCSSLCheck: http://www.thc.org/root/tools/THCSSLCheck.zip Example output: red@REDACTED:~/Downloads/thc$ wine THCSSLCheck.exe www.erlang.org 443 ------------------------------------------------------------------------ THCSSLCheck v0.1 - coding johnny cyberpunk (www.thc.org) 2004 ------------------------------------------------------------------------ [*] testing if port is up. pleaze wait... [*] port is up ! [*] testing if service speaks SSL ... [*] service speaks SSL ! [*] now testing SSLv2 ---------------------------------------------------------------------- DES-CBC3-MD5 - 168 Bits - unsupported IDEA-CBC-MD5 - 128 Bits - unsupported RC2-CBC-MD5 - 128 Bits - unsupported RC4-MD5 - 128 Bits - unsupported RC4-64-MD5 - 64 Bits - unsupported DES-CBC-MD5 - 56 Bits - unsupported EXP-RC2-CBC-MD5 - 40 Bits - unsupported EXP-RC4-MD5 - 40 Bits - unsupported [*] now testing SSLv3 ---------------------------------------------------------------------- DHE-RSA-AES256-SHA - 256 Bits - supported DHE-DSS-AES256-SHA - 256 Bits - unsupported AES256-SHA - 256 Bits - supported EDH-RSA-DES-CBC3-SHA - 168 Bits - supported EDH-DSS-DES-CBC3-SHA - 168 Bits - unsupported DES-CBC3-SHA - 168 Bits - supported DHE-RSA-AES128-SHA - 128 Bits - supported DHE-DSS-AES128-SHA - 128 Bits - unsupported AES128-SHA - 128 Bits - supported IDEA-CBC-SHA - 128 Bits - unsupported DHE-DSS-RC4-SHA - 128 Bits - unsupported RC4-SHA - 128 Bits - supported RC4-MD5 - 128 Bits - supported EXP1024-DHE-DSS-DES-CBC-SHA - 56 Bits - unsupported EXP1024-DES-CBC-SHA - 56 Bits - unsupported EXP1024-RC2-CBC-MD5 - 56 Bits - unsupported EDH-RSA-DES-CBC-SHA - 56 Bits - supported EDH-DSS-DES-CBC-SHA - 56 Bits - unsupported DES-CBC-SHA - 56 Bits - supported EXP1024-DHE-DSS-RC4-SHA - 56 Bits - unsupported EXP1024-RC4-SHA - 56 Bits - unsupported EXP1024-RC4-MD5 - 56 Bits - unsupported EXP-EDH-RSA-DES-CBC-SHA - 40 Bits - unsupported EXP-EDH-DSS-DES-CBC-SHA - 40 Bits - unsupported EXP-DES-CBC-SHA - 40 Bits - unsupported EXP-RC2-CBC-MD5 - 40 Bits - unsupported EXP-RC4-MD5 - 40 Bits - unsupported [*] now testing TLSv1 ---------------------------------------------------------------------- DHE-RSA-AES256-SHA - 256 Bits - supported DHE-DSS-AES256-SHA - 256 Bits - unsupported AES256-SHA - 256 Bits - supported EDH-RSA-DES-CBC3-SHA - 168 Bits - supported EDH-DSS-DES-CBC3-SHA - 168 Bits - unsupported DES-CBC3-SHA - 168 Bits - supported DHE-RSA-AES128-SHA - 128 Bits - supported DHE-DSS-AES128-SHA - 128 Bits - unsupported AES128-SHA - 128 Bits - supported IDEA-CBC-SHA - 128 Bits - unsupported DHE-DSS-RC4-SHA - 128 Bits - unsupported RC4-SHA - 128 Bits - supported RC4-MD5 - 128 Bits - supported EXP1024-DHE-DSS-DES-CBC-SHA - 56 Bits - unsupported EXP1024-DES-CBC-SHA - 56 Bits - unsupported EXP1024-RC2-CBC-MD5 - 56 Bits - unsupported EDH-RSA-DES-CBC-SHA - 56 Bits - supported EDH-DSS-DES-CBC-SHA - 56 Bits - unsupported DES-CBC-SHA - 56 Bits - supported EXP1024-DHE-DSS-RC4-SHA - 56 Bits - unsupported EXP1024-RC4-SHA - 56 Bits - unsupported EXP1024-RC4-MD5 - 56 Bits - unsupported EXP-EDH-RSA-DES-CBC-SHA - 40 Bits - unsupported EXP-EDH-DSS-DES-CBC-SHA - 40 Bits - unsupported EXP-DES-CBC-SHA - 40 Bits - unsupported EXP-RC2-CBC-MD5 - 40 Bits - unsupported EXP-RC4-MD5 - 40 Bits - unsupported Kind Regards, Red -------------- next part -------------- An HTML attachment was scrubbed... URL: From aschultz@REDACTED Tue Apr 10 20:55:23 2012 From: aschultz@REDACTED (Andreas Schultz) Date: Tue, 10 Apr 2012 20:55:23 +0200 (CEST) Subject: [erlang-questions] Erlang accepting SSL connection is really slow (comparing to C++) In-Reply-To: <6DAF988C-E7DD-4E7B-AA9C-1BE354A14139@gmail.com> Message-ID: <1393208133.1225976.1334084123121.JavaMail.root@office> Hi, ----- Original Message ----- > Hi Ali, > > It is indeed. > Cipher : DHE-RSA-AES256-SHA > > What would be the fastest Cipher, knowing that I don't really care > about 128 or 256 encoding. The cipher might be the fastest, but DHE = Ephermal-Diffi-Hellman key exchange, that is about the slowest way to establish an SSL session. Remember, ssl_accept does the full SSL handshake. C (OpenSSL) based implementation might delay the full handshake until you do something else with the connection. >From the OpenSSL ssl_accept man page: > If the underlying BIO is blocking, SSL_accept() will only return once the handshake has been finished or an error occurred, except for SGC (Server Gated Cryptography). For > SGC, SSL_accept() may return with -1, but SSL_get_error() will yield SSL_ERROR_WANT_READ/WRITE and SSL_accept() should be called again. If I remember correctly, Erlang might generate DH primes even when you are not using a DH suite and be therefore not faster, but that could be changed. The only drawback is, that with a non-DH cipher suite a recorded encrypted session can be decrypted when an attacker gets access to the servers private key, with DH suites that is not possible. Andreas > > And How can I change the Cipher on the SSL options ? > > Le 10 avr. 2012 ? 18:50, Ali Sabil a ?crit : > > > Hi Morgan, > > > > Did you check which cipher is being used in your c++ server vs the > > erlang server? DHE ciphers are notably slow. > > > > You can check which cipher suite is being used with: > > openssl s_client -host HOST -port PORT > > > > On Tue, Apr 10, 2012 at 6:19 PM, Morgan Segalis > > wrote: > >> Hi Lo?c, > >> > >> That's what I was afraid of. > >> > >> Then what would be the best workaround in order to outcome this > >> slowness of Erlang's SSL ? > >> Using a C++ Driver ? would that be even possible to pass a Socket > >> to the driver for it to upgrade it into a SSL one ? > >> > >> Thanks. > >> > >> Le 10 avr. 2012 ? 17:56, Lo?c Hoguin a ?crit : > >> > >>> Hello! > >>> > >>> On 04/10/2012 05:27 PM, SEGALIS Morgan wrote: > >>> [...] > >>>> While it will take 10 second to a ssl accepting bit of C++ code > >>>> to accept > >>>> all of them (which don't even have multiple accept pending), in > >>>> Erlang this > >>>> is quite different. It will accept at most 20 connections a > >>>> second > >>>> (according to netstat info, whilst C++ accept more like 1K > >>>> connection per > >>>> seconds) > >>>> > >>>> While the 10K connections are awaiting for acceptance, I'm > >>>> manually trying > >>>> to connect as well. > >>>> > >>>> openssl s_client -ssl3 -ign_eof -connect myserver.com:4242 > >>>> > >>>> 3 cases happen when I do : > >>>> > >>>> - Connection simply timeout > >>>> - Connection will connect after waiting for it 30 sec. at least > >>>> - Connection will occur almost directly > >>> > >>> The OTP SSL code is just very slow, and AFAIK the reason for this > >>> is that it's done in full Erlang. Here's a quick and dirty > >>> comparison between HTTP and HTTPS in Cowboy, where only the > >>> transport used differs: > >>> > >>> HTTP: > >>> > >>> % siege -b -c 100 http://localhost:8080/ > >>> ** SIEGE 2.70 > >>> ** Preparing 100 concurrent users for battle. > >>> The server is now under siege...^C > >>> Lifting the server siege... done. > >>> Transactions: 49266 hits > >>> Availability: 100.00 % > >>> Elapsed time: 5.94 secs > >>> Data transferred: 0.56 MB > >>> Response time: 0.01 secs > >>> Transaction rate: 8293.94 trans/sec > >>> Throughput: 0.09 MB/sec > >>> Concurrency: 99.36 > >>> Successful transactions: 49266 > >>> Failed transactions: 0 > >>> Longest transaction: 0.06 > >>> Shortest transaction: 0.00 > >>> > >>> HTTPS: > >>> > >>> % siege -b -c 100 https://localhost:8443/ > >>> ** SIEGE 2.70 > >>> ** Preparing 100 concurrent users for battle. > >>> The server is now under siege...^C > >>> Lifting the server siege... done. > >>> Transactions: 698 hits > >>> Availability: 100.00 % > >>> Elapsed time: 4.50 secs > >>> Data transferred: 0.01 MB > >>> Response time: 0.59 secs > >>> Transaction rate: 155.11 trans/sec > >>> Throughput: 0.00 MB/sec > >>> Concurrency: 92.15 > >>> Successful transactions: 698 > >>> Failed transactions: 0 > >>> Longest transaction: 1.14 > >>> Shortest transaction: 0.07 > >>> > >>> This is on a Zenbook UX31E which is a damn good machine but it > >>> still shows a huge difference between both of them. And the more > >>> you try to accept at the same time, the longest time it can take > >>> to accept. > >>> > >>> -- > >>> Lo?c Hoguin > >>> Erlang Cowboy > >>> Nine Nines > >> > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- -- Dipl. Inform. Andreas Schultz email: as@REDACTED phone: +49-391-819099-224 mobil: +49-170-2226073 ------------------ managed broadband access ------------------ Travelping GmbH phone: +49-391-8190990 Roentgenstr. 13 fax: +49-391-819099299 D-39108 Magdeburg email: info@REDACTED GERMANY web: http://www.travelping.com Company Registration: HRB21276 Handelsregistergericht Chemnitz Geschaeftsfuehrer: Holger Winkelmann | VAT ID No.: DE236673780 -------------------------------------------------------------- From ingela@REDACTED Tue Apr 10 21:11:22 2012 From: ingela@REDACTED (Ingela Andin) Date: Tue, 10 Apr 2012 21:11:22 +0200 Subject: [erlang-questions] Erlang accepting SSL connection is really slow (comparing to C++) In-Reply-To: References: Message-ID: Hi! 2012/4/10 Morgan Segalis : > Hi Ingela ! > > Le 10 avr. 2012 ? 20:04, Ingela Andin a ?crit : > >> Hi! >> >>> After looking around on other SSL server created in erlang, it seems that >>> they use some kind of driver for SSL/TLS connection, my examples are >>> RabbitMQ and EjabberD. >>> Nowhere there is ssl:ssl_accept in their Erlang code, I haven't investigate >>> a lot, but it seems they have created their own driver in order to upgrade >>> the TCP Socket to a SSL/TLS one. >>> Is that because there is an issue with Erlang's module SSL ? Does anyone >>> know why they are using custom driver for SSL/TLS ? >> >> I am pretty sure this is because the old ssl-implementation did not >> support SSL/TLS upgrade. >> >> Regards Ingela Erlang/OTP team Ericsson AB > > > Thank you for answering, I guess you are right, I have not thought about old implementation. > However it seems that using C for SSL is faster, don't you think, or maybe the issue is coming from something else. > I want to know that we are not comparing apples to pears before I answer that question, so that is why I avoided that part of the question for now! Regards Ingela Erlang/OTP team - Ericsson AB From ali.sabil@REDACTED Tue Apr 10 21:35:44 2012 From: ali.sabil@REDACTED (Ali Sabil) Date: Tue, 10 Apr 2012 21:35:44 +0200 Subject: [erlang-questions] Erlang accepting SSL connection is really slow (comparing to C++) In-Reply-To: <6DAF988C-E7DD-4E7B-AA9C-1BE354A14139@gmail.com> References: <4F845845.5030805@ninenines.eu> <0E123757-6D98-4496-B190-61C4008CA594@gmail.com> <6DAF988C-E7DD-4E7B-AA9C-1BE354A14139@gmail.com> Message-ID: Hi Morgan, In order to change the cipher, you can pass the {ciphers, Ciphers} option to ssl:listen/2. The valid options for Ciphers can be retrieved using ssl:cipher_suites/0. On Tue, Apr 10, 2012 at 7:16 PM, Morgan Segalis wrote: > Hi Ali, > > It is indeed. > Cipher ? ?: DHE-RSA-AES256-SHA > > What would be the fastest Cipher, knowing that I don't really care about 128 or 256 encoding. > And How can I change the Cipher on the SSL options ? > > Le 10 avr. 2012 ? 18:50, Ali Sabil a ?crit : > >> Hi Morgan, >> >> Did you check which cipher is being used in your c++ server vs the >> erlang server? DHE ciphers are notably slow. >> >> You can check which cipher suite is being used with: >> ? ?openssl s_client -host HOST -port PORT >> >> On Tue, Apr 10, 2012 at 6:19 PM, Morgan Segalis wrote: >>> Hi Lo?c, >>> >>> That's what I was afraid of. >>> >>> Then what would be the best workaround in order to outcome this slowness of Erlang's SSL ? >>> Using a C++ Driver ? would that be even possible to pass a Socket to the driver for it to upgrade it into a SSL one ? >>> >>> Thanks. >>> >>> Le 10 avr. 2012 ? 17:56, Lo?c Hoguin a ?crit : >>> >>>> Hello! >>>> >>>> On 04/10/2012 05:27 PM, SEGALIS Morgan wrote: >>>> [...] >>>>> While it will take 10 second to a ssl accepting bit of C++ code to accept >>>>> all of them (which don't even have multiple accept pending), in Erlang this >>>>> is quite different. It will accept at most 20 connections a second >>>>> (according to netstat info, whilst C++ accept more like 1K connection per >>>>> seconds) >>>>> >>>>> While the 10K connections are awaiting for acceptance, I'm manually trying >>>>> to connect as well. >>>>> >>>>> ? ? openssl s_client -ssl3 -ign_eof -connect myserver.com:4242 >>>>> >>>>> 3 cases happen when I do : >>>>> >>>>> ?- Connection simply timeout >>>>> ?- Connection will connect after waiting for it 30 sec. at least >>>>> ?- Connection will occur almost directly >>>> >>>> The OTP SSL code is just very slow, and AFAIK the reason for this is that it's done in full Erlang. Here's a quick and dirty comparison between HTTP and HTTPS in Cowboy, where only the transport used differs: >>>> >>>> HTTP: >>>> >>>> % siege -b -c 100 http://localhost:8080/ >>>> ** SIEGE 2.70 >>>> ** Preparing 100 concurrent users for battle. >>>> The server is now under siege...^C >>>> Lifting the server siege... ? ? ?done. >>>> Transactions: ? ? ? ? ? ? ? ?49266 hits >>>> Availability: ? ? ? ? ? ? ? 100.00 % >>>> Elapsed time: ? ? ? ? ? ? ? ? 5.94 secs >>>> Data transferred: ? ? ? ? ? ? 0.56 MB >>>> Response time: ? ? ? ? ? ? ? ? ? ? ? ?0.01 secs >>>> Transaction rate: ? ? ? ? ?8293.94 trans/sec >>>> Throughput: ? ? ? ? ? ? ? ? ? 0.09 MB/sec >>>> Concurrency: ? ? ? ? ? ? ? ? 99.36 >>>> Successful transactions: ? ? ? 49266 >>>> Failed transactions: ? ? ? ? ? ? 0 >>>> Longest transaction: ? ? ? ? ?0.06 >>>> Shortest transaction: ? ? ? ? 0.00 >>>> >>>> HTTPS: >>>> >>>> % siege -b -c 100 https://localhost:8443/ >>>> ** SIEGE 2.70 >>>> ** Preparing 100 concurrent users for battle. >>>> The server is now under siege...^C >>>> Lifting the server siege... ? ? ?done. >>>> Transactions: ? ? ? ? ? ? ? ? ?698 hits >>>> Availability: ? ? ? ? ? ? ? 100.00 % >>>> Elapsed time: ? ? ? ? ? ? ? ? 4.50 secs >>>> Data transferred: ? ? ? ? ? ? 0.01 MB >>>> Response time: ? ? ? ? ? ? ? ? ? ? ? ?0.59 secs >>>> Transaction rate: ? ? ? ? ? 155.11 trans/sec >>>> Throughput: ? ? ? ? ? ? ? ? ? 0.00 MB/sec >>>> Concurrency: ? ? ? ? ? ? ? ? 92.15 >>>> Successful transactions: ? ? ? ? 698 >>>> Failed transactions: ? ? ? ? ? ? 0 >>>> Longest transaction: ? ? ? ? ?1.14 >>>> Shortest transaction: ? ? ? ? 0.07 >>>> >>>> This is on a Zenbook UX31E which is a damn good machine but it still shows a huge difference between both of them. And the more you try to accept at the same time, the longest time it can take to accept. >>>> >>>> -- >>>> Lo?c Hoguin >>>> Erlang Cowboy >>>> Nine Nines >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions > From straightflush@REDACTED Tue Apr 10 21:37:52 2012 From: straightflush@REDACTED (AD) Date: Tue, 10 Apr 2012 15:37:52 -0400 Subject: [erlang-questions] broadcast message to all gen_server Message-ID: Hey All, I have a situation where i am trying to handle a case where I am using sockjs and need to send a message to each sockjs session_server (which is a gen_server). I am using gproc() but I cant simply do a gproc_send() b/c the message ends up in handle_info() instead of properly in handle_call(). I have managed to work this out, when receiving a message from rabbitmq i do a gproc:lookup_pids() and then loop through each pid and do a gen_server:call(PID,Message). The issue is this is a linear process, is there a way to handle sending gen_server:call() to all the processes concurrently ? One way i thought of doing this is having a lightweight set of "listener" processes each mapped to a socjks session process and then use gproc() to broadcast to the lightweight process which would in turn send a gen_server:call(). Any thoughts? Thanks -AD -------------- next part -------------- An HTML attachment was scrubbed... URL: From ali.sabil@REDACTED Tue Apr 10 21:40:33 2012 From: ali.sabil@REDACTED (Ali Sabil) Date: Tue, 10 Apr 2012 21:40:33 +0200 Subject: [erlang-questions] Erlang accepting SSL connection is really slow (comparing to C++) In-Reply-To: References: <4F845845.5030805@ninenines.eu> <0E123757-6D98-4496-B190-61C4008CA594@gmail.com> Message-ID: Hi Red, You are absolutely right, what I meant to say is that during the negociation the best cipher/key exchange mechanism is generally chosen, which is great for security, but sometimes not so great for performance :) On Tue, Apr 10, 2012 at 8:37 PM, Red Davies wrote: > Greetings! > > On Tue, Apr 10, 2012 at 12:50 PM, Ali Sabil wrote: >> >> Hi Morgan, >> >> Did you check which cipher is being used in your c++ server vs the >> erlang server? DHE ciphers are notably slow. >> >> You can check which cipher suite is being used with: >> ? ?openssl s_client -host HOST -port PORT > > > Actually - this isn't completely true.? What the above command gives you is > the specific cipher that openssl and your server negotiated FOR THAT > SESSION.? Both clients and servers typically support multiple ciphers and > versions.? During the SSL setup the two parties negotiate to find the most > secure algorithm that they both support. > > There is every chance that openssl and your benchmarking software are > utilising two different algorithms. > > To identify which algorithms are supported you need to use a tool such as > THCSSLCheck: http://www.thc.org/root/tools/THCSSLCheck.zip > > Example output: > > red@REDACTED:~/Downloads/thc$ wine THCSSLCheck.exe www.erlang.org 443 > > > ------------------------------------------------------------------------ > THCSSLCheck v0.1 - coding johnny cyberpunk (www.thc.org) 2004 > ------------------------------------------------------------------------ > > [*] testing if port is up. pleaze wait... > [*] port is up ! > [*] testing if service speaks SSL ... > [*] service speaks SSL ! > > > [*] now testing SSLv2 > ---------------------------------------------------------------------- > ????????????????? DES-CBC3-MD5 - 168 Bits - unsupported > ????????????????? IDEA-CBC-MD5 - 128 Bits - unsupported > ?????????????????? RC2-CBC-MD5 - 128 Bits - unsupported > ?????????????????????? RC4-MD5 - 128 Bits - unsupported > ??????????????????? RC4-64-MD5 -? 64 Bits - unsupported > ?????????????????? DES-CBC-MD5 -? 56 Bits - unsupported > ?????????????? EXP-RC2-CBC-MD5 -? 40 Bits - unsupported > ?????????????????? EXP-RC4-MD5 -? 40 Bits - unsupported > > > [*] now testing SSLv3 > ---------------------------------------------------------------------- > ??????????? DHE-RSA-AES256-SHA - 256 Bits -?? supported > ??????????? DHE-DSS-AES256-SHA - 256 Bits - unsupported > ??????????????????? AES256-SHA - 256 Bits -?? supported > ????????? EDH-RSA-DES-CBC3-SHA - 168 Bits -?? supported > ????????? EDH-DSS-DES-CBC3-SHA - 168 Bits - unsupported > ????????????????? DES-CBC3-SHA - 168 Bits -?? supported > ??????????? DHE-RSA-AES128-SHA - 128 Bits -?? supported > ??????????? DHE-DSS-AES128-SHA - 128 Bits - unsupported > ??????????????????? AES128-SHA - 128 Bits -?? supported > ????????????????? IDEA-CBC-SHA - 128 Bits - unsupported > ?????????????? DHE-DSS-RC4-SHA - 128 Bits - unsupported > ?????????????????????? RC4-SHA - 128 Bits -?? supported > ?????????????????????? RC4-MD5 - 128 Bits -?? supported > ?? EXP1024-DHE-DSS-DES-CBC-SHA -? 56 Bits - unsupported > ?????????? EXP1024-DES-CBC-SHA -? 56 Bits - unsupported > ?????????? EXP1024-RC2-CBC-MD5 -? 56 Bits - unsupported > ?????????? EDH-RSA-DES-CBC-SHA -? 56 Bits -?? supported > ?????????? EDH-DSS-DES-CBC-SHA -? 56 Bits - unsupported > ?????????????????? DES-CBC-SHA -? 56 Bits -?? supported > ?????? EXP1024-DHE-DSS-RC4-SHA -? 56 Bits - unsupported > ?????????????? EXP1024-RC4-SHA -? 56 Bits - unsupported > ?????????????? EXP1024-RC4-MD5 -? 56 Bits - unsupported > ?????? EXP-EDH-RSA-DES-CBC-SHA -? 40 Bits - unsupported > ?????? EXP-EDH-DSS-DES-CBC-SHA -? 40 Bits - unsupported > ?????????????? EXP-DES-CBC-SHA -? 40 Bits - unsupported > ?????????????? EXP-RC2-CBC-MD5 -? 40 Bits - unsupported > ?????????????????? EXP-RC4-MD5 -? 40 Bits - unsupported > > > [*] now testing TLSv1 > ---------------------------------------------------------------------- > ??????????? DHE-RSA-AES256-SHA - 256 Bits -?? supported > ??????????? DHE-DSS-AES256-SHA - 256 Bits - unsupported > ??????????????????? AES256-SHA - 256 Bits -?? supported > ????????? EDH-RSA-DES-CBC3-SHA - 168 Bits -?? supported > ????????? EDH-DSS-DES-CBC3-SHA - 168 Bits - unsupported > ????????????????? DES-CBC3-SHA - 168 Bits -?? supported > ??????????? DHE-RSA-AES128-SHA - 128 Bits -?? supported > ??????????? DHE-DSS-AES128-SHA - 128 Bits - unsupported > ??????????????????? AES128-SHA - 128 Bits -?? supported > ????????????????? IDEA-CBC-SHA - 128 Bits - unsupported > ?????????????? DHE-DSS-RC4-SHA - 128 Bits - unsupported > ?????????????????????? RC4-SHA - 128 Bits -?? supported > ?????????????????????? RC4-MD5 - 128 Bits -?? supported > ?? EXP1024-DHE-DSS-DES-CBC-SHA -? 56 Bits - unsupported > ?????????? EXP1024-DES-CBC-SHA -? 56 Bits - unsupported > ?????????? EXP1024-RC2-CBC-MD5 -? 56 Bits - unsupported > ?????????? EDH-RSA-DES-CBC-SHA -? 56 Bits -?? supported > ?????????? EDH-DSS-DES-CBC-SHA -? 56 Bits - unsupported > ?????????????????? DES-CBC-SHA -? 56 Bits -?? supported > ?????? EXP1024-DHE-DSS-RC4-SHA -? 56 Bits - unsupported > ?????????????? EXP1024-RC4-SHA -? 56 Bits - unsupported > ?????????????? EXP1024-RC4-MD5 -? 56 Bits - unsupported > ?????? EXP-EDH-RSA-DES-CBC-SHA -? 40 Bits - unsupported > ?????? EXP-EDH-DSS-DES-CBC-SHA -? 40 Bits - unsupported > ?????????????? EXP-DES-CBC-SHA -? 40 Bits - unsupported > ?????????????? EXP-RC2-CBC-MD5 -? 40 Bits - unsupported > ?????????????????? EXP-RC4-MD5 -? 40 Bits - unsupported > > Kind Regards, > > > > Red > From msegalis@REDACTED Tue Apr 10 21:43:49 2012 From: msegalis@REDACTED (Morgan Segalis) Date: Tue, 10 Apr 2012 21:43:49 +0200 Subject: [erlang-questions] Erlang accepting SSL connection is really slow (comparing to C++) In-Reply-To: References: <4F845845.5030805@ninenines.eu> <0E123757-6D98-4496-B190-61C4008CA594@gmail.com> <6DAF988C-E7DD-4E7B-AA9C-1BE354A14139@gmail.com> Message-ID: <1C6217A6-FD89-4B97-9EC8-594384C9AABE@gmail.com> Hi Ali, I have tried almost all of them, giving only one ciphers possibility per test. It doesn't really change anything really? I was hoping for it :-( Le 10 avr. 2012 ? 21:35, Ali Sabil a ?crit : > Hi Morgan, > > In order to change the cipher, you can pass the {ciphers, Ciphers} > option to ssl:listen/2. The valid options for Ciphers can be retrieved > using ssl:cipher_suites/0. > > On Tue, Apr 10, 2012 at 7:16 PM, Morgan Segalis wrote: >> Hi Ali, >> >> It is indeed. >> Cipher : DHE-RSA-AES256-SHA >> >> What would be the fastest Cipher, knowing that I don't really care about 128 or 256 encoding. >> And How can I change the Cipher on the SSL options ? >> >> Le 10 avr. 2012 ? 18:50, Ali Sabil a ?crit : >> >>> Hi Morgan, >>> >>> Did you check which cipher is being used in your c++ server vs the >>> erlang server? DHE ciphers are notably slow. >>> >>> You can check which cipher suite is being used with: >>> openssl s_client -host HOST -port PORT >>> >>> On Tue, Apr 10, 2012 at 6:19 PM, Morgan Segalis wrote: >>>> Hi Lo?c, >>>> >>>> That's what I was afraid of. >>>> >>>> Then what would be the best workaround in order to outcome this slowness of Erlang's SSL ? >>>> Using a C++ Driver ? would that be even possible to pass a Socket to the driver for it to upgrade it into a SSL one ? >>>> >>>> Thanks. >>>> >>>> Le 10 avr. 2012 ? 17:56, Lo?c Hoguin a ?crit : >>>> >>>>> Hello! >>>>> >>>>> On 04/10/2012 05:27 PM, SEGALIS Morgan wrote: >>>>> [...] >>>>>> While it will take 10 second to a ssl accepting bit of C++ code to accept >>>>>> all of them (which don't even have multiple accept pending), in Erlang this >>>>>> is quite different. It will accept at most 20 connections a second >>>>>> (according to netstat info, whilst C++ accept more like 1K connection per >>>>>> seconds) >>>>>> >>>>>> While the 10K connections are awaiting for acceptance, I'm manually trying >>>>>> to connect as well. >>>>>> >>>>>> openssl s_client -ssl3 -ign_eof -connect myserver.com:4242 >>>>>> >>>>>> 3 cases happen when I do : >>>>>> >>>>>> - Connection simply timeout >>>>>> - Connection will connect after waiting for it 30 sec. at least >>>>>> - Connection will occur almost directly >>>>> >>>>> The OTP SSL code is just very slow, and AFAIK the reason for this is that it's done in full Erlang. Here's a quick and dirty comparison between HTTP and HTTPS in Cowboy, where only the transport used differs: >>>>> >>>>> HTTP: >>>>> >>>>> % siege -b -c 100 http://localhost:8080/ >>>>> ** SIEGE 2.70 >>>>> ** Preparing 100 concurrent users for battle. >>>>> The server is now under siege...^C >>>>> Lifting the server siege... done. >>>>> Transactions: 49266 hits >>>>> Availability: 100.00 % >>>>> Elapsed time: 5.94 secs >>>>> Data transferred: 0.56 MB >>>>> Response time: 0.01 secs >>>>> Transaction rate: 8293.94 trans/sec >>>>> Throughput: 0.09 MB/sec >>>>> Concurrency: 99.36 >>>>> Successful transactions: 49266 >>>>> Failed transactions: 0 >>>>> Longest transaction: 0.06 >>>>> Shortest transaction: 0.00 >>>>> >>>>> HTTPS: >>>>> >>>>> % siege -b -c 100 https://localhost:8443/ >>>>> ** SIEGE 2.70 >>>>> ** Preparing 100 concurrent users for battle. >>>>> The server is now under siege...^C >>>>> Lifting the server siege... done. >>>>> Transactions: 698 hits >>>>> Availability: 100.00 % >>>>> Elapsed time: 4.50 secs >>>>> Data transferred: 0.01 MB >>>>> Response time: 0.59 secs >>>>> Transaction rate: 155.11 trans/sec >>>>> Throughput: 0.00 MB/sec >>>>> Concurrency: 92.15 >>>>> Successful transactions: 698 >>>>> Failed transactions: 0 >>>>> Longest transaction: 1.14 >>>>> Shortest transaction: 0.07 >>>>> >>>>> This is on a Zenbook UX31E which is a damn good machine but it still shows a huge difference between both of them. And the more you try to accept at the same time, the longest time it can take to accept. >>>>> >>>>> -- >>>>> Lo?c Hoguin >>>>> Erlang Cowboy >>>>> Nine Nines >>>> >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-questions >> From comptekki@REDACTED Tue Apr 10 21:47:32 2012 From: comptekki@REDACTED (Wes James) Date: Tue, 10 Apr 2012 13:47:32 -0600 Subject: [erlang-questions] replace question In-Reply-To: References: Message-ID: I see in the documentation now that & has special meaning in erlang re:replace. I escaped that and now things are working properly. -wes On Tue, Apr 10, 2012 at 11:54 AM, Wes James wrote: > I have the following code: > > f(). > S = <<"! *`-=[];',./~@#$%^&()_+{}|:\"<>?\\">>. > RE = ["&","\\("]. > io:format("~n~s~n",[RE]). > R="00&(00". > io:format("~n~s~n",[R]). > S2=re:replace(S, RE, R, [{return,list}, global, caseless]). > io:format("~n~s~n",[S2]). > > produces "00&((00" instead of "00&(00" inside the string returned. > > f(). > S = <<"! *`-=[];',./~@#$%^&()_+{}|:\"<>?\\">>. > RE = ["\\^","&"]. > io:format("~n~s~n",[RE]). > R="00^&00". > io:format("~n~s~n",[R]). > S2=re:replace(S, RE, R, [{return,list}, global, caseless]). > io:format("~n~s~n",[S2]). > > produces "00^^&00", instead of "00^&00" in the string returned. > > Can someone explain what I'm not escaping properly for this? > > Thanks, > > -wes From hsvhome@REDACTED Tue Apr 10 21:51:52 2012 From: hsvhome@REDACTED (Sergey Shilov) Date: Tue, 10 Apr 2012 22:51:52 +0300 Subject: [erlang-questions] pattern matching with records in a function In-Reply-To: References: Message-ID: <1540683.aAvu7sBISG@barabashka.favorit> On 10 ?????? 2012 16:25:49 Pablo Vieytes wrote: > -record(inputmsg, {action, data1, ..., datan}). ... > and I needed data1...datan in action_x(). handle_cast(#inputmsg{}=Msg, State) -> [_,X|Data] = tuple_to_list(Msg), ... -- V.B.R Sergey Shilov. From sam@REDACTED Tue Apr 10 22:04:23 2012 From: sam@REDACTED (Samuel Elliott) Date: Tue, 10 Apr 2012 21:04:23 +0100 Subject: [erlang-questions] broadcast message to all gen_server In-Reply-To: References: Message-ID: Why can't you do it in handle_info ? That still has access to modify the state and do everything a :call does, except maybe reply, however if you're sending the message from somewhere else, you could just reply with normal erlang message passing. Another option is the following: write a function that calls a given gen_server with what you want it to, then go through your list of gen_servers using a list comprehension and spawn that function with the server to run. That said, this is also a fire-and-forget way of doing it, unless after you call the gen server, you send a message back to the spawning process to confirm it worked. Something like the following: call_servers(Servers, Message, Timeout) -> [spawn(?MODULE, call_server, [GServer, self() Message]) || GServer <- Servers ], wait_loop(Servers, Timeout). call_server(GServer, Master, Message) -> gen_server:call(GServer, Message), Master ! {done, GServer}. wait_loop(Servers, Timeout) -> receive {done, GServer} when lists:member(GServer, Server) -> Servers1 = lists:delete(GServer, Servers), case Servers1 of [] -> ok; _ -> wait_loop(Servers1, Timeout) end; after Timeout -> never_finished end. Note: Timeout is the maximum time to wait between gen_server:calls, not the maximum time to wait for them all. that would be more complex, but might be what you need. Sam On Tue, Apr 10, 2012 at 8:37 PM, AD wrote: > Hey All, > > ?I have a situation where i am trying to handle a case where I am using > sockjs and need to send a message to each sockjs session_server (which is a > gen_server). ?I am using gproc() but I cant simply do a gproc_send() b/c the > message ends up in handle_info() instead of properly in handle_call(). ?I > have managed to work this out, when receiving a message from rabbitmq i do a > gproc:lookup_pids() and then loop through each pid and do a > gen_server:call(PID,Message). ?The issue is this is a linear process, is > there a way to handle sending gen_server:call() to all the processes > concurrently ? > > ?One way i thought of doing this is having a lightweight set of "listener" > processes each mapped to a socjks session process and then use gproc() to > broadcast to the lightweight process which would in turn send a > gen_server:call(). > > Any thoughts? > > Thanks > -AD > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Samuel Elliott sam@REDACTED http://lenary.co.uk/ +44 (0)7891 993 664 From tilman.holschuh@REDACTED Tue Apr 10 22:18:43 2012 From: tilman.holschuh@REDACTED (Tilman Holschuh) Date: Tue, 10 Apr 2012 13:18:43 -0700 Subject: [erlang-questions] broadcast message to all gen_server In-Reply-To: References: Message-ID: <4F8495A3.6020005@gmail.com> On 12-04-10 12:37 PM, AD wrote: > I have a situation where i am trying to handle a case where I am using > sockjs and need to send a message to each sockjs session_server (which is a > gen_server). I am using gproc() but I cant simply do a gproc_send() b/c > the message ends up in handle_info() instead of properly in handle_call(). > I have managed to work this out, when receiving a message from rabbitmq i > do a gproc:lookup_pids() and then loop through each pid and do a > gen_server:call(PID,Message). The issue is this is a linear process, is > there a way to handle sending gen_server:call() to all the processes > concurrently ? Do you need a response from the gen_server:call? If not you could just use a cast instead. Something like: [gen_server:cast(Pid, Message) || Pid <- gproc:lookup_pids()] Cheers - Tilman From per@REDACTED Tue Apr 10 22:39:18 2012 From: per@REDACTED (Per Hedeland) Date: Tue, 10 Apr 2012 22:39:18 +0200 (CEST) Subject: [erlang-questions] Erlang accepting SSL connection is really slow (comparing to C++) In-Reply-To: Message-ID: <201204102039.q3AKdIbs006704@pluto.hedeland.org> SEGALIS Morgan wrote: > >While it will take 10 second to a ssl accepting bit of C++ code to accept >all of them (which don't even have multiple accept pending), in Erlang this >is quite different. It will accept at most 20 connections a second >(according to netstat info, whilst C++ accept more like 1K connection per >seconds) As has already been pointed out, a) the DH-based cipher suites make for a very slow (mainly due to high CPU usage) handshake, and b) you need to check the selected cipher in your benchmarking to determine if one of these is being used. If you don't see any difference when disabling them, have you verified that they aren't being used? (I.e. maybe you are doing a mistake when disabling...) I'd just like to point out that the current OTP ssl implementation may end up using one of the DH-based suites "by default", while typical C/C++ + OpenSSL implementations (including the "old" ssl_esock-based OTP implementation) will not, since it requires a bit of extra work to make OpenSSL use them. Another reason for the handshake slowness, if you are using a suite/certificate with RSA authentication (pretty much the norm), is that the RSA signing operation is some 3-4 times slower than it need be with the current OTP ssl implementation. I reported this in http://erlang.org/pipermail/erlang-questions/2012-March/064925.html and subsequently found the cause, which is that a number of private key parameters aren't used even though they are available - to quote the OpenSSL rsa(3) man page: p, q, dmp1, dmq1 and iqmp may be NULL in private keys, but the RSA operations are much faster when these values are available. - "much" is an understatement I think.:-) I've recently submitted an "informal" patch fixing this to the OTP group, Ingela may be able to comment (or not:-) on when it might make it into the release. If you're desperate I can provide the patch off-list, it's not overly complex. But this issue alone can definitely not explain the difference you are seeing. Finally I'll point out that while the SSL protocol implementation is indeed implemented in Erlang now, all the "heavy crypto work" is still done in OpenSSL's libcrypto, with a "thin" NIF interface in between. The net result is probably a bit slower than 100% C/C++, but it shouldn't (need to) be anywhere near what you report. (The good part is, of course, that the implementation can make use of the Erlang/beam concurrency support, instead of the hairy pthread stuff you need to use for OpenSSL's libssl.) --Per Hedeland From msegalis@REDACTED Tue Apr 10 23:21:45 2012 From: msegalis@REDACTED (Morgan Segalis) Date: Tue, 10 Apr 2012 23:21:45 +0200 Subject: [erlang-questions] Erlang accepting SSL connection is really slow (comparing to C++) In-Reply-To: <201204102039.q3AKdIbs006704@pluto.hedeland.org> References: <201204102039.q3AKdIbs006704@pluto.hedeland.org> Message-ID: <2F70A8C0-854A-4E98-A45B-9E07D86A1B32@gmail.com> Le 10 avr. 2012 ? 22:39, Per Hedeland a ?crit : > SEGALIS Morgan wrote: >> >> While it will take 10 second to a ssl accepting bit of C++ code to accept >> all of them (which don't even have multiple accept pending), in Erlang this >> is quite different. It will accept at most 20 connections a second >> (according to netstat info, whilst C++ accept more like 1K connection per >> seconds) > > As has already been pointed out, a) the DH-based cipher suites make for > a very slow (mainly due to high CPU usage) handshake, and b) you need to > check the selected cipher in your benchmarking to determine if one of > these is being used. If you don't see any difference when disabling > them, have you verified that they aren't being used? (I.e. maybe you are > doing a mistake when disabling...) > > I'd just like to point out that the current OTP ssl implementation may > end up using one of the DH-based suites "by default", while typical > C/C++ + OpenSSL implementations (including the "old" ssl_esock-based OTP > implementation) will not, since it requires a bit of extra work to make > OpenSSL use them. > > Another reason for the handshake slowness, if you are using a > suite/certificate with RSA authentication (pretty much the norm), is > that the RSA signing operation is some 3-4 times slower than it need be > with the current OTP ssl implementation. I reported this in > http://erlang.org/pipermail/erlang-questions/2012-March/064925.html and > subsequently found the cause, which is that a number of private key > parameters aren't used even though they are available - to quote the > OpenSSL rsa(3) man page: > > p, q, dmp1, dmq1 and iqmp may be NULL in private keys, but the RSA > operations are much faster when these values are available. > > - "much" is an understatement I think.:-) > > I've recently submitted an "informal" patch fixing this to the OTP > group, Ingela may be able to comment (or not:-) on when it might make it > into the release. If you're desperate I can provide the patch off-list, > it's not overly complex. But this issue alone can definitely not explain > the difference you are seeing. > > Finally I'll point out that while the SSL protocol implementation is > indeed implemented in Erlang now, all the "heavy crypto work" is still > done in OpenSSL's libcrypto, with a "thin" NIF interface in between. The > net result is probably a bit slower than 100% C/C++, but it shouldn't > (need to) be anywhere near what you report. (The good part is, of > course, that the implementation can make use of the Erlang/beam > concurrency support, instead of the hairy pthread stuff you need to use > for OpenSSL's libssl.) > > --Per Hedeland Hi Per, Thank you for have taking the time to write this clear answer. Actually I'm kinda desperate. I found very weird indeed that there is so much differences between Erlang and C++ But I really can't think about anything else, I'm having multiple acceptor at once, set the Erl shell running on 8 threads? Even changed the ciphers to almost every possible options. The fact is in C++ I launch a thread after each socket accepted, and does the handshake on the said thread. It seems that "Learn You some Erlang" implementation is the best for what I'm trying to do. If not please anyone tell me what should I change. What could limit so much the connection if it is not SSL, really ? From bourinov@REDACTED Tue Apr 10 23:35:45 2012 From: bourinov@REDACTED (Max Bourinov) Date: Wed, 11 Apr 2012 01:35:45 +0400 Subject: [erlang-questions] Erlang accepting SSL connection is really slow (comparing to C++) In-Reply-To: <2F70A8C0-854A-4E98-A45B-9E07D86A1B32@gmail.com> References: <201204102039.q3AKdIbs006704@pluto.hedeland.org> <2F70A8C0-854A-4E98-A45B-9E07D86A1B32@gmail.com> Message-ID: <8122943088708806705@unknownmsgid> Hi Morgan, Did you try your tests on the same machine? Sent from my iPhone On 11.04.2012, at 1:21, Morgan Segalis wrote: > > Le 10 avr. 2012 ? 22:39, Per Hedeland a ?crit : > >> SEGALIS Morgan wrote: >>> >>> While it will take 10 second to a ssl accepting bit of C++ code to accept >>> all of them (which don't even have multiple accept pending), in Erlang this >>> is quite different. It will accept at most 20 connections a second >>> (according to netstat info, whilst C++ accept more like 1K connection per >>> seconds) >> >> As has already been pointed out, a) the DH-based cipher suites make for >> a very slow (mainly due to high CPU usage) handshake, and b) you need to >> check the selected cipher in your benchmarking to determine if one of >> these is being used. If you don't see any difference when disabling >> them, have you verified that they aren't being used? (I.e. maybe you are >> doing a mistake when disabling...) >> >> I'd just like to point out that the current OTP ssl implementation may >> end up using one of the DH-based suites "by default", while typical >> C/C++ + OpenSSL implementations (including the "old" ssl_esock-based OTP >> implementation) will not, since it requires a bit of extra work to make >> OpenSSL use them. >> >> Another reason for the handshake slowness, if you are using a >> suite/certificate with RSA authentication (pretty much the norm), is >> that the RSA signing operation is some 3-4 times slower than it need be >> with the current OTP ssl implementation. I reported this in >> http://erlang.org/pipermail/erlang-questions/2012-March/064925.html and >> subsequently found the cause, which is that a number of private key >> parameters aren't used even though they are available - to quote the >> OpenSSL rsa(3) man page: >> >> p, q, dmp1, dmq1 and iqmp may be NULL in private keys, but the RSA >> operations are much faster when these values are available. >> >> - "much" is an understatement I think.:-) >> >> I've recently submitted an "informal" patch fixing this to the OTP >> group, Ingela may be able to comment (or not:-) on when it might make it >> into the release. If you're desperate I can provide the patch off-list, >> it's not overly complex. But this issue alone can definitely not explain >> the difference you are seeing. >> >> Finally I'll point out that while the SSL protocol implementation is >> indeed implemented in Erlang now, all the "heavy crypto work" is still >> done in OpenSSL's libcrypto, with a "thin" NIF interface in between. The >> net result is probably a bit slower than 100% C/C++, but it shouldn't >> (need to) be anywhere near what you report. (The good part is, of >> course, that the implementation can make use of the Erlang/beam >> concurrency support, instead of the hairy pthread stuff you need to use >> for OpenSSL's libssl.) >> >> --Per Hedeland > > Hi Per, > > Thank you for have taking the time to write this clear answer. > Actually I'm kinda desperate. > I found very weird indeed that there is so much differences between Erlang and C++ > But I really can't think about anything else, > I'm having multiple acceptor at once, set the Erl shell running on 8 threads? > Even changed the ciphers to almost every possible options. > > The fact is in C++ I launch a thread after each socket accepted, and does the handshake on the said thread. > > It seems that "Learn You some Erlang" implementation is the best for what I'm trying to do. If not please anyone tell me what should I change. > > What could limit so much the connection if it is not SSL, really ? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From msegalis@REDACTED Tue Apr 10 23:48:43 2012 From: msegalis@REDACTED (Morgan Segalis) Date: Tue, 10 Apr 2012 23:48:43 +0200 Subject: [erlang-questions] Erlang accepting SSL connection is really slow (comparing to C++) In-Reply-To: <8122943088708806705@unknownmsgid> References: <201204102039.q3AKdIbs006704@pluto.hedeland.org> <2F70A8C0-854A-4E98-A45B-9E07D86A1B32@gmail.com> <8122943088708806705@unknownmsgid> Message-ID: <67B2761F-EA56-427A-9B00-4A36280A2043@gmail.com> Hi Max, Yes, the C++ code and the Erlang code, are running on the same server. Le 10 avr. 2012 ? 23:35, Max Bourinov a ?crit : > Hi Morgan, > > Did you try your tests on the same machine? > > Sent from my iPhone > > On 11.04.2012, at 1:21, Morgan Segalis wrote: > >> >> Le 10 avr. 2012 ? 22:39, Per Hedeland a ?crit : >> >>> SEGALIS Morgan wrote: >>>> >>>> While it will take 10 second to a ssl accepting bit of C++ code to accept >>>> all of them (which don't even have multiple accept pending), in Erlang this >>>> is quite different. It will accept at most 20 connections a second >>>> (according to netstat info, whilst C++ accept more like 1K connection per >>>> seconds) >>> >>> As has already been pointed out, a) the DH-based cipher suites make for >>> a very slow (mainly due to high CPU usage) handshake, and b) you need to >>> check the selected cipher in your benchmarking to determine if one of >>> these is being used. If you don't see any difference when disabling >>> them, have you verified that they aren't being used? (I.e. maybe you are >>> doing a mistake when disabling...) >>> >>> I'd just like to point out that the current OTP ssl implementation may >>> end up using one of the DH-based suites "by default", while typical >>> C/C++ + OpenSSL implementations (including the "old" ssl_esock-based OTP >>> implementation) will not, since it requires a bit of extra work to make >>> OpenSSL use them. >>> >>> Another reason for the handshake slowness, if you are using a >>> suite/certificate with RSA authentication (pretty much the norm), is >>> that the RSA signing operation is some 3-4 times slower than it need be >>> with the current OTP ssl implementation. I reported this in >>> http://erlang.org/pipermail/erlang-questions/2012-March/064925.html and >>> subsequently found the cause, which is that a number of private key >>> parameters aren't used even though they are available - to quote the >>> OpenSSL rsa(3) man page: >>> >>> p, q, dmp1, dmq1 and iqmp may be NULL in private keys, but the RSA >>> operations are much faster when these values are available. >>> >>> - "much" is an understatement I think.:-) >>> >>> I've recently submitted an "informal" patch fixing this to the OTP >>> group, Ingela may be able to comment (or not:-) on when it might make it >>> into the release. If you're desperate I can provide the patch off-list, >>> it's not overly complex. But this issue alone can definitely not explain >>> the difference you are seeing. >>> >>> Finally I'll point out that while the SSL protocol implementation is >>> indeed implemented in Erlang now, all the "heavy crypto work" is still >>> done in OpenSSL's libcrypto, with a "thin" NIF interface in between. The >>> net result is probably a bit slower than 100% C/C++, but it shouldn't >>> (need to) be anywhere near what you report. (The good part is, of >>> course, that the implementation can make use of the Erlang/beam >>> concurrency support, instead of the hairy pthread stuff you need to use >>> for OpenSSL's libssl.) >>> >>> --Per Hedeland >> >> Hi Per, >> >> Thank you for have taking the time to write this clear answer. >> Actually I'm kinda desperate. >> I found very weird indeed that there is so much differences between Erlang and C++ >> But I really can't think about anything else, >> I'm having multiple acceptor at once, set the Erl shell running on 8 threads? >> Even changed the ciphers to almost every possible options. >> >> The fact is in C++ I launch a thread after each socket accepted, and does the handshake on the said thread. >> >> It seems that "Learn You some Erlang" implementation is the best for what I'm trying to do. If not please anyone tell me what should I change. >> >> What could limit so much the connection if it is not SSL, really ? >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions From straightflush@REDACTED Wed Apr 11 00:01:50 2012 From: straightflush@REDACTED (AD) Date: Tue, 10 Apr 2012 18:01:50 -0400 Subject: [erlang-questions] broadcast message to all gen_server In-Reply-To: <4F8495A3.6020005@gmail.com> References: <4F8495A3.6020005@gmail.com> Message-ID: the gen_server is part of the sockjs server and i was trying to not modify/fork his code and leverage what is already there. Currently he uses a handle_call() so was looking at handling it outside his code. -AD On Tue, Apr 10, 2012 at 4:18 PM, Tilman Holschuh wrote: > > On 12-04-10 12:37 PM, AD wrote: > >> I have a situation where i am trying to handle a case where I am using >> sockjs and need to send a message to each sockjs session_server (which is >> a >> gen_server). I am using gproc() but I cant simply do a gproc_send() b/c >> the message ends up in handle_info() instead of properly in handle_call(). >> I have managed to work this out, when receiving a message from rabbitmq i >> do a gproc:lookup_pids() and then loop through each pid and do a >> gen_server:call(PID,Message). The issue is this is a linear process, is >> there a way to handle sending gen_server:call() to all the processes >> concurrently ? >> > > Do you need a response from the gen_server:call? If not you could just use > a cast instead. Something like: > > [gen_server:cast(Pid, Message) || Pid <- gproc:lookup_pids()] > > > Cheers > - Tilman > > ______________________________**_________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/**listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrew@REDACTED Wed Apr 11 00:36:23 2012 From: andrew@REDACTED (Andrew Thompson) Date: Tue, 10 Apr 2012 18:36:23 -0400 Subject: [erlang-questions] Strange behaviour of SSL verify depth option Message-ID: <20120410223623.GD28476@hijacked.us> I'm working on some SSL related code, and I'm testing with certificates signed with an intemediate CA. According to the documentation: Specifies the maximum verification depth, i.e. how far in a chain of certificates the verification process can proceed before the verification is considered to fail. Peer certificate = 0, CA certificate = 1, higher level CA certificate = 2, etc. The value 2 thus means that a chain can at most contain peer cert, CA cert, next CA cert, and an additional CA cert. The default value is 1. However, with depth set to 1 or 2, verification succeeds. As I understand this documentation, a depth of 1 with a certificate signed by an intermediate CA should fail, since there's actually 2 CAs involved in the chain. I also don't understand why setting the option to '2' allows a chain consisting of 1 peer certificate and *3* CA certificates. I've confirmed that SSL is following the chain by removing one of the CA certificates from the list passed to SSL, verifications fails as expected. Both certificates need to be present. Verification also fails if the depth is set to 0. Andrew From tilman.holschuh@REDACTED Wed Apr 11 01:09:09 2012 From: tilman.holschuh@REDACTED (Tilman Holschuh) Date: Tue, 10 Apr 2012 16:09:09 -0700 Subject: [erlang-questions] broadcast message to all gen_server In-Reply-To: References: <4F8495A3.6020005@gmail.com> Message-ID: <4F84BD95.9040406@gmail.com> And this doesn't work for you? https://github.com/sockjs/sockjs-erlang/blob/master/src/sockjs_session.erl#L66 It's a cast and you can supply the pid (just wondering why he explicitly returns ok but that doesn't matter). Cheers - Tilman On 12-04-10 03:01 PM, AD wrote: > the gen_server is part of the sockjs server and i was trying to not > modify/fork his code and leverage what is already there. Currently he uses > a handle_call() so was looking at handling it outside his code. > > -AD > > On Tue, Apr 10, 2012 at 4:18 PM, Tilman Holschuh > wrote: > >> >> On 12-04-10 12:37 PM, AD wrote: >> >>> I have a situation where i am trying to handle a case where I am using >>> sockjs and need to send a message to each sockjs session_server (which is >>> a >>> gen_server). I am using gproc() but I cant simply do a gproc_send() b/c >>> the message ends up in handle_info() instead of properly in handle_call(). >>> I have managed to work this out, when receiving a message from rabbitmq i >>> do a gproc:lookup_pids() and then loop through each pid and do a >>> gen_server:call(PID,Message). The issue is this is a linear process, is >>> there a way to handle sending gen_server:call() to all the processes >>> concurrently ? >>> >> >> Do you need a response from the gen_server:call? If not you could just use >> a cast instead. Something like: >> >> [gen_server:cast(Pid, Message) || Pid<- gproc:lookup_pids()] >> >> >> Cheers >> - Tilman >> >> ______________________________**_________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/**listinfo/erlang-questions >> > From phil.toland@REDACTED Wed Apr 11 02:00:17 2012 From: phil.toland@REDACTED (Phillip Toland) Date: Tue, 10 Apr 2012 19:00:17 -0500 Subject: [erlang-questions] Wrangler 1.0 released In-Reply-To: References: <4F844FA8.1030305@ninenines.eu> <4F84546A.5090301@ninenines.eu> Message-ID: On Tue, Apr 10, 2012 at 12:03 PM, Andr? Graf wrote: > congrats to 1.0, unfortunately not on vim! > how much work would it be to port wrangler to vim? I guess there are > several vim users who would like to see wrangler support in vim and > might also contribute. I am such a Vim user. +1 ~p From straightflush@REDACTED Wed Apr 11 03:43:57 2012 From: straightflush@REDACTED (AD) Date: Tue, 10 Apr 2012 21:43:57 -0400 Subject: [erlang-questions] broadcast message to all gen_server In-Reply-To: <4F84BD95.9040406@gmail.com> References: <4F8495A3.6020005@gmail.com> <4F84BD95.9040406@gmail.com> Message-ID: yea i finally backtracked more through the code and realized you can just do sockjs_session:send(iolist_to_binary([Msg]),{sockjs_session,{P,empty}}) as an API call to a gen_server:cast() call. I am gonna throw this into a spawn(fun() -> ) to get as close to "broadcast" as possible unless there is negligible gain in doing this since its an async call anyway. -A On Tue, Apr 10, 2012 at 7:09 PM, Tilman Holschuh wrote: > And this doesn't work for you? > > https://github.com/sockjs/**sockjs-erlang/blob/master/src/** > sockjs_session.erl#L66 > > It's a cast and you can supply the pid (just wondering why he explicitly > returns ok but that doesn't matter). > > Cheers > - Tilman > > > On 12-04-10 03:01 PM, AD wrote: > >> the gen_server is part of the sockjs server and i was trying to not >> modify/fork his code and leverage what is already there. Currently he uses >> a handle_call() so was looking at handling it outside his code. >> >> -AD >> >> On Tue, Apr 10, 2012 at 4:18 PM, Tilman Holschuh >> **wrote: >> >> >>> On 12-04-10 12:37 PM, AD wrote: >>> >>> I have a situation where i am trying to handle a case where I am using >>>> sockjs and need to send a message to each sockjs session_server (which >>>> is >>>> a >>>> gen_server). I am using gproc() but I cant simply do a gproc_send() b/c >>>> the message ends up in handle_info() instead of properly in >>>> handle_call(). >>>> I have managed to work this out, when receiving a message from >>>> rabbitmq i >>>> do a gproc:lookup_pids() and then loop through each pid and do a >>>> gen_server:call(PID,Message). The issue is this is a linear process, is >>>> there a way to handle sending gen_server:call() to all the processes >>>> concurrently ? >>>> >>>> >>> Do you need a response from the gen_server:call? If not you could just >>> use >>> a cast instead. Something like: >>> >>> [gen_server:cast(Pid, Message) || Pid<- gproc:lookup_pids()] >>> >>> >>> Cheers >>> - Tilman >>> >>> ______________________________****_________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/****listinfo/erlang-questions >>> >>> > >>> >>> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From ngocdaothanh@REDACTED Wed Apr 11 04:28:42 2012 From: ngocdaothanh@REDACTED (Ngoc Dao) Date: Wed, 11 Apr 2012 11:28:42 +0900 Subject: [erlang-questions] BERT encoding and WebSocket In-Reply-To: References: <3516e246-0cf8-4748-8646-6b4ce1f57557@z3g2000pbn.googlegroups.com> <8171494D-0839-45AE-9935-81084F77CFA9@gmail.com> Message-ID: Thanks for the info. About "websockets does not support binary data": * Wikipedia says "Binary frames are not supported yet in the API" ("http://en.wikipedia.org/wiki/WebSockets") * Stackoverflow says "until then, WebSockets payload is encoded as UTF-8" (http://stackoverflow.com/questions/5766802/send-and-receive-binary-data-over-web-sockets-in-javascript) About BERT, it seems that BERT is not shorter than JSON, so I'm thinking of not using BERT. On Tue, Apr 10, 2012 at 11:17 PM, Antoine Koener wrote: > Here's a link: http://autobahn.ws/testsuite/reports/clients/index.html > > :-) > > On Tue, Apr 10, 2012 at 3:54 PM, Antoine Koener > wrote: >> Are you sure that websockets does not support binary data ? >> >> The data type is "blob", or "arraybuffer". >> >> See w3c for more information. >> >> (sorry for not giving you Uris about that, I'm conferencing :)) >> >> -- >> Was in mobile mode ... >> >> On 10 avr. 2012, at 04:26, ngocdaothanh wrote: >> >>> What is the best way to use BERT encoding (http://bert-rpc.org/) with >>> WebSocket? >>> >>> BERT is binary but WebSocket does not support binary at this moment. >>> Should I use base64 to encode BERT binary to normal string? Base64 has >>> 33% overhead (http://en.wikipedia.org/wiki/Base64). How much space can >>> BERT save compared to JSON? From ok@REDACTED Wed Apr 11 04:32:23 2012 From: ok@REDACTED (Richard O'Keefe) Date: Wed, 11 Apr 2012 14:32:23 +1200 Subject: [erlang-questions] Fear and Loathing in Programming La La Land In-Reply-To: <4F7E0194.9030902@fastmail.fm> References: <4F7CDE52.6030903@fastmail.fm> <4F7D5D9B.9030806@fastmail.fm> <4F7D5F75.8020200@fastmail.fm> <4F7D92F1.3070507@meetinghouse.net> <4F7DD587.4000805@fastmail.fm> <4F7DE780.1020703@meetinghouse.net> <4F7E0194.9030902@fastmail.fm> Message-ID: <723E18E1-FB6A-4794-81BA-F6E9DC5707E2@cs.otago.ac.nz> On 6/04/2012, at 8:33 AM, Jan Burse wrote: > BTW: One can easily build and run code > written in the Erlang language with other > tool-sets and runtimes. Here is a very small > experiment: > https://plus.google.com/u/0/b/103259555581227445618/103259555581227445618/posts/KQrBA5yECpq Follow the links to http://www.xlog.ch/jekejeke/perpetual/erlang.p and you find something with - no concurrency - no hot loading - no modules - no functions - no conditionals ... It's so mini it's Zero. As an experiment, it's a dud. "Precise Garbage Collection in Prolog" is an interesting paper, though. From bourinov@REDACTED Wed Apr 11 05:52:29 2012 From: bourinov@REDACTED (Max Bourinov) Date: Wed, 11 Apr 2012 07:52:29 +0400 Subject: [erlang-questions] Wrangler 1.0 released In-Reply-To: References: <4F844FA8.1030305@ninenines.eu> <4F84546A.5090301@ninenines.eu> Message-ID: Hi Simon, Congratulations! The video on your website is very cool! Only because of Wrangler I will give emacs another (third?) try. p.s. At the moment I use Sublime. Best regards, Max On Wed, Apr 11, 2012 at 4:00 AM, Phillip Toland wrote: > On Tue, Apr 10, 2012 at 12:03 PM, Andr? Graf wrote: > > congrats to 1.0, unfortunately not on vim! > > how much work would it be to port wrangler to vim? I guess there are > > several vim users who would like to see wrangler support in vim and > > might also contribute. > > I am such a Vim user. +1 > > > > ~p > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ingela@REDACTED Wed Apr 11 10:53:51 2012 From: ingela@REDACTED (Ingela Andin) Date: Wed, 11 Apr 2012 10:53:51 +0200 Subject: [erlang-questions] Erlang accepting SSL connection is really slow (comparing to C++) In-Reply-To: <201204102039.q3AKdIbs006704@pluto.hedeland.org> References: <201204102039.q3AKdIbs006704@pluto.hedeland.org> Message-ID: Hi! Of course we need to continue investigating this, as for the patch that Per is talking about see comment below. 2012/4/10 Per Hedeland : > SEGALIS Morgan wrote: >> >>While it will take 10 second to a ssl accepting bit of C++ code to accept >>all of them (which don't even have multiple accept pending), in Erlang this >>is quite different. It will accept at most 20 connections a second >>(according to netstat info, whilst C++ accept more like 1K connection per >>seconds) > > As has already been pointed out, a) the DH-based cipher suites make for > a very slow (mainly due to high CPU usage) handshake, and b) you need to > check the selected cipher in your benchmarking to determine if one of > these is being used. If you don't see any difference when disabling > them, have you verified that they aren't being used? (I.e. maybe you are > doing a mistake when disabling...) > > I'd just like to point out that the current OTP ssl implementation may > end up using one of the DH-based suites "by default", while typical > C/C++ + OpenSSL implementations (including the "old" ssl_esock-based OTP > implementation) will not, since it requires a bit of extra work to make > OpenSSL use them. > > Another reason for the handshake slowness, if you are using a > suite/certificate with RSA authentication (pretty much the norm), is > that the RSA signing operation is some 3-4 times slower than it need be > with the current OTP ssl implementation. I reported this in > http://erlang.org/pipermail/erlang-questions/2012-March/064925.html and > subsequently found the cause, which is that a number of private key > parameters aren't used even though they are available - to quote the > OpenSSL rsa(3) man page: > > ? ?p, q, dmp1, dmq1 and iqmp may be NULL in private keys, but the RSA > ? ?operations are much faster when these values are available. > > - "much" is an understatement I think.:-) > > I've recently submitted an "informal" patch fixing this to the OTP > group, Ingela may be able to comment (or not:-) on when it might make it > into the release. If you're desperate I can provide the patch off-list, > it's not overly complex. But this issue alone can definitely not explain > the difference you are seeing. I am not in a position to make any promises, but it is a fairly easy patch and the plan is to include it for R15B02. We did not want to try and force it in to R15B01 after the deadline. Late fixes are seldom a good idea even when they feel trivial. > Finally I'll point out that while the SSL protocol implementation is > indeed implemented in Erlang now, all the "heavy crypto work" is still > done in OpenSSL's libcrypto, with a "thin" NIF interface in between. The > net result is probably a bit slower than 100% C/C++, but it shouldn't > (need to) be anywhere near what you report. (The good part is, of > course, that the implementation can make use of the Erlang/beam > concurrency support, instead of the hairy pthread stuff you need to use > for OpenSSL's libssl.) There are lots of gains doing things in Erlang instead of C/C++. Eaiser to maintain, portable, quicker to implement new features, can gain multicore benefits etc. Even though C/C++ will be faster for the small sequential-benchmarks it is far from certain it will be the quickest in the bigger picture parallell world. I will continue investegation your findings to see if there are any improvments we can make to erlang-ssl. Regards Ingela Erlang/OTP team - Ericsson AB From s.j.thompson@REDACTED Wed Apr 11 11:11:13 2012 From: s.j.thompson@REDACTED (Simon Thompson) Date: Wed, 11 Apr 2012 10:11:13 +0100 Subject: [erlang-questions] Wrangler 1.0 released In-Reply-To: References: <4F844FA8.1030305@ninenines.eu> <4F84546A.5090301@ninenines.eu> Message-ID: <9FE7C4D7-6865-423C-9C72-344BB4813AB4@kent.ac.uk> Thanks for all the interest in vim ? we'd be very happy to help anyone who is keen to integrate Wrangler into vim, or indeed other editors. Kind regards Huiqing and SImon On 11 Apr 2012, at 01:00, Phillip Toland wrote: > On Tue, Apr 10, 2012 at 12:03 PM, Andr? Graf wrote: >> congrats to 1.0, unfortunately not on vim! >> how much work would it be to port wrangler to vim? I guess there are >> several vim users who would like to see wrangler support in vim and >> might also contribute. > > I am such a Vim user. +1 > > > > ~p > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions Simon Thompson | Professor of Logic and Computation School of Computing | University of Kent | Canterbury, CT2 7NF, UK s.j.thompson@REDACTED | M +44 7986 085754 | W www.cs.kent.ac.uk/~sjt From janburse@REDACTED Wed Apr 11 12:20:51 2012 From: janburse@REDACTED (Jan Burse) Date: Wed, 11 Apr 2012 12:20:51 +0200 Subject: [erlang-questions] Fear and Loathing in Programming La La Land In-Reply-To: <723E18E1-FB6A-4794-81BA-F6E9DC5707E2@cs.otago.ac.nz> References: <4F7CDE52.6030903@fastmail.fm> <4F7D5D9B.9030806@fastmail.fm> <4F7D5F75.8020200@fastmail.fm> <4F7D92F1.3070507@meetinghouse.net> <4F7DD587.4000805@fastmail.fm> <4F7DE780.1020703@meetinghouse.net> <4F7E0194.9030902@fastmail.fm> <723E18E1-FB6A-4794-81BA-F6E9DC5707E2@cs.otago.ac.nz> Message-ID: <4F855B03.6060103@fastmail.fm> General Questions: - Would it be allowed to make a Erlang language realization? - Any legal problems with copyright or so? - Any ways to certify it, i.e. test suite etc.? Bye Richard O'Keefe schrieb: > > On 6/04/2012, at 8:33 AM, Jan Burse wrote: >> BTW: One can easily build and run code >> written in the Erlang language with other >> tool-sets and runtimes. Here is a very small >> experiment: >> https://plus.google.com/u/0/b/103259555581227445618/103259555581227445618/posts/KQrBA5yECpq > > Follow the links to > http://www.xlog.ch/jekejeke/perpetual/erlang.p > and you find something with > - no concurrency > - no hot loading > - no modules > - no functions > - no conditionals > ... > It's so mini it's Zero. > > As an experiment, it's a dud. > > "Precise Garbage Collection in Prolog" is an interesting paper, though. > > > > From msegalis@REDACTED Wed Apr 11 12:39:02 2012 From: msegalis@REDACTED (Morgan Segalis) Date: Wed, 11 Apr 2012 12:39:02 +0200 Subject: [erlang-questions] Erlang accepting SSL connection is really slow (comparing to C++) In-Reply-To: References: <201204102039.q3AKdIbs006704@pluto.hedeland.org> Message-ID: All this discussion made me think? It cannot be possible that this difference between C++ and Erlang is coming from SSL. Like said Per, It may not be 100% C++, but slightly different only. Ok the ciphers might be responsible for a little lag, but here I'm using the same on C++ and Erlang : AES256-SHA And I spotted something. While my 10K test, I'm trying to connect manually, like I wrote in my first email. openssl s_client -ssl3 -ign_eof -connect myserver:4242 When it is very long (one of the 3 cases)? the "CONNECTED(00000003)" that should appear between the connection and the handshake, does not. I'm sorry to realize that only now, but that means that it is not the SSL handshake that takes time, but really the connection itself. I'm not really sure where it could come from, but i'm starting to think that it may come from something like the max open file possible in erlang, or something like that? Le 11 avr. 2012 ? 10:53, Ingela Andin a ?crit : > Hi! > > Of course we need to continue investigating this, as for the patch > that Per is talking about see comment below. > > 2012/4/10 Per Hedeland : >> SEGALIS Morgan wrote: >>> >>> While it will take 10 second to a ssl accepting bit of C++ code to accept >>> all of them (which don't even have multiple accept pending), in Erlang this >>> is quite different. It will accept at most 20 connections a second >>> (according to netstat info, whilst C++ accept more like 1K connection per >>> seconds) >> >> As has already been pointed out, a) the DH-based cipher suites make for >> a very slow (mainly due to high CPU usage) handshake, and b) you need to >> check the selected cipher in your benchmarking to determine if one of >> these is being used. If you don't see any difference when disabling >> them, have you verified that they aren't being used? (I.e. maybe you are >> doing a mistake when disabling...) >> >> I'd just like to point out that the current OTP ssl implementation may >> end up using one of the DH-based suites "by default", while typical >> C/C++ + OpenSSL implementations (including the "old" ssl_esock-based OTP >> implementation) will not, since it requires a bit of extra work to make >> OpenSSL use them. >> >> Another reason for the handshake slowness, if you are using a >> suite/certificate with RSA authentication (pretty much the norm), is >> that the RSA signing operation is some 3-4 times slower than it need be >> with the current OTP ssl implementation. I reported this in >> http://erlang.org/pipermail/erlang-questions/2012-March/064925.html and >> subsequently found the cause, which is that a number of private key >> parameters aren't used even though they are available - to quote the >> OpenSSL rsa(3) man page: >> >> p, q, dmp1, dmq1 and iqmp may be NULL in private keys, but the RSA >> operations are much faster when these values are available. >> >> - "much" is an understatement I think.:-) >> >> I've recently submitted an "informal" patch fixing this to the OTP >> group, Ingela may be able to comment (or not:-) on when it might make it >> into the release. If you're desperate I can provide the patch off-list, >> it's not overly complex. But this issue alone can definitely not explain >> the difference you are seeing. > > I am not in a position to make any promises, but it is a fairly easy > patch and the plan is to include it for R15B02. We did not want to > try and force it in to R15B01 after the deadline. Late fixes are > seldom a good idea even when they feel trivial. > >> Finally I'll point out that while the SSL protocol implementation is >> indeed implemented in Erlang now, all the "heavy crypto work" is still >> done in OpenSSL's libcrypto, with a "thin" NIF interface in between. The >> net result is probably a bit slower than 100% C/C++, but it shouldn't >> (need to) be anywhere near what you report. (The good part is, of >> course, that the implementation can make use of the Erlang/beam >> concurrency support, instead of the hairy pthread stuff you need to use >> for OpenSSL's libssl.) > > There are lots of gains doing things in Erlang instead of C/C++. > Eaiser to maintain, portable, quicker to implement new features, can > gain multicore benefits etc. Even though C/C++ will be faster for the > small sequential-benchmarks it is far from certain it will be the > quickest in the bigger picture parallell world. I will continue > investegation your findings to see if there are any improvments we > can make to erlang-ssl. > > Regards Ingela Erlang/OTP team - Ericsson AB From erik.ylipaa@REDACTED Wed Apr 11 12:45:58 2012 From: erik.ylipaa@REDACTED (=?ISO-8859-1?Q?Erik_Ylip=E4=E4?=) Date: Wed, 11 Apr 2012 12:45:58 +0200 Subject: [erlang-questions] BERT encoding and WebSocket In-Reply-To: References: <3516e246-0cf8-4748-8646-6b4ce1f57557@z3g2000pbn.googlegroups.com> <8171494D-0839-45AE-9935-81084F77CFA9@gmail.com> Message-ID: Hello! Binary frames are actually supported, at least by chrome (and should be supported by any browser which implements at least hybi-07). I got it working with cowboy and chrome by modifying the websocket_handler:websocket_info/3 from the cowboy websocket example: websocket_info(tick, Req, State) -> {reply, {binary, term_to_binary("Hello")}, Req, State, hibernate}; The browser receives a Blob which can be decoded by a FileReader object using readAsBinaryString followed by BERT-JS decode. Sending from the browser is also not a problem. Converting the data from BERT-JS encoding requires you to convert it to an ArrayBuffer or Blob which introduces some extra steps, but it is doable. Even though it's possible, I'd use JSON if the browser doesn't have to know how the data is represented in Erlang. For the project I'm working on, we came to the conclusion that if we used BERT, we had to do more work in JavaScript. If we used JSON, we had to do more work in Erlang. Doing more work in Erlang is preferable, so we chose to go with JSON :) /Erik Ylip?? 2012/4/11 Ngoc Dao > Thanks for the info. > > About "websockets does not support binary data": > * Wikipedia says "Binary frames are not supported yet in the API" > ("http://en.wikipedia.org/wiki/WebSockets") > * Stackoverflow says "until then, WebSockets payload is encoded as > UTF-8" ( > http://stackoverflow.com/questions/5766802/send-and-receive-binary-data-over-web-sockets-in-javascript > ) > > About BERT, it seems that BERT is not shorter than JSON, so I'm > thinking of not using BERT. > > > On Tue, Apr 10, 2012 at 11:17 PM, Antoine Koener > wrote: > > Here's a link: http://autobahn.ws/testsuite/reports/clients/index.html > > > > :-) > > > > On Tue, Apr 10, 2012 at 3:54 PM, Antoine Koener > > wrote: > >> Are you sure that websockets does not support binary data ? > >> > >> The data type is "blob", or "arraybuffer". > >> > >> See w3c for more information. > >> > >> (sorry for not giving you Uris about that, I'm conferencing :)) > >> > >> -- > >> Was in mobile mode ... > >> > >> On 10 avr. 2012, at 04:26, ngocdaothanh wrote: > >> > >>> What is the best way to use BERT encoding (http://bert-rpc.org/) with > >>> WebSocket? > >>> > >>> BERT is binary but WebSocket does not support binary at this moment. > >>> Should I use base64 to encode BERT binary to normal string? Base64 has > >>> 33% overhead (http://en.wikipedia.org/wiki/Base64). How much space can > >>> BERT save compared to JSON? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From erik.ylipaa@REDACTED Wed Apr 11 12:48:48 2012 From: erik.ylipaa@REDACTED (=?ISO-8859-1?Q?Erik_Ylip=E4=E4?=) Date: Wed, 11 Apr 2012 12:48:48 +0200 Subject: [erlang-questions] BERT encoding and WebSocket In-Reply-To: References: <3516e246-0cf8-4748-8646-6b4ce1f57557@z3g2000pbn.googlegroups.com> <8171494D-0839-45AE-9935-81084F77CFA9@gmail.com> Message-ID: Hello! Binary frames are actually supported, at least by chrome (and should be supported by any browser which implements at least hybi-07). I got it working with cowboy and chrome by modifying the websocket_handler:websocket_info/3 from the cowboy websocket example: websocket_info(tick, Req, State) -> {reply, {binary, term_to_binary("Hello")}, Req, State, hibernate}; The browser receives a Blob which can be decoded by a FileReader object using readAsBinaryString followed by BERT-JS decode. Sending from the browser is also not a problem. Converting the data from BERT-JS encoding requires you to convert it to an ArrayBuffer or Blob which introduces some extra steps, but it is doable. Even though it's possible, I'd use JSON if the browser doesn't have to know how the data is represented in Erlang. For the project I'm working on, we came to the conclusion that if we used BERT, we had to do more work in JavaScript. If we used JSON, we had to do more work in Erlang. Doing more work in Erlang is preferable, so we chose to go with JSON :) /Erik Ylip?? 2012/4/11 Ngoc Dao > Thanks for the info. > > About "websockets does not support binary data": > * Wikipedia says "Binary frames are not supported yet in the API" > ("http://en.wikipedia.org/wiki/WebSockets") > * Stackoverflow says "until then, WebSockets payload is encoded as > UTF-8" ( > http://stackoverflow.com/questions/5766802/send-and-receive-binary-data-over-web-sockets-in-javascript > ) > > About BERT, it seems that BERT is not shorter than JSON, so I'm > thinking of not using BERT. > > > On Tue, Apr 10, 2012 at 11:17 PM, Antoine Koener > wrote: > > Here's a link: http://autobahn.ws/testsuite/reports/clients/index.html > > > > :-) > > > > On Tue, Apr 10, 2012 at 3:54 PM, Antoine Koener > > wrote: > >> Are you sure that websockets does not support binary data ? > >> > >> The data type is "blob", or "arraybuffer". > >> > >> See w3c for more information. > >> > >> (sorry for not giving you Uris about that, I'm conferencing :)) > >> > >> -- > >> Was in mobile mode ... > >> > >> On 10 avr. 2012, at 04:26, ngocdaothanh wrote: > >> > >>> What is the best way to use BERT encoding (http://bert-rpc.org/) with > >>> WebSocket? > >>> > >>> BERT is binary but WebSocket does not support binary at this moment. > >>> Should I use base64 to encode BERT binary to normal string? Base64 has > >>> 33% overhead (http://en.wikipedia.org/wiki/Base64). How much space can > >>> BERT save compared to JSON? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ingela@REDACTED Wed Apr 11 13:12:51 2012 From: ingela@REDACTED (Ingela Andin) Date: Wed, 11 Apr 2012 13:12:51 +0200 Subject: [erlang-questions] Strange behaviour of SSL verify depth option In-Reply-To: <20120410223623.GD28476@hijacked.us> References: <20120410223623.GD28476@hijacked.us> Message-ID: HI! 2012/4/11 Andrew Thompson : > I'm working on some SSL related code, and I'm testing with certificates > signed with an intemediate CA. According to the documentation: > > ?Specifies the maximum verification depth, i.e. how far in a > ?chain of certificates the verification process can proceed > ?before ?the ?verification ?is ?considered ?to > ?fail. ?Peer ?certificate ?= 0, CA certificate = 1, > ?higher level CA certificate = 2, etc. The value 2 > ?thus means that a chain can at most contain peer > ?cert, CA cert, next CA cert, and an additional CA > ?cert. The default value is 1. > > However, with depth set to 1 or 2, verification succeeds. As I > understand this documentation, a depth of 1 with a certificate signed by > an intermediate CA should fail, since there's actually 2 CAs involved in > the chain. > > I also don't understand why setting the option to '2' allows a chain > consisting of 1 peer certificate and *3* CA certificates. Humm... maybe this could be expressed clearer (that phrasing has been around for a while) The depth is the maximum number of non-self-issued intermediate certificates that may follow the peer certificate in a valid certification path. So if depth is 0 the PEER must be signed by the trusted ROOT-CA directly, if 1 the path can be PEER, CA, ROOT-CA, if it is 2 PEER, CA, CA, ROOT-CA and so on. Regards Ingela Erlang/OTP team - Ericsson AB From gleber.p@REDACTED Wed Apr 11 14:33:22 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Wed, 11 Apr 2012 14:33:22 +0200 Subject: [erlang-questions] Wrangler 1.0 released In-Reply-To: <9FE7C4D7-6865-423C-9C72-344BB4813AB4@kent.ac.uk> References: <4F844FA8.1030305@ninenines.eu> <4F84546A.5090301@ninenines.eu> <9FE7C4D7-6865-423C-9C72-344BB4813AB4@kent.ac.uk> Message-ID: On Wed, Apr 11, 2012 at 11:11, Simon Thompson wrote: > Thanks for all the interest in vim ? we'd be very happy to help anyone who is keen to integrate Wrangler into vim, or indeed other editors. > > Kind regards > Huiqing and SImon Is there any way to make wrangler-search-path dynamic depending on the project I'm currently editing? I work with few projects on day to day basis and it is pretty tedious to change wrangler-search-path whenever I switch. Some of them are even pretty comples, so some sort with rebar would be perfect! I was wondering about adding get-wrangler-search-path in wrangler.el.src and replacing wranger-search-path with it everywhere in wrangler and advising this function to return results based on detected project root (e.g. by finding rebar.config). Is this a viable approach? Does Wrangler / Emacs provide other ways which I'm overlooking? From michael.santos@REDACTED Wed Apr 11 14:38:01 2012 From: michael.santos@REDACTED (Michael Santos) Date: Wed, 11 Apr 2012 05:38:01 -0700 Subject: [erlang-questions] Erlang accepting SSL connection is really slow (comparing to C++) In-Reply-To: References: <201204102039.q3AKdIbs006704@pluto.hedeland.org> Message-ID: <20120411123801.GA14814@ioctl> On Wed, Apr 11, 2012 at 12:39:02PM +0200, Morgan Segalis wrote: > All this discussion made me think? > > It cannot be possible that this difference between C++ and Erlang is coming from SSL. > Like said Per, It may not be 100% C++, but slightly different only. > Ok the ciphers might be responsible for a little lag, but here I'm using the same on C++ and Erlang : > > AES256-SHA > > And I spotted something. > While my 10K test, I'm trying to connect manually, like I wrote in my first email. > > openssl s_client -ssl3 -ign_eof -connect myserver:4242 > > When it is very long (one of the 3 cases)? the "CONNECTED(00000003)" > that should appear between the connection and the handshake, does not. > > I'm sorry to realize that only now, but that means that it is not the SSL handshake that takes time, but really the connection itself. > > I'm not really sure where it could come from, but i'm starting to think that it may come from something like the max open file possible in erlang, or something like that? What's the backlog on the listening socket set to? The docs say the default is 5. > Le 11 avr. 2012 ? 10:53, Ingela Andin a ?crit : > > > Hi! > > > > Of course we need to continue investigating this, as for the patch > > that Per is talking about see comment below. > > > > 2012/4/10 Per Hedeland : > >> SEGALIS Morgan wrote: > >>> > >>> While it will take 10 second to a ssl accepting bit of C++ code to accept > >>> all of them (which don't even have multiple accept pending), in Erlang this > >>> is quite different. It will accept at most 20 connections a second > >>> (according to netstat info, whilst C++ accept more like 1K connection per > >>> seconds) > >> > >> As has already been pointed out, a) the DH-based cipher suites make for > >> a very slow (mainly due to high CPU usage) handshake, and b) you need to > >> check the selected cipher in your benchmarking to determine if one of > >> these is being used. If you don't see any difference when disabling > >> them, have you verified that they aren't being used? (I.e. maybe you are > >> doing a mistake when disabling...) > >> > >> I'd just like to point out that the current OTP ssl implementation may > >> end up using one of the DH-based suites "by default", while typical > >> C/C++ + OpenSSL implementations (including the "old" ssl_esock-based OTP > >> implementation) will not, since it requires a bit of extra work to make > >> OpenSSL use them. > >> > >> Another reason for the handshake slowness, if you are using a > >> suite/certificate with RSA authentication (pretty much the norm), is > >> that the RSA signing operation is some 3-4 times slower than it need be > >> with the current OTP ssl implementation. I reported this in > >> http://erlang.org/pipermail/erlang-questions/2012-March/064925.html and > >> subsequently found the cause, which is that a number of private key > >> parameters aren't used even though they are available - to quote the > >> OpenSSL rsa(3) man page: > >> > >> p, q, dmp1, dmq1 and iqmp may be NULL in private keys, but the RSA > >> operations are much faster when these values are available. > >> > >> - "much" is an understatement I think.:-) > >> > >> I've recently submitted an "informal" patch fixing this to the OTP > >> group, Ingela may be able to comment (or not:-) on when it might make it > >> into the release. If you're desperate I can provide the patch off-list, > >> it's not overly complex. But this issue alone can definitely not explain > >> the difference you are seeing. > > > > I am not in a position to make any promises, but it is a fairly easy > > patch and the plan is to include it for R15B02. We did not want to > > try and force it in to R15B01 after the deadline. Late fixes are > > seldom a good idea even when they feel trivial. > > > >> Finally I'll point out that while the SSL protocol implementation is > >> indeed implemented in Erlang now, all the "heavy crypto work" is still > >> done in OpenSSL's libcrypto, with a "thin" NIF interface in between. The > >> net result is probably a bit slower than 100% C/C++, but it shouldn't > >> (need to) be anywhere near what you report. (The good part is, of > >> course, that the implementation can make use of the Erlang/beam > >> concurrency support, instead of the hairy pthread stuff you need to use > >> for OpenSSL's libssl.) > > > > There are lots of gains doing things in Erlang instead of C/C++. > > Eaiser to maintain, portable, quicker to implement new features, can > > gain multicore benefits etc. Even though C/C++ will be faster for the > > small sequential-benchmarks it is far from certain it will be the > > quickest in the bigger picture parallell world. I will continue > > investegation your findings to see if there are any improvments we > > can make to erlang-ssl. > > > > Regards Ingela Erlang/OTP team - Ericsson AB > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From s.j.thompson@REDACTED Wed Apr 11 14:46:57 2012 From: s.j.thompson@REDACTED (Simon Thompson) Date: Wed, 11 Apr 2012 13:46:57 +0100 Subject: [erlang-questions] Wrangler 1.0 released In-Reply-To: References: <4F844FA8.1030305@ninenines.eu> <4F84546A.5090301@ninenines.eu> <9FE7C4D7-6865-423C-9C72-344BB4813AB4@kent.ac.uk> Message-ID: <7440652B-134D-4CDB-BCBE-2DC74C91526F@kent.ac.uk> Gleb - you're the second person in the last two weeks to suggest linking into rebar configuration information: that sounds like an excellent idea. Should we discuss this in some more detail outside the list, and then report back to the list once we've got something? Regards Simon On 11 Apr 2012, at 13:33, Gleb Peregud wrote: > On Wed, Apr 11, 2012 at 11:11, Simon Thompson wrote: >> Thanks for all the interest in vim ? we'd be very happy to help anyone who is keen to integrate Wrangler into vim, or indeed other editors. >> >> Kind regards >> Huiqing and SImon > > Is there any way to make wrangler-search-path dynamic depending on the > project I'm currently editing? I work with few projects on day to day > basis and it is pretty tedious to change wrangler-search-path whenever > I switch. Some of them are even pretty comples, so some sort with > rebar would be perfect! > > I was wondering about adding get-wrangler-search-path in > wrangler.el.src and replacing wranger-search-path with it everywhere > in wrangler and advising this function to return results based on > detected project root (e.g. by finding rebar.config). Is this a viable > approach? Does Wrangler / Emacs provide other ways which I'm > overlooking? Simon Thompson | Professor of Logic and Computation School of Computing | University of Kent | Canterbury, CT2 7NF, UK s.j.thompson@REDACTED | M +44 7986 085754 | W www.cs.kent.ac.uk/~sjt From msegalis@REDACTED Wed Apr 11 15:23:40 2012 From: msegalis@REDACTED (Morgan Segalis) Date: Wed, 11 Apr 2012 15:23:40 +0200 Subject: [erlang-questions] Erlang accepting SSL connection is really slow (comparing to C++) In-Reply-To: <20120411123801.GA14814@ioctl> References: <201204102039.q3AKdIbs006704@pluto.hedeland.org> <20120411123801.GA14814@ioctl> Message-ID: Thanks Michael !! that is it? Everything works fine, now, it is even faster than the C++ code? Problem solved on my part ! Long live Erlang ! Le 11 avr. 2012 ? 14:38, Michael Santos a ?crit : > On Wed, Apr 11, 2012 at 12:39:02PM +0200, Morgan Segalis wrote: >> All this discussion made me think? >> >> It cannot be possible that this difference between C++ and Erlang is coming from SSL. >> Like said Per, It may not be 100% C++, but slightly different only. >> Ok the ciphers might be responsible for a little lag, but here I'm using the same on C++ and Erlang : >> >> AES256-SHA >> >> And I spotted something. >> While my 10K test, I'm trying to connect manually, like I wrote in my first email. >> >> openssl s_client -ssl3 -ign_eof -connect myserver:4242 >> >> When it is very long (one of the 3 cases)? the "CONNECTED(00000003)" >> that should appear between the connection and the handshake, does not. >> >> I'm sorry to realize that only now, but that means that it is not the SSL handshake that takes time, but really the connection itself. >> >> I'm not really sure where it could come from, but i'm starting to think that it may come from something like the max open file possible in erlang, or something like that? > > What's the backlog on the listening socket set to? The docs say the > default is 5. > >> Le 11 avr. 2012 ? 10:53, Ingela Andin a ?crit : >> >>> Hi! >>> >>> Of course we need to continue investigating this, as for the patch >>> that Per is talking about see comment below. >>> >>> 2012/4/10 Per Hedeland : >>>> SEGALIS Morgan wrote: >>>>> >>>>> While it will take 10 second to a ssl accepting bit of C++ code to accept >>>>> all of them (which don't even have multiple accept pending), in Erlang this >>>>> is quite different. It will accept at most 20 connections a second >>>>> (according to netstat info, whilst C++ accept more like 1K connection per >>>>> seconds) >>>> >>>> As has already been pointed out, a) the DH-based cipher suites make for >>>> a very slow (mainly due to high CPU usage) handshake, and b) you need to >>>> check the selected cipher in your benchmarking to determine if one of >>>> these is being used. If you don't see any difference when disabling >>>> them, have you verified that they aren't being used? (I.e. maybe you are >>>> doing a mistake when disabling...) >>>> >>>> I'd just like to point out that the current OTP ssl implementation may >>>> end up using one of the DH-based suites "by default", while typical >>>> C/C++ + OpenSSL implementations (including the "old" ssl_esock-based OTP >>>> implementation) will not, since it requires a bit of extra work to make >>>> OpenSSL use them. >>>> >>>> Another reason for the handshake slowness, if you are using a >>>> suite/certificate with RSA authentication (pretty much the norm), is >>>> that the RSA signing operation is some 3-4 times slower than it need be >>>> with the current OTP ssl implementation. I reported this in >>>> http://erlang.org/pipermail/erlang-questions/2012-March/064925.html and >>>> subsequently found the cause, which is that a number of private key >>>> parameters aren't used even though they are available - to quote the >>>> OpenSSL rsa(3) man page: >>>> >>>> p, q, dmp1, dmq1 and iqmp may be NULL in private keys, but the RSA >>>> operations are much faster when these values are available. >>>> >>>> - "much" is an understatement I think.:-) >>>> >>>> I've recently submitted an "informal" patch fixing this to the OTP >>>> group, Ingela may be able to comment (or not:-) on when it might make it >>>> into the release. If you're desperate I can provide the patch off-list, >>>> it's not overly complex. But this issue alone can definitely not explain >>>> the difference you are seeing. >>> >>> I am not in a position to make any promises, but it is a fairly easy >>> patch and the plan is to include it for R15B02. We did not want to >>> try and force it in to R15B01 after the deadline. Late fixes are >>> seldom a good idea even when they feel trivial. >>> >>>> Finally I'll point out that while the SSL protocol implementation is >>>> indeed implemented in Erlang now, all the "heavy crypto work" is still >>>> done in OpenSSL's libcrypto, with a "thin" NIF interface in between. The >>>> net result is probably a bit slower than 100% C/C++, but it shouldn't >>>> (need to) be anywhere near what you report. (The good part is, of >>>> course, that the implementation can make use of the Erlang/beam >>>> concurrency support, instead of the hairy pthread stuff you need to use >>>> for OpenSSL's libssl.) >>> >>> There are lots of gains doing things in Erlang instead of C/C++. >>> Eaiser to maintain, portable, quicker to implement new features, can >>> gain multicore benefits etc. Even though C/C++ will be faster for the >>> small sequential-benchmarks it is far from certain it will be the >>> quickest in the bigger picture parallell world. I will continue >>> investegation your findings to see if there are any improvments we >>> can make to erlang-ssl. >>> >>> Regards Ingela Erlang/OTP team - Ericsson AB >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions From aleksandr.vin@REDACTED Wed Apr 11 16:23:17 2012 From: aleksandr.vin@REDACTED (Aleksandr Vinokurov) Date: Wed, 11 Apr 2012 18:23:17 +0400 Subject: [erlang-questions] Cowboy, Mochiweb or Webmachine Message-ID: Hi all, I'm looking for a Web framework to use for OAuth 2.0 implementation. And I've heard for Cowboy, Mochiweb and Webmachine in a Web context discussions. Can you describe their differences in short words (if it is available) or give me a hint in what order to try them? PS. I've also heard of Chicago Boss but it seems to be very big for my task, am I right? With best regards, Aleksandr Vinokurov @aleksandrvin -------------- next part -------------- An HTML attachment was scrubbed... URL: From antoine.koener@REDACTED Wed Apr 11 16:35:39 2012 From: antoine.koener@REDACTED (Antoine Koener) Date: Wed, 11 Apr 2012 16:35:39 +0200 Subject: [erlang-questions] Erlang accepting SSL connection is really slow (comparing to C++) In-Reply-To: References: <201204102039.q3AKdIbs006704@pluto.hedeland.org> <20120411123801.GA14814@ioctl> Message-ID: Could you please share with us what was the problem ? The backlog ? What value, 5 or more ? Thank you On 11 avr. 2012, at 15:23, Morgan Segalis wrote: > Thanks Michael !! > > that is it? > Everything works fine, now, it is even faster than the C++ code? > > Problem solved on my part ! > > Long live Erlang ! > > Le 11 avr. 2012 ? 14:38, Michael Santos a ?crit : > >> On Wed, Apr 11, 2012 at 12:39:02PM +0200, Morgan Segalis wrote: >>> All this discussion made me think? >>> >>> It cannot be possible that this difference between C++ and Erlang is coming from SSL. >>> Like said Per, It may not be 100% C++, but slightly different only. >>> Ok the ciphers might be responsible for a little lag, but here I'm using the same on C++ and Erlang : >>> >>> AES256-SHA >>> >>> And I spotted something. >>> While my 10K test, I'm trying to connect manually, like I wrote in my first email. >>> >>> openssl s_client -ssl3 -ign_eof -connect myserver:4242 >>> >>> When it is very long (one of the 3 cases)? the "CONNECTED(00000003)" >>> that should appear between the connection and the handshake, does not. >>> >>> I'm sorry to realize that only now, but that means that it is not the SSL handshake that takes time, but really the connection itself. >>> >>> I'm not really sure where it could come from, but i'm starting to think that it may come from something like the max open file possible in erlang, or something like that? >> >> What's the backlog on the listening socket set to? The docs say the >> default is 5. >> >>> Le 11 avr. 2012 ? 10:53, Ingela Andin a ?crit : >>> >>>> Hi! >>>> >>>> Of course we need to continue investigating this, as for the patch >>>> that Per is talking about see comment below. >>>> >>>> 2012/4/10 Per Hedeland : >>>>> SEGALIS Morgan wrote: >>>>>> >>>>>> While it will take 10 second to a ssl accepting bit of C++ code to accept >>>>>> all of them (which don't even have multiple accept pending), in Erlang this >>>>>> is quite different. It will accept at most 20 connections a second >>>>>> (according to netstat info, whilst C++ accept more like 1K connection per >>>>>> seconds) >>>>> >>>>> As has already been pointed out, a) the DH-based cipher suites make for >>>>> a very slow (mainly due to high CPU usage) handshake, and b) you need to >>>>> check the selected cipher in your benchmarking to determine if one of >>>>> these is being used. If you don't see any difference when disabling >>>>> them, have you verified that they aren't being used? (I.e. maybe you are >>>>> doing a mistake when disabling...) >>>>> >>>>> I'd just like to point out that the current OTP ssl implementation may >>>>> end up using one of the DH-based suites "by default", while typical >>>>> C/C++ + OpenSSL implementations (including the "old" ssl_esock-based OTP >>>>> implementation) will not, since it requires a bit of extra work to make >>>>> OpenSSL use them. >>>>> >>>>> Another reason for the handshake slowness, if you are using a >>>>> suite/certificate with RSA authentication (pretty much the norm), is >>>>> that the RSA signing operation is some 3-4 times slower than it need be >>>>> with the current OTP ssl implementation. I reported this in >>>>> http://erlang.org/pipermail/erlang-questions/2012-March/064925.html and >>>>> subsequently found the cause, which is that a number of private key >>>>> parameters aren't used even though they are available - to quote the >>>>> OpenSSL rsa(3) man page: >>>>> >>>>> p, q, dmp1, dmq1 and iqmp may be NULL in private keys, but the RSA >>>>> operations are much faster when these values are available. >>>>> >>>>> - "much" is an understatement I think.:-) >>>>> >>>>> I've recently submitted an "informal" patch fixing this to the OTP >>>>> group, Ingela may be able to comment (or not:-) on when it might make it >>>>> into the release. If you're desperate I can provide the patch off-list, >>>>> it's not overly complex. But this issue alone can definitely not explain >>>>> the difference you are seeing. >>>> >>>> I am not in a position to make any promises, but it is a fairly easy >>>> patch and the plan is to include it for R15B02. We did not want to >>>> try and force it in to R15B01 after the deadline. Late fixes are >>>> seldom a good idea even when they feel trivial. >>>> >>>>> Finally I'll point out that while the SSL protocol implementation is >>>>> indeed implemented in Erlang now, all the "heavy crypto work" is still >>>>> done in OpenSSL's libcrypto, with a "thin" NIF interface in between. The >>>>> net result is probably a bit slower than 100% C/C++, but it shouldn't >>>>> (need to) be anywhere near what you report. (The good part is, of >>>>> course, that the implementation can make use of the Erlang/beam >>>>> concurrency support, instead of the hairy pthread stuff you need to use >>>>> for OpenSSL's libssl.) >>>> >>>> There are lots of gains doing things in Erlang instead of C/C++. >>>> Eaiser to maintain, portable, quicker to implement new features, can >>>> gain multicore benefits etc. Even though C/C++ will be faster for the >>>> small sequential-benchmarks it is far from certain it will be the >>>> quickest in the bigger picture parallell world. I will continue >>>> investegation your findings to see if there are any improvments we >>>> can make to erlang-ssl. >>>> >>>> Regards Ingela Erlang/OTP team - Ericsson AB >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From andre@REDACTED Wed Apr 11 17:05:58 2012 From: andre@REDACTED (=?ISO-8859-1?Q?Andr=E9_Graf?=) Date: Wed, 11 Apr 2012 17:05:58 +0200 Subject: [erlang-questions] Cowboy, Mochiweb or Webmachine In-Reply-To: References: Message-ID: Hi Aleksandr Webmachine is a REST-layer on top of the HTTP server mochiweb. So if you don't need a full-blown REST stack you could also use stand-alone mochiweb. Cowboy is a HTTP server similar to mochiweb, but coming with several different handlers, simply enabling REST (through REST protocol upgrade) and HTML5 Websockets. You can also easily implement your own protocols on top of the Cowboy TCP acceptor. Webmachines documentation is much better than cowboys. But both are coming with pretty good examples. If you need HTML5 websockets I think cowboy is the way to go. I used the OAuth library https://github.com/tim/erlang-oauth with Webmachine as well as Cowboy, so no problems there. Chicago Boss is a Webframework similar to the Python based Django and the Ruby on Rails. It uses mochiweb or the misultin HTTP server under the hood. Cheers Andr? On 11 April 2012 16:23, Aleksandr Vinokurov wrote: > > > Hi all, > > I'm looking for a Web framework to use for OAuth 2.0 implementation. And > I've heard for?Cowboy, Mochiweb and Webmachine in a Web context discussions. > > Can you describe their differences in short words (if it is available) or > give me a hint in what order to try them? > > PS. I've also heard of Chicago Boss but it seems to be very big for my task, > am I right? > > With best regards, > Aleksandr Vinokurov > @aleksandrvin > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From andrew@REDACTED Wed Apr 11 17:13:42 2012 From: andrew@REDACTED (Andrew Thompson) Date: Wed, 11 Apr 2012 11:13:42 -0400 Subject: [erlang-questions] Strange behaviour of SSL verify depth option In-Reply-To: References: <20120410223623.GD28476@hijacked.us> Message-ID: <20120411151342.GE28476@hijacked.us> On Wed, Apr 11, 2012 at 01:12:51PM +0200, Ingela Andin wrote: > Humm... maybe this could be expressed clearer (that phrasing has been > around for a while) > > The depth is the maximum number of non-self-issued intermediate > certificates that may follow the > peer certificate in a valid certification path. So if depth is 0 the > PEER must be signed by the trusted ROOT-CA directly, if 1 the path > can be PEER, CA, ROOT-CA, if it is 2 PEER, CA, CA, ROOT-CA and so on. Ok, that makes a LOT more sense. I'd definitely recommend clarifying the documentation. Thanks, Andrew From msegalis@REDACTED Wed Apr 11 17:22:49 2012 From: msegalis@REDACTED (Morgan Segalis) Date: Wed, 11 Apr 2012 17:22:49 +0200 Subject: [erlang-questions] Erlang accepting SSL connection is really slow (comparing to C++) In-Reply-To: References: <201204102039.q3AKdIbs006704@pluto.hedeland.org> <20120411123801.GA14814@ioctl> Message-ID: <53313C4A-34FF-4E80-A149-8A056569278E@gmail.com> Hi Antoine, Indeed the backlog was slowing the whole thing. It was set at 5 by default, I have changed it to SOMAXCONN and everything came in order. Thank you all ! Le 11 avr. 2012 ? 16:35, Antoine Koener a ?crit : > Could you please share with us what was the problem ? > The backlog ? What value, 5 or more ? > > Thank you > > > On 11 avr. 2012, at 15:23, Morgan Segalis wrote: > >> Thanks Michael !! >> >> that is it? >> Everything works fine, now, it is even faster than the C++ code? >> >> Problem solved on my part ! >> >> Long live Erlang ! >> >> Le 11 avr. 2012 ? 14:38, Michael Santos a ?crit : >> >>> On Wed, Apr 11, 2012 at 12:39:02PM +0200, Morgan Segalis wrote: >>>> All this discussion made me think? >>>> >>>> It cannot be possible that this difference between C++ and Erlang is coming from SSL. >>>> Like said Per, It may not be 100% C++, but slightly different only. >>>> Ok the ciphers might be responsible for a little lag, but here I'm using the same on C++ and Erlang : >>>> >>>> AES256-SHA >>>> >>>> And I spotted something. >>>> While my 10K test, I'm trying to connect manually, like I wrote in my first email. >>>> >>>> openssl s_client -ssl3 -ign_eof -connect myserver:4242 >>>> >>>> When it is very long (one of the 3 cases)? the "CONNECTED(00000003)" >>>> that should appear between the connection and the handshake, does not. >>>> >>>> I'm sorry to realize that only now, but that means that it is not the SSL handshake that takes time, but really the connection itself. >>>> >>>> I'm not really sure where it could come from, but i'm starting to think that it may come from something like the max open file possible in erlang, or something like that? >>> >>> What's the backlog on the listening socket set to? The docs say the >>> default is 5. >>> >>>> Le 11 avr. 2012 ? 10:53, Ingela Andin a ?crit : >>>> >>>>> Hi! >>>>> >>>>> Of course we need to continue investigating this, as for the patch >>>>> that Per is talking about see comment below. >>>>> >>>>> 2012/4/10 Per Hedeland : >>>>>> SEGALIS Morgan wrote: >>>>>>> >>>>>>> While it will take 10 second to a ssl accepting bit of C++ code to accept >>>>>>> all of them (which don't even have multiple accept pending), in Erlang this >>>>>>> is quite different. It will accept at most 20 connections a second >>>>>>> (according to netstat info, whilst C++ accept more like 1K connection per >>>>>>> seconds) >>>>>> >>>>>> As has already been pointed out, a) the DH-based cipher suites make for >>>>>> a very slow (mainly due to high CPU usage) handshake, and b) you need to >>>>>> check the selected cipher in your benchmarking to determine if one of >>>>>> these is being used. If you don't see any difference when disabling >>>>>> them, have you verified that they aren't being used? (I.e. maybe you are >>>>>> doing a mistake when disabling...) >>>>>> >>>>>> I'd just like to point out that the current OTP ssl implementation may >>>>>> end up using one of the DH-based suites "by default", while typical >>>>>> C/C++ + OpenSSL implementations (including the "old" ssl_esock-based OTP >>>>>> implementation) will not, since it requires a bit of extra work to make >>>>>> OpenSSL use them. >>>>>> >>>>>> Another reason for the handshake slowness, if you are using a >>>>>> suite/certificate with RSA authentication (pretty much the norm), is >>>>>> that the RSA signing operation is some 3-4 times slower than it need be >>>>>> with the current OTP ssl implementation. I reported this in >>>>>> http://erlang.org/pipermail/erlang-questions/2012-March/064925.html and >>>>>> subsequently found the cause, which is that a number of private key >>>>>> parameters aren't used even though they are available - to quote the >>>>>> OpenSSL rsa(3) man page: >>>>>> >>>>>> p, q, dmp1, dmq1 and iqmp may be NULL in private keys, but the RSA >>>>>> operations are much faster when these values are available. >>>>>> >>>>>> - "much" is an understatement I think.:-) >>>>>> >>>>>> I've recently submitted an "informal" patch fixing this to the OTP >>>>>> group, Ingela may be able to comment (or not:-) on when it might make it >>>>>> into the release. If you're desperate I can provide the patch off-list, >>>>>> it's not overly complex. But this issue alone can definitely not explain >>>>>> the difference you are seeing. >>>>> >>>>> I am not in a position to make any promises, but it is a fairly easy >>>>> patch and the plan is to include it for R15B02. We did not want to >>>>> try and force it in to R15B01 after the deadline. Late fixes are >>>>> seldom a good idea even when they feel trivial. >>>>> >>>>>> Finally I'll point out that while the SSL protocol implementation is >>>>>> indeed implemented in Erlang now, all the "heavy crypto work" is still >>>>>> done in OpenSSL's libcrypto, with a "thin" NIF interface in between. The >>>>>> net result is probably a bit slower than 100% C/C++, but it shouldn't >>>>>> (need to) be anywhere near what you report. (The good part is, of >>>>>> course, that the implementation can make use of the Erlang/beam >>>>>> concurrency support, instead of the hairy pthread stuff you need to use >>>>>> for OpenSSL's libssl.) >>>>> >>>>> There are lots of gains doing things in Erlang instead of C/C++. >>>>> Eaiser to maintain, portable, quicker to implement new features, can >>>>> gain multicore benefits etc. Even though C/C++ will be faster for the >>>>> small sequential-benchmarks it is far from certain it will be the >>>>> quickest in the bigger picture parallell world. I will continue >>>>> investegation your findings to see if there are any improvments we >>>>> can make to erlang-ssl. >>>>> >>>>> Regards Ingela Erlang/OTP team - Ericsson AB >>>> >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-questions >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions From heinz@REDACTED Wed Apr 11 18:20:08 2012 From: heinz@REDACTED (Heinz N. Gies) Date: Wed, 11 Apr 2012 18:20:08 +0200 Subject: [erlang-questions] BERT encoding and WebSocket In-Reply-To: <3516e246-0cf8-4748-8646-6b4ce1f57557@z3g2000pbn.googlegroups.com> References: <3516e246-0cf8-4748-8646-6b4ce1f57557@z3g2000pbn.googlegroups.com> Message-ID: <0D48BDBF-1A6A-4F49-A59C-A585A3AA8D95@licenser.net> I was thinking about the same, after some testing I went to use JSON it was smaller then BERT+base64 for my cases without it I had problems with transmissions. Regards, Heinz -- Heinz N. Gies heinz@REDACTED http://licenser.net On Apr 10, 2012, at 04:26, ngocdaothanh wrote: > What is the best way to use BERT encoding (http://bert-rpc.org/) with > WebSocket? > > BERT is binary but WebSocket does not support binary at this moment. > Should I use base64 to encode BERT binary to normal string? Base64 has > 33% overhead (http://en.wikipedia.org/wiki/Base64). How much space can > BERT save compared to JSON? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From marc@REDACTED Wed Apr 11 20:28:21 2012 From: marc@REDACTED (Marc Worrell) Date: Wed, 11 Apr 2012 20:28:21 +0200 Subject: [erlang-questions] [ANN] Zotonic 0.8 released Message-ID: Dear all, Zotonic is a CMS and framework for websites. Zotonic is modular, based on Webmachine and makes use of extended ErlyDTL templates. It is in active use for many web sites. We just released version 0.8 Besides the usual bug fixes, this release contains quite some smaller and larger features. This release also marks the last release before some larger upcoming changes to the HTML framework, the admin interface and the database layer. Read the zotonic blog for the change log. http://zotonic.com/blog/941/version-0-8-0-released As always, Zotonic can be downloaded from google code: http://code.google.com/p/zotonic/downloads/list And the code can be found on GitHub: https://github.com/zotonic/zotonic Kind regards, Arjan Scherpenisse & Marc Worrell on behalf of the Zotonic team -------------- next part -------------- An HTML attachment was scrubbed... URL: From tilman.holschuh@REDACTED Wed Apr 11 22:02:35 2012 From: tilman.holschuh@REDACTED (Tilman Holschuh) Date: Wed, 11 Apr 2012 13:02:35 -0700 Subject: [erlang-questions] Wrangler 1.0 released In-Reply-To: <9FE7C4D7-6865-423C-9C72-344BB4813AB4@kent.ac.uk> References: <4F844FA8.1030305@ninenines.eu> <4F84546A.5090301@ninenines.eu> <9FE7C4D7-6865-423C-9C72-344BB4813AB4@kent.ac.uk> Message-ID: <4F85E35B.7080302@gmail.com> Congratulation on the release! Is there a command line mode that would allow clone detection to run on a CI server? BTW: +1 for a vim mode :) Cheers - Tilman On 12-04-11 02:11 AM, Simon Thompson wrote: > Thanks for all the interest in vim ? we'd be very happy to help anyone who is keen to integrate Wrangler into vim, or indeed other editors. > > Kind regards > > Huiqing and SImon > > > On 11 Apr 2012, at 01:00, Phillip Toland wrote: > >> On Tue, Apr 10, 2012 at 12:03 PM, Andr? Graf wrote: >>> congrats to 1.0, unfortunately not on vim! >>> how much work would it be to port wrangler to vim? I guess there are >>> several vim users who would like to see wrangler support in vim and >>> might also contribute. >> >> I am such a Vim user. +1 >> >> >> >> ~p >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > Simon Thompson | Professor of Logic and Computation > School of Computing | University of Kent | Canterbury, CT2 7NF, UK > s.j.thompson@REDACTED | M +44 7986 085754 | W www.cs.kent.ac.uk/~sjt > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From zabrane3@REDACTED Wed Apr 11 22:05:48 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Wed, 11 Apr 2012 22:05:48 +0200 Subject: [erlang-questions] Wrangler 1.0 released In-Reply-To: <4F85E35B.7080302@gmail.com> References: <4F844FA8.1030305@ninenines.eu> <4F84546A.5090301@ninenines.eu> <9FE7C4D7-6865-423C-9C72-344BB4813AB4@kent.ac.uk> <4F85E35B.7080302@gmail.com> Message-ID: <2E305BF4-728B-4190-836D-5016FECC6FE1@gmail.com> -1 for vim ;-) Regards, Zabrane On Apr 11, 2012, at 10:02 PM, Tilman Holschuh wrote: > Congratulation on the release! > > Is there a command line mode that would allow clone detection to run on a CI server? > > BTW: +1 for a vim mode :) > > Cheers > - Tilman -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Wed Apr 11 22:05:48 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Wed, 11 Apr 2012 22:05:48 +0200 Subject: [erlang-questions] Wrangler 1.0 released In-Reply-To: <4F85E35B.7080302@gmail.com> References: <4F844FA8.1030305@ninenines.eu> <4F84546A.5090301@ninenines.eu> <9FE7C4D7-6865-423C-9C72-344BB4813AB4@kent.ac.uk> <4F85E35B.7080302@gmail.com> Message-ID: <4AE17281-3F74-41C4-B5F6-DAC3F32487DC@gmail.com> -1 for vim ;-) Regards, Zabrane On Apr 11, 2012, at 10:02 PM, Tilman Holschuh wrote: > Congratulation on the release! > > Is there a command line mode that would allow clone detection to run on a CI server? > > BTW: +1 for a vim mode :) > > Cheers > - Tilman -------------- next part -------------- An HTML attachment was scrubbed... URL: From ricardocb48@REDACTED Thu Apr 12 01:03:55 2012 From: ricardocb48@REDACTED (megalomania) Date: Wed, 11 Apr 2012 16:03:55 -0700 (PDT) Subject: [erlang-questions] Help! with gen_server and a chat_server Message-ID: <1334185435630-4550462.post@n4.nabble.com> *Hi all, Im newbie on Erlang and trying lear to use gen_server but i begin to understan that maybe im wrong. Im just trying to making a chat_server with gen_serve, so the idea is a client on an another node could try to login in the chat_server who will be in another node. here is my code: * -module(servidor) . -behavior(gen_server) . % API functions -export([start_link/0, hi/0, login/2, logout/1, times/2, stop/0]). % Callback functions -export([init/1, handle_call/3, handle_info/2, terminate/2, handle_cast/2, code_change/3]). -define(NAME_SERVER, ?MODULE). -define(LOGUEADOS, logeados). start_link() -> gen_server:start_link({local, ?NAME_SERVER}, ?MODULE, [], []).%Se registra el proceso con el nombre del modulo(servidor) hi() -> gen_server:cast(?MODULE, hi) . stop() -> gen_server:cast(?MODULE, stop). login(Nick,Pid) -> gen_server:call(?MODULE, {login, Nick, Pid}). logout(Nick) -> gen_server:call(?MODULE, {logout, Nick}). times(N, M) -> ?MODULE ! {times_request, self(), {N, M}}. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Callback functions implementation %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% init([]) -> {ok, ets:new(?LOGUEADOS, [set])}. terminate(_Reason, _State) -> {_, Tab} = _State, ets:delete(Tab), ok. handle_call({login, Nick, Pid}, _From, _State) -> %% En el login habra que crear una nodo del que haga el login // Para probarlo, miro simplemente si existe en la BD. io:format("Loggin.. y state=~w: ~n", [_State]), BOOL = ets:member(_State, Nick), io:format("The user is online? = ~w ~n", [BOOL]), if BOOL == true -> io:format("~w its already login", [Nick]); true -> ets:insert(_State, {Nick,Pid}), io:format("Login succesful ~n") end, {reply, {login, Nick}, _State}; handle_call({logout, Nick}, _From, _State) -> io:format("Logout...~n", []), ets:delete(_State, Nick). handle_cast(hi, State) -> io:fwrite("\t\tHi!\~n"), {noreply, State} ; handle_cast(stop, _State) -> io:format("Stopped~n", []), {_, Tab} = _State, ets:delete(Tab), {stop, normal, _State} . handle_info({times_request, Pid, {N, M}}, State) -> io:fwrite("\t~w server handling info, request number ~w~n", [?MODULE, State]), Pid ! {times_response, N*M}, {noreply, State} . code_change(_OldVsn, _State, _Extra) -> {ok, _State}. *and then i typed this in one console:* >erl -sname server (server@REDACTED)1> c(servidor). {ok,servidor} (server@REDACTED)2> servidor:start_link(). {ok,<0.45.0>} (server@REDACTED)3> *and then i typed this in another console:* user@REDACTED)25> {servidor,server@REDACTED} ! {servidor,login,irene,777}. {servidor,login,irene,777} (user@REDACTED)26> {servidor,server@REDACTED} ! {servidor,login,irene,777}. {servidor,login,irene,777} (user@REDACTED)27> {servidor,server@REDACTED} ! servidor:call(login,irene,6666). ** exception error: undefined function servidor:call/3 (user@REDACTED)28> {servidor,server@REDACTED} ! servidor:login(irene,6666). ** exception exit: {noproc,{gen_server,call,[servidor,{login,irene,6666}]}} in function gen_server:call/2 (user@REDACTED)29> {servidor,server@REDACTED} ! process_request(login,{irene,2321}). ** exception error: undefined shell command process_request/2 (user@REDACTED)30> {servidor,server@REDACTED} ! {hi}. {hi} (user@REDACTED)31> {servidor,server@REDACTED} ! {async,hi}. *almost or the most of instructions makes server_node crash :(* My question is, what im doing wrong? It is the correct way? -- View this message in context: http://erlang.2086793.n4.nabble.com/Help-with-gen-server-and-a-chat-server-tp4550462p4550462.html Sent from the Erlang Questions mailing list archive at Nabble.com. From rexxe98@REDACTED Thu Apr 12 01:13:17 2012 From: rexxe98@REDACTED (Andrew Berman) Date: Wed, 11 Apr 2012 16:13:17 -0700 Subject: [erlang-questions] Help with Sublime Text 2 Code Completion In-Reply-To: References: Message-ID: Hey all, Been a while since I posed this question, but I'm still stuck on trying to load all the beam files. Is there some magic way to tell the VM to load all the beams in the code path or do I have to loop through the code path and load them all manually? How would I go about doing it that way if that is what is required? Thanks, Andrew On Tue, Mar 6, 2012 at 11:43 PM, Andrew Berman wrote: > All, > > I'm trying to build a plug-in for Sublime Text 2 to do proper Erlang code > completion. My thought is to have a server or node running and then talk > to that node using erl_call. I have it working with the stdlib, but I want > the code completion to be dynamic such that the plug-in tells the remote > node to add code paths. I have that working too, but the issue is loading > the actual modules in the new code path. Since the erlang vm loads modules > only upon access, when I call erlang:loaded() or code:all_loaded(), the > modules added with the new code path do not show. Do I have to loop > through the BEAMs in the new code path and manually load them or is there a > better way to do it? I'm trying to make the completion use a fuzzy search > such that something like "li" brings up all modules with "li" in it which > is why I need to be able to have the entire list of modules loaded already. > > Thanks, > > Andrew > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fritchie@REDACTED Thu Apr 12 04:07:45 2012 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Wed, 11 Apr 2012 21:07:45 -0500 Subject: [erlang-questions] Support for newcomers and the popularity of Erlang In-Reply-To: Message of "Mon, 19 Mar 2012 18:54:35 BST." <9FDE3C40-2713-471F-A7DE-9E9C775034E0@feuerlabs.com> Message-ID: <79653.1334196465@snookles.snookles.com> Wojciech, sorry about wading into a thread so long after it started. Ulf Wiger wrote: uw> OTOH, if all you do is simple get/put, and you need high throughput uw> and excellent fault tolerance, riak will let you scale to levels way uw> beyond what any sane person would attempt with mnesia. My story about alternative distributed databases also starts with Mnesia. Once upon a time, I was asked to prototype a spam cannon that would be capable of sending MMS & SMS messages to every mobile subscriber in a Large Asian Country ... messages of a {cough} public safety nature and manage and store and *not* lose message delivery confirmations, to assist {cough} law enforcement ... in less than one hour. I had a prototype with Mnesia that could handle the workload, but only if everything was perfect. Once Mnesia started writing checkpoints of its ETS-based tables to disk, throughput fell apart and could not recover. If a node failed during the peak workload, the cluster could not survive the additional workload created by rerestarting the failed node. My solution was to write a distributed database that eventually became Hibari(*). And I now work at Basho on Riak(**). Mnesia does some really cool things, but large clusters (where "large" is more than 6 or 8 machines) are very tricky to administer, both for sustaining large volumes of transactions and dealing with network partitions. -Scott (*) See https://github.com/hibari/hibari and https://github.com/hibari/hibari-doc/tree/master/src/hibari Fortunately, we didn't win the contract to build the spam cannon. (**) See https://github.com/basho/riak From ok@REDACTED Thu Apr 12 04:58:12 2012 From: ok@REDACTED (Richard O'Keefe) Date: Thu, 12 Apr 2012 14:58:12 +1200 Subject: [erlang-questions] Fear and Loathing in Programming La La Land In-Reply-To: <4F855B03.6060103@fastmail.fm> References: <4F7CDE52.6030903@fastmail.fm> <4F7D5D9B.9030806@fastmail.fm> <4F7D5F75.8020200@fastmail.fm> <4F7D92F1.3070507@meetinghouse.net> <4F7DD587.4000805@fastmail.fm> <4F7DE780.1020703@meetinghouse.net> <4F7E0194.9030902@fastmail.fm> <723E18E1-FB6A-4794-81BA-F6E9DC5707E2@cs.otago.ac.nz> <4F855B03.6060103@fastmail.fm> Message-ID: <267ECA04-67E9-498F-AF46-A0EC09192395@cs.otago.ac.nz> On 11/04/2012, at 10:20 PM, Jan Burse wrote: > General Questions: > > - Would it be allowed to make a Erlang language realization? There have been at least three other very-close-to-Erlang implementations that saw the light of day: EtoS (Erlang to Scheme) and EC by Maurice Castro of SERC at RMIT (back when there _was_ a SERC). See http://erlang.org/pipermail/erlang-questions/2004-July/012838.html about EC. Hmm; there was also GERL (Geoff's Erlang). I've no idea what Laurie Brown and Maurice Castro are up to these days. I'm aware of a couple of other partial implementations which were never shipped. At various times I've had copies of GERL and ETOS but would have a hard time finding them now; the Real Thing is so hard to keep up with... > - Any legal problems with copyright or so? Doesn't look like it. > - Any ways to certify it, i.e. test suite etc.? That I can't help with. From moxford@REDACTED Thu Apr 12 06:57:21 2012 From: moxford@REDACTED (Mike Oxford) Date: Wed, 11 Apr 2012 21:57:21 -0700 Subject: [erlang-questions] BERT encoding and WebSocket In-Reply-To: <0D48BDBF-1A6A-4F49-A59C-A585A3AA8D95@licenser.net> References: <3516e246-0cf8-4748-8646-6b4ce1f57557@z3g2000pbn.googlegroups.com> <0D48BDBF-1A6A-4F49-A59C-A585A3AA8D95@licenser.net> Message-ID: A truly stripped down binary-protocol can be faster and leaner than JSON, but for web-work JSON is highly preferred. Why? Javascript has zero tools for handling binary data and PHP's binary support is all but non-existent. mochijson2 is a good library for converting between erlang terms and JSON. JSON is more word-y and takes up more bandwidth, sure, but most people aren't uber-optimizing for 56k modems these days (exception: mobile.) The ease of using JSON in Ruby + PHP + javascript + iOS + Android more than makes up for the wire overhead. And it's easier to read tcpdump/pcaps, use existing tools like curl and read native traces/dumps. If you're just using backend server-server, BERT is easier and protobufs is smaller/more efficient. I use JSON on the front, BERT on the back with protobufs for talking to Riak. I deprecated AMF and a custom binary protocol on the front due to the above reasons. -mox On Wed, Apr 11, 2012 at 9:20 AM, Heinz N. Gies wrote: > I was thinking about the same, > after some testing I went to use JSON it was smaller then BERT+base64 for > my cases without it I had problems with transmissions. > > Regards, > Heinz > -- > Heinz N. Gies > heinz@REDACTED > http://licenser.net > > On Apr 10, 2012, at 04:26, ngocdaothanh wrote: > > > What is the best way to use BERT encoding (http://bert-rpc.org/) with > > WebSocket? > > > > BERT is binary but WebSocket does not support binary at this moment. > > Should I use base64 to encode BERT binary to normal string? Base64 has > > 33% overhead (http://en.wikipedia.org/wiki/Base64). How much space can > > BERT save compared to JSON? > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From moxford@REDACTED Thu Apr 12 07:40:42 2012 From: moxford@REDACTED (Mike Oxford) Date: Wed, 11 Apr 2012 22:40:42 -0700 Subject: [erlang-questions] Help! with gen_server and a chat_server In-Reply-To: <1334185435630-4550462.post@n4.nabble.com> References: <1334185435630-4550462.post@n4.nabble.com> Message-ID: Unfortunately there are quite a number of things wrong. =( You should read this: http://www.erlang.org/doc/getting_started/conc_prog.html I would suggest going through the tutorial on http://learnyousomeerlang.com . It's quite good. Here's why your code crashed... *(user@REDACTED)27> {servidor,server@REDACTED} !* *servidor:call(login,irene,6666). ** exception error: undefined function servidor:call/3 * You told it to call servidor:call/3, but that does not exist. You should be using gen_server:call/2 (see below). If it did, it would make the call and try to send the return code to *{servidor,server@REDACTED}* *.* * * *(user@REDACTED)28> {servidor,server@REDACTED} ! servidor:login(irene,6666). ** exception exit: {noproc,{gen_server,call,[servidor,{login,irene,6666}]}} in function gen_server:call/2 * You now called servidor:login/2 locally, which worked but tried to gen_server:call back to itself (via ?MODULE) to do a login. However, servidor is not running on *(user@REDACTED)* ... it's running on * {servidor,server@REDACTED}* *(user@REDACTED)29> {servidor,server@REDACTED} ! process_request(login,{irene,2321}). ** exception error: undefined shell command process_request/2 * You ran this from the shell and it doesn't know about process_request/2. If it did, the return-value from process_request would be shipped to * {servidor,server@REDACTED}* Don't mix ! and call/cast. The receive handlers are slightly different for OTP stuff ({'$gen_cast',Msg,State} and {'$gen_call',From,Msg,State}) which you have to account for. If you're using OTP, use OTP calls and handlers. It's cleaner. Try gen_server:call( {servidor,server@REDACTED}, {login, irene,777} ). Make sure server can login from server ( such as gen_server:call(self(), {login, irene, 777} ... and then scale out to multiple nodes.) -mox On Wed, Apr 11, 2012 at 4:03 PM, megalomania wrote: > *Hi all, > Im newbie on Erlang and trying lear to use gen_server but i begin to > understan that maybe im wrong. > > Im just trying to making a chat_server with gen_serve, so the idea is a > client on an another node could try to login in the chat_server who will be > in another node. > > here is my code: > * > > -module(servidor) . > -behavior(gen_server) . > > % API functions > -export([start_link/0, hi/0, login/2, logout/1, times/2, stop/0]). > > % Callback functions > -export([init/1, handle_call/3, handle_info/2, terminate/2, handle_cast/2, > code_change/3]). > > -define(NAME_SERVER, ?MODULE). > -define(LOGUEADOS, logeados). > > > start_link() -> > gen_server:start_link({local, ?NAME_SERVER}, ?MODULE, [], []).%Se > registra > el proceso con el nombre del modulo(servidor) > > hi() -> > gen_server:cast(?MODULE, hi) . > > stop() -> > gen_server:cast(?MODULE, stop). > > login(Nick,Pid) -> > gen_server:call(?MODULE, {login, Nick, Pid}). > > logout(Nick) -> > gen_server:call(?MODULE, {logout, Nick}). > > times(N, M) -> > ?MODULE ! {times_request, self(), {N, M}}. > > > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > %% Callback functions implementation %% > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > init([]) -> > {ok, ets:new(?LOGUEADOS, [set])}. > > terminate(_Reason, _State) -> > {_, Tab} = _State, > ets:delete(Tab), > ok. > > > handle_call({login, Nick, Pid}, _From, _State) -> > %% En el login habra que crear una nodo del que haga el login // > Para > probarlo, miro simplemente si existe en la BD. > io:format("Loggin.. y state=~w: ~n", [_State]), > BOOL = ets:member(_State, Nick), > io:format("The user is online? = ~w ~n", [BOOL]), > if > BOOL == true -> io:format("~w its already login", [Nick]); > true -> ets:insert(_State, {Nick,Pid}), io:format("Login > succesful ~n") > end, > {reply, {login, Nick}, _State}; > > > handle_call({logout, Nick}, _From, _State) -> > io:format("Logout...~n", []), > ets:delete(_State, Nick). > > > handle_cast(hi, State) -> > io:fwrite("\t\tHi!\~n"), > {noreply, State} ; > > handle_cast(stop, _State) -> > io:format("Stopped~n", []), > {_, Tab} = _State, > ets:delete(Tab), > {stop, normal, _State} . > > > handle_info({times_request, Pid, {N, M}}, State) -> > io:fwrite("\t~w server handling info, request number ~w~n", > [?MODULE, > State]), > Pid ! {times_response, N*M}, > {noreply, State} . > > code_change(_OldVsn, _State, _Extra) -> > {ok, _State}. > > > *and then i typed this in one console:* > > >erl -sname server > (server@REDACTED)1> c(servidor). > {ok,servidor} > (server@REDACTED)2> servidor:start_link(). > {ok,<0.45.0>} > (server@REDACTED)3> > > > *and then i typed this in another console:* > user@REDACTED)25> {servidor,server@REDACTED} ! {servidor,login,irene,777}. > {servidor,login,irene,777} > (user@REDACTED)26> {servidor,server@REDACTED} ! > {servidor,login,irene,777}. > {servidor,login,irene,777} > (user@REDACTED)27> {servidor,server@REDACTED} ! > servidor:call(login,irene,6666). > ** exception error: undefined function servidor:call/3 > (user@REDACTED)28> {servidor,server@REDACTED} ! > servidor:login(irene,6666). > ** exception exit: {noproc,{gen_server,call,[servidor,{login,irene,6666}]}} > in function gen_server:call/2 > (user@REDACTED)29> {servidor,server@REDACTED} ! > process_request(login,{irene,2321}). > ** exception error: undefined shell command process_request/2 > (user@REDACTED)30> {servidor,server@REDACTED} ! {hi}. > {hi} > (user@REDACTED)31> {servidor,server@REDACTED} ! {async,hi}. > > > *almost or the most of instructions makes server_node crash :(* > > My question is, what im doing wrong? It is the correct way? > > > -- > View this message in context: > http://erlang.2086793.n4.nabble.com/Help-with-gen-server-and-a-chat-server-tp4550462p4550462.html > Sent from the Erlang Questions mailing list archive at Nabble.com. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Thu Apr 12 08:18:24 2012 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Thu, 12 Apr 2012 08:18:24 +0200 Subject: [erlang-questions] Help! with gen_server and a chat_server In-Reply-To: <1334185435630-4550462.post@n4.nabble.com> References: <1334185435630-4550462.post@n4.nabble.com> Message-ID: <1334211504.4771.3.camel@seasc1137> Greetings, Your first crash is the function call servidor:call(login,irene,6666). I do not see such a function in the servidor module. Perhaps you have forgotten to add it? After that crash your process is dead (you are linked to it) and nothing will work. bengt On Thu, 2012-04-12 at 01:03 +0200, megalomania wrote: > *Hi all, > Im newbie on Erlang and trying lear to use gen_server but i begin to > understan that maybe im wrong. > > Im just trying to making a chat_server with gen_serve, so the idea is a > client on an another node could try to login in the chat_server who will be > in another node. > > here is my code: > * > > -module(servidor) . > -behavior(gen_server) . > > % API functions > -export([start_link/0, hi/0, login/2, logout/1, times/2, stop/0]). > > % Callback functions > -export([init/1, handle_call/3, handle_info/2, terminate/2, handle_cast/2, > code_change/3]). > > -define(NAME_SERVER, ?MODULE). > -define(LOGUEADOS, logeados). > > > start_link() -> > gen_server:start_link({local, ?NAME_SERVER}, ?MODULE, [], []).%Se registra > el proceso con el nombre del modulo(servidor) > > hi() -> > gen_server:cast(?MODULE, hi) . > > stop() -> > gen_server:cast(?MODULE, stop). > > login(Nick,Pid) -> > gen_server:call(?MODULE, {login, Nick, Pid}). > > logout(Nick) -> > gen_server:call(?MODULE, {logout, Nick}). > > times(N, M) -> > ?MODULE ! {times_request, self(), {N, M}}. > > > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > %% Callback functions implementation %% > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > init([]) -> > {ok, ets:new(?LOGUEADOS, [set])}. > > terminate(_Reason, _State) -> > {_, Tab} = _State, > ets:delete(Tab), > ok. > > > handle_call({login, Nick, Pid}, _From, _State) -> > %% En el login habra que crear una nodo del que haga el login // Para > probarlo, miro simplemente si existe en la BD. > io:format("Loggin.. y state=~w: ~n", [_State]), > BOOL = ets:member(_State, Nick), > io:format("The user is online? = ~w ~n", [BOOL]), > if > BOOL == true -> io:format("~w its already login", [Nick]); > true -> ets:insert(_State, {Nick,Pid}), io:format("Login succesful ~n") > end, > {reply, {login, Nick}, _State}; > > > handle_call({logout, Nick}, _From, _State) -> > io:format("Logout...~n", []), > ets:delete(_State, Nick). > > > handle_cast(hi, State) -> > io:fwrite("\t\tHi!\~n"), > {noreply, State} ; > > handle_cast(stop, _State) -> > io:format("Stopped~n", []), > {_, Tab} = _State, > ets:delete(Tab), > {stop, normal, _State} . > > > handle_info({times_request, Pid, {N, M}}, State) -> > io:fwrite("\t~w server handling info, request number ~w~n", [?MODULE, > State]), > Pid ! {times_response, N*M}, > {noreply, State} . > > code_change(_OldVsn, _State, _Extra) -> > {ok, _State}. > > > *and then i typed this in one console:* > > >erl -sname server > (server@REDACTED)1> c(servidor). > {ok,servidor} > (server@REDACTED)2> servidor:start_link(). > {ok,<0.45.0>} > (server@REDACTED)3> > > > *and then i typed this in another console:* > user@REDACTED)25> {servidor,server@REDACTED} ! {servidor,login,irene,777}. > {servidor,login,irene,777} > (user@REDACTED)26> {servidor,server@REDACTED} ! {servidor,login,irene,777}. > {servidor,login,irene,777} > (user@REDACTED)27> {servidor,server@REDACTED} ! > servidor:call(login,irene,6666). > ** exception error: undefined function servidor:call/3 > (user@REDACTED)28> {servidor,server@REDACTED} ! servidor:login(irene,6666). > ** exception exit: {noproc,{gen_server,call,[servidor,{login,irene,6666}]}} > in function gen_server:call/2 > (user@REDACTED)29> {servidor,server@REDACTED} ! > process_request(login,{irene,2321}). > ** exception error: undefined shell command process_request/2 > (user@REDACTED)30> {servidor,server@REDACTED} ! {hi}. > {hi} > (user@REDACTED)31> {servidor,server@REDACTED} ! {async,hi}. > > > *almost or the most of instructions makes server_node crash :(* > > My question is, what im doing wrong? It is the correct way? > > > -- > View this message in context: http://erlang.2086793.n4.nabble.com/Help-with-gen-server-and-a-chat-server-tp4550462p4550462.html > Sent from the Erlang Questions mailing list archive at Nabble.com. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From erlang@REDACTED Thu Apr 12 08:49:01 2012 From: erlang@REDACTED (Joe Armstrong) Date: Thu, 12 Apr 2012 08:49:01 +0200 Subject: [erlang-questions] BERT encoding and WebSocket In-Reply-To: References: <3516e246-0cf8-4748-8646-6b4ce1f57557@z3g2000pbn.googlegroups.com> <0D48BDBF-1A6A-4F49-A59C-A585A3AA8D95@licenser.net> Message-ID: On Thu, Apr 12, 2012 at 6:57 AM, Mike Oxford wrote: > A truly stripped down binary-protocol can be faster and leaner than JSON, > but for web-work JSON is highly preferred. ?Why? ?Javascript has zero tools > for handling binary data and PHP's binary support is all but non-existent. > mochijson2 is a good library for converting between erlang terms and JSON. > > JSON is more word-y and takes up more bandwidth, sure, but most people > aren't uber-optimizing for 56k modems these days (exception: mobile.) Right but "exception:mobile" is the kicker - we're running out of mobile bandwidth real fast. demand for for mobile bandwidth is growing at a faster rate than supply - and supply is limited by *physics* - as sales of smartphones increase there is more and more pressure on the net - 3G sucks in most city-centers. This means that mobile apps must "weight every byte on golden scales" JSON is *not* highly preferred here - I'd use UINT8INT arrays and huffman encoding and caching if the content is to be future proof. It's not much good making a cross platform app that just won't run in a congested mobile net ... /Joe > The ease of using JSON in Ruby + PHP + javascript + iOS + Android more than > makes up for the wire overhead. ? And it's easier to read tcpdump/pcaps, use > existing tools like curl and read native traces/dumps. > > If you're just using backend server-server, BERT is easier and protobufs is > smaller/more efficient. > > I use JSON on the front, BERT on the back with protobufs for talking to > Riak. ?I deprecated AMF and a custom binary protocol on the front due to the > above reasons. > > -mox > > > On Wed, Apr 11, 2012 at 9:20 AM, Heinz N. Gies wrote: >> >> I was thinking about the same, >> after some testing I went to use JSON it was smaller then BERT+base64 for >> my cases without it I had problems with transmissions. >> >> Regards, >> Heinz >> -- >> Heinz N. Gies >> heinz@REDACTED >> http://licenser.net >> >> On Apr 10, 2012, at 04:26, ngocdaothanh wrote: >> >> > What is the best way to use BERT encoding (http://bert-rpc.org/) with >> > WebSocket? >> > >> > BERT is binary but WebSocket does not support binary at this moment. >> > Should I use base64 to encode BERT binary to normal string? Base64 has >> > 33% overhead (http://en.wikipedia.org/wiki/Base64). How much space can >> > BERT save compared to JSON? >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://erlang.org/mailman/listinfo/erlang-questions >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From ok@REDACTED Thu Apr 12 08:56:34 2012 From: ok@REDACTED (Richard O'Keefe) Date: Thu, 12 Apr 2012 18:56:34 +1200 Subject: [erlang-questions] Fear and Loathing in Programming La La Land In-Reply-To: <267ECA04-67E9-498F-AF46-A0EC09192395@cs.otago.ac.nz> References: <4F7CDE52.6030903@fastmail.fm> <4F7D5D9B.9030806@fastmail.fm> <4F7D5F75.8020200@fastmail.fm> <4F7D92F1.3070507@meetinghouse.net> <4F7DD587.4000805@fastmail.fm> <4F7DE780.1020703@meetinghouse.net> <4F7E0194.9030902@fastmail.fm> <723E18E1-FB6A-4794-81BA-F6E9DC5707E2@cs.otago.ac.nz> <4F855B03.6060103@fastmail.fm> <267ECA04-67E9-498F-AF46-A0EC09192395@cs.otago.ac.nz> Message-ID: <6EB6FA8B-B684-4CBB-9248-A8642520EF53@cs.otago.ac.nz> On 12/04/2012, at 2:58 PM, Richard O'Keefe wrote: > I'm aware of a couple of other partial implementations which were never > shipped. At various times I've had copies of GERL and ETOS but would > have a hard time finding them now; the Real Thing is so hard to keep up > with... I found my copy of GERL. I cannot build it. Solaris 'make' doesn't like the Makefiles. GNU 'gmake' doesn't like them either. Patch the makefiles by hand, and they don't work because the package includes prebuilt code for the wrong architecture, and Make has never counted 'executable is for wrong architecture' as a species of 'needs rebuilding'. Fix that, and it _still_ doesn't work, with a linker error. It doesn't help that the how-to-build-it instructions in the top level directory conflict with the instructions in src. For code released in 1998, the C code is surprisingly not-quite-up-to-C-89. As for the C++ code, well, C++ has changed a lot since then. A less than rewarding 90 minutes. But the code *is* available. From erlang@REDACTED Thu Apr 12 09:03:57 2012 From: erlang@REDACTED (Joe Armstrong) Date: Thu, 12 Apr 2012 09:03:57 +0200 Subject: [erlang-questions] Fear and Loathing in Programming La La Land In-Reply-To: <267ECA04-67E9-498F-AF46-A0EC09192395@cs.otago.ac.nz> References: <4F7CDE52.6030903@fastmail.fm> <4F7D5D9B.9030806@fastmail.fm> <4F7D5F75.8020200@fastmail.fm> <4F7D92F1.3070507@meetinghouse.net> <4F7DD587.4000805@fastmail.fm> <4F7DE780.1020703@meetinghouse.net> <4F7E0194.9030902@fastmail.fm> <723E18E1-FB6A-4794-81BA-F6E9DC5707E2@cs.otago.ac.nz> <4F855B03.6060103@fastmail.fm> <267ECA04-67E9-498F-AF46-A0EC09192395@cs.otago.ac.nz> Message-ID: On Thu, Apr 12, 2012 at 4:58 AM, Richard O'Keefe wrote: > > On 11/04/2012, at 10:20 PM, Jan Burse wrote: > >> General Questions: >> >> - Would it be allowed to make a Erlang language realization? > That's ok - there is a trademark restriction as regards use of the name "Erlang" the reason is we don't want to damage the "brand" ie we don't want there to be implementations of Erlang that are manifestly buggy etc. Implementing everything from scratch would require major effort - the usual path is to implement a backend. You use standard Erlang to compile the Beam code then write a Beam backend. There are Beam backends for the JVM and JavaScript and there is work in progress for JIT'ing beam code. Beam code is essentially "abstract register machine" code - so it actually involves yet another transformation step before it can be executed. The erlang compiler from erlang to beam code does all the pattern matching etc. so what's left is pretty low level - things like bignums, garbage collection, process memory management and scheduling are pushed into the runtime. Implementing Erlang is ticky because, for an implementer it's a mixture of language and OS issues. Implementing non-blocking I/O for example involves lots of nasty low-level code etc. > There have been at least three other very-close-to-Erlang implementations > that saw the light of day: ?EtoS (Erlang to Scheme) and EC by Maurice > Castro of SERC at RMIT (back when there _was_ a SERC). ?See > http://erlang.org/pipermail/erlang-questions/2004-July/012838.html > about EC. ?Hmm; there was also GERL (Geoff's Erlang). ?I've no idea > what Laurie Brown and Maurice Castro are up to these days. > > I'm aware of a couple of other partial implementations which were never > shipped. ?At various times I've had copies of GERL and ETOS but would > have a hard time finding them now; the Real Thing is so hard to keep up > with... > >> - Any legal problems with copyright or so? > > Doesn't look like it. > >> - Any ways to certify it, i.e. test suite etc.? We don't certify implementations - but there is a large test suite bundled in the distribution Cheers /Joe > > That I can't help with. > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From gustav.simonsson@REDACTED Thu Apr 12 09:35:42 2012 From: gustav.simonsson@REDACTED (Gustav Simonsson) Date: Thu, 12 Apr 2012 08:35:42 +0100 (BST) Subject: [erlang-questions] Help with Sublime Text 2 Code Completion In-Reply-To: Message-ID: If you know which modules are in the added code paths you can simply loop over them and load each of them using the functions in the code module. Typically in Erlang systems one knows which modules exist, but if you cannot know that prior to adding a new code path my guess is that you have to search your newly added code paths and use e.g. code:load_file/1 Regards, Gustav Simonsson Sent from my PC ----- Original Message ----- > From: "Andrew Berman" > To: "Erlang Questions" > Sent: Thursday, 12 April, 2012 1:13:17 AM > Subject: Re: [erlang-questions] Help with Sublime Text 2 Code Completion > > > Hey all, > > > Been a while since I posed this question, but I'm still stuck on > trying to load all the beam files. Is there some magic way to tell > the VM to load all the beams in the code path or do I have to loop > through the code path and load them all manually? How would I go > about doing it that way if that is what is required? > > > Thanks, > > > Andrew > > > On Tue, Mar 6, 2012 at 11:43 PM, Andrew Berman < rexxe98@REDACTED > > wrote: > > > All, > > > I'm trying to build a plug-in for Sublime Text 2 to do proper Erlang > code completion. My thought is to have a server or node running and > then talk to that node using erl_call. I have it working with the > stdlib, but I want the code completion to be dynamic such that the > plug-in tells the remote node to add code paths. I have that working > too, but the issue is loading the actual modules in the new code > path. Since the erlang vm loads modules only upon access, when I > call erlang:loaded() or code:all_loaded(), the modules added with > the new code path do not show. Do I have to loop through the BEAMs > in the new code path and manually load them or is there a better way > to do it? I'm trying to make the completion use a fuzzy search such > that something like "li" brings up all modules with "li" in it which > is why I need to be able to have the entire list of modules loaded > already. > > > Thanks, > > > Andrew > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From H.Li@REDACTED Thu Apr 12 10:18:31 2012 From: H.Li@REDACTED (H.Li@REDACTED) Date: Thu, 12 Apr 2012 09:18:31 +0100 (BST) Subject: [erlang-questions] Wrangler 1.0 released In-Reply-To: <4F85E35B.7080302@gmail.com> References: <4F844FA8.1030305@ninenines.eu> <4F84546A.5090301@ninenines.eu> <9FE7C4D7-6865-423C-9C72-344BB4813AB4@kent.ac.uk> <4F85E35B.7080302@gmail.com> Message-ID: > Congratulation on the release! > > Is there a command line mode that would allow clone detection to run on > a CI server? > The clone detection can be run from within an Erlang shell. This is no support for OS command line yet. Regards, Huiqing > BTW: +1 for a vim mode :) > > Cheers > - Tilman > > On 12-04-11 02:11 AM, Simon Thompson wrote: >> Thanks for all the interest in vim we'd be very happy to help anyone >> who is keen to integrate Wrangler into vim, or indeed other editors. >> >> Kind regards >> >> Huiqing and SImon >> >> >> On 11 Apr 2012, at 01:00, Phillip Toland wrote: >> >>> On Tue, Apr 10, 2012 at 12:03 PM, Andr? Graf wrote: >>>> congrats to 1.0, unfortunately not on vim! >>>> how much work would it be to port wrangler to vim? I guess there are >>>> several vim users who would like to see wrangler support in vim and >>>> might also contribute. >>> >>> I am such a Vim user. +1 >>> >>> >>> >>> ~p >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >> >> Simon Thompson | Professor of Logic and Computation >> School of Computing | University of Kent | Canterbury, CT2 7NF, UK >> s.j.thompson@REDACTED | M +44 7986 085754 | W www.cs.kent.ac.uk/~sjt >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From inanun@REDACTED Thu Apr 12 10:35:37 2012 From: inanun@REDACTED (Kyungho Yun) Date: Thu, 12 Apr 2012 17:35:37 +0900 Subject: [erlang-questions] How to speed up mnesia startup? Message-ID: It usually takes 50 minutes to startup mnesia. It is too long. Here is my conditions: - DB exists local - more than 60000 tables - sum size is about 28 Giga Bytes. - most tables created options with record_name, attributes(and record_info()) and disc_only_copies. - startup after normal exit (not crash) - R14B04, no_table_loaders 10000 I've searched many websites, read documents here and other places, changed options. but the elapse of mnesia startup wasn't decrease. Here is what I controlled: - ulimit -n - no_table_loader, +A, +K, +P, +zdbbl, dc_dump_limit - add option local_content when create table - io schedule type finally, I am curious mnesia I/O ability. few blocks/s value(about 2000) is shown in iostat during mnesia startup, but it's very big blocks/s value (bigger than 100000) is shown during copy something. How to speed up mnesia startup? Tell me a clue please. thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From Barys_Ilyushonak@REDACTED Thu Apr 12 10:39:57 2012 From: Barys_Ilyushonak@REDACTED (Ilyushonak Barys) Date: Thu, 12 Apr 2012 08:39:57 +0000 Subject: [erlang-questions] Data structure for domain model Message-ID: Hello, community I?m looking for the best way to represent my domain model in Erlang. I use market information ? trades, orders, etc. I would like to do the following: 1. Create structure and fill it with the data 2. Access specific fields/keys values for implementing business requirements 3. Translate (serialize) the data to external systems (socket, xml, text) Actually, I need a good programming structures to work with. As I see there are two kind of data structures: 1. Records 2. Key-Value storage ? proplist, dict The question. Is there any kind of best practice or design patterns in Erlang how may it be implemented? I?m from OOP world. Maybe I miss something and I should change the way I see it? I have googled it, and can?t find the best answer. Could you please share some info about this theme in Erlang? Also please let me know if this theme is holy war. Best Regards, Barys Ilyushonak Information Technology Division, Troika Dialog _______________________________________________________ The information contained in this message may be privileged and conf idential and protected from disclosure. If you are not the original intended recipient, you are hereby notified that any review, retransmission, dissemination, or other use of, or taking of any action in reliance upon, this information is prohibited. If you have received this communication in error, please notify the sender immediately by replying to this message and delete it from your computer. Thank you for your cooperation. Troika Dialog, Russia. If you need assistance please contact our Contact Center (+7495) 258 0500 or go to www.troika.ru/eng/Contacts/system.wbp -------------- next part -------------- An HTML attachment was scrubbed... URL: From eriksoe@REDACTED Thu Apr 12 11:22:40 2012 From: eriksoe@REDACTED (=?ISO-8859-1?Q?Erik_S=F8e_S=F8rensen?=) Date: Thu, 12 Apr 2012 11:22:40 +0200 Subject: [erlang-questions] Data structure for domain model In-Reply-To: References: Message-ID: Hi there - For what it's worth, I've attempted to write up something about data representation in Erlang - aimed at people who know programming (e.g. in an OOP language), but are uncertain about how to do it in Erlang. Simple data structures are treated in this text: https://github.com/eriksoe/AGttES/blob/master/DataStructures.asciidoc And this is an "Erlang modelling for OOP programmers" intro: https://github.com/eriksoe/AGttES/blob/master/OOP.asciidoc (This one has been less well rendered by Github, alas; you can run it through asciidoc or ask me for a better HTML version.) There are many ways to represent an object in Erlang, depending on its nature. I've tried to sum up the possibilities here, in the form of a table showing when you can use which options: https://github.com/eriksoe/AGttES/blob/master/OOP-overview.asciidoc I'm afraid it's still work-in-progress - I'd be very interested in hearing about both anything that appears to be wrong or incomplete, and any questions it leaves unanswered. Hoping this might help. /Erik Den 12. apr. 2012 10.39 skrev Ilyushonak Barys : > Hello, community**** > > ** ** > > I?m looking for the best way to represent my domain model in Erlang. **** > > I use market information ? trades, orders, etc. I would like to do the > following:**** > > **1. **Create structure and fill it with the data**** > > **2. **Access specific fields/keys values for implementing business > requirements **** > > **3. **Translate (serialize) the data to external systems (socket, > xml, text)**** > > Actually, I need a good programming structures to work with. **** > > ** ** > > As I see there are two kind of data structures:**** > > **1. **Records**** > > **2. **Key-Value storage ? proplist, dict**** > > ** ** > > The question.**** > > Is there any kind of best practice or design patterns in Erlang how may it > be implemented?**** > > ** ** > > I?m from OOP world. Maybe I miss something and I should change the way I > see it? I have googled it, and can?t find the best answer. **** > > Could you please share some info about this theme in Erlang? **** > > Also please let me know if this theme is holy war.**** > > ** ** > > Best Regards,**** > > Barys Ilyushonak**** > > Information Technology Division, Troika Dialog**** > > ** ** > > _______________________________________________________ > > > > The information contained in this message may be privileged and conf > idential and protected from disclosure. If you are not the original > intended recipient, you are hereby notified that any review, > retransmission, dissemination, or other use of, or taking of any action in > reliance upon, this information is prohibited. If you have received this > communication in error, please notify the sender immediately by replying to > this message and delete it from your computer. Thank you for your > cooperation. Troika Dialog, Russia. > > If you need assistance please contact our Contact Center (+7495) 258 0500or go to > www.troika.ru/eng/Contacts/system.wbp > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Thu Apr 12 11:26:30 2012 From: ulf@REDACTED (Ulf Wiger) Date: Thu, 12 Apr 2012 11:26:30 +0200 Subject: [erlang-questions] How to speed up mnesia startup? In-Reply-To: References: Message-ID: <4DD5E107-B488-4A57-B2F6-85B00BBCC8BA@feuerlabs.com> Hmm, the first thing that stands out is the inordinate number of tables. Out of curiosity, I tried figuring out what is considered a reasonable number of tables for other database management systems: - Oracle: over 10,000 tables considered insane (http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:26039880025641) - Postgres: 10,000 tables works fine; practical limit (on ext3) probably 32k (http://blog.endpoint.com/2008/11/10000-databases-on-postgresql-cluster.html) - MySQL Server: no apparent problems (http://stackoverflow.com/questions/610920/maximum-number-of-workable-tables-in-sql-server-and-mysql) There may be some serialization happening that slows down the table loads. Mnesia is not optimized for this many tables. BR, Ulf W On 12 Apr 2012, at 10:35, Kyungho Yun wrote: > It usually takes 50 minutes to startup mnesia. > It is too long. > > Here is my conditions: > - DB exists local > - more than 60000 tables > - sum size is about 28 Giga Bytes. > - most tables created options with record_name, attributes(and record_info()) and disc_only_copies. > - startup after normal exit (not crash) > - R14B04, no_table_loaders 10000 > > I've searched many websites, read documents here and other places, changed options. > but the elapse of mnesia startup wasn't decrease. > > Here is what I controlled: > - ulimit -n > - no_table_loader, +A, +K, +P, +zdbbl, dc_dump_limit > - add option local_content when create table > - io schedule type > > finally, I am curious mnesia I/O ability. > few blocks/s value(about 2000) is shown in iostat during mnesia startup, > but it's very big blocks/s value (bigger than 100000) is shown during copy something. > > How to speed up mnesia startup? > Tell me a clue please. > > thanks > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From barcojie@REDACTED Thu Apr 12 12:26:15 2012 From: barcojie@REDACTED (Barco You) Date: Thu, 12 Apr 2012 18:26:15 +0800 Subject: [erlang-questions] Detailed usage about the erl -detached, -remsh, run_erl, to_erl Message-ID: Dear Erlangers, Although erlang doc has descriptions regarding these commands, but it's difficult to know how to use them in practice. I googled but cannot find details of their usage. Hope I can find answers at least for the following issues: 1. by using "erl -detached", if not indicating "-setcookie", how can I connect to this node console by using "-remsh"? 2. After successfully connect to the console of "erl -detached" through "-remsh" how can I quit from the console but keep the node still running which started by "erl -detached"? 3. If use run_erl to start a node, how can I connect to its console through "to_erl"? needing to indicate "-setcookie"? 4. Same as question 2, how to quit the to_erl without interrupting the node started by "run_erl"? 5. What's the difference between these to way to start erl program at backgroud? Appreciate all kinds of answers! Regards, Barco -------------- next part -------------- An HTML attachment was scrubbed... URL: From eriksoe@REDACTED Thu Apr 12 12:39:37 2012 From: eriksoe@REDACTED (=?ISO-8859-1?Q?Erik_S=F8e_S=F8rensen?=) Date: Thu, 12 Apr 2012 12:39:37 +0200 Subject: [erlang-questions] Detailed usage about the erl -detached, -remsh, run_erl, to_erl In-Reply-To: References: Message-ID: Den 12. apr. 2012 12.26 skrev Barco You : > Dear Erlangers, > > Although erlang doc has descriptions regarding these commands, but it's > difficult to know how to use them in practice. > > I googled but cannot find details of their usage. > > Hope I can find answers at least for the following issues: > > 1. by using "erl -detached", if not indicating "-setcookie", how can I > connect to this node console by using "-remsh"? > The default cookie has the value in the file ~/.erlang.cookie. (This file is generated automatically with a random value, in case it doesn't exists.) > 2. After successfully connect to the console of "erl -detached" through > "-remsh" how can I quit from the console but keep the node still running > which started by "erl -detached"? > Ctrl-g, then 'q'. (Or '?' to get a list of options.) 3. If use run_erl to start a node, how can I connect to its console through > "to_erl"? needing to indicate "-setcookie"? > run_erl uses a pipe file for communication. You specify the filename of that pipe when you start to_erl. $ to_erl -help Usage: to_erl [-h|-F] [pipe_name|pipe_dir/] It appears that '/tmp/erlang.pipe' is the default. > 4. Same as question 2, how to quit the to_erl without interrupting the > node started by "run_erl"? > Ctrl-D - which means "end-of-file" on Unix. I don't know if it's different on Windows. 5. What's the difference between these to way to start erl program at > backgroud? > How to attach to them, certainly. And possibly also something about logging. I don't know the complete answer. Appreciate all kinds of answers! The above is mostly of the "off-the-top-of-my-head" kinds :-) /Erik -------------- next part -------------- An HTML attachment was scrubbed... URL: From barcojie@REDACTED Thu Apr 12 12:49:06 2012 From: barcojie@REDACTED (Barco You) Date: Thu, 12 Apr 2012 18:49:06 +0800 Subject: [erlang-questions] Detailed usage about the erl -detached, -remsh, run_erl, to_erl In-Reply-To: References: Message-ID: Hi Erik, Thank you so much for your quick response! At least I can start practicing them now! Barco On Thu, Apr 12, 2012 at 6:39 PM, Erik S?e S?rensen wrote: > Den 12. apr. 2012 12.26 skrev Barco You : > > Dear Erlangers, >> >> Although erlang doc has descriptions regarding these commands, but it's >> difficult to know how to use them in practice. >> >> I googled but cannot find details of their usage. >> >> Hope I can find answers at least for the following issues: >> >> 1. by using "erl -detached", if not indicating "-setcookie", how can I >> connect to this node console by using "-remsh"? >> > The default cookie has the value in the file ~/.erlang.cookie. (This file > is generated automatically with a random value, in case it doesn't exists.) > > >> 2. After successfully connect to the console of "erl -detached" through >> "-remsh" how can I quit from the console but keep the node still running >> which started by "erl -detached"? >> > Ctrl-g, then 'q'. > (Or '?' to get a list of options.) > > 3. If use run_erl to start a node, how can I connect to its console >> through "to_erl"? needing to indicate "-setcookie"? >> > run_erl uses a pipe file for communication. You specify the filename of > that pipe when you start to_erl. > $ to_erl -help > Usage: to_erl [-h|-F] [pipe_name|pipe_dir/] > It appears that '/tmp/erlang.pipe' is the default. > > >> 4. Same as question 2, how to quit the to_erl without interrupting the >> node started by "run_erl"? >> > Ctrl-D - which means "end-of-file" on Unix. I don't know if it's different > on Windows. > > 5. What's the difference between these to way to start erl program at >> backgroud? >> > How to attach to them, certainly. And possibly also something about > logging. I don't know the complete answer. > > Appreciate all kinds of answers! > > > The above is mostly of the "off-the-top-of-my-head" kinds :-) > > /Erik > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From eriksoe@REDACTED Thu Apr 12 12:57:32 2012 From: eriksoe@REDACTED (=?ISO-8859-1?Q?Erik_S=F8e_S=F8rensen?=) Date: Thu, 12 Apr 2012 12:57:32 +0200 Subject: [erlang-questions] Help with Sublime Text 2 Code Completion In-Reply-To: References: Message-ID: Are you sure that you want to *load* all the modules? (Especially in these days, when modules may have 'on_load' hooks which you're probably not interested in running indiscriminately - and which may fail...) An alternative, in case you merely wish to know the list of exported functions from a beam file FileName: {beam_file,ModuleName,Exported0,_,_,_} = beam_disasm:file(FileName). Exported = [{Name,Arity} || {Name,Arity,_} <- Exported0]. Den 12. apr. 2012 09.35 skrev Gustav Simonsson < gustav.simonsson@REDACTED>: > > If you know which modules are in the added code paths you can simply loop > over them and load each of them using the functions in the code module. > > Typically in Erlang systems one knows which modules exist, but if you > cannot know that prior to adding a new code path my guess is that you > have to search your newly added code paths and use e.g. code:load_file/1 > > Regards, > Gustav Simonsson > > Sent from my PC > > ----- Original Message ----- > > From: "Andrew Berman" > > To: "Erlang Questions" > > Sent: Thursday, 12 April, 2012 1:13:17 AM > > Subject: Re: [erlang-questions] Help with Sublime Text 2 Code Completion > > > > > > Hey all, > > > > > > Been a while since I posed this question, but I'm still stuck on > > trying to load all the beam files. Is there some magic way to tell > > the VM to load all the beams in the code path or do I have to loop > > through the code path and load them all manually? How would I go > > about doing it that way if that is what is required? > > > > > > Thanks, > > > > > > Andrew > > > > > > On Tue, Mar 6, 2012 at 11:43 PM, Andrew Berman < rexxe98@REDACTED > > > wrote: > > > > > > All, > > > > > > I'm trying to build a plug-in for Sublime Text 2 to do proper Erlang > > code completion. My thought is to have a server or node running and > > then talk to that node using erl_call. I have it working with the > > stdlib, but I want the code completion to be dynamic such that the > > plug-in tells the remote node to add code paths. I have that working > > too, but the issue is loading the actual modules in the new code > > path. Since the erlang vm loads modules only upon access, when I > > call erlang:loaded() or code:all_loaded(), the modules added with > > the new code path do not show. Do I have to loop through the BEAMs > > in the new code path and manually load them or is there a better way > > to do it? I'm trying to make the completion use a fuzzy search such > > that something like "li" brings up all modules with "li" in it which > > is why I need to be able to have the entire list of modules loaded > > already. > > > > > > Thanks, > > > > > > Andrew > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists.nico.k@REDACTED Thu Apr 12 14:47:50 2012 From: lists.nico.k@REDACTED (Nico Kruber) Date: Thu, 12 Apr 2012 14:47:50 +0200 Subject: [erlang-questions] performance drop in R15A? In-Reply-To: <1936941.jsKPmCgjmJ@csr-pc40.zib.de> References: <1359554.YeRYZETzs8@csr-pc40.zib.de> <1936941.jsKPmCgjmJ@csr-pc40.zib.de> Message-ID: <5828521.xYxjN7VVri@csr-pc40.zib.de> is there any news on this? Our internal test server has a new additional configuration which compiles the latest otp from github once per day and tests its performance with the mentioned benchmarks. The resulting graphs for R14B04, R15B and latest git checkout are attached. As you can see - nothing has changed since then so I suppose it is still present in R15B01 :( I don't know how to debug this any further. If there is anything I could do to help you identify the issue, please tell me. Regards Nico Kruber On Wednesday 14 December 2011 17:41:33 Nico Kruber wrote: > ok, I did some profiling and made some optimisations but the differences > between R15B (git checkout from master just now) and R14B04 are still the > same: > > First the results of the calls to bench:quorum_read(10, 50000) (best of > three) ------------------------------------------------------------ > > | R14B04 | R15B | time surplus > > ------------------------------------------------------------ > timer:tc, smp8:8 | 22484619| 26641737| +18% > timer:tc, smp4:4 | 34009785| 35963489| + 6% > timer:tc, smp2:2 | 32863428| 34102038| + 4% > timer:tc, smpoff | 53805419| 54214795| + 1% > ------------------------------------------------------------ > > It seems there is some lock-contention or some other problem with smp in our > case which hasn't been there before. > I also observed that the results using R15B vary quite much, especially with > smp8:8 (see below for an example). R14B04 is more stable among different > test runs. > But still, even without smp, R15B is slower than R14B04 :( > > Lukas suggested to run fprof to a bit deeper and maybe find the function > taking longer in R15 than in R14B04. > Although it was helpful in finding some hot spots, it did however not help > with this problem. Following are the totals reported by fprof > (if you like, I can send the complete logs - didn't want to send too much to > the mailing list though). > > ------------------------------------------------------------ > > | R14B04 | R15B | time surplus > > ------------------------------------------------------------ > fprof, CNT, smp8:8 | 7723796| 7722635| n/a > fprof, ACC, smp8:8 | 98239| 85477| -13% > fprof, OWN, smp8:8 | 300534| 264018| -12% > ------------------------------------------------------------ > > As you can see, according to fprof, R15B should be faster (but it isn't!). > I assume that some function calls are not reported by fprof > (e.g. I did not see erlang:length/1). > Is there some way to include them again in order to analyse further? > Maybe suspend or garbage_collect are not in ACC or OWN? > But even here, R15B wastes less time as you can see in the table below. > ---------------------------------------------------------- > > | R14B04 | R15B | > > ---------------------------------------------------------- > fprof, suspend, smp8:8 | 9.8421e+06| 8.51855e+06| > fprof, garbage_collect, smp8:8 | 1315| 794| > ---------------------------------------------------------- > > We do rely quite much on the process dictionary (erlang:put and erlang:get) > which you might see as an "non-typical usage pattern" for erlang. > However, if I switch to ets instead, performance of bench:quorum_read(10, > 50000) for R15B does not change and for R14B04 decreases by about 7%. > > Everything else I would consider "typical use" - or at least I'm not aware > of anything untypical. > > I hope, someone can help to further analyse the problem. I did everything I > could think of and are stuck now. > Is other real-world software also affected? E.g. testing couchdb would be > nice. > > > Regards > Nico Kruber > > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > how to re-produce the values > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > I'm using scalaris from http://code.google.com/p/scalaris/ > ./configure && make > ================ R15B =============== > -------------------------------- > ./bin/firstnode.sh > Erlang R15B (erts-5.9) [source] [64-bit] [smp:8:8] [async-threads:0] [hipe] > [kernel-poll:false] > > timer:tc(bench, quorum_read, [10, 50000]). > {33764932,ok} % 1st try > {26641737,ok} % 2nd try > {27575975,ok} % 3rd try > -------------------------------- > ./bin/firstnode.sh "+S4:4" > Erlang R15B (erts-5.9) [source] [64-bit] [smp:4:4] [async-threads:0] [hipe] > [kernel-poll:false] > > timer:tc(bench, quorum_read, [10, 50000]). > {35963489,ok} % 1st try > {36332156,ok} % 2nd try > {37295819,ok} % 3rd try > -------------------------------- > ./bin/firstnode.sh "+S2:2" > Erlang R15B (erts-5.9) [source] [64-bit] [smp:2:2] [async-threads:0] [hipe] > [kernel-poll:false] > > timer:tc(bench, quorum_read, [10, 50000]). > {34102038,ok} % 1st try > {34379052,ok} % 2nd try > {34416173,ok} % 3rd try > -------------------------------- > ./bin/firstnode.sh "-smp disable" > Erlang R15B (erts-5.9) [source] [64-bit] [async-threads:0] [hipe] > [kernel-poll:false] > > timer:tc(bench, quorum_read, [10, 50000]). > {54214795,ok} % 1st try > {55210947,ok} % 2nd try > {54537194,ok} % 3rd try > > ================ R14B04 =============== > -------------------------------- > ./bin/firstnode.sh > Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:8:8] [rq:8] > [async-threads:0] [hipe] [kernel-poll:false] > > timer:tc(bench, quorum_read, [10, 50000]). > {22598819,ok} % 1st try > {22706185,ok} % 2nd try > {22484619,ok} % 3rd try > -------------------------------- > ./bin/firstnode.sh "+S4:4" > Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:4:4] [rq:4] > [async-threads:0] [hipe] [kernel-poll:false] > > timer:tc(bench, quorum_read, [10, 50000]). > {35482368,ok} % 1st try > {34009785,ok} % 2nd try > {34527203,ok} % 3rd try > -------------------------------- > ./bin/firstnode.sh "+S2:2" > Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:2:2] [rq:2] > [async-threads:0] [hipe] [kernel-poll:false] > > timer:tc(bench, quorum_read, [10, 50000]). > {33590356,ok} % 1st try > {33192033,ok} % 2nd try > {32863428,ok} % 3rd try > -------------------------------- > ./bin/firstnode.sh "-smp disable" > Erlang R14B04 (erts-5.8.5) [source] [64-bit] [rq:1] [async-threads:0] [hipe] > [kernel-poll:false] > > timer:tc(bench, quorum_read, [10, 50000]). > {53805419,ok} % 1st try > {54054538,ok} % 2nd try > {54066521,ok} % 3rd try > > > fprof runs: > ./bin/firstnode.sh > > fprof:trace([start, {procs, processes()}]). > bench:quorum_read(10, 1000). > fprof:trace(stop). > fprof:profile(). > fprof:analyse([{dest, "test.R15B.fprof.log"}]). % or R14B04 respectively > > > cat test.R14B04.fprof.log |grep suspend|cut -d',' -f3 | awk '{s+=$1} END > > {print s}' > 9.8421e+06 > > > cat test.R15B.fprof.log |grep suspend|cut -d',' -f3 | awk '{s+=$1} END > > {print s}' > 8.51855e+06 > > > cat test.R14B04.fprof.log |grep garbage_collect|cut -d',' -f3 | awk > > '{s+=$1} END {print s}' > 1315.33 > > > cat test.R15B.fprof.log |grep garbage_collect|cut -d',' -f3 | awk '{s+=$1} > > END {print s}' > 794.956 > > On Friday 09 December 2011 12:09:56 Kenneth Lundin wrote: > > On 12/5/11, Nico Kruber wrote: > > > Is there any news on this? > > > > > > The performance drop of the recent R15 checkout compared to R14B04 in > > > our > > > application is now at _30%_ compared to a drop of "only" 15% in R15A! > > > > When working with R15B we are of course performing a number of > > bencmarks to keep track of the performance. > > > > Whe always strive to improve general performance in each release AND > > OUR BENCHMARKS INDICATE THAT R15B IS FASTER IN GENERAL THAN R14B04. > > > > It is however always possible that some specific operations or > > combinations of operations get slower while others are optimized. > > > > Regarding the findings for this particular application we think the > > reason for slowdown is a very frequent but non typical usage pattern > > that now becomes visible as a performance bottleneck. > > > > > > / Kenneth, Erlang/OTP Ericsson -------------- next part -------------- A non-text attachment was scrubbed... Name: erlang-R15-performance.jpg Type: image/jpeg Size: 58032 bytes Desc: not available URL: From mkimber@REDACTED Thu Apr 12 15:15:10 2012 From: mkimber@REDACTED (Mike Kimber) Date: Thu, 12 Apr 2012 09:15:10 -0400 Subject: [erlang-questions] Make failing on Centos 5.8 for R15B01 Message-ID: I'm trying to build Erlang R15B01 on Centos 5.8. I have done this twice before as a root user on two other servers with out issue. However on this production server I have to use sudo and when I run sudo make I get the following error: === Entering application hipe make[3]: Entering directory `/home/kana/Downloads/otp_src_R15B01/lib/hipe/rtl' (cd ../main && make hipe.hrl) make[4]: Entering directory `/home/kana/Downloads/otp_src_R15B01/lib/hipe/main' sed -e "s;%VSN%;3.9.1;" ../../hipe/main/hipe.hrl.src > ../../hipe/main/hipe.hrl make[4]: Leaving directory `/home/kana/Downloads/otp_src_R15B01/lib/hipe/main' erlc -W +debug_info +inline -o../ebin hipe_rtl.erl pthread/ethr_event.c:98: Fatal error in wait__(): Function not implemented (38) make[3]: *** [../ebin/hipe_rtl.beam] Aborted make[3]: Leaving directory `/home/kana/Downloads/otp_src_R15B01/lib/hipe/rtl' make[2]: *** [opt] Error 2 make[2]: Leaving directory `/home/kana/Downloads/otp_src_R15B01/lib/hipe' make[1]: *** [opt] Error 2 make[1]: Leaving directory `/home/kana/Downloads/otp_src_R15B01/lib' make: *** [secondary_bootstrap_build] Error 2 Any one have any ideas of why I'm getting the above? I've googled and the main work around's seem to be trying different released of Erlang, which as I have already proved it cane b installed on Centos 5.8 I'd rather not have to go back and downgrade my other servers. Thanks Mike -------------- next part -------------- An HTML attachment was scrubbed... URL: From ricardocb48@REDACTED Thu Apr 12 15:22:43 2012 From: ricardocb48@REDACTED (megalomania) Date: Thu, 12 Apr 2012 06:22:43 -0700 (PDT) Subject: [erlang-questions] Comunication between 2 gen_server's Message-ID: <1334236963773-4551836.post@n4.nabble.com> I finally get one gen_server runs in a own node and reply requests of another client nodes, requests of login, logout and sendMesagge and its pretty cool!! thanks for your help guys!! But now i have a doubt, im not sure if the better option for client nodes is be a procces with a mailbox and render the replys OR make an another gen_server but this time for a client node. Which one is the better option and why? -- View this message in context: http://erlang.2086793.n4.nabble.com/Comunication-between-2-gen-server-s-tp4551836p4551836.html Sent from the Erlang Questions mailing list archive at Nabble.com. From lukas@REDACTED Thu Apr 12 15:28:44 2012 From: lukas@REDACTED (Lukas Larsson) Date: Thu, 12 Apr 2012 15:28:44 +0200 Subject: [erlang-questions] Erlang SF Conference 2012 slides In-Reply-To: References: Message-ID: Hello, You can now find my slides here on www.erlang-factory.com. I believe that Patrik's talk was almost identical to the talk he gave in November at the EUC, so you could view his slides from there and the video as well. Lukas On Thu, Apr 5, 2012 at 3:57 PM, Matthew Evans wrote: > Hi, > > Any chance we can get more of the slides published online for us poor folks > who couldn't make it? > > Especially?Patrik Nyblom?and?Lukas Larsson's slides? > > Many thanks > > Matt > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From dmkolesnikov@REDACTED Thu Apr 12 15:32:43 2012 From: dmkolesnikov@REDACTED (dmitry kolesnikov) Date: Thu, 12 Apr 2012 16:32:43 +0300 Subject: [erlang-questions] Make failing on Centos 5.8 for R15B01 In-Reply-To: References: Message-ID: <-8908630575607257640@unknownmsgid> Hello, Try to avoid erlang compilation on production servers. You can use systools to make a self contained tarball with your application at dev node . Best Regards, Dmitry >-|-|-*> On 12.4.2012, at 16.15, Mike Kimber wrote: I?m trying to build Erlang R15B01 on Centos 5.8. I have done this twice before as a root user on two other servers with out issue. However on this production server I have to use sudo and when I run sudo make I get the following error: === Entering application hipe make[3]: Entering directory `/home/kana/Downloads/otp_src_R15B01/lib/hipe/rtl' (cd ../main && make hipe.hrl) make[4]: Entering directory `/home/kana/Downloads/otp_src_R15B01/lib/hipe/main' sed -e "s;%VSN%;3.9.1;" ../../hipe/main/hipe.hrl.src > ../../hipe/main/hipe.hrl make[4]: Leaving directory `/home/kana/Downloads/otp_src_R15B01/lib/hipe/main' erlc -W +debug_info +inline -o../ebin hipe_rtl.erl pthread/ethr_event.c:98: Fatal error in wait__(): Function not implemented (38) make[3]: *** [../ebin/hipe_rtl.beam] Aborted make[3]: Leaving directory `/home/kana/Downloads/otp_src_R15B01/lib/hipe/rtl' make[2]: *** [opt] Error 2 make[2]: Leaving directory `/home/kana/Downloads/otp_src_R15B01/lib/hipe' make[1]: *** [opt] Error 2 make[1]: Leaving directory `/home/kana/Downloads/otp_src_R15B01/lib' make: *** [secondary_bootstrap_build] Error 2 Any one have any ideas of why I?m getting the above? I?ve googled and the main work around?s seem to be trying different released of Erlang, which as I have already proved it cane b installed on Centos 5.8 I?d rather not have to go back and downgrade my other servers. Thanks Mike _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From nc@REDACTED Thu Apr 12 15:36:31 2012 From: nc@REDACTED (Nicolas Charpentier) Date: Thu, 12 Apr 2012 09:36:31 -0400 Subject: [erlang-questions] performance drop in R15A? In-Reply-To: <5828521.xYxjN7VVri@csr-pc40.zib.de> References: <1359554.YeRYZETzs8@csr-pc40.zib.de> <1936941.jsKPmCgjmJ@csr-pc40.zib.de> <5828521.xYxjN7VVri@csr-pc40.zib.de> Message-ID: Hi Nico, According to erts documetation, since OTP R15B, the virtual machine doesn't bind the schedulers to logical processors. I don't know if it's the reason of your performance drop but it might worst looking around the +sbt option. Regards, Nicolas > is there any news on this? > Our internal test server has a new additional configuration which compiles > the > latest otp from github once per day and tests its performance with the > mentioned benchmarks. > The resulting graphs for R14B04, R15B and latest git checkout are > attached. As > you can see - nothing has changed since then so I suppose it is still > present > in R15B01 :( > > I don't know how to debug this any further. If there is anything I could > do to > help you identify the issue, please tell me. > > > Regards > Nico Kruber > > On Wednesday 14 December 2011 17:41:33 Nico Kruber wrote: >> ok, I did some profiling and made some optimisations but the differences >> between R15B (git checkout from master just now) and R14B04 are still >> the >> same: >> >> First the results of the calls to bench:quorum_read(10, 50000) (best of >> three) ------------------------------------------------------------ >> >> | R14B04 | R15B | time surplus >> >> ------------------------------------------------------------ >> timer:tc, smp8:8 | 22484619| 26641737| +18% >> timer:tc, smp4:4 | 34009785| 35963489| + 6% >> timer:tc, smp2:2 | 32863428| 34102038| + 4% >> timer:tc, smpoff | 53805419| 54214795| + 1% >> ------------------------------------------------------------ >> >> It seems there is some lock-contention or some other problem with smp in >> our >> case which hasn't been there before. >> I also observed that the results using R15B vary quite much, especially >> with >> smp8:8 (see below for an example). R14B04 is more stable among different >> test runs. >> But still, even without smp, R15B is slower than R14B04 :( >> >> Lukas suggested to run fprof to a bit deeper and maybe find the function >> taking longer in R15 than in R14B04. >> Although it was helpful in finding some hot spots, it did however not >> help >> with this problem. Following are the totals reported by fprof >> (if you like, I can send the complete logs - didn't want to send too >> much to >> the mailing list though). >> >> ------------------------------------------------------------ >> >> | R14B04 | R15B | time surplus >> >> ------------------------------------------------------------ >> fprof, CNT, smp8:8 | 7723796| 7722635| n/a >> fprof, ACC, smp8:8 | 98239| 85477| -13% >> fprof, OWN, smp8:8 | 300534| 264018| -12% >> ------------------------------------------------------------ >> >> As you can see, according to fprof, R15B should be faster (but it >> isn't!). >> I assume that some function calls are not reported by fprof >> (e.g. I did not see erlang:length/1). >> Is there some way to include them again in order to analyse further? >> Maybe suspend or garbage_collect are not in ACC or OWN? >> But even here, R15B wastes less time as you can see in the table below. >> ---------------------------------------------------------- >> >> | R14B04 | R15B | >> >> ---------------------------------------------------------- >> fprof, suspend, smp8:8 | 9.8421e+06| 8.51855e+06| >> fprof, garbage_collect, smp8:8 | 1315| 794| >> ---------------------------------------------------------- >> >> We do rely quite much on the process dictionary (erlang:put and >> erlang:get) >> which you might see as an "non-typical usage pattern" for erlang. >> However, if I switch to ets instead, performance of >> bench:quorum_read(10, >> 50000) for R15B does not change and for R14B04 decreases by about 7%. >> >> Everything else I would consider "typical use" - or at least I'm not >> aware >> of anything untypical. >> >> I hope, someone can help to further analyse the problem. I did >> everything I >> could think of and are stuck now. >> Is other real-world software also affected? E.g. testing couchdb would >> be >> nice. >> >> >> Regards >> Nico Kruber >> >> >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> how to re-produce the values >> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >> >> I'm using scalaris from http://code.google.com/p/scalaris/ >> ./configure && make >> ================ R15B =============== >> -------------------------------- >> ./bin/firstnode.sh >> Erlang R15B (erts-5.9) [source] [64-bit] [smp:8:8] [async-threads:0] >> [hipe] >> [kernel-poll:false] >> >> timer:tc(bench, quorum_read, [10, 50000]). >> {33764932,ok} % 1st try >> {26641737,ok} % 2nd try >> {27575975,ok} % 3rd try >> -------------------------------- >> ./bin/firstnode.sh "+S4:4" >> Erlang R15B (erts-5.9) [source] [64-bit] [smp:4:4] [async-threads:0] >> [hipe] >> [kernel-poll:false] >> >> timer:tc(bench, quorum_read, [10, 50000]). >> {35963489,ok} % 1st try >> {36332156,ok} % 2nd try >> {37295819,ok} % 3rd try >> -------------------------------- >> ./bin/firstnode.sh "+S2:2" >> Erlang R15B (erts-5.9) [source] [64-bit] [smp:2:2] [async-threads:0] >> [hipe] >> [kernel-poll:false] >> >> timer:tc(bench, quorum_read, [10, 50000]). >> {34102038,ok} % 1st try >> {34379052,ok} % 2nd try >> {34416173,ok} % 3rd try >> -------------------------------- >> ./bin/firstnode.sh "-smp disable" >> Erlang R15B (erts-5.9) [source] [64-bit] [async-threads:0] [hipe] >> [kernel-poll:false] >> >> timer:tc(bench, quorum_read, [10, 50000]). >> {54214795,ok} % 1st try >> {55210947,ok} % 2nd try >> {54537194,ok} % 3rd try >> >> ================ R14B04 =============== >> -------------------------------- >> ./bin/firstnode.sh >> Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:8:8] [rq:8] >> [async-threads:0] [hipe] [kernel-poll:false] >> >> timer:tc(bench, quorum_read, [10, 50000]). >> {22598819,ok} % 1st try >> {22706185,ok} % 2nd try >> {22484619,ok} % 3rd try >> -------------------------------- >> ./bin/firstnode.sh "+S4:4" >> Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:4:4] [rq:4] >> [async-threads:0] [hipe] [kernel-poll:false] >> >> timer:tc(bench, quorum_read, [10, 50000]). >> {35482368,ok} % 1st try >> {34009785,ok} % 2nd try >> {34527203,ok} % 3rd try >> -------------------------------- >> ./bin/firstnode.sh "+S2:2" >> Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:2:2] [rq:2] >> [async-threads:0] [hipe] [kernel-poll:false] >> >> timer:tc(bench, quorum_read, [10, 50000]). >> {33590356,ok} % 1st try >> {33192033,ok} % 2nd try >> {32863428,ok} % 3rd try >> -------------------------------- >> ./bin/firstnode.sh "-smp disable" >> Erlang R14B04 (erts-5.8.5) [source] [64-bit] [rq:1] [async-threads:0] >> [hipe] >> [kernel-poll:false] >> >> timer:tc(bench, quorum_read, [10, 50000]). >> {53805419,ok} % 1st try >> {54054538,ok} % 2nd try >> {54066521,ok} % 3rd try >> >> >> fprof runs: >> ./bin/firstnode.sh >> >> fprof:trace([start, {procs, processes()}]). >> bench:quorum_read(10, 1000). >> fprof:trace(stop). >> fprof:profile(). >> fprof:analyse([{dest, "test.R15B.fprof.log"}]). % or R14B04 respectively >> >> > cat test.R14B04.fprof.log |grep suspend|cut -d',' -f3 | awk '{s+=$1} >> END >> > {print s}' >> 9.8421e+06 >> >> > cat test.R15B.fprof.log |grep suspend|cut -d',' -f3 | awk '{s+=$1} END >> > {print s}' >> 8.51855e+06 >> >> > cat test.R14B04.fprof.log |grep garbage_collect|cut -d',' -f3 | awk >> > '{s+=$1} END {print s}' >> 1315.33 >> >> > cat test.R15B.fprof.log |grep garbage_collect|cut -d',' -f3 | awk >> '{s+=$1} >> > END {print s}' >> 794.956 >> >> On Friday 09 December 2011 12:09:56 Kenneth Lundin wrote: >> > On 12/5/11, Nico Kruber wrote: >> > > Is there any news on this? >> > > >> > > The performance drop of the recent R15 checkout compared to R14B04 >> in >> > > our >> > > application is now at _30%_ compared to a drop of "only" 15% in >> R15A! >> > >> > When working with R15B we are of course performing a number of >> > bencmarks to keep track of the performance. >> > >> > Whe always strive to improve general performance in each release AND >> > OUR BENCHMARKS INDICATE THAT R15B IS FASTER IN GENERAL THAN R14B04. >> > >> > It is however always possible that some specific operations or >> > combinations of operations get slower while others are optimized. >> > >> > Regarding the findings for this particular application we think the >> > reason for slowdown is a very frequent but non typical usage pattern >> > that now becomes visible as a performance bottleneck. >> > >> > >> > / Kenneth, Erlang/OTP >> Ericsson_______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From dmkolesnikov@REDACTED Thu Apr 12 15:49:57 2012 From: dmkolesnikov@REDACTED (dmitry kolesnikov) Date: Thu, 12 Apr 2012 16:49:57 +0300 Subject: [erlang-questions] BERT encoding and WebSocket In-Reply-To: References: <3516e246-0cf8-4748-8646-6b4ce1f57557@z3g2000pbn.googlegroups.com> <0D48BDBF-1A6A-4F49-A59C-A585A3AA8D95@licenser.net> Message-ID: <4376507848652988109@unknownmsgid> Joe, Rightnow, Majority of bandwidth is waisted for in-efficient organization of application data. Containers impact is small (unless XML + SOAP is used) You can use very small and efficient JSON or have fat BERT. My own experience shows that JSON helps to decouple App side from FE in more efficient manner then BERT. But I agree in general that BERT is more suitable fore erlang then JSON Best Regards, Dmitry >-|-|-*> On 12.4.2012, at 9.49, Joe Armstrong wrote: > On Thu, Apr 12, 2012 at 6:57 AM, Mike Oxford wrote: >> A truly stripped down binary-protocol can be faster and leaner than JSON, >> but for web-work JSON is highly preferred. Why? Javascript has zero tools >> for handling binary data and PHP's binary support is all but non-existent. >> mochijson2 is a good library for converting between erlang terms and JSON. >> >> JSON is more word-y and takes up more bandwidth, sure, but most people >> aren't uber-optimizing for 56k modems these days (exception: mobile.) > > Right but "exception:mobile" is the kicker - we're running out of > mobile bandwidth real fast. > demand for for mobile bandwidth is growing at a faster rate than > supply - and supply > is limited by *physics* - as sales of smartphones increase there is > more and more > pressure on the net - 3G sucks in most city-centers. > > This means that mobile apps must "weight every byte on golden scales" > > JSON is *not* highly preferred here - I'd use UINT8INT arrays and > huffman encoding > and caching if the content is to be future proof. It's not much good > making a cross platform > app that just won't run in a congested mobile net ... > > /Joe > > > >> The ease of using JSON in Ruby + PHP + javascript + iOS + Android more than >> makes up for the wire overhead. And it's easier to read tcpdump/pcaps, use >> existing tools like curl and read native traces/dumps. >> >> If you're just using backend server-server, BERT is easier and protobufs is >> smaller/more efficient. >> >> I use JSON on the front, BERT on the back with protobufs for talking to >> Riak. I deprecated AMF and a custom binary protocol on the front due to the >> above reasons. >> >> -mox >> >> >> On Wed, Apr 11, 2012 at 9:20 AM, Heinz N. Gies wrote: >>> >>> I was thinking about the same, >>> after some testing I went to use JSON it was smaller then BERT+base64 for >>> my cases without it I had problems with transmissions. >>> >>> Regards, >>> Heinz >>> -- >>> Heinz N. Gies >>> heinz@REDACTED >>> http://licenser.net >>> >>> On Apr 10, 2012, at 04:26, ngocdaothanh wrote: >>> >>>> What is the best way to use BERT encoding (http://bert-rpc.org/) with >>>> WebSocket? >>>> >>>> BERT is binary but WebSocket does not support binary at this moment. >>>> Should I use base64 to encode BERT binary to normal string? Base64 has >>>> 33% overhead (http://en.wikipedia.org/wiki/Base64). How much space can >>>> BERT save compared to JSON? >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-questions >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From thomasl_erlang@REDACTED Thu Apr 12 16:31:01 2012 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Thu, 12 Apr 2012 07:31:01 -0700 (PDT) Subject: [erlang-questions] Fear and Loathing in Programming La La Land In-Reply-To: References: <4F7CDE52.6030903@fastmail.fm> <4F7D5D9B.9030806@fastmail.fm> <4F7D5F75.8020200@fastmail.fm> <4F7D92F1.3070507@meetinghouse.net> <4F7DD587.4000805@fastmail.fm> <4F7DE780.1020703@meetinghouse.net> <4F7E0194.9030902@fastmail.fm> <723E18E1-FB6A-4794-81BA-F6E9DC5707E2@cs.otago.ac.nz> <4F855B03.6060103@fastmail.fm> <267ECA04-67E9-498F-AF46-A0EC09192395@cs.otago.ac.nz> Message-ID: <1334241061.11699.YahooMailNeo@web111415.mail.gq1.yahoo.com> ----- Original Message ----- > From: Joe Armstrong > > Implementing everything from scratch would require major effort - the usual > path is to implement a backend. You use standard Erlang to compile the Beam code > then write a Beam backend. > > There are Beam backends for the JVM and JavaScript and there is work in progress > for JIT'ing beam code. Didn't we already do JIT 17-18 years ago or so ...? Is Erik Stenman around? :-) Hipe's predecessor Jericho apart, if Hipe still can compile single functions, then write your own profiling tracker, poke Hipe when you think a function ought to be native and presto you have the (admittedly unsophisticated) sibling of what's known as a "method level JIT". Best regards, Thomas From tomas.abrahamsson@REDACTED Thu Apr 12 16:44:48 2012 From: tomas.abrahamsson@REDACTED (Tomas Abrahamsson) Date: Thu, 12 Apr 2012 16:44:48 +0200 Subject: [erlang-questions] performance drop in R15A? In-Reply-To: (Nicolas Charpentier's message of "Thu, 12 Apr 2012 15:36:31 +0200") References: <1359554.YeRYZETzs8@csr-pc40.zib.de> <1936941.jsKPmCgjmJ@csr-pc40.zib.de> <5828521.xYxjN7VVri@csr-pc40.zib.de> Message-ID: > Hi Nico, > According to erts documetation, since OTP R15B, the virtual machine > doesn't bind the schedulers to logical processors. > I don't know if it's the reason of your performance drop but it might > worst looking around the +sbt option. There's also the +scl true|false flag, to "[e]nable or disable scheduler compaction of load", that's new in R15, iirc, but the +sbt option may have more impact. With the particular workload we previously had, when we continued to measure more, it turned out that R15B was actually faster than R14B04 on machines with more CPUs: We had one machine with 2 Xeon X5660 CPUs (24 hyperthreads in total) where R15B was faster. We had another machine with 2 Xeon E5540 CPUs (16 HTs in total) where I think R15B and R14B04 were roughly on par with each other. We also did experiment a bit with the +rg ReaderGroupsLimit option. I think we did set it to be the same as the number of schedulers (online). BRs Tomas >> is there any news on this? >> Our internal test server has a new additional configuration which compiles >> the >> latest otp from github once per day and tests its performance with the >> mentioned benchmarks. >> The resulting graphs for R14B04, R15B and latest git checkout are >> attached. As >> you can see - nothing has changed since then so I suppose it is still >> present >> in R15B01 :( >> >> I don't know how to debug this any further. If there is anything I could >> do to >> help you identify the issue, please tell me. >> >> >> Regards >> Nico Kruber >> >> On Wednesday 14 December 2011 17:41:33 Nico Kruber wrote: >>> ok, I did some profiling and made some optimisations but the differences >>> between R15B (git checkout from master just now) and R14B04 are still >>> the >>> same: >>> >>> First the results of the calls to bench:quorum_read(10, 50000) (best of >>> three) ------------------------------------------------------------ >>> >>> | R14B04 | R15B | time surplus >>> >>> ------------------------------------------------------------ >>> timer:tc, smp8:8 | 22484619| 26641737| +18% >>> timer:tc, smp4:4 | 34009785| 35963489| + 6% >>> timer:tc, smp2:2 | 32863428| 34102038| + 4% >>> timer:tc, smpoff | 53805419| 54214795| + 1% >>> ------------------------------------------------------------ >>> >>> It seems there is some lock-contention or some other problem with smp in >>> our >>> case which hasn't been there before. >>> I also observed that the results using R15B vary quite much, especially >>> with >>> smp8:8 (see below for an example). R14B04 is more stable among different >>> test runs. >>> But still, even without smp, R15B is slower than R14B04 :( >>> >>> Lukas suggested to run fprof to a bit deeper and maybe find the function >>> taking longer in R15 than in R14B04. >>> Although it was helpful in finding some hot spots, it did however not >>> help >>> with this problem. Following are the totals reported by fprof >>> (if you like, I can send the complete logs - didn't want to send too >>> much to >>> the mailing list though). >>> >>> ------------------------------------------------------------ >>> >>> | R14B04 | R15B | time surplus >>> >>> ------------------------------------------------------------ >>> fprof, CNT, smp8:8 | 7723796| 7722635| n/a >>> fprof, ACC, smp8:8 | 98239| 85477| -13% >>> fprof, OWN, smp8:8 | 300534| 264018| -12% >>> ------------------------------------------------------------ >>> >>> As you can see, according to fprof, R15B should be faster (but it >>> isn't!). >>> I assume that some function calls are not reported by fprof >>> (e.g. I did not see erlang:length/1). >>> Is there some way to include them again in order to analyse further? >>> Maybe suspend or garbage_collect are not in ACC or OWN? >>> But even here, R15B wastes less time as you can see in the table below. >>> ---------------------------------------------------------- >>> >>> | R14B04 | R15B | >>> >>> ---------------------------------------------------------- >>> fprof, suspend, smp8:8 | 9.8421e+06| 8.51855e+06| >>> fprof, garbage_collect, smp8:8 | 1315| 794| >>> ---------------------------------------------------------- >>> >>> We do rely quite much on the process dictionary (erlang:put and >>> erlang:get) >>> which you might see as an "non-typical usage pattern" for erlang. >>> However, if I switch to ets instead, performance of >>> bench:quorum_read(10, >>> 50000) for R15B does not change and for R14B04 decreases by about 7%. >>> >>> Everything else I would consider "typical use" - or at least I'm not >>> aware >>> of anything untypical. >>> >>> I hope, someone can help to further analyse the problem. I did >>> everything I >>> could think of and are stuck now. >>> Is other real-world software also affected? E.g. testing couchdb would >>> be >>> nice. >>> >>> >>> Regards >>> Nico Kruber >>> >>> >>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >>> how to re-produce the values >>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >>> >>> I'm using scalaris from http://code.google.com/p/scalaris/ >>> ./configure && make >>> ================ R15B =============== >>> -------------------------------- >>> ./bin/firstnode.sh >>> Erlang R15B (erts-5.9) [source] [64-bit] [smp:8:8] [async-threads:0] >>> [hipe] >>> [kernel-poll:false] >>> >>> timer:tc(bench, quorum_read, [10, 50000]). >>> {33764932,ok} % 1st try >>> {26641737,ok} % 2nd try >>> {27575975,ok} % 3rd try >>> -------------------------------- >>> ./bin/firstnode.sh "+S4:4" >>> Erlang R15B (erts-5.9) [source] [64-bit] [smp:4:4] [async-threads:0] >>> [hipe] >>> [kernel-poll:false] >>> >>> timer:tc(bench, quorum_read, [10, 50000]). >>> {35963489,ok} % 1st try >>> {36332156,ok} % 2nd try >>> {37295819,ok} % 3rd try >>> -------------------------------- >>> ./bin/firstnode.sh "+S2:2" >>> Erlang R15B (erts-5.9) [source] [64-bit] [smp:2:2] [async-threads:0] >>> [hipe] >>> [kernel-poll:false] >>> >>> timer:tc(bench, quorum_read, [10, 50000]). >>> {34102038,ok} % 1st try >>> {34379052,ok} % 2nd try >>> {34416173,ok} % 3rd try >>> -------------------------------- >>> ./bin/firstnode.sh "-smp disable" >>> Erlang R15B (erts-5.9) [source] [64-bit] [async-threads:0] [hipe] >>> [kernel-poll:false] >>> >>> timer:tc(bench, quorum_read, [10, 50000]). >>> {54214795,ok} % 1st try >>> {55210947,ok} % 2nd try >>> {54537194,ok} % 3rd try >>> >>> ================ R14B04 =============== >>> -------------------------------- >>> ./bin/firstnode.sh >>> Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:8:8] [rq:8] >>> [async-threads:0] [hipe] [kernel-poll:false] >>> >>> timer:tc(bench, quorum_read, [10, 50000]). >>> {22598819,ok} % 1st try >>> {22706185,ok} % 2nd try >>> {22484619,ok} % 3rd try >>> -------------------------------- >>> ./bin/firstnode.sh "+S4:4" >>> Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:4:4] [rq:4] >>> [async-threads:0] [hipe] [kernel-poll:false] >>> >>> timer:tc(bench, quorum_read, [10, 50000]). >>> {35482368,ok} % 1st try >>> {34009785,ok} % 2nd try >>> {34527203,ok} % 3rd try >>> -------------------------------- >>> ./bin/firstnode.sh "+S2:2" >>> Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:2:2] [rq:2] >>> [async-threads:0] [hipe] [kernel-poll:false] >>> >>> timer:tc(bench, quorum_read, [10, 50000]). >>> {33590356,ok} % 1st try >>> {33192033,ok} % 2nd try >>> {32863428,ok} % 3rd try >>> -------------------------------- >>> ./bin/firstnode.sh "-smp disable" >>> Erlang R14B04 (erts-5.8.5) [source] [64-bit] [rq:1] [async-threads:0] >>> [hipe] >>> [kernel-poll:false] >>> >>> timer:tc(bench, quorum_read, [10, 50000]). >>> {53805419,ok} % 1st try >>> {54054538,ok} % 2nd try >>> {54066521,ok} % 3rd try >>> >>> >>> fprof runs: >>> ./bin/firstnode.sh >>> >>> fprof:trace([start, {procs, processes()}]). >>> bench:quorum_read(10, 1000). >>> fprof:trace(stop). >>> fprof:profile(). >>> fprof:analyse([{dest, "test.R15B.fprof.log"}]). % or R14B04 respectively >>> >>> > cat test.R14B04.fprof.log |grep suspend|cut -d',' -f3 | awk '{s+=$1} >>> END >>> > {print s}' >>> 9.8421e+06 >>> >>> > cat test.R15B.fprof.log |grep suspend|cut -d',' -f3 | awk '{s+=$1} END >>> > {print s}' >>> 8.51855e+06 >>> >>> > cat test.R14B04.fprof.log |grep garbage_collect|cut -d',' -f3 | awk >>> > '{s+=$1} END {print s}' >>> 1315.33 >>> >>> > cat test.R15B.fprof.log |grep garbage_collect|cut -d',' -f3 | awk >>> '{s+=$1} >>> > END {print s}' >>> 794.956 >>> >>> On Friday 09 December 2011 12:09:56 Kenneth Lundin wrote: >>> > On 12/5/11, Nico Kruber wrote: >>> > > Is there any news on this? >>> > > >>> > > The performance drop of the recent R15 checkout compared to R14B04 >>> in >>> > > our >>> > > application is now at _30%_ compared to a drop of "only" 15% in >>> R15A! >>> > >>> > When working with R15B we are of course performing a number of >>> > bencmarks to keep track of the performance. >>> > >>> > Whe always strive to improve general performance in each release AND >>> > OUR BENCHMARKS INDICATE THAT R15B IS FASTER IN GENERAL THAN R14B04. >>> > >>> > It is however always possible that some specific operations or >>> > combinations of operations get slower while others are optimized. >>> > >>> > Regarding the findings for this particular application we think the >>> > reason for slowdown is a very frequent but non typical usage pattern >>> > that now becomes visible as a performance bottleneck. >>> > >>> > >>> > / Kenneth, Erlang/OTP >>> Ericsson_______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From mkimber@REDACTED Thu Apr 12 17:29:23 2012 From: mkimber@REDACTED (Mike Kimber) Date: Thu, 12 Apr 2012 11:29:23 -0400 Subject: [erlang-questions] Make failing on Centos 5.8 for R15B01 In-Reply-To: <-8908630575607257640@unknownmsgid> References: <-8908630575607257640@unknownmsgid> Message-ID: Ok when I say production I mean it's a development environment controlled by some one else and not the virtualbox and vmware servers I have root access to, but I get and agree with your point although I'm not sure how I package up the three components into a rpm/tar I have built! However I'd still like to understand what this error means and how to resolve it, so if any one has any ideas on how to do this they would be greatly appreciated Thanks Mike ________________________________ From: dmitry kolesnikov [mailto:dmkolesnikov@REDACTED] Sent: 12 April 2012 14:33 To: Mike Kimber Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] Make failing on Centos 5.8 for R15B01 Hello, Try to avoid erlang compilation on production servers. You can use systools to make a self contained tarball with your application at dev node . Best Regards, Dmitry >-|-|-*> On 12.4.2012, at 16.15, Mike Kimber > wrote: I'm trying to build Erlang R15B01 on Centos 5.8. I have done this twice before as a root user on two other servers with out issue. However on this production server I have to use sudo and when I run sudo make I get the following error: === Entering application hipe make[3]: Entering directory `/home/kana/Downloads/otp_src_R15B01/lib/hipe/rtl' (cd ../main && make hipe.hrl) make[4]: Entering directory `/home/kana/Downloads/otp_src_R15B01/lib/hipe/main' sed -e "s;%VSN%;3.9.1;" ../../hipe/main/hipe.hrl.src > ../../hipe/main/hipe.hrl make[4]: Leaving directory `/home/kana/Downloads/otp_src_R15B01/lib/hipe/main' erlc -W +debug_info +inline -o../ebin hipe_rtl.erl pthread/ethr_event.c:98: Fatal error in wait__(): Function not implemented (38) make[3]: *** [../ebin/hipe_rtl.beam] Aborted make[3]: Leaving directory `/home/kana/Downloads/otp_src_R15B01/lib/hipe/rtl' make[2]: *** [opt] Error 2 make[2]: Leaving directory `/home/kana/Downloads/otp_src_R15B01/lib/hipe' make[1]: *** [opt] Error 2 make[1]: Leaving directory `/home/kana/Downloads/otp_src_R15B01/lib' make: *** [secondary_bootstrap_build] Error 2 Any one have any ideas of why I'm getting the above? I've googled and the main work around's seem to be trying different released of Erlang, which as I have already proved it cane b installed on Centos 5.8 I'd rather not have to go back and downgrade my other servers. Thanks Mike _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From attila.r.nohl@REDACTED Thu Apr 12 17:45:01 2012 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Thu, 12 Apr 2012 17:45:01 +0200 Subject: [erlang-questions] Make failing on Centos 5.8 for R15B01 In-Reply-To: References: <-8908630575607257640@unknownmsgid> Message-ID: Hello! Have you checked this: http://stackoverflow.com/questions/5463503/rabbitmq-install-issue-on-centos-5-5 ? There's a patch there. [...] > On 12.4.2012, at 16.15, Mike Kimber wrote: > > I?m trying to build Erlang R15B01 on Centos 5.8. I have done this twice > before as a root user on two other servers with out issue. However on this > production server I have to use sudo and when I run sudo make I get the > following error: > > > > === Entering application hipe > > make[3]: Entering directory > `/home/kana/Downloads/otp_src_R15B01/lib/hipe/rtl' > > (cd ../main && make hipe.hrl) > > make[4]: Entering directory > `/home/kana/Downloads/otp_src_R15B01/lib/hipe/main' > > sed -e "s;%VSN%;3.9.1;" ../../hipe/main/hipe.hrl.src > > ../../hipe/main/hipe.hrl > > make[4]: Leaving directory > `/home/kana/Downloads/otp_src_R15B01/lib/hipe/main' > > erlc -W? +debug_info +inline -o../ebin hipe_rtl.erl > > pthread/ethr_event.c:98: Fatal error in wait__(): Function not implemented > (38) > > make[3]: *** [../ebin/hipe_rtl.beam] Aborted > > make[3]: Leaving directory > `/home/kana/Downloads/otp_src_R15B01/lib/hipe/rtl' > > make[2]: *** [opt] Error 2 > > make[2]: Leaving directory `/home/kana/Downloads/otp_src_R15B01/lib/hipe' > > make[1]: *** [opt] Error 2 > > make[1]: Leaving directory `/home/kana/Downloads/otp_src_R15B01/lib' > > make: *** [secondary_bootstrap_build] Error 2 > > > > > > Any one have any ideas of why I?m getting the above? I?ve googled and the > main work around?s seem to be trying different released of Erlang, which as > I have already proved it cane b installed on Centos 5.8 I?d rather not have > to go back and downgrade my other servers. > > > > Thanks > > > > Mike > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From francesquini@REDACTED Thu Apr 12 17:46:48 2012 From: francesquini@REDACTED (Emilio De Camargo Francesquini) Date: Thu, 12 Apr 2012 17:46:48 +0200 Subject: [erlang-questions] erlang:trace/3 In-Reply-To: <4F842BBC.9050201@erlang.org> References: <4F842BBC.9050201@erlang.org> Message-ID: > I hope this clarifies things. Yes, pretty much. Thanks! From eriksoe@REDACTED Thu Apr 12 18:21:29 2012 From: eriksoe@REDACTED (=?ISO-8859-1?Q?Erik_S=F8e_S=F8rensen?=) Date: Thu, 12 Apr 2012 18:21:29 +0200 Subject: [erlang-questions] Make failing on Centos 5.8 for R15B01 In-Reply-To: References: Message-ID: Can you build Erlang with Hipe disabled, perhaps? I don't know if you're planning on using Hipe, of course, but that component appears to be the stumbling block for the build process. Den 12/04/2012 15.15 skrev "Mike Kimber" : > I?m trying to build Erlang R15B01 on Centos 5.8. I have done this twice > before as a root user on two other servers with out issue. However on this > production server I have to use sudo and when I run sudo make I get the > following error:**** > > ** ** > > === Entering application hipe**** > > make[3]: Entering directory > `/home/kana/Downloads/otp_src_R15B01/lib/hipe/rtl'**** > > (cd ../main && make hipe.hrl)**** > > make[4]: Entering directory > `/home/kana/Downloads/otp_src_R15B01/lib/hipe/main'**** > > sed -e "s;%VSN%;3.9.1;" ../../hipe/main/hipe.hrl.src > > ../../hipe/main/hipe.hrl**** > > make[4]: Leaving directory > `/home/kana/Downloads/otp_src_R15B01/lib/hipe/main'**** > > erlc -W +debug_info +inline -o../ebin hipe_rtl.erl**** > > pthread/ethr_event.c:98: Fatal error in wait__(): Function not implemented > (38)**** > > make[3]: *** [../ebin/hipe_rtl.beam] Aborted**** > > make[3]: Leaving directory > `/home/kana/Downloads/otp_src_R15B01/lib/hipe/rtl'**** > > make[2]: *** [opt] Error 2**** > > make[2]: Leaving directory `/home/kana/Downloads/otp_src_R15B01/lib/hipe'* > *** > > make[1]: *** [opt] Error 2**** > > make[1]: Leaving directory `/home/kana/Downloads/otp_src_R15B01/lib'**** > > make: *** [secondary_bootstrap_build] Error 2**** > > ** ** > > ** ** > > Any one have any ideas of why I?m getting the above? I?ve googled and the > main work around?s seem to be trying different released of Erlang, which as > I have already proved it cane b installed on Centos 5.8 I?d rather not have > to go back and downgrade my other servers.**** > > ** ** > > Thanks**** > > ** ** > > Mike **** > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mkimber@REDACTED Thu Apr 12 18:40:24 2012 From: mkimber@REDACTED (Mike Kimber) Date: Thu, 12 Apr 2012 12:40:24 -0400 Subject: [erlang-questions] Make failing on Centos 5.8 for R15B01 In-Reply-To: References: <-8908630575607257640@unknownmsgid> Message-ID: Top Banana that did it and I have erlang installed now! Thanks very much. Thanks Again Mike -----Original Message----- From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Attila Rajmund Nohl Sent: 12 April 2012 16:45 To: erlang-questions Subject: Re: [erlang-questions] Make failing on Centos 5.8 for R15B01 Hello! Have you checked this: http://stackoverflow.com/questions/5463503/rabbitmq-install-issue-on-centos-5-5 ? There's a patch there. [...] > On 12.4.2012, at 16.15, Mike Kimber wrote: > > I'm trying to build Erlang R15B01 on Centos 5.8. I have done this twice > before as a root user on two other servers with out issue. However on this > production server I have to use sudo and when I run sudo make I get the > following error: > > > > === Entering application hipe > > make[3]: Entering directory > `/home/kana/Downloads/otp_src_R15B01/lib/hipe/rtl' > > (cd ../main && make hipe.hrl) > > make[4]: Entering directory > `/home/kana/Downloads/otp_src_R15B01/lib/hipe/main' > > sed -e "s;%VSN%;3.9.1;" ../../hipe/main/hipe.hrl.src > > ../../hipe/main/hipe.hrl > > make[4]: Leaving directory > `/home/kana/Downloads/otp_src_R15B01/lib/hipe/main' > > erlc -W? +debug_info +inline -o../ebin hipe_rtl.erl > > pthread/ethr_event.c:98: Fatal error in wait__(): Function not implemented > (38) > > make[3]: *** [../ebin/hipe_rtl.beam] Aborted > > make[3]: Leaving directory > `/home/kana/Downloads/otp_src_R15B01/lib/hipe/rtl' > > make[2]: *** [opt] Error 2 > > make[2]: Leaving directory `/home/kana/Downloads/otp_src_R15B01/lib/hipe' > > make[1]: *** [opt] Error 2 > > make[1]: Leaving directory `/home/kana/Downloads/otp_src_R15B01/lib' > > make: *** [secondary_bootstrap_build] Error 2 > > > > > > Any one have any ideas of why I'm getting the above? I've googled and the > main work around's seem to be trying different released of Erlang, which as > I have already proved it cane b installed on Centos 5.8 I'd rather not have > to go back and downgrade my other servers. > > > > Thanks > > > > Mike > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions From comptekki@REDACTED Thu Apr 12 18:42:51 2012 From: comptekki@REDACTED (Wes James) Date: Thu, 12 Apr 2012 10:42:51 -0600 Subject: [erlang-questions] set up traces on live system - SF 2012 erlounge - who Message-ID: Someone gave a lightning talk on setting traces on live systems for debugging - who was that and do you have some info somewhere (tutorial) recap of what you covered? Thanks, -wes From mkimber@REDACTED Thu Apr 12 18:41:56 2012 From: mkimber@REDACTED (Mike Kimber) Date: Thu, 12 Apr 2012 12:41:56 -0400 Subject: [erlang-questions] Make failing on Centos 5.8 for R15B01 In-Reply-To: References: Message-ID: Hipe, no idea as I have no idea what that is. Erlang is a pre-req for Couchdb install so it depends on whether it needs it. The stackoverflow article provided in the previous response did the trick. Thanks Mike ________________________________ From: Erik S?e S?rensen [mailto:eriksoe@REDACTED] Sent: 12 April 2012 17:21 To: Mike Kimber Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] Make failing on Centos 5.8 for R15B01 Can you build Erlang with Hipe disabled, perhaps? I don't know if you're planning on using Hipe, of course, but that component appears to be the stumbling block for the build process. Den 12/04/2012 15.15 skrev "Mike Kimber" >: I'm trying to build Erlang R15B01 on Centos 5.8. I have done this twice before as a root user on two other servers with out issue. However on this production server I have to use sudo and when I run sudo make I get the following error: === Entering application hipe make[3]: Entering directory `/home/kana/Downloads/otp_src_R15B01/lib/hipe/rtl' (cd ../main && make hipe.hrl) make[4]: Entering directory `/home/kana/Downloads/otp_src_R15B01/lib/hipe/main' sed -e "s;%VSN%;3.9.1;" ../../hipe/main/hipe.hrl.src > ../../hipe/main/hipe.hrl make[4]: Leaving directory `/home/kana/Downloads/otp_src_R15B01/lib/hipe/main' erlc -W +debug_info +inline -o../ebin hipe_rtl.erl pthread/ethr_event.c:98: Fatal error in wait__(): Function not implemented (38) make[3]: *** [../ebin/hipe_rtl.beam] Aborted make[3]: Leaving directory `/home/kana/Downloads/otp_src_R15B01/lib/hipe/rtl' make[2]: *** [opt] Error 2 make[2]: Leaving directory `/home/kana/Downloads/otp_src_R15B01/lib/hipe' make[1]: *** [opt] Error 2 make[1]: Leaving directory `/home/kana/Downloads/otp_src_R15B01/lib' make: *** [secondary_bootstrap_build] Error 2 Any one have any ideas of why I'm getting the above? I've googled and the main work around's seem to be trying different released of Erlang, which as I have already proved it cane b installed on Centos 5.8 I'd rather not have to go back and downgrade my other servers. Thanks Mike _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From kostis@REDACTED Thu Apr 12 18:53:07 2012 From: kostis@REDACTED (Kostis Sagonas) Date: Thu, 12 Apr 2012 18:53:07 +0200 Subject: [erlang-questions] Make failing on Centos 5.8 for R15B01 In-Reply-To: References: Message-ID: <4F870873.2020007@cs.ntua.gr> On 04/12/2012 06:21 PM, Erik S?e S?rensen wrote: > Can you build Erlang with Hipe disabled, perhaps? > I don't know if you're planning on using Hipe, of course, but that > component appears to be the stumbling block for the build process. Can you provide some evidence for this claim, or you are just guessing that HiPE is a problem just because it's the first piece of Erlang code that gets compiled and (naturally) things break in that compilation? Kostis From francesquini@REDACTED Thu Apr 12 19:39:19 2012 From: francesquini@REDACTED (Emilio De Camargo Francesquini) Date: Thu, 12 Apr 2012 19:39:19 +0200 Subject: [erlang-questions] erlang:trace/3 In-Reply-To: <4F842BBC.9050201@erlang.org> References: <4F842BBC.9050201@erlang.org> Message-ID: Hello again, I was playing around with dbg:p/2 and I realized that it does not accept the flag 'exiting'. I browsed the code a little bit and found out that it accepts only the flags declared in dbg:all/0. Here's the code: all() -> [send,'receive',call,procs,garbage_collection,running, set_on_spawn,set_on_first_spawn,set_on_link,set_on_first_link, timestamp,arity,return_to]. I took a brief look at the documentation, and found that "The list can also include any of the flags allowed in erlang:trace/3". Is this a bug or a deliberate decision? Thanks! Le 10 avril 2012 14:46, Bj?rn-Egil Dahlberg a ?crit : > On 2012-04-09 19:49, Emilio De Camargo Francesquini wrote: >> >> Hello, >> >> I'm having some trouble understanding the exact meaning of two of the >> flags for the erlang:trace/3 function. >> >> Flag: >> >> - running >> ? ? Trace scheduling of processes. >> ? ? Message tags: in, and out. >> >> I imagine that a message tagged "in" means that the process was chosen >> by a scheduler and will begin/resume execution and a tag "out" means >> that the processes has been preempted. Is that correct? > > Correct but, to be clear, not only preempted. The tag "out" will be sent if > the process is scheduled out for any reason. > >> - exiting >> ? ? Trace scheduling of an exiting processes. >> ? ? Message tags: in_exiting, out_exiting, and out_exited. >> >> I guess that these messages are sent when the proccess is about to >> exit or has already exited. Am I right? What is the exact difference >> between each one of them? > > With "in_exiting" and "out_exiting" the process is scheduled as normal but > it is in limbo. This means the process is dead but has to be scheduled in > order to terminate and cleanup internally in the runtime. In other words, it > will not execute beam-code any more just terminate. Why? It simplifies > things internally. > >> Moreover, what is the difference between "exiting" flag with the tag >> "out_exited" and "procs" flag with the tag "exit"? > > The tag "exit" from procs is sent when the process is deemed dead, i.e. it > is exiting. The last chunk of beam code the process executed was some form > of exit. ?At this moment in time process has the state EXITING but will > potentially be scheduled again. > > The trace will after this be out_exited or, if more has to be done to > terminate it, out_exiting and in_exiting. Ex: > > > Eshell V5.9 ?(abort with ^G) > 1> P = spawn(fun() -> receive Ok -> ok end end). > <0.34.0> > 2> erlang:trace(P, true, [running, procs, exiting]). > 1 > 3> P ! ok. > ok > 4> flush(). > Shell got {trace,<0.34.0>,in,{erl_eval,receive_clauses,6}} > Shell got {trace,<0.34.0>,exit,normal} > Shell got {trace,<0.34.0>,out_exited,0} > ok > > I hope this clarifies things. > > Regards, > Bj?rn-Egil > Erlang/OTP > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From eriksoe@REDACTED Thu Apr 12 21:58:35 2012 From: eriksoe@REDACTED (=?ISO-8859-1?Q?Erik_S=F8e_S=F8rensen?=) Date: Thu, 12 Apr 2012 21:58:35 +0200 Subject: [erlang-questions] Make failing on Centos 5.8 for R15B01 In-Reply-To: <4F870873.2020007@cs.ntua.gr> References: <4F870873.2020007@cs.ntua.gr> Message-ID: Den 12. apr. 2012 18.53 skrev Kostis Sagonas : > On 04/12/2012 06:21 PM, Erik S?e S?rensen wrote: > >> Can you build Erlang with Hipe disabled, perhaps? >> I don't know if you're planning on using Hipe, of course, but that >> component appears to be the stumbling block for the build process. >> > > Can you provide some evidence for this claim, or you are just guessing > that HiPE is a problem just because it's the first piece of Erlang code > that gets compiled and (naturally) things break in that compilation? > That was just a guess. I believed it to be a qualified one, but upon reading the compile log closer I see that "pthread aborting while erlc is running" doesn't exactly point towards a HiPE problem... (Darn those small phone screens. Also, I assumed that the compile log was just an excerpt.) Sorry about being too hasty there... -------------- next part -------------- An HTML attachment was scrubbed... URL: From rexxe98@REDACTED Thu Apr 12 22:06:15 2012 From: rexxe98@REDACTED (Andrew Berman) Date: Thu, 12 Apr 2012 13:06:15 -0700 Subject: [erlang-questions] Help with Sublime Text 2 Code Completion In-Reply-To: References: Message-ID: Hey Erik, That looks interesting. Currently, I'm looping through the results of erlang:loaded() which is very fast, then doing Module:module_info(exports) and doing a fuzzy search on those which is why I wanted to load all the modules. By loading them all, they're already cached for me so that's one less thing I would have to do. Is using beam_disasm fast? Is loading all the modules really that bad? I can't imagine it uses that much memory that it would be an issue. Using beam_disasm would mean I would have to cache the results myself which means memory would be used anyway. Thoughts? Thanks, Andrew On Thu, Apr 12, 2012 at 3:57 AM, Erik S?e S?rensen wrote: > Are you sure that you want to *load* all the modules? > (Especially in these days, when modules may have 'on_load' hooks which > you're probably not interested in running indiscriminately - and which may > fail...) > > An alternative, in case you merely wish to know the list of exported > functions from a beam file FileName: > {beam_file,ModuleName,Exported0,_,_,_} = beam_disasm:file(FileName). > Exported = [{Name,Arity} || {Name,Arity,_} <- Exported0]. > > Den 12. apr. 2012 09.35 skrev Gustav Simonsson < > gustav.simonsson@REDACTED>: > > >> If you know which modules are in the added code paths you can simply loop >> over them and load each of them using the functions in the code module. >> >> Typically in Erlang systems one knows which modules exist, but if you >> cannot know that prior to adding a new code path my guess is that you >> have to search your newly added code paths and use e.g. code:load_file/1 >> >> Regards, >> Gustav Simonsson >> >> Sent from my PC >> >> ----- Original Message ----- >> > From: "Andrew Berman" >> > To: "Erlang Questions" >> > Sent: Thursday, 12 April, 2012 1:13:17 AM >> > Subject: Re: [erlang-questions] Help with Sublime Text 2 Code Completion >> > >> > >> > Hey all, >> > >> > >> > Been a while since I posed this question, but I'm still stuck on >> > trying to load all the beam files. Is there some magic way to tell >> > the VM to load all the beams in the code path or do I have to loop >> > through the code path and load them all manually? How would I go >> > about doing it that way if that is what is required? >> > >> > >> > Thanks, >> > >> > >> > Andrew >> > >> > >> > On Tue, Mar 6, 2012 at 11:43 PM, Andrew Berman < rexxe98@REDACTED > >> > wrote: >> > >> > >> > All, >> > >> > >> > I'm trying to build a plug-in for Sublime Text 2 to do proper Erlang >> > code completion. My thought is to have a server or node running and >> > then talk to that node using erl_call. I have it working with the >> > stdlib, but I want the code completion to be dynamic such that the >> > plug-in tells the remote node to add code paths. I have that working >> > too, but the issue is loading the actual modules in the new code >> > path. Since the erlang vm loads modules only upon access, when I >> > call erlang:loaded() or code:all_loaded(), the modules added with >> > the new code path do not show. Do I have to loop through the BEAMs >> > in the new code path and manually load them or is there a better way >> > to do it? I'm trying to make the completion use a fuzzy search such >> > that something like "li" brings up all modules with "li" in it which >> > is why I need to be able to have the entire list of modules loaded >> > already. >> > >> > >> > Thanks, >> > >> > >> > Andrew >> > >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://erlang.org/mailman/listinfo/erlang-questions >> > >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wallentin.dahlberg@REDACTED Thu Apr 12 23:20:05 2012 From: wallentin.dahlberg@REDACTED (=?ISO-8859-1?Q?Bj=F6rn=2DEgil_Dahlberg?=) Date: Thu, 12 Apr 2012 23:20:05 +0200 Subject: [erlang-questions] erlang:trace/3 In-Reply-To: References: <4F842BBC.9050201@erlang.org> Message-ID: Den 12 april 2012 19:39 skrev Emilio De Camargo Francesquini < francesquini@REDACTED>: > Hello again, > > I was playing around with dbg:p/2 and I realized that it does not > accept the flag 'exiting'. I browsed the code a little bit and found > out that it accepts only the flags declared in dbg:all/0. Here's the > code: > > all() -> > [send,'receive',call,procs,garbage_collection,running, > set_on_spawn,set_on_first_spawn,set_on_link,set_on_first_link, > timestamp,arity,return_to]. > > I took a brief look at the documentation, and found that "The list can > also include any of the flags allowed in erlang:trace/3". > > Is this a bug or a deliberate decision? > I am not so sure that this is a deliberate decision .. in fact a believe the opposite. If I recall correctly, the 'exiting' option is newer tracing option (though it apparently older than R13B03). I think it was added when some process termination internals got rewritten. dbg were probably overlooked when implementing it. Does it work as intended for you if you add 'exiting' to all/0 in this case? // Bj?rn-Egil > > Thanks! > > > Le 10 avril 2012 14:46, Bj?rn-Egil Dahlberg a ?crit : > > On 2012-04-09 19:49, Emilio De Camargo Francesquini wrote: > >> > >> Hello, > >> > >> I'm having some trouble understanding the exact meaning of two of the > >> flags for the erlang:trace/3 function. > >> > >> Flag: > >> > >> - running > >> Trace scheduling of processes. > >> Message tags: in, and out. > >> > >> I imagine that a message tagged "in" means that the process was chosen > >> by a scheduler and will begin/resume execution and a tag "out" means > >> that the processes has been preempted. Is that correct? > > > > Correct but, to be clear, not only preempted. The tag "out" will be sent > if > > the process is scheduled out for any reason. > > > >> - exiting > >> Trace scheduling of an exiting processes. > >> Message tags: in_exiting, out_exiting, and out_exited. > >> > >> I guess that these messages are sent when the proccess is about to > >> exit or has already exited. Am I right? What is the exact difference > >> between each one of them? > > > > With "in_exiting" and "out_exiting" the process is scheduled as normal > but > > it is in limbo. This means the process is dead but has to be scheduled in > > order to terminate and cleanup internally in the runtime. In other > words, it > > will not execute beam-code any more just terminate. Why? It simplifies > > things internally. > > > >> Moreover, what is the difference between "exiting" flag with the tag > >> "out_exited" and "procs" flag with the tag "exit"? > > > > The tag "exit" from procs is sent when the process is deemed dead, i.e. > it > > is exiting. The last chunk of beam code the process executed was some > form > > of exit. At this moment in time process has the state EXITING but will > > potentially be scheduled again. > > > > The trace will after this be out_exited or, if more has to be done to > > terminate it, out_exiting and in_exiting. Ex: > > > > > > Eshell V5.9 (abort with ^G) > > 1> P = spawn(fun() -> receive Ok -> ok end end). > > <0.34.0> > > 2> erlang:trace(P, true, [running, procs, exiting]). > > 1 > > 3> P ! ok. > > ok > > 4> flush(). > > Shell got {trace,<0.34.0>,in,{erl_eval,receive_clauses,6}} > > Shell got {trace,<0.34.0>,exit,normal} > > Shell got {trace,<0.34.0>,out_exited,0} > > ok > > > > I hope this clarifies things. > > > > Regards, > > Bj?rn-Egil > > Erlang/OTP > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ricardocb48@REDACTED Thu Apr 12 23:39:02 2012 From: ricardocb48@REDACTED (megalomania) Date: Thu, 12 Apr 2012 14:39:02 -0700 (PDT) Subject: [erlang-questions] Comunication between 2 gen_server's In-Reply-To: <1334236963773-4551836.post@n4.nabble.com> References: <1334236963773-4551836.post@n4.nabble.com> Message-ID: <1334266742508-4553168.post@n4.nabble.com> up! Well im trying make a gen_server for a client, but i dont now how get the messages that server sends, i cant register the client cuz this would be generic, any idea? -- View this message in context: http://erlang.2086793.n4.nabble.com/Comunication-between-2-gen-server-s-tp4551836p4553168.html Sent from the Erlang Questions mailing list archive at Nabble.com. From gustav.simonsson@REDACTED Thu Apr 12 23:42:05 2012 From: gustav.simonsson@REDACTED (Gustav Simonsson) Date: Thu, 12 Apr 2012 22:42:05 +0100 (BST) Subject: [erlang-questions] performance drop in R15A? In-Reply-To: <5828521.xYxjN7VVri@csr-pc40.zib.de> Message-ID: Hi Nico, Have you tried running the benchmarks between git bisects, using R14B04 and R15A as endpoints? // Gustav Sent from my PC ----- Original Message ----- > From: "Nico Kruber" > To: erlang-questions@REDACTED > Cc: "Lukas Larsson" > Sent: Thursday, 12 April, 2012 2:47:50 PM > Subject: Re: [erlang-questions] performance drop in R15A? > > is there any news on this? > Our internal test server has a new additional configuration which > compiles the > latest otp from github once per day and tests its performance with > the > mentioned benchmarks. > The resulting graphs for R14B04, R15B and latest git checkout are > attached. As > you can see - nothing has changed since then so I suppose it is still > present > in R15B01 :( > > I don't know how to debug this any further. If there is anything I > could do to > help you identify the issue, please tell me. > > > Regards > Nico Kruber > > On Wednesday 14 December 2011 17:41:33 Nico Kruber wrote: > > ok, I did some profiling and made some optimisations but the > > differences > > between R15B (git checkout from master just now) and R14B04 are > > still the > > same: > > > > First the results of the calls to bench:quorum_read(10, 50000) > > (best of > > three) ------------------------------------------------------------ > > > > | R14B04 | R15B | time surplus > > > > ------------------------------------------------------------ > > timer:tc, smp8:8 | 22484619| 26641737| +18% > > timer:tc, smp4:4 | 34009785| 35963489| + 6% > > timer:tc, smp2:2 | 32863428| 34102038| + 4% > > timer:tc, smpoff | 53805419| 54214795| + 1% > > ------------------------------------------------------------ > > > > It seems there is some lock-contention or some other problem with > > smp in our > > case which hasn't been there before. > > I also observed that the results using R15B vary quite much, > > especially with > > smp8:8 (see below for an example). R14B04 is more stable among > > different > > test runs. > > But still, even without smp, R15B is slower than R14B04 :( > > > > Lukas suggested to run fprof to a bit deeper and maybe find the > > function > > taking longer in R15 than in R14B04. > > Although it was helpful in finding some hot spots, it did however > > not help > > with this problem. Following are the totals reported by fprof > > (if you like, I can send the complete logs - didn't want to send > > too much to > > the mailing list though). > > > > ------------------------------------------------------------ > > > > | R14B04 | R15B | time surplus > > > > ------------------------------------------------------------ > > fprof, CNT, smp8:8 | 7723796| 7722635| n/a > > fprof, ACC, smp8:8 | 98239| 85477| -13% > > fprof, OWN, smp8:8 | 300534| 264018| -12% > > ------------------------------------------------------------ > > > > As you can see, according to fprof, R15B should be faster (but it > > isn't!). > > I assume that some function calls are not reported by fprof > > (e.g. I did not see erlang:length/1). > > Is there some way to include them again in order to analyse > > further? > > Maybe suspend or garbage_collect are not in ACC or OWN? > > But even here, R15B wastes less time as you can see in the table > > below. > > ---------------------------------------------------------- > > > > | R14B04 | R15B | > > > > ---------------------------------------------------------- > > fprof, suspend, smp8:8 | 9.8421e+06| 8.51855e+06| > > fprof, garbage_collect, smp8:8 | 1315| 794| > > ---------------------------------------------------------- > > > > We do rely quite much on the process dictionary (erlang:put and > > erlang:get) > > which you might see as an "non-typical usage pattern" for erlang. > > However, if I switch to ets instead, performance of > > bench:quorum_read(10, > > 50000) for R15B does not change and for R14B04 decreases by about > > 7%. > > > > Everything else I would consider "typical use" - or at least I'm > > not aware > > of anything untypical. > > > > I hope, someone can help to further analyse the problem. I did > > everything I > > could think of and are stuck now. > > Is other real-world software also affected? E.g. testing couchdb > > would be > > nice. > > > > > > Regards > > Nico Kruber > > > > > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > how to re-produce the values > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > > > I'm using scalaris from http://code.google.com/p/scalaris/ > > ./configure && make > > ================ R15B =============== > > -------------------------------- > > ./bin/firstnode.sh > > Erlang R15B (erts-5.9) [source] [64-bit] [smp:8:8] > > [async-threads:0] [hipe] > > [kernel-poll:false] > > > > timer:tc(bench, quorum_read, [10, 50000]). > > {33764932,ok} % 1st try > > {26641737,ok} % 2nd try > > {27575975,ok} % 3rd try > > -------------------------------- > > ./bin/firstnode.sh "+S4:4" > > Erlang R15B (erts-5.9) [source] [64-bit] [smp:4:4] > > [async-threads:0] [hipe] > > [kernel-poll:false] > > > > timer:tc(bench, quorum_read, [10, 50000]). > > {35963489,ok} % 1st try > > {36332156,ok} % 2nd try > > {37295819,ok} % 3rd try > > -------------------------------- > > ./bin/firstnode.sh "+S2:2" > > Erlang R15B (erts-5.9) [source] [64-bit] [smp:2:2] > > [async-threads:0] [hipe] > > [kernel-poll:false] > > > > timer:tc(bench, quorum_read, [10, 50000]). > > {34102038,ok} % 1st try > > {34379052,ok} % 2nd try > > {34416173,ok} % 3rd try > > -------------------------------- > > ./bin/firstnode.sh "-smp disable" > > Erlang R15B (erts-5.9) [source] [64-bit] [async-threads:0] [hipe] > > [kernel-poll:false] > > > > timer:tc(bench, quorum_read, [10, 50000]). > > {54214795,ok} % 1st try > > {55210947,ok} % 2nd try > > {54537194,ok} % 3rd try > > > > ================ R14B04 =============== > > -------------------------------- > > ./bin/firstnode.sh > > Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:8:8] [rq:8] > > [async-threads:0] [hipe] [kernel-poll:false] > > > > timer:tc(bench, quorum_read, [10, 50000]). > > {22598819,ok} % 1st try > > {22706185,ok} % 2nd try > > {22484619,ok} % 3rd try > > -------------------------------- > > ./bin/firstnode.sh "+S4:4" > > Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:4:4] [rq:4] > > [async-threads:0] [hipe] [kernel-poll:false] > > > > timer:tc(bench, quorum_read, [10, 50000]). > > {35482368,ok} % 1st try > > {34009785,ok} % 2nd try > > {34527203,ok} % 3rd try > > -------------------------------- > > ./bin/firstnode.sh "+S2:2" > > Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:2:2] [rq:2] > > [async-threads:0] [hipe] [kernel-poll:false] > > > > timer:tc(bench, quorum_read, [10, 50000]). > > {33590356,ok} % 1st try > > {33192033,ok} % 2nd try > > {32863428,ok} % 3rd try > > -------------------------------- > > ./bin/firstnode.sh "-smp disable" > > Erlang R14B04 (erts-5.8.5) [source] [64-bit] [rq:1] > > [async-threads:0] [hipe] > > [kernel-poll:false] > > > > timer:tc(bench, quorum_read, [10, 50000]). > > {53805419,ok} % 1st try > > {54054538,ok} % 2nd try > > {54066521,ok} % 3rd try > > > > > > fprof runs: > > ./bin/firstnode.sh > > > > fprof:trace([start, {procs, processes()}]). > > bench:quorum_read(10, 1000). > > fprof:trace(stop). > > fprof:profile(). > > fprof:analyse([{dest, "test.R15B.fprof.log"}]). % or R14B04 > > respectively > > > > > cat test.R14B04.fprof.log |grep suspend|cut -d',' -f3 | awk > > > '{s+=$1} END > > > {print s}' > > 9.8421e+06 > > > > > cat test.R15B.fprof.log |grep suspend|cut -d',' -f3 | awk > > > '{s+=$1} END > > > {print s}' > > 8.51855e+06 > > > > > cat test.R14B04.fprof.log |grep garbage_collect|cut -d',' -f3 | > > > awk > > > '{s+=$1} END {print s}' > > 1315.33 > > > > > cat test.R15B.fprof.log |grep garbage_collect|cut -d',' -f3 | awk > > > '{s+=$1} > > > END {print s}' > > 794.956 > > > > On Friday 09 December 2011 12:09:56 Kenneth Lundin wrote: > > > On 12/5/11, Nico Kruber wrote: > > > > Is there any news on this? > > > > > > > > The performance drop of the recent R15 checkout compared to > > > > R14B04 in > > > > our > > > > application is now at _30%_ compared to a drop of "only" 15% in > > > > R15A! > > > > > > When working with R15B we are of course performing a number of > > > bencmarks to keep track of the performance. > > > > > > Whe always strive to improve general performance in each release > > > AND > > > OUR BENCHMARKS INDICATE THAT R15B IS FASTER IN GENERAL THAN > > > R14B04. > > > > > > It is however always possible that some specific operations or > > > combinations of operations get slower while others are optimized. > > > > > > Regarding the findings for this particular application we think > > > the > > > reason for slowdown is a very frequent but non typical usage > > > pattern > > > that now becomes visible as a performance bottleneck. > > > > > > > > > / Kenneth, Erlang/OTP Ericsson > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From ok@REDACTED Fri Apr 13 00:31:55 2012 From: ok@REDACTED (Richard O'Keefe) Date: Fri, 13 Apr 2012 10:31:55 +1200 Subject: [erlang-questions] How to speed up mnesia startup? In-Reply-To: <4DD5E107-B488-4A57-B2F6-85B00BBCC8BA@feuerlabs.com> References: <4DD5E107-B488-4A57-B2F6-85B00BBCC8BA@feuerlabs.com> Message-ID: <4B0456F0-5168-457A-8733-6E0BE840C47E@cs.otago.ac.nz> On 12/04/2012, at 9:26 PM, Ulf Wiger wrote: > > Hmm, the first thing that stands out is the inordinate number of tables. > > Out of curiosity, I tried figuring out what is considered a reasonable number of tables for other database management systems: > > - Oracle: over 10,000 tables considered insane > (http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:26039880025641) That page has no claim that *Oracle* cannot handle it. The arguments given are - that it seems extremely unlikely that people could "design, implement, or maintain" a system with 10,000 distinct tables "personally". Of course it does not follow that a team could not design, implement, and maintain an ALGEBRA by means of which 10,000 relation values could be constructed and queried. - the specific problem looked as if it would fit a two table design That does not mean the OP's problem would suit such a design, although it well might. - "flooding the shared pool with 100's of thousands of SQL statements for one, that would be the first one - doesn't scale very well at all." This doesn't apply to Erlang/Mnesia. - You'd have to use dynamic SQL rather than stored procedures in SQL. This doesn't apply to Erlang/Mnesia either. > > - Postgres: 10,000 tables works fine; practical limit (on ext3) probably 32k > (http://blog.endpoint.com/2008/11/10000-databases-on-postgresql-cluster.html) That page actually talks about 10,000 DATABASES in one cluster. Since each database had 1-5 tables, the test tried about 30,000 TABLES. The 32k limit applies to databases, not tables. Somebody called "Michael" commented that they had 20,000 tables in a single database and someone called "wstrzalka" claimed to have a "similar installation". > > - MySQL Server: no apparent problems > (http://stackoverflow.com/questions/610920/maximum-number-of-workable-tables-in-sql-server-and-mysql) The page asks about (Microsoft) "SQL Server" and also about "MySQL". "Andy Ansryan" said "I have had a database with 2 million tables" with "no performance hit at all". As far as I can see all the answers were about Microsoft SQL Server, not about MySQL. For what it's worth, http://www.firebirdfaq.org/faq61/ says that the maximum number of tables in Firebird is 32k. >> Here is my conditions: >> - DB exists local >> - more than 60000 tables >> - sum size is about 28 Giga Bytes. >> - most tables created options with record_name, attributes(and record_info()) and disc_only_copies. 60,000 tables is, for example, more than Firebird can handle. The average table size is only 500 kB. How big are the tuples? How many tuples per table? I'm pretty sure that there is some structure in the problem domain that's not being exploited here. From rexxe98@REDACTED Fri Apr 13 01:13:54 2012 From: rexxe98@REDACTED (Andrew Berman) Date: Thu, 12 Apr 2012 16:13:54 -0700 Subject: [erlang-questions] Help with Sublime Text 2 Code Completion In-Reply-To: References: Message-ID: I actually just tested and it appears beam_disasm is really fast. I'm going to try to use it. Thanks again! Andrew On Thu, Apr 12, 2012 at 1:06 PM, Andrew Berman wrote: > Hey Erik, > > That looks interesting. Currently, I'm looping through the results of > erlang:loaded() which is very fast, then doing Module:module_info(exports) > and doing a fuzzy search on those which is why I wanted to load all the > modules. By loading them all, they're already cached for me so that's one > less thing I would have to do. Is using beam_disasm fast? Is loading all > the modules really that bad? I can't imagine it uses that much memory that > it would be an issue. Using beam_disasm would mean I would have to cache > the results myself which means memory would be used anyway. Thoughts? > > Thanks, > > Andrew > > > On Thu, Apr 12, 2012 at 3:57 AM, Erik S?e S?rensen wrote: > >> Are you sure that you want to *load* all the modules? >> (Especially in these days, when modules may have 'on_load' hooks which >> you're probably not interested in running indiscriminately - and which may >> fail...) >> >> An alternative, in case you merely wish to know the list of exported >> functions from a beam file FileName: >> {beam_file,ModuleName,Exported0,_,_,_} = beam_disasm:file(FileName). >> Exported = [{Name,Arity} || {Name,Arity,_} <- Exported0]. >> >> Den 12. apr. 2012 09.35 skrev Gustav Simonsson < >> gustav.simonsson@REDACTED>: >> >> >>> If you know which modules are in the added code paths you can simply loop >>> over them and load each of them using the functions in the code module. >>> >>> Typically in Erlang systems one knows which modules exist, but if you >>> cannot know that prior to adding a new code path my guess is that you >>> have to search your newly added code paths and use e.g. code:load_file/1 >>> >>> Regards, >>> Gustav Simonsson >>> >>> Sent from my PC >>> >>> ----- Original Message ----- >>> > From: "Andrew Berman" >>> > To: "Erlang Questions" >>> > Sent: Thursday, 12 April, 2012 1:13:17 AM >>> > Subject: Re: [erlang-questions] Help with Sublime Text 2 Code >>> Completion >>> > >>> > >>> > Hey all, >>> > >>> > >>> > Been a while since I posed this question, but I'm still stuck on >>> > trying to load all the beam files. Is there some magic way to tell >>> > the VM to load all the beams in the code path or do I have to loop >>> > through the code path and load them all manually? How would I go >>> > about doing it that way if that is what is required? >>> > >>> > >>> > Thanks, >>> > >>> > >>> > Andrew >>> > >>> > >>> > On Tue, Mar 6, 2012 at 11:43 PM, Andrew Berman < rexxe98@REDACTED > >>> > wrote: >>> > >>> > >>> > All, >>> > >>> > >>> > I'm trying to build a plug-in for Sublime Text 2 to do proper Erlang >>> > code completion. My thought is to have a server or node running and >>> > then talk to that node using erl_call. I have it working with the >>> > stdlib, but I want the code completion to be dynamic such that the >>> > plug-in tells the remote node to add code paths. I have that working >>> > too, but the issue is loading the actual modules in the new code >>> > path. Since the erlang vm loads modules only upon access, when I >>> > call erlang:loaded() or code:all_loaded(), the modules added with >>> > the new code path do not show. Do I have to loop through the BEAMs >>> > in the new code path and manually load them or is there a better way >>> > to do it? I'm trying to make the completion use a fuzzy search such >>> > that something like "li" brings up all modules with "li" in it which >>> > is why I need to be able to have the entire list of modules loaded >>> > already. >>> > >>> > >>> > Thanks, >>> > >>> > >>> > Andrew >>> > >>> > _______________________________________________ >>> > erlang-questions mailing list >>> > erlang-questions@REDACTED >>> > http://erlang.org/mailman/listinfo/erlang-questions >>> > >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From seth@REDACTED Fri Apr 13 07:47:12 2012 From: seth@REDACTED (Seth Falcon) Date: Thu, 12 Apr 2012 22:47:12 -0700 Subject: [erlang-questions] set up traces on live system - SF 2012 erlounge - who In-Reply-To: References: Message-ID: On Apr 12, 2012, at 9:42 AM, Wes James wrote: > Someone gave a lightning talk on setting traces on live systems for > debugging - who was that and do you have some info somewhere > (tutorial) recap of what you covered? I think that was dizzyd. He posted the following gist of his timeit module: https://gist.github.com/2257931 + seth -- Seth Falcon | @sfalcon | http://userprimary.net/ From ulf@REDACTED Fri Apr 13 07:53:32 2012 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 13 Apr 2012 07:53:32 +0200 Subject: [erlang-questions] How to speed up mnesia startup? In-Reply-To: <4B0456F0-5168-457A-8733-6E0BE840C47E@cs.otago.ac.nz> References: <4DD5E107-B488-4A57-B2F6-85B00BBCC8BA@feuerlabs.com> <4B0456F0-5168-457A-8733-6E0BE840C47E@cs.otago.ac.nz> Message-ID: On 13 Apr 2012, at 00:31, Richard O'Keefe wrote: > > On 12/04/2012, at 9:26 PM, Ulf Wiger wrote: > >> >> Hmm, the first thing that stands out is the inordinate number of tables. >> >> Out of curiosity, I tried figuring out what is considered a reasonable number of tables for other database management systems: >> >> - Oracle: over 10,000 tables considered insane >> (http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:26039880025641) > > That page has no claim that *Oracle* cannot handle it. > The arguments given are > - that it seems extremely unlikely that people could "design, > implement, or maintain" a system with 10,000 distinct tables > "personally". ? Fair enough. My point was mainly that 60k tables is well beyond what most database management systems are optimized for. The question is obviously here what _nmesia_ is good at, but I just wanted to illustrate that if you want to build a database with 60k tables, you shouldn't _assume_ that any given dbms will handle it well. As far as mnesia is concerned, there are a number of commonly used functions that are reasonable as long as the number of tables is somewhere in the hundreds. Take, for example, mnesia:wait_for_tables/2. Let's assume that our application actually needs those 60k tables to be loaded before it starts doing things. wait_for_tables/2 is basically implemented like this (lots of code snipped): wait_for_tables_init(From, Tabs) -> process_flag(trap_exit, true), ... cast({sync_tabs, Tabs, self()}), rec_tabs(Tabs, Tabs, From, Init) end. rec_tabs([Tab | Tabs], AllTabs, From, Init) -> receive {?SERVER_NAME, {tab_synced, Tab}} -> rec_tabs(Tabs, AllTabs, From, Init); ... end; rec_tabs([], _, _, Init) -> unlink(Init), ok. To begin with, if the objective was to support tens of thousand tables, it would be better to provide functions to efficiently query the 'table of tables'. Currently, there is no table of tables, but a system_info(tables), which provides them all as a list (including 'schema', which you often must delete from the list, since you can't, for example, do wait_for tables on the schema). In the code above, mnesia sends the 60k list of tables in a single message. It then loops through the list and does selective receive on the replies belonging to each. This is a convenient way to do it when the list of Tabs is short, but pretty awful for a very large list, since each iteration may end up scanning a rather large message queue. This was just one example. Mnesia was not designed with this sort of thing in mind. BR, Ulf W Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com From francesquini@REDACTED Fri Apr 13 08:58:59 2012 From: francesquini@REDACTED (Emilio De Camargo Francesquini) Date: Fri, 13 Apr 2012 08:58:59 +0200 Subject: [erlang-questions] erlang:trace/3 In-Reply-To: References: <4F842BBC.9050201@erlang.org> Message-ID: I added the 'exiting' flag to all/0 and ran some tests. It worked perfectly. Le 12 avril 2012 23:20, Bj?rn-Egil Dahlberg a ?crit : > > > Den 12 april 2012 19:39 skrev Emilio De Camargo Francesquini > : > >> Hello again, >> >> I was playing around with dbg:p/2 and I realized that it does not >> accept the flag 'exiting'. I browsed the code a little bit and found >> out that it accepts only the flags declared in dbg:all/0. Here's the >> code: >> >> all() -> >> ? ?[send,'receive',call,procs,garbage_collection,running, >> ? ? set_on_spawn,set_on_first_spawn,set_on_link,set_on_first_link, >> ? ? timestamp,arity,return_to]. >> >> I took a brief look at the documentation, and found that "The list can >> also include any of the flags allowed in erlang:trace/3". >> >> Is this a bug or a deliberate decision? > > > I am not so sure that this is a deliberate decision .. in fact a believe the > opposite. > > If I recall correctly, the 'exiting' option is newer tracing option (though > it apparently older than R13B03). I think it was added when some process > termination internals got rewritten. dbg were probably overlooked when > implementing it. > > Does it work as intended for you if you add 'exiting' to all/0 in this case? > > // Bj?rn-Egil >> >> >> Thanks! >> >> >> Le 10 avril 2012 14:46, Bj?rn-Egil Dahlberg a ?crit : >> > On 2012-04-09 19:49, Emilio De Camargo Francesquini wrote: >> >> >> >> Hello, >> >> >> >> I'm having some trouble understanding the exact meaning of two of the >> >> flags for the erlang:trace/3 function. >> >> >> >> Flag: >> >> >> >> - running >> >> ? ? Trace scheduling of processes. >> >> ? ? Message tags: in, and out. >> >> >> >> I imagine that a message tagged "in" means that the process was chosen >> >> by a scheduler and will begin/resume execution and a tag "out" means >> >> that the processes has been preempted. Is that correct? >> > >> > Correct but, to be clear, not only preempted. The tag "out" will be sent >> > if >> > the process is scheduled out for any reason. >> > >> >> - exiting >> >> ? ? Trace scheduling of an exiting processes. >> >> ? ? Message tags: in_exiting, out_exiting, and out_exited. >> >> >> >> I guess that these messages are sent when the proccess is about to >> >> exit or has already exited. Am I right? What is the exact difference >> >> between each one of them? >> > >> > With "in_exiting" and "out_exiting" the process is scheduled as normal >> > but >> > it is in limbo. This means the process is dead but has to be scheduled >> > in >> > order to terminate and cleanup internally in the runtime. In other >> > words, it >> > will not execute beam-code any more just terminate. Why? It simplifies >> > things internally. >> > >> >> Moreover, what is the difference between "exiting" flag with the tag >> >> "out_exited" and "procs" flag with the tag "exit"? >> > >> > The tag "exit" from procs is sent when the process is deemed dead, i.e. >> > it >> > is exiting. The last chunk of beam code the process executed was some >> > form >> > of exit. ?At this moment in time process has the state EXITING but will >> > potentially be scheduled again. >> > >> > The trace will after this be out_exited or, if more has to be done to >> > terminate it, out_exiting and in_exiting. Ex: >> > >> > >> > Eshell V5.9 ?(abort with ^G) >> > 1> P = spawn(fun() -> receive Ok -> ok end end). >> > <0.34.0> >> > 2> erlang:trace(P, true, [running, procs, exiting]). >> > 1 >> > 3> P ! ok. >> > ok >> > 4> flush(). >> > Shell got {trace,<0.34.0>,in,{erl_eval,receive_clauses,6}} >> > Shell got {trace,<0.34.0>,exit,normal} >> > Shell got {trace,<0.34.0>,out_exited,0} >> > ok >> > >> > I hope this clarifies things. >> > >> > Regards, >> > Bj?rn-Egil >> > Erlang/OTP >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://erlang.org/mailman/listinfo/erlang-questions >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > From mkimber@REDACTED Fri Apr 13 09:13:56 2012 From: mkimber@REDACTED (Mike Kimber) Date: Fri, 13 Apr 2012 03:13:56 -0400 Subject: [erlang-questions] Make failing on Centos 5.8 for R15B01 In-Reply-To: References: <-8908630575607257640@unknownmsgid> Message-ID: Will take a look Merci Buckets Mike ________________________________ From: Dmitry Kolesnikov [mailto:dev@REDACTED] Sent: 12 April 2012 19:48 To: Mike Kimber Cc: erlang-questions Questions Subject: Re: [erlang-questions] Make failing on Centos 5.8 for R15B01 Hello, I would suggest you to check: http://www.erlang.org/doc/man/systools.html (make_script & make_tar). It would guide you to ther process for tarball creation. It is very eets asy once you figure our how to create *.app and *.rel files for your project. - Dmitry On Apr 12, 2012, at 6:29 PM, Mike Kimber wrote: Ok when I say production I mean it's a development environment controlled by some one else and not the virtualbox and vmware servers I have root access to, but I get and agree with your point although I'm not sure how I package up the three components into a rpm/tar I have built! However I'd still like to understand what this error means and how to resolve it, so if any one has any ideas on how to do this they would be greatly appreciated Thanks Mike ________________________________ From: dmitry kolesnikov [mailto:dmkolesnikov@REDACTED] Sent: 12 April 2012 14:33 To: Mike Kimber Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] Make failing on Centos 5.8 for R15B01 Hello, Try to avoid erlang compilation on production servers. You can use systools to make a self contained tarball with your application at dev node . Best Regards, Dmitry >-|-|-*> On 12.4.2012, at 16.15, Mike Kimber > wrote: I'm trying to build Erlang R15B01 on Centos 5.8. I have done this twice before as a root user on two other servers with out issue. However on this production server I have to use sudo and when I run sudo make I get the following error: === Entering application hipe make[3]: Entering directory `/home/kana/Downloads/otp_src_R15B01/lib/hipe/rtl' (cd ../main && make hipe.hrl) make[4]: Entering directory `/home/kana/Downloads/otp_src_R15B01/lib/hipe/main' sed -e "s;%VSN%;3.9.1;" ../../hipe/main/hipe.hrl.src > ../../hipe/main/hipe.hrl make[4]: Leaving directory `/home/kana/Downloads/otp_src_R15B01/lib/hipe/main' erlc -W +debug_info +inline -o../ebin hipe_rtl.erl pthread/ethr_event.c:98: Fatal error in wait__(): Function not implemented (38) make[3]: *** [../ebin/hipe_rtl.beam] Aborted make[3]: Leaving directory `/home/kana/Downloads/otp_src_R15B01/lib/hipe/rtl' make[2]: *** [opt] Error 2 make[2]: Leaving directory `/home/kana/Downloads/otp_src_R15B01/lib/hipe' make[1]: *** [opt] Error 2 make[1]: Leaving directory `/home/kana/Downloads/otp_src_R15B01/lib' make: *** [secondary_bootstrap_build] Error 2 Any one have any ideas of why I'm getting the above? I've googled and the main work around's seem to be trying different released of Erlang, which as I have already proved it cane b installed on Centos 5.8 I'd rather not have to go back and downgrade my other servers. Thanks Mike _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From bengt.kleberg@REDACTED Fri Apr 13 09:35:25 2012 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Fri, 13 Apr 2012 09:35:25 +0200 Subject: [erlang-questions] Comunication between 2 gen_server's In-Reply-To: <1334266742508-4553168.post@n4.nabble.com> References: <1334236963773-4551836.post@n4.nabble.com> <1334266742508-4553168.post@n4.nabble.com> Message-ID: <1334302525.4748.5.camel@seasc1137> Greetings, If you have 2 gen_servers calling each other, please remember that they will dead lock. bengt On Thu, 2012-04-12 at 23:39 +0200, megalomania wrote: > up! > Well im trying make a gen_server for a client, but i dont now how get the > messages that server sends, i cant register the client cuz this would be > generic, any idea? > > -- > View this message in context: http://erlang.2086793.n4.nabble.com/Comunication-between-2-gen-server-s-tp4551836p4553168.html > Sent from the Erlang Questions mailing list archive at Nabble.com. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From bourinov@REDACTED Fri Apr 13 10:01:59 2012 From: bourinov@REDACTED (Max Bourinov) Date: Fri, 13 Apr 2012 12:01:59 +0400 Subject: [erlang-questions] Help with Sublime Text 2 Code Completion In-Reply-To: References: Message-ID: One more Sublime user is here. Hi guys, How it is possible for me to try "code completion" feature too? Is there any software? Or github repo? Instruction? Anything? Thank you in advance! Best regards, Max On Fri, Apr 13, 2012 at 3:13 AM, Andrew Berman wrote: > I actually just tested and it appears beam_disasm is really fast. I'm > going to try to use it. > > Thanks again! > > Andrew > > > On Thu, Apr 12, 2012 at 1:06 PM, Andrew Berman wrote: > >> Hey Erik, >> >> That looks interesting. Currently, I'm looping through the results of >> erlang:loaded() which is very fast, then doing Module:module_info(exports) >> and doing a fuzzy search on those which is why I wanted to load all the >> modules. By loading them all, they're already cached for me so that's one >> less thing I would have to do. Is using beam_disasm fast? Is loading all >> the modules really that bad? I can't imagine it uses that much memory that >> it would be an issue. Using beam_disasm would mean I would have to cache >> the results myself which means memory would be used anyway. Thoughts? >> >> Thanks, >> >> Andrew >> >> >> On Thu, Apr 12, 2012 at 3:57 AM, Erik S?e S?rensen wrote: >> >>> Are you sure that you want to *load* all the modules? >>> (Especially in these days, when modules may have 'on_load' hooks which >>> you're probably not interested in running indiscriminately - and which may >>> fail...) >>> >>> An alternative, in case you merely wish to know the list of exported >>> functions from a beam file FileName: >>> {beam_file,ModuleName,Exported0,_,_,_} = beam_disasm:file(FileName). >>> Exported = [{Name,Arity} || {Name,Arity,_} <- Exported0]. >>> >>> Den 12. apr. 2012 09.35 skrev Gustav Simonsson < >>> gustav.simonsson@REDACTED>: >>> >>> >>>> If you know which modules are in the added code paths you can simply >>>> loop >>>> over them and load each of them using the functions in the code module. >>>> >>>> Typically in Erlang systems one knows which modules exist, but if you >>>> cannot know that prior to adding a new code path my guess is that you >>>> have to search your newly added code paths and use e.g. code:load_file/1 >>>> >>>> Regards, >>>> Gustav Simonsson >>>> >>>> Sent from my PC >>>> >>>> ----- Original Message ----- >>>> > From: "Andrew Berman" >>>> > To: "Erlang Questions" >>>> > Sent: Thursday, 12 April, 2012 1:13:17 AM >>>> > Subject: Re: [erlang-questions] Help with Sublime Text 2 Code >>>> Completion >>>> > >>>> > >>>> > Hey all, >>>> > >>>> > >>>> > Been a while since I posed this question, but I'm still stuck on >>>> > trying to load all the beam files. Is there some magic way to tell >>>> > the VM to load all the beams in the code path or do I have to loop >>>> > through the code path and load them all manually? How would I go >>>> > about doing it that way if that is what is required? >>>> > >>>> > >>>> > Thanks, >>>> > >>>> > >>>> > Andrew >>>> > >>>> > >>>> > On Tue, Mar 6, 2012 at 11:43 PM, Andrew Berman < rexxe98@REDACTED > >>>> > wrote: >>>> > >>>> > >>>> > All, >>>> > >>>> > >>>> > I'm trying to build a plug-in for Sublime Text 2 to do proper Erlang >>>> > code completion. My thought is to have a server or node running and >>>> > then talk to that node using erl_call. I have it working with the >>>> > stdlib, but I want the code completion to be dynamic such that the >>>> > plug-in tells the remote node to add code paths. I have that working >>>> > too, but the issue is loading the actual modules in the new code >>>> > path. Since the erlang vm loads modules only upon access, when I >>>> > call erlang:loaded() or code:all_loaded(), the modules added with >>>> > the new code path do not show. Do I have to loop through the BEAMs >>>> > in the new code path and manually load them or is there a better way >>>> > to do it? I'm trying to make the completion use a fuzzy search such >>>> > that something like "li" brings up all modules with "li" in it which >>>> > is why I need to be able to have the entire list of modules loaded >>>> > already. >>>> > >>>> > >>>> > Thanks, >>>> > >>>> > >>>> > Andrew >>>> > >>>> > _______________________________________________ >>>> > erlang-questions mailing list >>>> > erlang-questions@REDACTED >>>> > http://erlang.org/mailman/listinfo/erlang-questions >>>> > >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-questions >>>> >>> >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> >>> >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lenartlad@REDACTED Fri Apr 13 10:09:05 2012 From: lenartlad@REDACTED (Ladislav Lenart) Date: Fri, 13 Apr 2012 10:09:05 +0200 Subject: [erlang-questions] Comunication between 2 gen_server's In-Reply-To: <1334266742508-4553168.post@n4.nabble.com> References: <1334236963773-4551836.post@n4.nabble.com> <1334266742508-4553168.post@n4.nabble.com> Message-ID: <4F87DF21.1030604@volny.cz> Hello. I don't understand the following: You can't register the client because this would be generic. You implement chat_server and chat_client as gen_server modules. Something like the following (WARNING: The code is incomplete and untested!)... %%%%%%%%%%%%%% %%% SERVER %%% %%%%%%%%%%%%%% -module(chat_server). -export(...). %%% API start(SrvName) -> gen_server:start({local, SrvName}, ?MODULE, [], []). start_link(SrvName) -> gen_server:start_link({local, SrvName}, ?MODULE, [], []). stop(Srv) -> gen_server:cast(Srv, stop). %% Connect a chat client process to a chat server. connect_client(Srv, Client) -> gen_server:call(Srv, {connect_client, Client}). %% Send Msg (a string) from a Nick to all currently connected clients. broadcast_message(Srv, Nick, Msg) -> gen_server:cast(Srv, {broadcast_message, Nick, Msg}). %%% Callbacks init([]) -> %% This way the server will be informed about termination %% of its clients (see handle_info/2 below). erlang:process_flag(trap_exit, true), {ok, []}. handle_call({connect_client, Client}, Clients) -> %% Establish a two-way relationship between the server and Client. %% Because of process_flag/2 above, the server will be notified if %% Client terminates for whatever reason. erlang:link(Client), {reply, ok, [Client | Clients]}. handle_cast({broadcast_message, SenderNick, Msg}, Clients) -> lists:foreach(fun (Client) -> chat_client:receive_message(Client, SenderNick, Msg) end, Clients), {noreply, Clients}; handle_cast(stop, Clients) -> %% This will automatically terminate all connected clients. {stop, shutdown, Clients}. handle_info({'EXIT', Client, _Reason}, Clients) -> {noreply, lists:delete(Client, Clients)}. %%%%%%%%%%%%%% %%% CLIENT %%% %%%%%%%%%%%%%% -module(chat_client). -export(...). -record(state, {nick, server}). %%% API start(Nick, Srv) -> gen_server:start(?MODULE, [Nick, Srv], []). start_link(Nick, Srv) -> gen_server:start_link(?MODULE, [Nick, Srv], []). stop(Client) -> %% This will inform the server about the end of my life. exit(Client, shutdown). say(Client, Msg) -> gen_server:cast(Client, {say, Msg}). %% Called by the chat_srv during its broadcast_message/2 to %% deliver Msg to each connected client. receive_message(Client, SenderNick, Msg) -> gen_server:cast(Client, {receive_message, SenderNick, Msg}). %%% Callbacks init([Nick, Srv]) -> self() ! connect, {ok, #state{nick=Nick, server=Srv}}. handle_cast({say, Msg}, #state{server=Srv, nick=Nick} = State) -> chat_server:broadcast_message(Srv, Nick, Msg), {noreply, State}; handle_cast({receive_message, SenderNick, Msg}, State) -> io:format("~p: ~p~n", [SenderNick, Msg]), {noreply, State}; handle_info(connect, State) -> ok = chat_server:connect_client(State#state.server, self()), {noreply, State}. %%%%%%%%%%%%% %%% USAGE %%% %%%%%%%%%%%%% srv_node> chat_srv:start(chat). {ok, ...} client_1> {ok, AdamPid} = chat_client:start("Adam", {chat, srv_node}). {ok, AdamPid} client_2> {ok, EvePid} = chat_client:start("Eve", {chat, srv_node}). {ok, EvePid} client_1> chat_client:say(AdamPid, "Hello!"). ok Adam: Hello! client_2> Adam: Hello! client_2> chat_client:say(EvePid, "Oh, hi handsome!"). ok Eve: Oh, hi handsome! client_1> Eve: Oh, hi handsome! Call chain to start new client (server must be already running): 1. [Client shell] chat_client:start(Nick, Srv). 2. [Chat client] chat_client:init([Nick, Srv]). 3. [Chat client] chat_client:handle_info(connect,...). 4. [Chat client] chat_server:connect_client(Srv, self()). 5. [Chat server] chat_server:handle_call({connect_client, Client},...). Call chain to send a message (server and client are running): 1. [Client shell] chat_client:say(Client, Msg). 2. [Chat client] chat_client:handle_cast({say, Msg},...). 3. [Chat client] chat_server:broadcast_message(Srv, SenderNick, Msg). 4. [Chat server] chat_server:handle_cast({broadcast_message, SenderNick, Msg),...). 5. [Chat server] For each connected client: 5.1 [Chat server] chat_client:receive_message(EachClient, SenderNick, Msg). 5.2 [Chat client] chat_client:handle_cast({receive_message, SenderNick, Msg},...). What's missing: * Some of the server internals. * Some of the client internals. * Tests. * Store messages on clients for further processing instead of just printing them. * You can generate and broadcast automatic connect / disconnect messages. Hope this helps, Ladislav Lenart On 12.4.2012 23:39, megalomania wrote: > up! > Well im trying make a gen_server for a client, but i dont now how get the > messages that server sends, i cant register the client cuz this would be > generic, any idea? > > -- > View this message in context: http://erlang.2086793.n4.nabble.com/Comunication-between-2-gen-server-s-tp4551836p4553168.html > Sent from the Erlang Questions mailing list archive at Nabble.com. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From tuncer.ayaz@REDACTED Fri Apr 13 10:11:24 2012 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Fri, 13 Apr 2012 10:11:24 +0200 Subject: [erlang-questions] set up traces on live system - SF 2012 erlounge - who In-Reply-To: References: Message-ID: On Fri, Apr 13, 2012 at 7:47 AM, Seth Falcon wrote: > On Apr 12, 2012, at 9:42 AM, Wes James wrote: >> Someone gave a lightning talk on setting traces on live systems for >> debugging - who was that and do you have some info somewhere >> (tutorial) recap of what you covered? > > I think that was dizzyd. He posted the following gist of his timeit module: > > ? https://gist.github.com/2257931 Don't forget redbug and if you have 15B01 try observer:start() for tracing, monitoring, and other tasks. From ngocdaothanh@REDACTED Fri Apr 13 10:56:58 2012 From: ngocdaothanh@REDACTED (Ngoc Dao) Date: Fri, 13 Apr 2012 17:56:58 +0900 Subject: [erlang-questions] set up traces on live system - SF 2012 erlounge - who In-Reply-To: References: Message-ID: > Don't forget redbug and if you have 15B01 try observer:start() > for tracing, monitoring, and other tasks. Good to know observer. It looks more powerful than Akka Console: http://console-demo.typesafe.com/ Doesn't it deserve some screenshots in the documentation? From alanrevans@REDACTED Fri Apr 13 11:57:35 2012 From: alanrevans@REDACTED (Alan Evans) Date: Fri, 13 Apr 2012 10:57:35 +0100 Subject: [erlang-questions] Is there an accepted way of including GPL code in a project? Message-ID: Hello list, I'm thinking about using some GPL code in a project I'm working on. Namely the SIGTRAN stack from the osmocom project (http://cgit.osmocom.org/cgit/erlang) Is there a recognized way to incorporate GPL code in an erlang project without making the whole project subject to the GPL license? I haven't yet decided whether or not to make my project open source. My thinking is that if I isolate all the GPL code to a particular Erlang node then only the modules running on that node need to be GPL or GPL compatible, I am free to license the modules running on the other nodes any way I wish. Any thoughts? Other than the obvious "ask a lawyer" response :-) Thanks in advance AlanE. From erlang@REDACTED Fri Apr 13 13:06:22 2012 From: erlang@REDACTED (Joe Armstrong) Date: Fri, 13 Apr 2012 13:06:22 +0200 Subject: [erlang-questions] Is there an accepted way of including GPL code in a project? In-Reply-To: References: Message-ID: It has been suggest that the Erlang licence be changed to MPL2 If [*] this change were to be made would it solve your problem? /Joe [*] (please note the word "if" - this is not a promise it's a pure question) On Fri, Apr 13, 2012 at 11:57 AM, Alan Evans wrote: > Hello list, > > I'm thinking about using some GPL code in a project I'm working on. > Namely the SIGTRAN stack from the osmocom project > (http://cgit.osmocom.org/cgit/erlang) > Is there a recognized way to incorporate GPL code in an erlang project > without making the whole project subject to the GPL license? > > I haven't yet decided whether or not to make my project open source. > > My thinking is that if I isolate all the GPL code to a particular > Erlang node then only the modules running on that node need to be GPL > or GPL compatible, I am free to license the modules running on the > other nodes any way I wish. > > Any thoughts? Other than the obvious "ask a lawyer" response :-) > > Thanks in advance > AlanE. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From bourinov@REDACTED Fri Apr 13 13:23:34 2012 From: bourinov@REDACTED (Max Bourinov) Date: Fri, 13 Apr 2012 15:23:34 +0400 Subject: [erlang-questions] Wrangler 1.0 released In-Reply-To: References: <4F844FA8.1030305@ninenines.eu> <4F84546A.5090301@ninenines.eu> <9FE7C4D7-6865-423C-9C72-344BB4813AB4@kent.ac.uk> <4F85E35B.7080302@gmail.com> Message-ID: +1 for Sublime Best regards, Max On Thu, Apr 12, 2012 at 12:18 PM, wrote: > > Congratulation on the release! > > > > Is there a command line mode that would allow clone detection to run on > > a CI server? > > > > The clone detection can be run from within an Erlang shell. This is no > support for OS command line yet. > > Regards, > Huiqing > > > BTW: +1 for a vim mode :) > > > > Cheers > > - Tilman > > > > On 12-04-11 02:11 AM, Simon Thompson wrote: > >> Thanks for all the interest in vim we'd be very happy to help anyone > >> who is keen to integrate Wrangler into vim, or indeed other editors. > >> > >> Kind regards > >> > >> Huiqing and SImon > >> > >> > >> On 11 Apr 2012, at 01:00, Phillip Toland wrote: > >> > >>> On Tue, Apr 10, 2012 at 12:03 PM, Andr? Graf > wrote: > >>>> congrats to 1.0, unfortunately not on vim! > >>>> how much work would it be to port wrangler to vim? I guess there are > >>>> several vim users who would like to see wrangler support in vim and > >>>> might also contribute. > >>> > >>> I am such a Vim user. +1 > >>> > >>> > >>> > >>> ~p > >>> _______________________________________________ > >>> erlang-questions mailing list > >>> erlang-questions@REDACTED > >>> http://erlang.org/mailman/listinfo/erlang-questions > >> > >> Simon Thompson | Professor of Logic and Computation > >> School of Computing | University of Kent | Canterbury, CT2 7NF, UK > >> s.j.thompson@REDACTED | M +44 7986 085754 | W www.cs.kent.ac.uk/~sjt > >> > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From amindfv@REDACTED Fri Apr 13 15:02:23 2012 From: amindfv@REDACTED (Tom Murphy) Date: Fri, 13 Apr 2012 09:02:23 -0400 Subject: [erlang-questions] Is there an accepted way of including GPL code in a project? In-Reply-To: References: Message-ID: Is this possible, to switch licenses? I'd think all the Erlang code that was already under the GPL has to stay under the GPL. Tom On 4/13/12, Joe Armstrong wrote: > It has been suggest that the Erlang licence be changed to MPL2 > If [*] this change were to be made would it solve your problem? > > /Joe > > [*] (please note the word "if" - this is not a promise it's a pure question) > > > On Fri, Apr 13, 2012 at 11:57 AM, Alan Evans wrote: >> Hello list, >> >> I'm thinking about using some GPL code in a project I'm working on. >> Namely the SIGTRAN stack from the osmocom project >> (http://cgit.osmocom.org/cgit/erlang) >> Is there a recognized way to incorporate GPL code in an erlang project >> without making the whole project subject to the GPL license? >> >> I haven't yet decided whether or not to make my project open source. >> >> My thinking is that if I isolate all the GPL code to a particular >> Erlang node then only the modules running on that node need to be GPL >> or GPL compatible, I am free to license the modules running on the >> other nodes any way I wish. >> >> Any thoughts? Other than the obvious "ask a lawyer" response :-) >> >> Thanks in advance >> AlanE. >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From zabrane3@REDACTED Fri Apr 13 15:06:22 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Fri, 13 Apr 2012 15:06:22 +0200 Subject: [erlang-questions] Wrangler 1.0 released In-Reply-To: References: <4F844FA8.1030305@ninenines.eu> <4F84546A.5090301@ninenines.eu> <9FE7C4D7-6865-423C-9C72-344BB4813AB4@kent.ac.uk> <4F85E35B.7080302@gmail.com> Message-ID: <75DC822A-EC4E-4146-834B-F3810930E293@gmail.com> +2 for Sublime On Apr 13, 2012, at 1:23 PM, Max Bourinov wrote: > +1 for Sublime > > > > Best regards, > Max From gleber.p@REDACTED Fri Apr 13 15:06:37 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Fri, 13 Apr 2012 15:06:37 +0200 Subject: [erlang-questions] Is there an accepted way of including GPL code in a project? In-Reply-To: References: Message-ID: On Fri, Apr 13, 2012 at 15:02, Tom Murphy wrote: > Is this possible, to switch licenses? I'd think all the Erlang code > that was already under the GPL has to stay under the GPL. Authors of the code are always free to re-release their code in whatever license they want. The culprit is that if GPL code has ever reached one's hands, that person is allowed to redistribute it as long and as much as he wants under GPL. Hence there can be a situation when the same code is circulating under two licenses and everything is clean legally From bchesneau@REDACTED Fri Apr 13 15:15:48 2012 From: bchesneau@REDACTED (Benoit Chesneau) Date: Fri, 13 Apr 2012 13:15:48 +0000 Subject: [erlang-questions] Is there an accepted way of including GPL code in a project? In-Reply-To: References: Message-ID: On Fri, Apr 13, 2012 at 11:06 AM, Joe Armstrong wrote: > It has been suggest that the Erlang licence be changed to MPL2 > If [*] ?this change were to be made would it solve your problem? > > /Joe > Using MPL2 for the Erlang license would be the worst thing to do. MPL2 licensed project can't be integrated in BSD and Apache 2 licenses I also wonder how would work a gen_server under an Apache 2 license with an MPL2 code ... I will let that to the layers. - beno?t From ulf@REDACTED Fri Apr 13 14:38:45 2012 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 13 Apr 2012 14:38:45 +0200 Subject: [erlang-questions] Is there an accepted way of including GPL code in a project? In-Reply-To: References: Message-ID: <14C428C7-89A6-4099-BEA5-B419C776372B@feuerlabs.com> You cannot affect the license of Erlang/OTP, since you are not the copyright owner. (As an example, ejabberd is GPL, but that doesn't affect the Erlang/OTP license, or their right to use it). The thing to worry about is what happens to _your_ code when you bundle it with GPL:d libraries. If your code is a extends or modifies the GPL:d code, and you distribute it, you must also distribute the source code as GPL. In any case, the operative sentence in the Affero GPL license ought to be: To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. That is, unless you modify or extend the GPL:d code in a way that would require copyright permission, _and_ distribute the executables, you are also obligated to distribute the modified code under GPL, e.g. by pushing your fork of it to github or equivalent. Merely using it, as an unmodified OTP application, should not be a problem. BR, Ulf W On 13 Apr 2012, at 11:57, Alan Evans wrote: > Hello list, > > I'm thinking about using some GPL code in a project I'm working on. > Namely the SIGTRAN stack from the osmocom project > (http://cgit.osmocom.org/cgit/erlang) > Is there a recognized way to incorporate GPL code in an erlang project > without making the whole project subject to the GPL license? > > I haven't yet decided whether or not to make my project open source. > > My thinking is that if I isolate all the GPL code to a particular > Erlang node then only the modules running on that node need to be GPL > or GPL compatible, I am free to license the modules running on the > other nodes any way I wish. > > Any thoughts? Other than the obvious "ask a lawyer" response :-) > > Thanks in advance > AlanE. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com From inanun@REDACTED Fri Apr 13 15:36:45 2012 From: inanun@REDACTED (Kyungho Yun) Date: Fri, 13 Apr 2012 22:36:45 +0900 Subject: [erlang-questions] How to speed up mnesia startup? In-Reply-To: References: <4DD5E107-B488-4A57-B2F6-85B00BBCC8BA@feuerlabs.com> <4B0456F0-5168-457A-8733-6E0BE840C47E@cs.otago.ac.nz> Message-ID: Thanks for replies. I just know why it takes so long time to start up mnesia. It looks fine to work except long time mnesia startup. But it's getting worse problem because the number of tables are increasing. Most of tables have same personally. The maximum size(whichever 2GB or 4GB) limit of dets was main problem to use single table. I needed short response from mnesia but I wasn't sure that fragmentation is right choice. so I used lots of tables instead of it. Some of table's size are about 50M Bytes. (about 130k no_objects(same no_keys)) Some of table's size are about 30K Bytes. (about 100 no_objects(same no_keys)) Is the fragmentation only way to reduce mnesia startup time? thanks On Fri, Apr 13, 2012 at 2:53 PM, Ulf Wiger wrote: > > > On 13 Apr 2012, at 00:31, Richard O'Keefe wrote: > > > > > On 12/04/2012, at 9:26 PM, Ulf Wiger wrote: > > > >> > >> Hmm, the first thing that stands out is the inordinate number of tables. > >> > >> Out of curiosity, I tried figuring out what is considered a reasonable > number of tables for other database management systems: > >> > >> - Oracle: over 10,000 tables considered insane > >> ( > http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:26039880025641 > ) > > > > That page has no claim that *Oracle* cannot handle it. > > The arguments given are > > - that it seems extremely unlikely that people could "design, > > implement, or maintain" a system with 10,000 distinct tables > > "personally". > ? > > Fair enough. My point was mainly that 60k tables is well beyond what most > database management systems are optimized for. The question is obviously > here what _nmesia_ is good at, but I just wanted to illustrate that if you > want to build a database with 60k tables, you shouldn't _assume_ that any > given dbms will handle it well. > > As far as mnesia is concerned, there are a number of commonly used > functions that are reasonable as long as the number of tables is somewhere > in the hundreds. > > Take, for example, mnesia:wait_for_tables/2. Let's assume that our > application actually needs those 60k tables to be loaded before it starts > doing things. > > wait_for_tables/2 is basically implemented like this (lots of code > snipped): > > wait_for_tables_init(From, Tabs) -> > process_flag(trap_exit, true), > ... > cast({sync_tabs, Tabs, self()}), > rec_tabs(Tabs, Tabs, From, Init) > end. > > rec_tabs([Tab | Tabs], AllTabs, From, Init) -> > receive > {?SERVER_NAME, {tab_synced, Tab}} -> > rec_tabs(Tabs, AllTabs, From, Init); > ... > end; > rec_tabs([], _, _, Init) -> > unlink(Init), > ok. > > To begin with, if the objective was to support tens of thousand tables, it > would be better to provide functions to efficiently query the 'table of > tables'. Currently, there is no table of tables, but a system_info(tables), > which provides them all as a list (including 'schema', which you often must > delete from the list, since you can't, for example, do wait_for tables on > the schema). > > In the code above, mnesia sends the 60k list of tables in a single > message. It then loops through the list and does selective receive on the > replies belonging to each. This is a convenient way to do it when the list > of Tabs is short, but pretty awful for a very large list, since each > iteration may end up scanning a rather large message queue. > > This was just one example. Mnesia was not designed with this sort of thing > in mind. > > BR, > Ulf W > > Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. > http://feuerlabs.com > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From comptekki@REDACTED Fri Apr 13 15:40:18 2012 From: comptekki@REDACTED (Wes James) Date: Fri, 13 Apr 2012 07:40:18 -0600 Subject: [erlang-questions] set up traces on live system - SF 2012 erlounge - who In-Reply-To: References: Message-ID: Thanks! (and Tuncer about Observer) -wes On Thu, Apr 12, 2012 at 11:47 PM, Seth Falcon wrote: > On Apr 12, 2012, at 9:42 AM, Wes James wrote: >> Someone gave a lightning talk on setting traces on live systems for >> debugging - who was that and do you have some info somewhere >> (tutorial) recap of what you covered? > > I think that was dizzyd. He posted the following gist of his timeit module: > > ? https://gist.github.com/2257931 > > + seth > > -- > Seth Falcon | @sfalcon | http://userprimary.net/ > > > > From torben.lehoff@REDACTED Fri Apr 13 15:50:52 2012 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Fri, 13 Apr 2012 15:50:52 +0200 Subject: [erlang-questions] Is there an accepted way of including GPL code in a project? In-Reply-To: <14C428C7-89A6-4099-BEA5-B419C776372B@feuerlabs.com> References: <14C428C7-89A6-4099-BEA5-B419C776372B@feuerlabs.com> Message-ID: <4F882F3C.6000806@gmail.com> Ulf is absolutely right about the distribution requirements. However, if you use GPLv3 code your own code has a very high risk of becoming GPLv3 - even if you have not modified the code, but merely calls it! But it will only become so if you distribute the code. If your code is running on a server you control, i.e., you have not distributed it to anyone, then you have not distributed anything and your code is safe. Cheers, Torben On 13/4/12 14:38 , Ulf Wiger wrote: > You cannot affect the license of Erlang/OTP, since you are not the copyright owner. > > (As an example, ejabberd is GPL, but that doesn't affect the Erlang/OTP license, or their right to use it). > > The thing to worry about is what happens to _your_ code when you bundle it with GPL:d libraries. > > If your code is a extends or modifies the GPL:d code, and you distribute it, you must also distribute the source code as GPL. > > In any case, the operative sentence in the Affero GPL license ought to be: > > To "modify" a work means to copy from or adapt all or part of the work > in a fashion requiring copyright permission, other than the making of an > exact copy. The resulting work is called a "modified version" of the > earlier work or a work "based on" the earlier work. > > That is, unless you modify or extend the GPL:d code in a way that would require copyright permission, _and_ distribute the executables, you are also obligated to distribute the modified code under GPL, e.g. by pushing your fork of it to github or equivalent. > > Merely using it, as an unmodified OTP application, should not be a problem. > > BR, > Ulf W > > On 13 Apr 2012, at 11:57, Alan Evans wrote: > >> Hello list, >> >> I'm thinking about using some GPL code in a project I'm working on. >> Namely the SIGTRAN stack from the osmocom project >> (http://cgit.osmocom.org/cgit/erlang) >> Is there a recognized way to incorporate GPL code in an erlang project >> without making the whole project subject to the GPL license? >> >> I haven't yet decided whether or not to make my project open source. >> >> My thinking is that if I isolate all the GPL code to a particular >> Erlang node then only the modules running on that node need to be GPL >> or GPL compatible, I am free to license the modules running on the >> other nodes any way I wish. >> >> Any thoughts? Other than the obvious "ask a lawyer" response :-) >> >> Thanks in advance >> AlanE. >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > Ulf Wiger, Co-founder& Developer Advocate, Feuerlabs Inc. > http://feuerlabs.com > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- http://www.linkedin.com/in/torbenhoffmann From alanrevans@REDACTED Fri Apr 13 15:57:11 2012 From: alanrevans@REDACTED (Alan Evans) Date: Fri, 13 Apr 2012 14:57:11 +0100 Subject: [erlang-questions] Is there an accepted way of including GPL code in a project? In-Reply-To: <14C428C7-89A6-4099-BEA5-B419C776372B@feuerlabs.com> References: <14C428C7-89A6-4099-BEA5-B419C776372B@feuerlabs.com> Message-ID: Thanks Ulf for steering the conversation back. I think it's generally understood that the licensing of the Erlang/OTP is unaffected by licenses placed on any Erlang modules that 'Joe Public' may write and distribute. My question refers to the code that I have written. Is there a generally recognized mechanism to incorporate GPL'd code into my project without then having to release my code as GPL. My understanding is as long as I don't link my code directly with the GPL'd code then I can distribute the work under separate licenses. The GPL part will stay GPL, any fixes and features that I add to the GPL'd code will also be GPL'd but I'm free to license my other code as I wish, I would think keeping the code on separate Erlang nodes (which could be 2 separate machines) should be enough to show that the work is separate, but has there been a precedent set already? Thanks AlanE On Fri, Apr 13, 2012 at 1:38 PM, Ulf Wiger wrote: > > You cannot affect the license of Erlang/OTP, since you are not the copyright owner. > > (As an example, ejabberd is GPL, but that doesn't affect the Erlang/OTP license, or their right to use it). > > The thing to worry about is what happens to _your_ code when you bundle it with GPL:d libraries. > > If your code is a extends or modifies the GPL:d code, and you distribute it, you must also distribute the source code as GPL. > > In any case, the operative sentence in the Affero GPL license ought to be: > > ? ? ? ?To "modify" a work means to copy from or adapt all or part of the work > ? ? ? ?in a fashion requiring copyright permission, other than the making of an > ? ? ? ?exact copy. ?The resulting work is called a "modified version" of the > ? ? ? ?earlier work or a work "based on" the earlier work. > > That is, unless you modify or extend the GPL:d code in a way that would require copyright permission, _and_ distribute the executables, you are also obligated to distribute the modified code under GPL, e.g. by pushing your fork of it to github or equivalent. > > Merely using it, as an unmodified OTP application, should not be a problem. > > BR, > Ulf W > From alanrevans@REDACTED Fri Apr 13 16:03:40 2012 From: alanrevans@REDACTED (Alan Evans) Date: Fri, 13 Apr 2012 15:03:40 +0100 Subject: [erlang-questions] Is there an accepted way of including GPL code in a project? In-Reply-To: <4F882F3C.6000806@gmail.com> References: <14C428C7-89A6-4099-BEA5-B419C776372B@feuerlabs.com> <4F882F3C.6000806@gmail.com> Message-ID: Hi Torben, The code in question from osmocom is licensed under the terms of the GNU Affero General Public License v3. This license specifically includes the situation where the code is on a server and not distributed. cheers AlanE From ulf@REDACTED Fri Apr 13 17:03:17 2012 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 13 Apr 2012 17:03:17 +0200 Subject: [erlang-questions] Is there an accepted way of including GPL code in a project? In-Reply-To: References: <14C428C7-89A6-4099-BEA5-B419C776372B@feuerlabs.com> Message-ID: Of course, the whole question of "linking" in regard to Erlang code is tricky. Strictly speaking, you do not "link" to the other application even if they run in the same node, but that is my erlang programmer's POV - a lawyer may be of a different opinion. Still, it seems to be the consequence of the sentence: This License explicitly affirms your unlimited permission to run the unmodified Program. The Erlang VM allows you to run concurrent applications in their own (logical) memory space, without needing to perform any special linking or merging steps, other than telling the code loader where they can be found. In this, running Erlang applications is more akin to running user-space applications in Linux. The way I read the part I snipped from the Affero license in question, especially in light of the above, ...copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy is that you are only making an exact copy and running it, as long as you do not change any files in the applications's source tree. Here is a possibly related and enlightening exchange regarding the GPL and Linux: http://kerneltrap.org/node/1735 BR, Ulf W On 13 Apr 2012, at 15:57, Alan Evans wrote: > My understanding is as long as I don't link my code directly with the > GPL'd code then I can distribute the work under separate licenses. The > GPL part will stay GPL, any fixes and features that I add to the GPL'd > code will also be GPL'd but I'm free to license my other code as I > wish, > > I would think keeping the code on separate Erlang nodes (which could > be 2 separate machines) should be enough to show that the work is > separate, but has there been a precedent set already? Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com From dafgar@REDACTED Fri Apr 13 17:24:43 2012 From: dafgar@REDACTED (Sergei Fomin) Date: Fri, 13 Apr 2012 19:24:43 +0400 Subject: [erlang-questions] Ssl tuning Message-ID: <4F88453B.4020405@yandex-team.ru> Hello. We tried some load testing of erlang ssl and have some questions. The bench is Xeon with 24 cores, otp R15B and modified mochweb server. Mochiweb acceptor is modified to do gen_tcp:accept, start new acceptor and call ssl:ssl_accept. Original mochiweb acceptor calls ssl:transport_accept, ssl:ssl_accept and only then spawns new acceptor. The server accepts requests and answers 200 immediately. First iteration. When load rate reached 1300 rps ssl_connection_sup process began to accumulate message queue. Second iteration. I moved all ssl_connection initialization code from init to separate function, the call to which was triggered by message send from init (simply delayed init). This way ssl_connection_sup was just spawning ssl_connection process and sending init message to it. Ssl_manager process became the new bottleneck. The threshold load rate increased insignificantly. According to top all cores had load ~60%. Any ideas how to tune ssl noninvasively to achieve more results? -- Sergei Fomin From brian@REDACTED Fri Apr 13 20:33:45 2012 From: brian@REDACTED (Brian Troutwine) Date: Fri, 13 Apr 2012 13:33:45 -0500 Subject: [erlang-questions] How to speed up mnesia startup? In-Reply-To: References: <4DD5E107-B488-4A57-B2F6-85B00BBCC8BA@feuerlabs.com> <4B0456F0-5168-457A-8733-6E0BE840C47E@cs.otago.ac.nz> Message-ID: Out of curiosity, what is it you're modeling that you need so many tables? On Fri, Apr 13, 2012 at 8:36 AM, Kyungho Yun wrote: > Thanks for replies. > I just know why it takes so long time to start up mnesia. > > > It looks fine to work except long time mnesia startup. > But it's getting worse problem because the number of tables are increasing. > > > Most of tables have same personally. > > The maximum size(whichever 2GB or 4GB) limit of dets was main problem to use > single table. > I needed short response from mnesia but I wasn't sure that fragmentation is > right choice. > > so I used lots of tables instead of it. > > Some of table's size are about 50M Bytes. (about 130k no_objects(same > no_keys)) > Some of table's size are about 30K Bytes. (about 100 no_objects(same > no_keys)) > > > Is the fragmentation only way to reduce mnesia startup time? > > thanks > > > On Fri, Apr 13, 2012 at 2:53 PM, Ulf Wiger wrote: >> >> >> >> On 13 Apr 2012, at 00:31, Richard O'Keefe wrote: >> >> > >> > On 12/04/2012, at 9:26 PM, Ulf Wiger wrote: >> > >> >> >> >> Hmm, the first thing that stands out is the inordinate number of >> >> tables. >> >> >> >> Out of curiosity, I tried figuring out what is considered a reasonable >> >> number of tables for other database management systems: >> >> >> >> - Oracle: over 10,000 tables considered insane >> >> >> >> ?(http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:26039880025641) >> > >> > That page has no claim that *Oracle* cannot handle it. >> > The arguments given are >> > - that it seems extremely unlikely that people could "design, >> > ? implement, or maintain" a system with 10,000 distinct tables >> > ? "personally". >> ? >> >> Fair enough. My point was mainly that 60k tables is well beyond what most >> database management systems are optimized for. The question is obviously >> here what _nmesia_ is good at, but I just wanted to illustrate that if you >> want to build a database with 60k tables, you shouldn't _assume_ that any >> given dbms will handle it well. >> >> As far as mnesia is concerned, there are a number of commonly used >> functions that are reasonable as long as the number of tables is somewhere >> in the hundreds. >> >> Take, for example, mnesia:wait_for_tables/2. Let's assume that our >> application actually needs those 60k tables to be loaded before it starts >> doing things. >> >> wait_for_tables/2 is basically implemented like this (lots of code >> snipped): >> >> wait_for_tables_init(From, Tabs) -> >> ? ?process_flag(trap_exit, true), >> ? ?... >> ? ?cast({sync_tabs, Tabs, self()}), >> ? ? ? ? ? ?rec_tabs(Tabs, Tabs, From, Init) >> ? ?end. >> >> rec_tabs([Tab | Tabs], AllTabs, From, Init) -> >> ? ?receive >> ? ? ? ?{?SERVER_NAME, {tab_synced, Tab}} -> >> ? ? ? ? ? ?rec_tabs(Tabs, AllTabs, From, Init); >> ? ? ? ?... >> ? ?end; >> rec_tabs([], _, _, Init) -> >> ? ?unlink(Init), >> ? ?ok. >> >> To begin with, if the objective was to support tens of thousand tables, it >> would be better to provide functions to efficiently query the 'table of >> tables'. Currently, there is no table of tables, but a system_info(tables), >> which provides them all as a list (including 'schema', which you often must >> delete from the list, since you can't, for example, do wait_for tables on >> the schema). >> >> In the code above, mnesia sends the 60k list of tables in a single >> message. It then loops through the list and does selective receive on the >> replies belonging to each. This is a convenient way to do it when the list >> of Tabs is short, but pretty awful for a very large list, since each >> iteration may end up scanning a rather large message queue. >> >> This was just one example. Mnesia was not designed with this sort of thing >> in mind. >> >> BR, >> Ulf W >> >> Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. >> http://feuerlabs.com >> >> >> > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Brian L. Troutwine From dmitryme@REDACTED Fri Apr 13 21:18:52 2012 From: dmitryme@REDACTED (Dmitry Melnikov) Date: Fri, 13 Apr 2012 23:18:52 +0400 Subject: [erlang-questions] trapexit.org Message-ID: Hello, all, does somebody know what happened with trapexit.com ? -------------- next part -------------- An HTML attachment was scrubbed... URL: From wiley.andrew.j@REDACTED Sat Apr 14 07:43:08 2012 From: wiley.andrew.j@REDACTED (Andrew Wiley) Date: Sat, 14 Apr 2012 00:43:08 -0500 Subject: [erlang-questions] HiPE on ARM Build Issue Message-ID: Hello, I'm trying to get Erlang with HiPE to build on an ARMv7 box (a Trimslice - http://trimslice.com/ ), and I'm getting an undefined reference to am_arm. I'm building R15B01, and the build commands I'm using are: ./otp_build autoconf ./otp_build configure --enable-native-libs --enable-hipe --prefix=/usr --enable-smp-support --enable-threads ./otp_build boot The build failure looks like this: gcc -g -O3 -fomit-frame-pointer -I/home/wiley/build/erlang2/test2/otp_src_R15B01/erts/armv7l-unknown-linux-gnu -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fno-tree-copyrename -D_GNU_SOURCE -DERTS_SMP -DHAVE_CONFIG_H -Wall -Wstrict-prototypes -Wmissing-prototypes -Wdeclaration-after-statement -DUSE_THREADS -D_THREAD_SAFE -D_REENTRANT -DPOSIX_THREADS -D_POSIX_THREAD_SAFE_FUNCTIONS -Iarmv7l-unknown-linux-gnu/opt/smp -Ibeam -Isys/unix -Isys/common -Iarmv7l-unknown-linux-gnu -Izlib -Ipcre -Ihipe -I../include -I../include/armv7l-unknown-linux-gnu -I../include/internal -I../include/internal/armv7l-unknown-linux-gnu -c beam/erl_bif_info.c -o obj/armv7l-unknown-linux-gnu/opt/smp/erl_bif_info.o beam/erl_bif_info.c: In function ?system_info_1?: beam/erl_bif_info.c:2133:2: error: ?am_arm? undeclared (first use in this function) beam/erl_bif_info.c:2133:2: note: each undeclared identifier is reported only once for each function it appears in make[3]: *** [obj/armv7l-unknown-linux-gnu/opt/smp/erl_bif_info.o] Error 1 make[3]: Leaving directory `/home/wiley/build/erlang2/test2/otp_src_R15B01/erts/emulator' make[2]: *** [opt] Error 2 make[2]: Leaving directory `/home/wiley/build/erlang2/test2/otp_src_R15B01/erts/emulator' make[1]: *** [smp] Error 2 make[1]: Leaving directory `/home/wiley/build/erlang2/test2/otp_src_R15B01/erts' make: *** [emulator] Error 2 It looks like am_x86 is declared in erts/emulator/armv7l-unknown-linux-gnu/erl_atom_table.h; should am_arm be in there as well? I'm not sure what else would be helpful to diagnose this, but here's `uname -a`: Linux tseng 3.2.1-1-ARCH #1 SMP PREEMPT Sun Jan 22 06:37:13 UTC 2012 armv7l ARMv7 Processor rev 0 (v7l) trimslice GNU/Linux Thanks, Andrew -------------- next part -------------- An HTML attachment was scrubbed... URL: From wiley.andrew.j@REDACTED Sat Apr 14 09:24:12 2012 From: wiley.andrew.j@REDACTED (Andrew Wiley) Date: Sat, 14 Apr 2012 02:24:12 -0500 Subject: [erlang-questions] HiPE on ARM Build Issue In-Reply-To: References: Message-ID: On Sat, Apr 14, 2012 at 12:43 AM, Andrew Wiley wrote: > Hello, > > I'm trying to get Erlang with HiPE to build on an ARMv7 box (a Trimslice - > http://trimslice.com/ ), and I'm getting an > undefined reference to am_arm. I'm building R15B01, and the build commands > I'm using are: > ./otp_build autoconf > ./otp_build configure --enable-native-libs --enable-hipe --prefix=/usr > --enable-smp-support --enable-threads > ./otp_build boot > > The build failure looks like this: > gcc -g -O3 -fomit-frame-pointer > -I/home/wiley/build/erlang2/test2/otp_src_R15B01/erts/armv7l-unknown-linux-gnu > -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fno-tree-copyrename > -D_GNU_SOURCE -DERTS_SMP -DHAVE_CONFIG_H -Wall -Wstrict-prototypes > -Wmissing-prototypes -Wdeclaration-after-statement -DUSE_THREADS > -D_THREAD_SAFE -D_REENTRANT -DPOSIX_THREADS -D_POSIX_THREAD_SAFE_FUNCTIONS > -Iarmv7l-unknown-linux-gnu/opt/smp -Ibeam -Isys/unix -Isys/common > -Iarmv7l-unknown-linux-gnu -Izlib -Ipcre -Ihipe -I../include > -I../include/armv7l-unknown-linux-gnu -I../include/internal > -I../include/internal/armv7l-unknown-linux-gnu -c beam/erl_bif_info.c -o > obj/armv7l-unknown-linux-gnu/opt/smp/erl_bif_info.o > beam/erl_bif_info.c: In function ?system_info_1?: > beam/erl_bif_info.c:2133:2: error: ?am_arm? undeclared (first use in this > function) > beam/erl_bif_info.c:2133:2: note: each undeclared identifier is reported > only once for each function it appears in > make[3]: *** [obj/armv7l-unknown-linux-gnu/opt/smp/erl_bif_info.o] Error 1 > make[3]: Leaving directory > `/home/wiley/build/erlang2/test2/otp_src_R15B01/erts/emulator' > make[2]: *** [opt] Error 2 > make[2]: Leaving directory > `/home/wiley/build/erlang2/test2/otp_src_R15B01/erts/emulator' > make[1]: *** [smp] Error 2 > make[1]: Leaving directory > `/home/wiley/build/erlang2/test2/otp_src_R15B01/erts' > make: *** [emulator] Error 2 > > It looks like am_x86 is declared in > erts/emulator/armv7l-unknown-linux-gnu/erl_atom_table.h; should am_arm be > in there as well? > I'm not sure what else would be helpful to diagnose this, but here's > `uname -a`: > Linux tseng 3.2.1-1-ARCH #1 SMP PREEMPT Sun Jan 22 06:37:13 UTC 2012 > armv7l ARMv7 Processor rev 0 (v7l) trimslice GNU/Linux > > Thanks, > Andrew > Just saw http://erlang.org/pipermail/erlang-bugs/2006-December/000268.html and it looks like I'm having the same issue. Are there any plans to try to fix configure.in so that ARM builds like this either work or produce an error? -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Sat Apr 14 09:44:30 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Sat, 14 Apr 2012 11:44:30 +0400 Subject: [erlang-questions] How to use "jobs": schedule tasks by core number Message-ID: Hi. I have 100 tasks to execute, each takes about 10 seconds and uses 1 core. I want them to run 8 simultaneously (by core number). What is the best way? I think that esl/jobs is right what I need: create some queue and let it schedule jobs. If yes, so can anyone share me a simple snippet of code, how to do it? I haven't found even any examples in google, only jobs source code, which is rather complicated. Next question will be: how to distribute these tasks among cluster? From kostis@REDACTED Sat Apr 14 10:12:47 2012 From: kostis@REDACTED (Kostis Sagonas) Date: Sat, 14 Apr 2012 10:12:47 +0200 Subject: [erlang-questions] HiPE on ARM Build Issue In-Reply-To: References: Message-ID: <4F89317F.80002@cs.ntua.gr> On 04/14/2012 09:24 AM, Andrew Wiley wrote: > On Sat, Apr 14, 2012 at 12:43 AM, Andrew Wiley > wrote: > > Hello, > > I'm trying to get Erlang with HiPE to build on an ARMv7 box (a > Trimslice - http://trimslice.com/ ), and > I'm getting an undefined reference to am_arm. I'm building R15B01, > and the build commands I'm using are: > ./otp_build autoconf > ./configure --enable-native-libs --enable-hipe > --prefix=/usr --enable-smp-support --enable-threads > ./otp_build boot > > The build failure looks like this: > ... > > It looks like am_x86 is declared in > erts/emulator/armv7l-unknown-linux-gnu/erl_atom_table.h; should > am_arm be in there as well? > I'm not sure what else would be helpful to diagnose this, but here's > `uname -a`: > Linux tseng 3.2.1-1-ARCH #1 SMP PREEMPT Sun Jan 22 06:37:13 UTC 2012 > armv7l ARMv7 Processor rev 0 (v7l) trimslice GNU/Linux > > Just saw > http://erlang.org/pipermail/erlang-bugs/2006-December/000268.html and it > looks like I'm having the same issue. Are there any plans to try to fix > configure.in so that ARM builds like this either > work or produce an error? In the HiPE team we would very much like to support the ARM architecture but the problem these days - for quite some time actually - is that we do not have access to any machine with an ARM processor. It's very painful to be testing ARM using QEMU, esp. all sorts of different ARMs that exist these days. Hence, occasionally code tends to rot or, as in this case which involves a newer ARMv7, code has never been tested on newer architectures. (I do not know what sort of access to ARM machines the Erlang/OTP team at Ericsson has, but I suspect that they do not have access to all possible ARMs either.) In this particular case, I would recommend that you extend the following lines in erts/configure.in armv5b) ARCH=arm;; armv5teb) ARCH=arm;; armv5tel) ARCH=arm;; with the line that corresponds to your newer armv7 and test to see what happens. If all goes well, please submit a patch using git. Also, since you are on an unexplored territory, I would recommend to build Erlang/OTP in two steps. First do: ./configure --enable-hipe ... which will test if Erlang/OTP can be built with HiPE support, and only if that works do: make clean // or start from a fresh copy, for extra safety ./configure --enable-hipe ... --enable-native-libs which will additionally test that the HiPE compiler generates correct native code and is able to self-compile itself (as well as many of the Erlang/OTP libraries: currently kernel, stdlib, compiler, syntax_tools, hipe, dialyzer, and typer). In any case, please report your findings here. Kostis PS. We welcome support, for example, donations of ARM-based machines that we can be using to test the HiPE compiler or its newer LLVM-based back-end (see http://erllvm.softlab.ntua.gr/) more regularly. Similar with other exotic architectures that people these days care about. Minimally, if you want native code for some configuration other than x86 and x86_64-based machines, give us some form of remote access to it. From zabrane3@REDACTED Sat Apr 14 10:17:54 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Sat, 14 Apr 2012 10:17:54 +0200 Subject: [erlang-questions] How to use "jobs": schedule tasks by core number In-Reply-To: References: Message-ID: I've asked "Ulf" long time ago about esl/jobs doc + examples (he was very busy). May be he can help on that now!! Regards, Zabrane On Apr 14, 2012, at 9:44 AM, Max Lapshin wrote: > Hi. I have 100 tasks to execute, each takes about 10 seconds and uses 1 core. > > I want them to run 8 simultaneously (by core number). What is the best way? > > I think that esl/jobs is right what I need: create some queue and let > it schedule jobs. If yes, so can anyone share me a simple snippet of > code, how to do it? > I haven't found even any examples in google, only jobs source code, > which is rather complicated. > > Next question will be: how to distribute these tasks among cluster? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From mjtruog@REDACTED Sat Apr 14 10:20:10 2012 From: mjtruog@REDACTED (Michael Truog) Date: Sat, 14 Apr 2012 01:20:10 -0700 Subject: [erlang-questions] How to use "jobs": schedule tasks by core number In-Reply-To: References: Message-ID: <4F89333A.1040800@gmail.com> If you wanted to use CloudI (http://cloudi.org) for this, you would create an Erlang CloudI service, which uses the cloudi_job behavior. The service would be started with the process count of 1.0 where 1.0 is a multiplier for the core count (really the active Erlang scheduler count) on the machine, since you seemed to imply that there were 8 cores that you wanted to utilize. The assumption is that the tasks are event-triggered, from some event you control, otherwise, they could be manually triggered within the service's initialization. To handle all 100 tasks, it would be simplest to send 100 separate messages to the same service name, where all 8 Erlang service processes have subscribed to a single service name. That service name becomes the destination for all 100 asynchronous messages which just get queued up and processed. The results can be retrieved or received (passive/active async messages are supported), or simply stored separately (such that the storage is triggered from within the service, after the task is complete). You might be looking for a simple example that is a minimal chunk of Erlang code, but I thought I should still suggest this as a way of benefiting off of existing code. On 04/14/2012 12:44 AM, Max Lapshin wrote: > Hi. I have 100 tasks to execute, each takes about 10 seconds and uses 1 core. > > I want them to run 8 simultaneously (by core number). What is the best way? > > I think that esl/jobs is right what I need: create some queue and let > it schedule jobs. If yes, so can anyone share me a simple snippet of > code, how to do it? > I haven't found even any examples in google, only jobs source code, > which is rather complicated. > > Next question will be: how to distribute these tasks among cluster? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From witeman.g@REDACTED Sat Apr 14 12:40:43 2012 From: witeman.g@REDACTED (Zheng Zhibin) Date: Sat, 14 Apr 2012 18:40:43 +0800 Subject: [erlang-questions] How to speed up mnesia startup? In-Reply-To: References: <4DD5E107-B488-4A57-B2F6-85B00BBCC8BA@feuerlabs.com> <4B0456F0-5168-457A-8733-6E0BE840C47E@cs.otago.ac.nz> Message-ID: fragmented table are basically used phash2, so it would also provide the good response performance. But actually there are some tables constructed a fragmented "table", it depends on the no of fragments. ???? iPhone ? 2012-4-13???9:36?Kyungho Yun ??? > Thanks for replies. > I just know why it takes so long time to start up mnesia. > > > It looks fine to work except long time mnesia startup. > But it's getting worse problem because the number of tables are increasing. > > > Most of tables have same personally. > > The maximum size(whichever 2GB or 4GB) limit of dets was main problem to use single table. > I needed short response from mnesia but I wasn't sure that fragmentation is right choice. > > so I used lots of tables instead of it. > > Some of table's size are about 50M Bytes. (about 130k no_objects(same no_keys)) > Some of table's size are about 30K Bytes. (about 100 no_objects(same no_keys)) > > > Is the fragmentation only way to reduce mnesia startup time? > > thanks > > > On Fri, Apr 13, 2012 at 2:53 PM, Ulf Wiger wrote: > > > On 13 Apr 2012, at 00:31, Richard O'Keefe wrote: > > > > > On 12/04/2012, at 9:26 PM, Ulf Wiger wrote: > > > >> > >> Hmm, the first thing that stands out is the inordinate number of tables. > >> > >> Out of curiosity, I tried figuring out what is considered a reasonable number of tables for other database management systems: > >> > >> - Oracle: over 10,000 tables considered insane > >> (http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:26039880025641) > > > > That page has no claim that *Oracle* cannot handle it. > > The arguments given are > > - that it seems extremely unlikely that people could "design, > > implement, or maintain" a system with 10,000 distinct tables > > "personally". > ? > > Fair enough. My point was mainly that 60k tables is well beyond what most database management systems are optimized for. The question is obviously here what _nmesia_ is good at, but I just wanted to illustrate that if you want to build a database with 60k tables, you shouldn't _assume_ that any given dbms will handle it well. > > As far as mnesia is concerned, there are a number of commonly used functions that are reasonable as long as the number of tables is somewhere in the hundreds. > > Take, for example, mnesia:wait_for_tables/2. Let's assume that our application actually needs those 60k tables to be loaded before it starts doing things. > > wait_for_tables/2 is basically implemented like this (lots of code snipped): > > wait_for_tables_init(From, Tabs) -> > process_flag(trap_exit, true), > ... > cast({sync_tabs, Tabs, self()}), > rec_tabs(Tabs, Tabs, From, Init) > end. > > rec_tabs([Tab | Tabs], AllTabs, From, Init) -> > receive > {?SERVER_NAME, {tab_synced, Tab}} -> > rec_tabs(Tabs, AllTabs, From, Init); > ... > end; > rec_tabs([], _, _, Init) -> > unlink(Init), > ok. > > To begin with, if the objective was to support tens of thousand tables, it would be better to provide functions to efficiently query the 'table of tables'. Currently, there is no table of tables, but a system_info(tables), which provides them all as a list (including 'schema', which you often must delete from the list, since you can't, for example, do wait_for tables on the schema). > > In the code above, mnesia sends the 60k list of tables in a single message. It then loops through the list and does selective receive on the replies belonging to each. This is a convenient way to do it when the list of Tabs is short, but pretty awful for a very large list, since each iteration may end up scanning a rather large message queue. > > This was just one example. Mnesia was not designed with this sort of thing in mind. > > BR, > Ulf W > > Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. > http://feuerlabs.com > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From hobson42@REDACTED Sat Apr 14 17:18:19 2012 From: hobson42@REDACTED (Ian) Date: Sat, 14 Apr 2012 16:18:19 +0100 Subject: [erlang-questions] Strange performance issue - advice needed Message-ID: <4F89953B.1060101@gmail.com> Hi all, Nubie here, learning Erlang. Having written some awfully slow code in new languages before, I am keen to write speedy code this time. I am writing a solution to the telegram problem. In the code below, tgpack reads words, and builds lines, while tgwriter receives those lines and writes the result to a file of text. Other code, not shown, generates words and writes them as binaries, to tgpack. I am getting some very strange timings. When I ran it with 50 characters per line, it too 18.8 seconds to run. So I doubled the length of the line, thus halving the number of lines. Same input file. If the time was dominate by the line count then the time taken would be about half. If it was dominated by the line length then it would be about double. I did not think I would get a timing outside this range (9-40 seconds). It took 3.6 seconds! So I doubled the line length again, and at 200 characters per line, it took 0.6 seconds! I tried 25 chars per line, it took 122 seconds. In every case it was reading the same 1.7MB file. I also repeated the tests and the timings are constant (+/- 3%). So it appears that short lines are terribly inefficient. I want to understand why? Can anyone spot it? Thanks Ian The code for tgpack -module(tgpack). -export([pack/2]). %% tgpack - read words, builds and write lines to writer, %% where lines are as long as possible and less than Length %% Upon reading <<>> write it to close file, and quit. pack(Length,Writer) -> receive <<>> -> Writer ! <<>>; % handle empty file Word -> buldlist(Length,byte_size(Word),Writer,[Word]) end. % buildList % Length is max length of line % Size is length of line so far % Writer is file writing process % List is list of binaries built up for current line in reverse order buldlist(Length,Size,Writer,List) -> receive <<>> -> Writer ! binaryFromList(List), % send last line. Writer ! <<>>; % close the output Word -> S = Size + 1 + byte_size(Word), case S >= Length of true -> % write old and start next line Writer ! binaryFromList(List), buldlist(Length,byte_size(Word),Writer,[Word]); false -> % add word to current buldlist(Length,S,Writer,[Word|List] ) end end. the code for tgwriter -module(tgwriter). -export([writer/1]). %% writer - reads lines and writes them to Filename until eof %% eof is a zero length binary writer(Filename) -> {ok, Fh} = file:open(Filename,[write,{delayed_write, 8096, 1000}]), writemore(Fh). writemore(Fh) -> receive <<>> -> file:close(Fh); Msg -> % write line file:write(Fh, Msg), file:write(Fh, "\n"), writemore(Fh) end. From essen@REDACTED Sat Apr 14 18:06:28 2012 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Sat, 14 Apr 2012 18:06:28 +0200 Subject: [erlang-questions] Split Cowboy's acceptor and HTTP code In-Reply-To: <4F7AE069.1030904@ninenines.eu> References: <4F7AE069.1030904@ninenines.eu> Message-ID: <4F89A084.1090306@ninenines.eu> Hello, The split code from Cowboy is available there: https://github.com/extend/ranch It has been tagged as 0.2.0 and is pretty much what's in Cowboy with the modules renamed. Note that no changes have occured in Cowboy yet, and nothing will change until we reach 0.6.0. Only then will Cowboy start using Ranch instead of its own acceptor code. I have various changes to make to Ranch in the next few weeks, but none of these will change the existing public API. I will lay out the user guides general layout next week so that interested people can contribute to it. Have fun! -- Lo?c Hoguin Erlang Cowboy Nine Nines From jared.kofron@REDACTED Sat Apr 14 18:10:55 2012 From: jared.kofron@REDACTED (Jared Kofron) Date: Sat, 14 Apr 2012 09:10:55 -0700 Subject: [erlang-questions] Help with Sublime Text 2 Code Completion In-Reply-To: References: Message-ID: <0054AC4C-8097-4114-B456-7245D9C8421B@gmail.com> +1 If this were available, I'd be happy to try it out/hack on it. JK On Apr 13, 2012, at 1:01 AM, Max Bourinov wrote: > One more Sublime user is here. > > Hi guys, > > How it is possible for me to try "code completion" feature too? Is there any software? Or github repo? Instruction? Anything? > > Thank you in advance! > > > Best regards, > Max > > > > > On Fri, Apr 13, 2012 at 3:13 AM, Andrew Berman wrote: > I actually just tested and it appears beam_disasm is really fast. I'm going to try to use it. > > Thanks again! > > Andrew > > > On Thu, Apr 12, 2012 at 1:06 PM, Andrew Berman wrote: > Hey Erik, > > That looks interesting. Currently, I'm looping through the results of erlang:loaded() which is very fast, then doing Module:module_info(exports) and doing a fuzzy search on those which is why I wanted to load all the modules. By loading them all, they're already cached for me so that's one less thing I would have to do. Is using beam_disasm fast? Is loading all the modules really that bad? I can't imagine it uses that much memory that it would be an issue. Using beam_disasm would mean I would have to cache the results myself which means memory would be used anyway. Thoughts? > > Thanks, > > Andrew > > > On Thu, Apr 12, 2012 at 3:57 AM, Erik S?e S?rensen wrote: > Are you sure that you want to *load* all the modules? > (Especially in these days, when modules may have 'on_load' hooks which you're probably not interested in running indiscriminately - and which may fail...) > > An alternative, in case you merely wish to know the list of exported functions from a beam file FileName: > {beam_file,ModuleName,Exported0,_,_,_} = beam_disasm:file(FileName). > Exported = [{Name,Arity} || {Name,Arity,_} <- Exported0]. > > Den 12. apr. 2012 09.35 skrev Gustav Simonsson : > > > If you know which modules are in the added code paths you can simply loop > over them and load each of them using the functions in the code module. > > Typically in Erlang systems one knows which modules exist, but if you > cannot know that prior to adding a new code path my guess is that you > have to search your newly added code paths and use e.g. code:load_file/1 > > Regards, > Gustav Simonsson > > Sent from my PC > > ----- Original Message ----- > > From: "Andrew Berman" > > To: "Erlang Questions" > > Sent: Thursday, 12 April, 2012 1:13:17 AM > > Subject: Re: [erlang-questions] Help with Sublime Text 2 Code Completion > > > > > > Hey all, > > > > > > Been a while since I posed this question, but I'm still stuck on > > trying to load all the beam files. Is there some magic way to tell > > the VM to load all the beams in the code path or do I have to loop > > through the code path and load them all manually? How would I go > > about doing it that way if that is what is required? > > > > > > Thanks, > > > > > > Andrew > > > > > > On Tue, Mar 6, 2012 at 11:43 PM, Andrew Berman < rexxe98@REDACTED > > > wrote: > > > > > > All, > > > > > > I'm trying to build a plug-in for Sublime Text 2 to do proper Erlang > > code completion. My thought is to have a server or node running and > > then talk to that node using erl_call. I have it working with the > > stdlib, but I want the code completion to be dynamic such that the > > plug-in tells the remote node to add code paths. I have that working > > too, but the issue is loading the actual modules in the new code > > path. Since the erlang vm loads modules only upon access, when I > > call erlang:loaded() or code:all_loaded(), the modules added with > > the new code path do not show. Do I have to loop through the BEAMs > > in the new code path and manually load them or is there a better way > > to do it? I'm trying to make the completion use a fuzzy search such > > that something like "li" brings up all modules with "li" in it which > > is why I need to be able to have the entire list of modules loaded > > already. > > > > > > Thanks, > > > > > > Andrew > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From watson.timothy@REDACTED Sat Apr 14 19:14:16 2012 From: watson.timothy@REDACTED (Gmail) Date: Sat, 14 Apr 2012 18:14:16 +0100 Subject: [erlang-questions] Strange performance issue - advice needed In-Reply-To: <4F89953B.1060101@gmail.com> References: <4F89953B.1060101@gmail.com> Message-ID: Can't read the code well on my phone but if you're using line oriented io then that tends to suck. I would suggest reading http://erlang.org/pipermail/erlang-questions/2012-March/065374.html as well. Cheers, Tim Sent from my iPhone On 14 Apr 2012, at 16:18, Ian wrote: > Hi all, > > Nubie here, learning Erlang. Having written some awfully slow code in new languages before, I am keen to write speedy code this time. > > I am writing a solution to the telegram problem. In the code below, tgpack reads words, and builds lines, while tgwriter receives those lines and writes the result to a file of text. Other code, not shown, generates words and writes them as binaries, to tgpack. > > I am getting some very strange timings. When I ran it with 50 characters per line, it too 18.8 seconds to run. So I doubled the length of the line, thus halving the number of lines. Same input file. > > If the time was dominate by the line count then the time taken would be about half. If it was dominated by the line length then it would be about double. I did not think I would get a timing outside this range (9-40 seconds). > > It took 3.6 seconds! > > So I doubled the line length again, and at 200 characters per line, it took 0.6 seconds! > > I tried 25 chars per line, it took 122 seconds. > > In every case it was reading the same 1.7MB file. I also repeated the tests and the timings are constant (+/- 3%). > > So it appears that short lines are terribly inefficient. I want to understand why? Can anyone spot it? > > Thanks > > Ian > > The code for tgpack > -module(tgpack). > -export([pack/2]). > %% tgpack - read words, builds and write lines to writer, > %% where lines are as long as possible and less than Length > %% Upon reading <<>> write it to close file, and quit. > pack(Length,Writer) -> > receive > <<>> -> Writer ! <<>>; % handle empty file > Word -> buldlist(Length,byte_size(Word),Writer,[Word]) > end. > > % buildList > % Length is max length of line > % Size is length of line so far > % Writer is file writing process > % List is list of binaries built up for current line in reverse order > buldlist(Length,Size,Writer,List) -> > receive > <<>> -> > Writer ! binaryFromList(List), % send last line. > Writer ! <<>>; % close the output > Word -> > S = Size + 1 + byte_size(Word), > case S >= Length of > true -> % write old and start next line > Writer ! binaryFromList(List), > buldlist(Length,byte_size(Word),Writer,[Word]); > false -> % add word to current > buldlist(Length,S,Writer,[Word|List] ) > end > end. > > the code for tgwriter > -module(tgwriter). > -export([writer/1]). > %% writer - reads lines and writes them to Filename until eof > %% eof is a zero length binary > writer(Filename) -> > {ok, Fh} = file:open(Filename,[write,{delayed_write, 8096, 1000}]), > writemore(Fh). > > writemore(Fh) -> > receive > <<>> -> file:close(Fh); > Msg -> % write line > file:write(Fh, Msg), > file:write(Fh, "\n"), > writemore(Fh) > end. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From s.j.thompson@REDACTED Sat Apr 14 19:23:44 2012 From: s.j.thompson@REDACTED (Simon Thompson) Date: Sat, 14 Apr 2012 18:23:44 +0100 Subject: [erlang-questions] Final CFP: 16th Brazilian Symposium on Programming Languages Message-ID: ============================================================ CALL FOR PAPERS 16th BRAZILIAN SYMPOSIUM ON PROGRAMMING LANGUAGES Natal, Rio Grande do Norte, Brazil September 24-28, 2012 http://www.cbsoft.dimap.ufrn.br ============================================================ IMPORTANT DATES Paper abstract submission (15 lines): April 27th, 2012 (extended) Full paper submission: May 4th, 2012 (extended) Notification of acceptance: June 4th, 2012 Final papers due: June 29th, 2012 INTRODUCTION The 16th Brazilian Symposium on Programming Languages, SBLP 2012, will be held in Natal, Brazil, on September 24-28, 2012. SBLP provides a venue for researchers and practitioners interested in the fundamental principles and innovations in the design and implementation of programming languages and systems. The symposium will be part of the 3rd Brazilian Conference on Software: Theory and Practice, CBSoft 2012, http://www.cbsoft.dimap.ufrn.br, which will host four traditional, well-established symposia: * XXVI Brazilian Symposium on Software Engineering (SBES) * XVI Brazilian Symposium on Programming Languages (SBLP) * XV Brazilian Symposium on Formal Methods (SBMF) * VI Brazilian Symposium on Components, Software Architecture and Software Reuse (SBCARS) SBLP 2012 invites authors to contribute with technical papers related (but not limited) to: * Program generation and transformation, including domain-specific languages and model-driven development in the context of programming languages. * Programming paradigms and styles, including functional, object-oriented, aspect-oriented, scripting languages, real-time, service-oriented, multithreaded, parallel, and distributed programming. * Formal semantics and theoretical foundations, including denotational, operational, algebraic and categorical. * Program analysis and verification, including type systems, static analysis and abstract interpretation. * Programming language design and implementation, including new programming models, programming language environments, compilation and interpretation techniques. SUBMISSIONS Contributions should be written in Portuguese or English. We solicit papers that should fall into one of two different categories: full papers, with at most 15 pages, or short papers, with at most 5 pages. We encourage the submission of short papers reporting on partial results of on-going master dissertations or doctoral theses. All accepted papers will be published in the conference proceedings distributed in a digital media by the CBSOFT organizers. Full papers submitted in English will be published in a volume of the Lecture Notes in Computer Science (LNCS), by Springer, to be distributed in the conference. For this reason, all papers must be prepared using the LNCS template, available at http://www.springer.com/computer/lncs?SGWID=0-164-6-793341-0. As in previous editions, a journal special issue, with selected papers from accepted contributions, is anticipated. Selected papers from 2003 to 2008 editions of SBLP were published in special issues of the Journal of Universal Computer Science, by Springer. The post-proceedings of SBLP from 2009 to 2011, also with selected papers from the conference proceedings, are being edited as special issues of Science of Computer Programming, published by Elsevier. Submissions should be done using SBLP 2012 installation of the EasyChair conference management system at http://www.easychair.org/conferences/?conf=sblp2012. GENERAL CO-CHAIRS N?lio Cacho, UFRN Gibeon Aquino, UFRN Martin Musicante, UFRN PROGRAMME CHAIRS Francisco Heron de Carvalho Junior, UFC Luis Soares Barbosa, Univ. do Minho PROGRAMME COMMITTEE * Alberto Pardo, Univ. de La Republica * Alex Garcia, IME * Alvaro Freitas Moreira, UFRGS * Andr? Rauber Du Bois, UFPel * Andre Santos, UFPE * Carlos Camarao, UFMG * Christiano Braga, UFF * Fernando Castor Filho, UFPE * Fernando Quint?o Pereira, UFMG * Francisco Heron de Carvalho Junior, UFC (co-chair) * Joao Saraiva, Universidade do Minho * Jo?o F. Ferreira, Teesside University * Jonathan Aldrich, Carnegie Mellon Univ. * Jose Luiz Fiadeiro, Univ. of Leicester * Lucilia Figueiredo, UFOP * Luis Soares Barbosa, Univ. do Minho (co-chair) * Manuel Ant?nio Martins, Univ. de Aveiro * Marcelo A. Maia, UFU * Marcello Bonsangue, Leiden Univ/CWI * Marcelo d'Amorim, UFPE * Marco Tulio Valente, UFMG * Mariza A. S. Bigonha, UFMG * Martin A. Musicante, UFRN * Noemi Rodriguez, PUC-Rio * Paulo Borba, UFPE * Peter Mosses, Swansea University * Qiu Zongyang, Peking University * Rafael Dueire Lins, UFPE * Renato Cerqueira, PUC-Rio * Ricardo Massa, UFPE * Roberto S. Bigonha, UFMG * Roberto Ierusalimschy, PUC-Rio * Sandro Rigo, UNICAMP * Sergio Soares, UFPE * Simon Thompson, Univ. of Kent * Varmo Vene, Univ. de Tartu Simon Thompson | Professor of Logic and Computation School of Computing | University of Kent | Canterbury, CT2 7NF, UK s.j.thompson@REDACTED | M +44 7986 085754 | W www.cs.kent.ac.uk/~sjt From wiley.andrew.j@REDACTED Sat Apr 14 19:54:08 2012 From: wiley.andrew.j@REDACTED (Andrew Wiley) Date: Sat, 14 Apr 2012 12:54:08 -0500 Subject: [erlang-questions] HiPE on ARM Build Issue In-Reply-To: References: <4F89317F.80002@cs.ntua.gr> Message-ID: On Sat, Apr 14, 2012 at 3:12 AM, Kostis Sagonas wrote: > > In the HiPE team we would very much like to support the ARM architecture > but the problem these days - for quite some time actually - is that we do > not have access to any machine with an ARM processor. It's very painful to > be testing ARM using QEMU, esp. all sorts of different ARMs that exist > these days. Hence, occasionally code tends to rot or, as in this case which > involves a newer ARMv7, code has never been tested on newer architectures. > > (I do not know what sort of access to ARM machines the Erlang/OTP team at > Ericsson has, but I suspect that they do not have access to all possible > ARMs either.) > > In this particular case, I would recommend that you extend the following > lines in erts/configure.in > > armv5b) ARCH=arm;; > armv5teb) ARCH=arm;; > armv5tel) ARCH=arm;; > > with the line that corresponds to your newer armv7 and test to see what > happens. If all goes well, please submit a patch using git. > I added: armv5b) ARCH=arm;; armv5teb) ARCH=arm;; armv5tel) ARCH=arm;; + armv7l) ARCH=arm;; to configure.in and reran autotools. > > Also, since you are on an unexplored territory, I would recommend to build > Erlang/OTP in two steps. First do: > > ./configure --enable-hipe ... > > which will test if Erlang/OTP can be built with HiPE support, and only if > that works do: > > make clean // or start from a fresh copy, for extra safety > ./configure --enable-hipe ... --enable-native-libs > I kicked off the build before you replied, and a build with both --enable-hipe and --enable-native libs completed successfully. However, when I try to get Hipe to build native code afterwards: [wiley@REDACTED erlang]$ erlc -W +debug_info +native +inline main.erl Crash dump was written to: erl_crash.dump Invalid tag in make_hash2(0x735F7374) Aborted [wiley@REDACTED erlang]$ erlc -W +native +inline main.erl Segmentation fault [wiley@REDACTED erlang]$ erlc -W +native main.erl Segmentation fault [wiley@REDACTED erlang]$ gdb erlc GNU gdb (GDB) 7.4 [...cut...] Reading symbols from /usr/bin/erlc...(no debugging symbols found)...done. (gdb) set args -W +native main.erl (gdb) run Starting program: /usr/bin/erlc -W +native main.erl process 20137 is executing new program: /bin/bash process 20137 is executing new program: /usr/lib/erlang/erts-5.9.1/bin/erlexec process 20137 is executing new program: /usr/lib/erlang/erts-5.9.1/bin/beam.smp [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/libthread_db.so.1". [New Thread 0x40da8470 (LWP 20143)] [New Thread 0x415a8470 (LWP 20144)] [New Thread 0x4002c470 (LWP 20145)] [New Thread 0x41da8470 (LWP 20146)] [New Thread 0x425a8470 (LWP 20147)] [New Thread 0x42da8470 (LWP 20148)] Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x41da8470 (LWP 20146)] 0x0007b9a4 in make_hash2 () (gdb) bt #0 0x0007b9a4 in make_hash2 () #1 0x000a9fbc in put_2 () #2 0x0014dca4 in nbif_put_2 () #3 0x0014dca4 in nbif_put_2 () Backtrace stopped: previous frame identical to this frame (corrupt stack?) > PS. We welcome support, for example, donations of ARM-based machines that > we can be using to test the HiPE compiler or its newer LLVM-based back-end > (see http://erllvm.softlab.ntua.gr/**) more regularly. Similar with other > exotic architectures that people these days care about. Minimally, if you > want native code for some configuration other than x86 and x86_64-based > machines, give us some form of remote access to it. > I'm a college student who randomly felt like learning Erlang might be useful, I'm not really in a position to donate hardware, and I'm a bit leery about giving out shell accounts on what's essentially my router, but I'll see what I can do. -------------- next part -------------- An HTML attachment was scrubbed... URL: From wiley.andrew.j@REDACTED Sat Apr 14 19:54:55 2012 From: wiley.andrew.j@REDACTED (Andrew Wiley) Date: Sat, 14 Apr 2012 12:54:55 -0500 Subject: [erlang-questions] HiPE on ARM Build Issue In-Reply-To: References: <4F89317F.80002@cs.ntua.gr> Message-ID: On Sat, Apr 14, 2012 at 12:48 PM, Andrew Wiley wrote: > On Sat, Apr 14, 2012 at 3:12 AM, Kostis Sagonas wrote: >> >> In the HiPE team we would very much like to support the ARM architecture >> but the problem these days - for quite some time actually - is that we do >> not have access to any machine with an ARM processor. It's very painful to >> be testing ARM using QEMU, esp. all sorts of different ARMs that exist >> these days. Hence, occasionally code tends to rot or, as in this case which >> involves a newer ARMv7, code has never been tested on newer architectures. >> >> (I do not know what sort of access to ARM machines the Erlang/OTP team at >> Ericsson has, but I suspect that they do not have access to all possible >> ARMs either.) >> >> In this particular case, I would recommend that you extend the following >> lines in erts/configure.in >> >> armv5b) ARCH=arm;; >> armv5teb) ARCH=arm;; >> armv5tel) ARCH=arm;; >> >> with the line that corresponds to your newer armv7 and test to see what >> happens. If all goes well, please submit a patch using git. >> > > I added: > armv5b) ARCH=arm;; > armv5teb) ARCH=arm;; > armv5tel) ARCH=arm;; > + armv7l) ARCH=arm;; > > to configure.in and reran autotools. > > >> >> Also, since you are on an unexplored territory, I would recommend to >> build Erlang/OTP in two steps. First do: >> >> ./configure --enable-hipe ... >> >> which will test if Erlang/OTP can be built with HiPE support, and only if >> that works do: >> >> make clean // or start from a fresh copy, for extra safety >> ./configure --enable-hipe ... --enable-native-libs >> > > I kicked off the build before you replied, and a build with both > --enable-hipe and --enable-native libs completed successfully. However, > when I try to get Hipe to build native code afterwards: > [wiley@REDACTED erlang]$ erlc -W +debug_info +native +inline main.erl > > Crash dump was written to: erl_crash.dump > Invalid tag in make_hash2(0x735F7374) > Aborted > [wiley@REDACTED erlang]$ erlc -W +native +inline main.erl > Segmentation fault > [wiley@REDACTED erlang]$ erlc -W +native main.erl > Segmentation fault > [wiley@REDACTED erlang]$ gdb erlc > GNU gdb (GDB) 7.4 > [...cut...] > Reading symbols from /usr/bin/erlc...(no debugging symbols found)...done. > (gdb) set args -W +native main.erl > (gdb) run > Starting program: /usr/bin/erlc -W +native main.erl > process 20137 is executing new program: /bin/bash > process 20137 is executing new program: > /usr/lib/erlang/erts-5.9.1/bin/erlexec > process 20137 is executing new program: > /usr/lib/erlang/erts-5.9.1/bin/beam.smp > [Thread debugging using libthread_db enabled] > Using host libthread_db library "/lib/libthread_db.so.1". > [New Thread 0x40da8470 (LWP 20143)] > [New Thread 0x415a8470 (LWP 20144)] > [New Thread 0x4002c470 (LWP 20145)] > [New Thread 0x41da8470 (LWP 20146)] > [New Thread 0x425a8470 (LWP 20147)] > [New Thread 0x42da8470 (LWP 20148)] > > Program received signal SIGSEGV, Segmentation fault. > [Switching to Thread 0x41da8470 (LWP 20146)] > 0x0007b9a4 in make_hash2 () > (gdb) bt > #0 0x0007b9a4 in make_hash2 () > #1 0x000a9fbc in put_2 () > #2 0x0014dca4 in nbif_put_2 () > #3 0x0014dca4 in nbif_put_2 () > Backtrace stopped: previous frame identical to this frame (corrupt stack?) > > >> PS. We welcome support, for example, donations of ARM-based machines that >> we can be using to test the HiPE compiler or its newer LLVM-based back-end >> (see http://erllvm.softlab.ntua.gr/**) more regularly. Similar with >> other exotic architectures that people these days care about. Minimally, if >> you want native code for some configuration other than x86 and x86_64-based >> machines, give us some form of remote access to it. >> > > I'm a college student who randomly felt like learning Erlang might be > useful, I'm not really in a position to donate hardware, and I'm a bit > leery about giving out shell accounts on what's essentially my router, but > I'll see what I can do. > Oh, yes, the main.erl I was using to test HiPE: -module(main). -export([main/0]). main() -> io:format("fib(42): ~B~n", [fib(42)]). fib(0) -> 1; fib(1) -> 1; fib(N) when N > 1, is_integer(N) -> fib(N-1) + fib(N-2). -------------- next part -------------- An HTML attachment was scrubbed... URL: From drew.varner@REDACTED Sat Apr 14 20:15:09 2012 From: drew.varner@REDACTED (Drew Varner) Date: Sat, 14 Apr 2012 22:15:09 +0400 Subject: [erlang-questions] crypto application in FIPS mode Message-ID: Has anyone toyed around with running the crypto application linked against an OpenSSL library in FIPS 140-2 mode (http://www.openssl.org/docs/fips/UserGuide.pdf)? I am interested in using Erlang libraries (http servers) and SSL distribution using the FIPS-certified library. I believe the application would need to put the OpenSSL module in FIPS mode (assuming it was compiled in FIPS mode) and then trigger the power-on self tests at initialization. Perhaps the NIFs could return "atom_notsup" where the OpenSSL library did not support the given operation in FIPS mode. Thanks, Drew From ulf@REDACTED Sat Apr 14 20:24:30 2012 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 14 Apr 2012 20:24:30 +0200 Subject: [erlang-questions] How to use "jobs": schedule tasks by core number In-Reply-To: References: Message-ID: <0A262A71-DF96-4B6B-91F5-1C6CECC0385C@feuerlabs.com> What?! My source code complicated? Apologies for never getting around to writing down some examples. Here is a simple one: https://github.com/esl/jobs/wiki/Counter-based-regulation BR, Ulf W On 14 Apr 2012, at 09:44, Max Lapshin wrote: > Hi. I have 100 tasks to execute, each takes about 10 seconds and uses 1 core. > > I want them to run 8 simultaneously (by core number). What is the best way? > > I think that esl/jobs is right what I need: create some queue and let > it schedule jobs. If yes, so can anyone share me a simple snippet of > code, how to do it? > I haven't found even any examples in google, only jobs source code, > which is rather complicated. > > Next question will be: how to distribute these tasks among cluster? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com From zabrane3@REDACTED Sat Apr 14 21:13:57 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Sat, 14 Apr 2012 21:13:57 +0200 Subject: [erlang-questions] How to use "jobs": schedule tasks by core number In-Reply-To: <0A262A71-DF96-4B6B-91F5-1C6CECC0385C@feuerlabs.com> References: <0A262A71-DF96-4B6B-91F5-1C6CECC0385C@feuerlabs.com> Message-ID: <439E18CF-303E-4BFE-AE9C-43FD59FF8415@gmail.com> On Apr 14, 2012, at 8:24 PM, Ulf Wiger wrote: > > What?! My source code complicated? ;-) > > Apologies for never getting around to writing down some examples. > > Here is a simple one: > https://github.com/esl/jobs/wiki/Counter-based-regulation Thanks a lot Ulf. I didn't notice the wikipage. Regards, Zabrane From rexxe98@REDACTED Sat Apr 14 21:35:30 2012 From: rexxe98@REDACTED (Andrew Berman) Date: Sat, 14 Apr 2012 12:35:30 -0700 Subject: [erlang-questions] Help with Sublime Text 2 Code Completion In-Reply-To: <0054AC4C-8097-4114-B456-7245D9C8421B@gmail.com> References: <0054AC4C-8097-4114-B456-7245D9C8421B@gmail.com> Message-ID: I'll let you guys know when I have something usable. I also want to get an Erlang code formatter in there to make things complete for me. Those are really the only two things I require for developing Erlang: code insight and a formatter. --Andrew On Sat, Apr 14, 2012 at 9:10 AM, Jared Kofron wrote: > +1 > > If this were available, I'd be happy to try it out/hack on it. > > JK > > On Apr 13, 2012, at 1:01 AM, Max Bourinov wrote: > > One more Sublime user is here. > > Hi guys, > > How it is possible for me to try "code completion" feature too? Is there > any software? Or github repo? Instruction? Anything? > > Thank you in advance! > > > Best regards, > Max > > > > > On Fri, Apr 13, 2012 at 3:13 AM, Andrew Berman wrote: > >> I actually just tested and it appears beam_disasm is really fast. I'm >> going to try to use it. >> >> Thanks again! >> >> Andrew >> >> >> On Thu, Apr 12, 2012 at 1:06 PM, Andrew Berman wrote: >> >>> Hey Erik, >>> >>> That looks interesting. Currently, I'm looping through the results of >>> erlang:loaded() which is very fast, then doing Module:module_info(exports) >>> and doing a fuzzy search on those which is why I wanted to load all the >>> modules. By loading them all, they're already cached for me so that's one >>> less thing I would have to do. Is using beam_disasm fast? Is loading all >>> the modules really that bad? I can't imagine it uses that much memory that >>> it would be an issue. Using beam_disasm would mean I would have to cache >>> the results myself which means memory would be used anyway. Thoughts? >>> >>> Thanks, >>> >>> Andrew >>> >>> >>> On Thu, Apr 12, 2012 at 3:57 AM, Erik S?e S?rensen wrote: >>> >>>> Are you sure that you want to *load* all the modules? >>>> (Especially in these days, when modules may have 'on_load' hooks which >>>> you're probably not interested in running indiscriminately - and which may >>>> fail...) >>>> >>>> An alternative, in case you merely wish to know the list of exported >>>> functions from a beam file FileName: >>>> {beam_file,ModuleName,Exported0,_,_,_} = beam_disasm:file(FileName). >>>> Exported = [{Name,Arity} || {Name,Arity,_} <- Exported0]. >>>> >>>> Den 12. apr. 2012 09.35 skrev Gustav Simonsson < >>>> gustav.simonsson@REDACTED>: >>>> >>>> >>>>> If you know which modules are in the added code paths you can simply >>>>> loop >>>>> over them and load each of them using the functions in the code module. >>>>> >>>>> Typically in Erlang systems one knows which modules exist, but if you >>>>> cannot know that prior to adding a new code path my guess is that you >>>>> have to search your newly added code paths and use e.g. >>>>> code:load_file/1 >>>>> >>>>> Regards, >>>>> Gustav Simonsson >>>>> >>>>> Sent from my PC >>>>> >>>>> ----- Original Message ----- >>>>> > From: "Andrew Berman" >>>>> > To: "Erlang Questions" >>>>> > Sent: Thursday, 12 April, 2012 1:13:17 AM >>>>> > Subject: Re: [erlang-questions] Help with Sublime Text 2 Code >>>>> Completion >>>>> > >>>>> > >>>>> > Hey all, >>>>> > >>>>> > >>>>> > Been a while since I posed this question, but I'm still stuck on >>>>> > trying to load all the beam files. Is there some magic way to tell >>>>> > the VM to load all the beams in the code path or do I have to loop >>>>> > through the code path and load them all manually? How would I go >>>>> > about doing it that way if that is what is required? >>>>> > >>>>> > >>>>> > Thanks, >>>>> > >>>>> > >>>>> > Andrew >>>>> > >>>>> > >>>>> > On Tue, Mar 6, 2012 at 11:43 PM, Andrew Berman < rexxe98@REDACTED > >>>>> > wrote: >>>>> > >>>>> > >>>>> > All, >>>>> > >>>>> > >>>>> > I'm trying to build a plug-in for Sublime Text 2 to do proper Erlang >>>>> > code completion. My thought is to have a server or node running and >>>>> > then talk to that node using erl_call. I have it working with the >>>>> > stdlib, but I want the code completion to be dynamic such that the >>>>> > plug-in tells the remote node to add code paths. I have that working >>>>> > too, but the issue is loading the actual modules in the new code >>>>> > path. Since the erlang vm loads modules only upon access, when I >>>>> > call erlang:loaded() or code:all_loaded(), the modules added with >>>>> > the new code path do not show. Do I have to loop through the BEAMs >>>>> > in the new code path and manually load them or is there a better way >>>>> > to do it? I'm trying to make the completion use a fuzzy search such >>>>> > that something like "li" brings up all modules with "li" in it which >>>>> > is why I need to be able to have the entire list of modules loaded >>>>> > already. >>>>> > >>>>> > >>>>> > Thanks, >>>>> > >>>>> > >>>>> > Andrew >>>>> > >>>>> > _______________________________________________ >>>>> > erlang-questions mailing list >>>>> > erlang-questions@REDACTED >>>>> > http://erlang.org/mailman/listinfo/erlang-questions >>>>> > >>>>> _______________________________________________ >>>>> erlang-questions mailing list >>>>> erlang-questions@REDACTED >>>>> http://erlang.org/mailman/listinfo/erlang-questions >>>>> >>>> >>>> >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-questions >>>> >>>> >>> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hobson42@REDACTED Sat Apr 14 21:56:06 2012 From: hobson42@REDACTED (Ian) Date: Sat, 14 Apr 2012 20:56:06 +0100 Subject: [erlang-questions] Strange performance issue - advice needed In-Reply-To: References: <4F89953B.1060101@gmail.com> Message-ID: <4F89D656.8070407@gmail.com> Thanks Tim, Before you posted I had tried a version that wrote each word to the file as it arrived. That took 3550 seconds! So I rewrote the code as below and it runs in 800ms at 50 chars line length and 769ms for 200 chars per line - much better and more the relationship I expected. Thanks for your helpful input. But, my goodness, so called buffered file IO is inexpressibly crap! Regards Ian On 14/04/2012 18:14, Gmail wrote: > Can't read the code well on my phone but if you're using line oriented io then that tends to suck. > > I would suggest reading http://erlang.org/pipermail/erlang-questions/2012-March/065374.html as well. > > Cheers, > Tim > Replacement code - smaller and 20 times faster (and needs a bit more RAM). -module(tgpack). -export([pack/2]). %% tgpack - read words, builds and write lines to FileName, %% where lines are as long as possible and less than Length pack(Length,FileName) -> file:write_file(FileName, buildlist(Length,0,[])). % buildList % Length is max length of line % Size is length of line so far % List is list of binaries built up so far, in reverse order buildlist(Length,Size,List) -> receive <<>> -> lists:reverse(List); Word -> S = Size + 1 + byte_size(Word), % length of current line if S >= Length -> % start new line buildlist(Length,byte_size(Word),[Word|[<<"\n">>|List]]); true -> buildlist(Length,S,[Word|[<<" ">>|List]]) end end. From mjtruog@REDACTED Sun Apr 15 00:14:45 2012 From: mjtruog@REDACTED (Michael Truog) Date: Sat, 14 Apr 2012 15:14:45 -0700 Subject: [erlang-questions] [ANN] CloudI 0.2.0rc2 Released Message-ID: <4F89F6D5.3040504@gmail.com> Download 0.2.0rc2 from http://sourceforge.net/projects/cloudi/files/latest/download CloudI (http://cloudi.org) release 0.2.0rc2 is a bugfix release. Testing is ongoing and the FAQ will be updated to reflect the new features in 0.2.0. After sufficient testing, the 0.2.0 release will become 1.0.0 to begin semantic versioning (http://semver.org). Summary of changes: * many bugfixes * messaging test is now implemented in Erlang, C++, Ruby, Java, and Python * added alternative function pointer parameters for C++ CloudI API usage so that there is no need to create std::string objects Anyone with questions, comments, ideas, suggestions, criticisms, or concerns is welcome to send email. Thanks, Michael From bourinov@REDACTED Sun Apr 15 00:46:41 2012 From: bourinov@REDACTED (Max Bourinov) Date: Sun, 15 Apr 2012 02:46:41 +0400 Subject: [erlang-questions] Help with Sublime Text 2 Code Completion In-Reply-To: References: <0054AC4C-8097-4114-B456-7245D9C8421B@gmail.com> Message-ID: <6891153940137300125@unknownmsgid> There is also very nice refactoring tool called Wrangler. It was recently released. If you see what it does I bet you will want it! Sent from my iPhone On 14.04.2012, at 23:36, Andrew Berman wrote: I'll let you guys know when I have something usable. I also want to get an Erlang code formatter in there to make things complete for me. Those are really the only two things I require for developing Erlang: code insight and a formatter. --Andrew On Sat, Apr 14, 2012 at 9:10 AM, Jared Kofron wrote: > +1 > > If this were available, I'd be happy to try it out/hack on it. > > JK > > On Apr 13, 2012, at 1:01 AM, Max Bourinov wrote: > > One more Sublime user is here. > > Hi guys, > > How it is possible for me to try "code completion" feature too? Is there > any software? Or github repo? Instruction? Anything? > > Thank you in advance! > > > Best regards, > Max > > > > > On Fri, Apr 13, 2012 at 3:13 AM, Andrew Berman wrote: > >> I actually just tested and it appears beam_disasm is really fast. I'm >> going to try to use it. >> >> Thanks again! >> >> Andrew >> >> >> On Thu, Apr 12, 2012 at 1:06 PM, Andrew Berman wrote: >> >>> Hey Erik, >>> >>> That looks interesting. Currently, I'm looping through the results of >>> erlang:loaded() which is very fast, then doing Module:module_info(exports) >>> and doing a fuzzy search on those which is why I wanted to load all the >>> modules. By loading them all, they're already cached for me so that's one >>> less thing I would have to do. Is using beam_disasm fast? Is loading all >>> the modules really that bad? I can't imagine it uses that much memory that >>> it would be an issue. Using beam_disasm would mean I would have to cache >>> the results myself which means memory would be used anyway. Thoughts? >>> >>> Thanks, >>> >>> Andrew >>> >>> >>> On Thu, Apr 12, 2012 at 3:57 AM, Erik S?e S?rensen wrote: >>> >>>> Are you sure that you want to *load* all the modules? >>>> (Especially in these days, when modules may have 'on_load' hooks which >>>> you're probably not interested in running indiscriminately - and which may >>>> fail...) >>>> >>>> An alternative, in case you merely wish to know the list of exported >>>> functions from a beam file FileName: >>>> {beam_file,ModuleName,Exported0,_,_,_} = beam_disasm:file(FileName). >>>> Exported = [{Name,Arity} || {Name,Arity,_} <- Exported0]. >>>> >>>> Den 12. apr. 2012 09.35 skrev Gustav Simonsson < >>>> gustav.simonsson@REDACTED>: >>>> >>>> >>>>> If you know which modules are in the added code paths you can simply >>>>> loop >>>>> over them and load each of them using the functions in the code module. >>>>> >>>>> Typically in Erlang systems one knows which modules exist, but if you >>>>> cannot know that prior to adding a new code path my guess is that you >>>>> have to search your newly added code paths and use e.g. >>>>> code:load_file/1 >>>>> >>>>> Regards, >>>>> Gustav Simonsson >>>>> >>>>> Sent from my PC >>>>> >>>>> ----- Original Message ----- >>>>> > From: "Andrew Berman" >>>>> > To: "Erlang Questions" >>>>> > Sent: Thursday, 12 April, 2012 1:13:17 AM >>>>> > Subject: Re: [erlang-questions] Help with Sublime Text 2 Code >>>>> Completion >>>>> > >>>>> > >>>>> > Hey all, >>>>> > >>>>> > >>>>> > Been a while since I posed this question, but I'm still stuck on >>>>> > trying to load all the beam files. Is there some magic way to tell >>>>> > the VM to load all the beams in the code path or do I have to loop >>>>> > through the code path and load them all manually? How would I go >>>>> > about doing it that way if that is what is required? >>>>> > >>>>> > >>>>> > Thanks, >>>>> > >>>>> > >>>>> > Andrew >>>>> > >>>>> > >>>>> > On Tue, Mar 6, 2012 at 11:43 PM, Andrew Berman < rexxe98@REDACTED > >>>>> > wrote: >>>>> > >>>>> > >>>>> > All, >>>>> > >>>>> > >>>>> > I'm trying to build a plug-in for Sublime Text 2 to do proper Erlang >>>>> > code completion. My thought is to have a server or node running and >>>>> > then talk to that node using erl_call. I have it working with the >>>>> > stdlib, but I want the code completion to be dynamic such that the >>>>> > plug-in tells the remote node to add code paths. I have that working >>>>> > too, but the issue is loading the actual modules in the new code >>>>> > path. Since the erlang vm loads modules only upon access, when I >>>>> > call erlang:loaded() or code:all_loaded(), the modules added with >>>>> > the new code path do not show. Do I have to loop through the BEAMs >>>>> > in the new code path and manually load them or is there a better way >>>>> > to do it? I'm trying to make the completion use a fuzzy search such >>>>> > that something like "li" brings up all modules with "li" in it which >>>>> > is why I need to be able to have the entire list of modules loaded >>>>> > already. >>>>> > >>>>> > >>>>> > Thanks, >>>>> > >>>>> > >>>>> > Andrew >>>>> > >>>>> > _______________________________________________ >>>>> > erlang-questions mailing list >>>>> > erlang-questions@REDACTED >>>>> > http://erlang.org/mailman/listinfo/erlang-questions >>>>> > >>>>> _______________________________________________ >>>>> erlang-questions mailing list >>>>> erlang-questions@REDACTED >>>>> http://erlang.org/mailman/listinfo/erlang-questions >>>>> >>>> >>>> >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-questions >>>> >>>> >>> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Sun Apr 15 08:33:01 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Sun, 15 Apr 2012 10:33:01 +0400 Subject: [erlang-questions] How to use "jobs": schedule tasks by core number In-Reply-To: <439E18CF-303E-4BFE-AE9C-43FD59FF8415@gmail.com> References: <0A262A71-DF96-4B6B-91F5-1C6CECC0385C@feuerlabs.com> <439E18CF-303E-4BFE-AE9C-43FD59FF8415@gmail.com> Message-ID: Thank you for example! Am I right, that I need to set limit,8 to enable 8 simultaneous jobs? -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Sun Apr 15 08:40:01 2012 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 15 Apr 2012 08:40:01 +0200 Subject: [erlang-questions] Strange performance issue - advice needed In-Reply-To: <4F89D656.8070407@gmail.com> References: <4F89953B.1060101@gmail.com> <4F89D656.8070407@gmail.com> Message-ID: <0CF8B293-2F4B-4F5F-8D44-C014689DF6AA@feuerlabs.com> On 14 Apr 2012, at 21:56, Ian wrote: > But, my goodness, so called buffered file IO is inexpressibly crap! Well, it wasn't designed to eat large files from disk in a hurry. :) What it shines at is distribution-transparent console I/O. You can do an RPC to an embedded system from a shell on your workstation, and have the code on the embedded system ask for input, without knowing that there is no console attached. The input and output will automatically be served by your shell. * That is not crap. BR, Ulf W * All this is actually default behavior, and easy to test. Start two nodes, e.g. node1 and node2, then from node1: (node1@REDACTED)2> rpc:call(node2@REDACTED, io, get_line, ['>> ']). >> foo "foo\n" The function io:get_line/1 is executed on node2, but the prompt appears on node1. To verify that nothing fishy is happening, you can run an ad-hoc trace on node2: Eshell V5.9 (abort with ^G) (node2@REDACTED)1> dbg:tracer(). {ok,<0.44.0>} (node2@REDACTED)2> dbg:tp(io,get_line,x). {ok,[{matched,'node2@REDACTED',2},{saved,x}]} (node2@REDACTED)3> dbg:p(new,[c]). {ok,[{matched,'node2@REDACTED',0}]} (node2@REDACTED)4> (<0.51.0>) call io:get_line('>> ') (<0.51.0>) returned from io:get_line/1 -> "foo\n" dbg:stop(). ok Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com From ulf@REDACTED Sun Apr 15 08:44:36 2012 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 15 Apr 2012 08:44:36 +0200 Subject: [erlang-questions] How to use "jobs": schedule tasks by core number In-Reply-To: References: <0A262A71-DF96-4B6B-91F5-1C6CECC0385C@feuerlabs.com> <439E18CF-303E-4BFE-AE9C-43FD59FF8415@gmail.com> Message-ID: <98CEF350-01EE-412D-AA0A-395C75C1E512@feuerlabs.com> Yes. I just pushed some bug fixes [1] and posted an example using shared counters as well [2]. BR, Ulf W [1] https://github.com/esl/jobs/commit/cd4135ee6f708ec1b98512200ee71de769755742 [2] https://github.com/esl/jobs/wiki/Shared-counters On 15 Apr 2012, at 08:33, Max Lapshin wrote: > Thank you for example! > > Am I right, that I need to set limit,8 to enable 8 simultaneous jobs? Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From xiaopong.tran@REDACTED Sun Apr 15 16:28:02 2012 From: xiaopong.tran@REDACTED (Xiaopong Tran) Date: Sun, 15 Apr 2012 22:28:02 +0800 Subject: [erlang-questions] [job] Erlang opening in Shanghai Message-ID: <4F8ADAF2.2040600@gmail.com> Hi, VC-backed startup in Shanghai is looking for Erlang developers; for the server side. Although Chinese and/or English is preferred, but we will consider anyone who can express him/herself through functional programming. Fun and fast-paced environment, cool project, great team. Requirements: Smart, team spirit, not afraid of hard problems, hacker type, roll-up-sleeve-and-get-hand-dirty type. Please get in touch with me in you're interested, or if you'd like to recommend someone. Cheers, Xiaopong From hukl@REDACTED Sun Apr 15 20:08:21 2012 From: hukl@REDACTED (John-Paul Bader) Date: Sun, 15 Apr 2012 20:08:21 +0200 Subject: [erlang-questions] How to handle a massive amount of UDP packets? Message-ID: <4F8B0E95.4060003@berlin.ccc.de> Dear list, I'm currently writing a bittorrent tracker in Erlang. While a naive implementation of the protocol is quite easy, there are some performance related challanges where I could use some help. In the first test run as a replacement for a very popular tracker, my erlang tracker got about 40k requests per second. My initial approach was to initialize the socket in one process with {active, once}, handle the message in handle_info with minimal effort and pass the data asynchronously to a freshly spawned worker processes which responds to the clients. After spawning the process I'm setting the socket back to {active, once}. Now when I switched the erlang tracker live the erlang vm was topping at 100% CPU load. My guess is that the process handling the udp packets from the socket could not keep up. Since I'm still quite new to the world of erlang I'd like to know if there are some best practices / patterns to handle this massive amount of packets. For example using the socket in {active, once} might be too slow? Also the response to the clients needs to come from the same port as the request was coming in. Is it a problem to use the same socket for that? Should I pre-spawn a couple of thousand workers and dispatch the data from the socket to them rather than spawning them on each packet? It would be really great if you could give some advice or point me into the right directions. ~ John From carlsson.richard@REDACTED Sun Apr 15 21:47:40 2012 From: carlsson.richard@REDACTED (Richard Carlsson) Date: Sun, 15 Apr 2012 21:47:40 +0200 Subject: [erlang-questions] Is there an accepted way of including GPL code in a project? In-Reply-To: References: Message-ID: <4F8B25DC.5080905@gmail.com> On 2012-04-13 11:57, Alan Evans wrote: > Hello list, > > I'm thinking about using some GPL code in a project I'm working on. > Namely the SIGTRAN stack from the osmocom project > (http://cgit.osmocom.org/cgit/erlang) > Is there a recognized way to incorporate GPL code in an erlang project > without making the whole project subject to the GPL license? > > I haven't yet decided whether or not to make my project open source. > > My thinking is that if I isolate all the GPL code to a particular > Erlang node then only the modules running on that node need to be GPL > or GPL compatible, I am free to license the modules running on the > other nodes any way I wish. > > Any thoughts? Other than the obvious "ask a lawyer" response :-) Erlang modules are dynamically linked to each other at run-time. The FSF considers this to be no different from static linkage, and Erlang is just like Java in this respect: http://www.gnu.org/licenses/lgpl-java.html My interpretation (not a lawyer etc. etc.) is that the LGPL is straightforward to use with Erlang, but plain GPL requires that all other libraries that your application calls, directly or indirectly, must be GPL compatible. (V3 of the GPL makes an exception for "system libraries", so the Erlang/OTP standard libraries don't pose a problem.) Isolating the GPL code to a separate node is similar to other workarounds I've seen that run GPL code in a separate OS process from the main application. It lies within that gray area where it will probably hold in court but will make you feel dirty. A nicer way would of course be if you could get hold of the original authors of that library and ask them for a different license, possibly for a fee. /Richard From nang2_2000@REDACTED Sun Apr 15 21:49:53 2012 From: nang2_2000@REDACTED (Kabir) Date: Sun, 15 Apr 2012 12:49:53 -0700 (PDT) Subject: [erlang-questions] How to handle a massive amount of UDP packets? In-Reply-To: <4F8B0E95.4060003@berlin.ccc.de> Message-ID: <1334519393.29619.YahooMailClassic@web110212.mail.gq1.yahoo.com> I am eager to know the answer of this question, too. Recently, I am trying out Erlang's own Diameter stack, which runs in a similar fashion, though it is mainly tcp-based. It spawns a new process to handle each request. With 3.6K requests per second, erlang vm is sucking one core out, while our in-house Diameter stack (C/C++ based) barely uses 5-10%. However, the round trip time is much shorter with Erlang Diameter stack, which further confuses me. I remember RabbitMQ uses a process worker pool instead of spawning new processes at will. Cheers ---- Kabir --- On Mon, 4/16/12, John-Paul Bader wrote: > From: John-Paul Bader > Subject: [erlang-questions] How to handle a massive amount of UDP packets? > To: erlang-questions@REDACTED > Date: Monday, April 16, 2012, 3:08 AM > Dear list, > > > I'm currently writing a bittorrent tracker in Erlang. While > a naive implementation of the protocol is quite easy, there > are some performance related challanges where I could use > some help. > > In the first test run as a replacement for a very popular > tracker, my erlang tracker got about 40k requests per > second. > > My initial approach was to initialize the socket in one > process with {active, once}, handle the message in > handle_info with minimal effort and pass the data > asynchronously to a freshly spawned worker processes which > responds to the clients. After spawning the process I'm > setting the socket back to {active, once}. > > Now when I switched the erlang tracker live the erlang vm > was topping at 100% CPU load. My guess is that the process > handling the udp packets from the socket could not keep up. > Since I'm still quite new to the world of erlang I'd like to > know if there are some best practices / patterns to handle > this massive amount of packets. > > For example using the socket in {active, once} might be too > slow? Also the response to the clients needs to come from > the same port as the request was coming in. Is it a problem > to use the same socket for that? Should I pre-spawn a couple > of thousand workers and dispatch the data from the socket to > them rather than spawning them on each packet? > > It would be really great if you could give some advice or > point me into the right directions. > > ~ John > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From rapsey@REDACTED Sun Apr 15 22:00:13 2012 From: rapsey@REDACTED (Rapsey) Date: Sun, 15 Apr 2012 22:00:13 +0200 Subject: [erlang-questions] How to handle a massive amount of UDP packets? In-Reply-To: <4F8B0E95.4060003@berlin.ccc.de> References: <4F8B0E95.4060003@berlin.ccc.de> Message-ID: Do some profiling. cprof to start with. A simple: cprof:start(),cprof:pause(),cprof:analyse(). cprof:stop(). while the server is running is often quite revealing. You need to figure out if your CPU is spent on sending or on receiving. One thing to keep in mind is that the erlang UDP socket code is not exactly as optimized as it could be for sending. To send something over UDP it would be really fast if you used a NIF that calls a write on the FD. Sergej On Sun, Apr 15, 2012 at 8:08 PM, John-Paul Bader wrote: > Dear list, > > > I'm currently writing a bittorrent tracker in Erlang. While a naive > implementation of the protocol is quite easy, there are some performance > related challanges where I could use some help. > > In the first test run as a replacement for a very popular tracker, my > erlang tracker got about 40k requests per second. > > My initial approach was to initialize the socket in one process with > {active, once}, handle the message in handle_info with minimal effort and > pass the data asynchronously to a freshly spawned worker processes which > responds to the clients. After spawning the process I'm setting the socket > back to {active, once}. > > Now when I switched the erlang tracker live the erlang vm was topping at > 100% CPU load. My guess is that the process handling the udp packets from > the socket could not keep up. Since I'm still quite new to the world of > erlang I'd like to know if there are some best practices / patterns to > handle this massive amount of packets. > > For example using the socket in {active, once} might be too slow? Also the > response to the clients needs to come from the same port as the request was > coming in. Is it a problem to use the same socket for that? Should I > pre-spawn a couple of thousand workers and dispatch the data from the > socket to them rather than spawning them on each packet? > > It would be really great if you could give some advice or point me into > the right directions. > > ~ John > ______________________________**_________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/**listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Sun Apr 15 22:29:58 2012 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 15 Apr 2012 22:29:58 +0200 Subject: [erlang-questions] How to handle a massive amount of UDP packets? In-Reply-To: <1334519393.29619.YahooMailClassic@web110212.mail.gq1.yahoo.com> References: <1334519393.29619.YahooMailClassic@web110212.mail.gq1.yahoo.com> Message-ID: That erlang-based apps have better response times than C/C++-based apps is not uncommon. Many techniques to get high throughput do bad things to latency. The dynamically spawned processes in the Diameter application don't coat much (unless you have them do heavy apllication-specific stuff), and they shouldn't load only one core. Most of the heavy lifting (encode/decode, retramsmit logic etc.) is in the dia_service module, and (I think) done in the dedicated process handling a certain port. BR, Ulf W Ulf Wiger, Feuerlabs, Inc. http://www.feuerlabs.com 15 apr 2012 kl. 21:49 skrev Kabir : > I am eager to know the answer of this question, too. Recently, I am trying out Erlang's own Diameter stack, which runs in a similar fashion, though it is mainly tcp-based. It spawns a new process to handle each request. With 3.6K requests per second, erlang vm is sucking one core out, while our in-house Diameter stack (C/C++ based) barely uses 5-10%. However, the round trip time is much shorter with Erlang Diameter stack, which further confuses me. > > I remember RabbitMQ uses a process worker pool instead of spawning new processes at will. > > Cheers > ---- > Kabir > > > --- On Mon, 4/16/12, John-Paul Bader wrote: > >> From: John-Paul Bader >> Subject: [erlang-questions] How to handle a massive amount of UDP packets? >> To: erlang-questions@REDACTED >> Date: Monday, April 16, 2012, 3:08 AM >> Dear list, >> >> >> I'm currently writing a bittorrent tracker in Erlang. While >> a naive implementation of the protocol is quite easy, there >> are some performance related challanges where I could use >> some help. >> >> In the first test run as a replacement for a very popular >> tracker, my erlang tracker got about 40k requests per >> second. >> >> My initial approach was to initialize the socket in one >> process with {active, once}, handle the message in >> handle_info with minimal effort and pass the data >> asynchronously to a freshly spawned worker processes which >> responds to the clients. After spawning the process I'm >> setting the socket back to {active, once}. >> >> Now when I switched the erlang tracker live the erlang vm >> was topping at 100% CPU load. My guess is that the process >> handling the udp packets from the socket could not keep up. >> Since I'm still quite new to the world of erlang I'd like to >> know if there are some best practices / patterns to handle >> this massive amount of packets. >> >> For example using the socket in {active, once} might be too >> slow? Also the response to the clients needs to come from >> the same port as the request was coming in. Is it a problem >> to use the same socket for that? Should I pre-spawn a couple >> of thousand workers and dispatch the data from the socket to >> them rather than spawning them on each packet? >> >> It would be really great if you could give some advice or >> point me into the right directions. >> >> ~ John >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From nang2_2000@REDACTED Sun Apr 15 22:45:25 2012 From: nang2_2000@REDACTED (Kabir) Date: Sun, 15 Apr 2012 13:45:25 -0700 (PDT) Subject: [erlang-questions] How to handle a massive amount of UDP packets? In-Reply-To: Message-ID: <1334522725.19707.YahooMailClassic@web110203.mail.gq1.yahoo.com> I should have quoted the phrase "sucking one core out". :) No, the VM thread is not taking 100% of one core. It takes 65% of one, 30% of another and 5% of the 3rd one, for example. It just happens to show 100% in top as if it were sucking one core out. Also, I did eprof on Diameter stack and noticed erlang:port_command() took 20-30% of CPU time of the diameter peer fsm (or transport?) process and this process is the busiest process shown by etop. Would it is because erlang tcp and udp aren't optimized to the best? In addition, spawning new processes at will creates a big problem with eprof. If I use it to profile diameter service process as the root, the result contains info for many many short lived processes. It becomes very hard to analyze. Using a process pool should be easier to profile. Cheers ---- Kabir --- On Mon, 4/16/12, Ulf Wiger wrote: > From: Ulf Wiger > Subject: Re: [erlang-questions] How to handle a massive amount of UDP packets? > To: "Kabir" > Cc: "erlang-questions@REDACTED" , "John-Paul Bader" > Date: Monday, April 16, 2012, 5:29 AM > That erlang-based apps have better > response times than C/C++-based apps is not uncommon. Many > techniques to get high throughput do bad things to latency. > > The dynamically spawned processes in the Diameter > application don't coat much (unless you have them do heavy > apllication-specific stuff), and they shouldn't load only > one core. Most of the heavy lifting (encode/decode, > retramsmit logic etc.) is in the dia_service module, and (I > think) done in the dedicated process handling a certain > port. > > BR, > Ulf W > > Ulf Wiger, Feuerlabs, Inc. > http://www.feuerlabs.com > > 15 apr 2012 kl. 21:49 skrev Kabir : > > > I am eager to know the answer of this question, too. > Recently, I am trying out Erlang's own Diameter stack, which > runs in a similar fashion, though it is mainly tcp-based. It > spawns a new process to handle each request. With 3.6K > requests per second, erlang vm is sucking one core out, > while our in-house Diameter stack (C/C++ based) barely uses > 5-10%. However, the round trip time is much shorter with > Erlang Diameter stack, which further confuses me. > > > > I remember RabbitMQ uses a process worker pool instead > of spawning new processes at will. > > > > Cheers > > ---- > > Kabir > > > > > > --- On Mon, 4/16/12, John-Paul Bader > wrote: > > > >> From: John-Paul Bader > >> Subject: [erlang-questions] How to handle a massive > amount of UDP packets? > >> To: erlang-questions@REDACTED > >> Date: Monday, April 16, 2012, 3:08 AM > >> Dear list, > >> > >> > >> I'm currently writing a bittorrent tracker in > Erlang. While > >> a naive implementation of the protocol is quite > easy, there > >> are some performance related challanges where I > could use > >> some help. > >> > >> In the first test run as a replacement for a very > popular > >> tracker, my erlang tracker got about 40k requests > per > >> second. > >> > >> My initial approach was to initialize the socket in > one > >> process with {active, once}, handle the message in > >> handle_info with minimal effort and pass the data > >> asynchronously to a freshly spawned worker > processes which > >> responds to the clients. After spawning the process > I'm > >> setting the socket back to {active, once}. > >> > >> Now when I switched the erlang tracker live the > erlang vm > >> was topping at 100% CPU load. My guess is that the > process > >> handling the udp packets from the socket could not > keep up. > >> Since I'm still quite new to the world of erlang > I'd like to > >> know if there are some best practices / patterns to > handle > >> this massive amount of packets. > >> > >> For example using the socket in {active, once} > might be too > >> slow? Also the response to the clients needs to > come from > >> the same port as the request was coming in. Is it a > problem > >> to use the same socket for that? Should I pre-spawn > a couple > >> of thousand workers and dispatch the data from the > socket to > >> them rather than spawning them on each packet? > >> > >> It would be really great if you could give some > advice or > >> point me into the right directions. > >> > >> ~ John > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://erlang.org/mailman/listinfo/erlang-questions > >> > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > From magnus.klaar@REDACTED Sun Apr 15 23:24:59 2012 From: magnus.klaar@REDACTED (Magnus Klaar) Date: Sun, 15 Apr 2012 23:24:59 +0200 Subject: [erlang-questions] How to handle a massive amount of UDP packets? In-Reply-To: <4F8B0E95.4060003@berlin.ccc.de> References: <4F8B0E95.4060003@berlin.ccc.de> Message-ID: Hi! You only mention setting the {active, once} option. Are you also setting higher values for the recbuf, sndbuf and read_packets options? As with all non-10gen default settings they are set to a low but safe value that may not be optimal for all applications. MVH Magnus On Sun, Apr 15, 2012 at 8:08 PM, John-Paul Bader wrote: > Dear list, > > > I'm currently writing a bittorrent tracker in Erlang. While a naive > implementation of the protocol is quite easy, there are some performance > related challanges where I could use some help. > > In the first test run as a replacement for a very popular tracker, my > erlang tracker got about 40k requests per second. > > My initial approach was to initialize the socket in one process with > {active, once}, handle the message in handle_info with minimal effort and > pass the data asynchronously to a freshly spawned worker processes which > responds to the clients. After spawning the process I'm setting the socket > back to {active, once}. > > Now when I switched the erlang tracker live the erlang vm was topping at > 100% CPU load. My guess is that the process handling the udp packets from > the socket could not keep up. Since I'm still quite new to the world of > erlang I'd like to know if there are some best practices / patterns to > handle this massive amount of packets. > > For example using the socket in {active, once} might be too slow? Also the > response to the clients needs to come from the same port as the request was > coming in. Is it a problem to use the same socket for that? Should I > pre-spawn a couple of thousand workers and dispatch the data from the > socket to them rather than spawning them on each packet? > > It would be really great if you could give some advice or point me into > the right directions. > > ~ John > ______________________________**_________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/**listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hukl@REDACTED Sun Apr 15 23:41:01 2012 From: hukl@REDACTED (John-Paul Bader) Date: Sun, 15 Apr 2012 23:41:01 +0200 Subject: [erlang-questions] How to handle a massive amount of UDP packets? In-Reply-To: References: <4F8B0E95.4060003@berlin.ccc.de> Message-ID: <4F8B406D.2030409@berlin.ccc.de> Ok, little update. I've changed the implementation to use {active,false} and a manual gen_udp:recv loop but that made things only slightly faster. Then I commented out the part where I spawned the processes which compute and send back the response to the clients and this gave a _huge_ speed improvement. I ran a benchmark on a fast server and could easily handle 100-200k packets per second without losing a single packet. So clearly my problem is dispatching the packet/message to the worker processes. I will experiment with a worker pool next instead of spawning the processes on demand. If you know how to do this dispatching with as little overhead as possible please let me know. ~ John Magnus Klaar wrote: > Hi! > > You only mention setting the {active, once} option. Are you also setting > higher values for the recbuf, sndbuf and read_packets options? As with > all non-10gen default settings they are set to a low but safe value that > may not be optimal for all applications. > > MVH Magnus > > On Sun, Apr 15, 2012 at 8:08 PM, John-Paul Bader > wrote: > > Dear list, > > > I'm currently writing a bittorrent tracker in Erlang. While a naive > implementation of the protocol is quite easy, there are some > performance related challanges where I could use some help. > > In the first test run as a replacement for a very popular tracker, > my erlang tracker got about 40k requests per second. > > My initial approach was to initialize the socket in one process with > {active, once}, handle the message in handle_info with minimal > effort and pass the data asynchronously to a freshly spawned worker > processes which responds to the clients. After spawning the process > I'm setting the socket back to {active, once}. > > Now when I switched the erlang tracker live the erlang vm was > topping at 100% CPU load. My guess is that the process handling the > udp packets from the socket could not keep up. Since I'm still quite > new to the world of erlang I'd like to know if there are some best > practices / patterns to handle this massive amount of packets. > > For example using the socket in {active, once} might be too slow? > Also the response to the clients needs to come from the same port as > the request was coming in. Is it a problem to use the same socket > for that? Should I pre-spawn a couple of thousand workers and > dispatch the data from the socket to them rather than spawning them > on each packet? > > It would be really great if you could give some advice or point me > into the right directions. > > ~ John > _________________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/__listinfo/erlang-questions > > > From magnus.klaar@REDACTED Sun Apr 15 23:52:25 2012 From: magnus.klaar@REDACTED (Magnus Klaar) Date: Sun, 15 Apr 2012 23:52:25 +0200 Subject: [erlang-questions] How to handle a massive amount of UDP packets? In-Reply-To: <4F8B406D.2030409@berlin.ccc.de> References: <4F8B0E95.4060003@berlin.ccc.de> <4F8B406D.2030409@berlin.ccc.de> Message-ID: Hi! You didn't really answer my question, but you may also want to look into buffering the packets and spawning a process to handle the bufffer. It's a lot more simple than maintaining a pool of worker processes. You only want to do that if you're pooling resources that are expensive to create, something which processes aren't. MVH Magnus On Sun, Apr 15, 2012 at 11:41 PM, John-Paul Bader wrote: > Ok, little update. > > I've changed the implementation to use {active,false} and a manual > gen_udp:recv loop but that made things only slightly faster. Then I > commented out the part where I spawned the processes which compute and send > back the response to the clients and this gave a _huge_ speed improvement. > > I ran a benchmark on a fast server and could easily handle 100-200k > packets per second without losing a single packet. > > So clearly my problem is dispatching the packet/message to the worker > processes. I will experiment with a worker pool next instead of spawning > the processes on demand. > > If you know how to do this dispatching with as little overhead as possible > please let me know. > > ~ John > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Mon Apr 16 02:14:52 2012 From: ok@REDACTED (Richard O'Keefe) Date: Mon, 16 Apr 2012 12:14:52 +1200 Subject: [erlang-questions] HiPE on ARM Build Issue In-Reply-To: <4F89317F.80002@cs.ntua.gr> References: <4F89317F.80002@cs.ntua.gr> Message-ID: <5A054E03-2E9D-4E23-866E-9A122985C977@cs.otago.ac.nz> On 14/04/2012, at 8:12 PM, Kostis Sagonas wrote: > In the HiPE team we would very much like to support the ARM architecture > but the problem these days - for quite some time actually - is that we do not have access to any machine with an ARM processor. It's very painful to be testing ARM using QEMU, esp. all sorts of different ARMs that exist these days. Hence, occasionally code tends to rot or, as in this case which involves a newer ARMv7, code has never been tested on newer architectures. When my colleague Andrew Trotman wanted to port his information retrieval engine to ARM (which turned out to mean 'configure, make, make install' (:-)) he bought a cheap mobile phone and installed Linux on it. You can get one for under NZD150. A BeagleBone board is USD 89. armv7. > > (I do not know what sort of access to ARM machines the Erlang/OTP team at Ericsson has, but I suspect that they do not have access to all possible ARMs either.) Since ARM is found in all sorts of SoC designs, "all possible ARMs" may well be an infinite set; even "all actual ARMs" is rather large. I don't suppose HiPE would be interested in Jazelle or NEON. From hukl@REDACTED Mon Apr 16 07:23:46 2012 From: hukl@REDACTED (John-Paul Bader) Date: Mon, 16 Apr 2012 07:23:46 +0200 Subject: [erlang-questions] How to handle a massive amount of UDP packets? In-Reply-To: References: <4F8B0E95.4060003@berlin.ccc.de> <4F8B406D.2030409@berlin.ccc.de> Message-ID: <4F8BACE2.7060505@berlin.ccc.de> Sorry, so far I did not set the mentioned properties to higher values and will experiement with that as well. Magnus Klaar wrote: > Hi! > > You didn't really answer my question, but you may also want to look into > buffering the packets and spawning a process to handle the bufffer. It's > a lot more simple than maintaining a pool of worker processes. You only > want to do that if you're pooling resources that are expensive to > create, something which processes aren't. > > MVH Magnus > > On Sun, Apr 15, 2012 at 11:41 PM, John-Paul Bader > wrote: > > Ok, little update. > > I've changed the implementation to use {active,false} and a manual > gen_udp:recv loop but that made things only slightly faster. Then I > commented out the part where I spawned the processes which compute > and send back the response to the clients and this gave a _huge_ > speed improvement. > > I ran a benchmark on a fast server and could easily handle 100-200k > packets per second without losing a single packet. > > So clearly my problem is dispatching the packet/message to the > worker processes. I will experiment with a worker pool next instead > of spawning the processes on demand. > > If you know how to do this dispatching with as little overhead as > possible please let me know. > > ~ John > > From max.lapshin@REDACTED Mon Apr 16 07:45:47 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Mon, 16 Apr 2012 09:45:47 +0400 Subject: [erlang-questions] How to handle a massive amount of UDP packets? In-Reply-To: References: <4F8B0E95.4060003@berlin.ccc.de> Message-ID: I've created proxy that translates UDP MPEG-TS to HTTP MPEG-TS. Erlang couldn't handle 1 Gbps of incoming 188 bytes packets because it was too many messages. Just because of them. That is why I've switched to driver that accumulates UDP packets in big chunks, lowers their amount in 10 times and sends as a big message. It can handle payload of several gigabits. From ok@REDACTED Mon Apr 16 08:09:45 2012 From: ok@REDACTED (Richard O'Keefe) Date: Mon, 16 Apr 2012 18:09:45 +1200 Subject: [erlang-questions] Erlang on multi-CPU board using USB Message-ID: <2F85FB34-CC47-4017-9C20-759BDFD197C1@cs.otago.ac.nz> We're building an 8-ARM machine from two boards with four ARMs each, connected using USB (because the ARM chips in question have USB built-in but not Ethernet). I'd like to run Erlang on this system as a cluster. Has anyone done something like that? I am (only just) aware of ethernet-over-USB, but I've never set up an Erlang cluster by any means other than IP. Where should I start looking in the Fine Manuals? From moxford@REDACTED Mon Apr 16 08:18:25 2012 From: moxford@REDACTED (Mike Oxford) Date: Sun, 15 Apr 2012 23:18:25 -0700 Subject: [erlang-questions] BERT encoding and WebSocket In-Reply-To: References: <3516e246-0cf8-4748-8646-6b4ce1f57557@z3g2000pbn.googlegroups.com> <0D48BDBF-1A6A-4F49-A59C-A585A3AA8D95@licenser.net> Message-ID: There are some places around which are running out of frequency/spectrum, you are correct. However, the advantages of binary over JSON aren't as huge as they appear on the surface. 1) gz compression on JSON brings things down closer to hand-rolled binary protocols 2) Application space usage (frequency of sends, streaming vs periodic updates etc) 3) Dev time, time to market, etc. 4) Move bandwidth is becoming available (FCC here in the US, etc) 5) 4G LTE rollouts 6) WiFi coverage expansion Sometimes you have to pack it down, but for a lot of mobile uses JSON is just the right way to go (with liberal uses of -define() and an eye that you may need to swap protocols later.) -mox On Wed, Apr 11, 2012 at 11:49 PM, Joe Armstrong wrote: > On Thu, Apr 12, 2012 at 6:57 AM, Mike Oxford wrote: > > A truly stripped down binary-protocol can be faster and leaner than JSON, > > but for web-work JSON is highly preferred. Why? Javascript has zero > tools > > for handling binary data and PHP's binary support is all but > non-existent. > > mochijson2 is a good library for converting between erlang terms and > JSON. > > > > JSON is more word-y and takes up more bandwidth, sure, but most people > > aren't uber-optimizing for 56k modems these days (exception: mobile.) > > Right but "exception:mobile" is the kicker - we're running out of > mobile bandwidth real fast. > demand for for mobile bandwidth is growing at a faster rate than > supply - and supply > is limited by *physics* - as sales of smartphones increase there is > more and more > pressure on the net - 3G sucks in most city-centers. > > This means that mobile apps must "weight every byte on golden scales" > > JSON is *not* highly preferred here - I'd use UINT8INT arrays and > huffman encoding > and caching if the content is to be future proof. It's not much good > making a cross platform > app that just won't run in a congested mobile net ... > > /Joe > > > > > The ease of using JSON in Ruby + PHP + javascript + iOS + Android more > than > > makes up for the wire overhead. And it's easier to read tcpdump/pcaps, > use > > existing tools like curl and read native traces/dumps. > > > > If you're just using backend server-server, BERT is easier and protobufs > is > > smaller/more efficient. > > > > I use JSON on the front, BERT on the back with protobufs for talking to > > Riak. I deprecated AMF and a custom binary protocol on the front due to > the > > above reasons. > > > > -mox > > > > > > On Wed, Apr 11, 2012 at 9:20 AM, Heinz N. Gies > wrote: > >> > >> I was thinking about the same, > >> after some testing I went to use JSON it was smaller then BERT+base64 > for > >> my cases without it I had problems with transmissions. > >> > >> Regards, > >> Heinz > >> -- > >> Heinz N. Gies > >> heinz@REDACTED > >> http://licenser.net > >> > >> On Apr 10, 2012, at 04:26, ngocdaothanh wrote: > >> > >> > What is the best way to use BERT encoding (http://bert-rpc.org/) with > >> > WebSocket? > >> > > >> > BERT is binary but WebSocket does not support binary at this moment. > >> > Should I use base64 to encode BERT binary to normal string? Base64 has > >> > 33% overhead (http://en.wikipedia.org/wiki/Base64). How much space > can > >> > BERT save compared to JSON? > >> > _______________________________________________ > >> > erlang-questions mailing list > >> > erlang-questions@REDACTED > >> > http://erlang.org/mailman/listinfo/erlang-questions > >> > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://erlang.org/mailman/listinfo/erlang-questions > > > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From aleksandr.vin@REDACTED Mon Apr 16 08:31:03 2012 From: aleksandr.vin@REDACTED (Aleksandr Vinokurov) Date: Mon, 16 Apr 2012 10:31:03 +0400 Subject: [erlang-questions] Cowboy, Mochiweb or Webmachine In-Reply-To: References: Message-ID: Thanks all of you. I'll try Webmachine, with your help. :) -- Aleksandr Vinokurov On 16 April 2012 10:05, Mike Oxford wrote: > Sorry, Mochiweb or Webmachine (which uses Mochiweb internally.) > > -mox > > > On Sun, Apr 15, 2012 at 11:04 PM, Mike Oxford wrote: > >> I switched from Misultin to Cowboy when Misultin shut down. >> >> Cowboy's more in startup mode and not really a mature option, and they're >> ripping it apart here shortly to split some stuff out. >> >> If I had it to do over again I would use Mochiweb. It's a larger >> project, backed by Basho and more "complete." >> >> -mox >> >> >> On Wed, Apr 11, 2012 at 7:23 AM, Aleksandr Vinokurov < >> aleksandr.vin@REDACTED> wrote: >> >>> >>> >>> Hi all, >>> >>> I'm looking for a Web framework to use for OAuth 2.0 implementation. And >>> I've heard for Cowboy, Mochiweb and Webmachine in a Web context discussions. >>> >>> Can you describe their differences in short words (if it is available) >>> or give me a hint in what order to try them? >>> >>> PS. I've also heard of Chicago Boss but it seems to be very big for my >>> task, am I right? >>> >>> With best regards, >>> Aleksandr Vinokurov >>> @aleksandrvin >>> >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> >>> >> > -- ????????? ????????? +7 (921) 982-21-43 @aleksandrvin -------------- next part -------------- An HTML attachment was scrubbed... URL: From chandrashekhar.mullaparthi@REDACTED Mon Apr 16 09:25:15 2012 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Mon, 16 Apr 2012 08:25:15 +0100 Subject: [erlang-questions] How to handle a massive amount of UDP packets? In-Reply-To: <4F8B0E95.4060003@berlin.ccc.de> References: <4F8B0E95.4060003@berlin.ccc.de> Message-ID: Hi John, Our RADIUS server which handles our data network is written in Erlang. We've experimented with various values of recbuf and read_packets options for the UDP socket. We also use {active, once}. The receiving process receives a packet and spawns a new process to handle it. That is all it does. The spawned process then executes the rest of the business logic. That won't be your problem. The problem will be to make sure your system is stable while handling all those packets. We use overload control at the receiver. You have to pretty much look at the entire execution path for each packet and ensure there are no bottlenecks. At that kind of load, every little bottleneck shows up sooner or later. cheers Chandru On 15 April 2012 19:08, John-Paul Bader wrote: > Dear list, > > > I'm currently writing a bittorrent tracker in Erlang. While a naive > implementation of the protocol is quite easy, there are some performance > related challanges where I could use some help. > > In the first test run as a replacement for a very popular tracker, my > erlang tracker got about 40k requests per second. > > My initial approach was to initialize the socket in one process with > {active, once}, handle the message in handle_info with minimal effort and > pass the data asynchronously to a freshly spawned worker processes which > responds to the clients. After spawning the process I'm setting the socket > back to {active, once}. > > Now when I switched the erlang tracker live the erlang vm was topping at > 100% CPU load. My guess is that the process handling the udp packets from > the socket could not keep up. Since I'm still quite new to the world of > erlang I'd like to know if there are some best practices / patterns to > handle this massive amount of packets. > > For example using the socket in {active, once} might be too slow? Also the > response to the clients needs to come from the same port as the request was > coming in. Is it a problem to use the same socket for that? Should I > pre-spawn a couple of thousand workers and dispatch the data from the > socket to them rather than spawning them on each packet? > > It would be really great if you could give some advice or point me into > the right directions. > > ~ John > ______________________________**_________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/**listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthias@REDACTED Mon Apr 16 10:26:01 2012 From: matthias@REDACTED (Matthias Lang) Date: Mon, 16 Apr 2012 10:26:01 +0200 Subject: [erlang-questions] Erlang on multi-CPU board using USB In-Reply-To: <2F85FB34-CC47-4017-9C20-759BDFD197C1@cs.otago.ac.nz> References: <2F85FB34-CC47-4017-9C20-759BDFD197C1@cs.otago.ac.nz> Message-ID: <20120416082601.GA2284@corelatus.se> On Monday, April 16, Richard O'Keefe wrote: > We're building an 8-ARM machine from two boards with four ARMs > each, connected using USB (because the ARM chips in question have > USB built-in but not Ethernet). I'd like to run Erlang on this > system as a cluster. Has anyone done something like that? I am > (only just) aware of ethernet-over-USB, but I've never set up an > Erlang cluster by any means other than IP. Where should I start > looking in the Fine Manuals? One way to read your question is that you're ruling out running Erlang distribution over IP. Why? I.e. why not run ethernet-over-USB, run IP on that and then run distributed Erlang over IP as usual? That approach doesn't require reading any Fine Erlang manuals at all, though it does require fiddling with Linux, assuming you're running Linux. If you really want to run without IP, then one approach is to implement your own Erlang distribution back-end using whatever method you like for getting data between CPUs over USB. We wrote our own distribution back end to let two ARM cores communicate over VLYNQ (a Texas Instruments specific connection between chips). My colleague Thomas did it all, I think it took him roughly a week, including figuring out VLYNQ. He started by looking at the 'uds_dist' example (included in the Erlang source tree) and reading the chapter about distribution backends in the ERTS manual: http://www.erlang.org/doc/apps/erts/alt_dist.html Matt From hukl@REDACTED Mon Apr 16 11:31:39 2012 From: hukl@REDACTED (John-Paul Bader) Date: Mon, 16 Apr 2012 11:31:39 +0200 Subject: [erlang-questions] How to handle a massive amount of UDP packets? In-Reply-To: References: <4F8B0E95.4060003@berlin.ccc.de> Message-ID: <4F8BE6FB.3020205@berlin.ccc.de> Hey Chandru, how many packets per second did you have to deal with and how big are they? Just to have something to compare to. ~ John Chandru wrote: > Hi John, > > Our RADIUS server which handles our data network is written in Erlang. > We've experimented with various values of recbuf and read_packets > options for the UDP socket. We also use {active, once}. The receiving > process receives a packet and spawns a new process to handle it. That is > all it does. The spawned process then executes the rest of the business > logic. > > That won't be your problem. The problem will be to make sure your system > is stable while handling all those packets. We use overload control at > the receiver. You have to pretty much look at the entire execution path > for each packet and ensure there are no bottlenecks. At that kind of > load, every little bottleneck shows up sooner or later. > > cheers > Chandru > > On 15 April 2012 19:08, John-Paul Bader > wrote: > > Dear list, > > > I'm currently writing a bittorrent tracker in Erlang. While a naive > implementation of the protocol is quite easy, there are some > performance related challanges where I could use some help. > > In the first test run as a replacement for a very popular tracker, > my erlang tracker got about 40k requests per second. > > My initial approach was to initialize the socket in one process with > {active, once}, handle the message in handle_info with minimal > effort and pass the data asynchronously to a freshly spawned worker > processes which responds to the clients. After spawning the process > I'm setting the socket back to {active, once}. > > Now when I switched the erlang tracker live the erlang vm was > topping at 100% CPU load. My guess is that the process handling the > udp packets from the socket could not keep up. Since I'm still quite > new to the world of erlang I'd like to know if there are some best > practices / patterns to handle this massive amount of packets. > > For example using the socket in {active, once} might be too slow? > Also the response to the clients needs to come from the same port as > the request was coming in. Is it a problem to use the same socket > for that? Should I pre-spawn a couple of thousand workers and > dispatch the data from the socket to them rather than spawning them > on each packet? > > It would be really great if you could give some advice or point me > into the right directions. > > ~ John > _________________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/__listinfo/erlang-questions > > > From bookjovi@REDACTED Mon Apr 16 11:33:43 2012 From: bookjovi@REDACTED (Jovi Zhang) Date: Mon, 16 Apr 2012 17:33:43 +0800 Subject: [erlang-questions] operate C data structure using Erlang Message-ID: Hi, Currently I'm working a Erlang project which need send msg represent by C language data structure. I know that Erlang have record represent by tuple, Is there have any open source project aim on resolve this problem? generate record format for C data structure automatically? note that there have many C data structure need to transform. There have JSON and protobuf, but none is toward plain C data structure, I cannot change the message protocol now because Erlang node need to communicate with C node. .jovi -------------- next part -------------- An HTML attachment was scrubbed... URL: From gleber.p@REDACTED Mon Apr 16 11:41:42 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Mon, 16 Apr 2012 11:41:42 +0200 Subject: [erlang-questions] operate C data structure using Erlang In-Reply-To: References: Message-ID: On Mon, Apr 16, 2012 at 11:33, Jovi Zhang wrote: > Hi, > > Currently I'm working a Erlang project which need send msg?represent by C > language data structure. > I know that Erlang have record represent by tuple, Is there have any open > source project aim on?resolve?this problem? > generate record format for C data structure?automatically??note that there > have many C data structure need to transform. > > There have JSON and protobuf, but none is toward plain C data structure, I > cannot change the message?protocol now because Erlang node need to > communicate with C node. > > .jovi Erlang has absolutely awesome tools to work with binaries. You will be able to parse and create binaries you want, including binary which can be represented with C structs. Of course assuming you are talking about parsing C structs which have been transported to Erlang via a network :) Best, Gleb From juan.puig.martinez@REDACTED Mon Apr 16 12:01:58 2012 From: juan.puig.martinez@REDACTED (Juan Puig) Date: Mon, 16 Apr 2012 11:01:58 +0100 (BST) Subject: [erlang-questions] trapexit.org In-Reply-To: Message-ID: <50491b83-0169-49f5-b315-3b9a6f806c5e@knuth> It has been torn down to migrate all its data into a future project. Stay tuned. Juan Puig Erlang Solutions Ltd - London www.erlang-solutions.com ----- Original Message ----- > > Hello, all, > does somebody know what happened with trapexit.com ? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From vasdeveloper@REDACTED Mon Apr 16 12:22:17 2012 From: vasdeveloper@REDACTED (Kannan) Date: Mon, 16 Apr 2012 15:52:17 +0530 Subject: [erlang-questions] operate C data structure using Erlang In-Reply-To: References: Message-ID: Hi Jovi, Since the communication is in between Erlang and C nodes, you don't have to worry about marshaling/un-marshaling the data at the Erlang node side. You can send and receive 'messages' in the 'record tuple' format. But, at the C node side, you have the work. You will have to hand code marshaling/un-marshaling routines to populate the Erlang ?records? or to populate the C structures. It very simple to edit C structures into Erlang records. I don?t think you will have to invent an interpreter for that. May be, you want to have a utility to generate marshaling/un-marshaling routines in C, from your C structures. If you are familiar with C preprocessor techniques, you can simply write a reusable module to generate marshaling/un-marshaling routines, and of course relevant Erlang records, with the help of a ?definition file?. Kannan. On Mon, Apr 16, 2012 at 3:03 PM, Jovi Zhang wrote: > Hi, > > Currently I'm working a Erlang project which need send msg represent by C > language data structure. > I know that Erlang have record represent by tuple, Is there have any open > source project aim on resolve this problem? > generate record format for C data structure automatically? note that there > have many C data structure need to transform. > > There have JSON and protobuf, but none is toward plain C data structure, I > cannot change the message protocol now because Erlang node need to > communicate with C node. > > .jovi > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From samuelrivas@REDACTED Mon Apr 16 12:55:51 2012 From: samuelrivas@REDACTED (Samuel) Date: Mon, 16 Apr 2012 12:55:51 +0200 Subject: [erlang-questions] operate C data structure using Erlang In-Reply-To: References: Message-ID: Hi, I'm not sure I understood you right, but from your mail I don't fully get the constrains you have to meet. Anyway to communicate erlang and C you have to put some glue in both sides, cannot happen automatically. Of course there are a number of tools to do it, but choosing one of them or writing a new one is something that has to be done with good understanding of the problem (which I don't have, but you do ;)) Just in case you don't have clear how to communicate both sides, there is a good paper explaining an old tool (EDTK). There are probably better tools today, but the paper explains quite good the issues and possible solutions: http://www.snookles.com/erlang/edtk/pli2002-edtk-paper.pdf Hope it helps -- Samuel From john.hughes@REDACTED Mon Apr 16 14:01:32 2012 From: john.hughes@REDACTED (John Hughes) Date: Mon, 16 Apr 2012 14:01:32 +0200 Subject: [erlang-questions] Resources for QuickCheck and TyPer In-Reply-To: References: Message-ID: <20EA802F7D334E9F942FBD4A6E569A4E@JohnsTablet2012> Hi Tej, Nowadays there is an installer (in Erlang)... if you cd to the directory containing eqc_install and run eqc_install:install(), then you should get a working installation. You will probably need to sudo/run as administrator in order to do that, because your Erlang installation is normally not writable. John From: Tejaswi Haramurali Sent: Saturday, April 07, 2012 12:33 AM To: erlang-questions@REDACTED Subject: [erlang-questions] Resources for QuickCheck and TyPer Thanks for your replies John and Tilman... I tried downloading Quickcheck from the link provided and run it, but however I was unable to. I followed the instructions in the ReadMe file and pasted the eqc- folder to the "lib" folder inside my Erlang installation folder, but still the "eqc:quickcheck" command doesnt work. Can you kindly help me out ? Is there anything I am missing ? regards, Tej -------------------------------------------------------------------------------- _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From Sergey_Zhemzhitsky@REDACTED Mon Apr 16 14:17:30 2012 From: Sergey_Zhemzhitsky@REDACTED (Zhemzhitsky Sergey) Date: Mon, 16 Apr 2012 12:17:30 +0000 Subject: [erlang-questions] Rebar eunit selective dependency exclusion in rebar.config? Message-ID: <06139A918ACCA041BF46A0F36940C7FA333CC319@exch-mbx1.msk.trd.ru> Hi guys, I?m currently trying to integrate eunit into my build process which is implemented with rebar. I have a number of dependencies which I don?t like to be under tests, so I?m wondering how to exclude these deps in rebar.config? I?ve already found that it?s possible to run rebar using the following commands: ./rebar eunit app=app_name ./rebar eunit skip_app=app_name ./rebar eunit skip_deps=true However I?d like to specify dependencies under test in rebar.config. Is it possible with current version of rebar? Best Regards, Sergey _______________________________________________________ The information contained in this message may be privileged and conf idential and protected from disclosure. If you are not the original intended recipient, you are hereby notified that any review, retransmission, dissemination, or other use of, or taking of any action in reliance upon, this information is prohibited. If you have received this communication in error, please notify the sender immediately by replying to this message and delete it from your computer. Thank you for your cooperation. Troika Dialog, Russia. If you need assistance please contact our Contact Center (+7495) 258 0500 or go to www.troika.ru/eng/Contacts/system.wbp -------------- next part -------------- An HTML attachment was scrubbed... URL: From dean_yanqing@REDACTED Mon Apr 16 14:59:32 2012 From: dean_yanqing@REDACTED (=?utf-8?B?ZGVhbiDlros=?=) Date: Mon, 16 Apr 2012 20:59:32 +0800 (CST) Subject: [erlang-questions] =?utf-8?q?re=EF=BC=9A__operate_C_data_structur?= =?utf-8?q?e_using_Erlang?= In-Reply-To: References: Message-ID: <1334581172.73708.YahooMailNeo@web15206.mail.cnb.yahoo.com> Hi? ? ?The situation Erlang need to follow C style data structure, before send to C, you need to convert Erlang record into C style date structure, right? And you said there are pretty ?C structures. In fact you can implement an module encode/decode Erlang record into C style automatically. Phase ?C head file then write to an file that can tell Erlang how to do the alignment for specify signal. ?It's not too difficult, just write it by yourself. ? Dean ________________________________ ???? Jovi Zhang ???? erlang-questions@REDACTED ????? 2012?4?16?, ???, ?? 5:33 ??: [erlang-questions] operate C data structure using Erlang Hi, Currently I'm working a Erlang project which need send msg?represent by C language data structure. I know that Erlang have record represent by tuple, Is there have any open source project aim on?resolve?this problem?? generate record format for C data structure?automatically??note that there have many C data structure need to transform. There have JSON and protobuf, but none is toward plain C data structure, I cannot change the message?protocol now because Erlang node need to communicate with C node.?? .jovi _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists.nico.k@REDACTED Mon Apr 16 16:03:49 2012 From: lists.nico.k@REDACTED (Nico Kruber) Date: Mon, 16 Apr 2012 16:03:49 +0200 Subject: [erlang-questions] performance drop in R15A? In-Reply-To: References: <1359554.YeRYZETzs8@csr-pc40.zib.de> Message-ID: <2039707.WCVItAxVID@csr-pc40.zib.de> Thank you for the tips, indeed, by using the +sbt option I was able to improve our benchmark results to a certain extend - not to the full R14B04 value though :( I achieved the best results together with the +swt low and very_low option, so I would probably go with "low". I also experienced with +rg and +scl but these didn't influence the results too much. I also attached the cpuinfo from the test system (basically an 8-core Opteron 2376 with 8GB RAM). using Scalaris "make bench": wall clock throughput // latency R14B04: 999 // 40 "+swt low" 1097 // 36 "+swt very_low" 1101 // 36 R15B: (same as "+sbt u") 679 // 59 "+scl true" 682 // 59 "+sbt db" 836 // 48 "+sbt ns" 828 // 48 "+sbt ts" 840 // 48 "+sbt ps" 816 // 49 "+sbt s" 822 // 49 "+sbt nnts" 825 // 48 "+sbt nnps" 834 // 48 "+sbt tnnps" 830 // 48 "+scl true +sbt db" 827 // 48 "+scl true +sbt db +swt low" 1029 // 39 "+sbt db +swt low" 1019 // 39 "+sbt db +swt very_low" 1038 // 39 "+swt low" 764 // 52 "+sbt db +swt low +rg 4" 1008 // 40 "+sbt db +swt low +rg 8" 1042 // 38 "+sbt db +swt low +rg 16" 1011 // 40 Recall that this creates 4 erlang VMs with the same (given) start-up options. On Thursday 12 April 2012 16:44:48 Tomas Abrahamsson wrote: > > Hi Nico, > > According to erts documetation, since OTP R15B, the virtual machine > > doesn't bind the schedulers to logical processors. > > I don't know if it's the reason of your performance drop but it might > > worst looking around the +sbt option. > > There's also the +scl true|false flag, to "[e]nable or > disable scheduler compaction of load", that's new in > R15, iirc, but the +sbt option may have more impact. > > With the particular workload we previously had, when we > continued to measure more, it turned out that R15B was > actually faster than R14B04 on machines with more CPUs: > > We had one machine with 2 Xeon X5660 CPUs (24 > hyperthreads in total) where R15B was faster. We had > another machine with 2 Xeon E5540 CPUs (16 HTs in > total) where I think R15B and R14B04 were roughly on > par with each other. > > We also did experiment a bit with the +rg ReaderGroupsLimit > option. I think we did set it to be the same as the > number of schedulers (online). > > BRs > Tomas > > >> is there any news on this? > >> Our internal test server has a new additional configuration which > >> compiles > >> the > >> latest otp from github once per day and tests its performance with the > >> mentioned benchmarks. > >> The resulting graphs for R14B04, R15B and latest git checkout are > >> attached. As > >> you can see - nothing has changed since then so I suppose it is still > >> present > >> in R15B01 :( > >> > >> I don't know how to debug this any further. If there is anything I could > >> do to > >> help you identify the issue, please tell me. > >> > >> > >> Regards > >> Nico Kruber > >> > >> On Wednesday 14 December 2011 17:41:33 Nico Kruber wrote: > >>> ok, I did some profiling and made some optimisations but the differences > >>> between R15B (git checkout from master just now) and R14B04 are still > >>> the > >>> same: > >>> > >>> First the results of the calls to bench:quorum_read(10, 50000) (best of > >>> three) ------------------------------------------------------------ > >>> > >>> | R14B04 | R15B | time surplus > >>> > >>> ------------------------------------------------------------ > >>> timer:tc, smp8:8 | 22484619| 26641737| +18% > >>> timer:tc, smp4:4 | 34009785| 35963489| + 6% > >>> timer:tc, smp2:2 | 32863428| 34102038| + 4% > >>> timer:tc, smpoff | 53805419| 54214795| + 1% > >>> ------------------------------------------------------------ > >>> > >>> It seems there is some lock-contention or some other problem with smp in > >>> our > >>> case which hasn't been there before. > >>> I also observed that the results using R15B vary quite much, especially > >>> with > >>> smp8:8 (see below for an example). R14B04 is more stable among different > >>> test runs. > >>> But still, even without smp, R15B is slower than R14B04 :( > >>> > >>> Lukas suggested to run fprof to a bit deeper and maybe find the function > >>> taking longer in R15 than in R14B04. > >>> Although it was helpful in finding some hot spots, it did however not > >>> help > >>> with this problem. Following are the totals reported by fprof > >>> (if you like, I can send the complete logs - didn't want to send too > >>> much to > >>> the mailing list though). > >>> > >>> ------------------------------------------------------------ > >>> > >>> | R14B04 | R15B | time surplus > >>> > >>> ------------------------------------------------------------ > >>> fprof, CNT, smp8:8 | 7723796| 7722635| n/a > >>> fprof, ACC, smp8:8 | 98239| 85477| -13% > >>> fprof, OWN, smp8:8 | 300534| 264018| -12% > >>> ------------------------------------------------------------ > >>> > >>> As you can see, according to fprof, R15B should be faster (but it > >>> isn't!). > >>> I assume that some function calls are not reported by fprof > >>> (e.g. I did not see erlang:length/1). > >>> Is there some way to include them again in order to analyse further? > >>> Maybe suspend or garbage_collect are not in ACC or OWN? > >>> But even here, R15B wastes less time as you can see in the table below. > >>> ---------------------------------------------------------- > >>> > >>> | R14B04 | R15B | > >>> > >>> ---------------------------------------------------------- > >>> fprof, suspend, smp8:8 | 9.8421e+06| 8.51855e+06| > >>> fprof, garbage_collect, smp8:8 | 1315| 794| > >>> ---------------------------------------------------------- > >>> > >>> We do rely quite much on the process dictionary (erlang:put and > >>> erlang:get) > >>> which you might see as an "non-typical usage pattern" for erlang. > >>> However, if I switch to ets instead, performance of > >>> bench:quorum_read(10, > >>> 50000) for R15B does not change and for R14B04 decreases by about 7%. > >>> > >>> Everything else I would consider "typical use" - or at least I'm not > >>> aware > >>> of anything untypical. > >>> > >>> I hope, someone can help to further analyse the problem. I did > >>> everything I > >>> could think of and are stuck now. > >>> Is other real-world software also affected? E.g. testing couchdb would > >>> be > >>> nice. > >>> > >>> > >>> Regards > >>> Nico Kruber > >>> > >>> > >>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > >>> how to re-produce the values > >>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > >>> > >>> I'm using scalaris from http://code.google.com/p/scalaris/ > >>> ./configure && make > >>> ================ R15B =============== > >>> -------------------------------- > >>> ./bin/firstnode.sh > >>> Erlang R15B (erts-5.9) [source] [64-bit] [smp:8:8] [async-threads:0] > >>> [hipe] > >>> [kernel-poll:false] > >>> > >>> timer:tc(bench, quorum_read, [10, 50000]). > >>> {33764932,ok} % 1st try > >>> {26641737,ok} % 2nd try > >>> {27575975,ok} % 3rd try > >>> -------------------------------- > >>> ./bin/firstnode.sh "+S4:4" > >>> Erlang R15B (erts-5.9) [source] [64-bit] [smp:4:4] [async-threads:0] > >>> [hipe] > >>> [kernel-poll:false] > >>> > >>> timer:tc(bench, quorum_read, [10, 50000]). > >>> {35963489,ok} % 1st try > >>> {36332156,ok} % 2nd try > >>> {37295819,ok} % 3rd try > >>> -------------------------------- > >>> ./bin/firstnode.sh "+S2:2" > >>> Erlang R15B (erts-5.9) [source] [64-bit] [smp:2:2] [async-threads:0] > >>> [hipe] > >>> [kernel-poll:false] > >>> > >>> timer:tc(bench, quorum_read, [10, 50000]). > >>> {34102038,ok} % 1st try > >>> {34379052,ok} % 2nd try > >>> {34416173,ok} % 3rd try > >>> -------------------------------- > >>> ./bin/firstnode.sh "-smp disable" > >>> Erlang R15B (erts-5.9) [source] [64-bit] [async-threads:0] [hipe] > >>> [kernel-poll:false] > >>> > >>> timer:tc(bench, quorum_read, [10, 50000]). > >>> {54214795,ok} % 1st try > >>> {55210947,ok} % 2nd try > >>> {54537194,ok} % 3rd try > >>> > >>> ================ R14B04 =============== > >>> -------------------------------- > >>> ./bin/firstnode.sh > >>> Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:8:8] [rq:8] > >>> [async-threads:0] [hipe] [kernel-poll:false] > >>> > >>> timer:tc(bench, quorum_read, [10, 50000]). > >>> {22598819,ok} % 1st try > >>> {22706185,ok} % 2nd try > >>> {22484619,ok} % 3rd try > >>> -------------------------------- > >>> ./bin/firstnode.sh "+S4:4" > >>> Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:4:4] [rq:4] > >>> [async-threads:0] [hipe] [kernel-poll:false] > >>> > >>> timer:tc(bench, quorum_read, [10, 50000]). > >>> {35482368,ok} % 1st try > >>> {34009785,ok} % 2nd try > >>> {34527203,ok} % 3rd try > >>> -------------------------------- > >>> ./bin/firstnode.sh "+S2:2" > >>> Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:2:2] [rq:2] > >>> [async-threads:0] [hipe] [kernel-poll:false] > >>> > >>> timer:tc(bench, quorum_read, [10, 50000]). > >>> {33590356,ok} % 1st try > >>> {33192033,ok} % 2nd try > >>> {32863428,ok} % 3rd try > >>> -------------------------------- > >>> ./bin/firstnode.sh "-smp disable" > >>> Erlang R14B04 (erts-5.8.5) [source] [64-bit] [rq:1] [async-threads:0] > >>> [hipe] > >>> [kernel-poll:false] > >>> > >>> timer:tc(bench, quorum_read, [10, 50000]). > >>> {53805419,ok} % 1st try > >>> {54054538,ok} % 2nd try > >>> {54066521,ok} % 3rd try > >>> > >>> > >>> fprof runs: > >>> ./bin/firstnode.sh > >>> > >>> fprof:trace([start, {procs, processes()}]). > >>> bench:quorum_read(10, 1000). > >>> fprof:trace(stop). > >>> fprof:profile(). > >>> fprof:analyse([{dest, "test.R15B.fprof.log"}]). % or R14B04 respectively > >>> > >>> > cat test.R14B04.fprof.log |grep suspend|cut -d',' -f3 | awk '{s+=$1} > >>> > >>> END > >>> > >>> > {print s}' > >>> > >>> 9.8421e+06 > >>> > >>> > cat test.R15B.fprof.log |grep suspend|cut -d',' -f3 | awk '{s+=$1} END > >>> > {print s}' > >>> > >>> 8.51855e+06 > >>> > >>> > cat test.R14B04.fprof.log |grep garbage_collect|cut -d',' -f3 | awk > >>> > '{s+=$1} END {print s}' > >>> > >>> 1315.33 > >>> > >>> > cat test.R15B.fprof.log |grep garbage_collect|cut -d',' -f3 | awk > >>> > >>> '{s+=$1} > >>> > >>> > END {print s}' > >>> > >>> 794.956 > >>> > >>> On Friday 09 December 2011 12:09:56 Kenneth Lundin wrote: > >>> > On 12/5/11, Nico Kruber wrote: > >>> > > Is there any news on this? > >>> > > > >>> > > The performance drop of the recent R15 checkout compared to R14B04 > >>> > >>> in > >>> > >>> > > our > >>> > > application is now at _30%_ compared to a drop of "only" 15% in > >>> > >>> R15A! > >>> > >>> > When working with R15B we are of course performing a number of > >>> > bencmarks to keep track of the performance. > >>> > > >>> > Whe always strive to improve general performance in each release AND > >>> > OUR BENCHMARKS INDICATE THAT R15B IS FASTER IN GENERAL THAN R14B04. > >>> > > >>> > It is however always possible that some specific operations or > >>> > combinations of operations get slower while others are optimized. > >>> > > >>> > Regarding the findings for this particular application we think the > >>> > reason for slowdown is a very frequent but non typical usage pattern > >>> > that now becomes visible as a performance bottleneck. > >>> > > >>> > > >>> > / Kenneth, Erlang/OTP > >>> > >>> Ericsson_______________________________________________ -------------- next part -------------- processor : 0 vendor_id : AuthenticAMD cpu family : 16 model : 4 model name : Quad-Core AMD Opteron(tm) Processor 2376 stepping : 2 cpu MHz : 800.000 cache size : 512 KB physical id : 0 siblings : 4 core id : 0 cpu cores : 4 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 5 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_good nonstop_tsc extd_apicid pni monitor cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt bogomips : 4599.91 TLB size : 1024 4K pages clflush size : 64 cache_alignment : 64 address sizes : 48 bits physical, 48 bits virtual power management: ts ttp tm stc 100mhzsteps hwpstate processor : 1 vendor_id : AuthenticAMD cpu family : 16 model : 4 model name : Quad-Core AMD Opteron(tm) Processor 2376 stepping : 2 cpu MHz : 800.000 cache size : 512 KB physical id : 0 siblings : 4 core id : 1 cpu cores : 4 apicid : 1 initial apicid : 1 fpu : yes fpu_exception : yes cpuid level : 5 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_good nonstop_tsc extd_apicid pni monitor cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt bogomips : 4599.99 TLB size : 1024 4K pages clflush size : 64 cache_alignment : 64 address sizes : 48 bits physical, 48 bits virtual power management: ts ttp tm stc 100mhzsteps hwpstate processor : 2 vendor_id : AuthenticAMD cpu family : 16 model : 4 model name : Quad-Core AMD Opteron(tm) Processor 2376 stepping : 2 cpu MHz : 800.000 cache size : 512 KB physical id : 0 siblings : 4 core id : 2 cpu cores : 4 apicid : 2 initial apicid : 2 fpu : yes fpu_exception : yes cpuid level : 5 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_good nonstop_tsc extd_apicid pni monitor cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt bogomips : 4600.00 TLB size : 1024 4K pages clflush size : 64 cache_alignment : 64 address sizes : 48 bits physical, 48 bits virtual power management: ts ttp tm stc 100mhzsteps hwpstate processor : 3 vendor_id : AuthenticAMD cpu family : 16 model : 4 model name : Quad-Core AMD Opteron(tm) Processor 2376 stepping : 2 cpu MHz : 800.000 cache size : 512 KB physical id : 0 siblings : 4 core id : 3 cpu cores : 4 apicid : 3 initial apicid : 3 fpu : yes fpu_exception : yes cpuid level : 5 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_good nonstop_tsc extd_apicid pni monitor cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt bogomips : 4599.98 TLB size : 1024 4K pages clflush size : 64 cache_alignment : 64 address sizes : 48 bits physical, 48 bits virtual power management: ts ttp tm stc 100mhzsteps hwpstate processor : 4 vendor_id : AuthenticAMD cpu family : 16 model : 4 model name : Quad-Core AMD Opteron(tm) Processor 2376 stepping : 2 cpu MHz : 800.000 cache size : 512 KB physical id : 1 siblings : 4 core id : 0 cpu cores : 4 apicid : 4 initial apicid : 4 fpu : yes fpu_exception : yes cpuid level : 5 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_good nonstop_tsc extd_apicid pni monitor cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt bogomips : 4600.00 TLB size : 1024 4K pages clflush size : 64 cache_alignment : 64 address sizes : 48 bits physical, 48 bits virtual power management: ts ttp tm stc 100mhzsteps hwpstate processor : 5 vendor_id : AuthenticAMD cpu family : 16 model : 4 model name : Quad-Core AMD Opteron(tm) Processor 2376 stepping : 2 cpu MHz : 800.000 cache size : 512 KB physical id : 1 siblings : 4 core id : 1 cpu cores : 4 apicid : 5 initial apicid : 5 fpu : yes fpu_exception : yes cpuid level : 5 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_good nonstop_tsc extd_apicid pni monitor cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt bogomips : 4600.01 TLB size : 1024 4K pages clflush size : 64 cache_alignment : 64 address sizes : 48 bits physical, 48 bits virtual power management: ts ttp tm stc 100mhzsteps hwpstate processor : 6 vendor_id : AuthenticAMD cpu family : 16 model : 4 model name : Quad-Core AMD Opteron(tm) Processor 2376 stepping : 2 cpu MHz : 800.000 cache size : 512 KB physical id : 1 siblings : 4 core id : 2 cpu cores : 4 apicid : 6 initial apicid : 6 fpu : yes fpu_exception : yes cpuid level : 5 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_good nonstop_tsc extd_apicid pni monitor cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt bogomips : 4600.01 TLB size : 1024 4K pages clflush size : 64 cache_alignment : 64 address sizes : 48 bits physical, 48 bits virtual power management: ts ttp tm stc 100mhzsteps hwpstate processor : 7 vendor_id : AuthenticAMD cpu family : 16 model : 4 model name : Quad-Core AMD Opteron(tm) Processor 2376 stepping : 2 cpu MHz : 800.000 cache size : 512 KB physical id : 1 siblings : 4 core id : 3 cpu cores : 4 apicid : 7 initial apicid : 7 fpu : yes fpu_exception : yes cpuid level : 5 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_good nonstop_tsc extd_apicid pni monitor cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt bogomips : 4600.00 TLB size : 1024 4K pages clflush size : 64 cache_alignment : 64 address sizes : 48 bits physical, 48 bits virtual power management: ts ttp tm stc 100mhzsteps hwpstate From zabrane3@REDACTED Mon Apr 16 16:08:51 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Mon, 16 Apr 2012 16:08:51 +0200 Subject: [erlang-questions] performance drop in R15A? In-Reply-To: <2039707.WCVItAxVID@csr-pc40.zib.de> References: <1359554.YeRYZETzs8@csr-pc40.zib.de> <2039707.WCVItAxVID@csr-pc40.zib.de> Message-ID: Thanks Nico for sharing such useful info. Regards, Zabrane On Apr 16, 2012, at 4:03 PM, Nico Kruber wrote: > Thank you for the tips, indeed, by using the +sbt option I was able to improve > our benchmark results to a certain extend - not to the full R14B04 value > though :( > I achieved the best results together with the +swt low and very_low option, so > I would probably go with "low". I also experienced with +rg and +scl but these > didn't influence the results too much. > > I also attached the cpuinfo from the test system (basically an 8-core Opteron > 2376 with 8GB RAM). > > using Scalaris "make bench": > wall clock throughput // latency > R14B04: 999 // 40 > "+swt low" 1097 // 36 > "+swt very_low" 1101 // 36 > R15B: (same as "+sbt u") 679 // 59 > "+scl true" 682 // 59 > "+sbt db" 836 // 48 > "+sbt ns" 828 // 48 > "+sbt ts" 840 // 48 > "+sbt ps" 816 // 49 > "+sbt s" 822 // 49 > "+sbt nnts" 825 // 48 > "+sbt nnps" 834 // 48 > "+sbt tnnps" 830 // 48 > "+scl true +sbt db" 827 // 48 > "+scl true +sbt db +swt low" 1029 // 39 > "+sbt db +swt low" 1019 // 39 > "+sbt db +swt very_low" 1038 // 39 > "+swt low" 764 // 52 > "+sbt db +swt low +rg 4" 1008 // 40 > "+sbt db +swt low +rg 8" 1042 // 38 > "+sbt db +swt low +rg 16" 1011 // 40 > > Recall that this creates 4 erlang VMs with the same (given) start-up options. > > > On Thursday 12 April 2012 16:44:48 Tomas Abrahamsson wrote: >>> Hi Nico, >>> According to erts documetation, since OTP R15B, the virtual machine >>> doesn't bind the schedulers to logical processors. >>> I don't know if it's the reason of your performance drop but it might >>> worst looking around the +sbt option. >> >> There's also the +scl true|false flag, to "[e]nable or >> disable scheduler compaction of load", that's new in >> R15, iirc, but the +sbt option may have more impact. >> >> With the particular workload we previously had, when we >> continued to measure more, it turned out that R15B was >> actually faster than R14B04 on machines with more CPUs: >> >> We had one machine with 2 Xeon X5660 CPUs (24 >> hyperthreads in total) where R15B was faster. We had >> another machine with 2 Xeon E5540 CPUs (16 HTs in >> total) where I think R15B and R14B04 were roughly on >> par with each other. >> >> We also did experiment a bit with the +rg ReaderGroupsLimit >> option. I think we did set it to be the same as the >> number of schedulers (online). >> >> BRs >> Tomas >> >>>> is there any news on this? >>>> Our internal test server has a new additional configuration which >>>> compiles >>>> the >>>> latest otp from github once per day and tests its performance with the >>>> mentioned benchmarks. >>>> The resulting graphs for R14B04, R15B and latest git checkout are >>>> attached. As >>>> you can see - nothing has changed since then so I suppose it is still >>>> present >>>> in R15B01 :( >>>> >>>> I don't know how to debug this any further. If there is anything I could >>>> do to >>>> help you identify the issue, please tell me. >>>> >>>> >>>> Regards >>>> Nico Kruber >>>> >>>> On Wednesday 14 December 2011 17:41:33 Nico Kruber wrote: >>>>> ok, I did some profiling and made some optimisations but the differences >>>>> between R15B (git checkout from master just now) and R14B04 are still >>>>> the >>>>> same: >>>>> >>>>> First the results of the calls to bench:quorum_read(10, 50000) (best of >>>>> three) ------------------------------------------------------------ >>>>> >>>>> | R14B04 | R15B | time surplus >>>>> >>>>> ------------------------------------------------------------ >>>>> timer:tc, smp8:8 | 22484619| 26641737| +18% >>>>> timer:tc, smp4:4 | 34009785| 35963489| + 6% >>>>> timer:tc, smp2:2 | 32863428| 34102038| + 4% >>>>> timer:tc, smpoff | 53805419| 54214795| + 1% >>>>> ------------------------------------------------------------ >>>>> >>>>> It seems there is some lock-contention or some other problem with smp in >>>>> our >>>>> case which hasn't been there before. >>>>> I also observed that the results using R15B vary quite much, especially >>>>> with >>>>> smp8:8 (see below for an example). R14B04 is more stable among different >>>>> test runs. >>>>> But still, even without smp, R15B is slower than R14B04 :( >>>>> >>>>> Lukas suggested to run fprof to a bit deeper and maybe find the function >>>>> taking longer in R15 than in R14B04. >>>>> Although it was helpful in finding some hot spots, it did however not >>>>> help >>>>> with this problem. Following are the totals reported by fprof >>>>> (if you like, I can send the complete logs - didn't want to send too >>>>> much to >>>>> the mailing list though). >>>>> >>>>> ------------------------------------------------------------ >>>>> >>>>> | R14B04 | R15B | time surplus >>>>> >>>>> ------------------------------------------------------------ >>>>> fprof, CNT, smp8:8 | 7723796| 7722635| n/a >>>>> fprof, ACC, smp8:8 | 98239| 85477| -13% >>>>> fprof, OWN, smp8:8 | 300534| 264018| -12% >>>>> ------------------------------------------------------------ >>>>> >>>>> As you can see, according to fprof, R15B should be faster (but it >>>>> isn't!). >>>>> I assume that some function calls are not reported by fprof >>>>> (e.g. I did not see erlang:length/1). >>>>> Is there some way to include them again in order to analyse further? >>>>> Maybe suspend or garbage_collect are not in ACC or OWN? >>>>> But even here, R15B wastes less time as you can see in the table below. >>>>> ---------------------------------------------------------- >>>>> >>>>> | R14B04 | R15B | >>>>> >>>>> ---------------------------------------------------------- >>>>> fprof, suspend, smp8:8 | 9.8421e+06| 8.51855e+06| >>>>> fprof, garbage_collect, smp8:8 | 1315| 794| >>>>> ---------------------------------------------------------- >>>>> >>>>> We do rely quite much on the process dictionary (erlang:put and >>>>> erlang:get) >>>>> which you might see as an "non-typical usage pattern" for erlang. >>>>> However, if I switch to ets instead, performance of >>>>> bench:quorum_read(10, >>>>> 50000) for R15B does not change and for R14B04 decreases by about 7%. >>>>> >>>>> Everything else I would consider "typical use" - or at least I'm not >>>>> aware >>>>> of anything untypical. >>>>> >>>>> I hope, someone can help to further analyse the problem. I did >>>>> everything I >>>>> could think of and are stuck now. >>>>> Is other real-world software also affected? E.g. testing couchdb would >>>>> be >>>>> nice. >>>>> >>>>> >>>>> Regards >>>>> Nico Kruber >>>>> >>>>> >>>>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >>>>> how to re-produce the values >>>>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% >>>>> >>>>> I'm using scalaris from http://code.google.com/p/scalaris/ >>>>> ./configure && make >>>>> ================ R15B =============== >>>>> -------------------------------- >>>>> ./bin/firstnode.sh >>>>> Erlang R15B (erts-5.9) [source] [64-bit] [smp:8:8] [async-threads:0] >>>>> [hipe] >>>>> [kernel-poll:false] >>>>> >>>>> timer:tc(bench, quorum_read, [10, 50000]). >>>>> {33764932,ok} % 1st try >>>>> {26641737,ok} % 2nd try >>>>> {27575975,ok} % 3rd try >>>>> -------------------------------- >>>>> ./bin/firstnode.sh "+S4:4" >>>>> Erlang R15B (erts-5.9) [source] [64-bit] [smp:4:4] [async-threads:0] >>>>> [hipe] >>>>> [kernel-poll:false] >>>>> >>>>> timer:tc(bench, quorum_read, [10, 50000]). >>>>> {35963489,ok} % 1st try >>>>> {36332156,ok} % 2nd try >>>>> {37295819,ok} % 3rd try >>>>> -------------------------------- >>>>> ./bin/firstnode.sh "+S2:2" >>>>> Erlang R15B (erts-5.9) [source] [64-bit] [smp:2:2] [async-threads:0] >>>>> [hipe] >>>>> [kernel-poll:false] >>>>> >>>>> timer:tc(bench, quorum_read, [10, 50000]). >>>>> {34102038,ok} % 1st try >>>>> {34379052,ok} % 2nd try >>>>> {34416173,ok} % 3rd try >>>>> -------------------------------- >>>>> ./bin/firstnode.sh "-smp disable" >>>>> Erlang R15B (erts-5.9) [source] [64-bit] [async-threads:0] [hipe] >>>>> [kernel-poll:false] >>>>> >>>>> timer:tc(bench, quorum_read, [10, 50000]). >>>>> {54214795,ok} % 1st try >>>>> {55210947,ok} % 2nd try >>>>> {54537194,ok} % 3rd try >>>>> >>>>> ================ R14B04 =============== >>>>> -------------------------------- >>>>> ./bin/firstnode.sh >>>>> Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:8:8] [rq:8] >>>>> [async-threads:0] [hipe] [kernel-poll:false] >>>>> >>>>> timer:tc(bench, quorum_read, [10, 50000]). >>>>> {22598819,ok} % 1st try >>>>> {22706185,ok} % 2nd try >>>>> {22484619,ok} % 3rd try >>>>> -------------------------------- >>>>> ./bin/firstnode.sh "+S4:4" >>>>> Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:4:4] [rq:4] >>>>> [async-threads:0] [hipe] [kernel-poll:false] >>>>> >>>>> timer:tc(bench, quorum_read, [10, 50000]). >>>>> {35482368,ok} % 1st try >>>>> {34009785,ok} % 2nd try >>>>> {34527203,ok} % 3rd try >>>>> -------------------------------- >>>>> ./bin/firstnode.sh "+S2:2" >>>>> Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:2:2] [rq:2] >>>>> [async-threads:0] [hipe] [kernel-poll:false] >>>>> >>>>> timer:tc(bench, quorum_read, [10, 50000]). >>>>> {33590356,ok} % 1st try >>>>> {33192033,ok} % 2nd try >>>>> {32863428,ok} % 3rd try >>>>> -------------------------------- >>>>> ./bin/firstnode.sh "-smp disable" >>>>> Erlang R14B04 (erts-5.8.5) [source] [64-bit] [rq:1] [async-threads:0] >>>>> [hipe] >>>>> [kernel-poll:false] >>>>> >>>>> timer:tc(bench, quorum_read, [10, 50000]). >>>>> {53805419,ok} % 1st try >>>>> {54054538,ok} % 2nd try >>>>> {54066521,ok} % 3rd try >>>>> >>>>> >>>>> fprof runs: >>>>> ./bin/firstnode.sh >>>>> >>>>> fprof:trace([start, {procs, processes()}]). >>>>> bench:quorum_read(10, 1000). >>>>> fprof:trace(stop). >>>>> fprof:profile(). >>>>> fprof:analyse([{dest, "test.R15B.fprof.log"}]). % or R14B04 respectively >>>>> >>>>>> cat test.R14B04.fprof.log |grep suspend|cut -d',' -f3 | awk '{s+=$1} >>>>> >>>>> END >>>>> >>>>>> {print s}' >>>>> >>>>> 9.8421e+06 >>>>> >>>>>> cat test.R15B.fprof.log |grep suspend|cut -d',' -f3 | awk '{s+=$1} END >>>>>> {print s}' >>>>> >>>>> 8.51855e+06 >>>>> >>>>>> cat test.R14B04.fprof.log |grep garbage_collect|cut -d',' -f3 | awk >>>>>> '{s+=$1} END {print s}' >>>>> >>>>> 1315.33 >>>>> >>>>>> cat test.R15B.fprof.log |grep garbage_collect|cut -d',' -f3 | awk >>>>> >>>>> '{s+=$1} >>>>> >>>>>> END {print s}' >>>>> >>>>> 794.956 >>>>> >>>>> On Friday 09 December 2011 12:09:56 Kenneth Lundin wrote: >>>>>> On 12/5/11, Nico Kruber wrote: >>>>>>> Is there any news on this? >>>>>>> >>>>>>> The performance drop of the recent R15 checkout compared to R14B04 >>>>> >>>>> in >>>>> >>>>>>> our >>>>>>> application is now at _30%_ compared to a drop of "only" 15% in >>>>> >>>>> R15A! >>>>> >>>>>> When working with R15B we are of course performing a number of >>>>>> bencmarks to keep track of the performance. >>>>>> >>>>>> Whe always strive to improve general performance in each release AND >>>>>> OUR BENCHMARKS INDICATE THAT R15B IS FASTER IN GENERAL THAN R14B04. >>>>>> >>>>>> It is however always possible that some specific operations or >>>>>> combinations of operations get slower while others are optimized. >>>>>> >>>>>> Regarding the findings for this particular application we think the >>>>>> reason for slowdown is a very frequent but non typical usage pattern >>>>>> that now becomes visible as a performance bottleneck. >>>>>> >>>>>> >>>>>> / Kenneth, Erlang/OTP >>>>> >>>>> Ericsson_______________________________________________ > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From watson.timothy@REDACTED Mon Apr 16 16:21:57 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Mon, 16 Apr 2012 15:21:57 +0100 Subject: [erlang-questions] Rebar eunit selective dependency exclusion in rebar.config? In-Reply-To: <06139A918ACCA041BF46A0F36940C7FA333CC319@exch-mbx1.msk.trd.ru> References: <06139A918ACCA041BF46A0F36940C7FA333CC319@exch-mbx1.msk.trd.ru> Message-ID: I don't think so, but you should really try posting to the rebar mailing list to be sure. You could also try https://github.com/hyperthunk/rebar_skip_deps if you like, though it may interfere with other commands unless used judiciously: YMMV. 2012/4/16 Zhemzhitsky Sergey : > Hi guys, > > > > I?m currently trying to integrate eunit into my build process which is > implemented with rebar. > > I have a number of dependencies which I don?t like to be under tests, so I?m > wondering how to exclude these deps in rebar.config? > > > > I?ve already found that it?s possible to run rebar using the following > commands: > > > > ./rebar eunit app=app_name > > ./rebar eunit skip_app=app_name > > ./rebar eunit skip_deps=true > > > > However I?d like to specify dependencies under test in rebar.config. Is it > possible with current version of rebar? > > > > Best Regards, > > Sergey > > > > _______________________________________________________ > > > > The information contained in this message may be privileged and conf > idential and protected from disclosure. If you are not the original intended > recipient, you are hereby notified that any review, retransmission, > dissemination, or other use of, or taking of any action in reliance upon, > this information is prohibited. If you have received this communication in > error, please notify the sender immediately by replying to this message and > delete it from your computer. Thank you for your cooperation. Troika Dialog, > Russia. > > If you need assistance please contact our Contact Center (+7495) 258 0500 or > go to www.troika.ru/eng/Contacts/system.wbp > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From Sergey_Zhemzhitsky@REDACTED Mon Apr 16 16:28:05 2012 From: Sergey_Zhemzhitsky@REDACTED (Zhemzhitsky Sergey) Date: Mon, 16 Apr 2012 14:28:05 +0000 Subject: [erlang-questions] Rebar eunit selective dependency exclusion in rebar.config? In-Reply-To: References: <06139A918ACCA041BF46A0F36940C7FA333CC319@exch-mbx1.msk.trd.ru> Message-ID: <06139A918ACCA041BF46A0F36940C7FA333CC4D9@exch-mbx1.msk.trd.ru> Hello Tim, Thanks for the tips. Best Regards, Sergey -----Original Message----- From: Tim Watson [mailto:watson.timothy@REDACTED] Sent: Monday, April 16, 2012 6:22 PM To: Zhemzhitsky Sergey Cc: erlang-questions@REDACTED; rebar@REDACTED Subject: Re: [erlang-questions] Rebar eunit selective dependency exclusion in rebar.config? I don't think so, but you should really try posting to the rebar mailing list to be sure. You could also try https://github.com/hyperthunk/rebar_skip_deps if you like, though it may interfere with other commands unless used judiciously: YMMV. 2012/4/16 Zhemzhitsky Sergey : > Hi guys, > > > > I?m currently trying to integrate eunit into my build process which is > implemented with rebar. > > I have a number of dependencies which I don?t like to be under tests, > so I?m wondering how to exclude these deps in rebar.config? > > > > I?ve already found that it?s possible to run rebar using the following > commands: > > > > ./rebar eunit app=app_name > > ./rebar eunit skip_app=app_name > > ./rebar eunit skip_deps=true > > > > However I?d like to specify dependencies under test in rebar.config. > Is it possible with current version of rebar? > > > > Best Regards, > > Sergey > > > > _______________________________________________________ > > > > The information contained in this message may be privileged and conf > idential and protected from disclosure. If you are not the original > intended recipient, you are hereby notified that any review, > retransmission, dissemination, or other use of, or taking of any > action in reliance upon, this information is prohibited. If you have > received this communication in error, please notify the sender > immediately by replying to this message and delete it from your > computer. Thank you for your cooperation. Troika Dialog, Russia. > > If you need assistance please contact our Contact Center (+7495) 258 > 0500 or go to www.troika.ru/eng/Contacts/system.wbp > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From francesco@REDACTED Mon Apr 16 19:13:30 2012 From: francesco@REDACTED (Francesco Cesarini) Date: Mon, 16 Apr 2012 18:13:30 +0100 Subject: [erlang-questions] trapexit.org In-Reply-To: <50491b83-0169-49f5-b315-3b9a6f806c5e@knuth> References: <50491b83-0169-49f5-b315-3b9a6f806c5e@knuth> Message-ID: <4F8C533A.50400@erlang-solutions.com> Trapexit should be back up. We hope to launch a new site in the upcoming months, migrating all of the contents to it. Unfortunately, the machines keep on running out of disk space, and migrating it to more powerful hardware does not make sense as we are planing on shutting it down. Please bear with us while we juggle both projects. I am sure you'll like what we are building. Thanks, Francesco On 16/04/2012 11:01, Juan Puig wrote: > It has been torn down to migrate all its data into a future project. Stay tuned. > > Juan Puig > Erlang Solutions Ltd - London > www.erlang-solutions.com > > ----- Original Message ----- >> Hello, all, >> does somebody know what happened with trapexit.com ? >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- Erlang Solutions Ltd. http://www.erlang-solutions.com From mfidelman@REDACTED Mon Apr 16 19:27:29 2012 From: mfidelman@REDACTED (Miles Fidelman) Date: Mon, 16 Apr 2012 13:27:29 -0400 Subject: [erlang-questions] trapexit.org In-Reply-To: <4F8C533A.50400@erlang-solutions.com> References: <50491b83-0169-49f5-b315-3b9a6f806c5e@knuth> <4F8C533A.50400@erlang-solutions.com> Message-ID: <4F8C5681.7050904@meetinghouse.net> Francesco Cesarini wrote: > Trapexit should be back up. We hope to launch a new site in the > upcoming months, migrating all of the contents to it. Unfortunately, > the machines keep on running out of disk space, and migrating it to > more powerful hardware does not make sense as we are planing on > shutting it down. Please bear with us while we juggle both projects. I > am sure you'll like what we are building. Still... as a key site for a run-time environment that's all about non-stop operation, hot updates, .... probably doesn't send a good message when a key (and much valued/appreciated) support site is down for an extended time. :-( Keep up the good work. Miles Fidelman -- In theory, there is no difference between theory and practice. In practice, there is. .... Yogi Berra From roberto@REDACTED Mon Apr 16 19:29:12 2012 From: roberto@REDACTED (Roberto Ostinelli) Date: Mon, 16 Apr 2012 10:29:12 -0700 Subject: [erlang-questions] [ANN] SublimErl: Run Erlang tests inside Sublime Text 2 Message-ID: Dear all, I'm happy to announce that SublimErl has been released today. SublimErl is a plugin for the editor Sublime Text 2, and allows you to run Erlang Tests from within the editor itself: - Run *Eunit* tests (all tests from file / single test) - Run *Common Tests* ( single file ) - Run *Dialyzer* tests ( single file ) Here's a short video which shows SublimErl in action: http://www.youtube.com/watch?v=T0rD0CQM4Yg SublimErl is released under the BSD license, and is available on github: http://github.com/ostinelli/sublimerl I know Erlang is a world of Vim/Emacs-ers, my hope is that other tools like this one might help to spur some additional TDD and Agile methodologies in the Erlang world. Comments, feedback and questions welcome. r. -------------- next part -------------- An HTML attachment was scrubbed... URL: From francesco@REDACTED Mon Apr 16 19:45:13 2012 From: francesco@REDACTED (Francesco Cesarini) Date: Mon, 16 Apr 2012 18:45:13 +0100 Subject: [erlang-questions] trapexit.org In-Reply-To: <4F8C5681.7050904@meetinghouse.net> References: <50491b83-0169-49f5-b315-3b9a6f806c5e@knuth> <4F8C533A.50400@erlang-solutions.com> <4F8C5681.7050904@meetinghouse.net> Message-ID: <4F8C5AA9.2020505@erlang-solutions.com> Goes to remind you that there is so much more to software that never fails than the software itself.... /F On 16/04/2012 18:27, Miles Fidelman wrote: > Francesco Cesarini wrote: >> Trapexit should be back up. We hope to launch a new site in the >> upcoming months, migrating all of the contents to it. Unfortunately, >> the machines keep on running out of disk space, and migrating it to >> more powerful hardware does not make sense as we are planing on >> shutting it down. Please bear with us while we juggle both projects. >> I am sure you'll like what we are building. > > Still... as a key site for a run-time environment that's all about > non-stop operation, hot updates, .... probably doesn't send a good > message when a key (and much valued/appreciated) support site is down > for an extended time. :-( > > Keep up the good work. > > Miles Fidelman > -- Erlang Solutions Ltd. http://www.erlang-solutions.com From chandrashekhar.mullaparthi@REDACTED Mon Apr 16 19:51:07 2012 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Mon, 16 Apr 2012 18:51:07 +0100 Subject: [erlang-questions] How to handle a massive amount of UDP packets? In-Reply-To: <4F8BE6FB.3020205@berlin.ccc.de> References: <4F8B0E95.4060003@berlin.ccc.de> <4F8BE6FB.3020205@berlin.ccc.de> Message-ID: Hi John, In the steady state, we have about 2000/sec, but in error situations, we've had peaks of up to 20000 packets / sec. cheers Chandru On 16 April 2012 10:31, John-Paul Bader wrote: > Hey Chandru, > > how many packets per second did you have to deal with and how big are > they? Just to have something to compare to. > > ~ John > > Chandru wrote: > >> Hi John, >> >> Our RADIUS server which handles our data network is written in Erlang. >> We've experimented with various values of recbuf and read_packets >> options for the UDP socket. We also use {active, once}. The receiving >> process receives a packet and spawns a new process to handle it. That is >> all it does. The spawned process then executes the rest of the business >> logic. >> >> That won't be your problem. The problem will be to make sure your system >> is stable while handling all those packets. We use overload control at >> the receiver. You have to pretty much look at the entire execution path >> for each packet and ensure there are no bottlenecks. At that kind of >> load, every little bottleneck shows up sooner or later. >> >> cheers >> Chandru >> >> On 15 April 2012 19:08, John-Paul Bader > > wrote: >> >> Dear list, >> >> >> I'm currently writing a bittorrent tracker in Erlang. While a naive >> implementation of the protocol is quite easy, there are some >> performance related challanges where I could use some help. >> >> In the first test run as a replacement for a very popular tracker, >> my erlang tracker got about 40k requests per second. >> >> My initial approach was to initialize the socket in one process with >> {active, once}, handle the message in handle_info with minimal >> effort and pass the data asynchronously to a freshly spawned worker >> processes which responds to the clients. After spawning the process >> I'm setting the socket back to {active, once}. >> >> Now when I switched the erlang tracker live the erlang vm was >> topping at 100% CPU load. My guess is that the process handling the >> udp packets from the socket could not keep up. Since I'm still quite >> new to the world of erlang I'd like to know if there are some best >> practices / patterns to handle this massive amount of packets. >> >> For example using the socket in {active, once} might be too slow? >> Also the response to the clients needs to come from the same port as >> the request was coming in. Is it a problem to use the same socket >> for that? Should I pre-spawn a couple of thousand workers and >> dispatch the data from the socket to them rather than spawning them >> on each packet? >> >> It would be really great if you could give some advice or point me >> into the right directions. >> >> ~ John >> ______________________________**___________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> > >> http://erlang.org/mailman/__**listinfo/erlang-questions >> >> > >> >> >> ______________________________**_________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/**listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tuncer.ayaz@REDACTED Mon Apr 16 20:40:55 2012 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Mon, 16 Apr 2012 20:40:55 +0200 Subject: [erlang-questions] Rebar eunit selective dependency exclusion in rebar.config? In-Reply-To: <06139A918ACCA041BF46A0F36940C7FA333CC319@exch-mbx1.msk.trd.ru> References: <06139A918ACCA041BF46A0F36940C7FA333CC319@exch-mbx1.msk.trd.ru> Message-ID: 2012/4/16 Zhemzhitsky Sergey: > Hi guys, > > I'm currently trying to integrate eunit into my build process which > is implemented with rebar. > > I have a number of dependencies which I don't like to be under > tests, so I'm wondering how to exclude these deps in rebar.config? > > I've already found that it's possible to run rebar using the following > commands: > > ./rebar eunit app=app_name > > ./rebar eunit skip_app=app_name > > ./rebar eunit skip_deps=true > > However I'd like to specify dependencies under test in rebar.config. > Is it possible with current version of rebar? You can create rebar.test.config and use that when testing: $ rebar -C rebar.test.config eunit skip_deps=true Also, some of the upcoming rebar changes should support this use case more easily. From ingo.jaeckel@REDACTED Mon Apr 16 20:52:23 2012 From: ingo.jaeckel@REDACTED (Ingo Jaeckel) Date: Mon, 16 Apr 2012 14:52:23 -0400 Subject: [erlang-questions] trapexit.org In-Reply-To: <4F8C5681.7050904@meetinghouse.net> References: <50491b83-0169-49f5-b315-3b9a6f806c5e@knuth> <4F8C533A.50400@erlang-solutions.com> <4F8C5681.7050904@meetinghouse.net> Message-ID: I agree. Remember when tidier was down for weeks back in February? At the end of the day things like this slow down the adoption of Erlang. Ingo On Mon, Apr 16, 2012 at 1:27 PM, Miles Fidelman wrote: > Francesco Cesarini wrote: >> >> Trapexit should be back up. We hope to launch a new site in the upcoming >> months, migrating all of the contents to it. Unfortunately, the machines >> keep on running out of disk space, and migrating it to more powerful >> hardware does not make sense as we are planing on shutting it down. Please >> bear with us while we juggle both projects. I am sure you'll like what we >> are building. > > > Still... as a key site for a run-time environment that's all about non-stop > operation, hot updates, .... probably doesn't send a good message when a key > (and much valued/appreciated) support site is down for an extended time. :-( > > Keep up the good work. > > Miles Fidelman > > -- > In theory, there is no difference between theory and practice. > In practice, there is. ? .... Yogi Berra > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From alanrevans@REDACTED Mon Apr 16 20:58:55 2012 From: alanrevans@REDACTED (Alan Evans) Date: Mon, 16 Apr 2012 19:58:55 +0100 Subject: [erlang-questions] Is there an accepted way of including GPL code in a project? In-Reply-To: <4F8B25DC.5080905@gmail.com> References: <4F8B25DC.5080905@gmail.com> Message-ID: Hi Richard, Thanks for the summary, I think it sums up my feelings on this as well. I already sent the author an email before posting this question. Ideally I'd like to use his code with his permission either as you say under a different license agreement or an acknowledgement that what I'm proposing is acceptable to him. I think I'll send him another email before I decide on the path I'm going to take. cheers AlanE. On Sun, Apr 15, 2012 at 8:47 PM, Richard Carlsson wrote: > On 2012-04-13 11:57, Alan Evans wrote: >> >> Hello list, >> >> I'm thinking about using some GPL code in a project I'm working on. >> Namely the SIGTRAN stack from the osmocom project >> (http://cgit.osmocom.org/cgit/erlang) >> Is there a recognized way to incorporate GPL code in an erlang project >> without making the whole project subject to the GPL license? >> >> I haven't yet decided whether or not to make my project open source. >> >> My thinking is that if I isolate all the GPL code to a particular >> Erlang node then only the modules running on that node need to be GPL >> or GPL compatible, I am free to license the modules running on the >> other nodes any way I wish. >> >> Any thoughts? Other than the obvious "ask a lawyer" response :-) > > > Erlang modules are dynamically linked to each other at run-time. The FSF > considers this to be no different from static linkage, and Erlang is just > like Java in this respect: > > ?http://www.gnu.org/licenses/lgpl-java.html > > My interpretation (not a lawyer etc. etc.) is that the LGPL is > straightforward to use with Erlang, but plain GPL requires that all other > libraries that your application calls, directly or indirectly, must be GPL > compatible. (V3 of the GPL makes an exception for "system libraries", so the > Erlang/OTP standard libraries don't pose a problem.) > > Isolating the GPL code to a separate node is similar to other workarounds > I've seen that run GPL code in a separate OS process from the main > application. It lies within that gray area where it will probably hold in > court but will make you feel dirty. A nicer way would of course be if you > could get hold of the original authors of that library and ask them for a > different license, possibly for a fee. > > ? /Richard From ulf@REDACTED Mon Apr 16 21:14:23 2012 From: ulf@REDACTED (Ulf Wiger) Date: Mon, 16 Apr 2012 21:14:23 +0200 Subject: [erlang-questions] Is there an accepted way of including GPL code in a project? In-Reply-To: References: <4F8B25DC.5080905@gmail.com> Message-ID: Here is an article from LinuxJournal on what constitutes a Derivative Work. http://www.linuxjournal.com/article/6366 [ 2) The meaning of derivative work will not be broadened to include software created by linking to library programs that were designed and intended to be used as library programs. When a company releases a scientific subroutine library, or a library of objects, for example, people who merely use the library, unmodified, perhaps without even looking at the source code, are not thereby creating derivative works of the library. ] [ 4) In most cases we shouldn't care how the linkage between separate programs was technically done, unless that fact helps determine whether the creators of the programs designed them with some apparent common understanding of what a derivative work would look like. We should consider subtle market-based factors as indicators of intent, such as whether the resulting program is being sold as an ?enhanced? version of the original, or whether the original was designed and advertised to be improvable ?like a library?. ] About the author: Lawrence Rosen is an attorney in private practice, with offices in Los Altos and Ukiah, California (www.rosenlaw.com). He is also corporate secretary and general counsel for the Open Source Initiative, which manages and promotes the Open Source Definition (www.opensource.org). Of course, to cover himself, he adds this: "Legal advice must be provided in the course of an attorney-client relationship specifically with reference to all the facts of a particular situation and the law of your jurisdiction. Even though an attorney wrote this article, the information in this article must not be relied upon as a substitute for obtaining specific legal advice from a licensed attorney." :) Given his reasoning, a component (like the ones discussed here) that was designed to be a sub-component in a larger system, would not contaminate the larger system, regardless of the linking technology used. If, on the other hand, the GPLd software is an application in its own right, any code using and extending it is clearly a derivative work. BR, Ulf W On 16 Apr 2012, at 20:58, Alan Evans wrote: > Hi Richard, > > Thanks for the summary, I think it sums up my feelings on this as well. > > I already sent the author an email before posting this question. > Ideally I'd like to use his code with his permission either as you say > under a different license agreement or an acknowledgement that what > I'm proposing is acceptable to him. > > I think I'll send him another email before I decide on the path I'm > going to take. > > cheers > AlanE. > > On Sun, Apr 15, 2012 at 8:47 PM, Richard Carlsson > wrote: >> On 2012-04-13 11:57, Alan Evans wrote: >>> >>> Hello list, >>> >>> I'm thinking about using some GPL code in a project I'm working on. >>> Namely the SIGTRAN stack from the osmocom project >>> (http://cgit.osmocom.org/cgit/erlang) >>> Is there a recognized way to incorporate GPL code in an erlang project >>> without making the whole project subject to the GPL license? >>> >>> I haven't yet decided whether or not to make my project open source. >>> >>> My thinking is that if I isolate all the GPL code to a particular >>> Erlang node then only the modules running on that node need to be GPL >>> or GPL compatible, I am free to license the modules running on the >>> other nodes any way I wish. >>> >>> Any thoughts? Other than the obvious "ask a lawyer" response :-) >> >> >> Erlang modules are dynamically linked to each other at run-time. The FSF >> considers this to be no different from static linkage, and Erlang is just >> like Java in this respect: >> >> http://www.gnu.org/licenses/lgpl-java.html >> >> My interpretation (not a lawyer etc. etc.) is that the LGPL is >> straightforward to use with Erlang, but plain GPL requires that all other >> libraries that your application calls, directly or indirectly, must be GPL >> compatible. (V3 of the GPL makes an exception for "system libraries", so the >> Erlang/OTP standard libraries don't pose a problem.) >> >> Isolating the GPL code to a separate node is similar to other workarounds >> I've seen that run GPL code in a separate OS process from the main >> application. It lies within that gray area where it will probably hold in >> court but will make you feel dirty. A nicer way would of course be if you >> could get hold of the original authors of that library and ask them for a >> different license, possibly for a fee. >> >> /Richard > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com From matthias@REDACTED Mon Apr 16 21:16:58 2012 From: matthias@REDACTED (Matthias Lang) Date: Mon, 16 Apr 2012 21:16:58 +0200 Subject: [erlang-questions] trapexit.org In-Reply-To: <4F8C5681.7050904@meetinghouse.net> References: <50491b83-0169-49f5-b315-3b9a6f806c5e@knuth> <4F8C533A.50400@erlang-solutions.com> <4F8C5681.7050904@meetinghouse.net> Message-ID: <20120416191658.GA6786@corelatus.se> On Monday, April 16, Miles Fidelman wrote: > Still... as a key site for a run-time environment that's all about > non-stop operation, hot updates, .... probably doesn't send a good > message when a key (and much valued/appreciated) support site is > down for an extended time. :-( Looks like a PHP site to me: > wget -S http://www.trapexit.org/ --2012-04-16 21:07:11-- http://www.trapexit.org/ Resolving www.trapexit.org (www.trapexit.org)... 213.171.204.166 ... X-Powered-By: PHP/5.1.4 so it not working isn't directly Erlang's fault. Maybe there's an argument along the lines of eating your own dogfood, which erlang.org seems to do: >wget -S www.erlang.org ... Server: inets/5.7.1 but, then again, Erlang doesn't have to be the right tool for everything---rewriting mediawiki would be quite a job. And then there's a whole separate discussion over whether a wiki is the right thing. Matt From thomas.burdick@REDACTED Mon Apr 16 21:37:14 2012 From: thomas.burdick@REDACTED (Tom Burdick) Date: Mon, 16 Apr 2012 14:37:14 -0500 Subject: [erlang-questions] Is there an accepted way of including GPL code in a project? In-Reply-To: References: <4F8B25DC.5080905@gmail.com> Message-ID: Why does it even require a lawyers opinion on this to figure it out? Shouldn't it be rather obvious what the intent is rather than require a lawyer to interpret what it really means to "modify" "link" and "distribute" "Can I use this without breaking the GPL?" If it the question is there, and lawyering is needed to figure it out and that wasn't the intention why use the GPL? Its off putting to a lot of people including myself when the intention was not to require me to provide my software licensed under the GPL or GPL compliant licensing as seems to be the case with PropEr. Tom On Mon, Apr 16, 2012 at 2:14 PM, Ulf Wiger wrote: > > Here is an article from LinuxJournal on what constitutes a Derivative Work. > > http://www.linuxjournal.com/article/6366 > > [ 2) The meaning of derivative work will not be broadened to include software created by linking to library programs that were designed and intended to be used as library programs. When a company releases a scientific subroutine library, or a library of objects, for example, people who merely use the library, unmodified, perhaps without even looking at the source code, are not thereby creating derivative works of the library. ] > > [ 4) In most cases we shouldn't care how the linkage between separate programs was technically done, unless that fact helps determine whether the creators of the programs designed them with some apparent common understanding of what a derivative work would look like. We should consider subtle market-based factors as indicators of intent, such as whether the resulting program is being sold as an ?enhanced? version of the original, or whether the original was designed and advertised to be improvable ?like a library?. ] > > About the author: > Lawrence Rosen is an attorney in private practice, with offices in Los Altos and Ukiah, California (www.rosenlaw.com). He is also corporate secretary and general counsel for the Open Source Initiative, which manages and promotes the Open Source Definition (www.opensource.org). > > Of course, to cover himself, he adds this: > > "Legal advice must be provided in the course of an attorney-client relationship specifically with reference to all the facts of a particular situation and the law of your jurisdiction. Even though an attorney wrote this article, the information in this article must not be relied upon as a substitute for obtaining specific legal advice from a licensed attorney." > > :) > > Given his reasoning, a component (like the ones discussed here) that was designed to be a sub-component in a larger system, would not contaminate the larger system, regardless of the linking technology used. If, on the other hand, the GPLd software is an application in its own right, any code using and extending it is clearly a derivative work. > > BR, > Ulf W > > > On 16 Apr 2012, at 20:58, Alan Evans wrote: > >> Hi Richard, >> >> Thanks for the summary, I think it sums up my feelings on this as well. >> >> I already sent the author an email before posting this question. >> Ideally I'd like to use his code with his permission either as you say >> under a different license agreement or an acknowledgement that what >> I'm proposing is acceptable to him. >> >> I think I'll send him another email before I decide on the path I'm >> going to take. >> >> cheers >> AlanE. >> >> On Sun, Apr 15, 2012 at 8:47 PM, Richard Carlsson >> wrote: >>> On 2012-04-13 11:57, Alan Evans wrote: >>>> >>>> Hello list, >>>> >>>> I'm thinking about using some GPL code in a project I'm working on. >>>> Namely the SIGTRAN stack from the osmocom project >>>> (http://cgit.osmocom.org/cgit/erlang) >>>> Is there a recognized way to incorporate GPL code in an erlang project >>>> without making the whole project subject to the GPL license? >>>> >>>> I haven't yet decided whether or not to make my project open source. >>>> >>>> My thinking is that if I isolate all the GPL code to a particular >>>> Erlang node then only the modules running on that node need to be GPL >>>> or GPL compatible, I am free to license the modules running on the >>>> other nodes any way I wish. >>>> >>>> Any thoughts? Other than the obvious "ask a lawyer" response :-) >>> >>> >>> Erlang modules are dynamically linked to each other at run-time. The FSF >>> considers this to be no different from static linkage, and Erlang is just >>> like Java in this respect: >>> >>> ?http://www.gnu.org/licenses/lgpl-java.html >>> >>> My interpretation (not a lawyer etc. etc.) is that the LGPL is >>> straightforward to use with Erlang, but plain GPL requires that all other >>> libraries that your application calls, directly or indirectly, must be GPL >>> compatible. (V3 of the GPL makes an exception for "system libraries", so the >>> Erlang/OTP standard libraries don't pose a problem.) >>> >>> Isolating the GPL code to a separate node is similar to other workarounds >>> I've seen that run GPL code in a separate OS process from the main >>> application. It lies within that gray area where it will probably hold in >>> court but will make you feel dirty. A nicer way would of course be if you >>> could get hold of the original authors of that library and ask them for a >>> different license, possibly for a fee. >>> >>> ? /Richard >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. > http://feuerlabs.com > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From paperless@REDACTED Mon Apr 16 21:48:17 2012 From: paperless@REDACTED (Tim McNamara) Date: Tue, 17 Apr 2012 07:48:17 +1200 Subject: [erlang-questions] Is there an accepted way of including GPL code in a project? In-Reply-To: References: <4F8B25DC.5080905@gmail.com> Message-ID: On 17 April 2012 07:37, Tom Burdick wrote: > Why does it even require a lawyers opinion on this to figure it out? > Shouldn't it be rather obvious what the intent is rather than require > a lawyer to interpret what it really means to "modify" "link" and > "distribute" > > "Can I use this without breaking the GPL?" > > If it the question is there, and lawyering is needed to figure it out > and that wasn't the intention why use the GPL? > > Its off putting to a lot of people including myself when the intention > was not to require me to provide my software licensed under the GPL or > GPL compliant licensing as seems to be the case with PropEr. [big snip] The GPL is a complicated license. It takes steps to enforce that future creators will respect users' freedom.* There are many people who seek to circumvent these steps. The terms "modify", "link" and "distribute" are fairly well defined, even if their meaning is technical. This is different from other forms of problems in legal terms, where they are inherently ambiguous. * Am not taking a stand on if this constitutes freedom here, merely that this is the intention of the license's creation. From maximminin@REDACTED Mon Apr 16 22:16:04 2012 From: maximminin@REDACTED (=?UTF-8?B?bWF4aW0gbWluaW4=?=) Date: Tue, 17 Apr 2012 00:16:04 +0400 Subject: [erlang-questions] =?utf-8?q?Built_In_Types?= Message-ID: Hi Erlangers, i try to define a type "product" like: -type product :: 'A'|'B'|'C'. But the compiler complains"type product() already defined". At http://www.erlang.org/doc/reference_manual/typespec.html is "product" not in the list of built-in types. So i have two quetions: Is "product" really a built-in type? Is it possible to show all built-in types in erlang shell? Thanks Max From kostis@REDACTED Mon Apr 16 23:01:59 2012 From: kostis@REDACTED (Kostis Sagonas) Date: Mon, 16 Apr 2012 23:01:59 +0200 Subject: [erlang-questions] Built In Types In-Reply-To: References: Message-ID: <4F8C88C7.2020607@cs.ntua.gr> On 04/16/2012 10:16 PM, maxim minin wrote: > Hi Erlangers, > i try to define a type "product" like: > > -type product :: 'A'|'B'|'C'. > > But the compiler complains"type product() already defined". > At http://www.erlang.org/doc/reference_manual/typespec.html is "product" not in the list of built-in types. > So i have two quetions: > > Is "product" really a built-in type? Hmmm... Nice discrepancy detected! This was actually news to me. Turns out that there are four atom names, which are not built-in types, but are instead used internally by the type system and are in principle defined for all arities. These are listed in lib/stdlib/src/erl_lint.erl is_var_arity_type(tuple) -> true; is_var_arity_type(product) -> true; is_var_arity_type(union) -> true; is_var_arity_type(record) -> true; is_var_arity_type(_) -> false. So, for the time being, you cannot use the atoms 'tuple', 'product', 'union' or 'record' as names of types. These should be a note of that in the reference_manual (or perhaps revise the representation to use less common atoms for some of these, e.g. '$$product'). Sorry for the inconvenience... > Is it possible to show all built-in types in erlang shell? Currently not. Kostis From peerst@REDACTED Mon Apr 16 23:12:07 2012 From: peerst@REDACTED (Peer Stritzinger) Date: Mon, 16 Apr 2012 23:12:07 +0200 Subject: [erlang-questions] Confused about USE_THREADS vs. ERTS_SMP while building Message-ID: Hi, while porting Erlang to the RTEMS real time os I'm stuck understanding the meaning of the USE_THREADS vs. ERTS_SMP in beam. So far it is clear to me that ERTS_SMP implies USE_THREADS. What is less clear is the usefulness of USE_THREADS without smp. I tried building with USE_THREADS and ERTS_SMP not set (RTEMS doesn't support SMP yet very well): The build works well but when I try to run it stumbles because of cpuinfo not set to useful values: *cpuinfo = {configured = 0, online = 0, available = 0, topology_size = 0, topology = 0x0} This results in the error exit with the message "Failed to set thread main status: Invalid argument (22)" The reason for that seems to be that erts_cpu_info_update() in erl_misc_utils.c can't figure out the right cpu topology for non SMP. reason is that my OS doesn't have all these fancy sysconf/syctl whatever calls. What I don't understand why it is trying to find out about the topology when ERTS_SMP is not defined? Shouldn't it just use a default of: "I have just one plain old core"? Is this a bug? Or does it only make sense to build the system either with both ERTS_SMP and USE_THREADS set or with both unset? Cheers, -- Peer From torben.lehoff@REDACTED Mon Apr 16 23:27:02 2012 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Mon, 16 Apr 2012 23:27:02 +0200 Subject: [erlang-questions] filelib:is_file/1 seems to be wrong on my machine Message-ID: <4F8C8EA6.3000600@gmail.com> Output from Erlang shell: 1> {ok, Cs} = file:list_dir("."). {ok,["TODO.md","test","src","sinan.config", "rebar.config.bak","README.md","Makefile","LICENSE", "INSTALL.md","examples","ebin","doc", "current_counterexample.eqc","config","CHANGELOG.md", "_build",".gitignore",".git"]} 2> lists:partition( fun file:is_file/1, Cs ). ** exception error: undefined function file:is_file/1 in function lists:partition/4 (lists.erl, line 1236) 3> lists:partition( fun filelib:is_file/1, Cs ). {["TODO.md","test","src","sinan.config","rebar.config.bak", "README.md","Makefile","LICENSE","INSTALL.md","examples", "ebin","doc","current_counterexample.eqc","config", "CHANGELOG.md","_build",".gitignore",".git"], []} 4> lists:partition( fun filelib:is_dir/1, Cs ). {["test","src","examples","ebin","doc","config","_build", ".git"], ["TODO.md","sinan.config","rebar.config.bak","README.md", "Makefile","LICENSE","INSTALL.md", "current_counterexample.eqc","CHANGELOG.md",".gitignore"]} It seems that filelib:is_file/1 is viewing everything as a file whereas filelib:is_dir/1 has a more correct view. Done on my Mac OS X Lion using R15B. Cheers, Torben -- http://www.linkedin.com/in/torbenhoffmann From tuncer.ayaz@REDACTED Mon Apr 16 23:30:10 2012 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Mon, 16 Apr 2012 23:30:10 +0200 Subject: [erlang-questions] filelib:is_file/1 seems to be wrong on my machine In-Reply-To: <4F8C8EA6.3000600@gmail.com> References: <4F8C8EA6.3000600@gmail.com> Message-ID: On Mon, Apr 16, 2012 at 11:27 PM, Torben Hoffmann wrote: > Output from Erlang shell: > 1> {ok, Cs} = file:list_dir("."). > {ok,["TODO.md","test","src","sinan.config", > ? ? "rebar.config.bak","README.md","Makefile","LICENSE", > ? ? "INSTALL.md","examples","ebin","doc", > ? ? "current_counterexample.eqc","config","CHANGELOG.md", > ? ? "_build",".gitignore",".git"]} > 2> lists:partition( fun file:is_file/1, Cs ). > ** exception error: undefined function file:is_file/1 > ? ? in function ?lists:partition/4 (lists.erl, line 1236) > 3> lists:partition( fun filelib:is_file/1, Cs ). > {["TODO.md","test","src","sinan.config","rebar.config.bak", > ?"README.md","Makefile","LICENSE","INSTALL.md","examples", > ?"ebin","doc","current_counterexample.eqc","config", > ?"CHANGELOG.md","_build",".gitignore",".git"], > ?[]} > 4> lists:partition( fun filelib:is_dir/1, Cs ). > {["test","src","examples","ebin","doc","config","_build", > ?".git"], > ?["TODO.md","sinan.config","rebar.config.bak","README.md", > ?"Makefile","LICENSE","INSTALL.md", > ?"current_counterexample.eqc","CHANGELOG.md",".gitignore"]} > > It seems that filelib:is_file/1 is viewing everything as a file whereas > filelib:is_dir/1 has a more correct view. > > Done on my Mac OS X Lion using R15B. Use filelib:is_regular/1 for files. From torben.lehoff@REDACTED Mon Apr 16 23:46:40 2012 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Mon, 16 Apr 2012 23:46:40 +0200 Subject: [erlang-questions] filelib:is_file/1 seems to be wrong on my machine In-Reply-To: References: <4F8C8EA6.3000600@gmail.com> Message-ID: <4F8C9340.3050304@gmail.com> On 16/4/12 23:30 , Tuncer Ayaz wrote: > On Mon, Apr 16, 2012 at 11:27 PM, Torben Hoffmann wrote: >> Output from Erlang shell: >> 1> {ok, Cs} = file:list_dir("."). >> {ok,["TODO.md","test","src","sinan.config", >> "rebar.config.bak","README.md","Makefile","LICENSE", >> "INSTALL.md","examples","ebin","doc", >> "current_counterexample.eqc","config","CHANGELOG.md", >> "_build",".gitignore",".git"]} >> 2> lists:partition( fun file:is_file/1, Cs ). >> ** exception error: undefined function file:is_file/1 >> in function lists:partition/4 (lists.erl, line 1236) >> 3> lists:partition( fun filelib:is_file/1, Cs ). >> {["TODO.md","test","src","sinan.config","rebar.config.bak", >> "README.md","Makefile","LICENSE","INSTALL.md","examples", >> "ebin","doc","current_counterexample.eqc","config", >> "CHANGELOG.md","_build",".gitignore",".git"], >> []} >> 4> lists:partition( fun filelib:is_dir/1, Cs ). >> {["test","src","examples","ebin","doc","config","_build", >> ".git"], >> ["TODO.md","sinan.config","rebar.config.bak","README.md", >> "Makefile","LICENSE","INSTALL.md", >> "current_counterexample.eqc","CHANGELOG.md",".gitignore"]} >> >> It seems that filelib:is_file/1 is viewing everything as a file whereas >> filelib:is_dir/1 has a more correct view. >> >> Done on my Mac OS X Lion using R15B. > Use filelib:is_regular/1 for files. I obviously should be at sleep instead of coding... :-$ One should read the text in the manual and not just the headlines! Thanks!! Torben -- http://www.linkedin.com/in/torbenhoffmann From peerst@REDACTED Tue Apr 17 01:14:32 2012 From: peerst@REDACTED (Peer Stritzinger) Date: Tue, 17 Apr 2012 01:14:32 +0200 Subject: [erlang-questions] Erlang on multi-CPU board using USB In-Reply-To: References: <2F85FB34-CC47-4017-9C20-759BDFD197C1@cs.otago.ac.nz> Message-ID: On Mon, Apr 16, 2012 at 8:09 AM, Richard O'Keefe wrote: > (only just) aware of ethernet-over-USB, but I've never set up an > Erlang cluster by any means other than IP. If you want to set up Ethernet-over-USB be aware that there are more than one way to do this since there are multiple standards how this is best being done. ?For a short overview you can refer to http://en.wikipedia.org/wiki/Ethernet_over_USB Basically you'll have to choose one of the Ethernet over USB protocols that your OS supports in device mode. ?Then there only remains the questions of topology and routing but this is standard once the devices are set up. >?Where should I start > looking in the Fine Manuals? I've implemented talking from Erlang on a Unixoid OS (FreeBSD in my case) to a embedded device not running Erlang as port. For the host part I've used the libusb API: http://libusb.sourceforge.net/api-1.0/ The device part was running on small real time OS so this was implemented ad-hoc without any support from the OS. If you want to implement a device on a Unixlike OS I'm not aware of a portable solution for this. ?You have to use whatever your OS offers. To have a proprietary point to point stream over USB is rather simple but its probably still easier to go with the Ethernet over USB variant if your OS has non buggy drivers. ?Much more communication overhead but you get multiplexing and routing for free. What I really recommend is getting a USB sniffing device for any USB driver or complicated setup work. ?USB is really weird and it helps a lot understanding what's going on. The one I'm using is http://www.totalphase.com/products/beagle_usb480/ I can only say positive things about it. Especially the software is free (you only buy the hardware) and runs on Windows, Linux and Mac OSX. ?BTW I'm not affiliated with Totalphase, just a happy customer Cheers, -- Peer From olivier.girondel@REDACTED Tue Apr 17 01:32:20 2012 From: olivier.girondel@REDACTED (Olivier Girondel) Date: Tue, 17 Apr 2012 01:32:20 +0200 Subject: [erlang-questions] trapexit.org In-Reply-To: <20120416191658.GA6786@corelatus.se> References: <50491b83-0169-49f5-b315-3b9a6f806c5e@knuth> <4F8C533A.50400@erlang-solutions.com> <4F8C5681.7050904@meetinghouse.net> <20120416191658.GA6786@corelatus.se> Message-ID: On Mon, Apr 16, 2012 at 9:16 PM, Matthias Lang wrote: > On Monday, April 16, Miles Fidelman wrote: > >> Still... as a key site for a run-time environment that's all about >> non-stop operation, hot updates, .... probably doesn't send a good >> message when a key (and much valued/appreciated) support site is >> down for an extended time. :-( > > Looks like a PHP site to me: > > ? > wget -S http://www.trapexit.org/ > ? --2012-04-16 21:07:11-- ?http://www.trapexit.org/ > ? Resolving www.trapexit.org (www.trapexit.org)... 213.171.204.166 > ? ... > ? X-Powered-By: PHP/5.1.4 > > so it not working isn't directly Erlang's fault. Maybe there's an argument > along the lines of eating your own dogfood, which erlang.org seems to do: > > ? >wget -S www.erlang.org > ? ... > ? Server: inets/5.7.1 > > but, then again, Erlang doesn't have to be the right tool for > everything---rewriting mediawiki would be quite a job. And then > there's a whole separate discussion over whether a wiki is the right > thing. +0.5: I was also sad for the downtimes of trapexit and tidier, but maybe these projects would like to get some more hands to help ? At least we can be proud of: Connecting to yaws.hyber.org (yaws.hyber.org)|213.180.77.67|:80... connected. HTTP/1.1 200 OK Server: Yaws 1.92 ;) -- Olivier From rexxe98@REDACTED Tue Apr 17 02:11:55 2012 From: rexxe98@REDACTED (Andrew Berman) Date: Mon, 16 Apr 2012 17:11:55 -0700 Subject: [erlang-questions] [ANN] SublimErl: Run Erlang tests inside Sublime Text 2 In-Reply-To: References: Message-ID: Awesome stuff Roberto! On Mon, Apr 16, 2012 at 10:29 AM, Roberto Ostinelli wrote: > Dear all, > > I'm happy to announce that SublimErl has been released today. > > SublimErl is a plugin for the editor Sublime Text 2, and allows you to run > Erlang Tests from within the editor itself: > > > - Run *Eunit* tests (all tests from file / single test) > - Run *Common Tests* ( single file ) > - Run *Dialyzer* tests ( single file ) > > > Here's a short video which shows SublimErl in action: > http://www.youtube.com/watch?v=T0rD0CQM4Yg > > > SublimErl is released under the BSD license, and is available on github: > http://github.com/ostinelli/sublimerl > > > I know Erlang is a world of Vim/Emacs-ers, my hope is that other tools > like this one might help to spur some additional TDD and Agile > methodologies in the Erlang world. > > Comments, feedback and questions welcome. > > r. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wiley.andrew.j@REDACTED Tue Apr 17 03:03:55 2012 From: wiley.andrew.j@REDACTED (Andrew Wiley) Date: Mon, 16 Apr 2012 20:03:55 -0500 Subject: [erlang-questions] HiPE on ARM Build Issue In-Reply-To: References: <4F89317F.80002@cs.ntua.gr> Message-ID: After some off-list work with Kostis' help, it looks like HiPE native compilation works for my sample program, but if I use native libraries, the VM segfaults. So ARMv7 is mostly working, but the codegen isn't quite correct (which makes sense because the platform is untested). I described the needed change to configure.in; where would I submit a patch? Andrew -------------- next part -------------- An HTML attachment was scrubbed... URL: From roberto@REDACTED Tue Apr 17 04:33:35 2012 From: roberto@REDACTED (Roberto Ostinelli) Date: Mon, 16 Apr 2012 19:33:35 -0700 Subject: [erlang-questions] [ANN] SublimErl: Run Erlang tests inside Sublime Text 2 In-Reply-To: References: Message-ID: Thank you Andrew! Not sure why I got so many replies off-list :) r. Awesome stuff Roberto! -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists.nico.k@REDACTED Tue Apr 17 11:22:47 2012 From: lists.nico.k@REDACTED (Nico Kruber) Date: Tue, 17 Apr 2012 11:22:47 +0200 Subject: [erlang-questions] performance drop in R15A? In-Reply-To: <20120416191120.GA5395@softlab.ntua.gr> References: <1359554.YeRYZETzs8@csr-pc40.zib.de> <2039707.WCVItAxVID@csr-pc40.zib.de> <20120416191120.GA5395@softlab.ntua.gr> Message-ID: <4927067.bQXkYCgyKN@csr-pc40.zib.de> On Monday 16 April 2012 22:11:20 Yiannis Tsiouris wrote: > On Mon, Apr 16, 2012 at 04:03:49PM +0200, Nico Kruber wrote: > > Thank you for the tips, indeed, by using the +sbt option I was able to > > improve our benchmark results to a certain extend - not to the full > > R14B04 value though :( > > I achieved the best results together with the +swt low and very_low > > option, so I would probably go with "low". I also experienced with +rg > > and +scl but these didn't influence the results too much. > > > > I also attached the cpuinfo from the test system (basically an 8-core > > Opteron 2376 with 8GB RAM). > > > > using Scalaris "make bench": > > wall clock throughput // latency > > > > R14B04: 999 // 40 > > > > "+swt low" 1097 // 36 > > "+swt very_low" 1101 // 36 > > > > R15B: (same as "+sbt u") 679 // 59 > > > > "+scl true" 682 // 59 > > "+sbt db" 836 // 48 > > "+sbt ns" 828 // 48 > > "+sbt ts" 840 // 48 > > "+sbt ps" 816 // 49 > > "+sbt s" 822 // 49 > > "+sbt nnts" 825 // 48 > > "+sbt nnps" 834 // 48 > > "+sbt tnnps" 830 // 48 > > "+scl true +sbt db" 827 // 48 > > "+scl true +sbt db +swt low" 1029 // 39 > > "+sbt db +swt low" 1019 // 39 > > "+sbt db +swt very_low" 1038 // 39 > > "+swt low" 764 // 52 > > "+sbt db +swt low +rg 4" 1008 // 40 > > "+sbt db +swt low +rg 8" 1042 // 38 > > "+sbt db +swt low +rg 16" 1011 // 40 > > > > Recall that this creates 4 erlang VMs with the same (given) start-up > > options. > Hi, > > First of all, thanks for sharing all these experiences with us! It's been > really interesting. I have one question though: how stable are your > results? I notice that some of the timings are really close, i.e. the > variance is around 10-20%. Do you think that these measurements are > reliable-enough to make valid assumptions? Regarding stability of the benchmarks in the plots I attached a while ago: these fluctuate because the machine is not only used for benchmarking. The trend is clear though. Regarding the values mentioned above, they are relatively stable, e.g. see "+sbt db" and "+sbt tnnps" which (according to the man page) are the same. There is less than 1% difference. On the other hand, the difference between the options is dramatic (and reproducable)! Here are the results of 10 runs of "+sbt db +swt low": R14B04: 1096 // 36.5 1088 // 36.7 1095 // 36.5 1094 // 36.5 1102 // 36.3 1100 // 36.4 1101 // 36.3 1095 // 36.5 1097 // 36.5 1089 // 36.7 R15B: 1026 // 39.0 1026 // 39.0 1026 // 39.0 1019 // 39.2 1012 // 39.5 1016 // 39.4 1028 // 38.9 1025 // 39.0 1021 // 39.2 1019 // 39.3 -> as you can see, with these two options on, the bench results between R14B04 and R15B do not differ much any more (avg: R14B04 1096, R15B 1022) but R15B is around 7% slower. The different results on each Erlang version however do not differ that much (R14B04 stddev 4.7 - R15B stddev 5.2; both less than 1%) Nico From hukl@REDACTED Tue Apr 17 18:00:41 2012 From: hukl@REDACTED (John-Paul Bader) Date: Tue, 17 Apr 2012 18:00:41 +0200 Subject: [erlang-questions] How to handle a massive amount of UDP packets? In-Reply-To: References: <4F8B0E95.4060003@berlin.ccc.de> <4F8BE6FB.3020205@berlin.ccc.de> Message-ID: <4F8D93A9.3060303@berlin.ccc.de> Quick Update: In our quest to find the potential bottlenecks we started benchmarking {active, false} vs {active, once} vs {active, true}. We used a rate limited client and measured how many packets were actually handled on the server. Note that when we say 40000 packets/s the client would send a burst of 40000 packets and then sleep the remaining time of that very second. {active, once} was the worst, losing up to 50% packets {active, false} was much better but still losing up to 25% packets {active, true} was the clear winner with no packet loss at 100000 packets per second. When using two clients at 100k/s it started losing packets but it was still reasonable given the amount of packets. Also the VM stayed below 100% CPU and did not increase memory consumption, staying stable below 23MB The server is using active, true and passes the message instantly to another process which does the actual work on another thread. Also, we ran these benchmarks on the same machine and sent / received all packets via the loopback interface. The next benchmarks could be run from different machines and also with a more sophisticated client that doesn't send the packets in bursts to see if that changes anything. During the tests we played with read_packets and recbuf settings but it appeared to have little or no effect at all but we will continue to play around with that. ~ John Chandru wrote: > Hi John, > > In the steady state, we have about 2000/sec, but in error situations, > we've had peaks of up to 20000 packets / sec. > > cheers > Chandru > > On 16 April 2012 10:31, John-Paul Bader > wrote: > > Hey Chandru, > > how many packets per second did you have to deal with and how big > are they? Just to have something to compare to. > > ~ John > > Chandru wrote: > > Hi John, > > Our RADIUS server which handles our data network is written in > Erlang. > We've experimented with various values of recbuf and read_packets > options for the UDP socket. We also use {active, once}. The > receiving > process receives a packet and spawns a new process to handle it. > That is > all it does. The spawned process then executes the rest of the > business > logic. > > That won't be your problem. The problem will be to make sure > your system > is stable while handling all those packets. We use overload > control at > the receiver. You have to pretty much look at the entire > execution path > for each packet and ensure there are no bottlenecks. At that kind of > load, every little bottleneck shows up sooner or later. > > cheers > Chandru > > On 15 April 2012 19:08, John-Paul Bader > >> wrote: > > Dear list, > > > I'm currently writing a bittorrent tracker in Erlang. While > a naive > implementation of the protocol is quite easy, there are some > performance related challanges where I could use some help. > > In the first test run as a replacement for a very popular > tracker, > my erlang tracker got about 40k requests per second. > > My initial approach was to initialize the socket in one > process with > {active, once}, handle the message in handle_info with minimal > effort and pass the data asynchronously to a freshly spawned > worker > processes which responds to the clients. After spawning the > process > I'm setting the socket back to {active, once}. > > Now when I switched the erlang tracker live the erlang vm was > topping at 100% CPU load. My guess is that the process > handling the > udp packets from the socket could not keep up. Since I'm > still quite > new to the world of erlang I'd like to know if there are > some best > practices / patterns to handle this massive amount of packets. > > For example using the socket in {active, once} might be too > slow? > Also the response to the clients needs to come from the same > port as > the request was coming in. Is it a problem to use the same > socket > for that? Should I pre-spawn a couple of thousand workers and > dispatch the data from the socket to them rather than > spawning them > on each packet? > > It would be really great if you could give some advice or > point me > into the right directions. > > ~ John > ___________________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > > > http://erlang.org/mailman/____listinfo/erlang-questions > > > > > > _________________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/__listinfo/erlang-questions > > > From max.lapshin@REDACTED Tue Apr 17 18:17:57 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Tue, 17 Apr 2012 20:17:57 +0400 Subject: [erlang-questions] How to handle a massive amount of UDP packets? In-Reply-To: <4F8D93A9.3060303@berlin.ccc.de> References: <4F8B0E95.4060003@berlin.ccc.de> <4F8BE6FB.3020205@berlin.ccc.de> <4F8D93A9.3060303@berlin.ccc.de> Message-ID: Can you show your code in client? If it is not written in C, then you are benchmarking your client. You should test simultaneous packet arrival and it will be hard to do if you use recursive function sending on client. From lists.nico.k@REDACTED Tue Apr 17 19:11:10 2012 From: lists.nico.k@REDACTED (Nico Kruber) Date: Tue, 17 Apr 2012 19:11:10 +0200 Subject: [erlang-questions] performance drop in R15A? In-Reply-To: References: Message-ID: <88980987.iGgxe8RB2p@csr-pc40.zib.de> I'll try to set up a script to automatically let git bisect with different otp versions as soon as I have time for that. However, chances are probably slim that this has been introduced by a single commit, especially since the runtime options "+sbt db +swt low" reduce the difference between R14B04 and R15B a lot... Nico On Thursday 12 April 2012 22:42:05 Gustav Simonsson wrote: > Hi Nico, > > Have you tried running the benchmarks between git bisects, > using R14B04 and R15A as endpoints? > > // Gustav > > Sent from my PC > > ----- Original Message ----- > > > From: "Nico Kruber" > > To: erlang-questions@REDACTED > > Cc: "Lukas Larsson" > > Sent: Thursday, 12 April, 2012 2:47:50 PM > > Subject: Re: [erlang-questions] performance drop in R15A? > > > > is there any news on this? > > Our internal test server has a new additional configuration which > > compiles the > > latest otp from github once per day and tests its performance with > > the > > mentioned benchmarks. > > The resulting graphs for R14B04, R15B and latest git checkout are > > attached. As > > you can see - nothing has changed since then so I suppose it is still > > present > > in R15B01 :( > > > > I don't know how to debug this any further. If there is anything I > > could do to > > help you identify the issue, please tell me. > > > > > > Regards > > Nico Kruber > > > > On Wednesday 14 December 2011 17:41:33 Nico Kruber wrote: > > > ok, I did some profiling and made some optimisations but the > > > differences > > > between R15B (git checkout from master just now) and R14B04 are > > > still the > > > same: > > > > > > First the results of the calls to bench:quorum_read(10, 50000) > > > (best of > > > three) ------------------------------------------------------------ > > > > > > | R14B04 | R15B | time surplus > > > > > > ------------------------------------------------------------ > > > timer:tc, smp8:8 | 22484619| 26641737| +18% > > > timer:tc, smp4:4 | 34009785| 35963489| + 6% > > > timer:tc, smp2:2 | 32863428| 34102038| + 4% > > > timer:tc, smpoff | 53805419| 54214795| + 1% > > > ------------------------------------------------------------ > > > > > > It seems there is some lock-contention or some other problem with > > > smp in our > > > case which hasn't been there before. > > > I also observed that the results using R15B vary quite much, > > > especially with > > > smp8:8 (see below for an example). R14B04 is more stable among > > > different > > > test runs. > > > But still, even without smp, R15B is slower than R14B04 :( > > > > > > Lukas suggested to run fprof to a bit deeper and maybe find the > > > function > > > taking longer in R15 than in R14B04. > > > Although it was helpful in finding some hot spots, it did however > > > not help > > > with this problem. Following are the totals reported by fprof > > > (if you like, I can send the complete logs - didn't want to send > > > too much to > > > the mailing list though). > > > > > > ------------------------------------------------------------ > > > > > > | R14B04 | R15B | time surplus > > > > > > ------------------------------------------------------------ > > > fprof, CNT, smp8:8 | 7723796| 7722635| n/a > > > fprof, ACC, smp8:8 | 98239| 85477| -13% > > > fprof, OWN, smp8:8 | 300534| 264018| -12% > > > ------------------------------------------------------------ > > > > > > As you can see, according to fprof, R15B should be faster (but it > > > isn't!). > > > I assume that some function calls are not reported by fprof > > > (e.g. I did not see erlang:length/1). > > > Is there some way to include them again in order to analyse > > > further? > > > Maybe suspend or garbage_collect are not in ACC or OWN? > > > But even here, R15B wastes less time as you can see in the table > > > below. > > > ---------------------------------------------------------- > > > > > > | R14B04 | R15B | > > > > > > ---------------------------------------------------------- > > > fprof, suspend, smp8:8 | 9.8421e+06| 8.51855e+06| > > > fprof, garbage_collect, smp8:8 | 1315| 794| > > > ---------------------------------------------------------- > > > > > > We do rely quite much on the process dictionary (erlang:put and > > > erlang:get) > > > which you might see as an "non-typical usage pattern" for erlang. > > > However, if I switch to ets instead, performance of > > > bench:quorum_read(10, > > > 50000) for R15B does not change and for R14B04 decreases by about > > > 7%. > > > > > > Everything else I would consider "typical use" - or at least I'm > > > not aware > > > of anything untypical. > > > > > > I hope, someone can help to further analyse the problem. I did > > > everything I > > > could think of and are stuck now. > > > Is other real-world software also affected? E.g. testing couchdb > > > would be > > > nice. > > > > > > > > > Regards > > > Nico Kruber > > > > > > > > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > > how to re-produce the values > > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > > > > > I'm using scalaris from http://code.google.com/p/scalaris/ > > > ./configure && make > > > ================ R15B =============== > > > -------------------------------- > > > ./bin/firstnode.sh > > > Erlang R15B (erts-5.9) [source] [64-bit] [smp:8:8] > > > [async-threads:0] [hipe] > > > [kernel-poll:false] > > > > > > timer:tc(bench, quorum_read, [10, 50000]). > > > {33764932,ok} % 1st try > > > {26641737,ok} % 2nd try > > > {27575975,ok} % 3rd try > > > -------------------------------- > > > ./bin/firstnode.sh "+S4:4" > > > Erlang R15B (erts-5.9) [source] [64-bit] [smp:4:4] > > > [async-threads:0] [hipe] > > > [kernel-poll:false] > > > > > > timer:tc(bench, quorum_read, [10, 50000]). > > > {35963489,ok} % 1st try > > > {36332156,ok} % 2nd try > > > {37295819,ok} % 3rd try > > > -------------------------------- > > > ./bin/firstnode.sh "+S2:2" > > > Erlang R15B (erts-5.9) [source] [64-bit] [smp:2:2] > > > [async-threads:0] [hipe] > > > [kernel-poll:false] > > > > > > timer:tc(bench, quorum_read, [10, 50000]). > > > {34102038,ok} % 1st try > > > {34379052,ok} % 2nd try > > > {34416173,ok} % 3rd try > > > -------------------------------- > > > ./bin/firstnode.sh "-smp disable" > > > Erlang R15B (erts-5.9) [source] [64-bit] [async-threads:0] [hipe] > > > [kernel-poll:false] > > > > > > timer:tc(bench, quorum_read, [10, 50000]). > > > {54214795,ok} % 1st try > > > {55210947,ok} % 2nd try > > > {54537194,ok} % 3rd try > > > > > > ================ R14B04 =============== > > > -------------------------------- > > > ./bin/firstnode.sh > > > Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:8:8] [rq:8] > > > [async-threads:0] [hipe] [kernel-poll:false] > > > > > > timer:tc(bench, quorum_read, [10, 50000]). > > > {22598819,ok} % 1st try > > > {22706185,ok} % 2nd try > > > {22484619,ok} % 3rd try > > > -------------------------------- > > > ./bin/firstnode.sh "+S4:4" > > > Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:4:4] [rq:4] > > > [async-threads:0] [hipe] [kernel-poll:false] > > > > > > timer:tc(bench, quorum_read, [10, 50000]). > > > {35482368,ok} % 1st try > > > {34009785,ok} % 2nd try > > > {34527203,ok} % 3rd try > > > -------------------------------- > > > ./bin/firstnode.sh "+S2:2" > > > Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:2:2] [rq:2] > > > [async-threads:0] [hipe] [kernel-poll:false] > > > > > > timer:tc(bench, quorum_read, [10, 50000]). > > > {33590356,ok} % 1st try > > > {33192033,ok} % 2nd try > > > {32863428,ok} % 3rd try > > > -------------------------------- > > > ./bin/firstnode.sh "-smp disable" > > > Erlang R14B04 (erts-5.8.5) [source] [64-bit] [rq:1] > > > [async-threads:0] [hipe] > > > [kernel-poll:false] > > > > > > timer:tc(bench, quorum_read, [10, 50000]). > > > {53805419,ok} % 1st try > > > {54054538,ok} % 2nd try > > > {54066521,ok} % 3rd try > > > > > > > > > fprof runs: > > > ./bin/firstnode.sh > > > > > > fprof:trace([start, {procs, processes()}]). > > > bench:quorum_read(10, 1000). > > > fprof:trace(stop). > > > fprof:profile(). > > > fprof:analyse([{dest, "test.R15B.fprof.log"}]). % or R14B04 > > > respectively > > > > > > > cat test.R14B04.fprof.log |grep suspend|cut -d',' -f3 | awk > > > > '{s+=$1} END > > > > {print s}' > > > > > > 9.8421e+06 > > > > > > > cat test.R15B.fprof.log |grep suspend|cut -d',' -f3 | awk > > > > '{s+=$1} END > > > > {print s}' > > > > > > 8.51855e+06 > > > > > > > cat test.R14B04.fprof.log |grep garbage_collect|cut -d',' -f3 | > > > > awk > > > > '{s+=$1} END {print s}' > > > > > > 1315.33 > > > > > > > cat test.R15B.fprof.log |grep garbage_collect|cut -d',' -f3 | awk > > > > '{s+=$1} > > > > END {print s}' > > > > > > 794.956 > > > > > > On Friday 09 December 2011 12:09:56 Kenneth Lundin wrote: > > > > On 12/5/11, Nico Kruber wrote: > > > > > Is there any news on this? > > > > > > > > > > The performance drop of the recent R15 checkout compared to > > > > > R14B04 in > > > > > our > > > > > application is now at _30%_ compared to a drop of "only" 15% in > > > > > R15A! > > > > > > > > When working with R15B we are of course performing a number of > > > > bencmarks to keep track of the performance. > > > > > > > > Whe always strive to improve general performance in each release > > > > AND > > > > OUR BENCHMARKS INDICATE THAT R15B IS FASTER IN GENERAL THAN > > > > R14B04. > > > > > > > > It is however always possible that some specific operations or > > > > combinations of operations get slower while others are optimized. > > > > > > > > Regarding the findings for this particular application we think > > > > the > > > > reason for slowdown is a very frequent but non typical usage > > > > pattern > > > > that now becomes visible as a performance bottleneck. > > > > > > > > > > > > / Kenneth, Erlang/OTP Ericsson > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions From magnus.klaar@REDACTED Tue Apr 17 19:21:58 2012 From: magnus.klaar@REDACTED (Magnus Klaar) Date: Tue, 17 Apr 2012 19:21:58 +0200 Subject: [erlang-questions] How to handle a massive amount of UDP packets? In-Reply-To: <4F8D93A9.3060303@berlin.ccc.de> References: <4F8B0E95.4060003@berlin.ccc.de> <4F8BE6FB.3020205@berlin.ccc.de> <4F8D93A9.3060303@berlin.ccc.de> Message-ID: Hi! I revisited the client code jlouis wrote for the UDP tracker client in etorrent. It turns out that my first assumption was wrong, it does not encode the packets using bencode, instead opting for a much more compact data representation. This may explain why you're not seeing any improvements from my first suggestion. I'd love to see this open sourced, bittorrent related projects are always interesting, projects aiming for high throughput are also interesting because they are so unforgiving on poor programming practices. Yours is both. MVH Magnus On Tue, Apr 17, 2012 at 6:00 PM, John-Paul Bader wrote: > Quick Update: > > > In our quest to find the potential bottlenecks we started benchmarking > {active, false} vs {active, once} vs {active, true}. > > We used a rate limited client and measured how many packets were actually > handled on the server. Note that when we say 40000 packets/s the client > would send a burst of 40000 packets and then sleep the remaining time of > that very second. > > {active, once} was the worst, losing up to 50% packets > {active, false} was much better but still losing up to 25% packets > {active, true} was the clear winner with no packet loss at 100000 packets > per second. When using two clients at 100k/s it started losing packets but > it was still reasonable given the amount of packets. > > Also the VM stayed below 100% CPU and did not increase memory consumption, > staying stable below 23MB > > The server is using active, true and passes the message instantly to > another process which does the actual work on another thread. > > Also, we ran these benchmarks on the same machine and sent / received all > packets via the loopback interface. The next benchmarks could be run from > different machines and also with a more sophisticated client that doesn't > send the packets in bursts to see if that changes anything. > > During the tests we played with read_packets and recbuf settings but it > appeared to have little or no effect at all but we will continue to play > around with that. > > ~ John > > Chandru wrote: > >> Hi John, >> >> In the steady state, we have about 2000/sec, but in error situations, >> we've had peaks of up to 20000 packets / sec. >> >> cheers >> Chandru >> >> On 16 April 2012 10:31, John-Paul Bader > > wrote: >> >> Hey Chandru, >> >> how many packets per second did you have to deal with and how big >> are they? Just to have something to compare to. >> >> ~ John >> >> Chandru wrote: >> >> Hi John, >> >> Our RADIUS server which handles our data network is written in >> Erlang. >> We've experimented with various values of recbuf and read_packets >> options for the UDP socket. We also use {active, once}. The >> receiving >> process receives a packet and spawns a new process to handle it. >> That is >> all it does. The spawned process then executes the rest of the >> business >> logic. >> >> That won't be your problem. The problem will be to make sure >> your system >> is stable while handling all those packets. We use overload >> control at >> the receiver. You have to pretty much look at the entire >> execution path >> for each packet and ensure there are no bottlenecks. At that kind >> of >> load, every little bottleneck shows up sooner or later. >> >> cheers >> Chandru >> >> On 15 April 2012 19:08, John-Paul Bader > >> >> wrote: >> >> Dear list, >> >> >> I'm currently writing a bittorrent tracker in Erlang. While >> a naive >> implementation of the protocol is quite easy, there are some >> performance related challanges where I could use some help. >> >> In the first test run as a replacement for a very popular >> tracker, >> my erlang tracker got about 40k requests per second. >> >> My initial approach was to initialize the socket in one >> process with >> {active, once}, handle the message in handle_info with minimal >> effort and pass the data asynchronously to a freshly spawned >> worker >> processes which responds to the clients. After spawning the >> process >> I'm setting the socket back to {active, once}. >> >> Now when I switched the erlang tracker live the erlang vm was >> topping at 100% CPU load. My guess is that the process >> handling the >> udp packets from the socket could not keep up. Since I'm >> still quite >> new to the world of erlang I'd like to know if there are >> some best >> practices / patterns to handle this massive amount of packets. >> >> For example using the socket in {active, once} might be too >> slow? >> Also the response to the clients needs to come from the same >> port as >> the request was coming in. Is it a problem to use the same >> socket >> for that? Should I pre-spawn a couple of thousand workers and >> dispatch the data from the socket to them rather than >> spawning them >> on each packet? >> >> It would be really great if you could give some advice or >> point me >> into the right directions. >> >> ~ John >> ______________________________**_____________________ >> >> erlang-questions mailing list >> erlang-questions@REDACTED >> > >> >> >> >> >> http://erlang.org/mailman/____**listinfo/erlang-questions >> >> > >> >> >> >> >> >> >> >> ______________________________**___________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> > >> http://erlang.org/mailman/__**listinfo/erlang-questions >> >> > >> >> >> ______________________________**_________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/**listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From chandrashekhar.mullaparthi@REDACTED Tue Apr 17 20:43:27 2012 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Tue, 17 Apr 2012 19:43:27 +0100 Subject: [erlang-questions] How to handle a massive amount of UDP packets? In-Reply-To: <4F8D93A9.3060303@berlin.ccc.de> References: <4F8B0E95.4060003@berlin.ccc.de> <4F8BE6FB.3020205@berlin.ccc.de> <4F8D93A9.3060303@berlin.ccc.de> Message-ID: John, When using the {active, once} option, how much processing was the receiving process doing with the packet before setting {active, once} again? I personally wouldn't use {active, true} in a production environment because of its potential to clog up the system. In our case, the receiving process does just this. handle_info({udp, Socket, _IP, _RemotePortNo, Packet} = Req, #state{stats_instance = StatsInstance, port = _InPortNo, overload = Overload, type = Type} = State) -> inet:setopts(Socket, [{active, once}]), case check_overload(Type, Overload) of allow -> spawn(?MODULE, handle_udp_packet, [Req, State]), {noreply, State}; {allow, O2} -> spawn(?MODULE, handle_udp_packet, [Req, State]), {noreply, State#state{overload = O2}}; {deny, O2} -> spawn(?MODULE, reject_udp_packet, [Req, State]), {noreply, State#state{overload = O2}} end; cheers Chandru On 17 April 2012 17:00, John-Paul Bader wrote: > Quick Update: > > > In our quest to find the potential bottlenecks we started benchmarking > {active, false} vs {active, once} vs {active, true}. > > We used a rate limited client and measured how many packets were actually > handled on the server. Note that when we say 40000 packets/s the client > would send a burst of 40000 packets and then sleep the remaining time of > that very second. > > {active, once} was the worst, losing up to 50% packets > {active, false} was much better but still losing up to 25% packets > {active, true} was the clear winner with no packet loss at 100000 packets > per second. When using two clients at 100k/s it started losing packets but > it was still reasonable given the amount of packets. > > Also the VM stayed below 100% CPU and did not increase memory consumption, > staying stable below 23MB > > The server is using active, true and passes the message instantly to > another process which does the actual work on another thread. > > Also, we ran these benchmarks on the same machine and sent / received all > packets via the loopback interface. The next benchmarks could be run from > different machines and also with a more sophisticated client that doesn't > send the packets in bursts to see if that changes anything. > > During the tests we played with read_packets and recbuf settings but it > appeared to have little or no effect at all but we will continue to play > around with that. > > ~ John > > Chandru wrote: > >> Hi John, >> >> In the steady state, we have about 2000/sec, but in error situations, >> we've had peaks of up to 20000 packets / sec. >> >> cheers >> Chandru >> >> On 16 April 2012 10:31, John-Paul Bader > > wrote: >> >> Hey Chandru, >> >> how many packets per second did you have to deal with and how big >> are they? Just to have something to compare to. >> >> ~ John >> >> Chandru wrote: >> >> Hi John, >> >> Our RADIUS server which handles our data network is written in >> Erlang. >> We've experimented with various values of recbuf and read_packets >> options for the UDP socket. We also use {active, once}. The >> receiving >> process receives a packet and spawns a new process to handle it. >> That is >> all it does. The spawned process then executes the rest of the >> business >> logic. >> >> That won't be your problem. The problem will be to make sure >> your system >> is stable while handling all those packets. We use overload >> control at >> the receiver. You have to pretty much look at the entire >> execution path >> for each packet and ensure there are no bottlenecks. At that kind >> of >> load, every little bottleneck shows up sooner or later. >> >> cheers >> Chandru >> >> On 15 April 2012 19:08, John-Paul Bader > >> >> wrote: >> >> Dear list, >> >> >> I'm currently writing a bittorrent tracker in Erlang. While >> a naive >> implementation of the protocol is quite easy, there are some >> performance related challanges where I could use some help. >> >> In the first test run as a replacement for a very popular >> tracker, >> my erlang tracker got about 40k requests per second. >> >> My initial approach was to initialize the socket in one >> process with >> {active, once}, handle the message in handle_info with minimal >> effort and pass the data asynchronously to a freshly spawned >> worker >> processes which responds to the clients. After spawning the >> process >> I'm setting the socket back to {active, once}. >> >> Now when I switched the erlang tracker live the erlang vm was >> topping at 100% CPU load. My guess is that the process >> handling the >> udp packets from the socket could not keep up. Since I'm >> still quite >> new to the world of erlang I'd like to know if there are >> some best >> practices / patterns to handle this massive amount of packets. >> >> For example using the socket in {active, once} might be too >> slow? >> Also the response to the clients needs to come from the same >> port as >> the request was coming in. Is it a problem to use the same >> socket >> for that? Should I pre-spawn a couple of thousand workers and >> dispatch the data from the socket to them rather than >> spawning them >> on each packet? >> >> It would be really great if you could give some advice or >> point me >> into the right directions. >> >> ~ John >> ______________________________**_____________________ >> >> erlang-questions mailing list >> erlang-questions@REDACTED >> > >> >> >> >> >> http://erlang.org/mailman/____**listinfo/erlang-questions >> >> > >> >> >> >> >> >> >> >> ______________________________**___________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> > >> http://erlang.org/mailman/__**listinfo/erlang-questions >> >> > >> >> >> ______________________________**_________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/**listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hukl@REDACTED Tue Apr 17 22:40:29 2012 From: hukl@REDACTED (John-Paul Bader) Date: Tue, 17 Apr 2012 22:40:29 +0200 Subject: [erlang-questions] How to handle a massive amount of UDP packets? In-Reply-To: References: <4F8B0E95.4060003@berlin.ccc.de> <4F8BE6FB.3020205@berlin.ccc.de> <4F8D93A9.3060303@berlin.ccc.de> Message-ID: <4F8DD53D.2090502@berlin.ccc.de> First of all we will share the code once we have some confidence that our benchmarks are indeed doing something meaningful. Right now its all a bit messy and the code changes frequently. Now while we have implemented the client in erlang we have monitored everything with: netstat -w 1 -p udp -n while true; do netstat -p udp -n -s; sleep 1; done systat -ifstat 1 top From netstat's point of view it looked like our client was working perfectly. Also the client was started in a different vm. We have already thought about a proper c client but since the erlang client seemed to work fine we didn't put our thoughts into action yet. ~ John Max Lapshin wrote: > Can you show your code in client? > > If it is not written in C, then you are benchmarking your client. You > should test simultaneous packet arrival and it will be hard to do if > you use recursive function sending on client. From dmkolesnikov@REDACTED Tue Apr 17 22:43:24 2012 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Tue, 17 Apr 2012 23:43:24 +0300 Subject: [erlang-questions] efficient binary escape Message-ID: Hello Erlangers! I'd like to get your opinion on the binary escaping techniques using erlang-only. Let's say that I have binary <<"ab,cdef,qwert,yuiop,....">> I wish to escape (substitute) comma by \, to get <<"ab\\,cdef\\,qwert\\,yuiop,....">>. In other words, a single byte of binary sequence has to be replaced by multiple bytes. and I do have about 35 - 50M tokens to procedure. The straight forward approaches like * binary:replace * sub(<<$,, Rest/binary>>, Acc) -> sub(Rest, <>) .... two slow for me! Do you have any suggestion? What is you experience? Thanks is advanced! - Dmitry From hi@REDACTED Tue Apr 17 22:45:05 2012 From: hi@REDACTED (Johannes Huning) Date: Tue, 17 Apr 2012 22:45:05 +0200 Subject: [erlang-questions] How to handle a massive amount of UDP packets? In-Reply-To: References: <4F8B0E95.4060003@berlin.ccc.de> <4F8BE6FB.3020205@berlin.ccc.de> <4F8D93A9.3060303@berlin.ccc.de> Message-ID: <4F8DD651.3070400@johanneshuning.com> On 04/17/2012 08:43 PM, Chandru wrote: > > When using the {active, once} option, how much processing was the > receiving process doing with the packet before setting {active, once} > again? I personally wouldn't use {active, true} in a production > environment because of its potential to clog up the system. > It's does nothing but to send the received Packet to a process which is intended to do the actual handling, then it immediately returns to receiving packets. For the next sessions we're most likely to look into {active, true} further, testing different buffer sizes et al with it to see how it behaves. Should {active, true} prove to be the fastest way of doing planned things, we'll implement some different means of preventing a system lock-up :) (Having some difficulties posting to the list, apologies for any duplicates) -- Johannes From dmkolesnikov@REDACTED Tue Apr 17 22:57:19 2012 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Tue, 17 Apr 2012 23:57:19 +0300 Subject: [erlang-questions] How to handle a massive amount of UDP packets? In-Reply-To: <4F8DD651.3070400@johanneshuning.com> References: <4F8B0E95.4060003@berlin.ccc.de> <4F8BE6FB.3020205@berlin.ccc.de> <4F8D93A9.3060303@berlin.ccc.de> <4F8DD651.3070400@johanneshuning.com> Message-ID: <34F93FF5-EA52-4FE6-B43B-6E415DC3BA98@gmail.com> Hello, On Apr 17, 2012, at 11:45 PM, Johannes Huning wrote: > On 04/17/2012 08:43 PM, Chandru wrote: >> >> When using the {active, once} option, how much processing was the >> receiving process doing with the packet before setting {active, once} >> again? I personally wouldn't use {active, true} in a production >> environment because of its potential to clog up the system. >> > > It's does nothing but to send the received Packet to a process which is > intended to do the actual handling, then it immediately returns to > receiving packets. It is faire to mentioned here that mailbox of destination process grows intensively if packet arrival rate higher then packet processing rate, as a consequence you'll get OOM. > For the next sessions we're most likely to look into {active, true} > further, testing different buffer sizes et al with it to see how it behaves. I would recommend to test various packet size and various processing time. > > Should {active, true} prove to be the fastest way of doing planned > things, we'll implement some different means of preventing a system > lock-up :) I am afraid that at the end your came up to flow control where {active,true} and {active, once} mixed together ;-) > > (Having some difficulties posting to the list, apologies for any duplicates) > > -- > Johannes > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions Regards, Dmitry From johannes.huning@REDACTED Tue Apr 17 23:00:52 2012 From: johannes.huning@REDACTED (Johannes Huning) Date: Tue, 17 Apr 2012 23:00:52 +0200 Subject: [erlang-questions] How to handle a massive amount of UDP packets? In-Reply-To: <34F93FF5-EA52-4FE6-B43B-6E415DC3BA98@gmail.com> References: <4F8B0E95.4060003@berlin.ccc.de> <4F8BE6FB.3020205@berlin.ccc.de> <4F8D93A9.3060303@berlin.ccc.de> <4F8DD651.3070400@johanneshuning.com> <34F93FF5-EA52-4FE6-B43B-6E415DC3BA98@gmail.com> Message-ID: <4F8DDA04.90109@googlemail.com> On 04/17/2012 10:57 PM, Dmitry Kolesnikov wrote: > Hello, > > On Apr 17, 2012, at 11:45 PM, Johannes Huning wrote: >> It's does nothing but to send the received Packet to a process >> which is intended to do the actual handling, then it immediately >> returns to receiving packets. > > It is faire to mentioned here that mailbox of destination process > grows intensively if packet arrival rate higher then packet > processing rate, as a consequence you'll get OOM. Absolutely! Being aware of the risk we would include some protection against that as well. >> Should {active, true} prove to be the fastest way of doing planned >> things, we'll implement some different means of preventing a >> system lock-up :) > I am afraid that at the end your came up to flow control where > {active,true} and {active, once} mixed together ;-) Yes, that indeed was one way of doing things that came to mind. -- Johannes Huning Berlin, Germany From comptekki@REDACTED Tue Apr 17 23:20:05 2012 From: comptekki@REDACTED (Wes James) Date: Tue, 17 Apr 2012 15:20:05 -0600 Subject: [erlang-questions] efficient binary escape In-Reply-To: References: Message-ID: On Tue, Apr 17, 2012 at 2:43 PM, Dmitry Kolesnikov wrote: > Hello Erlangers! > > I'd like to get your opinion on the binary escaping techniques using erlang-only. > > Let's say that I have binary ? <<"ab,cdef,qwert,yuiop,....">> I wish to escape (substitute) comma by \, to get <<"ab\\,cdef\\,qwert\\,yuiop,....">>. In other words, a single byte of binary sequence has to be replaced by multiple bytes. > > and I do have about 35 - 50M tokens to procedure. The straight forward approaches like > ?* binary:replace > ?* sub(<<$,, Rest/binary>>, Acc) -> > ? ? ?sub(Rest, <>) > ? ?.... > two slow for me! > > Do you have any suggestion? What is you experience? How about: re:replace(<<"ab,cdef,qwert,yuiop,">>,",","\\\\,",[{return, binary},global]). -wes From vasdeveloper@REDACTED Wed Apr 18 06:10:14 2012 From: vasdeveloper@REDACTED (Kannan) Date: Wed, 18 Apr 2012 09:40:14 +0530 Subject: [erlang-questions] How to handle a massive amount of UDP packets? In-Reply-To: <4F8D93A9.3060303@berlin.ccc.de> References: <4F8B0E95.4060003@berlin.ccc.de> <4F8BE6FB.3020205@berlin.ccc.de> <4F8D93A9.3060303@berlin.ccc.de> Message-ID: Hi John, {active, true} is the winner in performance, but it lacks throttling at the OS level. If can assure that your server does not receive beyond the benchmarked limits, it is the choice. For this, you may want to use a rate weighted load-balancer in front of your application. This will help you to scale your system easily as well. Initializing heavily loaded Mnesia, loops, selective receive on heavy message queues and lots of parallel heavy processing are also come culprits of 100% CPU. I would write my own process, instead of gen_server, for performance critical applications. Kind Regards, Kannan. On Tue, Apr 17, 2012 at 9:30 PM, John-Paul Bader wrote: > Quick Update: > > > In our quest to find the potential bottlenecks we started benchmarking > {active, false} vs {active, once} vs {active, true}. > > We used a rate limited client and measured how many packets were actually > handled on the server. Note that when we say 40000 packets/s the client > would send a burst of 40000 packets and then sleep the remaining time of > that very second. > > {active, once} was the worst, losing up to 50% packets > {active, false} was much better but still losing up to 25% packets > {active, true} was the clear winner with no packet loss at 100000 packets > per second. When using two clients at 100k/s it started losing packets but > it was still reasonable given the amount of packets. > > Also the VM stayed below 100% CPU and did not increase memory consumption, > staying stable below 23MB > > The server is using active, true and passes the message instantly to > another process which does the actual work on another thread. > > Also, we ran these benchmarks on the same machine and sent / received all > packets via the loopback interface. The next benchmarks could be run from > different machines and also with a more sophisticated client that doesn't > send the packets in bursts to see if that changes anything. > > During the tests we played with read_packets and recbuf settings but it > appeared to have little or no effect at all but we will continue to play > around with that. > > ~ John > > Chandru wrote: > >> Hi John, >> >> In the steady state, we have about 2000/sec, but in error situations, >> we've had peaks of up to 20000 packets / sec. >> >> cheers >> Chandru >> >> On 16 April 2012 10:31, John-Paul Bader > > wrote: >> >> Hey Chandru, >> >> how many packets per second did you have to deal with and how big >> are they? Just to have something to compare to. >> >> ~ John >> >> Chandru wrote: >> >> Hi John, >> >> Our RADIUS server which handles our data network is written in >> Erlang. >> We've experimented with various values of recbuf and read_packets >> options for the UDP socket. We also use {active, once}. The >> receiving >> process receives a packet and spawns a new process to handle it. >> That is >> all it does. The spawned process then executes the rest of the >> business >> logic. >> >> That won't be your problem. The problem will be to make sure >> your system >> is stable while handling all those packets. We use overload >> control at >> the receiver. You have to pretty much look at the entire >> execution path >> for each packet and ensure there are no bottlenecks. At that kind >> of >> load, every little bottleneck shows up sooner or later. >> >> cheers >> Chandru >> >> On 15 April 2012 19:08, John-Paul Bader > >> >> wrote: >> >> Dear list, >> >> >> I'm currently writing a bittorrent tracker in Erlang. While >> a naive >> implementation of the protocol is quite easy, there are some >> performance related challanges where I could use some help. >> >> In the first test run as a replacement for a very popular >> tracker, >> my erlang tracker got about 40k requests per second. >> >> My initial approach was to initialize the socket in one >> process with >> {active, once}, handle the message in handle_info with minimal >> effort and pass the data asynchronously to a freshly spawned >> worker >> processes which responds to the clients. After spawning the >> process >> I'm setting the socket back to {active, once}. >> >> Now when I switched the erlang tracker live the erlang vm was >> topping at 100% CPU load. My guess is that the process >> handling the >> udp packets from the socket could not keep up. Since I'm >> still quite >> new to the world of erlang I'd like to know if there are >> some best >> practices / patterns to handle this massive amount of packets. >> >> For example using the socket in {active, once} might be too >> slow? >> Also the response to the clients needs to come from the same >> port as >> the request was coming in. Is it a problem to use the same >> socket >> for that? Should I pre-spawn a couple of thousand workers and >> dispatch the data from the socket to them rather than >> spawning them >> on each packet? >> >> It would be really great if you could give some advice or >> point me >> into the right directions. >> >> ~ John >> ______________________________**_____________________ >> >> erlang-questions mailing list >> erlang-questions@REDACTED >> > >> >> >> >> >> http://erlang.org/mailman/____**listinfo/erlang-questions >> >> > >> >> >> >> >> >> >> >> ______________________________**___________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> > >> http://erlang.org/mailman/__**listinfo/erlang-questions >> >> > >> >> >> ______________________________**_________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/**listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kostis@REDACTED Wed Apr 18 10:09:18 2012 From: kostis@REDACTED (Kostis Sagonas) Date: Wed, 18 Apr 2012 10:09:18 +0200 Subject: [erlang-questions] HiPE on ARM Build Issue In-Reply-To: References: <4F89317F.80002@cs.ntua.gr> Message-ID: <4F8E76AE.60805@cs.ntua.gr> On 04/17/2012 03:03 AM, Andrew Wiley wrote: > After some off-list work with Kostis' help, it looks like HiPE native > compilation works for my sample program, but if I use native libraries, > the VM segfaults. So ARMv7 is mostly working, but the codegen isn't > quite correct (which makes sense because the platform is untested). > > I described the needed change to configure.in ; > where would I submit a patch? Since nobody answered so far (at least in the list) the procedure to submit patches can be found in the following page: https://github.com/erlang/otp/wiki/Submitting-patches Kostis From emeka_1978@REDACTED Wed Apr 18 10:19:43 2012 From: emeka_1978@REDACTED (eigenfunction) Date: Wed, 18 Apr 2012 01:19:43 -0700 (PDT) Subject: [erlang-questions] tcp server benchmark Message-ID: There has been a lot of mails recently about benchmarking stuff. Now i am faced with the task of benchmarking a tcp server so i am curious. Is there any simple way out there to benchmark an erlang tcp server without having to hack some linux script? I was expecting it to be a simple task but after i started writing the client, i had to stop a think first about what exactly i want to measure. single client sending 1000 messages vs 1000 clients sending 1 messages vs multicore vs single core and it is getting more and more complicated as i think about it. How do you guys go about it? Thanks. From max.lapshin@REDACTED Wed Apr 18 11:16:26 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Wed, 18 Apr 2012 13:16:26 +0400 Subject: [erlang-questions] Erlang multicore on AMD: 24 cores (48 pseudocores) Message-ID: Hi. I have a computing task, which can be parallelized into 50 independent tasks. I want to buy an 24 core Opteron-based computer for this and I want to understand, if erlang will be able to use all these cores effectively. This task is launched as 50 independent processes that just work with their private set of data. Maybe it is better to buy 6 computers with 4-core intel core i5, or better to test? From vasdeveloper@REDACTED Wed Apr 18 12:29:59 2012 From: vasdeveloper@REDACTED (Kannan) Date: Wed, 18 Apr 2012 15:59:59 +0530 Subject: [erlang-questions] tcp server benchmark In-Reply-To: References: Message-ID: Hi, It depends on what do you want to benchmark the system for. If you are benchmarking at the TCP level, you are comparing some parameters, like performance, of Erlang TCP implementation to that of another, say, C/C++, OR asserting the functional capacity of the Erlang TCP implementation, often you many want to benchmark by changing the environment, like OS, number of CPU cores, number of worker processes, just to mention a few. What you want to benchmark really depends on the objectives and QoS parameters of your final system. You will have decide on that first, before even thinking of benchmarking. There are load-generators available on the internet to stress-test your server, at various protocol layers. TCP is a stream oriented protocol, and your concept of 'messages' is irrelevant. Kind Regards, Kannan. On Wed, Apr 18, 2012 at 1:49 PM, eigenfunction wrote: > There has been a lot of mails recently about benchmarking stuff. Now i > am faced with the task of benchmarking a tcp server so i am curious. > Is there any simple way out there to benchmark an erlang tcp server > without having to hack some linux script? I was expecting it to be a > simple task but after i started writing the client, i had to stop a > think first about what exactly i want to measure. single client > sending 1000 messages vs 1000 clients sending 1 messages vs multicore > vs single core and it is getting more and more complicated as i think > about it. How do you guys go about it? > Thanks. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmkolesnikov@REDACTED Wed Apr 18 12:30:28 2012 From: dmkolesnikov@REDACTED (dmitry kolesnikov) Date: Wed, 18 Apr 2012 13:30:28 +0300 Subject: [erlang-questions] tcp server benchmark In-Reply-To: References: Message-ID: <6312784290131046379@unknownmsgid> Hello, I would recommend to look into tsung as a benchmark tool. Inet is full of doc how to benchmark http but you can do tcp as well through a raw session or even write you own protocol plugin. In terms of benchmark methodology... This sole depends on your use-case. If you do server to server solution then one connection and 1000 messages. If you do a consumer product then visa verse. Best Regards, Dmitry >-|-|-*> On 18.4.2012, at 11.19, eigenfunction wrote: > There has been a lot of mails recently about benchmarking stuff. Now i > am faced with the task of benchmarking a tcp server so i am curious. > Is there any simple way out there to benchmark an erlang tcp server > without having to hack some linux script? I was expecting it to be a > simple task but after i started writing the client, i had to stop a > think first about what exactly i want to measure. single client > sending 1000 messages vs 1000 clients sending 1 messages vs multicore > vs single core and it is getting more and more complicated as i think > about it. How do you guys go about it? > Thanks. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From vasdeveloper@REDACTED Wed Apr 18 12:57:19 2012 From: vasdeveloper@REDACTED (Kannan) Date: Wed, 18 Apr 2012 16:27:19 +0530 Subject: [erlang-questions] Erlang multicore on AMD: 24 cores (48 pseudocores) In-Reply-To: References: Message-ID: Hi, If you have required number of processes with sufficient processing, Erlang VM makes sure that all the cores are used. If you have "naturally independent" tasks, you can get them done be independent process -- 50 or other number. Putting all the cores in one machine VS having many machines totaling the same number of cores, must be made based on your performance, scalability and availability(redundancy) requirements. In a production environment, generally, required redundancy is provided by an active or standby redundant units. In an active-active setup, all the boxes are processing at any given time, and when one fails, other box/boxes will handle the load. I.e. the taking over box will have the capacity to process its traffic and the traffic diverted from the failed box. Hope this helps. Kind Regards, Kannan. On Wed, Apr 18, 2012 at 2:46 PM, Max Lapshin wrote: > Hi. > > I have a computing task, which can be parallelized into 50 independent > tasks. > I want to buy an 24 core Opteron-based computer for this and I want to > understand, if erlang will be able to use all these > cores effectively. This task is launched as 50 independent processes > that just work with their private set of data. > > Maybe it is better to buy 6 computers with 4-core intel core i5, or > better to test? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vasdeveloper@REDACTED Wed Apr 18 13:08:13 2012 From: vasdeveloper@REDACTED (Kannan) Date: Wed, 18 Apr 2012 16:38:13 +0530 Subject: [erlang-questions] Erlang multicore on AMD: 24 cores (48 pseudocores) In-Reply-To: References: Message-ID: You may want to have a loot at the 'Emulator Flags' section under ERL, in the Erlang/OTP documentation. On Wed, Apr 18, 2012 at 4:27 PM, Kannan wrote: > Hi, > > If you have required number of processes with sufficient processing, > Erlang VM makes sure that all the cores are used. > > If you have "naturally independent" tasks, you can get them done be > independent process -- 50 or other number. Putting all the cores in one > machine VS having many machines totaling the same number of cores, must be > made based on your performance, scalability and availability(redundancy) > requirements. > > In a production environment, generally, required redundancy is provided by > an active or standby redundant units. In an active-active setup, all the > boxes are processing at any given time, and when one fails, other box/boxes > will handle the load. I.e. the taking over box will have the capacity to > process its traffic and the traffic diverted from the failed box. > > Hope this helps. > > Kind Regards, > Kannan. > > > On Wed, Apr 18, 2012 at 2:46 PM, Max Lapshin wrote: > >> Hi. >> >> I have a computing task, which can be parallelized into 50 independent >> tasks. >> I want to buy an 24 core Opteron-based computer for this and I want to >> understand, if erlang will be able to use all these >> cores effectively. This task is launched as 50 independent processes >> that just work with their private set of data. >> >> Maybe it is better to buy 6 computers with 4-core intel core i5, or >> better to test? >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dgud@REDACTED Wed Apr 18 14:21:06 2012 From: dgud@REDACTED (Dan Gudmundsson) Date: Wed, 18 Apr 2012 14:21:06 +0200 Subject: [erlang-questions] Ssl tuning In-Reply-To: <4F88453B.4020405@yandex-team.ru> References: <4F88453B.4020405@yandex-team.ru> Message-ID: We saw that on the client side, (and came up with same things as you) I havn't seen the same issue on the server side, but maybe I just managed to load the server hard enough. Give me a couple of days and I'll get back to you /Dan On Fri, Apr 13, 2012 at 5:24 PM, Sergei Fomin wrote: > Hello. > > We tried some load testing of erlang ssl and have some questions. > > The bench is Xeon with 24 cores, otp R15B and modified mochweb server. > Mochiweb acceptor is modified to do gen_tcp:accept, start new acceptor and > call ssl:ssl_accept. Original mochiweb acceptor calls ssl:transport_accept, > ssl:ssl_accept and only then spawns new acceptor. > The server accepts requests and answers 200 immediately. > > First iteration. > When load rate reached 1300 rps ssl_connection_sup process began to > accumulate message queue. > > Second iteration. > I moved all ssl_connection initialization code from init to separate > function, the call to which was triggered by message send from init (simply > delayed init). This way ssl_connection_sup was just spawning ssl_connection > process and sending init message to it. > Ssl_manager process became the new bottleneck. The threshold load rate > increased insignificantly. > > According to top all cores had load ~60%. > > Any ideas how to tune ssl noninvasively to achieve more results? > > -- > Sergei Fomin > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From dmkolesnikov@REDACTED Wed Apr 18 15:33:35 2012 From: dmkolesnikov@REDACTED (dmitry kolesnikov) Date: Wed, 18 Apr 2012 16:33:35 +0300 Subject: [erlang-questions] Erlang multicore on AMD: 24 cores (48 pseudocores) In-Reply-To: References: Message-ID: <3636582534585078173@unknownmsgid> I would go with horizontal scalability unless you have a strickt hosting requirement. 6 node approach gives better redundancy and you can try you setup on EC2 before any serious investments. Actually you can try both options on EC2. Best Regards, Dmitry >-|-|-*> On 18.4.2012, at 12.16, Max Lapshin wrote: > Hi. > > I have a computing task, which can be parallelized into 50 independent tasks. > I want to buy an 24 core Opteron-based computer for this and I want to > understand, if erlang will be able to use all these > cores effectively. This task is launched as 50 independent processes > that just work with their private set of data. > > Maybe it is better to buy 6 computers with 4-core intel core i5, or > better to test? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From dmitrii@REDACTED Wed Apr 18 15:53:40 2012 From: dmitrii@REDACTED (Dmitrii Dimandt) Date: Wed, 18 Apr 2012 15:53:40 +0200 Subject: [erlang-questions] Erlang future dict structure Message-ID: <13D128F6-999F-4720-8282-C315F5037774@dmitriid.com> Hi all, I remember some time ago someone (Kenneth Lundin) posted an email in which he talked about OTP team's evaluation of various data structures suitable for a unified future dict structure in Erlang. And I can't find it :) Can anyone find it for me? :) Thank you! From mononcqc@REDACTED Wed Apr 18 16:56:44 2012 From: mononcqc@REDACTED (Fred Hebert) Date: Wed, 18 Apr 2012 10:56:44 -0400 Subject: [erlang-questions] Erlang future dict structure In-Reply-To: <13D128F6-999F-4720-8282-C315F5037774@dmitriid.com> References: <13D128F6-999F-4720-8282-C315F5037774@dmitriid.com> Message-ID: <4F8ED62C.8050900@ferd.ca> That was his talk at the 2011 EUC in Stockholm (http://www.erlang-factory.com/conference/ErlangUserConference2011/speakers/KennethLundin) On Wed Apr 18 09:53:40 2012, Dmitrii Dimandt wrote: > Hi all, > > I remember some time ago someone (Kenneth Lundin) posted an email in which he talked about OTP team's evaluation of various data structures suitable for a unified future dict structure in Erlang. > > And I can't find it :) > > Can anyone find it for me? :) > > Thank you! > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From gumm@REDACTED Wed Apr 18 17:33:20 2012 From: gumm@REDACTED (Jesse Gumm) Date: Wed, 18 Apr 2012 10:33:20 -0500 Subject: [erlang-questions] Erlang future dict structure In-Reply-To: <4F8ED62C.8050900@ferd.ca> References: <13D128F6-999F-4720-8282-C315F5037774@dmitriid.com> <4F8ED62C.8050900@ferd.ca> Message-ID: Here's what I think is the thread you're talking about: http://groups.google.com/group/erlang-programming/browse_thread/thread/8e2ca3c1430ca157 -- Jesse Gumm Owner, Sigma Star Systems 414.940.4866 www.sigma-star.com @jessegumm On Apr 18, 2012 9:56 AM, "Fred Hebert" wrote: > That was his talk at the 2011 EUC in Stockholm (http://www.erlang-factory. > **com/conference/**ErlangUserConference2011/**speakers/KennethLundin > ) > > On Wed Apr 18 09:53:40 2012, Dmitrii Dimandt wrote: > >> Hi all, >> >> I remember some time ago someone (Kenneth Lundin) posted an email in >> which he talked about OTP team's evaluation of various data structures >> suitable for a unified future dict structure in Erlang. >> >> And I can't find it :) >> >> Can anyone find it for me? :) >> >> Thank you! >> >> >> ______________________________**_________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/**listinfo/erlang-questions >> > ______________________________**_________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/**listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kenneth.lundin@REDACTED Wed Apr 18 18:34:20 2012 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Wed, 18 Apr 2012 18:34:20 +0200 Subject: [erlang-questions] How to handle a massive amount of UDP packets? In-Reply-To: References: <4F8B0E95.4060003@berlin.ccc.de> <4F8BE6FB.3020205@berlin.ccc.de> <4F8D93A9.3060303@berlin.ccc.de> Message-ID: Active, once is the recommended way to implement a server in both UDP and TCP. The use of active once is superior to the other alternatives from a programmatical standpoint, it is clean and robust. I don't recommend the use of active true or active false just for performance reasons, because it will cause other problems instead. We are currently working with improvements regarding active once for TCP since it obviously seems to be slower than necessary. Most probably it is the same with UDP and we will look into that as well. We don't think there need any significant performance difference between active once and the other alternatives and hope to have a solution confirming that soon (meaning r15b02 or 03) Regards Kenneth Erlang/OTP, Ericsson Den 18 apr 2012 06:10 skrev "Kannan" : > Hi John, > > {active, true} is the winner in performance, but it lacks throttling at > the OS level. If can assure that your server does not receive beyond the > benchmarked limits, it is the choice. For this, you may want to use a rate > weighted load-balancer in front of your application. This will help you to > scale your system easily as well. > > Initializing heavily loaded Mnesia, loops, selective receive on heavy > message queues and lots of parallel heavy processing are also come culprits > of 100% CPU. > > I would write my own process, instead of gen_server, for performance > critical applications. > > Kind Regards, > Kannan. > > > > On Tue, Apr 17, 2012 at 9:30 PM, John-Paul Bader wrote: > >> Quick Update: >> >> >> In our quest to find the potential bottlenecks we started benchmarking >> {active, false} vs {active, once} vs {active, true}. >> >> We used a rate limited client and measured how many packets were actually >> handled on the server. Note that when we say 40000 packets/s the client >> would send a burst of 40000 packets and then sleep the remaining time of >> that very second. >> >> {active, once} was the worst, losing up to 50% packets >> {active, false} was much better but still losing up to 25% packets >> {active, true} was the clear winner with no packet loss at 100000 >> packets per second. When using two clients at 100k/s it started losing >> packets but it was still reasonable given the amount of packets. >> >> Also the VM stayed below 100% CPU and did not increase memory >> consumption, staying stable below 23MB >> >> The server is using active, true and passes the message instantly to >> another process which does the actual work on another thread. >> >> Also, we ran these benchmarks on the same machine and sent / received all >> packets via the loopback interface. The next benchmarks could be run from >> different machines and also with a more sophisticated client that doesn't >> send the packets in bursts to see if that changes anything. >> >> During the tests we played with read_packets and recbuf settings but it >> appeared to have little or no effect at all but we will continue to play >> around with that. >> >> ~ John >> >> Chandru wrote: >> >>> Hi John, >>> >>> In the steady state, we have about 2000/sec, but in error situations, >>> we've had peaks of up to 20000 packets / sec. >>> >>> cheers >>> Chandru >>> >>> On 16 April 2012 10:31, John-Paul Bader >> > wrote: >>> >>> Hey Chandru, >>> >>> how many packets per second did you have to deal with and how big >>> are they? Just to have something to compare to. >>> >>> ~ John >>> >>> Chandru wrote: >>> >>> Hi John, >>> >>> Our RADIUS server which handles our data network is written in >>> Erlang. >>> We've experimented with various values of recbuf and read_packets >>> options for the UDP socket. We also use {active, once}. The >>> receiving >>> process receives a packet and spawns a new process to handle it. >>> That is >>> all it does. The spawned process then executes the rest of the >>> business >>> logic. >>> >>> That won't be your problem. The problem will be to make sure >>> your system >>> is stable while handling all those packets. We use overload >>> control at >>> the receiver. You have to pretty much look at the entire >>> execution path >>> for each packet and ensure there are no bottlenecks. At that kind >>> of >>> load, every little bottleneck shows up sooner or later. >>> >>> cheers >>> Chandru >>> >>> On 15 April 2012 19:08, John-Paul Bader >> >>> >> wrote: >>> >>> Dear list, >>> >>> >>> I'm currently writing a bittorrent tracker in Erlang. While >>> a naive >>> implementation of the protocol is quite easy, there are some >>> performance related challanges where I could use some help. >>> >>> In the first test run as a replacement for a very popular >>> tracker, >>> my erlang tracker got about 40k requests per second. >>> >>> My initial approach was to initialize the socket in one >>> process with >>> {active, once}, handle the message in handle_info with minimal >>> effort and pass the data asynchronously to a freshly spawned >>> worker >>> processes which responds to the clients. After spawning the >>> process >>> I'm setting the socket back to {active, once}. >>> >>> Now when I switched the erlang tracker live the erlang vm was >>> topping at 100% CPU load. My guess is that the process >>> handling the >>> udp packets from the socket could not keep up. Since I'm >>> still quite >>> new to the world of erlang I'd like to know if there are >>> some best >>> practices / patterns to handle this massive amount of packets. >>> >>> For example using the socket in {active, once} might be too >>> slow? >>> Also the response to the clients needs to come from the same >>> port as >>> the request was coming in. Is it a problem to use the same >>> socket >>> for that? Should I pre-spawn a couple of thousand workers and >>> dispatch the data from the socket to them rather than >>> spawning them >>> on each packet? >>> >>> It would be really great if you could give some advice or >>> point me >>> into the right directions. >>> >>> ~ John >>> ______________________________**_____________________ >>> >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> > >>> >>> >>> >> >>> http://erlang.org/mailman/____**listinfo/erlang-questions >>> >>> > >>> >>> >>> >> >>> >>> >>> >>> ______________________________**___________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> > >>> http://erlang.org/mailman/__**listinfo/erlang-questions >>> >>> > >>> >>> >>> ______________________________**_________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/**listinfo/erlang-questions >> > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From magnus.klaar@REDACTED Wed Apr 18 18:54:11 2012 From: magnus.klaar@REDACTED (Magnus Klaar) Date: Wed, 18 Apr 2012 18:54:11 +0200 Subject: [erlang-questions] tcp server benchmark In-Reply-To: References: Message-ID: HI! If you want to go from zero to meaningful results quickly I can't recommend basho bench enough. I had to benchmark cowboy recently to verify whether a change actually had positive effects or not. Every ... single .. tool i tried left me wondering if I should just pretend that an average of the throughput and response times is good enough and move on. Don't fall into that trap, it's really easy to write a test driver or two in erlang to test the scenarios you're interested in. Never tried Tsung, I guess it's alright as well once you get into it. MVH Magnus On Wed, Apr 18, 2012 at 10:19 AM, eigenfunction wrote: > There has been a lot of mails recently about benchmarking stuff. Now i > am faced with the task of benchmarking a tcp server so i am curious. > Is there any simple way out there to benchmark an erlang tcp server > without having to hack some linux script? I was expecting it to be a > simple task but after i started writing the client, i had to stop a > think first about what exactly i want to measure. single client > sending 1000 messages vs 1000 clients sending 1 messages vs multicore > vs single core and it is getting more and more complicated as i think > about it. How do you guys go about it? > Thanks. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Wed Apr 18 19:07:28 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Wed, 18 Apr 2012 21:07:28 +0400 Subject: [erlang-questions] Erlang multicore on AMD: 24 cores (48 pseudocores) In-Reply-To: <3636582534585078173@unknownmsgid> References: <3636582534585078173@unknownmsgid> Message-ID: How can I test different bare metal devices on EC2? On Wednesday, April 18, 2012, dmitry kolesnikov wrote: > I would go with horizontal scalability unless you have a strickt > hosting requirement. 6 node approach gives better redundancy and you > can try you setup on EC2 before any serious investments. > > Actually you can try both options on EC2. > > Best Regards, > Dmitry >-|-|-*> > > > On 18.4.2012, at 12.16, Max Lapshin > > wrote: > > > Hi. > > > > I have a computing task, which can be parallelized into 50 independent > tasks. > > I want to buy an 24 core Opteron-based computer for this and I want to > > understand, if erlang will be able to use all these > > cores effectively. This task is launched as 50 independent processes > > that just work with their private set of data. > > > > Maybe it is better to buy 6 computers with 4-core intel core i5, or > > better to test? > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gleber.p@REDACTED Wed Apr 18 19:18:02 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Wed, 18 Apr 2012 19:18:02 +0200 Subject: [erlang-questions] Erlang multicore on AMD: 24 cores (48 pseudocores) In-Reply-To: References: <3636582534585078173@unknownmsgid> Message-ID: On Wed, Apr 18, 2012 at 19:07, Max Lapshin wrote: > How can I test different bare metal devices on EC2? Max, you can try Newservers, which is "bare metal cloud" From max.lapshin@REDACTED Wed Apr 18 20:03:45 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Wed, 18 Apr 2012 22:03:45 +0400 Subject: [erlang-questions] Erlang multicore on AMD: 24 cores (48 pseudocores) In-Reply-To: References: <3636582534585078173@unknownmsgid> Message-ID: > (how many rows can we process per hour for $25,000...) in our case, bigger > more specialized machines crushed a far greater number of cheap machines for > the same dollar amount). > Ok, lets discuss this interesting moment. It is possible to buy cheap Core i7 box in Moscow for $700. AMD Opteron with 64 cores costs $7100 in Moscow. So it is $110 per core for 2,2GHz AMD and $175 per core for 3,6GHz Intel. Even if not to speak about power consumption and don't discuss frequencies, I'm afraid that 64 cores will fight for the same memory bus and other PC resources. So perhaps there is some limit in multicoring? It is very interesting that your results show that more cores in single box are always better. Maybe there is some communication between tasks in your processing code? From max.lapshin@REDACTED Wed Apr 18 20:06:15 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Wed, 18 Apr 2012 22:06:15 +0400 Subject: [erlang-questions] How to handle a massive amount of UDP packets? In-Reply-To: References: <4F8B0E95.4060003@berlin.ccc.de> <4F8BE6FB.3020205@berlin.ccc.de> <4F8D93A9.3060303@berlin.ccc.de> Message-ID: I have some experience in serving gigabits from erlang node, so I can say that {active,once} in TCP has one big problem: you cannot say to driver "don't bother me each 1548 bytes, collect 2 megabytes and send them to me at once". Usually you have to choose: either small latency, either high throughput. Saying {active, once, 1024*1024} will be a great way to make webserver better. From zabrane3@REDACTED Wed Apr 18 20:08:12 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Wed, 18 Apr 2012 20:08:12 +0200 Subject: [erlang-questions] "Securing" code in Erlang when deployed on customer's machines Message-ID: <47C1F0EA-D7E2-46B0-96FB-DF65190CED84@gmail.com> Hi guys, We're planning to deploy our proprietary HTTP/1.1 WebServer (of course in Erlang ;-)) on a customer website next month. For that, we would like to create a licensing system to ensure that it will not be deployed elsewhere. Someone offlist told me that "QuickCheck" has a very good licensing system to protect their code and manage the number of allowed users. Unfortunately, I don't know how it works. Any hints? Any code? Regards, Zabrane From emeka_1978@REDACTED Wed Apr 18 20:25:43 2012 From: emeka_1978@REDACTED (emeka okafor) Date: Wed, 18 Apr 2012 11:25:43 -0700 (PDT) Subject: [erlang-questions] tcp server benchmark In-Reply-To: Message-ID: <1334773543.5278.YahooMailClassic@web114213.mail.gq1.yahoo.com> I did not know about that basho bench. I went to check the documentation and half way through it, i can say that i am moving basho bench high up in my priority list.Thanks for the pointer. --- On Wed, 4/18/12, Magnus Klaar wrote: From: Magnus Klaar Subject: Re: [erlang-questions] tcp server benchmark To: "eigenfunction" Cc: erlang-questions@REDACTED Date: Wednesday, April 18, 2012, 11:54 AM HI! If you want to go from zero to meaningful results quickly I can't recommend basho bench enough. I had to benchmark cowboy recently to verify whether a change actually had positive effects or not. Every ... single .. tool i tried left me wondering if I should just pretend that an average of the throughput and response times is good enough and move on. Don't fall into that trap, it's really easy to write a test driver or two in erlang to test the scenarios you're interested in. Never tried Tsung, I guess it's alright as well once you get into it. MVH Magnus On Wed, Apr 18, 2012 at 10:19 AM, eigenfunction wrote: There has been a lot of mails recently about benchmarking stuff. Now i am faced with the task of benchmarking a tcp server so i am curious. Is there any simple way out there to benchmark an erlang tcp server without having to hack some linux script? I was expecting it to be a simple task but after i started writing the client, i had to stop a think first about what exactly i want to measure. single client sending 1000 messages vs 1000 clients sending 1 messages vs multicore vs single core and it is getting more and more complicated as i think about it. How do you guys go about it? Thanks. _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From chandrashekhar.mullaparthi@REDACTED Wed Apr 18 21:00:27 2012 From: chandrashekhar.mullaparthi@REDACTED (Chandru) Date: Wed, 18 Apr 2012 20:00:27 +0100 Subject: [erlang-questions] "Securing" code in Erlang when deployed on customer's machines In-Reply-To: <47C1F0EA-D7E2-46B0-96FB-DF65190CED84@gmail.com> References: <47C1F0EA-D7E2-46B0-96FB-DF65190CED84@gmail.com> Message-ID: The problem with the Quickcheck licensing model (the last time I checked) is that it requires a connection from the server running the code to Quviq's license servers. This is not always possible. If you have this luxury, then just setup an SSL connection to your licensing server and check the license using the MAC address. The MAC address can be spoofed, but it probably won't scale if someone really wants to rip you off. I'm not aware of a bullet proof way of enforcing license checks on a stand alone system. I've tried, but it just raises the bar I think, not make it impossible :-) cheers Chandru On 18 April 2012 19:08, Zabrane Mickael wrote: > Hi guys, > > We're planning to deploy our proprietary HTTP/1.1 WebServer (of course in > Erlang ;-)) on a customer website > next month. > > For that, we would like to create a licensing system to ensure that it > will not be deployed elsewhere. > > Someone offlist told me that "QuickCheck" has a very good licensing system > to protect their code > and manage the number of allowed users. Unfortunately, I don't know how it > works. > > Any hints? Any code? > > Regards, > Zabrane > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Wed Apr 18 21:09:08 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Wed, 18 Apr 2012 21:09:08 +0200 Subject: [erlang-questions] "Securing" code in Erlang when deployed on customer's machines In-Reply-To: References: <47C1F0EA-D7E2-46B0-96FB-DF65190CED84@gmail.com> Message-ID: Thanks Chandru. Any other hint? Regards, Zabrane On Apr 18, 2012, at 9:00 PM, Chandru wrote: > The problem with the Quickcheck licensing model (the last time I checked) is that it requires a connection from the server running the code to Quviq's license servers. This is not always possible. If you have this luxury, then just setup an SSL connection to your licensing server and check the license using the MAC address. > > The MAC address can be spoofed, but it probably won't scale if someone really wants to rip you off. > > I'm not aware of a bullet proof way of enforcing license checks on a stand alone system. I've tried, but it just raises the bar I think, not make it impossible :-) > > cheers > Chandru > > On 18 April 2012 19:08, Zabrane Mickael wrote: > Hi guys, > > We're planning to deploy our proprietary HTTP/1.1 WebServer (of course in Erlang ;-)) on a customer website > next month. > > For that, we would like to create a licensing system to ensure that it will not be deployed elsewhere. > > Someone offlist told me that "QuickCheck" has a very good licensing system to protect their code > and manage the number of allowed users. Unfortunately, I don't know how it works. > > Any hints? Any code? > > Regards, > Zabrane > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmkolesnikov@REDACTED Wed Apr 18 21:17:11 2012 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Wed, 18 Apr 2012 22:17:11 +0300 Subject: [erlang-questions] Erlang multicore on AMD: 24 cores (48 pseudocores) In-Reply-To: References: <3636582534585078173@unknownmsgid> Message-ID: <3B77C432-23FA-4C80-84B1-EE91C7C5B9F8@gmail.com> Hello, In some respect, Robert you are right regarding the choice of HW platform. By the end platform has to be optimized for your tasks, use-cases and hosting requirments... The final metric is cost per TX, cost per user.... I am not sure, what system you are developing but I am speaking form prism of Consumer Internet Services where horizontal scalability is only one sensible approach to carry on the traffic. Indeed, less nodes you have it is easy to manage and they often perform better due to local IPC, buses, caches, etc. On another hand, you have to invest into high-end HW to mitigate various bottleneck. As the result, high cost per user and more expensive to keep redundancy and scalability. Bunch of smaller CotS nodes might show worst performance but the system much more robust in terms of HW failure and bursty traffic. I would not worry about management... If you have 6+ nodes then management practices shall be automated. You start to follow up Erlang mantra "Let it fail". When I've tasked to build 60+ node Erlang cluster. First item in the task list was a collection of management tools to destroy and recover a nodes from scratch... Max, you have to answer couple of question for you self. 1. Where servers are hosted? 2. Is DC has enough facility for multiple node config? 3. What are the role of solution OLTP or Batch Jobs? 4. What are redundancy/availability requirements? 5. what are the traffic profiles? 6. what is you budget and solution life time? based on them you can make a proper decision. If you are just curios about Erlang performance. Vertical vs Horizontal then EC2 would be a good tools. I've been running Erlang evaluation on bare HW and EC2 (long time ago very old HW). For CPU bound load there is not big difference once CPU utilization below 60%. I think 4xLarge vs 1xHigh-CPU XL would be a good setup to validate scalability of your approach. - Dmitry On Apr 18, 2012, at 9:35 PM, Robert Melton wrote: > Might also be relevant -> http://www.cpubenchmark.net/cpu_value_available.html#multicpu > > On Wed, Apr 18, 2012 at 2:27 PM, Robert Melton wrote: > On Wed, Apr 18, 2012 at 2:03 PM, Max Lapshin wrote: > > (how many rows can we process per hour for $25,000...) in our case, bigger > > more specialized machines crushed a far greater number of cheap machines for > > the same dollar amount). > > > > Ok, lets discuss this interesting moment. > > It is possible to buy cheap Core i7 box in Moscow for $700. AMD > Opteron with 64 cores costs $7100 in Moscow. So it is $110 per core > for 2,2GHz AMD and $175 per core for 3,6GHz Intel. > > Even if not to speak about power consumption and don't discuss > frequencies, I'm afraid that 64 cores will fight for the same memory > bus and other PC resources. > > So perhaps there is some limit in multicoring? It is very interesting > that your results show that more cores in single box are always > better. Maybe there is some communication between tasks in your > processing code? > > First of all, which Opteron, and which 64 core configuration... I have been out of the shopping industry for a bit, but it was my understanding the Opteron still peaked at 16 core (6200). > > Secondly, there are more options than Core i7 versus Opteron... those two chips hardly represent the industry. You have to choose hardware that represents your problem well -- some problems can take advantage of the E7 set of Intel chips for example (10 core, 20 pseudocore) and good on chip cache. > > In our testing, we were lucky enough to have a quarter million in funding for R&D hardware, so we actually built 9 different setups, each very near 25k. But, I would broaden your considerations... maybe a greater number of i3 chips would be best, maybe i7 EEs, maybe the best value for you is monster E7-8870's. The i7 EE has 12 pseudocores and 15MB on chip cache on the high end versions now. > > You can use a site like: http://www.cpubenchmark.net/high_end_cpus.html#cpuvalue to find the best value in CPU power to dollars -- from scanning that, it looks like the best bet at this time is the AMD Athlon II X4 631 Quad-Core -- but consider that you have to build boxes around that CPU, and the value starts to fall away a bit, moreso if you have any I/O considerations. > > In our case, we had lots of different fairly close bottlenecks, including disk I/O, network I/O and CPU. Building fewer bigger machines let us spend a good bit on high end network cards and SSD and remain in budget... which at the end of the day is what matters. In our experience, the AMD "wrappers" (motherboard, etc) tended to run about 15% cheaper, so you might be able to use that as a sort of normalization for costing. > > If I was building the system today (we built ours sometime ago) -- I would probably start by looking at the i5-2400 and maybe the AMD Athlon II X4 (and see if you can built decent systems around it) ... your goal is to buy CPU bound work units as cheaply as possible, without inducing other bottlenecks (buy a system with terrible I/O and maybe I/O is your new bottleneck). > > -- > --Robert Melton > > > > -- > --Robert Melton -------------- next part -------------- An HTML attachment was scrubbed... URL: From vasdeveloper@REDACTED Thu Apr 19 09:32:26 2012 From: vasdeveloper@REDACTED (Kannan) Date: Thu, 19 Apr 2012 13:02:26 +0530 Subject: [erlang-questions] "Securing" code in Erlang when deployed on customer's machines In-Reply-To: References: <47C1F0EA-D7E2-46B0-96FB-DF65190CED84@gmail.com> Message-ID: Hi, We most often use combination of many techniques to prevent and detect piracy. Checking the environment of the software, e.g. OS parameters, hardware configuration, MAC address. These can be put on a encrypted 'Key File'. Also, some one time configurable customer specific parameters that are critical to the business logic can be put on this file instead of providing an interface to configure them. Prohibit system backup, allow only the data backup by providing a proprietary interface. Include system signature in the error logs and dumps. Keep track of the configuration changes in a log file. Allow some configuration changes only within a limited period of time. This time can be put in the key file. Timed checkpointing of the system signature to a licence server. Hope this helps to some extent. Kind Regards, Kannan. On Thu, Apr 19, 2012 at 12:39 AM, Zabrane Mickael wrote: > Thanks Chandru. > > Any other hint? > > Regards, > Zabrane > > On Apr 18, 2012, at 9:00 PM, Chandru wrote: > > The problem with the Quickcheck licensing model (the last time I checked) > is that it requires a connection from the server running the code to > Quviq's license servers. This is not always possible. If you have this > luxury, then just setup an SSL connection to your licensing server and > check the license using the MAC address. > > The MAC address can be spoofed, but it probably won't scale if someone > really wants to rip you off. > > I'm not aware of a bullet proof way of enforcing license checks on a stand > alone system. I've tried, but it just raises the bar I think, not make it > impossible :-) > > cheers > Chandru > > On 18 April 2012 19:08, Zabrane Mickael wrote: > >> Hi guys, >> >> We're planning to deploy our proprietary HTTP/1.1 WebServer (of course in >> Erlang ;-)) on a customer website >> next month. >> >> For that, we would like to create a licensing system to ensure that it >> will not be deployed elsewhere. >> >> Someone offlist told me that "QuickCheck" has a very good licensing >> system to protect their code >> and manage the number of allowed users. Unfortunately, I don't know how >> it works. >> >> Any hints? Any code? >> >> Regards, >> Zabrane >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dmitrii@REDACTED Thu Apr 19 09:49:03 2012 From: dmitrii@REDACTED (Dmitrii Dimandt) Date: Thu, 19 Apr 2012 09:49:03 +0200 Subject: [erlang-questions] Erlang future dict structure In-Reply-To: <63BE158E-BFB7-463D-8EFB-CB8B665BBCC9@dmitriid.com> References: <13D128F6-999F-4720-8282-C315F5037774@dmitriid.com> <4F8ED62C.8050900@ferd.ca> <63BE158E-BFB7-463D-8EFB-CB8B665BBCC9@dmitriid.com> Message-ID: I'm an idiot. It's the talk :) http://www.erlang-factory.com/upload/presentations/468/EUC_Hashes2011.pdf Thank you! > > Nah, it's not the talk and not the thread :) > > I clearly remember there was a list of possible implementations and benchmarking between them. > >> Here's what I think is the thread you're talking about: http://groups.google.com/group/erlang-programming/browse_thread/thread/8e2ca3c1430ca157 >> >> -- >> Jesse Gumm >> Owner, Sigma Star Systems >> 414.940.4866 >> www.sigma-star.com >> @jessegumm >> >> On Apr 18, 2012 9:56 AM, "Fred Hebert" wrote: >> That was his talk at the 2011 EUC in Stockholm (http://www.erlang-factory.com/conference/ErlangUserConference2011/speakers/KennethLundin) >> >> On Wed Apr 18 09:53:40 2012, Dmitrii Dimandt wrote: >> Hi all, >> >> I remember some time ago someone (Kenneth Lundin) posted an email in which he talked about OTP team's evaluation of various data structures suitable for a unified future dict structure in Erlang. >> >> And I can't find it :) >> >> Can anyone find it for me? :) >> >> Thank you! >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alanrevans@REDACTED Thu Apr 19 11:44:17 2012 From: alanrevans@REDACTED (Alan Evans) Date: Thu, 19 Apr 2012 10:44:17 +0100 Subject: [erlang-questions] tcp server benchmark In-Reply-To: References: Message-ID: By coincidence I have just completed building an Erlang/OTP tsung based load tester on an Amazon EC2 cloud server. It is a general purpose load tester that can be adapted to suit different IP protocols, I even have a working SCTP module! I am currently using this to load test a client's server, also within the Amazon cloud but there's no reason why it can't be used over the internet. I don't have any numbers yet as it's still a bit early but If anyone is interested in trying out 'Load Testing as a Service' then drop me an email. cheers AlanE On Wed, Apr 18, 2012 at 9:19 AM, eigenfunction wrote: > There has been a lot of mails recently about benchmarking stuff. Now i > am faced with the task of benchmarking a tcp server so i am curious. > Is there any simple way out there to benchmark an erlang tcp server > without having to hack some linux script? I was expecting it to be a > simple task but after i started writing the client, i had to stop a > think first about what exactly i want to measure. single client > sending 1000 messages vs 1000 clients sending 1 messages vs multicore > vs single core and it is getting more and more complicated as i think > about it. How do you guys go about it? > Thanks. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From andy.richards.iit@REDACTED Thu Apr 19 15:24:16 2012 From: andy.richards.iit@REDACTED (Andy Richards) Date: Thu, 19 Apr 2012 14:24:16 +0100 Subject: [erlang-questions] Null parameter for ODBC param_query Message-ID: <592B868E-2AA0-48AC-9833-66853698DE3E@googlemail.com> Hi all, I found this previous unanswered post to the mailing list and I now face the same problem.... http://erlang.2086793.n4.nabble.com/NULL-parameter-for-ODBC-param-query-td3226735.html > "Is it possible to use null values in a parameterised odbc param_query? > > example: odbc:param_query("exec User_Read ?", [{sql_integer, Param}]). % > Param is either an integer or null > > The odbc driver returns the 'null' atom when selecting rows, but I haven't > found a value that allows me to specify a null parameter ('null', 'NULL', > <<"null">>, etc...)" According to the documentation value = null | term() however an exception is thrown if the atom null is used? Has anyone come across this or are there any workarounds to this issue ? I've already patched the c portion of the odbc driver to resolve a socket issue under Linux so I'm wondering if this module is used much in the Erlang world? Many thanks, Andy. -------------- next part -------------- An HTML attachment was scrubbed... URL: From silver.buyer@REDACTED Thu Apr 19 15:51:18 2012 From: silver.buyer@REDACTED (Joseph Goldberg) Date: Thu, 19 Apr 2012 06:51:18 -0700 (PDT) Subject: [erlang-questions] (no subject) Message-ID: <1334843478.69936.YahooMailNeo@web121605.mail.ne1.yahoo.com> looking for erlang oprogrammer for metals trading platform. please skype me, my userid is :silverbuyer my email is silver.buyer@REDACTED -------------- next part -------------- An HTML attachment was scrubbed... URL: From silver.buyer@REDACTED Thu Apr 19 15:55:51 2012 From: silver.buyer@REDACTED (Joseph Goldberg) Date: Thu, 19 Apr 2012 06:55:51 -0700 (PDT) Subject: [erlang-questions] metals trading platform development in erlang In-Reply-To: <1334843478.69936.YahooMailNeo@web121605.mail.ne1.yahoo.com> References: <1334843478.69936.YahooMailNeo@web121605.mail.ne1.yahoo.com> Message-ID: <1334843751.16998.YahooMailNeo@web121604.mail.ne1.yahoo.com> Looking for erlang programmer for metals trading platform. Please skype me, my userid is :silverbuyer my email is silver.buyer@REDACTED, cheers! -------------- next part -------------- An HTML attachment was scrubbed... URL: From peerst@REDACTED Thu Apr 19 20:37:21 2012 From: peerst@REDACTED (Peer Stritzinger) Date: Thu, 19 Apr 2012 20:37:21 +0200 Subject: [erlang-questions] How to best debug init.erl? Message-ID: Hi, while porting Erlang to a embedded system with the RTEMS os I'm stuck currently with error exits in init.erl Example: {"init terminating in do_boot",{'cannot load',error_handler,get_file}} How can debug stuff like this? I'm loading the OS + Erlang with a JTAG debug box and gdb, debugging the C startup works fine this way but once I'm in Erlang code I'm blind. Currently I'm not getting crash dumps either (crash dumps not yet ported). I'm playing with "print debugging" -- adding erlang:display/1 calls which leads me to another problem and my second question: What do I have to do to rebuild with changes in init.erl ... especially for cross building. The way I'm building now looks like this: $ ./otp_build autoconf $ ./otp_build configure --xcomp-conf=xcomp/erl-xcomp-powerpc-rtems.conf --disable-threads --prefix=/otp $ ./otp_build boot -a $ rm -rf ~/export/otp; gmake install DESTDIR=$HOME/export The export/otp dir is NFS mounted to the target system. Even if I re-configure the changes in init.erl are not reflected on the target system. Cheers, -- Peer From peerst@REDACTED Thu Apr 19 21:06:48 2012 From: peerst@REDACTED (Peer Stritzinger) Date: Thu, 19 Apr 2012 21:06:48 +0200 Subject: [erlang-questions] How to best debug init.erl? In-Reply-To: References: Message-ID: On Thu, Apr 19, 2012 at 8:37 PM, Peer Stritzinger wrote: > What do I have to do to rebuild with changes in init.erl ... > especially for cross building. Small update to this part: I found $ ./otp_build update_preloaded Which rebuilds the preloaded files but then I get in trouble when I want to rebuild with $ ./otp_build boot -a I get errors like: ... * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ERROR: Trying to cross compile an Erlang/OTP-R15B system with a different * Erlang/{"load_mod",error_handler,"error_handler.beam"} ... Somehow update_preloaded seems to use the wrong Erlang version (my installed one?) From wallentin.dahlberg@REDACTED Thu Apr 19 21:11:38 2012 From: wallentin.dahlberg@REDACTED (=?ISO-8859-1?Q?Bj=F6rn=2DEgil_Dahlberg?=) Date: Thu, 19 Apr 2012 21:11:38 +0200 Subject: [erlang-questions] How to best debug init.erl? In-Reply-To: References: Message-ID: Do it like this instead: Hop down to erts/preloaded, 1. PATH=$ERL_TOP/bin:$PATH gmake 2. copy file from src to ebin 3. Hop to erts, remake beam, i.e make (check for preload.o to link) // Bj?rn-Egil Den 19 april 2012 21:06 skrev Peer Stritzinger : > On Thu, Apr 19, 2012 at 8:37 PM, Peer Stritzinger > wrote: > > What do I have to do to rebuild with changes in init.erl ... > > especially for cross building. > > Small update to this part: I found > > $ ./otp_build update_preloaded > > Which rebuilds the preloaded files but then I get in trouble when I > want to rebuild with > > $ ./otp_build boot -a > > I get errors like: > > ... > * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * > * * * > * ERROR: Trying to cross compile an Erlang/OTP-R15B system with a > different > * Erlang/{"load_mod",error_handler,"error_handler.beam"} > ... > > Somehow update_preloaded seems to use the wrong Erlang version (my > installed one?) > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lukas@REDACTED Thu Apr 19 21:14:46 2012 From: lukas@REDACTED (Lukas Larsson) Date: Thu, 19 Apr 2012 21:14:46 +0200 Subject: [erlang-questions] How to best debug init.erl? In-Reply-To: References: Message-ID: If you are cross compiling you probably want to set your bootstrap emulator in the path instead. It should be under $ERL_TOP/bootstrap/bin Lukas On Thu, Apr 19, 2012 at 9:11 PM, Bj?rn-Egil Dahlberg wrote: > Do it like this instead: > > Hop down to erts/preloaded, > 1. PATH=$ERL_TOP/bin:$PATH gmake > 2. copy file from src to ebin > 3. Hop to erts, remake beam, i.e make (check for preload.o to link) > > // Bj?rn-Egil > > Den 19 april 2012 21:06 skrev Peer Stritzinger : > >> On Thu, Apr 19, 2012 at 8:37 PM, Peer Stritzinger >> wrote: >> > What do I have to do to rebuild with changes in init.erl ... >> > especially for cross building. >> >> Small update to this part: I found >> >> ?$ ./otp_build update_preloaded >> >> Which rebuilds the preloaded files but then I get in trouble when I >> want to rebuild with >> >> ?$ ./otp_build boot -a >> >> I get errors like: >> >> ... >> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * >> * * * >> * ERROR: ? Trying to cross compile an Erlang/OTP-R15B system with a >> different >> * ? ? ? ? ?Erlang/{"load_mod",error_handler,"error_handler.beam"} >> ... >> >> Somehow update_preloaded seems to use the wrong Erlang version (my >> installed one?) >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From peerst@REDACTED Thu Apr 19 21:17:55 2012 From: peerst@REDACTED (Peer Stritzinger) Date: Thu, 19 Apr 2012 21:17:55 +0200 Subject: [erlang-questions] How to best debug init.erl? In-Reply-To: References: Message-ID: Hi, 2012/4/19 Bj?rn-Egil Dahlberg : > Any change to the files in erts/preloaded are a bit nasty. But not to worry, > no too nasty. =) > > After recompiling init.erl (or any other file in there) and moved it to > preloaded/ebin you need to remake the emulator. Preloaded, as the name > suggests, are compiled into the runtime. Specifically you need to recompile > preloaded.o and relink stuff. > > Relevant files: > ./emulator/i386-apple-darwin11.2.0/preload.c > ./emulator/i386-apple-darwin11.3.0/preload.c > ./emulator/obj/i386-apple-darwin11.2.0/opt/plain/preload.o > ./emulator/obj/i386-apple-darwin11.2.0/opt/smp/preload.o > ./emulator/obj/i386-apple-darwin11.3.0/opt/plain/preload.o > ./emulator/obj/i386-apple-darwin11.3.0/opt/smp/preload.o > ./emulator/utils/make_preload > > well subst darwin for your target. Isn't preload.c being rebuilt when doing ./otp_build boot -a ? > As for your earlier question, ERTS_SMP is for "enable multiple schedulers", > with what that entails, i.e. interprocess lockings, multiple runqueues etc. > > USE_THREADS are more or less for the async thread pool. I see. And the async thread pool probably also wants to know how many cores there are etc. At the moment I'm building without USE_THREADS since I'm not sure the async thread pool will help me much with my kind of OS and a single core. However I'm not really grokking the whole async I/O stuff. At the moment we only have a rather brittle select implementation but we are planning to port kqueues API to RTEMS. > Den 19 april 2012 20:37 skrev Peer Stritzinger : >> >> Hi, >> >> while porting Erlang to a embedded system with the RTEMS os I'm stuck >> currently with error exits in init.erl >> >> Example: >> >> {"init terminating in do_boot",{'cannot load',error_handler,get_file}} >> >> How can debug stuff like this? >> >> I'm loading the OS + Erlang with a JTAG debug box and gdb, debugging >> the C startup works fine this way but once I'm in Erlang code I'm >> blind. >> >> Currently I'm not getting crash dumps either (crash dumps not yet ported). >> >> I'm playing with "print debugging" -- adding erlang:display/1 calls >> which leads me to another problem and my second question: >> >> What do I have to do to rebuild with changes in init.erl ... >> especially for cross building. >> >> The way I'm building now looks like this: >> >> ?$ ?./otp_build autoconf >> ?$ ?./otp_build configure >> --xcomp-conf=xcomp/erl-xcomp-powerpc-rtems.conf --disable-threads >> --prefix=/otp >> ?$ ?./otp_build boot -a >> ?$ ?rm -rf ~/export/otp; gmake install DESTDIR=$HOME/export >> >> The export/otp dir is NFS mounted to the target system. >> >> Even if I re-configure the changes in init.erl are not reflected on >> the target system. >> >> Cheers, >> -- Peer >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > From peerst@REDACTED Thu Apr 19 22:23:53 2012 From: peerst@REDACTED (Peer Stritzinger) Date: Thu, 19 Apr 2012 22:23:53 +0200 Subject: [erlang-questions] How to best debug init.erl? In-Reply-To: References: Message-ID: 2012/4/19 Lukas Larsson : > If you are cross compiling you probably want to set your bootstrap > emulator in the path instead. It should be under > $ERL_TOP/bootstrap/bin Got it working with this. However "./otp_build boot -a" doesn't work after this I can only build with: $ gmake TARGET=powerpc-unknown-rtems4.11 all After changing any preloaded beams. Cheers, -- Peer > > Lukas > > On Thu, Apr 19, 2012 at 9:11 PM, Bj?rn-Egil Dahlberg > wrote: >> Do it like this instead: >> >> Hop down to erts/preloaded, >> 1. PATH=$ERL_TOP/bin:$PATH gmake >> 2. copy file from src to ebin >> 3. Hop to erts, remake beam, i.e make (check for preload.o to link) >> >> // Bj?rn-Egil >> >> Den 19 april 2012 21:06 skrev Peer Stritzinger : >> >>> On Thu, Apr 19, 2012 at 8:37 PM, Peer Stritzinger >>> wrote: >>> > What do I have to do to rebuild with changes in init.erl ... >>> > especially for cross building. >>> >>> Small update to this part: I found >>> >>> ?$ ./otp_build update_preloaded >>> >>> Which rebuilds the preloaded files but then I get in trouble when I >>> want to rebuild with >>> >>> ?$ ./otp_build boot -a >>> >>> I get errors like: >>> >>> ... >>> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * >>> * * * >>> * ERROR: ? Trying to cross compile an Erlang/OTP-R15B system with a >>> different >>> * ? ? ? ? ?Erlang/{"load_mod",error_handler,"error_handler.beam"} >>> ... >>> >>> Somehow update_preloaded seems to use the wrong Erlang version (my >>> installed one?) >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >> >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> From silver.buyer@REDACTED Fri Apr 20 02:17:41 2012 From: silver.buyer@REDACTED (Joseph Goldberg) Date: Thu, 19 Apr 2012 17:17:41 -0700 (PDT) Subject: [erlang-questions] reusable components Message-ID: <1334881061.25014.YahooMailNeo@web121605.mail.ne1.yahoo.com> ? we need to put erlang on the map, this close knit, not very in demand community must finally branch out, I propose snap in visual glue abstraction for erlang, that could create major interest and possilbe dominance for erlang. High level code for different fuctionalities, I have my own personal project that involves a broad range of technologies that I would donate every block of. Who wants erlang, I do, I do! Anyone interested in my project please contact me on skype, my userid is:silverbuyer or email me at silver.buyer@REDACTED -------------- next part -------------- An HTML attachment was scrubbed... URL: From jwatte@REDACTED Fri Apr 20 03:47:53 2012 From: jwatte@REDACTED (Jon Watte) Date: Thu, 19 Apr 2012 18:47:53 -0700 Subject: [erlang-questions] Error building OTP R15B01 Message-ID: I'm trying to build Erlang/OTP R15B01 from source, on Ubuntu Linux 10.04 LTS x64, using the "dh" debian wrapper tool for generating an internal package. When I "make install," I get the following error (this is very likely unrelated to the Debian tools): .... make[5]: Entering directory `/usr/local/src/erlang-otp-r15b01-0.1+imvu/lib/tools/emacs' /usr/bin/install -c -d /usr/local/src/erlang-otp-r15b01-0.1+imvu/debian/erlang-otp-r15b01/usr/lib/erlang/lib/tools-2.6.7/emacs /usr/bin/install -c -m 644 erlang-skels.el erlang-skels-old.el erlang_appwiz.el erlang-start.el erlang-eunit.el erlang-flymake.el erlang.el README test.erl.indented test.erl.orig \ /usr/local/src/erlang-otp-r15b01-0.1+imvu/debian/erlang-otp-r15b01/usr/lib/erlang/lib/tools-2.6.7/emacs /usr/bin/install: cannot stat `test.erl.orig': No such file or directory I configure with the following options: CFLAGS="-g -O2" CXXFLAGS="-g -O2" CPPFLAGS="-g -O2" ./configure --enable-hipe --enable-threads --enable-smp-support --enable-kernel-poll --enable-native-libs --without-javac --with-ssl --prefix=/usr Is this a known problem? Is there a recommended fix (other than just removing TEST_FILES from the emacs application makefile)? Sincerely, Jon Watte -- "I pledge allegiance to the flag of the United States of America, and to the republic for which it stands, one nation indivisible, with liberty and justice for all." ~ Adopted by U.S. Congress, June 22, 1942 -------------- next part -------------- An HTML attachment was scrubbed... URL: From jwatte@REDACTED Fri Apr 20 03:55:23 2012 From: jwatte@REDACTED (Jon Watte) Date: Thu, 19 Apr 2012 18:55:23 -0700 Subject: [erlang-questions] tcp server benchmark In-Reply-To: References: Message-ID: Benchmarks are only useful to judge the performance of the exact thing the benchmark is measuring. If you don't know what it is, exactly, that you want to measure, then any numbers you could come up with would possibly be totally meaningless, because numbers only have meaning when they influence decisions, and decisions are made based on specific requirements. So, start there: What decision are you going to make based on numbers? Then, you can figure out: What numbers do you actually need to make that decision? Then, you can figure out how to actually get THOSE numbers, and not some other numbers... Sincerely, Jon Watte -- "I pledge allegiance to the flag of the United States of America, and to the republic for which it stands, one nation indivisible, with liberty and justice for all." ~ Adopted by U.S. Congress, June 22, 1942 On Wed, Apr 18, 2012 at 1:19 AM, eigenfunction wrote: > There has been a lot of mails recently about benchmarking stuff. Now i > am faced with the task of benchmarking a tcp server so i am curious. > Is there any simple way out there to benchmark an erlang tcp server > without having to hack some linux script? I was expecting it to be a > simple task but after i started writing the client, i had to stop a > think first about what exactly i want to measure. single client > sending 1000 messages vs 1000 clients sending 1 messages vs multicore > vs single core and it is getting more and more complicated as i think > about it. How do you guys go about it? > Thanks. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jwatte@REDACTED Fri Apr 20 04:05:08 2012 From: jwatte@REDACTED (Jon Watte) Date: Thu, 19 Apr 2012 19:05:08 -0700 Subject: [erlang-questions] "Securing" code in Erlang when deployed on customer's machines In-Reply-To: <47C1F0EA-D7E2-46B0-96FB-DF65190CED84@gmail.com> References: <47C1F0EA-D7E2-46B0-96FB-DF65190CED84@gmail.com> Message-ID: Heavy anti-piracy engineering never works for popular software. If someone really wants to pirate your stuff, they will. They can clone the hard disks, and the hardware, and spin up as many virtual copies as they want. They can disassemble your binaries, and patch out the "branch-not-equal" you use to check any arbitrary condition. It's OK to put in a simple "lock" which "keeps honest users honest." Ideally, this lock is no hassle -- the more complex it is, the more likely your legitimate users are to actually use the cracked version of the software, even though they paid for it. If your system is anything more complex than, say, "every three hours, the system makes a HTTP request with some statistics to your web server, and if your web server doesn't answer OK, after three days the system will start slowing down requests" then you're probably solving the wrong problem. The alternative is to make software that nobody wants to pirate. But that's usually not a good long-term solution. Providing real value to your customers for being your customers is what's important, because if your customer makes more money when they pay you, than when they don't pay you, what do you think they're going to do? :-) And, finally -- if your work is really so much "secret sauce," then why don't you host it for the customer? Let the customer send you the content, and host it on a cloud infrastructure of some sort (Amazon, Heroku, Rackable, VMWare, etc.) That way, nobody sees the software except you. Sincerely, Jon Watte -- "I pledge allegiance to the flag of the United States of America, and to the republic for which it stands, one nation indivisible, with liberty and justice for all." ~ Adopted by U.S. Congress, June 22, 1942 On Wed, Apr 18, 2012 at 11:08 AM, Zabrane Mickael wrote: > Hi guys, > > We're planning to deploy our proprietary HTTP/1.1 WebServer (of course in > Erlang ;-)) on a customer website > next month. > > For that, we would like to create a licensing system to ensure that it > will not be deployed elsewhere. > > Someone offlist told me that "QuickCheck" has a very good licensing system > to protect their code > and manage the number of allowed users. Unfortunately, I don't know how it > works. > > Any hints? Any code? > > Regards, > Zabrane > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jwatte@REDACTED Fri Apr 20 04:09:19 2012 From: jwatte@REDACTED (Jon Watte) Date: Thu, 19 Apr 2012 19:09:19 -0700 Subject: [erlang-questions] HiPE on ARM Build Issue In-Reply-To: <4F89317F.80002@cs.ntua.gr> References: <4F89317F.80002@cs.ntua.gr> Message-ID: Maybe you can find a used Android cell phone somewhere? They typically have 256 MB RAM and as much "disk" as you can put on an MicroSD card. Or, for $35, the Raspberry Pi would be a nice little target. Linux, ARM, networking, desktop! Sincerely, Jon Watte -- "I pledge allegiance to the flag of the United States of America, and to the republic for which it stands, one nation indivisible, with liberty and justice for all." ~ Adopted by U.S. Congress, June 22, 1942 On Sat, Apr 14, 2012 at 1:12 AM, Kostis Sagonas wrote: > On 04/14/2012 09:24 AM, Andrew Wiley wrote: > >> On Sat, Apr 14, 2012 at 12:43 AM, Andrew Wiley > >> wrote: >> >> Hello, >> >> I'm trying to get Erlang with HiPE to build on an ARMv7 box (a >> Trimslice - http://trimslice.com/ ), and >> >> I'm getting an undefined reference to am_arm. I'm building R15B01, >> and the build commands I'm using are: >> ./otp_build autoconf >> ./configure --enable-native-libs --enable-hipe >> >> --prefix=/usr --enable-smp-support --enable-threads >> ./otp_build boot >> >> The build failure looks like this: >> ... >> >> >> It looks like am_x86 is declared in >> erts/emulator/armv7l-unknown-**linux-gnu/erl_atom_table.h; should >> am_arm be in there as well? >> I'm not sure what else would be helpful to diagnose this, but here's >> `uname -a`: >> Linux tseng 3.2.1-1-ARCH #1 SMP PREEMPT Sun Jan 22 06:37:13 UTC 2012 >> armv7l ARMv7 Processor rev 0 (v7l) trimslice GNU/Linux >> >> Just saw >> http://erlang.org/pipermail/**erlang-bugs/2006-December/**000268.htmland it >> looks like I'm having the same issue. Are there any plans to try to fix >> configure.in so that ARM builds like this either >> >> work or produce an error? >> > > In the HiPE team we would very much like to support the ARM architecture > but the problem these days - for quite some time actually - is that we do > not have access to any machine with an ARM processor. It's very painful to > be testing ARM using QEMU, esp. all sorts of different ARMs that exist > these days. Hence, occasionally code tends to rot or, as in this case which > involves a newer ARMv7, code has never been tested on newer architectures. > > (I do not know what sort of access to ARM machines the Erlang/OTP team at > Ericsson has, but I suspect that they do not have access to all possible > ARMs either.) > > In this particular case, I would recommend that you extend the following > lines in erts/configure.in > > armv5b) ARCH=arm;; > armv5teb) ARCH=arm;; > armv5tel) ARCH=arm;; > > with the line that corresponds to your newer armv7 and test to see what > happens. If all goes well, please submit a patch using git. > > Also, since you are on an unexplored territory, I would recommend to build > Erlang/OTP in two steps. First do: > > ./configure --enable-hipe ... > > which will test if Erlang/OTP can be built with HiPE support, and only if > that works do: > > make clean // or start from a fresh copy, for extra safety > ./configure --enable-hipe ... --enable-native-libs > > which will additionally test that the HiPE compiler generates correct > native code and is able to self-compile itself (as well as many of the > Erlang/OTP libraries: currently kernel, stdlib, compiler, syntax_tools, > hipe, dialyzer, and typer). > > In any case, please report your findings here. > > Kostis > > PS. We welcome support, for example, donations of ARM-based machines that > we can be using to test the HiPE compiler or its newer LLVM-based back-end > (see http://erllvm.softlab.ntua.gr/**) more regularly. Similar with other > exotic architectures that people these days care about. Minimally, if you > want native code for some configuration other than x86 and x86_64-based > machines, give us some form of remote access to it. > ______________________________**_________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/**listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jwatte@REDACTED Fri Apr 20 04:51:46 2012 From: jwatte@REDACTED (Jon Watte) Date: Thu, 19 Apr 2012 19:51:46 -0700 Subject: [erlang-questions] Erlang multicore on AMD: 24 cores (48 pseudocores) In-Reply-To: References: Message-ID: What is your bottleneck? Amount of DRAM? Available bandwidth to DRAM? L1, L2 or L3 cache? I/O? Floating point performance? Integer performance? Hard-to-predict branchy logic code? Depending on what the problem is you're trying to solve, different architectures and ways of slicing the work will perform differently. Sincerely, Jon Watte -- "I pledge allegiance to the flag of the United States of America, and to the republic for which it stands, one nation indivisible, with liberty and justice for all." ~ Adopted by U.S. Congress, June 22, 1942 On Wed, Apr 18, 2012 at 2:16 AM, Max Lapshin wrote: > Hi. > > I have a computing task, which can be parallelized into 50 independent > tasks. > I want to buy an 24 core Opteron-based computer for this and I want to > understand, if erlang will be able to use all these > cores effectively. This task is launched as 50 independent processes > that just work with their private set of data. > > Maybe it is better to buy 6 computers with 4-core intel core i5, or > better to test? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From avinash@REDACTED Fri Apr 20 08:24:42 2012 From: avinash@REDACTED (Avinash Dhumane) Date: Fri, 20 Apr 2012 11:54:42 +0530 Subject: [erlang-questions] Null parameter for ODBC param_query In-Reply-To: <592B868E-2AA0-48AC-9833-66853698DE3E@googlemail.com> References: <592B868E-2AA0-48AC-9833-66853698DE3E@googlemail.com> Message-ID: I use the ODBC application of Erlang (presently, on R14B02) quite heavily and with proprietary drivers like AS400 and Netezza. I rely on odbc:sql_query() - even with parameters - more than on odbc:param_query(). I use the latter only when to submit a batch of INSERTs. With former, I construct the SQL string by duly substituting all the parameter values and submit. So, the submission through ODBC becomes exactly same as I would do on the SQL command-line interface tool provided by the DBMS. Applying to your case, I would have done as follows: lists:flatten(io_lib:fwrite("exec User_Read ~w", [Param]) On Thu, 19 Apr 2012 18:54:16 +0530, Andy Richards wrote: > Hi all, > > I found this previous unanswered post to the mailing list and I now face > the same problem.... > > http://erlang.2086793.n4.nabble.com/NULL-parameter-for-ODBC-param-query-td3226735.html > >> "Is it possible to use null values in a parameterised odbc param_query? >> >> example: odbc:param_query("exec User_Read ?", [{sql_integer, Param}]). >> % >> Param is either an integer or null >> >> The odbc driver returns the 'null' atom when selecting rows, but I >> haven't >> found a value that allows me to specify a null parameter ('null', >> 'NULL', >> <<"null">>, etc...)" > > > According to the documentation value = null | term() however an > exception is thrown if the atom null is used? > > Has anyone come across this or are there any workarounds to this issue ? > > I've already patched the c portion of the odbc driver to resolve a > socket issue under Linux so I'm wondering if this module is used much in > the Erlang world? > > Many thanks, > > Andy. > > > -- Using Opera's revolutionary email client: http://www.opera.com/mail/ From ingela.andin@REDACTED Fri Apr 20 11:48:02 2012 From: ingela.andin@REDACTED (Ingela Andin) Date: Fri, 20 Apr 2012 11:48:02 +0200 Subject: [erlang-questions] Null parameter for ODBC param_query In-Reply-To: References: <592B868E-2AA0-48AC-9833-66853698DE3E@googlemail.com> Message-ID: Hi! The problem is that with param_query at the moment does not support all data types and null values that will be handled by sql_query. If someone wants this you are more then welcome to contribute. I can not see that this would get a high priority any time soon within Ericsson. Please submit your socket issue patch so that other people also can benefit from it. Regards Ingela Erlang/OTP team - Ericsson AB 2012/4/20, Avinash Dhumane : > I use the ODBC application of Erlang (presently, on R14B02) quite heavily > and with proprietary drivers like AS400 and Netezza. > > I rely on odbc:sql_query() - even with parameters - more than on > odbc:param_query(). I use the latter only when to submit a batch of > INSERTs. With former, I construct the SQL string by duly substituting all > the parameter values and submit. So, the submission through ODBC becomes > exactly same as I would do on the SQL command-line interface tool provided > by the DBMS. Applying to your case, I would have done as follows: > > lists:flatten(io_lib:fwrite("exec User_Read ~w", [Param]) > > On Thu, 19 Apr 2012 18:54:16 +0530, Andy Richards > wrote: > >> Hi all, >> >> I found this previous unanswered post to the mailing list and I now face >> the same problem.... >> >> http://erlang.2086793.n4.nabble.com/NULL-parameter-for-ODBC-param-query-td3226735.html >> >>> "Is it possible to use null values in a parameterised odbc param_query? >>> >>> example: odbc:param_query("exec User_Read ?", [{sql_integer, Param}]). >>> % >>> Param is either an integer or null >>> >>> The odbc driver returns the 'null' atom when selecting rows, but I >>> haven't >>> found a value that allows me to specify a null parameter ('null', >>> 'NULL', >>> <<"null">>, etc...)" >> >> >> According to the documentation value = null | term() however an >> exception is thrown if the atom null is used? >> >> Has anyone come across this or are there any workarounds to this issue ? >> >> I've already patched the c portion of the odbc driver to resolve a >> socket issue under Linux so I'm wondering if this module is used much in >> the Erlang world? >> >> Many thanks, >> >> Andy. >> >> >> > > > -- > Using Opera's revolutionary email client: http://www.opera.com/mail/ > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From andy.richards.iit@REDACTED Fri Apr 20 12:14:54 2012 From: andy.richards.iit@REDACTED (Andy Richards) Date: Fri, 20 Apr 2012 11:14:54 +0100 Subject: [erlang-questions] Null parameter for ODBC param_query In-Reply-To: References: <592B868E-2AA0-48AC-9833-66853698DE3E@googlemail.com> Message-ID: <16E44648-347B-4C57-950D-FB32D733FC2B@googlemail.com> Hi Avinash, That's useful thanks and gives me food for thought. We have many stored procs so I wouldn't know the param types before hand so I would need to dynamically construct our Format string with the appropriate types... E.g. lists:flatten(io_lib:fwrite("exec User_Read ~w, ~s, ~f", [Param, "some string", 0.1]) I'm not sure what the overhead would be but I could cache the string once constructed the first time. Do you find fwrite performant enough replacing parameters? I think we going to build a custom approach which will handle bits and sqlserver default values and perhaps your approach as you suggest. Many thanks, Andy. Sent from my iPad On 20 Apr 2012, at 07:24, "Avinash Dhumane" wrote: > I use the ODBC application of Erlang (presently, on R14B02) quite heavily > and with proprietary drivers like AS400 and Netezza. > > I rely on odbc:sql_query() - even with parameters - more than on > odbc:param_query(). I use the latter only when to submit a batch of > INSERTs. With former, I construct the SQL string by duly substituting all > the parameter values and submit. So, the submission through ODBC becomes > exactly same as I would do on the SQL command-line interface tool provided > by the DBMS. Applying to your case, I would have done as follows: > > lists:flatten(io_lib:fwrite("exec User_Read ~w", [Param]) > > On Thu, 19 Apr 2012 18:54:16 +0530, Andy Richards > wrote: > >> Hi all, >> >> I found this previous unanswered post to the mailing list and I now face the same problem.... >> >> http://erlang.2086793.n4.nabble.com/NULL-parameter-for-ODBC-param-query-td3226735.html >> >>> "Is it possible to use null values in a parameterised odbc param_query? >>> >>> example: odbc:param_query("exec User_Read ?", [{sql_integer, Param}]). % >>> Param is either an integer or null >>> >>> The odbc driver returns the 'null' atom when selecting rows, but I haven't >>> found a value that allows me to specify a null parameter ('null', 'NULL', >>> <<"null">>, etc...)" >> >> >> According to the documentation value = null | term() however an exception is thrown if the atom null is used? >> >> Has anyone come across this or are there any workarounds to this issue ? >> >> I've already patched the c portion of the odbc driver to resolve a socket issue under Linux so I'm wondering if this module is used much in the Erlang world? >> >> Many thanks, >> >> Andy. >> >> >> > > > -- > Using Opera's revolutionary email client: http://www.opera.com/mail/ From andy.richards.iit@REDACTED Fri Apr 20 12:29:49 2012 From: andy.richards.iit@REDACTED (Andy Richards) Date: Fri, 20 Apr 2012 11:29:49 +0100 Subject: [erlang-questions] Null parameter for ODBC param_query In-Reply-To: References: <592B868E-2AA0-48AC-9833-66853698DE3E@googlemail.com> Message-ID: <0773C9F9-C700-4E4B-8D58-6A22D1E6D629@googlemail.com> Hi Ingela, Thanks for the confirmation we'll probably proceed with the sql_query approach then. If possible I'll feed what i can back to the community. I intend to submit a patch for the socket issue I found however unfortunately the steps outlined at https://github.com/erlang/otp/wiki/submitting-patches fail for me even after getting the appropriate git ports opened through our corporate firewall. I'll post a separate thread detailing the error. Thanks, Andy. Sent from my iPad On 20 Apr 2012, at 10:48, Ingela Andin wrote: > Hi! > > The problem is that with param_query at the moment does not support > all data types and null > values that will be handled by sql_query. If someone wants this you > are more then welcome to contribute. I can not see that this would get > a high priority any time soon within Ericsson. > > Please submit your socket issue patch so that other people also can > benefit from it. > > Regards Ingela Erlang/OTP team - Ericsson AB > > 2012/4/20, Avinash Dhumane : >> I use the ODBC application of Erlang (presently, on R14B02) quite heavily >> and with proprietary drivers like AS400 and Netezza. >> >> I rely on odbc:sql_query() - even with parameters - more than on >> odbc:param_query(). I use the latter only when to submit a batch of >> INSERTs. With former, I construct the SQL string by duly substituting all >> the parameter values and submit. So, the submission through ODBC becomes >> exactly same as I would do on the SQL command-line interface tool provided >> by the DBMS. Applying to your case, I would have done as follows: >> >> lists:flatten(io_lib:fwrite("exec User_Read ~w", [Param]) >> >> On Thu, 19 Apr 2012 18:54:16 +0530, Andy Richards >> wrote: >> >>> Hi all, >>> >>> I found this previous unanswered post to the mailing list and I now face >>> the same problem.... >>> >>> http://erlang.2086793.n4.nabble.com/NULL-parameter-for-ODBC-param-query-td3226735.html >>> >>>> "Is it possible to use null values in a parameterised odbc param_query? >>>> >>>> example: odbc:param_query("exec User_Read ?", [{sql_integer, Param}]). >>>> % >>>> Param is either an integer or null >>>> >>>> The odbc driver returns the 'null' atom when selecting rows, but I >>>> haven't >>>> found a value that allows me to specify a null parameter ('null', >>>> 'NULL', >>>> <<"null">>, etc...)" >>> >>> >>> According to the documentation value = null | term() however an >>> exception is thrown if the atom null is used? >>> >>> Has anyone come across this or are there any workarounds to this issue ? >>> >>> I've already patched the c portion of the odbc driver to resolve a >>> socket issue under Linux so I'm wondering if this module is used much in >>> the Erlang world? >>> >>> Many thanks, >>> >>> Andy. >>> >>> >>> >> >> >> -- >> Using Opera's revolutionary email client: http://www.opera.com/mail/ >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> From serge.polkovnikov@REDACTED Fri Apr 20 13:27:03 2012 From: serge.polkovnikov@REDACTED (Serge Polkovnikov) Date: Fri, 20 Apr 2012 14:27:03 +0300 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas Message-ID: Hi! Have found some error. The compiler "eats" structures which are not separated by commas. Example: -module(new_file). -export([start/0]). -record(haha, { v } ). start() -> [ #haha{v=1} %% No comma here #haha{v=2} %% No comma here #haha{v=3} ]. The result: Eshell V5.9.1 (abort with ^G) 1> c(new_file). {ok,new_file} 2> new_file:start(). [{haha,3}] 3> --Serge -------------- next part -------------- An HTML attachment was scrubbed... URL: From gleber.p@REDACTED Fri Apr 20 13:31:34 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Fri, 20 Apr 2012 13:31:34 +0200 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: References: Message-ID: It is a well known culprit of Erlang pre-processor. It's here: http://erlang.org/pipermail/erlang-bugs/2011-July/002528.html On Fri, Apr 20, 2012 at 13:27, Serge Polkovnikov wrote: > Hi! > Have found some error. > The compiler "eats" structures which are not separated by commas. > > Example: > > -module(new_file). > -export([start/0]). > -record(haha,? { v } ). > > start() -> > ??? [ > ???? #haha{v=1}?? %% No comma here > ???? #haha{v=2} ? %% No comma here > ???? #haha{v=3} > ??? ]. > > The result: > > Eshell V5.9.1? (abort with ^G) > 1> c(new_file). > {ok,new_file} > 2> new_file:start(). > [{haha,3}] > 3> > > > --Serge > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From ponton@REDACTED Fri Apr 20 13:34:46 2012 From: ponton@REDACTED (Tomasz Maciejewski) Date: Fri, 20 Apr 2012 13:34:46 +0200 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: References: Message-ID: W dniu 20 kwietnia 2012 13:27 u?ytkownik Serge Polkovnikov napisa?: > start() -> > ??? [ > ???? #haha{v=1}?? %% No comma here > ???? #haha{v=2} ? %% No comma here > ???? #haha{v=3} > ??? ]. This is not a bug. The "Foo#bar" syntax tells the compiler to treat Foo as a bar instance. But this doesn't forbid Foo being also "Something#bar". So your code tells the compiler to get #haha{v=1}, substitute v with 2, and then subsitute v with 3. That's why you end up with [{haha, 3}]. If you had a record with fields v and w, then: [ #haha{v=1} #haha{w=3} ] would return a list [{haha,1,3}] -- Tomasz Maciejewski From vladdu55@REDACTED Fri Apr 20 13:34:52 2012 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 20 Apr 2012 13:34:52 +0200 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: References: Message-ID: Hi Serge, On Fri, Apr 20, 2012 at 13:27, Serge Polkovnikov wrote: > The compiler "eats" structures which are not separated by commas. > start() -> > ??? [ > ???? #haha{v=1}?? %% No comma here > ???? #haha{v=2} ? %% No comma here > ???? #haha{v=3} > ??? ]. No, the code is equivalent to ((#haha{v=1})#haha{v=2})#haha{v=3}. Try the following to understand: -record(haha, { a,b,c } ). start() -> ??? [ ???? #haha{a=1}?? %% No comma here ???? #haha{b=2} ? %% No comma here ???? #haha{c=3} ??? ]. regards, Vlad From serge.polkovnikov@REDACTED Fri Apr 20 13:48:54 2012 From: serge.polkovnikov@REDACTED (Serge Polkovnikov) Date: Fri, 20 Apr 2012 14:48:54 +0300 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: References: Message-ID: 20 ?????? 2012 ?. 14:31 ???????????? Gleb Peregud ???????: > It is a well known culprit of Erlang pre-processor. It's here: > http://erlang.org/pipermail/erlang-bugs/2011-July/002528.html > > Ok. Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From serge.polkovnikov@REDACTED Fri Apr 20 13:54:53 2012 From: serge.polkovnikov@REDACTED (Serge Polkovnikov) Date: Fri, 20 Apr 2012 14:54:53 +0300 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: References: Message-ID: 20 ?????? 2012 ?. 14:34 ???????????? Vlad Dumitrescu ???????: > Hi Serge, > > On Fri, Apr 20, 2012 at 13:27, Serge Polkovnikov > wrote: > > The compiler "eats" structures which are not separated by commas. > > start() -> > > [ > > #haha{v=1} %% No comma here > > #haha{v=2} %% No comma here > > #haha{v=3} > > ]. > > No, the code is equivalent to ((#haha{v=1})#haha{v=2})#haha{v=3}. > Is there any simple way to protect such lists against the behaviour? > > Try the following to understand: > > -record(haha, { a,b,c } ). > start() -> > [ > #haha{a=1} %% No comma here > #haha{b=2} %% No comma here > #haha{c=3} > ]. > > regards, > Vlad > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jbothma@REDACTED Fri Apr 20 14:11:12 2012 From: jbothma@REDACTED (JD Bothma) Date: Fri, 20 Apr 2012 14:11:12 +0200 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: References: Message-ID: Sadly erlang doesn't allow a trailing comma in the last element like [ #haha{v=1}, #haha{v=2}, #haha{v=3}, ]. otherwise, always trailing with a comma is a common best practise, e.g. in PHP arrays. When it becomes habit it's hardly a problem. Since this can silently cause bugs, the warning suggested in http://erlang.org/pipermail/erlang-bugs/2011-July/002528.html sounds like a good thing to push for, unless there's a better solution? JD On 20 April 2012 13:54, Serge Polkovnikov wrote: > > > 20 ?????? 2012??. 14:34 ???????????? Vlad Dumitrescu > ???????: > >> Hi Serge, >> >> On Fri, Apr 20, 2012 at 13:27, Serge Polkovnikov >> wrote: >> > The compiler "eats" structures which are not separated by commas. >> > start() -> >> > ??? [ >> > ???? #haha{v=1}?? %% No comma here >> > ???? #haha{v=2} ? %% No comma here >> > ???? #haha{v=3} >> > ??? ]. >> >> No, the code is equivalent to ((#haha{v=1})#haha{v=2})#haha{v=3}. > > > Is there any simple way to protect such lists against the behaviour? >> >> >> Try the following to understand: >> >> -record(haha, ?{ a,b,c } ). >> ?start() -> >> ???? [ >> ????? #haha{a=1}?? %% No comma here >> ????? #haha{b=2} ? %% No comma here >> ????? #haha{c=3} >> ???? ]. >> >> regards, >> Vlad > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From vladdu55@REDACTED Fri Apr 20 14:11:49 2012 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Fri, 20 Apr 2012 14:11:49 +0200 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: References: Message-ID: On Fri, Apr 20, 2012 at 13:54, Serge Polkovnikov wrote: > 20 ?????? 2012??. 14:34 ???????????? Vlad Dumitrescu > ???????: >> On Fri, Apr 20, 2012 at 13:27, Serge Polkovnikov >> wrote: >> > The compiler "eats" structures which are not separated by commas. >> > start() -> >> > ??? [ >> > ???? #haha{v=1}?? %% No comma here >> > ???? #haha{v=2} ? %% No comma here >> > ???? #haha{v=3} >> > ??? ]. >> >> No, the code is equivalent to ((#haha{v=1})#haha{v=2})#haha{v=3}. > > Is there any simple way to protect such lists against the behaviour? No, because this is a perfectly reasonable language construct. It's the same as in any other language if you compare "foo(1, -2)" and "foo(1 -2)". One could detect such repeated assignment to the same field, but I don't think it's easy to make it work in the general case (some use cases might be valid). regards, Vlad From arthurbeall@REDACTED Fri Apr 20 14:14:04 2012 From: arthurbeall@REDACTED (Art Beall) Date: Fri, 20 Apr 2012 05:14:04 -0700 (PDT) Subject: [erlang-questions] erlsrv fails with boot error when using argument "-run application start " Message-ID: <1334924044.75086.YahooMailNeo@web39304.mail.mud.yahoo.com> Hello, ? Thanks in advance for any help for an erlang newbie. ? We've developed an erlang application using OTP. It receives tcp messages, stores the data in ets, and provides a simple http api for returing the data as a JSON object. ? It works just fine undef werl. We are testing under windows 7. ? But when we use the erlsrv command to create/start the application is dies with an init error, terminating in do_boot. I've tried with both boot files, the start_clean and start_sasl, using a debug log file. ? We've tried various combos of options and arguments. eunit tests will run under the service, normal functions will run. But anything having to do with OTP seems to fail. ? Any help would be appreciated! ? Thanks Art -------------- next part -------------- An HTML attachment was scrubbed... URL: From dave@REDACTED Fri Apr 20 15:22:07 2012 From: dave@REDACTED (Dave Cottlehuber) Date: Fri, 20 Apr 2012 15:22:07 +0200 Subject: [erlang-questions] erlsrv fails with boot error when using argument "-run application start " In-Reply-To: References: <1334924044.75086.YahooMailNeo@web39304.mail.mud.yahoo.com> Message-ID: On 20 April 2012 14:14, Art Beall wrote: > Hello, > > Thanks in advance for any help for an erlang newbie. > > We've developed an erlang application using OTP. It receives tcp messages, > stores the data in ets, and provides a simple http api for returing the data > as a JSON object. > > It works just fine undef werl. We are testing under windows 7. > > But when we use the erlsrv command to create/start the application is dies > with an init error, terminating in do_boot. I've tried with both boot files, > the start_clean and start_sasl, using a debug log file. > > We've tried various combos of options and arguments. eunit tests will run > under the service, normal functions will run. But anything having to do with > OTP seems to fail. > > Any help would be appreciated! > > Thanks > > Art > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > Hi Art, At a glance nothing specific comes to mind, so some quick notes to help: Use erl.exe for services not werl.exe, take a look at the bottom part of http://wiki.apache.org/couchdb/Quirks_on_Windows for more info on erlsrv setup. When troubleshooting erlang services on windows, I usually use the debugmode flags in the service args (-debugtype console) so that I can see and interact directly with the console on startup. Usually this is enough to understand what's missing as you can type in stuff like this to load & start your apps: application:load(crypto). crypto:start(). Take a look at http://www.apache.org/dyn/closer.cgi?path=/couchdb/packages/win32/1.2.0/setup-couchdb-1.2.0_otp_R15B.exe specifically at bin/couchdb.bat to see how we do it in CouchDB. Are you sure that path & permissions are correct? Are there no sneaky DLLs like openssl ones hiding in the system path? There are some not-so-well-known bugs in how windows resolves DLL loading. A+ Dave From zabrane3@REDACTED Fri Apr 20 16:34:36 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Fri, 20 Apr 2012 16:34:36 +0200 Subject: [erlang-questions] "Securing" code in Erlang when deployed on customer's machines In-Reply-To: References: <47C1F0EA-D7E2-46B0-96FB-DF65190CED84@gmail.com> Message-ID: <25584FE3-F3FC-4EF9-8DA6-B7E8B7B8A11B@gmail.com> Thanks to all of you guys. Don't hesitate if you have others advises. Regards, Zabrane On Apr 20, 2012, at 4:05 AM, Jon Watte wrote: > Heavy anti-piracy engineering never works for popular software. If someone really wants to pirate your stuff, they will. > > They can clone the hard disks, and the hardware, and spin up as many virtual copies as they want. > They can disassemble your binaries, and patch out the "branch-not-equal" you use to check any arbitrary condition. > > It's OK to put in a simple "lock" which "keeps honest users honest." Ideally, this lock is no hassle -- the more complex it is, the more likely your legitimate users are to actually use the cracked version of the software, even though they paid for it. > > If your system is anything more complex than, say, "every three hours, the system makes a HTTP request with some statistics to your web server, and if your web server doesn't answer OK, after three days the system will start slowing down requests" then you're probably solving the wrong problem. > > The alternative is to make software that nobody wants to pirate. But that's usually not a good long-term solution. > > Providing real value to your customers for being your customers is what's important, because if your customer makes more money when they pay you, than when they don't pay you, what do you think they're going to do? :-) > > And, finally -- if your work is really so much "secret sauce," then why don't you host it for the customer? Let the customer send you the content, and host it on a cloud infrastructure of some sort (Amazon, Heroku, Rackable, VMWare, etc.) That way, nobody sees the software except you. > > > Sincerely, > > Jon Watte > > > -- > "I pledge allegiance to the flag of the United States of America, and to the republic for which it stands, one nation indivisible, with liberty and justice for all." > ~ Adopted by U.S. Congress, June 22, 1942 > > > > On Wed, Apr 18, 2012 at 11:08 AM, Zabrane Mickael wrote: > Hi guys, > > We're planning to deploy our proprietary HTTP/1.1 WebServer (of course in Erlang ;-)) on a customer website > next month. > > For that, we would like to create a licensing system to ensure that it will not be deployed elsewhere. > > Someone offlist told me that "QuickCheck" has a very good licensing system to protect their code > and manage the number of allowed users. Unfortunately, I don't know how it works. > > Any hints? Any code? > > Regards, > Zabrane > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hakan.nilsson@REDACTED Fri Apr 20 16:58:30 2012 From: hakan.nilsson@REDACTED (=?ISO-8859-1?Q?H=E5kan_Nilsson?=) Date: Fri, 20 Apr 2012 16:58:30 +0200 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: References: Message-ID: That's why it's preferable to have the convention to put the comma in the beginning om the line, like this: [ #haha{v=1} , #haha{v=2} , #haha{v=3} ]. It looks kinda funky at first sight, but once you get used to it then it will make your life easier. 2012/4/20 JD Bothma > Sadly erlang doesn't allow a trailing comma in the last element like > > [ > #haha{v=1}, > #haha{v=2}, > #haha{v=3}, > ]. > > otherwise, always trailing with a comma is a common best practise, > e.g. in PHP arrays. When it becomes habit it's hardly a problem. > > Since this can silently cause bugs, the warning suggested in > http://erlang.org/pipermail/erlang-bugs/2011-July/002528.html sounds > like a good thing to push for, unless there's a better solution? > > JD > > On 20 April 2012 13:54, Serge Polkovnikov > wrote: > > > > > > 20 ?????? 2012 ?. 14:34 ???????????? Vlad Dumitrescu > > > ???????: > > > >> Hi Serge, > >> > >> On Fri, Apr 20, 2012 at 13:27, Serge Polkovnikov > >> wrote: > >> > The compiler "eats" structures which are not separated by commas. > >> > start() -> > >> > [ > >> > #haha{v=1} %% No comma here > >> > #haha{v=2} %% No comma here > >> > #haha{v=3} > >> > ]. > >> > >> No, the code is equivalent to ((#haha{v=1})#haha{v=2})#haha{v=3}. > > > > > > Is there any simple way to protect such lists against the behaviour? > >> > >> > >> Try the following to understand: > >> > >> -record(haha, { a,b,c } ). > >> start() -> > >> [ > >> #haha{a=1} %% No comma here > >> #haha{b=2} %% No comma here > >> #haha{c=3} > >> ]. > >> > >> regards, > >> Vlad > > > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- H?kan Nilsson -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Fri Apr 20 19:07:07 2012 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 20 Apr 2012 19:07:07 +0200 Subject: [erlang-questions] =?iso-8859-1?q?Erlounge_=D6rebro=2C_9_May?= Message-ID: <792A6200-BAF1-4820-8B98-7D1BB3AC316D@feuerlabs.com> The event you've all been waiting for! On May 9, we arrange the first ever Erlounge ?rebro. (For those of you who don't know where ?rebro is, here's some help: http://g.co/maps/g748z) We haven't decided on exact place yet, but 18.00 seems like a good time to shoot for. Tony Rogvall has promised to join us, so it will be a truly cosmopolitan event. :) Let me know if you want to join us. BR, Ulf W Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com From emeka_1978@REDACTED Fri Apr 20 22:03:57 2012 From: emeka_1978@REDACTED (emeka okafor) Date: Fri, 20 Apr 2012 13:03:57 -0700 (PDT) Subject: [erlang-questions] erlsrv fails with boot error when using argument "-run application start " In-Reply-To: <1334924044.75086.YahooMailNeo@web39304.mail.mud.yahoo.com> Message-ID: <1334952237.92623.YahooMailClassic@web114209.mail.gq1.yahoo.com> Have you specified the correct path to the binaries??something like -pa Dir1 Dir2 ..DirN --- On Fri, 4/20/12, Art Beall wrote: From: Art Beall Subject: [erlang-questions] erlsrv fails with boot error when using argument "-run application start " To: "erlang-questions@REDACTED" Date: Friday, April 20, 2012, 7:14 AM Hello,?Thanks in advance for any help for an erlang newbie.?We've developed an erlang application using OTP. It receives tcp messages, stores the data in ets, and provides a simple http api for returing the data as a JSON object. ?It works just fine undef werl. We are testing under windows 7. ?But when we use the erlsrv command to create/start the application is dies with an init error, terminating in do_boot. I've tried with both boot files, the start_clean and start_sasl, using a debug log file. ?We've tried various combos of options and arguments. eunit tests will run under the service, normal functions will run. But anything having to do with OTP seems to fail.?Any help would be appreciated!?Thanks?Art -----Inline Attachment Follows----- _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From roberto@REDACTED Sat Apr 21 01:11:30 2012 From: roberto@REDACTED (Roberto Ostinelli) Date: Fri, 20 Apr 2012 16:11:30 -0700 Subject: [erlang-questions] Erlang Library Path Message-ID: Dear all, is it possible to retrieve erlang's install path? I'm talking about the full path to libraries, which is for instance /usr/local/lib/erlang/lib on my machine (OSX). Any pointers appreciated! r. -------------- next part -------------- An HTML attachment was scrubbed... URL: From watson.timothy@REDACTED Sat Apr 21 01:13:24 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Sat, 21 Apr 2012 00:13:24 +0100 Subject: [erlang-questions] Erlang Library Path In-Reply-To: References: Message-ID: code:lib_dir/0 On 21 April 2012 00:11, Roberto Ostinelli wrote: > Dear all, > > is it possible to retrieve erlang's install path? > > I'm talking about the full path to libraries, which is for instance > /usr/local/lib/erlang/lib on my machine (OSX). > > Any pointers appreciated! > > r. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From essen@REDACTED Sat Apr 21 01:13:42 2012 From: essen@REDACTED (=?ISO-8859-1?Q?Lo=EFc_Hoguin?=) Date: Sat, 21 Apr 2012 01:13:42 +0200 Subject: [erlang-questions] Erlang Library Path In-Reply-To: References: Message-ID: <4F91EDA6.2050807@ninenines.eu> code:lib_dir() ? On 04/21/2012 01:11 AM, Roberto Ostinelli wrote: > Dear all, > > is it possible to retrieve erlang's install path? > > I'm talking about the full path to libraries, which is for instance > /usr/local/lib/erlang/lib on my machine (OSX). > > Any pointers appreciated! > > r. > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- Lo?c Hoguin Erlang Cowboy Nine Nines From roberto@REDACTED Sat Apr 21 01:15:12 2012 From: roberto@REDACTED (Roberto Ostinelli) Date: Fri, 20 Apr 2012 16:15:12 -0700 Subject: [erlang-questions] Erlang Library Path In-Reply-To: <4F91EDA6.2050807@ninenines.eu> References: <4F91EDA6.2050807@ninenines.eu> Message-ID: yes. i've tried all permutations of that since I have no browser access right now (don't ask). Thank you. r. On Fri, Apr 20, 2012 at 4:13 PM, Lo?c Hoguin wrote: > code:lib_dir() ? > > > On 04/21/2012 01:11 AM, Roberto Ostinelli wrote: > >> Dear all, >> >> is it possible to retrieve erlang's install path? >> >> I'm talking about the full path to libraries, which is for instance >> /usr/local/lib/erlang/lib on my machine (OSX). >> >> Any pointers appreciated! >> >> r. >> >> >> >> >> ______________________________**_________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/**listinfo/erlang-questions >> > > > -- > Lo?c Hoguin > Erlang Cowboy > Nine Nines > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bourinov@REDACTED Sat Apr 21 09:38:16 2012 From: bourinov@REDACTED (Max Bourinov) Date: Sat, 21 Apr 2012 11:38:16 +0400 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: References: Message-ID: <-1153670036829932190@unknownmsgid> +1. I also use this technique. Sent from my iPhone On 20.04.2012, at 18:59, "H?kan Nilsson" wrote: That's why it's preferable to have the convention to put the comma in the beginning om the line, like this: [ #haha{v=1} , #haha{v=2} , #haha{v=3} ]. It looks kinda funky at first sight, but once you get used to it then it will make your life easier. 2012/4/20 JD Bothma > Sadly erlang doesn't allow a trailing comma in the last element like > > [ > #haha{v=1}, > #haha{v=2}, > #haha{v=3}, > ]. > > otherwise, always trailing with a comma is a common best practise, > e.g. in PHP arrays. When it becomes habit it's hardly a problem. > > Since this can silently cause bugs, the warning suggested in > http://erlang.org/pipermail/erlang-bugs/2011-July/002528.html sounds > like a good thing to push for, unless there's a better solution? > > JD > > On 20 April 2012 13:54, Serge Polkovnikov > wrote: > > > > > > 20 ?????? 2012 ?. 14:34 ???????????? Vlad Dumitrescu > > > ???????: > > > >> Hi Serge, > >> > >> On Fri, Apr 20, 2012 at 13:27, Serge Polkovnikov > >> wrote: > >> > The compiler "eats" structures which are not separated by commas. > >> > start() -> > >> > [ > >> > #haha{v=1} %% No comma here > >> > #haha{v=2} %% No comma here > >> > #haha{v=3} > >> > ]. > >> > >> No, the code is equivalent to ((#haha{v=1})#haha{v=2})#haha{v=3}. > > > > > > Is there any simple way to protect such lists against the behaviour? > >> > >> > >> Try the following to understand: > >> > >> -record(haha, { a,b,c } ). > >> start() -> > >> [ > >> #haha{a=1} %% No comma here > >> #haha{b=2} %% No comma here > >> #haha{c=3} > >> ]. > >> > >> regards, > >> Vlad > > > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- H?kan Nilsson _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From msegalis@REDACTED Sat Apr 21 13:33:32 2012 From: msegalis@REDACTED (Morgan Segalis) Date: Sat, 21 Apr 2012 13:33:32 +0200 Subject: [erlang-questions] Tip&Tricks reducing memory footprint for gen_server ssl socket References: <94C85983-8104-49CB-B4CF-8B33764140AC@gmail.com> Message-ID: <26BE7B65-3D25-468D-AB9A-51BA1AF97861@gmail.com> Does anyone would have an idea on how to reduce memory footprint for an Erlang gen_server ssl socket oriented ? Right now each client (gen_server) has a something like 128 Ko in memory. while in C++ I have more something like 40 Ko per client. I'm using gproc as a pub/sub, each client connected is stored in it. Like: - Changing the ssl cipher, would it change the memory footprint ? - Changing the buffer size ? - ? ? I'm really looking for any idea that would drastically reduce memory footprint... Even system oriented advice would be good, like changing /proc/sys/tcp/* Thank you ! mGs From robert.virding@REDACTED Sat Apr 21 18:07:28 2012 From: robert.virding@REDACTED (Robert Virding) Date: Sat, 21 Apr 2012 17:07:28 +0100 (BST) Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: <-1153670036829932190@unknownmsgid> Message-ID: <904751cc-fa1a-496f-8bbb-504568287f88@knuth> This is actually a relatively recent "feature" of the language that this can occur. Originally you had to write (#haha{x=a} )# haha{x=b} i.e wrap expression in parentheses. So before this problem would not have occurred. But the need for the parentheses was removed as people complained that it didn't look very nice. Pet peeve of mine, the removing that is. I honestly don't think #haha{x=a}#haha{x=b} is more readable. Robert ----- Original Message ----- > +1. I also use this technique. > Sent from my iPhone > On 20.04.2012, at 18:59, "H?kan Nilsson" < hakan.nilsson@REDACTED > > wrote: > > That's why it's preferable to have the convention to put the comma > > in > > the beginning om the line, like this: > > > [ #haha{v=1} > > > , #haha{v=2} > > > , #haha{v=3} > > > ]. > > > It looks kinda funky at first sight, but once you get used to it > > then > > it will make your life easier. > > > 2012/4/20 JD Bothma < jbothma@REDACTED > > > > > Sadly erlang doesn't allow a trailing comma in the last element > > > like > > > > > > [ > > > > > > #haha{v=1}, > > > > > > #haha{v=2}, > > > > > > #haha{v=3}, > > > > > > ]. > > > > > > otherwise, always trailing with a comma is a common best > > > practise, > > > > > > e.g. in PHP arrays. When it becomes habit it's hardly a problem. > > > > > > Since this can silently cause bugs, the warning suggested in > > > > > > http://erlang.org/pipermail/erlang-bugs/2011-July/002528.html > > > sounds > > > > > > like a good thing to push for, unless there's a better solution? > > > > > > JD > > > > > > On 20 April 2012 13:54, Serge Polkovnikov < > > > serge.polkovnikov@REDACTED > wrote: > > > > > > > > > > > > > > > > > > > > > 20 ?????? 2012 ?. 14:34 ???????????? Vlad Dumitrescu < > > > > vladdu55@REDACTED > > > > > > > > ???????: > > > > > > > > > > > > > >> Hi Serge, > > > > > > >> > > > > > > >> On Fri, Apr 20, 2012 at 13:27, Serge Polkovnikov > > > > > > >> < serge.polkovnikov@REDACTED > wrote: > > > > > > >> > The compiler "eats" structures which are not separated by > > > >> > commas. > > > > > > >> > start() -> > > > > > > >> > [ > > > > > > >> > #haha{v=1} %% No comma here > > > > > > >> > #haha{v=2} %% No comma here > > > > > > >> > #haha{v=3} > > > > > > >> > ]. > > > > > > >> > > > > > > >> No, the code is equivalent to > > > >> ((#haha{v=1})#haha{v=2})#haha{v=3}. > > > > > > > > > > > > > > > > > > > > > Is there any simple way to protect such lists against the > > > > behaviour? > > > > > > >> > > > > > > >> > > > > > > >> Try the following to understand: > > > > > > >> > > > > > > >> -record(haha, { a,b,c } ). > > > > > > >> start() -> > > > > > > >> [ > > > > > > >> #haha{a=1} %% No comma here > > > > > > >> #haha{b=2} %% No comma here > > > > > > >> #haha{c=3} > > > > > > >> ]. > > > > > > >> > > > > > > >> regards, > > > > > > >> Vlad > > > > > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > > erlang-questions mailing list > > > > > > > erlang-questions@REDACTED > > > > > > > http://erlang.org/mailman/listinfo/erlang-questions > > > > > > > > > > > > > _______________________________________________ > > > > > > erlang-questions mailing list > > > > > > erlang-questions@REDACTED > > > > > > http://erlang.org/mailman/listinfo/erlang-questions > > > > > -- > > > H?kan Nilsson > > > _______________________________________________ > > > erlang-questions mailing list > > > erlang-questions@REDACTED > > > http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From koops.j@REDACTED Sat Apr 21 18:15:03 2012 From: koops.j@REDACTED (Jeroen Koops) Date: Sat, 21 Apr 2012 18:15:03 +0200 Subject: [erlang-questions] Tip&Tricks reducing memory footprint for gen_server ssl socket In-Reply-To: <26BE7B65-3D25-468D-AB9A-51BA1AF97861@gmail.com> References: <94C85983-8104-49CB-B4CF-8B33764140AC@gmail.com> <26BE7B65-3D25-468D-AB9A-51BA1AF97861@gmail.com> Message-ID: Hi Morgan, If your SSL socket is mostly idle, the option { hibernate_after, integer() }, which can be passed as one of the options to ssl:connect or ssl:listen, might help. Regards, Jeroen On Sat, Apr 21, 2012 at 1:33 PM, Morgan Segalis wrote: > Does anyone would have an idea on how to reduce memory footprint for an > Erlang gen_server ssl socket oriented ? > Right now each client (gen_server) has a something like 128 Ko in memory. > while in C++ I have more something like 40 Ko per client. > I'm using gproc as a pub/sub, each client connected is stored in it. > > Like: > > - Changing the ssl cipher, would it change the memory footprint ? > - Changing the buffer size ? > - ? ? > > I'm really looking for any idea that would drastically reduce memory > footprint... > Even system oriented advice would be good, like changing /proc/sys/tcp/* > > Thank you ! > mGs > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Jeroen Koops M: koops.j@REDACTED T: +31-6-55590300 -------------- next part -------------- An HTML attachment was scrubbed... URL: From msegalis@REDACTED Sat Apr 21 18:21:02 2012 From: msegalis@REDACTED (Morgan Segalis) Date: Sat, 21 Apr 2012 18:21:02 +0200 Subject: [erlang-questions] Tip&Tricks reducing memory footprint for gen_server ssl socket In-Reply-To: References: <94C85983-8104-49CB-B4CF-8B33764140AC@gmail.com> <26BE7B65-3D25-468D-AB9A-51BA1AF97861@gmail.com> Message-ID: <4A27E078-F603-4CA9-9657-82DF68172766@gmail.com> Hi Jeroen, Sorry for not pointing that on my first email, but I already use hibernate_after? It does some good, but not good enough for what I'm trying to reach. Regards, Morgan Le 21 avr. 2012 ? 18:15, Jeroen Koops a ?crit : > Hi Morgan, > > If your SSL socket is mostly idle, the option { hibernate_after, integer() }, which can be passed as one of the options to ssl:connect or ssl:listen, might help. > > Regards, > > Jeroen > > On Sat, Apr 21, 2012 at 1:33 PM, Morgan Segalis wrote: > Does anyone would have an idea on how to reduce memory footprint for an Erlang gen_server ssl socket oriented ? > Right now each client (gen_server) has a something like 128 Ko in memory. while in C++ I have more something like 40 Ko per client. > I'm using gproc as a pub/sub, each client connected is stored in it. > > Like: > > - Changing the ssl cipher, would it change the memory footprint ? > - Changing the buffer size ? > - ? ? > > I'm really looking for any idea that would drastically reduce memory footprint... > Even system oriented advice would be good, like changing /proc/sys/tcp/* > > Thank you ! > mGs > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > > -- > Jeroen Koops > > M: koops.j@REDACTED > T: +31-6-55590300 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From janburse@REDACTED Sat Apr 21 23:04:55 2012 From: janburse@REDACTED (Jan Burse) Date: Sat, 21 Apr 2012 23:04:55 +0200 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: References: Message-ID: <4F9320F7.3010009@fastmail.fm> Vlad Dumitrescu schrieb: >>>> The compiler "eats" structures which are not separated by commas. >>>> start() -> >>>> [ >>>> #haha{v=1} %% No comma here >>>> #haha{v=2} %% No comma here >>>> #haha{v=3} >>>> ]. >>> >>> No, the code is equivalent to ((#haha{v=1})#haha{v=2})#haha{v=3}. Maybe adopt some technique from La La Land: Step I: - Distinguish constructor and setter, instead of Constructor: #Name{Field1=Expr1,...} Setter: Expr#Name{Field1=Expr1,...} Getter: Expr#Name.Field Use different syntactic forms, i.e. for example: Constructur: #Name{Field1=Expr1,...} Setter: Expr #setName{Field1=Expr1,...} Getter: Expr #getName.Field Step II - Use type inference, to deduce the record typ, instead of Constructur: #Name{Field1=Expr1,...} Setter: Expr #setName{Field1=Expr1,...} Getter: Expr #getName.Field One can use the abbreviated forms: Constructur: #Name{Field1=Expr1,...} Setter: Expr #set{Field1=Expr1,...} Getter: Expr #get.Field Or maybe even better: Constructur: #Name{Field1=Expr1,...} Setter: Expr #setField(Expr1) #... Getter: Expr #getField() Actually I don't know if a sufficient type inference could be realized for Erlang so that the above would work. Bye From michael.eugene.turner@REDACTED Sun Apr 22 18:25:21 2012 From: michael.eugene.turner@REDACTED (Michael Turner) Date: Mon, 23 Apr 2012 01:25:21 +0900 Subject: [erlang-questions] non-FIFO behavior in process mailboxes? Message-ID: When the code listed below executes with the first io:format call commented out, it breaks, reporting: ** exception error: no match of right hand side value [] in function wg:init/0 When I don't have it commented out, it works (sort of), writing val_for (P)=[] val_for (P)=2 ok Here's the code: ----- -module(wg). -export ([init/0, be/2]). val_for (P) -> P ! {tell, self(), val}, receive {Val, for, P} -> Val end. be (Arg, Val) -> receive [H|T] -> self() ! T, self() ! H, be (Arg, Val); [] -> be (Arg, Val); {tell, X, val} -> X ! {Val, for, self()}, be (Arg, Val); {set_arg_to, A} -> be (A, Val); {set_val_to, V} -> be (Arg, V) end. init() -> P = spawn (wg, be, [[],[]]), P ! [{set_arg_to, 1}, {set_val_to, 2}], % io:format ("val_for (P)=~p~n", [val_for (P)]), 2 = val_for (P), io:format ("val_for (P)=~p~n", [val_for (P)]), ok. ----- This is R14B on Windows XP. Haven't tried it elsewhere yet. Seeing this really messes with my mental model of process mailboxes. With the first io:format call commented out, I think process P should be seeing messages queued up in the following order: [{set_arg_to, 1}, {set_val_to, 2}] [{set_val_to, 2}] {set_arg_to, 1} [] {set_val_to, 2} {tell, X, val} And shouldn't this mean that Val = 2 in process P when the {tell, X, val} message reaches P? As I interpret Armstrong pp.145-6, since matches are guaranteed in this case, there's no save queue activity; since there's no "after" close, the timer is irrelevant; so you should get pure FIFO behavior, right? -michael turner From ulf@REDACTED Sun Apr 22 19:23:40 2012 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 22 Apr 2012 19:23:40 +0200 Subject: [erlang-questions] non-FIFO behavior in process mailboxes? In-Reply-To: References: Message-ID: You seem to have a race between the messages sent from the client and the ones the server sends to itself. Bear in mind that the client doesn't yield after send, add SMP to the mix and you cannot know whether that server consumes the first message before the client sends its BR, Ulf W Ulf Wiger, Feuerlabs, Inc. http://www.feuerlabs.com 22 apr 2012 kl. 18:25 skrev Michael Turner : > When the code listed below executes with the first io:format call > commented out, it breaks, reporting: > > ** exception error: no match of right hand side value [] > in function wg:init/0 > > When I don't have it commented out, it works (sort of), writing > > val_for (P)=[] > val_for (P)=2 > ok > > Here's the code: > ----- > > -module(wg). > -export ([init/0, be/2]). > > val_for (P) -> > P ! {tell, self(), val}, > receive > {Val, for, P} -> Val > end. > > be (Arg, Val) -> > receive > [H|T] -> > self() ! T, > self() ! H, > be (Arg, Val); > [] -> > be (Arg, Val); > {tell, X, val} -> > X ! {Val, for, self()}, > be (Arg, Val); > {set_arg_to, A} -> > be (A, Val); > {set_val_to, V} -> > be (Arg, V) > end. > > init() -> > P = spawn (wg, be, [[],[]]), > P ! [{set_arg_to, 1}, {set_val_to, 2}], > % io:format ("val_for (P)=~p~n", [val_for (P)]), > 2 = val_for (P), > io:format ("val_for (P)=~p~n", [val_for (P)]), > ok. > ----- > > This is R14B on Windows XP. Haven't tried it elsewhere yet. > > Seeing this really messes with my mental model of process mailboxes. > With the first io:format call commented out, I think process P should > be seeing messages queued up in the following order: > > [{set_arg_to, 1}, {set_val_to, 2}] > [{set_val_to, 2}] > {set_arg_to, 1} > [] > {set_val_to, 2} > {tell, X, val} > > And shouldn't this mean that Val = 2 in process P when the {tell, X, > val} message reaches P? As I interpret Armstrong pp.145-6, since > matches are guaranteed in this case, there's no save queue activity; > since there's no "after" close, the timer is irrelevant; so you should > get pure FIFO behavior, right? > > -michael turner > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From ulf@REDACTED Sun Apr 22 19:27:26 2012 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 22 Apr 2012 19:27:26 +0200 Subject: [erlang-questions] non-FIFO behavior in process mailboxes? In-Reply-To: References: Message-ID: <765DC2EC-CA0F-47A3-B58C-511C1BF719E5@feuerlabs.com> Oh, and the io:format/2 call _does_ force a yield, since it involves a synchronous call to the group_leader. BR, Ulf W Ulf Wiger, Feuerlabs, Inc. http://www.feuerlabs.com 22 apr 2012 kl. 19:23 skrev Ulf Wiger : > You seem to have a race between the messages sent from the client and the ones the server sends to itself. > > Bear in mind that the client doesn't yield after send, add SMP to the mix and you cannot know whether that server consumes the first message before the client sends its > > BR, > Ulf W > > Ulf Wiger, Feuerlabs, Inc. > http://www.feuerlabs.com > > 22 apr 2012 kl. 18:25 skrev Michael Turner : > >> When the code listed below executes with the first io:format call >> commented out, it breaks, reporting: >> >> ** exception error: no match of right hand side value [] >> in function wg:init/0 >> >> When I don't have it commented out, it works (sort of), writing >> >> val_for (P)=[] >> val_for (P)=2 >> ok >> >> Here's the code: >> ----- >> >> -module(wg). >> -export ([init/0, be/2]). >> >> val_for (P) -> >> P ! {tell, self(), val}, >> receive >> {Val, for, P} -> Val >> end. >> >> be (Arg, Val) -> >> receive >> [H|T] -> >> self() ! T, >> self() ! H, >> be (Arg, Val); >> [] -> >> be (Arg, Val); >> {tell, X, val} -> >> X ! {Val, for, self()}, >> be (Arg, Val); >> {set_arg_to, A} -> >> be (A, Val); >> {set_val_to, V} -> >> be (Arg, V) >> end. >> >> init() -> >> P = spawn (wg, be, [[],[]]), >> P ! [{set_arg_to, 1}, {set_val_to, 2}], >> % io:format ("val_for (P)=~p~n", [val_for (P)]), >> 2 = val_for (P), >> io:format ("val_for (P)=~p~n", [val_for (P)]), >> ok. >> ----- >> >> This is R14B on Windows XP. Haven't tried it elsewhere yet. >> >> Seeing this really messes with my mental model of process mailboxes. >> With the first io:format call commented out, I think process P should >> be seeing messages queued up in the following order: >> >> [{set_arg_to, 1}, {set_val_to, 2}] >> [{set_val_to, 2}] >> {set_arg_to, 1} >> [] >> {set_val_to, 2} >> {tell, X, val} >> >> And shouldn't this mean that Val = 2 in process P when the {tell, X, >> val} message reaches P? As I interpret Armstrong pp.145-6, since >> matches are guaranteed in this case, there's no save queue activity; >> since there's no "after" close, the timer is irrelevant; so you should >> get pure FIFO behavior, right? >> >> -michael turner >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From mattevans123@REDACTED Sun Apr 22 19:57:11 2012 From: mattevans123@REDACTED (Matthew Evans) Date: Sun, 22 Apr 2012 13:57:11 -0400 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: <904751cc-fa1a-496f-8bbb-504568287f88@knuth> References: <-1153670036829932190@unknownmsgid>, <904751cc-fa1a-496f-8bbb-504568287f88@knuth> Message-ID: Changing the subject slightly. One thing that would be nice is given: -record(foo, {a = 1, b = 2}). t() -> Foo = #foo{a = 8, b = 7}, Foo#foo.a. That since the pre-processor has seen that Foo is bound to a record #foo that I could do this instead: t() -> Foo = #foo{a = 8, b = 7}, Foo.a. Matt Date: Sat, 21 Apr 2012 17:07:28 +0100 From: robert.virding@REDACTED To: bourinov@REDACTED CC: erlang-questions@REDACTED Subject: Re: [erlang-questions] The compiler "eats" structures which are not separated by commas This is actually a relatively recent "feature" of the language that this can occur. Originally you had to write (#haha{x=a})#haha{x=b} i.e wrap expression in parentheses. So before this problem would not have occurred. But the need for the parentheses was removed as people complained that it didn't look very nice. Pet peeve of mine, the removing that is. I honestly don't think #haha{x=a}#haha{x=b} is more readable. Robert +1. I also use this technique. Sent from my iPhone On 20.04.2012, at 18:59, "H?kan Nilsson" wrote: That's why it's preferable to have the convention to put the comma in the beginning om the line, like this: [ #haha{v=1} , #haha{v=2}, #haha{v=3}]. It looks kinda funky at first sight, but once you get used to it then it will make your life easier. 2012/4/20 JD Bothma Sadly erlang doesn't allow a trailing comma in the last element like [ #haha{v=1}, #haha{v=2}, #haha{v=3}, ]. otherwise, always trailing with a comma is a common best practise, e.g. in PHP arrays. When it becomes habit it's hardly a problem. Since this can silently cause bugs, the warning suggested in http://erlang.org/pipermail/erlang-bugs/2011-July/002528.html sounds like a good thing to push for, unless there's a better solution? JD On 20 April 2012 13:54, Serge Polkovnikov wrote: > > > 20 ?????? 2012 ?. 14:34 ???????????? Vlad Dumitrescu > ???????: > >> Hi Serge, >> >> On Fri, Apr 20, 2012 at 13:27, Serge Polkovnikov >> wrote: >> > The compiler "eats" structures which are not separated by commas. >> > start() -> >> > [ >> > #haha{v=1} %% No comma here >> > #haha{v=2} %% No comma here >> > #haha{v=3} >> > ]. >> >> No, the code is equivalent to ((#haha{v=1})#haha{v=2})#haha{v=3}. > > > Is there any simple way to protect such lists against the behaviour? >> >> >> Try the following to understand: >> >> -record(haha, { a,b,c } ). >> start() -> >> [ >> #haha{a=1} %% No comma here >> #haha{b=2} %% No comma here >> #haha{c=3} >> ]. >> >> regards, >> Vlad > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -- H?kan Nilsson _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Sun Apr 22 21:04:13 2012 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Sun, 22 Apr 2012 21:04:13 +0200 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: References: <-1153670036829932190@unknownmsgid> <904751cc-fa1a-496f-8bbb-504568287f88@knuth> Message-ID: On Sun, Apr 22, 2012 at 19:57, Matthew Evans wrote: > One thing that would be nice is given: > -record(foo, {a = 1, b = 2}). > t() -> > ? Foo = #foo{a = 8, b = 7}, > ? Foo#foo.a. > That since the pre-processor has seen that Foo is bound to a record #foo > that I could do this instead: > t() -> > ? Foo = #foo{a = 8, b = 7}, > ? Foo.a. That would have to be the compiler's job, not the preprocessor's. And then it could help even in the following cases: t(X=#foo{}) -> X.a. t(X) when is_record(X, foo) -> X.a. Now, this gets me even more off-topic, but its' still related... What if the compiler would do some simple static typing analysis and also warn for things like f(X) when is_atom(X) -> X+1. and f(X) -> X = hello, X+1. and f(X) when is_integer(X) -> X+1. g() -> f(hello). ? Some of this information is already easily accessible and the rest doesn't feel like too difficult to retrieve, so I don't think it is a too far-fetched suggestion. regards, Vlad From robert.virding@REDACTED Sun Apr 22 22:06:11 2012 From: robert.virding@REDACTED (Robert Virding) Date: Sun, 22 Apr 2012 21:06:11 +0100 (BST) Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: Message-ID: <504834f6-daa8-4da5-84bc-733bf625b18a@knuth> There have been suggestions along this path earlier. Unfortunately it will only work occasionally. It would allow you to write things like Foo{a=7} or perhaps Foo#{a=7}. I will admit I don't see the need, but then I am corrupted. Robert ----- Original Message ----- > Changing the subject slightly. > One thing that would be nice is given: > -record(foo, {a = 1, b = 2}). > t() -> > Foo = #foo{a = 8, b = 7}, > Foo#foo.a. > That since the pre-processor has seen that Foo is bound to a record > #foo that I could do this instead: > t() -> > Foo = #foo{a = 8, b = 7}, > Foo.a. > Matt -------------- next part -------------- An HTML attachment was scrubbed... URL: From netch@REDACTED Sun Apr 22 22:26:00 2012 From: netch@REDACTED (Valentin Nechayev) Date: Sun, 22 Apr 2012 23:26:00 +0300 Subject: [erlang-questions] How to handle a massive amount of UDP packets? In-Reply-To: References: <4F8B0E95.4060003@berlin.ccc.de> <4F8BE6FB.3020205@berlin.ccc.de> <4F8D93A9.3060303@berlin.ccc.de> Message-ID: <20120422202600.GA84026@netch.kiev.ua> Using {active,once} on socket type other than stream one principally can't give performance compared to uncontrolled stream, due to asynchronous manner of sending messages to owner's mailbox and its processing. OTOH, {active,once} is shorthand for "send me one next portion" and this "one" can be extended to more numbers; e.g. {active,100} for "send me 100 next packets and then stay and wait for next permit". This combines advantages of both modes ('once' and 'true'). -netch- From jwatte@REDACTED Sun Apr 22 23:26:23 2012 From: jwatte@REDACTED (Jon Watte) Date: Sun, 22 Apr 2012 14:26:23 -0700 Subject: [erlang-questions] How to handle a massive amount of UDP packets? In-Reply-To: <4F8B0E95.4060003@berlin.ccc.de> References: <4F8B0E95.4060003@berlin.ccc.de> Message-ID: There are two options I would consider in this situation, both of which use synchronous reads on the socket: 1) A single process does recv() on the socket (synchronously) and pitches the received data to one of many worker processes (assuming work processing > receive processing.) 2) Each worker process blocks on recv() on the socket, and the OS will give each incoming packet to some arbitrary process that is currently blocked on the socket. This is nice because it "magically" load balances. I'd probably go for 2) first, and only look at 1) if I run into surprising lock contention issues between workers. Sincerely, Jon Watte -- "I pledge allegiance to the flag of the United States of America, and to the republic for which it stands, one nation indivisible, with liberty and justice for all." ~ Adopted by U.S. Congress, June 22, 1942 On Sun, Apr 15, 2012 at 11:08 AM, John-Paul Bader wrote: > Dear list, > > > I'm currently writing a bittorrent tracker in Erlang. While a naive > implementation of the protocol is quite easy, there are some performance > related challanges where I could use some help. > > In the first test run as a replacement for a very popular tracker, my > erlang tracker got about 40k requests per second. > > My initial approach was to initialize the socket in one process with > {active, once}, handle the message in handle_info with minimal effort and > pass the data asynchronously to a freshly spawned worker processes which > responds to the clients. After spawning the process I'm setting the socket > back to {active, once}. > > Now when I switched the erlang tracker live the erlang vm was topping at > 100% CPU load. My guess is that the process handling the udp packets from > the socket could not keep up. Since I'm still quite new to the world of > erlang I'd like to know if there are some best practices / patterns to > handle this massive amount of packets. > > For example using the socket in {active, once} might be too slow? Also the > response to the clients needs to come from the same port as the request was > coming in. Is it a problem to use the same socket for that? Should I > pre-spawn a couple of thousand workers and dispatch the data from the > socket to them rather than spawning them on each packet? > > It would be really great if you could give some advice or point me into > the right directions. > > ~ John > ______________________________**_________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/**listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Sun Apr 22 23:30:05 2012 From: ulf@REDACTED (Ulf Wiger) Date: Sun, 22 Apr 2012 23:30:05 +0200 Subject: [erlang-questions] How to handle a massive amount of UDP packets? In-Reply-To: <20120422202600.GA84026@netch.kiev.ua> References: <4F8B0E95.4060003@berlin.ccc.de> <4F8BE6FB.3020205@berlin.ccc.de> <4F8D93A9.3060303@berlin.ccc.de> <20120422202600.GA84026@netch.kiev.ua> Message-ID: What one can do is to combine {active, once} with gen_tcp:recv(). Essentially, you will be served the first message, then read as many as you wish from the socket. When the socket is empty, you can again enable {active, once}. BR, Ulf W On 22 Apr 2012, at 22:26, Valentin Nechayev wrote: > Using {active,once} on socket type other than stream one principally can't > give performance compared to uncontrolled stream, due to asynchronous manner > of sending messages to owner's mailbox and its processing. > OTOH, {active,once} is shorthand for "send me one next portion" and this "one" > can be extended to more numbers; e.g. {active,100} for "send me 100 next > packets and then stay and wait for next permit". This combines advantages > of both modes ('once' and 'true'). Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com From ok@REDACTED Mon Apr 23 02:19:12 2012 From: ok@REDACTED (Richard O'Keefe) Date: Mon, 23 Apr 2012 12:19:12 +1200 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: <4F9320F7.3010009@fastmail.fm> References: <4F9320F7.3010009@fastmail.fm> Message-ID: <436F6F6E-1131-4DC8-846B-0B0CC4C92CD8@cs.otago.ac.nz> On 22/04/2012, at 9:04 AM, Jan Burse wrote: > Use different syntactic forms, i.e. for example: > > Constructur: #Name{Field1=Expr1,...} > Setter: Expr #setName{Field1=Expr1,...} > Getter: Expr #getName.Field Saints preserve us! As if C envy weren't bad enough, now we have Java envy. And if that weren't bad enough, the disgusting 'set' and 'get' prefixes are on the wrong words entirely! Just distinguish clearly between *binding* a field and *replacing* it and all will be wall: Expr#Name{Field1 := Expr1, ..., Fieldn := Exprn} ^ ^ After all, there is nothing that stops someone using a record whose name begins with 'set' or 'get'. From b.nicholson@REDACTED Mon Apr 23 03:31:05 2012 From: b.nicholson@REDACTED (Barry Nicholson) Date: Sun, 22 Apr 2012 20:31:05 -0500 Subject: [erlang-questions] NWA developers Message-ID: <4F94B0D9.20204@niceng.com> I'm looking for anyone in Northwest Arkansas interested in Erlang. Maybe we could get a User's group started here. Barry From roberto@REDACTED Mon Apr 23 04:13:11 2012 From: roberto@REDACTED (Roberto Ostinelli) Date: Sun, 22 Apr 2012 19:13:11 -0700 Subject: [erlang-questions] [ANN] SublimErl - code completion: Looking for testers/contributors Message-ID: Dear all, SublimErl, the Sublime Text 2 editor Erlang plugin, now supports code completion in a features branch: https://github.com/ostinelli/SublimErl/tree/features/code_completion An animated GIF showing how it works can be seen here: http://www.ostinelli.net/_out_images/code_completion.gif Before I push it to master, I'd love to have some feedback from testers. If anyone is available, please msg me. As usual, comments / criticism / feedback welcome. r. -------------- next part -------------- An HTML attachment was scrubbed... URL: From janburse@REDACTED Mon Apr 23 04:28:58 2012 From: janburse@REDACTED (Jan Burse) Date: Mon, 23 Apr 2012 04:28:58 +0200 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: <436F6F6E-1131-4DC8-846B-0B0CC4C92CD8@cs.otago.ac.nz> References: <4F9320F7.3010009@fastmail.fm> <436F6F6E-1131-4DC8-846B-0B0CC4C92CD8@cs.otago.ac.nz> Message-ID: <4F94BE6A.5010906@fastmail.fm> Richard O'Keefe schrieb: > Expr#Name{Field1 := Expr1, ..., Fieldn := Exprn} > ^ ^ You still have the clutter of the Name (= RecordType), which a language with type inference doesn't need. How to deal with the reflective #Name.Field I have no clue yet. If there is not enough context where these expressions are used, then no type inference is possible and the name must be qualified. > After all, there is nothing that stops someone using a > record whose name begins with 'set' or 'get'. This shouldn't pose any problems. You can use the same logic that currently distinguishes in Erlang a "#name" from a "Expr #name" to choose between record creation and setter (better call it updater I guess, although updater also suggest a side effect, but a setter here has signature RecordType x Type -> RecordType, so it is functional). I guess it is a prefix '#' versus infix '#' thing to detect creation versus setter, but I don't know enough about the Erlang parser to be sure. Bye From robert.virding@REDACTED Mon Apr 23 04:39:05 2012 From: robert.virding@REDACTED (Robert Virding) Date: Mon, 23 Apr 2012 03:39:05 +0100 (BST) Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: <4F94BE6A.5010906@fastmail.fm> Message-ID: <6e592460-318d-402a-bfe2-9083c919037e@knuth> ----- Original Message ----- > Richard O'Keefe schrieb: > > Expr#Name{Field1 := Expr1, ..., Fieldn := Exprn} > > ^ ^ > You still have the clutter of the Name (= RecordType), > which a language with type inference doesn't need. Type inferencing in erlang doesn't work. Unfortunately. There are too many places where it breaks down to be useful, for example message passing and code loading. There were attempts in the 90's by people much more knowledgeable than we were on this. Robert From janburse@REDACTED Mon Apr 23 04:50:54 2012 From: janburse@REDACTED (Jan Burse) Date: Mon, 23 Apr 2012 04:50:54 +0200 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: <6e592460-318d-402a-bfe2-9083c919037e@knuth> References: <4F94BE6A.5010906@fastmail.fm> <6e592460-318d-402a-bfe2-9083c919037e@knuth> Message-ID: <4F94C38E.6090004@fastmail.fm> Robert Virding schrieb: > Type inferencing in erlang doesn't work. > Unfortunately. There are too many places > where it breaks down to be useful, for > example message passing and code loading. > There were attempts in the 90's by people > much more knowledgeable than we were on this. I can imagine. One would trade the clutter which would not anymore be needed in the main code by new clutter for type declarations. From bourinov@REDACTED Mon Apr 23 05:05:15 2012 From: bourinov@REDACTED (Max Bourinov) Date: Mon, 23 Apr 2012 07:05:15 +0400 Subject: [erlang-questions] [ANN] SublimErl - code completion: Looking for testers/contributors In-Reply-To: References: Message-ID: Hi Roberto! Great work! I want to try it, but we have slightly different folder structure like: -- my_project |-- apps |--my_project |--src | |--my_project.app.src |--ebin |--test How and where should I configure SublimErl to support it? Thank you in advance for you great job! Best regards, Max On Mon, Apr 23, 2012 at 6:13 AM, Roberto Ostinelli wrote: > Dear all, > > SublimErl, the Sublime Text 2 editor Erlang plugin, now supports code > completion in a features branch: > https://github.com/ostinelli/SublimErl/tree/features/code_completion > > An animated GIF showing how it works can be seen here: > http://www.ostinelli.net/_out_images/code_completion.gif > > Before I push it to master, I'd love to have some feedback from testers. > If anyone is available, please msg me. > > As usual, comments / criticism / feedback welcome. > > r. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mjollnir.ray@REDACTED Mon Apr 23 05:08:00 2012 From: mjollnir.ray@REDACTED (=?UTF-8?B?5ZC056OK?=) Date: Mon, 23 Apr 2012 11:08:00 +0800 Subject: [erlang-questions] is this a shell bug? Message-ID: Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:4:4] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.9.1 (abort with ^G) 1> self(). <0.32.0> 2> process_flag(trap_exit, true). false 3> spawn_link(fun() -> ok end). <0.36.0> 4> process_info(self(), messages). {messages,[{'EXIT',<0.36.0>,normal}]} 5> receive X -> X end. {'EXIT',<0.36.0>,normal} 6> spawn_link(fun() -> ok end). <0.40.0> 7> process_info(self(), messages). {messages,[{'EXIT',<0.40.0>,normal}]} 8> receive X -> X end. shell SUSPENDING .... WHAT's happed here? ^G User switch command --> s --> c Eshell V5.9.1 (abort with ^G) 1> process_info(pid(0,32,0), current_function). {current_function,{erl_eval,receive_clauses,6}} 2> process_info(pid(0,32,0), messages). {messages,[]} BTW c:flush() looks work well with shell. From roberto@REDACTED Mon Apr 23 05:38:00 2012 From: roberto@REDACTED (Roberto Ostinelli) Date: Sun, 22 Apr 2012 20:38:00 -0700 Subject: [erlang-questions] [ANN] SublimErl - code completion: Looking for testers/contributors In-Reply-To: References: Message-ID: Hello Max, great, thank you :) SublimErl entirely relies on rebar, so where/how do you compile your project? Do you compile running 'rebar compile' from my_project/apps/my_projects directory, and do the compiled files go to my_project/apps/my_projects/ebin? If so, SublimErl should work, because it works by walking the directory tree upwards from the .erl file you're editing until it finds a directory that contains an /ebin directory. Give it a try, let's take this off-list so that I can help you out. r. On Sun, Apr 22, 2012 at 8:05 PM, Max Bourinov wrote: > Hi Roberto! > > Great work! I want to try it, but we have slightly different folder > structure like: > > -- my_project > |-- apps > |--my_project > |--src > | |--my_project.app.src > |--ebin > |--test > > > How and where should I configure SublimErl to support it? > > Thank you in advance for you great job! > > Best regards, > Max > -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael.eugene.turner@REDACTED Mon Apr 23 05:38:28 2012 From: michael.eugene.turner@REDACTED (Michael Turner) Date: Mon, 23 Apr 2012 12:38:28 +0900 Subject: [erlang-questions] non-FIFO behavior in process mailboxes? In-Reply-To: References: Message-ID: On Mon, Apr 23, 2012 at 2:23 AM, Ulf Wiger wrote: > You seem to have a race between the messages sent from the client and the ones the server sends to itself. That, I could see. What I couldn't see was how. But it came to me when my head hit the pillow. (Which was, naturally, shortly after I sent e-mail to the list about it.) Sometimes, when I'm tired, I fall into an old mindset that apparently derives from the days of writing interrupt service routines running at high processor priority back in the 1980s. And even *that's* not a good excuse in this case. > Bear in mind that the client doesn't yield after send, add SMP to the mix and you cannot know whether that server consumes the first message before the client sends its > > BR, Before the client sends its ... BR? "Best Regards"? After a delay? Oh, *that's* what I forgot to do! ;-) This bug came out of experimentation inspired by the recent discussion of initializing objects *after* their creation, a topic raised by Richard O'Keefe. And -- waddya know -- the problem here relates directly to his objection to this practice: inconsistent intermediate states. It appears that when you model your objects as processes, the danger is particularly acute. Lesson learned. Message ... received. -michael turner > 22 apr 2012 kl. 18:25 skrev Michael Turner : > >> When the code listed below executes with the first io:format call >> commented out, it breaks, reporting: >> >> ** exception error: no match of right hand side value [] >> ? ? in function ?wg:init/0 >> >> When I don't have it commented out, it works (sort of), writing >> >> ?val_for (P)=[] >> ?val_for (P)=2 >> ?ok >> >> Here's the code: >> ----- >> >> -module(wg). >> -export ([init/0, be/2]). >> >> val_for (P) -> >> ? ?P ! {tell, self(), val}, >> ? ?receive >> ? ? ? ?{Val, for, P} -> Val >> ? ?end. >> >> be (Arg, Val) -> >> ? ?receive >> ? ? ? ?[H|T] -> >> ? ? ? ? ? ?self() ! T, >> ? ? ? ? ? ?self() ! H, >> ? ? ? ? ? ?be (Arg, Val); >> ? ? ? ?[] -> >> ? ? ? ? ? ?be (Arg, Val); >> ? ? ? ?{tell, X, val} -> >> ? ? ? ? ? ?X ! {Val, for, self()}, >> ? ? ? ? ? ?be (Arg, Val); >> ? ? ? ?{set_arg_to, A} -> >> ? ? ? ? ? ?be (A, Val); >> ? ? ? ?{set_val_to, V} -> >> ? ? ? ? ? ?be (Arg, V) >> ? ?end. >> >> init() -> >> ? ?P = spawn (wg, be, [[],[]]), >> ? ?P ! [{set_arg_to, 1}, {set_val_to, 2}], >> % ? io:format ("val_for (P)=~p~n", [val_for (P)]), >> ? ?2 = val_for (P), >> ? ?io:format ("val_for (P)=~p~n", [val_for (P)]), >> ? ?ok. >> ----- >> >> This is R14B on Windows XP. Haven't tried it elsewhere yet. >> >> Seeing this really messes with my mental model of process mailboxes. >> With the first io:format call commented out, I think process P should >> be seeing messages queued up in the following order: >> >> ?[{set_arg_to, 1}, {set_val_to, 2}] >> ?[{set_val_to, 2}] >> ?{set_arg_to, 1} >> ?[] >> ?{set_val_to, 2} >> ?{tell, X, val} >> >> And shouldn't this mean that Val = 2 in process P when the {tell, X, >> val} message reaches P? As I interpret Armstrong pp.145-6, since >> matches are guaranteed in this case, there's no save queue activity; >> since there's no "after" close, the timer is irrelevant; so you should >> get pure FIFO behavior, right? >> >> -michael turner >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions From ok@REDACTED Mon Apr 23 05:38:33 2012 From: ok@REDACTED (ok@REDACTED) Date: Mon, 23 Apr 2012 15:38:33 +1200 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: <4F94BE6A.5010906@fastmail.fm> References: <4F9320F7.3010009@fastmail.fm> <436F6F6E-1131-4DC8-846B-0B0CC4C92CD8@cs.otago.ac.nz> <4F94BE6A.5010906@fastmail.fm> Message-ID: <049bd08514a53fb92bdc31699b438c8c.squirrel@chasm.otago.ac.nz> > Richard O'Keefe schrieb: >> Expr#Name{Field1 := Expr1, ..., Fieldn := Exprn} >> ^ ^ > You still have the clutter of the Name (= RecordType), > which a language with type inference doesn't need. Indeed. But Erlang is not a language with type inference. If I want Haskell, Clean, F#, O'CAML, ML, or Mercury, I know where to find them. > I guess it is a prefix '#' versus infix '#' thing to > detect creation versus setter, but I don't know enough > about the Erlang parser to be sure. But a prefix # being unintentionally taken as an infix # is precisely what this thread is about. We could have a rule that says "take all the -record(name, { ..., field ... }) declarations that are visible in the current module, and for each field name, construct a function field(#rec1{...,field=X,...}) -> X; ... field(#recn(...,field=X,...}) -> X. " so that instead of Foo#rec.bar we could use a plain bar(Foo), which is much better syntax for a functional language than 'get' prefixes. And the type language used by dialyzer could handle this. It's best not to tinker any more with records. From roberto@REDACTED Mon Apr 23 05:40:20 2012 From: roberto@REDACTED (Roberto Ostinelli) Date: Sun, 22 Apr 2012 20:40:20 -0700 Subject: [erlang-questions] [ANN] SublimErl - code completion: Looking for testers/contributors In-Reply-To: References: Message-ID: > by walking the directory tree upwards from the .erl file you're editing > until it finds a directory that contains an /ebin directory. > Sorry, I meant the /src directory. -------------- next part -------------- An HTML attachment was scrubbed... URL: From avinash@REDACTED Mon Apr 23 07:07:40 2012 From: avinash@REDACTED (Avinash Dhumane) Date: Mon, 23 Apr 2012 10:37:40 +0530 Subject: [erlang-questions] is this a shell bug? In-Reply-To: References: Message-ID: At step# 8, X is already bound, unlike at step# 5. So, "receive" at step#8 is trying to receive the same message that it did at step# 5. Issue "f(X)" (i.e. "forget" X) after step#7 and before "receive" at step#8. That will explain. On Mon, 23 Apr 2012 08:38:00 +0530, ?? wrote: > Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:4:4] > [async-threads:0] [hipe] [kernel-poll:false] > > Eshell V5.9.1 (abort with ^G) > 1> self(). > <0.32.0> > 2> process_flag(trap_exit, true). > false > 3> spawn_link(fun() -> ok end). > <0.36.0> > 4> process_info(self(), messages). > {messages,[{'EXIT',<0.36.0>,normal}]} > 5> receive X -> X end. > {'EXIT',<0.36.0>,normal} > 6> spawn_link(fun() -> ok end). > <0.40.0> > 7> process_info(self(), messages). > {messages,[{'EXIT',<0.40.0>,normal}]} > 8> receive X -> X end. > > shell SUSPENDING .... WHAT's happed here? > > ^G > User switch command > --> s > --> c > Eshell V5.9.1 (abort with ^G) > 1> process_info(pid(0,32,0), current_function). > {current_function,{erl_eval,receive_clauses,6}} > 2> process_info(pid(0,32,0), messages). > {messages,[]} > > BTW c:flush() looks work well with shell. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- ----------------------------------------------------------------------------- Avinash Dhumane * Balin Tech Labs Pvt Ltd, Pune, India Architect, Integration & Scalability * Fulfilling SLAs in the presence of +91-9767838896 | www.balinlabs.com * faults and extreme load. ----------------------------------------------------------------------------- From ulf@REDACTED Mon Apr 23 07:36:38 2012 From: ulf@REDACTED (Ulf Wiger) Date: Mon, 23 Apr 2012 07:36:38 +0200 Subject: [erlang-questions] non-FIFO behavior in process mailboxes? In-Reply-To: References: Message-ID: On 23 Apr 2012, at 05:38, Michael Turner wrote: > Before the client sends its ... BR? "Best Regards"? After a delay? Oh, > *that's* what I forgot to do! ;-) Uhm? yes, processes should be well-behaved. :) > This bug came out of experimentation inspired by the recent discussion > of initializing objects *after* their creation, a topic raised by > Richard O'Keefe. And -- waddya know -- the problem here relates > directly to his objection to this practice: inconsistent intermediate > states. It appears that when you model your objects as processes, the > danger is particularly acute. For this reason, there is the gen_server:enter_loop(), which basically (for one thing) allows you to stay in a protected state after init(). Also, plain_fsm:start_opt(Mod, InitF, ?) allows you to have the InitF return {reply, {ok, self()}, Cont}, where Cont is a continuation function that let's the process proceed - possibly in a protected state. BR, Ulf Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com From netch@REDACTED Mon Apr 23 08:25:15 2012 From: netch@REDACTED (Valentin Nechayev) Date: Mon, 23 Apr 2012 09:25:15 +0300 Subject: [erlang-questions] How to handle a massive amount of UDP packets? In-Reply-To: References: <4F8B0E95.4060003@berlin.ccc.de> <4F8BE6FB.3020205@berlin.ccc.de> <4F8D93A9.3060303@berlin.ccc.de> <20120422202600.GA84026@netch.kiev.ua> Message-ID: <20120423062515.GF82789@netch.kiev.ua> > From: Ulf Wiger > What one can do is to combine {active, once} with gen_tcp:recv(). > > Essentially, you will be served the first message, then read as many as you > wish from the socket. When the socket is empty, you can again enable > {active, once}. First, the approach you described is quite badly documented. No description how such non-waiting recv() can be reached. If this is call with Timeout=0, type timeout() isn't defined, and return value for timeout isn't defined. It only defines Reason = closed or inet:posix(). But it's incorrect to guess that eagain (or ewouldblock?) will be returned, if the implementing code is uniform against timeout value except infinity. I dislike to use such undocumented ways. Second, your approach gives useless process switches. If a long message is in receiving via TCP, there will be two switches to owner or more - the first one for the first part of a message, and some next ones for rest of it. If incoming rate is enough to process each small portion (TCP window) separately, owner process will get and process them separately; if its and system speed isn't enough for such switching, data will group in larger portions. This means that performance measuring will be total lie, with three intervals - uselessly quick saturation, then stable 100% under wide load interval, and then unexpected overloading. It's very hard to diagnose and optimize a system with such behavior, and this trend to fill the whole system by one subsystem affects other concurrent subsystems in bad way. People invented many mechanisms of avoiding both uselessly fast switching and non-reasonable delays - see e.g. VMIN and VTIME in termios, low matermark in BSD sockets. The Max Lapshin's proposition is among them and should only get small but major extension - to specify both full limit and inter-portion timeout. Third, please see measures by John-Paul Bader in neighbour message: with {active,false} he gets substantial packet loss, compared to {active,true}. Yep, this is UDP specifics and nobody guaranteed the delivery but there is no reason to increase loss without reason. His result shall be checked against the real reason but I guess these are socket buffer overflows. With {active,true}, owner mailbox becomes additional socket buffer with much larger size, but owner process loses control on its mailbox. Having window of allowed packets, it can provide more fine tuning of its load. -netch- From kostis@REDACTED Mon Apr 23 08:25:50 2012 From: kostis@REDACTED (Kostis Sagonas) Date: Mon, 23 Apr 2012 08:25:50 +0200 Subject: [erlang-questions] Type inference in Erlang [WAS: Re: The compiler "eats" structures which are not separated by commas] In-Reply-To: <6e592460-318d-402a-bfe2-9083c919037e@knuth> References: <6e592460-318d-402a-bfe2-9083c919037e@knuth> Message-ID: <4F94F5EE.30003@cs.ntua.gr> On 04/23/2012 04:39 AM, Robert Virding wrote: > > ----- Original Message ----- >> Richard O'Keefe schrieb: >>> Expr#Name{Field1 := Expr1, ..., Fieldn := Exprn} >>> ^ ^ >> You still have the clutter of the Name (= RecordType), >> which a language with type inference doesn't need. > > Type inferencing in erlang doesn't work. Unfortunately. There are too many places where it breaks down to be useful, for example message passing and code loading. There were attempts in the 90's by people much more knowledgeable than we were on this. OMG! If so, what exactly is the technique that dialyzer is using if not type inference? Magic? Just because some people in the 90's, who were supposedly knowledgeable in the area, took (what I would claim is) the wrong approach to the problem, this does not mean that one cannot come up with some useful type inference algorithms tailored to Erlang. Actually I would claim very useful and effective ones. Also, since I've heard the (wrong) argument about code reloading being a big stopper for type inference, what exactly is the fundamental problem that makes type inference break in its presence? Really none. Type inference takes a set of modules M1,..,Mj,..,Mk and calculates types for their functions. Code reloading just means that the types which have been previously inferred for these modules have to be (incrementally) recalculated when a module Mj is reloaded. If, say the compiler, has performed some optimizations based on the previously inferred types, it just means that it has to have some way of undoing these optimizations, possibly reapplying new ones, or simply telling the loader that the new version of the module cannot be reloaded because it is incompatible with the rest of the application. (*) In any case, it is as simple as that. The issues with code reloading seem to me purely engineering ones, and not something which disallows type inference in its presence. Please think before you write statement that look authoritative but are plainly wrong. Kostis (*) Note that prohibiting code reloading in some cases is an action which actually might be a good idea even in Erlang as it is today! I really fail to see how the current practice of allowing reloading of single modules that are clearly incompatible with the rest of the system is a safe thing to do or a good idea. But that's a different topic... From ingela@REDACTED Mon Apr 23 09:02:55 2012 From: ingela@REDACTED (Ingela Andin) Date: Mon, 23 Apr 2012 09:02:55 +0200 Subject: [erlang-questions] Tip&Tricks reducing memory footprint for gen_server ssl socket In-Reply-To: <4A27E078-F603-4CA9-9657-82DF68172766@gmail.com> References: <94C85983-8104-49CB-B4CF-8B33764140AC@gmail.com> <26BE7B65-3D25-468D-AB9A-51BA1AF97861@gmail.com> <4A27E078-F603-4CA9-9657-82DF68172766@gmail.com> Message-ID: Hi! I am afraid I do not have a off the shelf solution for you. But we are currently putting some more focus on memory usage and bottlenecks in the new ssl implementation so hopfully we will come up with some improvments that will also benefit you. Regards Ingela Erlang/OTP team - Ericsson AB 2012/4/21 Morgan Segalis : > Hi Jeroen, > > Sorry for not pointing that on my first email, but I already use > hibernate_after? > It does some good, but not good enough for what I'm trying to reach. > > Regards, > > Morgan > > Le 21 avr. 2012 ? 18:15, Jeroen Koops a ?crit : > > Hi Morgan, > > If your SSL socket is mostly idle, the option { hibernate_after, integer() > }, which can be passed as one of the options to ssl:connect or ssl:listen, > might help. > > Regards, > > Jeroen > > On Sat, Apr 21, 2012 at 1:33 PM, Morgan Segalis wrote: >> >> Does anyone would have an idea on how to reduce memory footprint for an >> Erlang gen_server ssl socket oriented ? >> Right now each client (gen_server) has a something like 128 Ko in memory. >> while in C++ I have more something like 40 Ko per client. >> I'm using gproc as a pub/sub, each client connected is stored in it. >> >> Like: >> >> - Changing the ssl cipher, would it change the memory footprint ? >> - Changing the buffer size ? >> - ? ? >> >> I'm really looking for any idea that would drastically reduce memory >> footprint... >> Even system oriented advice would be good, like changing /proc/sys/tcp/* >> >> Thank you ! >> mGs >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > > > > -- > Jeroen Koops > > M: koops.j@REDACTED > T: +31-6-55590300 > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From rexxe98@REDACTED Mon Apr 23 09:11:18 2012 From: rexxe98@REDACTED (Andrew Berman) Date: Mon, 23 Apr 2012 00:11:18 -0700 Subject: [erlang-questions] [ANN] SublimErl - code completion: Looking for testers/contributors In-Reply-To: References: Message-ID: Roberto, you're awesome! I was actually in the process of writing a Sublime code completion library for Erlang! I just quickly tried out your stuff and it works well. On initial use Sublime did give me an error that the plugin was taking too long to load. Once I clicked "Ok", though, everything worked well and fast. Now all I need is an Erlang code formatter/beautifier (which also does proper auto-indenting when I press enter) and I'm all set to use Sublime as my de facto editor. Do you have that in the works already? --Andrew On Sun, Apr 22, 2012 at 8:40 PM, Roberto Ostinelli wrote: > > by walking the directory tree upwards from the .erl file you're editing >> until it finds a directory that contains an /ebin directory. >> > > Sorry, I meant the /src directory. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bchesneau@REDACTED Mon Apr 23 09:27:35 2012 From: bchesneau@REDACTED (Benoit Chesneau) Date: Mon, 23 Apr 2012 09:27:35 +0200 Subject: [erlang-questions] [ANN] SublimErl - code completion: Looking for testers/contributors In-Reply-To: References: Message-ID: On Mon, Apr 23, 2012 at 5:38 AM, Roberto Ostinelli wrote: > Hello Max, > > great, thank you :) > > SublimErl entirely relies on rebar, so where/how do you compile your > project? > > `sub_dirs` allows rebar to find path wheer it can find apps. - beno?t From attila.r.nohl@REDACTED Mon Apr 23 09:56:08 2012 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Mon, 23 Apr 2012 09:56:08 +0200 Subject: [erlang-questions] is this a shell bug? In-Reply-To: References: Message-ID: 2012/4/23 ?? : > Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:4:4] > [async-threads:0] [hipe] [kernel-poll:false] > > Eshell V5.9.1 ?(abort with ^G) > 1> self(). > <0.32.0> > 2> process_flag(trap_exit, true). > false > 3> ?spawn_link(fun() -> ok end). > <0.36.0> > 4> process_info(self(), messages). > {messages,[{'EXIT',<0.36.0>,normal}]} > 5> receive X -> X end. > {'EXIT',<0.36.0>,normal} > 6> ?spawn_link(fun() -> ok end). > <0.40.0> > 7> process_info(self(), messages). > {messages,[{'EXIT',<0.40.0>,normal}]} > 8> receive X -> X end. > > shell SUSPENDING .... WHAT's happed here? X was already bound, so you were waiting for {'EXIT',<0.36.0>,normal}, but got {'EXIT',<0.40.0>,normal} Too bad the shell can't read my mind, I've spent more hours chasing "bugs" like this than I'm willing to admit. From ulf@REDACTED Mon Apr 23 09:56:43 2012 From: ulf@REDACTED (Ulf Wiger) Date: Mon, 23 Apr 2012 09:56:43 +0200 Subject: [erlang-questions] How to handle a massive amount of UDP packets? In-Reply-To: <20120423062515.GF82789@netch.kiev.ua> References: <4F8B0E95.4060003@berlin.ccc.de> <4F8BE6FB.3020205@berlin.ccc.de> <4F8D93A9.3060303@berlin.ccc.de> <20120422202600.GA84026@netch.kiev.ua> <20120423062515.GF82789@netch.kiev.ua> Message-ID: <7B47CEE0-5BBE-4CA9-8CB1-947D4A130826@feuerlabs.com> On 23 Apr 2012, at 08:25, Valentin Nechayev wrote: >> From: Ulf Wiger > >> What one can do is to combine {active, once} with gen_tcp:recv(). >> >> Essentially, you will be served the first message, then read as many as you >> wish from the socket. When the socket is empty, you can again enable >> {active, once}. > > First, the approach you described is quite badly documented. No > description how such non-waiting recv() can be reached. If this is call > with Timeout=0, type timeout() isn't defined, and return value for > timeout isn't defined. It only defines Reason = closed or > inet:posix(). But it's incorrect to guess that eagain (or ewouldblock?) > will be returned, if the implementing code is uniform against timeout > value except infinity. I dislike to use such undocumented ways. Huh? Well, first of all, I wrote gen_tcp:recv() - apologies for that. I agree that the documentation should say that {error, timeout} is one of the possible return values, but this is a small oversight - feel free to submit a patch. It is by no means an undocumented or unsupported behavior. gen_[tcp|udp]:recv() is what you use when you have {active,false}. type timeout() _is_ defined. It's just that the gen_tcp/gen_udp manual doesn't tell you where to find it (I agree this is annoying, but if we're discussing optimal tuning of live systems, perhaps we can agree that we shouldn't let bugs in the documentation limit our options?) Actually, timeout() is a built-in type: timeout() :: 'infinity' | non_neg_integer() non_neg_integer() :: 0.. It's documented in the Reference Manual, chapter 6.2 http://www.erlang.org/doc/reference_manual/typespec.html#id74831 > Second, your approach gives useless process switches. If a long message > is in receiving via TCP, there will be two switches to owner or more - > the first one for the first part of a message, and some next ones for > rest of it. If incoming rate is enough to process each small portion > (TCP window) separately, owner process will get and process them > separately; if its and system speed isn't enough for such switching, > data will group in larger portions. This means that performance > measuring will be total lie, with three intervals - uselessly quick > saturation, then stable 100% under wide load interval, and then > unexpected overloading. It's very hard to diagnose and optimize a > system with such behavior, and this trend to fill the whole system by > one subsystem affects other concurrent subsystems in bad way. One way to look at it is that you go from {active, once} to {active, false} and stay with {active, false} until you get a timeout. Then switch to {active, once} to avoid being locked up in a blocking recv(), which can be bad for e.g. code updates and reconfigurations. If that particular problem doesn't bother you, it may be better to stay in {active, false} and do a blocking read. Chances are, you _will_ regret this. ;-) The only switching that goes on is between the port owner and the port. Granted, there is a performance penalty in using {active, false} and {active, true} (much of the 25% difference reported before). OTOH, {active, true} can only be used if you are absolutely sure you will not kill the system. It completely lacks flow control and effectively disables the back-pressure mechanisms in TCP. Packet loss in UDP _is_ the way for the server to stay alive if it cannot keep up with the rate of incoming requests. If you can over-provision your server side so that it cannot be killed by clients (which usually cannot be guaranteed), foregoing flow control will surely give the best throughput. In my experience, using UDP in situations where high availability is required, and overload possible, is a PITA. It's extremely difficult to achieve a proper overload behavior, if you also want the clients to have a predictable experience. If you want _really_ undocumented, here is one way to get better throughput than ({active,false} and gen_tcp:recv/3), but still keep the packets in the TCP buffer for as long as possible. (Not showing the other shell, where I'm just connecting and sending the messages "one", "two", ?, "five"). Eshell V5.9 (abort with ^G) 1> {ok,L} = gen_tcp:listen(8888,[{packet,2}]). {ok,#Port<0.760>} 2> {ok,S} = gen_tcp:accept(L). {ok,#Port<0.771>} 3> inet:setopts(S,[{active,false}]). ok % Can't use the Length indicator to tell the socket we want as much as possible: 4> gen_tcp:recv(S,1000,1000). {error,einval} % With Length = 0, we get exactly one message. This is what you normally do. 5> gen_tcp:recv(S,0,1000). {ok,"one"} 6> gen_tcp:recv(S,0,1000). {ok,"two"} % This is going directly at the low-level function used by both gen_tcp and gen_udp: 7> [prim_inet:async_recv(S,0,0) || _ <- [1,2,3,4]]. [{ok,3},{ok,4},{ok,5},{ok,6}] 8> flush(). Shell got {inet_async,#Port<0.771>,3,{ok,"three"}} Shell got {inet_async,#Port<0.771>,4,{ok,"four"}} Shell got {inet_async,#Port<0.771>,5,{ok,"five"}} Shell got {inet_async,#Port<0.771>,6,{error,timeout}} Note to self: the JOBS load regulation system internally figures out a quota of jobs for each dispatch. For counter-based regulation, it only supports a fixed job size per-queue, but it wouldn't be hard to allow a configuration that makes the job quota (the 'increment' in the JOBS config) to be dynamic up to a certain limit. The list of counters and their increment size is already passed on when the request is granted, and can be inspected by the client. This could be used in combination with the above to determine how many messages to receive. Jesper, if you want to steal back the MVP status, there's one way to get ahead. ;-) The main trick would be to figure out how to fairly divide the quota among several queued requests - and, as always, how this should be expressed in the config. BR, Ulf W Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com From ulf@REDACTED Mon Apr 23 10:07:11 2012 From: ulf@REDACTED (Ulf Wiger) Date: Mon, 23 Apr 2012 10:07:11 +0200 Subject: [erlang-questions] Type inference in Erlang [WAS: Re: The compiler "eats" structures which are not separated by commas] In-Reply-To: <4F94F5EE.30003@cs.ntua.gr> References: <6e592460-318d-402a-bfe2-9083c919037e@knuth> <4F94F5EE.30003@cs.ntua.gr> Message-ID: <41AB211C-4468-4680-96F9-1689082FF6F4@feuerlabs.com> On 23 Apr 2012, at 08:25, Kostis Sagonas wrote: > On 04/23/2012 04:39 AM, Robert Virding wrote: >> >> Type inferencing in erlang doesn't work. Unfortunately. There are too many places where it breaks down to be useful, for example message passing and code loading. There were attempts in the 90's by people much more knowledgeable than we were on this. > > OMG! > ... > Please think before you write statement that look authoritative but are plainly wrong. Of course, there is always a balance between servicing the community with vivid discourse and protecting your reputation by never risking being wrong. May I suggest that Robert's main mistake was using the word 'useful' - or specifically not clarifying the context. Obviously dialyzer is (extremely) useful, but there is a reason why it's off-line and doesn't actually give compilation errors, but merely advice. > > Kostis > > (*) Note that prohibiting code reloading in some cases is an action which actually might be a good idea even in Erlang as it is today! I really fail to see how the current practice of allowing reloading of single modules that are clearly incompatible with the rest of the system is a safe thing to do or a good idea. But that's a different topic? Indeed, and an interesting one. This would require some chosen level of global analysis, but it might be a good option to have. BR, Ulf W Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com From bourinov@REDACTED Mon Apr 23 10:35:55 2012 From: bourinov@REDACTED (Max Bourinov) Date: Mon, 23 Apr 2012 12:35:55 +0400 Subject: [erlang-questions] [ANN] SublimErl - code completion: Looking for testers/contributors In-Reply-To: References: Message-ID: Hi Beno?t, Thank you for the tip! I do use it in my config. Best regards, Max On Mon, Apr 23, 2012 at 11:27 AM, Benoit Chesneau wrote: > On Mon, Apr 23, 2012 at 5:38 AM, Roberto Ostinelli > wrote: > > Hello Max, > > > > great, thank you :) > > > > SublimErl entirely relies on rebar, so where/how do you compile your > > project? > > > > > > `sub_dirs` allows rebar to find path wheer it can find apps. > > - beno?t > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Mon Apr 23 10:37:41 2012 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Mon, 23 Apr 2012 10:37:41 +0200 Subject: [erlang-questions] Type inference in Erlang [WAS: Re: The compiler "eats" structures which are not separated by commas] In-Reply-To: <41AB211C-4468-4680-96F9-1689082FF6F4@feuerlabs.com> References: <6e592460-318d-402a-bfe2-9083c919037e@knuth> <4F94F5EE.30003@cs.ntua.gr> <41AB211C-4468-4680-96F9-1689082FF6F4@feuerlabs.com> Message-ID: On Mon, Apr 23, 2012 at 10:07, Ulf Wiger wrote: > Obviously dialyzer is (extremely) useful, but there is a reason why it's off-line and doesn't actually give compilation errors, but merely advice. So there is room for a simple and fast analysis of the code that would catch some problems at compile time. Dialyzer is slow because it infers the types, but if one would only consider the declared types (as advice) and the type guards (as authoritative) and do local type inference for a function clause at a time, then it should be fast enough to have as a compiler phase. One could argue that it's easy to see this kind of error without any compiler help, after all there are huge systems in production that work just fine. But since the compiler already warns for "hello + 1", why shouldn't it warn for "X=hello, X+1" or "f(X) when is_atom(X) -> X+1."? best regards, Vlad From v@REDACTED Mon Apr 23 10:59:12 2012 From: v@REDACTED (Valentin Micic) Date: Mon, 23 Apr 2012 10:59:12 +0200 Subject: [erlang-questions] How to handle a massive amount of UDP packets? In-Reply-To: <20120423062515.GF82789@netch.kiev.ua> References: <4F8B0E95.4060003@berlin.ccc.de> <4F8BE6FB.3020205@berlin.ccc.de> <4F8D93A9.3060303@berlin.ccc.de> <20120422202600.GA84026@netch.kiev.ua> <20120423062515.GF82789@netch.kiev.ua> Message-ID: First, why are we making a reference to TCP if subject line says we're discussing UDP? ;-) Second, may I say why I think Ulf's approach better than Valentin's (hey, finally a namesake -- please to meet you): Valentin's approach: Whilst {active, 100} may reduce some overhead, it creates far more damage if one consider ease of programming. For example, how would one know when to issue another {active, N}? What's worse than "useess process switching" is having programmer doing the counting in order to be able to issue another {active, 100} at the end of the cycle. And what happens if one issues {active, 100} while another one is still running? Does this mean that one should expect additional 100 messages, or just 100? OTOH, "useless process switching" notwithstanding, Ulf's approach offers a far simpler solution that does not require changes to driver -- if nothing else, far more practical approach. Now, if I may be impractical, there's an alternative approach, which we've used for some high-throughput application operating on a raw socket - since raw IP is not natively supported by Erlang, we had to write a driver for it. Motivated by a need to increase a throughput, we derived a *at-most-N method*. Simply put, the semantic of {active, 100} syntax in this case would mean that driver shall send in one message a list of up to 100 packets. Assuming it would be simpler for a programmer to traverse a list, rather than counting variable-timing events. This method combines relative simplicity suggested by Ulf, with lower overhead advocated by Valentin Nechayev. Kind regards V/ Or, what should happen if one issue another {active, 100} while the current one is still running? Saying that Ulf's approach gives useless process switches is quite useless -- process switches is what computer does. On 23 Apr 2012, at 8:25 AM, Valentin Nechayev wrote: >> From: Ulf Wiger > >> What one can do is to combine {active, once} with gen_tcp:recv(). >> >> Essentially, you will be served the first message, then read as many as you >> wish from the socket. When the socket is empty, you can again enable >> {active, once}. > > First, the approach you described is quite badly documented. No > description how such non-waiting recv() can be reached. If this is call > with Timeout=0, type timeout() isn't defined, and return value for > timeout isn't defined. It only defines Reason = closed or > inet:posix(). But it's incorrect to guess that eagain (or ewouldblock?) > will be returned, if the implementing code is uniform against timeout > value except infinity. I dislike to use such undocumented ways. > > Second, your approach gives useless process switches. If a long message > is in receiving via TCP, there will be two switches to owner or more - > the first one for the first part of a message, and some next ones for > rest of it. If incoming rate is enough to process each small portion > (TCP window) separately, owner process will get and process them > separately; if its and system speed isn't enough for such switching, > data will group in larger portions. This means that performance > measuring will be total lie, with three intervals - uselessly quick > saturation, then stable 100% under wide load interval, and then > unexpected overloading. It's very hard to diagnose and optimize a > system with such behavior, and this trend to fill the whole system by > one subsystem affects other concurrent subsystems in bad way. > > People invented many mechanisms of avoiding both uselessly fast > switching and non-reasonable delays - see e.g. VMIN and VTIME in > termios, low matermark in BSD sockets. The Max Lapshin's proposition is > among them and should only get small but major extension - to specify > both full limit and inter-portion timeout. > > Third, please see measures by John-Paul Bader in neighbour message: > with {active,false} he gets substantial packet loss, compared to > {active,true}. Yep, this is UDP specifics and nobody guaranteed the > delivery but there is no reason to increase loss without reason. His > result shall be checked against the real reason but I guess these are > socket buffer overflows. With {active,true}, owner mailbox becomes > additional socket buffer with much larger size, but owner process loses > control on its mailbox. Having window of allowed packets, it can > provide more fine tuning of its load. > > > -netch- > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From janburse@REDACTED Mon Apr 23 11:23:01 2012 From: janburse@REDACTED (Jan Burse) Date: Mon, 23 Apr 2012 11:23:01 +0200 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: <049bd08514a53fb92bdc31699b438c8c.squirrel@chasm.otago.ac.nz> References: <4F9320F7.3010009@fastmail.fm> <436F6F6E-1131-4DC8-846B-0B0CC4C92CD8@cs.otago.ac.nz> <4F94BE6A.5010906@fastmail.fm> <049bd08514a53fb92bdc31699b438c8c.squirrel@chasm.otago.ac.nz> Message-ID: <4F951F75.4090708@fastmail.fm> ok@REDACTED schrieb: > We could have a rule that says "take all the > -record(name, { ..., field ... }) > declarations that are visible in the current module, > and for each field name, construct a function > > field(#rec1{...,field=X,...}) -> X; > ... > field(#recn(...,field=X,...}) -> X. > > " > so that instead of Foo#rec.bar we could use a plain > bar(Foo), which is much better syntax for a functional > language than 'get' prefixes. And the type language > used by dialyzer could handle this. This would not be the intention of a getBar(Foo). To be universal so that a resolution a runtime can happen. The intention would be that there are multiple getBar() for each record type that has a bar field. And that the resolution is done a compile time. For a resolution at runtime we wouldn't even need a type inference. Only access to the meta data of the record type declaration. So the universal getXXX() would be: getXXX({Name|Rest}) -> ... record_info(fields,Fields) ... ... determine index of XXX in Fields ... ... access Rest with index ... (The above code is incomplete and I don't think a {Name|Rest} pattern exists in Erlang, but I guess the above can be coded). I guess same could be said for a setXXX(), that a universal one wouldn't need type inference and could be coded in the same vain as the getXXX(). Only reason getXXX()/setXXX() is probably not done is performance loss I guess, since by its universality it must do a record info lookup since any record type Name can come at runtime. If there are multiple getXXX()/setXXX() as in Java then there is no performance problem, only the type inference problem. Well this is not exactly true. Depending on the class hierarchie there can be also late binding and various inline caching techniques are then used: http://en.wikipedia.org/wiki/Inline_caching Bye From janburse@REDACTED Mon Apr 23 11:24:56 2012 From: janburse@REDACTED (Jan Burse) Date: Mon, 23 Apr 2012 11:24:56 +0200 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: <4F951F75.4090708@fastmail.fm> References: <4F9320F7.3010009@fastmail.fm> <436F6F6E-1131-4DC8-846B-0B0CC4C92CD8@cs.otago.ac.nz> <4F94BE6A.5010906@fastmail.fm> <049bd08514a53fb92bdc31699b438c8c.squirrel@chasm.otago.ac.nz> <4F951F75.4090708@fastmail.fm> Message-ID: <4F951FE8.7050005@fastmail.fm> Jan Burse schrieb: > ... record_info(fields,Fields) ... Oops, corr.: ... record_info(fields,Name) ... From bo.zhang86@REDACTED Mon Apr 23 12:14:37 2012 From: bo.zhang86@REDACTED (Bob) Date: Mon, 23 Apr 2012 18:14:37 +0800 Subject: [erlang-questions] [ANN] SublimErl - code completion: Looking for testers/contributors In-Reply-To: References: Message-ID: <58A2D8D012F64220BD3EE816AE12CF73@gmail.com> Hi, It seems like that it does not support "code_completion" from user code? -- Bob Sent with Sparrow (http://www.sparrowmailapp.com/?sig) On Monday, April 23, 2012 at 10:13 AM, Roberto Ostinelli wrote: > Dear all, > > SublimErl, the Sublime Text 2 editor Erlang plugin, now supports code completion in a features branch: > https://github.com/ostinelli/SublimErl/tree/features/code_completion > > An animated GIF showing how it works can be seen here: > http://www.ostinelli.net/_out_images/code_completion.gif > > Before I push it to master, I'd love to have some feedback from testers. If anyone is available, please msg me. > > As usual, comments / criticism / feedback welcome. > > r. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED (mailto:erlang-questions@REDACTED) > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rtrlists@REDACTED Mon Apr 23 12:23:50 2012 From: rtrlists@REDACTED (Robert Raschke) Date: Mon, 23 Apr 2012 11:23:50 +0100 Subject: [erlang-questions] is this a shell bug? In-Reply-To: References: Message-ID: Whenever I tinker with message sending and receiving in the shell, I make me this handy small fun (or similar) to ease my life: (erl@REDACTED)1> R = fun () -> receive X -> X after 0 -> no_messages_pending end end. #Fun (erl@REDACTED)2> self() ! {a, message}. {a,message} (erl@REDACTED)3> R(). {a,message} (erl@REDACTED)4> R(). no_messages_pending (erl@REDACTED)5> Robby On Mon, Apr 23, 2012 at 8:56 AM, Attila Rajmund Nohl < attila.r.nohl@REDACTED> wrote: > 2012/4/23 ?? : > > Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:4:4] > > [async-threads:0] [hipe] [kernel-poll:false] > > > > Eshell V5.9.1 (abort with ^G) > > 1> self(). > > <0.32.0> > > 2> process_flag(trap_exit, true). > > false > > 3> spawn_link(fun() -> ok end). > > <0.36.0> > > 4> process_info(self(), messages). > > {messages,[{'EXIT',<0.36.0>,normal}]} > > 5> receive X -> X end. > > {'EXIT',<0.36.0>,normal} > > 6> spawn_link(fun() -> ok end). > > <0.40.0> > > 7> process_info(self(), messages). > > {messages,[{'EXIT',<0.40.0>,normal}]} > > 8> receive X -> X end. > > > > shell SUSPENDING .... WHAT's happed here? > > X was already bound, so you were waiting for {'EXIT',<0.36.0>,normal}, > but got {'EXIT',<0.40.0>,normal} > > Too bad the shell can't read my mind, I've spent more hours chasing > "bugs" like this than I'm willing to admit. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hynek@REDACTED Mon Apr 23 13:01:36 2012 From: hynek@REDACTED (Hynek Vychodil) Date: Mon, 23 Apr 2012 13:01:36 +0200 Subject: [erlang-questions] is this a shell bug? In-Reply-To: References: Message-ID: Doesn't flush() work as well for you? On Mon, Apr 23, 2012 at 12:23 PM, Robert Raschke wrote: > Whenever I tinker with message sending and receiving in the shell, I make me > this handy small fun (or similar) to ease my life: > > (erl@REDACTED)1> R = fun () -> receive X -> X after 0 -> > no_messages_pending end end. > #Fun > (erl@REDACTED)2> self() ! {a, message}. > {a,message} > (erl@REDACTED)3> R(). > {a,message} > (erl@REDACTED)4> R(). > no_messages_pending > (erl@REDACTED)5> > > > Robby > > > On Mon, Apr 23, 2012 at 8:56 AM, Attila Rajmund Nohl > wrote: >> >> 2012/4/23 ?? : >> > Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:4:4] >> > [async-threads:0] [hipe] [kernel-poll:false] >> > >> > Eshell V5.9.1 ?(abort with ^G) >> > 1> self(). >> > <0.32.0> >> > 2> process_flag(trap_exit, true). >> > false >> > 3> ?spawn_link(fun() -> ok end). >> > <0.36.0> >> > 4> process_info(self(), messages). >> > {messages,[{'EXIT',<0.36.0>,normal}]} >> > 5> receive X -> X end. >> > {'EXIT',<0.36.0>,normal} >> > 6> ?spawn_link(fun() -> ok end). >> > <0.40.0> >> > 7> process_info(self(), messages). >> > {messages,[{'EXIT',<0.40.0>,normal}]} >> > 8> receive X -> X end. >> > >> > shell SUSPENDING .... WHAT's happed here? >> >> X was already bound, so you were waiting for {'EXIT',<0.36.0>,normal}, >> but got {'EXIT',<0.40.0>,normal} >> >> Too bad the shell can't read my mind, I've spent more hours chasing >> "bugs" like this than I'm willing to admit. >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Hynek Vychodil BI consultant GoodData n?m?st? 28. ??jna 1104/17, 602 00, Brno - ?ern? Pole Office: ? +420 530 50 7704 E-mail: ?hynek@REDACTED Web: ? ? www.gooddata.com From rtrlists@REDACTED Mon Apr 23 14:28:08 2012 From: rtrlists@REDACTED (Robert Raschke) Date: Mon, 23 Apr 2012 13:28:08 +0100 Subject: [erlang-questions] is this a shell bug? In-Reply-To: References: Message-ID: Intriguing. I was unaware of that. Thank you! On Mon, Apr 23, 2012 at 12:01 PM, Hynek Vychodil wrote: > Doesn't flush() work as well for you? > > On Mon, Apr 23, 2012 at 12:23 PM, Robert Raschke > wrote: > > Whenever I tinker with message sending and receiving in the shell, I > make me > > this handy small fun (or similar) to ease my life: > > > > (erl@REDACTED)1> R = fun () -> receive X -> X after 0 -> > > no_messages_pending end end. > > #Fun > > (erl@REDACTED)2> self() ! {a, message}. > > {a,message} > > (erl@REDACTED)3> R(). > > {a,message} > > (erl@REDACTED)4> R(). > > no_messages_pending > > (erl@REDACTED)5> > > > > > > Robby > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kostis@REDACTED Mon Apr 23 14:49:00 2012 From: kostis@REDACTED (Kostis Sagonas) Date: Mon, 23 Apr 2012 14:49:00 +0200 Subject: [erlang-questions] Type inference in Erlang [WAS: Re: The compiler "eats" structures which are not separated by commas] In-Reply-To: <41AB211C-4468-4680-96F9-1689082FF6F4@feuerlabs.com> References: <6e592460-318d-402a-bfe2-9083c919037e@knuth> <4F94F5EE.30003@cs.ntua.gr> <41AB211C-4468-4680-96F9-1689082FF6F4@feuerlabs.com> Message-ID: <4F954FBC.603@cs.ntua.gr> On 04/23/2012 10:07 AM, Ulf Wiger wrote: > > On 23 Apr 2012, at 08:25, Kostis Sagonas wrote: > >> On 04/23/2012 04:39 AM, Robert Virding wrote: >>> >>> Type inferencing in erlang doesn't work. Unfortunately. There are too many places where it breaks down to be useful, for example message passing and code loading. There were attempts in the 90's by people much more knowledgeable than we were on this. >> >> OMG! >> ... >> Please think before you write statement that look authoritative but are plainly wrong. > > Of course, there is always a balance between servicing the community with vivid discourse and protecting your reputation by never risking being wrong. > > May I suggest that Robert's main mistake was using the word 'useful' - or specifically not clarifying the context. Well, that's not it. Please re-read his post. His post started with an authoritative statement: "Type inferencing in erlang doesn't work." Sorry, but this is plainly wrong. Then it continued about the "too many places that it (type inference) breaks down to be useful" stating "message passing and code loading" as some of the reasons for this. As explained in my post, handling the interaction of type inference with code reloading is just an engineering issue -- by no means trivial but an engineering issue nonetheless. Finally, to give more evidence for this claim Robert mentioned "attempts in the 90's by knowledgeable people". If I took this last statement literally, I would probably find it a bit insulting -- I don't because I am sure that Robert did not mean it this way. Anyway, I will repeat myself: *there is no fundamental reason for type inference in Erlang not to work*; there are only engineering and still (erroneous) community perception reasons. > Obviously dialyzer is (extremely) useful, but there is a reason why it's off-line and doesn't actually give compilation errors, but merely advice. Well, no. This is also a wrong statement. The reason why dialyzer is off-line is mainly historical (it started as a separate tool) but also related to the fact that it is typically more effective when analyzing a complete application rather than a single module. But fundamentally there is actually no reason why dialyzer should remain an off-line tool, especially if the BEAM compiler gets extended to take a set of module rather than a single module as input. Anyway, it's really a matter of somebody (at Ericsson?) adding a hook to it in the compiler, perhaps via an appropriate option. As to whether the results of dialyzer's analysis will be just warnings or compiler errors it's just a matter of preference and of the community reaching consensus on this. (I am guessing the community may not be ready for this yet. For the time being, we have the "warnings_as_errors" compiler option.) But the whole thing can be done in a couple of weeks. Really. Kostis From roberto.ostinelli@REDACTED Mon Apr 23 16:45:17 2012 From: roberto.ostinelli@REDACTED (Roberto Ostinelli) Date: Mon, 23 Apr 2012 07:45:17 -0700 Subject: [erlang-questions] [ANN] SublimErl - code completion: Looking for testers/contributors In-Reply-To: <58A2D8D012F64220BD3EE816AE12CF73@gmail.com> References: <58A2D8D012F64220BD3EE816AE12CF73@gmail.com> Message-ID: <84166294-25C9-443F-ABBA-3DB51A696068@widetag.com> > Hi, It seems like that it does not support "code_completion" from user code? it does as long as it compiles. plugin is in beta, so any feedback to fix any unexpected behaviour is welcome. r. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Mon Apr 23 17:05:42 2012 From: ulf@REDACTED (Ulf Wiger) Date: Mon, 23 Apr 2012 17:05:42 +0200 Subject: [erlang-questions] Type inference in Erlang [WAS: Re: The compiler "eats" structures which are not separated by commas] In-Reply-To: <4F954FBC.603@cs.ntua.gr> References: <6e592460-318d-402a-bfe2-9083c919037e@knuth> <4F94F5EE.30003@cs.ntua.gr> <41AB211C-4468-4680-96F9-1689082FF6F4@feuerlabs.com> <4F954FBC.603@cs.ntua.gr> Message-ID: <2243B4B7-416B-4009-AC0E-D24D6E31E029@feuerlabs.com> On 23 Apr 2012, at 14:49, Kostis Sagonas wrote: > Finally, to give more evidence for this claim Robert mentioned "attempts in the 90's by knowledgeable people". If I took this last statement literally, I would probably find it a bit insulting -- I don't because I am sure that Robert did not mean it this way. So am I. I'm sure he referred to people like Wadler, Marlow, Arts and Armstrong. I guess you could see this as the first wave of type analyzers for Erlang. Dialyzer was introduced in 2004, right? Sven-Olof Nystr?m talked about his soft-typing system for Erlang at the 2003 Erlang workshop... At the start of the AXD 301 project, in 1996, we were promised that there would be a type checker with the first Erlang/OTP release - something derived from the Wadler/Marlow work, so we were doing our best to prepare, by inserting comments that at least approximated the syntax we'd seen examples of. When some type checker prototypes became ready for some serious testing (I recall trying to integrate them into our design flow), we had too much legacy code, and an established workflow that didn't play well with the type checkers. They were not very good at doing partial analysis, and going through our > 1 million lines of Erlang code and annotating everything was not an option. In other words, it was type *checking* - not inference. In short, they were never useful to us. No blame should fall on them (or on the original designers of Erlang). We certainly could have approached our design differently, if our primary goal had been to stay compatible with a future static type checker, but as it was, we had different requirements, and adapted to an Erlang without type inference, and without static type checking. When we first tested Dialyzer in 2004, it was very quickly well received, since it didn't clash with the established culture, even though we were then 8 years into our erlang-based product development. This was quite a feat. Given that a useful approach eventually emerged, surely the work that went before it was not a waste of time, and was therefore useful in a different context. I'm being deliberately hand-wavy on the connections, since I don't know to what extent the different projects informed each other, but negative results are also valuable results. Obviously, there is a huge difference between "commercially useful" and "academically useful", and even between "practically useful" and "theoretically useful". As to whether this means Robert was justified in saying that "type inferencing doesn't work", I will let him try to defend. :) But the *context*, once more, was that he commented on the statement "... which a language with type inference doesn't need", even more specifically, suggesting that certain parts of the Erlang syntax could be eliminated with the help of type inferencing. That Robert's claim *in this very narrow context* is plainly false is at least not obvious to me. > Anyway, I will repeat myself: *there is no fundamental reason for type inference in Erlang not to work*; there are only engineering and still (erroneous) community perception reasons. > >> Obviously dialyzer is (extremely) useful, but there is a reason why it's off-line and doesn't actually give compilation errors, but merely advice. > > Well, no. This is also a wrong statement. The reason why dialyzer is off-line is mainly historical (it started as a separate tool) but also related to the fact that it is typically more effective when analyzing a complete application rather than a single module. But fundamentally there is actually no reason why dialyzer should remain an off-line tool, especially if the BEAM compiler gets extended to take a set of module rather than a single module as input. Hmm, if we are nit-picking, did you just tell me that it was a wrong statement that "there is a reason why it's off-line?", and then proceed to give me the reason why Dialyzer is an off-line tool? ;-) Given that my reply was directed at the human equivalent of Dialyzer, I took some care to stay within the bounds of what I knew was correct (and as a consequence, didn't end up saying much). I merely observed that dialyzer is currently an off-line tool, and "merely" gives advice. I did *not* claim that there was a fundamental reason why it couldn't be more tightly integrated into the compilation flow. On the contrary, I have many times expressed the hope that we are slowly moving in that direction, including gradual changes of how the community views (and works with) its erlang code. Actually, the current state of things seems to be that the compiler borrows ideas from dialyzer and implements them selectively. This doesn't seem like an ideal setup. Since Vlad in a different thread mentioned that Dialyzer's was too slow to be incorporated into the compilation flow, I took some time to do some measurements to prove him wrong. Unfortunately, calling dialyzer_cl:run(?) with only one file (gproc.beam) given an up-to-date PLC took 3.5 seconds, of which most of the time seemed to be spent inside the actual analysis in dialyzer_analysis_callgraph. I gave up at that point, since my initial assumption was not so easily proven as I had hoped. Since the entire compilation of gproc.erl takes ca 320 ms on my machine, even reducing the runtime of Dialyzer by 10x would mean a doubling of the compilation time. Granted, my investigation was shallow to say the least, and on this point, I sincerely hope I am wrong. Also, as long as it's an option, even 3.5 secs might actually be quite reasonable sometimes. Bob Ippolito gave a talk at the London Erlang Factory last year, where he mentioned some practical issues they had had with Dialyzer (http://www.erlang-factory.com/conference/London2011/speakers/BobIppolito, 29:30 into the presentation - I recall that you were there). I know some of his complaints have been addressed to some extent (and so did Bob at the time), but you do often need to clear a few hurdles before you have dialyzer well adapted to your design flow (or the other way around). These are engineering issues, I agree, but there is really a fairly large number of tools and techniques that are discarded as "not useful" on mostly fairly subjective grounds, because the cost-benefit analysis is not clear to enough developers. Having said this, Dialyzer *is* one of the most popular tools in the Erlang community - in other words empirically "useful". ;-) BR, Ulf W Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com From bo.zhang86@REDACTED Mon Apr 23 17:21:04 2012 From: bo.zhang86@REDACTED (Bob) Date: Mon, 23 Apr 2012 23:21:04 +0800 Subject: [erlang-questions] [ANN] SublimErl - code completion: Looking for testers/contributors In-Reply-To: <84166294-25C9-443F-ABBA-3DB51A696068@widetag.com> References: <58A2D8D012F64220BD3EE816AE12CF73@gmail.com> <84166294-25C9-443F-ABBA-3DB51A696068@widetag.com> Message-ID: <8783F33A7D624D109DA0EDAB6B64C693@gmail.com> Good. If you can help us to provide auto compile when saving file, I think it will better to use. ps: Maybe you can consider scanning src than beam. Thanks! -- Bob Sent with Sparrow (http://www.sparrowmailapp.com/?sig) On Monday, April 23, 2012 at 10:45 PM, Roberto Ostinelli wrote: > > > Hi, It seems like that it does not support "code_completion" from user code? > it does as long as it compiles. > > plugin is in beta, so any feedback to fix any unexpected behaviour is welcome. > > r. -------------- next part -------------- An HTML attachment was scrubbed... URL: From roberto.ostinelli@REDACTED Mon Apr 23 17:56:43 2012 From: roberto.ostinelli@REDACTED (Roberto Ostinelli) Date: Mon, 23 Apr 2012 08:56:43 -0700 Subject: [erlang-questions] [ANN] SublimErl - code completion: Looking for testers/contributors In-Reply-To: <8783F33A7D624D109DA0EDAB6B64C693@gmail.com> References: <58A2D8D012F64220BD3EE816AE12CF73@gmail.com> <84166294-25C9-443F-ABBA-3DB51A696068@widetag.com> <8783F33A7D624D109DA0EDAB6B64C693@gmail.com> Message-ID: > Good. If you can help us to provide auto compile when saving file, I think it will better to use. it already works like this. r. From roberto@REDACTED Mon Apr 23 18:02:59 2012 From: roberto@REDACTED (Roberto Ostinelli) Date: Mon, 23 Apr 2012 09:02:59 -0700 Subject: [erlang-questions] rebar compile Message-ID: Dear all, is there a way to make rebar compile skip the files that do not compile properly and proceed to the next ones, instead of breaking the compile process asa it encounters one error? Thank you, r. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Mon Apr 23 18:12:15 2012 From: ulf@REDACTED (Ulf Wiger) Date: Mon, 23 Apr 2012 18:12:15 +0200 Subject: [erlang-questions] rebar compile In-Reply-To: References: Message-ID: There doesn't seem to be. It would not be terribly hard to add, I think. E.g. an option to make rebar_erlc_compiler:doterl_compile/3 and friends return 'skipped' on compilation error rather than ?FAIL. BR, Ulf W On 23 Apr 2012, at 18:02, Roberto Ostinelli wrote: > Dear all, > > is there a way to make rebar compile skip the files that do not compile properly and proceed to the next ones, instead of breaking the compile process asa it encounters one error? > > Thank you, > > r. _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From roberto.ostinelli@REDACTED Mon Apr 23 18:13:28 2012 From: roberto.ostinelli@REDACTED (Roberto Ostinelli) Date: Mon, 23 Apr 2012 09:13:28 -0700 Subject: [erlang-questions] [ANN] SublimErl - code completion: Looking for testers/contributors In-Reply-To: References: Message-ID: <28194813-AF28-4E81-9F17-62E23C64A8DA@widetag.com> i'd be more than happy to accept patches that improve support with custom directory specs. right now i'm concentrating in making everything work as smoothly as possible. r. On 23/apr/2012, at 00:27, Benoit Chesneau wrote: > `sub_dirs` allows rebar to find path wheer it can find apps. > > - beno?t From dan@REDACTED Mon Apr 23 19:32:40 2012 From: dan@REDACTED (Daniel Dormont) Date: Mon, 23 Apr 2012 13:32:40 -0400 Subject: [erlang-questions] Type inference in Erlang [WAS: Re: The compiler "eats" structures which are not separated by commas] In-Reply-To: <2243B4B7-416B-4009-AC0E-D24D6E31E029@feuerlabs.com> References: <6e592460-318d-402a-bfe2-9083c919037e@knuth> <4F94F5EE.30003@cs.ntua.gr> <41AB211C-4468-4680-96F9-1689082FF6F4@feuerlabs.com> <4F954FBC.603@cs.ntua.gr> <2243B4B7-416B-4009-AC0E-D24D6E31E029@feuerlabs.com> Message-ID: I didn't know Wadler and Marlow were involved with Erlang at one point. I'm a little familiar with them from the Haskell world. That's kind of cool. Was their work influential in the design of the type specification system that Erlang has today, and Dialyzer? Or was that separate? dan On Mon, Apr 23, 2012 at 11:05 AM, Ulf Wiger wrote: > > On 23 Apr 2012, at 14:49, Kostis Sagonas wrote: > > > Finally, to give more evidence for this claim Robert mentioned "attempts > in the 90's by knowledgeable people". If I took this last statement > literally, I would probably find it a bit insulting -- I don't because I am > sure that Robert did not mean it this way. > > So am I. > > I'm sure he referred to people like Wadler, Marlow, Arts and Armstrong. I > guess you could see this as the first wave of type analyzers for Erlang. > Dialyzer was introduced in 2004, right? Sven-Olof Nystr?m talked about his > soft-typing system for Erlang at the 2003 Erlang workshop... > > At the start of the AXD 301 project, in 1996, we were promised that there > would be a type checker with the first Erlang/OTP release - something > derived from the Wadler/Marlow work, so we were doing our best to prepare, > by inserting comments that at least approximated the syntax we'd seen > examples of. When some type checker prototypes became ready for some > serious testing (I recall trying to integrate them into our design flow), > we had too much legacy code, and an established workflow that didn't play > well with the type checkers. They were not very good at doing partial > analysis, and going through our > 1 million lines of Erlang code and > annotating everything was not an option. In other words, it was type > *checking* - not inference. > > In short, they were never useful to us. No blame should fall on them (or > on the original designers of Erlang). We certainly could have approached > our design differently, if our primary goal had been to stay compatible > with a future static type checker, but as it was, we had different > requirements, and adapted to an Erlang without type inference, and without > static type checking. > > When we first tested Dialyzer in 2004, it was very quickly well received, > since it didn't clash with the established culture, even though we were > then 8 years into our erlang-based product development. This was quite a > feat. Given that a useful approach eventually emerged, surely the work that > went before it was not a waste of time, and was therefore useful in a > different context. I'm being deliberately hand-wavy on the connections, > since I don't know to what extent the different projects informed each > other, but negative results are also valuable results. > > Obviously, there is a huge difference between "commercially useful" and > "academically useful", and even between "practically useful" and > "theoretically useful". > > As to whether this means Robert was justified in saying that "type > inferencing doesn't work", I will let him try to defend. :) > > But the *context*, once more, was that he commented on the statement "... > which a language with type inference doesn't need", even more specifically, > suggesting that certain parts of the Erlang syntax could be eliminated with > the help of type inferencing. That Robert's claim *in this very narrow > context* is plainly false is at least not obvious to me. > > > > Anyway, I will repeat myself: *there is no fundamental reason for type > inference in Erlang not to work*; there are only engineering and still > (erroneous) community perception reasons. > > > >> Obviously dialyzer is (extremely) useful, but there is a reason why > it's off-line and doesn't actually give compilation errors, but merely > advice. > > > > Well, no. This is also a wrong statement. The reason why dialyzer is > off-line is mainly historical (it started as a separate tool) but also > related to the fact that it is typically more effective when analyzing a > complete application rather than a single module. But fundamentally there > is actually no reason why dialyzer should remain an off-line tool, > especially if the BEAM compiler gets extended to take a set of module > rather than a single module as input. > > Hmm, if we are nit-picking, did you just tell me that it was a wrong > statement that "there is a reason why it's off-line?", and then proceed to > give me the reason why Dialyzer is an off-line tool? ;-) > > Given that my reply was directed at the human equivalent of Dialyzer, I > took some care to stay within the bounds of what I knew was correct (and as > a consequence, didn't end up saying much). I merely observed that dialyzer > is currently an off-line tool, and "merely" gives advice. I did *not* claim > that there was a fundamental reason why it couldn't be more tightly > integrated into the compilation flow. On the contrary, I have many times > expressed the hope that we are slowly moving in that direction, including > gradual changes of how the community views (and works with) its erlang code. > > Actually, the current state of things seems to be that the compiler > borrows ideas from dialyzer and implements them selectively. This doesn't > seem like an ideal setup. > > Since Vlad in a different thread mentioned that Dialyzer's was too slow to > be incorporated into the compilation flow, I took some time to do some > measurements to prove him wrong. Unfortunately, calling dialyzer_cl:run(?) > with only one file (gproc.beam) given an up-to-date PLC took 3.5 seconds, > of which most of the time seemed to be spent inside the actual analysis in > dialyzer_analysis_callgraph. I gave up at that point, since my initial > assumption was not so easily proven as I had hoped. > > Since the entire compilation of gproc.erl takes ca 320 ms on my machine, > even reducing the runtime of Dialyzer by 10x would mean a doubling of the > compilation time. Granted, my investigation was shallow to say the least, > and on this point, I sincerely hope I am wrong. Also, as long as it's an > option, even 3.5 secs might actually be quite reasonable sometimes. > > Bob Ippolito gave a talk at the London Erlang Factory last year, where he > mentioned some practical issues they had had with Dialyzer ( > http://www.erlang-factory.com/conference/London2011/speakers/BobIppolito, > 29:30 into the presentation - I recall that you were there). I know some of > his complaints have been addressed to some extent (and so did Bob at the > time), but you do often need to clear a few hurdles before you have > dialyzer well adapted to your design flow (or the other way around). > > These are engineering issues, I agree, but there is really a fairly large > number of tools and techniques that are discarded as "not useful" on mostly > fairly subjective grounds, because the cost-benefit analysis is not clear > to enough developers. > > Having said this, Dialyzer *is* one of the most popular tools in the > Erlang community - in other words empirically "useful". ;-) > > BR, > Ulf W > > Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. > http://feuerlabs.com > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From juan.puig.martinez@REDACTED Mon Apr 23 19:37:48 2012 From: juan.puig.martinez@REDACTED (Juan Puig) Date: Mon, 23 Apr 2012 18:37:48 +0100 (BST) Subject: [erlang-questions] Float multiplication behaviours In-Reply-To: <2dca6d7b-76fc-436b-ae10-35f4d20c1a38@knuth> Message-ID: <14d07c6c-d645-47d7-b124-0454a938cb56@knuth> Hello there, we are running Erlang R15B (erts-5.9). Any fact that could demonstrate the following behaviour? (node@REDACTED)51> 1.20*100. 120.0 (node@REDACTED)49> 10.20*100. 1019.9999999999999 (node@REDACTED)50> 100.20*100. 10020.0 Juan Puig Erlang Solutions Ltd - London www.erlang-solutions.com From ulf@REDACTED Mon Apr 23 19:41:07 2012 From: ulf@REDACTED (Ulf Wiger) Date: Mon, 23 Apr 2012 19:41:07 +0200 Subject: [erlang-questions] Type inference in Erlang [WAS: Re: The compiler "eats" structures which are not separated by commas] In-Reply-To: References: <6e592460-318d-402a-bfe2-9083c919037e@knuth> <4F94F5EE.30003@cs.ntua.gr> <41AB211C-4468-4680-96F9-1689082FF6F4@feuerlabs.com> <4F954FBC.603@cs.ntua.gr> <2243B4B7-416B-4009-AC0E-D24D6E31E029@feuerlabs.com> Message-ID: <8F747BF4-1A3B-4048-9F4F-60B33DAA9865@feuerlabs.com> http://community.haskell.org/~simonmar/papers/erltc.pdf BR, Ulf W On 23 Apr 2012, at 19:32, Daniel Dormont wrote: > I didn't know Wadler and Marlow were involved with Erlang at one point. I'm a little familiar with them from the Haskell world. That's kind of cool. > > Was their work influential in the design of the type specification system that Erlang has today, and Dialyzer? Or was that separate? > > dan > > On Mon, Apr 23, 2012 at 11:05 AM, Ulf Wiger wrote: > > On 23 Apr 2012, at 14:49, Kostis Sagonas wrote: > > > Finally, to give more evidence for this claim Robert mentioned "attempts in the 90's by knowledgeable people". If I took this last statement literally, I would probably find it a bit insulting -- I don't because I am sure that Robert did not mean it this way. > > So am I. > > I'm sure he referred to people like Wadler, Marlow, Arts and Armstrong. I guess you could see this as the first wave of type analyzers for Erlang. Dialyzer was introduced in 2004, right? Sven-Olof Nystr?m talked about his soft-typing system for Erlang at the 2003 Erlang workshop... > > At the start of the AXD 301 project, in 1996, we were promised that there would be a type checker with the first Erlang/OTP release - something derived from the Wadler/Marlow work, so we were doing our best to prepare, by inserting comments that at least approximated the syntax we'd seen examples of. When some type checker prototypes became ready for some serious testing (I recall trying to integrate them into our design flow), we had too much legacy code, and an established workflow that didn't play well with the type checkers. They were not very good at doing partial analysis, and going through our > 1 million lines of Erlang code and annotating everything was not an option. In other words, it was type *checking* - not inference. > > In short, they were never useful to us. No blame should fall on them (or on the original designers of Erlang). We certainly could have approached our design differently, if our primary goal had been to stay compatible with a future static type checker, but as it was, we had different requirements, and adapted to an Erlang without type inference, and without static type checking. > > When we first tested Dialyzer in 2004, it was very quickly well received, since it didn't clash with the established culture, even though we were then 8 years into our erlang-based product development. This was quite a feat. Given that a useful approach eventually emerged, surely the work that went before it was not a waste of time, and was therefore useful in a different context. I'm being deliberately hand-wavy on the connections, since I don't know to what extent the different projects informed each other, but negative results are also valuable results. > > Obviously, there is a huge difference between "commercially useful" and "academically useful", and even between "practically useful" and "theoretically useful". > > As to whether this means Robert was justified in saying that "type inferencing doesn't work", I will let him try to defend. :) > > But the *context*, once more, was that he commented on the statement "... which a language with type inference doesn't need", even more specifically, suggesting that certain parts of the Erlang syntax could be eliminated with the help of type inferencing. That Robert's claim *in this very narrow context* is plainly false is at least not obvious to me. > > > > Anyway, I will repeat myself: *there is no fundamental reason for type inference in Erlang not to work*; there are only engineering and still (erroneous) community perception reasons. > > > >> Obviously dialyzer is (extremely) useful, but there is a reason why it's off-line and doesn't actually give compilation errors, but merely advice. > > > > Well, no. This is also a wrong statement. The reason why dialyzer is off-line is mainly historical (it started as a separate tool) but also related to the fact that it is typically more effective when analyzing a complete application rather than a single module. But fundamentally there is actually no reason why dialyzer should remain an off-line tool, especially if the BEAM compiler gets extended to take a set of module rather than a single module as input. > > Hmm, if we are nit-picking, did you just tell me that it was a wrong statement that "there is a reason why it's off-line?", and then proceed to give me the reason why Dialyzer is an off-line tool? ;-) > > Given that my reply was directed at the human equivalent of Dialyzer, I took some care to stay within the bounds of what I knew was correct (and as a consequence, didn't end up saying much). I merely observed that dialyzer is currently an off-line tool, and "merely" gives advice. I did *not* claim that there was a fundamental reason why it couldn't be more tightly integrated into the compilation flow. On the contrary, I have many times expressed the hope that we are slowly moving in that direction, including gradual changes of how the community views (and works with) its erlang code. > > Actually, the current state of things seems to be that the compiler borrows ideas from dialyzer and implements them selectively. This doesn't seem like an ideal setup. > > Since Vlad in a different thread mentioned that Dialyzer's was too slow to be incorporated into the compilation flow, I took some time to do some measurements to prove him wrong. Unfortunately, calling dialyzer_cl:run(?) with only one file (gproc.beam) given an up-to-date PLC took 3.5 seconds, of which most of the time seemed to be spent inside the actual analysis in dialyzer_analysis_callgraph. I gave up at that point, since my initial assumption was not so easily proven as I had hoped. > > Since the entire compilation of gproc.erl takes ca 320 ms on my machine, even reducing the runtime of Dialyzer by 10x would mean a doubling of the compilation time. Granted, my investigation was shallow to say the least, and on this point, I sincerely hope I am wrong. Also, as long as it's an option, even 3.5 secs might actually be quite reasonable sometimes. > > Bob Ippolito gave a talk at the London Erlang Factory last year, where he mentioned some practical issues they had had with Dialyzer (http://www.erlang-factory.com/conference/London2011/speakers/BobIppolito, 29:30 into the presentation - I recall that you were there). I know some of his complaints have been addressed to some extent (and so did Bob at the time), but you do often need to clear a few hurdles before you have dialyzer well adapted to your design flow (or the other way around). > > These are engineering issues, I agree, but there is really a fairly large number of tools and techniques that are discarded as "not useful" on mostly fairly subjective grounds, because the cost-benefit analysis is not clear to enough developers. > > Having said this, Dialyzer *is* one of the most popular tools in the Erlang community - in other words empirically "useful". ;-) > > BR, > Ulf W > > Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. > http://feuerlabs.com > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From vinoski@REDACTED Mon Apr 23 19:46:14 2012 From: vinoski@REDACTED (Steve Vinoski) Date: Mon, 23 Apr 2012 13:46:14 -0400 Subject: [erlang-questions] Float multiplication behaviours In-Reply-To: <14d07c6c-d645-47d7-b124-0454a938cb56@knuth> References: <2dca6d7b-76fc-436b-ae10-35f4d20c1a38@knuth> <14d07c6c-d645-47d7-b124-0454a938cb56@knuth> Message-ID: On Mon, Apr 23, 2012 at 1:37 PM, Juan Puig wrote: > Hello there, > > we are running Erlang R15B (erts-5.9). Any fact that could demonstrate the following behaviour? > > (node@REDACTED)51> 1.20*100. > 120.0 > (node@REDACTED)49> 10.20*100. > 1019.9999999999999 > (node@REDACTED)50> 100.20*100. > 10020.0 http://floating-point-gui.de/ --steve From vladdu55@REDACTED Mon Apr 23 20:49:45 2012 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Mon, 23 Apr 2012 20:49:45 +0200 Subject: [erlang-questions] Type inference in Erlang [WAS: Re: The compiler "eats" structures which are not separated by commas] In-Reply-To: <2243B4B7-416B-4009-AC0E-D24D6E31E029@feuerlabs.com> References: <6e592460-318d-402a-bfe2-9083c919037e@knuth> <4F94F5EE.30003@cs.ntua.gr> <41AB211C-4468-4680-96F9-1689082FF6F4@feuerlabs.com> <4F954FBC.603@cs.ntua.gr> <2243B4B7-416B-4009-AC0E-D24D6E31E029@feuerlabs.com> Message-ID: On Mon, Apr 23, 2012 at 17:05, Ulf Wiger wrote: > Since Vlad in a different thread mentioned that Dialyzer's was too slow to be incorporated into the compilation flow, I took some time to do some measurements to prove him wrong. Unfortunately, calling dialyzer_cl:run(?) with only one file (gproc.beam) given an up-to-date PLC took 3.5 seconds, of which most of the time seemed to be spent inside the actual analysis in dialyzer_analysis_callgraph. I gave up at that point, since my initial assumption was not so easily proven as I had hoped. > > Since the entire compilation of gproc.erl takes ca 320 ms on my machine, even reducing the runtime of Dialyzer by 10x would mean a doubling of the compilation time. Granted, my investigation was shallow to say the least, and on this point, I sincerely hope I am wrong. Also, as long as it's an option, even 3.5 secs might actually be quite reasonable sometimes. I would have been the first to be happy to be proved wong on that! :-) There is the additional problem that running an analysis on a full system is worse than linear on the number of functions (I won't hazard into guessing if it's polynomial or even worse, Kostis can give us the right answer), compounded (for us) by the fact that the SGSN/MME node is on par in size with the AXE (i.e. many tens of thousands of functions)... best regards, Vlad From straightflush@REDACTED Mon Apr 23 21:12:51 2012 From: straightflush@REDACTED (AD) Date: Mon, 23 Apr 2012 15:12:51 -0400 Subject: [erlang-questions] preserving -s from erl commandline into rebar generate Message-ID: hello, I am using "erl -pa ebin/ -s MyModule " syntax for starting my app, which forces the start/0 command to be called in the module passed to -s. I am now looking at more formally packaging the app up with "./rebar generate", is there a way to mimic this behavior with this release setup somehow? Thanks -AD -------------- next part -------------- An HTML attachment was scrubbed... URL: From jwatte@REDACTED Mon Apr 23 22:38:59 2012 From: jwatte@REDACTED (Jon Watte) Date: Mon, 23 Apr 2012 13:38:59 -0700 Subject: [erlang-questions] How to handle a massive amount of UDP packets? In-Reply-To: <7B47CEE0-5BBE-4CA9-8CB1-947D4A130826@feuerlabs.com> References: <4F8B0E95.4060003@berlin.ccc.de> <4F8BE6FB.3020205@berlin.ccc.de> <4F8D93A9.3060303@berlin.ccc.de> <20120422202600.GA84026@netch.kiev.ua> <20120423062515.GF82789@netch.kiev.ua> <7B47CEE0-5BBE-4CA9-8CB1-947D4A130826@feuerlabs.com> Message-ID: > but if we're > discussing optimal tuning of live systems, perhaps we can agree that we > shouldn't let bugs in the documentation limit our options? > > All of Ulf's advice was great, except for the implicit assumption I read in this sentence. I know of operational environments, where operators may actively refuse to do anything that is not documented in a reference. These are large, performance-critical systems, and I think the operators are totally in their right to do this. In fact, I'd go so far as to say that, for experiments, academia, and engineering what-ifs, documentation is optional, and for high-value, operational systems, documentation is required. It turns out the type in question was documented elsewhere, so we're in agreement on the particular feature, but I'd like to pitch in a word from the poor operations guys on whom engineers sometimes "dump" "stuff" that will wake them up in the middle of the night without any idea what to do about it :-) Sincerely, jw -------------- next part -------------- An HTML attachment was scrubbed... URL: From robert.virding@REDACTED Mon Apr 23 23:26:15 2012 From: robert.virding@REDACTED (Robert Virding) Date: Mon, 23 Apr 2012 22:26:15 +0100 (BST) Subject: [erlang-questions] Type inference in Erlang [WAS: Re: The compiler "eats" structures which are not separated by commas] In-Reply-To: <2243B4B7-416B-4009-AC0E-D24D6E31E029@feuerlabs.com> Message-ID: <404ca74a-3709-4e28-9794-ecb1a39e64af@knuth> ----- Original Message ----- > > On 23 Apr 2012, at 14:49, Kostis Sagonas wrote: > > > Finally, to give more evidence for this claim Robert mentioned > > "attempts in the 90's by knowledgeable people". If I took this > > last statement literally, I would probably find it a bit insulting > > -- I don't because I am sure that Robert did not mean it this way. > > So am I. > > I'm sure he referred to people like Wadler, Marlow, Arts and > Armstrong. I guess you could see this as the first wave of type > analyzers for Erlang. Dialyzer was introduced in 2004, right? > Sven-Olof Nystr?m talked about his soft-typing system for Erlang at > the 2003 Erlang workshop... Yes, it was the work done in the 90's to which I was referring. It was very disappointing and sort of put me off type inferencing for Erlang. I am fully aware of that much of the problems came from Erlang and it contains features which make it hard to infer types. I wasn't classing the old type inferencing and the method used by Dialyzer as the same thing. That being said Erlang does have some features which makes it hard to "determine" (:-)) types, modules and message passing being the most obvious. No matter how you look at it you can't do any serious typing past a module boundary as there are no limitations as to what modules I run. Dialyzer gets around this by allowing you to check a group of modules and check that they are consistent, but that need not necessarily be the same modules which are run. There is a similar problem with message passing in that there are no restrictions on what you send and to whom. These are not limitations of Dialyzer but properties of Erlang, which was never designed for anything more than dynamic typing. Robert > At the start of the AXD 301 project, in 1996, we were promised that > there would be a type checker with the first Erlang/OTP release - > something derived from the Wadler/Marlow work, so we were doing our > best to prepare, by inserting comments that at least approximated > the syntax we'd seen examples of. When some type checker prototypes > became ready for some serious testing (I recall trying to integrate > them into our design flow), we had too much legacy code, and an > established workflow that didn't play well with the type checkers. > They were not very good at doing partial analysis, and going through > our > 1 million lines of Erlang code and annotating everything was > not an option. In other words, it was type *checking* - not > inference. > > In short, they were never useful to us. No blame should fall on them > (or on the original designers of Erlang). We certainly could have > approached our design differently, if our primary goal had been to > stay compatible with a future static type checker, but as it was, we > had different requirements, and adapted to an Erlang without type > inference, and without static type checking. > > When we first tested Dialyzer in 2004, it was very quickly well > received, since it didn't clash with the established culture, even > though we were then 8 years into our erlang-based product > development. This was quite a feat. Given that a useful approach > eventually emerged, surely the work that went before it was not a > waste of time, and was therefore useful in a different context. I'm > being deliberately hand-wavy on the connections, since I don't know > to what extent the different projects informed each other, but > negative results are also valuable results. > > Obviously, there is a huge difference between "commercially useful" > and "academically useful", and even between "practically useful" and > "theoretically useful". > > As to whether this means Robert was justified in saying that "type > inferencing doesn't work", I will let him try to defend. :) > > But the *context*, once more, was that he commented on the statement > "... which a language with type inference doesn't need", even more > specifically, suggesting that certain parts of the Erlang syntax > could be eliminated with the help of type inferencing. That Robert's > claim *in this very narrow context* is plainly false is at least not > obvious to me. > > > > Anyway, I will repeat myself: *there is no fundamental reason for > > type inference in Erlang not to work*; there are only engineering > > and still (erroneous) community perception reasons. > > > >> Obviously dialyzer is (extremely) useful, but there is a reason > >> why it's off-line and doesn't actually give compilation errors, > >> but merely advice. > > > > Well, no. This is also a wrong statement. The reason why dialyzer > > is off-line is mainly historical (it started as a separate tool) > > but also related to the fact that it is typically more effective > > when analyzing a complete application rather than a single module. > > But fundamentally there is actually no reason why dialyzer should > > remain an off-line tool, especially if the BEAM compiler gets > > extended to take a set of module rather than a single module as > > input. > > Hmm, if we are nit-picking, did you just tell me that it was a wrong > statement that "there is a reason why it's off-line?", and then > proceed to give me the reason why Dialyzer is an off-line tool? ;-) > > Given that my reply was directed at the human equivalent of Dialyzer, > I took some care to stay within the bounds of what I knew was > correct (and as a consequence, didn't end up saying much). I merely > observed that dialyzer is currently an off-line tool, and "merely" > gives advice. I did *not* claim that there was a fundamental reason > why it couldn't be more tightly integrated into the compilation > flow. On the contrary, I have many times expressed the hope that we > are slowly moving in that direction, including gradual changes of > how the community views (and works with) its erlang code. > > Actually, the current state of things seems to be that the compiler > borrows ideas from dialyzer and implements them selectively. This > doesn't seem like an ideal setup. > > Since Vlad in a different thread mentioned that Dialyzer's was too > slow to be incorporated into the compilation flow, I took some time > to do some measurements to prove him wrong. Unfortunately, calling > dialyzer_cl:run(?) with only one file (gproc.beam) given an > up-to-date PLC took 3.5 seconds, of which most of the time seemed to > be spent inside the actual analysis in dialyzer_analysis_callgraph. > I gave up at that point, since my initial assumption was not so > easily proven as I had hoped. > > Since the entire compilation of gproc.erl takes ca 320 ms on my > machine, even reducing the runtime of Dialyzer by 10x would mean a > doubling of the compilation time. Granted, my investigation was > shallow to say the least, and on this point, I sincerely hope I am > wrong. Also, as long as it's an option, even 3.5 secs might actually > be quite reasonable sometimes. > > Bob Ippolito gave a talk at the London Erlang Factory last year, > where he mentioned some practical issues they had had with Dialyzer > (http://www.erlang-factory.com/conference/London2011/speakers/BobIppolito, > 29:30 into the presentation - I recall that you were there). I know > some of his complaints have been addressed to some extent (and so > did Bob at the time), but you do often need to clear a few hurdles > before you have dialyzer well adapted to your design flow (or the > other way around). > > These are engineering issues, I agree, but there is really a fairly > large number of tools and techniques that are discarded as "not > useful" on mostly fairly subjective grounds, because the > cost-benefit analysis is not clear to enough developers. > > Having said this, Dialyzer *is* one of the most popular tools in the > Erlang community - in other words empirically "useful". ;-) > > BR, > Ulf W > > Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. > http://feuerlabs.com > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From jwatte@REDACTED Mon Apr 23 23:27:16 2012 From: jwatte@REDACTED (Jon Watte) Date: Mon, 23 Apr 2012 14:27:16 -0700 Subject: [erlang-questions] Crash in beam.smp, using x64 version of R15B01 Message-ID: Our test suite runner seems to produce a segfault in the Erlang VM (beam.smp.) I'm trying to port a system currently running R13B03 on Ubuntu Server x64 LTS 10.04 to R15B01. It's time I had line numbers in my back traces! I downloaded the release and built from source. I uninstalled the R13B03 that came with Ubuntu, and did a "make install" on the built release. The stack trace is just two frames of the value "0x0000000000000060" so it looks like a stack smasher bug. I can provide a bundled directory of beam files and a test runner script that reproduces the problem to anyone interested in figuring this out! Sincerely, Jon Watte -- "I pledge allegiance to the flag of the United States of America, and to the republic for which it stands, one nation indivisible, with liberty and justice for all." ~ Adopted by U.S. Congress, June 22, 1942 -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Mon Apr 23 23:30:03 2012 From: ulf@REDACTED (Ulf Wiger) Date: Mon, 23 Apr 2012 23:30:03 +0200 Subject: [erlang-questions] How to handle a massive amount of UDP packets? In-Reply-To: References: <4F8B0E95.4060003@berlin.ccc.de> <4F8BE6FB.3020205@berlin.ccc.de> <4F8D93A9.3060303@berlin.ccc.de> <20120422202600.GA84026@netch.kiev.ua> <20120423062515.GF82789@netch.kiev.ua> <7B47CEE0-5BBE-4CA9-8CB1-947D4A130826@feuerlabs.com> Message-ID: Just to clarify, I definitely didn't mean to imply that we should accept a poor state of documentation. :) I just wanted to highlight that the problem here was not that the behavior was 'undocumented' (as in unsupported), but simply that the documentation left something to be desired. This latter problem can fairly easily be fixed, even by the community. It is pretty easy to submit a patch on the documentation (much easier than it is to actually *write* good documentation?) BR, Ulf W On 23 Apr 2012, at 22:38, Jon Watte wrote: > > but if we're > discussing optimal tuning of live systems, perhaps we can agree that we > shouldn't let bugs in the documentation limit our options? > > > > All of Ulf's advice was great, except for the implicit assumption I read in this sentence. > > I know of operational environments, where operators may actively refuse to do anything that is not documented in a reference. > These are large, performance-critical systems, and I think the operators are totally in their right to do this. > In fact, I'd go so far as to say that, for experiments, academia, and engineering what-ifs, documentation is optional, and for high-value, operational systems, documentation is required. > > It turns out the type in question was documented elsewhere, so we're in agreement on the particular feature, but I'd like to pitch in a word from the poor operations guys on whom engineers sometimes "dump" "stuff" that will wake them up in the middle of the night without any idea what to do about it :-) > > Sincerely, > > jw > Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Tue Apr 24 00:24:00 2012 From: ok@REDACTED (Richard O'Keefe) Date: Tue, 24 Apr 2012 10:24:00 +1200 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: <4F951F75.4090708@fastmail.fm> References: <4F9320F7.3010009@fastmail.fm> <436F6F6E-1131-4DC8-846B-0B0CC4C92CD8@cs.otago.ac.nz> <4F94BE6A.5010906@fastmail.fm> <049bd08514a53fb92bdc31699b438c8c.squirrel@chasm.otago.ac.nz> <4F951F75.4090708@fastmail.fm> Message-ID: <1EEF2F3F-A943-487F-A677-0AEAE24668FF@cs.otago.ac.nz> On 23/04/2012, at 9:23 PM, Jan Burse wrote: > ok@REDACTED schrieb: >> We could have a rule that says "take all the >> -record(name, { ..., field ... }) >> declarations that are visible in the current module, >> and for each field name, construct a function >> >> field(#rec1{...,field=X,...}) -> X; >> ... >> field(#recn(...,field=X,...}) -> X. >> >> " >> so that instead of Foo#rec.bar we could use a plain >> bar(Foo), which is much better syntax for a functional >> language than 'get' prefixes. And the type language >> used by dialyzer could handle this. > > This would not be the intention of a getBar(Foo). First off, I was talking about bar(Foo), not getBar(Foo). (Exercise: who said that pure functions should not be given imperative phrases as names and why?) Second, *I* just defined bar(Foo); who are you to tell me that what I intended bar to do is not its intention? Or to put it another way, you can intend your getBar(Foo) to do whatever you feel like, but *I* intended an automatically defined bar(Foo) to accept all and only the records *visible* in the module where it was defined. And it remains true that dialyzer *could* handle such a bar/1 perfectly well. > To be universal so that a resolution a runtime can happen. That's your intention, not *my* intention. If you want something that type inference can work on, then it *HAS* to be something based on information that is *AVAILABLE* to the type inferencer. Wanting it "to be universal so that a resolution a[t] runtime can happen" is tantamount to saying that you REJECT type inference, or else that you wish for magic to happen. Given the actual state of Erlang's records, it is *impossible* for run time resolution to happen. -module(a). -export([a/0]). -record(foo, {bar,ugh}). a() -> v:v(#foo{bar=1, ugh=2}). -module(b). -export([b/0]). -record(foo, {ugh,bar}). b() -> v:v(#foo{ugh=1, bar=2}). -module(v). -export([v/1]). v(Rec) -> getBar(Rec). -------------------------------- Here getBar/1 is your intention, a "universal" function that magically selects the "bar" field from any record that has one. a:a() calls v:v({foo,1,2}). b:b() calls v:v({foo,1,2}). Just what run-time information is v:v/1 supposed to call on so that it can know to return 1 for the first call and 2 for the second? With frames, no problem: a() -> v:v(). b() -> v:v(). v(F) -> ~bar(F). % abbreviates frame_value(F, 'bar'). > For a resolution at runtime we wouldn't even need > a type inference. Only access to the meta data of > the record type declaration. But THERE IS NO SUCH ANIMAL. Just like in C, one record *name* may be used for any finite number of record *types* and there is *no* indication in a record *value* of which record *type* it came from. You may say that this is a bad thing, that at the very least record names ought to be tagged with something other than a simple name, so that it _is_ possible to discover which -record declaration applied. If you said those things, I would agree with you. I certainly sent a proposal to this list quite some time ago for a different approach to record tagging that was about as compatible with the current scheme as possible while still allowing you to discover which -record declaration was the right one. But that proposal was never adopted, and the Erlang we actually *have* is one in which your wish for a universal getBar/1 CANNOT be granted. > Only reason getXXX()/setXXX() is probably not done > is performance loss I guess, No. They are not done because they CANNOT be done because there can be multiple record types with the same name and it is IMPOSSIBLE to discover from a run-time value which of those record types was meant. You really don't understand Erlang records until this is obvious to you. From janburse@REDACTED Tue Apr 24 01:05:09 2012 From: janburse@REDACTED (Jan Burse) Date: Tue, 24 Apr 2012 01:05:09 +0200 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: <1EEF2F3F-A943-487F-A677-0AEAE24668FF@cs.otago.ac.nz> References: <4F9320F7.3010009@fastmail.fm> <436F6F6E-1131-4DC8-846B-0B0CC4C92CD8@cs.otago.ac.nz> <4F94BE6A.5010906@fastmail.fm> <049bd08514a53fb92bdc31699b438c8c.squirrel@chasm.otago.ac.nz> <4F951F75.4090708@fastmail.fm> <1EEF2F3F-A943-487F-A677-0AEAE24668FF@cs.otago.ac.nz> Message-ID: <4F95E025.1000404@fastmail.fm> Richard O'Keefe schrieb: > No. They are not done because they CANNOT be done > because there can be multiple record types with the > same name and it is IMPOSSIBLE to discover from a > run-time value which of those record types was meant. Well I am not advocating the unversal solution, I am an advocate of the La La Land solution which is not universal, and I didn't know that the universal solution is impossible in Erlang. In La La Land a universal solution is available via the reflection facility (*). But lets turn back to Erlang. So you basically are telling me that the function: record_info(fields, Record) -> [Field] Can be found in multiple modules and yielding different fields for the same record name. In case the same record name is defined differently in different modules. Sounds like records cannot transgress modules, I guess this is also what your first example shows. Maybe they can transgress modules, but can only be accessed via tuple expressions outside of their module. Is this the modus operandi? Such a limitation I have never heard of in La La Land. There are some problems when objects are serialized, but generally there is no limitation to the extend of an object, unless explicitly expressed by a modifier keyword. Small question. Since records are local to modules. Wouldn't the type inference become a little bit more simpler? Or can there be ambiguous cases where a variable may hold sometimes a record from an outside module and sometimes a local record, and here you go, the inferenced type would be #error. A useful type lattice could be: #error / | | \ R1 R2 ... RN \ | | / #undef Where R1, R2, .., Rn are the module local record types. And the end-user can drop the record name in setter/getter expressions when the inference is neither #error nor #undef. The whole approach is "useless" if the type inferencer will tell #error or #undef most of the time. Bye (*) http://docs.oracle.com/javase/6/docs/api/java/lang/reflect/Field.html From ok@REDACTED Tue Apr 24 04:17:56 2012 From: ok@REDACTED (Richard O'Keefe) Date: Tue, 24 Apr 2012 14:17:56 +1200 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: <4F95E025.1000404@fastmail.fm> References: <4F9320F7.3010009@fastmail.fm> <436F6F6E-1131-4DC8-846B-0B0CC4C92CD8@cs.otago.ac.nz> <4F94BE6A.5010906@fastmail.fm> <049bd08514a53fb92bdc31699b438c8c.squirrel@chasm.otago.ac.nz> <4F951F75.4090708@fastmail.fm> <1EEF2F3F-A943-487F-A677-0AEAE24668FF@cs.otago.ac.nz> <4F95E025.1000404@fastmail.fm> Message-ID: <87C1D9BF-4845-487A-A1FE-7CEC91FA4C90@cs.otago.ac.nz> On 24/04/2012, at 11:05 AM, Jan Burse wrote: > So you basically are telling me that the function: > > record_info(fields, Record) -> [Field] > > Can be found in multiple modules and yielding different > fields for the same record name. In case the same record > name is defined differently in different modules. Yes. > > Sounds like records cannot transgress modules, I don't know what you mean by 'transgress'; modules are not rules that can be transgressed. Record values can certainly cross module boundaries and this is common and intentional and works just fine AS LONG AS both modules -include the same .hrl file. > > Such a limitation I have never heard of in La La Land. > There are some problems when objects are serialized, but > generally there is no limitation to the extend of an object, > unless explicitly expressed by a modifier keyword. Records are not objects. Don't even _try_ to import OO concepts into a discussion of Erlang. It's generally not going to make much sense. (By the way, "Programming La La Land" did not mean "where people do OOP". It meant "where people are happy with objects that do not satisfy a suitable class invariant.") There is no restriction on the lifetime of a record value in Erlang, nor is there any problem with crossing module boundaries, being sent to another process, sent across a network, stored in a data base, &c. It's just that 'record' isn't a type (or a type family), it's a *preprocessor* convention. There *is* a proposal for a data type that is distinct from tuples and carries all the information you need to do reflection at run time. Joe Armstrong called such values 'proper structs' and I called them 'frames', but we basically agree on the semantics. > > Small question. Since records are local to modules. They aren't. Many modules may use the same -record declaration via -include. And records may be passed from one module to another that just holds onto them and passes them back. > Wouldn't the type inference become a little bit > more simpler? Ask Kostis. As far as I know, the Dialyzer handles records tolerably well. But of course now we are talking about "compile time", not "run time". > Or can there be ambiguous cases where > a variable may hold sometimes a record from an outside > module and sometimes a local record, and here you go. Of course there can. Left as a trivial exercise for the reader. Since the Dialyzer can handle union types, I don't see why this would lead to an #error type. If you are the Jan Burse who did Jekejeke Prolog, you are a *master* of Java and know a very great deal about Prolog. I'm sure you could master the Erlang reference manual. From bo.zhang86@REDACTED Tue Apr 24 04:38:09 2012 From: bo.zhang86@REDACTED (Bob) Date: Tue, 24 Apr 2012 10:38:09 +0800 Subject: [erlang-questions] [ANN] SublimErl - code completion: Looking for testers/contributors In-Reply-To: References: <58A2D8D012F64220BD3EE816AE12CF73@gmail.com> <84166294-25C9-443F-ABBA-3DB51A696068@widetag.com> <8783F33A7D624D109DA0EDAB6B64C693@gmail.com> Message-ID: <9EF9A6D4EADC4EDE8B0F9C5817918113@gmail.com> Hi, I try SublimErl again today, I found that: 1, When I save my erl file, than I can see *.beam did been compiled. 2, But I try to use functions of the erl file in another file, "auto_completion" does not work. eg. I write msgserver.erl, then I save it, msgserver.beam has been created. Then I use it in transforserver.erl, "auto_completion" does not work. See bellow: *.beam has been created successfully. But SublimErl can not find module msgserver. Thanks. -- Bob Sent with Sparrow (http://www.sparrowmailapp.com/?sig) On Monday, April 23, 2012 at 11:56 PM, Roberto Ostinelli wrote: > > > > Good. If you can help us to provide auto compile when saving file, I think it will better to use. > > it already works like this. > > r. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 55414D98-41FE-4A39-B168-79A811DC032F.png Type: image/png Size: 10931 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 28E0EE32-0F76-4BFD-B5E5-E1DDE7E07D77.png Type: image/png Size: 59912 bytes Desc: not available URL: From roberto@REDACTED Tue Apr 24 04:52:57 2012 From: roberto@REDACTED (Roberto Ostinelli) Date: Mon, 23 Apr 2012 19:52:57 -0700 Subject: [erlang-questions] [ANN] SublimErl - code completion: Looking for testers/contributors In-Reply-To: <9EF9A6D4EADC4EDE8B0F9C5817918113@gmail.com> References: <58A2D8D012F64220BD3EE816AE12CF73@gmail.com> <84166294-25C9-443F-ABBA-3DB51A696068@widetag.com> <8783F33A7D624D109DA0EDAB6B64C693@gmail.com> <9EF9A6D4EADC4EDE8B0F9C5817918113@gmail.com> Message-ID: Hello Bob, please use https://github.com/ostinelli/SublimErl/issues for these issue, this list isn't the appropriate place. Prior opening an issue, try using the latest version. Thank you, r. On Mon, Apr 23, 2012 at 7:38 PM, Bob wrote: > Hi, I try SublimErl again today, I found that: > 1, When I save my erl file, than I can see *.beam did been compiled. > 2, But I try to use functions of the erl file in another file, > "auto_completion" does not work. > > eg. > I write msgserver.erl, then I save it, msgserver.beam has been created. > Then I use it in transforserver.erl, "auto_completion" does not work. See > bellow: > > *.beam has been created successfully. > > But SublimErl can not find module msgserver. > > > Thanks. > > > -- > Bob > Sent with Sparrow > > On Monday, April 23, 2012 at 11:56 PM, Roberto Ostinelli wrote: > > > > Good. If you can help us to provide auto compile when saving file, I think > it will better to use. > > > it already works like this. > > r. > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 28E0EE32-0F76-4BFD-B5E5-E1DDE7E07D77.png Type: image/png Size: 59912 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 55414D98-41FE-4A39-B168-79A811DC032F.png Type: image/png Size: 10931 bytes Desc: not available URL: From max.lapshin@REDACTED Tue Apr 24 08:26:45 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Tue, 24 Apr 2012 10:26:45 +0400 Subject: [erlang-questions] How to handle a massive amount of UDP packets? In-Reply-To: References: <4F8B0E95.4060003@berlin.ccc.de> <4F8BE6FB.3020205@berlin.ccc.de> <4F8D93A9.3060303@berlin.ccc.de> <20120422202600.GA84026@netch.kiev.ua> <20120423062515.GF82789@netch.kiev.ua> <7B47CEE0-5BBE-4CA9-8CB1-947D4A130826@feuerlabs.com> Message-ID: I want to explain a bit about my words on highload, large throughput and big latency. Let's first discuss TCP. I consider, that {active,once} approach is one of the most beautiful and convenient ways to handle incoming network traffic, I've ever seen. gen_tcp:recv is not a choice (just like a blocking accept, which is very popular due its "documented" state, considering with non-blocking accept). {active,false} is a step back to a non-responsive C-like program that hangs because of client GPRS lag. So, again: {active,true} is for brave people. For very brave with very good monitoring. {active,false}?? I don't know what is it for, but it is really fast right now {active,once}?? this is the best way, because it is flexible and convenient. But it has one performance problem: messages. When I want to download 150 MB of data via HTTP into erlang via 1 Gbps channel, I suppose that it will be downloaded in 1 second. But lets see what may happen. 150 MB is about 100 000 times of 1500 bytes. If we use {active,once} than we may receive 100_000 messages in our process. Erlang VM can hardly handle more messages into one process than this amount. But this is not the biggest problem: we must handle this data. And often handling 1500 and 15000 bytes is almost the same time. So according to my experience, biggest problem is not an amount of data, it is amount of messages. Each message is a very expensive thing if we speak about hundreds of thousands of them. If we receive these 150MB in 150 messages, each 1 MB, our erlang system will not even start coolers working. Something about 5% CPU. But I was wrong about {active, 1024*1024}, because there should be some timeout. It must be something like {active, 1024*1024, 1000}. Don't wait more than 1 second and don't accumulate more than 1 MB. Such hinting will help a lot in terms of copying memory, because it is possible to preallocate required binary in tcp driver. Now about UDP: problem is also in amount of messages. I know only one way to reduce it: to reply with several udp messages in one message, but perhaps Ulf's approach to combine {active,once} and recv will be the easiest way to go. From janburse@REDACTED Tue Apr 24 09:50:16 2012 From: janburse@REDACTED (Jan Burse) Date: Tue, 24 Apr 2012 09:50:16 +0200 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: <87C1D9BF-4845-487A-A1FE-7CEC91FA4C90@cs.otago.ac.nz> References: <4F9320F7.3010009@fastmail.fm> <436F6F6E-1131-4DC8-846B-0B0CC4C92CD8@cs.otago.ac.nz> <4F94BE6A.5010906@fastmail.fm> <049bd08514a53fb92bdc31699b438c8c.squirrel@chasm.otago.ac.nz> <4F951F75.4090708@fastmail.fm> <1EEF2F3F-A943-487F-A677-0AEAE24668FF@cs.otago.ac.nz> <4F95E025.1000404@fastmail.fm> <87C1D9BF-4845-487A-A1FE-7CEC91FA4C90@cs.otago.ac.nz> Message-ID: <4F965B38.1000302@fastmail.fm> Richard O'Keefe schrieb: > Records are not objects. Don't even_try_ to import OO > concepts into a discussion of Erlang. It's generally not > going to make much sense. Why do you think so? Objects are a superset of records. Objects encapsulate state, behaviour and identity (Booch teaching OO for dummies). If you use them to only encapsulate state and no behaviour and no identity you get records. So any properties I describe about objects in La La Land also apply to their use in modelling records, as long as these properties are not specific to behaviours or identities of object. > There *is* a proposal for a data type that is distinct > from tuples and carries all the information you need > to do reflection at run time. Joe Armstrong called such > values 'proper structs' and I called them 'frames', but > we basically agree on the semantics. Frames are the grand mother of objects also in La La Land. But the difference is probably the following. The objects in La La Land carry their frame slot information not inside object instances but in the class of an instance. So you can for example have zillions of instances of a class Color, that a Color class has a red, green and blue attribute is only stored once in the class. So if your are going about to implement frames via some dictionary data structure (hash table in La La Land) you will end up with a much bigger memory footprint. Also the access will be probably much slower. Nevertheless frames are still seen around. If not using prototypes, you have them in JavaScript via associative arrays. Closure allows them for each object, reminiscent of Lisp association lists. The mess stops only when you clearly decide for a distinction between classes and instances. It could be that some newer interpreters, like the JavaScript interpreter of Chrome, can deduce class information at runtime in a JIT fashion, and eventually adapt the representation of their associative arrays. But I am not 100% sure, and would need to lookup a reference, I think I saw some mention like this. So maybe something clever could be done without having an explicit class/instance distinction. JIT can be viewed as a special strategy of type inference, it collects information at the call sites during program execution. > They aren't. Many modules may use the same -record > declaration via -include. And records may be passed > from one module to another that just holds onto them > and passes them back. Ok, this is the modus operandi. Understood, you get multiple local preprocessing declaration copies. Oki Doki. Bye From mrtndimitrov@REDACTED Tue Apr 24 09:51:34 2012 From: mrtndimitrov@REDACTED (Martin Dimitrov) Date: Tue, 24 Apr 2012 10:51:34 +0300 Subject: [erlang-questions] dynamic compilation of funs Message-ID: <4F965B86.3020100@gmail.com> Hello, I am looking at the dynamic_compile module developed by Mats Cronqvist, Chris Newcombe and Jacob Vorreuter. It has a function evaluate/1 which uses erl_parse to compile the code. I successfully manage to compile and use this way a fun. But going through eprof I start to realize that erl_parse has quite a lot of overhead and is inefficient for our needs. So what are my other options? I can use dynamic_compile to compile the functions into a module. But during the execution of the program new functions need to be dynamically compile. How can I achieve that? Can I add a function to the dynamically compiled module or I need to recompile the whole thing again? Thank you very much for looking at this. Best regards, Martin From ulf@REDACTED Tue Apr 24 10:04:53 2012 From: ulf@REDACTED (Ulf Wiger) Date: Tue, 24 Apr 2012 10:04:53 +0200 Subject: [erlang-questions] dynamic compilation of funs In-Reply-To: <4F965B86.3020100@gmail.com> References: <4F965B86.3020100@gmail.com> Message-ID: There are a few problems with dynamically compiling to (anonymous) modules: - SMP characteristics: code loading, at the moment, is quite disruptive on SMP. - GC: you have to heep track of when to purge the module, or you have a memory leak Figuring out a unique module name is left as an exercise to the reader. :) On the purging. One way to do this is to make use of the resource objects provided by NIFs. Here is an example from my own use of sqlite3, whose prepare statements must be removed with finalize(), and my particular implementation couldn't be sure that it would always be called: track_resource(Ref,Handle) -> %% spawn a resource monitor, since a lingering prepare statement may lock the %% database (I think...) Pid = spawn(fun() -> receive finalize -> sqlite3:finalize(Ref, Handle) end end), N = resource:notify_when_destroyed(Pid, finalize), {Pid, N, Handle}. {ok, Handle} = sqlite3:prepare(Ref, SQL), SH = track_resource(Ref, Handle), Basically, I create a wrapper around the object I want to be able to remove, as soon as the caller no longer references it. If the resource is accessed concurrently, you would need to introduce a counter, to know when it's safe to remove the resource. The 'resource' module can be found at https://github.com/tonyrog/resource BR, Ulf W On 24 Apr 2012, at 09:51, Martin Dimitrov wrote: > Hello, > > I am looking at the dynamic_compile module developed by Mats Cronqvist, > Chris Newcombe and Jacob Vorreuter. It has a function evaluate/1 which > uses erl_parse to compile the code. I successfully manage to compile and > use this way a fun. But going through eprof I start to realize that > erl_parse has quite a lot of overhead and is inefficient for our needs. > > So what are my other options? I can use dynamic_compile to compile the > functions into a module. But during the execution of the program new > functions need to be dynamically compile. How can I achieve that? Can I > add a function to the dynamically compiled module or I need to recompile > the whole thing again? > > Thank you very much for looking at this. > > Best regards, > > Martin > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com From janburse@REDACTED Tue Apr 24 10:06:09 2012 From: janburse@REDACTED (Jan Burse) Date: Tue, 24 Apr 2012 10:06:09 +0200 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: <87C1D9BF-4845-487A-A1FE-7CEC91FA4C90@cs.otago.ac.nz> References: <4F9320F7.3010009@fastmail.fm> <436F6F6E-1131-4DC8-846B-0B0CC4C92CD8@cs.otago.ac.nz> <4F94BE6A.5010906@fastmail.fm> <049bd08514a53fb92bdc31699b438c8c.squirrel@chasm.otago.ac.nz> <4F951F75.4090708@fastmail.fm> <1EEF2F3F-A943-487F-A677-0AEAE24668FF@cs.otago.ac.nz> <4F95E025.1000404@fastmail.fm> <87C1D9BF-4845-487A-A1FE-7CEC91FA4C90@cs.otago.ac.nz> Message-ID: <4F965EF1.8030705@fastmail.fm> Richard O'Keefe schrieb: > If you are the Jan Burse who did Jekejeke Prolog, you are > a*master* of Java and know a very great deal about Prolog. > I'm sure you could master the Erlang reference manual. The choice of an implementation language and implementation platform need not be determined by the own weak ability to code in the language. There can be other determinants. In the present case my choice was motivated by the following properties: - Access to community and educational material. - Safety of the resulting applications. - Efficiency of the resulting applications. - Portability of the resulting applications. - Maintainabiliy of a large code base. For the later I especially appreciate the amenability of Java to cross referencing, code inspection and refactoring thanks to its type system. IntelliJ is a great tool for that, which has a very good code indexer. Bye From michael.eugene.turner@REDACTED Tue Apr 24 10:24:02 2012 From: michael.eugene.turner@REDACTED (Michael Turner) Date: Tue, 24 Apr 2012 17:24:02 +0900 Subject: [erlang-questions] Float multiplication behaviours In-Reply-To: References: <2dca6d7b-76fc-436b-ae10-35f4d20c1a38@knuth> <14d07c6c-d645-47d7-b124-0454a938cb56@knuth> Message-ID: The first computer I ever programmed was an HP-2000B running a dialect of Dartmouth BASIC. IIRC, in certain instances, its floating point results could be off by over 5%. William Kahan, numerical analyst and co-architect of the IEEE floating point standard, was still seen hitting the ceiling in the late 70s over computing products from H-P that exhibited wild divergence from common sense (not to mention the subtler sources of error that drove numerics folk batty, back in the days before standardized floating point.) Against this historical background, perhaps one ought to be grateful when floating point appears to diverge from common sense by only one part in ten trillion. Decimal fixed-point arithmetic still has a place, though, I'm sure. Currency calculations, for example. -michael turner On Tue, Apr 24, 2012 at 2:46 AM, Steve Vinoski wrote: > On Mon, Apr 23, 2012 at 1:37 PM, Juan Puig > wrote: >> Hello there, >> >> we are running Erlang R15B (erts-5.9). Any fact that could demonstrate the following behaviour? >> >> (node@REDACTED)51> 1.20*100. >> 120.0 >> (node@REDACTED)49> 10.20*100. >> 1019.9999999999999 >> (node@REDACTED)50> 100.20*100. >> 10020.0 > > http://floating-point-gui.de/ > > --steve > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From mrtndimitrov@REDACTED Tue Apr 24 10:41:38 2012 From: mrtndimitrov@REDACTED (Martin Dimitrov) Date: Tue, 24 Apr 2012 11:41:38 +0300 Subject: [erlang-questions] dynamic compilation of funs In-Reply-To: References: <4F965B86.3020100@gmail.com> Message-ID: <4F966742.2070503@gmail.com> Thanks for the reply. One more question: would it be inefficient to create a separate module for each function? I would have about 1000 of them. Martin On 4/24/2012 11:04 AM, Ulf Wiger wrote: > There are a few problems with dynamically compiling to (anonymous) modules: > > - SMP characteristics: code loading, at the moment, is quite disruptive on SMP. > - GC: you have to heep track of when to purge the module, or you have a memory leak > > Figuring out a unique module name is left as an exercise to the reader. :) > > On the purging. One way to do this is to make use of the resource objects provided by NIFs. > > Here is an example from my own use of sqlite3, whose prepare statements must be removed with finalize(), and my particular implementation couldn't be sure that it would always be called: > > track_resource(Ref,Handle) -> > %% spawn a resource monitor, since a lingering prepare statement may lock the > %% database (I think...) > Pid = spawn(fun() -> receive finalize -> > sqlite3:finalize(Ref, Handle) > end > end), > N = resource:notify_when_destroyed(Pid, finalize), > {Pid, N, Handle}. > > {ok, Handle} = sqlite3:prepare(Ref, SQL), > SH = track_resource(Ref, Handle), > > Basically, I create a wrapper around the object I want to be able to remove, as soon as the caller no longer references it. > > If the resource is accessed concurrently, you would need to introduce a counter, to know when it's safe to remove the resource. > > The 'resource' module can be found at https://github.com/tonyrog/resource > > BR, > Ulf W > > On 24 Apr 2012, at 09:51, Martin Dimitrov wrote: > >> Hello, >> >> I am looking at the dynamic_compile module developed by Mats Cronqvist, >> Chris Newcombe and Jacob Vorreuter. It has a function evaluate/1 which >> uses erl_parse to compile the code. I successfully manage to compile and >> use this way a fun. But going through eprof I start to realize that >> erl_parse has quite a lot of overhead and is inefficient for our needs. >> >> So what are my other options? I can use dynamic_compile to compile the >> functions into a module. But during the execution of the program new >> functions need to be dynamically compile. How can I achieve that? Can I >> add a function to the dynamically compiled module or I need to recompile >> the whole thing again? >> >> Thank you very much for looking at this. >> >> Best regards, >> >> Martin >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. > http://feuerlabs.com > > > From bengt.kleberg@REDACTED Tue Apr 24 10:45:50 2012 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 24 Apr 2012 10:45:50 +0200 Subject: [erlang-questions] dynamic compilation of funs In-Reply-To: <4F966742.2070503@gmail.com> References: <4F965B86.3020100@gmail.com> <4F966742.2070503@gmail.com> Message-ID: <1335257150.4760.34.camel@seasc1137> Greetings, You could time (timer:tc/3) a test program with one module updated with 1000 functions vs 1000 modules with 1 function. bengt On Tue, 2012-04-24 at 10:41 +0200, Martin Dimitrov wrote: > Thanks for the reply. > > One more question: would it be inefficient to create a separate module > for each function? I would have about 1000 of them. > > Martin > > On 4/24/2012 11:04 AM, Ulf Wiger wrote: > > There are a few problems with dynamically compiling to (anonymous) modules: > > > > - SMP characteristics: code loading, at the moment, is quite disruptive on SMP. > > - GC: you have to heep track of when to purge the module, or you have a memory leak > > > > Figuring out a unique module name is left as an exercise to the reader. :) > > > > On the purging. One way to do this is to make use of the resource objects provided by NIFs. > > > > Here is an example from my own use of sqlite3, whose prepare statements must be removed with finalize(), and my particular implementation couldn't be sure that it would always be called: > > > > track_resource(Ref,Handle) -> > > %% spawn a resource monitor, since a lingering prepare statement may lock the > > %% database (I think...) > > Pid = spawn(fun() -> receive finalize -> > > sqlite3:finalize(Ref, Handle) > > end > > end), > > N = resource:notify_when_destroyed(Pid, finalize), > > {Pid, N, Handle}. > > > > {ok, Handle} = sqlite3:prepare(Ref, SQL), > > SH = track_resource(Ref, Handle), > > > > Basically, I create a wrapper around the object I want to be able to remove, as soon as the caller no longer references it. > > > > If the resource is accessed concurrently, you would need to introduce a counter, to know when it's safe to remove the resource. > > > > The 'resource' module can be found at https://github.com/tonyrog/resource > > > > BR, > > Ulf W > > > > On 24 Apr 2012, at 09:51, Martin Dimitrov wrote: > > > >> Hello, > >> > >> I am looking at the dynamic_compile module developed by Mats Cronqvist, > >> Chris Newcombe and Jacob Vorreuter. It has a function evaluate/1 which > >> uses erl_parse to compile the code. I successfully manage to compile and > >> use this way a fun. But going through eprof I start to realize that > >> erl_parse has quite a lot of overhead and is inefficient for our needs. > >> > >> So what are my other options? I can use dynamic_compile to compile the > >> functions into a module. But during the execution of the program new > >> functions need to be dynamically compile. How can I achieve that? Can I > >> add a function to the dynamically compiled module or I need to recompile > >> the whole thing again? > >> > >> Thank you very much for looking at this. > >> > >> Best regards, > >> > >> Martin > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://erlang.org/mailman/listinfo/erlang-questions > > Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. > > http://feuerlabs.com > > > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From mrtndimitrov@REDACTED Tue Apr 24 10:49:04 2012 From: mrtndimitrov@REDACTED (Martin Dimitrov) Date: Tue, 24 Apr 2012 11:49:04 +0300 Subject: [erlang-questions] dynamic compilation of funs In-Reply-To: <1335257150.4760.34.camel@seasc1137> References: <4F965B86.3020100@gmail.com> <4F966742.2070503@gmail.com> <1335257150.4760.34.camel@seasc1137> Message-ID: <4F966900.6050407@gmail.com> I am more concerned of any limits to the number of modules the VM can handle. By *inefficient* I meant to ask would the VM be given too much pressure. Thanks, Martin On 4/24/2012 11:45 AM, Bengt Kleberg wrote: > Greetings, > > You could time (timer:tc/3) a test program with one module updated with > 1000 functions vs 1000 modules with 1 function. > > > bengt > > On Tue, 2012-04-24 at 10:41 +0200, Martin Dimitrov wrote: >> Thanks for the reply. >> >> One more question: would it be inefficient to create a separate module >> for each function? I would have about 1000 of them. >> >> Martin >> >> On 4/24/2012 11:04 AM, Ulf Wiger wrote: >>> There are a few problems with dynamically compiling to (anonymous) modules: >>> >>> - SMP characteristics: code loading, at the moment, is quite disruptive on SMP. >>> - GC: you have to heep track of when to purge the module, or you have a memory leak >>> >>> Figuring out a unique module name is left as an exercise to the reader. :) >>> >>> On the purging. One way to do this is to make use of the resource objects provided by NIFs. >>> >>> Here is an example from my own use of sqlite3, whose prepare statements must be removed with finalize(), and my particular implementation couldn't be sure that it would always be called: >>> >>> track_resource(Ref,Handle) -> >>> %% spawn a resource monitor, since a lingering prepare statement may lock the >>> %% database (I think...) >>> Pid = spawn(fun() -> receive finalize -> >>> sqlite3:finalize(Ref, Handle) >>> end >>> end), >>> N = resource:notify_when_destroyed(Pid, finalize), >>> {Pid, N, Handle}. >>> >>> {ok, Handle} = sqlite3:prepare(Ref, SQL), >>> SH = track_resource(Ref, Handle), >>> >>> Basically, I create a wrapper around the object I want to be able to remove, as soon as the caller no longer references it. >>> >>> If the resource is accessed concurrently, you would need to introduce a counter, to know when it's safe to remove the resource. >>> >>> The 'resource' module can be found at https://github.com/tonyrog/resource >>> >>> BR, >>> Ulf W >>> >>> On 24 Apr 2012, at 09:51, Martin Dimitrov wrote: >>> >>>> Hello, >>>> >>>> I am looking at the dynamic_compile module developed by Mats Cronqvist, >>>> Chris Newcombe and Jacob Vorreuter. It has a function evaluate/1 which >>>> uses erl_parse to compile the code. I successfully manage to compile and >>>> use this way a fun. But going through eprof I start to realize that >>>> erl_parse has quite a lot of overhead and is inefficient for our needs. >>>> >>>> So what are my other options? I can use dynamic_compile to compile the >>>> functions into a module. But during the execution of the program new >>>> functions need to be dynamically compile. How can I achieve that? Can I >>>> add a function to the dynamically compiled module or I need to recompile >>>> the whole thing again? >>>> >>>> Thank you very much for looking at this. >>>> >>>> Best regards, >>>> >>>> Martin >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> erlang-questions@REDACTED >>>> http://erlang.org/mailman/listinfo/erlang-questions >>> Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. >>> http://feuerlabs.com >>> >>> >>> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From ulf@REDACTED Tue Apr 24 10:54:44 2012 From: ulf@REDACTED (Ulf Wiger) Date: Tue, 24 Apr 2012 10:54:44 +0200 Subject: [erlang-questions] dynamic compilation of funs In-Reply-To: <4F966742.2070503@gmail.com> References: <4F965B86.3020100@gmail.com> <4F966742.2070503@gmail.com> Message-ID: <5540AED9-6155-485B-A7EC-A2BBA90D2A78@feuerlabs.com> On 24 Apr 2012, at 10:41, Martin Dimitrov wrote: > One more question: would it be inefficient to create a separate module > for each function? I would have about 1000 of them. I do believe the most complex erlang-based systems built have thousands of modules. (E.g. the AXD 301 - and GPRS, which is roughly as complex, with more than 1M lines of code; I'm not sure what the average module size was, but would guess that it was < 1000 LOC). There are no linear operations when addressing modules, except e.g. if you decide to list them all. Interestingly, there is no limit mentioned in the Efficiency Guide regarding the number of modules. I guess there is no limit then. :) BR, Ulf W Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com From mrtndimitrov@REDACTED Tue Apr 24 10:57:39 2012 From: mrtndimitrov@REDACTED (Martin Dimitrov) Date: Tue, 24 Apr 2012 11:57:39 +0300 Subject: [erlang-questions] dynamic compilation of funs In-Reply-To: <5540AED9-6155-485B-A7EC-A2BBA90D2A78@feuerlabs.com> References: <4F965B86.3020100@gmail.com> <4F966742.2070503@gmail.com> <5540AED9-6155-485B-A7EC-A2BBA90D2A78@feuerlabs.com> Message-ID: <4F966B03.3030005@gmail.com> That is precisely my concern, the lack of documentation on the subject. In our app the number of functions can grow so I am not sure if this is the best option. Thanks again for the reply. Martin On 4/24/2012 11:54 AM, Ulf Wiger wrote: > On 24 Apr 2012, at 10:41, Martin Dimitrov wrote: > >> One more question: would it be inefficient to create a separate module >> for each function? I would have about 1000 of them. > I do believe the most complex erlang-based systems built have thousands of modules. > > (E.g. the AXD 301 - and GPRS, which is roughly as complex, with more than 1M lines of code; I'm not sure what the average module size was, but would guess that it was < 1000 LOC). > > There are no linear operations when addressing modules, except e.g. if you decide to list them all. > > Interestingly, there is no limit mentioned in the Efficiency Guide regarding the number of modules. I guess there is no limit then. :) > > BR, > Ulf W > > Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. > http://feuerlabs.com > > > From netch@REDACTED Tue Apr 24 12:16:44 2012 From: netch@REDACTED (Valentin Nechayev) Date: Tue, 24 Apr 2012 13:16:44 +0300 Subject: [erlang-questions] "fat burner" GC on periodic base? Message-ID: <20120424101644.GA42675@netch.kiev.ua> Our application area specifics is combination of high load and rather complex processing of data. When investigating a VM, I have found unusually big process memory usage: 2012-04-24T13:42:21.389762+0400 Top 20 consumers by total_heap_size: 2012-04-24T13:42:21.390460+0400 1) pid=<0.29.0> total_heap_size=105953765 desc=user 2012-04-24T13:42:21.390655+0400 2) pid=<0.6.0> total_heap_size=84274435 desc=error_logger [...] This confused me and I explicitly called GC on them, and have got after that: (sysmon7@REDACTED)8> process_info(pid(0,29,0),total_heap_size). {total_heap_size,3571} (sysmon7@REDACTED)9> process_info(pid(0,6,0),total_heap_size). {total_heap_size,233} This shrinking by ~1.5G by simple explicit GC call is shocking. To avoid such situations, I'm now probing of activating periodic GC process sweep by default (as opposed to previous mode when it needed to be explicitly enabled per VM). The burner is as follows: ==={{{ fat_burner() -> mmc_lib:mmc_desc({?MODULE, fat_burner}), put('$initial_call', {?MODULE, fat_burner, 0}), erlang:register(mmc_foreman_fat_burner, self()), fat_burner_loop(0, 0). fat_burner_loop(PrevSpent, PrevLimit) -> timer:sleep(?FAT_BURNER_INTERVAL_BASE + PrevSpent), Processes = erlang:processes(), MemorySum = fb_get_total_memory(Processes), if MemorySum < PrevLimit -> fat_burner_loop(PrevSpent, PrevLimit); true -> TStart = now(), lists:foreach( fun(Pid) -> catch erlang:garbage_collect(Pid) end, Processes), TFinish = now(), NewSpent = trunc(1000*mmc_lib:now_diff_seconds(TFinish, TStart)), NewLimit = 2 * fb_get_total_memory(Processes), fat_burner_loop(NewSpent, NewLimit) end. fb_get_total_memory(Processes) -> lists:foldl( fun(Pid, AccIn) -> PM = case catch erlang:process_info(Pid, memory) of {memory, PMX} -> PMX; _ -> 0 end, PM + AccIn end, 0, Processes). ===}}} My questions are: 1. Is there another way to achieve the same result, as avoiding keeping useless data, on timed basics instead of reduction count, which, as shown above, doesn't work enough? 2. Whether the algorithm shown in the code snippet should be fixed? Currently it clones approach of Lua which is directly targeted for reasonably minimal memory footprint in an environment with Unix styled VM, combined with calling GC only when memory usage is definitely grown (2 times - hardcoded here). -netch- From netch@REDACTED Tue Apr 24 12:34:37 2012 From: netch@REDACTED (Valentin Nechayev) Date: Tue, 24 Apr 2012 13:34:37 +0300 Subject: [erlang-questions] Float multiplication behaviours In-Reply-To: References: <2dca6d7b-76fc-436b-ae10-35f4d20c1a38@knuth> <14d07c6c-d645-47d7-b124-0454a938cb56@knuth> Message-ID: <20120424103437.GB42675@netch.kiev.ua> Mon, Apr 23, 2012 at 13:46:14, vinoski wrote about "Re: [erlang-questions] Float multiplication behaviours": > > (node@REDACTED)49> 10.20*100. > > 1019.9999999999999 > http://floating-point-gui.de/ The question is more complex if to compare with different language system behaviors and Erlang behavior difference between output formats. For example, Python (2.7) shows exactly the same value as Erlang in the quote, but C with Glibc (glibc-2.14.1-14.27.1.x86_64@REDACTED), Perl and Ruby's irb shows simply 1020. The latter one shows rounding which could be unreasonable, because doesn't differ adjacent values: $ cat tx1.c #include #include main() { double a = 10.20; a *= 100; double ap, an; ap = nextafter(a, 1000.0); an = nextafter(a, 0.0); printf("%g%s%g%s%g\n", an, (an == a) ? "==" : "!=", a, (a == ap) ? "==" : "!=", ap); return 0; } $ ./tx1 1020!=1020!=1020 If the thread starter expects the value to be rounded in accustomed way, this can help in its reading, but can also give confusing results on values which are looking equal but differs really. Erlang manner to print with full details with ~p is more debug-oriented than user-oriented: 2> io:fwrite("~p~n", [10.20*100]). 1019.9999999999999 ok 3> io:fwrite("~g~n", [10.20*100]). 1020.00 ok (Sadly, math module is quite thin and doesn't carry IEEE required functions, as nextafter().) For more floating-point details, it's better to go to and start reading from the previous topics. -netch- From attila.r.nohl@REDACTED Tue Apr 24 12:41:48 2012 From: attila.r.nohl@REDACTED (Attila Rajmund Nohl) Date: Tue, 24 Apr 2012 12:41:48 +0200 Subject: [erlang-questions] "fat burner" GC on periodic base? In-Reply-To: <20120424101644.GA42675@netch.kiev.ua> References: <20120424101644.GA42675@netch.kiev.ua> Message-ID: 2012/4/24 Valentin Nechayev : [...] > My questions are: > > 1. Is there another way to achieve the same result, as avoiding keeping > useless data, on timed basics instead of reduction count, which, as > shown above, doesn't work enough? You can subscribe to "heap used by process is too large" events using erlang:system_monitor/2. You can also make an educated guess based on the code to call garbage collection at certain points in the code (for example we have a gen_server that uses quite some memory during initialization, but then it releases most of the memory, so we have an explicit garbage collection at the end of the init function). From olivier.boudeville@REDACTED Tue Apr 24 13:52:18 2012 From: olivier.boudeville@REDACTED (Olivier BOUDEVILLE) Date: Tue, 24 Apr 2012 13:52:18 +0200 Subject: [erlang-questions] Resisting "noconnection" / Remote termination of nodes Message-ID: Hi, For a more controlled overall termination of a distributed application, I try to shutdown synchronously a series of nodes, as properly and as in parallel as possible, in a non-OTP program. I imagine that using '[ rpc:cast( N, erlang, halt, [] ) || N <- MyTargetNodes ]' and then waiting for them to be terminated is the best approach for that. As I want now these terminations to be synchronous (i.e. I want my terminate function to return only when all nodes are down for sure), I used to rely on checking their termination using net_adm:ping/1 (waiting for pong to become pang), but kept on getting (systematically) 'noconnection' errors (exceptions?), which do not seem to be catchable (at least not with a 'try .. catch T:E ->.. end' clause). This happens as soon as there is at least one node (which happens to be on the same host - of course it is not the local node from which that rpc:cast is triggered) to halt. I switched to looping on 'lists:member( Nodename, nodes() )' instead of ping (in both case with a proper waiting between checks), but I still get 'noconnection' errors. It looks like 'noconnection' is VM-level? As expected, commenting-out the rpc:cast/3 never leads to 'noconnection'. I feel I would need something like net_kernel:unconnect_node/1. My question now: how to deal gracefully with such a synchronous node shutdown and to resist to the (intended) loss of node(s)? Thanks in advance for any hint! Best regards, Olivier. --------------------------- Olivier Boudeville EDF R&D : 1, avenue du G?n?ral de Gaulle, 92140 Clamart, France D?partement SINETICS, groupe ASICS (I2A), bureau B-226 Office : +33 1 47 65 59 58 / Mobile : +33 6 16 83 37 22 / Fax : +33 1 47 65 27 13 Ce message et toutes les pi?ces jointes (ci-apr?s le 'Message') sont ?tablis ? l'intention exclusive des destinataires et les informations qui y figurent sont strictement confidentielles. Toute utilisation de ce Message non conforme ? sa destination, toute diffusion ou toute publication totale ou partielle, est interdite sauf autorisation expresse. Si vous n'?tes pas le destinataire de ce Message, il vous est interdit de le copier, de le faire suivre, de le divulguer ou d'en utiliser tout ou partie. Si vous avez re?u ce Message par erreur, merci de le supprimer de votre syst?me, ainsi que toutes ses copies, et de n'en garder aucune trace sur quelque support que ce soit. Nous vous remercions ?galement d'en avertir imm?diatement l'exp?diteur par retour du message. Il est impossible de garantir que les communications par messagerie ?lectronique arrivent en temps utile, sont s?curis?es ou d?nu?es de toute erreur ou virus. ____________________________________________________ This message and any attachments (the 'Message') are intended solely for the addressees. The information contained in this Message is confidential. Any use of information contained in this Message not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval. If you are not the addressee, you may not copy, forward, disclose or use any part of it. If you have received this message in error, please delete it and all copies from your system and notify the sender immediately by return message. E-mail communication cannot be guaranteed to be timely secure, error or virus-free. -------------- next part -------------- An HTML attachment was scrubbed... URL: From samuelrivas@REDACTED Tue Apr 24 14:24:19 2012 From: samuelrivas@REDACTED (Samuel) Date: Tue, 24 Apr 2012 14:24:19 +0200 Subject: [erlang-questions] is this a shell bug? In-Reply-To: References: Message-ID: > Intriguing. I was unaware of that. Thank you! > > On Mon, Apr 23, 2012 at 12:01 PM, Hynek Vychodil wrote: >> >> Doesn't flush() work as well for you? Note that flush() returns ok, it's intention is just to print received messages as a side effect. You cannot assign messages to variables with it. -- Samuel From francesco@REDACTED Tue Apr 24 16:42:58 2012 From: francesco@REDACTED (Francesco Mazzoli) Date: Tue, 24 Apr 2012 15:42:58 +0100 Subject: [erlang-questions] [Dialyser] Type parametrized behaviours Message-ID: <4F96BBF2.8090302@rabbitmq.com> Hi, I have recently updated some code to use the new callback signatures for behaviours. Before that, we simply used a .hrl file that we included in each implementing module. While hacky, the old approach had an advantage: we could include in the .hrl specs some types that were to be defined in the including file, and then used in type signatures. It would be useful to be able to parametrize behaviours by type more nicely, since most behaviours specs are dominated by 1 or 2 types (classically some kind of state) and as of now no typechecking takes place on those types. That might be achieved with some pre-processor directive, e.g. -behaviour_type(whatever). What do you think? Francesco. From pablo.platt@REDACTED Tue Apr 24 19:06:05 2012 From: pablo.platt@REDACTED (Pablo Platt) Date: Tue, 24 Apr 2012 10:06:05 -0700 (PDT) Subject: [erlang-questions] Erlang based media server? Message-ID: <1335287165.20676.YahooMailNeo@web112610.mail.gq1.yahoo.com> Hi, I'm looking for an open source media server written in Erlang. I need it to implement a video conferencing in Flash and in the future hopefully to support HTML5 as well. I've found two projects: https://github.com/processone/oms https://github.com/erlyvideo/erlyvideo oms looks like it's been discontinued. erlyvideo support many features but the few docs are hard to understand and questions on the forum sometimes not answered for months. The relation between the commercial version and the open source version is not clear to me. The open source version is 2.10.18 while the commercial version is 3.x.x. Does anyone have experience with oms or erlyvideo? Are there another options I'm missing? Is it a good idea to use erlang based media server instead of a media server written in C++ like rtmpd? Thanks From aronisstav@REDACTED Tue Apr 24 20:10:09 2012 From: aronisstav@REDACTED (Stavros Aronis) Date: Tue, 24 Apr 2012 11:10:09 -0700 (PDT) Subject: [erlang-questions] [Dialyser] Type parametrized behaviours In-Reply-To: <4F96BBF2.8090302@rabbitmq.com> References: <4F96BBF2.8090302@rabbitmq.com> Message-ID: <14724847.757.1335291009372.JavaMail.geo-discussion-forums@vbbh3> Hi Francesco, Do you mean that after your update these types have to be moved within the behaviour file itself? If this is the case, you could export them using the "-export_type" attribute and then use them as remote types: "behaviour_module:type_name()". You can use them in this way in both specs and other -type definitions and at least Dialyzer won't have any problem at all. Stavros On Tuesday, April 24, 2012 5:42:58 PM UTC+3, Francesco Mazzoli wrote: > > Hi, > > I have recently updated some code to use the new callback signatures for > behaviours. Before that, we simply used a .hrl file that we included in > each implementing module. > > While hacky, the old approach had an advantage: we could include in the > .hrl specs some types that were to be defined in the including file, and > then used in type signatures. > > It would be useful to be able to parametrize behaviours by type more > nicely, since most behaviours specs are dominated by 1 or 2 types > (classically some kind of state) and as of now no typechecking takes > place on those types. That might be achieved with some pre-processor > directive, e.g. -behaviour_type(whatever). > > What do you think? > > Francesco. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > On Tuesday, April 24, 2012 5:42:58 PM UTC+3, Francesco Mazzoli wrote: > > Hi, > > I have recently updated some code to use the new callback signatures for > behaviours. Before that, we simply used a .hrl file that we included in > each implementing module. > > While hacky, the old approach had an advantage: we could include in the > .hrl specs some types that were to be defined in the including file, and > then used in type signatures. > > It would be useful to be able to parametrize behaviours by type more > nicely, since most behaviours specs are dominated by 1 or 2 types > (classically some kind of state) and as of now no typechecking takes > place on those types. That might be achieved with some pre-processor > directive, e.g. -behaviour_type(whatever). > > What do you think? > > Francesco. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vinoski@REDACTED Tue Apr 24 21:24:04 2012 From: vinoski@REDACTED (Steve Vinoski) Date: Tue, 24 Apr 2012 15:24:04 -0400 Subject: [erlang-questions] is this a shell bug? In-Reply-To: References: Message-ID: On Mon, Apr 23, 2012 at 3:56 AM, Attila Rajmund Nohl wrote: > 2012/4/23 ?? : >> Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:4:4] >> [async-threads:0] [hipe] [kernel-poll:false] >> >> Eshell V5.9.1 ?(abort with ^G) >> 1> self(). >> <0.32.0> >> 2> process_flag(trap_exit, true). >> false >> 3> ?spawn_link(fun() -> ok end). >> <0.36.0> >> 4> process_info(self(), messages). >> {messages,[{'EXIT',<0.36.0>,normal}]} >> 5> receive X -> X end. >> {'EXIT',<0.36.0>,normal} >> 6> ?spawn_link(fun() -> ok end). >> <0.40.0> >> 7> process_info(self(), messages). >> {messages,[{'EXIT',<0.40.0>,normal}]} >> 8> receive X -> X end. >> >> shell SUSPENDING .... WHAT's happed here? > > X was already bound, so you were waiting for {'EXIT',<0.36.0>,normal}, > but got {'EXIT',<0.40.0>,normal} That much is true, but there's something else interesting here. Look more carefully at the output from the second shell in the original message, repeated below: ^G User switch command --> s --> c Eshell V5.9.1 (abort with ^G) 1> process_info(pid(0,32,0), current_function). {current_function,{erl_eval,receive_clauses,6}} 2> process_info(pid(0,32,0), messages). {messages,[]} The second call to process_info shows the first shell's message queue to be empty, when in fact it isn't. Could this be the problem to which the original author was actually referring? Here's a variant of the same. First, set X and then spawn a new process, same as in the original posting: Eshell V5.9.1 (abort with ^G) 1> self(). <0.31.0> 2> process_flag(trap_exit, true). false 3> spawn_link(fun() -> ok end). <0.35.0> 4> process_info(self(), messages). {messages,[{'EXIT',<0.35.0>,normal}]} 5> receive X -> X end. {'EXIT',<0.35.0>,normal} 6> spawn_link(fun() -> ok end). <0.39.0> At this point we should have an EXIT tuple in this shell's message queue. Next, start a new shell, and use it to verify that the first shell's message queue is not empty: ^G User switch command --> s --> c Eshell V5.9.1 (abort with ^G) 1> process_info(pid(0,31,0), messages). {messages,[{'EXIT',<0.39.0>,normal}]} Just what we expect to see. Now, get the pid of the second shell, and then switch back to the first shell. In the first shell, start a receive like in the original message, but add a 30 second timeout, and send a 'done' message to the second shell after the timeout: 2> self(). <0.43.0> ^G User switch command --> c 1 7> receive X -> X after 30000 -> pid(0,43,0) ! done end. Now quickly switch back to the second shell, check the first shell's message queue, and then wait for the 'done' message: User switch command --> c 2 3> process_info(pid(0,31,0), messages). {messages,[]} 4> receive done -> process_info(pid(0,31,0), messages) end. {messages,[{'EXIT',<0.39.0>,normal}]} Check that out -- while the first shell is trying to receive X, examining its message queue from the second shell shows that queue to be empty, contrary to what we saw the first time we checked it from the second shell, where it held the EXIT tuple for the second spawned process. But after the first shell's receive times out and the second shell gets the 'done' message, checking the first shell's message queue again shows it to contain the same EXIT tuple as before. In section 8.6 of his book, Joe describes a "save queue" used during selective receive, and this behavior matches his description. But if you write a program that does the same thing, it acts differently; unlike the shell, you won't observe an empty message queue during a receive. So this behavior must be a shell thing. I don't know the details of why it acts this way -- chatting about it with Scott Fritchie, he guessed it might have something to do with the other messaging the shell has to do, but neither of us knows for sure. Can someone explain why the shell seems to use an actual "save queue" during a receive? --steve From francesco@REDACTED Tue Apr 24 21:26:08 2012 From: francesco@REDACTED (Francesco Mazzoli) Date: Tue, 24 Apr 2012 20:26:08 +0100 Subject: [erlang-questions] [Dialyser] Type parametrized behaviours In-Reply-To: <14724847.757.1335291009372.JavaMail.geo-discussion-forums@vbbh3> References: <4F96BBF2.8090302@rabbitmq.com> <14724847.757.1335291009372.JavaMail.geo-discussion-forums@vbbh3> Message-ID: <4F96FE50.2030805@rabbitmq.com> On 24/04/12 19:10, Stavros Aronis wrote: > Hi Francesco, > > Do you mean that after your update these types have to be moved within > the behaviour file itself? If this is the case, you could export them > using the "-export_type" attribute and then use them as remote types: > "behaviour_module:type_name()". You can use them in this way in both > specs and other -type definitions and at least Dialyzer won't have any > problem at all. > > Stavros No, that's not what I want. To give a small example of what I want to do, a behaviour might define -callback step(state()) -> state(). where `state()' is not define locally in the behaviour, but in each implementing module. I hope I made myself more clear. Francesco. From aronisstav@REDACTED Tue Apr 24 21:36:19 2012 From: aronisstav@REDACTED (Stavros Aronis) Date: Tue, 24 Apr 2012 12:36:19 -0700 (PDT) Subject: [erlang-questions] [Dialyser] Type parametrized behaviours In-Reply-To: <4F96FE50.2030805@rabbitmq.com> References: <4F96BBF2.8090302@rabbitmq.com> <14724847.757.1335291009372.JavaMail.geo-discussion-forums@vbbh3> <4F96FE50.2030805@rabbitmq.com> Message-ID: <5005629.633.1335296179710.JavaMail.geo-discussion-forums@vbqq1> In this case you can leave generic definitions in the -callback attributes and write the fully specified specs in the callback module: %% Behaviour module: ... -callback step(State :: term()) -> NewState :: term(). ... %% Callback module: ... -type state() :: #state{}. ... -spec step(state()) -> state(). ... Dialyzer will check that your specs are subtypes of the corresponding callback attributes. What added benefit would you gain from your suggestion? Stavros On Tuesday, April 24, 2012 10:26:08 PM UTC+3, Francesco Mazzoli wrote: > > On 24/04/12 19:10, Stavros Aronis wrote: > > Hi Francesco, > > > > Do you mean that after your update these types have to be moved within > > the behaviour file itself? If this is the case, you could export them > > using the "-export_type" attribute and then use them as remote types: > > "behaviour_module:type_name()". You can use them in this way in both > > specs and other -type definitions and at least Dialyzer won't have any > > problem at all. > > > > Stavros > > No, that's not what I want. > > To give a small example of what I want to do, a behaviour might define > > -callback step(state()) -> state(). > > where `state()' is not define locally in the behaviour, but in each > implementing module. > > I hope I made myself more clear. > > Francesco. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From heinz@REDACTED Tue Apr 24 21:43:36 2012 From: heinz@REDACTED (Heinz N. Gies) Date: Tue, 24 Apr 2012 21:43:36 +0200 Subject: [erlang-questions] A plead to use tags (or equivalent in your SCM system) Message-ID: Hi I've noticed that a lot of libraires depend on bleeding edge data I kind of find that disturbing it makes maintaining a stable environment close to impossible since one never knows what I mean are lines like this: {alog, ".*", {git, "https://github.com/siberian-fast-food/alogger.git", {branch, "master"}}} now if the alogger people push a breaking change your application breaks when depending on it, even worst if you don't even use alogger yourself but a library you use uses it a change in alogger would break your application without you having direct influence on it :(. So what I'd love to ask people who maintain libraries is use dependencies that have a fixed version and tag your own versions so people can do the same when using your stuff - please? Regards, Heinz PS: I just choose alogger as an example since it was the first I found - I love the thing :) -- Heinz N. Gies heinz@REDACTED http://licenser.net From francesco@REDACTED Tue Apr 24 21:47:06 2012 From: francesco@REDACTED (Francesco Mazzoli) Date: Tue, 24 Apr 2012 20:47:06 +0100 Subject: [erlang-questions] [Dialyser] Type parametrized behaviours In-Reply-To: <5005629.633.1335296179710.JavaMail.geo-discussion-forums@vbqq1> References: <4F96BBF2.8090302@rabbitmq.com> <14724847.757.1335291009372.JavaMail.geo-discussion-forums@vbbh3> <4F96FE50.2030805@rabbitmq.com> <5005629.633.1335296179710.JavaMail.geo-discussion-forums@vbqq1> Message-ID: <4F97033A.9050107@rabbitmq.com> On 24/04/12 20:36, Stavros Aronis wrote: > In this case you can leave generic definitions in the -callback > attributes and write the fully specified specs in the callback module: > > %% Behaviour module: > ... > -callback step(State :: term()) -> NewState :: term(). > ... > > %% Callback module: > ... > -type state() :: #state{}. > ... > -spec step(state()) -> state(). > ... Yes, this works but is tedious and error prone, each time you change the behaviour you have to change each implementing module. You end up manually doing something that a computer does much better (copy-pasting code). Francesco. From aronisstav@REDACTED Tue Apr 24 22:15:53 2012 From: aronisstav@REDACTED (Stavros Aronis) Date: Tue, 24 Apr 2012 13:15:53 -0700 (PDT) Subject: [erlang-questions] [Dialyser] Type parametrized behaviours In-Reply-To: <4F97033A.9050107@rabbitmq.com> References: <4F96BBF2.8090302@rabbitmq.com> <14724847.757.1335291009372.JavaMail.geo-discussion-forums@vbbh3> <4F96FE50.2030805@rabbitmq.com> <5005629.633.1335296179710.JavaMail.geo-discussion-forums@vbqq1> <4F97033A.9050107@rabbitmq.com> Message-ID: <97213.1897.1335298553752.JavaMail.geo-discussion-forums@vbjb10> I do not want to go much further with this, but I fail to understand what kind of changes would trigger this need for extensive changes. If the behaviour code needs to be agnostic of the type of this state variable and "term()" needs not be changed due to this reason. The type definitions are already in every module because that's where the specialization is being made. On the other hand, if the same type is used in many modules then it should be defined in the behaviour module and exported. Then it can be used in all of them, without any need of copying. Could you provide a more detailed example? Stavros On Tuesday, April 24, 2012 9:47:06 PM UTC+2, Francesco Mazzoli wrote: > > On 24/04/12 20:36, Stavros Aronis wrote: > > In this case you can leave generic definitions in the -callback > > attributes and write the fully specified specs in the callback module: > > > > %% Behaviour module: > > ... > > -callback step(State :: term()) -> NewState :: term(). > > ... > > > > %% Callback module: > > ... > > -type state() :: #state{}. > > ... > > -spec step(state()) -> state(). > > ... > > Yes, this works but is tedious and error prone, each time you change the > behaviour you have to change each implementing module. > > You end up manually doing something that a computer does much better > (copy-pasting code). > > Francesco. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From francesco@REDACTED Tue Apr 24 22:27:18 2012 From: francesco@REDACTED (Francesco Mazzoli) Date: Tue, 24 Apr 2012 21:27:18 +0100 Subject: [erlang-questions] [Dialyser] Type parametrized behaviours In-Reply-To: <97213.1897.1335298553752.JavaMail.geo-discussion-forums@vbjb10> References: <4F96BBF2.8090302@rabbitmq.com> <14724847.757.1335291009372.JavaMail.geo-discussion-forums@vbbh3> <4F96FE50.2030805@rabbitmq.com> <5005629.633.1335296179710.JavaMail.geo-discussion-forums@vbqq1> <4F97033A.9050107@rabbitmq.com> <97213.1897.1335298553752.JavaMail.geo-discussion-forums@vbjb10> Message-ID: <4F970CA6.3000200@rabbitmq.com> On 24/04/12 21:15, Stavros Aronis wrote: > I do not want to go much further with this, but I fail to understand > what kind of changes would trigger this need for extensive changes. If > the behaviour code needs to be agnostic of the type of this state > variable and "term()" needs not be changed due to this reason. The type > definitions are already in every module because that's where the > specialization is being made. On the other hand, if the same type is > used in many modules then it should be defined in the behaviour module > and exported. Then it can be used in all of them, without any need of > copying. Could you provide a more detailed example? > > Stavros It's not even that much about changing code, it's just that doing what you propose (re-spec'ing all the definitions in the module) is an ugly, ugly solution, and there is no need for it. Code repetition is bad, and this is a form of it. I don't understand what you mean with "the behaviour code needs to be agnostic of the type of this state variable ...". By the way, what we did before implements what you're saying, but a bit better, since we only needed to define the specs once and then include them each time. In this case we'd always need to define them at least twice. Example: we have a behaviour `rabbit_backing_queue': https://github.com/rabbitmq/rabbitmq-server/blob/master/src/rabbit_backing_queue.erl . The types `ack()' and `state()' are specific to the implementation. An example implementation is rabbit_variable_queue ( https://github.com/rabbitmq/rabbitmq-server/blob/master/src/rabbit_variable_queue.erl ) implements this behaviour, and defines ack() and state() types, which are now unused. Following your suggestion I'd have to re-define the 15-or so methods in rabbit_backing_queue, which is really undesirable - I'd rather just leave things as they are. Francesco. From eriksoe@REDACTED Tue Apr 24 22:31:23 2012 From: eriksoe@REDACTED (=?ISO-8859-1?Q?Erik_S=F8e_S=F8rensen?=) Date: Tue, 24 Apr 2012 22:31:23 +0200 Subject: [erlang-questions] is this a shell bug? In-Reply-To: References: Message-ID: It is a consequence of the fact that the shell is interpreted; the way the pattern-and-guard condition is evaluated is that it is interpreted (from symbolic form) by the shell, which is a normal Erlang program. Thus the shell can't use normal receive for two reasons: the condition is too complex to be expressible as a fixed pattern+guard, and messages can't be put back into the queue once accepted. This is why the shell has to emulate 'receive' in this way. Den 24/04/2012 21.24 skrev "Steve Vinoski" : > On Mon, Apr 23, 2012 at 3:56 AM, Attila Rajmund Nohl > wrote: > > 2012/4/23 ?? : > >> Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:4:4] > >> [async-threads:0] [hipe] [kernel-poll:false] > >> > >> Eshell V5.9.1 (abort with ^G) > >> 1> self(). > >> <0.32.0> > >> 2> process_flag(trap_exit, true). > >> false > >> 3> spawn_link(fun() -> ok end). > >> <0.36.0> > >> 4> process_info(self(), messages). > >> {messages,[{'EXIT',<0.36.0>,normal}]} > >> 5> receive X -> X end. > >> {'EXIT',<0.36.0>,normal} > >> 6> spawn_link(fun() -> ok end). > >> <0.40.0> > >> 7> process_info(self(), messages). > >> {messages,[{'EXIT',<0.40.0>,normal}]} > >> 8> receive X -> X end. > >> > >> shell SUSPENDING .... WHAT's happed here? > > > > X was already bound, so you were waiting for {'EXIT',<0.36.0>,normal}, > > but got {'EXIT',<0.40.0>,normal} > > That much is true, but there's something else interesting here. Look > more carefully at the output from the second shell in the original > message, repeated below: > > ^G > User switch command > --> s > --> c > Eshell V5.9.1 (abort with ^G) > 1> process_info(pid(0,32,0), current_function). > {current_function,{erl_eval,receive_clauses,6}} > 2> process_info(pid(0,32,0), messages). > {messages,[]} > > The second call to process_info shows the first shell's message queue > to be empty, when in fact it isn't. Could this be the problem to which > the original author was actually referring? > > Here's a variant of the same. First, set X and then spawn a new > process, same as in the original posting: > > Eshell V5.9.1 (abort with ^G) > 1> self(). > <0.31.0> > 2> process_flag(trap_exit, true). > false > 3> spawn_link(fun() -> ok end). > <0.35.0> > 4> process_info(self(), messages). > {messages,[{'EXIT',<0.35.0>,normal}]} > 5> receive X -> X end. > {'EXIT',<0.35.0>,normal} > 6> spawn_link(fun() -> ok end). > <0.39.0> > > At this point we should have an EXIT tuple in this shell's message > queue. Next, start a new shell, and use it to verify that the first > shell's message queue is not empty: > > ^G > User switch command > --> s > --> c > Eshell V5.9.1 (abort with ^G) > 1> process_info(pid(0,31,0), messages). > {messages,[{'EXIT',<0.39.0>,normal}]} > > Just what we expect to see. Now, get the pid of the second shell, and > then switch back to the first shell. In the first shell, start a > receive like in the original message, but add a 30 second timeout, and > send a 'done' message to the second shell after the timeout: > > 2> self(). > <0.43.0> > > ^G > User switch command > --> c 1 > 7> receive X -> X after 30000 -> pid(0,43,0) ! done end. > > Now quickly switch back to the second shell, check the first shell's > message queue, and then wait for the 'done' message: > > User switch command > --> c 2 > 3> process_info(pid(0,31,0), messages). > {messages,[]} > 4> receive done -> process_info(pid(0,31,0), messages) end. > {messages,[{'EXIT',<0.39.0>,normal}]} > > Check that out -- while the first shell is trying to receive X, > examining its message queue from the second shell shows that queue to > be empty, contrary to what we saw the first time we checked it from > the second shell, where it held the EXIT tuple for the second spawned > process. But after the first shell's receive times out and the second > shell gets the 'done' message, checking the first shell's message > queue again shows it to contain the same EXIT tuple as before. > > In section 8.6 of his book, Joe describes a "save queue" used during > selective receive, and this behavior matches his description. But if > you write a program that does the same thing, it acts differently; > unlike the shell, you won't observe an empty message queue during a > receive. So this behavior must be a shell thing. I don't know the > details of why it acts this way -- chatting about it with Scott > Fritchie, he guessed it might have something to do with the other > messaging the shell has to do, but neither of us knows for sure. Can > someone explain why the shell seems to use an actual "save queue" > during a receive? > > --steve > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From aronisstav@REDACTED Tue Apr 24 23:17:06 2012 From: aronisstav@REDACTED (Stavros Aronis) Date: Tue, 24 Apr 2012 14:17:06 -0700 (PDT) Subject: [erlang-questions] [Dialyser] Type parametrized behaviours In-Reply-To: <4F970CA6.3000200@rabbitmq.com> References: <4F96BBF2.8090302@rabbitmq.com> <14724847.757.1335291009372.JavaMail.geo-discussion-forums@vbbh3> <4F96FE50.2030805@rabbitmq.com> <5005629.633.1335296179710.JavaMail.geo-discussion-forums@vbqq1> <4F97033A.9050107@rabbitmq.com> <97213.1897.1335298553752.JavaMail.geo-discussion-forums@vbjb10> <4F970CA6.3000200@rabbitmq.com> Message-ID: <30045856.798.1335302226907.JavaMail.geo-discussion-forums@vbqq1> Ok, I understand your original approach now. It is indeed clever and reduces duplication. The only solution I can think of, while still using -callback attributes, is to keep both the callback attributes and the old hrl file and end up with two duplicate definitions (one in the callback attributes and one in the specs that would be included and completed by the types in each callback module). I agree that it is bad practice, but remember that Dialyzer will check that the definitions are compatible so you will be actively protected from code rot. Callback attributes were added mainly as a way way to describe a behaviour's interface better than comments and a list of exports that originally existed. The benefit of using them instead of included -specs is that you can have generic -callback attributes and more specific specs in each callback module. In your case, where little or no further refinement is needed, it turns out that using them leads to duplication. As a final note, remember that you can always choose to shut off warning categories. In your case it might be simpler to just shut off behaviour-related warnings. Stavros On Tuesday, April 24, 2012 10:27:18 PM UTC+2, Francesco Mazzoli wrote: > > On 24/04/12 21:15, Stavros Aronis wrote: > > I do not want to go much further with this, but I fail to understand > > what kind of changes would trigger this need for extensive changes. If > > the behaviour code needs to be agnostic of the type of this state > > variable and "term()" needs not be changed due to this reason. The type > > definitions are already in every module because that's where the > > specialization is being made. On the other hand, if the same type is > > used in many modules then it should be defined in the behaviour module > > and exported. Then it can be used in all of them, without any need of > > copying. Could you provide a more detailed example? > > > > Stavros > > It's not even that much about changing code, it's just that doing what > you propose (re-spec'ing all the definitions in the module) is an ugly, > ugly solution, and there is no need for it. Code repetition is bad, and > this is a form of it. > > I don't understand what you mean with "the behaviour code needs to be > agnostic of the type of this state variable ...". > > By the way, what we did before implements what you're saying, but a bit > better, since we only needed to define the specs once and then include > them each time. In this case we'd always need to define them at least > twice. > > Example: we have a behaviour `rabbit_backing_queue': > > https://github.com/rabbitmq/rabbitmq-server/blob/master/src/rabbit_backing_queue.erl > . The types `ack()' and `state()' are specific to the implementation. An > example implementation is rabbit_variable_queue ( > > https://github.com/rabbitmq/rabbitmq-server/blob/master/src/rabbit_variable_queue.erl > ) implements this behaviour, and defines ack() and state() types, which > are now unused. Following your suggestion I'd have to re-define the > 15-or so methods in rabbit_backing_queue, which is really undesirable - > I'd rather just leave things as they are. > > Francesco. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From francesco@REDACTED Tue Apr 24 23:43:04 2012 From: francesco@REDACTED (Francesco Mazzoli) Date: Tue, 24 Apr 2012 22:43:04 +0100 Subject: [erlang-questions] [Dialyser] Type parametrized behaviours In-Reply-To: <30045856.798.1335302226907.JavaMail.geo-discussion-forums@vbqq1> References: <4F96BBF2.8090302@rabbitmq.com> <14724847.757.1335291009372.JavaMail.geo-discussion-forums@vbbh3> <4F96FE50.2030805@rabbitmq.com> <5005629.633.1335296179710.JavaMail.geo-discussion-forums@vbqq1> <4F97033A.9050107@rabbitmq.com> <97213.1897.1335298553752.JavaMail.geo-discussion-forums@vbjb10> <4F970CA6.3000200@rabbitmq.com> <30045856.798.1335302226907.JavaMail.geo-discussion-forums@vbqq1> Message-ID: <4F971E68.6010702@rabbitmq.com> > The only solution I can think of, while still using -callback > attributes, is to keep both the callback attributes and the old hrl file > and end up with two duplicate definitions (one in the callback > attributes and one in the specs that would be included and completed by > the types in each callback module). I agree that it is bad practice, but > remember that Dialyzer will check that the definitions are compatible so > you will be actively protected from code rot. That is still too ugly, I'd rather keep it as it is now and not type check that. That said, given that no satisfactory solution exists, and given that we can probably find a nice way of parametrize types in behaviours, I think that the best thing would be to integrate that as a dialyser feature. Francesco. From tuncer.ayaz@REDACTED Wed Apr 25 00:06:40 2012 From: tuncer.ayaz@REDACTED (Tuncer Ayaz) Date: Wed, 25 Apr 2012 00:06:40 +0200 Subject: [erlang-questions] preserving -s from erl commandline into rebar generate In-Reply-To: References: Message-ID: On Mon, Apr 23, 2012 at 9:12 PM, AD wrote: > hello, > > I am using "erl -pa ebin/ -s MyModule " syntax for starting my app, > which forces the start/0 command to be called in the module passed > to -s. I am now looking at more formally packaging the app up with > "./rebar generate", is there a way to mimic this behavior with this > release setup somehow? While you could try adding that to vm.args, you should let otp release handling take care of that. Just make sure it's an application and listed in reltool.config. See http://learnyousomeerlang.com/release-is-the-word#releases-with-reltool From bourinov@REDACTED Wed Apr 25 08:26:32 2012 From: bourinov@REDACTED (Max Bourinov) Date: Wed, 25 Apr 2012 10:26:32 +0400 Subject: [erlang-questions] Ho to keep-alive inactive RabbitMQ connections? Message-ID: Hi Erlangers, I use forked RabbitMQ client: https://github.com/jbrisbin/amqp_client While testing it I noticed that if connection is not active for some hours it becomes closed. Interesting thing is that my Erlang app doesn't show any crashes or error messages. SASL is enabled, process that holds connection is under supervision. Does anybody know how RabbitMQ client must be configured to keep connection alive all the time? Best regards, Max -------------- next part -------------- An HTML attachment was scrubbed... URL: From bourinov@REDACTED Wed Apr 25 08:34:07 2012 From: bourinov@REDACTED (Max Bourinov) Date: Wed, 25 Apr 2012 10:34:07 +0400 Subject: [erlang-questions] Erlang based media server? In-Reply-To: <1335287165.20676.YahooMailNeo@web112610.mail.gq1.yahoo.com> References: <1335287165.20676.YahooMailNeo@web112610.mail.gq1.yahoo.com> Message-ID: erlyvideo [1] is your friend. As far as I know for simple "conferencing" current open source edition of erlyvideo is more than enough. If you need something more advanced - you better talk to maintainers of erlyvideo. >Is it a good idea to use erlang based media server instead of a media server written in C++ like rtmpd? Depends of what you exactly need, but there are no disadvantages in Erland implementation compare to C++. Actually there are many serious advantages which comes from Erlang. Moreover, it is very hard to give you good advice because you didn't mention your requirements. You also can have a look on BigBlue Button [2]. Maybe BigBlueButton will do work for you? --- 1. https://github.com/erlyvideo/erlyvideo 2. http://www.bigbluebutton.org/ Best regards, Max On Tue, Apr 24, 2012 at 9:06 PM, Pablo Platt wrote: > Hi, > > I'm looking for an open source media server written in Erlang. > I need it to implement a video conferencing in Flash and in the future > hopefully to support HTML5 as well. > > I've found two projects: > > https://github.com/processone/oms > https://github.com/erlyvideo/erlyvideo > > oms looks like it's been discontinued. > > erlyvideo support many features but the few docs are hard to understand > and questions on the forum sometimes not answered for months. > The relation between the commercial version and the open source version is > not clear to me. > The open source version is 2.10.18 while the commercial version is 3.x.x. > > Does anyone have experience with oms or erlyvideo? > Are there another options I'm missing? > Is it a good idea to use erlang based media server instead of a media > server written in C++ like rtmpd? > > Thanks > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tilman.holschuh@REDACTED Wed Apr 25 08:36:14 2012 From: tilman.holschuh@REDACTED (Tilman Holschuh) Date: Tue, 24 Apr 2012 23:36:14 -0700 Subject: [erlang-questions] Ho to keep-alive inactive RabbitMQ connections? In-Reply-To: References: Message-ID: <84B16C85-1523-41E5-8716-36DFFB9BF06E@gmail.com> Hi Max, Check out AMQP heartbeat. Cheers - Tilman On 2012-04-24, at 11:26 PM, Max Bourinov wrote: > Hi Erlangers, > > I use forked RabbitMQ client: https://github.com/jbrisbin/amqp_client > > While testing it I noticed that if connection is not active for some hours it becomes closed. Interesting thing is that my Erlang app doesn't show any crashes or error messages. SASL is enabled, process that holds connection is under supervision. > > Does anybody know how RabbitMQ client must be configured to keep connection alive all the time? > > Best regards, > Max > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From bourinov@REDACTED Wed Apr 25 08:40:21 2012 From: bourinov@REDACTED (Max Bourinov) Date: Wed, 25 Apr 2012 10:40:21 +0400 Subject: [erlang-questions] Ho to keep-alive inactive RabbitMQ connections? In-Reply-To: <84B16C85-1523-41E5-8716-36DFFB9BF06E@gmail.com> References: <84B16C85-1523-41E5-8716-36DFFB9BF06E@gmail.com> Message-ID: Hi Tilman! I have it! It is 5 seconds in my case. *{ok, Connection} = amqp_connection:start(* * #amqp_params_network{* * host = "localhost",* * username = <<"guest">>,* * password = <<"guest">>,* * port = 5672,* * virtual_host = <<"/">>,* * heartbeat = 5* * }),* Still dropping connections... Best regards, Max On Wed, Apr 25, 2012 at 10:36 AM, Tilman Holschuh wrote: > Hi Max, > > Check out AMQP heartbeat. > > Cheers > - Tilman > > On 2012-04-24, at 11:26 PM, Max Bourinov wrote: > > > Hi Erlangers, > > > > I use forked RabbitMQ client: https://github.com/jbrisbin/amqp_client > > > > While testing it I noticed that if connection is not active for some > hours it becomes closed. Interesting thing is that my Erlang app doesn't > show any crashes or error messages. SASL is enabled, process that holds > connection is under supervision. > > > > Does anybody know how RabbitMQ client must be configured to keep > connection alive all the time? > > > > Best regards, > > Max > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mrtndimitrov@REDACTED Wed Apr 25 09:49:22 2012 From: mrtndimitrov@REDACTED (Martin Dimitrov) Date: Wed, 25 Apr 2012 10:49:22 +0300 Subject: [erlang-questions] How to debug handle_info EXIT message? Message-ID: <4F97AC82.5010508@gmail.com> Hello, I receive in a module implementing gen_server behavior in the function handle_info/2 the following message: {'EXIT',<0.2637.0>,normal} What is the reason to receive this message? The process <0.2637.0> was spawned by this gen_server and then died? Is it possible to get more information about this process after it has died since process_info/1 returns undefined? Thank you very much for looking at this. Best Regards, Martin From watson.timothy@REDACTED Wed Apr 25 10:18:16 2012 From: watson.timothy@REDACTED (Gmail) Date: Wed, 25 Apr 2012 09:18:16 +0100 Subject: [erlang-questions] A plead to use tags (or equivalent in your SCM system) In-Reply-To: References: Message-ID: <87D08161-95C6-47A9-96C7-44CF78568AE2@gmail.com> Massive +1 on this point. It's really hard to rely on stuff that isn't tagged and either the author has to maintain a dork of these libraries they depend on so as to control the changes (which is really quite a headache) or simply 'hope for the best). Neither of which is a good solution. Please version and tags your components if you intend them to be re-used! Sent from my iPhone On 24 Apr 2012, at 20:43, "Heinz N. Gies" wrote: > Hi I've noticed that a lot of libraires depend on bleeding edge data I kind of find that disturbing it makes maintaining a stable environment close to impossible since one never knows > > > what I mean are lines like this: > > {alog, ".*", {git, "https://github.com/siberian-fast-food/alogger.git", {branch, "master"}}} > > now if the alogger people push a breaking change your application breaks when depending on it, even worst if you don't even use alogger yourself but a library you use uses it a change in alogger would break your application without you having direct influence on it :(. > > So what I'd love to ask people who maintain libraries is use dependencies that have a fixed version and tag your own versions so people can do the same when using your stuff - please? > > Regards, > Heinz > > PS: I just choose alogger as an example since it was the first I found - I love the thing :) > > -- > Heinz N. Gies > heinz@REDACTED > http://licenser.net > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From watson.timothy@REDACTED Wed Apr 25 10:33:04 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Wed, 25 Apr 2012 09:33:04 +0100 Subject: [erlang-questions] A plead to use tags (or equivalent in your SCM system) In-Reply-To: <87D08161-95C6-47A9-96C7-44CF78568AE2@gmail.com> References: <87D08161-95C6-47A9-96C7-44CF78568AE2@gmail.com> Message-ID: Thanks autocorrect - I'm not entirely sure that maintaining a 'dork' involves, but it sounds even worse than maintaining a 'fork' anyway! On 25 April 2012 09:18, Gmail wrote: > Massive +1 on this point. It's really hard to rely on stuff that isn't tagged and either the author has to maintain a dork of these libraries they depend on so as to control the changes (which is really quite a headache) or simply 'hope for the best). Neither of which is a good solution. Please version and tags your components if you intend them to be re-used! > > Sent from my iPhone > > On 24 Apr 2012, at 20:43, "Heinz N. Gies" wrote: > >> Hi I've noticed that a lot of libraires depend on bleeding edge data I kind of find that disturbing it makes maintaining a stable environment close to impossible since one never knows >> >> >> what I mean are lines like this: >> >> {alog, ".*", {git, "https://github.com/siberian-fast-food/alogger.git", {branch, "master"}}} >> >> now if the alogger people push a breaking change your application breaks when depending on it, even worst if you don't even use alogger yourself but a library you use uses it a change in alogger would break your application without you having direct influence on it :(. >> >> So what I'd love to ask people who maintain libraries is use dependencies that have a fixed version and tag your own versions so people can do the same when using your stuff - please? >> >> Regards, >> Heinz >> >> PS: I just choose alogger as an example since it was the first I found - I love the thing :) >> >> -- >> Heinz N. Gies >> heinz@REDACTED >> http://licenser.net >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions From lenartlad@REDACTED Wed Apr 25 10:42:43 2012 From: lenartlad@REDACTED (Ladislav Lenart) Date: Wed, 25 Apr 2012 10:42:43 +0200 Subject: [erlang-questions] How to debug handle_info EXIT message? In-Reply-To: <4F97AC82.5010508@gmail.com> References: <4F97AC82.5010508@gmail.com> Message-ID: <4F97B903.4020407@volny.cz> Hello. The process <0.2637.0> terminated with reason 'normal'. Your gen_server process received the 'EXIT' message because: * <0.2637.0> and your gen_server were linked together AND * your gen_server is trapping exits, i.e. it invoked process_flag(trap_exit, true) in its init/1. See also the following documentation: * process_flag/2 - http://www.erlang.org/doc/man/erlang.html#process_flag-2 * spawn_link/1 - http://www.erlang.org/doc/man/erlang.html#spawn_link-1 * link/1 - http://www.erlang.org/doc/man/erlang.html#link-1 HTH, Ladislav Lenart On 25.4.2012 09:49, Martin Dimitrov wrote: > Hello, > > I receive in a module implementing gen_server behavior in the function > handle_info/2 the following message: > > {'EXIT',<0.2637.0>,normal} > > What is the reason to receive this message? The process <0.2637.0> was > spawned by this gen_server and then died? Is it possible to get more > information about this process after it has died since process_info/1 > returns undefined? > > Thank you very much for looking at this. > > Best Regards, > > Martin > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From bourinov@REDACTED Wed Apr 25 11:26:48 2012 From: bourinov@REDACTED (Max Bourinov) Date: Wed, 25 Apr 2012 13:26:48 +0400 Subject: [erlang-questions] A plead to use tags (or equivalent in your SCM system) In-Reply-To: References: <87D08161-95C6-47A9-96C7-44CF78568AE2@gmail.com> Message-ID: +1 It is very good practice to use tags to avoid such a problem. Would be great, if lib maintainers will write in readme file how to include deps in rebar.config in a proper way. Like this: {webmachine, "1.9.*", {git, "git://github.com/basho/webmachine", {tag, "1.9.0"}}}, This is just one line of code, but it will eliminate the following case: - Which version should I use? Hm no any info available in readme... Let's try master... OK, master works... ... after some time ... - Oh not! What's going on?? WHy? Why did it happen to me? :-) Best regards, Max On Wed, Apr 25, 2012 at 12:33 PM, Tim Watson wrote: > Thanks autocorrect - I'm not entirely sure that maintaining a 'dork' > involves, but it sounds even worse than maintaining a 'fork' anyway! > > On 25 April 2012 09:18, Gmail wrote: > > Massive +1 on this point. It's really hard to rely on stuff that isn't > tagged and either the author has to maintain a dork of these libraries they > depend on so as to control the changes (which is really quite a headache) > or simply 'hope for the best). Neither of which is a good solution. Please > version and tags your components if you intend them to be re-used! > > > > Sent from my iPhone > > > > On 24 Apr 2012, at 20:43, "Heinz N. Gies" wrote: > > > >> Hi I've noticed that a lot of libraires depend on bleeding edge data I > kind of find that disturbing it makes maintaining a stable environment > close to impossible since one never knows > >> > >> > >> what I mean are lines like this: > >> > >> {alog, ".*", {git, "https://github.com/siberian-fast-food/alogger.git", > {branch, "master"}}} > >> > >> now if the alogger people push a breaking change your application > breaks when depending on it, even worst if you don't even use alogger > yourself but a library you use uses it a change in alogger would break your > application without you having direct influence on it :(. > >> > >> So what I'd love to ask people who maintain libraries is use > dependencies that have a fixed version and tag your own versions so people > can do the same when using your stuff - please? > >> > >> Regards, > >> Heinz > >> > >> PS: I just choose alogger as an example since it was the first I found > - I love the thing :) > >> > >> -- > >> Heinz N. Gies > >> heinz@REDACTED > >> http://licenser.net > >> > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From torben.lehoff@REDACTED Wed Apr 25 11:30:34 2012 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Wed, 25 Apr 2012 11:30:34 +0200 Subject: [erlang-questions] A plead to use tags (or equivalent in your SCM system) In-Reply-To: References: Message-ID: <4F97C43A.7040707@gmail.com> Hi! I might be a bit paranoid, but after loosing half a day due to an "update" to a dependency given with {branch, "master"} I have resorted to the following approach: I fork all the dependencies so that I am in control if I cannot get a proper tag from the dependency itself. This means that: 1. I control when to take in new stuff. 2. I can add my own tags to ease upgrades. 3. If the author removes his repo I still have access to the source. The main problem is that version numbering is not so popular these days - what's the point when you have a sha? Well, it harder to say intelligent things about the magnitude of a change from looking at the sha compared to a version number that follows semantic versioning (semver.org). With semantic versioning you know that a change to the major number will - at the very least - require serious investigation before you can be sure that your code with work with the updated dependency. And so on. It is actually easy to do semver with git - just tag your code. But easy is not enough to get people to do this. Unfortunately. I am of the opinion that it becomes easier to re-use software that uses semver - you get some info from the version number and people that takes the time to do proper semver knows about software maintenance, which speaks volumes for their code. Cheers, Torben On 24/4/12 21:43 , Heinz N. Gies wrote: > Hi I've noticed that a lot of libraires depend on bleeding edge data I kind of find that disturbing it makes maintaining a stable environment close to impossible since one never knows > > > what I mean are lines like this: > > {alog, ".*", {git, "https://github.com/siberian-fast-food/alogger.git", {branch, "master"}}} > > now if the alogger people push a breaking change your application breaks when depending on it, even worst if you don't even use alogger yourself but a library you use uses it a change in alogger would break your application without you having direct influence on it :(. > > So what I'd love to ask people who maintain libraries is use dependencies that have a fixed version and tag your own versions so people can do the same when using your stuff - please? > > Regards, > Heinz > > PS: I just choose alogger as an example since it was the first I found - I love the thing :) > > -- > Heinz N. Gies > heinz@REDACTED > http://licenser.net > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- http://www.linkedin.com/in/torbenhoffmann -------------- next part -------------- An HTML attachment was scrubbed... URL: From jbothma@REDACTED Wed Apr 25 11:39:18 2012 From: jbothma@REDACTED (JD Bothma) Date: Wed, 25 Apr 2012 11:39:18 +0200 Subject: [erlang-questions] A plead to use tags (or equivalent in your SCM system) In-Reply-To: References: <4F97C43A.7040707@gmail.com> Message-ID: I think, at the very least, if you write something with rebar dependencies and the dependency repos aren't tagged, just use the hash of the change you're testing on. That's exactly the version that you believe to work. Sure, it's even better if everyone tags, they're more meaningful (I didn't even read about semantic versioning), but at the very least, I wouldn't want to end up with a moving target on some nested dependency just because one of my dependencies depend on someone else's master branch. You don't need to fork to have a stable dependency, you just use {deps, [{openid, ".*", {git, "https://github.com/brendonh/erl_openid.git", "ed8688d"}}]}. instead of {deps, [{openid, ".*", {git, "https://github.com/brendonh/erl_openid.git", "master"}}]} JD On 25 April 2012 11:30, Torben Hoffmann wrote: > Hi! > > I might be a bit paranoid, but after loosing half a day due to an "update" > to a dependency given with {branch, "master"} I have resorted to the > following approach: I fork all the dependencies so that I am in control if I > cannot get a proper tag from the dependency itself. > > This means that: > > I control when to take in new stuff. > I can add my own tags to ease upgrades. > If the author removes his repo I still have access to the source. > > The main problem is that version numbering is not so popular these days - > what's the point when you have a sha? > Well, it harder to say intelligent things about the magnitude of a change > from looking at the sha compared to a version number that follows semantic > versioning (semver.org). > > With semantic versioning you know that a change to the major number will - > at the very least - require serious investigation before you can be sure > that your code with work with the updated dependency. And so on. > > It is actually easy to do semver with git - just tag your code. > But easy is not enough to get people to do this. Unfortunately. > > I am of the opinion that it becomes easier to re-use software that uses > semver - you get some info from the version number and people that takes the > time to do proper semver knows about software maintenance, which speaks > volumes for their code. > > Cheers, > Torben > > > On 24/4/12 21:43 , Heinz N. Gies wrote: > > Hi I've noticed that a lot of libraires depend on bleeding edge data I kind > of find that disturbing it makes maintaining a stable environment close to > impossible since one never knows > > > what I mean are lines like this: > > {alog, ".*", {git, "https://github.com/siberian-fast-food/alogger.git", > {branch, "master"}}} > > now if the alogger people push a breaking change your application breaks > when depending on it, even worst if you don't even use alogger yourself but > a library you use uses it a change in alogger would break your application > without you having direct influence on it :(. > > So what I'd love to ask people who maintain libraries is use dependencies > that have a fixed version and tag your own versions so people can do the > same when using your stuff - please? > > Regards, > Heinz > > PS: I just choose alogger as an example since it was the first I found - I > love the thing :) > > -- > Heinz N. Gies > heinz@REDACTED > http://licenser.net > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > -- > http://www.linkedin.com/in/torbenhoffmann > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From torben.lehoff@REDACTED Wed Apr 25 11:47:33 2012 From: torben.lehoff@REDACTED (Torben Hoffmann) Date: Wed, 25 Apr 2012 11:47:33 +0200 Subject: [erlang-questions] A plead to use tags (or equivalent in your SCM system) In-Reply-To: References: <4F97C43A.7040707@gmail.com> Message-ID: <4F97C835.9060204@gmail.com> On 25/4/12 11:39 , JD Bothma wrote: > I think, at the very least, if you write something with rebar > dependencies and the dependency repos aren't tagged, just use the hash of > the change you're testing on. That's exactly the version that you > believe to work. > > Sure, it's even better if everyone tags, they're more meaningful (I > didn't even read about semantic versioning), but at the very least, I > wouldn't want to end up with a moving target on some nested dependency > just because one of my dependencies depend on someone else's master > branch. > > You don't need to fork to have a stable dependency, you just use > > {deps, [{openid, ".*", {git, > "https://github.com/brendonh/erl_openid.git", "ed8688d"}}]}. Very true and I do that as well. I just have this paranoia that I want to be sure that I have a fork of a dependency in case the author removes it. I have not personally been burned by this, but I would rather be safe than sorry ;-) Cheers, Torben > > instead of > > {deps, [{openid, ".*", {git, > "https://github.com/brendonh/erl_openid.git", "master"}}]} > > JD > > On 25 April 2012 11:30, Torben Hoffmann wrote: >> Hi! >> >> I might be a bit paranoid, but after loosing half a day due to an "update" >> to a dependency given with {branch, "master"} I have resorted to the >> following approach: I fork all the dependencies so that I am in control if I >> cannot get a proper tag from the dependency itself. >> >> This means that: >> >> I control when to take in new stuff. >> I can add my own tags to ease upgrades. >> If the author removes his repo I still have access to the source. >> >> The main problem is that version numbering is not so popular these days - >> what's the point when you have a sha? >> Well, it harder to say intelligent things about the magnitude of a change >> from looking at the sha compared to a version number that follows semantic >> versioning (semver.org). >> >> With semantic versioning you know that a change to the major number will - >> at the very least - require serious investigation before you can be sure >> that your code with work with the updated dependency. And so on. >> >> It is actually easy to do semver with git - just tag your code. >> But easy is not enough to get people to do this. Unfortunately. >> >> I am of the opinion that it becomes easier to re-use software that uses >> semver - you get some info from the version number and people that takes the >> time to do proper semver knows about software maintenance, which speaks >> volumes for their code. >> >> Cheers, >> Torben >> >> >> On 24/4/12 21:43 , Heinz N. Gies wrote: >> >> Hi I've noticed that a lot of libraires depend on bleeding edge data I kind >> of find that disturbing it makes maintaining a stable environment close to >> impossible since one never knows >> >> >> what I mean are lines like this: >> >> {alog, ".*", {git, "https://github.com/siberian-fast-food/alogger.git", >> {branch, "master"}}} >> >> now if the alogger people push a breaking change your application breaks >> when depending on it, even worst if you don't even use alogger yourself but >> a library you use uses it a change in alogger would break your application >> without you having direct influence on it :(. >> >> So what I'd love to ask people who maintain libraries is use dependencies >> that have a fixed version and tag your own versions so people can do the >> same when using your stuff - please? >> >> Regards, >> Heinz >> >> PS: I just choose alogger as an example since it was the first I found - I >> love the thing :) >> >> -- >> Heinz N. Gies >> heinz@REDACTED >> http://licenser.net >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> >> -- >> http://www.linkedin.com/in/torbenhoffmann >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- http://www.linkedin.com/in/torbenhoffmann From bsvancara@REDACTED Wed Apr 25 11:49:45 2012 From: bsvancara@REDACTED (Bohuslav Svancara) Date: Wed, 25 Apr 2012 11:49:45 +0200 Subject: [erlang-questions] Ho to keep-alive inactive RabbitMQ connections? In-Reply-To: References: <84B16C85-1523-41E5-8716-36DFFB9BF06E@gmail.com> Message-ID: Yes. Connection is closed if a heartbeat pulse does not arrive. You need to open connection again. The best way (I think) is to let module crash and its supervisor will restart (and reconnect) it. I have "topRabbitSupervisor", which starts "rabbitConnection" module. rabbitConnection module opens connection and starts amqp subscribers which use this open connection. If any of amqp subscribers lose a connection (heartbeat did not arrive) it crashes, crash propagates to topRabbitSupervisor and topRabbitSupervisor restarts rabbitConnection which restarts all subscribers then. It seems it works fine. Bob Dne 25. dubna 2012 8:40 Max Bourinov napsal(a): > Hi Tilman! > > I have it! It is 5 seconds in my case. > > *{ok, Connection} = amqp_connection:start(* > * #amqp_params_network{* > * host = "localhost",* > * username = <<"guest">>,* > * password = <<"guest">>,* > * port = 5672,* > * virtual_host = <<"/">>,* > * heartbeat = 5* > * }),* > > > Still dropping connections... > > Best regards, > Max > > > > > On Wed, Apr 25, 2012 at 10:36 AM, Tilman Holschuh < > tilman.holschuh@REDACTED> wrote: > >> Hi Max, >> >> Check out AMQP heartbeat. >> >> Cheers >> - Tilman >> >> On 2012-04-24, at 11:26 PM, Max Bourinov wrote: >> >> > Hi Erlangers, >> > >> > I use forked RabbitMQ client: https://github.com/jbrisbin/amqp_client >> > >> > While testing it I noticed that if connection is not active for some >> hours it becomes closed. Interesting thing is that my Erlang app doesn't >> show any crashes or error messages. SASL is enabled, process that holds >> connection is under supervision. >> > >> > Does anybody know how RabbitMQ client must be configured to keep >> connection alive all the time? >> > >> > Best regards, >> > Max >> > >> > >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://erlang.org/mailman/listinfo/erlang-questions >> >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthew@REDACTED Wed Apr 25 12:14:16 2012 From: matthew@REDACTED (Matthew Sackman) Date: Wed, 25 Apr 2012 11:14:16 +0100 Subject: [erlang-questions] [Dialyser] Type parametrized behaviours In-Reply-To: <30045856.798.1335302226907.JavaMail.geo-discussion-forums@vbqq1> References: <4F96BBF2.8090302@rabbitmq.com> <14724847.757.1335291009372.JavaMail.geo-discussion-forums@vbbh3> <4F96FE50.2030805@rabbitmq.com> <5005629.633.1335296179710.JavaMail.geo-discussion-forums@vbqq1> <4F97033A.9050107@rabbitmq.com> <97213.1897.1335298553752.JavaMail.geo-discussion-forums@vbjb10> <4F970CA6.3000200@rabbitmq.com> <30045856.798.1335302226907.JavaMail.geo-discussion-forums@vbqq1> Message-ID: <20120425101416.GA19156@rabbitmq.com> On Tue, Apr 24, 2012 at 02:17:06PM -0700, Stavros Aronis wrote: > Ok, I understand your original approach now. It is indeed clever and > reduces duplication. Just for purposes of another example, one which shows several narrowings, the same technique is used heavily in erlando. Behaviour: https://github.com/rabbitmq/erlando/blob/master/src/monad.erl Specs: https://github.com/rabbitmq/erlando/blob/master/include/monad_specs.hrl Refinement: https://github.com/rabbitmq/erlando/blob/master/src/identity_m.erl https://github.com/rabbitmq/erlando/blob/master/src/error_m.erl https://github.com/rabbitmq/erlando/blob/master/src/maybe_m.erl https://github.com/rabbitmq/erlando/blob/master/src/list_m.erl https://github.com/rabbitmq/erlando/blob/master/src/state_t.erl https://github.com/rabbitmq/erlando/blob/master/src/error_t.erl Note that some of those refinements (eg maybe_m) also bring in the specs from https://github.com/rabbitmq/erlando/blob/master/include/monad_plus_specs.hrl and that both sets of specs make use of the *same* type parameter name. The point is that it allows you to define the specs with named polymorphism and then to narrow those types as the specialisations require. In the case of erlando, the narrowing still leads to polymorphic types, though normally narrower, whereas the rmq example reduced the types to fully ground types. Just From bourinov@REDACTED Wed Apr 25 13:16:15 2012 From: bourinov@REDACTED (Max Bourinov) Date: Wed, 25 Apr 2012 15:16:15 +0400 Subject: [erlang-questions] Ho to keep-alive inactive RabbitMQ connections? In-Reply-To: References: <84B16C85-1523-41E5-8716-36DFFB9BF06E@gmail.com> Message-ID: Hi Bob, I have 1 to 1 architecture as you described. It works fine! But I cannot understand how it is possible that RabbitMQ client process loses connection WITHOUT crash? It just ABSOLUTELY silently loses connection and I know about it from RabbitMQ management interface only. This is very strange... This is why I asked the List. Best regards, Max On Wed, Apr 25, 2012 at 1:49 PM, Bohuslav Svancara wrote: > Yes. Connection is closed if a heartbeat pulse does not arrive. > You need to open connection again. > The best way (I think) is to let module crash and its supervisor will > restart (and reconnect) it. > > I have "topRabbitSupervisor", which starts "rabbitConnection" module. > rabbitConnection module opens connection and starts amqp subscribers which > use this open connection. > > If any of amqp subscribers lose a connection (heartbeat did not arrive) it > crashes, crash propagates to topRabbitSupervisor and > topRabbitSupervisor restarts rabbitConnection which restarts all > subscribers then. > > It seems it works fine. > > Bob > > Dne 25. dubna 2012 8:40 Max Bourinov napsal(a): > > Hi Tilman! >> >> I have it! It is 5 seconds in my case. >> >> *{ok, Connection} = amqp_connection:start(* >> * #amqp_params_network{* >> * host = "localhost",* >> * username = <<"guest">>,* >> * password = <<"guest">>,* >> * port = 5672,* >> * virtual_host = <<"/">>,* >> * heartbeat = 5* >> * }),* >> >> >> Still dropping connections... >> >> Best regards, >> Max >> >> >> >> >> On Wed, Apr 25, 2012 at 10:36 AM, Tilman Holschuh < >> tilman.holschuh@REDACTED> wrote: >> >>> Hi Max, >>> >>> Check out AMQP heartbeat. >>> >>> Cheers >>> - Tilman >>> >>> On 2012-04-24, at 11:26 PM, Max Bourinov wrote: >>> >>> > Hi Erlangers, >>> > >>> > I use forked RabbitMQ client: https://github.com/jbrisbin/amqp_client >>> > >>> > While testing it I noticed that if connection is not active for some >>> hours it becomes closed. Interesting thing is that my Erlang app doesn't >>> show any crashes or error messages. SASL is enabled, process that holds >>> connection is under supervision. >>> > >>> > Does anybody know how RabbitMQ client must be configured to keep >>> connection alive all the time? >>> > >>> > Best regards, >>> > Max >>> > >>> > >>> > _______________________________________________ >>> > erlang-questions mailing list >>> > erlang-questions@REDACTED >>> > http://erlang.org/mailman/listinfo/erlang-questions >>> >>> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From freeakk@REDACTED Wed Apr 25 13:23:24 2012 From: freeakk@REDACTED (Michael Uvarov) Date: Wed, 25 Apr 2012 15:23:24 +0400 Subject: [erlang-questions] Atom to integer Message-ID: Is there way to convert an atom to its internal representation as its address in the atom table? I planning to use this mapping from atom to id inside driver code. -- Best regards, Uvarov Michael From aleksandr.vin@REDACTED Wed Apr 25 13:52:12 2012 From: aleksandr.vin@REDACTED (Aleksandr Vinokurov) Date: Wed, 25 Apr 2012 15:52:12 +0400 Subject: [erlang-questions] Erlang Job for $5000 in Saint-Petersburg Message-ID: Hello all, We are working on a distributed platform development in Peter-Service CJSC, Saint-Petersburg, Russia. It will be a distributed application server framework with key-value cluster backends, monitoring and audit services and fail-over with scale-ability support under the hood. Now we are in the process of Erlang team building and we look for the best people in Erlang environment that will join us. We offer a big salary of about $5000 for the one that hit us with his Erlang kung-fu. We are a strong Russian IT company with long history and traditions, looking forward for innovations and new technologies. http://www.billing.ru/guest/language/en?destination=mainpage -- Aleksandr Vinokurov +7 (921) 982-21-43 @aleksandrvin -------------- next part -------------- An HTML attachment was scrubbed... URL: From mrtndimitrov@REDACTED Wed Apr 25 14:07:30 2012 From: mrtndimitrov@REDACTED (Martin Dimitrov) Date: Wed, 25 Apr 2012 15:07:30 +0300 Subject: [erlang-questions] How to debug handle_info EXIT message? In-Reply-To: <4F97B903.4020407@volny.cz> References: <4F97AC82.5010508@gmail.com> <4F97B903.4020407@volny.cz> Message-ID: <4F97E902.8070709@gmail.com> The puzzling thing is that this message appears 1-2 sec after the start of the gen_server without any further interaction with it. At the end of Module:init/1 function I try to print information about this process: process_info(list_to_pid("<0.2637.0>")) but returns 'undefined'. On 4/25/2012 11:42 AM, Ladislav Lenart wrote: > Hello. > > The process <0.2637.0> terminated with reason 'normal'. Your gen_server process > received the 'EXIT' message because: > * <0.2637.0> and your gen_server were linked together AND > * your gen_server is trapping exits, i.e. it invoked process_flag(trap_exit, > true) in its init/1. > > See also the following documentation: > * process_flag/2 - http://www.erlang.org/doc/man/erlang.html#process_flag-2 > * spawn_link/1 - http://www.erlang.org/doc/man/erlang.html#spawn_link-1 > * link/1 - http://www.erlang.org/doc/man/erlang.html#link-1 > > > HTH, > > Ladislav Lenart > > > On 25.4.2012 09:49, Martin Dimitrov wrote: >> Hello, >> >> I receive in a module implementing gen_server behavior in the function >> handle_info/2 the following message: >> >> {'EXIT',<0.2637.0>,normal} >> >> What is the reason to receive this message? The process <0.2637.0> was >> spawned by this gen_server and then died? Is it possible to get more >> information about this process after it has died since process_info/1 >> returns undefined? >> >> Thank you very much for looking at this. >> >> Best Regards, >> >> Martin >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > From fjl@REDACTED Wed Apr 25 14:20:49 2012 From: fjl@REDACTED (Felix Lange) Date: Wed, 25 Apr 2012 14:20:49 +0200 Subject: [erlang-questions] Resisting "noconnection" / Remote termination of nodes In-Reply-To: References: Message-ID: Hi, I'd suggest using net_kernel:monitor_nodes/1 for this purpose. Example: shutdown(Nodes) -> spawn_link(fun () -> net_kernel:monitor_nodes(true), lists:foreach(fun (Node) -> rpc:cast(Node, erlang, halt, []) end, Nodes), wait_dead(Nodes) end). wait_dead([]) -> ok; wait_dead([Node | Rest]) -> receive {nodedown, Node, _} -> wait_dead(Rest) after 10000 -> error_logger:error_report([{shutdown_timeout, Node}]), wait_dead(Rest) end. On Tue, 24 Apr 2012 13:52:18 +0200, Olivier BOUDEVILLE wrote: > Hi, > > For a more controlled overall termination of a distributed application, I > try to shutdown synchronously a series of nodes, as properly and as in > parallel as possible, in a non-OTP program. I imagine that using '[ > rpc:cast( N, erlang, halt, [] ) || N <- MyTargetNodes ]' and then waiting > for them to be terminated is the best approach for that. > > As I want now these terminations to be synchronous (i.e. I want my > terminate function to return only when all nodes are down for sure), I > used to rely on checking their termination using net_adm:ping/1 (waiting > for pong to become pang), but kept on getting (systematically) > 'noconnection' errors (exceptions?), which do not seem to be catchable > (at > least not with a 'try .. catch T:E ->.. end' clause). This happens as > soon > as there is at least one node (which happens to be on the same host - of > course it is not the local node from which that rpc:cast is triggered) to > halt. > > I switched to looping on 'lists:member( Nodename, nodes() )' instead of > ping (in both case with a proper waiting between checks), but I still get > 'noconnection' errors. It looks like 'noconnection' is VM-level? As > expected, commenting-out the rpc:cast/3 never leads to 'noconnection'. > > I feel I would need something like net_kernel:unconnect_node/1. > > My question now: how to deal gracefully with such a synchronous node > shutdown and to resist to the (intended) loss of node(s)? > > Thanks in advance for any hint! > Best regards, > > Olivier. > --------------------------- > Olivier Boudeville > > EDF R&D : 1, avenue du G?n?ral de Gaulle, 92140 Clamart, France > D?partement SINETICS, groupe ASICS (I2A), bureau B-226 > Office : +33 1 47 65 59 58 / Mobile : +33 6 16 83 37 22 / Fax : +33 1 47 > 65 27 13 > > > > Ce message et toutes les pi?ces jointes (ci-apr?s le 'Message') sont > ?tablis ? l'intention exclusive des destinataires et les informations > qui y figurent sont strictement confidentielles. Toute utilisation de ce > Message non conforme ? sa destination, toute diffusion ou toute > publication totale ou partielle, est interdite sauf autorisation > expresse. > > Si vous n'?tes pas le destinataire de ce Message, il vous est interdit > de le copier, de le faire suivre, de le divulguer ou d'en utiliser tout > ou partie. Si vous avez re?u ce Message par erreur, merci de le > supprimer de votre syst?me, ainsi que toutes ses copies, et de n'en > garder aucune trace sur quelque support que ce soit. Nous vous > remercions ?galement d'en avertir imm?diatement l'exp?diteur par retour > du message. > > Il est impossible de garantir que les communications par messagerie > ?lectronique arrivent en temps utile, sont s?curis?es ou d?nu?es de > toute erreur ou virus. > ____________________________________________________ > > This message and any attachments (the 'Message') are intended solely for > the addressees. The information contained in this Message is > confidential. Any use of information contained in this Message not in > accord with its purpose, any dissemination or disclosure, either whole > or partial, is prohibited except formal approval. > > If you are not the addressee, you may not copy, forward, disclose or use > any part of it. If you have received this message in error, please > delete it and all copies from your system and notify the sender > immediately by return message. > > E-mail communication cannot be guaranteed to be timely secure, error or > virus-free. From fjl@REDACTED Wed Apr 25 14:26:06 2012 From: fjl@REDACTED (Felix Lange) Date: Wed, 25 Apr 2012 14:26:06 +0200 Subject: [erlang-questions] Resisting "noconnection" / Remote termination of nodes In-Reply-To: References: Message-ID: Please note that shutdown/1 is not synchronous in my example. On Wed, 25 Apr 2012 14:20:49 +0200, Felix Lange wrote: > Hi, > > I'd suggest using net_kernel:monitor_nodes/1 for this purpose. > > Example: > > shutdown(Nodes) -> > spawn_link(fun () -> > net_kernel:monitor_nodes(true), > lists:foreach(fun (Node) -> rpc:cast(Node, > erlang, halt, []) end, Nodes), > wait_dead(Nodes) > end). > > wait_dead([]) -> > ok; > wait_dead([Node | Rest]) -> > receive > {nodedown, Node, _} -> > wait_dead(Rest) > after > 10000 -> > error_logger:error_report([{shutdown_timeout, Node}]), > wait_dead(Rest) > end. > > On Tue, 24 Apr 2012 13:52:18 +0200, Olivier BOUDEVILLE > wrote: > >> Hi, >> >> For a more controlled overall termination of a distributed application, >> I >> try to shutdown synchronously a series of nodes, as properly and as in >> parallel as possible, in a non-OTP program. I imagine that using '[ >> rpc:cast( N, erlang, halt, [] ) || N <- MyTargetNodes ]' and then >> waiting >> for them to be terminated is the best approach for that. >> >> As I want now these terminations to be synchronous (i.e. I want my >> terminate function to return only when all nodes are down for sure), I >> used to rely on checking their termination using net_adm:ping/1 (waiting >> for pong to become pang), but kept on getting (systematically) >> 'noconnection' errors (exceptions?), which do not seem to be catchable >> (at >> least not with a 'try .. catch T:E ->.. end' clause). This happens as >> soon >> as there is at least one node (which happens to be on the same host - of >> course it is not the local node from which that rpc:cast is triggered) >> to >> halt. >> >> I switched to looping on 'lists:member( Nodename, nodes() )' instead of >> ping (in both case with a proper waiting between checks), but I still >> get >> 'noconnection' errors. It looks like 'noconnection' is VM-level? As >> expected, commenting-out the rpc:cast/3 never leads to 'noconnection'. >> >> I feel I would need something like net_kernel:unconnect_node/1. >> >> My question now: how to deal gracefully with such a synchronous node >> shutdown and to resist to the (intended) loss of node(s)? >> >> Thanks in advance for any hint! >> Best regards, >> >> Olivier. >> --------------------------- >> Olivier Boudeville >> >> EDF R&D : 1, avenue du G?n?ral de Gaulle, 92140 Clamart, France >> D?partement SINETICS, groupe ASICS (I2A), bureau B-226 >> Office : +33 1 47 65 59 58 / Mobile : +33 6 16 83 37 22 / Fax : +33 1 47 >> 65 27 13 >> >> >> >> Ce message et toutes les pi?ces jointes (ci-apr?s le 'Message') sont >> ?tablis ? l'intention exclusive des destinataires et les informations >> qui y figurent sont strictement confidentielles. Toute utilisation de >> ce Message non conforme ? sa destination, toute diffusion ou toute >> publication totale ou partielle, est interdite sauf autorisation >> expresse. >> >> Si vous n'?tes pas le destinataire de ce Message, il vous est interdit >> de le copier, de le faire suivre, de le divulguer ou d'en utiliser tout >> ou partie. Si vous avez re?u ce Message par erreur, merci de le >> supprimer de votre syst?me, ainsi que toutes ses copies, et de n'en >> garder aucune trace sur quelque support que ce soit. Nous vous >> remercions ?galement d'en avertir imm?diatement l'exp?diteur par retour >> du message. >> >> Il est impossible de garantir que les communications par messagerie >> ?lectronique arrivent en temps utile, sont s?curis?es ou d?nu?es de >> toute erreur ou virus. >> ____________________________________________________ >> >> This message and any attachments (the 'Message') are intended solely >> for the addressees. The information contained in this Message is >> confidential. Any use of information contained in this Message not in >> accord with its purpose, any dissemination or disclosure, either whole >> or partial, is prohibited except formal approval. >> >> If you are not the addressee, you may not copy, forward, disclose or >> use any part of it. If you have received this message in error, please >> delete it and all copies from your system and notify the sender >> immediately by return message. >> >> E-mail communication cannot be guaranteed to be timely secure, error or >> virus-free. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From witeman.g@REDACTED Wed Apr 25 14:35:51 2012 From: witeman.g@REDACTED (Zheng Zhibin) Date: Wed, 25 Apr 2012 20:35:51 +0800 Subject: [erlang-questions] R15B01 SmartOS Compile Error Message-ID: Dear, On SmartOS(Joyent SmartMachine), When I configure in default mode, and after making, I got this error: gcc -g -O2 -I/root/.kerl/builds/r15b01/otp_src_R15B01/erts/i386-pc-solaris2.11 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fno-tree-copyrename -DERTS_SMP -DHAVE_CONFIG_H -Wall -Wstrict-prototypes -Wmissing-prototypes -Wdeclaration-after-statement -DUSE_THREADS -D_THREAD_SAFE -D_REENTRANT -DPOSIX_THREADS -D_POSIX_PTHREAD_SEMANTICS -Ii386-pc-solaris2.11/opt/smp -Ibeam -Isys/unix -Isys/common -Ii386-pc-solaris2.11 -Izlib -Ipcre -Ihipe -I../include -I../include/i386-pc-solaris2.11 -I../include/internal -I../include/internal/i386-pc-solaris2.11 -c i386-pc-solaris2.11/opt/smp/hipe_x86_bifs.S -o obj/i386-pc-solaris2.11/opt/smp/hipe_x86_bifs.o i386-pc-solaris2.11/opt/smp/hipe_x86_bifs.S:2176:2: error: #endif without #if If I set these environment variable: "--enable-hipe --enable-smp-support --enable-threads --with-dynamic-trace=dtrace --enable-m64-build --enable-kernel-poll" export CFLAGS=-m64 export CPPFLAGS=-m64 Then I got the error as below: gcc -m64 -I/root/.kerl/builds/r15b01/otp_src_R15B01/erts/i386-pc-solaris2.11 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fno-tree-copyrename -m64 -DERTS_SMP -DHAVE_CONFIG_H -Wall -Wstrict-prototypes -Wmissing-prototypes -Wdeclaration-after-statement -DUSE_THREADS -D_THREAD_SAFE -D_REENTRANT -DPOSIX_THREADS -D_POSIX_PTHREAD_SEMANTICS -Ii386-pc-solaris2.11/opt/smp -Ibeam -Isys/unix -Isys/common -Ii386-pc-solaris2.11 -Izlib -Ipcre -Ihipe -I../include -I../include/i386-pc-solaris2.11 -I../include/internal -I../include/internal/i386-pc-solaris2.11 -c hipe/hipe_bif0.c -o obj/i386-pc-solaris2.11/opt/smp/hipe_bif0.o In file included from hipe/hipe_primops.h:91:0, from hipe/hipe_bif0.c:862: hipe/hipe_amd64_primops.h:25:1: error: 'am_sse2_fnegate_mask' undeclared here (not in a function) gmake[3]: *** [obj/i386-pc-solaris2.11/opt/smp/hipe_bif0.o] Error 1 Anyone can help? Thanks and regards, Witeman -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu55@REDACTED Wed Apr 25 14:50:12 2012 From: vladdu55@REDACTED (Vlad Dumitrescu) Date: Wed, 25 Apr 2012 14:50:12 +0200 Subject: [erlang-questions] How to debug handle_info EXIT message? In-Reply-To: <4F97E902.8070709@gmail.com> References: <4F97AC82.5010508@gmail.com> <4F97B903.4020407@volny.cz> <4F97E902.8070709@gmail.com> Message-ID: Hi, On Wed, Apr 25, 2012 at 14:07, Martin Dimitrov wrote: > The puzzling thing is that this message appears 1-2 sec after the start > of the gen_server without any further interaction with it. At the end of > Module:init/1 function I try to print information about this process: > process_info(list_to_pid("<0.2637.0>")) > but returns 'undefined'. You could try to setup tracing on all process events, to see when the process is created and by whom. erlang:trace(all, true, [procs, exiting]) It's best to setup a separate tracer message listener process for it. regards, Vlad From aleksandr.vin@REDACTED Wed Apr 25 15:17:04 2012 From: aleksandr.vin@REDACTED (Aleksandr Vinokurov) Date: Wed, 25 Apr 2012 17:17:04 +0400 Subject: [erlang-questions] Erlang Job for $5000 in Saint-Petersburg In-Reply-To: <86E46605704248E5AA6A65F2F3540918@HALL> References: <86E46605704248E5AA6A65F2F3540918@HALL> Message-ID: Ok John, it's per month basis. Russia is closer to Sweden on this side ;) Thanks, John On 25 April 2012 16:08, John Hughes wrote: > ** > Is that $5,000 per month or per year? Not that I'm a candidate, but you > might want to clarify! (In Sweden, salaries are quoted per month, while in > the UK and the US, they're quoted per year--so I won't be the only one > wondering). > > John > > ----- Original Message ----- > *From:* Aleksandr Vinokurov > *To:* erlang-questions@REDACTED > *Sent:* Wednesday, April 25, 2012 1:52 PM > *Subject:* [erlang-questions] Erlang Job for $5000 in Saint-Petersburg > > > > Hello all, > > We are working on a distributed platform development in Peter-Service > CJSC, Saint-Petersburg, Russia. > It will be a distributed application server framework with key-value > cluster backends, monitoring and audit services > and fail-over with scale-ability support under the hood. > > Now we are in the process of Erlang team building and we look for the best > people in Erlang environment that will join us. We offer a big salary of > about $5000 for the one that hit us with his Erlang kung-fu. > > We are a strong Russian IT company with long history and traditions, > looking forward for innovations and new technologies. > http://www.billing.ru/guest/language/en?destination=mainpage > > -- > Aleksandr Vinokurov > +7 (921) 982-21-43 > @aleksandrvin > > ------------------------------ > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -- ????????? ????????? +7 (921) 982-21-43 @aleksandrvin -------------- next part -------------- An HTML attachment was scrubbed... URL: From aleksandr.vin@REDACTED Wed Apr 25 15:25:32 2012 From: aleksandr.vin@REDACTED (Aleksandr Vinokurov) Date: Wed, 25 Apr 2012 17:25:32 +0400 Subject: [erlang-questions] Webmachine and 302 "Found" redirect Message-ID: Hello all, Can't find a working list for webmachine users. I have a question: how to respond with 302 "Found" code an HTTP request with a vanilla Webmachine callback, like moved_permanently/2. It is missed in the Webmachine activity diagram. I know how to make it work with a {{halt, 302}, wrq:set_resp_header("Location", Location, ReqData),State} but it is not the nice way IMHO. -- Aleksandr Vinokurov -------------- next part -------------- An HTML attachment was scrubbed... URL: From bourinov@REDACTED Wed Apr 25 15:56:38 2012 From: bourinov@REDACTED (Max Bourinov) Date: Wed, 25 Apr 2012 17:56:38 +0400 Subject: [erlang-questions] Erlang Job for $5000 in Saint-Petersburg In-Reply-To: References: <86E46605704248E5AA6A65F2F3540918@HALL> Message-ID: Hi Aleksandr, It is gross salary or net? Please clarify for those who might be interested. p.s. I am also not a candidate. Best regards, Max On Wed, Apr 25, 2012 at 5:17 PM, Aleksandr Vinokurov < aleksandr.vin@REDACTED> wrote: > > > Ok John, it's per month basis. Russia is closer to Sweden on this side ;) > > Thanks, John > > On 25 April 2012 16:08, John Hughes wrote: > >> ** >> Is that $5,000 per month or per year? Not that I'm a candidate, but you >> might want to clarify! (In Sweden, salaries are quoted per month, while in >> the UK and the US, they're quoted per year--so I won't be the only one >> wondering). >> >> John >> >> ----- Original Message ----- >> *From:* Aleksandr Vinokurov >> *To:* erlang-questions@REDACTED >> *Sent:* Wednesday, April 25, 2012 1:52 PM >> *Subject:* [erlang-questions] Erlang Job for $5000 in Saint-Petersburg >> >> >> >> Hello all, >> >> We are working on a distributed platform development in Peter-Service >> CJSC, Saint-Petersburg, Russia. >> It will be a distributed application server framework with key-value >> cluster backends, monitoring and audit services >> and fail-over with scale-ability support under the hood. >> >> Now we are in the process of Erlang team building and we look for the >> best people in Erlang environment that will join us. We offer a big salary >> of about $5000 for the one that hit us with his Erlang kung-fu. >> >> We are a strong Russian IT company with long history and traditions, >> looking forward for innovations and new technologies. >> http://www.billing.ru/guest/language/en?destination=mainpage >> >> -- >> Aleksandr Vinokurov >> +7 (921) 982-21-43 >> @aleksandrvin >> >> ------------------------------ >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > > > -- > ????????? ????????? > +7 (921) 982-21-43 > @aleksandrvin > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From avtobiff@REDACTED Wed Apr 25 16:10:00 2012 From: avtobiff@REDACTED (Per Andersson) Date: Wed, 25 Apr 2012 16:10:00 +0200 Subject: [erlang-questions] Erlang Job for $5000 in Saint-Petersburg In-Reply-To: References: Message-ID: On Wed, Apr 25, 2012 at 1:52 PM, Aleksandr Vinokurov wrote: > > > Hello all, > > We are working on a distributed platform development in Peter-Service CJSC, > Saint-Petersburg, Russia. > It will be a distributed application server framework with key-value cluster > backends, monitoring and audit services and?fail-over?with?scale-ability > support under the hood. > > Now we are in the process of Erlang team building and we look for the best > people in Erlang environment that will join us. We offer a big salary of > about $5000 for the one that hit us with his Erlang kung-fu. Only looking for the best _men_ or are women welcome also, even though you use gender specific possessive pronoun? -- Per > We are a strong?Russian?IT company with long history and traditions, looking > forward for innovations and new > technologies.?http://www.billing.ru/guest/language/en?destination=mainpage > > -- > Aleksandr Vinokurov > +7 (921) 982-21-43 > @aleksandrvin > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From vinoski@REDACTED Wed Apr 25 16:28:35 2012 From: vinoski@REDACTED (Steve Vinoski) Date: Wed, 25 Apr 2012 10:28:35 -0400 Subject: [erlang-questions] Webmachine and 302 "Found" redirect In-Reply-To: References: Message-ID: On Wed, Apr 25, 2012 at 9:25 AM, Aleksandr Vinokurov wrote: > > > Hello all, > > Can't find a working list for webmachine users. http://lists.therestfulway.com/mailman/listinfo/webmachine_lists.therestfulway.com There was a DNS problem that was keeping it from working, Justin Sheehy has fixed it now. --steve From madtrick@REDACTED Wed Apr 25 19:34:35 2012 From: madtrick@REDACTED (Farruco Sanjurjo) Date: Wed, 25 Apr 2012 19:34:35 +0200 Subject: [erlang-questions] Doubt with lists:dropwhile Message-ID: Hi, I'm not getting the expected result while using lists:dropwhile/2 Here is an example of my problem: Data = <<"HTTP/1.1 205 Reset Content\r\n Header-A: A\r\n Header-C : dGhlIHNhbXBsZSBub25jZQ==\r\n Header-D: D\r\n\r\n ">>, lists:dropwhile(fun(E) -> E == <<>> end, binary:split(Data, <<"\r\n">>, [trim, global])). And this is the result: [<<"HTTP/1.1 205 Reset Content">>, <<"\n Header-A: A">>, <<"\n Header-C dGhlIHNhbXBsZSBub25jZQ==">>, <<"\n Header-D: D">>,<<>>, <<"\n ">>] But on the result above, there's a <<>> which if I understand the manpage of lists:dropwhile shouldn't be there. Am I misunderstanding something? -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob@REDACTED Wed Apr 25 19:47:58 2012 From: bob@REDACTED (Bob Ippolito) Date: Wed, 25 Apr 2012 10:47:58 -0700 Subject: [erlang-questions] Doubt with lists:dropwhile In-Reply-To: References: Message-ID: On Wed, Apr 25, 2012 at 10:34 AM, Farruco Sanjurjo wrote: > Hi, > > I'm not getting the expected result while using lists:dropwhile/2 > > Here is an example of my problem: > > Data = <<"HTTP/1.1 205 Reset Content\r\n > Header-A: A\r\n > Header-C : dGhlIHNhbXBsZSBub25jZQ==\r\n > Header-D: D\r\n\r\n > ">>, > > lists:dropwhile(fun(E) -> E == <<>> end, binary:split(Data, <<"\r\n">>, > [trim, global])). > > And this is the result: > > [<<"HTTP/1.1 205 Reset Content">>, > <<"\n Header-A: A">>, > <<"\n Header-C dGhlIHNhbXBsZSBub25jZQ==">>, > <<"\n Header-D: D">>,<<>>, > <<"\n ">>] > > But on the result above, there's a <<>> which if I understand the manpage > of lists:dropwhile shouldn't be there. > > Am I misunderstanding something? > It sounds like you are looking for lists:filter/2, lists:dropwhile/2 drops from the head of the list until F returns false, then it simply returns the rest of the list. -bob -------------- next part -------------- An HTML attachment was scrubbed... URL: From gumm@REDACTED Wed Apr 25 19:49:19 2012 From: gumm@REDACTED (Jesse Gumm) Date: Wed, 25 Apr 2012 12:49:19 -0500 Subject: [erlang-questions] Doubt with lists:dropwhile In-Reply-To: References: Message-ID: This is a misinterpretation of lists:dropwhile. lists:dropwhile will remove elements of a list starting with the first and iterate through the list, continuing to drop elements as long as the predicate returns true. However, as soon as the predicate returns false, it'll just stop and return. So in your case, the dropwhile didn't match the first element, so it just returned. Easy Example: > LessThan5 = fun(X) X < 5 end. > lists:dropwhile(LessThan5,[1,2,3,4,5,6]). [5,6] >lists:dropwhile(LessThan5,[6,5,4,3,2,1]). [6,5,4,3,2,1] -Jesse On Wed, Apr 25, 2012 at 12:34 PM, Farruco Sanjurjo wrote: > Hi, > > I'm not getting the expected result while using lists:dropwhile/2 > > Here is an example of my problem: > > Data = <<"HTTP/1.1 205 Reset Content\r\n > ? ? ? ? ? ? ? Header-A: A\r\n > ? ? ? ? ? ? ? Header-C : dGhlIHNhbXBsZSBub25jZQ==\r\n > ? ? ? ? ? ? ? Header-D: D\r\n\r\n > ? ? ? ? ? ? ? ">>, > > lists:dropwhile(fun(E) -> E == <<>> end, binary:split(Data, <<"\r\n">>, > [trim, global])). > > And this is the result: > > [<<"HTTP/1.1 205 Reset Content">>, > ?<<"\n ? ? ? ? ? ? ?Header-A: A">>, > ?<<"\n ? ? ? ? ? ? ?Header-C dGhlIHNhbXBsZSBub25jZQ==">>, > ?<<"\n ? ? ? ? ? ? ?Header-D: D">>,<<>>, > ?<<"\n ? ? ? ? ? ? ?">>] > > But on the result above, there's a <<>> which if I understand the manpage of > lists:dropwhile shouldn't be there. > > Am I misunderstanding something? > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -- Jesse Gumm Owner, Sigma Star Systems 414.940.4866 || sigma-star.com || @jessegumm From james@REDACTED Wed Apr 25 19:51:16 2012 From: james@REDACTED (James Aimonetti) Date: Wed, 25 Apr 2012 10:51:16 -0700 Subject: [erlang-questions] Doubt with lists:dropwhile In-Reply-To: References: Message-ID: <4F983994.9020505@2600hz.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 lists:dropwhile/2 discards list elements while the fun returns true. The first element of the list, <<"HTTP/1.1 205 Reset Content">>, does not equal the empty binary, returns false, which ends the dropwhile/2, having dropped no elements. Are you trying to filter out the empty binary? [ E || E <- binary:split(Data, <<"\r\n">>, [trim, global]), E =/= <<>>]. That will filter out all empty binaries. On 04/25/2012 10:34 AM, Farruco Sanjurjo wrote: > Hi, > > I'm not getting the expected result while using lists:dropwhile/2 > > Here is an example of my problem: > > Data = <<"HTTP/1.1 205 Reset Content\r\n Header-A: A\r\n Header-C : > dGhlIHNhbXBsZSBub25jZQ==\r\n Header-D: D\r\n\r\n ">>, > > lists:dropwhile(fun(E) -> E == <<>> end, binary:split(Data, > <<"\r\n">>, [trim, global])). > > And this is the result: > > [<<"HTTP/1.1 205 Reset Content">>, <<"\n Header-A: > A">>, <<"\n Header-C dGhlIHNhbXBsZSBub25jZQ==">>, > <<"\n Header-D: D">>,<<>>, <<"\n ">>] > > But on the result above, there's a <<>> which if I understand the > manpage of lists:dropwhile shouldn't be there. > > Am I misunderstanding something? > > > > > _______________________________________________ erlang-questions > mailing list erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions - -- James Aimonetti Distributed Systems Engineer / DJ MC_ 2600hz | http://2600hz.com sip:james@REDACTED tel: 415.886.7905 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJPmDmUAAoJENc77s1OYoGgdsQH/1UHoHzlgMxsAToCTUtMGgP4 qBtM62soVTPAeNNrLEPBokY8Jv0qpDPVI2cQeDRLHqrvi5JfVaAK09gIUrMbluNi KGr1MqH5GsYS+SVeUgKRwfvKpuKijzGDzY0pFLLywvXtRAw/5WO2YuLYC9oV7vD1 ixgaRQMOiie3TkO5igdDo72mlhtdyREizxdrGD8BBIb6mpKMnP1wVc7tabKYgZF5 xiQUbtMbaEbEbstQSDMiDDNy6hl86S8kj1eCJqGtggTirCII3fvk5Qqm13Q5sVEc 65HPhrab+PbUS4K74LAyqfwlcUK04CVS4qCkaHoJCfOBfZPoXMCQtwX/Vj6Zp58= =GVoj -----END PGP SIGNATURE----- From madtrick@REDACTED Wed Apr 25 20:08:11 2012 From: madtrick@REDACTED (Farruco Sanjurjo) Date: Wed, 25 Apr 2012 20:08:11 +0200 Subject: [erlang-questions] Doubt with lists:dropwhile In-Reply-To: References: Message-ID: You both are right. It was a misinterpretation : ) Thanks P.S: Bob and Jesse, sorry for the previous responses. I click "Reply" instead of "Reply to all". Shame on me : ( On 25 April 2012 19:49, Jesse Gumm wrote: > This is a misinterpretation of lists:dropwhile. > > lists:dropwhile will remove elements of a list starting with the first > and iterate through the list, continuing to drop elements as long as > the predicate returns true. However, as soon as the predicate returns > false, it'll just stop and return. > > So in your case, the dropwhile didn't match the first element, so it > just returned. > > Easy Example: > > > LessThan5 = fun(X) X < 5 end. > > > lists:dropwhile(LessThan5,[1,2,3,4,5,6]). > [5,6] > > >lists:dropwhile(LessThan5,[6,5,4,3,2,1]). > [6,5,4,3,2,1] > > -Jesse > > On Wed, Apr 25, 2012 at 12:34 PM, Farruco Sanjurjo > wrote: > > Hi, > > > > I'm not getting the expected result while using lists:dropwhile/2 > > > > Here is an example of my problem: > > > > Data = <<"HTTP/1.1 205 Reset Content\r\n > > Header-A: A\r\n > > Header-C : dGhlIHNhbXBsZSBub25jZQ==\r\n > > Header-D: D\r\n\r\n > > ">>, > > > > lists:dropwhile(fun(E) -> E == <<>> end, binary:split(Data, <<"\r\n">>, > > [trim, global])). > > > > And this is the result: > > > > [<<"HTTP/1.1 205 Reset Content">>, > > <<"\n Header-A: A">>, > > <<"\n Header-C dGhlIHNhbXBsZSBub25jZQ==">>, > > <<"\n Header-D: D">>,<<>>, > > <<"\n ">>] > > > > But on the result above, there's a <<>> which if I understand the > manpage of > > lists:dropwhile shouldn't be there. > > > > Am I misunderstanding something? > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > > > > > -- > Jesse Gumm > Owner, Sigma Star Systems > 414.940.4866 || sigma-star.com || @jessegumm > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jwatte@REDACTED Wed Apr 25 23:40:56 2012 From: jwatte@REDACTED (Jon Watte) Date: Wed, 25 Apr 2012 14:40:56 -0700 Subject: [erlang-questions] dynamic compilation of funs In-Reply-To: <4F966B03.3030005@gmail.com> References: <4F965B86.3020100@gmail.com> <4F966742.2070503@gmail.com> <5540AED9-6155-485B-A7EC-A2BBA90D2A78@feuerlabs.com> <4F966B03.3030005@gmail.com> Message-ID: Module look-up is a hash table look-up, so assuming correct re-hashing implementation, it's amortized O(1). If you're really, really worried, then it would be super simple to just write the two versions, and benchmark them in isolation, and see if there's a real difference. My money is on a module-per-function being just fine. Sincerely, Jon Watte -- "I pledge allegiance to the flag of the United States of America, and to the republic for which it stands, one nation indivisible, with liberty and justice for all." ~ Adopted by U.S. Congress, June 22, 1942 On Tue, Apr 24, 2012 at 1:57 AM, Martin Dimitrov wrote: > That is precisely my concern, the lack of documentation on the subject. > In our app the number of functions can grow so I am not sure if this is > the best option. > > Thanks again for the reply. > > Martin > > On 4/24/2012 11:54 AM, Ulf Wiger wrote: > > On 24 Apr 2012, at 10:41, Martin Dimitrov wrote: > > > >> One more question: would it be inefficient to create a separate module > >> for each function? I would have about 1000 of them. > > I do believe the most complex erlang-based systems built have thousands > of modules. > > > > (E.g. the AXD 301 - and GPRS, which is roughly as complex, with more > than 1M lines of code; I'm not sure what the average module size was, but > would guess that it was < 1000 LOC). > > > > There are no linear operations when addressing modules, except e.g. if > you decide to list them all. > > > > Interestingly, there is no limit mentioned in the Efficiency Guide > regarding the number of modules. I guess there is no limit then. :) > > > > BR, > > Ulf W > > > > Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. > > http://feuerlabs.com > > > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jwatte@REDACTED Wed Apr 25 23:48:34 2012 From: jwatte@REDACTED (Jon Watte) Date: Wed, 25 Apr 2012 14:48:34 -0700 Subject: [erlang-questions] Crash in beam.smp, using x64 version of R15B01 In-Reply-To: References: Message-ID: It turns out this was EBKAC -- I had not managed to remove all old bits of Erlang, so an old shared library got in the way and caused incompatibility. On a clean machine, R15B01 does not crash. It breaks previously working eunit tests, but I'm pretty sure that's my own fault :-) Sincerely, Jon Watte -- "I pledge allegiance to the flag of the United States of America, and to the republic for which it stands, one nation indivisible, with liberty and justice for all." ~ Adopted by U.S. Congress, June 22, 1942 On Mon, Apr 23, 2012 at 2:27 PM, Jon Watte wrote: > Our test suite runner seems to produce a segfault in the Erlang VM > (beam.smp.) > > I'm trying to port a system currently running R13B03 on Ubuntu Server x64 > LTS 10.04 to R15B01. It's time I had line numbers in my back traces! > I downloaded the release and built from source. I uninstalled the R13B03 > that came with Ubuntu, and did a "make install" on the built release. > The stack trace is just two frames of the value "0x0000000000000060" so it > looks like a stack smasher bug. > > I can provide a bundled directory of beam files and a test runner script > that reproduces the problem to anyone interested in figuring this out! > > > Sincerely, > > Jon Watte > > > -- > "I pledge allegiance to the flag of the United States of America, and to > the republic for which it stands, one nation indivisible, with liberty and > justice for all." > ~ Adopted by U.S. Congress, June 22, 1942 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Thu Apr 26 00:35:05 2012 From: ulf@REDACTED (Ulf Wiger) Date: Thu, 26 Apr 2012 00:35:05 +0200 Subject: [erlang-questions] dynamic compilation of funs In-Reply-To: References: <4F965B86.3020100@gmail.com> <4F966742.2070503@gmail.com> <5540AED9-6155-485B-A7EC-A2BBA90D2A78@feuerlabs.com> <4F966B03.3030005@gmail.com> Message-ID: On 25 Apr 2012, at 23:40, Jon Watte wrote: > Module look-up is a hash table look-up, so assuming correct re-hashing implementation, it's amortized O(1). > > If you're really, really worried, then it would be super simple to just write the two versions, and benchmark them in isolation, and see if there's a real difference. My money is on a module-per-function being just fine. ?but, as I mentioned before, there is currently an issue with module loading being potentially disruptive in the SMP VM. See e.g. http://article.gmane.org/gmane.comp.lang.erlang.general/56974 BR, Ulf W Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From lukas@REDACTED Thu Apr 26 00:55:10 2012 From: lukas@REDACTED (Lukas Larsson) Date: Thu, 26 Apr 2012 00:55:10 +0200 Subject: [erlang-questions] dynamic compilation of funs In-Reply-To: References: <4F965B86.3020100@gmail.com> <4F966742.2070503@gmail.com> <5540AED9-6155-485B-A7EC-A2BBA90D2A78@feuerlabs.com> <4F966B03.3030005@gmail.com> Message-ID: The SMP load issue has been fixed in the current master branch on github and will be part of the R16B release. Lukas On Thu, Apr 26, 2012 at 12:35 AM, Ulf Wiger wrote: > > On 25 Apr 2012, at 23:40, Jon Watte wrote: > > Module look-up is a hash table look-up, so assuming correct re-hashing > implementation, it's amortized O(1). > > If you're really, really worried, then it would be super simple to just > write the two versions, and benchmark them in isolation, and see if there's > a real difference. My money is on a module-per-function being just fine. > > > ?but, as I mentioned before, there is currently an issue with module loading > being potentially disruptive in the SMP VM. > > See e.g. > > http://article.gmane.org/gmane.comp.lang.erlang.general/56974 > > BR, > Ulf W > > Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. > http://feuerlabs.com > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From kostis@REDACTED Thu Apr 26 00:57:19 2012 From: kostis@REDACTED (Kostis Sagonas) Date: Thu, 26 Apr 2012 00:57:19 +0200 Subject: [erlang-questions] [Dialyser] Type parametrized behaviours In-Reply-To: <4F96BBF2.8090302@rabbitmq.com> References: <4F96BBF2.8090302@rabbitmq.com> Message-ID: <4F98814F.2070108@cs.ntua.gr> On 04/24/2012 04:42 PM, Francesco Mazzoli wrote: > Hi, > > I have recently updated some code to use the new callback signatures for > behaviours. Before that, we simply used a .hrl file that we included in > each implementing module. > > While hacky, the old approach had an advantage: we could include in the > .hrl specs some types that were to be defined in the including file, and > then used in type signatures. > > It would be useful to be able to parametrize behaviours by type more > nicely, since most behaviours specs are dominated by 1 or 2 types > (classically some kind of state) and as of now no typechecking takes > place on those types. That might be achieved with some pre-processor > directive, e.g. -behaviour_type(whatever). > > What do you think? The first thing I think is that you have not fully understood the need for having both a -callback and a -spec. In the general case, the behaviour module needs to have a way to define what the callback module *can* have as implementation of callbacks, not what it *should* have as its implementation. For example, it's perfectly ok for the behaviour module to say that there needs to be a callback function f/1 which can return 'foo' and 'bar' and for the callback module to implement a function that just returns 'bar'. So, we do need both these attributes since they serve different purposes. This also means that the "header file approach" does not work / is not flexible enough in general. Now, regarding parameterized behaviours, I think that you need to explain more concretely what you have in mind. Perhaps it's something interesting but the example you gave in another mail of yours: > To give a small example of what I want to do, a behaviour might define > > -callback step(state()) -> state(). > > where `state()' is not define locally in the behaviour, but in each > implementing module. > > I hope I made myself more clear. unfortunately does not make matters any clearer... If I understand what you are sketching correctly, the problem I see is that since there will be no definition for state() in the behaviour module, that module will impose no constraints on what state() can be. Thus, your example is semantically equivalent to: -callback step(X) -> Y. for some arbitrary types X and Y. (Just take state() to be their union.) The point is that the callback module is allowed to provide the following implementation of step/1 step(foo) -> 42. and dialyzer (*) is obliged to keep silent in this case. As I wrote this case is actually fine. The callback module is allowed to implement only a portion of what the callback spec specifies. How is that different than what currently takes place other than perhaps requiring that the callback module contains a definition for state()? (Perhaps as liberal as -type state() :: 'foo' | 42.) Anyway, can you provide a *precise* proposal for how you want things to look and what checks dialyzer should perform in your opinion? Kostis (*) Please use the correct spelling for dialyzer. From francesco@REDACTED Thu Apr 26 01:12:13 2012 From: francesco@REDACTED (Francesco Mazzoli) Date: Thu, 26 Apr 2012 00:12:13 +0100 Subject: [erlang-questions] [Dialyser] Type parametrized behaviours In-Reply-To: <4F98814F.2070108@cs.ntua.gr> References: <4F96BBF2.8090302@rabbitmq.com> <4F98814F.2070108@cs.ntua.gr> Message-ID: <4F9884CD.7000003@rabbitmq.com> Hi Kostis, Thanks for your answer. I'll probably try to produce something more precise when I have time, but me and Matthew gave more precise use cases further in the thread, which hopefully clarify things (they did for Stavros). > If I understand what you are sketching correctly, the problem I see is > that since there will be no definition for state() in the behaviour > module, that module will impose no constraints on what state() can be. No, my problem is that I want to defer the decision of state() to the *implementing* behaviours, not the behaviour specs itself. > Thus, your example is semantically equivalent to: > > -callback step(X) -> Y. I don't follow you here, and I'm not sure what semantics you're referring to... My example was just an example of a function with an argument of a given type which returns something of the same type, nothing more. The rest of your post follows these premises, so I'm not sure what you're suggesting. Francesco. From matthew@REDACTED Thu Apr 26 02:20:02 2012 From: matthew@REDACTED (Matthew Sackman) Date: Thu, 26 Apr 2012 01:20:02 +0100 Subject: [erlang-questions] [Dialyser] Type parametrized behaviours In-Reply-To: <4F98814F.2070108@cs.ntua.gr> References: <4F96BBF2.8090302@rabbitmq.com> <4F98814F.2070108@cs.ntua.gr> Message-ID: <20120426002002.GA24034@rabbitmq.com> On Thu, Apr 26, 2012 at 12:57:19AM +0200, Kostis Sagonas wrote: > In the general case, > the behaviour module needs to have a way to define what the callback > module *can* have as implementation of callbacks, not what it > *should* have as its implementation. For example, it's perfectly ok > for the behaviour module to say that there needs to be a callback > function f/1 which can return 'foo' and 'bar' and for the callback > module to implement a function that just returns 'bar'. Absolutely. So we agree that 'foo' is a subtype of 'foo' | 'bar'. Just so that we're on the same page, let us also define subtyping to be symmetric - i.e. A is a subtype of A. Let us also define supertype to be "if A is a subtype of B then B is a supertype of A". > So, we do > need both these attributes since they serve different purposes. This > also means that the "header file approach" does not work / is not > flexible enough in general. In general, yes, I agree. I would add the following though: If type inference on the callback module's function definition yields a type that wider in the parameters and narrower in the result type, then that is an acceptable implementation of the callback. I.e. if the callback says :: (number()) -> (boolean() | 'undefined') and the function is :: (number() | atom()) -> 'undefined' then that is fine, as the callback spec is a subtype of the function in parameter and a supertype in the result. As per the usual covariance/contravariance methods. Consequently, the only purpose of a spec in the module itself is for clarity of documentation, or to explicitly provide a type that dialyzer cannot infer. > If I understand what you are sketching correctly, the problem I see > is that since there will be no definition for state() in the > behaviour module, that module will impose no constraints on what > state() can be. Thus, your example is semantically equivalent to: > > -callback step(X) -> Y. > > for some arbitrary types X and Y. (Just take state() to be their union.) > > The point is that the callback module is allowed to provide the > following implementation of step/1 > > step(foo) -> 42. > > and dialyzer (*) is obliged to keep silent in this case. As I wrote > this case is actually fine. The callback module is allowed to > implement only a portion of what the callback spec specifies. How is > that different than what currently takes place other than perhaps > requiring that the callback module contains a definition for > state()? (Perhaps as liberal as -type state() :: 'foo' | 42.) If I understand you correctly, the answer to your question is purely to do with scoping of the type parameters. Rather than just leaving individual functions as polymorphic, we wish to express that the instantiation of the type parameter is the same across the callback. The problem we wish to solve is that -callback init() -> A. -callback step(A) -> A. -callback unstep(A) -> A. would allow me to implement a module in which it is unsafe to write unstep(step(init())), because those As may not be the same thing. For example: $ cat behave.erl -module(behave). -export([behaviour_info/1]). behaviour_info(callbacks) -> [{init, 0}, {step, 1}, {unstep, 1}]; behaviour_info(_Other) -> undefined. $ cat foo.erl -module(foo). -export([init/0, step/1, unstep/1]). -behaviour(behave). init() -> 5. step(true) -> false. unstep(wibble) -> wobble. $ rm *.beam ; erlc behave.erl ; erlc -I . -pa . -Wall foo.erl $ dialyzer foo.erl Checking whether the PLT /home/matthew/.dialyzer_plt is up-to-date... yes Proceeding with analysis... done in 0m0.99s done (passed successfully) I want to prevent this as I choose to judge it illegal and I would like dialyzer to help enforce this. Thus the current solution is: $ cat behave.erl -module(behave). -export([behaviour_info/1]). behaviour_info(callbacks) -> [{init, 0}, {step, 1}, {unstep, 1}]; behaviour_info(_Other) -> undefined. $ cat behave_specs.hrl -spec init() -> state(). -spec step(state()) -> state(). -spec unstep(state()) -> state(). $ cat foo.erl -module(foo). -export([init/0, step/1, unstep/1]). -behaviour(behave). -type state() :: boolean(). -include("behave_specs.hrl"). init() -> 5. step(true) -> false. unstep(wibble) -> wobble. This will now be rejected, which is what I want. As a user of modules which implement this behaviour, I want to know that it is always safe to write M:unstep(M:step(M:init())). I don't care what the ground type is, but I want dialyzer to be able to enforce this for me. To do that, I can't use *just* the -callback attribute, because 1) they do not allow the scope of polymorphic type parameters to be wider than the callback attribute itself; and 2) they do not allow type parameters to be defined in the callback modules themselves. As you said, -callback and -spec do serve different roles. In our case, it would seem of greater use to us for the -callback attributes to be treated as templates for the -specs which can be further refined in the module, thus achieving the same avoidance of duplication as we currently do. In short, the method we use with headers allows us to express more accurate constraints with less duplication than the -callback attributes alone would allow. If the -callback attributes are not designed to help us achieve the sorts of abstractions and constraints that I've described, then it becomes very unclear what additional functionality the -callback attribute mechanism is providing. I hope that's clearer. Matthew From james@REDACTED Thu Apr 26 03:06:54 2012 From: james@REDACTED (James Aimonetti) Date: Wed, 25 Apr 2012 18:06:54 -0700 Subject: [erlang-questions] Dialyzer and opaque types question Message-ID: <4F989FAE.2080607@2600hz.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 We have a module, whapps_call.erl, with a record, types, and an exported type defined inside: - -record(whapps_call, {lots, of, fields, but, one, in, particular :: whapps_helper_function()}). - -type whapps_api_binary() :: binary() | 'undefined'. - -type whapps_helper_function() :: fun((whapps_api_binary(), whapps_call:call()) -> whapps_api_binary()). - -opaque call() :: #whapps_call{}. - -export_type([call/0]). One of our 'getter' functions tries to use the function in 'particular' if defined; that function looks like: call_id(#whapps_call{field=Field, particular=undefined}) -> Field; call_id(#whapps_call{field=Field, particular=Fun}=Call) when is_function(Fun, 2) -> Fun(Field, Call). 'field', in this case, is spec'd as whapps_api_binary() in the record definition. When Dialyzing, however, we get: $ dialyzer --plt ../.platform_dialyzer.plt ebin/whapps_call.beam Checking whether the PLT ../.platform_dialyzer.plt is up-to-date... yes Proceeding with analysis... whapps_call.erl:323: Fun application with arguments (Field::'undefined' | binary(),Call::whapps_call:call()) will fail since the function has type fun(('undefined' | binary(),whapps_call:call()) -> 'undefined' | binary()) Line 323 is the "Fun(Field, Call)." line in the source. If I change the call() type from -opaque to -type, all is well and no warnings/errors are emitted. - -- James Aimonetti Distributed Systems Engineer / DJ MC_ 2600hz | http://2600hz.com sip:james@REDACTED tel: 415.886.7905 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJPmJ+uAAoJENc77s1OYoGgSXMH/REPOC0mosTB1GojzVZ1R9W/ 15dkQOM09k8TqEl9TSYmHx7fr0dkqhDCl2Cw3zfO4V25WA719K9YJd8oU1/JgdE4 KPv+wnX9Y2TFdmxInaPD7MNuWY7lV36kHbhBn2zoXw/VxHbUgVj5pbRn8yCkytX/ UHUL8e2uNw9QolLLEkiOeaILd3jWHe/kIZp/iQXRpsrC9D+To7utsJhIF4DudgIM W377euYKynXD8YG+nvnkwq/HViRtToVhZTdwks5xpl7aJLlBXFhsQtpX5Fy16Syz hIEk39Sp63aju4Gz1RGqAPfakjsG3zzBJMOryBZVH4Bk/Pkn47XMMMau9mS1yuE= =Acsb -----END PGP SIGNATURE----- From ok@REDACTED Thu Apr 26 03:50:40 2012 From: ok@REDACTED (Richard O'Keefe) Date: Thu, 26 Apr 2012 13:50:40 +1200 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: <4F965B38.1000302@fastmail.fm> References: <4F9320F7.3010009@fastmail.fm> <436F6F6E-1131-4DC8-846B-0B0CC4C92CD8@cs.otago.ac.nz> <4F94BE6A.5010906@fastmail.fm> <049bd08514a53fb92bdc31699b438c8c.squirrel@chasm.otago.ac.nz> <4F951F75.4090708@fastmail.fm> <1EEF2F3F-A943-487F-A677-0AEAE24668FF@cs.otago.ac.nz> <4F95E025.1000404@fastmail.fm> <87C1D9BF-4845-487A-A1FE-7CEC91FA4C90@cs.otago.ac.nz> <4F965B38.1000302@fastmail.fm> Message-ID: <728E8F42-1626-450E-AE2C-2EB9ECDF48F0@cs.otago.ac.nz> On 24/04/2012, at 7:50 PM, Jan Burse wrote: > Richard O'Keefe schrieb: >> Records are not objects. Don't even_try_ to import OO >> concepts into a discussion of Erlang. It's generally not >> going to make much sense. > > Why do you think so? Objects are a superset of records. > Objects encapsulate state, behaviour and identity (Booch > teaching OO for dummies). Records - do not have identity distinct from their contents - do not encapsulate mutable state - do not have any associated behaviour - are not associated with anything even remotely like classes, inheritance, or delegation. That is, NONE of the OO concepts apply to records. > If you use them to only encapsulate > state and no behaviour and no identity you get records. This reminds me of a joke that I saw several times in the "Pogo" comic strip by Walt Kelly; I don't know whether he invented it or not. If the Mayor could read, I'd write him a nasty letter about this, if I could write. > So any properties I describe about objects in La La Land nononononononononno! Remember, "programming La La Land" (Macintosh Dictionary defines "La La Land" as "a fanciful dreamworld") is *****NO***** the world of object oriented programming. It is the world in which programmers are encouraged to create incompletely initialised data structures that do not satisfy any useful invariant, whether those data structures are objects or not. > also apply to their use in modelling records, as long as > these properties are not specific to behaviours or > identities of object. OR encapsulation of mutable state. In short, you are saying, yes, really you are, "Any properties I describe about objects apply to records as long as they are not OBJECT properties". A fat lot of use _that_ is! Erlang is often characterised as an Actor language. As such, the nearest equivalent of an object in Erlang is not a record but a *process*. Processes have - a persistent identity distinct from their state - encapsulate state which varies with time - are created in modules that equip them with state - messages they respond to (some versions of Actors, and early versions of Smalltalk, used something uncommonly like an Erlang 'receive' to indicate willingness to accept a message and select what to do based on its contents) which clearly counts as associated behaviour Trying to apply object-oriented concepts to records . > Frames are the grand mother of objects also in La La Land. > But the difference is probably the following. The objects > in La La Land carry their frame slot information not inside > object instances but in the class of an instance. You were told before that "programming La La Land" had nothing to do with objects. Please remember that. If you had read the frames proposal, you would have realised that the proposed implementation has the first slot pointing to a descriptor, which can be shared by any number of frames having the same slots. This is precisely the same as an object pointing to its class. At this late date, I am sure that I don't have to point out that there is a wildly popular object oriented language that doesn't *have* classes. Sadly, I don't mean 'Self'. I mean, of course, JavaScript. Logically, JavaScript objects *do* carry their slot information inside object instances. Some implementations do very clever things at run time, and I suppose there may have been an influence from advanced JavaScript implementation techniques on the frames proposal, although I thought I was inspired by Self. > So you can > for example have zillions of instances of a class Color, > that a Color class has a red, green and blue attribute is only > stored once in the class. In exactly the same way, you can have 'zillions of instances' of a frame where each instance is four words: R, G, B and run time type information. If I was to have any hope of getting frames accepted, I felt I had to show that they would have no space penalty compared with records. (They could even take less per-instance space.) > > So if your are going about to implement frames via some > dictionary data structure (hash table in La La Land) Would you kindly have the goodness to READ the frames proposal before criticising it? Frames are NOT dictionaries and dictionaries in general are NOT the same as hash tables (in my Smalltalk system I have four different implementations of dictionaries, only one of which is a hash table). The frames proposal does not use hash tables. > It could be that some newer interpreters, like the JavaScript > interpreter of Chrome, can deduce class information at runtime > in a JIT fashion, and eventually adapt the representation of > their associative arrays. But I am not 100% sure, and would > need to lookup a reference, There are true compilers for JavaScript. The Rhino JavaScript compiler compiles JavaScript sources to Java .class files, for example. You may perhaps be thinking of this: in SpiderMonkey[, m]ost objects are represented by a shared structural description, called the object shape, that maps property names to array indexes using a hash table. The object stores a pointer to the shape and the array of its own property values. (This is from the PLDI'09 paper about TraceMonkey.) This is pretty much the representation in the 'frames' paper except for the frame shape not being a hash table. From max.lapshin@REDACTED Thu Apr 26 07:00:53 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Thu, 26 Apr 2012 09:00:53 +0400 Subject: [erlang-questions] Erlang and FIX protocol Message-ID: Seems that since May 2007 ( http://erlang.2086793.n4.nabble.com/FIX-protocol-td2096116.html) nothing had changed about erlang and FIX protocol, http://fixprotocol.org/ Everyone is rewriting their own parser/encoder? -------------- next part -------------- An HTML attachment was scrubbed... URL: From cyplo@REDACTED Thu Apr 26 07:29:04 2012 From: cyplo@REDACTED (=?UTF-8?Q?Cyryl_P=C5=82otnicki=2DChudyk?=) Date: Thu, 26 Apr 2012 07:29:04 +0200 Subject: [erlang-questions] compiling github's master from scratch Message-ID: Hello ! I have problems compiling the master branch from scratch, both on linux and macos. [cyryl@REDACTED dev]$ git clone https://github.com/erlang/otp.git Cloning into 'otp'... remote: Counting objects: 78204, done. remote: Compressing objects: 100% (20703/20703), done. remote: Total 78204 (delta 60145), reused 73570 (delta 56113) Receiving objects: 100% (78204/78204), 56.08 MiB | 724 KiB/s, done. Resolving deltas: 100% (60145/60145), done. [cyryl@REDACTED dev]$ cd otp/ [cyryl@REDACTED otp]$ ls aclocal.m4 configure.in INSTALL-CROSS.md make prebuild.delete README.md TAR.include AUTHORS EPLICENCE INSTALL.md Makefile.in prebuild.skip README.md.txt xcomp bin erl-build-tool-vars.sh INSTALL-WIN32.md otp_build README.bootstrap README.systemtap.md bootstrap erts lib plt README.dtrace.md system [cyryl@REDACTED otp]$ autoconf [cyryl@REDACTED otp]$ ./configure Ignoring the --cache-file argument since it can cause the system to be erroneously configured Disabling caching checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking for g++... g++ checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes checking for ld... ld checking for GNU make... yes (make) checking for a BSD-compatible install... /usr/bin/install -c checking whether ln -s works... yes checking for ranlib... ranlib checking ERTS version... 5.10 checking OTP release... R16B configure: creating ./config.status config.status: creating Makefile config.status: WARNING: 'Makefile.in' seems to ignore the --datarootdir setting config.status: creating make/emd2exml === configuring in lib (/home/cyryl/dev/otp/lib) configure: WARNING: no configuration information is in lib === configuring in erts (/home/cyryl/dev/otp/erts) configure: running /bin/sh /home/cyryl/dev/otp/erts/autoconf/configure --disable-option-checking '--prefix=/usr/local' --cache-file=/dev/null --srcdir=/home/cyryl/dev/otp/erts /bin/sh: /home/cyryl/dev/otp/erts/autoconf/configure: No such file or directory configure: error: /home/cyryl/dev/otp/erts/autoconf/configure failed for erts [cyryl@REDACTED otp]$ git branch * master Is it me or is it a bug ? If so - should I try to fix it or wait for some patch ? -- cyryl From kostis@REDACTED Thu Apr 26 07:35:18 2012 From: kostis@REDACTED (Kostis Sagonas) Date: Thu, 26 Apr 2012 07:35:18 +0200 Subject: [erlang-questions] compiling github's master from scratch In-Reply-To: References: Message-ID: <4F98DE96.7010204@cs.ntua.gr> On 04/26/2012 07:29 AM, Cyryl P?otnicki-Chudyk wrote: > Hello ! > I have problems compiling the master branch from scratch, both on > linux and macos. > > [cyryl@REDACTED dev]$ git clone https://github.com/erlang/otp.git > ... > [cyryl@REDACTED otp]$ autoconf > [cyryl@REDACTED otp]$ ./configure > ... > > Is it me or is it a bug ? It's you. Do the following sequence instead: git clone ... ./otp_build autoconf ./configure make -j Kostis From cyplo@REDACTED Thu Apr 26 07:46:24 2012 From: cyplo@REDACTED (=?UTF-8?Q?Cyryl_P=C5=82otnicki=2DChudyk?=) Date: Thu, 26 Apr 2012 07:46:24 +0200 Subject: [erlang-questions] compiling github's master from scratch In-Reply-To: <4F98DE96.7010204@cs.ntua.gr> References: <4F98DE96.7010204@cs.ntua.gr> Message-ID: 2012/4/26 Kostis Sagonas : > It's you. Do the following sequence instead: > > ?git clone ... > ?./otp_build autoconf > ?./configure > ?make -j > > Kostis Thanks a lot, works now -- cyryl From cyplo@REDACTED Thu Apr 26 07:55:30 2012 From: cyplo@REDACTED (=?UTF-8?Q?Cyryl_P=C5=82otnicki=2DChudyk?=) Date: Thu, 26 Apr 2012 07:55:30 +0200 Subject: [erlang-questions] compiling github's master from scratch In-Reply-To: References: <4F98DE96.7010204@cs.ntua.gr> Message-ID: 2012/4/26 Cyryl P?otnicki-Chudyk : > 2012/4/26 Kostis Sagonas : >> It's you. Do the following sequence instead: >> >> ?git clone ... >> ?./otp_build autoconf >> ?./configure >> ?make -j >> >> Kostis > > Thanks a lot, works now > As I see this line is mentioned only in W32 and cross-compilation docs, nothing about it in the top-level INSTALL.md . Should I patch the main docs ? -- cyryl From norton@REDACTED Thu Apr 26 08:37:22 2012 From: norton@REDACTED (Joseph Norton) Date: Thu, 26 Apr 2012 15:37:22 +0900 Subject: [erlang-questions] compiling github's master from scratch In-Reply-To: References: <4F98DE96.7010204@cs.ntua.gr> Message-ID: <63ABAD97-4CAB-4796-992E-B6654A9FFA21@lovely.email.ne.jp> Cyryl - If it is helpful, there are some recipes at the end of this makefile that I use for building OTP from git, building dialyzer's PLT, and running OTP's regression tests. https://github.com/norton/manifests/blob/master/rebar.mk good luck! - Joe N Joseph Norton norton@REDACTED On Apr 26, 2012, at 2:55 PM, Cyryl P?otnicki-Chudyk wrote: > 2012/4/26 Cyryl P?otnicki-Chudyk : >> 2012/4/26 Kostis Sagonas : >>> It's you. Do the following sequence instead: >>> >>> git clone ... >>> ./otp_build autoconf >>> ./configure >>> make -j >>> >>> Kostis >> >> Thanks a lot, works now >> > > As I see this line is mentioned only in W32 and cross-compilation > docs, nothing about it in the top-level INSTALL.md . > Should I patch the main docs ? > > -- > cyryl > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From gleber.p@REDACTED Thu Apr 26 09:04:37 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Thu, 26 Apr 2012 09:04:37 +0200 Subject: [erlang-questions] compiling github's master from scratch In-Reply-To: <63ABAD97-4CAB-4796-992E-B6654A9FFA21@lovely.email.ne.jp> References: <4F98DE96.7010204@cs.ntua.gr> <63ABAD97-4CAB-4796-992E-B6654A9FFA21@lovely.email.ne.jp> Message-ID: 2012/4/26 Joseph Norton > If it is helpful, there are some recipes at the end of this makefile that > I use for building OTP from git, building dialyzer's PLT, and running OTP's > regression tests. > > https://github.com/norton/manifests/blob/master/rebar.mk > > good luck! > Cyryl, you could also try using kerl to build version from git: $ ~/bin/kerl build git usage: /home/gleber/bin/kerl build git -------------- next part -------------- An HTML attachment was scrubbed... URL: From kostis@REDACTED Thu Apr 26 09:20:57 2012 From: kostis@REDACTED (Kostis Sagonas) Date: Thu, 26 Apr 2012 09:20:57 +0200 Subject: [erlang-questions] Dialyzer and opaque types question In-Reply-To: <4F989FAE.2080607@2600hz.com> References: <4F989FAE.2080607@2600hz.com> Message-ID: <4F98F759.8010705@cs.ntua.gr> On 04/26/2012 03:06 AM, James Aimonetti wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > We have a module, whapps_call.erl, with a record, types, and an > exported type defined inside: > > > - -record(whapps_call, {lots, of, fields, but, one, in, particular :: > whapps_helper_function()}). > > - -type whapps_api_binary() :: binary() | 'undefined'. > > - -type whapps_helper_function() :: fun((whapps_api_binary(), > whapps_call:call()) -> whapps_api_binary()). Aside: you do not really need to module qualify the whapps_call:call()) type if that definition appears within the module. Writing just call() should be enough. > - -opaque call() :: #whapps_call{}. > - -export_type([call/0]). > > > One of our 'getter' functions tries to use the function in > 'particular' if defined; that function looks like: > > > call_id(#whapps_call{field=Field, particular=undefined}) -> > Field; > call_id(#whapps_call{field=Field, particular=Fun}=Call) when > is_function(Fun, 2) -> > Fun(Field, Call). > > > 'field', in this case, is spec'd as whapps_api_binary() in the record > definition. > > When Dialyzing, however, we get: > > $ dialyzer --plt ../.platform_dialyzer.plt ebin/whapps_call.beam > Checking whether the PLT ../.platform_dialyzer.plt is up-to-date... yes > Proceeding with analysis... > whapps_call.erl:323: Fun application with arguments > (Field::'undefined' | binary(),Call::whapps_call:call()) will fail > since the function has type fun(('undefined' | > binary(),whapps_call:call()) -> 'undefined' | binary()) > > Line 323 is the "Fun(Field, Call)." line in the source. > > If I change the call() type from -opaque to -type, all is well and no > warnings/errors are emitted. This is most probably a bug. Can you please send to: dialyzer AT softlab DOT ntua DOT gr the module that shows this behaviour? Kostis From francesco@REDACTED Thu Apr 26 09:26:29 2012 From: francesco@REDACTED (Francesco Mazzoli) Date: Thu, 26 Apr 2012 08:26:29 +0100 Subject: [erlang-questions] [Dialyser] Type parametrized behaviours In-Reply-To: <4F98814F.2070108@cs.ntua.gr> References: <4F96BBF2.8090302@rabbitmq.com> <4F98814F.2070108@cs.ntua.gr> Message-ID: <4F98F8A5.7080508@rabbitmq.com> > The first thing I think is that you have not fully understood the need > for having both a -callback and a -spec. In the general case, the > behaviour module needs to have a way to define what the callback module > *can* have as implementation of callbacks, not what it *should* have as > its implementation. For example, it's perfectly ok for the behaviour > module to say that there needs to be a callback function f/1 which can > return 'foo' and 'bar' and for the callback module to implement a > function that just returns 'bar'. By the way, I had overlooked this part and I don't see why you get this impression, I do acknowledge the possibility and the usefulness of narrowing the type via -specs in the implementing module (in fact, I do acknowledge that is already a solution to our problem, albeit a very ugly one). > So, we do need both these attributes > since they serve different purposes. This also means that the "header > file approach" does not work / is not flexible enough in general. True, but I'd argue that this wouldn't/shouldn't happen often in the general case, given that the interface given to the user is the one of the behaviour -callbacks, and implementing functions with narrower arguments types will probably leads to breakage. I could see the usefulness of narrowing the result types, but still is not something that I'd do often. Francesco. From Barys_Ilyushonak@REDACTED Thu Apr 26 09:51:14 2012 From: Barys_Ilyushonak@REDACTED (Ilyushonak Barys) Date: Thu, 26 Apr 2012 07:51:14 +0000 Subject: [erlang-questions] Erlang and FIX protocol In-Reply-To: References: Message-ID: I have found only this implementation http://www.ieiss.com/products/fix-engine . But it seems to be closed. From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Max Lapshin Sent: Thursday, April 26, 2012 9:01 AM To: Erlang-Questions Questions Subject: [erlang-questions] Erlang and FIX protocol Seems that since May 2007 (http://erlang.2086793.n4.nabble.com/FIX-protocol-td2096116.html) nothing had changed about erlang and FIX protocol, http://fixprotocol.org/ Everyone is rewriting their own parser/encoder? _______________________________________________________ The information contained in this message may be privileged and conf idential and protected from disclosure. If you are not the original intended recipient, you are hereby notified that any review, retransmission, dissemination, or other use of, or taking of any action in reliance upon, this information is prohibited. If you have received this communication in error, please notify the sender immediately by replying to this message and delete it from your computer. Thank you for your cooperation. Troika Dialog, Russia. If you need assistance please contact our Contact Center (+7495) 258 0500 or go to www.troika.ru/eng/Contacts/system.wbp -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Thu Apr 26 09:54:55 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Thu, 26 Apr 2012 11:54:55 +0400 Subject: [erlang-questions] Erlang and FIX protocol In-Reply-To: References: Message-ID: On Thu, Apr 26, 2012 at 11:51 AM, Ilyushonak Barys wrote: > > I have found only this implementation http://www.ieiss.com/products/fix-engine . > > But it seems to be closed. > And I couldn't contact these guys. QuickFix is ok, it has great XML description inside which happened to be very useful to write own parser. Java code is of absolutely no use for me, like Fortran, Cobol, Ada or any other language from this group. From olivier.boudeville@REDACTED Thu Apr 26 10:01:47 2012 From: olivier.boudeville@REDACTED (Olivier BOUDEVILLE) Date: Thu, 26 Apr 2012 10:01:47 +0200 Subject: [erlang-questions] Resisting "noconnection" / Remote termination of nodes In-Reply-To: Message-ID: Hi Felix, Thanks for your answer. However I am not sure it would prevent 'noconnection' to happen anymore than the previous solutions? I imagined that there was at least another process that was concurrently trying to interact with the halted node, but I did not find any. Maybe, when raising a 'noconnection' error, specifying its origin could help (ex: "'noconnection' triggered because process whose PID is P1 (on node N1) tried to send message M to process whose PID is P2 (on node N2)"). It would be very convenient! Strangely enough, as I had an idle process on each of the nodes to halt, I made it terminate its node (executing directly halt() rather than using rpc:cast/3 to trigger the halt()) and 'noconnection' does not happen anymore. So, in some way, problem solved! Thanks, Best regards, Olivier. --------------------------- Olivier Boudeville EDF R&D : 1, avenue du G?n?ral de Gaulle, 92140 Clamart, France D?partement SINETICS, groupe ASICS (I2A), bureau B-226 Office : +33 1 47 65 59 58 / Mobile : +33 6 16 83 37 22 / Fax : +33 1 47 65 27 13 fjl@REDACTED Envoy? par : erlang-questions-bounces@REDACTED 25/04/2012 14:26 A erlang-questions@REDACTED cc Objet Re: [erlang-questions] Resisting "noconnection" / Remote termination of nodes Please note that shutdown/1 is not synchronous in my example. On Wed, 25 Apr 2012 14:20:49 +0200, Felix Lange wrote: > Hi, > > I'd suggest using net_kernel:monitor_nodes/1 for this purpose. > > Example: > > shutdown(Nodes) -> > spawn_link(fun () -> > net_kernel:monitor_nodes(true), > lists:foreach(fun (Node) -> rpc:cast(Node, > erlang, halt, []) end, Nodes), > wait_dead(Nodes) > end). > > wait_dead([]) -> > ok; > wait_dead([Node | Rest]) -> > receive > {nodedown, Node, _} -> > wait_dead(Rest) > after > 10000 -> > error_logger:error_report([{shutdown_timeout, Node}]), > wait_dead(Rest) > end. > > On Tue, 24 Apr 2012 13:52:18 +0200, Olivier BOUDEVILLE > wrote: > >> Hi, >> >> For a more controlled overall termination of a distributed application, >> I >> try to shutdown synchronously a series of nodes, as properly and as in >> parallel as possible, in a non-OTP program. I imagine that using '[ >> rpc:cast( N, erlang, halt, [] ) || N <- MyTargetNodes ]' and then >> waiting >> for them to be terminated is the best approach for that. >> >> As I want now these terminations to be synchronous (i.e. I want my >> terminate function to return only when all nodes are down for sure), I >> used to rely on checking their termination using net_adm:ping/1 (waiting >> for pong to become pang), but kept on getting (systematically) >> 'noconnection' errors (exceptions?), which do not seem to be catchable >> (at >> least not with a 'try .. catch T:E ->.. end' clause). This happens as >> soon >> as there is at least one node (which happens to be on the same host - of >> course it is not the local node from which that rpc:cast is triggered) >> to >> halt. >> >> I switched to looping on 'lists:member( Nodename, nodes() )' instead of >> ping (in both case with a proper waiting between checks), but I still >> get >> 'noconnection' errors. It looks like 'noconnection' is VM-level? As >> expected, commenting-out the rpc:cast/3 never leads to 'noconnection'. >> >> I feel I would need something like net_kernel:unconnect_node/1. >> >> My question now: how to deal gracefully with such a synchronous node >> shutdown and to resist to the (intended) loss of node(s)? >> >> Thanks in advance for any hint! >> Best regards, >> >> Olivier. >> --------------------------- >> Olivier Boudeville >> >> EDF R&D : 1, avenue du G?n?ral de Gaulle, 92140 Clamart, France >> D?partement SINETICS, groupe ASICS (I2A), bureau B-226 >> Office : +33 1 47 65 59 58 / Mobile : +33 6 16 83 37 22 / Fax : +33 1 47 >> 65 27 13 >> >> >> >> Ce message et toutes les pi?ces jointes (ci-apr?s le 'Message') sont >> ?tablis ? l'intention exclusive des destinataires et les informations >> qui y figurent sont strictement confidentielles. Toute utilisation de >> ce Message non conforme ? sa destination, toute diffusion ou toute >> publication totale ou partielle, est interdite sauf autorisation >> expresse. >> >> Si vous n'?tes pas le destinataire de ce Message, il vous est interdit >> de le copier, de le faire suivre, de le divulguer ou d'en utiliser tout >> ou partie. Si vous avez re?u ce Message par erreur, merci de le >> supprimer de votre syst?me, ainsi que toutes ses copies, et de n'en >> garder aucune trace sur quelque support que ce soit. Nous vous >> remercions ?galement d'en avertir imm?diatement l'exp?diteur par retour >> du message. >> >> Il est impossible de garantir que les communications par messagerie >> ?lectronique arrivent en temps utile, sont s?curis?es ou d?nu?es de >> toute erreur ou virus. >> ____________________________________________________ >> >> This message and any attachments (the 'Message') are intended solely >> for the addressees. The information contained in this Message is >> confidential. Any use of information contained in this Message not in >> accord with its purpose, any dissemination or disclosure, either whole >> or partial, is prohibited except formal approval. >> >> If you are not the addressee, you may not copy, forward, disclose or >> use any part of it. If you have received this message in error, please >> delete it and all copies from your system and notify the sender >> immediately by return message. >> >> E-mail communication cannot be guaranteed to be timely secure, error or >> virus-free. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions Ce message et toutes les pi?ces jointes (ci-apr?s le 'Message') sont ?tablis ? l'intention exclusive des destinataires et les informations qui y figurent sont strictement confidentielles. Toute utilisation de ce Message non conforme ? sa destination, toute diffusion ou toute publication totale ou partielle, est interdite sauf autorisation expresse. Si vous n'?tes pas le destinataire de ce Message, il vous est interdit de le copier, de le faire suivre, de le divulguer ou d'en utiliser tout ou partie. Si vous avez re?u ce Message par erreur, merci de le supprimer de votre syst?me, ainsi que toutes ses copies, et de n'en garder aucune trace sur quelque support que ce soit. Nous vous remercions ?galement d'en avertir imm?diatement l'exp?diteur par retour du message. Il est impossible de garantir que les communications par messagerie ?lectronique arrivent en temps utile, sont s?curis?es ou d?nu?es de toute erreur ou virus. ____________________________________________________ This message and any attachments (the 'Message') are intended solely for the addressees. The information contained in this Message is confidential. Any use of information contained in this Message not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval. If you are not the addressee, you may not copy, forward, disclose or use any part of it. If you have received this message in error, please delete it and all copies from your system and notify the sender immediately by return message. E-mail communication cannot be guaranteed to be timely secure, error or virus-free. -------------- next part -------------- An HTML attachment was scrubbed... URL: From kostis@REDACTED Thu Apr 26 10:23:31 2012 From: kostis@REDACTED (Kostis Sagonas) Date: Thu, 26 Apr 2012 10:23:31 +0200 Subject: [erlang-questions] [Dialyser] Type parametrized behaviours In-Reply-To: <4F98F8A5.7080508@rabbitmq.com> References: <4F96BBF2.8090302@rabbitmq.com> <4F98814F.2070108@cs.ntua.gr> <4F98F8A5.7080508@rabbitmq.com> Message-ID: <4F990603.9060107@cs.ntua.gr> On 04/26/2012 09:26 AM, Francesco Mazzoli wrote: >> The first thing I think is that you have not fully understood the need >> for having both a -callback and a -spec. In the general case, the >> behaviour module needs to have a way to define what the callback module >> *can* have as implementation of callbacks, not what it *should* have as >> its implementation. For example, it's perfectly ok for the behaviour >> module to say that there needs to be a callback function f/1 which can >> return 'foo' and 'bar' and for the callback module to implement a >> function that just returns 'bar'. > > By the way, I had overlooked this part and I don't see why you get this > impression, I do acknowledge the possibility and the usefulness of > narrowing the type via -specs in the implementing module (in fact, I do > acknowledge that is already a solution to our problem, albeit a very > ugly one). Note that "ugly" is a subjective word. I guess that qualifying it with "very" makes it... very subjective ;) >> So, we do need both these attributes >> since they serve different purposes. This also means that the "header >> file approach" does not work / is not flexible enough in general. > > True, but I'd argue that this wouldn't/shouldn't happen often in the > general case, given that the interface given to the user is the one of > the behaviour -callbacks, and implementing functions with narrower > arguments types will probably leads to breakage. I could see the > usefulness of narrowing the result types, but still is not something > that I'd do often. I am not sure what your point is. Just because this is something you (and perhaps many others, myself included) do not do that often, does not mean that Erlang does not need a mechanism that is general enough to allow them to do it, if they want/need to. All I tried to argue in that part of my post is that the distinction between specifications of allowed callbacks (-callback attributes in the behaviour module) and actual implementations of these callbacks (-spec attributes in the callback module) is a general enough mechanism that serves this purpose. I am sorry if you find it very ugly in your particular situation. Perhaps others may find it ugly if Erlang gets extended with both a general and some less general mechanism to solve the same problem depending on the situation. Think about it... Enough on this. I need to digest at some point Matthew's mail which provides some more concrete information about what may still be missing from callbacks. Kostis From aleksandr.vin@REDACTED Thu Apr 26 10:37:47 2012 From: aleksandr.vin@REDACTED (Aleksandr Vinokurov) Date: Thu, 26 Apr 2012 12:37:47 +0400 Subject: [erlang-questions] Fwd: Erlang Job for $5000 in Saint-Petersburg In-Reply-To: References: <86E46605704248E5AA6A65F2F3540918@HALL> Message-ID: ---------- Forwarded message ---------- From: Aleksandr Vinokurov Date: 26 April 2012 12:27 Subject: Re: [erlang-questions] Erlang Job for $5000 in Saint-Petersburg To: Max Bourinov My pardon, it's gross salary. On 25 April 2012 17:56, Max Bourinov wrote: > Hi Aleksandr, > > It is gross salary or net? Please clarify for those who might be > interested. > > p.s. I am also not a candidate. > > Best regards, > Max > > > > > On Wed, Apr 25, 2012 at 5:17 PM, Aleksandr Vinokurov < > aleksandr.vin@REDACTED> wrote: > >> >> >> Ok John, it's per month basis. Russia is closer to Sweden on this side ;) >> >> Thanks, John >> >> On 25 April 2012 16:08, John Hughes wrote: >> >>> ** >>> Is that $5,000 per month or per year? Not that I'm a candidate, but you >>> might want to clarify! (In Sweden, salaries are quoted per month, while in >>> the UK and the US, they're quoted per year--so I won't be the only one >>> wondering). >>> >>> John >>> >>> ----- Original Message ----- >>> *From:* Aleksandr Vinokurov >>> *To:* erlang-questions@REDACTED >>> *Sent:* Wednesday, April 25, 2012 1:52 PM >>> *Subject:* [erlang-questions] Erlang Job for $5000 in Saint-Petersburg >>> >>> >>> >>> Hello all, >>> >>> We are working on a distributed platform development in Peter-Service >>> CJSC, Saint-Petersburg, Russia. >>> It will be a distributed application server framework with key-value >>> cluster backends, monitoring and audit services >>> and fail-over with scale-ability support under the hood. >>> >>> Now we are in the process of Erlang team building and we look for the >>> best people in Erlang environment that will join us. We offer a big salary >>> of about $5000 for the one that hit us with his Erlang kung-fu. >>> >>> We are a strong Russian IT company with long history and traditions, >>> looking forward for innovations and new technologies. >>> http://www.billing.ru/guest/language/en?destination=mainpage >>> >>> -- >>> Aleksandr Vinokurov >>> +7 (921) 982-21-43 >>> @aleksandrvin >>> >>> ------------------------------ >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >>> >>> >> >> >> -- >> ????????? ????????? >> +7 (921) 982-21-43 >> @aleksandrvin >> >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> >> > -- ????????? ????????? +7 (921) 982-21-43 @aleksandrvin -- ????????? ????????? +7 (921) 982-21-43 @aleksandrvin -------------- next part -------------- An HTML attachment was scrubbed... URL: From aleksandr.vin@REDACTED Thu Apr 26 10:38:14 2012 From: aleksandr.vin@REDACTED (Aleksandr Vinokurov) Date: Thu, 26 Apr 2012 12:38:14 +0400 Subject: [erlang-questions] Fwd: Erlang Job for $5000 in Saint-Petersburg In-Reply-To: References: Message-ID: ---------- Forwarded message ---------- From: Aleksandr Vinokurov Date: 26 April 2012 12:31 Subject: Re: [erlang-questions] Erlang Job for $5000 in Saint-Petersburg To: Per Andersson I'm sorry, but I can't find where I've used the word "men" :) Actually men and women, elves and dwarfs are looked for, but no trolls, sorry ;) -- Aleksandr Vinokurov On 25 April 2012 18:10, Per Andersson wrote: > On Wed, Apr 25, 2012 at 1:52 PM, Aleksandr Vinokurov > wrote: > > > > > > Hello all, > > > > We are working on a distributed platform development in Peter-Service > CJSC, > > Saint-Petersburg, Russia. > > It will be a distributed application server framework with key-value > cluster > > backends, monitoring and audit services and fail-over with scale-ability > > support under the hood. > > > > Now we are in the process of Erlang team building and we look for the > best > > people in Erlang environment that will join us. We offer a big salary of > > about $5000 for the one that hit us with his Erlang kung-fu. > > Only looking for the best _men_ or are women welcome also, > even though you use gender specific possessive pronoun? > > > -- > Per > > > We are a strong Russian IT company with long history and traditions, > looking > > forward for innovations and new > > technologies. > http://www.billing.ru/guest/language/en?destination=mainpage > > > > -- > > Aleksandr Vinokurov > > +7 (921) 982-21-43 > > @aleksandrvin > > > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > > > -- ????????? ????????? +7 (921) 982-21-43 @aleksandrvin -- ????????? ????????? +7 (921) 982-21-43 @aleksandrvin -------------- next part -------------- An HTML attachment was scrubbed... URL: From francesco@REDACTED Thu Apr 26 10:38:42 2012 From: francesco@REDACTED (Francesco Mazzoli) Date: Thu, 26 Apr 2012 09:38:42 +0100 Subject: [erlang-questions] [Dialyser] Type parametrized behaviours In-Reply-To: <4F990603.9060107@cs.ntua.gr> References: <4F96BBF2.8090302@rabbitmq.com> <4F98814F.2070108@cs.ntua.gr> <4F98F8A5.7080508@rabbitmq.com> <4F990603.9060107@cs.ntua.gr> Message-ID: <4F990992.9090208@rabbitmq.com> > Note that "ugly" is a subjective word. I guess that qualifying it with > "very" makes it... very subjective ;) I'd say that it's equally subjective :) I'd also say that we can agree that that in software engineering there is a certain agreement that code duplication is bad, and in this instance this duplication can easily be avoided. > I am not sure what your point is. Just because this is something you > (and perhaps many others, myself included) do not do that often, does > not mean that Erlang does not need a mechanism that is general enough to > allow them to do it, if they want/need to. Well, I think then a good principle when designing a language (and many other thins, I guess) is to try to keep things simple by satisfying a majority, but not everyone. Apart from that, I don't think that this specific feature of -callback is bad, mine was just an observation. > All I tried to argue in that part of my post is that the distinction > between specifications of allowed callbacks (-callback attributes in the > behaviour module) and actual implementations of these callbacks (-spec > attributes in the callback module) is a general enough mechanism that > serves this purpose. I am sorry if you find it very ugly in your > particular situation. Note that in the end we decided not to narrow the types in the single behaviours, since in our opinion it wasn't worth it. Imo parametrising behaviours would be an elegant solution that would make narrowing the types adequately easy and would be general enough in the vast majority of use cases. > Perhaps others may find it ugly if Erlang gets > extended with both a general and some less general mechanism to solve > the same problem depending on the situation. Think about it... I think it could be an extremely non-invasive feature. One way it could work, syntactically, is in a similar way parametrized modules work, e.g. introduce an (optional) -behaviour_spec(name_of_behaviour, ListOfTypeParameters]) to be used in the module defining the -callbacks. Then, in the implementing modules, one can write -behaviour(name_of_behaviour, ListOfTypes). Or similar. No existing code would break, and users that do not want to use this feature would never know it exists :) Francesco. From francesco@REDACTED Thu Apr 26 10:42:32 2012 From: francesco@REDACTED (Francesco Mazzoli) Date: Thu, 26 Apr 2012 09:42:32 +0100 Subject: [erlang-questions] Fwd: Erlang Job for $5000 in Saint-Petersburg In-Reply-To: References: Message-ID: <4F990A78.5060501@rabbitmq.com> > I'm sorry, but I can't find where I've used the word "men" :) > > Actually men and women, elves and dwarfs are looked for, but no trolls, > sorry ;) He's referring to the "his" by the end of the post, which is nitpicking, also considering that English does not have an gender "unspecific" possessive pronoun, and writing his/her each time is annoying. Francesco. From max.lapshin@REDACTED Thu Apr 26 10:46:43 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Thu, 26 Apr 2012 12:46:43 +0400 Subject: [erlang-questions] Fwd: Erlang Job for $5000 in Saint-Petersburg In-Reply-To: <4F990A78.5060501@rabbitmq.com> References: <4F990A78.5060501@rabbitmq.com> Message-ID: On Thu, Apr 26, 2012 at 12:42 PM, Francesco Mazzoli wrote: > > He's referring to the "his" by the end of the post, which is nitpicking, > also considering that English does not have an gender "unspecific" > possessive pronoun, and writing his/her each time is annoying. > There are absolutely no problems in Russia with women rights, especially when we speak about programmer job. This is why nobody tells explicitly that women are welcome, because everyone is welcome. From janburse@REDACTED Thu Apr 26 10:54:09 2012 From: janburse@REDACTED (Jan Burse) Date: Thu, 26 Apr 2012 10:54:09 +0200 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: <728E8F42-1626-450E-AE2C-2EB9ECDF48F0@cs.otago.ac.nz> References: <4F9320F7.3010009@fastmail.fm> <436F6F6E-1131-4DC8-846B-0B0CC4C92CD8@cs.otago.ac.nz> <4F94BE6A.5010906@fastmail.fm> <049bd08514a53fb92bdc31699b438c8c.squirrel@chasm.otago.ac.nz> <4F951F75.4090708@fastmail.fm> <1EEF2F3F-A943-487F-A677-0AEAE24668FF@cs.otago.ac.nz> <4F95E025.1000404@fastmail.fm> <87C1D9BF-4845-487A-A1FE-7CEC91FA4C90@cs.otago.ac.nz> <4F965B38.1000302@fastmail.fm> <728E8F42-1626-450E-AE2C-2EB9ECDF48F0@cs.otago.ac.nz> Message-ID: <4F990D31.8070309@fastmail.fm> Richard O'Keefe schrieb: > [... Long Useless Mail ...] You are basically repeating and rephrasing what I wrote first instance i (OO vs Record / JavaScript Prototypes). Don't you have some thinking of your own? There is no official frames proposal yet for Erlang I have read in a blog, on the other hand the term "frame" has a known meaning from the old AI times. So instead of talking about a miracoulous proposals, it would be helpful to provide a link and substantiate claims. Bye From watson.timothy@REDACTED Thu Apr 26 10:58:02 2012 From: watson.timothy@REDACTED (Gmail) Date: Thu, 26 Apr 2012 09:58:02 +0100 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: <4F990D31.8070309@fastmail.fm> References: <4F9320F7.3010009@fastmail.fm> <436F6F6E-1131-4DC8-846B-0B0CC4C92CD8@cs.otago.ac.nz> <4F94BE6A.5010906@fastmail.fm> <049bd08514a53fb92bdc31699b438c8c.squirrel@chasm.otago.ac.nz> <4F951F75.4090708@fastmail.fm> <1EEF2F3F-A943-487F-A677-0AEAE24668FF@cs.otago.ac.nz> <4F95E025.1000404@fastmail.fm> <87C1D9BF-4845-487A-A1FE-7CEC91FA4C90@cs.otago.ac.nz> <4F965B38.1000302@fastmail.fm> <728E8F42-1626-450E-AE2C-2EB9ECDF48F0@cs.otago.ac.nz> <4F990D31.8070309@fastmail.fm> Message-ID: <6FEE1D24-D883-440F-9A81-5BFF43C7A21F@gmail.com> The frames proposal is documented along with the other eep submissions. Erlang.org has links under the 'community' section. Joe's structs proposal may be there too, though I'm not sure. Have fun! Bye Sent from my iPhone On 26 Apr 2012, at 09:54, Jan Burse wrote: > Richard O'Keefe schrieb: >> [... Long Useless Mail ...] > > You are basically repeating and rephrasing > what I wrote first instance i (OO vs > Record / JavaScript Prototypes). Don't you > have some thinking of your own? > > There is no official frames proposal yet > for Erlang I have read in a blog, on the > other hand the term "frame" has a known > meaning from the old AI times. > > So instead of talking about a miracoulous > proposals, it would be helpful to provide > a link and substantiate claims. > > Bye > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From dmkolesnikov@REDACTED Thu Apr 26 11:05:22 2012 From: dmkolesnikov@REDACTED (dmitry kolesnikov) Date: Thu, 26 Apr 2012 12:05:22 +0300 Subject: [erlang-questions] Fwd: Erlang Job for $5000 in Saint-Petersburg In-Reply-To: <4F990A78.5060501@rabbitmq.com> References: <4F990A78.5060501@rabbitmq.com> Message-ID: <2921925898744828063@unknownmsgid> Just to follow your logic, "history" does not look politically correct. Should it be renamed into "herstory" or maybe "itstory" to be sure that nobody complains (even a small group of non traditional folks)? ;-) Best Regards, Dmitry >-|-|-*> On 26.4.2012, at 11.42, Francesco Mazzoli wrote: >> I'm sorry, but I can't find where I've used the word "men" :) >> >> Actually men and women, elves and dwarfs are looked for, but no trolls, >> sorry ;) > > He's referring to the "his" by the end of the post, which is nitpicking, also considering that English does not have an gender "unspecific" possessive pronoun, and writing his/her each time is annoying. > > Francesco. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From ivan@REDACTED Thu Apr 26 11:08:51 2012 From: ivan@REDACTED (Ivan Uemlianin) Date: Thu, 26 Apr 2012 10:08:51 +0100 Subject: [erlang-questions] Fwd: Erlang Job for $5000 in Saint-Petersburg In-Reply-To: <4F990A78.5060501@rabbitmq.com> References: <4F990A78.5060501@rabbitmq.com> Message-ID: <4F9910A3.2030500@llaisdy.com> fwiw colloquial British English uses "their" for his/her ("they" for he/she, and "them" for him/her). It's quite serviceable. Ivan On 26/04/2012 09:42, Francesco Mazzoli wrote: >> I'm sorry, but I can't find where I've used the word "men" :) >> >> Actually men and women, elves and dwarfs are looked for, but no trolls, >> sorry ;) > > He's referring to the "his" by the end of the post, which is nitpicking, > also considering that English does not have an gender "unspecific" > possessive pronoun, and writing his/her each time is annoying. > > Francesco. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- ============================================================ Ivan A. Uemlianin Llaisdy Speech Technology Research and Development ivan@REDACTED www.llaisdy.com llaisdy.wordpress.com github.com/llaisdy www.linkedin.com/in/ivanuemlianin "Froh, froh! Wie seine Sonnen, seine Sonnen fliegen" (Schiller, Beethoven) ============================================================ From silver.buyer@REDACTED Thu Apr 26 11:08:54 2012 From: silver.buyer@REDACTED (Joseph Goldberg) Date: Thu, 26 Apr 2012 02:08:54 -0700 (PDT) Subject: [erlang-questions] project details In-Reply-To: <1335425979.50978.YahooMailNeo@web121606.mail.ne1.yahoo.com> References: <1335425979.50978.YahooMailNeo@web121606.mail.ne1.yahoo.com> Message-ID: <1335431334.8862.YahooMailNeo@web121605.mail.ne1.yahoo.com> I FEEL LIKE I'M TRYING TO SELL WINDOWS TO IBM....I KNOW SOME BIG PLAYERS IN THE GOLD/SILVER COINS AND BULLION MARKET HERE IN MONTREAL. I'm using fix as one of my components (fix does not include the transport layer), need the whole system put together,ATTACHED IS OTHER DOC Java http://www.quickfixj.org/ c++ http://elato.se/minifix/ notice he mentions the code of?libraries?are not 100% tested boost c++ https://github.com/FellowTraveler/Open-Transactions/wiki/Messaging http://vimeo.com/28141679 http://vimeo.com/28142096 API https://github.com/FellowTraveler/Open-Transactions/wiki/API https://github.com/FellowTraveler/Open-Transactions/wiki/Messaging java ?http://emarket.sourceforge.net/index.html ________________________________ From: Max Lapshin To: Erlang-Questions Questions Sent: Thursday, April 26, 2012 1:00:53 AM Subject: [erlang-questions] Erlang and FIX protocol Seems that since May 2007 (http://erlang.2086793.n4.nabble.com/FIX-protocol-td2096116.html) nothing had changed about erlang and FIX protocol, http://fixprotocol.org/ Everyone is rewriting their own parser/encoder? _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: CANADA METALS AUCTION FEATURES.docx Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document Size: 15283 bytes Desc: not available URL: From cgsmcmlxxv@REDACTED Thu Apr 26 11:09:57 2012 From: cgsmcmlxxv@REDACTED (CGS) Date: Thu, 26 Apr 2012 11:09:57 +0200 Subject: [erlang-questions] Fwd: Erlang Job for $5000 in Saint-Petersburg In-Reply-To: References: Message-ID: Hi, $5k/month is a very attractive salary and in many surrounding countries you can get a very good project manager for that money (in some countries, you can get a full team for that money). I am wondering how many from this list feel about themselves to be that good in Erlang. Don't get me wrong, I know here some people to be very skillful in Erlang, but it's about how one estimates himself/herself (or maybe itself in case of trolls :P). And what's wrong with trolls? They are strong and they do a good job on stepping on the others. They are good to kill all the competitors. :D CGS PS: Sorry if my message had nothing to do with the aim of this mailing list, but I couldn't help myself. :) On Thu, Apr 26, 2012 at 10:38 AM, Aleksandr Vinokurov < aleksandr.vin@REDACTED> wrote: > > > ---------- Forwarded message ---------- > From: Aleksandr Vinokurov > Date: 26 April 2012 12:31 > Subject: Re: [erlang-questions] Erlang Job for $5000 in Saint-Petersburg > To: Per Andersson > > > I'm sorry, but I can't find where I've used the word "men" :) > > Actually men and women, elves and dwarfs are looked for, but no trolls, > sorry ;) > > -- Aleksandr Vinokurov > > > On 25 April 2012 18:10, Per Andersson wrote: > >> On Wed, Apr 25, 2012 at 1:52 PM, Aleksandr Vinokurov >> wrote: >> > >> > >> > Hello all, >> > >> > We are working on a distributed platform development in Peter-Service >> CJSC, >> > Saint-Petersburg, Russia. >> > It will be a distributed application server framework with key-value >> cluster >> > backends, monitoring and audit services and fail-over with scale-ability >> > support under the hood. >> > >> > Now we are in the process of Erlang team building and we look for the >> best >> > people in Erlang environment that will join us. We offer a big salary of >> > about $5000 for the one that hit us with his Erlang kung-fu. >> >> Only looking for the best _men_ or are women welcome also, >> even though you use gender specific possessive pronoun? >> >> >> -- >> Per >> >> > We are a strong Russian IT company with long history and traditions, >> looking >> > forward for innovations and new >> > technologies. >> http://www.billing.ru/guest/language/en?destination=mainpage >> > >> > -- >> > Aleksandr Vinokurov >> > +7 (921) 982-21-43 >> > @aleksandrvin >> > >> > >> > _______________________________________________ >> > erlang-questions mailing list >> > erlang-questions@REDACTED >> > http://erlang.org/mailman/listinfo/erlang-questions >> > >> > > > > -- > ????????? ????????? > +7 (921) 982-21-43 > @aleksandrvin > > > > > -- > ????????? ????????? > +7 (921) 982-21-43 > @aleksandrvin > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From avtobiff@REDACTED Thu Apr 26 11:12:32 2012 From: avtobiff@REDACTED (Per Andersson) Date: Thu, 26 Apr 2012 11:12:32 +0200 Subject: [erlang-questions] Fwd: Erlang Job for $5000 in Saint-Petersburg In-Reply-To: <4F9910A3.2030500@llaisdy.com> References: <4F990A78.5060501@rabbitmq.com> <4F9910A3.2030500@llaisdy.com> Message-ID: Hi! On Thu, Apr 26, 2012 at 11:08 AM, Ivan Uemlianin wrote: > fwiw colloquial British English uses "their" for his/her ("they" for he/she, > and "them" for him/her). ?It's quite serviceable. Ivan summarize it nicely. It takes a very small extra effort to write gender neutral. The extra effort actually makes a difference. -- Per From thaterlangguy@REDACTED Thu Apr 26 11:24:59 2012 From: thaterlangguy@REDACTED (Ahmed Al-Saadi) Date: Thu, 26 Apr 2012 05:24:59 -0400 Subject: [erlang-questions] Fwd: Erlang Job for $5000 in Saint-Petersburg In-Reply-To: <4F9910A3.2030500@llaisdy.com> References: <4F990A78.5060501@rabbitmq.com> <4F9910A3.2030500@llaisdy.com> Message-ID: <2B13FBDCF67F4C3F92A54F067AA723E7@gmail.com> -module(politically_correct). -behaviour(gen_der_neutral). -export([pronoun/1, possessive/1]). -include_lib("grammer.hrl"). %% The context passed in to the exported function will have the gender info (presumably) %% The rest of the module is left as an exercise for the reader! ;) -- Ahmed Al-Saadi Sent with Sparrow (http://www.sparrowmailapp.com/?sig) On Thursday, April 26, 2012 at 5:08 AM, Ivan Uemlianin wrote: > fwiw colloquial British English uses "their" for his/her ("they" for > he/she, and "them" for him/her). It's quite serviceable. > > Ivan > > On 26/04/2012 09:42, Francesco Mazzoli wrote: > > > I'm sorry, but I can't find where I've used the word "men" :) > > > > > > Actually men and women, elves and dwarfs are looked for, but no trolls, > > > sorry ;) > > > > > > > > > He's referring to the "his" by the end of the post, which is nitpicking, > > also considering that English does not have an gender "unspecific" > > possessive pronoun, and writing his/her each time is annoying. > > > > Francesco. > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED (mailto:erlang-questions@REDACTED) > > http://erlang.org/mailman/listinfo/erlang-questions > > > > > > -- > ============================================================ > Ivan A. Uemlianin > Llaisdy > Speech Technology Research and Development > > ivan@REDACTED (mailto:ivan@REDACTED) > www.llaisdy.com (http://www.llaisdy.com) > llaisdy.wordpress.com (http://llaisdy.wordpress.com) > github.com/llaisdy (http://github.com/llaisdy) > www.linkedin.com/in/ivanuemlianin (http://www.linkedin.com/in/ivanuemlianin) > > "Froh, froh! Wie seine Sonnen, seine Sonnen fliegen" > (Schiller, Beethoven) > ============================================================ > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED (mailto:erlang-questions@REDACTED) > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From paperless@REDACTED Thu Apr 26 11:31:43 2012 From: paperless@REDACTED (Tim McNamara) Date: Thu, 26 Apr 2012 21:31:43 +1200 Subject: [erlang-questions] project details In-Reply-To: <1335431334.8862.YahooMailNeo@web121605.mail.ne1.yahoo.com> References: <1335425979.50978.YahooMailNeo@web121606.mail.ne1.yahoo.com> <1335431334.8862.YahooMailNeo@web121605.mail.ne1.yahoo.com> Message-ID: This message failed the Turing test. I honestly thought it was spam. Please don't use all caps. On 26 April 2012 21:08, Joseph Goldberg wrote: > I FEEL LIKE I'M TRYING TO SELL WINDOWS TO IBM....I KNOW SOME BIG PLAYERS IN > THE GOLD/SILVER COINS AND BULLION MARKET HERE IN MONTREAL. > > I'm using fix as one of my components (fix does not include the transport > layer), need the whole system put together,ATTACHED IS OTHER DOC > Java > http://www.quickfixj.org/ > c++ > http://elato.se/minifix/ > notice he mentions the code of?libraries?are not 100% tested > boost c++ > https://github.com/FellowTraveler/Open-Transactions/wiki/Messaging > http://vimeo.com/28141679 > http://vimeo.com/28142096 > API > https://github.com/FellowTraveler/Open-Transactions/wiki/API > https://github.com/FellowTraveler/Open-Transactions/wiki/Messaging > java > ?http://emarket.sourceforge.net/index.html > > ________________________________ > From: Max Lapshin > To: Erlang-Questions Questions > Sent: Thursday, April 26, 2012 1:00:53 AM > Subject: [erlang-questions] Erlang and FIX protocol > > Seems that since May 2007 > (http://erlang.2086793.n4.nabble.com/FIX-protocol-td2096116.html) nothing > had changed about erlang and FIX protocol, http://fixprotocol.org/ > > Everyone is rewriting their own parser/encoder? > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From watson.timothy@REDACTED Thu Apr 26 11:33:00 2012 From: watson.timothy@REDACTED (Gmail) Date: Thu, 26 Apr 2012 10:33:00 +0100 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: <6FEE1D24-D883-440F-9A81-5BFF43C7A21F@gmail.com> References: <4F9320F7.3010009@fastmail.fm> <436F6F6E-1131-4DC8-846B-0B0CC4C92CD8@cs.otago.ac.nz> <4F94BE6A.5010906@fastmail.fm> <049bd08514a53fb92bdc31699b438c8c.squirrel@chasm.otago.ac.nz> <4F951F75.4090708@fastmail.fm> <1EEF2F3F-A943-487F-A677-0AEAE24668FF@cs.otago.ac.nz> <4F95E025.1000404@fastmail.fm> <87C1D9BF-4845-487A-A1FE-7CEC91FA4C90@cs.otago.ac.nz> <4F965B38.1000302@fastmail.fm> <728E8F42-1626-450E-AE2C-2EB9ECDF48F0@cs.otago.ac.nz> <4F990D31.8070309@fastmail.fm> <6FEE1D24-D883-440F-9A81-5BFF43C7A21F@gmail.com> Message-ID: My mistake - it is situated at http://www.cs.otago.ac.nz/staffpriv/ok/frames.pdf Sent from my iPhone On 26 Apr 2012, at 09:58, Gmail wrote: > The frames proposal is documented along with the other eep submissions. Erlang.org has links under the 'community' section. > > Joe's structs proposal may be there too, though I'm not sure. > > Have fun! > > Bye > > Sent from my iPhone > > On 26 Apr 2012, at 09:54, Jan Burse wrote: > >> Richard O'Keefe schrieb: >>> [... Long Useless Mail ...] >> >> You are basically repeating and rephrasing >> what I wrote first instance i (OO vs >> Record / JavaScript Prototypes). Don't you >> have some thinking of your own? >> >> There is no official frames proposal yet >> for Erlang I have read in a blog, on the >> other hand the term "frame" has a known >> meaning from the old AI times. >> >> So instead of talking about a miracoulous >> proposals, it would be helpful to provide >> a link and substantiate claims. >> >> Bye >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions From netch@REDACTED Thu Apr 26 11:38:21 2012 From: netch@REDACTED (Valentin Nechayev) Date: Thu, 26 Apr 2012 12:38:21 +0300 Subject: [erlang-questions] Resisting "noconnection" / Remote termination of nodes In-Reply-To: References: Message-ID: <20120426093821.GC42675@netch.kiev.ua> Tue, Apr 24, 2012 at 13:52:18, olivier.boudeville wrote about "[erlang-questions] Resisting "noconnection" / Remote termination of nodes": > As I want now these terminations to be synchronous (i.e. I want my > terminate function to return only when all nodes are down for sure), I > used to rely on checking their termination using net_adm:ping/1 (waiting > for pong to become pang), but kept on getting (systematically) > 'noconnection' errors (exceptions?), which do not seem to be catchable (at > least not with a 'try .. catch T:E ->.. end' clause). Seems this is good case for erlang:monitor_node(). Initially, check each node from the list and subscribe to nodedown messages using monitor_node() if it is shown alive. Then make multicast halt request and loop around nodedown messages, dropping nodes from list on each one. Exit on empty list. Also net_kernel:monitor_nodes() provide similar ability. The only side issue I see is that it tries to connect to node if there is no connection yet, so you one can occur a potential race if some another agent performs similar action. If this is your case, separate node control to own manager process. > I feel I would need something like net_kernel:unconnect_node/1. It's erlang:disconnect_node/1, but I doubt it is useful for your goal. > My question now: how to deal gracefully with such a synchronous node > shutdown and to resist to the (intended) loss of node(s)? Seems something is unclear in your description so feel free to reformulate it. -netch- From netch@REDACTED Thu Apr 26 11:49:14 2012 From: netch@REDACTED (Valentin Nechayev) Date: Thu, 26 Apr 2012 12:49:14 +0300 Subject: [erlang-questions] "fat burner" GC on periodic base? In-Reply-To: References: <20120424101644.GA42675@netch.kiev.ua> Message-ID: <20120426094914.GD42675@netch.kiev.ua> Tue, Apr 24, 2012 at 12:41:48, attila.r.nohl wrote about "Re: [erlang-questions] "fat burner" GC on periodic base?": > > 1. Is there another way to achieve the same result, as avoiding keeping > > useless data, on timed basics instead of reduction count, which, as > > shown above, doesn't work enough? > You can subscribe to "heap used by process is too large" events using > erlang:system_monitor/2. You can also make an educated guess based on > the code to call garbage collection at certain points in the code (for > example we have a gen_server that uses quite some memory during > initialization, but then it releases most of the memory, so we have an > explicit garbage collection at the end of the init function). Thanks, but all these are indirect measures which doesn't give the needed one. Heap size monitoring is, as long as I got from the documentation, per-process. I need to check the whole VM occupied size instead. Also, explicit requests in some processes are good for the case when 1) it's your code and 2) problem is already detected; all this doesn't help in case e.g. of error_logger I shown earlier. -netch- From vasdeveloper@REDACTED Thu Apr 26 12:34:39 2012 From: vasdeveloper@REDACTED (Kannan) Date: Thu, 26 Apr 2012 16:04:39 +0530 Subject: [erlang-questions] Resisting "noconnection" / Remote termination of nodes In-Reply-To: References: Message-ID: Hi Olivier, In distributed computing, we see the collective effort of individual -- but not independent -- nodes. Communicating nodes, at any point in time, need to be connected and should have the knowledge of the other, including the availability status. The OAM node, or leader, will have the total picture of all the nodes. You have to look at the bigger picture of the whole system, when it comes to stopping a distributed system. The following steps are generally taken to tear down a system. * Signal all the nodes of a forthcoming shutdown request * Stop accepting new requests * Finish servicing the accepted requests * Do the stock taking and clean-up * Check the readiness of all the nodes for shutdown * Then call shutdown on all the nodes. Here, I am looking from top into the system. The shutdown process will be generally coordinated by a single process. An ad-hock shutdown is more scary to me in a production environment. Kind Regards, Kannan. On Tue, Apr 24, 2012 at 5:22 PM, Olivier BOUDEVILLE < olivier.boudeville@REDACTED> wrote: > > Hi, > > For a more controlled overall termination of a distributed application, I > try to shutdown synchronously a series of nodes, as properly and as in > parallel as possible, in a non-OTP program. I imagine that using '[ > rpc:cast( N, erlang, halt, [] ) || N <- MyTargetNodes ]' and then waiting > for them to be terminated is the best approach for that. > > As I want now these terminations to be synchronous (i.e. I want my > terminate function to return only when all nodes are down for sure), I used > to rely on checking their termination using net_adm:ping/1 (waiting for > pong to become pang), but kept on getting (systematically) 'noconnection' > errors (exceptions?), which do not seem to be catchable (at least not with > a 'try .. catch T:E ->.. end' clause). This happens as soon as there is at > least one node (which happens to be on the same host - of course it is not > the local node from which that rpc:cast is triggered) to halt. > > I switched to looping on 'lists:member( Nodename, nodes() )' instead of > ping (in both case with a proper waiting between checks), but I still get > 'noconnection' errors. It looks like 'noconnection' is VM-level? As > expected, commenting-out the rpc:cast/3 never leads to 'noconnection'. > > I feel I would need something like net_kernel:unconnect_node/1. > > My question now: how to deal gracefully with such a synchronous node > shutdown and to resist to the (intended) loss of node(s)? > > Thanks in advance for any hint! > Best regards, > > Olivier. > --------------------------- > Olivier Boudeville > > EDF R&D : 1, avenue du G?n?ral de Gaulle, 92140 Clamart, France > D?partement SINETICS, groupe ASICS (I2A), bureau B-226 > Office : +33 1 47 65 59 58 / Mobile : +33 6 16 83 37 22 / Fax : +33 1 47 > 65 27 13 > > > Ce message et toutes les pi?ces jointes (ci-apr?s le 'Message') sont > ?tablis ? l'intention exclusive des destinataires et les informations qui y > figurent sont strictement confidentielles. Toute utilisation de ce Message > non conforme ? sa destination, toute diffusion ou toute publication totale > ou partielle, est interdite sauf autorisation expresse. > > Si vous n'?tes pas le destinataire de ce Message, il vous est interdit de > le copier, de le faire suivre, de le divulguer ou d'en utiliser tout ou > partie. Si vous avez re?u ce Message par erreur, merci de le supprimer de > votre syst?me, ainsi que toutes ses copies, et de n'en garder aucune trace > sur quelque support que ce soit. Nous vous remercions ?galement d'en > avertir imm?diatement l'exp?diteur par retour du message. > > Il est impossible de garantir que les communications par messagerie > ?lectronique arrivent en temps utile, sont s?curis?es ou d?nu?es de toute > erreur ou virus. > ____________________________________________________ > > This message and any attachments (the 'Message') are intended solely for > the addressees. The information contained in this Message is confidential. > Any use of information contained in this Message not in accord with its > purpose, any dissemination or disclosure, either whole or partial, is > prohibited except formal approval. > > If you are not the addressee, you may not copy, forward, disclose or use > any part of it. If you have received this message in error, please delete > it and all copies from your system and notify the sender immediately by > return message. > > E-mail communication cannot be guaranteed to be timely secure, error or > virus-free. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From claudef@REDACTED Thu Apr 26 14:17:36 2012 From: claudef@REDACTED (claudef@REDACTED) Date: Thu, 26 Apr 2012 09:17:36 -0300 Subject: [erlang-questions] Issues with Erlang Build under SUSE SLES 11 SP 1 on S390 Message-ID: Dear colleagues, I'm compiling an Erlang environment under the SUSE SLES 11 SP1 on a S390 platform building it from the source. I'm facing an error condition when adding the support for OpenSSL and Erlang "crypto" support using the following configuration: ./configure --with-ssl --with-ssl=/usr/lib64/openssl The configure completes normal, but the subsequent "make" step throws a sequence of errors like this: .. crypto.c: In function ?hmac_md5?: crypto.c:1713: error: ?MD5_CTX? undeclared (first use in this function) crypto.c:1713: error: expected ?;? before ?ctx? crypto.c:1714: warning: ISO C90 forbids mixed declarations and code crypto.c:1737: error: ?ctx? undeclared (first use in this function) crypto.c: In function ?hmac_sha1?: crypto.c:1752: error: ?SHA_CTX? undeclared (first use in this function) crypto.c:1752: error: expected ?;? before ?ctx? crypto.c:1753: warning: ISO C90 forbids mixed declarations and code crypto.c:1776: error: ?ctx? undeclared (first use in this function) make[4]: *** [../priv/obj/s390x-ibm-linux-gnu/crypto.o] Error 1 make[4]: Leaving directory `/opt/erlang/otp_src_R14B03/lib/crypto/c_src' make[3]: *** [opt] Error 2 make[3]: Leaving directory `/opt/erlang/otp_src_R14B03/lib/crypto/c_src' make[2]: *** [opt] Error 2 make[2]: Leaving directory `/opt/erlang/otp_src_R14B03/lib/crypto' make[1]: *** [opt] Error 2 make[1]: Leaving directory `/opt/erlang/otp_src_R14B03/lib' make: *** [libs] Error 2 .. Without OpenSSL support, the Erlang package compiles successfully and I've tested it with the console prompt. Thanks in advance for your hints how to fix this issue with the crypto module. Regards, Claude Claude Falbriard Certified IT Specialist L2 - Middleware AMS Hortol?ndia / SP - Brazil phone: +55 19 9837 0789 cell: +55 13 8117 3316 e-mail: claudef@REDACTED -------------- next part -------------- An HTML attachment was scrubbed... URL: From cgsmcmlxxv@REDACTED Thu Apr 26 15:03:59 2012 From: cgsmcmlxxv@REDACTED (CGS) Date: Thu, 26 Apr 2012 15:03:59 +0200 Subject: [erlang-questions] Issues with Erlang Build under SUSE SLES 11 SP 1 on S390 In-Reply-To: References: Message-ID: Hi, I suppose you need to install OpenSSL-dev (from the error it looks like you are missing some OpenSSL headers). CGS On Thu, Apr 26, 2012 at 2:17 PM, wrote: > Dear colleagues, > > I'm compiling an Erlang environment under the SUSE SLES 11 SP1 on a S390 > platform building it from the source. I'm facing an error condition when > adding the support for OpenSSL and Erlang "crypto" support using the > following configuration: > > ./configure --with-ssl --with-ssl=/usr/lib64/openssl > > The configure completes normal, but the subsequent "make" step throws a > sequence of errors like this: > .. > crypto.c: In function ?hmac_md5?: > crypto.c:1713: error: ?MD5_CTX? undeclared (first use in this function) > crypto.c:1713: error: expected ?;? before ?ctx? > crypto.c:1714: warning: ISO C90 forbids mixed declarations and code > crypto.c:1737: error: ?ctx? undeclared (first use in this function) > crypto.c: In function ?hmac_sha1?: > crypto.c:1752: error: ?SHA_CTX? undeclared (first use in this function) > crypto.c:1752: error: expected ?;? before ?ctx? > crypto.c:1753: warning: ISO C90 forbids mixed declarations and code > crypto.c:1776: error: ?ctx? undeclared (first use in this function) > make[4]: *** [../priv/obj/s390x-ibm-linux-gnu/crypto.o] Error 1 > make[4]: Leaving directory `/opt/erlang/otp_src_R14B03/lib/crypto/c_src' > make[3]: *** [opt] Error 2 > make[3]: Leaving directory `/opt/erlang/otp_src_R14B03/lib/crypto/c_src' > make[2]: *** [opt] Error 2 > make[2]: Leaving directory `/opt/erlang/otp_src_R14B03/lib/crypto' > make[1]: *** [opt] Error 2 > make[1]: Leaving directory `/opt/erlang/otp_src_R14B03/lib' > make: *** [libs] Error 2 > .. > > Without OpenSSL support, the Erlang package compiles successfully and > I've tested it with the console prompt. > Thanks in advance for your hints how to fix this issue with the crypto > module. > > Regards, > Claude > > * > Claude Falbriard > Certified IT Specialist L2 - Middleware > AMS Hortol?ndia / SP - Brazil > phone: +55 19 9837 0789 > cell: +55 13 8117 3316 > e-mail: claudef@REDACTED > * > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kenji.rikitake@REDACTED Thu Apr 26 15:32:44 2012 From: kenji.rikitake@REDACTED (Kenji Rikitake) Date: Thu, 26 Apr 2012 22:32:44 +0900 Subject: [erlang-questions] TinyMT PRNG for Erlang/OTP Message-ID: <20120426133244.GA6242@k2r.org> TinyMT is a pseudo random number generator (PRNG) which has 2^127-1 period, and is designed for parallel execution (with orthogonal multiple keys and seeds). I've released a preliminary piece of example code at: https://github.com/jj1bdx/tinymt-erlang/ Note: this implementation is in pure Erlang (i.e., no NIF), and a preliminary benchmark suggests that it's x0.5 - x1.5 faster than the random module functions (i.e., of competitive speed). It's BSD licensed, so feel free to test it by yourself, and feedbacks are always welcome. Kenji Rikitake From zabrane3@REDACTED Thu Apr 26 15:46:08 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Thu, 26 Apr 2012 15:46:08 +0200 Subject: [erlang-questions] TinyMT PRNG for Erlang/OTP In-Reply-To: <20120426133244.GA6242@k2r.org> References: <20120426133244.GA6242@k2r.org> Message-ID: <77E0CF67-673E-44CA-BBBD-814C0B291DCB@gmail.com> Well done Kenji. Regards, Zabrane On Apr 26, 2012, at 3:32 PM, Kenji Rikitake wrote: > TinyMT is a pseudo random number generator (PRNG) which has 2^127-1 > period, and is designed for parallel execution (with orthogonal multiple > keys and seeds). I've released a preliminary piece of example code at: > > https://github.com/jj1bdx/tinymt-erlang/ > > Note: this implementation is in pure Erlang (i.e., no NIF), and a > preliminary benchmark suggests that it's x0.5 - x1.5 faster than the > random module functions (i.e., of competitive speed). > > It's BSD licensed, so feel free to test it by yourself, and feedbacks > are always welcome. > > Kenji Rikitake > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From jared.kofron@REDACTED Thu Apr 26 17:27:51 2012 From: jared.kofron@REDACTED (Jared Kofron) Date: Thu, 26 Apr 2012 08:27:51 -0700 Subject: [erlang-questions] Grouping processes Message-ID: Hi List, I'd like to be able to have 'groups' of processes that I can send messages to, such that sending a message to a group through whatever API there is results in that message being sent to all members of that group. Is anybody aware of an existing project that provides this functionality? Jared K From andy.richards.iit@REDACTED Thu Apr 26 17:30:39 2012 From: andy.richards.iit@REDACTED (Andy Richards) Date: Thu, 26 Apr 2012 16:30:39 +0100 Subject: [erlang-questions] Resource discovery & load balancing Message-ID: <71A38EAD-4B2E-4763-8466-0EE703AEC797@googlemail.com> Hi all, I've read the chapter on resource discovery in Erlang & OTP In Action Logan et al and understand how I can dynamically bring an additional node into a cluster, however I can't find a good resource explaining good approaches to distributing load across such nodes? I'm assuming I will need to do some sort of hashing or round robin across the nodes but was wondering how others in the community distribute load across nodes (using resource discovery) or if anyone was aware of a good resource related to this? Many thanks, Andy. Sent from my iPad From olivier.boudeville@REDACTED Thu Apr 26 17:30:56 2012 From: olivier.boudeville@REDACTED (Olivier BOUDEVILLE) Date: Thu, 26 Apr 2012 17:30:56 +0200 Subject: [erlang-questions] Resisting "noconnection" / Remote termination of nodes In-Reply-To: Message-ID: Hi Kannan, Indeed there was already a master node which, once the termination was agreed upon (consensus is easy to obtain in my case), was enforcing it, shutting down distributed services synchronously and in the right order. So the tear-down phase was fully planned, except that a 'noconnection' error suggested that I had at least one reckless process that was attempting to reach an already halted node. My question was whether 'noconnection' was VM-level and uncatchable (not directly triggered by a specific operation that I could have wrapped in a try/catch clause) and whether we could have a little more information than just 'noconnection' (source/target node/pid). Anyway replacing rpc:cast( N, erlang, halt, [] ) by a direct halt() performed on a process already running on each node did the trick. Thanks, Best regards, Olivier Boudeville. --------------------------- Olivier Boudeville EDF R&D : 1, avenue du G?n?ral de Gaulle, 92140 Clamart, France D?partement SINETICS, groupe ASICS (I2A), bureau B-226 Office : +33 1 47 65 59 58 / Mobile : +33 6 16 83 37 22 / Fax : +33 1 47 65 27 13 vasdeveloper@REDACTED 26/04/2012 12:34 A olivier.boudeville@REDACTED cc erlang-questions@REDACTED Objet Re: [erlang-questions] Resisting "noconnection" / Remote termination of nodes Hi Olivier, In distributed computing, we see the collective effort of individual -- but not independent -- nodes. Communicating nodes, at any point in time, need to be connected and should have the knowledge of the other, including the availability status. The OAM node, or leader, will have the total picture of all the nodes. You have to look at the bigger picture of the whole system, when it comes to stopping a distributed system. The following steps are generally taken to tear down a system. * Signal all the nodes of a forthcoming shutdown request * Stop accepting new requests * Finish servicing the accepted requests * Do the stock taking and clean-up * Check the readiness of all the nodes for shutdown * Then call shutdown on all the nodes. Here, I am looking from top into the system. The shutdown process will be generally coordinated by a single process. An ad-hock shutdown is more scary to me in a production environment. Kind Regards, Kannan. On Tue, Apr 24, 2012 at 5:22 PM, Olivier BOUDEVILLE < olivier.boudeville@REDACTED> wrote: Hi, For a more controlled overall termination of a distributed application, I try to shutdown synchronously a series of nodes, as properly and as in parallel as possible, in a non-OTP program. I imagine that using '[ rpc:cast( N, erlang, halt, [] ) || N <- MyTargetNodes ]' and then waiting for them to be terminated is the best approach for that. As I want now these terminations to be synchronous (i.e. I want my terminate function to return only when all nodes are down for sure), I used to rely on checking their termination using net_adm:ping/1 (waiting for pong to become pang), but kept on getting (systematically) 'noconnection' errors (exceptions?), which do not seem to be catchable (at least not with a 'try .. catch T:E ->.. end' clause). This happens as soon as there is at least one node (which happens to be on the same host - of course it is not the local node from which that rpc:cast is triggered) to halt. I switched to looping on 'lists:member( Nodename, nodes() )' instead of ping (in both case with a proper waiting between checks), but I still get 'noconnection' errors. It looks like 'noconnection' is VM-level? As expected, commenting-out the rpc:cast/3 never leads to 'noconnection'. I feel I would need something like net_kernel:unconnect_node/1. My question now: how to deal gracefully with such a synchronous node shutdown and to resist to the (intended) loss of node(s)? Thanks in advance for any hint! Best regards, Olivier. --------------------------- Olivier Boudeville EDF R&D : 1, avenue du G?n?ral de Gaulle, 92140 Clamart, France D?partement SINETICS, groupe ASICS (I2A), bureau B-226 Office : +33 1 47 65 59 58 / Mobile : +33 6 16 83 37 22 / Fax : +33 1 47 65 27 13 Ce message et toutes les pi?ces jointes (ci-apr?s le 'Message') sont ?tablis ? l'intention exclusive des destinataires et les informations qui y figurent sont strictement confidentielles. Toute utilisation de ce Message non conforme ? sa destination, toute diffusion ou toute publication totale ou partielle, est interdite sauf autorisation expresse. Si vous n'?tes pas le destinataire de ce Message, il vous est interdit de le copier, de le faire suivre, de le divulguer ou d'en utiliser tout ou partie. Si vous avez re?u ce Message par erreur, merci de le supprimer de votre syst?me, ainsi que toutes ses copies, et de n'en garder aucune trace sur quelque support que ce soit. Nous vous remercions ?galement d'en avertir imm?diatement l'exp?diteur par retour du message. Il est impossible de garantir que les communications par messagerie ?lectronique arrivent en temps utile, sont s?curis?es ou d?nu?es de toute erreur ou virus. ____________________________________________________ This message and any attachments (the 'Message') are intended solely for the addressees. The information contained in this Message is confidential. Any use of information contained in this Message not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval. If you are not the addressee, you may not copy, forward, disclose or use any part of it. If you have received this message in error, please delete it and all copies from your system and notify the sender immediately by return message. E-mail communication cannot be guaranteed to be timely secure, error or virus-free. _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions Ce message et toutes les pi?ces jointes (ci-apr?s le 'Message') sont ?tablis ? l'intention exclusive des destinataires et les informations qui y figurent sont strictement confidentielles. Toute utilisation de ce Message non conforme ? sa destination, toute diffusion ou toute publication totale ou partielle, est interdite sauf autorisation expresse. Si vous n'?tes pas le destinataire de ce Message, il vous est interdit de le copier, de le faire suivre, de le divulguer ou d'en utiliser tout ou partie. Si vous avez re?u ce Message par erreur, merci de le supprimer de votre syst?me, ainsi que toutes ses copies, et de n'en garder aucune trace sur quelque support que ce soit. Nous vous remercions ?galement d'en avertir imm?diatement l'exp?diteur par retour du message. Il est impossible de garantir que les communications par messagerie ?lectronique arrivent en temps utile, sont s?curis?es ou d?nu?es de toute erreur ou virus. ____________________________________________________ This message and any attachments (the 'Message') are intended solely for the addressees. The information contained in this Message is confidential. Any use of information contained in this Message not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval. If you are not the addressee, you may not copy, forward, disclose or use any part of it. If you have received this message in error, please delete it and all copies from your system and notify the sender immediately by return message. E-mail communication cannot be guaranteed to be timely secure, error or virus-free. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cgsmcmlxxv@REDACTED Thu Apr 26 17:39:32 2012 From: cgsmcmlxxv@REDACTED (CGS) Date: Thu, 26 Apr 2012 17:39:32 +0200 Subject: [erlang-questions] Resource discovery & load balancing In-Reply-To: <71A38EAD-4B2E-4763-8466-0EE703AEC797@googlemail.com> References: <71A38EAD-4B2E-4763-8466-0EE703AEC797@googlemail.com> Message-ID: Hi Andy, I used round robin to solve such a problem. It's easy to implement, it can be tuned according to your hardware capabilities and scaled easily according to the number of nodes to be used. I hope this message will help. CGS On Thu, Apr 26, 2012 at 5:30 PM, Andy Richards < andy.richards.iit@REDACTED> wrote: > Hi all, > > I've read the chapter on resource discovery in Erlang & OTP In Action > Logan et al and understand how I can dynamically bring an additional node > into a cluster, however I can't find a good resource explaining good > approaches to distributing load across such nodes? > > I'm assuming I will need to do some sort of hashing or round robin across > the nodes but was wondering how others in the community distribute load > across nodes (using resource discovery) or if anyone was aware of a good > resource related to this? > > Many thanks, > > Andy. > > Sent from my iPad > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jayson.barley@REDACTED Thu Apr 26 17:43:17 2012 From: jayson.barley@REDACTED (Jayson Barley) Date: Thu, 26 Apr 2012 08:43:17 -0700 Subject: [erlang-questions] Resource discovery & load balancing In-Reply-To: References: <71A38EAD-4B2E-4763-8466-0EE703AEC797@googlemail.com> Message-ID: Andy, It all depends on what you are load balancing. I most often analyze data so I use a queue and have each of my nodes grab jobs off of the queue as they become available. This works well for me. Jayson On Thu, Apr 26, 2012 at 8:39 AM, CGS wrote: > Hi Andy, > > I used round robin to solve such a problem. It's easy to implement, it can > be tuned according to your hardware capabilities and scaled easily > according to the number of nodes to be used. > > I hope this message will help. > > CGS > > > > > > On Thu, Apr 26, 2012 at 5:30 PM, Andy Richards < > andy.richards.iit@REDACTED> wrote: > >> Hi all, >> >> I've read the chapter on resource discovery in Erlang & OTP In Action >> Logan et al and understand how I can dynamically bring an additional node >> into a cluster, however I can't find a good resource explaining good >> approaches to distributing load across such nodes? >> >> I'm assuming I will need to do some sort of hashing or round robin across >> the nodes but was wondering how others in the community distribute load >> across nodes (using resource discovery) or if anyone was aware of a good >> resource related to this? >> >> Many thanks, >> >> Andy. >> >> Sent from my iPad >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions >> > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From olivier.boudeville@REDACTED Thu Apr 26 17:53:06 2012 From: olivier.boudeville@REDACTED (Olivier BOUDEVILLE) Date: Thu, 26 Apr 2012 17:53:06 +0200 Subject: [erlang-questions] Resisting "noconnection" / Remote termination of nodes In-Reply-To: <20120426093821.GC42675@netch.kiev.ua> Message-ID: Hi Netch, Thanks for the hint: I was aware of net_kernel:connect_node/1 but not of erlang:disconnect_node/1 (a bit confusing to find them in different places!). My (speculative) point was that erlang:monitor_node/0 and net_kernel:monitor_nodes/0 would not have prevented 'noconnection' to happen, which I see as a sign that other processes might be trying to access a node that is being shut down. On the other end, I did find any process doing so (yes, this does not imply much!) and I wonder whether rpc:cast( N, erlang, halt, [] ) could not be a reason sufficient by itself to trigger a 'noconnection' (doing a local halt() thanks to an idle process already on the target node never shown any noconnection). That's why I was inquiring about whether 'noconnection' could be a little bit more talkative or even catchable (unless I am mistaken, it is not possible?). Anyway at least for my very specific problem, the issue seems to be closed (at least for the moment!). Thanks! Best regards, Olivier Boudeville. --------------------------- Olivier Boudeville EDF R&D : 1, avenue du G?n?ral de Gaulle, 92140 Clamart, France D?partement SINETICS, groupe ASICS (I2A), bureau B-226 Office : +33 1 47 65 59 58 / Mobile : +33 6 16 83 37 22 / Fax : +33 1 47 65 27 13 netch@REDACTED 26/04/2012 11:38 A olivier.boudeville@REDACTED cc erlang-questions@REDACTED Objet Re: [erlang-questions] Resisting "noconnection" / Remote termination of nodes Tue, Apr 24, 2012 at 13:52:18, olivier.boudeville wrote about "[erlang-questions] Resisting "noconnection" / Remote termination of nodes": > As I want now these terminations to be synchronous (i.e. I want my > terminate function to return only when all nodes are down for sure), I > used to rely on checking their termination using net_adm:ping/1 (waiting > for pong to become pang), but kept on getting (systematically) > 'noconnection' errors (exceptions?), which do not seem to be catchable (at > least not with a 'try .. catch T:E ->.. end' clause). Seems this is good case for erlang:monitor_node(). Initially, check each node from the list and subscribe to nodedown messages using monitor_node() if it is shown alive. Then make multicast halt request and loop around nodedown messages, dropping nodes from list on each one. Exit on empty list. Also net_kernel:monitor_nodes() provide similar ability. The only side issue I see is that it tries to connect to node if there is no connection yet, so you one can occur a potential race if some another agent performs similar action. If this is your case, separate node control to own manager process. > I feel I would need something like net_kernel:unconnect_node/1. It's erlang:disconnect_node/1, but I doubt it is useful for your goal. > My question now: how to deal gracefully with such a synchronous node > shutdown and to resist to the (intended) loss of node(s)? Seems something is unclear in your description so feel free to reformulate it. -netch- Ce message et toutes les pi?ces jointes (ci-apr?s le 'Message') sont ?tablis ? l'intention exclusive des destinataires et les informations qui y figurent sont strictement confidentielles. Toute utilisation de ce Message non conforme ? sa destination, toute diffusion ou toute publication totale ou partielle, est interdite sauf autorisation expresse. Si vous n'?tes pas le destinataire de ce Message, il vous est interdit de le copier, de le faire suivre, de le divulguer ou d'en utiliser tout ou partie. Si vous avez re?u ce Message par erreur, merci de le supprimer de votre syst?me, ainsi que toutes ses copies, et de n'en garder aucune trace sur quelque support que ce soit. Nous vous remercions ?galement d'en avertir imm?diatement l'exp?diteur par retour du message. Il est impossible de garantir que les communications par messagerie ?lectronique arrivent en temps utile, sont s?curis?es ou d?nu?es de toute erreur ou virus. ____________________________________________________ This message and any attachments (the 'Message') are intended solely for the addressees. The information contained in this Message is confidential. Any use of information contained in this Message not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval. If you are not the addressee, you may not copy, forward, disclose or use any part of it. If you have received this message in error, please delete it and all copies from your system and notify the sender immediately by return message. E-mail communication cannot be guaranteed to be timely secure, error or virus-free. -------------- next part -------------- An HTML attachment was scrubbed... URL: From tilman.holschuh@REDACTED Thu Apr 26 17:58:32 2012 From: tilman.holschuh@REDACTED (Tilman Holschuh) Date: Thu, 26 Apr 2012 08:58:32 -0700 Subject: [erlang-questions] Grouping processes In-Reply-To: References: Message-ID: Hi Jared, Have you had a look at Ulf Wiger's gproc for this? https://github.com/uwiger/gproc Cheers - Tilman On 2012-04-26, at 8:27 AM, Jared Kofron wrote: > Hi List, > I'd like to be able to have 'groups' of processes that I can send messages to, such that sending a message > to a group through whatever API there is results in that message being sent to all members of that group. > > Is anybody aware of an existing project that provides this functionality? > > Jared K > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From rpettit@REDACTED Thu Apr 26 18:09:30 2012 From: rpettit@REDACTED (Rick Pettit) Date: Thu, 26 Apr 2012 11:09:30 -0500 Subject: [erlang-questions] Grouping processes In-Reply-To: References: Message-ID: On Apr 26, 2012, at 10:58 AM, Tilman Holschuh wrote: > Hi Jared, > > Have you had a look at Ulf Wiger's gproc for this? > > https://github.com/uwiger/gproc There's also pg2, which comes with the erlang distribution. I haven't personally used gproc (though after a glance at the docs that looks worth checking out, too). -Rick > Cheers > - Tilman > > On 2012-04-26, at 8:27 AM, Jared Kofron wrote: > >> Hi List, >> I'd like to be able to have 'groups' of processes that I can send messages to, such that sending a message >> to a group through whatever API there is results in that message being sent to all members of that group. >> >> Is anybody aware of an existing project that provides this functionality? >> >> Jared K >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From claudef@REDACTED Thu Apr 26 20:20:55 2012 From: claudef@REDACTED (claudef@REDACTED) Date: Thu, 26 Apr 2012 15:20:55 -0300 Subject: [erlang-questions] Issues with Erlang Build under SUSE SLES 11 SP 1 on S390 In-Reply-To: References: Message-ID: Dear colleagues, Thanks, for the quick reply. The issue with the crypto.c clearly relates to OpenSSL. Unfortunately an openssl-devel package is not available from Novell SUSE. I've downloaded the latest source packages of Kerberos 5 (MIT) and as well as OpenSSL. Remains some doubts how to use the configuration arguments described in the Erlang install process --with-ssl=PATH - Specify location of OpenSSL include and lib Is there an example how to setup this PATH? Questions: 1 - What exactly goes into the PATH argument of with-ssl= ? Is there an example how to use it? 2 - Why does the /configure shell search for the krb5.h only under the location of /usr/include Those are the locations generated by Kerberos5: /usr/local/include/krb5.h /usr/local/include/krb5/krb5.h and for the openssl package /usr/local/ssl/bin/openssl /usr/local/ssl/include/openssl 3. Any modules need to be placed under /usr/include (default path of ./configure) ? Thanks in advance for your support to add crypto (ssl) suport to Erlang. Regards, Claude Claude Falbriard Certified IT Specialist L2 - Middleware AMS Hortol?ndia / SP - Brazil phone: +55 19 9837 0789 cell: +55 13 8117 3316 e-mail: claudef@REDACTED From: CGS To: claudef@REDACTED Cc: Erlang-Questions Questions Date: 26/04/2012 10:03 Subject: Re: [erlang-questions] Issues with Erlang Build under SUSE SLES 11 SP 1 on S390 Hi, I suppose you need to install OpenSSL-dev (from the error it looks like you are missing some OpenSSL headers). CGS On Thu, Apr 26, 2012 at 2:17 PM, wrote: Dear colleagues, I'm compiling an Erlang environment under the SUSE SLES 11 SP1 on a S390 platform building it from the source. I'm facing an error condition when adding the support for OpenSSL and Erlang "crypto" support using the following configuration: ./configure --with-ssl --with-ssl=/usr/lib64/openssl The configure completes normal, but the subsequent "make" step throws a sequence of errors like this: .. crypto.c: In function ?hmac_md5?: crypto.c:1713: error: ?MD5_CTX? undeclared (first use in this function) crypto.c:1713: error: expected ?;? before ?ctx? crypto.c:1714: warning: ISO C90 forbids mixed declarations and code crypto.c:1737: error: ?ctx? undeclared (first use in this function) crypto.c: In function ?hmac_sha1?: crypto.c:1752: error: ?SHA_CTX? undeclared (first use in this function) crypto.c:1752: error: expected ?;? before ?ctx? crypto.c:1753: warning: ISO C90 forbids mixed declarations and code crypto.c:1776: error: ?ctx? undeclared (first use in this function) make[4]: *** [../priv/obj/s390x-ibm-linux-gnu/crypto.o] Error 1 make[4]: Leaving directory `/opt/erlang/otp_src_R14B03/lib/crypto/c_src' make[3]: *** [opt] Error 2 make[3]: Leaving directory `/opt/erlang/otp_src_R14B03/lib/crypto/c_src' make[2]: *** [opt] Error 2 make[2]: Leaving directory `/opt/erlang/otp_src_R14B03/lib/crypto' make[1]: *** [opt] Error 2 make[1]: Leaving directory `/opt/erlang/otp_src_R14B03/lib' make: *** [libs] Error 2 .. Without OpenSSL support, the Erlang package compiles successfully and I've tested it with the console prompt. Thanks in advance for your hints how to fix this issue with the crypto module. Regards, Claude Claude Falbriard Certified IT Specialist L2 - Middleware AMS Hortol?ndia / SP - Brazil phone: +55 19 9837 0789 cell: +55 13 8117 3316 e-mail: claudef@REDACTED _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From watson.timothy@REDACTED Thu Apr 26 22:07:33 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Thu, 26 Apr 2012 21:07:33 +0100 Subject: [erlang-questions] Grouping processes In-Reply-To: References: Message-ID: <8FAF616A-6AD4-482E-9FB3-9CF57271A043@gmail.com> You might also look at http://hg.rabbitmq.com/rabbitmq-server/file/default/src/gm.erl Sent from my iPhone On 26 Apr 2012, at 17:09, Rick Pettit wrote: > > On Apr 26, 2012, at 10:58 AM, Tilman Holschuh wrote: > >> Hi Jared, >> >> Have you had a look at Ulf Wiger's gproc for this? >> >> https://github.com/uwiger/gproc > > There's also pg2, which comes with the erlang distribution. > > I haven't personally used gproc (though after a glance at the docs that looks worth checking out, too). > > -Rick > >> Cheers >> - Tilman >> >> On 2012-04-26, at 8:27 AM, Jared Kofron wrote: >> >>> Hi List, >>> I'd like to be able to have 'groups' of processes that I can send messages to, such that sending a message >>> to a group through whatever API there is results in that message being sent to all members of that group. >>> >>> Is anybody aware of an existing project that provides this functionality? >>> >>> Jared K >>> _______________________________________________ >>> erlang-questions mailing list >>> erlang-questions@REDACTED >>> http://erlang.org/mailman/listinfo/erlang-questions >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From anders.nygren@REDACTED Thu Apr 26 22:12:55 2012 From: anders.nygren@REDACTED (Anders Nygren) Date: Thu, 26 Apr 2012 15:12:55 -0500 Subject: [erlang-questions] Issues with Erlang Build under SUSE SLES 11 SP 1 on S390 In-Reply-To: References: Message-ID: On suse the package is called libopenssl-devel. /Anders On Thu, Apr 26, 2012 at 1:20 PM, wrote: > Dear colleagues, > > Thanks, for the quick reply. The issue with the crypto.c ?clearly relates to > OpenSSL. Unfortunately an openssl-devel package is not available from Novell > SUSE. ?I've downloaded the latest source packages of Kerberos 5 (MIT) and as > well as OpenSSL. Remains some doubts how to use the configuration arguments > described in the Erlang install process > > --with-ssl=PATH - Specify location of OpenSSL include and lib > > Is there an example how to setup this PATH? > > Questions: > > 1 ?- What exactly goes into the PATH argument of with-ssl= ? Is there an > example how to use it? > > 2 ?- Why does the /configure shell search for the krb5.h only under the > location of ?/usr/include > > Those are the locations generated by Kerberos5: > ? ? /usr/local/include/krb5.h > ? ? /usr/local/include/krb5/krb5.h > > and for the openssl package > ? ? /usr/local/ssl/bin/openssl > ? ? /usr/local/ssl/include/openssl > > 3. Any modules need to be placed under /usr/include (default path of > ?./configure) ? > > Thanks in advance for your support to add crypto (ssl) suport to Erlang. > > Regards, > Claude > > > Claude Falbriard > Certified IT Specialist L2 - Middleware > AMS Hortol?ndia / SP - Brazil > phone: ? ?+55 19 9837 0789 > cell: ? ? ? ? +55 13 8117 3316 > e-mail: ? ?claudef@REDACTED > > > > > From: ? ? ? ?CGS > To: ? ? ? ?claudef@REDACTED > Cc: ? ? ? ?Erlang-Questions Questions > Date: ? ? ? ?26/04/2012 10:03 > Subject: ? ? ? ?Re: [erlang-questions] Issues with Erlang Build under SUSE > SLES 11 SP 1 on S390 > ________________________________ > > > > Hi, > > I suppose you need to install OpenSSL-dev (from the error it looks like you > are missing some OpenSSL headers). > > CGS > > > > > > On Thu, Apr 26, 2012 at 2:17 PM, wrote: > Dear colleagues, > > ?I'm compiling an Erlang ?environment under the SUSE SLES 11 SP1 on a S390 > platform building it from the source. I'm facing an error condition when > adding the support for OpenSSL and Erlang "crypto" support using the > following configuration: > > ./configure --with-ssl --with-ssl=/usr/lib64/openssl > > The configure completes normal, but the subsequent "make" step throws a > sequence of errors like this: > .. > crypto.c: In function ?hmac_md5?: > crypto.c:1713: error: ?MD5_CTX? undeclared (first use in this function) > crypto.c:1713: error: expected ?;? before ?ctx? > crypto.c:1714: warning: ISO C90 forbids mixed declarations and code > crypto.c:1737: error: ?ctx? undeclared (first use in this function) > crypto.c: In function ?hmac_sha1?: > crypto.c:1752: error: ?SHA_CTX? undeclared (first use in this function) > crypto.c:1752: error: expected ?;? before ?ctx? > crypto.c:1753: warning: ISO C90 forbids mixed declarations and code > crypto.c:1776: error: ?ctx? undeclared (first use in this function) > make[4]: *** [../priv/obj/s390x-ibm-linux-gnu/crypto.o] Error 1 > make[4]: Leaving directory `/opt/erlang/otp_src_R14B03/lib/crypto/c_src' > make[3]: *** [opt] Error 2 > make[3]: Leaving directory `/opt/erlang/otp_src_R14B03/lib/crypto/c_src' > make[2]: *** [opt] Error 2 > make[2]: Leaving directory `/opt/erlang/otp_src_R14B03/lib/crypto' > make[1]: *** [opt] Error 2 > make[1]: Leaving directory `/opt/erlang/otp_src_R14B03/lib' > make: *** [libs] Error 2 > .. > > ?Without OpenSSL support, the Erlang package compiles successfully and I've > tested it with the console prompt. > Thanks in advance for your hints how to fix this issue with the crypto > module. > > Regards, > Claude > > > Claude Falbriard > Certified IT Specialist L2 - Middleware > AMS Hortol?ndia / SP - Brazil > phone: ? ?+55 19 9837 0789 > cell: ? ? ? ? +55 13 8117 3316 > e-mail: ? ?claudef@REDACTED > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From cgsmcmlxxv@REDACTED Thu Apr 26 23:27:35 2012 From: cgsmcmlxxv@REDACTED (CGS) Date: Thu, 26 Apr 2012 23:27:35 +0200 Subject: [erlang-questions] Issues with Erlang Build under SUSE SLES 11 SP 1 on S390 In-Reply-To: References: Message-ID: I suppose you can pass --with-ssl-lib=SSL_LIBRARY_PATH and --with-ssl-include=SSL_INCLUDE_PATH. And, yes, there should be libopenssl-devel under SuSE. CGS On Thu, Apr 26, 2012 at 8:20 PM, wrote: > Dear colleagues, > > Thanks, for the quick reply. The issue with the crypto.c clearly relates > to OpenSSL. Unfortunately an openssl-devel package is not available from > Novell SUSE. I've downloaded the latest source packages of Kerberos 5 > (MIT) and as well as OpenSSL. Remains some doubts how to use the > configuration arguments described in the Erlang install process > > --with-ssl=PATH - Specify location of OpenSSL include and lib > > Is there an example how to setup this PATH? > > *Questions: * > > 1 - What exactly goes into the PATH argument of with-ssl= ? Is there an > example how to use it? > > 2 - Why does the /configure shell search for the krb5.h only under the > location of /usr/include > > Those are the locations generated by Kerberos5: > /usr/local/include/krb5.h > /usr/local/include/krb5/krb5.h > > and for the openssl package > /usr/local/ssl/bin/openssl > /usr/local/ssl/include/openssl > > 3. Any modules need to be placed under /usr/include (default path of > ./configure) ? > > Thanks in advance for your support to add crypto (ssl) suport to Erlang. > > Regards, > Claude > > * > Claude Falbriard > Certified IT Specialist L2 - Middleware > AMS Hortol?ndia / SP - Brazil > phone: +55 19 9837 0789 > cell: +55 13 8117 3316 > e-mail: claudef@REDACTED > * > > > > From: CGS > To: claudef@REDACTED > Cc: Erlang-Questions Questions > Date: 26/04/2012 10:03 > Subject: Re: [erlang-questions] Issues with Erlang Build under > SUSE SLES 11 SP 1 on S390 > ------------------------------ > > > > Hi, > > I suppose you need to install OpenSSL-dev (from the error it looks like > you are missing some OpenSSL headers). > > CGS > > > > > > On Thu, Apr 26, 2012 at 2:17 PM, <*claudef@REDACTED*> > wrote: > Dear colleagues, > > I'm compiling an Erlang environment under the SUSE SLES 11 SP1 on a S390 > platform building it from the source. I'm facing an error condition when > adding the support for OpenSSL and Erlang "crypto" support using the > following configuration: > > ./configure --with-ssl --with-ssl=/usr/lib64/openssl > > The configure completes normal, but the subsequent "make" step throws a > sequence of errors like this: > .. > crypto.c: In function ?hmac_md5?: > crypto.c:1713: error: ?MD5_CTX? undeclared (first use in this function) > crypto.c:1713: error: expected ?;? before ?ctx? > crypto.c:1714: warning: ISO C90 forbids mixed declarations and code > crypto.c:1737: error: ?ctx? undeclared (first use in this function) > crypto.c: In function ?hmac_sha1?: > crypto.c:1752: error: ?SHA_CTX? undeclared (first use in this function) > crypto.c:1752: error: expected ?;? before ?ctx? > crypto.c:1753: warning: ISO C90 forbids mixed declarations and code > crypto.c:1776: error: ?ctx? undeclared (first use in this function) > make[4]: *** [../priv/obj/s390x-ibm-linux-gnu/crypto.o] Error 1 > make[4]: Leaving directory `/opt/erlang/otp_src_R14B03/lib/crypto/c_src' > make[3]: *** [opt] Error 2 > make[3]: Leaving directory `/opt/erlang/otp_src_R14B03/lib/crypto/c_src' > make[2]: *** [opt] Error 2 > make[2]: Leaving directory `/opt/erlang/otp_src_R14B03/lib/crypto' > make[1]: *** [opt] Error 2 > make[1]: Leaving directory `/opt/erlang/otp_src_R14B03/lib' > make: *** [libs] Error 2 > .. > > Without OpenSSL support, the Erlang package compiles successfully and > I've tested it with the console prompt. > Thanks in advance for your hints how to fix this issue with the crypto > module. > > Regards, > Claude > * > > Claude Falbriard > Certified IT Specialist L2 - Middleware > AMS Hortol?ndia / SP - Brazil > phone: +55 19 9837 0789 > cell: +55 13 8117 3316 > e-mail: **claudef@REDACTED* > > _______________________________________________ > erlang-questions mailing list* > **erlang-questions@REDACTED* * > **http://erlang.org/mailman/listinfo/erlang-questions* > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok@REDACTED Fri Apr 27 00:53:33 2012 From: ok@REDACTED (Richard O'Keefe) Date: Fri, 27 Apr 2012 10:53:33 +1200 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: <4F990D31.8070309@fastmail.fm> References: <4F9320F7.3010009@fastmail.fm> <436F6F6E-1131-4DC8-846B-0B0CC4C92CD8@cs.otago.ac.nz> <4F94BE6A.5010906@fastmail.fm> <049bd08514a53fb92bdc31699b438c8c.squirrel@chasm.otago.ac.nz> <4F951F75.4090708@fastmail.fm> <1EEF2F3F-A943-487F-A677-0AEAE24668FF@cs.otago.ac.nz> <4F95E025.1000404@fastmail.fm> <87C1D9BF-4845-487A-A1FE-7CEC91FA4C90@cs.otago.ac.nz> <4F965B38.1000302@fastmail.fm> <728E8F42-1626-450E-AE2C-2EB9ECDF48F0@cs.otago.ac.nz> <4F990D31.8070309@fastmail.fm> Message-ID: <8D0F33D1-9E34-4D3A-B12A-25FBE3065CB7@cs.otago.ac.nz> On 26/04/2012, at 8:54 PM, Jan Burse wrote: > Richard O'Keefe schrieb: >> [... Long Useless Mail ...] Merci du compliment. > > There is no official frames proposal yet > for Erlang I have read in a blog Who said anything about "official"? > > So instead of talking about a miracoulous > proposals, it would be helpful to provide > a link and substantiate claims. The frames proposal has often been discussed in this mailing list, and a quick Google (Erlang frames proposal) would have found this message http://erlang.org/pipermail/erlang-questions/2011-February/056475.html which contains a link faster than any number of insults. Indeed, simply _asking_ for the link before spouting off about it would have been a good idea. There is no EEP for the simple reason that EEPs must now be written in Markdown, and I have been unable to master Markdown, largely because I have been unable to find a clear, complete, and consistent description of Markdown syntax or semantics. From ok@REDACTED Fri Apr 27 00:58:19 2012 From: ok@REDACTED (Richard O'Keefe) Date: Fri, 27 Apr 2012 10:58:19 +1200 Subject: [erlang-questions] Fwd: Erlang Job for $5000 in Saint-Petersburg In-Reply-To: <4F9910A3.2030500@llaisdy.com> References: <4F990A78.5060501@rabbitmq.com> <4F9910A3.2030500@llaisdy.com> Message-ID: <8FEF2536-1F35-442C-BFD1-7AF4BD2FF281@cs.otago.ac.nz> On 26/04/2012, at 9:08 PM, Ivan Uemlianin wrote: > fwiw colloquial British English uses "their" for his/her ("they" for he/she, and "them" for him/her). It's quite serviceable. However some native speakers of English find that unappealing. In this case, as very often happens, the sentence could have been easily reworded to say "your". Note that English has _almost_ entirely abandoned grammatical gender, so that people think of pronouns as referring to sex. Other languages, like Russian, have not done this, and I wonder whether the same issue arises there? From janburse@REDACTED Fri Apr 27 01:47:34 2012 From: janburse@REDACTED (Jan Burse) Date: Fri, 27 Apr 2012 01:47:34 +0200 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: <8D0F33D1-9E34-4D3A-B12A-25FBE3065CB7@cs.otago.ac.nz> References: <4F9320F7.3010009@fastmail.fm> <436F6F6E-1131-4DC8-846B-0B0CC4C92CD8@cs.otago.ac.nz> <4F94BE6A.5010906@fastmail.fm> <049bd08514a53fb92bdc31699b438c8c.squirrel@chasm.otago.ac.nz> <4F951F75.4090708@fastmail.fm> <1EEF2F3F-A943-487F-A677-0AEAE24668FF@cs.otago.ac.nz> <4F95E025.1000404@fastmail.fm> <87C1D9BF-4845-487A-A1FE-7CEC91FA4C90@cs.otago.ac.nz> <4F965B38.1000302@fastmail.fm> <728E8F42-1626-450E-AE2C-2EB9ECDF48F0@cs.otago.ac.nz> <4F990D31.8070309@fastmail.fm> <8D0F33D1-9E34-4D3A-B12A-25FBE3065CB7@cs.otago.ac.nz> Message-ID: <4F99DE96.2010006@fastmail.fm> Richard O'Keefe schrieb: >> So instead of talking about a miracoulous >> proposals, it would be helpful to provide >> a link and substantiate claims. I wrote "a link" and "substantiate claims". What I would like to know how the following claims of yours: Claim I: > If you had read the frames proposal, you would > have realised that the proposed implementation has > the first slot pointing to a descriptor, which can > be shared by any number of frames having the same slots. > This is precisely the same as an object pointing > to its class. Claim II: > In exactly the same way, you can have 'zillions of instances' > of a frame where each > instance is four words: R, G, B and run time type information. > If I was to have any hope of getting frames accepted, I felt > I had to show that they would have no space penalty compared > with records. Relate to your proposal. In particular I have the following doubts about your claims: Claim I: Most OO languages don't have a <{k1~v1,k2~v2|F}> operation that allows the creation of dynamic frames. Even if you are putting key sequences, seen in code, into a constant pool at compile time, when you don't have complete type inference, you will not know in advance what the above operation will generate as a keyset, and you will have a miss on the constant pool and end up with a more costly solution that doesn't exist in modern OO languages. This will especially happen for your use case 3 where module C adds an "annotation" to a frame from module P. (See section 11, 2 of your frame proposal) Maybe Self had such an architecture, but for example Java has single inheritance and you can only instantiate objects from this class hierarchy. Ordinary Java code hardly generates dynamic classes by a simple source code statement. The multiple inheritance hierarchy along the interfaces cannot be used to instantiate objects. Scala has traits, which allow kind of multiple inheritance and instances. There is a tech report from Lausanne detailing how traits can be rewritten to ordinary Java. One solution uses delegation, the other I forgot about. Claim II: Here I must say some additional words to re-emphasize what I mean by "have". When I talk of zillion objects I am not only interrested in the memory footprint but also in the performance of the primitive operations on these objects. I think I mentioned that in my post. In Java, if not too much polymorphism is involved, the accessing of a field is O(1), both for write access and read access. Although your memory representation, in those cases where the keyset is in the constant pool, caters for small memory footprint. But I doubt that the performance is that good. Let's look at read access. The example you give to calculate the magnitude of a complex number uses pattern matching with frames. This is very appealing since Erlang has already pattern matching for lists, tuples and records. But you also write that the resulting code must check whether the argument is really a frame, whether it has really a re field and whether it has really a im field. This crosses the O(1) complexity. Also you note by yourself that frame_value/2 has cost O(lg n). (See section 7.2, 4 of your frame proposal) Bye From ok@REDACTED Fri Apr 27 05:07:39 2012 From: ok@REDACTED (Richard O'Keefe) Date: Fri, 27 Apr 2012 15:07:39 +1200 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: <4F99DE96.2010006@fastmail.fm> References: <4F9320F7.3010009@fastmail.fm> <436F6F6E-1131-4DC8-846B-0B0CC4C92CD8@cs.otago.ac.nz> <4F94BE6A.5010906@fastmail.fm> <049bd08514a53fb92bdc31699b438c8c.squirrel@chasm.otago.ac.nz> <4F951F75.4090708@fastmail.fm> <1EEF2F3F-A943-487F-A677-0AEAE24668FF@cs.otago.ac.nz> <4F95E025.1000404@fastmail.fm> <87C1D9BF-4845-487A-A1FE-7CEC91FA4C90@cs.otago.ac.nz> <4F965B38.1000302@fastmail.fm> <728E8F42-1626-450E-AE2C-2EB9ECDF48F0@cs.otago.ac.nz> <4F990D31.8070309@fastmail.fm> <8D0F33D1-9E34-4D3A-B12A-25FBE3065CB7@cs.otago.ac.nz> <4F99DE96.2010006@fastmail.fm> Message-ID: <7F715FD5-1AC8-4AAA-9B0D-62BBC2538DB6@cs.otago.ac.nz> I am withdrawing from this thread after this message. On 27/04/2012, at 11:47 AM, Jan Burse wrote: > Claim I: > > If you had read the frames proposal, you would > > have realised that the proposed implementation has > > the first slot pointing to a descriptor, which can > > be shared by any number of frames having the same slots. > > This is precisely the same as an object pointing > > to its class. What this means is incredibly simple. Suppose we have an object with an 'x' field and a 'y' field. (Such as Smalltalk's Point.) The representation will be objid ----> +------+ | rtti | -----> "class" or "vtable" or other descriptor +------+ | x | +------+ | y | +------+ Three words: header to identify somehow what kind of object it is, (current) value of x, (current) value of y. The header might be a pointer to a virtual function table (typical in C++), it might be a pointer to a class object (usual Smalltalk approach), it might be a class number (SmartEiffel, my Smalltalk). All instances of the class have the same header. Suppose we have a frame <{x ~ X, y ~ Y}>. The representation will be tagged ---> +------+ pointer | desc | -----> points to a descriptor +------+ | X | +------+ | Y | +------+ Three words: pointer to a descriptor to identify the structure, value of x, value of y. It need not be the case that all frames with the same structure share the same descriptor, but as described in the proposal, all instances created at the same program point will, so make_point(X, Y) when is_number(X), is_number(Y) -> <{x ~ X, y ~ Y}>. -- which is the rough equivalent of a constructor -- does this. Also, creating a frame with new values for existing slots of an existing frame should share the original frame's descriptor. Claim II: > > In exactly the same way, you can have 'zillions of instances' > > of a frame where each > > instance is four words: R, G, B and run time type information. > > If I was to have any hope of getting frames accepted, I felt > > I had to show that they would have no space penalty compared > > with records. There is a minor error there. The size is five words, just as the size for #colour{red = R, green = G, blue = B} is five words. frame --> [| Descriptor, 'colour', B, G, R |] record --> [| 4, 'colour', R, G, B |] where [| ... |] is an ad hoc horizontal notation for a group of consecutive words in memory. > > Relate to your proposal. In particular I have > the following doubts about your claims: > > Claim I: > Most OO languages don't have a <{k1~v1,k2~v2|F}> operation > that allows the creation of dynamic frames. A claim that descriptors *CAN* be shared is not a claim that ALL descriptors ALWAYS ARE shared. In particular, the frames paper makes no claim that dynamic frames WILL have shared descriptors, although it should be obvious that and how they CAN. As you note, 'most OO languages' don't allow that in the first place. More precisely, several Smalltalk systems _do_ allow extending objects with dynamically assigned properties in various ways, at a space cost which is rather high compared with the frames proposal. For an example that isn't Javascript, R allows this: x <- F x$k1 <- v1 # or x["k1"] <- v1 x$k2 <- v2 # or x["k2"] <- v2 > Even if you > are putting key sequences, seen in code, into a constant > pool at compile time, when you don't have complete type > inference, you will not know in advance what the above > operation will generate as a keyset, and you will have a > miss on the constant pool and end up with a more costly > solution that doesn't exist in modern OO languages. So Javascript isn't modern? R isn't modern? You seem to be taking the fact that the frames proposal allows something at reasonable cost in space that some statically typed OO languages do not allow at all or force to be quite a bit *more* costly in space as a bad thing. When both can do the same thing (the set of slot names is known at compile time), both have the same space cost. The point is that constructors with known keys are *NOT* space-costly in the frames proposal. Argue honestly and fairly: compare apples with apples. Records also do not allow the creation of associations with slot names unknown at compile time. Compare what frames can do with what records can do. > This > will especially happen for your use case 3 where module > C adds an "annotation" to a frame from module P. > (See section 11, 2 of your frame proposal) And so? Records and Java cannot do that at all. How is being able to do MORE a worse thing? After all, the whole point of the frames proposal is to let you use a form of "reflection" to do all the things people want to do with records but can't (like get them printed properly), while at the same time ensuring that things that *could* be done with records can be still be done, at perhaps a small constant time cost. > > Maybe Self had such an architecture, but for example Java > has single inheritance and you can only instantiate objects > from this class hierarchy. That wasn't news 10 years ago, and it's not news now. The argument goes roughly like this: Me: you can go from A to B using that car at X litres of fuel. Using this amphibian will also take X litres. JB: Yes, but the amphibian can also float around in water, and it uses more fuel then, so the amphibian is really bad. The plain fact of the matter is that records are not objects and were never intended to act like objects and in the same way, frames are not objects and are not intended to act like objects. There are things that objects can do (like change state) that frames cannot. This is not news. It is not a surprise or a disappointment. It is not a defect. Frames are meant to be a replacement for Erlang records. It so happens that when they are all being used like plain old Pascal-style records to hold a fixed set of fields known at compile time, frames and records and objects take pretty much the same amount of space, and when used *that* way it is very easy to exploit the possibility of shared descriptors. > Claim II: > Here I must say some additional words to re-emphasize what > I mean by "have". When I talk of zillion objects I am not > only interrested in the memory footprint but also in the > performance of the primitive operations on these objects. In context, it sounded as though you were primarily talking about the memory footprint. The number of objects is after all not terribly relevant to the performance of the primitive operations. I have never made any claim that frames have the same access costs as objects or indeed as records. To take the most elementary fact: objects have mutable fields so updating a single field is O(1), while records and frames alike are immutable, so updating a single field is O(|fields|). The aim of frames is not to match or beat objects, but to provide most of the benefits of records without *too* much overhead. It turns out (and I haven't written this up yet) that the common use of records to pass a large number of state variables around an actor event-handling loop is one where HiPE's type inference should pay off, so *reading* single fields might *often* (but not always) be just as efficient as reading single fields using records. > But I doubt that the performance is that good. Let's > look at read access. The example you give to calculate > the magnitude of a complex number uses pattern matching > with frames. This is very appealing since Erlang has already > pattern matching for lists, tuples and records. But you > also write that the resulting code must check whether the > argument is really a frame, whether it has really a re > field and whether it has really a im field. This crosses > the O(1) complexity. Well yes, but then O(1) never had any application here anyway. If you want to access k fields of a record, the cost is O(k). And if you use records, the resulting code - must check that the value is a tuple - must check that the tuple has the right size - must check that the tuple has the right first element - must extract the 're' field - must extract the 'im' field so the fixed overheads are pretty much *identical* for records and frames, and the rest is O(k) for both of them. Indeed, for a Java object accessing k fields is going to take O(k), not O(1). (More precisely, if a frame has f fields and you access k of them, the cost is in general O(f) not O(k).) >Also you note by yourself that > frame_value/2 has cost O(lg n). I also note that I just don't *care* because in well-written code that operation should very seldom be used. As noted above, I now expect that fairly straightforward type inference should get this to O(1) in many but not all cases. The key thing here is that to get top speed you need static type information. The static type information used for records in Erlang is not well integrated with the rest of the language. Frames make do without *any* static type information; that's what the design is about. But they can take advantage of type information if available. > From michael.eugene.turner@REDACTED Fri Apr 27 06:32:09 2012 From: michael.eugene.turner@REDACTED (Michael Turner) Date: Fri, 27 Apr 2012 13:32:09 +0900 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: <4F99DE96.2010006@fastmail.fm> References: <4F9320F7.3010009@fastmail.fm> <436F6F6E-1131-4DC8-846B-0B0CC4C92CD8@cs.otago.ac.nz> <4F94BE6A.5010906@fastmail.fm> <049bd08514a53fb92bdc31699b438c8c.squirrel@chasm.otago.ac.nz> <4F951F75.4090708@fastmail.fm> <1EEF2F3F-A943-487F-A677-0AEAE24668FF@cs.otago.ac.nz> <4F95E025.1000404@fastmail.fm> <87C1D9BF-4845-487A-A1FE-7CEC91FA4C90@cs.otago.ac.nz> <4F965B38.1000302@fastmail.fm> <728E8F42-1626-450E-AE2C-2EB9ECDF48F0@cs.otago.ac.nz> <4F990D31.8070309@fastmail.fm> <8D0F33D1-9E34-4D3A-B12A-25FBE3065CB7@cs.otago.ac.nz> <4F99DE96.2010006@fastmail.fm> Message-ID: "Here I must say some additional words to re-emphasize what I mean by "have"." I hope you don't have any additional words to re-emphasize what you mean by "Bye." -michael turner On Fri, Apr 27, 2012 at 8:47 AM, Jan Burse wrote: > Richard O'Keefe schrieb: > >>> So instead of talking about a miracoulous >>> proposals, it would be helpful to provide >>> a link and substantiate claims. > > > I wrote "a link" and "substantiate claims". What > I would like to know how the following claims > of yours: > > Claim I: >> If you had read the frames proposal, you would >> have realised that the proposed implementation has >> the first slot pointing to a descriptor, which can >> be shared by any number of frames having the same slots. >> This is precisely the same as an object pointing >> to its class. > > Claim II: >> In exactly the same way, you can have 'zillions of instances' >> of a frame where each >> instance is four words: R, G, B and run time type information. >> If I was to have any hope of getting frames accepted, I felt >> I had to show that they would have no space penalty compared >> with records. > > Relate to your proposal. In particular I have > the following doubts about your claims: > > Claim I: > Most OO languages don't have a <{k1~v1,k2~v2|F}> operation > that allows the creation of dynamic frames. Even if you > are putting key sequences, seen in code, into a constant > pool at compile time, when you don't have complete type > inference, you will not know in advance what the above > operation will generate as a keyset, and you will have a > miss on the constant pool and end up with a more costly > solution that doesn't exist in modern OO languages. This > will especially happen for your use case 3 where module > C adds an "annotation" to a frame from module P. > (See section 11, 2 of your frame proposal) > > Maybe Self had such an architecture, but for example Java > has single inheritance and you can only instantiate objects > from this class hierarchy. Ordinary Java code hardly generates > dynamic classes by a simple source code statement. The > multiple inheritance hierarchy along the interfaces cannot > be used to instantiate objects. Scala has traits, which > allow kind of multiple inheritance and instances. There is > a tech report from Lausanne detailing how traits can be > rewritten to ordinary Java. One solution uses delegation, > the other I forgot about. > > Claim II: > Here I must say some additional words to re-emphasize what > I mean by "have". When I talk of zillion objects I am not > only interrested in the memory footprint but also in the > performance of the primitive operations on these objects. > I think I mentioned that in my post. In Java, if not too much > polymorphism is involved, the accessing of a field is O(1), > both for write access and read access. Although your > memory representation, in those cases where the keyset > is in the constant pool, caters for small memory footprint. > > But I doubt that the performance is that good. Let's > look at read access. The example you give to calculate > the magnitude of a complex number uses pattern matching > with frames. This is very appealing since Erlang has already > pattern matching for lists, tuples and records. But you > also write that the resulting code must check whether the > argument is really a frame, whether it has really a re > field and whether it has really a im field. This crosses > the O(1) complexity. Also you note by yourself that > frame_value/2 has cost O(lg n). > (See section 7.2, 4 of your frame proposal) > > Bye > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From mrtndimitrov@REDACTED Fri Apr 27 07:17:09 2012 From: mrtndimitrov@REDACTED (Martin Dimitrov) Date: Fri, 27 Apr 2012 08:17:09 +0300 Subject: [erlang-questions] Stripping slashes from a string Message-ID: <4F9A2BD5.2080907@gmail.com> Hello, I have a string as the following: "This is some\\r\\ntext" I am trying to replace "\\r" with \r and "\\n" with \n. I do it with the following two reg expressions: R1 = re:replace(Result, "\\\\r", "\\\r", [{return,list}, global, unicode]), R2 = re:replace(R1, "\\\\n", "\\\n", [{return,list}, global, unicode]), Is there a better way? I tried to combine the two regex like: re:replace(Result, "\\\\(r|n)", "\\\\1", [{return,list}, global, unicode]) but can't make it to work. Thanks for looking at this. Best regards, Martin From michael.eugene.turner@REDACTED Fri Apr 27 08:34:20 2012 From: michael.eugene.turner@REDACTED (Michael Turner) Date: Fri, 27 Apr 2012 15:34:20 +0900 Subject: [erlang-questions] Stripping slashes from a string In-Reply-To: <4F9A2BD5.2080907@gmail.com> References: <4F9A2BD5.2080907@gmail.com> Message-ID: Works for me, Martin. Maybe you need to write the result with ~s rather than ~p? E.g. io:format ("~s", R2); Made that mistake myself .... -michael turner On Fri, Apr 27, 2012 at 2:17 PM, Martin Dimitrov wrote: > Hello, > > I have a string as the following: > > "This is some\\r\\ntext" > > I am trying to replace "\\r" with \r and "\\n" with \n. > > I do it with the following two reg expressions: > > R1 = re:replace(Result, "\\\\r", "\\\r", [{return,list}, global, unicode]), > R2 = re:replace(R1, "\\\\n", "\\\n", [{return,list}, global, unicode]), > > Is there a better way? I tried to combine the two regex like: > > re:replace(Result, "\\\\(r|n)", "\\\\1", [{return,list}, global, unicode]) > > but can't make it to work. > > Thanks for looking at this. > > Best regards, > > Martin > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From mrtndimitrov@REDACTED Fri Apr 27 09:04:46 2012 From: mrtndimitrov@REDACTED (Martin Dimitrov) Date: Fri, 27 Apr 2012 10:04:46 +0300 Subject: [erlang-questions] Stripping slashes from a string In-Reply-To: References: <4F9A2BD5.2080907@gmail.com> Message-ID: <4F9A450E.5060508@gmail.com> Hi, I am not sure what it works for you. See what I get: (dilbert@REDACTED)16> re:replace("\\r \\n text", "\\\\(r|n)", "\\\\1", [{return,list}, global, unicode]). "\\1 \\1 text" (dilbert@REDACTED)17> Best regards, Martin On 4/27/2012 9:34 AM, Michael Turner wrote: > Works for me, Martin. Maybe you need to write the result with ~s > rather than ~p? E.g. > > io:format ("~s", R2); > > Made that mistake myself .... > > -michael turner > > > On Fri, Apr 27, 2012 at 2:17 PM, Martin Dimitrov wrote: >> Hello, >> >> I have a string as the following: >> >> "This is some\\r\\ntext" >> >> I am trying to replace "\\r" with \r and "\\n" with \n. >> >> I do it with the following two reg expressions: >> >> R1 = re:replace(Result, "\\\\r", "\\\r", [{return,list}, global, unicode]), >> R2 = re:replace(R1, "\\\\n", "\\\n", [{return,list}, global, unicode]), >> >> Is there a better way? I tried to combine the two regex like: >> >> re:replace(Result, "\\\\(r|n)", "\\\\1", [{return,list}, global, unicode]) >> >> but can't make it to work. >> >> Thanks for looking at this. >> >> Best regards, >> >> Martin >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions From max.lapshin@REDACTED Fri Apr 27 09:06:50 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Fri, 27 Apr 2012 11:06:50 +0400 Subject: [erlang-questions] Fwd: Erlang Job for $5000 in Saint-Petersburg In-Reply-To: <8FEF2536-1F35-442C-BFD1-7AF4BD2FF281@cs.otago.ac.nz> References: <4F990A78.5060501@rabbitmq.com> <4F9910A3.2030500@llaisdy.com> <8FEF2536-1F35-442C-BFD1-7AF4BD2FF281@cs.otago.ac.nz> Message-ID: > Other languages, like Russian, have not done this, and I wonder > whether the same issue arises there? > It sounds very silly when someone tries to speak genderless in Russian, because of some grammar differences between English and Russian. I can say you even more: you can offence to women's feelings if you call her profession in a femine gender. For example, if she is a doctor and usually we use the word "doctor", but you say that she is a "doctorsha" (femine variant of word "doctor") she may add some phenolphthalein to your cure. From sgolovan@REDACTED Fri Apr 27 09:17:18 2012 From: sgolovan@REDACTED (Sergei Golovan) Date: Fri, 27 Apr 2012 11:17:18 +0400 Subject: [erlang-questions] Stripping slashes from a string In-Reply-To: <4F9A450E.5060508@gmail.com> References: <4F9A2BD5.2080907@gmail.com> <4F9A450E.5060508@gmail.com> Message-ID: Hi, Martin! On Fri, Apr 27, 2012 at 11:04 AM, Martin Dimitrov wrote: > Hi, > > I am not sure what it works for you. See what I get: > > (dilbert@REDACTED)16> re:replace("\\r \\n text", "\\\\(r|n)", "\\\\1", > [{return,list}, global, unicode]). > "\\1 \\1 text" > (dilbert@REDACTED)17> "\\\\1" denotes the "\\1" string, so it means 'replace the matched pattern by a single backslash and the number 1'. Try "\\\\\\1" (six backslashes) instead. Cheers! -- Sergei Golovan From mrtndimitrov@REDACTED Fri Apr 27 09:19:57 2012 From: mrtndimitrov@REDACTED (Martin Dimitrov) Date: Fri, 27 Apr 2012 10:19:57 +0300 Subject: [erlang-questions] Stripping slashes from a string In-Reply-To: References: <4F9A2BD5.2080907@gmail.com> <4F9A450E.5060508@gmail.com> Message-ID: <4F9A489D.4050109@gmail.com> With 6 it produces double backslashes making the result equivalent to the initial text: (dilbert@REDACTED)17> re:replace("\\r \\n text", "\\\\(r|n)", "\\\\\\1", [{return,list}, global, unicode]). "\\r \\n text" (dilbert@REDACTED)18> Best regards, Martin On 4/27/2012 10:17 AM, Sergei Golovan wrote: > Hi, Martin! > > On Fri, Apr 27, 2012 at 11:04 AM, Martin Dimitrov > wrote: >> Hi, >> >> I am not sure what it works for you. See what I get: >> >> (dilbert@REDACTED)16> re:replace("\\r \\n text", "\\\\(r|n)", "\\\\1", >> [{return,list}, global, unicode]). >> "\\1 \\1 text" >> (dilbert@REDACTED)17> > "\\\\1" denotes the "\\1" string, so it means 'replace the matched pattern by > a single backslash and the number 1'. Try "\\\\\\1" (six backslashes) instead. > > Cheers! From sgolovan@REDACTED Fri Apr 27 09:24:54 2012 From: sgolovan@REDACTED (Sergei Golovan) Date: Fri, 27 Apr 2012 11:24:54 +0400 Subject: [erlang-questions] Stripping slashes from a string In-Reply-To: <4F9A489D.4050109@gmail.com> References: <4F9A2BD5.2080907@gmail.com> <4F9A450E.5060508@gmail.com> <4F9A489D.4050109@gmail.com> Message-ID: On Fri, Apr 27, 2012 at 11:19 AM, Martin Dimitrov wrote: > With 6 it produces double backslashes making the result equivalent to > the initial text: True, I oversaw that the replacing regexp was incorrect too (also, the string itself). 1> re:replace("\\\\r \\\\n text", "\\\\\\\\(r|n)", "\\\\\\1", [{return,list}, global, unicode]). "\\r \\n text" 2> works fine. Cheers! -- Sergei Golovan From mrtndimitrov@REDACTED Fri Apr 27 09:28:17 2012 From: mrtndimitrov@REDACTED (Martin Dimitrov) Date: Fri, 27 Apr 2012 10:28:17 +0300 Subject: [erlang-questions] Stripping slashes from a string In-Reply-To: References: <4F9A2BD5.2080907@gmail.com> <4F9A450E.5060508@gmail.com> <4F9A489D.4050109@gmail.com> Message-ID: <4F9A4A91.2010005@gmail.com> Hi, What I am trying to achieve is not to convert "\\\\n" to "\\n" but "\\n" to [10]. Martin On 4/27/2012 10:24 AM, Sergei Golovan wrote: > On Fri, Apr 27, 2012 at 11:19 AM, Martin Dimitrov > wrote: >> With 6 it produces double backslashes making the result equivalent to >> the initial text: > True, I oversaw that the replacing regexp was incorrect too (also, the > string itself). > > 1> re:replace("\\\\r \\\\n text", "\\\\\\\\(r|n)", "\\\\\\1", > [{return,list}, global, unicode]). > "\\r \\n text" > 2> > > works fine. > > Cheers! From sgolovan@REDACTED Fri Apr 27 09:36:14 2012 From: sgolovan@REDACTED (Sergei Golovan) Date: Fri, 27 Apr 2012 11:36:14 +0400 Subject: [erlang-questions] Stripping slashes from a string In-Reply-To: <4F9A4A91.2010005@gmail.com> References: <4F9A2BD5.2080907@gmail.com> <4F9A450E.5060508@gmail.com> <4F9A489D.4050109@gmail.com> <4F9A4A91.2010005@gmail.com> Message-ID: Hi! On Fri, Apr 27, 2012 at 11:28 AM, Martin Dimitrov wrote: > > What I am trying to achieve is not to convert "\\\\n" to "\\n" but "\\n" > to [10]. You didn't tell that. In this case I'd use two calls to re:replace/4 A = re:replace("\\\\r \\\\n text", "\\\\\\\\n", [10], [{return,list}, global, unicode]), re:replace(A, "\\\\\\\\r", [13], [{return,list}, global, unicode]). Cheers! -- Sergei Golovan From mrtndimitrov@REDACTED Fri Apr 27 09:38:43 2012 From: mrtndimitrov@REDACTED (Martin Dimitrov) Date: Fri, 27 Apr 2012 10:38:43 +0300 Subject: [erlang-questions] Stripping slashes from a string In-Reply-To: References: <4F9A2BD5.2080907@gmail.com> <4F9A450E.5060508@gmail.com> <4F9A489D.4050109@gmail.com> <4F9A4A91.2010005@gmail.com> Message-ID: <4F9A4D03.80600@gmail.com> Sorry Sergei. My bet. In the original message I describe that my current solution is exactly what you are suggesting but I wondered if it is possible to replace both in one run. Best regards, Martin On 4/27/2012 10:36 AM, Sergei Golovan wrote: > Hi! > > On Fri, Apr 27, 2012 at 11:28 AM, Martin Dimitrov > wrote: >> What I am trying to achieve is not to convert "\\\\n" to "\\n" but "\\n" >> to [10]. > You didn't tell that. In this case I'd use two calls to re:replace/4 > A = re:replace("\\\\r \\\\n text", "\\\\\\\\n", [10], [{return,list}, > global, unicode]), > re:replace(A, "\\\\\\\\r", [13], [{return,list}, global, unicode]). > > Cheers! From bourinov@REDACTED Fri Apr 27 09:49:48 2012 From: bourinov@REDACTED (Max Bourinov) Date: Fri, 27 Apr 2012 11:49:48 +0400 Subject: [erlang-questions] Grouping processes In-Reply-To: <8FAF616A-6AD4-482E-9FB3-9CF57271A043@gmail.com> References: <8FAF616A-6AD4-482E-9FB3-9CF57271A043@gmail.com> Message-ID: gproc works very well. I suggest trying gproc too. Best regards, Max On Fri, Apr 27, 2012 at 12:07 AM, Tim Watson wrote: > You might also look at > http://hg.rabbitmq.com/rabbitmq-server/file/default/src/gm.erl > > Sent from my iPhone > > On 26 Apr 2012, at 17:09, Rick Pettit wrote: > > > > > On Apr 26, 2012, at 10:58 AM, Tilman Holschuh wrote: > > > >> Hi Jared, > >> > >> Have you had a look at Ulf Wiger's gproc for this? > >> > >> https://github.com/uwiger/gproc > > > > There's also pg2, which comes with the erlang distribution. > > > > I haven't personally used gproc (though after a glance at the docs that > looks worth checking out, too). > > > > -Rick > > > >> Cheers > >> - Tilman > >> > >> On 2012-04-26, at 8:27 AM, Jared Kofron wrote: > >> > >>> Hi List, > >>> I'd like to be able to have 'groups' of processes that I can send > messages to, such that sending a message > >>> to a group through whatever API there is results in that message being > sent to all members of that group. > >>> > >>> Is anybody aware of an existing project that provides this > functionality? > >>> > >>> Jared K > >>> _______________________________________________ > >>> erlang-questions mailing list > >>> erlang-questions@REDACTED > >>> http://erlang.org/mailman/listinfo/erlang-questions > >> > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sgolovan@REDACTED Fri Apr 27 09:52:49 2012 From: sgolovan@REDACTED (Sergei Golovan) Date: Fri, 27 Apr 2012 11:52:49 +0400 Subject: [erlang-questions] Stripping slashes from a string In-Reply-To: <4F9A4D03.80600@gmail.com> References: <4F9A2BD5.2080907@gmail.com> <4F9A450E.5060508@gmail.com> <4F9A489D.4050109@gmail.com> <4F9A4A91.2010005@gmail.com> <4F9A4D03.80600@gmail.com> Message-ID: Hi! On Fri, Apr 27, 2012 at 11:38 AM, Martin Dimitrov wrote: > Sorry Sergei. My bet. > > In the original message I describe that my current solution is exactly > what you are suggesting but I wondered if it is possible to replace both > in one run. Heh, then I guess you can't (or I don't know how to do it myself). \n and \r are converted into LF and CR only in string constants. When you use back references they point to letters r and n, which can't be converted into \r and \n. Cheers! -- Sergei Golovan From janburse@REDACTED Fri Apr 27 10:22:41 2012 From: janburse@REDACTED (Jan Burse) Date: Fri, 27 Apr 2012 10:22:41 +0200 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: <7F715FD5-1AC8-4AAA-9B0D-62BBC2538DB6@cs.otago.ac.nz> References: <4F9320F7.3010009@fastmail.fm> <436F6F6E-1131-4DC8-846B-0B0CC4C92CD8@cs.otago.ac.nz> <4F94BE6A.5010906@fastmail.fm> <049bd08514a53fb92bdc31699b438c8c.squirrel@chasm.otago.ac.nz> <4F951F75.4090708@fastmail.fm> <1EEF2F3F-A943-487F-A677-0AEAE24668FF@cs.otago.ac.nz> <4F95E025.1000404@fastmail.fm> <87C1D9BF-4845-487A-A1FE-7CEC91FA4C90@cs.otago.ac.nz> <4F965B38.1000302@fastmail.fm> <728E8F42-1626-450E-AE2C-2EB9ECDF48F0@cs.otago.ac.nz> <4F990D31.8070309@fastmail.fm> <8D0F33D1-9E34-4D3A-B12A-25FBE3065CB7@cs.otago.ac.nz> <4F99DE96.2010006@fastmail.fm> <7F715FD5-1AC8-4AAA-9B0D-62BBC2538DB6@cs.otago.ac.nz> Message-ID: <4F9A5751.6030807@fastmail.fm> Richard O'Keefe schrieb: >> Also you note by yourself that >> > frame_value/2 has cost O(lg n). > I also note that I just don't*care* because in well-written code > that operation should very seldom be used. I guess the access can be made O(1). If a closed frame pattern acess is used as in: p() Then then usual speed can be archived and zillions of objects can be quickly handled. But I guess the above coding is not desired to support use case 3, where module C adds an "annotation" to a frame from module P. The programmer from module P would then be required to code: p() -> ... And this would be the well written code. I guess the access via open frame patterns cannot be anymore O(1). At least I don't see some approach mentioned in your proposal. Especially annoying for the performance would be the recreation of the tail frame F. This can be circumvented when only read access is needed, and no update, by the following code: p(H) -> H=, ... In Java every method parameter, local variable and field is assumed to be co-variant. For class types this means that any of these place holders can always hold a subclass. The access is still O(1) for classes since they only have single inheritance. For interface types the situation is not that good, and more JIT work is required to get back to O(1) if the call site permits. But I could write Java code that handles zillions of Colors, and when I want I could also pass a subclass, for example IndexedColor and code runs exactly the same speed. > Frames make do without *any* static type information; > that's what the design is about. But they can take > advantage of type information if available. In which proposal is this substantiated? Bye From andy.richards.iit@REDACTED Fri Apr 27 10:23:15 2012 From: andy.richards.iit@REDACTED (Andy Richards) Date: Fri, 27 Apr 2012 09:23:15 +0100 Subject: [erlang-questions] Resource discovery & load balancing In-Reply-To: References: <71A38EAD-4B2E-4763-8466-0EE703AEC797@googlemail.com> Message-ID: <1C2920F9-0EDB-4B2E-89ED-77E0412AF326@googlemail.com> Thanks both, that gives me a couple of ideas. Any other suggestions anyone? Many thanks, Andy. Sent from my iPad On 26 Apr 2012, at 16:43, Jayson Barley wrote: > Andy, > > It all depends on what you are load balancing. I most often analyze data so I use a queue and have each of my nodes grab jobs off of the queue as they become available. This works well for me. > > Jayson > > On Thu, Apr 26, 2012 at 8:39 AM, CGS wrote: > Hi Andy, > > I used round robin to solve such a problem. It's easy to implement, it can be tuned according to your hardware capabilities and scaled easily according to the number of nodes to be used. > > I hope this message will help. > > CGS > > > > > > On Thu, Apr 26, 2012 at 5:30 PM, Andy Richards wrote: > Hi all, > > I've read the chapter on resource discovery in Erlang & OTP In Action Logan et al and understand how I can dynamically bring an additional node into a cluster, however I can't find a good resource explaining good approaches to distributing load across such nodes? > > I'm assuming I will need to do some sort of hashing or round robin across the nodes but was wondering how others in the community distribute load across nodes (using resource discovery) or if anyone was aware of a good resource related to this? > > Many thanks, > > Andy. > > Sent from my iPad > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From janburse@REDACTED Fri Apr 27 10:29:29 2012 From: janburse@REDACTED (Jan Burse) Date: Fri, 27 Apr 2012 10:29:29 +0200 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: References: <4F9320F7.3010009@fastmail.fm> <436F6F6E-1131-4DC8-846B-0B0CC4C92CD8@cs.otago.ac.nz> <4F94BE6A.5010906@fastmail.fm> <049bd08514a53fb92bdc31699b438c8c.squirrel@chasm.otago.ac.nz> <4F951F75.4090708@fastmail.fm> <1EEF2F3F-A943-487F-A677-0AEAE24668FF@cs.otago.ac.nz> <4F95E025.1000404@fastmail.fm> <87C1D9BF-4845-487A-A1FE-7CEC91FA4C90@cs.otago.ac.nz> <4F965B38.1000302@fastmail.fm> <728E8F42-1626-450E-AE2C-2EB9ECDF48F0@cs.otago.ac.nz> <4F990D31.8070309@fastmail.fm> <8D0F33D1-9E34-4D3A-B12A-25FBE3065CB7@cs.otago.ac.nz> <4F99DE96.2010006@fastmail.fm> Message-ID: <4F9A58E9.40409@fastmail.fm> Michael Turner schrieb: > I hope you don't have any additional words > to re-emphasize what you mean by "Bye." > -michael turner I guess contrary to ROK you are the simple minded type and not able to dwell into arguments. Tip: If you don't have something to say and feel that void in your brain, step back from the keyboard. Bye From gianfranco.alongi@REDACTED Fri Apr 27 10:33:53 2012 From: gianfranco.alongi@REDACTED (Gianfranco Alongi) Date: Fri, 27 Apr 2012 10:33:53 +0200 Subject: [erlang-questions] Fwd: Erlang Job for $5000 in Saint-Petersburg In-Reply-To: References: <4F990A78.5060501@rabbitmq.com> <4F9910A3.2030500@llaisdy.com> <8FEF2536-1F35-442C-BFD1-7AF4BD2FF281@cs.otago.ac.nz> Message-ID: Do you mind continuing the discussion outside the erlang mailing list? /Cheers On Apr 27, 2012 9:06 AM, "Max Lapshin" wrote: > > Other languages, like Russian, have not done this, and I wonder > > whether the same issue arises there? > > > > It sounds very silly when someone tries to speak genderless in > Russian, because of some grammar differences between English and > Russian. > > > I can say you even more: you can offence to women's feelings if you > call her profession in a femine gender. > For example, if she is a doctor and usually we use the word "doctor", > but you say that she is a "doctorsha" (femine variant of word > "doctor") she may add some phenolphthalein to your cure. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hynek@REDACTED Fri Apr 27 11:07:37 2012 From: hynek@REDACTED (Hynek Vychodil) Date: Fri, 27 Apr 2012 11:07:37 +0200 Subject: [erlang-questions] Stripping slashes from a string In-Reply-To: <4F9A4A91.2010005@gmail.com> References: <4F9A2BD5.2080907@gmail.com> <4F9A450E.5060508@gmail.com> <4F9A489D.4050109@gmail.com> <4F9A4A91.2010005@gmail.com> Message-ID: Wouldn't be this simple code far faster and simpler (especially compiled with HiPE): replace([$\\, $n | T]) -> [$\n, replace(T)]; replace([$\\, $r | T]) -> [$\r, replace(T)]; replace([H | T]) -> [H | replace(T)]; replace([]) -> []. I'm always curious why people tend to use RE instead of few lines of very simple code especially in Erlang. Cheers Hynek On Fri, Apr 27, 2012 at 9:28 AM, Martin Dimitrov wrote: > Hi, > > What I am trying to achieve is not to convert "\\\\n" to "\\n" but "\\n" > to [10]. > > Martin > > On 4/27/2012 10:24 AM, Sergei Golovan wrote: >> On Fri, Apr 27, 2012 at 11:19 AM, Martin Dimitrov >> wrote: >>> With 6 it produces double backslashes making the result equivalent to >>> the initial text: >> True, I oversaw that the replacing regexp was incorrect too (also, the >> string itself). >> >> 1> re:replace("\\\\r \\\\n text", "\\\\\\\\(r|n)", "\\\\\\1", >> [{return,list}, global, unicode]). >> "\\r \\n text" >> 2> >> >> works fine. >> >> Cheers! > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From mrtndimitrov@REDACTED Fri Apr 27 11:28:58 2012 From: mrtndimitrov@REDACTED (Martin Dimitrov) Date: Fri, 27 Apr 2012 12:28:58 +0300 Subject: [erlang-questions] Stripping slashes from a string In-Reply-To: References: <4F9A2BD5.2080907@gmail.com> <4F9A450E.5060508@gmail.com> <4F9A489D.4050109@gmail.com> <4F9A4A91.2010005@gmail.com> Message-ID: <4F9A66DA.4020208@gmail.com> This is beautiful. Thank you. On 4/27/2012 12:07 PM, Hynek Vychodil wrote: > Wouldn't be this simple code far faster and simpler (especially > compiled with HiPE): > > replace([$\\, $n | T]) -> [$\n, replace(T)]; > replace([$\\, $r | T]) -> [$\r, replace(T)]; > replace([H | T]) -> [H | replace(T)]; > replace([]) -> []. > > I'm always curious why people tend to use RE instead of few lines of > very simple code especially in Erlang. > > Cheers > Hynek > > On Fri, Apr 27, 2012 at 9:28 AM, Martin Dimitrov wrote: >> Hi, >> >> What I am trying to achieve is not to convert "\\\\n" to "\\n" but "\\n" >> to [10]. >> >> Martin >> >> On 4/27/2012 10:24 AM, Sergei Golovan wrote: >>> On Fri, Apr 27, 2012 at 11:19 AM, Martin Dimitrov >>> wrote: >>>> With 6 it produces double backslashes making the result equivalent to >>>> the initial text: >>> True, I oversaw that the replacing regexp was incorrect too (also, the >>> string itself). >>> >>> 1> re:replace("\\\\r \\\\n text", "\\\\\\\\(r|n)", "\\\\\\1", >>> [{return,list}, global, unicode]). >>> "\\r \\n text" >>> 2> >>> >>> works fine. >>> >>> Cheers! >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions From robert.virding@REDACTED Fri Apr 27 11:32:47 2012 From: robert.virding@REDACTED (Robert Virding) Date: Fri, 27 Apr 2012 10:32:47 +0100 (BST) Subject: [erlang-questions] How to debug handle_info EXIT message? In-Reply-To: <4F97E902.8070709@gmail.com> Message-ID: <6a4be261-a9b5-4b15-9848-b1d699f2d600@knuth> The message is sent to gen_server because it was trapping exits and was linked to the other process. This message comes from the exit signal the other process (automatically) sent out when it died*. So it no longer exists and it is impossible to do process_info on it. *As the gen_server is trapping exits then all exit signals which it receives are automatically converted into messages which it can 'receive' in the normal manner. The gen_server behaviour receives the message, recognises it as something recognise and so calls handle_info/2 to allow the callback module to process it. N.B. exist signals are NOT messages, it is trapping exists which converts them to messages. Robert ----- Original Message ----- > The puzzling thing is that this message appears 1-2 sec after the > start > of the gen_server without any further interaction with it. At the end > of > Module:init/1 function I try to print information about this process: > > process_info(list_to_pid("<0.2637.0>")) > > but returns 'undefined'. > > On 4/25/2012 11:42 AM, Ladislav Lenart wrote: > > Hello. > > > > The process <0.2637.0> terminated with reason 'normal'. Your > > gen_server process > > received the 'EXIT' message because: > > * <0.2637.0> and your gen_server were linked together AND > > * your gen_server is trapping exits, i.e. it invoked > > process_flag(trap_exit, > > true) in its init/1. > > > > See also the following documentation: > > * process_flag/2 - > > http://www.erlang.org/doc/man/erlang.html#process_flag-2 > > * spawn_link/1 - > > http://www.erlang.org/doc/man/erlang.html#spawn_link-1 > > * link/1 - http://www.erlang.org/doc/man/erlang.html#link-1 > > > > > > HTH, > > > > Ladislav Lenart > > > > > > On 25.4.2012 09:49, Martin Dimitrov wrote: > >> Hello, > >> > >> I receive in a module implementing gen_server behavior in the > >> function > >> handle_info/2 the following message: > >> > >> {'EXIT',<0.2637.0>,normal} > >> > >> What is the reason to receive this message? The process <0.2637.0> > >> was > >> spawned by this gen_server and then died? Is it possible to get > >> more > >> information about this process after it has died since > >> process_info/1 > >> returns undefined? > >> > >> Thank you very much for looking at this. > >> > >> Best Regards, > >> > >> Martin > >> _______________________________________________ > >> erlang-questions mailing list > >> erlang-questions@REDACTED > >> http://erlang.org/mailman/listinfo/erlang-questions > >> > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From michael.eugene.turner@REDACTED Fri Apr 27 12:18:15 2012 From: michael.eugene.turner@REDACTED (Michael Turner) Date: Fri, 27 Apr 2012 19:18:15 +0900 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: <4F9A58E9.40409@fastmail.fm> References: <4F9320F7.3010009@fastmail.fm> <436F6F6E-1131-4DC8-846B-0B0CC4C92CD8@cs.otago.ac.nz> <4F94BE6A.5010906@fastmail.fm> <049bd08514a53fb92bdc31699b438c8c.squirrel@chasm.otago.ac.nz> <4F951F75.4090708@fastmail.fm> <1EEF2F3F-A943-487F-A677-0AEAE24668FF@cs.otago.ac.nz> <4F95E025.1000404@fastmail.fm> <87C1D9BF-4845-487A-A1FE-7CEC91FA4C90@cs.otago.ac.nz> <4F965B38.1000302@fastmail.fm> <728E8F42-1626-450E-AE2C-2EB9ECDF48F0@cs.otago.ac.nz> <4F990D31.8070309@fastmail.fm> <8D0F33D1-9E34-4D3A-B12A-25FBE3065CB7@cs.otago.ac.nz> <4F99DE96.2010006@fastmail.fm> <4F9A58E9.40409@fastmail.fm> Message-ID: > I guess contrary to ROK you are the > simple minded type and not able to > dwell into arguments. Tip: If you > don't have something to say and feel > that void in your brain, step back > from the keyboard. > > Bye I actually do have something to say regarding object-orientation in Erlang. But I already said it: http://erlang.2086793.n4.nabble.com/Erlang-quot-object-oriented-quot-after-all-td2101240.html And Joe Armstrong agreed, rather emphatically, which is about all I need to hear. Richard is right: if there's anything corresponding to the concept of "object" in Erlang, it's "process", not "record." Note my "if". Processes are well-defined in Erlang. So are records. "Object" never got a consensus definition in software engineering. Pontificate all you want on what you consider the essence of object-oriented programming. You'll always get an objection -- from another OO pontiff, usually. Also, so long as we're dwelling on semantics here: in English, "bye", in the context of a discussion, means, "I'm leaving the discussion." In heated discussions, it has the added nuance of "... because you're a waste of time." And with that ... Bye. -michael turner On Fri, Apr 27, 2012 at 5:29 PM, Jan Burse wrote: > Michael Turner schrieb: > >> I hope you don't have any additional words >> to re-emphasize what you mean by "Bye." >> -michael turner > > From janburse@REDACTED Fri Apr 27 13:08:59 2012 From: janburse@REDACTED (Jan Burse) Date: Fri, 27 Apr 2012 13:08:59 +0200 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: References: <4F9320F7.3010009@fastmail.fm> <436F6F6E-1131-4DC8-846B-0B0CC4C92CD8@cs.otago.ac.nz> <4F94BE6A.5010906@fastmail.fm> <049bd08514a53fb92bdc31699b438c8c.squirrel@chasm.otago.ac.nz> <4F951F75.4090708@fastmail.fm> <1EEF2F3F-A943-487F-A677-0AEAE24668FF@cs.otago.ac.nz> <4F95E025.1000404@fastmail.fm> <87C1D9BF-4845-487A-A1FE-7CEC91FA4C90@cs.otago.ac.nz> <4F965B38.1000302@fastmail.fm> <728E8F42-1626-450E-AE2C-2EB9ECDF48F0@cs.otago.ac.nz> <4F990D31.8070309@fastmail.fm> <8D0F33D1-9E34-4D3A-B12A-25FBE3065CB7@cs.otago.ac.nz> <4F99DE96.2010006@fastmail.fm> <4F9A58E9.40409@fastmail.fm> Message-ID: <4F9A7E4B.7020900@fastmail.fm> Michael Turner schrieb: > Richard is right: if there's anything corresponding to the concept of > "object" in Erlang, it's "process", not "record." Note my "if". > Processes are well-defined in Erlang. So are records. "Object" never > got a consensus definition in software engineering. Pontificate all > you want on what you consider the essence of object-oriented > programming. You'll always get an objection -- from another OO > pontiff, usually. Thank you for misunderstanding me. If you are only looking at what is currently in Erlang, you might be right that process are more closes to objects than records are. But the current discussion is not only about the present but also about possible futures, in particular proposals such as frames. And inside this discussion I take OO as a constrast, to compare with. In particular I prefer taking OO as found in Java as a contrast, since this lives in present and neither in the past or future. I am particular interested in solving some inherent problem with frames, that bothered me already in the 90's. If it were possible to create a frame data structure with very good footprint and performance properties, I would have used it already back then. But when I looked at it back then, I found some inherent limitations that I guess cannot be overcome, except if you can walk on water or turn water into wine, i.e. if there is a miracle. I guess there are theoretical papers around that show these limitations inherent in polymorphism. If I have time I can post some links here. So if somebody claims to have solved this and that problem, either indepedent of some programming language or inside some programming language specification, I always get suspicious. And sorry my "bye" is not that "bye" that you would like to think of. I am interested in sorting the thing out, since I might learn something. 90's is already a long time ago, and discoveries might have been made. For example there have been some interesting developments in data structures for functional programming languages, that are immutable from the outside, but might use destructive operations in the inside. Etc.. But statements as follows: ROK wrote: > Frames make do without *any* static type information; > that's what the design is about. But they can take > advantage of type information if available. Are especially dangerous. They insuinate that late binding (*) can be solved performance wise. I am primarily concerned with the idea that some borders can be pushed that have not already been push for example by my contrast OO language Java. So I am awaiting clarification: JB wrote: > In which proposal is this substantiated? Bye (*) http://en.wikipedia.org/wiki/Late_binding From zhengsyao@REDACTED Fri Apr 27 13:23:26 2012 From: zhengsyao@REDACTED (=?utf-8?Q?=22Siyao_Zheng=28=E9=83=91=E6=80=9D=E9=81=A5=29=22?=) Date: Fri, 27 Apr 2012 19:23:26 +0800 Subject: [erlang-questions] About Erlang SMP scheduler Message-ID: <0F4D9489-7755-4FD2-8831-E4BEE2A8C8F1@gmail.com> Hi, In SMP version of Erlang, every scheduler periodically call "check_balance()" to check load balance among all schedulers, then it might migrate some processes to balance load, or shut down some schedulers with low load. Does anyone know why scheduler should do this? check_balance() is quite a big one, and it has to lock every run queue when it checks the run queue. I think it's quite a big cost here. The work stealing at each schedule step afterwards actually does work load balance very well. Actually after I comment out the check_balance() step and run BigBang and Hackbench benchmarks, they are really faster! So, I wonder what is the purpose of check_balance() step here, if it is related to scalability on many core processors or something, and if there is any other benchmark I can run to prove its usefulness. Cheers! Siyao From ulf@REDACTED Fri Apr 27 13:45:03 2012 From: ulf@REDACTED (Ulf Wiger) Date: Fri, 27 Apr 2012 13:45:03 +0200 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: <4F9A7E4B.7020900@fastmail.fm> References: <4F9320F7.3010009@fastmail.fm> <436F6F6E-1131-4DC8-846B-0B0CC4C92CD8@cs.otago.ac.nz> <4F94BE6A.5010906@fastmail.fm> <049bd08514a53fb92bdc31699b438c8c.squirrel@chasm.otago.ac.nz> <4F951F75.4090708@fastmail.fm> <1EEF2F3F-A943-487F-A677-0AEAE24668FF@cs.otago.ac.nz> <4F95E025.1000404@fastmail.fm> <87C1D9BF-4845-487A-A1FE-7CEC91FA4C90@cs.otago.ac.nz> <4F965B38.1000302@fastmail.fm> <728E8F42-1626-450E-AE2C-2EB9ECDF48F0@cs.otago.ac.nz> <4F990D31.8070309@fastmail.fm> <8D0F33D1-9E34-4D3A-B12A-25FBE3065CB7@cs.otago.ac.nz> <4F99DE96.2010006@fastmail.fm> <4F9A58E9.40409@fastmail.fm> <4F9A7E4B.7020900@fastmail.fm> Message-ID: <553DE821-D5C4-4A91-99B3-D890E225A93A@feuerlabs.com> On 27 Apr 2012, at 13:08, Jan Burse wrote: > ROK wrote: > > Frames make do without *any* static type information; > > that's what the design is about. But they can take > > advantage of type information if available. > > Are especially dangerous. They insuinate that late > binding (*) can be solved performance wise. Not really. It merely points out that it is designed to operate in a setting where no (or extremely limited) static type information is available. This has performance repercussions, but there isn't much ROK can do about that. If there is no static type information to work with, the frames construct will have to do without. It would be possible to envision a future erlang version that has a closer integration of types, and thus more type information available at compile-time. I read Richard's statement as saying that, in that event, frames would be able to operate more efficiently. Adding static types to Erlang is not merely a technical challenge. Erlang is an industrial language which takes backward compatibility very seriously. A broader view of BW compatibility is that one has to think very carefully before fundamentally changing the nature of the language, even if the change would, technically speaking, not break legacy code. BR, Ulf W Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com From janburse@REDACTED Fri Apr 27 13:46:28 2012 From: janburse@REDACTED (Jan Burse) Date: Fri, 27 Apr 2012 13:46:28 +0200 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: <4F9A7E4B.7020900@fastmail.fm> References: <4F9320F7.3010009@fastmail.fm> <436F6F6E-1131-4DC8-846B-0B0CC4C92CD8@cs.otago.ac.nz> <4F94BE6A.5010906@fastmail.fm> <049bd08514a53fb92bdc31699b438c8c.squirrel@chasm.otago.ac.nz> <4F951F75.4090708@fastmail.fm> <1EEF2F3F-A943-487F-A677-0AEAE24668FF@cs.otago.ac.nz> <4F95E025.1000404@fastmail.fm> <87C1D9BF-4845-487A-A1FE-7CEC91FA4C90@cs.otago.ac.nz> <4F965B38.1000302@fastmail.fm> <728E8F42-1626-450E-AE2C-2EB9ECDF48F0@cs.otago.ac.nz> <4F990D31.8070309@fastmail.fm> <8D0F33D1-9E34-4D3A-B12A-25FBE3065CB7@cs.otago.ac.nz> <4F99DE96.2010006@fastmail.fm> <4F9A58E9.40409@fastmail.fm> <4F9A7E4B.7020900@fastmail.fm> Message-ID: <4F9A8714.1010400@fastmail.fm> Jan Burse schrieb: > > Are especially dangerous. They insuinate that late > binding (*) can be solved performance wise. I am primarily > concerned with the idea that some borders can be pushed > that have not already been push for example by my contrast > OO language Java. So I am awaiting clarification: > > JB wrote: > > In which proposal is this substantiated? For example one solution is to use global oriented vtables. That is the keys name space leads to indexes, and all frames will have the same eventually very large vtable. I am currently using this approach for Jekejeke Prolog, for thread local predicates. But would be interested in alternative solutions. Here processes not only have state inside their local variables of their tail recursive predicates as in Erlang, but predicate modifications can be also local to the processes, not sure whether this has made its way into Erlang. It is very useful for hypothetical reasoning inside a process. Many Prolog systems do have this in one or the other form. XSB calls it private and not thread local. Some Prolog system probably implement it by the thread local support found in some C compilers. I don't implement it via ThreadLocal found in Java. You might want give it a try, its still experimental: http://www.jekejeke.ch/idatab/doclet/prod/en/docs/05_run/02_reference/07_theories/06_system/04_thread.html The performance penalty is practically zero in Jekejeke Prolog. My thread local predicates have the same speed as the normal predicates. There is one advantage for thread local predicates, they don't need synchronization compared to normal predicates. This probably compensates the additional indirection via the global oriented vtables. But the global oriented vtables solution doesn't need type information. It only needs generation of sernos for key names, i.e. atoms and caching of these sernos inside the code that is executed. So without type information one will have at least amortized cost of O(1) for: frame_has/2 frame_value/2 frame_find/2 The other operations that generate new frames, are also not that expensive, but there is no yet support for them. So for example copying one clauses from one predicate in one process to another predicate in another process would not be slowed down by finding the predicate. This could be use for message passing. Bye From janburse@REDACTED Fri Apr 27 13:57:06 2012 From: janburse@REDACTED (Jan Burse) Date: Fri, 27 Apr 2012 13:57:06 +0200 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: <4F9A8714.1010400@fastmail.fm> References: <4F9320F7.3010009@fastmail.fm> <436F6F6E-1131-4DC8-846B-0B0CC4C92CD8@cs.otago.ac.nz> <4F94BE6A.5010906@fastmail.fm> <049bd08514a53fb92bdc31699b438c8c.squirrel@chasm.otago.ac.nz> <4F951F75.4090708@fastmail.fm> <1EEF2F3F-A943-487F-A677-0AEAE24668FF@cs.otago.ac.nz> <4F95E025.1000404@fastmail.fm> <87C1D9BF-4845-487A-A1FE-7CEC91FA4C90@cs.otago.ac.nz> <4F965B38.1000302@fastmail.fm> <728E8F42-1626-450E-AE2C-2EB9ECDF48F0@cs.otago.ac.nz> <4F990D31.8070309@fastmail.fm> <8D0F33D1-9E34-4D3A-B12A-25FBE3065CB7@cs.otago.ac.nz> <4F99DE96.2010006@fastmail.fm> <4F9A58E9.40409@fastmail.fm> <4F9A7E4B.7020900@fastmail.fm> <4F9A8714.1010400@fastma il.fm> Message-ID: <4F9A8992.7080203@fastmail.fm> Jan Burse schrieb: > For example one solution is to use global oriented > vtables. That is the keys name space leads to indexes, > and all frames will have the same eventually very large > vtable. I am currently using this approach for > Jekejeke Prolog, for thread local predicates. But > would be interested in alternative solutions. One more indirection and clever caching, I guess it could be made more sparse to have zillions of similar frames (so that both footprint and performance is ok, and not only performance). Not yet implemented in Jekejeke Prolog. Pure speculation, did not work it out or write it on a back of an envelope. Just an idea, since the sparseness problem bothers me. From claudef@REDACTED Fri Apr 27 14:29:26 2012 From: claudef@REDACTED (claudef@REDACTED) Date: Fri, 27 Apr 2012 09:29:26 -0300 Subject: [erlang-questions] Issues with Erlang Build under SUSE SLES 11 SP 1 on S390 In-Reply-To: References: Message-ID: Dear colleagues, When including SSL support, I'm still having an issue during the build of Erlang from the source under SUSE SLES 11 SP1 S390 platform. The error remains in the Erlang crypto module (openssl) and relates to a missing -fPIC compiler flag. I've tried to set the following flags to force the -fPIC flag. export CFLAGS="$CFLAGS -fPIC" export CXXFLAGS="$CXXFLAGS -fPIC" export CC="gcc -fPIC" The -fPIC flag shows shows up in the previous gcc executions, but in this step it gets overwritten by the -shared option. Is there any option that configures the compile of the crypto module, or a place where I could modify this argument? make ... make[3]: Entering directory `/opt/erlang/otp_src_R14B03/lib/crypto/c_src' make -f s390x-ibm-linux-gnu/Makefile TYPE=opt make[4]: Entering directory `/opt/erlang/otp_src_R14B03/lib/crypto/c_src' /usr/bin/install -c -d ../priv/lib/s390x-ibm-linux-gnu gcc -fPIC -shared -Wl,-Bsymbolic -o ../priv/lib/s390x-ibm-linux-gnu/crypto.so ../priv/obj/s390x-ibm-linux-gnu/crypto.o -Wl,-R/usr/local/ssl/lib -Wl,-R/usr/local/lib64 -Wl,-R/usr/sfw/lib64 -Wl,-R/opt/local/lib64 -Wl,-R/usr/lib64 -Wl,-R/usr/pkg/lib64 -Wl,-R/usr/local/openssl/lib64 -Wl,-R/usr/lib/openssl/lib64 -Wl,-R/usr/openssl/lib64 -Wl,-R/usr/local/ssl/lib64 -Wl,-R/usr/lib/ssl/lib64 -Wl,-R/usr/ssl/lib64 -Wl,-R/usr/local/lib -Wl,-R/usr/sfw/lib -Wl,-R/opt/local/lib -Wl,-R/usr/lib -Wl,-R/usr/pkg/lib -Wl,-R/usr/local/openssl/lib -Wl,-R/usr/lib/openssl/lib -Wl,-R/usr/openssl/lib -Wl,-R/usr/lib/ssl/lib -Wl,-R/usr/ssl/lib -L/usr/local/ssl/lib -lcrypto /usr/lib64/gcc/s390x-suse-linux/4.3/../../../../s390x-suse-linux/bin/ld: /usr/local/ssl/lib/libcrypto.a(mem_clr.o): relocation R_390_PC32DBL against `memchr@@GLIBC_2.2' can not be used when making a shared object; recompile with -fPIC /usr/lib64/gcc/s390x-suse-linux/4.3/../../../../s390x-suse-linux/bin/ld: final link failed: Bad value collect2: ld returned 1 exit status make[4]: *** [../priv/lib/s390x-ibm-linux-gnu/crypto.so] Error 1 make[4]: Leaving directory `/opt/erlang/otp_src_R14B03/lib/crypto/c_src' make[3]: *** [opt] Error 2 make[3]: Leaving directory `/opt/erlang/otp_src_R14B03/lib/crypto/c_src' make[2]: *** [opt] Error 2 make[2]: Leaving directory `/opt/erlang/otp_src_R14B03/lib/crypto' make[1]: *** [opt] Error 2 make[1]: Leaving directory `/opt/erlang/otp_src_R14B03/lib' make: *** [libs] Error 2 Thanks in advance for your support. Regards, Claude Claude Falbriard Certified IT Specialist L2 - Middleware AMS Hortol?ndia / SP - Brazil phone: +55 19 9837 0789 cell: +55 13 8117 3316 e-mail: claudef@REDACTED From: CGS To: claudef@REDACTED Cc: erlang-questions@REDACTED Date: 26/04/2012 18:27 Subject: Re: [erlang-questions] Issues with Erlang Build under SUSE SLES 11 SP 1 on S390 I suppose you can pass --with-ssl-lib=SSL_LIBRARY_PATH and --with-ssl-include=SSL_INCLUDE_PATH. And, yes, there should be libopenssl-devel under SuSE. CGS On Thu, Apr 26, 2012 at 8:20 PM, wrote: Dear colleagues, Thanks, for the quick reply. The issue with the crypto.c clearly relates to OpenSSL. Unfortunately an openssl-devel package is not available from Novell SUSE. I've downloaded the latest source packages of Kerberos 5 (MIT) and as well as OpenSSL. Remains some doubts how to use the configuration arguments described in the Erlang install process --with-ssl=PATH - Specify location of OpenSSL include and lib Is there an example how to setup this PATH? Questions: 1 - What exactly goes into the PATH argument of with-ssl= ? Is there an example how to use it? 2 - Why does the /configure shell search for the krb5.h only under the location of /usr/include Those are the locations generated by Kerberos5: /usr/local/include/krb5.h /usr/local/include/krb5/krb5.h and for the openssl package /usr/local/ssl/bin/openssl /usr/local/ssl/include/openssl 3. Any modules need to be placed under /usr/include (default path of ./configure) ? Thanks in advance for your support to add crypto (ssl) suport to Erlang. Regards, Claude Claude Falbriard Certified IT Specialist L2 - Middleware AMS Hortol?ndia / SP - Brazil phone: +55 19 9837 0789 cell: +55 13 8117 3316 e-mail: claudef@REDACTED From: CGS To: claudef@REDACTED Cc: Erlang-Questions Questions Date: 26/04/2012 10:03 Subject: Re: [erlang-questions] Issues with Erlang Build under SUSE SLES 11 SP 1 on S390 Hi, I suppose you need to install OpenSSL-dev (from the error it looks like you are missing some OpenSSL headers). CGS On Thu, Apr 26, 2012 at 2:17 PM, wrote: Dear colleagues, I'm compiling an Erlang environment under the SUSE SLES 11 SP1 on a S390 platform building it from the source. I'm facing an error condition when adding the support for OpenSSL and Erlang "crypto" support using the following configuration: ./configure --with-ssl --with-ssl=/usr/lib64/openssl The configure completes normal, but the subsequent "make" step throws a sequence of errors like this: .. crypto.c: In function ?hmac_md5?: crypto.c:1713: error: ?MD5_CTX? undeclared (first use in this function) crypto.c:1713: error: expected ?;? before ?ctx? crypto.c:1714: warning: ISO C90 forbids mixed declarations and code crypto.c:1737: error: ?ctx? undeclared (first use in this function) crypto.c: In function ?hmac_sha1?: crypto.c:1752: error: ?SHA_CTX? undeclared (first use in this function) crypto.c:1752: error: expected ?;? before ?ctx? crypto.c:1753: warning: ISO C90 forbids mixed declarations and code crypto.c:1776: error: ?ctx? undeclared (first use in this function) make[4]: *** [../priv/obj/s390x-ibm-linux-gnu/crypto.o] Error 1 make[4]: Leaving directory `/opt/erlang/otp_src_R14B03/lib/crypto/c_src' make[3]: *** [opt] Error 2 make[3]: Leaving directory `/opt/erlang/otp_src_R14B03/lib/crypto/c_src' make[2]: *** [opt] Error 2 make[2]: Leaving directory `/opt/erlang/otp_src_R14B03/lib/crypto' make[1]: *** [opt] Error 2 make[1]: Leaving directory `/opt/erlang/otp_src_R14B03/lib' make: *** [libs] Error 2 .. Without OpenSSL support, the Erlang package compiles successfully and I've tested it with the console prompt. Thanks in advance for your hints how to fix this issue with the crypto module. Regards, Claude Claude Falbriard Certified IT Specialist L2 - Middleware AMS Hortol?ndia / SP - Brazil phone: +55 19 9837 0789 cell: +55 13 8117 3316 e-mail: claudef@REDACTED _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan@REDACTED Fri Apr 27 14:31:26 2012 From: ivan@REDACTED (Ivan Uemlianin) Date: Fri, 27 Apr 2012 13:31:26 +0100 Subject: [erlang-questions] Fwd: Erlang Job for $5000 in Saint-Petersburg In-Reply-To: <8FEF2536-1F35-442C-BFD1-7AF4BD2FF281@cs.otago.ac.nz> References: <4F990A78.5060501@rabbitmq.com> <4F9910A3.2030500@llaisdy.com> <8FEF2536-1F35-442C-BFD1-7AF4BD2FF281@cs.otago.ac.nz> Message-ID: <4F9A919E.6080905@llaisdy.com> On 26/04/2012 23:58, Richard O'Keefe wrote: > > On 26/04/2012, at 9:08 PM, Ivan Uemlianin wrote: > >> fwiw colloquial British English uses "their" for his/her ("they" for he/she, and "them" for him/her). It's quite serviceable. > > However some native speakers of English find that unappealing. Granted. I do hear it a lot though. > In this case, as very often happens, the sentence could have been > easily reworded to say "your". I agree. 2nd person is best for job notices. (Apologies to Gianfranco Alongi;) Ivan -- ============================================================ Ivan A. Uemlianin Llaisdy Speech Technology Research and Development ivan@REDACTED www.llaisdy.com llaisdy.wordpress.com github.com/llaisdy www.linkedin.com/in/ivanuemlianin "Froh, froh! Wie seine Sonnen, seine Sonnen fliegen" (Schiller, Beethoven) ============================================================ From carlsson.richard@REDACTED Fri Apr 27 15:06:05 2012 From: carlsson.richard@REDACTED (Richard Carlsson) Date: Fri, 27 Apr 2012 15:06:05 +0200 Subject: [erlang-questions] useful trick for finding record instantiations Message-ID: <4F9A99BD.7090208@gmail.com> It's not unusual when working with some legacy code that you want to find all the locations that instantiate a certain record using the #foo{...} syntax, so that you can replace those with calls to a function that controls the instantiation for better encapsulation: init_foo(...) -> #foo{...}. However, you can't easily grep for '#foo{' because of all the patterns that have the same syntax, '= #foo{' misses cases where a record is instantiated as the argument of a function call, and so on. It's hard to know that you've found all the occurrences. This little trick works pretty well, though: you add a dummy field to the record definition (usually in a header file): -record(foo, {'$hidden' = 1/0, ...}). This will not cause errors or warnings at the point of the record declaration, so modules that include the header file and just use the record for pattern matching and field accesses will compile cleanly. But instantiations of the record, such as 'X=#foo{...}', will cause the compiler to warn that "this expression will fail with a 'badarith' exception". Only instantiations that override this locally will not trigger the warning. Since you just added that field, there should not be any cases like that in the code, apart from the one you write in your new instantiator function: init_foo(...) -> #foo{'$hidden'=[], ...}. The exception is that if you have a record instantiation on the form '#foo{..., _=Default}', which overrides the default setting for all fields not explicitly mentioned (usually only used in match specs). You can use this to suppress the warning in places like unit tests where you might want to allow direct instantiation. Of course, once you're done refactoring and have all instantiations under control, you remove the dummy field again (in particular if it's used for a mnesia table). Have a nice weekend, /Richard From robert.virding@REDACTED Fri Apr 27 15:38:52 2012 From: robert.virding@REDACTED (Robert Virding) Date: Fri, 27 Apr 2012 14:38:52 +0100 (BST) Subject: [erlang-questions] Fwd: Erlang Job for $5000 in Saint-Petersburg In-Reply-To: <2921925898744828063@unknownmsgid> Message-ID: Actually the french might object to this seeing history has nothing to do with stories, either his or hers, but comes from the word "histoire". Of course they might just shake their head an pity us. And I would agree with them. Robert ----- Original Message ----- > Just to follow your logic, "history" does not look politically > correct. Should it be renamed into "herstory" or maybe "itstory" to > be > sure that nobody complains (even a small group of non traditional > folks)? > > ;-) > > Best Regards, > Dmitry >-|-|-*> > > > On 26.4.2012, at 11.42, Francesco Mazzoli > wrote: > > >> I'm sorry, but I can't find where I've used the word "men" :) > >> > >> Actually men and women, elves and dwarfs are looked for, but no > >> trolls, > >> sorry ;) > > > > He's referring to the "his" by the end of the post, which is > > nitpicking, also considering that English does not have an gender > > "unspecific" possessive pronoun, and writing his/her each time is > > annoying. > > > > Francesco. > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From zabrane3@REDACTED Fri Apr 27 15:40:43 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Fri, 27 Apr 2012 15:40:43 +0200 Subject: [erlang-questions] About Erlang SMP scheduler In-Reply-To: <0F4D9489-7755-4FD2-8831-E4BEE2A8C8F1@gmail.com> References: <0F4D9489-7755-4FD2-8831-E4BEE2A8C8F1@gmail.com> Message-ID: Hi Siyao, Which "check_balance" you've commented out? Here is what I found so far: $ find /otp_src_R15B01 -type f | xargs grep check_balance | grep -v matches /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c: int forced_check_balance; /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c:check_balance(ErtsRunQueue *c_rq) /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c:# error check_balance() assumes ERTS_MAX_PROCESS < (1 << 27) /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c: c_rq->check_balance_reds = INT_MAX; /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c: c_rq->check_balance_reds = INT_MAX; /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c: rq->check_balance_reds = ERTS_RUNQ_CALL_CHECK_BALANCE_REDS; /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c: * check_balance() is never called in more threads /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c: forced = balance_info.forced_check_balance; /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c: balance_info.forced_check_balance = 0; /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c: c_rq->check_balance_reds = INT_MAX; /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c: rq->check_balance_reds = INT_MAX; /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c: rq->check_balance_reds = ERTS_RUNQ_CALL_CHECK_BALANCE_REDS; /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c: rq->check_balance_reds = ERTS_RUNQ_CALL_CHECK_BALANCE_REDS; /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c: balance_info.forced_check_balance = 0; /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c: (RQ)->check_balance_reds = ERTS_RUNQ_CALL_CHECK_BALANCE_REDS; \ /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c: balance_info.forced_check_balance = 1; /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c: ERTS_RUNQ_IX(0)->check_balance_reds = 0; /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c: if (rq->check_balance_reds <= 0) /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c: check_balance(rq); /opt/otp_src_R15B01/erts/emulator/beam/erl_process.h: int check_balance_reds; /opt/otp_src_R15B01/erts/emulator/beam/erl_process.h: (RQ)->check_balance_reds -= (REDS); \ /opt/otp_src_R15B01/erts/emulator/beam/erl_process.h: (RQ)->check_balance_reds -= (REDS); [...] For OTP Team: is this dangerous ? Regards, Zabrane On Apr 27, 2012, at 1:23 PM, Siyao Zheng(???) wrote: > Hi, > > In SMP version of Erlang, every scheduler periodically call "check_balance()" to check load balance among all schedulers, then it might migrate some processes to balance load, or shut down some schedulers with low load. Does anyone know why scheduler should do this? check_balance() is quite a big one, and it has to lock every run queue when it checks the run queue. I think it's quite a big cost here. The work stealing at each schedule step afterwards actually does work load balance very well. Actually after I comment out the check_balance() step and run BigBang and Hackbench benchmarks, they are really faster! > > So, I wonder what is the purpose of check_balance() step here, if it is related to scalability on many core processors or something, and if there is any other benchmark I can run to prove its usefulness. > > Cheers! > > Siyao > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From zhengsyao@REDACTED Fri Apr 27 15:58:32 2012 From: zhengsyao@REDACTED (=?utf-8?Q?=22Siyao_Zheng=28=E9=83=91=E6=80=9D=E9=81=A5=29=22?=) Date: Fri, 27 Apr 2012 21:58:32 +0800 Subject: [erlang-questions] About Erlang SMP scheduler In-Reply-To: References: <0F4D9489-7755-4FD2-8831-E4BEE2A8C8F1@gmail.com> Message-ID: <2FF9F129-C96C-48C2-BFE9-223F591D624B@gmail.com> Hi, schedule(), in which check_balance() is only called. In schedule(), when check_balance_reds reaches zero, scheduler decides to "check_balance". But later in schedule(), when scheduler finds run queue being empty, it will try to steal task from other schedulers (by calling try_steal_task()), which is also a load balance mechanism. I'm just wondering what the purpose of check_balance(). Cheers Siyao On Apr 27, 2012, at 9:40 PM, Zabrane Mickael wrote: > Hi Siyao, > > Which "check_balance" you've commented out? > > Here is what I found so far: > > $ find /otp_src_R15B01 -type f | xargs grep check_balance | grep -v matches > /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c: int forced_check_balance; > /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c:check_balance(ErtsRunQueue *c_rq) > /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c:# error check_balance() assumes ERTS_MAX_PROCESS < (1 << 27) > /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c: c_rq->check_balance_reds = INT_MAX; > /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c: c_rq->check_balance_reds = INT_MAX; > /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c: rq->check_balance_reds = ERTS_RUNQ_CALL_CHECK_BALANCE_REDS; > /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c: * check_balance() is never called in more threads > /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c: forced = balance_info.forced_check_balance; > /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c: balance_info.forced_check_balance = 0; > /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c: c_rq->check_balance_reds = INT_MAX; > /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c: rq->check_balance_reds = INT_MAX; > /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c: rq->check_balance_reds = ERTS_RUNQ_CALL_CHECK_BALANCE_REDS; > /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c: rq->check_balance_reds = ERTS_RUNQ_CALL_CHECK_BALANCE_REDS; > /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c: balance_info.forced_check_balance = 0; > /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c: (RQ)->check_balance_reds = ERTS_RUNQ_CALL_CHECK_BALANCE_REDS; \ > /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c: balance_info.forced_check_balance = 1; > /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c: ERTS_RUNQ_IX(0)->check_balance_reds = 0; > /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c: if (rq->check_balance_reds <= 0) > /opt/otp_src_R15B01/erts/emulator/beam/erl_process.c: check_balance(rq); > /opt/otp_src_R15B01/erts/emulator/beam/erl_process.h: int check_balance_reds; > /opt/otp_src_R15B01/erts/emulator/beam/erl_process.h: (RQ)->check_balance_reds -= (REDS); \ > /opt/otp_src_R15B01/erts/emulator/beam/erl_process.h: (RQ)->check_balance_reds -= (REDS); > [...] > > For OTP Team: is this dangerous ? > > Regards, > Zabrane > > > On Apr 27, 2012, at 1:23 PM, Siyao Zheng(???) wrote: > >> Hi, >> >> In SMP version of Erlang, every scheduler periodically call "check_balance()" to check load balance among all schedulers, then it might migrate some processes to balance load, or shut down some schedulers with low load. Does anyone know why scheduler should do this? check_balance() is quite a big one, and it has to lock every run queue when it checks the run queue. I think it's quite a big cost here. The work stealing at each schedule step afterwards actually does work load balance very well. Actually after I comment out the check_balance() step and run BigBang and Hackbench benchmarks, they are really faster! >> >> So, I wonder what is the purpose of check_balance() step here, if it is related to scalability on many core processors or something, and if there is any other benchmark I can run to prove its usefulness. >> >> Cheers! >> >> Siyao >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > From vychodil.hynek@REDACTED Fri Apr 27 16:02:47 2012 From: vychodil.hynek@REDACTED (Hynek Vychodil) Date: Fri, 27 Apr 2012 16:02:47 +0200 Subject: [erlang-questions] Network vs native endianness in binary Message-ID: Hi, I'm working on some kind special "database" engine and found weird performance behavior. When I use Erlang default (network, big) integer representation I got better performance then if I use machine native (little) representation. It is consistent either for HiPE and byte code BEAM. It seems weird for me especially in HiPE case when I imagine it have to swap bytes twice. I expect either BEAM and HiPE is using native byte order in internal integer representation. When there is less difference between native (little) HiPE and BEAM implementation then Erlang default which seems to me that HiPE calls some sort of Bif same as in BEAM. May be I understand it totally wrong but it seems to me that there can be some fix in HiPE which will make using native endianness faster than Erlang default. I'm planning rewrite mine pure Erlang prototype to Nif's where using native endianness will be simpler but I'm just curious what is behind. There is simple testing module and result: -module(bln). -export([test/0, big/1, native/1]). test() -> Big = generate(1048576, <<>>), Native = << <> || <> <=Big >>, [timer:tc(?MODULE, big, [Big]), timer:tc(?MODULE, native, [Native])]. generate(0, Acc) -> Acc; generate(N, Acc) -> generate(N-1, <>). big(Bin) when is_binary(Bin) -> big(Bin, 0). big(<>, S) -> big(Rest, S+X); big(<<>>, S) -> S. native(Bin) when is_binary(Bin) -> native(Bin, 0). native(<>, S) -> native(Rest, S+X); native(<<>>, S) -> S. 17> c(bln, [native, {hipe,[o3]}]). {ok,bln} 18> bln:test(). [{8322,2146938992},{34700,2146938992}] 19> bln:test(). [{8536,2143318954},{35553,2143318954}] 20> c(bln). {ok,bln} 21> bln:test(). [{14896,2145208908},{41116,2145208908}] 22> bln:test(). [{14765,2145949712},{41943,2145949712}] I'm getting similar results for mine much more complicated POC. (Anyway 126Mr/s either 30Mr/s is impressive.) Cheers -- --Hynek (Pichi) Vychodil From michael.eugene.turner@REDACTED Fri Apr 27 16:14:38 2012 From: michael.eugene.turner@REDACTED (Michael Turner) Date: Fri, 27 Apr 2012 23:14:38 +0900 Subject: [erlang-questions] useful trick for finding record instantiations In-Reply-To: <4F9A99BD.7090208@gmail.com> References: <4F9A99BD.7090208@gmail.com> Message-ID: Where were you last week, when I needed this hack? ;-) -michael turner On Fri, Apr 27, 2012 at 10:06 PM, Richard Carlsson wrote: > It's not unusual when working with some legacy code that you want to find > all the locations that instantiate a certain record using the #foo{...} > syntax, so that you can replace those with calls to a function that controls > the instantiation for better encapsulation: > > ?init_foo(...) -> #foo{...}. > > However, you can't easily grep for '#foo{' because of all the patterns that > have the same syntax, '= #foo{' misses cases where a record is instantiated > as the argument of a function call, and so on. It's hard to know that you've > found all the occurrences. > > This little trick works pretty well, though: you add a dummy field to the > record definition (usually in a header file): > > ?-record(foo, {'$hidden' = 1/0, > ? ? ? ? ? ? ? ?...}). > > This will not cause errors or warnings at the point of the record > declaration, so modules that include the header file and just use the record > for pattern matching and field accesses will compile cleanly. But > instantiations of the record, such as 'X=#foo{...}', will cause the compiler > to warn that "this expression will fail with a 'badarith' exception". Only > instantiations that override this locally will not trigger the warning. > Since you just added that field, there should not be any cases like that in > the code, apart from the one you write in your new instantiator function: > > ?init_foo(...) -> #foo{'$hidden'=[], ...}. > > The exception is that if you have a record instantiation on the form > '#foo{..., _=Default}', which overrides the default setting for all fields > not explicitly mentioned (usually only used in match specs). You can use > this to suppress the warning in places like unit tests where you might want > to allow direct instantiation. > > Of course, once you're done refactoring and have all instantiations under > control, you remove the dummy field again (in particular if it's used for a > mnesia table). > > Have a nice weekend, > > ? ?/Richard > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From comptekki@REDACTED Fri Apr 27 17:24:22 2012 From: comptekki@REDACTED (Wes James) Date: Fri, 27 Apr 2012 09:24:22 -0600 Subject: [erlang-questions] Stripping slashes from a string In-Reply-To: <4F9A2BD5.2080907@gmail.com> References: <4F9A2BD5.2080907@gmail.com> Message-ID: On Thu, Apr 26, 2012 at 11:17 PM, Martin Dimitrov wrote: > Hello, > > I have a string as the following: > > "This is some\\r\\ntext" > > I am trying to replace "\\r" with \r and "\\n" with \n. > > I do it with the following two reg expressions: > > R1 = re:replace(Result, "\\\\r", "\\\r", [{return,list}, global, unicode]), > R2 = re:replace(R1, "\\\\n", "\\\n", [{return,list}, global, unicode]), > > Is there a better way? I tried to combine the two regex like: not sure if better... but just some other ways to do it :) 1> A="This is some\\r\\ntext". "This is some\\r\\ntext" 2> re:replace(A,"\\\\r\\\\n","\r\n",[{return,list}, global, unicode]). "This is some\r\ntext" or 1> A = "This is some\\r\\ntext". "This is some\\r\\ntext" 2> [C,D] = string:tokens(A,"\\r\\n"). ["This is some","text"] 3> C ++ "\r\n" ++ D. "This is some\r\ntext" -wes From fritchie@REDACTED Fri Apr 27 17:29:02 2012 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Fri, 27 Apr 2012 10:29:02 -0500 Subject: [erlang-questions] "fat burner" GC on periodic base? In-Reply-To: Message of "Thu, 26 Apr 2012 12:49:14 +0300." <20120426094914.GD42675@netch.kiev.ua> Message-ID: <82506.1335540542@snookles.snookles.com> Attila, have you tried using the 'fullsweep_after' flag to erlang:spawn_opt() and related functions (e.g. in proc_lib) to control how frequently full-sweep garbage collection is performed? http://www.snookles.com/erlang-docs/R15B01//erts-5.9.1/doc/html/erlang.html#spawn_opt-2 -Scott From netch@REDACTED Fri Apr 27 17:57:26 2012 From: netch@REDACTED (Valentin Nechayev) Date: Fri, 27 Apr 2012 18:57:26 +0300 Subject: [erlang-questions] strange VM hangup with mremap() cycle (R14B04) Message-ID: <20120427155726.GF42675@netch.kiev.ua> Hi, as seen on national TV my monitor just now: an Erlang VM in out system has hung up, with one thread active and all other sleeping. The active thread strace shows: 19:45:06.215838 mremap(0x7f47ca48b000, 190615552, 190619648, MREMAP_MAYMOVE) = 0x7f47e5217000 19:45:06.344998 mremap(0x7f47e5217000, 190619648, 190623744, MREMAP_MAYMOVE) = 0x7f47ca489000 19:45:06.428110 mremap(0x7f47ca489000, 190623744, 190627840, MREMAP_MAYMOVE) = 0x7f47e5215000 & so on & so forth, with rate ~5 calls per second. VM memory grows approx. 2MB/minute. No system calls except remap() are seen for a long time. There is no way to connect to the node, and it has cluster connections lost, but epmd still remembers it. The beam binary is stripped so I don't expect a help from gdb. Previously, it worked ~16 minutes without any problem. Is this known problem? Does heart(3) help against such problems? I can't find details of its action to reboot the node if watchdog is timed out. -netch- From netch@REDACTED Fri Apr 27 18:21:33 2012 From: netch@REDACTED (Valentin Nechayev) Date: Fri, 27 Apr 2012 19:21:33 +0300 Subject: [erlang-questions] strange VM hangup with mremap() cycle (R14B04) In-Reply-To: <20120427155726.GF42675@netch.kiev.ua> References: <20120427155726.GF42675@netch.kiev.ua> Message-ID: <20120427162133.GA22856@netch.kiev.ua> Fri, Apr 27, 2012 at 18:57:26, netch wrote about "strange VM hangup with mremap() cycle (R14B04)": > as seen on national TV my monitor just now: an Erlang > VM in out system has hung up, with one thread active and all other > sleeping. The active thread strace shows: > > 19:45:06.215838 mremap(0x7f47ca48b000, 190615552, 190619648, MREMAP_MAYMOVE) = 0x7f47e5217000 Ha ha, I have reproduced it: Erlang R14B04 (erts-5.8.5) [source] [64-bit] [rq:1] [async-threads:10] [hipe] [kernel-poll:true] Eshell V5.8.5 (abort with ^G) (sysmon41@REDACTED)1> erlang:process_info(pid(0,251,0),message_queue_len). {message_queue_len,97676} (sysmon41@REDACTED)2> erlang:process_info(pid(0,251,0),message_queue_len). {message_queue_len,98505} (sysmon41@REDACTED)3> erlang:process_info(pid(0,251,0),message_queue_len). {message_queue_len,98741} (sysmon41@REDACTED)4> erlang:process_info(pid(0,251,0),backtrace). <... Here the long timeout is...> *** ERROR: Shell process terminated! (^G to start new job) *** Seems the attempt to get backtrace is the trigger. -netch- From netch@REDACTED Fri Apr 27 18:21:57 2012 From: netch@REDACTED (Valentin Nechayev) Date: Fri, 27 Apr 2012 19:21:57 +0300 Subject: [erlang-questions] strange VM hangup with mremap() cycle (R14B04) In-Reply-To: <20120427162133.GA22856@netch.kiev.ua> References: <20120427155726.GF42675@netch.kiev.ua> <20120427162133.GA22856@netch.kiev.ua> Message-ID: <20120427162157.GB22856@netch.kiev.ua> Hi, Fri, Apr 27, 2012 at 19:21:33, netch wrote about "Re: strange VM hangup with mremap() cycle (R14B04)": > Date: Fri, 27 Apr 2012 19:21:33 +0300 > From: Valentin Nechayev > To: erlang-questions@REDACTED > Subject: Re: strange VM hangup with mremap() cycle (R14B04) > > Fri, Apr 27, 2012 at 18:57:26, netch wrote about "strange VM hangup with mremap() cycle (R14B04)": > > > as seen on national TV my monitor just now: an Erlang > > VM in out system has hung up, with one thread active and all other > > sleeping. The active thread strace shows: > > > > 19:45:06.215838 mremap(0x7f47ca48b000, 190615552, 190619648, MREMAP_MAYMOVE) = 0x7f47e5217000 > > Ha ha, I have reproduced it: > > Erlang R14B04 (erts-5.8.5) [source] [64-bit] [rq:1] [async-threads:10] [hipe] [kernel-poll:true] > > Eshell V5.8.5 (abort with ^G) > (sysmon41@REDACTED)1> erlang:process_info(pid(0,251,0),message_queue_len). > {message_queue_len,97676} > (sysmon41@REDACTED)2> erlang:process_info(pid(0,251,0),message_queue_len). > {message_queue_len,98505} > (sysmon41@REDACTED)3> erlang:process_info(pid(0,251,0),message_queue_len). > {message_queue_len,98741} > (sysmon41@REDACTED)4> erlang:process_info(pid(0,251,0),backtrace). > <... Here the long timeout is...> > *** ERROR: Shell process terminated! (^G to start new job) *** > > Seems the attempt to get backtrace is the trigger. > > > -netch- -netch- From dmercer@REDACTED Fri Apr 27 21:26:38 2012 From: dmercer@REDACTED (David Mercer) Date: Fri, 27 Apr 2012 12:26:38 -0700 Subject: [erlang-questions] non-FIFO behavior in process mailboxes? In-Reply-To: References: Message-ID: On Apr 22, 2012, at 20:38, Michael Turner wrote: > This bug came out of experimentation inspired by the recent discussion > of initializing objects *after* their creation, a topic raised by > Richard O'Keefe. And -- waddya know -- the problem here relates > directly to his objection to this practice: inconsistent intermediate > states. It appears that when you model your objects as processes, the > danger is particularly acute. If you had modeled the the set_arg_to and set_val_to as synchronous calls, like your function val_for ? and like gen_server's call rather than cast ? you can still do this. Though I still agree with ROK. Cheers, DBM From lukas@REDACTED Fri Apr 27 21:49:01 2012 From: lukas@REDACTED (Lukas Larsson) Date: Fri, 27 Apr 2012 21:49:01 +0200 Subject: [erlang-questions] Issues with Erlang Build under SUSE SLES 11 SP 1 on S390 In-Reply-To: References: Message-ID: --disable-dynamic-ssl-lib might do what you want. Lukas On Fri, Apr 27, 2012 at 2:29 PM, wrote: > Dear colleagues, > > ?When including SSL support, I'm still having an issue during the build ?of > Erlang from the source under SUSE SLES 11 SP1 S390 platform. The error > remains in the Erlang crypto module (openssl) and relates to a missing -fPIC > compiler flag. ?I've tried to set the following flags to force the -fPIC > flag. > > export CFLAGS="$CFLAGS -fPIC" > export CXXFLAGS="$CXXFLAGS -fPIC" > export CC="gcc -fPIC" > > The -fPIC flag shows shows up in the previous gcc executions, but in this > step it gets overwritten by the -shared option. Is there any option that > configures the compile of the crypto module, or a place where I could modify > this argument? > > make > ... > make[3]: Entering directory `/opt/erlang/otp_src_R14B03/lib/crypto/c_src' > make -f s390x-ibm-linux-gnu/Makefile TYPE=opt > make[4]: Entering directory `/opt/erlang/otp_src_R14B03/lib/crypto/c_src' > /usr/bin/install -c -d ../priv/lib/s390x-ibm-linux-gnu > gcc -fPIC -shared -Wl,-Bsymbolic -o > ../priv/lib/s390x-ibm-linux-gnu/crypto.so > ../priv/obj/s390x-ibm-linux-gnu/crypto.o ?-Wl,-R/usr/local/ssl/lib > -Wl,-R/usr/local/lib64 -Wl,-R/usr/sfw/lib64 -Wl,-R/opt/local/lib64 > -Wl,-R/usr/lib64 -Wl,-R/usr/pkg/lib64 -Wl,-R/usr/local/openssl/lib64 > -Wl,-R/usr/lib/openssl/lib64 -Wl,-R/usr/openssl/lib64 > -Wl,-R/usr/local/ssl/lib64 -Wl,-R/usr/lib/ssl/lib64 -Wl,-R/usr/ssl/lib64 > -Wl,-R/usr/local/lib -Wl,-R/usr/sfw/lib -Wl,-R/opt/local/lib -Wl,-R/usr/lib > -Wl,-R/usr/pkg/lib -Wl,-R/usr/local/openssl/lib -Wl,-R/usr/lib/openssl/lib > -Wl,-R/usr/openssl/lib -Wl,-R/usr/lib/ssl/lib -Wl,-R/usr/ssl/lib > -L/usr/local/ssl/lib -lcrypto > /usr/lib64/gcc/s390x-suse-linux/4.3/../../../../s390x-suse-linux/bin/ld: > /usr/local/ssl/lib/libcrypto.a(mem_clr.o): relocation R_390_PC32DBL against > `memchr@@GLIBC_2.2' can not be used when making a shared object; recompile > with -fPIC > /usr/lib64/gcc/s390x-suse-linux/4.3/../../../../s390x-suse-linux/bin/ld: > final link failed: Bad value > collect2: ld returned 1 exit status > make[4]: *** [../priv/lib/s390x-ibm-linux-gnu/crypto.so] Error 1 > make[4]: Leaving directory `/opt/erlang/otp_src_R14B03/lib/crypto/c_src' > make[3]: *** [opt] Error 2 > make[3]: Leaving directory `/opt/erlang/otp_src_R14B03/lib/crypto/c_src' > make[2]: *** [opt] Error 2 > make[2]: Leaving directory `/opt/erlang/otp_src_R14B03/lib/crypto' > make[1]: *** [opt] Error 2 > make[1]: Leaving directory `/opt/erlang/otp_src_R14B03/lib' > make: *** [libs] Error 2 > > > Thanks in advance for your support. > > Regards, > Claude > > > Claude Falbriard > Certified IT Specialist L2 - Middleware > AMS Hortol?ndia / SP - Brazil > phone: ? ?+55 19 9837 0789 > cell: ? ? ? ? +55 13 8117 3316 > e-mail: ? ?claudef@REDACTED > > > > > From: ? ? ? ?CGS > To: ? ? ? ?claudef@REDACTED > Cc: ? ? ? ?erlang-questions@REDACTED > Date: ? ? ? ?26/04/2012 18:27 > Subject: ? ? ? ?Re: [erlang-questions] Issues with Erlang Build under SUSE > SLES 11 SP 1 on S390 > ________________________________ > > > > I suppose you can pass --with-ssl-lib=SSL_LIBRARY_PATH and > --with-ssl-include=SSL_INCLUDE_PATH. > > And, yes, there should be libopenssl-devel under SuSE. > > CGS > > > > > On Thu, Apr 26, 2012 at 8:20 PM, wrote: > Dear colleagues, > > Thanks, for the quick reply. The issue with the crypto.c ?clearly relates to > OpenSSL. Unfortunately an openssl-devel package is not available from Novell > SUSE. ?I've downloaded the latest source packages of Kerberos 5 (MIT) and as > well as OpenSSL. Remains some doubts how to use the configuration arguments > described in the Erlang install process > > --with-ssl=PATH - Specify location of OpenSSL include and lib > > Is there an example how to setup this PATH? > > Questions: > > 1 ?- What exactly goes into the PATH argument of with-ssl= ? Is there an > example how to use it? > > 2 ?- Why does the /configure shell search for the krb5.h only under the > location of ?/usr/include > > Those are the locations generated by Kerberos5: > ? ? /usr/local/include/krb5.h > ? ? /usr/local/include/krb5/krb5.h > > and for the openssl package > ? ? /usr/local/ssl/bin/openssl > ? ? /usr/local/ssl/include/openssl > > 3. Any modules need to be placed under /usr/include (default path of > ?./configure) ? > > Thanks in advance for your support to add crypto (ssl) suport to Erlang. > > Regards, > Claude > > > Claude Falbriard > Certified IT Specialist L2 - Middleware > AMS Hortol?ndia / SP - Brazil > phone: ? ?+55 19 9837 0789 > cell: ? ? ? ? +55 13 8117 3316 > e-mail: ? ?claudef@REDACTED > > > > > From: ? ? ? ?CGS > To: ? ? ? ?claudef@REDACTED > Cc: ? ? ? ?Erlang-Questions Questions > Date: ? ? ? ?26/04/2012 10:03 > Subject: ? ? ? ?Re: [erlang-questions] Issues with Erlang Build under SUSE > SLES 11 SP 1 on S390 > ________________________________ > > > > > Hi, > > I suppose you need to install OpenSSL-dev (from the error it looks like you > are missing some OpenSSL headers). > > CGS > > > > > > On Thu, Apr 26, 2012 at 2:17 PM, wrote: > Dear colleagues, > > ?I'm compiling an Erlang ?environment under the SUSE SLES 11 SP1 on a S390 > platform building it from the source. I'm facing an error condition when > adding the support for OpenSSL and Erlang "crypto" support using the > following configuration: > > ./configure --with-ssl --with-ssl=/usr/lib64/openssl > > The configure completes normal, but the subsequent "make" step throws a > sequence of errors like this: > .. > crypto.c: In function ?hmac_md5?: > crypto.c:1713: error: ?MD5_CTX? undeclared (first use in this function) > crypto.c:1713: error: expected ?;? before ?ctx? > crypto.c:1714: warning: ISO C90 forbids mixed declarations and code > crypto.c:1737: error: ?ctx? undeclared (first use in this function) > crypto.c: In function ?hmac_sha1?: > crypto.c:1752: error: ?SHA_CTX? undeclared (first use in this function) > crypto.c:1752: error: expected ?;? before ?ctx? > crypto.c:1753: warning: ISO C90 forbids mixed declarations and code > crypto.c:1776: error: ?ctx? undeclared (first use in this function) > make[4]: *** [../priv/obj/s390x-ibm-linux-gnu/crypto.o] Error 1 > make[4]: Leaving directory `/opt/erlang/otp_src_R14B03/lib/crypto/c_src' > make[3]: *** [opt] Error 2 > make[3]: Leaving directory `/opt/erlang/otp_src_R14B03/lib/crypto/c_src' > make[2]: *** [opt] Error 2 > make[2]: Leaving directory `/opt/erlang/otp_src_R14B03/lib/crypto' > make[1]: *** [opt] Error 2 > make[1]: Leaving directory `/opt/erlang/otp_src_R14B03/lib' > make: *** [libs] Error 2 > .. > > ?Without OpenSSL support, the Erlang package compiles successfully and I've > tested it with the console prompt. > Thanks in advance for your hints how to fix this issue with the crypto > module. > > Regards, > Claude > > > Claude Falbriard > Certified IT Specialist L2 - Middleware > AMS Hortol?ndia / SP - Brazil > phone: ? ?+55 19 9837 0789 > cell: ? ? ? ? +55 13 8117 3316 > e-mail: ? ?claudef@REDACTED > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From eriksoe@REDACTED Fri Apr 27 22:18:28 2012 From: eriksoe@REDACTED (=?ISO-8859-1?Q?Erik_S=F8e_S=F8rensen?=) Date: Fri, 27 Apr 2012 22:18:28 +0200 Subject: [erlang-questions] non-FIFO behavior in process mailboxes? In-Reply-To: References: Message-ID: Modeled as synchronous calls how exactly? If taken literally, it sounds like you're suggesting that the process make synchronous calls to itself... Den 27. apr. 2012 21.26 skrev David Mercer : > On Apr 22, 2012, at 20:38, Michael Turner > wrote: > > > This bug came out of experimentation inspired by the recent discussion > > of initializing objects *after* their creation, a topic raised by > > Richard O'Keefe. And -- waddya know -- the problem here relates > > directly to his objection to this practice: inconsistent intermediate > > states. It appears that when you model your objects as processes, the > > danger is particularly acute. > > If you had modeled the the set_arg_to and set_val_to as synchronous calls, > like your function val_for ? and like gen_server's call rather than cast ? > you can still do this. Though I still agree with ROK. > > Cheers, > > DBM > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jvliwanag@REDACTED Sat Apr 28 04:05:22 2012 From: jvliwanag@REDACTED (Jan Vincent Liwanag) Date: Sat, 28 Apr 2012 10:05:22 +0800 Subject: [erlang-questions] Pros and Cons OTP Release Message-ID: <81D0E211AC9843FFA7A33CE39FF2E424@gmail.com> Hi, What are the pros and cons of packaging an Erlang program as an OTP release? I notice that some of the erlang programs use OTP release (Riak), while others use an augmented erlang install with custom scripts (Ejabberd, RabbitMQ). Jan Vincent Liwanag jvliwanag@REDACTED +63 (939) 9369647 -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael.eugene.turner@REDACTED Sat Apr 28 06:10:39 2012 From: michael.eugene.turner@REDACTED (Michael Turner) Date: Sat, 28 Apr 2012 13:10:39 +0900 Subject: [erlang-questions] non-FIFO behavior in process mailboxes? In-Reply-To: References: Message-ID: On Sat, Apr 28, 2012 at 5:18 AM, Erik S?e S?rensen wrote: > Modeled as synchronous calls how exactly? > If taken literally, it sounds like you're suggesting that the process make > synchronous calls to itself... In this case, yes. Blind as I might be at times, I *can* see the more trivial cases of deadlock. Besides which, I'm looking for all the asynchrony I can get. The code from which my simplified example was distilled is part of an attempt to implement the natural language processing model outlined in linguist Richard Hudson's Word Grammar, http://www.phon.ucl.ac.uk/home/dick/WG/lntnwg.pdf and it's not exactly clear where the human brain makes synchronous calls to itself. Actually, a range of observable linguistic phenomena suggest that nothing of the kind is involved. Formulating and uttering a sentence might be something more like a team of people trying to build a car, but sometimes dropping parts, picking the wrong part, installing the right part the wrong way, bumping into each other mid-task, dozing off on the job .... but mostly getting it right, most of the time. In this sense, what I thought might be a bug was actually just a misapplied feature. -michael turner > Den 27. apr. 2012 21.26 skrev David Mercer : > >> On Apr 22, 2012, at 20:38, Michael Turner >> wrote: >> >> > This bug came out of experimentation inspired by the recent discussion >> > of initializing objects *after* their creation, a topic raised by >> > Richard O'Keefe. And -- waddya know -- the problem here relates >> > directly to his objection to this practice: inconsistent intermediate >> > states. It appears that when you model your objects as processes, the >> > danger is particularly acute. >> >> If you had modeled the the set_arg_to and set_val_to as synchronous calls, >> like your function val_for ? and like gen_server's call rather than cast ? >> you can still do this. ?Though I still agree with ROK. >> >> Cheers, >> >> DBM > > From max.lapshin@REDACTED Sat Apr 28 06:37:27 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Sat, 28 Apr 2012 08:37:27 +0400 Subject: [erlang-questions] Pros and Cons OTP Release In-Reply-To: <81D0E211AC9843FFA7A33CE39FF2E424@gmail.com> References: <81D0E211AC9843FFA7A33CE39FF2E424@gmail.com> Message-ID: I have used OTP release for erlyvideo for a long. Now I've refused from it and not going to return back. 1) ESL now distribute good and fresh erlang packages for all required platforms and I don't have to mess with buddy and ancient debian/ubuntu/... native erlang package 2) Release changes file layout. It is a problem when you develop in one environment and deploy in another. You have to deal with it and in fact there are no reasons for it. When file layout doesn't change, I can go to staging server, make there git pull and develop server there with "close to production" conditions. With releases it becomes a problem. So in fact I don't see any pros in releases for me. From cao.xu@REDACTED Sat Apr 28 10:40:58 2012 From: cao.xu@REDACTED (cao.xu) Date: Sat, 28 Apr 2012 16:40:58 +0800 Subject: [erlang-questions] Question about distributed mnesia behavior Message-ID: <4EF8E418-9466-4AF0-99D4-98CAF84E7165@rytong.com> Hi, I am using mnesia recently under OTP R15B, and feel confused about some behavior of distributed mnesia. I ran two nodes with sname 'test1' and 'test2', and then executed the following command "mnesia:create_schema(['test1', 'test2']), mnesia:create_table(test, [{disc_copies,['test1', 'test2']}]" on 'test1'. After that, I was able to use table 'test' on both nodes, everything seemed fine. Then I shutdown these two nodes and restarted 'test2', the table 'test' was still accessible and I could read and write on it. But when I shutdown 'test2' and restarted 'test1', the table 'test' was unaccessible. The function wait_for_tables would timeout and operations on table 'test' would fail. Only if 'test2' is running, the table becomes accessible again on 'test1'. I was wondering if this is an expected behavior, or the table should work properly on both nodes when they run alone. BR Xu Cao From norton@REDACTED Sat Apr 28 11:41:23 2012 From: norton@REDACTED (Joseph Norton) Date: Sat, 28 Apr 2012 18:41:23 +0900 Subject: [erlang-questions] Question about distributed mnesia behavior In-Reply-To: <4EF8E418-9466-4AF0-99D4-98CAF84E7165@rytong.com> References: <4EF8E418-9466-4AF0-99D4-98CAF84E7165@rytong.com> Message-ID: <81A48659-A4E0-4297-81BD-693440738FC1@lovely.email.ne.jp> Can you repeat your test and make sure to shutdown test1 AFTER test2? If you then restart test1 first, is the 'test' table accessible on test1? Joe N. On 2012/04/28, at 17:40, "cao.xu" wrote: > Then I shutdown these two nodes and restarted 'test2', the table 'test' was still accessible and I could read and write on it. But when I shutdown 'test2' and restarted 'test1', the table 'test' was unaccessible. From cao.xu@REDACTED Sat Apr 28 12:16:11 2012 From: cao.xu@REDACTED (cao.xu) Date: Sat, 28 Apr 2012 18:16:11 +0800 Subject: [erlang-questions] Question about distributed mnesia behavior In-Reply-To: <81A48659-A4E0-4297-81BD-693440738FC1@lovely.email.ne.jp> References: <4EF8E418-9466-4AF0-99D4-98CAF84E7165@rytong.com> <81A48659-A4E0-4297-81BD-693440738FC1@lovely.email.ne.jp> Message-ID: Yes. It is accessible as you expect. Does that mean the shutdown order affect the result of single restart, why? Xu Cao On 2012-4-28, at ??5:41, Joseph Norton wrote: > Can you repeat your test and make sure to shutdown test1 AFTER test2? > > If you then restart test1 first, is the 'test' table accessible on test1? > > Joe N. > > > > On 2012/04/28, at 17:40, "cao.xu" wrote: > >> Then I shutdown these two nodes and restarted 'test2', the table 'test' was still accessible and I could read and write on it. But when I shutdown 'test2' and restarted 'test1', the table 'test' was unaccessible. From norton@REDACTED Sat Apr 28 12:39:33 2012 From: norton@REDACTED (Joseph Norton) Date: Sat, 28 Apr 2012 19:39:33 +0900 Subject: [erlang-questions] Question about distributed mnesia behavior In-Reply-To: References: <4EF8E418-9466-4AF0-99D4-98CAF84E7165@rytong.com> <81A48659-A4E0-4297-81BD-693440738FC1@lovely.email.ne.jp> Message-ID: <186D6CD6-0472-4D42-9950-DEBF53543D08@lovely.email.ne.jp> Yes, it is expected behavior. See this section in the Mnesia user's guide: At start-up, it must be noted that all tables residing on nodes without a mnesia_down entry, may have fresher replicas. Their replicas may have been updated after the termination of Mnesia on the current node. In order to catch up with the latest updates, transfer a copy of the table from one of these other "fresh" nodes. If you are unlucky, other nodes may be down and you must wait for the table to be loaded on one of these nodes before receiving a fresh copy of the table. http://www.erlang.org/doc/apps/mnesia/Mnesia_chap7.html#id78236 On 2012/04/28, at 19:16, "cao.xu" wrote: > Yes. It is accessible as you expect. Does that mean the shutdown order affect the result of single restart, why? > > Xu Cao > > On 2012-4-28, at ??5:41, Joseph Norton wrote: > >> Can you repeat your test and make sure to shutdown test1 AFTER test2? >> >> If you then restart test1 first, is the 'test' table accessible on test1? >> >> Joe N. >> >> >> >> On 2012/04/28, at 17:40, "cao.xu" wrote: >> >>> Then I shutdown these two nodes and restarted 'test2', the table 'test' was still accessible and I could read and write on it. But when I shutdown 'test2' and restarted 'test1', the table 'test' was unaccessible. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cao.xu@REDACTED Sat Apr 28 12:51:54 2012 From: cao.xu@REDACTED (cao.xu) Date: Sat, 28 Apr 2012 18:51:54 +0800 Subject: [erlang-questions] Question about distributed mnesia behavior In-Reply-To: <186D6CD6-0472-4D42-9950-DEBF53543D08@lovely.email.ne.jp> References: <4EF8E418-9466-4AF0-99D4-98CAF84E7165@rytong.com> <81A48659-A4E0-4297-81BD-693440738FC1@lovely.email.ne.jp> <186D6CD6-0472-4D42-9950-DEBF53543D08@lovely.email.ne.jp> Message-ID: Thanks very much. I got it. On 2012-4-28, at ??6:39, Joseph Norton wrote: > Yes, it is expected behavior. > > See this section in the Mnesia user's guide: > > At start-up, it must be noted that all tables residing on nodes without a mnesia_down entry, may have fresher replicas. Their replicas may have been updated after the termination of Mnesia on the current node. In order to catch up with the latest updates, transfer a copy of the table from one of these other "fresh" nodes. If you are unlucky, other nodes may be down and you must wait for the table to be loaded on one of these nodes before receiving a fresh copy of the table. > > http://www.erlang.org/doc/apps/mnesia/Mnesia_chap7.html#id78236 > > On 2012/04/28, at 19:16, "cao.xu" wrote: > >> Yes. It is accessible as you expect. Does that mean the shutdown order affect the result of single restart, why? >> >> Xu Cao >> >> On 2012-4-28, at ??5:41, Joseph Norton wrote: >> >>> Can you repeat your test and make sure to shutdown test1 AFTER test2? >>> >>> If you then restart test1 first, is the 'test' table accessible on test1? >>> >>> Joe N. >>> >>> >>> >>> On 2012/04/28, at 17:40, "cao.xu" wrote: >>> >>>> Then I shutdown these two nodes and restarted 'test2', the table 'test' was still accessible and I could read and write on it. But when I shutdown 'test2' and restarted 'test1', the table 'test' was unaccessible. >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Sat Apr 28 14:13:22 2012 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 28 Apr 2012 14:13:22 +0200 Subject: [erlang-questions] Question about distributed mnesia behavior In-Reply-To: <4E978603-488E-48CE-92E2-9BA9AD38221E@rytong.com> References: <4E978603-488E-48CE-92E2-9BA9AD38221E@rytong.com> Message-ID: <32D4AA4D-D099-4614-8BE3-E075962D26AF@feuerlabs.com> When test1 comes up, and detects that test2 is down, it also notes that it has no log entry of test2 dying. Therefore it assumes that test2 has a newer copy and decides to wait for it. Remember that mnesia has no built-in heuristics for conflict resolution. It does provide a function to 'force_load' a table, if your application (or operator) can determine that it's the right thing to do. Fair warning, though, make sure that test2 doesn't start loading in the middle of this. All bets are off then. BR, Ulf W Ulf Wiger, Feuerlabs, Inc. http://www.feuerlabs.com 28 apr 2012 kl. 10:25 skrev "cao.xu" : > Hi, > > I am using mnesia recently under OTP R15B, and feel confused about some behavior of distributed mnesia. > > I ran two nodes with sname 'test1' and 'test2', and then executed the following command "mnesia:create_schema(['test1', 'test2']), mnesia:create_table(test, [{disc_copies,['test1', 'test2']}]" on 'test1'. After that, I was able to use table 'test' on both nodes, everything seemed fine. > > Then I shutdown these two nodes and restarted 'test2', the table 'test' was still accessible and I could read and write on it. But when I shutdown 'test2' and restarted 'test1', the table 'test' was unaccessible. The function wait_for_table would timeout and operations on table 'test' would fail. Only if 'test2' is running, the table becomes accessible again on 'test1'. > > I was wondering if this is an expected behavior, or the table should work properly on both nodes when run alone. > > BR > > Xu Cao From ulf@REDACTED Sat Apr 28 14:15:30 2012 From: ulf@REDACTED (Ulf Wiger) Date: Sat, 28 Apr 2012 14:15:30 +0200 Subject: [erlang-questions] Question about distributed mnesia behavior In-Reply-To: <32D4AA4D-D099-4614-8BE3-E075962D26AF@feuerlabs.com> References: <4E978603-488E-48CE-92E2-9BA9AD38221E@rytong.com> <32D4AA4D-D099-4614-8BE3-E075962D26AF@feuerlabs.com> Message-ID: <03AE9CD1-AF76-4507-AF83-247FBD1D6DDF@feuerlabs.com> Apologies - didn't spot the duplicate thread. /Ulf W Ulf Wiger, Feuerlabs, Inc. http://www.feuerlabs.com 28 apr 2012 kl. 14:13 skrev Ulf Wiger : > When test1 comes up, and detects that test2 is down, it also notes that it has no log entry of test2 dying. Therefore it assumes that test2 has a newer copy and decides to wait for it. > > Remember that mnesia has no built-in heuristics for conflict resolution. It does provide a function to 'force_load' a table, if your application (or operator) can determine that it's the right thing to do. > > Fair warning, though, make sure that test2 doesn't start loading in the middle of this. All bets are off then. > > BR, > Ulf W > > Ulf Wiger, Feuerlabs, Inc. > http://www.feuerlabs.com > > 28 apr 2012 kl. 10:25 skrev "cao.xu" : > >> Hi, >> >> I am using mnesia recently under OTP R15B, and feel confused about some behavior of distributed mnesia. >> >> I ran two nodes with sname 'test1' and 'test2', and then executed the following command "mnesia:create_schema(['test1', 'test2']), mnesia:create_table(test, [{disc_copies,['test1', 'test2']}]" on 'test1'. After that, I was able to use table 'test' on both nodes, everything seemed fine. >> >> Then I shutdown these two nodes and restarted 'test2', the table 'test' was still accessible and I could read and write on it. But when I shutdown 'test2' and restarted 'test1', the table 'test' was unaccessible. The function wait_for_table would timeout and operations on table 'test' would fail. Only if 'test2' is running, the table becomes accessible again on 'test1'. >> >> I was wondering if this is an expected behavior, or the table should work properly on both nodes when run alone. >> >> BR >> >> Xu Cao > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From dmkolesnikov@REDACTED Sat Apr 28 14:21:17 2012 From: dmkolesnikov@REDACTED (Dmitry Kolesnikov) Date: Sat, 28 Apr 2012 15:21:17 +0300 Subject: [erlang-questions] Pros and Cons OTP Release In-Reply-To: References: <81D0E211AC9843FFA7A33CE39FF2E424@gmail.com> Message-ID: <8798E540-B762-422F-A0BB-F583C479CE5B@gmail.com> Hello, I am not satisfied with packages that comes with distributions. I am always building OTP from source according to desired configuration. The releases is only sensible way for me to distribute the software from development to staging & production. I do not use release to perform a on-line code update. Instead, release is a tarball for me that contains erts binaries, dependent libraries and my application. - Dmitry On Apr 28, 2012, at 7:37 AM, Max Lapshin wrote: > I have used OTP release for erlyvideo for a long. > > Now I've refused from it and not going to return back. > > 1) ESL now distribute good and fresh erlang packages for all required > platforms and I don't have to mess with buddy and ancient > debian/ubuntu/... native erlang package > 2) Release changes file layout. It is a problem when you develop in > one environment and deploy in another. > You have to deal with it and in fact there are no reasons for it. > > When file layout doesn't change, I can go to staging server, make > there git pull and develop server there with "close to production" > conditions. With releases it becomes a problem. > > So in fact I don't see any pros in releases for me. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From noiddicle@REDACTED Sat Apr 28 15:19:37 2012 From: noiddicle@REDACTED (Red Davies) Date: Sat, 28 Apr 2012 09:19:37 -0400 Subject: [erlang-questions] Releasing wxerlang applications Message-ID: Please forgive me if this question has an obvious answer. I'm still in the "what's the right syntax for a guard again?" stage of learning the language. So I want to write a simple wxerlang application. I want to use OTP functionality such as supervisors. The thing that I don't seem to be able to wrap my head around is that you start and stop OTP applications like you would start and stop server daemons, not client applications. So, does it make sense to fold-in OTP into graphical client applications? If so, any pointers as to how or references for where it's been done before. Thanks Red -------------- next part -------------- An HTML attachment was scrubbed... URL: From tristan.sloughter@REDACTED Sat Apr 28 15:36:54 2012 From: tristan.sloughter@REDACTED (Tristan Sloughter) Date: Sat, 28 Apr 2012 08:36:54 -0500 Subject: [erlang-questions] Building, Packaging and Installing Message-ID: I started with this problem as something to simply discuss with the maintainers of certain build and package management projects -- sinan and agner specifically. But it seems to be more broad and cover how all of us who keep apps on github handle versioning and dependencies. The basic issue is app versions within .app files on branches in github, the resultant directory from a agner install and the discrepancies this causes. For an example take an app like Cowboy that its .app files in the master branch has {vsn, "0.5.0"} but this is not really 0.5.0. That is a tagged version. What is in master is a version beyond 0.5.0. An agner install of this results in lib/cowboy-@REDACTED with the .app file still being vsn 0.5.0, of course. Rebar has a partial work around for these where you can put {vsn git} in your .app.src file and it will populate it on build with part of the git hash for the repo at that time. This I think could be part of the ultimate solution. Though another problem arises for cut versions put into tags, like if you simply download https://github.com/boundary/folsom/zipball/0.6you can not build it by default because it is not a git repo. And if you pull the tag and build it (as Agner does for when you do a 'agner install folsom -v 0.6' the version is not 0.6 in the .app as you'd expect, but instead 0.6-. Thus I had to create an agner package for the tag 0.6-51-gdaa75cb that points to the 0.6 tag of folsom -- other wise the dir name and the actual app version would not match. So I've been doing many work arounds for this for my needs, none of them yet satisfying. For real development of an Erlang project on a team its important to keep versions of dependencies in sync AND accurate. I've not found a good flow for this with the current environment of Erlang apps from their main source, github. Am I the only one going crazy with this? haha Does anyone have suggestions/examples of what they do for production projects on teams to ease these annoyances? I mostly just create my own packages and repos of dependencies, or package third party deps with the project. Tristan -------------- next part -------------- An HTML attachment was scrubbed... URL: From cgsmcmlxxv@REDACTED Sat Apr 28 16:02:06 2012 From: cgsmcmlxxv@REDACTED (CGS) Date: Sat, 28 Apr 2012 16:02:06 +0200 Subject: [erlang-questions] Releasing wxerlang applications In-Reply-To: References: Message-ID: Hi, I am no expert in Erlang, but I think I may have few answers for you. "The thing that I don't seem to be able to wrap my head around is that you start and stop OTP applications like you would start and stop server daemons, not client applications." There is no big difference in between a daemon and a client application. A daemon is just a script which installed in a certain path and is started at a certain stage of the Linux boot (for example). The same script put in another folder can start the application at user level (after the linux booted and users privileges come into play). Now, depending on how you would prefer to have start/stop strategy, you can do it by brutal kill (sending kill signal to your OS for that process) of your application or by sending signal to your application to stop itself. But this is something different from starting your application as daemon or user application. "So, does it make sense to fold-in OTP into graphical client applications?" It depends more on your client application than the graphical part. By default, Erlang knows nothing about graphics and graphical decorations, but it can talk with C via NIF's. For example, if you have to set a communication in between client and server and you don't want to make it in C/C++/JAVA (depending on the language you use to develop your client application), then Erlang can be a nice choice. If you want a hotswap for your application (code change without restarting the application), then OTP is providing a very nice tool for that. There are other advantage and disadvantages adding Erlang code to your application, but, mainly, everything depends on what you expect from application functionality. I hope this answer will help you in deciding your strategy for your project. CGS On Sat, Apr 28, 2012 at 3:19 PM, Red Davies wrote: > Please forgive me if this question has an obvious answer. I'm still in > the "what's the right syntax for a guard again?" stage of learning the > language. > > So I want to write a simple wxerlang application. I want to use OTP > functionality such as supervisors. > > The thing that I don't seem to be able to wrap my head around is that you > start and stop OTP applications like you would start and stop server > daemons, not client applications. > > So, does it make sense to fold-in OTP into graphical client applications? > > If so, any pointers as to how or references for where it's been done > before. > > Thanks > > Red > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tilman.holschuh@REDACTED Sat Apr 28 18:19:50 2012 From: tilman.holschuh@REDACTED (Tilman Holschuh) Date: Sat, 28 Apr 2012 09:19:50 -0700 Subject: [erlang-questions] Pros and Cons OTP Release In-Reply-To: References: <81D0E211AC9843FFA7A33CE39FF2E424@gmail.com> Message-ID: One further slight disadvantage of using releases you cannot add as easily a new application to your release. Say you have your production system running for a while and now you want to run redbug because you found a problem. If it was not contained in your release you have to manually add it somehow. On 2012-04-27, at 9:37 PM, Max Lapshin wrote: > 1) ESL now distribute good and fresh erlang packages for all required > platforms and I don't have to mess with buddy and ancient > debian/ubuntu/... native erlang package Yes, that's great! Thanks to ESL again! But when doing so you still have to deal with package dependencies (see here https://gist.github.com/2284940). > 2) Release changes file layout. It is a problem when you develop in > one environment and deploy in another. > You have to deal with it and in fact there are no reasons for it. > When file layout doesn't change, I can go to staging server, make > there git pull and develop server there with "close to production" > conditions. With releases it becomes a problem. Releases allow you to put all files and applications you need in the place the way you want it. In our environment we put the same deployment mechanisms in place for test and production using releases. For development we basically differ only in arguments to the VM which you can handle well using vm.args. Rebar makes it very easy to create releases. Thanks Basho! Cheers - Tilman From cjk@REDACTED Sat Apr 28 19:06:26 2012 From: cjk@REDACTED (Christian Kruse) Date: Sat, 28 Apr 2012 19:06:26 +0200 Subject: [erlang-questions] EUnit error test: limit number of processes at runtime Message-ID: <20120428170626.GA2692@achilles.local.defunct.ch> Hi, for an Erlang project I'm working on (Open Source, in case someone is curious) I'm trying to test a possible error with spawning a process, e.g. maximum number of processes reached. Since I don't want to spawn > 32k processes for each test run, I'd like to limit the number of possible processes for this test only. Is this possible? Or is there another solution I can use to test such an error case? Greetings, CK -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 230 bytes Desc: not available URL: From kostis@REDACTED Sat Apr 28 19:11:05 2012 From: kostis@REDACTED (Kostis Sagonas) Date: Sat, 28 Apr 2012 19:11:05 +0200 Subject: [erlang-questions] EUnit error test: limit number of processes at runtime In-Reply-To: <20120428170626.GA2692@achilles.local.defunct.ch> References: <20120428170626.GA2692@achilles.local.defunct.ch> Message-ID: <4F9C24A9.9070807@cs.ntua.gr> On 04/28/2012 07:06 PM, Christian Kruse wrote: > Hi, > > for an Erlang project I'm working on (Open Source, > in case someone is curious) I'm > trying to test a possible error with spawning a process, e.g. maximum > number of processes reached. Since I don't want to spawn> 32k > processes for each test run, I'd like to limit the number of possible > processes for this test only. > > Is this possible? Or is there another solution I can use to test such > an error case? Have you considered using the +P option of erl? Kostis From cjk@REDACTED Sat Apr 28 19:19:03 2012 From: cjk@REDACTED (Christian Kruse) Date: Sat, 28 Apr 2012 19:19:03 +0200 Subject: [erlang-questions] EUnit error test: limit number of processes at runtime In-Reply-To: <4F9C24A9.9070807@cs.ntua.gr> References: <20120428170626.GA2692@achilles.local.defunct.ch> <4F9C24A9.9070807@cs.ntua.gr> Message-ID: <20120428171903.GC2692@achilles.local.defunct.ch> Hi, On 28/04/12 19:11, Kostis Sagonas wrote: > >for an Erlang project I'm working on (Open Source, > > in case someone is curious) I'm > >trying to test a possible error with spawning a process, e.g. maximum > >number of processes reached. Since I don't want to spawn> 32k > >processes for each test run, I'd like to limit the number of possible > >processes for this test only. > > > >Is this possible? Or is there another solution I can use to test such > >an error case? > > Have you considered using the +P option of erl? Yes, but since I want to reduce this limit only for one specific test it is not really a good solution. I would have to set the limit to a specific number of processes for all tests and exceed that limit in the error test. Of course it can be much lower than 32k processes for the test run, but it would be much nicer to limit it only for this one test. Greetings, CK -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 230 bytes Desc: not available URL: From nem@REDACTED Sat Apr 28 21:24:12 2012 From: nem@REDACTED (Geoff Cant) Date: Sat, 28 Apr 2012 12:24:12 -0700 Subject: [erlang-questions] EUnit error test: limit number of processes at runtime In-Reply-To: <20120428171903.GC2692@achilles.local.defunct.ch> References: <20120428170626.GA2692@achilles.local.defunct.ch> <4F9C24A9.9070807@cs.ntua.gr> <20120428171903.GC2692@achilles.local.defunct.ch> Message-ID: From memory there's no way to limit the number of processes allowed aside from the size of the process table. The size of the process table is set at startup and can't be changed, so I guess the answer to your question is No - you have to spawn enough processes to run out. spawn(fun () -> erlang:hibernate(erlang, exit, [normal]) end, []) might help with the memory footprint a bit. Cheers, -Geoff On 2012-04-28, at 10:19 , Christian Kruse wrote: > Hi, > > On 28/04/12 19:11, Kostis Sagonas wrote: >>> for an Erlang project I'm working on (Open Source, >>> in case someone is curious) I'm >>> trying to test a possible error with spawning a process, e.g. maximum >>> number of processes reached. Since I don't want to spawn> 32k >>> processes for each test run, I'd like to limit the number of possible >>> processes for this test only. >>> >>> Is this possible? Or is there another solution I can use to test such >>> an error case? >> >> Have you considered using the +P option of erl? > > Yes, but since I want to reduce this limit only for one specific test > it is not really a good solution. I would have to set the limit to a > specific number of processes for all tests and exceed that limit in > the error test. Of course it can be much lower than 32k processes for > the test run, but it would be much nicer to limit it only for this one > test. > > Greetings, > CK > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -- Geoff Cant From max.lapshin@REDACTED Sun Apr 29 09:01:24 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Sun, 29 Apr 2012 11:01:24 +0400 Subject: [erlang-questions] Quick snippet: how to parse erlang config file, loaded into memory Message-ID: There is a very convenient tool file:path_consult for config files. But what if config is loaded into memory? You have to dig into sources. https://gist.github.com/2537756 parse(Text) when is_list(Text) -> parse(Text, [], 0, []). parse(Text, Env, Line, Acc) -> case erl_scan:tokens([], Text, Line) of {done, {ok, Scanned, NewLine}, Rest} -> {ok, Parsed} = erl_parse:parse_exprs(Scanned), {value, Out, NewEnv} = erl_eval:exprs(Parsed, Env), parse(Rest, NewEnv, NewLine, [Out|Acc]); {more, _} -> lists:reverse(Acc) end. From ok@REDACTED Mon Apr 30 03:05:42 2012 From: ok@REDACTED (Richard O'Keefe) Date: Mon, 30 Apr 2012 13:05:42 +1200 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: <4F9A7E4B.7020900@fastmail.fm> References: <4F9320F7.3010009@fastmail.fm> <436F6F6E-1131-4DC8-846B-0B0CC4C92CD8@cs.otago.ac.nz> <4F94BE6A.5010906@fastmail.fm> <049bd08514a53fb92bdc31699b438c8c.squirrel@chasm.otago.ac.nz> <4F951F75.4090708@fastmail.fm> <1EEF2F3F-A943-487F-A677-0AEAE24668FF@cs.otago.ac.nz> <4F95E025.1000404@fastmail.fm> <87C1D9BF-4845-487A-A1FE-7CEC91FA4C90@cs.otago.ac.nz> <4F965B38.1000302@fastmail.fm> <728E8F42-1626-450E-AE2C-2EB9ECDF48F0@cs.otago.ac.nz> <4F990D31.8070309@fastmail.fm> <8D0F33D1-9E34-4D3A-B12A-25FBE3065CB7@cs.otago.ac.nz> <4F99DE96.2010006@fastmail.fm> <4F9A58E9.40409@fastmail.fm> <4F9A7E4B.7020900@fastmail.fm> Message-ID: <6A224D58-2DDA-4473-BCD9-FAAA1B93DCB0@cs.otago.ac.nz> On 27/04/2012, at 11:08 PM, Jan Burse wrote: > If it were possible to create a frame data structure > with very good footprint and performance properties, I > would have used it already back then. As described in the frames proposal, a frame with n slots takes between n+1 and 2(n+1) words depending on whether the structure was expressed statically or dynamically. At the lower end (which is what is comparable to OO systems) it _is_ comparable to OO systems and if you know a way to do better I would be delighted to hear it. At the upper end, it is at least a lot better than a hash table, and if you know a better way to store dynamically constructed associations I would be delighted to hear that too. As for performance, the only performance that matters to me (as this is Erlang) is performance relative to records. I now have some measurements which are quite encouraging. Even better, I can see how a module-level data flow analysis (thus one that is compatible with hot loading) could make frames precisely as efficient as records in some important uses in Erlang, though I have not had time to write that up yet. > But when I looked > at it back then, I found some inherent limitations that > I guess cannot be overcome, I guess you could tell us what they are. > > I guess there are theoretical papers around that > show these limitations inherent in polymorphism. If they are inherent in polymorphism, then they apply every bit as much to Erlang records and Java objects as they do to frames. It is often possible to evade 'inherent limitations'; what we want to do on any particular occasion often has some special property missing from the general case that is limited. (As a very well known example, the Simplex algorithm is in principle exponential, but people happily used it quite successfully on very large problems for years, and it almost always worked fine.) The limitations are presumably just constant factor ones, and in a world where people happily use things like Java, constant factors that are not _too_ big need not stop something being useful. > But statements as follows: > > ROK wrote: > > Frames make do without *any* static type information; > > that's what the design is about. But they can take > > advantage of type information if available. > > Are especially dangerous. They insuinate that late > binding (*) can be solved performance wise. Rubbish. My statement means precisely what it says, no more and no less. Frames *DO* in fact make do without static type information. And they *CAN* take advantage of type information *IF* it is available. This is not a claim that 'late binding can be solved performance wise' (whatever that means), but on the contrary and quite obviously a claim that if what you are doing is *NOT* late binding that can be noticed and taken advantage of. It is also not a claim that when type information *is* exploited the result is as efficient as it could be in a system that did not allow late binding. This is *precisely* like the way that Java objects are theoretically heap allocated, not stack allocated, but papers have been published showing that an 'escape analysis' can allow a Java compiler to allocate some objects on the stack after all: the language has no restriction on object lifetimes but IF you are using an object in a way which IS restricted that can be noticed and exploited. Far from making any outrageous claims about solving impossible problems, this is a commonplace of programming language design and implementation. There are many examples. For example, in Smalltalk, closures are in principle allocated whenever execution hits a block, but if certain built-in methods are not overridden, many blocks can be inlined, many other blocks can be statically allocated (about a third of the ones that aren't inlined, in my system), and a simple static analysis lets you discover a substantial number of blocks that can be stack-allocated (like Pascal or GNU C nested functions) provided you box exceeding clever in #doesNotUnderstand: . It's almost as simple as noticing that a program that doesn't create any threads other than the initial one doesn't need to bother with locks in stdio. The important fact for frames is that frames are meant to be used as a replacement for Erlang records, and Erlang records *are* used in a statically-typed way. > I am primarily > concerned with the idea that some borders can be pushed > that have not already been push for example by my contrast > OO language Java. So I am awaiting clarification: > > JB wrote: > > In which proposal is this substantiated? In which proposal is WHAT substantiated? The exploitability of type information? Come ON: given the representation described in frames.pdf, if you see a slot reference ~foo(Bar) and you have type information (Bar is a frame with these fields having those types) similar to the information currently available about records, then the compiler would know just as much about that reference as a Pascal, C, or indeed Java compiler would know about Bar^.foo (Pascal), Bar->foo (C), or Bar.foo (Java). That would not stop the *same* value being passed to a function that *didn't* have the type information and being used there. From ok@REDACTED Mon Apr 30 03:09:10 2012 From: ok@REDACTED (Richard O'Keefe) Date: Mon, 30 Apr 2012 13:09:10 +1200 Subject: [erlang-questions] Frames proposal Message-ID: <4714288D-1696-49E3-9854-8707CC84CE6F@cs.otago.ac.nz> There is a new version of http://www.cs.otago.ac.nz/staffpriv/ok/frames.pdf up. This one has some encouraging experimental results. From janburse@REDACTED Mon Apr 30 11:06:12 2012 From: janburse@REDACTED (Jan Burse) Date: Mon, 30 Apr 2012 11:06:12 +0200 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: <6A224D58-2DDA-4473-BCD9-FAAA1B93DCB0@cs.otago.ac.nz> References: <4F9320F7.3010009@fastmail.fm> <436F6F6E-1131-4DC8-846B-0B0CC4C92CD8@cs.otago.ac.nz> <4F94BE6A.5010906@fastmail.fm> <049bd08514a53fb92bdc31699b438c8c.squirrel@chasm.otago.ac.nz> <4F951F75.4090708@fastmail.fm> <1EEF2F3F-A943-487F-A677-0AEAE24668FF@cs.otago.ac.nz> <4F95E025.1000404@fastmail.fm> <87C1D9BF-4845-487A-A1FE-7CEC91FA4C90@cs.otago.ac.nz> <4F965B38.1000302@fastmail.fm> <728E8F42-1626-450E-AE2C-2EB9ECDF48F0@cs.otago.ac.nz> <4F990D31.8070309@fastmail.fm> <8D0F33D1-9E34-4D3A-B12A-25FBE3065CB7@cs.otago.ac.nz> <4F99DE96.2010006@fastmail.fm> <4F9A58E9.40409@fastmail.fm> <4F9A7E4B.7020900@fastmail.fm> <6A224D58-2DDA-4473-BCD9-FAAA1B93DCB0@cs.otago.ac.nz> Message-ID: <4F9E5604.2080703@fastmail.fm> Richard O'Keefe schrieb: > Come ON: given the representation described in frames.pdf, > if you see a slot reference ~foo(Bar) and you have type > information (Bar is a frame with these fields having those > types) similar to the information currently available about > records, then the compiler would know just as much about that > reference as a Pascal, C, or indeed Java compiler would know > about Bar^.foo (Pascal), Bar->foo (C), or Bar.foo (Java). > That would not stop the*same* value being passed to a > function that*didn't* have the type information and being > used there. This only works in the non-polymorphic case. It can only speed up your access in the non-polymorphic case and then frames boil down to records. You still don't get my argument that frames pose certain complexity limitations, either access is O(1) (field access) and frames don't get updated in their signature, or access is O(log n) and frames get updated in their signature and are sparsely represented. I don't see a way around this right now. Unfortunately I did not yet find a paper detailing it. But you can think about it for yourself. Assume you have the following keys dispersed in your code: k1, ..., kn Then the possible frame signatures are: k1, k2, ... kn k1, k2 ... kn-1,kn ... k1, ..., kn There are 2^n possible frame signatures for n keys. Now you can easily construct some program that will visit all these combinations and the program need only have length proportional to n. I don't think some type inference can push down the access time to these frames O(1) (field access) and in the same time represent the frames sparsely. Further type declaration is pretty void for the example. Bye From gleber.p@REDACTED Mon Apr 30 11:26:30 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Mon, 30 Apr 2012 11:26:30 +0200 Subject: [erlang-questions] Distributed minimum weight spanning tree Message-ID: Hello list, Does anyone know of any Erlang implementation of distributed minimum weight spanning tree algorithm which works in presence of failures? Best regards, Gleb Peregud From janburse@REDACTED Mon Apr 30 11:38:31 2012 From: janburse@REDACTED (Jan Burse) Date: Mon, 30 Apr 2012 11:38:31 +0200 Subject: [erlang-questions] The compiler "eats" structures which are not separated by commas In-Reply-To: <4F9E5604.2080703@fastmail.fm> References: <4F9320F7.3010009@fastmail.fm> <436F6F6E-1131-4DC8-846B-0B0CC4C92CD8@cs.otago.ac.nz> <4F94BE6A.5010906@fastmail.fm> <049bd08514a53fb92bdc31699b438c8c.squirrel@chasm.otago.ac.nz> <4F951F75.4090708@fastmail.fm> <1EEF2F3F-A943-487F-A677-0AEAE24668FF@cs.otago.ac.nz> <4F95E025.1000404@fastmail.fm> <87C1D9BF-4845-487A-A1FE-7CEC91FA4C90@cs.otago.ac.nz> <4F965B38.1000302@fastmail.fm> <728E8F42-1626-450E-AE2C-2EB9ECDF48F0@cs.otago.ac.nz> <4F990D31.8070309@fastmail.fm> <8D0F33D1-9E34-4D3A-B12A-25FBE3065CB7@cs.otago.ac.nz> <4F99DE96.2010006@fastmail.fm> <4F9A58E9.40409@fastmail.fm> <4F9A7E4B.7020900@fastmail.fm> <6A224D58-2DDA-4473-BCD9-FAAA1B93DCB0@cs.otago.ac.nz> <4F9E5604.2080703@fastmail.fm> Message-ID: <4F9E5D97.8070302@fastmail.fm> Jan Burse schrieb: > Richard O'Keefe schrieb: >> Come ON: given the representation described in frames.pdf, >> [...] > This only works in the non-polymorphic case. > [...] Oops, My previous post is rather a response to: > The limitations are presumably just constant factor ones, and in > a world where people happily use things like Java, constant factors > that are not _too_ big need not stop something being useful. Otherwise I agree that something can be done, even despite the complexity limitations. I also agree that something can be done locally in some cases. And I also agree that something can be done statically in some cases. No problem with that, really. But you were asking what I mean by: >> In which proposal is this substantiated? > In which proposal is WHAT substantiated? > The exploitability of type information? I am still not sure whether a pandora box is openened. I would like to see a concrete analysis in the case of use case 3 where module C adds an annotation to a frame from module P and where the code would be written as: p(<{k1~v1,k2-v2|F>) -> What I know from other languages is that for annontations, if it can be predicted that they might happen, and if they are orthogonal to subtyping, simply a dict field is introduced. So one could go with records instead of frames: p(#rec{k1=v1,k2=v2,ann=A}) -> Or if subtyping really happens: p(#<{k1~v1,k2~v2,ann~A|F}>) -> This lowers the degree of polymorphism inside the main record. There are many such examples, for example client data in widgets, client data in HTTP requests etc.. etc... Bye From clist@REDACTED Mon Apr 30 13:22:44 2012 From: clist@REDACTED (Angel J. Alvarez Miguel) Date: Mon, 30 Apr 2012 13:22:44 +0200 Subject: [erlang-questions] Cannot start my application inside an escript (shame on me, rebar or what?) Message-ID: <201204301322.44789.clist@uah.es> Hi We are developing a molecular dynamics simulator in erlang so we have create an app structure of dirs and compile and bundle everything with rebar... /src ./src/script_utils ./src/script_utils/getopt.erl.... ./src/nosehoover.app.src ./src/nosehoover_core.erl ./src/nosehoover.erl ./src/nosehoover_tools.erl ./src/nosehoover_loader_gaussian.erl ./src/nosehoover_main.erl ./src/sim_utils ./src/sim_utils/group_membership.erl... ./data ./data/METANO... ./test ./test/thermo_test.erl ./test/dynamics_test.erl.... ./ebin ./ebin/atom_utils.beam ./ebin/group_membership.beam ./ebin/nosehoover_loader_gaussian.beam..... ./plugins ./plugins/rebar_qc.erl ./include ./include/nosehoover_options.hrl ./include/constants.hrl ./rebar.config . We currently hook all functionality into the main() function on nosehoover.erl that escripts calls and this runs fine. Now we want to leave only cmdline args procesing to the main function and start a full blown erlang app creating worker and supervisors so first we are trying to start a minimal application. ################### nosehoover.erl (-compile(export_all)) main(Argumentos) -> ok = application:load(nosehoover), {ok,Version} = application:get_key(nosehoover,vsn), {ok,Description} = application:get_key(nosehoover,description), Programa = escript:script_name(), % print a welcome message.. io:format("Erlang Nosehoover(~s): ~s\n\n\n",[Version,Description]), % look for cmdline specs exported by my modules OptionProviders = module_tools:list_app_modules(nosehoover,exports,option_specs), io:format("[ COMMAND LINE PARSING STAGE ]\nOptions providers found: ~w\n",[OptionProviders]), % build a complete specs list for getopt {OptSpecList,OptFunList} = collect_option_providers(OptionProviders), case parse_args(OptSpecList, Argumentos, OptFunList) of {ok, {Opciones, _OtrosArgs}} -> % ok lets start the whole thing % try to start the application ok = application:start(nosehover), % <---------- THIS IS THE ERROR!! % current entry point as a plain script app nosehoover_core:main(Opciones); {help} -> getopt:usage(OptSpecList, Programa); {version} -> io:format("~s (v ~s)\n~s\n", [Programa,Version,Description]); {error, {invalid_option_arg, Data}} -> io:format("Error:\n\t Invalid option: ~p~n~n", [Data]), getopt:usage(OptSpecList, Programa); {error, {Reason, Data}} -> io:format("Error:\n\t~s ~p~n~n", [Reason, Data]), getopt:usage(OptSpecList, Programa) end. start(Type,Args) -> % just something to see if appp controller tried to start us... io:format("Application started (~w) with args:~p",[Type,Args]), {ok,self()}. #################### We use application controller to load the bundled nosehoover.app in order to ask for what modules the app has and thinks like this, and it seem it find the app file and can load our app description, but whenever i try to start the application there is a error: escript: exception error: no match of right hand side value {error,{"no such file or directory","nosehover.app"}} in function nosehoover:main/1 (src/nosehoover.erl, line 103) in call from escript:run/2 (escript.erl, line 727) in call from escript:start/1 (escript.erl, line 277) in call from init:start_it/1 in call from init:start_em/1 Its seems app controller can locate the app file and we can interrogate about app properties , but then it is unable to use it just to start the application. Have anyone tried this way of doing things (start as an escript, the load and start an app), is there some problem with the app controller and zip bundled beams, or mybe escript zip files are no suitable for full erlangs apps? ZIP dir structure looks flat while is should retain the app form? Thanks in advance.... -- ->>---------------------------------------------------------------------------- Angel J. Alvarez Miguel, Servicios Inform?ticos Edificio Torre de Control, Campus Externo UAH Alcal? de Henares 28806, Madrid ** ESPA?A ** -------------[taH pagh taHbe', DaH mu'tlheghvam v?qeln?S]--<<- From clist@REDACTED Mon Apr 30 13:27:43 2012 From: clist@REDACTED (Angel J. Alvarez Miguel) Date: Mon, 30 Apr 2012 13:27:43 +0200 Subject: [erlang-questions] =?utf-8?q?Cannot_start_my_application_inside_a?= =?utf-8?q?n_escript_=C2=A1=C2=A1SOLVED!!_=28shame_on_me=29?= Message-ID: <201204301327.43526.clist@uah.es> My app name was wrong being nosehoover instead of nosehover.... Silly mistake /Angel Hi We are developing a molecular dynamics simulator in erlang so we have create an app structure of dirs and compile and bundle everything with rebar... /src ./src/script_utils ./src/script_utils/getopt.erl.... ./src/nosehoover.app.src ./src/nosehoover_core.erl ./src/nosehoover.erl ./src/nosehoover_tools.erl ./src/nosehoover_loader_gaussian.erl ./src/nosehoover_main.erl ./src/sim_utils ./src/sim_utils/group_membership.erl... ./data ./data/METANO... ./test ./test/thermo_test.erl ./test/dynamics_test.erl.... ./ebin ./ebin/atom_utils.beam ./ebin/group_membership.beam ./ebin/nosehoover_loader_gaussian.beam..... ./plugins ./plugins/rebar_qc.erl ./include ./include/nosehoover_options.hrl ./include/constants.hrl ./rebar.config . We currently hook all functionality into the main() function on nosehoover.erl that escripts calls and this runs fine. Now we want to leave only cmdline args procesing to the main function and start a full blown erlang app creating worker and supervisors so first we are trying to start a minimal application. ################### nosehoover.erl (-compile(export_all)) main(Argumentos) -> ok = application:load(nosehoover), {ok,Version} = application:get_key(nosehoover,vsn), {ok,Description} = application:get_key(nosehoover,description), Programa = escript:script_name(), % print a welcome message.. io:format("Erlang Nosehoover(~s): ~s\n\n\n",[Version,Description]), % look for cmdline specs exported by my modules OptionProviders = module_tools:list_app_modules(nosehoover,exports,option_specs), io:format("[ COMMAND LINE PARSING STAGE ]\nOptions providers found: ~w\n", [OptionProviders]), % build a complete specs list for getopt {OptSpecList,OptFunList} = collect_option_providers(OptionProviders), case parse_args(OptSpecList, Argumentos, OptFunList) of {ok, {Opciones, _OtrosArgs}} -> % ok lets start the whole thing % try to start the application ok = application:start(nosehover), % <---------- THIS IS THE ERROR!! % current entry point as a plain script app nosehoover_core:main(Opciones); {help} -> getopt:usage(OptSpecList, Programa); {version} -> io:format("~s (v ~s)\n~s\n", [Programa,Version,Description]); {error, {invalid_option_arg, Data}} -> io:format("Error:\n\t Invalid option: ~p~n~n", [Data]), getopt:usage(OptSpecList, Programa); {error, {Reason, Data}} -> io:format("Error:\n\t~s ~p~n~n", [Reason, Data]), getopt:usage(OptSpecList, Programa) end. start(Type,Args) -> % just something to see if appp controller tried to start us... io:format("Application started (~w) with args:~p",[Type,Args]), {ok,self()}. #################### We use application controller to load the bundled nosehoover.app in order to ask for what modules the app has and thinks like this, and it seem it find the app file and can load our app description, but whenever i try to start the application there is a error: escript: exception error: no match of right hand side value {error,{"no such file or directory","nosehover.app"}} in function nosehoover:main/1 (src/nosehoover.erl, line 103) in call from escript:run/2 (escript.erl, line 727) in call from escript:start/1 (escript.erl, line 277) in call from init:start_it/1 in call from init:start_em/1 Its seems app controller can locate the app file and we can interrogate about app properties , but then it is unable to use it just to start the application. Have anyone tried this way of doing things (start as an escript, the load and start an app), is there some problem with the app controller and zip bundled beams, or mybe escript zip files are no suitable for full erlangs apps? ZIP dir structure looks flat while is should retain the app form? Thanks in advance.... -- - >>---------------------------------------------------------------------------- Angel J. Alvarez Miguel, Servicios Inform?ticos Edificio Torre de Control, Campus Externo UAH Alcal? de Henares 28806, Madrid ** ESPA?A ** -------------[taH pagh taHbe', DaH mu'tlheghvam v?qeln?S]--<<- From emeka_1978@REDACTED Mon Apr 30 14:27:09 2012 From: emeka_1978@REDACTED (eigenfunction) Date: Mon, 30 Apr 2012 05:27:09 -0700 (PDT) Subject: [erlang-questions] net_adm:ping/1 Message-ID: <40f3f8ac-df2c-49bd-902e-9b8644c59e1d@l3g2000vbv.googlegroups.com> Hi everybody, i habe been trying to rpc another node on the same machine, but that node did not respond. I then tried this: (test2@REDACTED) > erl_epmd:names(localhost). {ok,[{test1,45555},{test2,49788}]} (test2@REDACTED) > net_adm:ping(test1@REDACTED). pang. (test2@REDACTED) > net_adm:ping(test1@REDACTED). pang. Any Idea why it is not working? From watson.timothy@REDACTED Mon Apr 30 14:37:18 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Mon, 30 Apr 2012 13:37:18 +0100 Subject: [erlang-questions] Pros and Cons OTP Release In-Reply-To: References: <81D0E211AC9843FFA7A33CE39FF2E424@gmail.com> Message-ID: On 28 April 2012 17:19, Tilman Holschuh wrote: > One further slight disadvantage of using releases you cannot add as easily a new application to your release. Say you have your production system running for a while and now you want to run redbug because you found a problem. If it was not contained in your release you have to manually add it somehow. > Although funnily enough, I would've thought that redbug was the exception to the rule, as eper has (at least) support for shipping modules to a remote machine when using prf:start/3 - does this not work with redbug also? Anyway, it's a valid point for adding many other applications nonetheless. Cheers, Tim From claudef@REDACTED Mon Apr 30 14:47:18 2012 From: claudef@REDACTED (claudef@REDACTED) Date: Mon, 30 Apr 2012 09:47:18 -0300 Subject: [erlang-questions] Fw: Issue with Riak Install from Source under SUSE SLES 11 SP11 Version S390 / Problem solved Message-ID: Dear colleagues, Problem solved! To give you a current feedback about the status of the port. I've succeed to ported the RIAK database under the IBM mainframe system z model E114 running it under the Linux SUSE SLES 11 SP1. I was very happy to find a post from Mr. Nobuhiro Iwamatsu (Debian Linux Engineer) who described a fix for the module atomic_pointer.h to reconize the S390 architecture (possibly also the Power7). I suggest to Basho to include this fix into the latest .github source distribution. I'v applied those changes to the module and the executable now was successfully built.. I already did some testing with the Python and Java clients , both are working perfectly with a few samples from the Basho wiki. First of all, my big thanks for the great support from the Erlang user group, as well as the Riak user group that both helped me to quickly fix those porting issues. Regards, Claude Dear colleagues, Thanks for the quick replies in usergroup. I've reinstalled the "curl" and "expat" packages both from its source and rebuilt the "git" tool using the: ./configure --with-curl --with-expat ps .. yes, for Suse it must be done from source. As Jared pointed below, by changing the git protocol to "http://" it solved the issue and the "leveldb" package was successfully downloaded. This is a good step forwards. During the build and a few steps later I got another error message telling: "Please implement AtomicPointer for this platform" HEAD is now at 14478f1... Rework compaction scoring to ensure L1 doesn't exceed the max bytes on that level make[1]: Entering directory `/opt/riak/riak-1.1.2/deps/eleveldb/c_src/leveldb' c++ -fPIC -fPIC -I /opt/riak/riak-1.1.2/deps/eleveldb/c_src/system/include -c -I. -I./include -fno-builtin-memcmp -DLEVELDB_PLATFORM_POSIX -pthread -DOS_LINUX -O2 -DNDEBUG -DSNAPPY db/builder.cc -o db/builder.o In file included from ./port/port_posix.h:28, from ./port/port.h:14, from ./db/filename.h:14, from db/builder.cc:7: ./port/atomic_pointer.h:133:2: error: #error Please implement AtomicPointer for this platform. make[1]: *** [db/builder.o] Error 1 make[1]: Leaving directory `/opt/riak/riak-1.1.2/deps/eleveldb/c_src/leveldb' ERROR: Command [compile] failed! make: *** [rel] Error 1 Any idea how to fix this error? Any dependency with other packages? Thanks in advance for your support. Regards, Claude Claude Falbriard Certified IT Specialist L2 - Middleware AMS Hortol?ndia / SP - Brazil phone: +55 19 9837 0789 cell: +55 13 8117 3316 e-mail: claudef@REDACTED From: Jared Morrow To: claudef@REDACTED Cc: riak-users@REDACTED Date: 28/04/2012 01:17 Subject: Re: Issue with Riak Install from Source under SUSE SLES 11 SP11 Version S390 Claude, The issue is not in the rebar.config file for eleveldb, but in a file that fetches the original C++ source for leveldb. To fix your issue, simply unpack the riak source as you already did then: $ cd deps/eleveldb And then make the following changes to 'c_src/build_deps.sh': --- c_src/build_deps.sh.orig 2012-04-27 22:06:31.000000000 -0600 +++ c_src/build_deps.sh 2012-04-27 22:07:49.000000000 -0600 @@ -37,7 +37,7 @@ export LD_LIBRARY_PATH="$BASEDIR/system/lib:$LD_LIBRARY_PATH" if [ ! -d leveldb ]; then - git clone git://github.com/basho/leveldb + git clone http://github.com/basho/leveldb (cd leveldb && git checkout $LEVELDB_VSN) fi Then return to the top-level source directory for Riak and run 'make' and things should be better. -Jared On Apr 27, 2012, at 12:31 PM, claudef@REDACTED wrote: Dear colleagues, Trying to install the RIAK package under a SUSE SLES 11 SP11 Version S390. I've downloaded the .tar.gz install file from the BASHO site. First I've installed the Erlang package with the --with-ssl option and recompiled the openssl package with the "shared" option, as requested by the Erlang procedure. Using the "make rel" command, I see a successful build running on the screen, until a point where the install tries to connect to the GITHUB, throwing an error like this: test -z "/opt/riak/riak-1.1.2/deps/eleveldb/c_src/system/share/doc/snappy" || /bin/mkdir -p "/opt/riak/riak-1.1.2/deps/eleveldb/c_src/system/share/doc/snappy" /usr/bin/install -c -m 644 ChangeLog COPYING INSTALL NEWS README format_description.txt '/opt/riak/riak-1.1.2/deps/eleveldb/c_src/system/share/doc/snappy' test -z "/opt/riak/riak-1.1.2/deps/eleveldb/c_src/system/include" || /bin/mkdir -p "/opt/riak/riak-1.1.2/deps/eleveldb/c_src/system/include" /usr/bin/install -c -m 644 snappy.h snappy-sinksource.h snappy-stubs-public.h snappy-c.h '/opt/riak/riak-1.1.2/deps/eleveldb/c_src/system/include' make[2]: Leaving directory `/opt/riak/riak-1.1.2/deps/eleveldb/c_src/snappy-1.0.4' make[1]: Leaving directory `/opt/riak/riak-1.1.2/deps/eleveldb/c_src/snappy-1.0.4' fatal: unable to connect to github.com: github.com[0: 207.97.227.239]: errno=Connection refused Cloning into 'leveldb'... ERROR: Command [compile] failed! make: *** [rel] Error 1 The riak executable was not yet created under the /bin. Question: -------------- Is there a way to avoid a connect to GITHUB during the package build from source, or could you give me a pointer what is causing the connection to be refused, as our firewall is configured for outgoing HTTP connections (which port and protocol does it use?). Thanks in advance for your feedback and support. Regards, Claude Claude Falbriard Certified IT Specialist L2 - Middleware AMS Hortol?ndia / SP - Brazil phone: +55 19 9837 0789 cell: +55 13 8117 3316 e-mail: claudef@REDACTED _______________________________________________ riak-users mailing list riak-users@REDACTED http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From rtrlists@REDACTED Mon Apr 30 15:41:50 2012 From: rtrlists@REDACTED (Robert Raschke) Date: Mon, 30 Apr 2012 14:41:50 +0100 Subject: [erlang-questions] net_adm:ping/1 In-Reply-To: <40f3f8ac-df2c-49bd-902e-9b8644c59e1d@l3g2000vbv.googlegroups.com> References: <40f3f8ac-df2c-49bd-902e-9b8644c59e1d@l3g2000vbv.googlegroups.com> Message-ID: Are the nodes using the same cookie? (See http://www.erlang.org/doc/getting_started/conc_prog.html#id67210) On Mon, Apr 30, 2012 at 1:27 PM, eigenfunction wrote: > Hi everybody, > i habe been trying to rpc another node on the same machine, but that > node did not respond. I then tried this: > > (test2@REDACTED) > erl_epmd:names(localhost). > {ok,[{test1,45555},{test2,49788}]} > > (test2@REDACTED) > net_adm:ping(test1@REDACTED). > pang. > > (test2@REDACTED) > net_adm:ping(test1@REDACTED). > pang. > > > Any Idea why it is not working? > -------------- next part -------------- An HTML attachment was scrubbed... URL: From emeka_1978@REDACTED Mon Apr 30 15:53:09 2012 From: emeka_1978@REDACTED (eigenfunction) Date: Mon, 30 Apr 2012 06:53:09 -0700 (PDT) Subject: [erlang-questions] net_adm:ping/1 In-Reply-To: References: <40f3f8ac-df2c-49bd-902e-9b8644c59e1d@l3g2000vbv.googlegroups.com> Message-ID: <737c3c17-7373-49f5-be36-618c38365bb0@a5g2000vbl.googlegroups.com> Yes they are. On 30 Apr., 15:41, Robert Raschke wrote: > Are the nodes using the same cookie? > (Seehttp://www.erlang.org/doc/getting_started/conc_prog.html#id67210) > > > > > > > > On Mon, Apr 30, 2012 at 1:27 PM, eigenfunction wrote: > > Hi everybody, > > i habe been trying to rpc another node on the same machine, but that > > node did not respond. I then tried this: > > > (test2@REDACTED) > erl_epmd:names(localhost). > > ?{ok,[{test1,45555},{test2,49788}]} > > > (test2@REDACTED) > net_adm:ping(test1@REDACTED). > > pang. > > > (test2@REDACTED) > net_adm:ping(test1@REDACTED). > > pang. > > > Any Idea why it is not working? > > > > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From bsvancara@REDACTED Mon Apr 30 16:04:15 2012 From: bsvancara@REDACTED (Bohuslav Svancara) Date: Mon, 30 Apr 2012 16:04:15 +0200 Subject: [erlang-questions] net_adm:ping/1 In-Reply-To: <40f3f8ac-df2c-49bd-902e-9b8644c59e1d@l3g2000vbv.googlegroups.com> References: <40f3f8ac-df2c-49bd-902e-9b8644c59e1d@l3g2000vbv.googlegroups.com> Message-ID: A) erl -name n1@REDACTED -setcookie 123456 B) erl -name n2@REDACTED -setcookie 123456 C) (n2@REDACTED)1> net_adm:ping('n1@REDACTED'). pong (n2@REDACTED)2> nodes(). ['n1@REDACTED'] D) (n1@REDACTED)1> nodes(). ['n2@REDACTED'] No problem :-) Sincerely, Bob 2012/4/30 eigenfunction > Hi everybody, > i habe been trying to rpc another node on the same machine, but that > node did not respond. I then tried this: > > (test2@REDACTED) > erl_epmd:names(localhost). > {ok,[{test1,45555},{test2,49788}]} > > (test2@REDACTED) > net_adm:ping(test1@REDACTED). > pang. > > (test2@REDACTED) > net_adm:ping(test1@REDACTED). > pang. > > > Any Idea why it is not working? > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From boris.muehmer@REDACTED Mon Apr 30 16:34:35 2012 From: boris.muehmer@REDACTED (=?UTF-8?Q?Boris_M=C3=BChmer?=) Date: Mon, 30 Apr 2012 16:34:35 +0200 Subject: [erlang-questions] net_adm:ping/1 In-Reply-To: <737c3c17-7373-49f5-be36-618c38365bb0@a5g2000vbl.googlegroups.com> References: <40f3f8ac-df2c-49bd-902e-9b8644c59e1d@l3g2000vbv.googlegroups.com> <737c3c17-7373-49f5-be36-618c38365bb0@a5g2000vbl.googlegroups.com> Message-ID: Which OS do You use? If You're running the "avahi" daemon on Ubuntu You may run into different problems. May old solution was to remove the avahi-daemon, but recently I started to tweak the avahi configuration instead (I only had to change the value for "domain-name" in "/etc/avahi/avahi-daemon.conf"). - boris From yoursurrogategod@REDACTED Mon Apr 30 17:08:34 2012 From: yoursurrogategod@REDACTED (Yves S. Garret) Date: Mon, 30 Apr 2012 11:08:34 -0400 Subject: [erlang-questions] Artificial Intelligence and Erlang? Message-ID: Does anyone know of a good source on AI and Erlang? A book would be awesome! Most of the sources that I see out there have Lisp as the functional programming language of choice. Erlang seems like a better option given it's nature of distributed nature and ability to place a ton of processes in less space. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cgsmcmlxxv@REDACTED Mon Apr 30 17:16:17 2012 From: cgsmcmlxxv@REDACTED (CGS) Date: Mon, 30 Apr 2012 17:16:17 +0200 Subject: [erlang-questions] Artificial Intelligence and Erlang? In-Reply-To: References: Message-ID: Having AI in Erlang would be awesome! But I fear if someone spends so much time to create such a thing, he/she would like to earn something from that work. :) Cheers, CGS On Mon, Apr 30, 2012 at 5:08 PM, Yves S. Garret wrote: > Does anyone know of a good source on AI and Erlang? A book would be > awesome! Most of the sources that I see out there have Lisp as the > functional programming language of choice. Erlang seems like a better > option given it's nature of distributed nature and ability to place a ton > of processes in less space. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Mon Apr 30 17:18:03 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Mon, 30 Apr 2012 17:18:03 +0200 Subject: [erlang-questions] Artificial Intelligence and Erlang? In-Reply-To: References: Message-ID: <4F27D4BF-CA43-4FAC-B9F0-BE8995B62941@gmail.com> Eresye (Corroda Santoro): http://www.erlang-solutions.com/erlangworkshop05/eresye.pdf http://sourceforge.net/projects/eresye/ Regards, Zabrane On Apr 30, 2012, at 5:08 PM, Yves S. Garret wrote: > Does anyone know of a good source on AI and Erlang? A book would be awesome! Most of the sources that I see out there have Lisp as the functional programming language of choice. Erlang seems like a better option given it's nature of distributed nature and ability to place a ton of processes in less space. _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From mfidelman@REDACTED Mon Apr 30 17:18:55 2012 From: mfidelman@REDACTED (Miles Fidelman) Date: Mon, 30 Apr 2012 11:18:55 -0400 Subject: [erlang-questions] Artificial Intelligence and Erlang? In-Reply-To: References: Message-ID: <4F9EAD5F.3010203@meetinghouse.net> Yves S. Garret wrote: > Does anyone know of a good source on AI and Erlang? A book would be > awesome! Most of the sources that I see out there have Lisp as the > functional programming language of choice. Erlang seems like a better > option given it's nature of distributed nature and ability to place a > ton of processes in less space. > > Not Erlang per se, but Erlang is really an implementation of the Actor formalism. You'll find a lot if you google on things like: "actor model" "actor formalism" planner (the computer language) "Carl Hewitt" - the father of the actor formalism be warned, if you google on "artifical intelligence" + actors - you'll get lots of pages on A.I. the movie :-) -- In theory, there is no difference between theory and practice. In practice, there is. .... Yogi Berra From mfidelman@REDACTED Mon Apr 30 17:20:37 2012 From: mfidelman@REDACTED (Miles Fidelman) Date: Mon, 30 Apr 2012 11:20:37 -0400 Subject: [erlang-questions] Artificial Intelligence and Erlang? In-Reply-To: <4F9EAD5F.3010203@meetinghouse.net> References: <4F9EAD5F.3010203@meetinghouse.net> Message-ID: <4F9EADC5.7040503@meetinghouse.net> Miles Fidelman wrote: > Yves S. Garret wrote: >> Does anyone know of a good source on AI and Erlang? A book would be >> awesome! Most of the sources that I see out there have Lisp as the >> functional programming language of choice. Erlang seems like a >> better option given it's nature of distributed nature and ability to >> place a ton of processes in less space. >> >> > Not Erlang per se, but Erlang is really an implementation of the Actor > formalism. You'll find a lot if you google on things like: > "actor model" > "actor formalism" > planner (the computer language) > "Carl Hewitt" - the father of the actor formalism > > be warned, if you google on "artifical intelligence" + actors - you'll > get lots of pages on A.I. the movie :-) Should have added: multi-agent systems are also an actor-like model that map nicely onto Erlang, but for some reason seem mostly to be developed in Java. I expect a lot of the higher-level architectural models and design patterns for multi-agent systems would be trivial to implement in Erlang. -- In theory, there is no difference between theory and practice. In practice, there is. .... Yogi Berra From zabrane3@REDACTED Mon Apr 30 17:24:56 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Mon, 30 Apr 2012 17:24:56 +0200 Subject: [erlang-questions] Artificial Intelligence and Erlang? In-Reply-To: <4F9EAD5F.3010203@meetinghouse.net> References: <4F9EAD5F.3010203@meetinghouse.net> Message-ID: <3DF58113-1F5B-42BB-BCC4-B3888B9F28DB@gmail.com> Erlang & neural networks: http://webjazz.blogspot.com/2007/03/erlang-and-neural-networks-part-i.html Regards, Zabrane On Apr 30, 2012, at 5:18 PM, Miles Fidelman wrote: > Yves S. Garret wrote: >> Does anyone know of a good source on AI and Erlang? A book would be awesome! Most of the sources that I see out there have Lisp as the functional programming language of choice. Erlang seems like a better option given it's nature of distributed nature and ability to place a ton of processes in less space. >> >> > Not Erlang per se, but Erlang is really an implementation of the Actor formalism. You'll find a lot if you google on things like: > "actor model" > "actor formalism" > planner (the computer language) > "Carl Hewitt" - the father of the actor formalism > > be warned, if you google on "artifical intelligence" + actors - you'll get lots of pages on A.I. the movie :-) > > > > -- > In theory, there is no difference between theory and practice. > In practice, there is. .... Yogi Berra > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From gleber.p@REDACTED Mon Apr 30 17:30:45 2012 From: gleber.p@REDACTED (Gleb Peregud) Date: Mon, 30 Apr 2012 17:30:45 +0200 Subject: [erlang-questions] Artificial Intelligence and Erlang? In-Reply-To: <4F9EADC5.7040503@meetinghouse.net> References: <4F9EAD5F.3010203@meetinghouse.net> <4F9EADC5.7040503@meetinghouse.net> Message-ID: I am current maintainer of eXAT, which is an implementation of multi-agent system's protocols by FIPA. I have heavily rewritten it to be more compliant with standard Erlang code. And switched it to use Seresye which is a continuation of Eresye. Feel free to try it out, although take a note that both are of pre-beta quality yet 30 kwi 2012 17:20, "Miles Fidelman" napisa?(a): > Miles Fidelman wrote: > >> Yves S. Garret wrote: >> >>> Does anyone know of a good source on AI and Erlang? A book would be >>> awesome! Most of the sources that I see out there have Lisp as the >>> functional programming language of choice. Erlang seems like a better >>> option given it's nature of distributed nature and ability to place a ton >>> of processes in less space. >>> >>> >>> Not Erlang per se, but Erlang is really an implementation of the Actor >> formalism. You'll find a lot if you google on things like: >> "actor model" >> "actor formalism" >> planner (the computer language) >> "Carl Hewitt" - the father of the actor formalism >> >> be warned, if you google on "artifical intelligence" + actors - you'll >> get lots of pages on A.I. the movie :-) >> > > Should have added: multi-agent systems are also an actor-like model that > map nicely onto Erlang, but for some reason seem mostly to be developed in > Java. I expect a lot of the higher-level architectural models and design > patterns for multi-agent systems would be trivial to implement in Erlang. > > > > > -- > In theory, there is no difference between theory and practice. > In practice, there is. .... Yogi Berra > > > ______________________________**_________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/**listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zabrane3@REDACTED Mon Apr 30 17:35:29 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Mon, 30 Apr 2012 17:35:29 +0200 Subject: [erlang-questions] Artificial Intelligence and Erlang? In-Reply-To: <4F9EAD5F.3010203@meetinghouse.net> References: <4F9EAD5F.3010203@meetinghouse.net> Message-ID: Erlang & MultiAgents systems: * Exat (source somewhere on the Net): http://www.erlang.se/euc/05/Santoro.pdf * http://www.erlang.se/workshop/2004/carlosvarela.pdf Regards, Zabrane On Apr 30, 2012, at 5:18 PM, Miles Fidelman wrote: > Yves S. Garret wrote: >> Does anyone know of a good source on AI and Erlang? A book would be awesome! Most of the sources that I see out there have Lisp as the functional programming language of choice. Erlang seems like a better option given it's nature of distributed nature and ability to place a ton of processes in less space. >> >> > Not Erlang per se, but Erlang is really an implementation of the Actor formalism. You'll find a lot if you google on things like: > "actor model" > "actor formalism" > planner (the computer language) > "Carl Hewitt" - the father of the actor formalism > > be warned, if you google on "artifical intelligence" + actors - you'll get lots of pages on A.I. the movie :-) > > > > -- > In theory, there is no difference between theory and practice. > In practice, there is. .... Yogi Berra > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions From zabrane3@REDACTED Mon Apr 30 17:39:35 2012 From: zabrane3@REDACTED (Zabrane Mickael) Date: Mon, 30 Apr 2012 17:39:35 +0200 Subject: [erlang-questions] Artificial Intelligence and Erlang? In-Reply-To: References: <4F9EAD5F.3010203@meetinghouse.net> <4F9EADC5.7040503@meetinghouse.net> Message-ID: <8442A289-D1A9-4DDC-B32E-BECC52FFE846@gmail.com> Hi Gled, Where can I find "eXat" and "Sereyse"? Regards, Zabrane On Apr 30, 2012, at 5:30 PM, Gleb Peregud wrote: > I am current maintainer of eXAT, which is an implementation of multi-agent system's protocols by FIPA. I have heavily rewritten it to be more compliant with standard Erlang code. And switched it to use Seresye which is a continuation of Eresye. > > Feel free to try it out, although take a note that both are of pre-beta quality yet > > 30 kwi 2012 17:20, "Miles Fidelman" napisa?(a): > Miles Fidelman wrote: > Yves S. Garret wrote: > Does anyone know of a good source on AI and Erlang? A book would be awesome! Most of the sources that I see out there have Lisp as the functional programming language of choice. Erlang seems like a better option given it's nature of distributed nature and ability to place a ton of processes in less space. > > > Not Erlang per se, but Erlang is really an implementation of the Actor formalism. You'll find a lot if you google on things like: > "actor model" > "actor formalism" > planner (the computer language) > "Carl Hewitt" - the father of the actor formalism > > be warned, if you google on "artifical intelligence" + actors - you'll get lots of pages on A.I. the movie :-) > > Should have added: multi-agent systems are also an actor-like model that map nicely onto Erlang, but for some reason seem mostly to be developed in Java. I expect a lot of the higher-level architectural models and design patterns for multi-agent systems would be trivial to implement in Erlang. > > > > > -- > In theory, there is no difference between theory and practice. > In practice, there is. .... Yogi Berra > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From jose.valim@REDACTED Mon Apr 30 17:39:52 2012 From: jose.valim@REDACTED (=?ISO-8859-1?Q?Jos=E9_Valim?=) Date: Mon, 30 Apr 2012 17:39:52 +0200 Subject: [erlang-questions] Frames proposal In-Reply-To: <4714288D-1696-49E3-9854-8707CC84CE6F@cs.otago.ac.nz> References: <4714288D-1696-49E3-9854-8707CC84CE6F@cs.otago.ac.nz> Message-ID: Thanks Richard for your work and the article. It was a good read! Given the current good results, what is the likelihood we will see this feature in R16? * Jos? Valim www.plataformatec.com.br Founder and Lead Developer * On Mon, Apr 30, 2012 at 3:09 AM, Richard O'Keefe wrote: > There is a new version of > http://www.cs.otago.ac.nz/staffpriv/ok/frames.pdf > up. This one has some encouraging experimental results. > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf@REDACTED Mon Apr 30 17:58:10 2012 From: ulf@REDACTED (Ulf Wiger) Date: Mon, 30 Apr 2012 17:58:10 +0200 Subject: [erlang-questions] Artificial Intelligence and Erlang? In-Reply-To: References: Message-ID: <601B3A58-5912-4EF6-888F-91EACBA851C0@feuerlabs.com> The USAF Cognitive Modeling Group is doing some pretty interesting stuff in Erlang for large-scale cognitive modeling and simulations. http://article.gmane.org/gmane.comp.lang.erlang.general/50450 http://iccm2010.cs.drexel.edu/proceedings/papers/Douglass.pdf http://duniptechnologies.com/jm/images/dunip/docs/2011_DSLToImproveScale.pdf BR, Ulf W On 30 Apr 2012, at 17:08, Yves S. Garret wrote: > Does anyone know of a good source on AI and Erlang? A book would be awesome! Most of the sources that I see out there have Lisp as the functional programming language of choice. Erlang seems like a better option given it's nature of distributed nature and ability to place a ton of processes in less space. _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc. http://feuerlabs.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From emeka_1978@REDACTED Mon Apr 30 18:01:16 2012 From: emeka_1978@REDACTED (eigenfunction) Date: Mon, 30 Apr 2012 09:01:16 -0700 (PDT) Subject: [erlang-questions] net_adm:ping/1 In-Reply-To: References: <40f3f8ac-df2c-49bd-902e-9b8644c59e1d@l3g2000vbv.googlegroups.com> <737c3c17-7373-49f5-be36-618c38365bb0@a5g2000vbl.googlegroups.com> Message-ID: I am using Suse. Now the funny thing is that, back home and using the same script, everything is working fine. I will try your solution. Thanks. On Apr 30, 4:34?pm, Boris M?hmer wrote: > Which OS do You use? > > If You're running the "avahi" daemon on Ubuntu You may run into > different problems. May old solution was to remove the avahi-daemon, > but recently I started to tweak the avahi configuration instead (I > only had to change the value for "domain-name" in > "/etc/avahi/avahi-daemon.conf"). > > ? - boris > _______________________________________________ > erlang-questions mailing list > erlang-questi...@REDACTED://erlang.org/mailman/listinfo/erlang-questions From watson.timothy@REDACTED Mon Apr 30 18:53:03 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Mon, 30 Apr 2012 17:53:03 +0100 Subject: [erlang-questions] Frames proposal In-Reply-To: References: <4714288D-1696-49E3-9854-8707CC84CE6F@cs.otago.ac.nz> Message-ID: Some assistance with converting the proposal to markdown format perhaps....? On 30 April 2012 16:39, Jos? Valim wrote: > Thanks Richard for your work and the article. It was a good read! > Given the current good results, what is the likelihood we will see this > feature in R16? > > > Jos? Valim > www.plataformatec.com.br > Founder and Lead Developer > > > > On Mon, Apr 30, 2012 at 3:09 AM, Richard O'Keefe wrote: >> >> There is a new version of >> http://www.cs.otago.ac.nz/staffpriv/ok/frames.pdf >> up. ?This one has some encouraging experimental results. >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://erlang.org/mailman/listinfo/erlang-questions > > > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > From max.lapshin@REDACTED Mon Apr 30 19:13:17 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Mon, 30 Apr 2012 21:13:17 +0400 Subject: [erlang-questions] Frames proposal In-Reply-To: References: <4714288D-1696-49E3-9854-8707CC84CE6F@cs.otago.ac.nz> Message-ID: Maybe it possible to add JSON notation to frame handling? It would be very convenient, because {id : 4135, title : "title2"} is mapped to [{id, 4135}, {title, "title2"}]. The only difference is that in all external format handlers binaries are used to represent external strings. From erisa85d@REDACTED Mon Apr 30 19:17:50 2012 From: erisa85d@REDACTED (Erisa Dervishi) Date: Mon, 30 Apr 2012 19:17:50 +0200 Subject: [erlang-questions] Can't load crypto module after installing R15 in Solaris 10 x86 Message-ID: Hi all, I have installed Erlang OTP R15, in Solaris 10 x86. When I try to load the crypto module I get the following error: Erlang R15B (erts-5.9) [source] [smp:16:16] [async-threads:0] [kernel-poll:false] Eshell V5.9 (abort with ^G) 1> l(crypto). =ERROR REPORT==== 30-Apr-2012::16:29:45 === Unable to load crypto library. Failed with error: "load_failed, Failed to load NIF library: 'ld.so.1: beam.smp: fatal: relocation error: file /usr/local/otp_R15B/lib/erlang/lib/crypto-2.1/priv/lib/crypto.so: symbol DES_ede3_cfb_encrypt: referenced symbol not found'" OpenSSL might not be installed on this system. {error,on_load_failure} =ERROR REPORT==== 30-Apr-2012::16:29:45 === The on_load function for module crypto returned {error, {load_failed, "Failed to load NIF library: 'ld.so.1: beam.smp: fatal: relocation error: file /usr/local/otp_R15B/lib/erlang/lib/crypto-2.1/priv/lib/crypto.so: symbol DES_ede3_cfb_encrypt: referenced symbol not found'"}} OpenSSL is installed. As suggested in the Erlang documentation, I installed it from http://www.openssl.org/source/ (version: openssl-0.9.8w.tar.gz) I tried several suggestions after googling but nothing helped. Any help to get this straight would be appreciated :) Thanks, Erisa -------------- next part -------------- An HTML attachment was scrubbed... URL: From watson.timothy@REDACTED Mon Apr 30 19:22:09 2012 From: watson.timothy@REDACTED (Tim Watson) Date: Mon, 30 Apr 2012 18:22:09 +0100 Subject: [erlang-questions] Can't load crypto module after installing R15 in Solaris 10 x86 In-Reply-To: References: Message-ID: <378BA1B5-914E-430C-99BA-8AAA10F68737@gmail.com> Did you pass --with-ssl= during configure? On 30 Apr 2012, at 18:17, Erisa Dervishi wrote: > Hi all, > > I have installed Erlang OTP R15, in Solaris 10 x86. > When I try to load the crypto module I get the following error: > > Erlang R15B (erts-5.9) [source] [smp:16:16] [async-threads:0] [kernel-poll:false] > > Eshell V5.9 (abort with ^G) > 1> l(crypto). > > =ERROR REPORT==== 30-Apr-2012::16:29:45 === > Unable to load crypto library. Failed with error: > "load_failed, Failed to load NIF library: 'ld.so.1: beam.smp: fatal: relocation error: file /usr/local/otp_R15B/lib/erlang/lib/crypto-2.1/priv/lib/crypto.so: symbol DES_ede3_cfb_encrypt: referenced symbol not found'" > OpenSSL might not be installed on this system. > {error,on_load_failure} > > =ERROR REPORT==== 30-Apr-2012::16:29:45 === > The on_load function for module crypto returned {error, > {load_failed, > "Failed to load NIF library: 'ld.so.1: beam.smp: fatal: relocation error: file /usr/local/otp_R15B/lib/erlang/lib/crypto-2.1/priv/lib/crypto.so: symbol DES_ede3_cfb_encrypt: referenced symbol not found'"}} > > > OpenSSL is installed. As suggested in the Erlang documentation, I installed it from http://www.openssl.org/source/ (version: openssl-0.9.8w.tar.gz) > I tried several suggestions after googling but nothing helped. > Any help to get this straight would be appreciated :) > > Thanks, > Erisa > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From claudef@REDACTED Mon Apr 30 19:38:13 2012 From: claudef@REDACTED (claudef@REDACTED) Date: Mon, 30 Apr 2012 14:38:13 -0300 Subject: [erlang-questions] Can't load crypto module after installing R15 in Solaris 10 x86 In-Reply-To: References: Message-ID: Dear Erisa, I've just finished to build the Riak, Erlang from its source under a SUSE LINUX on a S390 machine, now having the crypto support. In order to make it work, I needed to download the source of the OpenSSL package and rebuild it completely. I also needed to add some flags for "gcc" compiler to allow a successful build as the standard Erlang build showed some conflicts with shared modules. This is what I did during the OpenSSL install: ./config no-shared This is what I did during the Erlang install: export CFLAGS="$CFLAGS -fPIC" export CXXFLAGS="$CXXFLAGS -fPIC" export CC="gcc -fPIC" ./configure --with-ssl --with-ssl-lib=SSL_LIBRARY_PATH Yes, the conflict showed up in the crypto module, Not sure, if it applies to the Sun environment. but give it a trial, Regards, Claude Claude Falbriard Certified IT Specialist L2 - Middleware AMS Hortol?ndia / SP - Brazil phone: +55 19 9837 0789 cell: +55 13 8117 3316 e-mail: claudef@REDACTED From: Erisa Dervishi To: erlang-questions@REDACTED Date: 30/04/2012 14:17 Subject: [erlang-questions] Can't load crypto module after installing R15 in Solaris 10 x86 Sent by: erlang-questions-bounces@REDACTED Hi all, I have installed Erlang OTP R15, in Solaris 10 x86. When I try to load the crypto module I get the following error: Erlang R15B (erts-5.9) [source] [smp:16:16] [async-threads:0] [kernel-poll:false] Eshell V5.9 (abort with ^G) 1> l(crypto). =ERROR REPORT==== 30-Apr-2012::16:29:45 === Unable to load crypto library. Failed with error: "load_failed, Failed to load NIF library: 'ld.so.1: beam.smp: fatal: relocation error: file /usr/local/otp_R15B/lib/erlang/lib/crypto-2.1/priv/lib/crypto.so: symbol DES_ede3_cfb_encrypt: referenced symbol not found'" OpenSSL might not be installed on this system. {error,on_load_failure} =ERROR REPORT==== 30-Apr-2012::16:29:45 === The on_load function for module crypto returned {error, {load_failed, "Failed to load NIF library: 'ld.so.1: beam.smp: fatal: relocation error: file /usr/local/otp_R15B/lib/erlang/lib/crypto-2.1/priv/lib/crypto.so: symbol DES_ede3_cfb_encrypt: referenced symbol not found'"}} OpenSSL is installed. As suggested in the Erlang documentation, I installed it from http://www.openssl.org/source/ (version: openssl-0.9.8w.tar.gz) I tried several suggestions after googling but nothing helped. Any help to get this straight would be appreciated :) Thanks, Erisa _______________________________________________ erlang-questions mailing list erlang-questions@REDACTED http://erlang.org/mailman/listinfo/erlang-questions -------------- next part -------------- An HTML attachment was scrubbed... URL: From jose.valim@REDACTED Mon Apr 30 19:47:59 2012 From: jose.valim@REDACTED (=?ISO-8859-1?Q?Jos=E9_Valim?=) Date: Mon, 30 Apr 2012 19:47:59 +0200 Subject: [erlang-questions] binary_to_integer/1 and binary_to_float/1 and friends Message-ID: At the beginning of this year, there was a discussion about how to implement binary_to_integer/1 in Erlang. There is a possible implementation for such function which is quite trivial: list_to_integer(binary_to_list(binary)) However, it has the trade-off that it can't be used in guards (unless defined in a macro) and there is an unnecessary conversion cost to list (although the cost is small since both binary and list are likely small). With Riak, Cowboy and other tools pushing towards using binaries instead of lists for strings, the need for such functions will become more and more common. Is there any chance we will see this as built-in functions and therefore available in guards in R16? Thanks, * Jos? Valim www.plataformatec.com.br Founder and Lead Developer * -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob@REDACTED Mon Apr 30 19:53:02 2012 From: bob@REDACTED (Bob Ippolito) Date: Mon, 30 Apr 2012 10:53:02 -0700 Subject: [erlang-questions] binary_to_integer/1 and binary_to_float/1 and friends In-Reply-To: References: Message-ID: On Mon, Apr 30, 2012 at 10:47 AM, Jos? Valim wrote: > At the beginning of this year, there was a discussion about how to > implement binary_to_integer/1 in Erlang. > There is a possible implementation for such function which is quite > trivial: > > list_to_integer(binary_to_list(binary)) > > However, it has the trade-off that it can't be used in guards (unless > defined in a macro) and there is an unnecessary conversion cost to list > (although the cost is small since both binary and list are likely small). > > With Riak, Cowboy and other tools pushing towards using binaries instead > of lists for strings, the need for such functions will become more and more > common. > Is there any chance we will see this as built-in functions and therefore > available in guards in R16? > I think this is a good proposal. We've already got these functions for atoms, numbers make sense too. I find myself implementing this often one way or another, sometimes just using a JSON parser and checking that the result is the kind of number I'm looking for. -bob -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Mon Apr 30 19:54:18 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Mon, 30 Apr 2012 21:54:18 +0400 Subject: [erlang-questions] binary_to_integer/1 and binary_to_float/1 and friends In-Reply-To: References: Message-ID: > defined in a macro) and there is an unnecessary conversion cost to list > (although the cost is small since both binary and list are likely small). > Cost is not so small, because NIF binary_to_integer will create only one object, when list_to_integer(binary_to_list()) will create many of them. It is very important when you need to import LOTS of numbers (read about my CSV parsing). From tristan.sloughter@REDACTED Mon Apr 30 19:54:19 2012 From: tristan.sloughter@REDACTED (Tristan Sloughter) Date: Mon, 30 Apr 2012 12:54:19 -0500 Subject: [erlang-questions] Case-insensitive key search on a list Message-ID: So you want to find a tuple in a list converted from JSON so the key is binary. And not only that, you want it to be case insensitive! Now as far as I found, I'm only now bothering to go back to this code and ask why, there is only string:equal/2 and it doesn't support case insensitive matching. And not only that but string:to_lower/1 only supports lists. So I ended up with a conversion to a list, then to_lower and then back to a binary.... It is too ugly to think it was right... Does anyone know a better way of doing this? I feel I am missing something obvious. case_insensitive_binary_string_keyfind(_String, _Pos, []) -> false; case_insensitive_binary_string_keyfind(String, Pos, [H|T]) -> case list_to_binary( string:to_lower( binary_to_list( element(Pos, H)))) of String -> H; _ -> case_insensitive_binary_string_keyfind(String, Pos, T) end. -------------- next part -------------- An HTML attachment was scrubbed... URL: From raskchanky@REDACTED Mon Apr 30 20:05:52 2012 From: raskchanky@REDACTED (Josh Black) Date: Mon, 30 Apr 2012 11:05:52 -0700 Subject: [erlang-questions] Debugging apps with dependencies Message-ID: <4BE220475DFC4F5AA43F0637D39ED568@gmail.com> Hi, erlang beginner here. I have a question about the best way to debug apps which include dependencies. I'm working on an app, and so far, I've been testing it by using rebar to generate a release, then starting a console for the release and going from there. The problem comes when I want to use something like dbg or appmon to debug errors or inspect the state of my app. When I try to do, e.g. appmon:start() from the console for my release, it tells me "undefined function appmon:start/0". I'm guessing this is because I didn't explicitly specify appmon in my release configuration? Alternatively, I created a start.sh shell script with contents like this: erl -pa apps/*/ebin -pa deps/*/ebin -eval 'application:start(dependency1), application:start(dependency2), application:start(myapp).' This lets me start appmon and whatever else I want when I run into errors, but feels pretty messy and wrong. I feel like I'm missing something really obvious here. What's the correct way to do this? -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob@REDACTED Mon Apr 30 20:13:24 2012 From: bob@REDACTED (Bob Ippolito) Date: Mon, 30 Apr 2012 11:13:24 -0700 Subject: [erlang-questions] binary_to_integer/1 and binary_to_float/1 and friends In-Reply-To: References: Message-ID: On Mon, Apr 30, 2012 at 10:54 AM, Max Lapshin wrote: > > defined in a macro) and there is an unnecessary conversion cost to list > > (although the cost is small since both binary and list are likely small). > > > > Cost is not so small, because NIF binary_to_integer will create only > one object, when list_to_integer(binary_to_list()) will create many of > them. It is very important when you need to import LOTS of numbers > (read about my CSV parsing). > I suppose you could implement it in pure erlang without creating any intermediate lists, maybe it's even fast with HIPE. Floats are likely another story. binary_to_integer(B=(<<_N, _/binary>>)) -> binary_to_integer(B, 0). binary_to_integer(<>, Acc) when N >= $0 andalso N =< $9 -> binary_to_integer(Rest, (N - $0) + (Acc * 10)); binary_to_integer(<<>>, Acc) -> Acc. -bob -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Mon Apr 30 20:18:43 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Mon, 30 Apr 2012 22:18:43 +0400 Subject: [erlang-questions] binary_to_integer/1 and binary_to_float/1 and friends In-Reply-To: References: Message-ID: On Mon, Apr 30, 2012 at 10:13 PM, Bob Ippolito wrote: > > I suppose you could implement it in pure erlang without creating any > intermediate lists, maybe it's even fast with HIPE. Floats are likely > another story. > It also creates lots of intermediate objects and we both know how "fast" erlang arithmetic is. Floats can be parsed in the same way. In fact parsing in C can be done in the way, you have described. And it is many times faster, according to my benchmarks, done while working with CSV. You should remember that intermediate objects lead to useless GC. From bob@REDACTED Mon Apr 30 20:23:38 2012 From: bob@REDACTED (Bob Ippolito) Date: Mon, 30 Apr 2012 11:23:38 -0700 Subject: [erlang-questions] Case-insensitive key search on a list In-Reply-To: References: Message-ID: On Mon, Apr 30, 2012 at 10:54 AM, Tristan Sloughter < tristan.sloughter@REDACTED> wrote: > So you want to find a tuple in a list converted from JSON so the key is > binary. And not only that, you want it to be case insensitive! > > Now as far as I found, I'm only now bothering to go back to this code and > ask why, there is only string:equal/2 and it doesn't support case > insensitive matching. And not only that but string:to_lower/1 only supports > lists. So I ended up with a conversion to a list, then to_lower and then > back to a binary.... > > It is too ugly to think it was right... Does anyone know a better way of > doing this? I feel I am missing something obvious. > > case_insensitive_binary_string_keyfind(_String, _Pos, []) -> > false; > case_insensitive_binary_string_keyfind(String, Pos, [H|T]) -> > case list_to_binary( > string:to_lower( > binary_to_list( > element(Pos, H)))) of > String -> > H; > _ -> > case_insensitive_binary_string_keyfind(String, Pos, T) > end. > Well, just implement it yourself. Maybe something like this: lower_match(<>, <>) -> lower_match(B0, B1); lower_match(<>, <>) when (C1 >= $a andalso C1 =< $z andalso C0 >= $A andalso (C0 + ($a - $A)) =:= C1) -> lower_match(B0, B1); lower_match(<>, <>) when (C1 >= $a andalso C1 =< $z andalso C0 >= $A andalso (C0 + ($a - $A)) =:= C1) -> lower_match(B0, B1); lower_match(<<>>, <<>>) -> true; lower_match(_B0, _B1) -> false. lower_keyfind(_K, _P, []) -> false; lower_keyfind(K, P, [H | T]) -> case lower_match(K, element(P, H)) of true -> H; false -> lower_keyfind(K, P, T) end. -bob -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob@REDACTED Mon Apr 30 20:35:07 2012 From: bob@REDACTED (Bob Ippolito) Date: Mon, 30 Apr 2012 11:35:07 -0700 Subject: [erlang-questions] binary_to_integer/1 and binary_to_float/1 and friends In-Reply-To: References: Message-ID: On Mon, Apr 30, 2012 at 11:18 AM, Max Lapshin wrote: > On Mon, Apr 30, 2012 at 10:13 PM, Bob Ippolito wrote: > > > > I suppose you could implement it in pure erlang without creating any > > intermediate lists, maybe it's even fast with HIPE. Floats are likely > > another story. > > > > It also creates lots of intermediate objects and we both know how > "fast" erlang arithmetic is. > > Floats can be parsed in the same way. > > In fact parsing in C can be done in the way, you have described. And > it is many times faster, according to my benchmarks, done while > working with CSV. > > You should remember that intermediate objects lead to useless GC. > Well, when numbers are small enough (60 or 28 bits depending on if it's full word 64-bit or not, see ./erts/emulator/beam/erl_term.h) they are stored as immediate fixnums, and the match context shouldn't have much overhead either. I have no doubt that it's significantly slower than good C code, but maybe it's better than the combination of binary_to_list/1 and list_to_integer/1 BIFs. -bob -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob@REDACTED Mon Apr 30 20:39:25 2012 From: bob@REDACTED (Bob Ippolito) Date: Mon, 30 Apr 2012 11:39:25 -0700 Subject: [erlang-questions] Debugging apps with dependencies In-Reply-To: <4BE220475DFC4F5AA43F0637D39ED568@gmail.com> References: <4BE220475DFC4F5AA43F0637D39ED568@gmail.com> Message-ID: On Mon, Apr 30, 2012 at 11:05 AM, Josh Black wrote: > Hi, erlang beginner here. > > I have a question about the best way to debug apps which include > dependencies. > > I'm working on an app, and so far, I've been testing it by using rebar to > generate a release, then starting a console for the release and going from > there. The problem comes when I want to use something like dbg or appmon > to debug errors or inspect the state of my app. When I try to do, e.g. > appmon:start() from the console for my release, it tells me "undefined > function appmon:start/0". I'm guessing this is because I didn't explicitly > specify appmon in my release configuration? > > Alternatively, I created a start.sh shell script with contents like this: > > erl -pa apps/*/ebin -pa deps/*/ebin -eval 'application:start(dependency1), > application:start(dependency2), application:start(myapp).' > > This lets me start appmon and whatever else I want when I run into errors, > but feels pretty messy and wrong. > > I feel like I'm missing something really obvious here. What's the correct > way to do this? > I haven't discovered a great workflow for developing with releases either, but you can start dependencies in a slightly cleaner way by looking at the app file: This would go in some module with the same name as the application, and you would call it with "erl ... -s modname" -export([start/0]). start() -> start(?MODULE). start(App) -> application:load(App), {ok, Deps} = application:get_key(App, applications), lists:foreach(fun start_app/1, Deps), application:start(App). start_app(App) -> case application:start(App) of {error, {already_started, _}} -> ok; ok -> ok end. -------------- next part -------------- An HTML attachment was scrubbed... URL: From tristan.sloughter@REDACTED Mon Apr 30 20:48:12 2012 From: tristan.sloughter@REDACTED (Tristan Sloughter) Date: Mon, 30 Apr 2012 13:48:12 -0500 Subject: [erlang-questions] Debugging apps with dependencies In-Reply-To: <4BE220475DFC4F5AA43F0637D39ED568@gmail.com> References: <4BE220475DFC4F5AA43F0637D39ED568@gmail.com> Message-ID: Correct about why you can't find appmon, but there is an easy way around this. Start the release yourself, you probably have to add your libs to ERL_LIBS first depending how how you have things setup. So like: $ export ERL_LIBS=$ERL_LIBS: $ erl -boot This will have your release running in your main erts env, not one created specifically for your release. Someone else can probably give better instructions based on where rebar places the libs and .boot file, I don't know those. Tristan On Mon, Apr 30, 2012 at 1:05 PM, Josh Black wrote: > Hi, erlang beginner here. > > I have a question about the best way to debug apps which include > dependencies. > > I'm working on an app, and so far, I've been testing it by using rebar to > generate a release, then starting a console for the release and going from > there. The problem comes when I want to use something like dbg or appmon > to debug errors or inspect the state of my app. When I try to do, e.g. > appmon:start() from the console for my release, it tells me "undefined > function appmon:start/0". I'm guessing this is because I didn't explicitly > specify appmon in my release configuration? > > Alternatively, I created a start.sh shell script with contents like this: > > erl -pa apps/*/ebin -pa deps/*/ebin -eval 'application:start(dependency1), > application:start(dependency2), application:start(myapp).' > > This lets me start appmon and whatever else I want when I run into errors, > but feels pretty messy and wrong. > > I feel like I'm missing something really obvious here. What's the correct > way to do this? > > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.lapshin@REDACTED Mon Apr 30 20:50:53 2012 From: max.lapshin@REDACTED (Max Lapshin) Date: Mon, 30 Apr 2012 22:50:53 +0400 Subject: [erlang-questions] binary_to_integer/1 and binary_to_float/1 and friends In-Reply-To: References: Message-ID: Shame on me! I always thought that Erlang VM doesn't use intermediate integers =((( So perhaps it is possible to produce some really efficient code for arithmetic that uses proper bit operations for integers! > Well, when numbers are small enough (60 or 28 bits depending on if it's full > word 64-bit or not, see ./erts/emulator/beam/erl_term.h) they are stored as > immediate fixnums, and the match context shouldn't have much overhead > either. I have no doubt that it's significantly slower than good C code, but > maybe it's better than the combination of binary_to_list/1 and > list_to_integer/1 BIFs. > > -bob > From raskchanky@REDACTED Mon Apr 30 21:00:00 2012 From: raskchanky@REDACTED (Josh Black) Date: Mon, 30 Apr 2012 12:00:00 -0700 Subject: [erlang-questions] Debugging apps with dependencies In-Reply-To: References: <4BE220475DFC4F5AA43F0637D39ED568@gmail.com> Message-ID: <2375676CEBC34724A653F2C69CBDD33C@gmail.com> Excellent! Thanks Tristan and Bob for the suggestions. I'll try them out. Is either one considered more idiomatic? On Monday, April 30, 2012 at 11:48 AM, Tristan Sloughter wrote: > Correct about why you can't find appmon, but there is an easy way around this. Start the release yourself, you probably have to add your libs to ERL_LIBS first depending how how you have things setup. So like: > > $ export ERL_LIBS=$ERL_LIBS: > $ erl -boot > > This will have your release running in your main erts env, not one created specifically for your release. > > Someone else can probably give better instructions based on where rebar places the libs and .boot file, I don't know those. > > Tristan > > On Mon, Apr 30, 2012 at 1:05 PM, Josh Black wrote: > > Hi, erlang beginner here. > > > > I have a question about the best way to debug apps which include dependencies. > > > > I'm working on an app, and so far, I've been testing it by using rebar to generate a release, then starting a console for the release and going from there. The problem comes when I want to use something like dbg or appmon to debug errors or inspect the state of my app. When I try to do, e.g. appmon:start() from the console for my release, it tells me "undefined function appmon:start/0". I'm guessing this is because I didn't explicitly specify appmon in my release configuration? > > > > Alternatively, I created a start.sh (http://start.sh) shell script with contents like this: > > > > erl -pa apps/*/ebin -pa deps/*/ebin -eval 'application:start(dependency1), application:start(dependency2), application:start(myapp).' > > > > This lets me start appmon and whatever else I want when I run into errors, but feels pretty messy and wrong. > > > > I feel like I'm missing something really obvious here. What's the correct way to do this? > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED (mailto:erlang-questions@REDACTED) > > http://erlang.org/mailman/listinfo/erlang-questions > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tristan.sloughter@REDACTED Mon Apr 30 21:34:39 2012 From: tristan.sloughter@REDACTED (Tristan Sloughter) Date: Mon, 30 Apr 2012 14:34:39 -0500 Subject: [erlang-questions] Case-insensitive key search on a list In-Reply-To: References: Message-ID: Thanks, Bob! This will be nicer. I guess I didn't think about doing it that way since I was busy looking around thinking there must be a function already to make a binary string lower case :) Tristan On Mon, Apr 30, 2012 at 1:23 PM, Bob Ippolito wrote: > On Mon, Apr 30, 2012 at 10:54 AM, Tristan Sloughter < > tristan.sloughter@REDACTED> wrote: > >> So you want to find a tuple in a list converted from JSON so the key is >> binary. And not only that, you want it to be case insensitive! >> >> Now as far as I found, I'm only now bothering to go back to this code and >> ask why, there is only string:equal/2 and it doesn't support case >> insensitive matching. And not only that but string:to_lower/1 only supports >> lists. So I ended up with a conversion to a list, then to_lower and then >> back to a binary.... >> >> It is too ugly to think it was right... Does anyone know a better way of >> doing this? I feel I am missing something obvious. >> >> case_insensitive_binary_string_keyfind(_String, _Pos, []) -> >> false; >> case_insensitive_binary_string_keyfind(String, Pos, [H|T]) -> >> case list_to_binary( >> string:to_lower( >> binary_to_list( >> element(Pos, H)))) of >> String -> >> H; >> _ -> >> case_insensitive_binary_string_keyfind(String, Pos, T) >> end. >> > > Well, just implement it yourself. Maybe something like this: > > lower_match(<>, <>) -> > lower_match(B0, B1); > lower_match(<>, <>) > when (C1 >= $a andalso C1 =< $z andalso C0 >= $A andalso > (C0 + ($a - $A)) =:= C1) -> > lower_match(B0, B1); > lower_match(<>, <>) > when (C1 >= $a andalso C1 =< $z andalso C0 >= $A andalso > (C0 + ($a - $A)) =:= C1) -> > lower_match(B0, B1); > lower_match(<<>>, <<>>) -> > true; > lower_match(_B0, _B1) -> > false. > > lower_keyfind(_K, _P, []) -> > false; > lower_keyfind(K, P, [H | T]) -> > case lower_match(K, element(P, H)) of > true -> > H; > false -> > lower_keyfind(K, P, T) > end. > > -bob > -------------- next part -------------- An HTML attachment was scrubbed... URL: From aaron@REDACTED Mon Apr 30 21:38:38 2012 From: aaron@REDACTED (Aaron Hillegass) Date: Mon, 30 Apr 2012 15:38:38 -0400 Subject: [erlang-questions] ei for Apple's iOS? Message-ID: <8FCACD73-8E5C-4DF1-979A-DE816BF88155@bignerdranch.com> I'm writing a client that talks to an Erlang server. The client runs on iOS. I was thinking it would be nice to use the ei_encode* functions to make the data passing back and forth more Erlang-friendly. My question: Has anyone compiled ei as a static library for iOS applications? I have tried: downloading the source to a Mac with the iOS SDK, cd to the erl_interface directory, configure, and make. The output from that is attached. Any suggestions are appreciated. -- Aaron Hillegass Big Nerd Ranch, Inc. $ ./configure CPP="cpp" CXXCPP="cpp" CXX=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-llvm-g++-4.2 CC=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2 LD=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ld CFLAGS="-O -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk" CXXFLAGS="-O -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk" --disable-dependency-tracking --host=arm-apple-darwin10 LDFLAGS="-isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk" AR=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ar AS=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/as LIBTOOL=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool STRIP=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/strip RANLIB=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib configure: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used. checking build system type... i386-apple-darwin11.3.0 checking host system type... arm-apple-darwin10 checking for arm-apple-darwin10-gcc... /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2 checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... yes checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2 accepts -g... yes checking for /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2 option to accept ANSI C... none needed checking how to run the C preprocessor... cpp checking for arm-apple-darwin10-ranlib... /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib checking for ld.sh... /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ld checking for arm-apple-darwin10-ld... (cached) /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ld checking for egrep... grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking for short... yes checking size of short... 2 checking for int... yes checking size of int... 4 checking for long... yes checking size of long... 4 checking for void *... yes checking size of void *... 4 checking for long long... yes checking size of long long... 8 checking for arm-apple-darwin10-ar... /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ar checking for a BSD-compatible install... /usr/bin/install -c checking how to create a directory including parents... /usr/bin/install -c -d checking for gethostbyname in -lnsl... no checking for getpeername in -lsocket... no checking for ANSI C header files... (cached) yes checking for sys/wait.h that is POSIX.1 compatible... yes checking arpa/inet.h usability... yes checking arpa/inet.h presence... yes checking for arpa/inet.h... yes checking fcntl.h usability... yes checking fcntl.h presence... yes checking for fcntl.h... yes checking limits.h usability... yes checking limits.h presence... yes checking for limits.h... yes checking malloc.h usability... no checking malloc.h presence... no checking for malloc.h... no checking netdb.h usability... yes checking netdb.h presence... yes checking for netdb.h... yes checking netinet/in.h usability... yes checking netinet/in.h presence... yes checking for netinet/in.h... yes checking stddef.h usability... yes checking stddef.h presence... yes checking for stddef.h... yes checking for stdlib.h... (cached) yes checking for string.h... (cached) yes checking sys/param.h usability... yes checking sys/param.h presence... yes checking for sys/param.h... yes checking sys/socket.h usability... yes checking sys/socket.h presence... yes checking for sys/socket.h... yes checking sys/select.h usability... yes checking sys/select.h presence... yes checking for sys/select.h... yes checking sys/time.h usability... yes checking sys/time.h presence... yes checking for sys/time.h... yes checking for unistd.h... (cached) yes checking for sys/types.h... (cached) yes checking for uid_t in sys/types.h... yes checking for pid_t... yes checking for size_t... yes checking whether time.h and sys/time.h may both be included... yes checking for socklen_t usability... yes checking for working alloca.h... yes checking for alloca... yes checking whether /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2 needs -traditional... no checking for working memcmp... no checking for dup2... yes checking for gethostbyaddr... yes checking for gethostbyname... yes checking for gethostbyaddr_r... no checking for gethostbyname_r... no checking for gethostname... yes checking for writev... yes checking for gethrtime... no checking for gettimeofday... yes checking for inet_ntoa... yes checking for memchr... yes checking for memmove... yes checking for memset... yes checking for select... yes checking for socket... yes checking for strchr... yes checking for strerror... yes checking for strrchr... yes checking for strstr... yes checking for uname... yes checking for res_gethostbyname... no checking for res_gethostbyname in -lresolv... no checking for clock_gettime... no checking for clock_gettime in -lrt... no checking for mixed cygwin or msys and native VC++ environment... no checking for mixed cygwin and native MinGW environment... no checking if we mix cygwin with any native compiler... no checking if we mix msys with another native compiler... no checking for native win32 threads... no checking for pthread_create in -lpthread... yes checking pthread.h usability... yes checking pthread.h presence... yes checking for pthread.h... yes checking pthread/mit/pthread.h usability... no checking pthread/mit/pthread.h presence... no checking for pthread/mit/pthread.h... no configure: creating ./config.status config.status: creating src/arm-apple-darwin10/Makefile config.status: creating src/arm-apple-darwin10/eidefs.mk config.status: creating src/arm-apple-darwin10/config.h config.status: src/arm-apple-darwin10/config.h is unchanged $ make Makefile:19: /make/target.mk: No such file or directory Makefile:20: /make//otp.mk: No such file or directory Makefile:32: /make/otp_subdir.mk: No such file or directory make: *** No rule to make target `/make/otp_subdir.mk'. Stop. From jack@REDACTED Mon Apr 30 22:42:13 2012 From: jack@REDACTED (Jack Moffitt) Date: Mon, 30 Apr 2012 14:42:13 -0600 Subject: [erlang-questions] ei for Apple's iOS? In-Reply-To: <8FCACD73-8E5C-4DF1-979A-DE816BF88155@bignerdranch.com> References: <8FCACD73-8E5C-4DF1-979A-DE816BF88155@bignerdranch.com> Message-ID: > I was thinking it would be nice to use the ei_encode* functions to make the data passing back and forth more Erlang-friendly. This isn't directly your question, but I did an iOS app that talks to an Erlang server and used JSON. I've also done this with another app with MsgPack, and both worked great. I gave a talk on the former app here: http://vimeo.com/23494466 And I presented the props library I wrote for the latter app this year. You can find more about props here: https://github.com/greyarea/props I think using props to manipulate JSON-like structures is quite a bit more convenient than the native data structures, but it of course adds some dependencies (albeit small ones). jack. From jared.kofron@REDACTED Mon Apr 30 23:05:42 2012 From: jared.kofron@REDACTED (Jared Kofron) Date: Mon, 30 Apr 2012 14:05:42 -0700 Subject: [erlang-questions] ei for Apple's iOS? In-Reply-To: References: <8FCACD73-8E5C-4DF1-979A-DE816BF88155@bignerdranch.com> Message-ID: +1 for JSON - Communication between our Erlang nodes and Obj-C is done entirely via JSON and it works very nicely. And we do use exclusively props, which really makes it easy on the Erlang side (thanks Jack!) JK On Mon, Apr 30, 2012 at 1:42 PM, Jack Moffitt wrote: > > I was thinking it would be nice to use the ei_encode* functions to make > the data passing back and forth more Erlang-friendly. > > This isn't directly your question, but I did an iOS app that talks to > an Erlang server and used JSON. I've also done this with another app > with MsgPack, and both worked great. > > I gave a talk on the former app here: > http://vimeo.com/23494466 > > And I presented the props library I wrote for the latter app this > year. You can find more about props here: > https://github.com/greyarea/props > > I think using props to manipulate JSON-like structures is quite a bit > more convenient than the native data structures, but it of course adds > some dependencies (albeit small ones). > > jack. > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://erlang.org/mailman/listinfo/erlang-questions > -------------- next part -------------- An HTML attachment was scrubbed... URL: