做笔记记忆是靠不住的,会自然淘汰长时间不用的数据,一旦需要重新加载,如果从0开始那成本就太高了,而笔记和思维导图是自己思考方式的组织的,可以快速加载;
- 一开始笔记软件做的不好的时候就发邮件给自己,然后不断的回顾更新笔记;
- 后来用OneNote,由于这玩意当时不是云同步的,硬盘坏掉的时候丢了一些数据,打击还是挺大,好多事情要从头开始
- 再后来用过一段时间Google Wave,还以和朋友分享讨论笔记,结果,你们知道关闭服务了,费力导出来
- 现在转战Evernote和思维导图Conceptdraw
下面这些内容零零散散记录了很久,当时记录的时候可能还是新东西,过了那么久新东西也都成常识了,算不得"新"了;删之可惜,继续放在Erlang杂记里面吧,无论如何都是一个知识积累的记录;另外,分享记录还可以发现盲点,比如下面代码就是我曾经的盲点之一,我曾经使用非常绕的方法解决ETS进程依赖Shell进程的问题,很快就有朋友指出其实只需要执行下catch_exception(true)就可以搞定.
Eshell V6.0 (abort with ^G) 1> self(). <0.33.0> 2> 1/0. ** exception error: an error occurred when evaluating an arithmetic expression in operator '/'/2 called as 1 / 0 3> self(). %% 注意这里 已经重启 <0.36.0> 4> catch_exception(true). false 5> 1/0. * exception error: an error occurred when evaluating an arithmetic expression in operator '/'/2 called as 1 / 0 6> self(). <0.36.0> 7>
Eshell V6.0 (abort with ^G) 1> catch_exception(true). false 2> ets:new(test,[named_table]). test 3> [ ets:insert(test,{N,1,1,2}) || N <- lists:seq(1,10) ]. [true,true,true,true,true,true,true,true,true,true] 4> 4> ets:info(test). [{compressed,false}, {memory,389}, {owner,<0.33.0>}, {heir,none}, {name,test}, {size,10}, {node,nonode@nohost}, {named_table,true}, {type,set}, {keypos,1}, {protection,protected}] 5> ets:new(test2,[named_table,compressed]). test2 6> [ ets:insert(test2,{N,1,1,2}) || N <- lists:seq(1,10) ]. [true,true,true,true,true,true,true,true,true,true] 7> 7> ets:info(test2). [{compressed,true}, {memory,399}, {owner,<0.33.0>}, {heir,none}, {name,test2}, {size,10}, {node,nonode@nohost}, {named_table,true}, {type,set}, {keypos,1}, {protection,protected}]
Eshell V6.0 (abort with ^G) 1> catch_exception(true). false 2> ets:new(t,[named_table]). t 3> [ ets:insert(t,{N,[1,1,2],[a,b],{2,1,1024}}) || N <- lists:seq(1,100000) ]. [true,true,true,true,true,true,true,true,true,true,true, true,true,true,true,true,true,true,true,true,true,true,true, true,true,true,true,true,true|...] 4> ets:info(t). [{compressed,false}, {memory,2314637}, {owner,<0.33.0>}, {heir,none}, {name,t}, {size,100000}, {node,nonode@nohost}, {named_table,true}, {type,set}, {keypos,1}, {protection,protected}] 5> ets:new(t2,[named_table,compressed]). t2 6> [ ets:insert(t2,{N,[1,1,2],[a,b],{2,1,1024}}) || N <- lists:seq(1,100000) ]. [true,true,true,true,true,true,true,true,true,true,true, true,true,true,true,true,true,true,true,true,true,true,true, true,true,true,true,true,true|...] 7> [ ets:insert(t2,{N,[1,1,2],[a,b],{2,1,1024}}) || N <- lists:seq(1,100000) ]. [true,true,true,true,true,true,true,true,true,true,true, true,true,true,true,true,true,true,true,true,true,true,true, true,true,true,true,true,true|...] 8> ets:info(t2). [{compressed,true}, {memory,1414637}, {owner,<0.33.0>}, {heir,none}, {name,t2}, {size,100000}, {node,nonode@nohost}, {named_table,true}, {type,set}, {keypos,1}, {protection,protected}] 9>
-module(a). -compile(export_all). v()-> 1.0. Eshell V6.0 (abort with ^G) 1> c(a). {ok,a} 2> a:v(). 1.0 3> c(a). %% 代码已经修改过了 {ok,a} 4> erlang:check_old_code(a). true 5> a:v(). 2.0 6>
7> B= <<"binary_test_demo">>. <<"binary_test_demo">> 8> erlang:external_size(B). 27 9> byte_size(B). 16 10>
> float_to_list(7.12, [{decimals, 4}]). "7.1200" > float_to_list(7.12, [{decimals, 4}, compact]). "7.12" > float_to_binary(7.12, [{decimals, 4}]). <<"7.1200">> > float_to_binary(7.12, [{decimals, 4}, compact]). <<"7.12">> 13> erlang:binary_to_integer(<<"10204">>). 10204 14> erlang:integer_to_binary(10204). <<"10204">> 15>
1> Color = 16#F09A29. 15768105 2> Pixel = <<Color:24>>. <<240,154,41>>
application:set_env(kernel, inet_dist_listen_min, 9100). application:set_env(kernel, inet_dist_listen_max, 9105).