表
a = { }
b = { x = 1, ["hello, "] = "world!" }
a.astring = "ni, hao!"
a[1] = 100
a["a table"] = b
function foo()
end
function bar()
end
a[foo] = bar
--分别穷举表a和b
for k, v in pairs(a) do
print(k, "=>",...
分类:
其他好文 时间:
2014-07-22 23:00:33
阅读次数:
261
函数闭包
function createCountdownTimer(second)
local ms=second * 1000;
local function countDown()
ms = ms - 1;
return ms;
end
return countDown;
end
timer1 = createCountdownTimer(1);
for...
分类:
其他好文 时间:
2014-07-22 22:59:53
阅读次数:
307
类--友元、static成员一、友元 友元机制允许一个类将对其非公有成员的访问权授予指定的函数或类(对未被授权的函数或类,则阻止其访问);友元的声明以关键字friend开始,但是它只能出现在类定义的内部。友元声明可以出现在类中的任何地方:友元不是授予友元关系的那个类的成员,所以它们不受其声明出现部分的访问控制影响。【最佳实践】 通常,将友元声明成组的放在类定义的开始或结尾是个好主意!1...
分类:
编程语言 时间:
2014-05-03 00:33:38
阅读次数:
372
下面是一个小程序,可以很好阐述 关键字:continue,break;
package org.song.loop;
public class TestLoop {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int tot...
分类:
其他好文 时间:
2014-05-03 00:03:21
阅读次数:
311
/*** 给元素增加遮罩层* @param maskLayer 遮罩层* @param maskObj
被遮罩元素*/function doMask(maskLayer,maskObj){
maskLayer.css("filter","alpha(opacity=60)"); maskLayer....
分类:
其他好文 时间:
2014-05-02 21:44:40
阅读次数:
434
//字符串全排列package com.demo.acm;public class
AllSortChar { public static void allSort(char[] buf,int start,int end){
if(start==end){ ...
分类:
其他好文 时间:
2014-05-02 19:43:21
阅读次数:
256
package ioTest.io1;
import java.io.FileReader;
import java.io.FileWriter;
/*将d盘的文件复制到e盘
* Copy的原理:
* 读取d盘的文件内容,然后写入到e盘的同名文件中。(同名文件需要创建)
*
*/
public class CopyText {
public static void main(St...
分类:
编程语言 时间:
2014-05-02 19:34:41
阅读次数:
432
1. 自定义验证--成功提示
1) 添加选项
errorClass: "unchecked",
validClass: "checked",
errorElement: "span",
errorPlacement: function (error, element) {
if (element.parent().find("span[for=""" + element.attr("id...
分类:
Web程序 时间:
2014-05-02 18:38:21
阅读次数:
467
接着上次LU分解的讲解,这次给出使用不同的计算LU分解的方法,这种方法称为基于GaxPy的计算方法。这里需要了解lapapck中的一些函数。lapack中有一个函数名为gaxpy,所对应的矩阵计算公式是:x
= Gx + y; 对应的Matlab代码如下:function[L, U] =zgaxpy...
分类:
其他好文 时间:
2014-05-02 13:09:10
阅读次数:
414
重操旧业,再温Java,写了个大整数相乘先回顾回顾基本知识。算法、效率什么的都没怎么考虑,就纯粹实现功能而已。先上代码: 1 package
com.tacyeh.common; 2 3 public class MyMath { 4 5 public static String Big...
分类:
编程语言 时间:
2014-05-02 13:02:39
阅读次数:
396