博客

  • 学为所用,享受生活

    毕业这么久了,回头看看,没有达到预期的目的。太多时间纠结在项目里技术,失去了自己原有的色彩。

    这一年来火了很多技术,node.js, hadoop等,视乎离我很近。

    大学是时候还能用自己的激情创造社会的生产力,能创建一些自己喜欢的项目并且投入到互联网中,但是现在没有这样的条件来做这些事情。

    (更多…)

  • REST-ful URI design

    What are the criteria for a good REST-ful URI?

    I assert:

    • Short (as possible). This makes them easy to write down or spell or remember.
    • Hackable ‘up the tree’. The user should be able to remove the leaf path and get an expected page back. e.g. http://example.com/cars/alfa-romeos/gt you could remove the gt bit and expect to get back all the alfa-romeos.
    • Meaningful. Describes the resource. I should have a hint at the type of resource I am looking at (a blog post, or a conversation). Ideally I would have a clue about the actual content of the URI (e.g. a uri like uri-design-essay)
    • Predictable. Human-guessable. If your URLs are meaningful they may also be predictable. If your users understand them and can predict what a url for a given resource is then may be able to go ‘straight there’ without having to find a hyperlink on a page. If your URIs are predictable, then your developers will argue less over what should be used for new resource types.
    • Help visualize the site structure. This helps make them more ‘predictable’.
    • Readable.
    • Nouns, not verbs.
    • Query args (everything after the ?) are used on querying/searching resources (exclusively). They contain data the affects the query.
    • Consistent. If you use extensions, do not use .html in one location and .htm in another. Consistent patterns make URIs more predictable.
    • Stateless.
    • Return a representation (e.g. XML or json) based on the request headers, like Accept and Accept-Language rather than a change in the URI.
    • Tied to a resource. Permanent. The URI will continue to work while the resource exists, and despite the resource potentially changing over time.
    • Report canonical URIs. If you have two different URIs for the same resource, ensure you put the canonical URL in the response.
    • Follows the digging-deeper-path-and-backspace convention. URI path can be used like a backspace.

    Some of these criteria pull against each other. For example, how can I make a meaningful-yet-short uri? URI-design rightly remains an art not a science. (更多…)

  • HTTP persistent connection

    From Wikipedia,

    HTTP persistent connection, also called HTTP keep-alive, or HTTP connection reuse, is the idea of using the same TCPconnection to send and receive multiple HTTP requests/responses, as opposed to opening a new connection for every single request/response pair.

    Schema of multiple vs. persistent connection.

    Contents

    (更多…)

  • 密码保护:Could you see this

    此内容受密码保护。如需查阅,请在下方输入密码。

  • My fav Sublime Text 2 shortcuts

    It’s a long time for me to write this blog, because I have got Evernote to noted everything I have learned, it is really very convenient.

    These are the most common keyboard shortcuts that i use in Sublime Text 2 (WIN):

    Ctrl + Shift + P – Commands list

    Ctrl+P – Go to anything. I just hit Ctrl+P and type parts of files I want to open – huge time saver.

    Ctrl + Space – Auto completion.

    Alt + 1, 2, 3, 4, … – Switch between open files’ tabs. Not to waste your time grabbing a mouse, and clicking on a tab.

    Ctrl + PgUp/PgDn – Cicles throught the open files

    Ctrl + click somewhere in your code – multiplies your caret, so you can simultaneously enter, delete, overwrite your code. Hitting Esc will exit this function. (更多…)

  • 密码保护:大年初一

    此内容受密码保护。如需查阅,请在下方输入密码。

  • 钱,赤裸裸的钱。

    没有钱,没有前。

    有时候,即使那么不在乎它。

    这是一个花钱如流水的季节,即使有一些是那么的不情愿。

    生活该这样,生活不该这样。

  • 密码保护:随想

    此内容受密码保护。如需查阅,请在下方输入密码。

  • 想回到过去

    听了一首歌,大一的总总事情一篇一篇的浮现在眼前。

    每当从一个环境迁移到另外一个环境,总会有很多怀恋,总想回忆过去的美好。人们总是会回忆那些过去的事情,那些事情仿佛触手可及,但是好像却抓不到,会从指缝中流逝。 (更多…)