Source favicon23:02 MSNBC News @ Virtual Earth » Jan's Tech Blog
記得早前Jan介入過BBC NewsGlobe嗎?BBC就選了Google Earth作為新聞的新表達方式,那麼MSNBC當然就找MSN Virtual Earth做Partner吧。有興趣的話,可以看看這個MSNBC News在MSN Virtual Earth上的Demo吧。 [ via Scobleizer: Microsoft Geek Blogger ]...
Source favicon22:37 How the New York Times conducts an interview » Danwei RSS 1.0

How do western news organizations get such great quotes from their Chinese sources? Linghu Lei, creative director at New Weekly and founder of the online magazine Rocky Week (home of The iPod Times), describes a telephone interview he had with a New York Times reporter:

So this is how the New York Times conducts an interview

Unexpectedly, I received an interview call from the New York Times today. The theme was "How to you perceive the entrance of Vogue and other western fashion magazines into China?"

Reading the New York Times in the past, I had always felt that their reports were not only outstanding, but that the material and the reaction of the interviewee worked together to serve the content of the article - it's not easy to achieve this. When this kind of narrative + interview is written in the domestic media, you get answers to questions you haven't asked, or the answers the interviewee gives are not really in accordance the perspective and outlook you had planned for the article.

During the interview process today, the reporter from the New York Times first spoke a good deal about why he wanted to do the interview, and then after I had answered the first question, he said that he "identified" with my viewpoint and felt that it was "special." Then he said, "Your viewpoint is extremely close to what I want to communicate with in article," and wanted me to discuss it further. To express this identification that he felt toward my viewpoint, I elaborated on the point I had just mentioned in passing, and then expanded a bit on his viewpoint. Then he echoed my viewpoint. During this process of communication, the New York Times reporter always led me to understand that what I said was precisely what he needed for his article. My viewpoint supported his argument exactly. So unwittingly I became his news spokesperson. At the end, for the final question, the reporter summarized our entire "discussion" and asked me if I agreed - at this point, there was no way I could deny what I had just said, so - right, "that's correct."

The reporter seemed satisfied that he had obtained all of the viewpoints he needed for "the article he wanted to write," and he said "Thank you" and hung up. This, then, is a New York Times interview.

--written 12 September

See this and related posts at Language Log for a further analysis of the phenomenon.

Links and Sources
Source favicon21:53 Adsense減價? » Jan's Tech Blog
昨晚遊迪士尼回來,看到昨天有4.56美元的收入,感覺當然良好。於是就走入被窩,發其甜夢。但當再從被窩走出來時,卻發現收入只剩下3.80美元。而當「收市」前再看看價位,只有2.84。到底發生甚麼事呢? Jan已經發電郵給Adsense的管理人,但暫時仍未收到回覆。真的希望有一個令人滿意的回覆。...
Source favicon21:08 Yahoo Instant Search » WebLeOn's Blog
Instant Search是Yahoo!刚刚推出的搜索功能,它可以让用户更加快捷方便的得到所要查询的信息。



Instant Search在界面的实现方法上和Google Suggestion比较相近,都使用了类似AJAX的技术。在搜索框输入关键词的同时,会即时在下方出现与当前输入内容相关的内容。不过并不是所有的关键词都有即时搜索结果,Yahoo! Instant Search只支持一些特定的常用关键词以及Yahoo! Shortcuts中所提供的内容。



如果你喜欢这个功能,也可以把它直接添加Yahoo的主搜索引擎中。
Source favicon17:15 Beijing Media Top Stories: Hu Jintao and W.; China and Saudi basketball, bombs in Baghdad ... » Danwei RSS 1.0
BT050915S.jpg
The cover of Beijing Times features a picture of a basketball match between China and Saudi Arabia.

1. China's President Hu Jintao meets U.S. President George W. Bush in New York during the United Nations General Assembly meeting;

2. China's 'second-string' team overwhelms Saudi Arabia 98-10 in the semi-final of the Asian Men's Basketball Championships;

3. Insurgents launched at least a dozen suicide bombings that ripped through Baghdad in rapid succession on Wednesday, killing almost 150 people in a coordinated assault;

4. Three prime culprits who kidnapped Wu Ruopu, a well-known actor executed (for more about the kidnapping, see the botttom of this
Danwei post from 2004));

5. An accident on Beijing's North Forth Ring Road caused a six-hour-long traffic jam.

Source favicon16:49 网络创新应用选20050915 » 未完成 - Incomplete
有一个多月没有继续这个系列,主要是因为很多我看到的新服务都会有中文Blogger在第一时间介绍。这次选择的五个服务中有三个都与信息的智能化处理有关,另外两个分别是Web版开源“Outlook”与Blog信息追踪服务。 Findory:Findory的服务在Ken的Blog中有过简单的介绍。Findory提供的是个性化定制新闻或者Blog内容的服务,但与一般的用户挑选类别或者来源来定制自己的个性化页面不同的是,你只需要在Findory中点击阅读自己喜欢的内容,系统就会自动记录你的阅读习惯,并在首页上呈现系统为你推荐的新闻与Blog内容,你阅读得越多,系统对你的阅读习惯的分析越全面,就可能为你提供越准确的推荐内容。Findory的创办人Greg Linden是Amazon商品推荐引擎与个性化界面的主导开发者,因此Findory的推荐效果自然不俗。不过个人感觉Findory的界面还需要更好地优化。你同样不需要注册也一样可以使用Findory的服务,现在这种无需强制注册就可以让用户迅速体验的服务越来越多,是否也算是Web2.0类网站的特色之一。 SearchFox与Attensa:SearchFox也是Ken以前曾经介绍过的网站,但与Ken在blog中提到的社会性搜索引擎服务不同的是,在这里要介绍的是SearchFox正在内测阶段的在线RSS阅读器服务。面对RSS在线阅读器市场如此多而强大的竞争对手,SearchFox的特点在于智能化的RSS内容排列。它会根据你的阅读习惯以及对Blog的内容分析而将你最感兴趣的RSS内容排列在最前面,SearchFox表示用户使用一个星期后,他最感兴趣的50%的内容就会在首页呈现,使用两个星期后,准确率可以达到90%。智能化的RSS过滤应该会是RSS阅读软件未来竞争的重点方向之一,Attensa就是另外一个正在开发中,同样将重点放在RSS内容的智能化调整上的在线RSS阅读器(已提供outlook版阅读器)。根据介绍,Attensa应该是利用Attention的功能来记录用户的Feed订阅与删除、文章阅读、删除、标注tag等等行为来调整RSS内容的呈现顺序。 Zimbra:我想可以用使用Ajax技术的Web版开源的Outlook来形容Zimbra,Zimbra并不提供在线服务,所以如果你想使用Zimbra就需要下载Zimbra的代码并安装在自己的服务器上。但从它的Demo,我们已经可以体验到Zimbra强大的功能:类似Gmail的界面、类似Gmail的相关邮件聚合阅读方式,方便的邮件Tag和搜索功能,从邮件内容直接添加日程表,与GoogleMap、Skype、Alexa等第三方网站的集成服务等等功能,相信你体验过它的Demo后一定会被Zimbra所吸引。 Blogdex:之前在中文Blog圈中风行的怪癖病毒,keso认为用来追踪研究blog的传播特性实在是再好不过的机会。Blogdex就是一个专门跟踪Blog圈中的信息传播的网站,这个由MIT媒体实验室创建的项目已经运行了两年的时间,通过分析所追踪的Blog之间的相互链接关系得出Blog圈中的热门话题。比如今天进入Blogdex就会发现排名前三位的热门话题都是与Google的Blog搜索引擎有关的。发现与追踪Blog圈的热门话题相信也是Blog整个生态链中的重要一环,但Blogdex目前的技术、呈现方式等方面都还需要较大的改进。
Source favicon16:45 Flat Tire » Jeremy Zawodny's blog
On my way home tonight (well, last night technically--it's late) from the SDForum Audio Search event, I managed to get a flat tire in highway 87. I got off one exit short of the one I'd normally take to get home. A quick call to AAA yielded a tow truck 20 minutes later. Rather than tow me home so that I could deal with changing it in the daylight and out of the traffic (that was my plan), we moved...
Source favicon16:17 Google blog search » Tim Yang's Geek Blog

Hot news this week: Google has launched a blog search tool. I think we were always expecting a blog: operator for the regular Google search site, which I think I would have liked better. But Google decided to come up with a separate engine.

Source favicon16:17 SiteMaps:和Googlebot直接对话 » 车东[Blog^2]

昨天Google发布了BlogSearch
正确的提交自己的RSS还是要通过SiteMaps:

今天重新用了一下Google的SiteMaps网站:使用了一下提交网站认领(确认)功能。

具体信息如下:Googlebot要求你在网站的FEED目录下创建一个空文件名,比如:

确认网站: http://www.niernier.com/
Google 已经抓取了您的网站 http://www.niernier.com/ ,并将向您展示某些结果。然而,为确保我们不会将您网站的隐私信息透露给他人,我们需要确认您的所有权。

1. 创建一个确认文件

创建名为 GOOGLE1cd1cd73cbe423a2.html 的空文件。该文件使 Google 可以对您进行唯一确认。您可以在任何文本编辑器中创建该文件。该文件应为空,因为我们只是检查其是否与您的 Sitemaps 位于同一位置,而不会阅读其内容。 您可以在 此处阅读有关此文件的详细信息。
2. 上传确认文件

您创建确认文件后,放置在您服务器上的 http://www.niernier.com/。

确认状态: http://www.niernier.com/GOOGLE1cd1cd73cbe423a2.html 已确认 查看网站状态 »

« 返回我的 Sitemaps

在网站上touch这个文件后:GOOGLE1cd1cd73cbe423a2.html
点击“检查”Googlebot会立刻访问这个文件:记录到的日志如下
66.249.65.141 - - [15/Sep/2005:16:13:27 +0800] "HEAD /GOOGLE1cd1cd73cbe423a2.html HTTP/1.1" 200 0 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"

Googlebot真是够省的,连内容都不要,只要HEAD发现这个文件存在即可。
如果成功:这个网站是你的了!网站被认领的好处在于你可以看到Googlebot的访问日志:从而帮助你的网站进行死链检查。

比如我的网站的“ 统计信息”如下:

网站: http://www.chedong.com/blog/
在我们的常规抓取过程中发现的网址

作为我们常规抓取过程的一部分,我们一直在抓取您的网站。这包括来自您的网页以及其他网站网页的以下链接。 以下我们列出了在此抓取过程中无法访问的网址,以及解释我们为什么无法访问的链接。

网址 错误
http://www.chedong.com/blog/archives/000019.html HTTP 错误
http://www.chedong.com/blog/archives/000020.html HTTP 错误
http://www.chedong.com/blog/archives/000027.html HTTP 错误

Source favicon16:05 Instant Search Beta » Yahoo! Next
Why feel lucky when you can be right? With Instant Search, find the information you want -- without even hitting the search button. Results instantly appear for Yahoo! Shortcuts and common searches.
Source favicon15:49 有Blog在Google上查不到?用SiteMaps检查一下RSS » Che Dong's Photos

Che Dong posted a photo:

有Blog在Google上查不到?用SiteMaps检查一下RSS

昨天Google发布了Blog搜索:
google.com/blogsearch
如果发现自己的blog查不到,到Google的SiteMaps: www.google.com/webmasters/sitemaps/
上去检查一下:没错SiteMaps就是一个RSS的提交入口。

我发现我提交的RSS都能查的到,而查不到的 www.adayang.com 是Google同步失败的FEED,并非WordPress发布系统的问题。

其实Blog搜索的关键还是RSS FEED的发现和同步,和传统的基于SPIDER的网页抓取分析相比,基于RSS的搜索引擎成本优势明显:
1 同步速度快:因为只需要同步RSS即可,减少了对网站的大量抓取,我看到很多RSS甚至是小时级别的同步抓取更新(从apache日志里也可以看到);
2 内容直达:通过RSS进行内容索引,减少了对索引页,专题目录页的抓取,便于用户直接找到具体的内容而不是内容入口页;
3 内容提取简单:因为RSS将标题/摘要已经提供了,避免了后台进行内容提取的工作,可以轻松的将和主题无关的导航,页头/页尾和广告过滤掉。

Source favicon15:18 Instant Search Gives You Instant Answers » Yahoo! Search blog
If search engines are so smart, why do they give you millions of results when you type in "boston weather"? Why even ten, for that matter? Why not just one? Or better yet, why not just tell me what the...
Source favicon13:19 Xinhua today: so gay » Danwei RSS 1.0
hu_bin.jpg
Hu Bin in a traditional Chinese mood

State-owned news agency Xinhua, already well-known for its sexy image galleries of women, is branching out into homoerotica. Xinhua's "Inner Mongolian Channel" published a set of photos of China's best-known male model, Hu Bin (胡兵).

The four-image series is titled Another set of alternative Hu Bin portraits: plums, orchids, bamboo and chrysanthemum added to the naked body strike the eyes. The image pictured here shows Hu Bin posing with plum blossoms.






Links and Sources

Source favicon12:18 电车男、群智的力量与TBE » 未完成 - Incomplete
虽然之前也从不同的渠道听说过“电车男”这个词,但却一直只是将它当作一部流行日剧的名字而没有太过关心,直到前两天在台湾的《e天下》杂志上看到有关电车男的报道才知道原来电车男其实是一个颇为Web2.0的故事。 先从cathome01上转个有关电车男的介绍: 「电车男」是去年4月发生在东京的一个真实的故事,22岁的「电车男」每天坐着同样线路的电车上下班,他痴迷于计算机游戏,不善与人交往,也从来没跟女孩子接触过,只是偶尔会去日本最大的BBS网站“2频道”上留言,写写无聊的日记打发时间。 有一天返家途中,“电车男”看到车厢里有个醉醺醺的老头正在骚扰一位姑娘,他鼓足勇气上前伸张正义。回家后,他把这件事情写在了“2频道”中一个名为“没女人缘的男人”的留言板上。打那以后响应“电车男”的留言迅速暴增,在热心网友们的鼓励、帮助下,他向那位姑娘表白了自己的爱情,最后有情人终于走到了一起。 去年10月,向来以标新立异著称的日本出版界大腕新潮社将BBS上的原始对话内容集结成册,于是就有了眼下这本引得年轻人趋之若鹜的「电车男」。单行本面世仅仅3天,就增印了4次,订货量高达12.5万册,连美联社也发专文报道了该书热卖的盛况。 而不仅仅如此,电车男的故事随后还被改变成电影、日剧、漫画、舞台剧等等,据e天下报道,电车男共引发了高达60亿日元的商机。而这一切的内容都原生自2ch中的用户,他们建议电车男改变邋遢的外型,指点他见面如何措词,也有许多女网友从女性的观点提出自己的建议,普通的网络用户们用自己的知识与智慧让电车男迈向自己的爱情,这应该可以算是群众的智慧(Wisdom of Crowds)在现实中的一个绝佳例子。 但群众的智慧并不总是那么能够发挥效力的。TBE是我之前介绍过的一个实践群众智慧的项目,但进展却并没有想象中的那么顺利。TBE的发起人Robert May在Blog中总结了到目前为止所得到的一些经验。参与TBE显然要比给电车男出主意复杂得多,TBE前期一直在讨论与选择项目的方向,参与者需要花费不少的时间去仔细阅读每个选项的内容并考虑哪个更适合于TBE,到了后期,还需要参与者去编写以及增补每个选项的商业计划书的内容。 显然这样的高门槛限制了不少人的参与,但这并非关键。Robert为了让项目更吸引用户,让他们有更多的贡献,特意准备在日后拿出项目的股权分配给参与人,但经过一段时间的实践,Robert发现其实有许多用户只是简单地参与投票,而从不参与讨论或作其他贡献,他们或许只是想偶尔投几次票,日后就有机会获得一个成功项目的股权。而真正热心的参与者,积极贡献自己的智慧的用户其实依靠的是他们的热情而不是经济利益的刺激来参与的。 如何激发用户的热情,这不仅仅是TBE中,也是那些不断涌现的SNS以及Web2.0网站们需要正视的问题。只有那些热情的用户才会真正贡献群众的智慧,带来群智的力量。
Source favicon11:49 School's back in session; time for nude photography » Danwei RSS 1.0
JDM050915venus.jpg

It's the start of a new semester, and once again it's time to fret about the depravity of today's youth. Back in 2003, the shocking news was of a traveling photo exhibition whose models were all college students. Last year, people fretted about the morality of college women having nude photoshoots done.

Now this year, we find the letters sections of newspapers full of people discussing...the morality of college women having nude photoshoots done. Was last year's flap unresolved? Are colleges still shirking their responsibilities in loco parentis? Or should we simply be thankful that it's nothing worse this year, like the news that 20-30% of college women moonlight as working girls? (oh, wait, that idea was floated back in 2003 as well.)

A selection of letters printed in Beijing's Legal Mirror provides a nice cross-section of opinions - readers range from thinking that nude photography is unethical and unhealthy to simply worring that the young women will be taken advantage of (curiously, there has been no discussion of men doing these photo shoots...).

Gao Fusheng: Currently, the country's laws and regulations have a "blind spot" in regard to oversight of this new practice of "fully nude photography," and there is no clear line marking the "degree of exposure." That line is in the hands of the photographer doing the shoot. While there exists an unwritten rule in the profession that a male photographer must always have a female assistant present; i.e. the photographer must not come into contact with the nude subject at any time, so the female assistant must carry out the photographer's wishes; and the negatives are handed over to the subject at the same time as the photos. But are these "professional rules" effective?

If unlawful businessmen seize the opportunity to profit by copying and distributing large numbers of photograps, then what can be done? If these photos of "indecent exposure" are put to use by an unscrupulous minority, then the losers are those young college women themselves. Even if they try to protect their rights through legal means after the fact, getting proof is no easy matter!

Xu Linlin: I cannot readily agree with many of the misgivings people have. First, recognizing the beauty of a youthful body is an expression of self-confidence in one's life. The self-discovery of these young women is good, not harmful. Second, voluntarily having nude pictures taken has no connection with morality or the law. Third, as adult women, these college students surely know that nude photography is a closely private matter, and they know how to protect themselves against the unexpected.

But in my view, having nude photos taken is far from being a "symbol of fashion." College administrations and the parents of these women should stay on their toes, to prevent these young women from being unwittingly led astray and bringing trouble onto themselves.

Yin Jianguang: Having nude photos taken is without a doubt a precursor to having one's rights infringed. And if the photos are let out, there is no way to repair the harm done to you even if you pursue legal compensation. Besides, this is an unhealthy outlook on consumer fashion. Every penny that students spend was earned through their parents hard labor, so they shouldn't waste it in this manner.

This kind of "popularity" reflects the fact that educational activities are not making a deep impression in the minds of students. Behind this fashion is an expression of a sense of spiritual beauty that is left unsatisfied.

Links and Sources
Source favicon11:40 单页面应用程序(Single Page Application) » Andy's blog

最近习惯先写主题,然后再慢慢完善:)

单页面应用程序(Single Page Application)是只有一个页面Web应用程序。WikiPedia上这样描述的

A single page application (SPA) is a web application that runs entirely in the client web browser, typically using a combination of HTML, JavaScript, and CSS. The application modifies the web page's own data structures through its DOM tree, and makes its changes persistent when the user invokes the browser's Save Page command to save the (modified) web page to disk.

举几个例子吧:

Source favicon11:35 Weka 3 - Data Mining with Open Source Machine Learning Software in Java » del.icio.us/chedong
Weka 3: Data Mining Software in Java
Source favicon11:24 Adding a few sprinkles » Google Blog




We launched our first version of the Google personalized homepage in May. It started as a project on Google Labs in response to numerous requests from people who wanted to add at-a-glance info by the Google search box. Today we're thrilled to "graduate" from Labs and add a Personalized Home link on the Google homepage. Though we realize that many love the vanilla Google, there are those who might want to add a few sprinkles.
Source favicon09:35 用Java进行基于浏览器的桌面应用程序开发(Browser-based desktop application development with java) » Andy's blog

作者:Andy(http://blog.xintiantang.com/andy),版权所有,转载请先联系我

这篇文章于2005/08/30 20:00开始,计划在一个月内完成,所以将会人工置顶。内容有点儿乱,先把想的和做的记下来,然后再慢慢整理。同时欢迎提出你的看法。更新记录:2005/08/30 20:00,2005/08/31 14:45,2005/08/31 21:21,2005/09/01 16:24,2005/09/01 21:53,2005/09/02 22:13,2005/09/14 13:10,2005/09/15 09:35

对于普通用户来说,使用传统的桌面应用程序(可能采用不同语言和工具开发的)可能存在这样那样的限制,比如界面风格千变万化、操作习惯不统一、学习难度大、无法或很难和外部应用通信等。而传统的服务器端应用程序或网站也存在许多限制,比如网络连通可能出现问题、响应速度慢、不能保证服务器端始终可用、担心数据安全和个人隐私问题、不够灵活、使用不方便等。

 而基于浏览器的桌面应用程序正是综合桌面应用程序和服务器端应用程序的功能产生的。它包含以下优点:

基于浏览器的桌面应用程序(Browser-based desktop application)的定义:一个包含嵌入式网站服务器(Embedded web server)的能够在浏览器内的客户端的独立运行(Stand alone)的应用程序。

我把基于浏览器的桌面应用程序(Browser-based desktop application)简称为BBDA。其实BBDA和AJAX技术一样,也是一个buzzword,而不是什么新技术,只不过把几种通用的软件或技术组合在一起而已。和传统的重量级的Portal系统不同的是,BBDA是轻量级网络应用(Light weight web application),XML(Feed / RSS / XML-RPC / SOAP)是联系各个服务或应用的纽带。

其实,BBDA很符合目前热炒的WebOS(基于网络浏览器的操作系统)的特性,这方面Google做了个最好的Demo:Google Desktop, 在GD中,一切内容的表现都是网页(虽然隐藏了浏览器),并且很容易和Google网站进行通信(比如同时搜索本地和搜索Web,利用Feed(RSS)或XML-PRC或SOAP之类的协议读新闻、邮件、天气预报、股票行情等,微软该称RSS为Feed好像很有道理吧?)。现在GDS(Google Desktop Search)只是GD的一个模块而已,百度的桌面搜索只是单纯地模仿了GDS,却没有猜到原来Google是要做GD,好傻的百度。Google这几年的收购和挖人活动(Google Net, Google Browser等),看来一切都是为了WebOS而努力。这里顺便说一下Yahoo刚收购的Konfabulator,Konfabulator和GD有很大不同,我觉得它只是包含许多小软件或和网站交互的工具,只是个玩具箱而已,要做WebOS靠这个可以吗?看来Yahoo的眼光似乎始终不如Google。找到这篇文章:GoogleOS? YahooOS? MozillaOS? WebOS? 居然和我的想法如此相似(写这个之前我绝对没看过这篇文章)!

由于我主要做Java开发,所以只列出可能涉及的Java软件包:Browser(IE/FireFox), JDK, Tomcat/Jetty, HSQLDB/Apache Derby, Hibernate, Spring, Groovy, DOM4J,Apache Http Client, Lucene, Struts/WebWork/JSF/Tapestry/Wicket, DWR(AJAX), Apache Web Services(SOAP/XML-RPC), Apache POI(Word/Excel/ PDF), MP3 ID TAG 3 lib ,JPEG EXIF lib...

我的目的是组合几种通用的JAVA软件,用来进行快速的BBDA开发。对于开发者而言,只要选好合适的软件,并合理组合起来,完全可以达到或超过Ruby on rails的功能和开发效率。同时,对于普通用户而言,只要打开浏览器输入http://localhost就会进入Dashboard(ProtoPage是个很好的Prototype^_^,Start也不错),然后就可以管理日记(blog)、日历、通讯录、照片(flickr?)、音乐(itunes?)、文件、网摘(delicious?)、阅读订阅的RSS(bloglines?)、查看邮件(web mail)、新闻之类等,并可以进行搜索、共享、发布、与外部应用或网站同步等,构成一个完整的个人门户系统(Personal portal),XML(Feed / RSS / XML-RPC / SOAP)是联系各个服务或应用的纽带。

画了个草图(持续完善中):

Zoom in

关于嵌入式网站服务器(Embedded web server):

我这几天试用了Jetty和Tomcat。总以为Jetty很小呢,最适合做BBDA呢,结果发现软件包也很大了,另外很多功能不如Tomcat,Tomcat Embed 5.5由于使用Ecipse JDT,现在已经很小了(3M左右),而且标准,所以选了Tomcat Embed(这里下载)。下面的代码是Tomcat Embed的启动程序。

Start.java:

package com.terac.tomcat;
import java.net.InetAddress;
import java.net.UnknownHostException;
import org.apache.catalina.Context;
import org.apache.catalina.Engine;
import org.apache.catalina.Host;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.startup.Embedded;

public class Start {
 public static void main(String[] args) {
  try {
   String path = System.getProperty("SERVER_HOME");
   if(path!=null&&!"".equals(path)){    
    int port = Integer.parseInt(System.getProperty("SERVER_PORT","8080"));
    startTomcat(path,port);
   }   
  } catch (Exception e) {
   e.printStackTrace();
  }
 }
 private static void startTomcat(String path,int port) throws UnknownHostException,
   LifecycleException {
  System.setProperty("catalina.home", path);
  Embedded embedded = new Embedded();
  Engine engine = embedded.createEngine();
  engine.setName("Engine");
  Host host = embedded.createHost("localhost", "web");
  Context rootContext = embedded.createContext("", "");
  rootContext.setPrivileged(true);
  host.addChild(rootContext);
  engine.addChild(host);
  engine.setDefaultHost("localhost");
  embedded.addEngine(engine);
  Connector connector = embedded.createConnector((InetAddress) null,port, false);
  embedded.addConnector(connector);
  embedded.start();
 }
}

start.bat:

@set classpath=./lib/所有的jar文件
@java -DSERVER_HOME=%cd% -DSERVER_PORT=80 -classpath %classpath% com.terac.tomcat.Start

关于嵌入式数据库(Embeded database):

Apache Derby虽然比HSQLDB强大,但还是太大了,尤其是当用到IBM的JDBC Driver时。所以只好选HSQLDB。下面的代码是利用ServerContextListener在Web应用程序启动时启动HSQLDB服务器。

HSQLDBServletContextListener.java:

package com.terac.hsqldb;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

public class HSQLDBServletContextListener implements ServletContextListener {
 public void contextInitialized(ServletContextEvent evt) {
        try {
            ServletContext context = evt.getServletContext();
            String params = "port=9001;silent=true;trace=false;database.0=" +
                context.getRealPath("/") + "/WEB-INF/hsqldb/terac";
            org.hsqldb.Server server = new org.hsqldb.Server();
            server.putPropertiesFromString(params);
            server.setLogWriter(null);
            server.setErrWriter(null);
            server.start();
        } catch (Exception e) {
            System.err.println(e);
        }
    }
    public void contextDestroyed(ServletContextEvent evt) {
        Connection conn = null;
        try {
            Class.forName("org.hsqldb.jdbcDriver");
            conn = DriverManager.getConnection("jdbc:hsqldb:hsql://localhost:9001",
                    "sa", "123456");
            Statement stmt = conn.createStatement();
            stmt.executeUpdate("SHUTDOWN;");
        } catch (Exception e) {
            //
        }
    }
}

web.xml中需要加入listener:

com.terac.hsqldb.HSQLDBServletContextListener

关于全文检索引擎(Full text search engine):

Apache Lucene应用广泛,也足够强大,高亮显示(Highlighting)需要自己实现,自动摘要(autosummarize)需要Classifier4j 。下面是常用类的封装代码:

Indexer.java:

还未整理好

Searcher.java:

还未整理好

关于Shell:

有些时候,用户不满足已经有的服务,需要更灵活的、或者定制的功能,一个简单的、易学的、解释性的、交互式的Shell就显得很必要,比如Windows提供的cmd或Linux里的bash。研究了一下,发现Groovy正好能满足需要,“for (ch in "Hello world!") {println ch}”,这个稍微复杂点儿的Hello world很好懂吧?

关于时间服务(Time Service):

Windows里有计划任务(Schedule task),Linux里有Cron job,这个对于WebOS也是必须的,比如定时检查邮件,定时抓新闻等等都需要定时器(Timer),Spring framework封装了好几种Time service,足够了。

关于对象关系映射工具(OR mapping tools):

Hibernate是最常用最强大的工具。下面是Hibernate Session的封装代码(也可以利用Spring framework来管理):

HibernateUtil.java:

import net.sf.hibernate.HibernateException;
import net.sf.hibernate.SessionFactory;
import net.sf.hibernate.Session;
import net.sf.hibernate.cfg.Configuration;
import org.apache.log4j.Logger;

public class HibernateUtil {
 private static Log log = LogFactory.getLog(HibernateUtil.class); 
 public static final ThreadLocal threadSession = new ThreadLocal();
 private static final SessionFactory sessionFactory;
 static {
  try {
   sessionFactory = new Configuration().configure().buildSessionFactory();
  } catch (Throwable ex) {
   // We have to catch Throwable, otherwise we will miss
   // NoClassDefFoundError and other subclasses of Error
   log.error("Building SessionFactory failed.", ex);
   throw new ExceptionInInitializerError(ex);
  }
 }
    public static Session currentSession() throws HibernateException {       
        Session s = (Session) threadSession.get();
        if (s == null) {
            s = sessionFactory.openSession();
            threadSession.set(s);
        }
        return s;
    }
    public static void closeSession() throws HibernateException {
        Session s = (Session) session.get();
        session.set(null);
        if (s != null)
            s.close();
    }
}

关于模型-视图-控制框架(MVC framework):

现在的MVC framework太多了,传统的有Struts/WebWork,新的有JSF/Tapestry/Wicket/Flex&Laszlo(Flash RIA) ,Wicket网站列出了55种之多!我试过JSF,始终不能另我满意,正在研究WicketRIFE(这两个都支持AJAX),新加一个Stripes(采用Java 5 Annotations,所以不需要XML配置文件,非常简单)。

关于文件系统(File system):

Apache Commons Virtual File System - Commons VFS provides a single API for accessing various different file systems. It presents a uniform view of the files from various different sources, such as the files on local disk, on an HTTP server, or inside a Zip archive. 越来越好玩了:)

另外,发现在Windows系统下PHP5也可以在Tomcat下运行(Running php 5.x on windows using tomcat 4.x or 5.x - Simple Thoughts - Java and Web Software)。BBDA with PHP:),不知道PHP的基于文本的数据库都有哪些?我试了一下,phpinfo和一个简单的基于文本的PHP留言本可以使用,phpMyAdmin和几个PHP的blog不能运行,Tomcat直接Crash。

我已经把BBDA框架,以前写的一个非常简单的Struts/Hibernate单用户相册程序,还有一个基于文本的PHP留言本做好打包了,下载后解压缩就能用。(运行PHP需要设Path,整个软件包稍后提供)

Source favicon06:07 Citabria Lesson #3: Never Got Off The Ground » Jeremy Zawodny's blog
Today's flying lesson was.... short. It was decided that we'd take up 03G for some more spin training. I did the pre-flight, we pushed the plane out, got in, and I started the checklist. Everything was cool so I asked for ground clearance and was told to taxi to runway 32 Right. (Hey, I'm doing my own radio work now!) We arrived in the run up area and I did the pre-takeoff stuff. One of the final steps is the...
Source favicon03:04 超酷Microsoft相册:Max » WebLeOn's Blog
Microsoft Max

Microsoft Max是微软最新开发的图片管理及分享工具的代号,它使用了大量最新的技术,其界面效果和软件功能都令人眼前一亮。



Max和其它普通的图片管理软件一样,可以搜索、归档、管理电脑硬盘上的图片。除此以外,它还可以利用MSN Passport系统来远程同步本地的指定相册,与亲友分享图片。Microsoft Max所使用的技术包括微软的下一代应用程序接口WinFX以及super hot 3D Mantle View™。



Microsoft Max已经开始提供下载试用。不过,安装的系统要求不低,而且还需要最新版本的WinFX。当然,Max也有自己的Blog,你可以知道Max开发的最新进展。



不知道Max会单独发行还是集成在Windows Vista操作系统中,无论怎样,它对其它同类软件,甚至是图片分享在线服务都是一个有力的竞争者。Google的Picasa、Yahoo的Flickr和MS的Max,最后会由谁来执掌我们的图片呢?
Source favicon02:48 Google Blog Search » WebLeOn's Blog

不出所料,Google终于推出了Blog搜索引擎

MSN Search的Feed搜索选项比起来,Google Blog Search看起来更加像其它普通的Blog搜索引擎,用起来也方便很多。Google Blog Search的搜索结果支持RSS和Atom格式的输出。而且通过搜索参数,我们可以进行Blog标题、文章标题、文章作者、Blog地址的搜索。可惜的是,Google Blog Search目前索引的Blog数量只有800万(Technorati为1700万)。不过,它的索引速度非常快,用来追踪热点事件还是很不错的。

同时,Google也把这个搜索引擎置入了Blogger网站。你也可以在用户控制面板和Blogger Navbar进行搜索。

以Google的搜索技术和品牌效应,特别是它在Blogger中的高关注度,相信Google Blog Search会迅速成为最常用的Blog搜索引擎之一。在这样的情况下,2个月前就开始测试Blog Search的Yahoo应该也很快会开放Blog搜索引擎。
Source favicon02:01 Kingsoft attacks Microsoft: free download of Chinese equivalent to Microsoft Office » Danwei RSS 1.0
word_ha_ha.jpg
Looks like Word, works like Word, but it's free!

Would you like a legal working equivalent to Microsoft Office for free?

For the next 90 days or so, you can download a Chinese-made alternative to Microsoft's Office suite, for free. The download is only 15MB, and includes equivalents to Word, PowerPoint and Excel. The company offering the free software is Kingsoft, whose more poetic Chinese name is Gold Mountain (金山). Kingsoft's Office suite is named WPS Office.


The software is available in versions for both Windows and Linux. According to King Soft, this new release of WPS Office "is an overhaul of 5 million lines of code by 100 engineers over three years", with all the work done in China. The software is available for free for 100 days, after which it will be sold at prices designed not to compete with Microsoft Office, but with pirate versions of Microsoft Office.

There seem to be two main problems with Kingsoft's office suite:

- The menus are only available in Chinese, and there is no English spell check;
- The interface design is a clone of Microsoft Office's interface.

Problems aside, this is the the beginning of a trend that is going to make people in Seattle and Mountain View nervous. Just as the West Coast is getting used to the competition from India, cut-rate Chinese software, hand-coded in Beijing and Hangzhou, is going to present another challenge.

Links and Sources
Source favicon00:11 SDForum Audio Search Event at Yahoo Tonight » Jeremy Zawodny's blog
If you're into podcasting or audio search (and in the Bay Area), drop by Yahoo for the SDForum Audio Search event tonight. Join SDForum on Wed, 9/14 at Yahoo's headquarters in Sunnyvale for the inaugural Silicon Valley Search SIG, where our first meeting will be an overview of the audio search market and an in-depth look at podcasting startups, directiories, and tools. With the raging popularity of iTunes, the announcement of Yahoo Audio Search, and the sudden upsurge in podcasting...

^==Back Home: www.chedong.com

<== 2005-09-14

==> 2005-09-16