Rails2.2世界:国际化功能问与答(三)
由Gudao Luo在2008-11-30 at 22:27发表的

警告:在复制本博客代码时,空行存在中文空格,需要删除!!!
- 国际化功能问与答(三):本地化翻译方法
- 如何调用翻译函数?
I18n.translate < key >
如:
I18n.translate :hello
或者
I18n.t :hello - 如何调用具有插值的翻译函数?
I18n.translate < key >, < 插值 >
如:
I18n.translate :hello_with_name, :name=>”Hans” - 如何调用多元化的翻译函数?
I18n.translate < key >, < 多元化变量 >
如:
I18n.translate :second_in_words, :count=>12 - 如何调用具有命名空间的翻译函数?
I18n.translate < 命名空间.key >, < 多元化变量 >
如:
I18n.translate “namespcae.second_in_words”, :count=>2 - 如何调用时间对象的本地化函数?
I18n.localize < 时间对象 >, :format=>< key >
如:
I18n.localize Time.now, :format=>:long
或者
I18n.l Time.now, :format=>:long - 如何调用日期对象的本地化函数?
I18n.localize < 日期对象 >, :format=>< key >
如:
I18n.localize Date.parse(‘2008-11-29’) - 如何调用时间和日期名称的翻译函数?
I18n.translate < 命名空间.key >
如:
I18n.translate(‘date.month_names’)
I18n.translate(‘date.month_names’).last
- 如何调用翻译函数?
- 注
- 在图中的命令sc就是“ruby script/console”命令。
Apple世界:文件chm的阅读器iChm
由Gudao Luo在2008-11-30 at 07:01发表的

- 说明
- 针对Mac OSX上的文件chm阅读器:
iChm
Chmox
Chamanix
CHM Reader - 软件iChm是最新的,而软件Chmox是最最早的
- 上面所示的图使用了软件iChm打开chm文件,但是当你打开该文件mootools_doc_cn_1.chm(链接在下面参考文献中)时,中间的内容会出现中文乱码。
- 乱码原因:在这个软件中使用了两种文本编码UTF-8(中间文字)和GBK(目录文字,注意该文字在图中是乱码)。
- 谁之过?创建chm文件的软件是否应该规定同一文件只能存在一种文本编码?软件iChm是否考虑到能够显示不同的文本编码?创建该文件的制作者应该注意在同一文件中要使用一种文本编码?你以为呢?
- 调整文本编码:菜单 >> 显示 >> 文本编码 >> UTF-8 或者 GBK
- 针对Mac OSX上的文件chm阅读器:
- iChm 安装方法:
- 下载文件:http://ichm.googlecode.com/files/iChm.1.4.0.zip
- 双击文件:iChm.1.4.0.zip
- 移动文件iChm.app到文件夹“应用软件”中
- Chmox 安装方法:
- 下载软件:http://mesh.dl.sourceforge.net/sourceforge/chmox/Chmox-0.3.dmg
- 双击文件Chmox-0.3.dmg
- 移动文件Chmox.app到文件夹“应用软件”中
Cucumber实例世界:Cucumber基本概念实例(二)
由Gudao Luo在2008-11-29 at 20:17发表的

- 除了括号<>的内容之外,在文件features/addition.feature
与
文件features/step_definitons/calculator_steps.rb
之间的陈述句要"基本"保持一致;
如:
features/addition.feature:“我已经在计算器里输入<6>”
features/step_definitons/calculator_steps.rb:“我已经在计算器里输入<$n>” - 在括号<>中,一个是具体值:6,一个是变量$n。
- 这个括号<>是我增加的,不是必须的,目的是要把问题说明清楚;
- 括号<>是为了说明在其里面的内容是可以变化的值;
- 陈述句是随意表达的,只要意思正确就可以了。
- 我们可以把这种表述看作为一个“函数名称”。
- 在陈述句之前的单词是该软件的中文关键词,必须如此。
- 关键词之后的空格是我增加的,不是必须的,目的是要把问题说明清楚;
- 在文件.feature中,Cucumber关键词对应于文件
*_steps.rb的相应关键词
如:
features/addition.feature:“当”
features/step_definitons/calculator_steps.rb:“When” - 文件.feature是*应该*是仅仅问题的描述
- 文件
*_steps.rb是对问题的描述具体实现
Rails2.2世界:国际化功能问与答(二)
由Gudao Luo在2008-11-28 at 23:50发表的

- 国际化功能问与答(二):用户定义本地化文件
- 注意 ,在下面第二个问题中,Rails 2.2.2的示例代码存在错误,源代码为:“<<”,正确应该是:“+=”。参见: 对于数组的运算符“<<”和“+=”的差异
Cucumber实例世界:Cucumber on Rails基本使用过程(一)
由Gudao Luo在2008-11-28 at 20:17发表的
代码世界:对于数组的运算符“<<”和“+=”的差异
由Gudao Luo在2008-11-27 at 21:53发表的
Rails实例世界(No 3):关于Textile的可视化编辑插件textile_toolbar
由Gudao Luo在2008-11-27 at 11:23发表的
代码世界:逆向循环语句
由Gudao Luo在2008-11-27 at 09:58发表的
- 说明
- 在下面资料的逆向循环语句中,do前面多了一个点。
- 参考资料
- http://www.railsrocket.com/articles/looping-backwards-in-ruby
Rails框架:最有前途的代码测试工具Cucumber
由Gudao Luo在2008-11-26 at 22:40发表的

- 说明
- Cucumber是跨计算机语言的代码测试工具
- Cucumber是使用本地化语言的代码测试工具
- Cucumber是集成多种测试工具于一体的工具
- Cucumber彻底分离测试描述(文字工作者)与描述实现(软件工作者)
- Cucumber更加人性化,更加语言化,更加简单化
- 评论
- Cucumber makes me so happy. —Dr Nic
- 参考资料
- 代码测试工具Cucumber首页
- Cucumber工具开发者
- Cucumber工具相关项目
- Cucumber: Next Generation Ruby BDD tool
- Cucumber: 黄瓜将成为下一代的Ruby BDD工具
- Ruby on Rails(Cucumber Wiki)
- Cucumber(黄瓜)
- Behavior Driven Development with Cucumber
- Using Cucumber for Writing Stories for Command-Line Applications
- Writing a Story: why, when, where, who, what, how and a bunch of other questions and answers
- Using RSpec, Cucumber and User stories to build our internal systems
- Cucumber: The Latest in Ruby Testing
- Story Driven Development Recipes with Cucumber
- Cucumber(中文语言描述)基础讲座系列
Rails2.2世界:国际化功能问与答(一)
由Gudao Luo在2008-11-26 at 06:02发表的
Rails世界:Ruby on Rails 2.2版本相关资料
由Gudao Luo在2008-11-25 at 15:41发表的

- 重要参考资料
- Rails 2.2: i18n, HTTP validators, thread safety, JRuby/1.9 compatibility, docs
- Ruby on Rails 2.2 Release Notes
- Rails 2.2已经正式发布!
- What’s New in Edge Rails: Rails 2.2 Released – Summary of Features 4
- Demo application to show Rails’ new i18n features
- Rails 2.2 For Me And For You
- Rails 2.2 Released – 27 Links and Resources To Get You Going
- Localizing Rails : Demo application
- Rails2.2 发布 - 27个链接和资源带你出发
- Rails 2.2版本不再推荐使用的功能
- 专题资料
Apple世界:终于有了合适的中文输入法Fun Input Toy
由Gudao Luo在2008-11-24 at 14:33发表的

- 安装说明
- 下载: http://fit.coollittlethings.com/down.php?v=1.9.3_intel
- 解压文件即双击该文件: FunInputToy_v1.9.3_intel.zip
- 双击文件: FunInputToy_v1.9.3_intel.pkg
- 自动重新启动计算机
- 系统偏好设置 >> 多语言环境 >> 输入法菜单 >> 如上图所示
- 参考资料
- FIT发布实验版 http://fit.coollittlethings.com/?p=112
- 下载首页 http://funinput.com/mac/download
- 删除苹果电脑FIT输入法错误自动记忆词组的方法
- 致谢
- 非常感谢 kyle 所提供的信息.
软件世界:消息队列(Messaging Queue)与Ruby语言和Rails框架
由Gudao Luo在2008-11-23 at 10:46发表的

- 什么是消息队列(Messaging Queue)
- 有哪些队列服务器(Queue Server)软件
- 同步与异步概念
- HTTP是同步的,Queue是异步的,但是目的是一样的
- http://en.wikipedia.org/wiki/Message_Queue
- 服务器与客户端概念
- 在HTTP概念中,存在浏览器(Client)与网络服务器(Server);
- 在Queue概念中,也存在客户端软件与服务器软件概念;
- 如何在Ruby和Rails中使用基于Beanstalk的消息队列(Messaging Queue)
- Beanstalk Messaging Queue http://tinyurl.com/24zfv7
- Ruby Beanstalkd distributed worker basics http://tinyurl.com/5nehld
- Ruby Beanstalkd distributed worker intermediate lessons http://tinyurl.com/6hz6p3
- http://async-observer.rubyforge.org/
- 参考资料
- https://computing.llnl.gov/tutorials/parallel_comp/
苹果世界:最受欢迎的RSS阅读器NewsGator
由Gudao Luo在2008-11-22 at 22:18发表的

- 安装说明
- 点击链接: http://tinyurl.com/6g8nd9
- 把下载的文件NetNewsWire.app移到应用软件目录下
- 点击该文件NetNewsWire.app,就可以启动该软件
- 注册一下用户
- 在所有的Mac OS X机器上,只要有该软件并且有相同的用户,相互间就可以同步本地RSS信息。
网站推荐:Ruby和Rails书籍有多少?
由Gudao Luo在2008-11-21 at 21:55发表的
- 相关链接
- Ruby和Rails应用软件有多少? http://www.railsforall.org/apps
- Ruby和Rails资料有多少? http://www.railsforall.org/resources
Rails世界:Ruby软件包和Rails插件的使用趋势
由Gudao Luo在2008-11-20 at 06:05发表的
Rails实例世界(No 2):很有前途的JavaScript框架Mootools
由Gudao Luo在2008-11-19 at 08:30发表的

- 参考资料
- Mootools首页 http://mootools.net
- Mootools on Rails插件
- MooTools Plays Well With Rails http://tinyurl.com/6pl8ql
- Mootools插件Accordion
- Increasing User Experience With Javascript http://tinyurl.com/5ed8tf
苹果工具世界: 文件rar的压缩工具 UnRarX
由Gudao Luo在2008-11-18 at 03:33发表的

- 安装说明
- 下载文件:http://www.unrarx.com/files/UnRarX_2.2.zip
- 解压文件UnRarX_2.2.zip
- 复制或者移动文件UnRarX.app到目录/Applications/(即:应用程序)下
技术图书世界: 免费的电子图书"Ruby要点(Essential Ruby)"
由Gudao Luo在2008-11-17 at 15:36发表的
Rails实例世界(No 1):可视化路由工具vasco
由Gudao Luo在2008-11-16 at 06:49发表的
- 安装前提条件:
- ruby version 1.8.6
- gem version 1.3.1
- rails version 2.1.2
- git version 1.6.0.1
- 说明
- 在Mac OS X上使用上面所说的方法一切正常
- 在Debian Sarge 3.1 Server上使用上面所说的方法,在使用命令“rake vasco:explore”时,就会出现问题。
- 在使用Mongrel服务器可以正常访问
- 在使用Thin服务器可以访问vasco时,会出现下面错误:
No route matches ”/vasco” with {:method=>:get}
- 参考资料
- Introducing Vasco: A Route Explorer for Rails http://tinyurl.com/59pacg
- Minor bug fix to Vasco http://tinyurl.com/5dk37r
- Vasco now supports nested routes http://tinyurl.com/6n8v6y
博客世界:Rails神话(The Rails Myths)
由Gudao Luo在2008-11-15 at 07:59发表的

- 相关资料
- Merb, Rails Myths, Language Popularity and other Zenbits http://tinyurl.com/6pjfrn
- http://www.zedshaw.com/blog/2008-11-13.html
- MythBusting — Rails is not a monolith http://tinyurl.com/6adalf
网站推荐:Ruby & Rails 外文精华翻译站
由Gudao Luo在2008-11-15 at 06:41发表的
软件开发工具:在Debian/Ubuntu上安装版本控制工具Git
由Gudao Luo在2008-11-14 at 05:00发表的
Apple世界:苹果电脑朗读英文文本
由Gudao Luo在2008-11-12 at 13:58发表的

- 设置方法
- 在桌面的程序栏中,打开“系统偏好设置”
- 在打开了的窗口中,点击“语音”
- 选择如上图的设置,“按下按钮时朗读所选文本”
- 点击按钮“设置键”,输入一个任意组合键,如“Option+A”
- 使用方法
- 在浏览器中,选择需要朗读的英文内容
- 使用组合键“Option+A”,就会朗读该英文内容
- 说明
- 可惜朗读中文内容功能好像没有。
- 参考资料
使用苹果电脑朗读英文文章 http://tinyurl.com/5a4keu
使用苹果电脑共享上网 http://tinyurl.com/6s3xdy
代码世界:开源软件Redmin版本0.7.3的代码问题
由Gudao Luo在2008-11-11 at 13:54发表的
网站推荐:获取隐藏的flv文件连接
由Gudao Luo在2008-11-10 at 10:17发表的
开发工具世界:在Mac OSX上如何安装7-zip
由Gudao Luo在2008-11-08 at 09:46发表的
Apple世界:Mac OS X浏览器知道多少?
由Gudao Luo在2008-11-07 at 08:46发表的
Apple世界: 在Mac OS X上安装网络文件下载工具wget
由Gudao Luo在2008-11-06 at 14:56发表的

- 安装说明
- 下载:wget http://tinyurl.com/5odt4o 。
- 解压: 双击文件wget.zip
- 进入该解压目录,可以看到文件:wget,wgetrc和wget.1 。
- 设置环境变量“:/usr/local/bin”,具体方法参考: 如何设置环境变量 MacOSX on Leopard
- 执行下面命令
- 说明
- 上面是使用可执行文件的安装方法,如果想从源代码开始安装它的话,那么请看下面参考文献的连接。
- 参考文献
- wget for Mac OS X Leopard http://tinyurl.com/4rlzns
- Building wget for Mac OS X http://tinyurl.com/d9b39
图书世界:免费的Git使用手册
由Gudao Luo在2008-11-03 at 12:02发表的
Apple世界:SQLite数据库可视化工具
由Gudao Luo在2008-11-02 at 21:43发表的

- 相关连接
- SQLite Manager https://addons.mozilla.org/zh-CN/firefox/addon/5817
数据库世界:下一代数据库储存系统CouchDB
由Gudao Luo在2008-11-01 at 17:44发表的

- 说明
“Its interesting to see that recently things like CouchDB or BigTable, and other implementations treat the database as a big hash. Or implement a big hash as a database are popping up and that’s very interesting.”—-DHH
- CouchDB on Rails何时到位?
- 值得好好学习的数据库系统!
- Ruby语言实现的CouchDB接口
- ActiveCouch home http://activecouch.googlecode.com/
- ActiveCouch Source
- CouchResource
- CouchObject
- CouchObject Home
- CouchObject RDoc
- 参考文献
- Installing CouchDB on MacOSX
- 最简单地安装CouchDB到MacOS
- 基于RESTful的面向文档数据库
- ActiveCouch – A Ruby Wrapper for CouchDB
- Futuretalk: CouchDB
- ActiveCouch – a CouchDB library in the spirit of ActiveResource and ActiveRecord
- Installing CouchDB 0.8.0 on Ubuntu 8.04
- ThruDB for Rails? ActiveDocument
- Thrudb – faster, cheaper than SimpleDB
- Damien Katz
- CouchDB Implementation













