随笔 - 22  文章 - 17  trackbacks - 0
<2024年4月>
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

常用链接

留言簿(2)

随笔分类

随笔档案

文章档案

朋友的blog

搜索

  •  

最新评论

阅读排行榜

评论排行榜

今天拿到一个新键盘,真够有趣的,
中文键盘,好些键上面除了英文名,还有中文翻译,
比如Esc上面写推出,Tab上面写制表,Ctrl写控制,
Shift写上档,Alt是换档,Backspace是回格,哈哈,真够好玩的
posted @ 2005-12-05 15:59 femto 阅读(247) | 评论 (0)编辑 收藏
现在好像每个网站都有blog服务了拉,如雨后春笋一般.
推论一,一个推论,任何东西过多,最后的赢家都是搜索引擎
推论二,web1.0的时代是搜索引擎和网站双赢,那么web2.0时代就是搜索引擎和blogger双赢(当然还有BSP)
posted @ 2005-12-04 23:42 femto 阅读(196) | 评论 (0)编辑 收藏
试了一下,发现当结果网页带错误javascript的时候,httpunit就支持报错,
而jwebunit是对httpunit的封装,当然也通不过。
再试了htmlunit,也是一样报错,
看来只能用apache的httpclient了
posted @ 2005-11-23 00:15 femto 阅读(1338) | 评论 (2)编辑 收藏

People often criticize asynchronous messaging solutions as too complicated and cumbersome. Or, they believe distributed solutions cannot be successful unless they include a distributed transaction model. There is little doubt that asynchronous solutions require us to think in new ways as we have to deal with concurrency, out-of-sequence issues, correlation and other. However, the real world is full of examples of asynchronous processes that successfully with exactly the same issues. We don't have to go further than the local coffee shop...

Hotto Cocoa o Kudasai

I just returned from a 2 week trip to Japan. One of the more familiar sights was the ridiculous number of Starbucks (???????) coffee shops, especially around Shinjuku and Roppongi. While waiting for my "Hotto Cocoa" I started to think about how Starbucks processes drink orders. Starbucks, like most other businesses is primarily interested in maximizing throughput of orders. More orders equals more revenue. As a result they use asynchronous processing. When you place your order the cashier marks a coffee cup with your order and places it into the queue. The queue is quite literally a queue of coffee cups lined up on top of the espresso machine. This queue decouples cashier and barista and allows the cashier to keep taking orders even if the barista is backed up for a moment. It allows them to deploy multiple baristas in a Competing Consumer scenario if the store gets busy.

Correlation

By taking advantage of an asynchronous approach Starbucks also has to deal with the same challenges that asynchrony inherently brings. Take for example, correlation. Drink orders are not necessarily completed in the order they were placed. This can happen for two reasons. First, multiple baristas may be processing orders using different equipment. Blended drinks may take longer than a drip coffee. Second, baristas may make multiple drinks in one batch to optimize processing time. As a result, Starbucks has a correlation problem. Drinks are delivered out of sequence and need to be matched up to the correct customer. Starbucks solves the problem with the same "pattern" we use in messaging architectures -- they use a Correlation Identifier. In the US, most Starbucks use an explicit correlation identifier by writing your name on the cup and calling it out when the drink is complete. In other countries, you have to correlate by the type of drink.

Exception Handling

Exception handling in asynchronous messaging scenarios can be difficult. If the real world writes the best stories maybe we can learn something by watching how Starbucks deals with exceptions. What do they do if you can't pay? They will toss the drink if it has already been made or otherwise pull your cup from the "queue". If they deliver you a drink that is incorrect or nonsatisfactory they will remake it. If the machine breaks down and they cannot make your drink they will refund your money. Each of these scenarios describes a different, but common error handling strategy:

  • Write-off - This error handling strategy is the simplest of all: do nothing. Or discard what you have done. This might seem like a bad plan but in the reality of business this option might be acceptable. If the loss is small it might be more expensive to build an error correction solution than to just let things be. For example, I worked for a number of ISP providers who would chose this approach when there was an error in the billing / provisioning cycle. As a result, a customer might end up with active service but would not get billed. The revenue loss was small enough to allow the business to operate in this way. Periodically, they would run reconciliation reports to detect the "free" accounts and close them.
  • Retry - When some operations of a larger group (i.e. "transaction") fail, we have essentially two choices: undo the ones that are already done or retry the ones that failed. Retry is a plausible option if there is a realistic chance that the retry will actually succeed. For example, if a business rule is violated it is unlikely a retry will succeed. However, if an external system is not available a retry might well be successful. A special case is a retry with Idempotent Receiver. In this case we can simply retry all operations since the successful receivers will ignore duplicate messages.
  • Compensating Action - The last option is to undo operations that were already completed to put the system back into a consistent state. Such "compensating actions" work well for example if we deal with monetary systems where we can recredit money that has been debited.

All of these strategies are different than a two-phase commit that relies on separate prepare and execute steps. In the Starbucks example, a two-phase commit would equate to waiting at the cashier with the receipt and the money on the table until the drink is finished. Then, the drink would be added to the mix. Finally the money, receipt and drink would change hands in one swoop. Neither the cashier nor the customer would be able to leave until the "transaction" is completed. Using such a two-phase-commit approach would certainly kill Starbucks' business because the number of customers they can serve within a certain time interval would decrease dramatically. This is a good reminder that a two-phase-commit is can make life a lot simpler but it can also hurt the free flow of messages (and therefore the scalability) because it has to maintain stateful transaction resources across the flow of multiple, asynchronous actions.

Conversations

The coffee shop interaction is also a good example of a simple, but common Conversation pattern. The interaction between two parties (customer and coffee shop) consists of a short synchronous interaction (ordering and paying) and a longer, asynchronous interaction (making and receiving the drink). This type of conversation is quite common in purchasing scenarios. For example, when placing an order on Amazon the short synchronous interaction assigns an order number and all subsequent steps (charging credit card, packaging, shipping) are done asynchronously. You are notified via e-mail (asynchronous) when the additional steps complete. If anything goes wrong, Amazon usually compensates (refund to credit card) or retries (resend lost goods).

In summary we can see that the real world is often asynchronous. Our daily lives consists of many coordinated, but asynchronous interactions (reading and replying to e-mail, buying coffee etc). This means that an asynchronous messaging architecture can often be a natural way to model these types of interactions. It also means that often we can look at daily life to help design successful messaging solutions. Domo arigato gozaimasu!



About the author

Gregor Hohpe
Blog: http://www.enterpriseintegrationpatterns.com/ramblings.html

Gregor Hohpe leads the Enterprise Integration practice at ThoughtWorks, Inc., a specialized provider of application development and integration services. Gregor is a widely recognized thought leader on asynchronous messaging architectures and co-author of the seminal book "Enterprise Integration Patterns" (Addison-Wesley, 2004). Gregor speaks regularly at technical conferences around the world and maintains the Web site www.eaipatterns.com.
(from http://www.theserverside.net/blogs/showblog.tss?id=TwoPhaseCommit)
看完之后,第一就是佩服的作者的水平
第二就是对Enterprise Integration patterns这本书产生了兴趣
posted @ 2005-11-18 21:43 femto 阅读(796) | 评论 (0)编辑 收藏

Web 2.0 的课什么时候开呀?

昨天在复旦,谈起Web 2.0。问我怎么看。我讲了个故事。

明天早上有节大课,
原本是8点钟开课。

同学甲

听说了有课,
3点钟就去教室占座位,
并坚持认为5点钟就会开课。

同学乙

虽然清醒的知道8点钟才开课,
但看到3点钟已经有人占座位了,
估计6点钟再去没位置了,
不得已3点钟也去占座位。

同学丙和同学丁

4点钟的时候,坚持认为5点钟开课的同学丙可能把占到的座位卖给认为6点钟会开课的同学丁。

同学戊

5点钟的时候,同学戊叫着说,别等了,今天的课不上了,大家撤吧。

祝各位同学好运

同学甲需要坚持,我们不要打击他,
因为他们推动了科技进步,
但做好准备,开课的时间比预料的晚了3个小时;

同学乙也需要坚持,
不过看来是带着干粮来的,
有坚持的准备;

同学丙是聪明的人,
知道自己坚持不了多久,却不想浪费知道有课这个消息;

同学丁在合适的时间进入,也不错。

不要只听同学甲的,因为热情和干粮不见得耗得到8点钟
也不要只听同学戊,课还是要上的,只不过不时5点钟而已。

所以祝每位同学好运。

-------------------------------------------------------------------------------------------------

(来自http://home.wangjianshuo.com/cn/20051020_web_20_ceaeae.htm)
你是同学几阿?

posted @ 2005-11-18 16:59 femto 阅读(242) | 评论 (0)编辑 收藏
微软也是创新的。关于创新,它一直在微软的血液里面。微软内部的达尔文主义(物竞天择,适者生存),从Windows 95时代到现在,从来都没有改变过。迈克尔-德拉蒙德所写的《微软帝国叛逆》就讲述了OpenGL组里三个工程是坚持认为世界上有比OpenGL更适合Windows系统的图形引擎,于是掀起了微软内部的战争,秘密开发DirectX引擎。战争最终以更多的内部的部门采用更快更简单得DirectX而不是OpenGL,并使OpenGL组最终转变成为DirectX组而告终。这内部的种种创新的故事,已经有很多本书的记述了。
(来源于王建硕的blog)
posted @ 2005-11-18 01:51 femto 阅读(492) | 评论 (2)编辑 收藏
管理员,没找到怎么用trackback阿?
posted @ 2005-11-18 00:58 femto 阅读(319) | 评论 (2)编辑 收藏
http://gzkou.blogdriver.com/gzkou/1034494.html#comment
其实很多功能吧,发明的人一开始并不一定都想到的,
比如一些军用发明转民用,你会惊讶的发现,
你的用户会采用一些你意想不到的方式使用你的系统
posted @ 2005-11-18 00:58 femto 阅读(254) | 评论 (0)编辑 收藏
http://mt.bookiesky.com/archives/vagabond/2005/10/googleececioeeo.html
  Google给每位工程师20%的自由支配时间。在私人时间里,大家反而创意勃发;诞
生了Gmail邮箱产品和人际网络产品Orkut


嗯,20%的自由支配时间,真的很吸引人,google就是google,确有独到之处。
事实上,人在比较free比较自由的时候,确实容易创意勃发,萌生很多想法
比如我的一些创意想法,就像下面这个曾经在论坛上发表过的想法
google 20%的空余时间可以给世界 创造很有创意的想法  比如我现在觉得,电脑上的字典就很不好用,查一个单词,还就给出 文字解释,真是太原始了,应该充分发挥电脑的多媒体优势, 在解释一个单词就给出图片或者相关动画,就像小孩子学单词一样,由本能 figure out what the word means. 不要文字,或者只在需要时再给出文字解释。

还有以前发表的java应该动态化,POHP(Plain Old Html Page),都是在一些比较闲适,
比较随意的时候,突然想法蹦到脑子里头来的。
  
posted @ 2005-11-17 23:53 femto 阅读(259) | 评论 (0)编辑 收藏
山德勒销售研究所(Sandler Sales Institute)曾作过关于推荐人如何影响销售环节的研究,他们的结论如下:
电话销售的成功率只有1%~5%
如果告诉客户推件人姓名的话,销售成功率为15%左右
如果推荐人能给你的客户打电话或发送电子邮件的话,销售成功率就上升到50%
如果推荐人能出现在你和客户的会面或电话交谈中,那么销售的成功率就飙升至70%多,甚至超过80%

image001.gif

找工作也是类似的,呵呵,所以人脉很重要,呵呵
posted @ 2005-11-17 14:39 femto 阅读(313) | 评论 (1)编辑 收藏
仅列出标题
共3页: 上一页 1 2 3 下一页