一些简单的 Erlang 的用法(RabbitMQ)

众所周知,RabbitMQ 底层的开发语言是 Erlang,所以通过一些简单的 Erlang 操作能获得一些 RabbitMQ 的底层信息。 通过新的 Node 节点来进行连接和调用 通过命令erl -sname test ,我们先新建了一个节点。 接下来就是通过命令 net_adm:names(). 来查看当前机器上的 Erlang 节点。 然后通过命令 net_adm:ping('rabbit@Asia'). 来连接上 RabbitMQ 的节点。 接下来就可以通过命令 rpc:call(<node_name>, <command>, <function_name>, <parameters>) 的形式来执行命令在连接上的节点上。 通过 CLI 直接连接到 RabbitMQ 的节点 通过传入 remsh 参数来启动 Erlang 程序。 这里你会发现,我们已经直接连接到了 RabbitMQ 的节点了。接下来就让我们来查询一下 RabbitMQ 的底层数据库 Mnesia 的一些表信息。

Read more feature in hexo

When I am using the hexo as my blog system, I found one big problem that really frustrate me. In the home page of my blog website, articles are displayed at full content and that makes the page size so big and the loading time extraordinary long.

《函数式编程入门:使用 Elixir》笔记 1

基本思想 函数式编程是一种编程范式。编程范式包括构建软件的规则和设计原则,侧重于使用纯函数构建软件,这些函数的描述方式是要怎么样,而不是使改如何做!使用像 Elixir 这样的函数式语言,可以更好地利用多核 CPU,编写更简洁的代码。在函数式语言中使用函数范式,可以编写出更和谐的程序。前提是要理解其核心概念:不可变性,函数和声明式代码。 不可变数据 1 2 3 4 5 6 7 8 9 10 11 list = [1, 2, 3] # => [1, 2, 3] List.delete_at(list, 1) # => [1, 3] list ++ [4] # => [1, 2, 3, 4] list # => [1, 2, 3] 你可能会想每次都创建新值会降低效率,其实并非如此,Elixir 具有灵巧的数据结构来避免这个问题。

Something about code review

Recently, I was reading some articles which are about the code review. As a software developer, we all know the importance of the code review. But eventually, we will all ignore or put less attention on this step. When I was surfing the Internet, I found Google wrote some pages to explain how they do the code review and which kind of things that we as a reviewer should be aware of.