??xml version="1.0" encoding="utf-8" standalone="yes"?>一区精品视频,一区二区三区波多野结衣在线观看,国内精品久久久久影院薰衣草 http://www.aygfsteel.com/zgli/zh-cn Fri, 06 Jun 2025 21:07:39 GMT Fri, 06 Jun 2025 21:07:39 GMT 60 谈Hibernate的flush机制 http://www.aygfsteel.com/zgli/archive/2006/05/24/47803.htmljava记 java记 Wed, 24 May 2006 05:47:00 GMT http://www.aygfsteel.com/zgli/archive/2006/05/24/47803.html http://www.aygfsteel.com/zgli/comments/47803.html http://www.aygfsteel.com/zgli/archive/2006/05/24/47803.html#Feedback 0 http://www.aygfsteel.com/zgli/comments/commentRss/47803.html http://www.aygfsteel.com/zgli/services/trackbacks/47803.html
随着Hibernate在Java开发中的广泛应用,我们在用Hibernateq行对象持久化操作中也遇C(jin)各种各样的问题。这些问题往(xin)往(xin)都是我们对Hibernate~Z?jin)解所_(d)q里我讲个我从前遇到的问题及(qing)一些想法,希望能给大家一点借鉴?br /> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)q是在一ơ事务提交时遇到的异常?br /> (tng) (tng) (tng) (tng) (tng) (tng) (tng)an (tng)assertion (tng)failure (tng)occured (tng)(this (tng)may (tng)indicate (tng)a (tng)bug (tng)in (tng)Hibernate, (tng)but (tng)is (tng)more (tng)likely (tng)due (tng)to (tng)unsafe (tng)use (tng)of (tng)the (tng)session) net.sf.hibernate.AssertionFailure: (tng)possible (tng)nonthreadsafe (tng)access (tng)to (tng)session 注:(x)非possible (tng)non-threadsafe (tng)access (tng)to (tng)the (tng)session (tng)Q那是另外的错误Q类g不一P(j) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)q个异常应该很多的朋友都遇到q,原因可能各不相同。但所有的异常都应该是在flush或者事务提交的q程中发生的。这一般由我们在事务开始至事务提交的过E中q行?jin)不正确的操作导_(d)也会(x)在多U程同时操作一个Session时发生,q里我们仅仅讨论单线E的情况Q多U程除了(jin)U程同步外基本与此相同?br /> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)至于具体是什么样的错误操作那Q我l大家看一个例子(假设Hibernate配置正确Qؓ(f)保持代码z,不引入包?qing)处理Q何异常)(j) (tng) (tng) SessionFactory (tng)sf (tng)= (tng)new (tng)Configuration().configure().buildSessionFactory() (tng); Session (tng)s (tng)= (tng)sf.openSession(); Cat (tng)cat (tng)= (tng)new (tng)Cat(); Transaction (tng)tran (tng)= (tng)s.beginTransaction(); (tng)(1) s.save(cat); (tng)(2)Q此处同样可以ؓ(f)update (tng)deleteQ?br />s.evict(cat); (tng)(3) tran.commit(); (tng)(4) s.close();(5) (tng) (tng) (tng) (tng) (tng) (tng) (tng)q就是引h异常的典型错误。我当时遇C(jin)q个异常Q检查代码时Ҏ(gu)没感觉到q段代码Z(jin)问题Q想当然的认为在Session上开始一个事务,通过Session对象存入数据库Q再这个对象从Session上拆,提交事务Q这是一个很正常的流E。如果这里正常的话,那问题(sh)定在别处?br /> (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)问题恰恰在q里Q我的想法也许没有错Q但是一个错误的论据所引出的观Ҏ(gu)q都不可能是正确的。因为我一直以为直接在Ҏ(gu)据库q行操作Q忘C(jin)在我与数据库之间隔了(jin)一个HibernateQHibernate在ؓ(f)我们提供持久化服务的同时Q也改变?sh)(jin)我们对数据库的操作方式Q这U方式与我们直接的数据库操作有着很多的不同,正因为我们对q种方式没有一个大致的?jin)解造成?jin)我们的应用q未得到预先设想的结果?br /> (tng) 那Hibernate的持久化机制到底有什么不同那Q简单的_(d)Hibernate在数据库层之上实C(jin)一个缓存区Q当应用save或者update一个对象时QHibernateq未这个对象实际的写入数据库中Q而仅仅是在缓存(sh)Ҏ(gu)应用的行为做?jin)登讎ͼ在真正需要将~存?sh)的数据flush入数据库时才执行先前登记的所有行为?br /> (tng) 在实际执行的q程中,每个Session是通过几个映射和集合来l护所有与该Session建立?jin)关联的对象以?qing)应用对这些对象所q行的操作的Q与我们q次讨论有关的有entityEntriesQ与Session相关联的对象的映)(j)、insertionsQ所有的插入操作集合Q、deletionsQ删除操作集合)(j)、updatesQ更新操作集合)(j)。下面我开始解释在最开始的例子中,Hibernate到底是怎样q作的?br />(1)生成一个事务的对象Qƈ标记当前的Session处于事务状态(注:(x)此时q未启动数据库事务Q?br />(2)应用使用s.save保存cat对象Q这个时候Sessioncatq个对象攑օentityEntriesQ用来标记cat已经和当前的?x)话建立了(jin)关联,׃应用对cat做了(jin)保存的操作,Sessionq要在insertions中登记应用的q个插入行ؓ(f)Q行为包括:(x)对象引用、对象id、Session、持久化处理c)(j)?br />(3)s.evict(cat)cat对象从s?x)话中拆,q时s?x)从entityEntries中将catq个对象Ud?br />(4)事务提交Q需要将所有缓存flush入数据库QSession启动一个事务,q按照insert,update,…?delete的顺序提交所有之前登记的操作Q注意:(x)所有insert执行完毕后才?x)执行updateQ这里的Ҏ(gu)处理也可能会(x)你的程序搞得一团糟Q如需要控制操作的执行序Q要善于使用flushQ,现在cat不在entityEntries中,但在执行insert的行为时只需要访问insertionsp够了(jin)Q所以此时不?x)有M的异常。异常出现在插入后通知Session该对象已l插入完毕这个步骤上Q这个步骤中需要将entityEntries中cat的existsInDatabase标志|ؓ(f)trueQ由于catq不存在于entityEntries中,此时Hibernatep为insertions和entityEntries可能因ؓ(f)U程安全的问题(sh)生了(jin)不同步(也不知道Hibernate的开发者是否考虑C子中的处理方式,如果没有的话Q这也许是一个bug吧)(j)Q于是一个net.sf.hibernate.AssertionFailurep抛出Q程序终止?br /> (tng) 我想现在大家应该明白例子中的E序到底哪里有问题(sh)(jin)吧,我们的错误的认ؓ(f)s.save?x)立即的执行Q而将cat对象q早的与Session拆离Q造成?jin)Session的insertions和entityEntries中内容的不同步。所以我们在做此cL作时一定要清楚Hibernate什么时候会(x)数据flush入数据库Q在未flush之前不要已q行操作的对象从Session上拆R?br /> (tng) 对于q个错误的解x(chng)法是Q我们可以在(2)?3)之间插入一个s.flush()强制Session缓存(sh)的数据flush入数据库Q此时Hibernate?x)提前启动事务,?2)中的save登记的insert语句登记在数据库事务中,q将所有操作集合清I)(j)Q这样在(4)事务提交时insertions集合已l是I的?jin),即我们拆离了(jin)cat也不?x)有M的异怺(jin)?br />前面单的介绍?jin)一下Hibernate的flush机制和对我们E序可能带来的媄(jing)响以?qing)相应的解决?gu)QHibernate的缓存机制还?sh)(x)在其他的方面给我们的程序带来一些意想不到的影响。看下面的例子:(x) (tng) (tng) Qname为cat表的主键Q?br />Cat (tng)cat (tng)= (tng)new (tng)Cat(); cat.setName(“tom?; s.save(cat); cat.setName(“mary?; s.update(cat);(6) Cat (tng)littleCat (tng)= (tng)new (tng)Cat(); littleCat.setName(“tom?; s.save(littleCat); s.flush(); q个例子看v来有什么问题?估计不了(jin)解Hibernate~存机制的h多半?x)说没有问题Q但它也一样不能按照我们的思\正常q行Q在flushq程中会(x)产生主键冲突Q可能你想问Q“在save(littleCat)之前不是已经更改cat.nameq已l更C(jin)么?Z么还?sh)(x)发生主键冲H那Q”这里的原因是我在解释W一个例子时所提到的缓存flush序的问题,Hibernate按照insert,update,…?delete的顺序提交所有登记的操作Q所以你的s.update(cat)虽然在程序中出现在s.save(littleCat)之前Q但是在flush的过E中Q所有的save都将在update之前执行Q这造成?jin)主键冲H的发生?br /> (tng) q个例子中的更改Ҏ(gu)一h?6)之后加入s.flush()强制Session在保存littleCat之前更新cat的name。这样在W二ơflush时就只会(x)执行s.save(littleCat)q次登记的动作,q样׃?x)出C键冲H的状况?br /> (tng) 再看一个例子(很奇怪的例子Q但是能够说明问题)(j) Cat (tng)cat (tng)= (tng)new (tng)Cat(); cat.setName(“tom?; s.save(cat); (tng)(7) s.delete(cat);(8) cat.id=null;(9) s.save(cat);(10) s.flush(); (tng) q个例子在运行时?x)生异常net.sf.hibernate.HibernateException: (tng)identifier (tng)of (tng)an (tng)instance (tng)of (tng)Cat (tng)altered (tng)from (tng)8b818e920a86f038010a86f03a9d0001 (tng)to (tng)null (tng) q里例子也是有关于缓存的问题Q但是原因稍有不同:(x) Q?Q和Q?Q的处理相同?br />Q?QSession?x)在deletions中登记这个删除动作,同时更新entityEntries中该对象的登记状态ؓ(f)DELETED?br />Q?QCatcȝ标识W字Dؓ(f)id,其|ؓ(f)null便于重新分配idq保存进数据库?br />Q?0Q此时Session?x)首先在entityEntries查找cat对象是否曄与Session做过兌Q因为cat只改变(sh)(jin)属性|引用q未改变Q所以会(x)取得状态ؓ(f)DELETED的那个登记对象。由于第二次保存的对象已l在当前Session中删除,save?x)强制Session缓存flush才会(x)l箋(hu)Qflush的过E中首先要执行最开始的save动作Q在q个save中检查了(jin)catq个对象的id是否与原来执行动作时的id相同。不q的是,此时cat的id被赋为nullQ异常被抛出Q程序终止(此处要注意,我们在以后的开发过E尽量不要在flush之前改变已经q行?jin)操作的对象的idQ?br /> (tng) q个例子中的错误也是׃~存的g时更新造成的(当然Q与不正规的使用Hibernate也有关系Q,处理Ҏ(gu)有两U:(x) 1、在Q?Q之后flushQ这样就可以保证Q?0Q处savecat作ؓ(f)一个全新的对象q行保存?br />2、删除(9Q,q样W二ơsave所引v的强制flush可以正常的执行,在数据库中插入cat对象后将其删除,然后l箋(hu)W二ơsave重新插入cat对象Q此时cat的id仍与从前一致?br /> (tng) q两U方法可以根据不同的需要来使用Q呵呵,总觉得好像是很不正规的方式来解决问题Q但是问题本w也不够正规Q只希望能够在应用开发中l大家一些帮助,不对的地方也希望各位l与指正?br /> (tng) ȝ来说Q由于Hibernate的flush处理机制Q我们在一些复杂的对象更新和保存的q程中就要考虑数据库操作顺序的改变?sh)?qing)延时flush是否对程序的l果有媄(jing)响。如果确实存在着影响Q那可以在需要保持这U操作顺序的位置加入flush强制Hibernate缓存(sh)记录的操作flush入数据库Q这L(fng)h也许不太观Q但很有效?/td>
]]> 如何判断一个对象是否是基本cd的Wrapper http://www.aygfsteel.com/zgli/archive/2006/05/22/47491.htmljava记 java记 Mon, 22 May 2006 08:44:00 GMT http://www.aygfsteel.com/zgli/archive/2006/05/22/47491.html http://www.aygfsteel.com/zgli/comments/47491.html http://www.aygfsteel.com/zgli/archive/2006/05/22/47491.html#Feedback 0 http://www.aygfsteel.com/zgli/comments/commentRss/47491.html http://www.aygfsteel.com/zgli/services/trackbacks/47491.html
(tng) (tng) (tng) (tng)
public
(tng)
static
(tng)
void
(tng)main(String[] (tng)args) (tng)
throws
(tng)Exception (tng)
{ (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)System.out.println(isWrapClass(Long.
class
)); (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)System.out.println(isWrapClass(String.
class
)); (tng) (tng) (tng) (tng) (tng)}
(tng) (tng) (tng) (tng) (tng)
public
(tng)
static
(tng)
boolean
(tng)isWrapClass(Class (tng)clz) (tng)
{ (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)
try
(tng)
{ (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)
return
(tng)((Class) (tng)clz.getField(
"
TYPE
"
).get(
null
)).isPrimitive(); (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)}
(tng)
catch
(tng)(Exception (tng)e) (tng)
{ (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)
return
(tng)
false
; (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)}
(tng) (tng) (tng) (tng) (tng)}
(tng)
]]> 如何避免不小?j)关掉web览器窗? http://www.aygfsteel.com/zgli/archive/2006/05/15/46159.htmljava记 java记 Mon, 15 May 2006 01:27:00 GMT http://www.aygfsteel.com/zgli/archive/2006/05/15/46159.html http://www.aygfsteel.com/zgli/comments/46159.html http://www.aygfsteel.com/zgli/archive/2006/05/15/46159.html#Feedback 0 http://www.aygfsteel.com/zgli/comments/commentRss/46159.html http://www.aygfsteel.com/zgli/services/trackbacks/46159.html (tng) g_blnCheckUnload = true; (tng) function RunOnBeforeUnload() { (tng) (tng) (tng) if (g_blnCheckUnload) {window.event.returnValue = 'You will lose any unsaved content'; (tng) (tng) (tng) (tng) (tng) (tng)} (tng) (tng) } </script> <body (tng) onbeforeunload="RunOnBeforeUnload()"> </body> ]]> jdom的简单?/title> http://www.aygfsteel.com/zgli/archive/2006/05/13/45944.htmljava记 java记 Sat, 13 May 2006 01:22:00 GMT http://www.aygfsteel.com/zgli/archive/2006/05/13/45944.html http://www.aygfsteel.com/zgli/comments/45944.html http://www.aygfsteel.com/zgli/archive/2006/05/13/45944.html#Feedback 0 http://www.aygfsteel.com/zgli/comments/commentRss/45944.html http://www.aygfsteel.com/zgli/services/trackbacks/45944.html (tng)
import
(tng)java.io.FileOutputStream;
import
(tng)java.util.List;
import
(tng)org.jdom.Attribute;
import
(tng)org.jdom.Document;
import
(tng)org.jdom.Element;
import
(tng)org.jdom.input.SAXBuilder;
import
(tng)org.jdom.output.Format;
import
(tng)org.jdom.output.XMLOutputter;
public
(tng)
class
(tng)XML (tng)
{ (tng) (tng) (tng) (tng)
public
(tng)
static
(tng)
void
(tng)main(String[] (tng)args) (tng)
throws
(tng)Exception (tng)
{ (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)SAXBuilder (tng)builder (tng)
=
(tng)
new
(tng)SAXBuilder(); (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)Document (tng)doc (tng)
=
(tng)builder.build(
"
d:\\destination.xml
"
); (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)Element (tng)root (tng)
=
(tng)doc.getRootElement(); (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)root.removeChild(
"
Target
"
); (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)Element (tng)items (tng)
=
(tng)root.getChild(
"
Items
"
); (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)List (tng)item (tng)
=
(tng)items.getChildren(
"
item
"
); (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)
for
(tng)(
int
(tng)i (tng)
=
(tng)
0
; (tng)i (tng)
<
(tng)item.size(); (tng)i
++
) (tng)
{ (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)Element (tng)elem (tng)
=
(tng)(Element) (tng)item.get(i); (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)Attribute (tng)attr (tng)
=
(tng)elem.getAttribute(
"
displayName
"
); (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)attr.setValue(attr.getValue() (tng)
+
(tng)
"
中国
"
); (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)}
(tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)
//
(tng)保存
(tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)Format (tng)format (tng)
=
(tng)Format.getCompactFormat(); (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)format.setEncoding(
"
gb2312
"
); (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)format.setIndent(
"
(tng) (tng)
"
); (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)XMLOutputter (tng)XMLOut (tng)
=
(tng)
new
(tng)XMLOutputter(format); (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)XMLOut.output(doc, (tng)
new
(tng)FileOutputStream(
"
d:\\destination_tmp.xml
"
)); (tng) (tng) (tng) (tng)}
}
]]>STUN http://www.aygfsteel.com/zgli/archive/2006/05/12/45862.htmljava记 java记 Fri, 12 May 2006 08:19:00 GMT http://www.aygfsteel.com/zgli/archive/2006/05/12/45862.html http://www.aygfsteel.com/zgli/comments/45862.html http://www.aygfsteel.com/zgli/archive/2006/05/12/45862.html#Feedback 0 http://www.aygfsteel.com/zgli/comments/commentRss/45862.html http://www.aygfsteel.com/zgli/services/trackbacks/45862.html STUN enables a device to find out its public IP address and the type of NAT service its sitting behind.
STUN operates on TCP and UDP port 3478.
STUN is not widely supported by VOIP devices yet.
STUN may use DNS SRV records to find STUN servers attached to a domain. The service name is _stun._udp or _stun._tcp Definitions (from the RFC) STUN Client: A STUN client (also just referred to as a client) is an entity that generates STUN requests. A STUN client can execute on an end system, such as a user's PC, or can run in a network element, such as a conferencing server.
STUN Server: A STUN Server (also just referred to as a server) is an entity that receives STUN requests, and sends STUN responses. STUN servers are generally attached to the public Internet. Various types of NAT (still according to the RFC) Full Cone: A full cone NAT is one where all requests from the same internal IP address and port are mapped to the same external IP address and port. Furthermore, any external host can send a packet to the internal host, by sending a packet to the mapped external address.
Restricted Cone: A restricted cone NAT is one where all requests from the same internal IP address and port are mapped to the same external IP address and port. Unlike a full cone NAT, an external host (with IP address X) can send a packet to the internal host only if the internal host had previously sent a packet to IP address X.
Port Restricted Cone: A port restricted cone NAT is like a restricted cone NAT, but the restriction includes port numbers. Specifically, an external host can send a packet, with source IP address X and source port P, to the internal host only if the internal host had previously sent a packet to IP address X and port P.
Symmetric: A symmetric NAT is one where all requests from the same internal IP address and port, to a specific destination IP address and port, are mapped to the same external IP address and port. If the same host sends a packet with the same source address and port, but to a different destination, a different mapping is used. Furthermore, only the external host that receives a packet can send a UDP packet back to the internal host. ]]>验证密码强度 http://www.aygfsteel.com/zgli/archive/2006/05/10/45339.htmljava记 java记 Wed, 10 May 2006 01:10:00 GMT http://www.aygfsteel.com/zgli/archive/2006/05/10/45339.html http://www.aygfsteel.com/zgli/comments/45339.html http://www.aygfsteel.com/zgli/archive/2006/05/10/45339.html#Feedback 0 http://www.aygfsteel.com/zgli/comments/commentRss/45339.html http://www.aygfsteel.com/zgli/services/trackbacks/45339.html 1、密码由6-32位字母、数字或下划U构成; 2、至需要一位小写字母; 3、至需要一位大写字母; 4、至需要一位数字?br />String (tng)password (tng) = (tng) " password " ; (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)System.out.println(password (tng) != (tng) null (tng) && (tng)password.length() (tng) >= (tng) 6 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)&& (tng)password.length() (tng) <= (tng) 32 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)&& (tng)Pattern.compile( " [a-z]+ " ).matcher(password).find() (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) && (tng)Pattern.compile( " [A-Z]+ " ).matcher(password).find() (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) && (tng)Pattern.compile( " [\\d]+ " ).matcher(password).find());
]]> SwinglgJList的列表数据修改了(jin),如何通知JList改变昄? http://www.aygfsteel.com/zgli/archive/2006/04/28/43694.htmljava记 java记 Fri, 28 Apr 2006 00:28:00 GMT http://www.aygfsteel.com/zgli/archive/2006/04/28/43694.html http://www.aygfsteel.com/zgli/comments/43694.html http://www.aygfsteel.com/zgli/archive/2006/04/28/43694.html#Feedback 0 http://www.aygfsteel.com/zgli/comments/commentRss/43694.html http://www.aygfsteel.com/zgli/services/trackbacks/43694.html (tng) (tng) JListlg有一个单独的昄模式ListModel来表CJList的显C数? (tng) (tng) JList创徏以后,JList数据元素的值及(qing)数据元素的数量可以动态地改变. (tng) (tng) JList在它的数据模式ListModel中观察数据的改变.因此,一个ListModel 的正实现应当在每次数据发生改变?通知事g的监听? (tng) (tng) 当用构造函数JList(Object[])创徏一个JList的实例时,pȝ自?创徏一个DefaultListModel的实例来存储JList的显C数? 可以调用 DefaultListModel中定义的便方法来动态地修改JList的数??removeElementAt(index),addElement(Object){? DefaultListModel 在修Ҏ(gu)据的同时,通知JList关于数据的改? (tng) (tng)
(tng)
]]> 如何防止swingH口改变大小和最化 http://www.aygfsteel.com/zgli/archive/2006/04/28/43693.htmljava记 java记 Fri, 28 Apr 2006 00:28:00 GMT http://www.aygfsteel.com/zgli/archive/2006/04/28/43693.html http://www.aygfsteel.com/zgli/comments/43693.html http://www.aygfsteel.com/zgli/archive/2006/04/28/43693.html#Feedback 0 http://www.aygfsteel.com/zgli/comments/commentRss/43693.html http://www.aygfsteel.com/zgli/services/trackbacks/43693.html (tng)
import
(tng)java.awt.
*
;
import
(tng)java.awt.event.
*
;
public
(tng)
class
(tng)MyFrame (tng)
extends
(tng)Frame
{
{
public
(tng)MyFrame()
{ (tng) (tng)setSize(
500
,
400
); (tng) (tng)setResizable( (tng)
false
(tng)); (tng) (tng) (tng)
this
.addWindowStateListener(
new
(tng)WindowStateListener()
{
//
状态监听器
(tng) (tng) (tng) (tng)
public
(tng)
void
(tng)windowStateChanged(WindowEvent (tng)e)
{ (tng) (tng) (tng) (tng) (tng) (tng)
if
(getState()
==
1
)
{
//
最化状?/span>
(tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)setState(
0
);
//
切换成正常状?/span>
(tng) (tng) (tng) (tng) (tng) (tng)}
(tng) (tng) (tng) (tng)}
(tng) (tng)}
); }
public
(tng)
static
(tng)
void
(tng)main(String[] (tng)args)
{ (tng) (tng) (tng) (tng)
new
(tng)MyFrame().setVisible(
true
); }
}
]]> Big endian VS Little endian http://www.aygfsteel.com/zgli/archive/2006/04/25/43033.htmljava记 java记 Tue, 25 Apr 2006 07:21:00 GMT http://www.aygfsteel.com/zgli/archive/2006/04/25/43033.html http://www.aygfsteel.com/zgli/comments/43033.html http://www.aygfsteel.com/zgli/archive/2006/04/25/43033.html#Feedback 0 http://www.aygfsteel.com/zgli/comments/commentRss/43033.html http://www.aygfsteel.com/zgli/services/trackbacks/43033.html Big endian machine: It thinks the first byte it reads is the biggest. Little endian machine: It thinks the first byte it reads is the littlest. 举个例子Q从内存地址0x0000开始有以下数据 (tng)0x0000 (tng) (tng) (tng) (tng) (tng)0x12 (tng)0x0001 (tng) (tng) (tng) (tng) (tng)0x34 (tng)0x0002 (tng) (tng) (tng) (tng) (tng)0xab (tng)0x0003 (tng) (tng) (tng) (tng) (tng)0xcd 如果我们去读取一个地址?x0000的四个字节变量,若字节序为big-endianQ则d l果?x1234abcdQ若字节序位little-endianQ则dl果?xcdab3412. 如果我们?x1234abcd写入C0x0000开始的内存?sh),则结果?f) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)big-endian (tng) (tng) (tng) (tng) (tng)little-endian 0x0000 (tng) (tng) (tng) (tng) (tng)0x12 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)0xcd 0x0001 (tng) (tng) (tng) (tng) (tng)0x23 (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)0xab 0x0002 (tng) (tng) (tng) (tng) (tng)0xab (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)0x34 0x0003 (tng) (tng) (tng) (tng) (tng)0xcd (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng) (tng)0x12 x86pdCPU都是little-endian的字节序. ]]> About VoIP ? http://www.aygfsteel.com/zgli/archive/2006/04/05/39313.htmljava记 java记 Wed, 05 Apr 2006 01:59:00 GMT http://www.aygfsteel.com/zgli/archive/2006/04/05/39313.html http://www.aygfsteel.com/zgli/comments/39313.html http://www.aygfsteel.com/zgli/archive/2006/04/05/39313.html#Feedback 1 http://www.aygfsteel.com/zgli/comments/commentRss/39313.html http://www.aygfsteel.com/zgli/services/trackbacks/39313.html Internet Voice, also known as Voice over Internet Protocol (VoIP), is a technology that allows you to make telephone calls using a broadband Internet connection instead of a regular (or analog) phone line. Some services using VoIP may only allow you to call other people using the same service, but others may allow you to call anyone who has a telephone number - including local, long distance, mobile, and international numbers. Also, while some services only work over your computer or a special VoIP phone, other services allow you to use a traditional phone through an adaptor. ]]>
վ֩ģ壺
|
|
ƽ |
̨ |
«Ϫ |
ͨ |
üɽ |
|
ٷ |
|
ˮ |
̫ |
|
|
ɣ |
|
ݳ |
ͭϿ |
|
|
|
|
|
|
|
|
° |
ī |
|
ɽʡ |
ض |
|
˳ |
Ӽ |
ɽ |
ƽ |
Զ |
ֶ |
|
|
|