11 2013 档案

摘要:一、 catch(Fun):似乎可以避免因为 函数Fun内的错误而造成的当前的进程的崩溃。 阅读全文
posted @ 2013-11-30 15:54 宁静的天空 阅读(454) 评论(0) 推荐(0) 编辑
摘要:一、 concat(Things) -> string() Types: Things = [Thing] Thing = atom() | integer() | float() | string() Concatenates the text representation of the elements of Things. The elements of Things can be atoms, integers, floats or strings. > lists:concat([doc, '/', file, '.', 3]). &quo 阅读全文
posted @ 2013-11-28 15:47 宁静的天空 阅读(199) 评论(0) 推荐(0) 编辑
摘要:gen_tcp:linsten()/2使用的是{packet,2/4/8},则gen_tcp模块在接受或者发送时自动除去包头或者自动加上包头。本例中使用的是{packet,0}。-module(mod_tcp_server_listener)%%监听端口,收到新的socket就启动 mod_client_reader进程%%监听端口,收到新的socket就启动 mod_client_reader进程-module(mod_tcp_server_listener).-include("common.hrl").%% ============================== 阅读全文
posted @ 2013-11-22 15:12 宁静的天空 阅读(403) 评论(0) 推荐(0) 编辑
摘要:GBK的文字编码是双字节来表示的,即不论中、英文字符均使用双字节来表示,只不过为区分中文,将其最高位都定成1。至于UTF-8编码则是用以解决国际上字符的一种多字节编码,它对英文使用8位(即一个字节),中文使用24位(三个字节)来编码。对于英文字符较多的网站则用UTF-8节省空间。GBK包含全部中文字符;UTF-8则包含全世界所有国家需要用到的字符。 GBK是在国家标准GB2312基础上扩容后兼容GB2312的标准,UTF-8编码的文字可以在各国各种支持UTF8字符集的浏览器上显示。 比如,如果是UTF8编码,则在外国人的英文IE上也能显示中文,而无需他们下载IE的中文语言支持包。 所以,对于英 阅读全文
posted @ 2013-11-22 14:32 宁静的天空 阅读(1312) 评论(0) 推荐(0) 编辑
摘要:一、> = Bin, > = Bin, 红色的编辑不过去,erl会提示:a bit unit size must not be specified unless a size is specified too 阅读全文
posted @ 2013-11-20 16:08 宁静的天空 阅读(202) 评论(0) 推荐(0) 编辑
摘要:需要测试:spawn(fun() -> end)end.与spawn(fun mm:aa/0).1秒=1000毫秒(ms) 1毫秒=1/1,000秒(s) 1秒=1,000,000 微秒(μs) 1微秒=1/1,000,000秒(s) 1秒=1,000,000,000 纳秒(ns) 1纳秒=1/1,000,000,000秒(s) 1秒=1,000,000,000,000 皮秒(ps) 1皮秒=1/1,000,000,000,000秒(s) 阅读全文
posted @ 2013-11-19 17:35 宁静的天空 阅读(195) 评论(0) 推荐(0) 编辑
摘要:一、模块内调用1> AA=fun(BB)-> io:format("this is test args ~s~n",[BB]) end.#Fun2> AA(aa).this is test argsaaok3> BB=fun()-> io:format("this is BB FUN ~n",[]) end. #Fun4> BB().this is BB FUN ok5> spawn( BB). this is BB FUN 6> spawn(fun()-> AA(cc) end).this is t 阅读全文
posted @ 2013-11-15 10:56 宁静的天空 阅读(534) 评论(0) 推荐(0) 编辑
摘要:转自:https://erlangcentral.org/wiki/index.php/Building_a_Non-blocking_TCP_server_using_OTP_principlesBuilding a Non-blocking TCP server using OTP principlesFrom ErlangCentral WikiContents1 Author2 Overview3 Server Design4 Application and Supervisor behaviours5 Listener Process6 Client Socket Handling 阅读全文
posted @ 2013-11-06 09:32 宁静的天空 阅读(960) 评论(0) 推荐(0) 编辑
摘要:-module(first_gen_server).-behaviour(gen_server).-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]).%% ====================================================================%% API functions%% ====================================================================-e 阅读全文
posted @ 2013-11-05 21:20 宁静的天空 阅读(447) 评论(0) 推荐(0) 编辑
摘要:一、new(Name, Options) -> tid() | atom(),创建ets表.Options = [Option],目测常用的属性,{keypos, Pos}:指定key的位置,每个元组的长度必须要大约Pos,也可以使用record的字段。named_table:ets表注册.Type:set | ordered_set | bag | duplicate_bag:表的类型,是否允许出现重复。Access:public | protected | private二、查询1.lookup(Tab, Key) -> [Object]:根据key进行查询Types:Tab 阅读全文
posted @ 2013-11-04 23:07 宁静的天空 阅读(429) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示