摘要: https://github.com/Eonblast/Emysqlhttps://github.com/denglf/erlang-db-driverhttps://github.com/dizzyd/erlang-mysql-driver(推荐)https://github.com/Eonbla... 阅读全文
posted @ 2013-12-02 19:19 宁静的天空 阅读(549) 评论(0) 推荐(0)
摘要: 1> list_to_binary(["select * from aa limit","1",",","97"]).>2> list_to_binary(["select * from aa limit",integer_to_list(1),",","97"]).>3> list_to_binary(["select * from aa limit",1,"97"]). >不理 阅读全文
posted @ 2013-12-01 22:31 宁静的天空 阅读(950) 评论(0) 推荐(0)
摘要: 一、 catch(Fun):似乎可以避免因为 函数Fun内的错误而造成的当前的进程的崩溃。 阅读全文
posted @ 2013-11-30 15:54 宁静的天空 阅读(470) 评论(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 宁静的天空 阅读(210) 评论(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 宁静的天空 阅读(414) 评论(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 宁静的天空 阅读(1319) 评论(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 宁静的天空 阅读(206) 评论(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 宁静的天空 阅读(202) 评论(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 宁静的天空 阅读(540) 评论(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 宁静的天空 阅读(988) 评论(0) 推荐(0)