1. 交换两个数值
x, y = y, x; //等价于 x = y, y =x;
2. 变量初始化问题
a, b, c = 0;
print(a,b,c); --> 0 nil nil
仅对第一个值复制,所以要初始化一组变量,应该提供多个初始值
a, b, c = 0, 0, 0;
print(a, b, c); --> 0 0 0
3. "尽可能...
分类:
其他好文 时间:
2014-05-10 10:17:39
阅读次数:
272
最近在学习javascript的原型,发现了__proto__与prototype,学问很大,于是研究了一下。
首先解释一下什么是原型?
原型是一个对象,其他对象可以通过它实现属性继承。
对象又是什么呢?
在javascript中,一个对象就是任何无序键值对的集合,如果它不是一个主数据类型(undefined,null,boolean,number,string),那它就是一个对象。...
分类:
其他好文 时间:
2014-05-10 10:13:54
阅读次数:
361
简介
使用FFmpeg SDK实现的H.264码流合成MPEG2-TS文件
一、源代码
int main(int argc, char* argv[])
{
const char* input = NULL;
const char* o...
分类:
其他好文 时间:
2014-05-10 10:04:42
阅读次数:
501
1. 函数可以返回多个值 return a, b, c; 但是如果函数不是作为表达式的最后一个元素的话,仅返回第一个
如:
function f2() return "a", "b" end;
x, y = f2() -> x = "a", y = "b";
x, y = f2(), 1 -> x = "a", y = nil;
2. 可以将一个函数调用放入一对圆括...
分类:
其他好文 时间:
2014-05-10 09:21:56
阅读次数:
317
public static void main(String[] args) {
String a=null;
if("aa".equals(a))//这种情形,不出现空指针异常
//if(a.equals("aa"))//出现空指针异常
{
System.out.println(true);
}
else {
System.out.println(false);
}
}
...
分类:
其他好文 时间:
2014-05-10 09:20:33
阅读次数:
257
当我在SQLPLUS执行 :
INSERT INTO customers (
customer_id, first_name, last_name, dob, phone
) VALUES (
5, 'Doreen', 'Blue', '20-MAY-1970', NULL
);
出现 “ORA-01843: 无效的月份 ”这个错误。 Google之后找到下面的这篇文章...
分类:
其他好文 时间:
2014-05-10 09:19:59
阅读次数:
348
Codeforces Round #244 (Div. 2)D (后缀自动机)
(标号为0的节点一定是null节点,无论如何都不能拿来用,切记切记,以后不能再错了)
这题用后缀自动机的话,对后缀自动机的很多性质有足够深刻的理解。没想过后缀数组怎么做,因为不高兴敲。。。。
题意:给出两个长度均不超过5000的字符串s1,s2,求这两个串中,都只出现一次的最短公共子串。
解题思路:求的是公共子...
分类:
其他好文 时间:
2014-05-10 09:17:40
阅读次数:
313
public class LinkedList {
Node head = null;
Node tail = null;
int length = 0;
public void add(Object object) {
Node node = new Node(object, null);
if (head == null) {
head = tail = nod...
分类:
其他好文 时间:
2014-05-07 08:24:17
阅读次数:
306
1:select * 表名 where 查询条件 (有以下属性:is not null , is
null , and 等)// 查询表中数据2:可通过主键和外键将两张表连接在一起 :
分类:
数据库 时间:
2014-05-06 11:59:30
阅读次数:
311
private ImageInfo CreateImageFile(string fileName)
{ if (!File.Exists(fileName)) return null; Image image =
Image.FromFile(fileName); MemoryStream ms....
分类:
Web程序 时间:
2014-05-06 10:01:43
阅读次数:
313