Jiajun Yao

Stay hungry, Stay foolish.

What I Have Learned From Writing a Kernel From Scratch

Last semester, I took the course 15410 and wrote a kernel from scratch with my partner. I learned a lot from this course and the kernel project. Following is what I have learned:

  1. Never Failed Functions
  2. Comment on Why
  3. Synchronization
  4. Error Handling
  5. Why Writing a Kernel From Scratch
  6. Misc.

Which Intent Will You Get After Android Relaunches the Activity

Imagine that you launch a singleTop activity using intent A and then launch it again using intent B. As a result, activity’s onNewIntent method is called and inside this method you call setIntent to store the new intent. After that, Android decides to relaunch the activity. Now we have the question: which intent will you get after Android relaunches the activity? The original one(A) or the latest one(B)?

android.os.Message.what

Send an android.os.Message whose what is 0 and then remove it, which unexpectedly removes all posted Runnables

Does Your App Have a Rock Solid SSL Connection

SSL(Secure Sockets Layer)是目前广泛用来加密网络通信的加密协议。它的一个著名应用就是HTTPS,也就是使用SSL协议对HTTP进行加密从而使得整个通信更加安全。对于一个移动应用(其他类型的客户端也同理),为了保证其和服务器的通信安全,开发者就会使用SSL来加密客户端和服务器之间的通信。这样理应是安全的,但由于很多开发者使用方式不对,导致客户端和服务器之间的SSL通信会受到中间人攻击(Man-in-the-middle attack),从而使得安全性荡然无存。本文将首先介绍下SSL和中间人攻击的原理,然后会提供一个中间人攻击的实例,最后本文介绍该如何防止中间人攻击。

Review on American Dreams in China

这两天看了陈可辛导演的《中国合伙人》和柴静对新东方三位联合创始人的采访,感受颇多。创业奋斗路上风风雨雨,有太多的东西值得我们去学习,去感悟。下面就聊聊我所感悟到的东西:

  1. 合伙人的品质
  2. 老大的品质
  3. 和比自己优秀的人在一起
  4. 老俞的安眠药

A Close Look Into PHP Zval

最近研究了一下PHP variable的内部实现也就是zval,以及引申出来的Copy on Write, Reference等概念和机制。为了检验一下我是不是真的弄懂了,一个好的方法就是看能不能把它清楚地写下来并让人能够读懂。

Who Are You

这两天在研究新浪微博的第三方插件实现,无意中发现通过利用新浪微博的某个URL能让我获取当前访问这个URL的用户的微博uid。也就是说只要在某个网站中嵌入一段代码,这段代码在后台偷偷地访问那个URL,然后就可以把访问这个网站的用户的微博uid获取到,于是隐私就被泄露了…… 也就是说一个网站可以知道有哪些微博用户访问了它,然后可以就此采取一系列的措施……
下面就具体讲讲这个漏洞是怎么回事。

Refactor With Vim

使用IDE的一个大好处就是可以方便的进行重构,想想Eclipse那彪悍的重构功能吧。可是对于我们这种喜欢用Vim的人来说,要如何来进行代码重构呢?接下来我就介绍一些Tips,来让Vim也能干重构的事。