Archive for September, 2008
以往在使用Fixture时都是用部分数据填充来模拟达到真实效果,但Model之间的关系使的维护与书写Fixture成为一件比较复杂的事情,稍有不慎,Fixture也会使测试代码变的十分脆弱,今天看到一个不错的方式,基本上可以解决这个问题.方法如下:
# products.yml
couch:
name: Couch
price: 399.99
manufacturer: lazyboy
categories: furniture
tv_stand:
name: TV Stand
price: 149.95
manufacturer: highdeph
categories: furniture, electronics
# manufacturers.yml
lazyboy:
name: LazyBoy
highdeph:
name: HighDeph
# categories.yml
furniture:
name: Furniture
electronics:
name: Electronics
感兴趣的朋友还可以看视频教程,相信会有所收获
video tutorial
rails command list
# rake db:fixtures:load
# # 载入fixtures到当前环境的数据库
# # 载入指定的fixtures使用FIXTURES=x,y
# rake db:migrate
# # 迁移数据库通过在db/migrate目录下的脚本.可以指定版本号通过VERSION=x
# rake db:schema:dump
# # 创建一个db/schema.rb文件,通过AR能过够支持任何数据库去使用
# rake db:schema:load
# # 载入一个schema.rb文件进数据库
# rake db:sessions:clear
# # 清空sessions表
看到一段描述国内开发者特点的言论,感觉比较靠谱,至少我可以算是这类人,看起来要努力改进,在此做个记号.
中国开发者的一个大的特点就是对技术痴迷的同时不食人间烟火,整天津津乐道的就是那些算法、数据结构、设计模式、语言技巧、技术规范,对于普通老百姓关心的东西一概没有兴趣。我们中的大部分人对于时尚、化妆品、小资情调嗤之以鼻,对于电影、音乐、艺术、美食一知半解,对于地产、金融、法律知识一窍不通,对于一个普通老百姓市场生活中所能遇到的困难和问题,所追求的那一点享受和乐趣不闻不问,既不愿意亲身实践,更在主观心态上予以拒斥。
策划产品的时候全凭感觉,结果呢,做出来的东西千篇一律,看上去什么都有,一用起来处处不贴心。究其根源,就在于我们太专业,把太多的时间用来围着电脑转,根本上缺少对于生活和需求的深刻体察,对于人的关怀。
http各个状态码含义
1**:请求收到,继续处理
2**:操作成功收到,分析、接受
3**:完成此请求必须进一步处理
4**:请求包含一个错误语法或不能完成
5**:服务器执行一个完全有效请求失败
100 Continue 初始的请求已经接受,客户应当继续发送请求的其余部分。(HTTP 1.1新)
101 Switching Protocols 服务器将遵从客户的请求转换到另外一种协议(HTTP 1.1新)
200 OK 一切正常,对GET和POST请求的应答文档跟在后面。
201 Created 服务器已经创建了文档,Location头给出了它的URL。
202 Accepted 已经接受请求,但处理尚未完成。
Shoes is a very informal graphics and windowing toolkit. It’s for making regular old apps that run on Windows, Mac OS X and Linux. It’s a blend of my favorite things from the Web, some Ruby style, and a sprinkling of cross-platform widgets. (More in the README, or at the newshoooes.net!)
click here , you can find [...]
a Wordpress blog installed in the root of your (sub-) domain:
$HTTP["host"] =~ “{yourdomain}” {
var.app = “{yourdomain}”
accesslog.filename = base + “/logs/” + app + “.access.log”
server.errorlog = base + “/logs/” + app + “.error.log”
load php app
url.rewrite = (
“^/(wp-.+).*/?” => “$0″,
“^/(sitemap.xml)” => “$0″,
“^/(xmlrpc.php)” => “$0″,
“^/(.+)/?$” => “/index.php/$1″
)
}
a Wordpress blog installed in a subfolder (e.g. /blog/)
$HTTP["host"] =~ [...]











