Tuesday, December 25, 2007

Java读书杂记

How to build .jar in NetBeans: 1. make sure main class is set; 2. clean and buildJ2ee design patterns by Crawford

EJB目的:抽象persistant mechanism

消息类型:document,event, command

反模式产生的原因:inexperience;不可读代码;copy and paste development,与其贴,不如抽象化之,使得继承
最好用stateless如果可以,节约container的资源使用:Session facade: (a few stateful bean layer hiding more stateless bean?)

Round tripper反模式(误用网络降低调用速度),how to reduce::应该把多次调用合为一,用DataTransferObject和facade,即facade接受一次DTO数据传输对象,然后代替网络调用,执行n次个体方法(getPersonaldata(0), gPd(1)...)

MagicServlet AntiPattern: too many code in a single doGet()..

public class PeopleDTO implements Serialzable { private List people;
public PeopleDTO() { people= new Vector();}
public List getpeople(){ return people;]
public void addPerson(Person person) {people.add(person);}
}
在用facade SessionBean来people.iterator() { LocalEJBperson ejbPerson = (LocalEJBPersin)i.next();
dto.addPerson(new Person(ebjPerson.getFirstName(),ejbPerson.getLastName())); //已经是集合,和不用facade的时候一样用people.add, ONLY changed by wrapped in PeopleDTO

golden hammer:用惯了ejb所以滥用
MVC (model view, controller tier)

乐观锁定模式:复制对象并更新,提交,如果版本号已改,再报错

domain object model: is the business tier and center of app. defines entities which would otherwise in database, and processes which would be scattered. Step1: vision; 2 gather use cases; 3 find object candidates (4 use case)
serialized Entity pattern: turns to binary format so hard for future change of class. enhanced by Tuple table pattern

Get of http1.1 can be cache

process(business) logic for verbs and domain logic for nouns
J2EE:每个container可以有多个web application,每个app应该有一个deployment descriptor web.xml文件申明并映射资源,在/WEB-INF目录



1.Data mining methods and models (Wiley), Figure 2.25 如何强行建立线性关系,用bulging rules 在球第三象限的限制heuristic rule(X down, Y down):
(t-3, t-2, t-1(minus square),t−1/2 ln(t) √t t1 t2 t3 (third power, third order)),对
变量处理后看有没有线性了

2.web dm:将客户数据转化为客户价值

将不赢利客户全部去掉以增加利润不是一个好方法(现有客户的成本会提高,因为有固定成本)

客户信息总在变动:比如住址,这给保留旧信息带来困难

四类客户来源:恳求,激励,自愿,推荐(此类通常双方都是高值,但是数据库中很难记录)

服务电话时间越长,越可能是投诉电话?(我看恐怕是支持电话)

客户价值变动趋势(beta价值)=f(y)/f(x),计算:

y的函数:第一时间段的y值乘1,下一个时间段*2,该加权和减去(x的和乘以y的平均值). 其中
x的和=N*(N+1)/x

X的函数:前N个数的平方和-N个数平均值与总和的积


douobleclick曾经并购Abacus,离线的消费者行为数据提供商

在很多不放置广告的地方放置跟踪器(internet bug/Clear gifs),没有看到任何广告的人的行踪也被跟踪了

有多少企业在招最好的人?(绝对最好,应聘者中最好)。最好的人是否对企业发展最有利?

任何人都只能认识到一部分真理,任何真理都只适用于一部分地方。全部真理也会互相提出。怀疑论,不可能精细描述全部,所以不可能达到最优控制


Credit Susie的挖掘套路:简单实用

The analysis starts with simple statistics of single variables (e.g., mean, std.
deviation). Analysis is then extended to pairs of variables, in order to detect
correlation. One of the variables is typically the target eld. There is a tradeo
in the use of variables appearing with a high correlation to the target variable.
On the one hand, they are suited for building the mining model. On the other
hand, an information leaker might be found that need to be excluded, because
it is likely to produce bad models. The only way to solve this problem is a rst
interaction with business people, discussing the meaning of the high correlation.
Then the modeling process starts. A straightforward way is to build a decision
tree with all non information leaking variables. The data mining suite DARWIN
uses a parallelized implementation of the CART algorithm [1].
Decision trees have the advantage (in contract for example to arti cial neural
networks) of being able to show understandable rules as well as getting a quick overview of quality of the model


正确的分类也有cost,可用ROC/ TQ
Three categories of costs were estimated. Direct monetary costs are easiest to
estimate: design and printing costs of the mailed documents, cost of the address
list, stu¢ng envelopes, postage. Then, the cost of training the commercial sta¤
for this very marketing programme, negotiation and case management must also
be estimated. Thirdly, the "psychological" or opportunity cost of a misdirected
targeting must be estimated. A client being o¤ered products that don’t interest
him can become dissatis…ed or annoyed with the bank, and may tend to disregard

J2ee
BEAN WAS DESIGNED TO BE A RE-USE COMPONENTS IN idE, DRAGGABLE AND CAN SEE LIST OF METHODS WITHOUT ACCESS SOURCE CODE
EJB USE RMI

JB serves data request in an orderly fashion (even if they arrive same time)
JAVA BEANS CAN BE USED IN 3 WAYS
IN IDE
IN RMI
SERIALIZED (SVE PROPERTY VALUS AND STATE TO DISK ALLOWS MOVING)

BEAN NEED NO-ARGUMENT CONSTRUCTOR?

CAN HAVE MULTIPLE CONSTRCTOR,

COMPILER WILL CREATE ONE IF THERE ISN'T ANY

Oracle stores numbers as characters so quoted number is inserted as normal number

Java: String str=null //will print as null

Scope (life span): (or page, request, application


J2ee1.3
EJB: Stateless session beans/stateful session beans. 前者可以被Pool,不存客户状态(每次呼叫都要provide),都can't survice after server crash
Entity beeans (saves state to a persistent store

J2ee services: RMI; JDBC, JNDI, JTransServ, jConnA

Access remote EJB: Object robj=jndi.llkup("catalogEJB");
CatalogHome home = (CatalogHome) PortableRemoteObject.narrow(robj, CatalogHome.class);
catalog = home.create()



Structs和service locator pattern都是用于减少客户复杂度

???buidling a spider 800??? where is the link reading???

catbog:阅读不同的公司网站,确定shippting status of a certain shipping track number

0 Comments:

Post a Comment

<< Home