123
 123

Tue 06 January, 2009

Click here to bookmark this link.Channel Image17:22 Xapian,Sphinx在Rails中的性能比较» LetRails
Xapian 和 Sphinx都是非常棒的开源全文搜索解决方案,但是我想知道哪个性能更好一些,Xapian官方提供了与Solr的对比,但是没有和Sphinx的,所以我决定自己来测试。 数据集 要测试首先需要准备好...
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image04:42 Announcing the Rails activists» Riding Rails - home

Railway station crowd

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:

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 add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Mon 05 January, 2009

Click here to bookmark this link.Channel Image23:34 扩大防守» 梦想风暴
即便是一个初入职场的程序员,多半也知道编程规范的概念。但是,你是否想过为什么会有编程规范的存在。答案很简单,减少混乱。

程序员是一群很有想法的人,即便如编码风格之类的问题,一旦允许讨论,那也会引发无穷无尽的争论,括号究竟是放在行后,还是另起一行,每个人都能说出一堆让人听起来很有道理的论据。不过,事实上,这对于项目的目标本身,并没有直接的贡献。所以,有识之士们把编程轨范敲定下来,大家也别争了,照着做就好。经过最初的一段时间,大家便都会按照着这个规范行事,少了无谓的争论,大家便会把精力放在项目本身上。

如果你用过Rails,你多半会热爱上Convention over Configuration,因为它不让你动脑为那些Model、Controller和View挨个起名字了,要知道,想写好程序的话,名字就是第一个需要头疼的关隘。随着你对Rails开发了解的增多,你会发现,除了CoC的概念,Rails还包含了很多的实践,比如目录组织、比如开发脚本等等,而我们所需要做的,只是遵循这些已有的东西。或许,作为一个有想法的程序员,你会跳出来说,这种做法限制了程序员的创造力。可事实是,真正使用Rails开发的人对这种做法甘之若饴,因为有更多的地方等着他们发挥创造力。

好吧!我想说的是,我们把太多的精力浪费在无谓的争论上了。让我们把更多的精力放在那些值得思考的东西上吧!

如果我们可以把一些东西固化下来,无论是规范,还是脚本,抑或是框架,只要有一个一致的东西,大家遵循就好了。写程序,确实需要创造力,但真的不是每个点都需要。而且,不是每个人都可以真正的争到点子上,最差劲的结果是,讨论变成了攻击,N败俱伤。

守、破、离》是一种做事方式。或许,对于一个程序员来说,离是我们追求的境界,但守是我们应该先做好的。相信你可以对应的上,这里的守,便是前面提到的那些要固化下来的内容。守不仅仅是一个简单的简化编码的方法,我们甚至可以把一些设计上的理念守下来,这样,做类似的应用,我们就不必从头再来。守的范围越大,离的层次也就可以越高。

软件开发的发展,就是一个守的范围不端扩张的过程,操作寄存器的模式用高级程序设计语言的方式守了下来,一些良好的设计方法用设计模式的概念守了下来,一些好的编程习惯用最佳实践的方式守了下来……

不妨偶尔停下来,想想什么可以守住。




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

Sun 04 January, 2009

Click here to bookmark this link.Channel Image02:47 おつかい» Matzにっき
おつかいを頼まれて、スーパーに餃子を買いに行ったら、町内の二店舗が両方とも正月休みだったので、 ついカッとなって手近な材料で皮から餃子を作ってしまった。 今は反省している。 でも、それなりに食べられた。
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Sat 03 January, 2009

Click here to bookmark this link.Channel Image16:05 Disable that annoying beep on Thinkpads when resuming from Sleep» John Lam on Software
It’s under the Power Manager settings:
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image05:27 This Week in Edge Rails» Riding Rails - home

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

commit

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]

commit

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 add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Fri 02 January, 2009

Click here to bookmark this link.Channel Image13:11 Hello, 2009» John Lam on Software
Happy New Year! It’s been a hectic holiday season here in the Pacific Northwest. We were snowed in over here for somewhere in the neighborhood of 10 days or so. I wanted to spend most of my time with family,...
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image11:31 Ruby/Rails工具世界:创建基于Ruby语言的PDF文件工具Prawn» 天天红玉世界
创建基于Ruby语言的PDF文件工具Prawn
  • 说明
    • Prawn 项目是使用Ruby生成PDF文件的工具;
    • Prawnto 项目是基于Prawn的Rails插件,其目的是简化Prawn项目在Rails框架软件下的使用方法。
    • Prawn项目能够很好地实现中文PDF文件的创建!
    • Prawn项目将是创建基于Ruby语言的PDF文件最有潜力的工具。
    • Prawn项目将会成为Rails最重要的工具之一。

add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image08:47 Practice» O'Reilly News:Ruby
My New Year's Resolution for this year is simple: practice. You don't have to achieve (or even aim for) total mastery for the practice to be worthwhile.
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image08:47 Practice» O'Reilly News:Ruby
My New Year's Resolution for this year is simple: practice. You don't have to achieve (or even aim for) total mastery for the practice to be worthwhile.
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image08:28 malleolus: 1. Either of the...» Projectionist
mal•le•o•lus
[muh-lee-uh-luh s]noun
1. Either of the two rounded protuberances on each side of the ankle, the inner formed by a projection of the tibia and the outer by a projection of the fibula.
2. Any bony projection with a shape likened to a hammer head.

add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image08:28 When you have overpowered a...» Projectionist
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 add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Thu 01 January, 2009

Click here to bookmark this link.Channel Image22:28 Goodbye weberberg.de» chris blogs

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 add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image09:00 lycom.de祝愿大家健康和成功的2009年!» 天天红玉世界


lycom.de祝愿大家

健康和成功的2009年!


add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image01:28 epicene: Having characteris...» Projectionist
ep•i•cene
[ep-i-seen]adjective
Having characteristics of both sexes or no characteristics of either sex; of indeterminate sex: the sort of epicene beauty peculiar to boys of a certain age.

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

Wed 31 December, 2008

Click here to bookmark this link.Channel Image04:54 On Merb+Rails» James Britt - Code, Content, Caffiene

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 add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Click here to bookmark this link.Channel Image01:49 Building Standalone FXRuby Applications with Exerb» Lovable Lyle
Distributing FXRuby-based applications to end-users who don’t have Ruby (or FXRuby) installed on their computers can be a challenge. Fortunately, there are a number of freely available tools for building “standalone” versions of Ruby applications. In this post, we’re going to focus on how to use Exerb, developed by Yuya Kato, to build standalone FXRuby [...]
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Sources