vim command

remember these common-used commands will make your work faster

with ‘o’ or ‘O’ you can insert a new line after/before the current line.  both commands will enter the insert mode at the new line

Cursor Movement Commands

h  Moves the cursor one character to the left

l   Moves the cursor one character to the right

k   Moves the cursor up one line

j   Moves the cursor down one line

w   Forward one word

b   Backward one word

e   go to the end of the Next word

$    Move cursor to the end of current line

0    (zero) Move cursor to the beginning of current line

w    Forward one word

b    Backward one word

Text Deletion Commands

x    Delete character

dw    Delete word from cursor on

db    Delete word backward

dd    Delete line

d$    Delete to end of line

d^    (d caret, not CTRL d) Delete to beginning of line

migration review

  • rake db:migrate VERSION=20080906120000 ( if it is run already,  won’t be run again)
  • rake db:migrate:up VERSION=20080906120000
  • rake db:migrate:redo STEP=3
  • rake db:migrate:redo VERSION=20080906120000
  • rake db:rollback This will run the down method from the latest migration ( check out scheme_migrations to see which one is the latest; if many people are working at the same time, you will be surprised about the result. If the latest migration file is not on your desktop, it won’t run anything.)

web service

  • a software system designed to support interoperable machine-to-machine interaction over a network
  • why?
    • When all major platforms could access the Web using Web browsers, different platforms couldn’t interact. For these platforms to work together, Web-applications were developed.
    • Web-applications are simply applications that run on the web. These are built around the Web browser standards and can be used by any browser on any platform.
  • good article about rest:


Pagination in Web content (HTML, ASP, PHP, and others) [edit]

On the Internet, pagination is used for such things as displaying a limited number of results on search engine results pages, or showing a limited number of posts when viewing a forum thread. Pagination is used in some form in almost every web application to divide returned data and display it on multiple pages. Pagination also includes the logic of preparing and displaying the links to the various pages.

Pagination can be handled client-side or server-side. Server-side pagination is more common. Client-side pagination can be used when there are very few records to be accessed, in which case all records can be returned, and the client can use JavaScript to view the separate pages. By using AJAX, hybrid server/client-side pagination can be used, in which Javascript is used to request the subsequent page which is loaded and inserted into the Document Object Model via AJAX.[1]

Server-side pagination is appropriate for large data sets providing faster initial page load, accessibility for those not running Javascript, and complex view business logic.

Correctly implementing pagination can be difficult.[2] There are many different usability questions such as should “previous” and “next” links be included, how many links to pages should be displayed, and should there be a link to the first and last pages.[3] Also ability to define the number of records displayed in a single page is useful.[4]

Server side pagination is best for:

  • Large data set
  • Faster initial page load
  • Accessibility for those not running javascript

Client side pagination is best for:

  • Small data set
  • Faster subsequent page loads

If you have large pages and a large number of pages you are better of requesting pages in chunks from the server via AJAX. So let the server do the pagination, based of your request URL.

You can also pre-fetch the next few pages the user will likely view to make the interface seem more responsive.

If there are only few pages, grabbing it all up-front and paginating on the client may be a better choice

ToDO: understand how it is implemented in the client-side


Mercurial is a cross-platform, distributed revision control tool for software developers. It is mainly implemented using the Python programming language, but includes a binary diff implementation written in C. It is supported on Windows and Unix-like systems, such as FreeBSD, Mac OS X and Linux. Mercurial is primarily a command line program but graphical user interface extensions are available. All of Mercurial’s operations are invoked as arguments to its driver program hg, a reference to the chemical symbol of the element mercury.

Mercurial’s major design goals include high performance and scalability, decentralized, fully distributed collaborative development, robust handling of both plain text and binary files, and advanced branching and merging capabilities, while remaining conceptually simple.[3] It includes an integrated web interface. Mercurial has also taken steps to ease the transition for SVN users.

rails cache

  • difference between caches_page and caches_action: the former just caches the page content to a file, the latter called some before filters in the action before do the cache ( the action itself won’t be called, just its before filters).
  • expire_page, expire_action
  • config.action_controller.perform_caching = true ( be careful if you are in development env; it will do the cache and your action change will NOT have effect immediately. I would set it to be false in development env.)