123
 123

Sat 12 January, 2008

Click here to bookmark this link.Channel Image05:53 Ruby语言:2007年Ruby语言集成运行环境» 天天红玉世界
Host unlimited photos at slide.com for FREE!
  • 评论
    • 在Windows系统下无疑是InstantRails最佳的选择;
    • 在Unix/Linux系统下将会有比较大的竞争,但是RubyWorks前景看好。

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

Fri 11 January, 2008

Click here to bookmark this link.Channel Image22:44 Jester:ActiveResource的JS实现» Ruby on Rails: LetRails
ThoughtBot开发的Jester库可以让你通过JS访问REST API,它提供了与ActiveRecord类似的语法,并同时支持JSON与XML。 ...
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 Image20:07 Thanks Zed; Syntax matters; no more dumping stuff in Java; Quit pimple pimping Ruby; Scala warning» Matzにっき
「文法は重要だから、Javaと似た文法のGroovyを使おう。 SunはJRubyに投資すべきじゃない。Scala? とんでもない」という話。 私は賛同しない。 文法は重要じゃない、とは言わない。 文法はそれなりに意味があるし、言語選択にあたっての重要な要素になる。 しかし、もっとも重要な要素ではない。 重要なのは「メンタルモデル」である。 「文化」と言ってもいい。これが違ってたら、多少文法が似てても意味がない。 表面的な類似を除けば、JavaとGroovyってそんなに似てるか? 多少の文法の違いを乗り越えるのは人間にとって簡単である。 ..
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 Image14:18 I just ripped my own bodice...» Projectionist
I just ripped my own bodice with anticipation.

Patrick Henry Ewing


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 Image14:18 Stop someone from snoring» Projectionist

Tip Stop someone from snoring

If you bed partner is snoring, make several clicking noises with the side of your mouth.


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 Image12:06 Well, I'm Back: String Theory» Matzにっき
本当は[言語]タグではないような。 MozillaハッカーであるRobert O'Callahanによる、 「UTF-16はダメ、UTF-8でいいじゃん」という話。 私も前に書いたような気がするけど、 UTF-16は良くない。まず、第一にUTF-16はバイト単位のCES(Character Encoding Scheme)でないので エンディアンの影響を受ける。これは結局同じ名前で2種類のCESがあるのと同じである。 それを区別するための方策がBOM(Byte Order Mark)だが、 これが輪をかけてよくない。 BOMの文字としての意味は「ZERO WIDTH NON-BREAKING SPACE」なので、 これは見えない文字であ..
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 Image12:06 StringRepresentations - The Larceny Project - Trac» Matzにっき
LarcenyというScheme処理系でどのように文字列を表現するか、という話。 前にShiroさんが話してたものだね。 紹介されているのは以下の7通り。 flat1 バイト列。1バイトが1文字に相当。ASCIIやLatin-1(ISO-8859-1)に対応。 flat4 バイト列に似ているが、1文字あたり4バイト占有(UTF-32ライク)。Unicodeに対応。 record4 flat4を内包した構造体 record2 1文字あたり2バイトのバイト列で文字列を表現する。 2バイトで表現できない文字が来たら、補助配列を割り当て、 サロゲートペアの後半を補助配列の方に配置する。 record1 1文字あたり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 Image00:22 Ramaze: 轻量级家族的新成员» Ruby on Rails: LetRails
Rails尽管很强大,但是对某些人来说,它还是太庞大了,于是就出现了像Merb与Camping这样的轻量级框架,现在,这一家族又多了一个新成员:Ramaze,它轻的几乎难以置信: 并且它支持Ruby1.9,因...
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Thu 10 January, 2008

Click here to bookmark this link.Channel Image23:27 网站推荐:Ruby语言代码段网站» 天天红玉世界
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 Image17:37 The deal with shared hosts» Loud Thinking by David Heinemeier Hansson

Most Rails contributors are not big users of shared hosting and they tend to work on problems or enhancements that'll benefit their own usage of the framework. You don't have to have a degree in formal logic to deduce that work to improve life on shared hosting is not exactly a top priority for these people, myself included.

That's not a value judgement. It's not saying that shared hosting is bad or evil. It's simply saying that the Rails contributors generally don't use it. By extension, it's not something that we are personally invested in solving as a traditional "scratch your own itch" type of development.

Improve what is for profit and fun
I'd love for Rails to be easy as pie to run in a shared hosting environment, though. I'd love for Rails to be easy as pie to run in any environment. In that "more people could have fun learning Rails and deploying their first hobby application" kind of way. But I don't need it in the sense that I'm going to put in the work, personally, to make it happen.

Others might, though. The Dreamhost guys in particular sounds like they're experiencing a lot of hurt running Rails in their shared hosting environments. That should be a great motivator to jump in and help improve things. The work I do every day to improve Rails is usually about removing hurt. Heck, it's currently in the slogan on the Rails site: "Web development that doesn't hurt".

Second, it sounds like they have a substantial economic interest in making the shared hosting scenario for Rails easier. I read that a fair number of their customers are going elsewhere because they can't get Rails to run well at Dreamhost. Before they leave, though, they probably tax the support system quite heavily as well. So there's direct costs, lost revenues, and probably also a great upside waiting if Rails ran great on their system.

That's both a personal motive for having a less stressful day and a profit motive for making your business more money. Sounds like a match made in heaven for someone like Dreamhost to get involved and help do the work to make Rails a great shared host experience. They might not have the man-power in-house today to make that happen, but I'm sure they could easily hire their way out of that. If the plan they want to pursue is a better mod_ruby, I'd start looking at that project for people who've contributed and ask if they'd like to earn a living improving the state of affairs.

We'll work with you if you're willing to work with us
Again, I'd love to see someone tackle this challenge and would be more than happy to work with a group pursuing this to get their results into Rails or working with Rails the best way we can. Consider that an open, standing invitation.

In exchange, I'll ask a few, small favors. Don't treat the current Rails community as your unpaid vendor. Wipe the wah-wah tears off your chin and retract the threats of imminent calamity if we don't drop everything we're doing to pursue your needs. Stop assuming that it's either a "complete lack of understanding of how web hosting works, or an utter disregard for the real world" that we're not working on issues that would benefit your business. Think of it more as we're all just working on the issues that matters most to our business or interests.

The alternatives
Now if you're a user of shared hosting and you're not satisfied with the results you're getting — and you're not getting good vibes that things will be better — there are alternatives. Lots of them in fact. And it doesn't have to cost an arm and a leg. Self-service VPS outfits like Slice Host has plans starting at $20/month that runs Rails great (I use them to run this site). RailsMachine has a Rails-specific setup for $75/month. And for the more high-end stuff, you can get great setups from Joyent, Engine Yard, and tons of others.

So as a programmer looking to deploy Rails, you have tons of options in all price ranges. If you're a shared host looking to capitalize on a framework that's driving a lot of demand, it would seem that your best option is to actually get involved and help the community help you.


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:41 Oh, so *that's* how you say that!» James Britt - Code, Content, Caffiene

Learning a new programming language is hard enough when there are new abstractions to get your head around, but the matter is made worse with a plethora of new syntax and symbols with no obvious verbal expression.

For example, most folks would read this:

x = 4 * y

as “x equals 4 times y.”

But how do you vocalize this:

f :: Int -> Int

Well, that’s Haskell, and lucky for Haskell new-comers a wiki page is being assembled to explain how to vocalize code.

So, the above example would be, “f has type Int to Int.”


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

Wed 09 January, 2008

Click here to bookmark this link.Channel Image22:56 ActiveResource指南» Ruby on Rails: LetRails
尽管ActiveResource(以下简称ARes)在Rails2.0庞大的ChangeLog中只占了短短的几行,但我们不应该因此就认为这只是一个小改动,实际上,ARes可以算作是Rails1.2中引入的Resource概念的一个后续,利用Reso...
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:03 电子产品:世界上第一个太阳能耳机» 天天红玉世界
世界上第一个太阳能耳机
  • 说明
    • 芬兰 IQUA 公司出品
    • 在使用太阳能耳机时用户不再担心电力不足
    • 只要有光该太阳能耳机就可以充电
    • 太阳能耳机电力保持12个小时
    • 太阳能耳机可以向其它电子设备输送电力

创新是赢得顾客的最佳途径之一


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:33 FXRuby Book Now Available as Beta Release!» Lovable Lyle
I’m pleased to report that FXRuby: Create Lean and Mean GUIs with Ruby has been released as a Beta book. That means that although the book is still under development, you can get early access to the content right now and provide feedback to help make the final book even better when it’s released later [...]
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:33 McAfee throws some FUD at the GPL - The INQUIRER» Matzにっき
McAfeeがGPLに対するFUDを行ったという話。 In its annual report, Windows security software vendor McAfee told its investors that open source software licence terms it vaguely characterised as " ambiguous" might "result in unanticipated obligations regarding our products." 投資家に対する年次報告においてMcAfeeは以下のように報告した。 「オープンソースソフトウェアの曖昧な性質によって、我々のプロダクトに予期しない義務が発生する可能性がある」 "To the extent that we use 'open source' software, we face risks,..
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:33 A programming language cannot be better without being unintuitive» Matzにっき
「プログラムはわかりにくさがあるくらいでなければ良いものではない」という話。 Rubyのモットー(と呼ばれていた)「Principle of Least Surprise」の真逆であるが。 まずは、Scalaのプログラムから。 (0/:l)(_+_) なんか、私がメールのシグネチャにつけている似顔絵(と呼べるのか)であるところの 「/:|)」に似ているような気もするけど、これは立派なScalaのプログラムである。 これをもって「だからScalaはダメなんだ」という結論を出すのは早急すぎる。 これらは確かにわざわざわかりにくく書いてはあるけど、個別の文法要素は 決して..
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Tue 08 January, 2008

Click here to bookmark this link.Channel Image19:27 Substroke Design Dump» Matzにっき
前にも書いたような気がするけど、 私は「ビジュアル言語」に対して否定的だ。 ここでいう「ビジュアル言語」とは、 「Microsoft Visual 〜」な言語のことではなくて、 グラフィカルな表現でプログラムを表現しようという試みのこと。 一番成功した(でも、普通の人はやっぱり知らない)のはPrographかなあ。 しかし、もしかしたらこのSubstrokeは意味のある試みかもしれないと思った。 Substrokeは「ビジュアル(画像など目に見えるもの)を操作する言語」だから。 そもそもアルゴリズムという「形のないもの」にむりやり形を与える ビジュア..
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 Image13:59 今天是个值得纪念的日子» Ruby 语言 思想驱动生活
1976年1月8日周恩来在北京病逝终年78岁 个人来说,终于买了第一支股票,工商银行。 毫无任何分析,只是想遍地都是工行的门面,想来不错。买的不多,只有100股,都不好意思跟人说了。
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 Image12:33 Ruby语言:Ruby语言网络框架如雨后春笋一般» 天天红玉世界
Click here to bookmark this link.Channel Image01:34 “Yo” is the new...» Projectionist

“Yo” is the new “Hir”


Language experts in the US say since at least 2004 students have been saying “yo” as a substitute for gender specific pronouns and the trend is growing.
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:15 I have a prediction for 200...» Projectionist
I have a prediction for 2008: you fail.

uncov


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

Mon 07 January, 2008

Click here to bookmark this link.Channel Image18:25 The Mythical 5%» Matzにっき
以前、RubyをDISってくれた*1、 Bruce Eckelのエントリ。 IT技術者ではトップ5%は残りの人たちの20倍の生産性を持つという。 これが本当のことであるとしたら、その科学的な根拠はなにか、という話。 80%の技術者は、本を読まない、イベントに参加しない、勉強しない。 それでどうして、それらを継続的に行う開発者と同等の生産性をあげることができるのか。 それらを行う20%のうち、さらに80%は、(まだ)うまく成果をあげられていない。 すると、それらを継続的に行い、さらにうまくいっている人はおおよそ5%になる。 「トップ5%」という..
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 Image14:14 Setting the Standard in Screencast Technique» James Britt - Code, Content, Caffiene
Click here to bookmark this link.Channel Image14:14 Ramaze Screencasts» James Britt - Code, Content, Caffiene

Documentation for Ramaze keeps growing, and some screencasts have been posted.

Well worth checking out.

Also worth checking out is the latest version of Ramaze. It runs on Ruby 1.9, and includes a number of really interesting example apps. You can pull it from the darcs repo (though a new release should be coming soon).


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 Image13:46 Hello, Lucene» 梦想风暴
Lucene是什么?下面是官方回答。

Apache Lucene is a high-performance, full-featured text search engine library written entirely in Java.

简而言之,它是用来做搜索的库。提及搜索,我们的思绪就会情不自禁飞到串匹配上。没错,串匹配确实是一种搜索,但对于不同的应用,搜索的方法不一样,对于在一篇文档中进行搜索这种小规模应用而言,串匹配足够了,而Lucene为我们向大规模搜索铺上了一条大道。大规模?是不是想到了搜索引擎,事实上,Lucene就是被很多人用来构建搜索引擎。

关于搜索引擎的实现,很多人或多或少的听说过一些,比如网络爬虫,比如分布式的架构,比如PageRank。抛开其它其它复杂的部分,最关键的步骤便是建立索引,然后进行搜索。不妨让我们Lucene是如何实现这最关键的部分。

import java.io.File;
import java.io.FileReader;

import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.index.IndexWriter;

public class Indexer {
    public static void main(String[] args) throws Exception {
        File indexDir = new File("index");
        File dataDir = new File("data");

        IndexWriter indexWriter = null;
        try {
            indexWriter = new IndexWriter(indexDir, new StandardAnalyzer(), true);
            for (File file : dataDir.listFiles()) {
                if (file.isFile() && file.getName().endsWith(".txt")) {
                    Document document = new Document();
                    Field pathField = new Field("path", file.getCanonicalPath(),
                        Field.Store.YES, Field.Index.TOKENIZED);
                    document.add(pathField);
                    Field contentField = new Field("contents", new FileReader(file));
                    document.add(contentField);
                    indexWriter.addDocument(document);
                }
            }
            indexWriter.optimize();
        } finally {
            if (indexWriter != null) {
                indexWriter.close();
            }
        }
    }
}

这段代码很容易理解,遍历数据目录下的文本文件,为每个文件生成索引。

这里有一个Document的概念,它在Lucene表示的是索引和搜索的单位,也就是说,建立索引,是以Document为单位的,搜索也是以Document为单位的。Document中有一堆的Field,我们可以把它们理解为Document中一个一个小节。有了Field,我们可以为Document添加一些属性,比如这里,我们就添加了路径(path)和内容(content)两个属性。这样,搜索之后,我们可以利用这些属性提供更多的信息,比如,告诉别人搜索的词出现在哪个文档中。

上面的代码中,我们可以清楚看到,建立Document,并向其中插入Field的过程。有了Document,我们就可以把它借助IndexWriter将它们写入索引中,至于最后的optimize,显然是为了让搜索更有效率而存在的。

有了索引,那就该进行下一步的工作,搜索。

import org.apache.lucene.document.Document;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.Hits;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.TermQuery;

public class Searcher {
    public static void main(String[] args) throws Exception {
        String type = "contents";
        String key = "game";
        String path = "index";
        
        IndexSearcher searcher = new IndexSearcher(path);
        Term t = new Term(type, key);
        Query query = new TermQuery(t);

        Hits hits = searcher.search(query);
        for(int i = 0; i < hits.length(); i++){
            Document document = hits.doc(i);
            System.out.println("File: " + document.get("path"));
        }
    }
}

IndexSearcher是用来在索引中进行搜索主要帮手,前提是我们要告诉它到索引在哪。Term表示文本中的一个词,它说明了我们要在哪个Field(type)中找什么(key)。然后,我们用Term做成一个Query,表示我们要进行搜索了。做好准备,接下来,就是搜索了。搜索的结果叫做Hits。遍历这个Hits,便可以将搜索结果一一展示出来。如前面所说,这里利用路径这个属性报告搜索的结果。

有了Lucene做基础,能做的事就很多了,比如搭建一个搜索引擎。事实上,已经有了这样的开源项目,比如与Lucene同出一门的Nutch,比如比Nutch年纪更大的Compass


收藏到:Del.icio.us

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:17 开发工具:Windows软件安装工具Inno Setup» 天天红玉世界
Windows软件安装工具Inno Setup
  • 什么是Inno Setup
    • Inno Setup is a free installer for Windows programs.

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

Sun 06 January, 2008

Click here to bookmark this link.Channel Image21:21 爱,不会以表现决定价值» Suave's Blog
最近读了两本小巫的书,很多都是在睡前,马桶上,地铁里看的,通过发短信到饭否记了不少读书笔记。现在书读完了,把自己的记录也收集起来。 父母的职责是对孩子有用,而不要利用孩子...
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 Image17:39 2007» Suave's Blog
1月 - 家里添了新成员,一只可爱的雪纳瑞,我们给它取名叫特特,抱来的时候刚断奶,特小特逗特乖,第一个晚上就很自觉的睡在了我们给他准备的小垫子上 2月 - 春节去了上海,开始住在哥...
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:07 Ruby语言:Ruby语言未来几个重要和可能的项目» 天天红玉世界
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:06 新年会» Matzにっき
近辺にいる親族が集まる。 私のうちで、という話もあったが、引っ越し後2ヶ月にもなるのに まだ箱だらけなので(私が年末まで忙しすぎて全然手伝わなかったのと、 年末来の風邪襲来のせいで手つかず)、 今回は妹のうちで。 私、妹1、弟1の家族で総勢、えーと、15名か。どんどん増えるな。 関東組(両親、妹2、弟2)は別で集まってるようだ。 大変にぎやかで、大変楽しかった。 また、妹の旦那が買ってきたモノポリーで遊んだのも 久しぶり。あんまり久しぶりすぎてルールを完全に忘れていた。
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Sat 05 January, 2008

Click here to bookmark this link.Channel Image16:41 This is the DANCING bone!» Projectionist
This is the DANCING bone!

A 3 year old holding up a model pelvis at the Providence Children’s Museum


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