去除警告:warning:No previous prototype for function

inline void hexString(unsigned char *from, char *to, NSUInteger length) { for (NSUInteger i = 0; i < length; ++i) { unsigned char c = from[i]; unsigned char cHigh = c >> 4; unsigned char cLow = c & 0xf; to[2 * i] = hexChar(cHigh); to[2 * i + 1] = hexChar(cLow); } to[2 * length] [...]

动态获取一个类的所有方法

- (NSMutableSet *)methodsTokensForClass:(id)_id { Class klass = [_id class]; NSMutableSet *ms = [NSMutableSet set]; unsigned int methodListCount; Method *methodList = class_copyMethodList(klass, &methodListCount); NSUInteger i; for (i = 0; i < methodListCount; i++) { Method currMethod = (methodList[i]); NSString *mName = [NSString stringWithCString:(const char *)method_getName(currMethod) encoding:NSASCIIStringEncoding]; NSArray *mNameParts = [mName componentsSeparatedByString:@":"]; for(NSString *mNamePart in mNameParts) { [...]

用perl进行base64转码,非常好用的代码

前一个帖子提到使用base64转码图片直接在浏览器里展示,文中也提供了一段使用php进行转码的代码很简练,但本人没有试用过(总是对php环境配置存在压力感)。我喜欢用perl代码段完成这类小事,下面分享两段好用的base64的encoding、decoding的代码。

HTML 5与CSS 3权威指南[download]

浏览了一下感觉很不错,最近很多朋友都在学Html5,分享一下

Xcode中iOS单元测试

Xcode中iOS单元测试

Xcode中集成了单元测试框架OCUnit,可以完成不同侧重点的测试。Xcode下的单元测试分为logic uint tests和application unit tests。 logic uint tests在编译阶段进行,并且只能在模拟器中进行,并且需要配置一个单独的schemes来运行。主要是针对数据层的各个模块进行测试,如果数据层的模块划分比较理想解耦相对彻底,则可以通过逻辑单元测试对各模块给出各种输入,然后对各数据模块的输出进行判断,来判断各数据模块是否正常。 application unit tests在程序运行阶段进行,可以在模拟器和真机上进行,可以在应用的schemes或者单独配置的schemes里面运行。主要是针对应用中的相对比较重要的类以及部分简单的界面操作进行测试,完成逻辑单元测试以外的检测。