摘要:
背景 对于OO思想实现的类, 对于某些场景需要屏蔽某些方法, 不让调用。过了这段场景, 就恢复这些类的方法, 可以调用。 例如: 工厂具有开工方法, 但是在晚上不允许开工, 所有在晚上这段时间, 见开工方法屏蔽掉, 到第二天早上八点将此方法恢复。 实现 LOG: >lua -e "io.stdout
阅读全文
posted @ 2016-09-17 19:39
lightsong
阅读(1336)
推荐(0)
摘要:
http://wenku.baidu.com/view/0f4acf88cc22bcd126ff0ca2.html?re=view 1 标准和目标 1.1前言目前开源的网管软件众多,时间关系只能通过网络上的资料介绍和其他用户的体验进行评估。对于重点调查的开源软件通过运行环境搭建、开发环境搭建的方法进
阅读全文
posted @ 2016-09-15 22:41
lightsong
阅读(2314)
推荐(0)
摘要:
Unit Test Unit testing is about testing your code during development, not in production. Typically you start by preparing the testing environment, wri
阅读全文
posted @ 2016-09-15 21:09
lightsong
阅读(2435)
推荐(0)
摘要:
背景 前面的文章演示了使用闭包函数实现 状态的迭代器。 本文演示使用 coroutine来产生迭代器的例子。 coroutine迭代器例子 -- 遍历二叉树 LOG: >lua -e "io.stdout:setvbuf 'no'" "luatest.lua" 13455.577.4911>Exit
阅读全文
posted @ 2016-09-15 00:29
lightsong
阅读(568)
推荐(0)
摘要:
table.maxn (table) Returns the largest positive numerical index of the given table, or zero if the table has no positive numerical indices. (To do its
阅读全文
posted @ 2016-09-15 00:19
lightsong
阅读(634)
推荐(0)
摘要:
迭代器 http://www.tutorialspoint.com/lua/lua_iterators.htm 迭代器能够让你遍历某个集合或者容器中的每一个元素。 对于lua来说, 集合通常指代 table, 用于创建变化的数据结构, 类似数组。 Iterator is a construct th
阅读全文
posted @ 2016-09-04 21:33
lightsong
阅读(1125)
推荐(0)
摘要:
https://www.owasp.org/images/0/04/Roberto_Suggi_Liverani_OWASPNZDAY2010-Defending_against_application_DoS.pdf slowloris http://www.huffingtonpost.co.u
阅读全文
posted @ 2016-08-21 23:00
lightsong
阅读(371)
推荐(0)
摘要:
是什么? https://www.promisejs.org/ What is a promise? The core idea behind promises is that a promise represents the result of an asynchronous operation.
阅读全文
posted @ 2016-08-21 16:36
lightsong
阅读(1104)
推荐(0)
摘要:
问题 attempt to yield across metamethod/C-call boundary 需求跟如下帖子中描述一致: http://bbs.chinaunix.net/forum.php?mod=viewthread&action=printable&tid=4065715 模拟一
阅读全文
posted @ 2016-08-18 22:30
lightsong
阅读(5589)
推荐(0)
摘要:
问题 web framework是否包括webserver? 是否可以包括? webserver 和 framework的关系是? https://www.quora.com/What-is-the-difference-between-a-web-server-and-a-web-framewor
阅读全文
posted @ 2016-08-18 00:11
lightsong
阅读(489)
推荐(0)
摘要:
throttle http://www.iciba.com/throttle N-COUNT (汽车、飞机的)节流阀,油门杆,油门踏板 The throttle of a motor vehicle or aircraft is the device, lever, or pedal that co
阅读全文
posted @ 2016-08-17 23:38
lightsong
阅读(1107)
推荐(0)
摘要:
背景 最近解决lua的一则协程问题, 需要将一个patch添加到我们自己的lua库代码中, 由于我们整合的lua库代码目录,与原始的lua库代码不一致,导致不能直接使用path应用到我们自己的lua代码中, 所以需要将path做成 old&new文件夹, 使用merge工具, 手动同步到我们的lua
阅读全文
posted @ 2016-08-17 21:53
lightsong
阅读(766)
推荐(0)
摘要:
什么是环境? http://www.lua.org/manual/5.1/manual.html#2.9 Besides metatables, objects of types thread, function, and userdata have another table associated
阅读全文
posted @ 2016-08-07 22:23
lightsong
阅读(1090)
推荐(0)
摘要:
module 与 package.seeall http://blog.codingnow.com/2006/02/lua_51_module.html 使用 module("test") 后,下面不再看的见前面的全局环境。如果在这个模块里想调用 print 输出调试信息怎么办呢?一个简单的方法是 local print=printmodule("test") 这样 print 是一个 loc...
阅读全文
posted @ 2016-08-06 01:30
lightsong
阅读(3920)
推荐(0)
摘要:
module 作用 module (name [, ···]) Creates a module. If there is a table in package.loaded[name], this table is the module. Otherwise, if there is a global table t with the given name, this table is the...
阅读全文
posted @ 2016-08-06 00:25
lightsong
阅读(410)
推荐(0)
摘要:
数学中的链式法则 http://sx.zxxk.com/ArticleInfo.aspx?InfoID=164649 链式微分法则:实数运算的链式法则:对数运算的链式法则:平行公理的链式法则:向量运算的链式法则: JS对象链式调用方法http://stackoverflow.com/questions/15029309/how-to-write-jquery-chainable-functi...
阅读全文
posted @ 2016-08-04 22:33
lightsong
阅读(1132)
推荐(0)
摘要:
什么是函数式编程 http://www.zhihu.com/topic/19585411/hot 函数式编程的本质函数式编程中的函数这个术语不是指计算机中的函数(实际上是Subroutine),而是指数学中的函数,即自变量的映射。也就是说一个函数的值仅决定于函数参数的值,不依赖其他状态。比如sqrt(x)函数计算x的平方根,只要x不变,不论什么时候调用,调用几次,值都是不变的。在函数式语言中,函...
阅读全文
posted @ 2016-07-24 23:41
lightsong
阅读(1567)
推荐(0)
摘要:
介绍 http://keplerproject.github.io/orbit/ Orbit是lua语言版本的MVC框架。 此框架完全抛弃CGILUA的脚本模型, 支持的应用, 每个应用可以卸载一个单独的文件中,当然你也可以将它拆为一个文件, 当你需要时候。 此框架运行在WSAPI协议的服务器上,所以可以工作在 Xavante和一些CGI和fastcgi程序上。 Orbit is an MVC ...
阅读全文
posted @ 2016-07-23 00:21
lightsong
阅读(3459)
推荐(0)
摘要:
模板引擎 模板引擎 起到 数据和视图分离的作用, 模板对应视图, 关注如何展示数据, 在模板外头准备的数据, 关注那些数据可以被展示。 后端模板引擎 freemarker 如下介绍, java后台的模板引擎, freemark介绍,其图能很好标明这种关系。 http://freemarker.org
阅读全文
posted @ 2016-07-20 23:32
lightsong
阅读(10020)
推荐(0)
摘要:
autocomplete方法 https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion#The_autocomplete_attribute_and_login_fields 对于普通的表单区域 此属性设置为 off,具有阻止浏览器记忆的功能 S...
阅读全文
posted @ 2016-07-14 00:27
lightsong
阅读(1023)
推荐(0)
摘要:
背景 经常区分不了 界 和 级 的区别, 不清楚入学和毕业应该使用哪个词语, 这里记录下我的研究,并谈谈我的理解,以帮助正确使用这两个词。 http://home.51.com/founderyao/diary/item/10042245.html 说文解字 界 http://www.zdic.net/z/18/js/5C4A.htm 基本字义 ● 届 jiè ㄐㄧㄝˋ 1. 到:~...
阅读全文
posted @ 2016-07-10 19:43
lightsong
阅读(7027)
推荐(0)
摘要:
原理 http://chuna2.787528.xyz/skynet/p/4173450.html 快速通用网关接口(Fast Common Gateway Interface/FastCGI)是通用网关接口(CGI)的改进,描述了客户端和服务器程序之间传输数据的一种标准。FastCGI致力于减少Web
阅读全文
posted @ 2016-07-03 23:47
lightsong
阅读(5495)
推荐(0)
摘要:
pack和unpack 对于一个函数, 要将其入参转换为一个表, 则pack函数合适。 对于一个表要将其转换为 一个函数的入参, 则 lua原生提供的 unpack函数可以实现。 do arrayData = {"a", "b", "c", "d", "e"}; function pack(...) return {...}; end print( pack("aa", "bb"...
阅读全文
posted @ 2016-06-30 00:14
lightsong
阅读(449)
推荐(0)
摘要:
什么是兼容性? compatible http://www.webopedia.com/TERM/C/compatible.html (n) Indicates that a product can work with or is equivalent to another, better-know
阅读全文
posted @ 2016-06-30 00:00
lightsong
阅读(2755)
推荐(0)
摘要:
安装 参考如下博文安装thttpd软件 http://blog.csdn.net/21aspnet/article/details/7045845 http://blog.csdn.net/dragoncheng/article/details/5614559 thttpd配置文件: root@fqs:/usr/local/bin# cat /usr/local/thttpd/conf/ e...
阅读全文
posted @ 2016-06-26 23:06
lightsong
阅读(2060)
推荐(0)
摘要:
安装软件 需要安装三个lua 库: xavante wsapi cgilua luarocks install xavante http://keplerproject.github.io/xavante/manual.html#install Xavante is a Lua HTTP 1.1 Web server that uses a modular architecture base...
阅读全文
posted @ 2016-06-22 23:16
lightsong
阅读(850)
推荐(0)
摘要:
seajs http://seajs.org/docs/en.html#intro https://github.com/seajs/seajs/releases Extremely simple experience of modular development Why use Sea.js ? Sea.js's pursuit of a simple, natural coding a...
阅读全文
posted @ 2016-06-13 22:49
lightsong
阅读(296)
推荐(0)
摘要:
是什么? http://brackets.io/ A modern, open source text editor that understands web design. 现代, 开源的文本编辑器, 最懂得web设计。 With focused visual tools and preprocessor support, Brackets is a modern text editor t...
阅读全文
posted @ 2016-06-12 22:10
lightsong
阅读(1692)
推荐(0)
摘要:
什么是luaprofiler? http://luaprofiler.luaforge.net/manual.html LuaProfiler is a time profiler designed to help finding bottlenecks on your Lua program. If you use LuaProfiler into your program, it will ...
阅读全文
posted @ 2016-06-11 22:28
lightsong
阅读(3099)
推荐(0)
摘要:
背景描述 编程或者文档处理过程, 经常遇到需要将一个单词修改为另外一个单词的情况, 例如 命名为 shall 修改 为 should。 使用工具实现, 则比较方便,不容易出错, 解放双手。 需求规格 对于某个文件夹中的所有文本文件(txt), 将某个单词替换为目标单词。 实现思路 对于替换的单词映射, 在配置文件config.lua进行设置, 存储一个表,表中每一行 对应 src voc...
阅读全文
posted @ 2016-06-11 21:33
lightsong
阅读(3051)
推荐(0)
摘要:
什么是Markdown http://note.youdao.com/iyoudao/?p=1895 Markdown是一种轻量级的「标记语言」。是为那些经常需要码字或者进行文字排版的、对码字手速和排版顺畅度有要求的人群设计的,他们希望用键盘把文字内容打出来的同时搞定排版,最好从头到尾都不要使用鼠标。这些人最常见的是经常需要写文档的码农,另外包括博客写手、网站小编、出版业人士等等。 如果你是程...
阅读全文
posted @ 2016-05-31 22:00
lightsong
阅读(680)
推荐(0)
摘要:
什么是 keep-alive 连接 https://en.wikipedia.org/wiki/HTTP_persistent_connection HTTP persistent connection, also called HTTP keep-alive, or HTTP connection reuse, is the idea of using a single TCP connect...
阅读全文
posted @ 2016-05-29 22:44
lightsong
阅读(460)
推荐(0)
摘要:
emoji是什么? http://www.baike.com/wiki/emoji emoji表情符号,是20世纪90年代由NTT Docomo栗田穣崇(Shigetaka Kurit)创建的,词义来自日语(えもじ,e-moji,moji在日语中的含义是字符)。 emoji可以使数字通信做到让人如同面对面交流,避免错误传达信息。 自苹果公司发布的iOS 5输入法中加入了emoji后,这种表情符号开...
阅读全文
posted @ 2016-05-18 23:38
lightsong
阅读(1960)
推荐(0)
摘要:
问题 使用原生的setTimeout和setInterval仅仅能够实现, 定时执行事件处理函数, 在网页开发中, 往往会出现一种情况,定时器用于定时更新某个页面区域的数据, 往往在页面加载之后, 就启动这个定时器, 往后则间隔执行此定时器。 页面上定时刷新的区域可能会动态消失, 特别是在ajax被广泛使用的今天, 如果定时刷新的区域被删除了, 则定时器材也需要自动清除掉。 此二个接口...
阅读全文
posted @ 2016-05-06 22:28
lightsong
阅读(1419)
推荐(0)
摘要:
需求介绍 在编码或者调试过程中经常需要进行 字节码转换为 十六进制的字符串, 或者将 十六进制字符串 转换为 字节码的需求。 即: 字节码 (内存中存储的 01 串): 11111111 FF Code linux上调试通过。 #include #include #include // Stringify binary data. Output buffer must be ...
阅读全文
posted @ 2016-05-02 00:04
lightsong
阅读(1868)
推荐(0)
摘要:
单例 存在这么一类class, 无论class怎么初始化, 产生的instance都是同一个对象。 Code string.toHTMLCode = function(self) return encodeHTML(self) end -- Instantiates a class local fu
阅读全文
posted @ 2016-05-01 00:03
lightsong
阅读(1266)
推荐(0)
摘要:
lua原生不支持OOP特性 确实如此, 同时可以采用其它lua代码的方式实现OOP的特性。 OOP四大特性 抽象 封装 继承 多态 http://chuna2.787528.xyz/xiaosongluffy/p/5072501.html 四大基本特性: 抽象:提取现实世界中某事物的关键特性,为该事物构建模型的过程。对同一事物在不同的需求下,需要提取的特性可能不一样。得到的抽象模型中一般包含:属...
阅读全文
posted @ 2016-04-30 23:56
lightsong
阅读(861)
推荐(0)
摘要:
分离构造和使用 构造含义是功能的实现, 此功能是一个定义明确的处理过程, 开放出明确的接口给调用者使用。 则使用者可以直接调用接口进行使用, 但是使用者需要搞清楚, 那些是构造, 那些是使用。 不要再使用的地方, 将构造的代码也实现。 否则, 构造的代码会淹没掉 使用地方的 业务逻辑。 LUA需求 在一个lua表中, 查询指定参数名称的参数值, 并将此参数值转换为 html encode编码...
阅读全文
posted @ 2016-04-30 23:34
lightsong
阅读(347)
推荐(0)
摘要:
相同name的submit 类型的input提交行为 描述 这种情况, 其能够作为提交内容, 发送到服务器段的参数的按钮, 对应被点击激活的按钮。 这表示多个 同名的name, 一次提交只能激活一个。 例如点击了 apply, ACTION=Apply会被传送到服务器端。 这样服务器端就可以判断对于同样提交的一份数据, 需要执行什么样的操作, 是修改...
阅读全文
posted @ 2016-04-30 22:45
lightsong
阅读(811)
推荐(0)
摘要:
困扰 设计师给出静态的高保真图片, 需要前端工程师按照高保真图,进行html编码。 前端工程师, 一般工作方法为: 打开图片,一边看下图片, 一边编写相应的html代码。 这样有两个问题: 1、 前端工程师比较累, 不停切换 图片和 编辑器, 操作频繁。手累! 2、 编写出来的html页面,不一定跟
阅读全文
posted @ 2016-04-30 22:19
lightsong
阅读(14396)
推荐(0)