by agate - Published: 2009-05-20 [11:27 上午] - Category: 程序编码

在 javascript 中常需要获取或者修改当前页面的地址
可以使用 window.location 这个对象

window.location = {
  // attributes
  hash:     //Sets or returns the URL from the hash sign (#)
  host:     //Sets or returns the hostname and port number of the current URL
  hostname: //Sets or returns the hostname of the current URL
  href:     //Sets or returns the entire URL
  pathname: //Sets or returns the path of the current URL
  port:     //Sets or returns the port number of the current URL
  protocol: //Sets or returns the protocol of the current URL
  search:   //Sets or returns the URL from the question mark (?)

  // methods
  assign():  //Loads a new document
  reload():  //Reloads the current document
  replace(): //Replaces the current document with a new one
}
Tags: [ ] - Comments: View Comments
by agate - Published: 2009-05-13 [1:51 下午] - Category: 程序编码

首先谢谢 wujiang 的推荐, 在详细阅读 Sinatra 的文档和看了 rubyconf 的视频之后, 我举双手认同这个新的 ruby web 框架.

它没有 rails 那样的臃肿(? 之前我们说 rails 多么敏捷轻量阿... ). 它可以十分便捷地将所有现成的东西集成进来. 你不需要做很多的配置, 你只要知道我需要什么, 然后你就用吧.
它十分Restful: GET/POST/PUT/DELETE 都是集成的. 方便将 web 应用写成良好的格式.
它支持多种模板: Haml Erb Sass Builder
它支持多种持久层框架: Datamapper Sequel ActiveRecord

更多的细节可以查阅: Sinatra - The Book (一个十分短小的优质文档)
PS. 我喜欢 Sequel!

Tags: [ , , , , ] - Comments: View Comments