1? .yasw文件输出源代码? 原因是notepad++显示所有字符发现 正常文件换行时cr+lf或只要lf
异常文件不执行只输出源代码的文件每行末尾只有cr
2
3 yaws 购物例子 访问 /index.yasw 和 //index.yaws 的session不同
4 bad type mnesia 插入数据时这个错误是因为
---- 比如要求四列 四个字段,但是实际只填了两个字段 或:
---- 有的列要求是原子但是插入的是字符串或list 等等 类型不一致,这时候要求进行list_to_atom等 转换
---- db创建错误 badtype “e” 表名应该为原子,如果需要 list_to_atom("tablename")
---- [{record_name, AA}, {attributes, record_info(fields, BB)} record_name和record_info 的recode必须一致 AA必须和BB完全相同
---- mnesia:dirty_update_counter {aborted,{combine_error,unique_id,update_counter} ,unique_id表类型应该为默认set。其他类型就出这个错。
----表的创建不能放到事务里面!
----
----
----
5
5> list_to_existing_atom("1").
** exception error: bad argument
in function list_to_existing_atom/1
called as list_to_existing_atom("1")
6> list_to_atom("1").
'1'
写程序反思时多参考:http://www.iteye.com/topic/374167
下面的问题也许要
> unicode:characters_to_binary([36825]).
<<232,191,153>>
Yaws process died: {badarg,[{erlang,iolist_size,
[[["HTTP/1.1 ","200"," ","OK","\r\n"],
[[],
["Server: Yaws/","1.88",
" Yet Another Web Server\r\n"],
[],[],
["Date: ",
["Sun",", ","21"," ","Nov"," ","2010",
" ","04",":","21",":","29"," ","GMT"],
"\r\n"],
[],[],[],[],
["Content-Length: ","29","\r\n"],
["Content-Type: ",
"application/json; charset=utf-8",
"\r\n"],
[],[],[],[],[]],
"\r\n",
[[[91,
[123,
[[34,49,46,49,46,48,97,105,109,48,
27721,23383 ,34],
58,"\"detail0\""],
125],
93]],
<<"\r\n">>]]]},
{yaws,gen_tcp_send,2},
2> erlang:iolist_size(
[["HTTP/1.1 ","200"," ","OK","\r\n"],
[[],
["Server: Yaws/","1.88",
" Yet Another Web Server\r\n"],
[],[],
["Date: ",
["Sun",", ","21"," ","Nov"," ","2010",
" ","04",":","21",":","29"," ","GMT"],
"\r\n"],
[],[],[],[],
["Content-Length: ","29","\r\n"],
["Content-Type: ",
"application/json; charset=utf-8",
"\r\n"],
[],[],[],[],[]],
"\r\n",
[[[91,
[123,
[[34,49,46,49,46,48,97,105,109,48,
27721,23383,34], 有unicode就错误
58,"\"detail0\""],
125],
93]],
<<"\r\n">>]]).
** exception error: bad argument
in function iolist_size/1
called as iolist_size([["HTTP/1.1 ","200"," ","OK","\r\n"],
[[],
["Server: Yaws/","1.88",
" Yet Another Web Server\r\n"],
[],[],
["Date: ",
["Sun",", ","21"," ","Nov"," ","2010"," ",
"04",":","21",":","29"," ","GMT"],
"\r\n"],
[],[],[],[],
["Content-Length: ","29","\r\n"],
["Content-Type: ",
"application/json; charset=utf-8","\r\n"],
[],[],[],[],[]],
"\r\n",
[[[91,
[123,
[[34,49,46,49,46,48,97,105,109,48,27721,
23383,34],
58,"\"detail0\""],
125],
93]],
<<"\r\n">>]])
3> <<"\r\n">>]]).
* 1: syntax error before: ']'
3> erlang:iolist_size(
[["HTTP/1.1 ","200"," ","OK","\r\n"],
[[],
["Server: Yaws/","1.88",
" Yet Another Web Server\r\n"],
[],[],
["Date: ",
["Sun",", ","21"," ","Nov"," ","2010",
" ","04",":","21",":","29"," ","GMT"],
"\r\n"],
[],[],[],[],
["Content-Length: ","29","\r\n"],
["Content-Type: ",
"application/json; charset=utf-8",
"\r\n"],
[],[],[],[],[]],
"\r\n",
[[[91,
[123,
[[34,49,46,49,46,48,97,105,109,48,
34],
58,"\"detail0\""],
125],
93]],
<<"\r\n">>]]).
192 去掉unicode就ok