Dear Scarlett

Dear Scarlett: It’s been a while. I guess everything comes to an end, sweetie. And things may not always make sense to you. There’s a great chance that you’re not gonna see this, I’m well aware o...

Wasted No More

I have no idea why I have to go through these hard times. I never wanted to admit that I’ve lost the ability of expressing myself in some kind of weird way. The truth is that I haven’t done this in...

TLS&SSL

一般都会把两者并称(SSL/TLS),因为这两个可以视作是同一个东西的不同阶段。TLS为SSL的继任者 SSL: Secure Socket Layer 位于可靠的面向连接的网络层协议和应用层协议之间的一种协议。SSL通过互相认证、使用数字签名确保完整性、使用加密确保私密性,以实现客户端和服务器之间的安全通讯。SSL被标准化之后名称改为TSL(Transport Layer Securi...

记一次生成马赛克效果图片的经历

起因 有次逛github,看到一个repo,是用Python写的利用一堆图片剪裁成正方形然后生成一张大图,下了代码运行了一下发现效果很好。于是很自然地想到用一堆姑娘的照片生成一张大图应该会很讨姑娘喜欢。正好我想学下swift和mac开发,于是想何不用swift重写一下呢。开始写。 过程 理解算法 因为对Python并没有太熟悉,加上Python的风格本来就看上去很散漫。所以这一步花了不...

Understanding Multitasking Through Terms

There are important terms that we have to figure out to understand the almighty multitasking better!! Serial vs. Concurrent These two terms describe how the tasks are executed. Tasks executed ...

Consolation

I know it’s been so long since I posted last blog. It’s totally my fault and I won’t look for any kind of excuses, too busy working, got no time or whatever. But I never stopped writing, that’s one...

ARC

内存管理(一) 想花几个章节来整理一下内存管理的知识。 我们都知道OC的内存管理用的是引用计数,下面是引用计数的思考方式。 引用计数思考方式: 自己生成的对象,自己所持有 非自己生成的对象,自己也能持有 自己持有的对象不再需要时释放 非自己持有的对象无法释放 用alloc/new/copy/mutableCopy以外的方法取得的对象,因为非自己生成并持有,所以自...

用GCD实现多任务

GCD(Grand Central Dispatch)是iOS多任务的核心。NSOperationQueue是在GCD的基础上实现的,基本原理都类似。这个是要你把NSOperation添加到NSOperationQueue,而GCD是要你把一个块添加到分派队列。 Note that 分派队列是队列,不是线程。队列不是接受块的东西,而是组织块的。所有的GCD方法都是把块添加到队列末尾,...

用KVC来修改系统类的私有属性

1. 获得私有属性 获得私有属性需要用到runtime, 代码如下, 具体每个函数用途就不解释了, 顾名思义即可. unsigned int count = 0; Ivar *ivars = class_copyIvarList([UIPageControl class], &count); for (int i = 0; i < count; i++) { const ...

Finally

I finally did it. This is reference I know!! Is this working or not?? For christ’s sake, this is so annoying. The internet is killing me. Can’t seem to figure it out. Well, I do not own ...