Tue 06 January, 2009

add to del.icio.us. look up in del.icio.us.
add to furl

Bringing Rails and Merb together is about more than just merging the respective code. We’re also picking up the best ideas from both communities beyond the code. Following on Merb’s success in offering a strong evangelism effort, we’re pleased to announce the creation of the Rails activists:
The mission of the Rails activists is to empower and support the worldwide network of Ruby on Rails users. We do this by publicizing Rails, making adoption easier, and enhancing developer support.
At launch, we’ve identified seven areas where the Rails activists can contribute to the Rails ecosystem:
- Public Relations with media of all sizes
- Ombudsman work to ensure good user-to-user support
- Community Leadership at events and conferences
- Media Organization to help create good promotional opportunities
- Website maintenance
- Documentation efforts
- Developer support
The initial members of the Rails activists are Gregg Pollack, Matt Aimonetti, Ryan Bates, and Mike Gunderloy. But we can’t do all this alone, nor do we want to! Our vision includes a large and vibrant Rails network composed of other activists, bloggers, event hosts, authors, and developers. Our intent is to provide connections, resources, and support to help the entire ecosystem to grow. To start things off, we’re bringing in a lot of our own projects, including videos, screencasts, case studies, Rails documentation, and more – we’re a working group, and we hope you’ll work with us.
If you have ideas about improving the Rails community, projects you want to participate in, or are just looking for ways to get involved, get in touch with us! There are a lot of ways to do that:
- Through the new Rails activism Google group.
- Through the Rails feedback site, where you can vote on which projects you’d like to see us devote resources to in the Rails 3 timeframe and beyond.
- Through our Twitter accounts (linked above)
- Through IRC to Matt (mattetti) or Mike (mikeg1a)
- Through email to Mike Gunderloy, Matt Aimonetti, Gregg Pollack, or Ryan Bates.
We look forward to hearing from you!
For additional perspectives from the activists, see the posts by Gregg Pollack, Matt Aimonetti, and Mike Gunderloy.
Photo by Flickr user caravinagre
add to del.icio.us. look up in del.icio.us.
add to furlMon 05 January, 2009

程序员是一群很有想法的人,即便如编码风格之类的问题,一旦允许讨论,那也会引发无穷无尽的争论,括号究竟是放在行后,还是另起一行,每个人都能说出一堆让人听起来很有道理的论据。不过,事实上,这对于项目的目标本身,并没有直接的贡献。所以,有识之士们把编程轨范敲定下来,大家也别争了,照着做就好。经过最初的一段时间,大家便都会按照着这个规范行事,少了无谓的争论,大家便会把精力放在项目本身上。
如果你用过Rails,你多半会热爱上Convention over Configuration,因为它不让你动脑为那些Model、Controller和View挨个起名字了,要知道,想写好程序的话,名字就是第一个需要头疼的关隘。随着你对Rails开发了解的增多,你会发现,除了CoC的概念,Rails还包含了很多的实践,比如目录组织、比如开发脚本等等,而我们所需要做的,只是遵循这些已有的东西。或许,作为一个有想法的程序员,你会跳出来说,这种做法限制了程序员的创造力。可事实是,真正使用Rails开发的人对这种做法甘之若饴,因为有更多的地方等着他们发挥创造力。
好吧!我想说的是,我们把太多的精力浪费在无谓的争论上了。让我们把更多的精力放在那些值得思考的东西上吧!
如果我们可以把一些东西固化下来,无论是规范,还是脚本,抑或是框架,只要有一个一致的东西,大家遵循就好了。写程序,确实需要创造力,但真的不是每个点都需要。而且,不是每个人都可以真正的争到点子上,最差劲的结果是,讨论变成了攻击,N败俱伤。
《守、破、离》是一种做事方式。或许,对于一个程序员来说,离是我们追求的境界,但守是我们应该先做好的。相信你可以对应的上,这里的守,便是前面提到的那些要固化下来的内容。守不仅仅是一个简单的简化编码的方法,我们甚至可以把一些设计上的理念守下来,这样,做类似的应用,我们就不必从头再来。守的范围越大,离的层次也就可以越高。
软件开发的发展,就是一个守的范围不端扩张的过程,操作寄存器的模式用高级程序设计语言的方式守了下来,一些良好的设计方法用设计模式的概念守了下来,一些好的编程习惯用最佳实践的方式守了下来……
不妨偶尔停下来,想想什么可以守住。
add to del.icio.us. look up in del.icio.us.
add to furlSun 04 January, 2009

add to del.icio.us. look up in del.icio.us.
add to furlSat 03 January, 2009

December 27, 2008-January 2, 2009
Happy New Year! Apparently the Rails core team was not doing too much partying to end the old year: we had 35 commits hit the edge tree, and some of them involved very substantial work. Here’s my weekly overview of some of the most visible and significant changes.
Optimization of respond_to
In some of the first fruits of the Rails-Merb team merger, Yehuda Katz took a look at the respond_to method, which is of course heavily used in many Rails applications to allow your controller to format results differently based on the MIME type of the incoming request. After eliminating a call to method_missing and some profiling and tweaking, he reports an 8% improvement in the number of requests per second served with a simple respond_to that switches between three formats. The best part? No change at all required to the code of your application to take advantage of this speedup. commit commit
If you want a preview of what else to expect from Rails 3, you might want to dip into Yehuda’s own fork of the Rails tree I’ll be covering these changes as they make their way back into the master copy of edge Rails.
Dynamic Scopes for Active Record
You know about dynamic finders in Rails (which allow you to concoct methods like find_by_color_and_flavor on the fly) and named scopes (which allow you to encapsulate reusable query conditions into friendly names like currently_active). Well, now you can have dynamic scope methods. The idea is to put together syntax that allows filtering on the fly and method chaining. For example:
Order.scoped_by_customer_id(12)
Order.scoped_by_customer_id(12).find(:all,
:conditions => "status = 'open'")
Order.scoped_by_customer_id(12).scoped_by_status("open")
There’s some further discussion of this over on Ryan Daigle’s blog. commit
Other Active Record Updates
There were a few changes going on in Active Record this week. A trio of commits cleaned up some behavior of associations when the :primary_key option is specified. commit commit commit
On another front, ActiveRecord::Base#new_record? now returns false rather than nil when confronted with an existing record. While there was some discussion of the wisdom of this change, the consensus seems to be that it can’t hurt and might make things less surprising for some developers. commit
HTTP Digest Authentication
Rails now has built-in support for HTTP digest authentication. To use it, you call authenticate_or_request_with_http_digest with a block that returns the user’s password (which is then hashed and compared against the transmitted credentials):
class PostsController < ApplicationController
Users = {"dhh" => "secret"}
before_filter :authenticate
def secret
render :text => "Password Required!"
end
private
def authenticate
realm = "Application"
authenticate_or_request_with_http_digest(realm) do |name|
Users[name]
end
end
end
Multiple Conditions for Callbacks
When using Active Record callbacks, you can now combine :if and :unless options on the same callback, and supply multiple conditions as an array:
before_save :update_credit_rating, :if => :active,
:unless => [:admin, :cash_only]
Testing and continuous integration
A little flurry of activity cleaned up some loose ends in our testing strategy for Rails itself. This included not running symlink tests on Windows, adding test coverage to Rails::TemplateRunner, removing some assumptions in various tests, and getting the FCGI and sqlite2 tests working again. This is all part of a longer-term effort to make the Rails continuous integration server more useful moving forward. As you’ll see if you peek at the current build status, we’re not quite there yet, but we’re getting close.
By the way, if you want to set up your own CI server for Rails, there are instructions right in the source code.
Code Comments for Metaprogramming
One side effect of the changes to respond_to is that people really liked the inline comments that make the intent of the class_eval code clear. As a result, we now have similar comments throughout the Rails source code. For example:
def #{method_name} # def year
time.#{method_name} # time.year
end # end
If you’re just using Rails, you’ll never see these comments – but if you’re helping to maintain and improve the framework, you’ll appreciate them. commit
add to del.icio.us. look up in del.icio.us.
add to furlFri 02 January, 2009

add to del.icio.us. look up in del.icio.us.
add to furl

- 说明
- 参考资料
- Ruby Mendicant: Permian Prawn
- Ruby Mendicant: Archaean Prawn
- The Ruby Mendicant Project
- The Ruby Mendicant Project
- Ruby Mendicant: Permian Prawn
- 轻而易举创建PDF打印文档
- Building printable documents doesn’t have to be hard
- Building printable documents doesn’t have to be hard
- Prawn的Rails插件Prawnto首页
- Prawn项目中文实例代码
- Prawn项目首页
- Prawn: The Pure Ruby PDF Generation Library
- 项目Redmin的Prawn代码
- How To Generate PDFs in Rails With Prawn
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
2. Any bony projection with a shape likened to a hammer head.
add to del.icio.us. look up in del.icio.us.
add to furl
“ When you have overpowered an enemy, show him forgiveness out of gratitude for the ability to overpower him. ”
Ali ibn Abu Talib
add to del.icio.us. look up in del.icio.us.
add to furlThu 01 January, 2009

Und schon beginnt das Jahr mit gemischten Gefühlen… weberberg.de, die Bastion des oberschwäbischen Gonzo-Journalismus schließt ihre Tore. Ich werde diese Angelegenheit sicher mit einem lachenden und einem weinenden Auge sehen. Einerseits war die Bergzeitung, der blogartige Teil der Seite sicher oft zuviel des Guten, überladen von Trivialitäten und ohne Ironiedetektor kaum lesbar, andererseits war die Seite eben die einzige ihrer Art für Biberach. Hier wurden die Signale zu spät erkannt und Biberach steht zumindest im Bereich der tagesaktuellen Stadtnachrichten und -gerüchte wieder allein im Schatten der unsäglichen SchwäZ oder noch unsäglicherer Werbeblätter.
Obwohl ich wegen meines Studiums die meiste Zeit nicht mehr in Biberach bin, hätte ich da doch eine Idee. Die Leserschaft von Weberberg ist doch hoffentlich nicht ausschließlich so beschränkt und behämmert wie das Gästebuch (man könnte es das “4chan Biberachs” nennen) es scheinen lassen mag. Ich denke, ein kollaborativer Weblog, z.b. auf Scoop-Basis (vgl. Nensch) hätte sicherlich Potenzial und wäre eine Bereicherung für die Stadt. (Hierbei darf jeder Berichte einreichen, und die anderen stimmen dann ab, ob sie gut genug für die Titelseite sind. Auch gibt es eine ausgeklügelte Kommentarfunktion so dass dumme Kommentare schnell verschwinden und die lesenswerten Ergänzungen gut zu finden sind.) Ich könnte da beim Aufsetzen durchaus helfen, aber aufgrund meiner Hauptbeschäftigung eben nur passives Mitglied sein.
Bitte lasst euch schnell was einfallen.
NP: Single Gun Theory—Open the Skies (Remix)
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furlWed 31 December, 2008

Pat Eyler has been asking some folks for their thoughts on the Merb/Rails merge. Basically, he’s putting the same three questions to a number of people, with interesting results.
He asked me, and has published my response.
BTW, the observation that adding Merb into Rails could mean that people will get to use Merb (or some form of it) while claiming to be doing Rails (and so avoiding the dread “but why use @foo? Why not Rails?” challenge) was copped from a post by David Koontz to the Phoenix Ruby User Group mailing list.
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
