123
 123

Thu 22 January, 2009

Click here to bookmark this link.Channel Image17:41 CTO飲み会» Matzにっき
CTOじゃないけど、お邪魔する。 やっぱりCTOじゃない、ミラクルの吉岡さんもいて、 「今度、本を出すんで帯の言葉を書いてください」と依頼される。 人気前書きおよび帯作家としては、絶好のチャンス(?)であるので快諾する。 とはいえ、前書きや帯では全然収入がないので、やっぱり作家とは言えないな。 やや遅れて、やっぱりCTOじゃない、ひろゆき(西村博之)が来て、 話が盛り上がる。こちらはしょっちゅう間違えられているわけだが、 向こうも「Ruby作った人ですよね」と言われたことがあるそうで、 なんとなく一方的でなかったのがう..
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:35 @type エンジニア適職フェア» Matzにっき
上京。 有楽町で、セミナーをしてくる。 アナウンスでまた「まつもとひろゆきさん」と 呼ばれた。もはやこれはネタだな。 今回もエンジニアの幸せ話だが、 Nathaniel Talbotの「Fear of Programming」インスパイアの 「恐怖」についての話が追加されている。 そのぶん、今までちょっと冗長っぽかったところを削除。 質疑とかなかったので、聴衆の反応は不明。 つまんなそうに聞いていた人はそんなにたくさんはいなかったような。
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:35 住所録» Matzにっき
教会でCSVになっている会員記録から整形された名簿がほしい、と頼まれているので、 テンプレートにデータを差し込んで印刷する方法があるに違いないと 思っていろいろ調べるのだが、どうもよくわからない。 誰だ、私が「コンピュータが得意」とかいう人は。 実際にはワープロやら表計算やら全然使えないから。 むしろ人並み以下。 しょうがないから、Rubyで加工してTeXの表を吐いて印刷するか。 でも、TeXも良く知らないんだよなあ。 論文とか過去の資産からコピーしてるだけで。
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:35 たまIT戦略会議 キックオフシンポジウム» Matzにっき
というミーティングでEC Oneの最首さんとパネルを。 最首さんは非常に話し上手なので、 1時間の予定をややオーバーして、大変楽しく話させてもらった。 が、話題がかなりあちこちに移動したので、 聴衆はついてこれたかなあ。ほぼ全員がスーツだった。 懇親会では偉い人が、立派な挨拶をなさっていた。 なんか政治を感じた。 いろんな人とご挨拶。 立川、人多い。なんて都会なんだ(松江と比べて)。 が、しかし、その後移動した新宿ときたら、もう。
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:35 PDA» Matzにっき
時間がちょっとだけあまったので秋葉原に移動する。 自分のPDAの使い方を振り替えると Linuxと同期できなくても、Webの、たとえばGoogle Calendarに 同期できれば、それでOKという事実に気がついて、 じゃあ、最近のスマートフォンでも大丈夫か、 と思えてきたので、物色する。 が、Windows Mobileの「予定表」は使い勝手や閲覧性が悪くて挫折。 今、PHSだからWillcomにしようと思ったんだけどなあ。 iPhoneはそこまでは悪くないけど、だいぶ慣れが必要そう。 っていうか、電話要らないんだからiPod touchでいいのか。 結局決めきれない。..
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Wed 21 January, 2009

Click here to bookmark this link.Channel Image11:34 If the world was perfect, i...» Projectionist
If the world was perfect, it wouldn’t be.

Yogi Berra


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:34 malapropism: The ludicrous ...» Projectionist
mal•a•prop•ism
[mal-uh-prop-iz-uh m]noun
The ludicrous misuse of a word in place of a similar-sounding one, often with unintentionally amusing effect, as in, for example, “dance a flamingo” (instead of flamenco).

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

Tue 20 January, 2009

Click here to bookmark this link.Channel Image14:34 Twenty-Five Things You May Or May Not Know About Me» Joey Gibson's Blog
There’s a meme making the rounds on Twitter and Friendfeed where you share twenty-five things about yourself. Always ready to join in, though usually late to the game, I offer up my list. I can read Koine Greek. I can play the Great Highland Bagpipe. I can play a bit of mandolin. I love to cook. I started writing software [...]
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 Image10:43 推荐网站原型工具 Balsamiq Mockups» Suave's Blog
Balsamiq Mockups 挺长时间以前就开始用了,但是在以前的 iBook 上跑的太慢(基于 Adobe Air,这点很好也很无奈)。现在机器升级后重新装起来,因为界面原型实在太重要了,你必须用一个实实在在...
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Mon 19 January, 2009

Click here to bookmark this link.Channel Image23:44 苦中做乐» 梦想风暴

早在2003年,我就厌倦了出差。在客户现场工作,我也不喜欢

但是,既来之则安之。

每个公司都有属于自己的特点,这些特点从外面看起来是一个样子,在里面看起来却是别有洞天。外面的样子一般是公司刻意打造的形像和大众的评论,这些信息很容易得到,而内部的样子,只有在公司内部的工作一段相对较长的时间才能看得到。我只在两个公司工作过,即便算上在曾经的内部跳动,我也不过在三个地方工作过,所以,只看到很少公司内部的样子。

这次的咨询工作让我在客户公司已经工作了一个半月,不算短的一段时间。每天和客户不同绝色的人打着交道,像客户的员工一样每天上班、工作和下班。这也给了我一个机会看到了客户公司内部的样子。尽管客户花钱是希望从我们这里获得一些东西,但这丝毫不妨碍我从他们身上去学习。在这里,我可以看到许多ThoughtWorks也不俱备的优点,也许,以后回了公司可以分享给大家。

虽然我们不是客户的员工,但每天的朝夕相处还是让我们有机会和客户的员工结下私交:有人为我们节假日出游提供建议,有人带着我们到处转转,有人在我们三缺一的时侯,大老远打车来凑手,还有一些从其它城市出差至此的人邀请我们到他们的地盘上。

时值年关,我们几个在外出差的同事没有机会参加公司的年会,于是,顺便参加了客户的年会。我第一次见识到这么有气势的年会,也见到了那些平时闷闷的程序员们是多么的有才。公司的年会之外,我们还顺便去蹭了一个部门的年会,其目的是为了看看平时和我们一起工作的兄弟到底有多少演艺才华。

这次出差已经打破了我一次性出差的最长纪录,而且,还在继续中,好在还有一些乐趣。






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 Image18:50 Ruby代码世界:尽可能使用Ruby语言方法”<<“» 天天红玉世界
尽可能使用Ruby语言操作方法”<<“
  • 说明
    •  下面第一段代码使用了变量“i”。在Ruby代码中,基本上不需要使用这种变量,即使需要也可以使用“each_with_index”。而第一段代码连这种需要也没有。
    • 下面第二段代码是使用方法“<<”改进后代码清单。注意使用这种方法时,一定要清楚方法“<<”之后的对象是什么。在Rails 2.2.2版本中因为使用此方法不当,产生了错误。参见: Rails2.2世界:国际化功能问与答(二)
下面参考链接的部分代码
#rows
rows=[]
i=0
@issues.each do |issue|
rows[i] = [issue.id.to_s, issue.tracker.name, issue.status.name,
issue.priority.name, issue.assigned_to ? issue.assigned_to.name : '',
format_date(issue.updated_on),
@project == issue.project ? issue.subject : "#{issue.project.name} - #{issue.subject}"]
i=i+1
end
使用方法“<<”改进后代码清单
#rows
rows=[]
@issues.each do |issue|
rows << [issue.id.to_s, issue.tracker.name, issue.status.name,
issue.priority.name, issue.assigned_to ? issue.assigned_to.name : '',
format_date(issue.updated_on),
@project == issue.project ? issue.subject : "#{issue.project.name} - #{issue.subject}"]
end

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:37 网站推荐:Ruby语言项目大世界» 天天红玉世界
Click here to bookmark this link.Channel Image00:30 Rails技巧系列:你使用过script/runner吗?» 天天红玉世界
你使用过script/runner吗?
  • 说明
    • Rails命令script/runner可以执行Rails软件Ruby文件或者Ruby代码。
    • 结合工具 crontab 可以实现Rails项目的定时任务的执行。

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

Sat 17 January, 2009

Click here to bookmark this link.Channel Image20:56 Rails技巧系列:代码redirect_to(@object)够用了吗» 天天红玉世界
代码redirect_to(@object)够用了吗
图片页面HTML代码简化清单
<div id="tabs">
<ul>
<li><a href="#tabs-1">公司</a></li>
<li><a href="#tabs-2">员工</a></li>
<li><a href="#tabs-3">集装箱</a></li>
</ul>
<div id="tabs-1">Company</div>
<div id="tabs-2">Employee</div>
<div id="tabs-3">Container</div>
</div>
  • 说明
    • 代码(一)是通过Rails命令scaffold自动生成代码,其中有一行代码“redirect_to @container”。这一行代码返回到页面,而不能够返回到该页面的某一个标签位置,如上图所示类似页面。如何办?
    • 代码(二)中代码“redirect_to container_path(@container, :anchor => “tabs-3”) ”就是解决这个问题的办法。
代码(一)
  # POST /containers
# POST /containers.xml
def create
@container = Container.new(params[:container]) respond_to do |format|
if @container.save
flash[:notice] = 'Container was successfully created.'
format.html { redirect_to @container) }
format.xml { render :xml => @container, :status => :created, :location => @container }
else
format.html { render :action => "new" }
format.xml { render :xml => @container.errors, :status => :unprocessable_entity }
end
end
end
代码(二)
  # POST /containers
# POST /containers.xml
def create
@container = Container.new(params[:container]) respond_to do |format|
if @container.save
flash[:notice] = 'Container was successfully created.'
format.html { redirect_to container_path(@container, :anchor => "tabs-3") }
format.xml { render :xml => @container, :status => :created, :location => @container }
else
format.html { render :action => "new" }
format.xml { render :xml => @container.errors, :status => :unprocessable_entity }
end
end
end

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 Image10:56 合宿4日目» Matzにっき
中田先生もいらっしゃることもあって、学生時代の思い出が 話題になる機会が何度かあったが、 卒論でプログラミング言語を設計 インテルのインターンで文字コード周りと格闘 など、結局今やってることとあんまり変わらないことに自分で驚く。 20年もやってりゃそれなりの成果も出るか。 三つ子の魂百まで、というか、病膏肓に入る、というか。
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:18 Rails世界:Rails框架软件平台 adva cms» 天天红玉世界
免费无限存放图片在slide.com!
  • 说明
    • adva cms 是基于Rails框架的开发平台。
    • adva cms 最大的特点是所有插件和引擎都存储于目录vendor下,与用户软件彻底分离。

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 Image07:54 Rails技巧系列:为什么不要使用函数puts?» 天天红玉世界
为什么不要使用函数puts?
使用函数puts与函数logger.info的区别
  # GET /users/1
# GET /users/1.xml
def show
@user = User.find(params[:id])
#函数puts
puts @user.to_yaml
# 函数logger.info
logger.info("#{Time.now} - #{@user.to_yaml}")
#
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @user }
end
end
  • 说明
    • 很多人喜欢使用函数puts,获取调试信息。这个问题类似于Java语言人们使用System.out.println(),获取输出内容。一旦使用了函数puts,无法保证网络服务器对于源代码输出信息的顺序!参见上图作了标记的两行输出记录。尽管在上面代码中,函数puts和logger.info是一前一后,但是输出信息的顺序与代码的顺序是不同的。
    • 建议放弃使用函数puts,获取输出信息的方法。
    • Rails框架已经集成了logger软件包!
    • 什么是logger? What is logger?

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 Image03:56 Mt. West RubyConf 2009 registration is open» James Britt - Code, Content, Caffiene

MountainWest RubyConf is on March 13-14, 2009 in Salt Lake City, UT and costs just $100.

That’s right, perhaps the most kick-ass RubyConf of the year cost only one. Hundred. Dollars.

Go now.

BTW, I’ll be speaking at the conference.

See the list of speakers here


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 Image00:50 This Week in Edge Rails» Riding Rails - home

January 10, 2009 -January 16, 2009

24 commits for edge Rails this week (with one patch ported over to the 2.2 branch as well). If you want a pre-release look at Rails 2.3, this is a fine time to install a copy of edge, if you’re not already there. It’s plenty stable enough for test sites, though there are a few rough patches yet.

Nested Transactions in Active Record

Several people contributed to a big patch that gives us nested transactions in Active Record, a much-requested feature. Now you can write code like this:


User.transaction do
    User.create(:username => 'Admin')
    User.transaction(:requires_new => true) do
      User.create(:username => 'Regular')
      raise ActiveRecord::Rollback
    end
  end

  User.find(:all)  # => Returns only Admin

Nested transactions let you rollback an inner transaction without affecting the state of the outer transaction. If you want a transaction to be nested, you must explicitly add the :requires_new option; otherwise, a nested transaction simply becomes part of the parent transaction (as it does currently on Rails 2.2). Under the covers, nested transactions are using savepoints, so they’re supported even on databases that don’t have true nested transactions. There is also a bit of magic going on to make these transactions play well with transactional fixtures during testing. commit

MemCacheStore Enhancements

Nahum Wild contributed some work that (inspired by his spandex_mem_cache_store plugin) that enhances the performance of Rails when using MemCacheStore. The basic idea is to keep a per-request local cache of requests sent to MemCacheStore, cutting down on unnecessary reads and leading to better site performance. commit

Making Active Record Callbacks behave

You may recall the spot in the Active Record documentation that says “If a before_* callback returns false, all the later callbacks and the associated action are cancelled.” What you may not know is that this is actually broken in the current version of Rails: if you cancel a before_update or before_create callback, the after_save callbacks still run. In Rails 2.3, this will behave the way that the documentation says it does. commit

Fractional seconds for TimeWithZone

The Time and TimeWithZone classes include an xmlschema method to return the time in an XML-friendly string. As of this week, TimeWithZone supports the same argument for specifying the number of digits in the fractional second part of the returned string that Time does:


>> Time.zone.now.xmlschema(6)
=> "2009-01-16T13:00:06.13653Z" 

commit

JSON Key Quoting

If you look up the spec on the “json.org” site, you’ll discover that all keys in a JSON structure must be strings, and they must be quoted with double quotes. As of this week, Rails does the right thing here, even with numeric keys. commit

Test Refactoring

Josh Peek spent some time refactoring various tests inside of Action Pack, including those for query string parsing, JSON parameter parsing, XML parameter parsing, multipart parameter parsing, and URL-encoded parameter parsing. While you won’t see any new functionality as a result of this work, it’s worth shining a spotlight on the often-thankless cleanup that keeps the Rails code in good shape.

Changes to Object#try

After some discussion, the semantics of Object#try have changed slightly: it now raises NoMethodError on private methods and always returns nil if the object is nil. commit


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 Image00:50 My Obama Inauguration Speech» Joey Gibson's Blog
I just found the Obama Inauguration Speech Generator through a link on Friendfeed. Basically it’s like Madlibs; you fill in adjectives, nouns, verbs, etc, and then those words get plugged into the story. Hilarity ensues. Or not. Mine turned out pretty good, I think. Barack Obama’s Inauguration Speech My fellow Americans, today is a hopeful day. You [...]
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Fri 16 January, 2009

Click here to bookmark this link.Channel Image05:20 Apple世界:Google正在走进Mac OS X» 天天红玉世界
Google正在走进Mac OS X
  • 说明:Google Quick Search Box
    • 与Mac OS X软件Spotlight类似的搜索工具
    • Google Quick Search Box不仅仅搜索本地信息,而且也可以搜索网络信息。

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:45 合宿3日目» Matzにっき
今日は作業日。昨日までの議論の結果を反映した 草案の新しい版を作る。 その間、私はコミットしたり、バグを取ったり。
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:45 合宿2日目» Matzにっき
昨日同様に密度の高いレビューと議論。 もうこれでRubyの仕様は隅から隅までわかるよ。 って、今までわかってなかったんかい。 で、重箱の隅に変な仕様を見つけるたびに「ごめんなさい」とつぶやくのであった。
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:45 Visor Edge» Matzにっき
愛用のPDAはいまだにHandspringのVisor Edge (Palm Pilot互換機)だったりするのだが、 今日になって調子が悪くなった。画面がノイズ状の表示になり反応がない。リセットも効かない。 うちには予備機として全部で4台のVisor Edgeがあるのだが、 これで3台ダメになった計算になる。あれ、2台だったか。 そろそろ在庫が不安になってきたので、 乗り換えを考えるべきか。 残りをだましだまし使う iPhoneにする iPod touchにする (たとえばソフトバンクの)スマートフォンにする BlackBerry とはいえ、別にスマートフォン要らないし。メールやネ..
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:45 ACM Professional» Matzにっき
中田先生から「ACM Professional会員ならSafariの本が追加料金なしで読めるよ」と 教えていただく。先生は「The Programming Language Ruby (Flanagan本)」はそうやって読まれたのだそうで。 Safari全部ではないようだが、かなりの数の本が読める。 ACM入会以来8年近くなるが、そんなことは知らなかった。 すごい損してた気がする。
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 Image00:58 Rails Documentation Projects» Riding Rails - home

With the recent revitalization of the Rails Wiki project, we’re seeing people ask how the various pieces of Rails documentation fit together. I thought it might be useful to lay out how the Rails Activists see everything fitting together as we move forward.

Rails is a large and mature framework, with a lot of functionality – and with the Merb merger, there will be even more to learn in the future. As such, it presents challenges for developers at all levels trying to understand how to use Rails effectively. There are many resources to help with the learning process, including commercial books and magazines, screencasts and podcasts, tutorials, blog entries, and training courses. But there is also a series of official written documentation projects.

There’s no such thing as one-size-fits-all documentation. Different developers bring different skill sets, backgrounds, and levels of professional maturity to learning Rails. There are at least four levels of official documentation, overlapping but serving different needs:

  • Inline documentation, with comments within the code itself (that you can see by running rake doc:rails within any Rails project).
  • Rails Guides
  • Rails Book (a new project for Rails 3.0)
  • Rails wiki

Although at first glance there appears to be substantial overlap, our feeling is that the each of these projects occupies a distinct (and valuable) niche.

RDoc

  • Provides immediate help for syntax questions
  • Maintained by the actual core developers and generally up-to-date

Rails Guides:

  • Provides focused “how to” help for particular problem domains
  • Target the mid-level developer, possibly with Rails experience
  • Have a large amount of existing high-quality material
  • Are already being continuously revised to track changes in edge Rails
  • Can include version-specific tutorial code samples
  • Can be delivered as a part of core Rails to provide “guidance at your fingertips” for new developers

Rails Book:

  • Provides high-level architectural guidance and overview of how the pieces fit together
  • Digs into the philosophy of the “Rails Ways”, so readers can understand why the framework works the way it does
  • Targets the developer new to Rails or those wanting to go from the “trees” to the “forest” view
  • Offers help in conceptualizing Rails and choosing between alternative modules (ORMs, routing DSLs, etc.) in the Rails 3 timeframe
  • Can draw on the Merb experience in simultaneous translation and pulling in contributions from many writers
  • Largely version independent
  • Gives a structured path through end-to-end documentation in a way that standalone Guides do not

Rails Wiki

  • Community-driven documentation that can respond rapidly to new software and new questions
  • A good repository to links to external information
  • Potentially a showcase for Rails itself in the underlying software
  • A place to put the accumulated community knowledge, even the pieces that are not often needed

It’s important to note that we don’t see these four projects as entirely separate efforts that have no interaction with one another. In particular, it seems likely that the Book will link to the Guides for those seeking additional detail, while the Guides will link to the Book for those seeking additional high-level guidance. We also anticipate that the wiki will point readers to both Guides and Book (as well as to other sources of information).

So, what can you do to get involved? If you’re a writer, translator, or editor, any of these documentation projects would love to have your help:

  • To contribute to the RDoc, write a Rails patch with good comments or check out the docrails project.
  • To help the Rails Guides, get in touch with Pratik Naik or Mike Gunderloy, or drop by the #docrails channel on IRC freenode.
  • To get involved with the Rails Book, contact Matt Aimonetti.
  • To add to the Rails Wiki, join the rubyonrails-wiki group.

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

Thu 15 January, 2009

Click here to bookmark this link.Channel Image15:49 Ruby標準規格合宿» Matzにっき
合宿と言っても夜はやらないのはいつも通り。 Ruby標準規格原案作成をドライブするため、 WG委員長の中田育男先生にわざわざ松江まで来ていただいて 現時点での草案をレビュー。 わたしよりも「できのよい」人たちがメンバーなので ばりばりと進む。っていうか、まる一日昼食以外はほぼ休憩なしってのは どんだけパワフルなんだと。 しかし、わかっていたことではあるけれど、 Rubyってのは標準規格とかに向いてない言語だとつくづく思う。 こうして規格文書としてまとめていて感じるのは、 重箱の隅のような部分で「やめときゃよかった」..
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl
Sources