摘要: 包含在带有src属性的标签之间再包含额外的JavaScript代码。如果包含了嵌入的代码,则只会下载并执行外部脚本文件,嵌入的代码会被忽略。 在文档的元素中包含所有JavaScript文件,意味着必须等到全部JavaScript代码都被下载,解析和执行完成以后,才能开始呈现页面的内容(浏览器在遇到标签时才开始呈现内容)。对于那些需要很多JavaScript代码的页面来说,这无疑会导致浏览器在呈现页面时出现明显的延迟,而延迟期间的浏览器窗口将是一片空白。现代做法:将所有JavaScript引用放在元素页面内容的后面 Example HTML Page ... 阅读全文
posted @ 2013-06-26 23:38 *tingliang* 阅读(81) 评论(0) 推荐(0) 编辑
摘要: --[[ for window path this function return 1. file path 2. file name with extension 3. file name no extension 4. file extension--]] local function getFilePathAndName( file ) local fn_flag = string.find(file, "\\") if fn_flag then local filepath = string.match(file, "(.+... 阅读全文
posted @ 2013-06-14 11:49 *tingliang* 阅读(813) 评论(0) 推荐(0) 编辑
摘要: temp.luainfo = { textures="testui0.plist", designHeight=510, designWidth=450, widgetTree={ classname="Panel", }}加载temp.lua> = tnil> t = assert(loadfile("temp.lua"))> = tfunction: 0x8006b530> = infonil> t() -- 关键就在这里> = infotable: 0x8005ab48> = ... 阅读全文
posted @ 2013-06-13 15:07 *tingliang* 阅读(407) 评论(0) 推荐(0) 编辑
摘要: 1. 将table视为数组的操作函数* table.insert (list, [pos,] value)table.insert用于将一个元素插入到一个数组的指定位置,它会移动pos后续元素。如果不指定位置参数pos,新元素会插入到数组末尾。t = {100, 200, 300}for k, v in pairs(t) do print(k, v)endprint("------------------------")table.insert(t, 1, "a")table.insert(t, 1, "b")table.insert 阅读全文
posted @ 2013-06-10 00:28 *tingliang* 阅读(305) 评论(0) 推荐(0) 编辑
摘要: 1. 伪随机数生成函数* math.random1) math.random() 返回一个在区间[0, 1)内均匀分布的伪随机实数。> = math.random()0.39438292681909> = math.random()0.783099223758612)math.random(n) n为实数,返回一个在区间[1, n]内的伪随机整数。> = math.random(6)5> = math.random(6)6> = math.random(6)2> = math.random(6.28)2> = math.random(6.28)4> 阅读全文
posted @ 2013-06-09 22:28 *tingliang* 阅读(935) 评论(0) 推荐(0) 编辑
摘要: 1. 函数声明的顺序* 函数a和b均为local function,b调用a函数,这种情况a要在b之前定义,否则会报错local function a() print("in a function")endlocal function b() a()endb()输出in a function[Finished in 0.0s]b在a之前定义就会报错local function b() a()endlocal function a() print("in a function")endb()输出lua: E:\testLua\localfun.lua:13 阅读全文
posted @ 2013-06-07 15:19 *tingliang* 阅读(207) 评论(0) 推荐(0) 编辑
摘要: 1. lua与C++的接口定义在$cocos2dx-dir/scripting/lua/cocos2dx_support/LuaCocos2d.cpp2. 将lua脚本的调试信息输出到终端默认情况下,在lua中使用print函数输出的信息不会显示在调试终端里,解决方法是使用CCLuaLog函数CCLuaLog("debug message")或者更简单点local log = CCLuaLoglog("debug message") 阅读全文
posted @ 2013-06-07 14:54 *tingliang* 阅读(324) 评论(0) 推荐(1) 编辑
摘要: 1. 将指定用户加入sudo组$ su# visudo在以下内容下多添加一行root ALL=(ALL) ALLusername ALL=(ALL) ALLusername为要添加到sudo组的用户2. debian 6 安装ati显卡驱动a.安装ati driver所需的依赖sudo apt-get install module-assistant build-essentialsudo apt-get install fakeroot dh-make debconf libstdc++5 linux-headers-$(uname -r)b. 运行ati driver# ./amd-... 阅读全文
posted @ 2013-05-12 12:15 *tingliang* 阅读(177) 评论(0) 推荐(0) 编辑
摘要: 1. add to /etc/apt/sources.listdeb http://ftp.uk.debian.org/debian/ squeeze main contrib non-freedeb-src http://ftp.uk.debian.org/debian/ squeeze main contrib non-freedeb http://security.debian.org/ squeeze/updates maindeb-src http://security.debian.org/ squeeze/updates main2. updatesudo apt-get upd 阅读全文
posted @ 2013-05-09 00:41 *tingliang* 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 1.编译依赖sudo aptitude build-dep emacs232.编译emacs24.2wget http://mirror.bjtu.edu.cn/gnu/emacs/emacs-24.2.tar.gztar zxf emacs-24.2.tar.gzcd emacs-24.2/./configuremakesudo make install 阅读全文
posted @ 2013-04-20 11:25 *tingliang* 阅读(132) 评论(0) 推荐(0) 编辑