摘要:
背景 在一个lua文件中书写的代码, 使用的变量, 需要设置其运行环境。 目的: 1、 不破坏全局环境。 2、 限定文件所使用的环境, 作为沙箱功能。 解法 限定运行空间环境的文件: 加载上个文件的代码 (将dmenu的值,传入上个文件, 并限定只能在全局环境中读取):
阅读全文
posted @ 2017-01-26 10:57
lightsong
阅读(1396)
推荐(0)
摘要:
函数链 http://lua-users.org/wiki/FiltersSourcesAndSinks A chain is a function that combines the effect of two (or more) other functions, but whose interf
阅读全文
posted @ 2017-01-26 10:49
lightsong
阅读(388)
推荐(0)
摘要:
背景 不同文件中,lua提供模块写法, 使用local修饰,可以将变量或者函数,声明为模块内有效,例如 模块暴漏变量使用 return 表的方式。 这样能够避免不同文件中, 存在相同函数或者变量名, 污染全局环境问题, 也解决的命名冲突问题。 但是存在一种情况, 在同一个文件内, 存在函数同名情况,
阅读全文
posted @ 2017-01-11 22:01
lightsong
阅读(1882)
推荐(0)
摘要:
背景 见上一篇。 面向对象的链式调用中,掺杂了 一个一部动作, 对于这种工作链, 是非同步执行的链。 LazyMan("Hank").sleep(1).eat("dinner") 同步执行的工作链中, 任何一个动作,即函数调用, 都是同步的, 可理解为普通的函数。 异步的工作链, 前提条件是工作链中
阅读全文
posted @ 2017-01-07 22:13
lightsong
阅读(1341)
推荐(0)
摘要:
LazyMan问题与解法 http://mp.weixin.qq.com/s/drNGvLZddQztcUzSh8OsSw 给出了一道题目,并给出了解法: 题目: 实现一个LazyMan,可以按照以下方式调用: LazyMan(“Hank”)输出: Hi! This is Hank! LazyMan
阅读全文
posted @ 2017-01-05 00:53
lightsong
阅读(274)
推荐(0)
摘要:
ReactiveX http://reactivex.io/ An API for asynchronous programmingwith observable streams The Observer pattern done right ReactiveX is a combination o
阅读全文
posted @ 2017-01-04 00:31
lightsong
阅读(605)
推荐(0)
摘要:
https://en.wikipedia.org/wiki/Aspect-oriented_programming Action Agent-oriented Array-oriented Automata-based Concurrent computing Relativistic progra
阅读全文
posted @ 2017-01-03 00:11
lightsong
阅读(220)
推荐(0)
摘要:
AOP https://en.wikipedia.org/wiki/Aspect-oriented_programming Typically, an aspect is scattered or tangled as code, making it harder to understand and
阅读全文
posted @ 2017-01-02 23:57
lightsong
阅读(413)
推荐(0)
摘要:
luaunit Luaunit is a unit-testing framework for Lua, in the spirit of many others unit-testing framework. Luaunit let's you write test functions, test
阅读全文
posted @ 2017-01-01 10:07
lightsong
阅读(1956)
推荐(0)
摘要:
Diet Food Diet (nutrition), the sum of the food consumed by an organism or group Dieting, the deliberate selection of food to control body weight or n
阅读全文
posted @ 2017-01-01 08:52
lightsong
阅读(1242)
推荐(0)
摘要:
如上实验, 第二行文字点击, 显示第二个id。 具体原因是, 事件被克隆, 但是事件处理函数没有被执行, 事件处理函数在clone对象的事件处理后才执行, 其中this为,触发此函数执行的对象。 见zhangxinxu解释: http://www.zhangxinxu.com/wordpress/2
阅读全文
posted @ 2016-12-28 17:47
lightsong
阅读(4116)
推荐(0)
摘要:
概念 XML 扩展标记语言 (Extensible Markup Language, XML) ,用于标记电子文件使其具有结构性的标记语言,可以用来标记数据、定义数据类型,是一种允许用户对自己的标记语言进行定义的源语言。 XML使用DTD(document type definition)文档类型定
阅读全文
posted @ 2016-12-28 17:23
lightsong
阅读(8890)
推荐(1)
摘要:
背景 在移动互联网浪潮下,移动设备普及,对配置需要考虑移动端设备可访问性。Web作为最贴近用户的配置手段,面向从PC端传统页面,向移动端页面的转型。 概念 PC Web: 面向传统PC电脑的浏览器开发的Web人机交互界面。 移动Web:面向移动设备的浏览器开发的Web人机交互界面。移动设备包括:手机
阅读全文
posted @ 2016-12-25 22:19
lightsong
阅读(429)
推荐(0)
摘要:
背景 工作中往往会有多个excel维护的情况,随着业务的变化, 将一个Excel合并到另外一个Excel,成为必须。 如何移动sheet,对于不会的人,这是一个好问题, 也许你经过多次尝试都没有成功。 下面给出方案。 方案 http://blog.163.com/yj_yuan/blog/stati
阅读全文
posted @ 2016-12-25 18:00
lightsong
阅读(3530)
推荐(0)
摘要:
背景 Web自动化测试越来越被重视, 因为现在Web已经是工程化的状态。 如何通过工具测试, 保证Web开发的质量,提升开发效率,是Web工具的诞生的来由。 Web测试分为以下几个方面: 1、 界面测试 测试界面是否正常,这是前端测试最基础的环节。 2、 功能测试 测试功能操作是否正常,由于涉及交互
阅读全文
posted @ 2016-12-19 23:56
lightsong
阅读(2747)
推荐(0)
摘要:
问题 对于 jquery 接口text()只能取到有标签的 dom对象中 文本内容。 如果索引对象本身就是文本节点,则不好索引到, 没有相关的索引选择器。 例如: 对于<input>aaa 形式的代码, $("input").next().text(), 则不能返回 aaa。 下面有讨论使用jque
阅读全文
posted @ 2016-11-27 21:09
lightsong
阅读(640)
推荐(0)
摘要:
概念 http://www.juweixin.com/t/detail/148383 语法到底是什么?有人说语法是语言里的法律、法规;有人说语法是框架结构;还有人说语法就是对前人语言习惯的一种总结。以上这些说法都对,但是又不全对。 In linguistics, grammar is the set
阅读全文
posted @ 2016-11-27 20:56
lightsong
阅读(9959)
推荐(0)
摘要:
Digest access authentication https://en.wikipedia.org/wiki/Digest_access_authentication Digest access authentication is one of the agreed-upon methods
阅读全文
posted @ 2016-11-27 20:34
lightsong
阅读(1667)
推荐(0)
摘要:
用途 https://github.com/gf3/sandbox Can be used to execute untrusted code. Support for timeouts (e.g. prevent infinite loops) Support for memory errors
阅读全文
posted @ 2016-11-24 23:35
lightsong
阅读(953)
推荐(0)
摘要:
MVVM https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93viewmodel Model–view–view-model (MVVM) is a software architectural pattern. MVVM facilit
阅读全文
posted @ 2016-11-22 00:10
lightsong
阅读(1526)
推荐(0)
摘要:
Sass https://en.wikipedia.org/wiki/Sass_(stylesheet_language) Sass (Syntactically Awesome Stylesheets) is a style sheet language initially designed by
阅读全文
posted @ 2016-11-19 01:09
lightsong
阅读(471)
推荐(0)
摘要:
背景 对于某一个函数, 其被调用多次, 每次调用的入参都是一致的。 不想每次都填写参数, 如果能够定义一个新的函数, 将参数跟此函数绑定就棒哒哒了。 类似javascript function.bind功能: https://developer.mozilla.org/en-US/docs/Web/
阅读全文
posted @ 2016-11-19 00:17
lightsong
阅读(1712)
推荐(0)
摘要:
函数重载 https://en.wikipedia.org/wiki/Function_overloading In some programming languages, function overloading or method overloading is the ability to cr
阅读全文
posted @ 2016-11-14 22:43
lightsong
阅读(1127)
推荐(0)
摘要:
二维码 http://www.baike.com/wiki/%E4%BA%8C%E7%BB%B4%E7%A0%81 二维条码/二维码(2-dimensional bar code)是用某种特定的几何图形按一定规律在平面(二维方向上)分布的黑白相间的图形记录数据符号信息的;在代码编制上巧妙地利用构成计
阅读全文
posted @ 2016-11-14 22:09
lightsong
阅读(18693)
推荐(0)
摘要:
功能背景 大部网站都有菜单功能, 每个页面都有ajax更新页数据请求, 如何将页面上的所有菜单的页面都保存下来本地PC? 后续可以在本地PC上浏览页面。 前面一个文章 利用phantomjs可以抓取单个页面的并保存到PC, 可以本地浏览。 http://www.cnblogs.com/lightso
阅读全文
posted @ 2016-11-06 21:29
lightsong
阅读(781)
推荐(0)
摘要:
什么是? http://www.w3school.com.cn/xsl/xsl_intro.asp XSLT 是一种用于将 XML 文档转换为 XHTML 文档或其他 XML 文档的语言。 XPath 是一种用于在 XML 文档中进行导航的语言。 什么是 XSLT? XSLT 指 XSL 转换(XS
阅读全文
posted @ 2016-11-04 23:56
lightsong
阅读(634)
推荐(0)
摘要:
lua no class It is a prototype based language。 在此语言中没有class关键字来创建类。 现代ES6, 已经添加class类。 prototype based 语言没啥优势。 lua 如何构建class机制? https://github.com/fan
阅读全文
posted @ 2016-11-04 22:59
lightsong
阅读(2290)
推荐(0)
摘要:
背景 现代页面上越来越多的内容是通过ajax更新, 因为页面可以显示的更加快速, 局部更新, 同时可以实现页面内容的动态性, 增加页面的内容的丰富性。 但是如果将页面内容保存下来, 以备离线浏览器查看, 则由于ajax存在的原因, 直接使用保存的方法不能实现, 因为会有ajax访问禁用的报错。 对于
阅读全文
posted @ 2016-10-17 23:26
lightsong
阅读(795)
推荐(0)
摘要:
Cyassl库 https://wolfssl.com/wolfSSL/Docs-wolfssl-manual-17-8-wolfssl-api-connection-session-io.html int CyaSSL_read(CYASSL* ssl, void* data, int sz);
阅读全文
posted @ 2016-10-04 20:20
lightsong
阅读(8325)
推荐(0)
摘要:
Prototype-based programming https://en.wikipedia.org/wiki/Prototype-based_programming Prototype-based programming is a style of object-oriented progra
阅读全文
posted @ 2016-09-26 23:06
lightsong
阅读(427)
推荐(0)
摘要:
背景 lua是类是借助表的来实现的, 类被定义后, 在使用场景下, 不希望被修改。如果被修改, 则影响的类的原始定义, 影响所有使用类的地方。 例如: 故提出新的要求: 1、 对于类在应用场景下,不能修改属性。 2、 对于类在应用场景下, 不能添加新的属性。 类的实现代码: 他山之石 http://
阅读全文
posted @ 2016-09-25 19:06
lightsong
阅读(2635)
推荐(0)
摘要:
HTML5 video https://github.com/remy/html5demos/blob/master/demos/video.html HTML5支持video和audio之前, 网页播放流媒体文件, 都是通过其它方法, 例如 activex插件 或者 flash。 支持后,页面可以
阅读全文
posted @ 2016-09-20 23:23
lightsong
阅读(31499)
推荐(0)
摘要:
commonjs http://www.commonjs.org/ CommonJS JavaScript is a powerful object oriented language with some of the fastest dynamic language interpreters ar
阅读全文
posted @ 2016-09-19 00:11
lightsong
阅读(544)
推荐(0)
摘要:
websocket 2011年技术文档 http://www.ibm.com/developerworks/cn/web/1112_huangxa_websocket/index.html 浏览器端接口: https://developer.mozilla.org/en-US/docs/Web/AP
阅读全文
posted @ 2016-09-17 23:36
lightsong
阅读(2397)
推荐(0)
摘要:
背景 对于OO思想实现的类, 对于某些场景需要屏蔽某些方法, 不让调用。过了这段场景, 就恢复这些类的方法, 可以调用。 例如: 工厂具有开工方法, 但是在晚上不允许开工, 所有在晚上这段时间, 见开工方法屏蔽掉, 到第二天早上八点将此方法恢复。 实现 LOG: >lua -e "io.stdout
阅读全文
posted @ 2016-09-17 19:39
lightsong
阅读(1331)
推荐(0)
摘要:
http://wenku.baidu.com/view/0f4acf88cc22bcd126ff0ca2.html?re=view 1 标准和目标 1.1前言目前开源的网管软件众多,时间关系只能通过网络上的资料介绍和其他用户的体验进行评估。对于重点调查的开源软件通过运行环境搭建、开发环境搭建的方法进
阅读全文
posted @ 2016-09-15 22:41
lightsong
阅读(2310)
推荐(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
阅读(2430)
推荐(0)
摘要:
背景 前面的文章演示了使用闭包函数实现 状态的迭代器。 本文演示使用 coroutine来产生迭代器的例子。 coroutine迭代器例子 -- 遍历二叉树 LOG: >lua -e "io.stdout:setvbuf 'no'" "luatest.lua" 13455.577.4911>Exit
阅读全文
posted @ 2016-09-15 00:29
lightsong
阅读(566)
推荐(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
阅读(632)
推荐(0)
摘要:
迭代器 http://www.tutorialspoint.com/lua/lua_iterators.htm 迭代器能够让你遍历某个集合或者容器中的每一个元素。 对于lua来说, 集合通常指代 table, 用于创建变化的数据结构, 类似数组。 Iterator is a construct th
阅读全文
posted @ 2016-09-04 21:33
lightsong
阅读(1123)
推荐(0)