<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
  <channel>
    <title>erlang非业余研究</title>
    <description>专注 高性能 容错 分布服务器的实现（erlang）
承接服务器外包项目</description>
    <link>http://mryufeng.javaeye.com</link>
    <language>UTF-8</language>
    <copyright>Copyright 2003-2008, JavaEye.com</copyright>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <generator>JavaEye - 做最棒的软件开发交流社区</generator>
      <item>
        <title>lua扩展模块里面如何申请内存</title>
        <author>mryufeng</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://mryufeng.javaeye.com">mryufeng</a>&nbsp;
          链接：<a href="http://mryufeng.javaeye.com/blog/219439" style="color:red;">http://mryufeng.javaeye.com/blog/219439</a>&nbsp;
          发表时间: 2008年07月25日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          我们在编写lua模块的时候经常会遇到申请内存的情况，有2中用途 1。 临时的 2. 长期的。 通常我们是用malloc来分配内存 free来释放。但是这样做的话 lua runtime就没有办法跟踪内存的使用。但是我们有解决方法：<br />1. 临时的 通过LuaL_Buffer来， 因为LuaL_buffer有自主扩展能力，所以我们可以存入很多数据 只是每次可以直接使用buffer的大小有限制。<br />2. 长期的, 通过lua_newuserdata 放在fenv里面. fenv 是个table,而且可以gc. 当分配的内存不够用的时候 可以重新分配一个 然后lua_replace一下 这样旧的内存就会被gc掉。 <br /><br />Note: Lpeg的代码实现很精致 可以精读。
          <br/>
          <span style="color:red;">
            <a href="http://mryufeng.javaeye.com/blog/219439#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Fri, 25 Jul 2008 12:35:54 +0800</pubDate>
        <link>http://mryufeng.javaeye.com/blog/219439</link>
        <guid>http://mryufeng.javaeye.com/blog/219439</guid>
      </item>
      <item>
        <title>haproxy支持4层交换的规则了</title>
        <author>mryufeng</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://mryufeng.javaeye.com">mryufeng</a>&nbsp;
          链接：<a href="http://mryufeng.javaeye.com/blog/219434" style="color:red;">http://mryufeng.javaeye.com/blog/219434</a>&nbsp;
          发表时间: 2008年07月25日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          July 20th, 2008 : two lines...<br /><br />      Two lines... That's all what is needed with the new TCP content inspection system to stop half of the spams I got home. One of my major customers who uses HAProxy a lot has sponsored the development of some preliminary content inspection which is used to decide whether to forward a connection or not. The very first usage of this feature consists in checking that only SSL is spoken on a connection. But most likely more protocols will come soon. As a nice side effect, I could now add a delay before the HELO message of my SMTP server, and reject all robots which talk first (forbidden). And since many spam bots have small timeout values, many of them abort before the timeout is reached, resulting in my incoming spam rate dropping from about 300/hour to "only" 150/hour. Those who keep up with the time out slow down due to limited resources. The small addition simply consists in adding those two lines in the frontend :<br /><br />      		tcp-request inspect-delay  35s<br />      		tcp-request content reject if REQ_CONTENT<br />      	<br />在process_cli中增加了一个状态CL_STINSPECT用于处理4层数据规则的状态，这样就很容易根据tcp的内容做判断决定拒绝连接或者如何转发后端等事务。<br />强！
          <br/>
          <span style="color:red;">
            <a href="http://mryufeng.javaeye.com/blog/219434#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Fri, 25 Jul 2008 12:23:03 +0800</pubDate>
        <link>http://mryufeng.javaeye.com/blog/219434</link>
        <guid>http://mryufeng.javaeye.com/blog/219434</guid>
      </item>
      <item>
        <title>未公开的Lua Frontier Pattern %f  比较实用</title>
        <author>mryufeng</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://mryufeng.javaeye.com">mryufeng</a>&nbsp;
          链接：<a href="http://mryufeng.javaeye.com/blog/218671" style="color:red;">http://mryufeng.javaeye.com/blog/218671</a>&nbsp;
          发表时间: 2008年07月23日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          参见： http://lua-users.org/wiki/FrontierPattern<br /><br />Frontier Pattern<br />	<br />lua-users home<br />	wiki<br /><br />The "frontier" expression pattern %f is undocumented in the standard Lua references (for reasons why see LuaList:2006-12/msg00536.html).<br /><br />I would like to present here the usefulness of it, in an attempt to show how it can be used, and why it should be retained.<br /><br />Let's consider a fairly straightforward task: to find all words in upper-case in a string.<br /><br />First attempt: %u+<br /><br />    string.gsub ("the QUICK brown fox", "%u+", print)<br /><br />    QUICK<br /><br />That looks OK, found a word in all caps. But look at this:<br /><br />    string.gsub ("the QUICK BROwn fox", "%u+", print)<br /><br />    QUICK<br />    BRO<br /><br />We also found a word which was partially capitalised.<br /><br />Second attempt: %u+%A<br /><br />    string.gsub ("the QUICK BROwn fox", "%u+%A", print)<br /><br />    QUICK<br /><br />The detection of non-letters correctly excluded the partially capitalised word. But wait! How about this:<br /><br />    string.gsub ("the QUICK brOWN fox", "%u+%A", print)<br /><br />    QUICK <br />    OWN <br /><br />We also have a second problem:<br /><br />    string.gsub ("the QUICK. brown fox", "%u+%A", print)<br /><br />    QUICK.<br /><br />The punctuation after the word is now part of the captured string, which is not wanted.<br /><br />Third attempt: %A%u+%A<br /><br />    string.gsub ("the QUICK brOWN FOx jumps", "%A%u+%A", print)<br /><br />     QUICK<br /><br />This correctly excludes the two partially capitalised words, but still leaves the punctuation in, like this:<br /><br />    string.gsub ("the (QUICK) brOWN FOx jumps", "%A%u+%A", print)<br /><br />    (QUICK)<br /><br />Also, there is another problem, apart from capturing the non-letters at the sides. Look at this:<br /><br />    string.gsub ("THE (QUICK) brOWN FOx JUMPS", "%A%u+%A", print)<br /><br />    (QUICK)<br /><br />The correctly capitalised words at the start and end of the string are not detected.<br /><br />The solution: The Frontier pattern: %f<br /><br />    string.gsub ("THE (QUICK) brOWN FOx JUMPS", "%f[%a]%u+%f[%A]", print)<br /><br />    THE<br />    QUICK<br />    JUMPS<br /><br />The frontier pattern %f followed by a set detects the transition from "not in set" to "in set". The source string boundary qualifies as "not in set" so it also matches the word at the very start of the string to be matched.<br /><br />The second frontier pattern is also matched at the end of the string, so our final word is also captured.<br /><br />Alternatives without the frontier pattern<br /><br />Without the frontier pattern, one might resort to things like this:<br /><br />    s = "THE (QUICK) brOWN FOx JUMPS"<br />    s = "\0" .. s:gsub("(%A)(%u)", "%1\0%2")<br />                 :gsub("(%u)(%A)", "%1\0%2") .. "\0"<br />    s = s:gsub("%z(%u+)%z", print)<br /><br />This page brought to you by NickGammon. FindPage · RecentChanges · preferences<br />edit · history<br />Last edited July 7, 2007 7:17 pm GMT (diff) <br /><br /><br />看下代码lstrlib.c：<br /><br />        case 'f': {  /* frontier? */<br />          const char *ep; char previous;<br />          p += 2;<br />          if (*p != '[')<br />            luaL_error(ms->L, "missing " LUA_QL("[") " after "<br />                               LUA_QL("%%f") " in pattern");<br />          ep = classend(ms, p);  /* points to what is next */<br />          previous = (s == ms->src_init) ? '\0' : *(s-1);<br />          if (matchbracketclass(uchar(previous), p, ep-1) ||<br />             !matchbracketclass(uchar(*s), p, ep-1)) return NULL;<br />          p=ep; goto init;  /* else return match(ms, s, ep); */<br />        }<br /><br />就知道如何用了。
          <br/>
          <span style="color:red;">
            <a href="http://mryufeng.javaeye.com/blog/218671#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Wed, 23 Jul 2008 17:57:34 +0800</pubDate>
        <link>http://mryufeng.javaeye.com/blog/218671</link>
        <guid>http://mryufeng.javaeye.com/blog/218671</guid>
      </item>
      <item>
        <title>Notes about how the Lua garbage collector works</title>
        <author>mryufeng</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://mryufeng.javaeye.com">mryufeng</a>&nbsp;
          链接：<a href="http://mryufeng.javaeye.com/blog/217402" style="color:red;">http://mryufeng.javaeye.com/blog/217402</a>&nbsp;
          发表时间: 2008年07月22日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          lua垃圾收集的原理 参见： http://lua-users.org/wiki/EmergencyGarbageCollector<br /><br />Notes about how the Lua garbage collector works<br />Disclaimer: This is the first time I have worked on a garbage collector so some of this may be incorrect. Corrections/cleanups are welcome. --RobertGabrielJakabosky<br /><br />"While working on this patch I had to learn how the garbage collector in Lua works. I am writing this to help me later if I need to fix more bugs with the collector and I hope this info can help other people who are interested in how the Lua garbage collector works." --RobertGabrielJakabosky<br /><br />Simple description<br />The Lua garbage collector is a mark & sweep collector. The collector has two major phases mark & sweep that it runs each collection cycle. During the mark phases the collector traverse the Lua stack and into tables to mark values it finds as live. Next the sweep phases will walk a list of all collectible values and free all dead values it finds.<br /><br />Detailed description<br />All collectible type objects have a 'marked' bit field. The bits are defined as (copied from header "lgc.h"):<br /><br />    * bit 0 - object is white (type 0)<br />    * bit 1 - object is white (type 1)<br />    * bit 2 - object is black<br />    * bit 3 - for userdata: has been finalized<br />    * bit 3 - for tables: has weak keys (note this bit has two different meanings one for userdata and one for tables)<br />    * bit 4 - for tables: has weak values<br />    * bit 5 - object is fixed (should not be collected)<br />    * bit 6 - object is "super" fixed (only the main thread) <br /><br />The garbage collector keeps track of a current white (type 0 or 1) and objects with the other white are dead objects that can be collected during the sweep states.<br /><br />An object's color is defined by which of the first 3 bits (0, 1, 2) are set:<br /><br />    * It is white if one of the two white bits (0,1) are set and the black bit is clear. Only one white bit should be used by a white object.<br />    * It is gray if all three color bits (0,1,2) are clear.<br />    * It is black if the black bit is set and the two white bits are clear. <br /><br />Garbage collector states (each collection cycle passes through these states in this order):<br /><br />    * GCSpause - Start of collection cycle. At this state all objects should be marked with the current white. The main lua_State, globals table, registry, and metatables are marked gray and added to the gray list. The state now changes to GCSpropagate.<br />    * GCSpropagate - Each object in the gray list is removed and marked black, then any white (type 0 or 1) objects it references are marked gray and added to the gray list. Once the gray list is empty the current white is switched to the other white. All objects marked with the old white type are now dead objects. The state now changes to GCSsweepstring.<br />    * GCSsweepstring - The color of each string in the internal strings hashtable is checked. If the color matches the old white type that string is dead and is freed. If the color matches the current white (newly created string) or is gray (some other object references it), then it is alive and it's color is reset to the current white. Once all strings are checked the state is changed to GCSsweep.<br />    * GCSsweep - The color of each objects in the global rootgc list (this list holds all objects except strings) is checked just like the strings during the GCSsweepstring state. Dead objects are freed and removed from the rootgc list. Live objects have their color reset to the current white. Once all objects have been checked the state is changed to GCSfinalize.<br />    * GCSfinalize - This state will finalize all dead userdata objects by running their "__gc" metamethod. Once all dead userdata objects have been finailzed the state is changed to GCSpause and this completes a cycle of the garbage collector. <br /><br />--RobertGabrielJakabosky <br /><br /><br />还有一本Garbage Collection垃圾收集的书 国内翻译的也许对你理解Lua的gc运作有帮助。
          <br/>
          <span style="color:red;">
            <a href="http://mryufeng.javaeye.com/blog/217402#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Tue, 22 Jul 2008 00:46:57 +0800</pubDate>
        <link>http://mryufeng.javaeye.com/blog/217402</link>
        <guid>http://mryufeng.javaeye.com/blog/217402</guid>
      </item>
      <item>
        <title>Yueliang + LuLu 完整的LuaInLua系统</title>
        <author>mryufeng</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://mryufeng.javaeye.com">mryufeng</a>&nbsp;
          链接：<a href="http://mryufeng.javaeye.com/blog/216857" style="color:red;">http://mryufeng.javaeye.com/blog/216857</a>&nbsp;
          发表时间: 2008年07月21日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          Yueliang: http://yueliang.luaforge.net/<br /><br />Introduction<br /><br />The goal of Yueliang is to implement Lua 5 in Lua 5. Such a codebase, if well documented, can be a useful prototyping and educational tool. Initially, the focus is on the front end of Lua, i.e. the lexical analyzer, the parser and the code generator, in order to generate binary chunks. A port of the back end (the VM) is being considered. Yueliang is moon in Mandarin.<br /><br /><br />LuLu: http://luaforge.net/projects/lulu/<br /> <br />LuLu is a Lua 5.1 VM implementation in Lua language itself. It aims to be a concise, easily readable, and customizable LuaVM implemantation.<br /><br /><br />2者都是用lua语言实现的 一个实现了前端lex parser code, 一个实现了vm, 结合起来就是一个完整的lua in lua.<br /><br />实现思路很有意思，代码及其紧凑。
          <br/>
          <span style="color:red;">
            <a href="http://mryufeng.javaeye.com/blog/216857#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Mon, 21 Jul 2008 11:43:06 +0800</pubDate>
        <link>http://mryufeng.javaeye.com/blog/216857</link>
        <guid>http://mryufeng.javaeye.com/blog/216857</guid>
      </item>
      <item>
        <title>luatcc 方便你写lua扩展</title>
        <author>mryufeng</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://mryufeng.javaeye.com">mryufeng</a>&nbsp;
          链接：<a href="http://mryufeng.javaeye.com/blog/216365" style="color:red;">http://mryufeng.javaeye.com/blog/216365</a>&nbsp;
          发表时间: 2008年07月18日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          当要用c实现lua的模块的时候  就涉及到模块的编译 调试 运行 而这些步骤很繁琐，容易出错，有了luatcc就可以直接在lua代码里面直接写c代码了 动态运行 岂不是很cool, 大大提高了开发速度。<br />luatcc项目网站： http://luaforge.net/projects/lua-tcc/<br /><br />require "lua_tcc"<br /><br />m = tcc.compile ([[<br /><br />        #include "lua.h"<br /><br />        typedef struct {<br />                void *s;<br />        } tcc_userdata;<br /><br />        void hi (void) {<br />                printf ("hello world!\n");<br />        }<br /><br />        void bye (void) {<br />                printf ("bye yufeng.!\n");<br />        }<br /><br />        int count (lua_State *L) {<br />                printf ("hay %d parametros\n", lua_gettop (L));<br />                lua_pushnumber (L, lua_gettop (L));<br />                return 1;<br />        }<br /><br />]], {"hi", "bye", "count", }, {"m"})<br /><br />m.hi()<br />m.count("", 1,2,3,4)
          <br/>
          <span style="color:red;">
            <a href="http://mryufeng.javaeye.com/blog/216365#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Fri, 18 Jul 2008 22:21:43 +0800</pubDate>
        <link>http://mryufeng.javaeye.com/blog/216365</link>
        <guid>http://mryufeng.javaeye.com/blog/216365</guid>
      </item>
      <item>
        <title>luacoco  增强lua的coroutine功能</title>
        <author>mryufeng</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://mryufeng.javaeye.com">mryufeng</a>&nbsp;
          链接：<a href="http://mryufeng.javaeye.com/blog/211650" style="color:red;">http://mryufeng.javaeye.com/blog/211650</a>&nbsp;
          发表时间: 2008年07月04日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          Coco is a small extension to get True C Coroutine semantics for Lua 5.1.<br /><br />Coco is both available as a stand-alone release and integrated into LuaJIT.<br /><br />The stand-alone release is a patchset against the standard Lua 5.1.3 distribution. There are no dependencies on LuaJIT. However LuaJIT depends on Coco to allow yielding for JIT compiled functions. <br /><br />这个luacoco patch也是匠心独特 以最小的侵入修改让lua支持原生的coroutine,解除了原版的coroutine的几个限制：<br /><br />    * Yield across all metamethods (not advised for __gc).<br />    * Yield across iterator functions (for x in func do).<br />    * Yield across callbacks (table.foreach(), dofile(), ...).<br />    * Yield across protected callbacks (pcall(), xpcall(), ...).<br />    * Yield from C functions and resume back to them.<br /><br />在实现方面主要是利用以下几个macro来实现修改的：<br /><br />/*<br />@@ LUAI_EXTRASPACE allows you to add user-specific data in a lua_State<br />@* (the data goes just *before* the lua_State pointer).<br />** CHANGE (define) this if you really need that. This value must be<br />** a multiple of the maximum alignment required for your machine.<br />*/<br />#define LUAI_EXTRASPACE		0<br /><br /><br />/*<br />@@ luai_userstate* allow user-specific actions on threads.<br />** CHANGE them if you defined LUAI_EXTRASPACE and need to do something<br />** extra when a thread is created/deleted/resumed/yielded.<br />*/<br />#define luai_userstateopen(L)		((void)L)<br />#define luai_userstateclose(L)		((void)L)<br />#define luai_userstatethread(L,L1)	((void)L)<br />#define luai_userstatefree(L)		((void)L)<br />#define luai_userstateresume(L,n)	((void)L)<br />#define luai_userstateyield(L,n)	((void)L)<br /><br />再拜下萝卜神！！！
          <br/>
          <span style="color:red;">
            <a href="http://mryufeng.javaeye.com/blog/211650#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Fri, 04 Jul 2008 16:41:14 +0800</pubDate>
        <link>http://mryufeng.javaeye.com/blog/211650</link>
        <guid>http://mryufeng.javaeye.com/blog/211650</guid>
      </item>
      <item>
        <title>lua做tcp服务器的2套库</title>
        <author>mryufeng</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://mryufeng.javaeye.com">mryufeng</a>&nbsp;
          链接：<a href="http://mryufeng.javaeye.com/blog/211588" style="color:red;">http://mryufeng.javaeye.com/blog/211588</a>&nbsp;
          发表时间: 2008年07月04日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          copas是纯lua的实现 依赖于luasocket, 但是毕竟大的现在，只能支持1024个并发，是select机制的限制。<br /><br />luaevent和copas的接口很像，基于libevent，支持epoll等，可以支持大规模的并发。<br /><br />copas经过几天几夜的测试， 比较稳定，但是吃比较多的内存。<br />luaevent测试在进行中。<br /><br />注：<br />在copas或者luaevent.loop 中加入 <br />print(collectgarbage("count")) 可以知道lua vm用的内存 以K为单位。
          <br/>
          <span style="color:red;">
            <a href="http://mryufeng.javaeye.com/blog/211588#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Fri, 04 Jul 2008 15:37:48 +0800</pubDate>
        <link>http://mryufeng.javaeye.com/blog/211588</link>
        <guid>http://mryufeng.javaeye.com/blog/211588</guid>
      </item>
      <item>
        <title>Ascii85 aka Base85 更高效的binary-&gt;ascii编码 </title>
        <author>mryufeng</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://mryufeng.javaeye.com">mryufeng</a>&nbsp;
          链接：<a href="http://mryufeng.javaeye.com/blog/211563" style="color:red;">http://mryufeng.javaeye.com/blog/211563</a>&nbsp;
          发表时间: 2008年07月04日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          Ascii85 (also called "Base85") is a form of binary-to-text encoding developed by Paul E. Rutter for the btoa utility. By using five ASCII characters to represent four bytes of binary data (encoded size 25% larger), it is more efficient than uuencode or Base64, which use four characters to represent three bytes of data (33% increase).<br /><br />Its main modern use is in Adobe's PostScript and Portable Document Format file formats.<br /><br />能提高点效率是一点，反正编码也简单。
          <br/>
          <span style="color:red;">
            <a href="http://mryufeng.javaeye.com/blog/211563#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Fri, 04 Jul 2008 15:01:46 +0800</pubDate>
        <link>http://mryufeng.javaeye.com/blog/211563</link>
        <guid>http://mryufeng.javaeye.com/blog/211563</guid>
      </item>
      <item>
        <title>lua symbexec的2个用途</title>
        <author>mryufeng</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://mryufeng.javaeye.com">mryufeng</a>&nbsp;
          链接：<a href="http://mryufeng.javaeye.com/blog/211426" style="color:red;">http://mryufeng.javaeye.com/blog/211426</a>&nbsp;
          发表时间: 2008年07月04日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          原型： static Instruction symbexec (const Proto *pt, int lastpc, int reg);<br /><br />symbexec 是安装vm的执行流程来模拟一段opcode的执行， 执行到lastpc, 同时返回修改reg的那条指令。<br /><br />有2个用途<br />1. loadstring检查代码是否被篡改，是否合法 <br />2. 用于lua_getinfo的时候 看一个first class的function是global,local,upval 还是其他东西。<br /><br />总之设计还是很巧妙的。
          <br/>
          <span style="color:red;">
            <a href="http://mryufeng.javaeye.com/blog/211426#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Fri, 04 Jul 2008 11:40:29 +0800</pubDate>
        <link>http://mryufeng.javaeye.com/blog/211426</link>
        <guid>http://mryufeng.javaeye.com/blog/211426</guid>
      </item>
      <item>
        <title>lua coroutine是如何实现的？</title>
        <author>mryufeng</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://mryufeng.javaeye.com">mryufeng</a>&nbsp;
          链接：<a href="http://mryufeng.javaeye.com/blog/211004" style="color:red;">http://mryufeng.javaeye.com/blog/211004</a>&nbsp;
          发表时间: 2008年07月03日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          一直对coroutine的运作原理不是很明白， 这几天琢磨了下终于搞明白了：<br /><br />root@yfnix:~/lua-5.1.3/src# cat t.lua <br />a= coroutine.create(function () <br />						b= coroutine.create(function () <br />												coroutine.yield(1) <br />											end)<br />						coroutine.resume(b)<br />					end)<br />coroutine.resume(a,1)<br /><br />root@yfnix:~/lua-5.1.3/src#  gdb --args lua t.lua<br />b lua_yield<br />r<br />bt<br />得到以下的调用stack<br /><br />#0  lua_yield (L=0x80770b0, nresults=1) at ldo.c:446<br />#1  0x08064f7d in luaB_yield (L=0x80770b0) at lbaselib.c:592<br />#2  0x08050ac2 in luaD_precall (L=0x80770b0, func=0x8077b00, nresults=0) at ldo.c:319<br />#3  0x0805d2c8 in <span style="color: red">luaV_execute </span>(L=0x80770b0, nexeccalls=1) at lvm.c:587<br />#4  0x08050e11 in resume (L=0x80770b0, ud=0x8077b00) at ldo.c:404<br />#5  0x0804fec5 in luaD_rawrunprotected (L=0x80770b0, f=0x8050d56 &lt;resume>, ud=0x8077b00) at ldo.c:116<br />#6  0x08050f61 in lua_resume (L=0x80770b0, nargs=0) at ldo.c:427<br />#7  0x08064c97 in auxresume (L=0x8076e90, co=0x80770b0, narg=0) at lbaselib.c:526<br />#8  0x08064d85 in luaB_coresume (L=0x8076e90) at lbaselib.c:545<br />#9  0x08050ac2 in luaD_precall (L=0x8076e90, func=0x8077818, nresults=0) at ldo.c:319<br />#10 0x0805d2c8 in <span style="color: red">luaV_execute</span> (L=0x8076e90, nexeccalls=1) at lvm.c:587<br />#11 0x08050e11 in resume (L=0x8076e90, ud=0x8077818) at ldo.c:404<br />#12 0x0804fec5 in luaD_rawrunprotected (L=0x8076e90, f=0x8050d56 &lt;resume>, ud=0x8077818) at ldo.c:116<br />#13 0x08050f61 in lua_resume (L=0x8076e90, nargs=1) at ldo.c:427<br />#14 0x08064c97 in auxresume (L=0x8072008, co=0x8076e90, narg=1) at lbaselib.c:526<br />#15 0x08064d85 in luaB_coresume (L=0x8072008) at lbaselib.c:545<br />#16 0x08050ac2 in luaD_precall (L=0x8072008, func=0x807226c, nresults=0) at ldo.c:319<br />#17 0x0805d2c8 in luaV_execute (L=0x8072008, nexeccalls=1) at lvm.c:587<br />#18 0x08050d22 in luaD_call (L=0x8072008, func=0x8072260, nResults=-1) at ldo.c:377<br />#19 0x0804dbe7 in f_call (L=0x8072008, ud=0xbfaf3574) at lapi.c:801<br />#20 0x0804fec5 in luaD_rawrunprotected (L=0x8072008, f=0x804dbbd &lt;f_call>, ud=0xbfaf3574) at ldo.c:116<br />#21 0x0805107e in luaD_pcall (L=0x8072008, func=0x804dbbd &lt;f_call>, u=0xbfaf3574, old_top=48, ef=36) at ldo.c:463<br />#22 0x0804dc7b in lua_pcall (L=0x8072008, nargs=0, nresults=-1, errfunc=2) at lapi.c:822<br />#23 0x0804b3b9 in docall (L=0x8072008, narg=0, clear=0) at lua.c:102<br />#24 0x0804bc16 in handle_script (L=0x8072008, argv=0xbfaf38e4, n=1) at lua.c:250<br />#25 0x0804c0e5 in pmain (L=0x8072008) at lua.c:362<br />#26 0x08050ac2 in luaD_precall (L=0x8072008, func=0x807223c, nresults=0) at ldo.c:319<br />#27 0x08050d0b in luaD_call (L=0x8072008, func=0x807223c, nResults=0) at ldo.c:376<br />#28 0x0804dd5e in f_Ccall (L=0x8072008, ud=0xbfaf37ec) at lapi.c:847<br />#29 0x0804fec5 in luaD_rawrunprotected (L=0x8072008, f=0x804dcab &lt;f_Ccall>, ud=0xbfaf37ec) at ldo.c:116<br />#30 0x0805107e in luaD_pcall (L=0x8072008, func=0x804dcab &lt;f_Ccall>, u=0xbfaf37ec, old_top=12, ef=0) at ldo.c:463<br />#31 0x0804ddac in lua_cpcall (L=0x8072008, func=0x804bf61 &lt;pmain>, ud=0xbfaf3830) at lapi.c:857<br />#32 0x0804c1b2 in main (argc=2, argv=0xbfaf38e4) at lua.c:387<br /><br />lua的coroutine是通过c的堆栈来保存调用上下文的 多少个coroutine嵌套 就有多少个luaV_execute, 而lua的state保存存在lua_State，也就是thread对象中。<br />顺着调用链 再看下源代码很容易就明白了。
          <br/>
          <span style="color:red;">
            <a href="http://mryufeng.javaeye.com/blog/211004#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Thu, 03 Jul 2008 12:47:23 +0800</pubDate>
        <link>http://mryufeng.javaeye.com/blog/211004</link>
        <guid>http://mryufeng.javaeye.com/blog/211004</guid>
      </item>
      <item>
        <title>RemDebug小巧的Lua远端调试器 告诉你coroutine很强大</title>
        <author>mryufeng</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://mryufeng.javaeye.com">mryufeng</a>&nbsp;
          链接：<a href="http://mryufeng.javaeye.com/blog/209766" style="color:red;">http://mryufeng.javaeye.com/blog/209766</a>&nbsp;
          发表时间: 2008年06月30日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          RemDebug is a remote debugger for Lua 5.0 and 5.1. It lets you control the execution of another Lua program remotely, setting breakpoints and inspecting the current state of the program. RemDebug can also debug CGILua scripts.<br /><br />看他的源码只有2个东西:controller.lua 和 remdebug/engine.lua<br /><br />controller（233行）接受用户输入的指令 把指令传到远程的debugger去 同时显示结果, 它是一个socket server.<br /><br />engine（283行）是调试器的核心 解释controller的指令 通过sethook来进行调试动作。<br /><br />一个完整的调试器 500行左右， 其中的engine完美演示了coroutine的强大，佩服。<br /><br />不过1.0有个小bug,就是使用了getn,setn来进行表格插入 有问题，改成5.1的语法就OK了
          <br/>
          <span style="color:red;">
            <a href="http://mryufeng.javaeye.com/blog/209766#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Mon, 30 Jun 2008 14:47:24 +0800</pubDate>
        <link>http://mryufeng.javaeye.com/blog/209766</link>
        <guid>http://mryufeng.javaeye.com/blog/209766</guid>
      </item>
      <item>
        <title>Lua For Windows v5.1.3.11 Release Candidate 1</title>
        <author>mryufeng</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://mryufeng.javaeye.com">mryufeng</a>&nbsp;
          链接：<a href="http://mryufeng.javaeye.com/blog/209663" style="color:red;">http://mryufeng.javaeye.com/blog/209663</a>&nbsp;
          发表时间: 2008年06月30日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          Lua For Windows v5.1.3.11 Release Candidate 1<br />    Andrew Wilson - 2008-06-28 00:19   -   Lua for Windows<br />We are proud to announce the first release candidate of Lua for Windows (LfW). This moves this project into feature freeze, so only bugs will be fixed until the official release. Let us know what you think. It is important to get the best product so this can have a long life and bring more people to use Lua. Please give feedback.<br /><br />里面带了很多常用的lua模块 如luasocket，luazip等,还有相应的文档。<br />最值得一提的是里面带了个sciTE编辑器 支持lua的编辑调试，貌似还很稳定。推荐用下。<br /><br />附：	<br />SciTE研究 - 中文小组  https://groups.google.com/group/scite-cn
          <br/>
          <span style="color:red;">
            <a href="http://mryufeng.javaeye.com/blog/209663#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Mon, 30 Jun 2008 11:41:19 +0800</pubDate>
        <link>http://mryufeng.javaeye.com/blog/209663</link>
        <guid>http://mryufeng.javaeye.com/blog/209663</guid>
      </item>
      <item>
        <title>高级服务器编程和p2p的PPT</title>
        <author>mryufeng</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://mryufeng.javaeye.com">mryufeng</a>&nbsp;
          链接：<a href="http://mryufeng.javaeye.com/blog/208968" style="color:red;">http://mryufeng.javaeye.com/blog/208968</a>&nbsp;
          发表时间: 2008年06月28日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          前段时间受邀去青岛海洋大学做的演讲的ppt,内容主要涉及到<br />1. 高级服务器设计实现<br />2. Architecture of Large-Scale Websites<br />3. P2P设计经验谈<br />4. 个人成长之路<br /><br /><br />凑合看吧！
          <br/>
          <span style="color:red;">
            <a href="http://mryufeng.javaeye.com/blog/208968#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Sat, 28 Jun 2008 16:46:15 +0800</pubDate>
        <link>http://mryufeng.javaeye.com/blog/208968</link>
        <guid>http://mryufeng.javaeye.com/blog/208968</guid>
      </item>
      <item>
        <title>Alien - Pure Lua extensions</title>
        <author>mryufeng</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://mryufeng.javaeye.com">mryufeng</a>&nbsp;
          链接：<a href="http://mryufeng.javaeye.com/blog/208424" style="color:red;">http://mryufeng.javaeye.com/blog/208424</a>&nbsp;
          发表时间: 2008年06月27日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          What is Alien<br /><br />Alien is a Foreign Function Interface (FFI) for Lua. An FFI lets you call functions in dynamic libraries (.so, .dylib, .dll, etc.) from Lua code without having to write, compile and link a C binding from the library to Lua. In other words, it lets you write extensions that call out to native code using just Lua.<br /><br />Be careful when you use Alien, I tried to make it as safe as possible, but it is still very easy to crash Lua if you make a mistake. Alien itself is not as robust as a standard Lua extension, but you can use it to write extensions that won't crash if you code them well.<br /><br />Alien works on Unix-based systems and Windows. It has been tested on Linux x86, Linux x64, Linux ARM, FreeBSD x86, Windows x86, OSX x86, and OSX PPC. The Windows binary uses MSVCR80.DLL for compatibility with LuaBinaries.<br /><br />连模块都省了写了。
          <br/>
          <span style="color:red;">
            <a href="http://mryufeng.javaeye.com/blog/208424#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Fri, 27 Jun 2008 02:19:50 +0800</pubDate>
        <link>http://mryufeng.javaeye.com/blog/208424</link>
        <guid>http://mryufeng.javaeye.com/blog/208424</guid>
      </item>
      <item>
        <title>luaedit 新版本 支持lua5.1 马上要发布</title>
        <author>mryufeng</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://mryufeng.javaeye.com">mryufeng</a>&nbsp;
          链接：<a href="http://mryufeng.javaeye.com/blog/208423" style="color:red;">http://mryufeng.javaeye.com/blog/208423</a>&nbsp;
          发表时间: 2008年06月27日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          Announcing LuaEdit 2008 and new website<br />    Jean-François Goulet - 2008-06-24 21:14   -   LuaEdit<br />LuaEdit is getting a whole new look with the upcoming version of LuaEdit 2008 which will support the latest version of Lua 5.1, remote debugging, easy software integration and solution oriented management. Almost all previous features will be back (EG: syntax highlighting, code completion, locals, variable watch, etc)
          <br/>
          <span style="color:red;">
            <a href="http://mryufeng.javaeye.com/blog/208423#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Fri, 27 Jun 2008 01:53:14 +0800</pubDate>
        <link>http://mryufeng.javaeye.com/blog/208423</link>
        <guid>http://mryufeng.javaeye.com/blog/208423</guid>
      </item>
      <item>
        <title>lua newproxy用途</title>
        <author>mryufeng</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://mryufeng.javaeye.com">mryufeng</a>&nbsp;
          链接：<a href="http://mryufeng.javaeye.com/blog/208420" style="color:red;">http://mryufeng.javaeye.com/blog/208420</a>&nbsp;
          发表时间: 2008年06月27日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          What does newproxy() in 5.1?<br /><br />> I find newproxy a curious addition.  It gives you unique userdata that<br />> share the same metatable.  I cannot think of a use for it yet.<br />> What did you have in mind?<br /><br />This is a very experimental feature. We wanted a simple and secure way<br />of creating userdata in Lua. It has several uses, such as to monitor<br />garbage collection, as a light "unique" object, and for testing ;-).<br />But we cannot allow Lua to change the metatable of those userdata;<br />otherwise, Lua could break other libraries (e.g. give one of these<br />userdata as a file to be closed). To allow each userdata to have its own<br />new metatable or to share the metatable of another such userdata seems<br />flexible and secure.<br /><br />userdata to be collected still counts into new GC threshold, increasing memory consumption.<br />Reported by Roberto on 25 Jul 2003. Fixed in 5.0.2.<br /><br /><span style="color: red">这是用法：</span><br />Example:<br /><br />a = newproxy(true)<br />getmetatable(a).__gc = function () end<br />for i=1,10000000 do<br />  newproxy(a)<br />  if math.mod(i, 10000) == 0 then print(gcinfo()) end<br />end<br /><br /><br />搞了半天原来主要是用来产生大量的具有相同的行为的小对象 主要是做测试用的。<br /><br />萝卜神也搞得太忽悠人了。
          <br/>
          <span style="color:red;">
            <a href="http://mryufeng.javaeye.com/blog/208420#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Fri, 27 Jun 2008 01:02:00 +0800</pubDate>
        <link>http://mryufeng.javaeye.com/blog/208420</link>
        <guid>http://mryufeng.javaeye.com/blog/208420</guid>
      </item>
      <item>
        <title>你们有yum  我有LuaRocks </title>
        <author>mryufeng</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://mryufeng.javaeye.com">mryufeng</a>&nbsp;
          链接：<a href="http://mryufeng.javaeye.com/blog/208371" style="color:red;">http://mryufeng.javaeye.com/blog/208371</a>&nbsp;
          发表时间: 2008年06月26日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          LuaRocks<br /><br />This is LuaRocks, a deployment and management system for Lua modules.<br /><br />LuaRocks allows you to install Lua modules as self-contained packages called "rocks", which also contain version dependency information. This information is used both at install time, so that when one rock is requested all rocks it depends on are installed as well, and at run time, so that when a module is required, the correct version is loaded. LuaRocks supports both local and remote repositories, and multiple local rocks trees. You can download and install LuaRocks on Unix and Windows.<br /><br />LuaRocks is free software and uses the same license as Lua 5.1.<br /><br /><br />有这个东西安装lua的模块就方便了<br /><br />LuaRocks 0.5.2, a module deployment system for Lua<br /><br />luarocks - LuaRocks main command-line interface<br />usage: luarocks [--from=&lt;server> | --only-from=&lt;server>] [--to=&lt;tree>] [VAR=VALUE]... &lt;command> [&lt;argument>]<br /><br />Variables from the "variables" table of the configuration file<br />can be overriden with VAR=VALUE assignments.<br /><br />--from=&lt;server>       Fetch rocks/rockspecs from this server<br />                      (takes priority over config file)<br />--only-from=&lt;server>  Fetch rocks/rockspecs from this server only<br />                      (overrides any entries in the config file)<br />--to=&lt;tree>           Which tree to operate on.<br /><br />Supported commands:<br /><br />build   Build/compile a rock.<br />help    Help on commands.<br />install Install a rock.<br />list    Lists currently installed rocks.<br />make    Compile package in current directory using a rockspec.<br />pack    Create a rock, packing sources or binaries.<br />remove  Uninstall a rock.<br />search  Query the LuaRocks servers.<br />unpack  Unpack the contents of a rock.<br /><br /><br />比如：<br />我要安装copas  那么 luarocks install copas<br /><br />但是 lua -l copas还是出错 原因是rocks安装的模块不是在标准的lua 路径下 可以这样解决 <br /><br />lua -l luarocks.require -l copas 搞定<br /><br />luarocks.require会取代lua标准的require 这样就可以顺利引导模块。<br /><br /><br />Enjoy Lua!
          <br/>
          <span style="color:red;">
            <a href="http://mryufeng.javaeye.com/blog/208371#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Thu, 26 Jun 2008 21:38:19 +0800</pubDate>
        <link>http://mryufeng.javaeye.com/blog/208371</link>
        <guid>http://mryufeng.javaeye.com/blog/208371</guid>
      </item>
      <item>
        <title>ASN.1协议 适合我们用吗？</title>
        <author>mryufeng</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://mryufeng.javaeye.com">mryufeng</a>&nbsp;
          链接：<a href="http://mryufeng.javaeye.com/blog/204244" style="color:red;">http://mryufeng.javaeye.com/blog/204244</a>&nbsp;
          发表时间: 2008年06月16日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          R12B发布以后 号称ASN.1解码速度快了好多。前天仔细看了文档，感觉用在自有的系统去不错。ASN.1的结构还是很紧凑的，BER,PER,BER_BIN,PER_BIN都支持。特别是支持选择性decode,这个feature非常赶兴趣。用在自己的项目里面就省去了很多协议编解码的繁琐和易错,毕竟asn compiler也做了几万行 我相信他的性能。
          <br/>
          <span style="color:red;">
            <a href="http://mryufeng.javaeye.com/blog/204244#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Mon, 16 Jun 2008 17:12:48 +0800</pubDate>
        <link>http://mryufeng.javaeye.com/blog/204244</link>
        <guid>http://mryufeng.javaeye.com/blog/204244</guid>
      </item>
      <item>
        <title>LPeg Parsing Expression Grammars For Lua, version </title>
        <author>mryufeng</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://mryufeng.javaeye.com">mryufeng</a>&nbsp;
          链接：<a href="http://mryufeng.javaeye.com/blog/204054" style="color:red;">http://mryufeng.javaeye.com/blog/204054</a>&nbsp;
          发表时间: 2008年06月16日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          Introduction<br /><br />LPeg is a new pattern-matching library for Lua, based on Parsing Expression Grammars (PEGs). In this text, I assume you are familiar with PEGs. If you are not, you can get a quick start reading the Wikipedia Entry for PEGs or Section 2 of Parsing Expression Grammars: A Recognition-Based Syntactic Foundation (the section has only one page). The nice thing about PEGs is that it has a formal basis (instead of being an ad-hoc set of features), allows an efficient and simple implementation, and does most things we expect from a pattern-matching library (and more, as we can define entire grammars). <br /><br />作者是Lua语言的Robert， 2100行ANSI c代码， 和boost:spirit差不多强大。我等有福气了，做个小型的文法分析器轻轻松松.  作者200行用lpeg实现了一个regex模块. 一起来吧， lua也有了yacc & lex.
          <br/>
          <span style="color:red;">
            <a href="http://mryufeng.javaeye.com/blog/204054#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Mon, 16 Jun 2008 12:05:06 +0800</pubDate>
        <link>http://mryufeng.javaeye.com/blog/204054</link>
        <guid>http://mryufeng.javaeye.com/blog/204054</guid>
      </item>
      <item>
        <title>gen_tcp 应对对端半关闭</title>
        <author>mryufeng</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://mryufeng.javaeye.com">mryufeng</a>&nbsp;
          链接：<a href="http://mryufeng.javaeye.com/blog/203005" style="color:red;">http://mryufeng.javaeye.com/blog/203005</a>&nbsp;
          发表时间: 2008年06月13日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          当tcp对端调用shutdown(RD/WR) 时候， 宿主进程默认将收到{tcp_closed, Socket}消息， 如果这个行为不是你想要的，那么请看：<br /><br />shutdown(Socket, How) -> ok | {error, Reason}<br /><br />Types:<br /><br />Socket = socket()<br />How = read | write | read_write<br />Reason = posix()<br /><br />Immediately close a socket in one or two directions.<br /><br />How == write means closing the socket for writing, reading from it is still possible.<br /><span style="color: red"><br />To be able to handle that the peer has done a shutdown on the write side, the {exit_on_close, false} option is useful</span>.<br /><br />这样就不会被强制退出了。
          <br/>
          <span style="color:red;">
            <a href="http://mryufeng.javaeye.com/blog/203005#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Fri, 13 Jun 2008 15:53:25 +0800</pubDate>
        <link>http://mryufeng.javaeye.com/blog/203005</link>
        <guid>http://mryufeng.javaeye.com/blog/203005</guid>
      </item>
      <item>
        <title>丢人的strncpy 语义理解错误</title>
        <author>mryufeng</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://mryufeng.javaeye.com">mryufeng</a>&nbsp;
          链接：<a href="http://mryufeng.javaeye.com/blog/202588" style="color:red;">http://mryufeng.javaeye.com/blog/202588</a>&nbsp;
          发表时间: 2008年06月12日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          今天发现strncpy使用上的一个古怪bug, 解决了是发现对strncpy的语义理解错误。<br /><br />SYNOPSIS<br />       #include &lt;string.h><br /><br />       char *strcpy(char *dest, const char *src);<br /><br />       char *strncpy(char *dest, const char *src, size_t n);<br /><br />DESCRIPTION<br />       The  strcpy()  function  copies the string pointed to by src (including<br />       the terminating '\0' character) to the array pointed to by  dest.   The<br />       strings  may not overlap, and the destination string dest must be large<br />       enough to receive the copy.<br /><br />       The strncpy() function is similar, except that not more than n bytes of<br />       src  are copied. Thus, if there is no null byte among the first n bytes<br />       of src, the result will not be null-terminated.<br /><br />       <span style="color: red">In the case where the length of src is less than that of n, the remain-<br />       der of dest will be padded with null bytes.</span><br /><br /><br />请非常注意上面的红字:<br />1. 低效率的padding 因为常规情况下buffer要比实际的字符串大的多，所以无辜的填充。<br />2. 一旦不小心你的n 比 buffer的长度大 那就死惨了 内存狂越界写。<br />这种情况经常发生在你把buffer的长度改小了 但是后面的n没有相应地改。<br /> <br />相信很多人会遭受这个使用bug.
          <br/>
          <span style="color:red;">
            <a href="http://mryufeng.javaeye.com/blog/202588#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Thu, 12 Jun 2008 18:35:50 +0800</pubDate>
        <link>http://mryufeng.javaeye.com/blog/202588</link>
        <guid>http://mryufeng.javaeye.com/blog/202588</guid>
      </item>
      <item>
        <title>Erlang/OTP R12B-3 released</title>
        <author>mryufeng</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://mryufeng.javaeye.com">mryufeng</a>&nbsp;
          链接：<a href="http://mryufeng.javaeye.com/blog/202431" style="color:red;">http://mryufeng.javaeye.com/blog/202431</a>&nbsp;
          发表时间: 2008年06月12日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          Erlang/OTP R12B-3 released<br /><br />The third service release for Erlang/OTP R12B has been released. (June 11, 2008) <br /><br />最大的卖点：<br /><br /> An experimental module "re" is added to the emulator which interfaces a publicly available regular expression library for Perl-like regular expressions (PCRE). The interface is purely experimental and *will* be subject to change.<br /><br />根据这个eep做的 http://www.erlang.org/eeps/eep-0011.html
          <br/>
          <span style="color:red;">
            <a href="http://mryufeng.javaeye.com/blog/202431#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Thu, 12 Jun 2008 11:30:52 +0800</pubDate>
        <link>http://mryufeng.javaeye.com/blog/202431</link>
        <guid>http://mryufeng.javaeye.com/blog/202431</guid>
      </item>
      <item>
        <title>Programming in lua (PIL) 2版中文版已经出来了</title>
        <author>mryufeng</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://mryufeng.javaeye.com">mryufeng</a>&nbsp;
          链接：<a href="http://mryufeng.javaeye.com/blog/198626" style="color:red;">http://mryufeng.javaeye.com/blog/198626</a>&nbsp;
          发表时间: 2008年05月30日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          这本书是lua作者自己写的 非常的不错 解说非常到位 学lua的都应该人手一本  china-pub.com上面有的买。俺前2年买的E版本 花了俺好几百块 不过值。。。
          <br/>
          <span style="color:red;">
            <a href="http://mryufeng.javaeye.com/blog/198626#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Fri, 30 May 2008 12:17:29 +0800</pubDate>
        <link>http://mryufeng.javaeye.com/blog/198626</link>
        <guid>http://mryufeng.javaeye.com/blog/198626</guid>
      </item>
      <item>
        <title>看例子写 testserver 和commontest 测试案例</title>
        <author>mryufeng</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://mryufeng.javaeye.com">mryufeng</a>&nbsp;
          链接：<a href="http://mryufeng.javaeye.com/blog/195778" style="color:red;">http://mryufeng.javaeye.com/blog/195778</a>&nbsp;
          发表时间: 2008年05月22日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          R12发步的时候 附带了testserver和commontest，有文档但是没有详细的叫你如何写测试案例。今天发现官网上有早期的测试案例（R9）的，可以参考下：<br />http://www.erlang.org/project/test_server/index.html<br /><br />有3种测试案例：<br />test_server-3.1.1.tar.gz   	 The test server application.<br />emulator-tests-2004-05-26.tar.gz 	Test suites for the emulator.<br />stdlib-tests-2004-05-26.tar.gz 	Test suites for the stdlib application.<br /><br />多写测试案例对于系统的稳定非常的有帮助哦。
          <br/>
          <span style="color:red;">
            <a href="http://mryufeng.javaeye.com/blog/195778#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Thu, 22 May 2008 19:01:46 +0800</pubDate>
        <link>http://mryufeng.javaeye.com/blog/195778</link>
        <guid>http://mryufeng.javaeye.com/blog/195778</guid>
      </item>
  </channel>
</rss>