Tue 08 January, 2008

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
“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. look up in del.icio.us.
add to furl
“ I have a prediction for 2008: you fail. ”
uncov
add to del.icio.us. look up in del.icio.us.
add to furlMon 07 January, 2008

add to del.icio.us. look up in del.icio.us.
add to furl
Found via Boing-boing : You Sucjk at Photoshop
Educational and damn funny.
add to del.icio.us. look up in del.icio.us.
add to furl
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. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
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。
add to del.icio.us. look up in del.icio.us.
add to furl

- 什么是Inno Setup
- Inno Setup is a free installer for Windows programs.
add to del.icio.us. look up in del.icio.us.
add to furlSun 06 January, 2008

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

- Ruby语言未来十个重要工具
- http://rubini.us/
- Ruby语言进入商业领域的重要项目。
- http://merbivore.com/
- Rails框架的最具有竞争力的项目。
- http://www.malline.org/
- Rails框架的视图需要使用纯Ruby的DSL框架,而不是ERB和其它新语言的DSL框架。
- http://swiby.codehaus.org/
- 一个基于 Swing 的未来Ruby语言桌面应用软件框架。
- Glimmer
- 一个基于 SWT 的未来Ruby语言桌面应用软件框架。
- JRuby on Android
- 在Android系统上实现JRuby语言程序的运行。
- http://rubini.us/
- 参考资料
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 furlSat 05 January, 2008

add to del.icio.us. look up in del.icio.us.
add to furl
“ 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. look up in del.icio.us.
add to furl
I Want You (Remix)
Lloyd feat. Nas & Andre 3000
add to del.icio.us. look up in del.icio.us.
add to furl

- 说明
- 下面三个项目都是在Rubyy语言中使用Erlang语言的功能。
- 项目RBridge
- 参考资料:
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 furlFri 04 January, 2008

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

- 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. look up in del.icio.us.
add to furlThu 03 January, 2008

如果真的有机会和高手一起工作,有时,你会发现,从具体做的事来说,这些高手做的事并不像想象的那么高深,甚至可以说很简单,简单到换了谁都能做。于是,心中的高手形象逐渐开始动摇,难道令N多人景仰的高手就是这个样子。
不知道你有没有想过这样一个问题,同样的事,如果没有高手的参与,换你来做,结果会怎样呢?
老大给我讲了一个他当年和Ward Cunningham在一起工作的故事。每天做的工作就是日常的测试驱动开发,写测试、写代码,所有的一切都是异常简单,下午从不会耽误喝咖啡的时间,到点也就正常下班。一个月后,要做的事情做完了,没有觉得有什么特别之处。不过,回想了一个月前对于这个项目的看法,老大突然发现,这一个月里原来做了许多事情:一个月前,他还觉得这是一项不可能完成的工作。
我最近的一个项目里,和我一起工作的是有我们中国区的CTO。这个项目的前期是一个类似于可行性论证的工作,项目最初,他为整个项目的结构订下了一个基调,让整个项目的结构显得特别清晰,准确的说,应该是很简单,简单到让人觉得理所当然。单从工作的具体内容来看,他并没有在这个项目里面做太多的事情,但从另外一个层面来说,正是他做的前期所做的工作,让后面的工作变得容易了许多。
这么一说,是不是有一种高手形象顿失的感觉。其实,高手通常不会觉得自己是高手。多年积累下的,只是良好的工作习惯而已。他们知道,自己是普通人,自己不能应付过于复杂的东西,于是,把自己要做的事分解成一些非常简单的小事。只要把这些微不足道的小事做好了,所谓的大事便也做成了。
我很喜欢读的书中,有几本书出自贝尔实验室,比如《程序设计实践》、《Unix编程环境》、《C程序设计语言》等等,每一本都是那么轻薄。这些书里面的内容读起来都是那么轻松,每一步做的事都让人觉得太过简单,但回过头来,可能你才发现,原来一些貌似很复杂的工作已经完成了。
曾有一段时间,我一直觉得自己掌握的东西不够复杂,为此,我总是惴惴不安。后来发现,但凡我学过的东西本质上都很简单,于是我想,到底怎么才能让自己复杂起来。读过那几本书之后,我释然了:做事本就该是做简单的事。如果你觉得复杂,多半是走错了路。
与高手共事,技术之外的东西,也许更值得学习。
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
结果发现有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. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furlWed 02 January, 2008

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

- 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. look up in del.icio.us.
add to furl
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. look up in del.icio.us.
add to furlTue 01 January, 2008

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

