1 object.methods() # 列出对象的类的实例方法。即该实例的可用方法列表。puts
[].methods.grep /^re/ #列出Array以re开头的实例方法列表2 object.instance_variables()
#列出对象(Module或Class)的实例变量cl.....
分类:
其他好文 时间:
2014-05-09 04:05:02
阅读次数:
278
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
测试程序:
#include
#include
struct dev
{
int a;
char b;
float c;
};
struct dev devs[]=
{
{
1,'a',7.0,
},
{
1,'a',7.0,
},
{
...
分类:
系统相关 时间:
2014-05-09 02:10:16
阅读次数:
494
问题一:value = [array objectAtIndex:n];
//得到一个数组中的对象[arry removeObjectAtIndex:n];
//卸载那个对象因为value得到了那个对象,但是由于另外一个拥有者release了该对象,所以其实value现在成了摇摆指针(无效数据)问题...
分类:
其他好文 时间:
2014-05-09 00:02:03
阅读次数:
366
1 @interface NSString (reverse)2 3 -(NSString *)
reverseString;4 5 @end 1 @implementation NSString (reverse) 2 3 -(NSString *)
reverseString { 4 ...
分类:
其他好文 时间:
2014-05-08 23:54:31
阅读次数:
438
isset:变量是否设置,或者是否未null$var="11";isset($var);返回1isset($empty);返回0数组$arr=array();isset($arr);返回1empty:""、0、"0"、NULL、FALSE、array()、var
$var;以及没有任何属性的对象都将...
分类:
其他好文 时间:
2014-05-08 23:43:03
阅读次数:
350
MySQL源码中自己定义了许多数据结构,放在mysys的目录下,源码中通常都使用这些数据结构来组织存放数据,也更容易实现跨平台。下面先来看下MySQL定义的动态数组:【源代码include/array.h
mysys/array.c】typedef struct st_dynamic_array{ ...
分类:
数据库 时间:
2014-05-08 18:10:32
阅读次数:
392
Single Number
Total Accepted: 19800 Total
Submissions: 44027My Submissions
Given an array of integers, every element appears twice except for one. Find that single one.
Note:
Your algor...
分类:
其他好文 时间:
2014-05-08 11:01:40
阅读次数:
298
Given a sorted array and a target value, return
the index if the target is found. If not, return the index where it would be if
it were inserted in or...
分类:
其他好文 时间:
2014-05-08 07:29:02
阅读次数:
285
Given an array of integers, find two numbers
such that they add up to a specific target number.The function twoSum should
return indices of the two nu...
分类:
其他好文 时间:
2014-05-08 06:33:29
阅读次数:
339
1、yii框架中验证的类文件:上面红线内是验证的具体的类文件,下面的这个文件制定了类的别名。2、验证邮箱的时候默认不能为空,除了可以在模型里面设置为required外,还可以在模型的rule里面,在对应的email类里面可以看到这个allowEmpty参数。array(‘kemail‘,‘email‘,‘allowEm..
分类:
其他好文 时间:
2014-05-08 02:37:35
阅读次数:
1080