Tekkaman

导航

 
上一页 1 ··· 30 31 32 33 34 35 36 37 38 ··· 42 下一页

2013年5月17日

摘要: 【x86_64 Assembler Calling Convention】 1、x86_64 registers (r8-r15follow the same convention.) Theripregister is the instruction pointer register which points to the instruction being executed. 2、x86_64寄存器特性表 3、特性要点: 1)常用寄存器有16个,分为x86通用寄存器以及r8-r15寄存器。 2)通用寄存器中,函数执行前后必须保持原始的寄存器有3个:是rbx、rbp、rsp。r... 阅读全文
posted @ 2013-05-17 14:02 Tekkaman 阅读(595) 评论(0) 推荐(0)
 

2013年5月16日

摘要: 【Assembly之Operation Code】 The operation code field of an assembly language statement identifies the statement as a machine instruction, an assembler d... 阅读全文
posted @ 2013-05-16 23:07 Tekkaman 阅读(469) 评论(0) 推荐(0)
 
摘要: 【Assembly Language Statements】 1、general format of an assembly language statement: 2、A line may contain multiple statements separated by asemicolon ... 阅读全文
posted @ 2013-05-16 22:50 Tekkaman 阅读(191) 评论(0) 推荐(0)
 

2013年5月10日

摘要: 【Global Assert】 通常Assert函数被用于函数内部,这些assert会在运行时起检察状态作用。但是如何把Assert运用在编译期呢?objc4项目提供了一种方法。 即通过设置数组长度为-1的方法来达到编译期Assert作用。 阅读全文
posted @ 2013-05-10 10:11 Tekkaman 阅读(277) 评论(0) 推荐(0)
 

2013年5月8日

摘要: 【dlopen之mode参数详解】 1、mode参数可以设置2方面内容,导出符号范围与绑定时间。 2、导出符号范围,为以下2值。基本上来说,App每次加载dylib,都应该以RTLD_LOCAL来打开dylib。 3、绑定行为,为以下2值。基本上说来,App都应该以RTLD_LAZY来绑定,RTLD_NOW以在调度时有价值。 阅读全文
posted @ 2013-05-08 11:12 Tekkaman 阅读(981) 评论(0) 推荐(0)
 
摘要: 【dylib如何导出C++Class】 1、C++类成员函数必须为virtual。因为virtual函数在编译期会转换成偏移,偏移是可以跨平台的。而非virtual函数,则会直接通过符号去寻找,各个平台编译器对C++函数名符号的改写规则并不一致,可能导致找不到符号的情况。 2、必须提供工厂函数。因为 阅读全文
posted @ 2013-05-08 10:04 Tekkaman 阅读(1592) 评论(0) 推荐(0)
 

2013年5月7日

摘要: 【objc之method&class attributes】 Objective-C now supports some gcc attributes for Objective-C methods. Syntactically, attributes for a method follow the method's declaration, and attributes for a method parameter sit between the parameter type and the parameter name. Supported attributes inclu 阅读全文
posted @ 2013-05-07 19:41 Tekkaman 阅读(295) 评论(0) 推荐(0)
 
摘要: 【mac之 dylib类型】 1、dependent library Adependent library, from the client’s point of view, is a dynamic library the client is linked with. Dependent libraries are loaded into the same process the client is being loaded into as part of its load process. For example, when an app is launched, its depende. 阅读全文
posted @ 2013-05-07 19:15 Tekkaman 阅读(2598) 评论(0) 推荐(0)
 

2013年5月3日

摘要: 【linux之setsid】 1、函数原型 2、说明:当进程是会话组长时setsid()调用失败。setsid()调用成功后,进程成为新的会话组长和新的进程组长,并与原来的登录会话和进程组脱离。由于会话过程对控制终端的独占性,进程同时与控制终端脱离。 3、使用: 如果parent和child运行在同一个session里,而且parent是session头。所以作为session头的parent如果exit结束执行的话,那么会话session组中的所有进程将都被杀死。执行setsid()之后,parent将重新获得一个新的会话session组id,child将仍持有原有的会话sessio... 阅读全文
posted @ 2013-05-03 11:40 Tekkaman 阅读(10903) 评论(0) 推荐(1)
 

2013年5月2日

摘要: 【C内联汇编】 主要为了搞明白__asm__()中的:号是个啥意思,链接文档中写的很详细。 参考:http://learn.akae.cn/media/ch19s05.html 阅读全文
posted @ 2013-05-02 08:15 Tekkaman 阅读(278) 评论(0) 推荐(0)
 

2013年5月1日

摘要: 【objc runtime之association】 1、objc runtime association函数有3个,功能是给某个instance添加额外的key-value。 2、在objc runtime的实现中,采用monostate模式实现了一具全局association表,用于记录每一个对象所对应的key-value表。 3、AssociationManager中存留着disguise(obj_ptr) -> AssociationHashMap,此map记录着此obj_ptr所有的key->value。参考: 4、在3中可以看到,给某Class的instance添加as 阅读全文
posted @ 2013-05-01 14:41 Tekkaman 阅读(233) 评论(0) 推荐(0)
 

2013年4月30日

摘要: 【objc新老runtime接口类型对比】 1、objc_class->class_t. objc_class,此类型仍有,在OBJC2中,此类型的保留只是为了与OBJC1兼容。 上图看到,在OBJC2中,objc_class只有一个成员变量,isa。此变量存在的意义只是为了与OBJC1兼容。 class接口类型在OBJC2中变成了class_t,在runtime处理时,将objc_class*(即Class)强转成class_t*。 2、objc_method -> method_t。 && objc_method_list -> method_lsit_t 阅读全文
posted @ 2013-04-30 01:43 Tekkaman 阅读(477) 评论(0) 推荐(0)
 
摘要: 【build objc4 runtime】 1、Get the latest objc4 project codes from www.opensource.apple.com. 2、Open the projetct, compile it, you will get compile error. 3、you need some file to complete the compilation. 1) Create Directory: /tmp/objc.dst/usr/include 2) from libauto project, get auto_zone.h. Put it i.. 阅读全文
posted @ 2013-04-30 01:25 Tekkaman 阅读(1539) 评论(1) 推荐(1)
 

2013年4月29日

摘要: 【字节对齐实现】 给定某大小,按4字节对齐,或按8字节对齐,咋实现?看下面objc runtime中的实现 上文中WORD_MASK根据环境可以设置为4或8。 阅读全文
posted @ 2013-04-29 18:03 Tekkaman 阅读(349) 评论(0) 推荐(0)
 

2013年4月25日

摘要: 【Mac之SenTestingKit中的设计模式】 1、模板模式。 SenTest、SenTestRun分别提供了基类方法,让各自的子类(SenTestCase、SenTestRun)去实现。此为模板模式。 2、组合模式。 SenTestCase、SenTestSuit继承于SenTest,而SenTestSuit内含SenTest指针list。此为组合模式。组合模式提供多级目录式的牛X功能。 3、策略模式。 SenTest中饮食一个SenTestRun指针,可以用于指向不同类型的SenTestRun子类。此为策略模式。 4、桥模式。 SenTest作为基类,提供统一接口,让子类实现,... 阅读全文
posted @ 2013-04-25 14:10 Tekkaman 阅读(657) 评论(0) 推荐(0)
 
摘要: 【OC之respondsToSelector】 1、instancesRespondToSelector是类方法,用于判断此类实例是否能处理某个方法(包括基类方法)。 2、respondsToSelector是实例方法也是类方法,用于判断某个类/实例是否能处理某个方法(包括基类方法)。 3、下面是objc-runtime源码,可以看到这3个方法最终都调用class_respondsToSelector来实现功能,而class_respondsToSelector从父类中去寻找是否有对应的方法。 2个respondsToSelector方法类似,均是先取出isa指针,然后在isa指向的... 阅读全文
posted @ 2013-04-25 10:18 Tekkaman 阅读(6720) 评论(0) 推荐(2)
 
摘要: 【OC之new】 1、OC提供了alloc和new两个类方法,new方法实质上等于 [[xxx alloc] init]。 alloc方法会自动将分配内存设置为0。 阅读全文
posted @ 2013-04-25 09:53 Tekkaman 阅读(1262) 评论(0) 推荐(0)
 
摘要: 【Mac之Darwin】 1、The kernel, along with other core parts of OS X are collectively referred to asDarwin.。 Mac OS X的kernel,以及其它几个核心组件,也被统称为Darwin。Darwin是2000年苹果开源的一个类Unix操作系统。So,意即,Mac OS X构建于Darwin技术之上。 Darwin does not include Apple’s proprietary graphics or applications layers, such as Quartz, Qu... 阅读全文
posted @ 2013-04-25 00:23 Tekkaman 阅读(3168) 评论(0) 推荐(0)
 

2013年4月24日

摘要: 【OC之OBJC2_UNAVAILABLE】 1、What isOBJC2_UNAVAILABLE macro mean? 意即在OBJC2.0中,这些东西将被删除。 阅读全文
posted @ 2013-04-24 18:03 Tekkaman 阅读(3203) 评论(0) 推荐(0)
 
摘要: 【OC之initialize】 1、+ (void)initialize方法在调用每个类的第一个方法前(类方法,意味着以+打头的方法),会调用此函数。So,如果BaseClass继承了DerivedClass,那么initialize会被调用2次。 更详细资料参考:http://www.cocoachina.com/macdev/objc/2009/0611/158.html# 2、如何实现initialize方法:由于initialize会被多次调用,在执行initialize时,如果想只为本类初始化,则需要使用[self class]进行类型判定。 阅读全文
posted @ 2013-04-24 16:39 Tekkaman 阅读(489) 评论(0) 推荐(0)
 

2013年4月23日

摘要: 【bundle之principal class】 In particular, every Cocoa loadable bundle contains aprincipal class. The code loading mechanism provided by the NSBundle class uses a bundle’s principal class as an entry point. Applications loading bundles can ask NSBundle to find the principal class and use the returnedC. 阅读全文
posted @ 2013-04-23 17:39 Tekkaman 阅读(847) 评论(0) 推荐(0)
 
摘要: 【iOS之Framework】 1、Aframeworkis a hierarchical directory that encapsulates a dynamic shared library and the resource files needed to support that library. framework,所包含的必然是一个dylib。 2、Accounts.framework实例: 可以看到,大多数framework都是一个dylib+headers。所以在osx/ios中,通常没有单独的dylib存在(一个没有给出导出符号的dylib,对大数用户来说都没用),每... 阅读全文
posted @ 2013-04-23 14:36 Tekkaman 阅读(1382) 评论(0) 推荐(0)
 

2013年4月21日

摘要: 【js's for-in vs oc's for-in】 1、在OC中,for-in中的item代表array中的元素本身,即obj。例如: 2、在js中,for-in中的item代表key。即array[key] = value。所以js中使用for-in枚举的话,可能会产生意响不到值。例如: 对于JS,建议使用for(;;)来枚举array。 阅读全文
posted @ 2013-04-21 13:11 Tekkaman 阅读(594) 评论(0) 推荐(0)
 

2013年4月20日

摘要: 【iOS之Accessibility】 1、UIAccessibility协议用于让外界程序了解到自己身的执情情况。Accessibility是一个交互协议,基于查询<->应答,通知<->监听模型的协议。外部程序通过查询来获取APP应答,从而了解程序。另外通过监听来自APP的消息,来通知用户当前状态。 2、常用的协议与元素包括: 1)UIAccessibility, protocol,核心协议。 2)UIAccessibilityAction,protocol,添加行为的协议。 3) UIAccessibilityElement, class。 4)UIAccessib 阅读全文
posted @ 2013-04-20 23:36 Tekkaman 阅读(5884) 评论(0) 推荐(1)
 
摘要: 【iOS之VoiceOver】 1、什么是VoiceOver? VoiceOver是苹果开发的为视觉障碍服人士务的应用。伴随UIAccessibility协议,开发者可以通过支持UIAccessibility来使用自己的APP支持为盲人服务。 2、开关:Settings > General > Accessibility > VoiceOver 3、高频操作: 1)通常操作 2)其它操作提示 阅读全文
posted @ 2013-04-20 16:17 Tekkaman 阅读(537) 评论(0) 推荐(0)
 

2013年4月18日

摘要: 【iOS之UIALogger日志系统】 1、UIALogger是AnimationJS中的日志类,内含8个函数。 2、上半部分函数是一个LOG块,LOG块由logStart发起,由logIssue、logFail或logPass结束。 3、下半部分四个函数用于在logStart块中输出日志。logDebug对应“debug”,logMessage对应“message”,logWarning对应“warning”,logError对应"logError"。 4、LOG块结果级别依次是 pass < warning < error。所以如果一个LOG中同时有这3种类 阅读全文
posted @ 2013-04-18 19:31 Tekkaman 阅读(1320) 评论(0) 推荐(0)
 
摘要: 【iOS之AutomationJS】 1、BrowserJS中没有提供JS互相引用的机制,只能通过HTML元素<script>来互相引用。 2、NodeJS中提供了require机制来互相引用。 3、在iOS AutomationJS中,提供了#import 命令来实现互相引用。 阅读全文
posted @ 2013-04-18 18:00 Tekkaman 阅读(642) 评论(0) 推荐(0)
 
摘要: 【iOS新加速计事件】 1、iOS5.0以前,可以使用UIAcceleration来监听加速计事件。 2、Bug iOS5.0以后,UIAccelerometerDelegate已经被depreacated,如下: deprecated不是说不能说了,而是意味着在将来版本会删除,所以如果不想更新知识的话,就使用UIAccelerometer吧。更保险的方法是使用一个Timer来检查UIAcceleration,即不依赖于此Delegate回调。 3、针对iOS4.0以上版本,推荐使用CMMotionManager来监听加速计事件。涉及到下面几个方法: 4、其实,CMMotion... 阅读全文
posted @ 2013-04-18 17:06 Tekkaman 阅读(2413) 评论(0) 推荐(0)
 
摘要: 【iOS之Export UIAutomation script】To export a script to a file on disk:Open a script in a trace document.Control-click in the content area to display the contextual menu, as shown inFigure 3-5. Attention: Command+S is used to save the whole template. Only use Ctrl+LeftClick will leads to save the js. 阅读全文
posted @ 2013-04-18 11:32 Tekkaman 阅读(404) 评论(0) 推荐(0)
 

2013年4月17日

摘要: 【linux之GCC&C++Runtime版本编译期检查】 1、官方开发文档如下: 2、But how to use this feature in real development? I don't know at present. 阅读全文
posted @ 2013-04-17 17:52 Tekkaman 阅读(550) 评论(0) 推荐(0)
 

2013年4月16日

摘要: 【linux之exit】 1、exit主要的函数相关函数有3个:exit、_exit、atexit。 2、进程终止方式: 3、atexit函数原型: 4、exit、_exit函数区别 阅读全文
posted @ 2013-04-16 22:39 Tekkaman 阅读(649) 评论(0) 推荐(0)
 
摘要: 【C++匿名对象】 C++也有匿名对象,只在当行代码有用,离开当行代码立马析构。 【mutable of C++】 mutalbe的中文意思是“可变的,易变的”,跟constant(即C++中的const)是反义词。 在C++中,mutable也是为了突破const的限制而设置的。被mutable修 阅读全文
posted @ 2013-04-16 22:07 Tekkaman 阅读(1106) 评论(0) 推荐(0)
 
摘要: 【linux数据重定向&管道】 1、linux数据重定向。#将错误输出信息关闭掉[chengmo@centos5 shell]$ ls test.sh test1.sh 2>&-test.sh[chengmo@centos5 shell]$ ls test.sh test1.sh 2>/dev/nulltest.sh#&[n] 代表是已经存在的文件描述符,&1 代表输出 &2代表错误输出 &-代表关闭与它绑定的描述符#/dev/null 这个设备,是linux 中黑洞设备,什么信息只要输出给这个设备,都会给吃掉 参考:http://w 阅读全文
posted @ 2013-04-16 16:17 Tekkaman 阅读(236) 评论(0) 推荐(0)
 
摘要: 【Mac之Font管理】 1、常常需要确定当前系统到底有多少字体可用,OSX已经为我们开发了专门的应用来帮助管理字体。 LaunchPad -> 其它 -> Font Book。 2、通过Font Book可以查看到系统当前有多少字体,以及查找到系统存放字体的路径。 阅读全文
posted @ 2013-04-16 12:44 Tekkaman 阅读(1686) 评论(0) 推荐(0)
 
摘要: 【什么是dmg?】 .dmg是Mac机用的一种文件格式。 dmg就是disk image的意思,即磁盘影像,相当于在windows上常见的iso文件。 假如你在网上下载了一个dmg文件,双击它,你就会发现系统多了一个磁盘。这个磁盘就是刚才双击的dmg文件所包含的内容。 同时,用户可以在程序-常用工具-磁盘工具里面创建,大小自己定义的dmg文件,用来放程序,文件打包,或用来做一个限定容量的路径。然后你可以对这个磁盘做你要做的事情,如用TOAST刻录。因此说,dmg文件在Mac中又相当于一个软U盘。 dmg文件是mac系统的安装文件,相当于win的setup.exe,win系统无法安装,该下ex. 阅读全文
posted @ 2013-04-16 10:11 Tekkaman 阅读(2617) 评论(0) 推荐(0)
 

2013年4月13日

摘要: 【linux之atexit函数】 1、什么是atexit函数? 2、流程图 3、后注册的函数会被插入到前排,从而被先调用。 阅读全文
posted @ 2013-04-13 23:11 Tekkaman 阅读(1394) 评论(0) 推荐(0)
 
摘要: 【linux之文件的时间】 阅读全文
posted @ 2013-04-13 22:42 Tekkaman 阅读(199) 评论(0) 推荐(0)
 
摘要: 【linux之umask】 1、umask用于设置文件创屏蔽字,即被umask设置的值,在新建文件时,不允许存在。 2、9个存取位。 阅读全文
posted @ 2013-04-13 22:13 Tekkaman 阅读(169) 评论(0) 推荐(0)
 
摘要: 【linux之access函数】 1、access函数按实际用户ID、组ID来测试。原型如下: 2、mode参数如下: 3、Demo: 阅读全文
posted @ 2013-04-13 21:29 Tekkaman 阅读(258) 评论(0) 推荐(0)
 

2013年4月12日

摘要: 【linux之文件类型】 1、linux文件类型有7类: 1)普通文件。(regular file) 2)目录文件。(directory file) 3)字符特殊文件。(character special file) 4)块特殊文件。(block special file) 5)FIFO。 6)套接口。(socket) 7)符号连接。(symbolic link) 2、通过<sys/stat.h>中的宏可以判定某文件是哪个类型 3、例: 阅读全文
posted @ 2013-04-12 16:13 Tekkaman 阅读(178) 评论(0) 推荐(0)
 
上一页 1 ··· 30 31 32 33 34 35 36 37 38 ··· 42 下一页