Learning to be Giant.

React浅析(React Demystified)


本文翻译自:React Demystified by Josh Haberman,已得到原作本人授权。

我通常在这个博客当中写一些关于parsing和底层编程的内容,但这篇文章跟平时的那些主题不太相关。最近我对诸多JavaScript的框架产生了些兴趣,包括Facebook发布的React。我最近读的一些文章,尤其是The Future of JavaScript MVC Frameworks,让我确信在React当中蕴含着一些非常强大的深层次思想,但是我至今没能找到一篇让我满意的解释React的核心概念的文章。如同之前的LL and LR Parsing Demystified一样,本文将试图用一种我个人能够认可的方式来解释React当中的这些核心思想。

Use RethinkDB to extract distinct tags with Map-reduce


This is originally a question I asked on StackOverflow, but I came up with the answer by myself.

I have a database whose documents are of the format:

        'timestamp': 1431307846643,
        'tag': 'tag1',
        'message': 'message content'

What I want to do is to:

  1. group all the documents by message
  2. find the earliest and latest timestamp from each group
  3. find all the distinct tags in a group

Let OpenCV work with Asus Xtion Pro Live under Ubuntu


I spent several hours make OpenCV and Xtion work together. I want to extract the depth map from Xtion with OpenCV. There is a sample program openni_capture.cpp under samples/cpp/. It makes us of VideoCapture.

My configuration is:

  1. Ubuntu 14.04 LTS
  2. OpenCV 2.4.10 (compiled with OpenNI support, check here)
  3. OpenNI with PrimeSense Module

Postfix cannot start on centos


When I tried to start postfix today, I got the following message:

fatal: parameter inet_interfaces: no local interface found for ::1

Solution is straightforward:

  1. open /etc/postfix/main.cf
  2. comment out inet_interfaces: all
  3. add inet_protocol: ipv4

React diff是怎么工作的


Facebook前段时间发布的React提供了许多前端开发的新思路,在React当中提出的Virutal DOM和diff据称极大的提高了效率并且在代码写作的时候十分符合直觉,而且基于此的对于DOM的渲染策略让人感到十分有趣。Facebook相关的团队宣称他们使用的启发式算法成功的将树的diff操作从原有的$O(n^3)$降到了$O(n)$。所以,这篇文章综合了最近看到的好多篇关于React渲染的策略的文章,希望能对React的渲染策略有一个较为全面的宏观上的探讨。



  1. React’s diff algorithm
  2. Why is React’s concept of Virtual DOM said to be more performant than dirty model checking?
  3. React Documentation: Reconsiliation
  4. React Demystified