Analyze the implementation of erlang process monitoring and erlang Process MonitoringErlang supports two monitoring methods: Monitor and Link, so that all processes can be integrated. When a process exits due to an error, the monitoring process receives a message indicating that the process exits. With these features, using Erlang to build a simple and robust sys
Original address: http://www.cnblogs.com/me-sa/archive/2011/07/09/erlang0004.htmlSince the final deployment of the production environment is CentOS, I need to install Erlang b13r04 in CentOS, the first time to do this is a lot of trouble, mainly on the Erlang relies on the library is not familiar with, always compile but; here's a look at the details of the installation process:which libraries does
[Erlang] What are the pitfalls for future generations? (3) erlang Mining
21.The following code is used to generate a random number:
random:seed(erlang:now()).
Erlang: now () is a continuously increasing number that never repeats, but is not suitable for Random Algorithms. It is best to use the following:
-spec get_random_num(integer()) -> integer().get_random_num
The settings are common to multiple projects, but there are other fine notes depending on the scenario, which is not in the one by one description. -SunfaceFirst, the Erl startup parameters:+k trueOpen Epoll Scheduling, open Epoll in Linux, will greatly increase the efficiency of scheduling+a 100Asynchronous thread pool, invoking services for some ports+p 1024000Maximum number of processes+q 65535Maximum number of ports+SBT DBThe bound scheduler, after which the scheduler's task queue does not j
Since the final deployment of the production environment is centos, I need to install Erlang b13r04 in centos. The first time I did this, I had to take a long time off, but I was not familiar with the libraries that Erlang relied on; here we will sort out the installation details:
Which libraries does Erlang depend on?
A fully workingGccCompiler environment
Nc
= fun (_, S) -> Pid = mochiweb_acceptor:start_link(self(), Listen, Loop), sets:add_element(Pid, S) end, Pool1 = lists:foldl(F, Pool, lists:seq(1, Size)), State#mochiweb_socket_server{acceptor_pool=Pool1}.
This function first defines the anonymous function F, which accepts two parameters. The first parameter is discarded, and the other parameter is S. Then let's look at the first line and callMochiweb_acceptor: start_link/3Function, return the process i
The first pain in learning Erlang is ide support, and the second pain point is that there are too few Chinese materials. For Beginners, Erlang benefited from the Chinese materials contributed by Yu Feng, Li Tao, and others, returning Erlang Chinese.CommunityHere is the Chinese version of Erlang stdlib;
What is a C
Symptom: in ErlangProgramAfter the startup, as long as an external Erlang program is accepted through gen_server: Call or other accesses, many unknown Erlang processes will appear.
Analysis: At the beginning, I thought something went wrong. During the local test, there was no such phenomenon. Check these unknown Erlang processes and find that each of them has a
(2) small project ---- create an erlang server and an erlang Server
Originally intended to embed protobuf in quick in window, many errors were found. I did not do a good job of research for a day. You can only take a rest to get down to the erlang server. First, do a good job on the server and then embed protobuf into quick.
Rebar cannot be used in a window and c
I have studied a problem "[Erlang 0050] using fun to write tail recursion in Erlang shell" and have been paying attention to this problem. Recently, I found the same problem in search engines, the question is clear enough. Calling fun () from fun () provides another solution: Y-Combinator!
%%That's easy, you need the Y-combinator!y(M) -> G = fun (F) -> M(fun(A) -> (F(F))(A) end) end, G(G). and then
Protobuf is a serialization framework of Google. Similar to XML and JSON, protobuf is based on binary and is much shorter than XML to indicate the same content. You can also define some optional fields, it is widely used for communication between the server and the client. This article focuses on how to use protobuf in Erlang.
First, Google does not provide direct support for the Erlang language, so the t
[Erlang] What are the pitfalls for future generations? (1) erlang Mining
1. if an error occurs in guard, no error is reported. Only false is returned!
case 1=:1 of true when not erlang:length(t) =:= 1 orelse true -> ok; _ -> errorend.Result is: error
An error occurs when length is obtained for t (atom) in the protection formula, which should have been crash. However, in the protect
In windows, the erlang package starts and the erlang package starts.
In a linux environment, erlang generates an image package by running the systools: make_script ("", []) and systools: make_tar () commands, first installs the image package, and then installs the image package, replace erl. in src, and then output to erl again, and then use erl-sname cache-boot
provides tools to help you combine multiple modules into one7.parsetoolapplication, contains the LALR-1 generation parser YECC (similar to YACC), lexical analysis generator Leex8.reltool Release Management tool that provides graphical front end and back end hooks that can be used to build common systems9.runtime_toolsapplication, offers some very useful tools, dyntrace (Dynamic Trace), System_information (System probe), DBG ( Text-based trace, which contains the user-friendly trace bifs), etc.
Erlang has three ways to produce a random numberRandom:uniform ().This function is provided by the Erlang Library random module. This is generally used.1> Random:uniform (). 0.4435846174457203Erlang:now ().Use the current time as a random believe a lot of people have done it. So if you don't have a lot of demands, you can do the same.1> Erlang:now (). { 1419,831449,715000}Crypto:strong_rand_bytes (N).The cr
The Broadcast Algorithm on the erlang server of a browser game is inefficient. It should be a bug. The erlang ServerAn error occurred while obtaining the erlang webpage server code.The documentation is very elegant, but I can see that the Broadcast Algorithm in the scenario management is very beautiful, but the efficiency is very low.
Every time a game traverses
The Behaviour framework (gen_server, gen_fsm, gen_event, and supervisor) using Erlang saves a lot of unnecessary code when dealing with many situations, you can build a project by adding a custom logic to the framework.
Gen_server: Provides the processing of requests and callbacks between the client and the server.
Client -- request --> server -- Response --> Client
Specific description: gen_server in Erlang
1.application definition . Illustration: Mnesia, cowboy, Mochiweb ... is a application. does not affect each other in Erlang, which causes a process to crash and B processes that do not rely on the a process to function properly. And since Erlang's mechanism causes it to know the a process crashes, then if you can restart the A-process, then this system: I tell you, it's a perpetual system, "Who's so wasted that they don't have electricity at night"
Baidu Cloud Push official address Http://developer.baidu.com/wiki/index.php?title=docs/cplat/pushSimple introduction to the following principle:Baidu Cloud push support for iOS and Android cloud push. Android support is good, but iOS is generally hard to get through. Baidu Cloud for iOS push, he just did an intermediary agent, to provide users with interface, the advantage is the use of Baidu Cloud push, Android and iOS can be unified management; The disadvantage is: it is not easy to pass, the
) Throw New Argumentnullexception ( " Dict " ); VaR NL = encoding. utf8.getbytes ( " \ R \ n " ); VaR MS = New Memorystream (); Foreach ( VaR Key In Dict. Keys){ VaR Val = dict [Key]; VaR Klength = encoding. utf8.getbytes ( " $ " + Key. Length + " \ R \ n " ); VaR K = encoding. utf8.getbytes (Key + " \ R \ n " ); VaR Vlength = encoding. utf8.getbytes ( " $ " + Val. Length + " \ R \ n " );Ms. Write (klength, 0 , Klength. Length );Ms. Write (K, 0 , K. Length );Ms. Write (vlength,
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.