摘要: 前段时间导读了ranch的源码,具体见ranch 源码分析(一), 现在整理了下ranch框架下经典应用cowboy。 源码地方:https://github.com/ninenines/cowboy(目前使用的是cowboy-1.0.4版本) 还是找其中最简单的例子来入手,那就选这个static_ 阅读全文
posted @ 2016-07-08 09:55 土豆008 阅读(1083) 评论(0) 推荐(0) 编辑
摘要: 前段时间写了同一个世界的,链接如下 同一个世界(erlang解题答案) 这次带来了三生梦醒的解题答案和思路, 首先看题目 还是用1代表黑色,0代表白色,用2代表黄点,x代表空白 抽象就是这样 | 1 | 1 | 1 | 1 | | 1 | 0 | 0 | 1 | | 0 | 1 | 1 | 1 | 阅读全文
posted @ 2016-05-31 11:20 土豆008 阅读(828) 评论(0) 推荐(0) 编辑
摘要: 最近玩同一个世界,才几关就把3次提示用完了,十分气愤, 于是写了程序来解~~~ o(^▽^)o 以2-1为例子,题目如下 以0代表白色,1代表黑色,抽象的就是这样的 | 0 | 1 | 0 | 1 | 0 | | 0 | 1 | 0 | 1 | 0 | | 1 | 0 | 1 | 0 | 1 | | 阅读全文
posted @ 2016-05-23 15:37 土豆008 阅读(728) 评论(0) 推荐(0) 编辑
摘要: 接上 ranch 源码分析(三) 在上一次,根据ranch源码把大概流程理了一遍,下面我们将一些细节解释一下。 ranch只是一个服务的框架,它提供了传输层协议代码(ranch_tcp 和ranch_ssl), 大概可以看看这2个的源码,其实就是gen_tcp和gen_ssl的封装。 它做的工作可以 阅读全文
posted @ 2016-05-12 11:11 土豆008 阅读(521) 评论(0) 推荐(0) 编辑
摘要: 接上 ranch 源码分析(二) 上次讲到了ranch_conns_sup和ranch_acceptors_sup这2个ranch的核心模块,我们接着分析 首先查看ranch_conns_sup.erl 可以看到ranch_conns_sup不是一个典型的gen_tcp模块, start_link/ 阅读全文
posted @ 2016-05-09 14:57 土豆008 阅读(633) 评论(0) 推荐(0) 编辑
摘要: 接上ranch 源码分析(一) 上次讲到了ranch.erl的start_listener函数,下面我们详细分析下这个函数 可以看到在ranch的start_listener中,首先查看Transport模块(传输层模块,这里是ranch_tcp)是否载入, 如果正常载入就启动ranch_liste 阅读全文
posted @ 2016-05-09 13:33 土豆008 阅读(584) 评论(0) 推荐(0) 编辑
摘要: 以前写了一个ranch的处理流程,http://www.cnblogs.com/tudou008/p/5197314.html ,就只有一张图,不是很清晰,现在有空做个源码分析。 ranch的源码(版本v1.2.1 下载链接https://github.com/ninenines/ranch.git 阅读全文
posted @ 2016-05-06 18:10 土豆008 阅读(1538) 评论(0) 推荐(0) 编辑
摘要: 下面代码摘自rebar_utils.erl 这样就能用port方法执行一些shell命令 执行如下  去掉调试,修改DefaultOptions = [{use_stdout, true}, abort_on_error]   阅读全文
posted @ 2016-03-15 10:54 土豆008 阅读(823) 评论(0) 推荐(0) 编辑
摘要: 1 .同时打开的端口数量限制(Open ports) erlang:system_info(port_limit)查询 可以通过环境变量ERL_MAX_PORTS修改,或者配置erlang启动参数(标志+Q)修改(erl +Q 10000) 2、ets表的数量限制 默认值是1400,可以通过环境变量 阅读全文
posted @ 2016-03-02 10:26 土豆008 阅读(175) 评论(0) 推荐(0) 编辑
摘要: recon 是ferd 大神 释出的一个 用于生产环境诊断Erlang 问题的一个工具, 不仅仅是对Erlang stdlib 接口的封装, 还有memory fragmentation 相关的函数. 下面对rencon的各个函数进行解读,做个笔记 -module(recon). -export([ 阅读全文
posted @ 2016-02-24 17:31 土豆008 阅读(913) 评论(0) 推荐(0) 编辑