• Summary of Matching Patterns in Erlang


    Matching in Assignment Atom matching Copy codeThe code is as follows: atom    = atom                        % atom another = another                     % another atom    = another                     % exception error Variable matching Copy codeThe code is as follows: Var = 2.                              % 2 Var = 3 – 1.                          % 2 Var = 1.                              % exception error Tuple matching […]

  • Introduction to Erlang Concurrent Programming


    Process in Erlang – Processes are lightweight and not shared between processes. Looking up a lot of information, it seems that no one knows what the concept of lightweight process is and continues to look for it. Gossip aside, into the world of concurrent programming. This is a learning note, or a brief translation of […]

  • Summary of Common Methods of File Directory Operation in Erlang IO Programming


    Erlang‘s modules for manipulating file I/O are: File module: The methods of opening, reading, writing and closing the directory where the file has been operated are basically here. Filename module: Provides a platform-independent way to manipulate file names Filelib Module: Extension of File Module, which provides more practical tools to build on File Module IO […]

  • Erlang Grammar Learning Notes: Variables, Atoms, Tuples, Lists, Strings


    1: Variables 1. Variables in Erlang [single assignment] mean that variables can only be assigned once.2. Variables must begin with capital letters. Two: Atoms Atoms are equivalent to enumeration types in c++, but the value of atoms in Erlang is itself. Atoms begin with a bunch of lower-case letters, but if they are given a […]

  • Introduction of Function and Process Control in Erlang


    1: function 1: In Erlang, the two functions with the same name but different number of parameters are completely different functions. 2: Functions in other modules are called with fully qualified names: Copy codeThe code is as follows: -module(sort1). -export([reverse_sort/1, sort/1]). reverse_sort(L) ->         lists1:reverse(sort(L)). sort(L) ->         lists:sort(L). 3: The clauses are separated by […]

  • Three Methods of Generating Random Numbers in Erlang


    Erlang has three ways to produce random numbers random:uniform(). This function is provided by the random module of the Erlang library. This is generally used. Copy codeThe code is as follows: 1> random:uniform(). 0.4435846174457203 erlang:now(). Use the current time as a random belief that many people have done it. So if you don’t have too […]

  • Two ways to execute linux commands in Erlang


    os.cmd(Cmd) OS module provides CMD functions to execute Linux system shell commands (or windows commands). Returns the standard output string result of a Cmd command. For example, in a Linux system, os: CMD (“date”) is executed. The time when Linux is returned. This is relatively simple, in general, but also to meet most of the […]

  • CentOS 6.5 Source Installation Erlang Tutorial


    Erlang is now part of the Fedora and Debian/Ubuntu software repositories. The latest version of Erlang is OTP 17.0. Erlang is a programming language for building large-scale, highly scalable and highly available soft real-time systems. It has been used in telecommunications, finance, e-commerce, Internet telephony and instant messaging. Erlang’s runtime system has built-in support for […]

  • Erlang Project Memory Leakage Analysis Method


    As projects become more reliant on Erlang, the number of problems they encounter increases. Some time ago, the online system encountered the problem of high memory consumption. Record the Troubleshooting Analysis process. The online system uses Erlang R16B02. Problem description There are several online systems that run for a period of time and memory soars. […]

  • Examples of registration process usage in Erlang distributed nodes


    As mentioned in the previous article, the atoms associated with the registration process have a global scope, which refers to the current Erlang virtual machine, which is the current distributed node in the distributed mode. Therefore, the atoms associated with the registration process in one node can not be used directly in another node, but […]

  • An Example of Baidu Cloud Push Android Server Implemented by Erlang


    Baidu cloud push official address The following principles are briefly introduced: Baidu cloud push supports IOS and Android cloud push. Android support is good, but IOS is generally difficult to tune in. Baidu cloud for IOS push, he just acts as an intermediary agent, providing interface for users, the advantage is using Baidu cloud […]

  • Some programming skills shared by Erlang


    guard Guard can be separated by commas or semicolons, which represent the final result of each guard and the final result is true as long as any guard is true. Copy codeThe code is as follows: guard(X, Y) when not(X>Y), is_atom(X) ->     X + Y. Guard can filter elements in list comprehension: Copy codeThe […]