123
 123

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 Image14:19 Twitter Updates for 2008-01-07» halostatue
brown rice risotto was excellent # @twistedchick it takes about twice as long as normal and needs another two cups of water. # @twistedchick it was otherwise normal brown rice. it took about 9c of liquid (7c broth, 2c wine), instead of 7c (6c b, 1c w) # @danielpunkass @bynkii I see worse from other folks all the [...]
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 Image14:14 Twitter Updates for 2008-01-06» halostatue
@rubyist can’t do it. it’s not vegetarian. # @rubyist i could make it for myself (sans fishy stuff), but the wife can’t have the tomatoes (arthritis) and doesn’t like olives. # I know. I don’t understand not liking olives, either. # why is quicksilver showing in the dock now that I’m on Leopard? # @jamis what’s the version and [...]
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 Image15:20 Twitter Updates for 2008-01-05» halostatue
@danielpunkass come to Toronto. I’ll be happy to provide you with good vegetarian eats. (I’m one myself) # @danbenjamin you can get out of it by filling it out. doesn’t mean that your answers have to be truthful. just that you have to fill it out. # @bitsweat Ryan Davis has a simplified version of it [...]
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:53 Twitter Updates for 2008-01-04» halostatue
@danwood aren’t those mutually exclusive requirements for a candidate? sadly? # @chartier not customizable enough. 40404 only works for USAians. it’s 21212 here in the Great White North # lazytwitter: can someone please try to add a comment to my blog to let me know if something’s broken with the comments? # @lylejohnson dammit. could you try again, [...]
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 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
Click here to bookmark this link.Channel Image16:38 I Want You (Remix) by Lloyd...» Projectionist
Click here to bookmark this link.Channel Image05:17 New Year’s Goals» Lovable Lyle
I’m not going to call them resolutions, because that implies a bit too much of a commitment, but I’ve been thinking about some of the techie goals that I have for this year. First, the obvious one. My goal (and my publisher’s “goal”, if you want to call it that) is to get the book finished. [...]
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:08 Would you like to be a reviewer?» Lovable Lyle
Some of you may know that I’m writing a book about FXRuby for the Pragmatic Bookshelf. I’m almost finished with the first draft, and I’m looking for some volunteers to review the book. Specifically, I’m looking for people to go over the book with a fine toothed comb, looking for inconsistencies, things that are confusing [...]
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Fri 04 January, 2008

Click here to bookmark this link.Channel Image15:12 Twitter Updates for 2008-01-03» halostatue
@bynkii idiotic judge. # Good to know that Zed’s in his usual form…and still can’t spell worth shit. # More to the point, I’ve been validated … Zed hates me. Means that I’ve pointed out his bullshit in the past and he doesn’t like that. # Not feeling good today. Working (a little) from home. # @chartier wouldn’t the [...]
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:01 取舍对话» 动态感觉 静观其变
今天hgf和我聊了一下django,他用ror的,想了解一下django的近况,我们就一些话题多说了几句,我觉得挺有趣,征得他的同意,放出来和大家共享一下。

[09:44] big student:
django现在到底发展到什么程度了
[09:44] 2008新年好: 你想要它发展到什么程度,呵呵
[09:46] big student: 看,我的预言没错吧还出不来1.0
[09:47] 2008新年好: 还语言什么,人家还想直接蹦到2.0呢
[09:47] big student: 呵呵
[09:47] 2008新年好: 很多人提出反对意见
[09:47] big student: 什么意思
[09:47] 2008新年好: 不同意版本跳的太快
[09:48] 2008新年好: 实际svn版本已经非常好
[09:48] 2008新年好: 因为他们是用branches来处理很多分支
[09:48] 2008新年好: 再合并到trunk
[09:49] 2008新年好: 所以svn版,是一个可以实用的版本
[09:49] big student: 开发效率快不快,和ror比
[09:49] 2008新年好: 只不过又是应用代码要改一下而已,也就是有重大改变的时候
[09:50] big student: ror社区也在闹,ror2.0都跟不上了
[09:50] big student: nnd
[09:50] 2008新年好: 我不能说比较的事,我只能说django是以一种清晰的处理,简单的处理,进入web设计,而不是隐藏很多,然后要挖掘一堆的,才能弄清楚的那种
[09:51] big student: 呵呵
[09:52] 2008新年好: 因为我也喜欢ror,并不是排斥它,呵呵
[09:52] big student: 纵向比一下,django和pylons你怎么看
[09:52] 2008新年好: 只是我现在没有再弄ror了
[09:52] 2008新年好: pylons和ror走的路数是一样的
[09:53] big student: 那django呢
[09:53] 2008新年好: 它的哲学要弄清楚,清楚了这个,就能理解django为何变得这样,好像和一般意义的框架不同
[09:53] 2008新年好: 这点很有趣
[09:54] big student: 他的哲学是什么样子的,有什么不同呢
[09:54] 2008新年好: guido几次推荐django,是有暗合之意的
[09:55] 2008新年好: 哲学上的不是一句两句就能说清楚的
[09:55] 2008新年好: 你要自己体会
[09:55] 2008新年好: 有一点
[09:55] 2008新年好: 我可以说说
[09:55] big student: 俺日,你的理解讲一下了,省的俺走弯路
[09:56] 2008新年好: 就是在用django时,它是对采用其他的技术是不排斥的,也就是用其他的技术不是坏事,是一种更能组合有效的资源的做法
[09:57] 2008新年好: 比如javascript/sql之类的
[09:57] 2008新年好: 这点上,很多人都给ror,java迷惑了,呵呵
[09:58] big student: active_record用起来也不错啊,他也不排斥啊
[09:58] big student: 怎么能说法一个用ror的人用django
[09:59] 2008新年好: ar不是标准,它有它的路数
[09:59] 2008新年好: django orm也有它的路数
[09:59] 2008新年好: 可能django orm没有ar方便,但这并不能说明django orm比ar差很多
[10:01] 2008新年好: 只不过程序员有中情结,就是什么都要用一种锤子来敲打
[10:02] 2008新年好: 实际上可以不同东西用不同锤子来打的
[10:02] big student:
[10:03] big student: 那你用过python和ruby,你觉的哪种语言更舒服
[10:03] 2008新年好: 我更喜欢py一些
[10:03] big student: why
[10:03] 2008新年好: 这没有什么why
[10:03] 2008新年好: 个人的机缘不同
[10:04] big student: 有一腚的道理
[10:04] big student: python社区看起来比较强大
[10:06] 2008新年好: ror的社区也不弱啊
[10:06] big student: 国内不显
[10:06] 2008新年好: 那都一样
[10:06] big student: 国外是很强,互联网创业公司一水用ror
[10:07] 2008新年好: 不见得
[10:07] big student:
[10:07] big student: 你是讲django的体系结构比较清晰是吗
[10:07] big student: 便于理解?
[10:08] 2008新年好: 实际上你待在一个社区越久,就会产生一种依赖
[10:08] 2008新年好: 什么消息都是这个社区的
[10:09] 2008新年好: 别的社区的消息相对要少很多
[10:09] 2008新年好: 所以会觉得自己待的社区很好
[10:09] 2008新年好: 别的都不行
[10:09] 2008新年好: 这是一种错觉
[10:09] big student: 呵呵,没觉的
[10:09] 2008新年好: 你有,我也有
[10:10] 2008新年好: 所以这种比较,是不太公平的
[10:10] big student: 我是吃碗看锅
[10:10] 2008新年好: 比如我用django时间长了,自然熟悉里面的路数
[10:10] 2008新年好: 然后我可能会说结构清晰
[10:11] 2008新年好: 你用ror长,熟悉ror的路数,你也会说,看,ror多好,mvc很清楚,该做什么一目了然
[10:11] 2008新年好: 哈哈
[10:12] big student: 取舍
[10:23] 2008新年好: django的创建者,最近有个访谈
[10:23] 2008新年好: 你看看
[10:23] 2008新年好: 他很有意思,很多主持人想挑起争论,都给他化解了
[10:23] 2008新年好: 你看看他的说法,很有趣
[10:23] big student: 有中文吗
[10:24] big student: 什么说法
[10:24] 2008新年好:
[10:24] 2008新年好: 你自己看吧
[10:24] big student: 地址给我
[10:25] 2008新年好: http://www.akitaonrails.com/2008/1/1/chatting-with-adrian-holovaty...
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 Image06:55 Ruby语言:Ruby语言2007年最好的个人博客RSS» 天天红玉世界
Ruby语言2007年最好的个人博客RSS
  • Ruby语言2007年最好的个人博客
    • http://feeds.feedburner.com/nubyonrails
    • http://feeds.feedburner.com/errtheblog
    • http://feeds.feedburner.com/RidingRails
    • http://feeds.feedburner.com/buckblog
    • http://feeds.feedburner.com/LoudThinking
    • http://feeds.feedburner.com/MyConfPlan
    • http://www.oreillynet.com/ruby/blog/index.xml
    • http://eigenclass.org/hiki.rb?c=rss;format=1;tags=blog

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

Thu 03 January, 2008

Click here to bookmark this link.Channel Image22:40 与高手共事» 梦想风暴
大多数人都愿意与高手共事,因为他们指望着从高手身上可以学到很多东西。在ThoughtWorks,因为要pair,所以,我们可以有更多的机会与高手近距离一起工作。

如果真的有机会和高手一起工作,有时,你会发现,从具体做的事来说,这些高手做的事并不像想象的那么高深,甚至可以说很简单,简单到换了谁都能做。于是,心中的高手形象逐渐开始动摇,难道令N多人景仰的高手就是这个样子。

不知道你有没有想过这样一个问题,同样的事,如果没有高手的参与,换你来做,结果会怎样呢?

老大给我讲了一个他当年和Ward Cunningham在一起工作的故事。每天做的工作就是日常的测试驱动开发,写测试、写代码,所有的一切都是异常简单,下午从不会耽误喝咖啡的时间,到点也就正常下班。一个月后,要做的事情做完了,没有觉得有什么特别之处。不过,回想了一个月前对于这个项目的看法,老大突然发现,这一个月里原来做了许多事情:一个月前,他还觉得这是一项不可能完成的工作。

我最近的一个项目里,和我一起工作的是有我们中国区的CTO。这个项目的前期是一个类似于可行性论证的工作,项目最初,他为整个项目的结构订下了一个基调,让整个项目的结构显得特别清晰,准确的说,应该是很简单,简单到让人觉得理所当然。单从工作的具体内容来看,他并没有在这个项目里面做太多的事情,但从另外一个层面来说,正是他做的前期所做的工作,让后面的工作变得容易了许多。

这么一说,是不是有一种高手形象顿失的感觉。其实,高手通常不会觉得自己是高手。多年积累下的,只是良好的工作习惯而已。他们知道,自己是普通人,自己不能应付过于复杂的东西,于是,把自己要做的事分解成一些非常简单的小事。只要把这些微不足道的小事做好了,所谓的大事便也做成了。

我很喜欢读的书中,有几本书出自贝尔实验室,比如《程序设计实践》、《Unix编程环境》、《C程序设计语言》等等,每一本都是那么轻薄。这些书里面的内容读起来都是那么轻松,每一步做的事都让人觉得太过简单,但回过头来,可能你才发现,原来一些貌似很复杂的工作已经完成了。

曾有一段时间,我一直觉得自己掌握的东西不够复杂,为此,我总是惴惴不安。后来发现,但凡我学过的东西本质上都很简单,于是我想,到底怎么才能让自己复杂起来。读过那几本书之后,我释然了:做事本就该是做简单的事。如果你觉得复杂,多半是走错了路。

与高手共事,技术之外的东西,也许更值得学习。


收藏到: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 Image20:35 Twitter Updates for 2008-01-02» halostatue
@jamis curious: why? # @wyhaines It’s our main explort. Cold Air Dumping, you know. # @BWJones I don’t agree. They’re claiming that 70% of the ingredients are organic, but can’t (or won’t) get the rest organic (yet). # @mjtsai do you get support emails that say "grrr"? ;) # moving slow this morning. enjoying Terry Goodkind entirely too [...]
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:35 Twitter Updates for 2008-01-02» halostatue
@jamis curious: why? # @wyhaines It’s our main explort. Cold Air Dumping, you know. # @BWJones I don’t agree. They’re claiming that 70% of the ingredients are organic, but can’t (or won’t) get the rest organic (yet). # @mjtsai do you get support emails that say "grrr"? ;) # moving slow this morning. enjoying Terry Goodkind entirely too [...]
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 Image15:01 视频到底有多好玩» 动态感觉 静观其变
最近看到一个网站,很想知道后面的技术是什么,开始只知道它是用django做的,但是关于在网页中视频对话那一块的技术,自己也从来没有接触过。然后就开始漫天黑地的找呗。
结果发现有red5可用rtmp server,不过它的资料很少,更主要的是red5是用java写的,虽说客户端不用搭理java,可毕竟要麻烦写。不过自从发现了一个小家伙后,我就没有再碰red5了。
这个非常小的rtmp server就是haxevideo,也许你没有听过haxe,这是什么呢?这是一个用来创建flash swf的漂亮工具,是一个编译器。有了它,你可以用不着flash cs之类的大软件。在linux/win/mac下都能用程序来控制swf。但真的要用好它,必须熟悉flash api,actionscript 3.0又是学习flash的必备品。幸好haxe和as3之间相差不大。haxevideo的rmtp server这一块用haxe编译成neko的是服务端的程序。haxe还能用来编写javascript的,可以说他是一个超强的后端,前端一起抓的能手。
不懂没关系,只要先熟悉haxe编写flash程序就行了。

我先把我试的画中画效果的例子,弄一弄,看看效果吧。



代码放在这备查了:

import flash.display.Sprite;
import flash.media.Camera;
import flash.display.MovieClip;
import flash.media.Microphone;
import flash.net.NetConnection;
import flash.media.Video;

class Test8 extends MovieClip {
  var video : Video;
  var video2 : Video;
  var cam : Camera;
  var mic : Microphone;
  var nc : flash.net.NetConnection;
  var ns : flash.net.NetStream;
  static var ct;
  var file : String;
  var share : String;

  static function main() {
    flash.net.NetConnection.defaultObjectEncoding = flash.net.ObjectEncoding.AMF0;
    var mc = flash.Lib.current;
    var st = mc.stage;
    ct = new Test8("rtmp://localhost", "record.flv", "mywebcam");
    ct.width = st.stageWidth;
    ct.height = st.stageHeight - 20;
    ct.y = 20;
    mc.addChild(ct);
  }
  function new(host, file, ?share) {
    super();
    this.file = file;
    this.share = share;
    video = new Video(Std.int(width), Std.int(height));
    video2 = new Video(50, 70);
    video2.scaleX = 0.15;
    video2.scaleY = 0.15;
    video2.y = 150;
    addChild(video);
    addChild(video2);
    cam = Camera.getCamera();
    cam.setMode(400, 300, 24);
    cam.setQuality(10240, 800);
    mic = Microphone.getMicrophone();
    if( cam == null )
      throw "webcam not found";
    nc = new NetConnection();
    nc.addEventListener(flash.events.NetStatusEvent.NET_STATUS, onEvent);
    nc.connect(host);
  }

  function onEvent(e) {
    trace(e.info);
    if( e.info.code == "NetConnection.Connect.Success" ) {
      ns = new flash.net.NetStream(nc);
      ns.addEventListener(flash.events.NetStatusEvent.NET_STATUS, onEvent);
      this.stage.addEventListener(flash.events.KeyboardEvent.KEY_DOWN, onKey);
      ns.attachCamera(cam);
      ns.attachAudio(mic);
      video.attachCamera(cam);
      video2.attachCamera(cam);
      ns.publish(file, share);
    }
  }
  function onKey( e : flash.events.KeyboardEvent ) {
        ns.send("onMetaData",{ keypress : e.keyCode });
    }
}

然后把haxe -swf test8.swf -main Test8 -swf-version 9,编译成test8.swf,再用neko把haxevideo的rtmp server启动,

<object    classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
        width="400"
    height="300"
    id="haxe"
    align="middle">
<param name="movie" value="Test8.swf"/>
<param name="allowScriptAccess" value="always" />
<param name="quality" value="high" />
<param name="scale" value="noscale" />
<param name="salign" value="lt" />
<param name="bgcolor" value="#ffffff"/>
<embed src="Test8.swf"
       bgcolor="#ffffff"
       width="400"
       height="300"
       name="haxe"
       quality="high"
       align="middle"
       allowScriptAccess="always"
       type="application/x-shockwave-flash"
       pluginspage="http://www.macromedia.com/go/getflashplayer"
/>
</object>

<p>
    If you don't see the SWF, check that you have Flash Player 9 installed.
</p>

<p>
    If the flash player can't connect to the server, please allow it to do so by using the
    <a href="http://www.macromedia.com/support/
          documentation/en/flashplayer/help/settings_manager04.html">
          Flash Security Manager</a>.
</p>

注意页面的最后这个,如果脱离web server来访问的话,就要设置访问的路径。如果采用web server来访问就不用了。试试这个小玩意吧,我会继续。。。

注解:haxe是用另外一个语言编写的,你猜猜吧,反正不是python,也不是c/c++,更不是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:07 IronRuby vs. Ruby.NET?» John Lam on Software
In the spirit of Jon Udell's Principle of Keystroke Conservation, I'm posting a follow-up to M. David Peterson's write-up on the differences between Ruby.NET and IronRuby here. David observes correctly that the key difference between the two implementations is IronRuby's...
add to del.icio.us add to del.icio.us. look up in del.icio.us.   add to furl.net add to furl

Wed 02 January, 2008

Click here to bookmark this link.Channel Image13:41 Twitter Updates for 2008-01-01» halostatue
@ejacqui I think C’s the best, but B or D is probably Classic NYE ;) # Thai Queen service sucked tonight — @the Dark Horse for the rest of the evening # moved to the Fox & Fiddle, where I’m suffering karaoke –"Low Places"was last # the songs aren’t good when Garth Brooks warbles them — save 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 Image10:11 Ruby语言:Ruby语言2007年最好的综合博客feed» 天天红玉世界
Ruby语言2007年最好的综合博客feed
  • Ruby语言2007年最好的综合博客feed
  • Ruby语言2007年混合博客
    • http://reddit.com/search?q=ruby
    • http://planets.sun.com/Ruby/group/blogs/
    • http://www.planetrubyonrails.org
    • http://rubycorner.com/
    • http://www.swik.net/Ruby
    • http://blog.caboo.se/
    • http://www.planetrubyonrails.com/

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:11 Unsubscribing ruby-talk» chris blogs
To: ruby-talk-ctl@ruby-lang.org
Subject: unsubscribe
From: Christian Neukirchen <chneukirchen@gmail.com>

I finally got around unsubscribing ruby-talk, which has a feeling of both pity and relief. I didn’t read it for the last months, and only skimmed the overgrowing thread list. There was no way to keep up.

What I don’t want to miss are the software announces, therefore I set up a quick’n’dirty RSS feed to keep me up to date.

It’s been over three years and more than 800 messages. See you somewhere else.

(Of course, I’ll continue to post my ANN’s there.)

NP: Morcheeba—Fear and Love


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

Tue 01 January, 2008

Click here to bookmark this link.Channel Image23:45 年賀状» 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 Image23:45 ゴビウス» Matzにっき
で、あまりにもなにもしない正月というのも寂しいので、 小豆雑煮*1を食べて、 近くの水族館(ゴビウス)に出かける。 子供が大きくなると一緒に活動することが少なくなるので、 末娘はこの施設は初めて。 今回も妻と長女は留守番ということになった。 途中、寒かったけど、行った人たちは結構楽しんでたみたい。 私はオオサンショウウオが良かった。 これって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 Image23:45 ZSFA -- Rails Is A Ghetto» Matzにっき
高速HTTPサーバMongrelの作者であるZed Shawが、 Ruby(やRails)を離れて、LuaやPythonやFactorに移ろうか、という話。 要するに みんな、俺の方が間違ってる、とか言ってたけど、 結局、いつも俺の方が正しかったじゃないか。 お前らみたいにコンピュータサイエンスのサの字も知らない、知ろうとしない 連中と付き合うのはもうまっぴらだ。 とかいうことみたい。 かなりキツい口調なので、読むのが辛いんだけど、 あまり知識(とか技術)がない人がなだれこんでくる弊害のようなものに 対する警鐘として読むと、価値を見いだすことができる、..
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 Image19:12 Yahoo Groups And the Hard Bounce» Joey Gibson's Blog

I've been a member of several groups at Yahoo! Groups since before Yahoo bought eGroups. That's quite a long time. At 06:30 this morning, I realized that I hadn't seen any email from any of those groups for a while. So I got up and checked and discovered what I knew I was going to see: email delivery to my address had been turned off since 12/15 because of a "hard bounce." This happens every month or so, and it's always the same thing:

Remote host said: 554 The message was rejected because it contains prohibited virus or spam content [BODY]
What that means is that someone (not me) sent an email containing a virus to one of the lists. The list then tried to deliver it to me, but my mail server rejected it. And Yahoo's list manager then interpreted that bounce as indicating that my email address won't accept email, and turned off all delivery to me. Does this make sense to you? Someone else sends a virus and my email gets turned off.

I actually think that both Yahoo Groups and my mail server share blame in this case. My mail server shouldn't bounce a virus-laden email, it should just quietly throw it away. It's not like anyone who intentionally sends a virus really needs to see the bounce message; they know what they're doing. And Yahoo Groups' server is too stupid to interpret the bounce message and quietly ignore it. Instead, it penalizes me. But what, exactly, is my mail server?

That question is interesting because I can't be sure whose mail server is the culprit. The reason is that there are three mail servers involved in sending me email. GoDaddy is my domain registrar, and therefore they maintain my MX records, and all my mail is first sent to them. I also have a SpamCop account. I have a forwarding address setup with GoDaddy that sends all email for me to SpamCop. SpamCop, once the email has been checked for spam, then forwards the email to my Gmail account. Since the bounce message that I'm allowed to see doesn't include any details, I don't know which server sent actually did the bouncing. Two days ago I stopped using my SpamCop account, so now I'm down to just GoDaddy's and Gmail's servers, and I'm hoping that the troublesome server belonged to SpamCop. If I get turned off again, I guess I'll know it wasn't.

It's very frustrating to get turned off like this, over and over, because of someone else's nefarious acts.


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