表
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
二、栈与队列 1、栈的定义 栈(Stack)是限制仅在表的一端进行插入和删除运算的线性表。
(1)通常称插入、删除的这一端为栈顶(Top),另一端称为栈底(Bottom)。 (2)当表中没有元素时称为空栈。 (3)栈为后进先出(Last In
First Out)的线性表,简称为LI...
分类:
编程语言 时间:
2014-05-06 09:00:26
阅读次数:
414
命名的返回值优化:
针对返回一个局部的变量的优化,可以直接用返回的结果对象直接替代局部变量,从而减少了一个复制拷贝,从而提高效率。比如 一个函数如下:X bar(){ X xx;
// .. 处理xx return xx;}而在编译器看来则是如下的代码: // 此处的_resu...
分类:
其他好文 时间:
2014-05-06 00:01:10
阅读次数:
442
只是看看能不能成功使用python操作redis,redis具体的数据结构和使用会在以后学习。安装连接redis的包pipinstallredis本地已经在6379端口启动了redis服务。In[1]:importredis
In[2]:r=redis.StrictRedis(host=‘localhost‘,port=6379,db=0)
In[3]:r.set(‘foo‘,‘bar‘)
Out[3]:Tru..
分类:
编程语言 时间:
2014-05-03 14:38:32
阅读次数:
405
Shaass has decided to hunt some birds. There are n horizontal electricity wires aligned parallel to each other. Wires are numbered 1 to n from
top to bottom. On each wire there are some oskols sitti...
分类:
其他好文 时间:
2014-05-02 20:48:26
阅读次数:
462
这道题,采用动态规划算法。from top to
down,把到每个节点的最小路径和都求出来。下面是AC代码: 1 /** 2 * Given a triangle, find the minimum path
sum from top to bottom. 3 * Each ...
分类:
其他好文 时间:
2014-05-02 12:19:23
阅读次数:
382
在JavaScript可以使用try...catch来进行异常处理。例如: try {
foo.bar(); } catch (e) { alert(e.name + " : " + e.message); }
目前我们可能得到的系统异常主要包含以下6种: EvalError: raised whe...
分类:
编程语言 时间:
2014-05-01 19:01:02
阅读次数:
325
方案一:利用UINavigationBar 自带的布局item(Fixed space Bar Button Item)来适配ios7. 其实就是在原来返回按钮的位置上在多加一个占位的Item
为UINavigationBar 写一个分类。UINavigationItem+correct_offset.h
#import
@interface UINavigationIte...
分类:
移动开发 时间:
2014-05-01 17:29:39
阅读次数:
525
相关Matlab函数:hist, bar, cdfplot, ksdensity
(1) hist函数
n = hist(Y, x)
如果x是一个向量,返回x的长度个以x为中心的,Y的分布情况。
例如:如果x是一个5元素的向量,返回Y在以x为中心的,x长度个范围内数据直方分布。
[n,xout] = hist(...)
返回n和xout,包含有数目频率和间隔位置。可以使用bar(x...
分类:
其他好文 时间:
2014-04-30 22:11:38
阅读次数:
293
好久不写CSS代码 感觉忘的差不多了,代码就是要多敲才行的。就行武林中的武者一样,每天都要勤加练习才可。
正好写写博客,就当复习复习。
position 主要是用来 元素的定位方式
static : 无特殊定位,对象遵循HTML定位规则
absolute : 将对象从文档流中拖出,使用left,right,top,bottom等属性进行绝对定位。而其层叠通过z-index属性定义。此...
分类:
Web程序 时间:
2014-04-29 13:45:20
阅读次数:
354