星期三, 三月 31, 2004

星期二, 三月 30, 2004

Macromedia - Macromedia Flex Developer Center (Beta)

Macromedia - Macromedia Flex Developer Center (Beta)

!!!!!!!!!!!!!!!!!!!!!!!棒.
http://www.macromedia.com/devnet/flex/

星期一, 三月 29, 2004

JSP Web 页面实现表格列表Off-line数据大比较.ResultSet vs CachedResultSet vs Result

典型应用类似Microsoft传统桌面技术ADO.
通过JDBC ResultSet 得到查询结果后,传统方式是直接通过.next()来Iterator显示所有记录。这种方式同MVC的偶合程度比较紧凑,经常需要许多HTML来格式化表现的内容。
目前采用Collection VO(Value Object)或Collection POJO(Plaint old Java Object)模式来把查询结果传递到Servlet Front-controler来处理。

所有的项目都需要编写这种无聊的代码。

Sun 终于推出了javax.sql.RowSet包来解决了这种问题。不过目前依然是Public Review 2版本,bug一大堆。依然不能用在生产环境种。在这之前,成熟的可以使用的替代方法,只有JSTL带来的ResultSet, javax.servlet.
jsp.jstl.sql.Result.可以把JDBC ResultSet 转换为Off-line的Result.避免了ResultSet显示不能释放connection的弊病.

调用方法:Result.toResult(java.sql.ResultSet rs) .
这中方法提供了导航和分页的基本支持。可以在JSTL自然使用。
不过更加完美的RowSet包中的CachedRowSetImpl已经计划包含在J2SE 1。5种了。到那里,off-line 表格式的显示,编辑,才能真正完美实现。
.目前通过JSTL的Result和<sql:update> tag也可以做到很多工作了。不过需要手工编写大量的代码。
等javax.sql.RowSet包完全实现后,就可以放弃传统的编码方法了。
官方网站:http://www.jcp.org/en/jsr/detail?id=114


星期五, 三月 26, 2004

JNDI: Resource Configuration

JNDI: Resource ConfigurationGood article.

Get disconnected with CachedRowSet/极大的一小步

这篇文章对RowSet技术给出了一个概览:详细参考:http://jcp.org/en/jsr/detail?id=114

Get disconnected with CachedRowSet:

Propose:希望能提供一种列表格结构的数据供应用程序使用(tabular).典型的为查询结果等

所以jcp努力工作给出了这个规范.包含在jdk 1.5中了.其他版本需要下载附加包.

星期四, 三月 25, 2004

如何在JSF中使用Javascript进行简单数据校验(validate)

JSF会自动concat 上层组件的ID作为到下层组件ID一部分.极其麻烦.因为分隔符号为":",
所以,所有变量名为"<..>:"的方式.
如下:
<h:view>
<h:selectManyCheckbox id="toggleAll" onclick="ToggleAll(this);">
<f:selectItem id="ALL" itemLabel="ALL Selected" itemValue=""/>
</h:selectManyCheckbox>
<h:selectManyCheckbox id="bb" onclick="Toggle(this);" >
<f:selectItem itemValue="aaaa" itemLabel="苹果"/>
<f:selectItem itemValue="bbbb" itemLabel="橡胶"/>
<f:selectItem itemValue="cccc" itemLabel="西瓜"/>
<f:selectItem itemValue="dddd" itemLabel="草梅"/>
<f:selectItem itemValue="eeee" itemLabel="蜜枣"/>
<f:selectItem itemValue="ffff" itemLabel="土豆"/>
</h:selectManyCheckbox>
</h:view>

如果想在Javascript表中访问这些对象,必须使用elements对象来引用(冒出一头冷汗)
document.forms["messageList"].elements["messageList:bb"].checked=true;
<script>
function Toggle(e)
{
if (e.checked) {
document.forms["messageList"].elements["messageList:toggleAll"].checked = AllChecked();
}
else {
document.forms["messageList"].elements["messageList:toggleAll"].checked = false;
}
}
</script>

星期三, 三月 24, 2004

Java Security vocal Summary

see this

为什么JSF 1.0在Jboss下总是 出现cannot find facecontext错误?

原因:在访问的URL要加入触发javax.faces.webapp.FacesServlet 的pattern
配置
1.faces-config.xml

<?xml version='1.0' encoding='UTF-8'?>

<!--
Copyright 2004 Sun Microsystems, Inc. All rights reserved.
SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
-->

<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
"http://java.sun.com/dtd/web-facesconfig_1_0.dtd">

<!-- =========== FULL CONFIGURATION FILE ================================== -->

<faces-config>

<navigation-rule>
<from-view-id>/confirmChoices.jsp</from-view-id>
<navigation-case>
<description>
Any action that returns "carDetail" on confirmChoices.jsp should
cause navigation to carDetail.jsp
</description>
<from-outcome>index</from-outcome>
<to-view-id>/index.jsp</to-view-id>
</navigation-case>
</navigation-rule>


</faces-config>

2. web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>testjsf</display-name>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<taglib>
<taglib-uri>http://java.sun.com/jsf/core</taglib-uri>
<taglib-location>/WEB-INF/jsf_core.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jsf/html</taglib-uri>
<taglib-location>/WEB-INF/html_basic.tld</taglib-location>
</taglib>
</web-app>

3.index.jsp

<%@ page contentType="text/html; charset=UTF-8" %>

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

<html>
<head>
<title>
JSF Test.
</title>
</head>
<body bgcolor="#008000">
<h1>
Hlsjlksfjslf:)</h1>
<f:view>

<h:commandButton id="aaa" value=":)">
</h:commandButton>
</f:view>
</body>
</html>

星期一, 三月 22, 2004

最简洁得到browser header代码

In jsp:
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<c:forEach var="product" items="${header}" varStatus="status">
<tr>
<td><c:out value="${status.count}"/></td>
<td><c:out value="${product}"/></td>
</tr>
</c:forEach>

星期四, 三月 18, 2004

The Memory Management Reference: Full Bibliography关于java object refefence理论解释.

The Memory Management Reference: Full Bibliography

very good

These are all available details on all books and papers in this bibliography.
Each entry lists some or all of the following:




  • Author or authors (linked to summary by author);


  • Publication date;

  • Title;

  • Publisher (linked to web site, if known);

  • Publisher's identifier (ISBN for books);

  • URL of document online or ordering information (if known).



Entries are ordered by first author and publication date.




Ole Agesen, David L. Detlefs. 1997. Finding References in JavaTM Stacks. Sun Labs. OOPSLA97 Workshop on Garbage Collection and Memory Management. Abstract. Online.




Ole Agesen, David L. Detlefs, J. Eliot B. Moss. 1998. Garbage Collection and Local Variable Type-precision and Liveness in JavaTM Virtual Machines . ACM. Proceedings of the ACM SIGPLAN '98 conference on Programming language design and implementation, pages 269-279. Abstract. Online. Online.




Andrew Appel, John R. Ellis, Kai Li. 1988. Real-time Concurrent Collection on Stock Multiprocessors. ACM, SIGPLAN. ACM PLDI 88, SIGPLAN Notices 23, 7 (July 88), pp. 11-20. Abstract. Online.




Apple Computer, Inc.. 1994. Inside Macintosh: Memory. Addison-Wesley. ISBN 0-201-63240-3. Abstract. Online.



Giuseppe Attardi, Tito Flagella. 1994. A Customisable Memory Management Framework. TR-94-010. Abstract. Online.




Giuseppe Attardi, Tito Flagella, Pietro Iglio. 1998. A customisable memory management framework for C++. Software -- Practice and Experience. 28(11), 1143-1183. Abstract. Online.



Alain Azagury, Elliot K. Kolodner, Erez Petrank, Zvi Yehudai. 1998. Combining Card Marking with Remembered Sets: How to Save Scanning Time. ACM. ISMM'98 pp.10--19. Abstract. Online.




Henry G. Baker, Carl Hewitt. 1977. The Incremental Garbage Collection of Processes. Abstract. Online.



Henry G. Baker. 1978. List Processing in Real Time on a Serial Computer. ACM. Communications of the ACM 21, 4 (April 1978), pp. 280-294. Abstract. Online.




Henry G. Baker. 1979. Optimizing Allocation and Garbage Collection of Spaces. Abstract. Online.



Henry G. Baker. 1991. Cache-Conscious Copying Collectors. Abstract. Online.




Henry G. Baker. 1992. Lively Linear Lisp -- 'Look Ma, No Garbage!'. Abstract. Online.



Henry G. Baker. 1992. The Treadmill: Real-Time Garbage Collection Without Motion Sickness. Abstract. Online.




Henry G. Baker. 1992. CONS Should not CONS its Arguments, or, a Lazy Alloc is a Smart Alloc. Abstract. Online.



Henry G. Baker. 1992. NREVERSAL of Fortune -- The Thermodynamics of Garbage Collection. Springer-Verlag. LNCS Vol. 637, pp. ?. Abstract. Online.




Henry G. Baker. 1993. 'Infant Mortality' and Generational Garbage Collection. Abstract. Online.



Henry G. Baker. 1993. Equal Rights for Functional Objects or, The More Things Change, The More They Are the Same. ACM. ACM OOPS Messenger 4, 4 (October 1993), pp. 2-27. Abstract. Online.




Henry G. Baker. 1994. Minimizing Reference Count Updating with Deferred and Anchored Pointers for Functional Data Structures. Abstract. Online.



Henry G. Baker. 1994. Thermodynamics and Garbage Collection. ACM. ACM Sigplan Notices 29,4 (April 1994), 58-63.. Abstract. Online.




Henry G. Baker. 1995. 'Use-Once' Variables and Linear Objects -- Storage Management, Reflection and Multi-Threading. SIGPLAN. AMC SIGPLAN Notices 30(1). Abstract. Online.



Henry G. Baker. 1995. Memory Management: International Workshop IWMM'95. Springer-Verlag. ISBN 3-540-60368-9. Abstract. Online.




Nick Barnes, Richard Brooksby, David Jones, Gavin Matthews, Pekka P. Pirinen, Nick Dalton, P. Tucker Withington. 1997. A Proposal for a Standard Memory Management Interface. OOPSLA97 Workshop on Garbage Collection and Memory Management. Online.




David A. Barrett, Benjamin Zorn. 1993. Using Lifetime Predictors to Improve Memory Allocation Performance. ACM, SIGPLAN. SIGPLAN'93 Conference on Programming Language Design and Implementation, pp. 187-196. Abstract.



David A. Barrett, Benjamin Zorn. 1995. Garbage Collection using a Dynamic Threatening Boundary. SIGPLAN. ACM SIGPLAN'95 Conference on Programming Language Design and Implementation, pp301-314. Abstract. Online.




Joel F. Bartlett. 1988. Compacting Garbage Collection with Ambiguous Roots. Digital Equipment Corporation. Abstract. Online.



Joel F. Bartlett. 1989. Mostly-Copying Garbage Collection Picks Up Generations and C++. Digital Equipment Corporation. Abstract. Online.




Yves Bekkers, Jacques Cohen. 1992. Memory Management, International Workshop IWMM 92. Springer-Verlag. LNCS Vol. 637, ISBN 3-540-55940-X. Online.



Emery D. Berger, Robert D. Blumofe. 1999. Hoard: A Fast, Scalable, and Memory-Efficient Allocator for Shared-Memory Multiprocessors. University of Texas at Austin. UTCS TR99-22. Abstract. Online.




Hans-J. Boehm, Mark Weiser. 1988. Garbage collection in an uncooperative environment. Software -- Practice and Experience. 18(9):807-820. Abstract.



Hans-J. Boehm, Alan J. Demers, Scott Shenker. 1991. Mostly Parallel Garbage Collection. Xerox PARC. ACM PLDI 91, SIGPLAN Notices 26, 6 (June 1991), pp. 157-164. Abstract. Online.




Hans-J. Boehm, David Chase. 1992. A Proposal for Garbage-Collector-Safe C Compilation. Journal of C Language Translation. vol. 4, 2 (December 1992), pp. 126-141. Online.



Hans-J. Boehm. 1993. Space Efficient Conservative Garbage Collection. ACM, SIGPLAN. Proceedings of the ACM SIGPLAN '91 Conference on Programming Language Design and Implementation, SIGPLAN Notices 28, 6, pp 197-206. Abstract. Online.




Hans-J. Boehm. 2000. Reducing Garbage Collector Cache Misses. ACM. ISMM'00 pp. 59-64. Abstract.



P. Branquart, J. Lewi. 1972. A scheme of storage allocation and garbage collection for ALGOL 68. Elsevier/North-Holland. ALGOL 68 Implementation -- Proceedings of the IFIP Working Conference on ALGOL 68 Implementation, July 1970.




Brad Calder, Dirk Grunwald, Benjamin Zorn. 1994. Quantifying Behavioral Differences Between C and C++ Programs. Journal of Programming Languages. 2(4):313-351. Abstract. Online.



Dante J. Cannarozzi, Michael P. Plezbert, Ron K. Cytron. 2000. Contaminated garbage collection. ACM. Proceedings of the ACM SIGPLAN '00 conference on on Programming language design and implementation, pp. 264-273. Online.




Patrick J. Caudill, Allen Wirfs-Brock. 1986. A Third-Generation Smalltalk-80 Implementation. SIGPLAN Notices. 21(11), OOPSLA'86 ACM Conference on Object-Oriented Systems, Languages and Applications.



C. J. Cheney. 1970. A non-recursive list compacting algorithm. CACM. 13-11 pp677--678.



Perry Cheng, Robert Harper, Peter Lee. 1998. Generational stack collection and profile-driven pretenuring. ACM. Proceedings of SIGPLAN'98 Conference on Programming Language Design and Implementation, pp. 162-173. Online. Online.




Trishul M. Chilimbi, James R. Larus. 1998. Using Generational Garbage Collection To Implement Cache-Conscious Data Placement. ACM. ISMM'98 pp.37--48. Abstract. Online.



William D Clinger, Lars T Hansen. 1997. Generational Garbage Collection and the Radioactive Decay Model. ACM. Proceedings of PLDI 1997. Abstract.




Jacques Cohen. 1981. Garbage collection of linked data structures. Computing Surveys. Vol. 13, no. 3. Abstract.



Dominique Colnet, Philippe Coucaud, Olivier Zendra. 1998. Compiler Support to Customize the Mark and Sweep Algorithm. ACM. ISMM'98 pp.154-165. Abstract. Online.




Jonathan E. Cook, Alexander L. Wolf, Benjamin Zorn. 1994. Partition Selection Policies in Object Database Garbage Collection. ACM, SIGMOD. International Conference on the Management of Data (SIGMOD'94), pp. 371-382. Abstract.



Jonathan E. Cook, Artur Klauser, Alexander L. Wolf, Benjamin Zorn. 1996. Semi-automatic, Self-adaptive Control of Garbage Collection Rates in Object Databases. ACM, SIGMOD. International Conference on the Management of Data (SIGMOD'96), pp377-388.




Eric Cooper, Scott Nettles, Indira Subramanian. 1992. Improving the Performance of SML Garbage Collection using Application-Specific Virtual Memory Management. ACM. Abstract.



Michael C. Daconta. 1993. C Pointers and Dynamic Memory Management. Wiley. ISBN 0-471-56152-5.




Michael C. Daconta. 1995. C++ Pointers and Dynamic Memory Management. Wiley. ISBN 0-471-04998-0. Abstract.



O.-J. Dahl. 1963. The SIMULA Storage Allocation Scheme. Norsk Regnesentral. NCC Document no. 162.



P. J. Denning. 1968. Thrashing: Its Causes and Prevention. Proceedings AFIPS,1968 Fall Joint Computer Conference, vol. 33, pp. 915-922.




P. J. Denning. 1970. Virtual Memory. ACM. ACM Computing Surveys, vol. 2, no. 3, pp. 153-190, Sept. 1970.



P. J. Denning, S. C. Schwartz. 1972. Properties of the Working-set Model. CACM. CACM, vol. 15, no. 3, pp. 191-198.



David L. Detlefs. 1992. Garbage collection and runtime typing as a C++ library. USENIX. USENIX C++ Conference.




David L. Detlefs, Al Dosser, Benjamin Zorn. 1994. Memory Allocation Costs in Large C and C++ Programs. Software -- Practice and Experience. 24(6):527-542. Abstract. Online.



L. Peter Deutsch, Daniel G. Bobrow. 1976. An Efficient, Incremental, Automatic Garbage Collector. CACM. CACM, vol. 19, no. 9, pp. 522-526.




E. W. Dijkstra, Leslie Lamport, A. J. Martin, C. S. Scholten, E. F. M. Steffens. 1976. On-the-fly Garbage Collection: An Exercise in Cooperation. Springer-Verlag. Lecture Notes in Computer Science, Vol. 46.



Amer Diwan, Richard L. Hudson, J. Eliot B. Moss. 1992. Compiler Support for Garbage Collection in a Statically Typed Language. ACM. Proceedings of the 5th ACM SIGPLAN conference on Programming language design and implementation, pages 273-282. Abstract. Online.




Amer Diwan, David Tarditi, J. Eliot B. Moss. 1993. Memory Subsystem Performance of Programs with Intensive Heap Allocation. Carnegie Mellon University. CMU-CS-93-227. Abstract. Online.



Amer Diwan, David Tarditi, J. Eliot B. Moss. 1994. Memory Subsystem Performance of Programs Using Copying Garbage Collection. ACM. CMU-CS-93-210, also in POPL '94. Abstract.




Damien Doligez, Xavier Leroy. 1993. A concurrent, generational garbage collector for a multithreaded implementation of ML. ACM. POPL '93, 113-123. Abstract. Online.



Damien Doligez, Georges Gonthier. 1994. Portable, unobtrusive garbage collection for multiprocessor systems. ACM. POPL '94, 70-83. Abstract. Online.




R. Kent Dybvig, Carl Bruggeman, David Eby. 1993. Guardians in a Generation-Based Garbage Collector. SIGPLAN. Proceedings of the ACM SIGPLAN '93 Conference on Programming Language Design and Implementation, June 1993. Abstract. Online.



Daniel R. Edelson. 1992. Smart pointers: They're smart, but they're not pointers. USENIX. USENIX C++ Conference.




Daniel R. Edelson. 1992. Comparing Two Garbage Collectors for C++. University of California at Santa Cruz. Technical Report UCSC-CRL-93-20.



Daniel J. Edwards. n.d. Lisp II Garbage Collector. MIT. AI Memo 19 (AIM-19). Abstract. Online.




John R. Ellis, David L. Detlefs. 1993. Safe, Efficient Garbage Collection for C++. Abstract.



Paulo Ferreira. 1996. Larchant: garbage collection in a cached distributed shared store with persistence by reachability. Université Paris VI. Thése de doctorat. Abstract. Online.




Paulo Ferreira, Marc Shapiro. 1998. Modelling a Distributed Cached Store for Garbage Collection. Springer-Verlag. Proceedings of 12th European Conference on Object-Oriented Programming, ECOOP98, LNCS 1445. Online.



Daniel P Friedman, David S. Wise. 1976. Garbage collecting a heap which includes a scatter table. Information Processing Letters. 5, 6 (December 1976): 161-164.




Daniel P Friedman, David S. Wise. 1977. The One-Bit Reference Count. BIT. (17)3: 351-359. Abstract.



Daniel P Friedman, David S. Wise. 1979. Reference counting can manage the circular environments of mutual recursion. Information Processing Letters. 8, 1 (January 1979): 41--45.




Dirk Grunwald, Benjamin Zorn, R. Henderson. 1993. Improving the Cache Locality of Memory Allocation. SIGPLAN. SIGPLAN '93, Conference on PLDI, June 1993, Albuquerque, New Mexico. Abstract. Online.



Dirk Grunwald, Benjamin Zorn. 1993. CustoMalloc: Efficient Synthesized Memory Allocators. Software -- Practice and Experience. 23(8):851-869. Abstract.




David Gudeman. 1993. Representing Type Information in Dynamically Typed Languages. University of Arizona at Tucson. Technical Report TR 93-27. Abstract. Online.



Timothy Harris. 1999. Early storage reclamation in a tracing garbage collector. ACM. ACM SIG-PLAN Notices 34:4, pp. 46-53. Abstract. Online.




Roger Henriksson. 1994. Scheduling Real Time Garbage Collection. Department of Computer Science at Lund University. LU-CS-TR:94-129. Abstract. Online.



Roger Henriksson. 1996. Adaptive Scheduling of Incremental Copying Garbage Collection for Interactive Applications. NWPER96. Abstract. Online.




Roger Henriksson. 1998. Scheduling Garbage Collection in Embedded Systems. Department of Computer Science at Lund University. Ph.D. thesis. Abstract. Online.



Antony L. Hosking. 1991. Main memory management for persistence. ACM. Proceedings of the ACM OOPSLA'91 Workshop on Garbage Collection. Online.




Antony L. Hosking, J. Eliot B. Moss, Darko Stefanovic. 1992. A comparative performance evaluation of write barrier implementations. ACM. OOPSLA'92 Conference Proceedings, ACM SIGPLAN Notices 27(10), pp 92-109. Online.



Antony L. Hosking, Richard L. Hudson. 1993. Remembered sets can also play cards. ACM. Proceedings of the ACM OOPSLA'93 Workshop on Memory Management and Garbage Collection. Online.




Antony L. Hosking, J. Eliot B. Moss. 1993. Protection traps and alternatives for memory management of an object-oriented language. ACM. Proceedings of the Fourteenth ACM Symposium on Operating Systems Principles, ACM Operating Systems Review 27(5), pp 106-119. Online.



Richard L. Hudson, J. Eliot B. Moss, Amer Diwan, Christopher F. Weight. 1991. A Language-Independent Garbage Collector Toolkit. University of Massachusetts at Amherst. COINS Technical Report 91-47. Abstract.




Richard L. Hudson, J. Eliot B. Moss. 1992. Incremental Collection of Mature Objects. Springer-Verlag. LNCS #637 International Workshop on Memory Management, St. Malo, France, Sept. 1992, pp. 388-403. Abstract. Online.



Richard L. Hudson, Ron Morrison, J. Eliot B. Moss, David S. Munro. 1997. Garbage Collecting the World: One Car at a Time. ACM. Proc. OOPSLA 97, pp.162-175. Abstract. Online.




Jin-Soo Kim, Xiaohan Qin, Yarsun Hsu. 1998. Memory Characterization of a Parallel Data Mining Workload. IEEE. Proc. Workload Characterization: Methodology and Case Studies, pp. . Abstract. Online.



Jin-Soo Kim, Yarsun Hsu. 2000. Memory system behavior of Java programs: methodology and analysis. ACM. Proc. International conference on measurements and modeling of computer systems, pp. 264-274. Online.




Mark S. Johnstone. 1997. Non-Compacting Memory Allocation and Real-Time Garbage Collection. University of Texas at Austin. Abstract. Online.



Mark S. Johnstone, Paul R. Wilson. 1998. The Memory Fragmentation Problem: Solved?. ACM. ISMM'98 pp.26-36. Abstract. Online.




Richard E. Jones. 1992. Tail recursion without space leaks. Journal of Functional Programming. 2(1):73-79.



Richard E. Jones, Rafael Lins. 1992. Cyclic weighted reference counting without delay. Computing Laboratory, The University of Kent at Canterbury. Technical Report 28-92. Abstract. Online.




Richard E. Jones, Rafael Lins. 1996. Garbage Collection: Algorithms for Automatic Dynamic Memory Management. Wiley. ISBN 0-471-94148-4. Abstract. Online.



Richard E. Jones. 1998. ISMM'98 International Symposium on Memory Management. ACM. ISBN 1-58113-114-3. Abstract. Online.




Bob Kanefsky. 1989. Recursive Memory Allocation. Bob Kanefsky. Songworm 3, p.?. Online.



Elliot K. Kolodner. 1992. Atomic Incremental Garbage Collection and Recovery for a Large Stable Heap. Laboratory for Computer Science at MIT. MIT-LCS-TR-534. Abstract.



Per-Åke Larson, Murali Krishnan. 1998. Memory Allocation for Long-Running Server Applications. ACM. ISMM'98 pp.176--185. Abstract. Online.




Henry Lieberman, Carl Hewitt. 1983. A real-time garbage collector based on the lifetimes of objects. ACM. 26(6):419-429.



J. McCarthy, M. L. Minsky. 1959. Artificial Intelligence, Quarterly Progress Report no. 53. Research Laboratory of Electronics at MIT.




J. McCarthy. 1960. Recursive Functions of Symbolic Expressions and Their Computation by Machine. CACM. Abstract. Online.



Veljko Milutinovic, Jelica Protic, Milo Tomasevic. 1997. Distributed shared memory: concepts and systems. IEEE Computer Society Press. ISBN 0-8186-7737-6. Abstract. Online.




M. L. Minsky. 1963. A LISP Garbage Collector Algorithm Using Serial Secondary Storage. MIT. Memorandum MAC-M-129, Artificial Intelligence Project, Memo 58 (revised).



David Moon. 1984. Garbage Collection in a Large Lisp System. ACM. Symposium on Lisp and Functional Programming, August 1984.



David Moon. 1985. Architecture of the Symbolics 3600. IEEE. 12th International Symposium on Computer Architecture, pp. 76-83.




David Moon. 1990. Symbolics Architecture. Wiley. Chapter 3 of "Computers for Artificial Intelligence Processing", ISBN 0-471-84811-5.



David Moon. 1991. Genera Retrospective. IEEE. 1991 International Workshop on Object Orientation in
Operating Systems, order #2265.



Ben-Ari Mordechai. 1984. Algorithms for On-the-fly Garbage Collection. TOPLAS. TOPLAS 6(3): 333-344 (1984).




Luc Moreau. 1998. Hierarchical Distributed Reference Counting. ACM. ISMM'98 pp.57-67. Online.



Greg Morrisett, Matthias Felleisen, Robert Harper. 1995. Abstract Models of Memory Management. Carnegie Mellon University. CMU-CS-FOX-95-01. Abstract. Online.




David S. Munro, Alfred Brown, Ron Morrison, J. Eliot B. Moss. 1999. Incremental Garbage Collection of a Persistent Object Store using PMOS. Morgan Kaufmann. in Advances in Persistent Object Systems, pp. 78-91. Abstract.



Scott Nettles, James O'Toole, David Pierce, Nickolas Haines. 1992. Replication-Based Incremental Copying Collection. IWMM'92. Abstract.




Scott Nettles. 1992. A Larch Specification of Copying Garbage Collection. Carnegie Mellon University. CMU-CS-92-219. Abstract.



Scott Nettles, James O'Toole. 1993. Implementing Orthogonal Persistence: A Simple Optimization Using Replicating Collection. USENIX. IWOOOS'93. Abstract.




Scott Nettles, James O'Toole. 1993. Real-Time Replication Garbage Collection. ACM. PLDI'93. Abstract.



Norman R. Nielsen. 1977. Dynamic Memory Allocation in Computer Simulation. ACM. CACM 20:11. Abstract.




James O'Toole. 1990. Garbage Collecting Locally. Abstract.



James O'Toole, Scott Nettles. 1994. Concurrent Replicating Garbage Collection. ACM. LFP'94. Abstract.




Simon Peyton Jones, Norman Ramsey, Fermin Reig. 1999. C--: a portable assembly language that supports garbage collection. Springer-Verlag. International Conference on Principles and Practice of Declarative Programming 1999, LNCS 1702, pp. 1-28. Abstract. Online.



John S. Pieper. 1993. Compiler Techniques for Managing Data Motion. Carnegie Mellon University. Technical report number CMU-CS-93-217. Abstract.




Pekka P. Pirinen. 1998. Barrier techniques for incremental tracing. ACM. ISMM'98 pp.20-25. Abstract. Online.



Tony Printezis. 1996. Disk Garbage Collection Strategies for Persistent Java. Proceedings of the First International Workshop on Persistence and Java. Abstract. Online.




Tony Printezis, Quentin Cutts. 1996. Measuring the Allocation Rate of Napier88. Department of Computing Science at University of Glasgow. TR ?. Online.



M. B. Reinhold. 1993. Cache Performance of Garbage Collected Programming Languages. Laboratory for Computer Science at MIT. MIT/LCS/TR-581. Abstract.




J. M. Robson. 1977. Worst case fragmentation of first fit and best bit storage allocation strategies. ACM. ACM Computer Journal, 20(3):242-244.



Gustavo Rodriguez-Rivera, Vince Russo. 1997. Non-intrusive Cloning Garbage Collection with Stock Operating System Support. Software -- Practice and Experience. 27:8. Abstract.




Niklas Röjemo. 1995. Highlights from nhc -- a space-efficient Haskell compiler. Chalmers University of Technology. Abstract. Online.



Niklas Röjemo. 1995. Generational garbage collection for lazy functional languages without temporary space leaks. Chalmers University of Technology. Online.




Niklas Röjemo, Colin Runciman. 1996. Lag, drag, void and use -- heap profiling and space-efficient compilation revisited. ACM, SIGPLAN. ICFP'96, ACM SIGPLAN Notices 31:6, ISBN 0-89791-770-7, pp. 34-41. Abstract. Online.



David J. Roth, David S. Wise. 1999. One-bit counts between unique and sticky. ACM. ISMM'98, pp. 49--56. Abstract. Online. Online.




Paul Rovner. 1985. On Adding Garbage Collection and Runtime Types to a Strongly-Typed, Statically-Checked, Concurrent Language. Xerox PARC. TR CSL-84-7.



Colin Runciman, David Wakeling. 1992. Heap Profiling of Lazy Functional Programs. University of York. Abstract. Online.




Colin Runciman, Niklas Röjemo. 1994. New dimensions in heap profiling. University of York. Abstract. Online.



Colin Runciman, Niklas Röjemo. 1996. Two-pass heap profiling: a matter of life and death. Department of Computer Science, University of York. Online.




Jacob Seligmann, Steffen Grarup. 1995. Incremental Mature Garbage Collection Using the Train Algorithm. Springer-Verlag. ECOOP'95, Lecture Notes in Computer Science, Vol. 952, pp. 235-252, ISBN 3-540-60160-0. Abstract. Online.



Manuel Serrano, Hans-J. Boehm. 2000. Understanding memory allocation of Scheme programs. ACM. Proceedings of International Conference on Functional
Programming 2000.




Marc Shapiro, Paulo Ferreira. 1994. Larchant-RDOSS: a distributed shared persistent memory and its garbage collector. INRIA. INRIA Rapport de Recherche no. 2399; Cornell Computer Science TR94-1466. Abstract. Online.



Robert A. Shaw. 1987. Improving Garbage Collector Performance in Virtual Memory. Stanford University. CSL-TR-87-323.




Robert A. Shaw. 1988. Empirical Analysis of a LISP System. Stanford University. CSL-TR-88-351.



Vivek Singhal, Sheetal V. Kakkad, Paul R. Wilson. 1992. Texas: An Efficient, Portable Persistent Store. University of Texas at Austin. Abstract. Online.




P. G. Sobalvarro. 1988. A Lifetime-based Garbage Collector for LISP Systems on General-Purpose Computers. MIT. AITR-1417. Abstract. Online.



Guy L. Steele. 1975. Multiprocessing Compactifying Garbage Collection. CACM. 18:9 pp. 495--508.




Guy L. Steele. 1976. Corrigendum: Multiprocessing Compactifying Garbage Collection. CACM. 19:6 p.354.



Guy L. Steele. 1977. Data Representation in PDP-10 MACLISP. MIT. AI Memo 421.



James M. Stichnoth, Guei-Yuan Lueh, Michal Cierniak. 1999. Support for Garbage Collection at Every Instruction in a Java Compiler. SIGPLAN. Proceedings of the 1999 ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI). SIGPLAN Notices 34(5). pp. 118-127. Online.




Will R Stoye, T J W Clarke, Arthur C Norman. 1984. Some Practical Methods for Rapid Combinator Reduction. In LFP 1984, 159-166.



David Tarditi, Amer Diwan. 1995. Measuring the Cost of Storage Management. Carnegie Mellon University. CMU-CS-94-201. Abstract.




Stephen Thomas, Richard E. Jones. 1994. Garbage Collection for Shared Environment Closure Reducers. Computing Laboratory, The University of Kent at Canterbury. Technical Report 31-94. Abstract. Online.



Stephen Thomas. 1995. Garbage Collection in Shared-Environment Closure Reducers: Space-Efficient Depth First Copying using a Tailored Approach. Information Processing Letters. 56:1, pp. 1-7.




Mads Tofte, Jean-Pierre Talpin. 1997. Region-Based Memory Management. Information and Computation 132(2), pp. 109-176. Abstract.



Dave Ungar. 1984. Generation Scavenging: A Non-disruptive High Performance Storage Reclamation Algorithm. ACM, SIGSOFT, SIGPLAN. Practical Programming Environments Conference.




Dave Ungar, Frank Jackson. 1988. Tenuring Policies for Generation-Based Storage Reclamation. SIGPLAN. OOPSLA '88 Conference Proceedings, ACM SIGPLAN Notices, Vol. 23, No. 11, pp. 1-17. Abstract.



Kiem-Phong Vo. 1996. Vmalloc: A General and Efficient Memory Allocator. Software -- Practice and Experience. 26(3): 357-374 (1996). Abstract. Online.




Daniel C. Watson, David S. Wise. 1976. Tuning Garwick's algorithm for repacking sequential storage. BIT. 16, 4 (December 1976): 442--450.



Paul R. Wilson, Michael S. Lam, Thomas G. Moher. 1992. Caching Considerations for Generational Garbage Collection. ACM. L&FP 92. Abstract.




Paul R. Wilson, Sheetal V. Kakkad. 1992. Pointer Swizzling at Page Fault Time. University of Texas at Austin. Abstract. Online.



Paul R. Wilson. 1994. Uniprocessor Garbage Collection Techniques. University of Texas. Abstract. Online.




Paul R. Wilson, Mark S. Johnstone, Michael Neely, David Boles. 1995. Dynamic Storage Allocation: A Survey and Critical Review. University of Texas at Austin. Abstract. Online.




David S. Wise. 1978. The double-buddy system. Department of Computer Science at Indiana University. Technical Report 79.



David S. Wise. 1979. Morris's garbage compaction algorithm restores reference counts. TOPLAS. 1, 1 (July l979): 115--120.



David S. Wise. 1985. Design for a multiprocessing heap with on-board reference counting. Springer-Verlag. In J.-P. Jouannaud (ed.), Functional Programming Languages and Computer Architecture, Lecture Notes in Computer Science 201: 289--304.




David S. Wise. 1993. Stop-and-copy and one-bit reference counting. Information Processing Letters. 46, 5 (July 1993): 243--249. Abstract. Online.



David S. Wise, Joshua Walgenbach. 1996. Static and Dynamic Partitioning of Pointers as Links and Threads. SIGPLAN. Proc. 1996 ACM SIGPLAN Intl. Conf. on Functional Programming, SIGPLAN Not. 31, 6 (June 1996), pp. 42--49. Online. Online.




David S. Wise, Brian Heck, Caleb Hess, Willie Hunt, Eric Ost. 1997. Uniprocessor Performance of a Reference-Counting Hardware Heap. LISP and Symbolic Computation. 10, 2 (July 1997), pp. 159--181. Online.




P. Tucker Withington. 1991. How Real is "Real-Time" Garbage Collection?. ACM. OOPSLA/ECOOP '91 Workshop on Garbage Collection in Object-Oriented Systems. Abstract. Online.



G. May Yip. 1991. Incremental, Generational Mostly-Copying Garbage Collection in Uncooperative Environments. Digital Equipment Corporation. Abstract. Online.




Taiichi Yuasa. 1990. Real-Time Garbage Collection on General-Purpose Machines. Journal of Software and Systems. 11:3 pp.181-198.



Benjamin Zorn, Paul Hilfinger. 1988. A Memory Allocation Profiler for C and Lisp Programs. USENIX. Proceedings for the Summer 1988 USENIX Conference, pp223--237. Abstract. Online.




Benjamin Zorn. 1989. Comparative Performance Evaluation of Garbage Collection Algorithms. Computer Science Division (EECS) of University of California at Berkeley. Technical Report UCB/CSD 89/544 and PhD thesis. Abstract. Online.



Benjamin Zorn. 1990. Comparing Mark-and-sweep and Stop-and-copy Garbage Collection. ACM. Conference on Lisp and Functional Programming, pp. 87-98. Abstract.




Benjamin Zorn. 1990. Barrier Methods for Garbage Collection. University of Colorado at Boulder. Technical Report CU-CS-494-90. Abstract. Online.



Benjamin Zorn. 1991. The Effect of Garbage Collection on Cache Performance. University of Colorado at Boulder. Technical Report CU-CS-528-91. Abstract. Online.




Benjamin Zorn, Dirk Grunwald. 1992. Empirical Measurements of Six Allocation-intensive C Programs. ACM, SIGPLAN. SIGPLAN notices, 27(12):71-80. Abstract. Online.



Benjamin Zorn. 1993. The Measured Cost of Conservative Garbage Collection. Software -- Practice and Experience. 23(7):733-756. Abstract. Online.




Benjamin Zorn, Dirk Grunwald. 1994. Evaluating Models of Memory Allocation. ACM. Transactions on Modeling and Computer Simulation 4(1):107-131. Abstract. Online.



[JBoss-dev] [ jboss-Change Notes-658609 ] Optimistic locking support

[JBoss-dev] [ jboss-Change Notes-658609 ] Optimistic locking support

Initial Comment:
To setup optimistic locking, container configuration
element locking-policy should be set to
<locking-
policy>org.jboss.ejb.plugins.lock.JDBCOptimisticLock</l
ocking-policy>
and entity element in jbosscmp-jdbc.xml should have
optimistic-locking element.

Following are the possible configurations of optimistic-
locking element:
1. Fixed group of fields that will be used for optimistic
locking.
<optimistic-locking>
<group-name>optimisticLockingGroup</group-
name>
</optimistic-locking>
where optimisticLockingGroup is one of the entity's load-
group-name's.

2. Modified strategy. The fields that were modified during
transaction will be used for optimistic locking.
<optimistic-locking>
<modified-strategy/>
</optimistic-locking>

3. Read strategy. The fields that were read during
transaction will be used for optimistic locking.
<optimistic-locking>
<read-strategy/>
</optimistic-locking>

4. Version (counter) column strategy. Additional version
(counter) field of type java.lang.Long will be added to
entity which

will be used for optimistic locking. Each update of the
entity will increase the value of its version field by 1.
<optimistic-locking>
<version-column/>
<field-name>versionField</field-name>
<column-name>ol_version</column-name>
<jdbc-type>INTEGER</jdbc-type>
<sql-type>INTEGER(5)</sql-type>
</optimistic-locking>

5. Timestamp column strategy. Additional timestamp
column field of type java.util.Date will be added to entity
which will be

used for optimistic locking. Each update of the entity will
set the value of its timestamp field to the current time.
<optimistic-locking>
<timestamp-column/>
<field-name>timestampField</field-name>
<column-name>ol_timestamp</column-name>
<jdbc-type>TIMESTAMP</jdbc-type>
<sql-type>DATETIME</sql-type>
</optimistic-locking>

6. Version column generated by KeyGenerator.
Additional field will be added to entity that will be used
for optimistic

locking. Each update of the entity will update its version
column with value generated by KeyGenerator.
<optimistic-locking>
<key-generator-
factory>UUIDKeyGeneratorFactory</key-generator-
factory>
<field-type>java.lang.String</field-type>
<field-name>uuidField</field-name>
<column-name>ol_uuid</column-name>
<jdbc-type>VARCHAR</jdbc-type>
<sql-type>VARCHAR(32)</sql-type>
</optimistic-locking>

星期二, 三月 16, 2004

[JBoss-user] Virtual Directory creation for Jboss

[JBoss-user] Virtual Directory creation for Jboss

You can add one or more external contexts to wars deployed to
a host by adding a Context element to the corresponding Host
by editing the jbossweb-tomcat41.sar/META-INF/jboss-service.xml
descriptor:

<server >

<mbean code= "org.jboss.web.tomcat.tc4.EmbeddedTomcatService "
name= "jboss.web:service=WebServer " >

<attribute name= "Java2ClassLoadingCompliance " >true </attribute >
<attribute name= "LenientEjbLink " >true </attribute >
<attribute name= "UseJBossWebLoader " >true </attribute >
<attribute name= "SubjectAttributeName " >j_subject </attribute >

<attribute name= "Config " >
<Server >
<Service name= "JBoss-Tomcat " >
<Engine name= "MainEngine " defaultHost= "localhost " >
<Logger className= "org.jboss.web.tomcat.Log4jLogger "
verbosityLevel= "debug "
category= "org.jboss.web.localhost.Engine "/ >
<Host name= "localhost " >
...

<Context path= "/images " docBase= "C:/tmp/images " debug= "1 "
reloadable= "true " crossContext= "true " / >
...

With this you can reference the /images path from any war deployed
to the Host. For example, a test-ex.war index.html page accessible
at http://localhost/test-ex/index.html that includes images from
the external context:

test-ex.war/index.html
<html >

<body >
<h1 >External Images </h1 >
<ul >
<li > <img src= "/images/img1.jpg " alt= "Image1 " > </li >
<li > <img src= "/images/img1.jpg " alt= "Image2 " > </li >
<li > <img src= "/images/img1.jpg " alt= "Image3 " > </li >
</ul >
</body >

</html >

有关Jboss web Server一些怪癖的确FAQ

Core Developers Network: "


/documents/*
/docroot





"

星期日, 三月 14, 2004

io architecure


/*
*/


关于JSP Model 1,Model 2很好的实现框架

Link*/
*/

*/
Model 2X

Model 2X is the result of a natural evolution that started in the early days of Web application development. This architecture enhances Model 2, allowing a more flexible and modular front-end design. With Model 2X, XML is generated by the Servlet or the JSP. This XML goes through a sequence of transformations before being sent to the browser. The sequence of transformations is described in XML pipelines. To better understand the relationship between J2EE technologies such as JSP/JSF and XML pipelines, read the article published recently by Orbeon on TheServerSide.com.
Model 1

Model 1 consists of using JSP to extract data from the HTTP request parameters, call the business logic implemented in JavaBeans or directly into the JSP, handle the HTTP session, and generate the HTML output. Using this approach usually leads to a significant amount of scriptlets (Java code embedded in HTML). Another limitation of Model 1 is that each JSP page must be individually responsible for managing the application state and verifying authentication and security./*
*/

Model 2

Model 2 is a server-side implementation of the Model View Controller architecture using Servlets and Java Server Pages (JSP). In Model 2, Servlets control the flow of the Web application and delegate the business logic to either JavaBeans or EJBs, while JSP pages take care of producing the HTML. This model encourages a much cleaner separation of business and presentation logic, making application development as well as maintenance a much easier task. The most popular example of frameworks implementing Model 2 is an Apache Jakarta project called Struts.
*/

Model 2X

Model 2 based frameworks are a big step in the right direction. However, in some cases it is not necessarily optimal to output HTML directly from JSPs to the Web browser. For example, there are situations where it would be desirable to separate look and feel logic from the localization. Likewise, there might be situations where the same application has requirements to support multiple devices with the same back-end logic. These are perfect use cases for an XML/XSLT approach. Executing a series of XML transformations before sending the appropriate markup language to the Web browser is a better approach. That is why Orbeon introduced Model 2X back in February 2002 in an article published in JavaWorld magazine.

集成JSP/JSF和XML/XSLT

Sun eCommunity
很好的一篇介绍JSF 1。0技术框架的文章。

星期六, 三月 13, 2004

InLine Image HTML 实现(二),如何在HTML页面里嵌入图片数据?

William按:当初想到为为什么不可以在HTML里面直接嵌入图片数据呢?非要用link引用的方式呢?不方便发送,也不方便保存。
最终找到了部分实现的方法,可惜丑陋的M$的IE,不支持HTML4。0的规范,BT.但可爱的Mozilla和FIreFox支持.:).
--
理论:<IMG SRC="">是通过link URL的方式获得图片资源,不过现在HTML 4。0支持:data协议。
<IMG SRC="data:....">
另外Mozilla也支持Pipeline的方式获取数据。从这里可以看出良好的API设计的重要了。否则一个模块的功能的扩展性非常差。Mozilla的HTML Rengine是在资源上加了一层Pipeline的抽象,通过chian filter的模式来匹配最终的负责render,进行这样渲染rende的都是符合某钟合格数据流。这样一下子是API的灵活性极大加强了,而IE的HTML render Enginne是死板的switch("GIF89a")类似的方式写的代码,扩展性极差,怪不得要经常升级和打补丁呢。愚昧啊,愚昧。丑陋战胜了先进.
这种Inline Image支持的图片长度有限,最少或最多是1k的图片,不过我这个可不只1K,也可以。当然页勉里面嵌入数据,最好只放在个人简介里,否则,可要给访问网站的骂的心惊肉跳了。

实现部分:
1.<IMG SRC="data:...">
2.<IMG SRC="javascript:imagedata">
<html>
<body>
<script>

var hexdata='[\x...]';//这里是存放InLineImage工具生成的GIF87a格式数据

</script>
a<br>
<img src="javascript:hexdata;">//Javascript PipeLine数据管道实现
<p><IMG SRC="data:image/gif;base64,[..base64 data]" ALT="Larry"/>
</body>
</html>

--------



a



Html Inline Image 工具(一):把Gif87a 图片转换为Ascii表示

当前网站:http://sunose.blogspot.com
目的:打开一个gif图片把16进制数字转换为ASCII表示或转为Bas64表示.为Inline Image准备数据.
------------------------------------------------------------------------
import sun.misc.*;
import java.io.*;
import java.lang.Integer;

public class InLineImageTool {
private static BASE64Encoder encoder = new BASE64Encoder();
private static BASE64Decoder decoder = new BASE64Decoder();

public InLineImageTool() {
}

public static String bytesToHex(byte[] data) {
StringBuffer buf = new StringBuffer();
for (int i = 0; i < data.length; i++) {
buf.append(byteToHex(data[i]).toUpperCase());
}
return (buf.toString());
}


/**
* method to convert a byte to a hex string.
*
* @param data the byte to convert
* @return String the converted byte
*/
public static String byteToHex(byte data) {
StringBuffer buf = new StringBuffer();
buf.append(toHexChar((data >>> 4) & 0x0F));//高字节充0,把高移到低字节保存
buf.append(toHexChar(data & 0x0F));//低字节转成字符
return buf.toString();
}


/**
* Convenience method to convert an int to a hex char.
*
* @param i the int to convert
* @return char the converted char
*/
public static char toHexChar(int i) {
if ((0 <= i) && (i <= 9)) {
return (char) ('0' + i);//把0-9字节转成ASCII
} else {
return (char) ('a' + (i - 10));//把a-f转成ASCII
}
}



public static void main (String[] args) throws Exception
{
if(args.length<2){System.out.println("Syntax:java InLineImageTool gifFile format(base64 or gif)");System.exit(0);}

File giffile=null;
giffile=new File(args[0]);
FileInputStream insrc=new FileInputStream(giffile);
byte[] inbyte=new byte[1];
if(args[1].equals("gif"))
{
String temp="";

for(int i=0;i<giffile.length();i++)
{
if(insrc.read(inbyte)==-1)break;
System.out.print("\\x"+byteToHex(inbyte[0]));
}
}else if(args[1].equals("base64"))//Base64 is Latin ascii string
{
byte[] fielbyte=new byte[(int)giffile.length()];//多大的文件?:)
insrc.read(fielbyte);
System.out.print(encoder.encode(fielbyte));
}else
{
System.out.println("Invalid format String:"+args[0]+" Valid is base64 or gif");
}
}
}

//另外还有一种把gif转为base64的简便方法:打开发送邮件软件:outlookexpress或Mozilla Thunderbird 新建邮件,然后保存为草稿(drafts)然后看邮件源代码:
Content-Type: image/gif;
name="1.gif"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="1.gif"
下面所附加的就是Base64编码了.

星期五, 三月 12, 2004

如何在上传文件的HTML页面里预览图片或其他

<body bgcolor>
上传:<strong><font size=+1>dddd</strong>的照片
<script>
document.write("<img src=file:///c:\\b5.gif>");
</script>

<FORM name="mainform" ENCTYPE='multipart/form-data' method='POST' action='/Member/QuizController?page=upload'>
<INPUT TYPE='file' NAME='uploadfile' size="40" maxlength="255" onchange="javascript:displayimg();">
<INPUT TYPE='submit' VALUE='start...' >
</FORM>
<script>
function displayimg()
{
var tstr=document.mainform.uploadfile.value;
document.all.contentLayer.document.user.src=tstr;
}
</script>

<DIV ID="contentLayer" STYLE="position: absolute; left: 20px; top: 100px; height: 120px; z-index: 1; visibility: visible;">
<FONT CLASS=title>Preview</FONT>
<IMG name=user SRC="file:///c:/2.jpg">
</DIV>
</body>