摘要: 1. CentOS setup The following command install all the required tools and libraries to build and install the Apache Thrift compiler on a CentOS5/RHEL5 Linux based system. These packages are available ... 阅读全文
posted @ 2013-05-21 14:38 agefisher 阅读(780) 评论(0) 推荐(0) 编辑
摘要: 3. 测试代码的重用 测试开始前需要模拟比较多的数据,测试完成后又需要清除这些模拟数据,测试service时需要,测试controller时也需要,所以一般都会把模拟测试数据的工具类放在service层的测试代码中,同时测试controller时引用之。maven配置中需要添加plugin编译并生成测试代码,同时在controller中添加对service包测试代码的引用。 service包中... 阅读全文
posted @ 2013-04-26 20:08 agefisher 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 2. 测试controller 测试controller和service的测试类似,不同的是可能controller的action中会同时调用service的多个方法,多个方法之间可能有依赖关系,所以不建议使用事务管理器回滚事务,而是通过编写数据清理的代码来清理测试过程中产生的数据。测试controller时,还需要借用spring的mockMvc来模拟收到的浏览器请求。 一般会把测试中公共的... 阅读全文
posted @ 2013-04-26 19:58 agefisher 阅读(300) 评论(0) 推荐(0) 编辑
摘要: 1. 添加maven的依赖 <dependency> <groupId>net.sourceforge.jtds</groupId> <artifactId>jtds</artifactId> <version>1.2.4</version> </dependency> ... 阅读全文
posted @ 2013-04-25 20:30 agefisher 阅读(5421) 评论(0) 推荐(0) 编辑
摘要: 1. 测试service service 层业务逻辑较多,而且一般会和db发生关系。在测试代码中需要让测试用例成功跑完一遍后,不在db里留下测试数据,以免数据的问题引起测试失败或者没有测试到模拟的情况。 以下代码片段中通过@TransactionConfiguration注解将测试过程中的db操作在测试完成后默认作了一个回滚操作。 @RunWith(SpringJUnit4ClassRunn... 阅读全文
posted @ 2013-04-25 20:09 agefisher 阅读(340) 评论(0) 推荐(0) 编辑
摘要: Use Accessor Methods to Make Memory Management Easier: 一般使用accessor method 来大幅度减少内存管理出现的问题,相比直接使用retain和release来说。 @interface Counter: NSObject{ NSNumber *_count; } @property (nonatomic, reta... 阅读全文
posted @ 2012-06-15 14:06 agefisher 阅读(127) 评论(0) 推荐(0) 编辑
摘要: About Memory Management: MRR: “manual retain-release” ARC: Automatic Reference Counting, 和mrr一样,只是编译器在编译的时候加入相应的retain, release, 推荐使用ARC Garbage Collection: 只在 Mac OS X 支持,iOS不支持 Mem... 阅读全文
posted @ 2012-06-08 09:58 agefisher 阅读(620) 评论(0) 推荐(0) 编辑
摘要: Invokint a Block: 若定义了一个block变量,就可以像调用函数那样调用. Using a Block as a Function Argument: 可以把一个block 向其他参数一样传给函数;但是,不要单独定义变量,只需要简单的以内联方式来实现就行,而且block只能是最后一个参数。 Using a Block as a Method Argument:... 阅读全文
posted @ 2012-06-06 11:00 agefisher 阅读(217) 评论(0) 推荐(0) 编辑
摘要: 使用函数,根据property的name,通过metadata来读取一个class, category or protocol 的property类型(@encode String 表示),copying 得到一个array of C Strings 的列表。 example: @interface Lender: NSObject{ floar alone; } @prope... 阅读全文
posted @ 2012-06-05 20:00 agefisher 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 如下,定义一个block: 使用之: printf(“%d”, myBlock(3));//prints “21” 也可以直接在使用block: char *myCharacters[3] = {“TomJohn”, “George”, “Charles Condomine”}; qsort_b(myCharacters, 3, sizeof(char *), ^(c... 阅读全文
posted @ 2012-06-05 19:59 agefisher 阅读(312) 评论(0) 推荐(0) 编辑