mingyi's profile大头的空间PhotosBlogListsMore Tools Help

mingyi Wang

Occupation
Location

Windows Media Player

There are no music lists on this space.

大头的空间

我要的就是骄傲阳光的潇洒 a free man just start his journy whose conclusion is uncertain
Photo 1 of 27
July 01

治世之能臣,乱世之奸雄

Cáo Cāo (曹操; 155 – March 15, 220[1]) was a warlord and the penultimate Chancellor of the Eastern Han Dynasty who rose to great power during its final years in ancient China. As one of the central figures of the Three Kingdoms period, he laid the foundations for what was to become Cao Wei and was posthumously titled Emperor Wu of Wei (魏武帝). Although often portrayed as a cruel and merciless tyrant, Cao Cao has also been praised as a brilliant ruler and military genius who treated his officers like his family. He was also skilled in poetry and the martial arts, and wrote many war journals。

 

Cao Cao was born in the county of Qiao (譙, present day Bozhou, Anhui) in 155. His father Cao Song was a foster son of Cao Teng, who in turn was one of the favorite eunuchs of Emperor Huan. Some historical records, including Biography of Cao Man, claim that Cao Song was originally surnamed Xiahou (thus making Cao Cao a cousin of Xiahou Dun and Xiahou Yuan, two of his most prominent generals). In the fictionalized Romance of the Three Kingdoms, Cao Cao's father was originally a Xiahou and was adopted into the Cao family.

Cao Cao was known for his craftiness as a young man. According to the Biography of Cao Man, Cao Cao's uncle often complained to Cao Song regarding Cao Cao's childhood indulgence in hunting and music with Yuan Shao. To counter this, Cao Cao one day feigned a fit before his uncle, who hurriedly informed Cao Song. Cao Song rushed out to see his son, who then acted normally. When asked, Cao Cao replied, "I have never had such illness, but I lost the love of my uncle, and therefore he had deceived you." Henceforth, Cao Song ceased to believe the words of his brother regarding Cao Cao, and thus Cao Cao became even more blatant in his wayward pursuits.

At that time, there was a man living in Runan named Xu Shao who was famed for his ability to evaluate one's potentials and talents. Cao Cao paid him a visit in hopes of receiving the evaluation that will earn him some reputation politically. Originally Xu Shao pondered and refused to make a statement; however, under persistent questioning, he finally said, "You would be a capable minister in peaceful times and an unscrupulous hero in chaotic times." Cao Cao took this as a compliment and was very pleased as it was recorded that he "laughs and leaves" after receiving said comment. It is worth noting that there are two other versions of the comment in other unofficial historical records: "capable minister in peaceful times, righteous hero in chaotic times"[citation needed] and "sinister foe in peaceful times, great hero in chaotic times."[citation needed]

At twenty, Cao Cao was recommended to be a district captain of Luoyang. Upon taking up the post, Cao Cao placed rows of multicolored staffs outside his office and ordered his deputies to flog those who violated the law, regardless of their status. An uncle of Jian Shuo, one of the most powerful and influential eunuchs under Emperor Ling, was once caught walking in the city beyond the evening curfew hour by Cao Cao and given his fair share of flogging. This prompted Jian Shuo and other higher authorities to "promote" Cao Cao to another position outside the imperial capital (governor of Dunqiu County) to remove his management.

When the Yellow Turban Rebellion broke out in 184 Cao Cao was recalled to Luoyang and promoted to a captain of the cavalry (騎都尉) and sent to Yingchuan to put down the rebels there. He was successful in his military exploits and was further promoted to Governor of Dong Commandery (東郡).

Battle of Guandu

In the spring of 200, Yuan Shao, the most powerful warlord of the north, amassed more than 100,000 troops and marched from Ye on Xuchang. To defend against the invasion, Cao Cao placed 20,000 men at Guandu (官渡), a strategic landing point on the shore of the Yellow River which Yuan Shao's troops had to secure en route Xuchang.

With a few diversionary tactics, Cao Cao managed to disorient Yuan Shao's troops as well as kill two of Yuan Shao's most capable generals, Yan Liang and Wen Chou. The morale of Yuan Shao's troops suffered a further blow when Cao Cao launched a stealth attack on the former's food store, Wuchao. Many more of Yuan Shao's men surrendered or deserted than were killed during the ensuing battle. When Yuan Shao eventually retreated back to Ye in the winter of 201, he did so with little more than 800 light cavalry.

The Battle of Guandu shifted the balance of power in northern China. Yuan Shao died shortly after his retreat and his two sons were soon defeated by Cao Cao further in the northern regions of Liaodong. Since then, Cao Cao's dominance in the entirety of northern China was never seriously challenged. The battle has also been studied by military strategists ever since as a classic example of winning against an enemy with far superior numbers.

Battle of Red Cliffs

Traditional site of the Red Cliffs, north of Wulin

The Battle of Chibi (literally, "Red Cliffs") was another classic battle where the vastly outnumbered emerged as victor through strategy. In this battle, however, Cao Cao was on the losing end.

In the winter of 208, Liu Bei and Sun Quan – two warlords who later founded Shu and Wu respectively – formed their first coalition against the southward expansion of Cao Cao. The two sides confronted at the Red Cliffs (northwest of present day Chibi City, Hubei). Cao Cao boasted 830,000 men (historians believe the realistic number was around 220,000), while the Liu-Sun coalition at best had 50,000 troops.

However, Cao Cao's men, mostly from the north, were ill-suited to the southern climate and naval warfare, and thus entered the battle with a disadvantage. Furthermore, a plague that broke out undermined the strength of Cao Cao's army. The decision by Zhou Yu, military advisor to Sun Quan, to use fire also worked effectively against Cao Cao's vessels, which were chained together and thus allowed the fires to quickly spread. (Though in the novel Romance of the Three Kingdoms the chaining of the ships is attributed to Pang Tong, it is most likely that it was done to make stable the ships as his men were suffering from seasickness). A majority of Cao Cao's troops were either burnt to death or drowned. Those who tried to retreat to the near bank were ambushed and annihilated by enemy skirmishers. Cao Cao himself barely escaped the encounter.

Agriculture and education

While waging military campaigns against his enemies, Cao Cao did not forget the basis of society – agriculture and education.

In 194, a locust plague caused a major famine across China. According to the Records of the Three Kingdoms, the people ate each other out of desperation. Without food, many armies were defeated even without fighting. From this experience, Cao Cao saw the importance of an ample food supply in building a strong military. He began a series of agricultural programs in cities such as Xuchang and Chenliu. Refugees were recruited and given wastelands to cultivate. Later, encampments not faced with imminent danger of war were also made to farm. This system was continued and spread to all regions under Cao Cao as his realm expanded. Although Cao Cao's primary intention was to build a powerful army, the agricultural program also improved the living standards of the people, especially war refugees.

By 203, Cao Cao had eliminated most of Yuan Shao's force. This afforded him more attention on construction within his realm. In autumn of that year, Cao Cao passed an order decreeing the promotion of education throughout the counties and cities within his jurisdiction. An official in charge of education matters was assigned to each county with at least 500 households. Youngsters with potential and talents were selected to undergo schooling. This prevented a lapse in the output of intellectuals in those warring years and, in Cao Cao's words, would benefit the people.

 
June 15

关于BPEL

关于BPEL

 

在企业应用集成中,可以使用工作流程和BPM结合的方式来协调各个应用,但是WEBSERVICES 中必须要有一种标准来让无论是计算机人员和业务人员都能懂的东西。这种东西既结合计算的程序又综合了工作流程的概念,BPEL就是其中最流行的标准。

 

通过BPEL可以将很多的WEBSERVICE集成起来,通过工作流的形式来自动执行。在集成的过程中,单个的SERVICE的实现部分保持非透明化,也就是说,在BPEL里面用到得只是每个SERVICE的接口(WSDL)而不用管,每个SERVICE在自己的地盘是怎么实现的。BPEL只要知道每个SERVICE 的功能,物理地址,和需要的参数就可以了。这样即使单个SERVICE改变或者变化也对BPEL流程没有太大的影响。这也就是composition of web services的原理:应该调用什么服务,什么时候调用,如何处理异常等等。

 

BPLE具体的结构和细节是如何的?

BPEL实际上也是一个基于XML的文件。

BPEL中的一个显著特点是定义了不同的 partnerlink, partnerlink定于了这个流程中各个服务所处的地位(role), 比如说bpel中有一个查询票价的服务接口,那么对于这个查询票价的服务就处于一个SERVICE的地位,那么BPEL过程本身就是一个requestor 的地位。

BPEL总定义好了partnerlink后也要在相应的服务接口文件中定义partnerlinktype,这个type实际指向的就是服务接口文件(WSDL)中的porttype.

 

像一般的流程图一样,BPEL有自己的活动标签。

Receive: 接受信息

Reply:  对之前接受到得信息的相应,同时它还可以返回一个异常。

Invoke: 调用一个相应的服务

Sequence: 按顺序执行一定的活动

Flow: 一些活动可以同时进行。

Switch: 按照情况选择需要执行的活动

Pick: 等待某些活动的完成

Wait: 等待一定得时间

While: 循环

Assign: 复制的操作

 

FLOW中可以定义一些links元素,用来作为导向的功能

Link 使用连接两个活动的。

活动中可以定义source 元素 或者target元素, source 元素内可以指明满足的条件,当满足条件时,就走到相应的target.

 

Link 中的JoinFault的处理: 当所有导向摸个活动的links都为FALSE的时候,这个活动就应该被跳过,而且从这个活动导出的LINKS也应该被置为FALSE。这个处理可以通过BPELsuppressJoinFault=”yes” 和在相应的活动中加入 joinconditon来判断。

 

FaultHandling:

BPEL中的异常处理可以是全局的也可以是局部的,可以讲faulthanding加入到整个过程中或者加入到一个局部的scope中,一般的处理FAULT是当异常发生时,中止活动,并转向相应的FAULTHANDLER,这点于compensation handler不同,compensation handler是指当异常发生时,不仅活动会终止而且,之前所有的完成的工作都会被重置为最近的那个没活动发生的状态。

关于工作流程

关于workflow(工作流程)

 

什么是工作流程?

工作流就是一系列相互衔接、自动进行的业务活动或任务。 注意这里的业务活动都是自动的非人力的,在计算机领域也就是传说中的自动化过程。

工作流的出现动力是因为,企业应用集成的发展需要将一系列的商业活动以自动化的,流线型的方式来执行,传统的点对点形式不能满足日益增加的商业过程中的应用和新技术的发展。所以工作流在应用集成方面是一个很好的工具。

 

在当前,企业的应用集成一般是通过一个central bus来连接每个单个的应用,这里需要每个单个的应用有自己的接口,这个接口和WSDL有相似的含义。

BUS上有很多不同的ADAPTOR,这些ADAPTORS 和每个单独应用的接口相连接,通过这个ADAPTOR可以把每个应用的数据映射为一个共同的模式,在BUS上还会有一个MESSAGE BROKER,这个东西是用来协调ADAPTOR之间的互动的。通过这样的方式,企业各系统之间的异种性就被隐藏了。

所以设计一个EAI的平台关键的步骤就是设计ADAPTORMESSAGE BROKER

 

综上所述,MESSAGE BROKER 隐藏了系统的异种性,而且工作流程则起到了应用集成和增加应用互动性的功能。所以这两个可以结合起来。也就是将工作流程和EAI平台两者相结合,这样既隐藏了系统的异种性,有起到了增加各应用之间互动的作用。工作流程也可以通过一个工作流程ADAPTOREAI平台相连接。这样工作流程管理系统就能和企业的其他应用相互互动。

 

那么工作流程管理系统到底能干什么了?

工作流程管理系统是一个软件平台,用来设计,发展,分析,和管理工作流程。

工作流程管理系统就决定了自动化执行一个商业过程,这个商业过程什么时候执行,由谁来执行都能够由工作流程管理系统来自动决定。

 

那么什么是商业过程?

商业过程就是为了达到一个商业目标所需要执行的一系列商业活动的集合,比如发表一篇论坛就必须经过查询资料,开始写,教授审查,发表等等活动,每个活动的执行者和使用到的资源都不一样。

 

工作流程是一个导向图,一般包括起始,结束,工作,和导向节点,每个节点的功能都不相同。

 

工作流程的工作原理是,首先从工作流定义库中搜索工作节点,通过分析,将它们放到对应的资源队列中去(资源可以是人或者计算机)。

 

BPM和工作流程相结合起来,就出现了一下几点部件

1.       Task: 不能再细分的工作单位

2.       Sequence 某些工作需要按一定顺序执行

3.       Selection 基于默写情况来处理一定得工作

4.       Parallel:   某些工作可能可以平行处理

5.       Synchronization; 某些工作需要等待其他工作的完成才能进行

6.       Iterator: 某些工作需要重复循环的处理

BMP和工作流程的结合中:

长方形代表单个的task, 圆圈代表一定join split操作, join and join or join,同样split and split or split.

 

基于Petri Net 的工作流管理系统

有两个重要部件,一个是places 存储了一系列的token,对象,比如说一个发送请求,一个客户的投诉等等。

还有一个部件叫tansition,这个决定了之前token的走向,这种构造方式将一个商业过程模式化为了许多个不同的状态,比如说初始化的places 有三个客户投诉,流程图的构造是两个places 中间一个transition, 那么这个商业过程的初始状态就是(3,0),transition 将第一个places里面的一个投诉转移到第二个places里面后,状态就变为(2,1)了。

 

判断一个transition是否激活的标准时在places里面至少有一个token.

Token可以属于多个transition, work item 是属于transition 的,当时间到达,信息到达或者发生了一个事件,那么这个transition里面的workitem就被分配给某个资源来执行,这个时候称为fireing of transition, 当它处于fireing 的阶段时候,就被称为活动了。

 

Petri Net中有几种split, or- split, or split 可以分为可以决定的和不可决定的两种,可以决定的是当满足某种情况的时候就进行工作,输出可以个多个,不可以决定的or split包括了可决定的情况,当preconditions重叠的时候就不可决定,反之和决定形的效果一样。

 

 

关于REST

关于Rest

Rest 到底是个什么东西?

 

Rest 就是一种联网系统的架构风格。比如说SOAP的网络服务的架构风格是服务定义特定的接口,客户通过接口可以了解服务能够干什么和怎么与服务进行互动。但是Rest 的服务与基于SOAP的服务不同,它没有像基于SOAP的那些服务那样有一个接口说明(也就是著名的WSDL)。

 

对于REST而言,整个WEB世界是由许多资源所构成了,你要和一个网络服务互动,只能通过4个特定的服务接口模式:put, post, update and delete.这四个操作是基于REST架构的网络服务的标准活动。这些活动和servletdoget, dopost相似。

 

如上所述。REST是将WEB上的东西定义为资源(resourse,那么所有与网络服务相关的就是对资源的获取操作等等了。每个基于REST 架构的服务都要给每个资源指定特定的URI,这个URI是非常重要的而且是极其方便简洁的。客户通过一个设计好的URI可以直接获取需要的资源。

 

那么设计REST 架构的目的是什么? 很明显,使用REST架构就是为了很好的获取网络的资源。。。。

 

资源到底是什么?

 

资源就是一系列的操作和数据集合。

REST 架构中,资源是通过一系列数据格式来代表的比如说:XML,JSON,TXT等等。

比如客户要获取自己的账户信息,那么客户根据这个账户信息特定的URI,可以得到自己的资源。服务器端通过XML格式,或者JSON格式返回这个资源给客户。

 

 

REST架构的服务的特点:

1.       首先REST架构有两个方面:客户端和服务器端

2.       统一的接口:put, post, update, delete

3.       资源都是很好命名好的,而且是通过一个设计良好的URI来获取,资源之间也是通过URI来联系互动的。

 

既然REST架构的服务的资源都是通过URI来引用的,那么必然导致一些复杂查询语句的产生。

Rest架构的服务的数据代表格式有两个重要: XML JSON

JSON其实也是基于XML的。

 

那么设计一个REST架构的服务需要什么原则

1.       主要的是对每一个资源定义一个有效的,命名规范的URI,不能使用动词,一定要用名词。

2.       把资源分类,只能读的资源分为一类,不仅能读而且能写的资源分为另外一类。

3.       所有的资源通过服务器返回的只是服务器资源的一个代表,读取资源不能对服务器的资源产生任何的影响。

4.       通过URI来连接资源,同样资源之间的连接也是通过URI来联系的(超连接)

5.       通过一个说明文件向客户阐述这个基于REST架构的服务是怎么操作的。这个说明文件是必须的但是这个说明文件和基于SOAP的服务的WSDL是不同的。

 

既然你设计原则确定了,那么到底应该怎么建立一个REST 服务了?

首先,编程语言是无关紧要的。其次,需要一个支持HTTP协议的服务器,因为REST架构的服务基本是基于HTTP的。第三,定义好REST架构服务的接口,也就是这个服务支持的一些方法: 比如说doget(), doPost(), doUpdate(), doDelete().这跟基于SOAP的服务不同,基于SOAP的服务将方法接口定义到WSDL里面,而REST 将方法接口说明放到一个说明文件里面。

第四,在每个方法里面都要定义好特定的URI等等。最后,定义返回的资源以一种什么样的数据格式来返回给客户,比如是返回XML格式还是JSON格式,还是纯文本格式了。

 

 

基于REST 架构的服务和XML-RPC服务,SOAP服务的不同:

XML-RPC服务: 客户端发送一个请求,这里牵涉到一个xmlrpcclient对象和xmlrpcserver对象, xmlrpcclient可以远程对象xmlrpcserver. 在服务器端,xmlRpcServer接受客户请求并执行相应的操作。

客户发送的请求是以XML格式传说过去的,服务器端返回的数据也是以XML格式传说过来的。这种服务凭借的协议是HTTP-POST,发送一个HTTP-Post 然后得到一个reply.

 

基于SOAP的服务,是XML-RPC服务的进化版本,将数据封装到一个SOAP里面。。。。

Rest SOAP

REST:将WEB看成是一个有资源所组成的世界,仅仅基于HTTP协议。

SOAP: WEB看成是一个互动的,每个应用通过信息传输所构成的世界。不仅仅是HTTP协议,可能还有其他协议。

 

RESTSOAP服务在设计的不同:

对于SOAP 需要定义一个接口说明(WSDL),数据类型,合适的传输协议,注册发布服务。

对于REST 定义各种资源,使用很好的URI来指向这些资源,区分只读和读写的资源,定义资源之间的超连接,发布服务。

REST SOAP各有个的好处。SOAP比较适合于B2Bbusiness to business)而REST比较适合于B2C。所以将两种构架结合起来是未来网络架构形式的一个趋向。

关于UDDI

UDDI: 存储了一些服务的接口说明文件,简单来讲就是存储了一些WSDL

一个web service 要公布于世,就必须让自己在UDDI上注册,这样才能让客户来寻找和查询它的功能。

一般的, 注册机包含了两个部分:

1.       document-based: 存储WSDL的说明文件

2.       meta-based: 只提取说明文件的精髓内容

 

service provider, service registry, service requestor 之间的关系式:

首要进行service discovery:

Service discovery 分为静态和动态两个部分

静态: design time, 由设计人员检测

动态:   run time, 提供preferences, 选择合适的服务。

 

一个最基本的流程是:

N个服务提供者发布服务在UDDI 然后一个服务请求者发送一个查询请求(SOAP),然后这个请求者会得到很多满足要求的服务列表,然后选择一个好的服务,再发送一个请求,然后UDDI可以把这个最好的服务的WSDL发给请求者,接下来,这个请求者就可以通过这个WSDL建立PROXY来利用所选择的服务。

 

UDDI的具体结构是如何的?

UDDI的结构和通常的电话本很相似:

包括:

1.       white page: 服务提供者的联系信息

2.       Green page: 也就是服务的porttypes

3.       Yellow page: 关于上面的说明信息。

 

在技术上称为:

1.       Business Entity: 记录了服务提供者的信息

2.       Business Service: 包含了一些列的binding template

3.       Binding template: 指向一系列的tMODE

4.       Tmode: 指向WSDL的实际网络地址(port) porttype

 

UDDI能够有效的进行服务的生命周期管理: 一个服务换了地方或者换了其他什么东西

UDDI 充当了一个中间者对于服务的改变,而且保持了服务的更新

比如如果之前的服务出了错误,可以再次访问UDDI,更新新的服务WSDL