吃零食,像大人有时都难免。更何况孩子。孩子需要快乐,而吃零食是她的快乐很大的一部分。所以,如果全信书,不能给孩子吃零食,那也未必对孩子太残忍了。
所以,适当的零食应是孩子的权利。当然,食物还是应该以一日三餐为主的。
作者:littlebat
幼儿无错论
孩子的一切都是出自自心,看到吃的东西就想吃,看到自认为有趣的东西就想玩。至于吃不吃得,玩不玩得,只有大人替她考虑了。
再译:wiring your web application...中的难点、疑点
1、Building non-trivial web applications with Java is no trivial task.
2、where the business logic will reside
3、how to enforce a consistent design across all application layers
4、Each application layer should be isolated from other layers but allow an interface for communication between them.
5、Assembling a model that can be presented in a view.
6、 type coupling
7、“allow”的使用: In particular, the Hibernate framework allows object-to-relational persistence and query service for Java.
8、This is not the correct place because it leads to tightly coupled applications and code that can be hard to maintain over time.
9、“allow”的使用:This layer allows developers to stop building and maintaining unnecessary data transfer objects, or DTOs, to match their domain objects.
10,,This model allows Java developers to work with objects naturally in an OO fashion without additional coding.
11. allows for easier maintenance when troubleshooting
12.Inversion of control is a simple concept that allows objects to accept other objects that are created at a higher level.
13.Since Hibernate works with POJOs we will use our domain objects for persistence.
14.Here is the interface for the business service object that is stubbed for a DAO object dependency
没有目标的标题有点伤感
只是用于一篇日记暂时没有合适的目标。但是应该改一个名字。
结合重译wiring web application with open source java学习Spring...
学习其中的内容。
totodo在2004年9月就已经翻译了这篇文章,总体还可以。我准备重译的同时学习文中的用Struts+Spring+Hibernate构建web应用。今天下载了文中的源码。
我觉得当前在完善学习日记用户界面和重译这篇文章这两件事之间,重译和学习这篇文章应该优先。
女儿的口头禅
“不要你管,我自己踩...”,这是她在骑她的小自行车时最常说的一句话。在她踩不动或路不好,我们去帮忙时,她往往这样说。
(转帖)POJO 与 PO的 概念
转自:http://www.kissjava.com/zhuanti/hibernate/2005-06-03/13341117764046.html
[文章信息]
作者: robbin
时间: 2005-06-03 13:29:44
出处: KissJava.com
责任编辑: Icy
点击:
[文章导读]
POJO 与 PO的 概念
专题推荐
· 手机游戏开发专辑
· Struts专题学习
· Hibernate大杂烩
· WebWork全接触
· Spring - 春的诱惑
· Eclipse使用大全
· JBuilder 开发者指南
· Ant - 让编程更轻松
热门文章
· 图解利用Eclipse3+Lomboz3+Tomcat开发JSP(4673)
· 图解利用Eclipse3+Lomboz3+Tomcat开发JSP(4673)
· 史上最简单的struts+spring+hibernate配置实例(4657)
· Eclipse 平台Java开发入门(4568)
· Eclipse 平台Java开发入门(4568)
· Spring 入门(一个简单的例子)(3349)
· J2SDK和TOMCAT的安装及配置(2680)
· struts傻瓜式学习(一天篇)(2572)
· Spring framework 10分钟入门(2188)
· 图解利用Eclipse3+Lomboz3+Tomcat开发JSP(1704)
[正文]
POJO = pure old java object or plain ordinary java object or what ever.
PO = persisent object 持久对象
就是说在一些Object/Relation Mapping工具中,能够做到维护数据库表记录的persisent object完全是一个符合Java Bean规范的纯Java对象,没有增加别的属性和方法。全都是这样子的:
public class User {
private long id;
private String name;
public void setId(long id) {
this.id = id;
}
public void setName(String name) {
this.name=name;
}
public long getId() {
return id;
}
public String getName() {
return name;
}
}
--------------------------------------------------------------------------------
首先要区别持久对象和POJO。
持久对象实际上必须对应数据库中的entity,所以和POJO有所区别。比如说POJO是由new创建,由GC回收。但是持久对象是insert数据库创建,由数据库delete删除的。基本上持久对象生命周期和数据库密切相关。另外持久对象往往只能存在一个数据库Connection之中,Connnection关闭以后,持久对象就不存在了,而POJO只要不被GC回收,总是存在的。
由于存在诸多差别,因此持久对象PO(Persistent Object)在代码上肯定和POJO不同,起码PO相对于POJO会增加一些用来管理数据库entity状态的属性和方法。而ORM追求的目标就是要PO在使用上尽量和POJO一致,对于程序员来说,他们可以把PO当做POJO来用,而感觉不到PO的存在。
JDO的实现方法是这样的:
1、编写POJO
2、编译POJO
3、使用JDO的一个专门工具,叫做Enhancer,一般是一个命令行程序,手工运行,或者在ant脚本里面运行,对POJO的class文件处理一下,把POJO替换成同名的PO。
4、在运行期运行的实际上是PO,而不是POJO。
该方法有点类似于JSP,JSP也是在编译期被转换成Servlet来运行的,在运行期实际上运行的是Servlet,而不是JSP。
Hibernate的实现方法比较先进:
1、编写POJO
2、编译POJO
3、直接运行,在运行期,由Hibernate的CGLIB动态把POJO转换为PO。
由此可以看出Hibernate是在运行期把POJO的字节码转换为PO的,而JDO是在编译期转换的。一般认为JDO的方式效率会稍高,毕竟是编译期转换嘛。但是Hibernate的作者Gavin King说CGLIB的效率非常之高,运行期的PO的字节码生成速度非常之快,效率损失几乎可以忽略不计。
实际上运行期生成PO的好处非常大,这样对于程序员来说,是无法接触到PO的,PO对他们来说完全透明。可以更加自由的以POJO的概念操纵PO。另外由于是运行期生成PO,所以可以支持增量编译,增量调试。而JDO则无法做到这一点。实际上已经有很多人在抱怨JDO的编译期Enhancer问题了,而据说JBossDO将采用运行期生成PO字节码,而不采用编译期生成PO字节码。
另外一个相关的问题是,不同的JDO产品的Enhancer生成的PO字节码可能会有所不同,可能会影响在JDO产品之间的可移植性,这一点有点类似EJB的可移植性难题。
--------------------------------------------------------------------------------
由这个问题另外引出一个JDO的缺陷。
由于JDO的PO状态管理方式,所以当你在程序里面get/set的时候,实际上不是从PO的实例中取values,而是从JDO ?中取出来,所以一旦PM关闭,PO就不能进行存取了。
在JDO中,也可以通过一些办法使得PO可以在PM外面使用,比如说定义PO是transient的,但是该PO在PM关闭后就没有PO identity了。无法进行跨PM的状态管理。
而Hibernate是从PO实例中取values的,所以即使Session关闭,也一样可以get/set,可以进行跨Session的状态管理。
在分多层的应用中,由于持久层和业务层和web层都是分开的,此时Hibernate的PO完全可以当做一个POJO来用,也就是当做一个VO,在各层间自由传递,而不用去管Session是开还是关。如果你把这个POJO序列化的话,甚至可以用在分布式环境中。(不适合lazy loading的情况)
但是JDO的PO在PM关闭后就不能再用了,所以必须在PM关闭前把PO拷贝一份VO,把VO传递给业务层和web层使用。在非分布式环境中,也可以使用ThreadLocal模式确保PM始终是打开状态,来避免每次必须进行PO到VO的拷贝操作。但是不管怎么说,这总是权宜之计,不如Hibernate的功能强。
"Wiring Your Web Application with Open Source Java"
It has been translated by "totodo" already,the translated article is at "http://www.matrix.org.cn/resource/article/1034.html".
What a shame on me...
Ok,I will compare totodo's translation and mine,and make a correction bases on both of ours.
我有点烦了
编码真的是一件枯燥无味的活动,前些天征对与用户交互的改进设计后,对编码实施有了畏难情绪,迟迟不愿动手。
但是,我想,既然在做它,这个任务我一定完成,为了使学习日记使用起来方便一点。
the usage of "which"(and some articles come from net)
This is a sentence come from :http://www.onjava.com/pub/a/onjava/2004/04/07/wiringwebapps.html?page=2
Since Spring has built-in support for Hibernate this example DAO will extend the HibernateDaoSupport class, which allows us to easily get a reference to a HibernateTemplate, which is a helper class that simplifies coding with a Hibernate Session and handles HibernateExceptions.
There are two "which" in it,but,I can't understand what does the first "which" represent.Is it "HibernateDaoSupport class"?Or "this example DAO"?
因为Spring有Hibernate内建的支持,这个例子DAO将继承HibernateDaoSupport类,它[译者注:英语语法问题:它是指“例子DAO”还是指“HibernateDaoSupport类”?]允许我们容易取得一个到HibernateTemplate的引用,HibernateTemplate是一个帮助类,它能简化Hibernate Session的编码和处理HibernateExceptions。
***************************************************************************************************
http://jrgaojzx.zje.net.cn/Article_Show.asp?ArticleID=135
考查which的用法
[ 作者:w 转贴自:本站原创 点击数:222 更新时间:2004-4-5 文章录入:fenghe ]
考查which的用法
(一)which用作疑问代词,指上文或下文提到的几个名词中的“哪一个”。
1._____ writer is better known in China, Charles Dickens or Mark Twain?
A.Which B.What
C.Either D.Whether
2.Dr.Black comes from either Oxford or Cambridge ,I can't remember _____ .
A.where B.there
C.which D.that
3.There are so many kinds of tape-recorders on sale that I can't make up my mind _____ to buy.
A.which B.what
C.how D.where
4.I read about it in some book or other,does it matter _____ it was?
A.where B.what
C.how D.which
答案:1.A2.C 3.A4.D
(二)which用作关系代词,代替上文的先行词或先行句,在下文引导非限制性定语从句。
5.She heard a terrible noise, _____ brought her heart into her mouth.
A.it B.which
C.that D.what
6.Alice received an invitation from her boss,_____ came as a surprise.
A.it B.that
C.which D.he
答案:5.B6.C
关系代词which分别代替上文的先行词noise和invitation。
7.Carol said that the work would be done by October,_____ personally I doubt very much.
A.it B.that C.when D.which
答案:D。关系代词which代替上文句子的一部分the work would be done by October。
8.Dorothy was always speaking highly of her role in the play,_____ , of course,made the others unhappy.
A.who B.which C.this D.what
9.Wilma became the first American woman who won three Olympic gold medals in tracks,_____ made her mother very proud.
A.it B.that C.which D.this
10.He was very rude to the Customs Officer,_____ of course made things even worse.
A.who B.whom C.what D.which
11.The result of the experiment was very good,_____ we hadn't expected.
A.when B.that
C.which D.what
12.John said that he'd been working in the office for an hour,_____ was true.
A.he B.this C.which D.who
13.The weather turned out to be very good,_____ was more than we could expect.
A.what B.which C.that D.it
答案:8.B 9.C 10.D 11.C 12.C 13.B
关系代词which代替上文整个主句,用以引导下文非限制性定语从句。
14.I shall never forget those years _____ I lived in the country with the farmers,_____ has a great effect on my life.
A.that;which B.when;which
C.which;that D.when;who
答案:B。关系副词when引导修饰时间名词those years的定语从句,关系代词which代替when I lived in the country with the farmers这一定语从句部分,在下文引导非限制性定语从句,when...which...形成重叠定语从句。
(三)“介词+ which”结构引导定语从句
15.He paid the boy $10 for washing the windows,most of _____ hadn't been cleaned for at least a year.
A.these B.those C.that D.which
16.Recently I bought an ancient Chinese vase,_____ was reasonable.
A.which price
B.the price of which
C.its price
D.the price of whose
17.In the office I never seem to have time untilafter 5:30p.m._____ , many people have gone home.
A.whose time B.that
C.on which D.by which time
答案:15.D 16.B17.D
关系代词which分别指代上文先行词the windows,an ancient Chinese vase和5:30p.m.。
***************************************************************************************************
http://www.9xue.com/Html/200449101130-1.html
关系代词 that 和which 的用法比较
中国高校指南 2004-4-9
定语从句(attributive clause)是英语语法中一项重要的学习内容?正确选择关系代词是掌握定语从句的关键?关系代词that和which均可指代先行词是事物的名词或代词,此时两者可互换,但有时that和which的使用场合并不相同?具体介绍如下:
一关系代词that的使用
1.先行词是all, anything, everything, nothing等,关系代词应用that?
That's all that I know.
2.先行词前有the only, the same, the very或no, little, much, any, every, all等修饰时,关系代词应用that?
This is the only reason that I can say.
3.先行词前有序数词或形容词最高级修饰时,关系代词常用that?
The first thing that we should do is to help him.
4.当先行词同时含有"人"或"物"时,关系代词应用that?
Can you see a man and his horse that are crossing the bridge?
5.在固定结构the same...that...; so...that...; such...that...以及it is/was...that...的强调句型中,须用that?
This is the same museum that you once visited.
6.如主句以there be开头时,关系代词应用that?
There is a house that has two windows.
7.当一个句子中含有两个定语从句时,如前一个已用关系代词which,后一个关系代词宜用that,避免重复?但两个定语从句的结构如果平行,应重复同一个关系代词?
I'll borrow a book which tells about the heroic deeds that the PLA did in the battles against the invaders.
He told me to read a book that is very short, and that is very interesting.
8. that还可引导同位语从句,which则不能?
He told me the news that they would come to see me.
二关系代词which的使用
1.非限制性定语从句中关系代词一般要用which?
She was awarded a gold medal, which the whole family considered a great honour.
2.关系代词前如有介词,关系代词须用which?如把介词移至句末,可用that (或省略)?
There's only one problem about which they disagree.
This is the book(that)she was looking for.
3.如果先行词是that,关系代词应用which?
I have that which you gave me.
4.如先行词和定语从句之间被其它较长的成分分隔,常用which?
Larry told her the story of the young airman which I narrated at the beginning of this book. (先行词为story)
5.在"those+复数形式的名词"结构中,其后的关系代词多用which?
A shop should keep a stock of those goods which sell best.
6.一个句子中如有两个定语从句,第一个定语从句用了关系代词that,第二个从句中的关系代词宜用which?但在平行结构中,应重复同一个关系代词?
This is the book that you bought which you have lost.
I have a house which is located on the hillside, which faces the south.