02 2013 档案

 
Objective-C protocol 和 delegate
摘要:概述protocol类似C++中的抽象类和Java中的interface。分为Formal protocol和informal protocol两种,其中在Objective C 2.0之前,informal protocol是Cocoa中实现delegate的重要基础。因为Objective C 2.0引入了@optional和@required关键字。delegate是一种常用的设计模式,而不是Objective C或者Cocoa的feature,也没有任何关键字是给delegate用的。protocolFormal protocol 声明了一个客户类需要实现的方法列表,它有自己独立的de 阅读全文
posted @ 2013-02-28 18:03 做个不善的人 阅读(4901) 评论(0) 推荐(0) 编辑
Objective-C 中的 self 和 super
摘要:在 Objective-C 中的类实现中经常看到这两个关键字 ”self” 和 ”super”,以以前 oop 语言的经验,拿 c++ 为例,self 相当于 this,super 相当于调用父类的方法,这么看起来是很容易理解的。以下面的代码为例:@interface Person:NSObject { NSString* name;}- (void) setName:(NSString*) yourName;@end@interface PersonMe:Person { NSUInteger age;}- (void) setAge:(NSUInteger) age;- (v... 阅读全文
posted @ 2013-02-27 16:15 做个不善的人 阅读(214) 评论(0) 推荐(0) 编辑
Objective-C 拾遗
摘要:关于Method这里引入method specification的概念(我自己弄的,因为不了解官方的名称是什么,如果有人知道,请告诉我)。在C中,一个函数的方法名(区分大小写),也就是说,如果两个函数的方法名相同,即使参数个数或者参数类型不同,那么也认为这两个方法是一样的,从而产生错误(在C语言中是编译时错误),比如下面的代码:void foo() //valid{}int foo() //Error 1 error C2371: 'foo' : redefinition; different basic types{}void Foo() //valid{}void foo( 阅读全文
posted @ 2013-02-27 16:01 做个不善的人 阅读(1739) 评论(0) 推荐(0) 编辑
Objective-C 与 C++ 的异同
摘要:转自:http://www.cppblog.com/kesalin/archive/2010/12/26/compare_objective_c_and_c_plus_plus.html 阅读全文
posted @ 2013-02-27 14:13 做个不善的人 阅读(193) 评论(0) 推荐(0) 编辑
Objective-C 的Compiler Directives
摘要:Objective-C 中使用@来表示其对C语言的扩展,由编译器提供支持,也叫做compiler directives,比如@interface, @implementation等,下面一一介绍:@interface相当于类的声明,像是C++中.h文件中包含的类声明信息。跟Java中的interface是不一样的。interface file就是.h文件。在声明一个新类时,可以注意一下信息:使用@public @protected @private来控制变量或者方法是否对外可见;使用 ‘+’ 修饰的方法是 method for class(类似于C++ 的static method),只能使用 阅读全文
posted @ 2013-02-27 12:58 做个不善的人 阅读(519) 评论(0) 推荐(0) 编辑
Objective-C的Runtime System (转载)
摘要:[0] Outline -- [1] 版本和平台 -- [2] 与Runtime System交互 -- [3] 方法的动态决议 -- [4] 消息转发 -- [5] 类型编码 -- [6] 属性声明 [1] 版本和平台Runtime System对于Objective-C来说就好比是它的操作系统,或者说是运行的支撑平台,它使得Objective-C代码能够按照既定的语言特性跑起来。相对于C/C+... 阅读全文
posted @ 2013-02-26 16:44 做个不善的人 阅读(389) 评论(0) 推荐(0) 编辑
Objective-C Runtime的数据类型
摘要:ClassObjective-C是支持反射的,先来了解一下其如何表达一个类。在Objective-C的Runtime中有个类型是Class(只在Runtime环境中使用),用来表示Objective-C中的类,其定义为:typedef struct objc_class *Class;可以看出,其实Class类型是一个指针,指向struct objc_class,而struct objc_class才是保存真正数据的地方,再看struct objc_class的声明(from http://www.opensource.apple.com/source/objc4/objc4-493.9/ru 阅读全文
posted @ 2013-02-26 14:50 做个不善的人 阅读(4446) 评论(0) 推荐(0) 编辑
Xcode基础
摘要:刚开始用Xcode还是没那么顺溜的,功能是一方面的,还有就是那几个界面,不小心关了就怎么也找不回去了,下面先介绍一下这些知识吧(本文使用XCode 4.3.3)。 Xcode中有几个Navigator:Project Navigator(Coding时最常用的), Symbol Navigator, Search Navigator, Issue Navigator, Debug Navigato... 阅读全文
posted @ 2013-02-25 17:08 做个不善的人 阅读(2221) 评论(0) 推荐(0) 编辑
进入Mac OSX的第一步
摘要:先来理解一些概念 a microkernel (also known as μ-kernel) is the near-minimum amount of software that can provide the mechanisms needed to implement an operating system (OS)。在20世纪80年代,传统的mono-kernels遇到了很多挑战(不断的... 阅读全文
posted @ 2013-02-25 13:30 做个不善的人 阅读(469) 评论(0) 推荐(0) 编辑
comScore是如何工作的
摘要:经常看科技新闻提到comScore发布了搜索引擎的排名数据,比如Google占多少份额,Bing占多少,甚至于在这一个月里有多少用户使用Google做了搜索,待了多少时间,等等很多很细节的数据都能知道,comScore使用了什么先进的技术以至于能做到这一步呢?先来了解一下comScore这个公司:c... 阅读全文
posted @ 2013-02-18 16:35 做个不善的人 阅读(1606) 评论(0) 推荐(0) 编辑
Android开发ABC之:Context
摘要:SDK Doc中对Context的定义如下: Interface to global information about an application environment. This is an abstract class whose implementation is provided by the Android system. It allows access to applicati... 阅读全文
posted @ 2013-02-06 13:52 做个不善的人 阅读(373) 评论(0) 推荐(0) 编辑
Android开发ABC之:Service
摘要:下面是SDK doc对Service的描述: A Service is an application component representing either an application's desire to perform a longer-running operation while not interacting with the user or to supply function... 阅读全文
posted @ 2013-02-06 13:39 做个不善的人 阅读(2732) 评论(0) 推荐(0) 编辑
自信的行为特征
摘要:敢于表达消极情感。例如,敢于拒绝他人过分的请求,争取自己的权利。表达自己的愤怒,要求搅扰自己的人改变他们的行为。再比如,你在说某个事情的时候被别人打断,你就应该要求他听你把话说完。 自信的人不会过于关注自己的内心。今天没睡好,昨天磕到了,小时候被别人欺负,etc.当你想到这些事情时,渴望别人同情的人是不自信的人,而自信的人根本就不会把那些事情放在心上,也不会跟别人说,即便说,也是作为趣事来讲。 ... 阅读全文
posted @ 2013-02-05 17:17 做个不善的人 阅读(1744) 评论(0) 推荐(0) 编辑
OLE Automation
摘要:OLE Automation (later renamed by Microsoft to just Automation), is an inter-process communication mechanism based on Component Object Model (COM) that was intended for use by scripting languages – ori... 阅读全文
posted @ 2013-02-05 17:17 做个不善的人 阅读(2747) 评论(0) 推荐(0) 编辑
tips of learning
摘要:some error cases will cover similar code path in playback, we can group them to make sure, we will cover this area of playback. sanity test should have a list related with specific feature change; sa... 阅读全文
posted @ 2013-02-05 17:12 做个不善的人 阅读(185) 评论(0) 推荐(0) 编辑
owner of a job
摘要:When you become the owner of some job, you should be responsible for all things related to the jobs. including the technique questions, question on your method to do the job, your expected and actual ... 阅读全文
posted @ 2013-02-05 17:10 做个不善的人 阅读(170) 评论(0) 推荐(0) 编辑
Prioritize your work by your title
摘要:这也就是分出大石头和小石头的过程。 一个大学哲学教授给他的学生做了一个实验,他拿了一个很大的玻璃碗,首先在碗里面放了些大石头,不一会碗里面就被大石头塞满了,当再也放不下一块大石块的时候,他和在场的学生们下了一个结论:碗被装满了,再也装不下大石块了。接着教授拿出一些鹅卵石,他把一些鹅卵石和细小的石头放进碗里,正好填进了大石头的空隙里,尽管碗里已经被大石头占满了,但是还是有很多空隙可以放小石头,不一会... 阅读全文
posted @ 2013-02-05 17:09 做个不善的人 阅读(244) 评论(0) 推荐(0) 编辑
理解ABI
摘要:An application binary interface (ABI) describes the low-level interface between a computer program and the operating system or another program. An embedded-application binary interface (EABI) specifie... 阅读全文
posted @ 2013-02-05 17:05 做个不善的人 阅读(1349) 评论(0) 推荐(0) 编辑
需要必知必会,倒背如流的经典算法和实现
摘要:二叉树的遍历算法(递归和迭代)#include <iostream>#include <stack>using namespace std;template <typename T>class BinaryTree{public: BinaryTree(){} class TreeNode { public: TreeNode(){ visited = false;} TreeNode* left; TreeNode* right; ... 阅读全文
posted @ 2013-02-05 15:55 做个不善的人 阅读(387) 评论(0) 推荐(0) 编辑
Windows 8 常用快捷键
摘要:Windows key + X:Power User Tasks Menu Windows Key + Q: Search Apps Windows Key + F: Search Files Windows Key + W: Search Settings 阅读全文
posted @ 2013-02-05 11:52 做个不善的人 阅读(136) 评论(0) 推荐(0) 编辑
消失的字符(关于New CRT)
摘要:看看下面的代码有什么问题?int main( void ){ size_t MAX = 256; wchar_t * src = new wchar_t[MAX]; src[0] = L'H'; src[1] = L'i'; char *dest = new char[MAX]; size_t len = 0; wcstombs_s(&len,dest,MAX,src,MAX);}如果我们使用strlen(dest),得到的结果会是0,但是如果我们访问dst[1],其结果是i,是我们期望的,而且如果src的有效字符更多一些,除了第一个字符不在外,其他的都 阅读全文
posted @ 2013-02-01 18:42 做个不善的人 阅读(867) 评论(0) 推荐(0) 编辑

 

点击右上角即可分享
微信分享提示