11/21/2006
11/17/2006
今天的任务
希望尽快整理出详细的文档。
另外,周六要帮忙搬家,东西很多哦,做好心理准备~周日没其它安排的话,要去看房子。最近的几周,一直排的很满啊。。。
---------------------------------------------------------
各种ADSL路由器端口影射设置
http://www.linuxmine.com/20585.html
北京宽带网
http://www.bta.net.cn/
11/14/2006
About WebMethods
webMethods 是一个platform的名字,也是一个公司的名字。这个platform主要是用来做EAI的。webMethods公司的网站就是webMethods.com,上面有一些简单的介绍。而如果需要学习,则可以到advantage.webmethods.com这个地址上去,不过似乎只有webMethods的合作伙伴才可以注册帐号,浏览里面的doc. 另外有一个叫wmusers.com的网站,上面有一些简单的资料,但是远不如前者齐全了。
webMethods有一个certificate,以前是免费的(当然,你需要是webMethods的partner)。但从今年的7月开始,无论是谁,都必须先参加其相关课程才能够去考。(相关课程的价格很高,数千USD)。所以以前能考出来的人实在是幸运的。
webMethods 这个平台有好几个部分构成,主要有IS(Intergration Server), Broker, Workflow, Modeler, Trading Network,还有一些诸如MainFrame,eStandards等的还没怎么接触过。
就软件而言,webMethods提供了IS Server,Developer,Modeler,Workflow,Administrator等, 这几个已经可以基本完成开发了。在后面的相关文章里我会再逐一介绍。
接下来的文章里,绝大部分来自于webMehods官方提供的guideline里的内容,也有一些是在做case study时的一些体会。
webMethods 之 components
首先我们看一下webMethods的主要结构:
如图所示,左侧的几个组件代表client端的组件,而右侧的是server端的。
在官方文档里,将webMethods platform分为了run-time components, design-tiem conponents和
administrator components。后两者主要以操作为主,在本文中,主要介绍run-time组件。
IS是run-time的核心组件,它是integration logic的主要执行者。“ webMethods Integration Server connects internal and external resources to the integration platform”。
Broker是“message router”,它是我们所说的“message backbone” or “message facility”的主要部件。
Adapter位于IS上,它将the back-end resources与integration platform连接起来。
Mainframe “functions as an agent between the Integration Server and online applications running under CICS (Customer Information Control System) or IMS/DC (Information Management System/Data Communications) on the mainframe.”
Trading Networks 是IS的一个附加(add-on)组件,它用以实现与外部系统(如客户的相关系统)的信息交换。“webMethods Trading Networks acts as a business document gateway ”。
Workflow用来执行workflows. "A workflow is a series of tasks performed by one or more people (participants) at execution time."
Run-time components主要就是以上几种。另外,design-time components主要包括Developer, Workflow Designer, Modeler, Trading Networks Console. Adminstrator components主要有Administrator,Monitor和Manger。这些将在后面介绍。
webMethods 之 Developer 1
现在开始Developer的内容。Developer我认为是webMethods开发的最重要的IDE。本文先讲一些相关概念。
Service 这里的service很像我们平常程序中的函数,doc:Integration Server is a service-base integration broker. A service is a process that may be invoked to perform a wide variety of tasks.
Package
Pacakge可以看成是一个容器。官方的doc是这么写的“A package is a container that is used to bundle services and related elements. Packages are designed to hold all of the components of a logical unit in an integration solution.”
Element
Elements可以看成是package中可以包含的元素。doc:Elements include folders, services, specifications, IS document types, triggers, and IS schemas.
Element Names
Elements Names比较特别,是由目录名和element名构成的。比如:
folder.subfolder1.subfolder2:element
Lock
Lock很像版本控制里的概念。doc: A lock on an element prevents another user from editing that element. There are two types of locks: user locks and system locks.
ACL
ACL是一种权限控制的机制。doc:
An ACL (access control list) controls access to packages, folders, and other elements (such as services, IS document types, and specifications) at the group level.
webMethods 之 Developer 2
我们继续讲webMethods Developer。本文主要讲的是Developer的Flow Service。
Flow Service的功能类似于一般的函数。但是,这个函数是用webMethods自创的Flow语言写的。(其实与其说写,还不如说“画”的)。看doc里的定义: A flow service is a service that is written in the webMethods flow language. 另外,每个Flow Service都有输入输出。
Flow Service是由Flow Step构成的。我们可以将flow step想象为函数的一条(或者多条语句)。doc:A flow step is a basic unit of work. 本文主要讲的就是不同类型的flow step。
了解了上面的两个概念,我们还需要知道Pipeline的含义。 在我看来,Pipeline很像JSP里的Servlet Context,它存放着可以被整个系统使用的数据。我们看doc:The pipeline is the general term used to refer to the data structure in which input and output values are maintained for a flow service. It allows services in the flow to share data. When a service in the flow executes, it has access to all data in the pipeline at that point. (SHARE)
接下来是有关flow step的内容。flow step 分为BRANCH,SEQUENCE,REPEAT,LOOP,EXIT,MAP六种。这六种其实只不过是对一般编程语言的赋值、流程控制等的重新定义而已。
BRANCH是分支结构的意思,它与Java里的switch类似。而有趣的是,用来确定BRANCH走向的参数名恰好就是在switch中定义的. (而子选择参数是以Label确定的)
SEQUENCE是顺序结构的意思。它的意义在于它可以将多个flow step封装成一个来看待。并且,在其内部可以定义运行到何时结束,比如until failure, until success, until done等。
REPEAT是重复,它可以指定重复次数。
LOOP的意义在于它极大方便了对数组的枚举。
EXIT是退出的意思,它可以选择退出到程序的那一层。
MAP是赋值的作用,它有一个叫transformer的东西,可以在赋值前完成一些处理。
以上就是对Flow Language的简单介绍,上面的各种step都是通过拖拽图标实现的,而不是手工code。这是好是坏,也没什么好说的。不过pipeline的作用,是需要在实践中逐步体会的。
webMethods 之 Developer 3
写到这里,有关于Developer的基本概念应该是有些了解了。那么在本文中,我们看一下在实践中的几个要点。
首先是启动Integration Server。IS的启动可以直接在开始菜单启动,也可以在cmd下启动。在cmd中启动时,有个参数可以用:
-debug num 这个表示log的显示等级,num越大Log越详细
-log none 这个表示将log显示在cmd窗口中,如果没有这个参数,可进入Adminstrator查看
一般来说,初次启动IS还是需要在cmd中显示比较好(顺便说一句,笔者使用的webMethods6.1,要想正常启动IS,需要修改: %webMethods%/IntergrationServer/bin/server.bat ,line 49:
SET JAVA_DIR=C:\webMethods6\jvm\win142
否则会报ClassNotFound的错误,因为JRE路径没有设对)
成功启动IS之后,可以在浏览器输入http://localhost:5555 进入Administrator。第一次进入的用户名是Administrator,密码是manage。在里面,通常可以自己添加用户。这个比较简单,就不说了。
以后在Developer中,以自己的用户登录,就可以开始工作了。
成功进入Developer之后,我们就可以开始工作了。比较简单的内容这里就不写了,下面只摘录一些我在做case study时的理解。
- 在一般编程时,我们常常需要定义一些数据类型。在Developer里,这种数据类型的定义是通过Document Type来实现的。这种Document Type很像structure,当然,通过IDE,它的定义过程也被极大地傻瓜化了。同时,Document Type的定义也可来自XML、XML Schema等,这也许才是改进之处吧。
- 既然Service可以看成一个函数,那么因为原来函数是可以调用函数的,所以,Service也是可以调用Service的。事实上,数据定义,流程控制,以及数据处理——这三者已经构成了编程语言的三个要素。
- 在Developer 中,还有一些常用的Element,其实都是傻瓜化了的程序功能。比如Adapter Service,提供了对数据库操作的支持,我们只需要在IS中定义好相应的数据库联接,就可以方便的在Developer中调用。又比如 Trriger,它提供了对subscribe的支持(以后我会讲publish-subscribe)。比如Notification,它能够监视数据源的变化,有力地支持了数据同步功能。这些可以说是webMethods为集成提供的不错的工具吧。
笔者对Trading Networks的认识还只是概念而已,由于读了相应的文档,所以把一些笔记整理在这里。
普遍意义上的Trading Network是指“a set of organizations that have agreed to exchange business documents”
webMethods Trading Networks是运行在IS上的一个组件,其功能是与其他组织(公司、市场等)的系统联系“to form a business-to-business trading network.”
在Trading Networks有Partner这样的概念。它是构成Trading Network的元素,“send documents to Trading Networks for processing and/or that will receive documents that Trading Networks is instructed to deliver”
有关Partner的Information有两方面:一个是Profile,记录的是“information about a corporation that is a part of a trading network.”
另一个是TPA(Trading partner agreements),是一组定义Trading的参数约定,是可选的。文档里的说法是:“ A Trading Partner Agreement (TPA) is an optional set of parameters that you can define and use to tailor how documents are exchanged between two trading partners.
用手机拨分机
让我们来看看有哪些较流行的手机能支持吧:
如果你持有的是诺基亚的手机:只要按住米字键3次,就会在屏幕上出现小写的p。
如果你持有的是摩托罗拉的手机:只要按住米字键一至两秒,就会在屏幕上出现一个小方格,就是表示停顿一下的意思。
如果你持有的是“爱立信”的手机:只要按住米字键一至两秒,就会在屏幕上出现小写的p。
如果你持有的是西门子的手机:同样也要按住米字键一至两秒,就会在屏幕上出现大写的P6618、6688不支持。
11/06/2006
c面试题
使用临时变量。
这个我实在没有好办法,我觉得唯一的办法就是写一个循环进行移位。
2,下面是两个变量的声明,请把那个数组初始化为零,且不能增加任何
其他变量。
unsigned char c;
int x[257];(刚才错写成256了)
这到题的那点是数组x长度为257,使用变量c进行循环的话会溢出。
我的土方法:
for(c=0; c < 255; c ++){
x[c] = 0;
x[c + 1] = 0;
}
3.
unsigned long val;
char a=0x96;
char b=0x81;
val= b<<8 | a;
问val=___?
4. 写一个函数互换两个变量,但不能用到第三个变量.
5. What is wrong with the following code? Write a main() to print “hello” using
the function f().
void f(char** p)
{
printf(“%s”, p[0]);
}
void main()
{
char a[50][50];
strcpy(a[0], “hello”);
f(a);
}
6. Coding Problem:
"The most obnoxious book I have in my bookshelf is one that somebody
bought my baby daughter... Runny Babbit: A Billy Sook by Shel
Silverstein. Information on this book (in case you want to torture a
parent) can be found at
http://www.amazon.com/gp/product/0060256532/sr=8-1/qid=1139876282/ref=pd
_bbs_1/104-0687593-6578327?%5Fencoding=UTF8 - and a good close-up from
one of the pages in the book can be seen at
http://webcontent.harpercollins.com/images/interior/bookseller_spreads/0
060256532.interior01.jpg. Your programming task is to create a Runny
Babbit translator. I should be able to compile your program (language
of your choice), use it to type in any paragraph of English text (end at
blank line), and have it type back a paragraph translated into Runny
Babbit language. Your output doesn't have to be a perfect match to the
samples in the book - but document any assumptions you make in your code
regarding translation rules."
7. c里面有几种调用序列?
8. 如何用一句不带循环的C语句来判断一个数是否是2的幂
a & (a-1)
9. char *strcpy(char *strDest, const char *strSrc);
{
assert((strDest!=NULL) && (strSrc !=NULL));
char *address = strDest;
while( (*strDest++ = * strSrc++) != ‘\0’ )
NULL ;
return address ;
}
实战tor + privoxy
假设你已经以下源文件:
tor-0.1.1.24.tar.gz
privoxy-3.0.5-beta-src.tar.gz(www.privoxy.org 该网站有可能被封锁而打不开,可以通过http://anonymouse.org/cgi-bin/anon-www.cgi/http://www.privoxy.org)
安装过程就不多说,不过在安装privoxy时最好按照INSTALL所说的,创建privoxy用户及组。
此外启动privoxy前需要配置,在config文件(/usr/local/etc/privoxy/config或/etc/privoxy/config)增加这么一行:
forward-socks4a / localhost:9050 .
为了在firefox中使用tor,安装插件Torbutton plugin(https://addons.mozilla.org/firefox/2275/),重启firefox使该插件生效。
启动privoxy
/etc/rc.d/init.d/privoxy start
启动tor
tor &
打开firefox,点击右下角"Tor Disabled"
Good luck!
参考: http://tor.eff.org/docs/tor-doc-unix.html.en 《Running the Tor client on Linux/BSD/Unix》


