1. autoload_paths vs eager_load_paths

    In Ruby you have to require every .rb file in order to have its code run. However, notice how in Rails you never specifically require any of your models, controllers, or other files in the app/ dir. Why is that? That’s because in Rails app/* is in autoload_paths. This means that when you run your rails app in development (for example via rails console) — none of the models and controllers are actually required by ruby yet. Rails uses special magical feature of ruby to actually wait until the code mentions a constant, say Book, and only then it would run require ‘book’which it finds in one of the autoload_paths. This gives you faster console and server startup in development, because nothing gets required when you start it, only when code actually needs it.

    2016/03/22 Rails

  2. KMP算法分析

    KMP算法是字符串匹配中的经典算法。相比暴力匹配算法的时间复杂度为O(m*n),KMP算法的时间复杂度为O(m+n)。虽然,之后又出现了比KMP算法还高效的字符匹配算法,不过KMP算法作为经典,一直作为算法学习中的教材知识。 KMP算法流程: 假设现在文本串S匹配到 i 位置,模式串P匹配到 j 位置

    2016/03/15 Algorithm

  3. Event-Loop

    Event Loop是计算机系统的一种运行机制。Javascript就采用这种机制,Nodejs也是采用这种机制,来解决单进程运行时带来的一些问题。

    2016/03/11 Summary

  4. About Lock

    About Lock

    2016/03/08 Summary

  5. A Decision

    A Decision

    2016/03/04 Thought

  6. Study algorithm again and again

    Study algorithm again and again

    2016/03/01 Thought

  7. 关于连接池原理

    ### 理解中的连接池

    2016/02/28 Database

  8. Homebrew notes

    Homebrew notes

    2016/02/25 Tool

  9. A story about concurrency and parallelism

    A story about concurrency and parallelism

    2016/02/23 Summary

  10. 操作系统原理-进程线程

    操作系统原理-进程线程 一直对高并发的web系统感兴趣,看了很多文章和资料,发现很多东西还理解的不清楚,特别是多线程和多进程方面的知识。 这样不行,所以回归原理,用了周末的时间,把操作系统原理的进程和线程的知识内容好好的温习了。突然发现,上学时不懂,不明白的问题,一下就明白了。 所以,写了这篇博客,也算是读书笔记吧。主要内容:操作系统并发、多进程、多线程

    2016/02/18 Summary