Struts Action get Resource by Injection

  Http://www.codecomments.com/archive419-2006-6-954408.html 

  Craig McClanahan: 

  A couple of possibilities come to mind … 

  * Inject the resource into a container-instantiated object (like a servlet), and modify your framework to copy values in when it creates, say, an Action instance in the Struts case. BIG PROBLEM: thread safety … the servlet instance is shared across all threads, so the variable would get stomped on if there was more than one simultaneous request. 

  * Modify your framework to scan for the injection annotations itself when it creates new object instances, and perform the same kinds of injection that the container can do. 

  * Use a dependency injection framework that knows how to initialize properties from JNDI lookups, and configure it to look up the corresponding resources. 

  * Use the managed beans portion of JSF (even if you are not using the rest of it) as a dependency injection framework, and let the container go ahead and do the injection for you. (If you're using an additional framework, it would need to be modified to use managed beans to create object instances, instead of doing 
  Class.newInstance () things itself). 

  Craig 

  "Q Ԓ Õf, Application Server> Q Ƿ Ô inject êPÄ Resource ϵ ½ y ֮ Ð, ԓ Application Server K>] ֧ Ԯ Struts Action û Framework, ͵ 춼 ʹ ϵ ½ y Ҳ Ú Java EE 5.0 ĭh Ј Ð ~ ~ Ҳ ʹ à JNDI lookup ȥ ȡ êPÄ Resource, 

  ÔO Ȼ ʹ 'TÄ Framework, Ͳ ޸ êP ԭ ʼ' a ȥ è Annotations. Ԓ Ҳ ҂

CVS in VS.Net integrated development and UML

  First say that I use the VS2003. Should be below 2005, however, should be no big difference between the development of a decision by 2005. 

  CVS 

  CVS Server under Windows with CVSNT, seemingly online unanimously recommended this. Under the cvsnt-2.5.03.2382. CVSNT in order to create a new account, as long as the creation of the Windows operating system account, in other words, CVSNT Server and Account with the operating system account is the same. 

  CVS Client use TortoiseCVS or WinCVS, just personal preference. Under the TortoiseCVS-1.8.29. Specific with how the Internet everywhere. 

  . Net naturally be installed directly on the use of CVS plug-ins, Jalindi Igloo very good (http://www.jalindi.com/igloo/). Mounted directly on the can, with the speed of super-fast, with almost no thought good. VS2005 also support this, although the latest version seems to be out in 2002. 

  Over all free of charge. 

  BTW, ClearCase will be loaded directly into. Net, but make no major development with ClearCase is too complex, the largest engineering; heard Subversion better than CVS, after try. 

  UML 

  UML plug-ins on Buhaohua, all relatively good business, and learn to play their own to find a good crack. 

  Internet use is generally recommended the development of small Borland Together for. Plug-Net (http://tech.163.com/05/1008/15/1VI85TAG00091589.html). 

  Use really good, depressed do not support C + +, C # or VB written procedures with this. Business can be made into crack. Together Designer 2005 for Microsoft Visual Studio. NET support 2003, Together 2006 for Visual Studio 2005 support. 

  In fact,. Directly with Visio Net UML can be dealt with, and integrated. Net, reverse engineering is also supported, but said that the Internet is so weak, the very idea of using Visio painting UML nondescript not want to test. 

  Rational Rose can achieve UML and C + + code Huzhuai, also used to visit must be integrated into the VS installed Rational Rose XDE Developer Plus For VS.net, but the current version only supports VS.NET 2003. Heard that the speed is quite slow. 

  Based on the Eclipse platform, as some of the UML framework IDE, through CDT also supports UML and C + + cross-conversion, and also can do C + + Project, (under the direct use of Linux gcc / make, decorate things under Windows trip), but with the speed it VS Meifabi, and the point is good business. 

  Would like to think the former, Rational Rose UML painting, and tried to reverse C + + is all good, to use this to do a C + + modeling. 

  Finally VS posted two small problems to their own future reference: 

  1. 

  Open Visual Studio. Net, the creation of a new application procedures, sometimes in the following error message: 
  Chinese Information: Automation server can not create objects in English: Automation server can't create object solution: 
  Run: Regsvr32 scrrun.dll can. 

  2. 

  VS2005 classic problem: running a "not found MSVCR80D.dll, so this application failure. Re-install the application may repair the problem." As VS2005 procedures arising from the operation of different ways, it should be running it is managed, NTFS and FAT32 system cut-off time for the issue, I have read, FAT32 without documents Accessed Time this property, and NTFS is, I wonder if this is not possible, after a close study. do as long as the item property into support FAT32 on it. reference to the following article, or, pay attention to a problem they all times. 

Improve the performance of query system

  First you select a primitive Jsp / Servlet + JavaBeans structure, jsp / Servlet thread is the fact that when concurrent users in the visit, that is multi-threaded, so, in your procedure, the first to visit the same multi-threaded a resource, especially Singleton, the problem has been considerable discussion in front of posts, such as: Originally parallel advance to a single-plank bridge, we must Serial forward, then much of a discount. 

  The best way is, an object as a thread, with 10 threads will visit 10 objects, such highest standards of efficiency, but at the same time note that if you target this Javabeans for each visit to create new, it is possible to waste performance, particularly Javabeans code many, many functions, then use pool, the system was activated, started generating these JavaBeans object in memory. 

  I said that these are functional Javabeans javaBeans through Pool JavaBeans improve functional performance.    There is also a data javabeans, specialized loading data, in part to increase the use of Cache. 

  EJB in the bottom of a state Session Bean Pool has been supported, if you will be functional JavaBeans code ported to achieve Session Beans, will increase the number of concurrent users processing performance, the use of the Local SLSB, closed its network performance loss; closed SLSB Service mechanisms (if not), this will become a pure SLSB Pool javaBeans a special support. 

  As EJB Entity bean is the bottom Cache support, it can be used for data javaBeans entity bean cache, but is generally recommended, preferably in their own to do some of the Web cache, so from the client recently, the best performance. 

  In short, the performance issue is the inadvertent choice of structure, in this forum to see a lot of Jsp + JavaBeans performance problems, why we have a system at the beginning, do not choose EJB powerful scalable architecture? Thus, in expand your system, you do not have headaches for system performance problems, and even lead to performance problems your Jsp + JavaBeans system failure. 

21 minutes struts resolve international issues and Chinese

  Struts framework of the current application has been very mature, the basic configuration I do not say much, everyone on google found to have found a lot of the recent development of a project met the Struts I18N question, I turn to the basic rough used to give you some of the internationalization of the issue Struts have a brief understanding (Note, the following is in the struts of the development environment configured under the situation of international steps to solve the Chinese way): 

  1. Settings all JSP pages charset as UTF-8. That is added before each JSP pages <% @ page language = "java" contentType = "text / html; charset = UTF-8"%>. Java is unicode through internationalization, but unicode and UTF-8 is one-to-one relationship. 

  2. JSP pages contain no hard-coded text (that is, the text pages are from the inside *. properties resource documents read out, with <bean: message key = "keyword in property file"> can be read.) Resource allocation is to say, with distribution in the web.xml like inside. following assumptions English resource file called ApplicationResources_en.properties, Chinese source told ApplicationResources_xx.properties (value are Chinese). onboard with JDK Chinese native2ascii tools to document the resources inside the Chinese into ASCII representation for the use of Unicode encoding, ordered as follows: native2ascii-encoding GBK ApplicationResources_xx.properties ApplicationResources_zh.properties. (Chinese GBK is the default operating system inside, it is the expansion of gb2312 Set) , well, if you do not have form-Chinese, not storage, then you succeed. opened in the internet browser setup options to try languages. easy bar, huh. involves the following steps to storage problems. 

  3. Write a Filter categories, one of the most simple code examples are as follows: 

  Import java.io. *; 
  Import javax.servlet .*; 

  Public class CharsetFilter implements Filter ( 
  Private FilterConfig config = null; 
  Private String defaultEncode = "UTF-8"; 

  Public void init (FilterConfig config) throws ServletException ( 
  This.config = config; 
  If (config.getInitParameter ( "Charset")! = Null) ( 
  DefaultEncode = config.getInitParameter ( "Charset"); 
  ) 
  ) 

  Public void destroy () ( 
  This.config = null; 
  ) 

  Public void doFilter (ServletRequest request, ServletResponse response, 
  FilterChain chain) throws IOException, ServletException ( 
  ServletRequest srequest = request; 
  Srequest.setCharacterEncoding (defaultEncode); 
  Chain.doFilter (srequest, response); 
  ) 
  ) 

  Then you need to set up inside in the web.xml Filter, can be added the following (note that if you are inside JBX development, the statement must filter in a statement <servlet> front, otherwise they will be error, but by the time seemed no problem.) 

<filter>
  <filter-name> Character Encoding </ filter-name> 
  <filter-class> Com.alex.util.CharsetEncodingFilter </ filter-class> 
  </ Filter> 
<filter-mapping>
  <filter-name> Character Encoding </ filter-name> 
  <servlet-name> Action </ servlet-name> 
  </ Filter-mapping> 

  4. Followed by the writing of a Converter in storage before calling encode (), to be called the decode () ok. Below is a simple example: 

  (Public class Converter 
  Public Converter () ( 
  ) 

  Public static String enCode (String str) ( 
  [] Byte temp; 
  Temp = str.getBytes (); 
  Try ( 
  / / System.out.println ( "in before convert:" + str); 
  Str = new String (temp, "ISO-8859-1"); 
  / / System.out.println ( "in after convert:" + str); 
  ) 
  Catch (Exception e) ( 
  System.err.println ( "convert error:" + e); 
  ) 
  Return str; 
  ) 

  Public static String deCode (String str) ( 
  [] Byte temp; 
  Try ( 
  / / System.out.println ( "out before convert:" + str); 
  Temp = str.getBytes ( "ISO-8859-1"); 
  Str = new String (temp, "GBK"); 
  / / System.out.println ( "out after convert:" + str); 
  ) 
  Catch (Exception e) ( 
  System.err.println ( "convert error:" + e); 
  ) 
  Return str; 
  ) 
  ) 

  5. Should all OK too, so I settled on the struts of the Chinese and international issues. Younger brother of a rookie, if wrong please master Comments? 

JSP pages in the database connectivity features (zz)

  Jsp many novice users often ask how database connectivity ah, I summarize for your reference, 
  In fact, all of this logic on the database jsp, is not necessarily good practice, but beginners to learn, when we learn a certain degree of, 
  MVC may consider using the model developed.    In practice these codes, you must be jdbc driver put in the path of the server, 
  And then to build a database table test, for example, there are two fields test1, test2, can be built using the following SQL 
  Create table test (test1 varchar (20), test2 varchar (20) 
  To the table and then write a test records, then we will now begin the journey jsp and databases it. 

  First, jsp Oracle8/8i/9i database connectivity (using thin model) 
  Testoracle.jsp as follows: 
  <% @ Page contentType = "text / html; gb2312 charset ="%> 
  <% @ Page import = "java.sql .*"%> 
<html>
<body>
  <% Class.forName ( "oracle.jdbc.driver.OracleDriver"). NewInstance (); 
  String url = "jdbc: oracle: thin: @ localhost: 1521: orcl"; 
  / / Orcl for your database SID 
  String user = "scott"; 
  String password = "tiger"; 
  Connection conn = DriverManager.getConnection (url, user, password); 
  Statement stmt = conn.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); 
  String sql = "select * from test"; 
  ResultSet rs = stmt.executeQuery (sql); 
  While (rs.next ()) (%> 
  Your first column says: <% = rs.getString (1)%> 
  Your second column says: <% = rs.getString (2)%> 
<%}%>
  <% Out.print ( "database operations successful, congratulate you ");%> 
  <% Rs.close (); 
  Stmt.close (); 
  Conn.close (); 
%>
  </ Body> 
  </ Html> 

  Second, jsp database connectivity Sql Server7.0/2000 
  Testsqlserver.jsp as follows: 
  <% @ Page contentType = "text / html; gb2312 charset ="%> 
  <% @ Page import = "java.sql .*"%> 
<html>
<body>
  <% Class.forName ( "com.microsoft.jdbc.sqlserver.SQLServerDriver"). NewInstance (); 
  String url = "jdbc: microsoft: sqlserver: / / localhost: 1433; DatabaseName = pubs"; 
  / / Pubs for your database 
  String user = "sa"; 
  String password = ""; 

  Connection conn = DriverManager.getConnection (url, user, password); 
  Statement stmt = conn.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); 
  String sql = "select * from test"; 
  ResultSet rs = stmt.executeQuery (sql); 
  While (rs.next ()) (%> 
  Your first column says: <% = rs.getString (1)%> 
  Your second column says: <% = rs.getString (2)%> 
<%}%>
  <% Out.print ( "database operations successful, congratulate you ");%> 
  <% Rs.close (); 
  Stmt.close (); 
  Conn.close (); 

%>
  </ Body> 
  </ Html> 

  Third, jsp connect DB2 database 
  Testdb2.jsp as follows: 
  <% @ Page contentType = "text / html; gb2312 charset ="%> 
  <% @ Page import = "java.sql .*"%> 
<html>
<body>
  <% Class.forName ( "com.ibm.db2.jdbc.app.DB2Driver"). NewInstance (); 
  String url = "jdbc: db2: / / localhost: 5000/sample"; 
  / / Sample for your database name 
  String user = "admin"; 
  String password = ""; 
  Connection conn = DriverManager.getConnection (url, user, password); 
  Statement stmt = conn.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); 
  String sql = "select * from test"; 
  ResultSet rs = stmt.executeQuery (sql); 
  While (rs.next ()) (%> 
  Your first column says: <% = rs.getString (1)%> 
  Your second column says: <% = rs.getString (2)%> 
<%}%>
  <% Out.print ( "database operations successful, congratulate you ");%> 
  <% Rs.close (); 
  Stmt.close (); 
  Conn.close (); 
%>
  </ Body> 
  </ Html> 
  4. Jsp Informix database connection 
  Testinformix.jsp as follows: 
  <% @ Page contentType = "text / html; gb2312 charset ="%> 
  <% @ Page import = "java.sql .*"%> 
<html>
<body>
  <% Class.forName ( "com.informix.jdbc.IfxDriver"). NewInstance (); 
  String url = 
  "Jdbc: informix-sqli: / / 123.45.67.89:1533 / testDB: INFORMIXSERVER = myserver; 
  User = testuser; testpassword password = "; 
  / / TestDB for your database name 
  Connection conn = DriverManager.getConnection (url); 
  Statement stmt = conn.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); 
  String sql = "select * from test"; 
  ResultSet rs = stmt.executeQuery (sql); 
  While (rs.next ()) (%> 
  Your first column says: <% = rs.getString (1)%> 
  Your second column says: <% = rs.getString (2)%> 
<%}%>
  <% Out.print ( "database operations successful, congratulate you ");%> 
  <% Rs.close (); 
  Stmt.close (); 
  Conn.close (); 
%>
  </ Body> 
  </ Html> 

  5. Jsp Sybase database connection 
  Testmysql.jsp as follows: 
  <% @ Page contentType = "text / html; gb2312 charset ="%> 
  <% @ Page import = "java.sql .*"%> 
<html>
<body>
  <% Class.forName ( "com.sybase.jdbc.SybDriver"). NewInstance (); 
  String url = "jdbc: sybase: Tds: localhost: 5007/tsdata"; 
  / / Tsdata for your database name 
  Properties sysProps = System.getProperties (); 
  SysProps.put ( "user", "userid"); 
  SysProps.put ( "password", "user_password"); 
  Connection conn = DriverManager.getConnection (url, SysProps); 
  Statement stmt = conn.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); 
  String sql = "select * from test"; 
  ResultSet rs = stmt.executeQuery (sql); 
  While (rs.next ()) (%> 
  Your first column says: <% = rs.getString (1)%> 
  Your second column says: <% = rs.getString (2)%> 
<%}%>
  <% Out.print ( "database operations successful, congratulate you ");%> 
  <% Rs.close (); 
  Stmt.close (); 
  Conn.close (); 
%>
  </ Body> 
  </ Html> 

  6. Jsp MySQL database connection 
  Testmysql.jsp as follows: 
  <% @ Page contentType = "text / html; gb2312 charset ="%> 
  <% @ Page import = "java.sql .*"%> 
<html>
<body>
  <% Class.forName ( "org.gjt.mm.mysql.Driver"). NewInstance (); 
  String url = "jdbc: mysql: / / localhost / softforum? User & password = = soft soft1234 & useUnicode = = true & characterEncoding 8859_1" 
  / / TestDB for your database name 
  Connection conn = DriverManager.getConnection (url); 
  Statement stmt = conn.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); 
  String sql = "select * from test"; 
  ResultSet rs = stmt.executeQuery (sql); 
  While (rs.next ()) (%> 
  Your first column says: <% = rs.getString (1)%> 
  Your second column says: <% = rs.getString (2)%> 
<%}%>
  <% Out.print ( "database operations successful, congratulate you ");%> 
  <% Rs.close (); 
  Stmt.close (); 
  Conn.close (); 
%>
  </ Body> 
  </ Html> 

  7. Jsp PostgreSQL database connection 
  Testmysql.jsp as follows: 
  <% @ Page contentType = "text / html; gb2312 charset ="%> 
  <% @ Page import = "java.sql .*"%> 
<html>
<body>
  <% Class.forName ( "org.postgresql.Driver"). NewInstance (); 
  String url = "jdbc: postgresql: / / localhost / soft" 
  / / Soft for your database name 
  String user = "myuser"; 
  String password = "mypassword"; 
  Connection conn = DriverManager.getConnection (url, user, password); 
  Statement stmt = conn.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); 
  String sql = "select * from test"; 
  ResultSet rs = stmt.executeQuery (sql); 
  While (rs.next ()) (%> 
  Your first column says: <% = rs.getString (1)%> 
  Your second column says: <% = rs.getString (2)%> 
<%}%>
  <% Out.print ( "database operations successful, congratulate you ");%> 
  <% Rs.close (); 
  Stmt.close (); 
  Conn.close (); 
%>
  </ Body> 
  </ Html> 

Using Java to access Oracle CLOB type in the word

  Import java.sql .*; 
  Import java.io. *; 
  Import oracle.jdbc.driver.OracleResultSet; 
  Import oracle.sql.CLOB; 

  Public class TestOracleClob implements Serializable ( 
  Public static void main (String [] args) 
  ( 
  / / Create table test (id integer, content clob); 
  System.out.println ("——————- insert —————–"); 
  Try ( 
  Class.forName ( "oracle.jdbc.driver.OracleDriver"); 
  Connection con = DriverManager.getConnection ( "jdbc: oracle: thin: @ fangm: 1521: LICSFC," "SFC", "SFC"); 
  / / Con.setAutoCommit (false); 
  / / Ok
  String sql = "insert into test values (1, empty_clob ())"; 
  Statement stmt = con.createStatement (); 
  ResultSet rs = stmt.executeQuery (sql); 
  String sqll = "select content from test where id = 1 for update"; 
  ResultSet rss = stmt.executeQuery (sqll); 
  If (rss.next ()) ( 
  CLOB clob = ((OracleResultSet) rss). GetCLOB (1); 
  Clob.putString (1, "ddddddddddddddddddddddddddddddddddd"); 
  Sql = "update test set content =? Where id = 1"; 
  PreparedStatement pstmt = con.prepareStatement (sql); 
  Pstmt.setClob (1, clob); 
  Pstmt.executeUpdate (); 
  Pstmt.close (); 
  ) 
  / / Ok
  / / String sql1 = "insert into test values (2, empty_clob ())"; 
  / / ResultSet rs3 = stmt.executeQuery (sql1); 
  String sql12 = "insert into test values (?,?)"; 
  PreparedStatement pstmt1 = con.prepareStatement (sql12); 
  Pstmt1.setInt (1,2); 
  Pstmt1.setClob (2, oracle.sql.CLOB.empty_lob ()); 
  Pstmt1.executeUpdate (); 
  String sqll2 = "select content from test where id = 2 for update"; 
  ResultSet rss2 = stmt.executeQuery (sqll2); 
  If (rss2.next ()) ( 
  CLOB clob = ((OracleResultSet) rss2). GetCLOB (1); 
  Clob.putString (1, "affffffffffdfdfdfdddddddffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdddfff"); 
  String sql1 = "update test set content =? Where id = 2"; 
  PreparedStatement pstmt = con.prepareStatement (sql1); 
  Pstmt.setClob (1, clob); 
  Pstmt.executeUpdate (); 
  Pstmt.close (); 
  ) 
  / / Con.commit (); 
  Rss.close (); 
  Rss2.close (); 
  Pstmt1.close (); 
  Rs.close (); 
  Stmt.close (); 
  Con.close (); 
  System.out.println ————- ("————- insert ok "); 
  ) Catch (Exception e) ( 
  System.out.println ( "insert:" + e); 
  ) 
  System.out.println ("——————- query —————–"); 
  Try ( 
  String content = ""; 
  Class.forName ( "oracle.jdbc.driver.OracleDriver"); 
  Connection con = DriverManager.getConnection ( "jdbc: oracle: thin: @ fangm: 1521: LICSFC," "SFC", "SFC"); 
  Statement stmt = con.createStatement (); 
  String sql = "select content from test where id = 1"; 
  ResultSet rs = stmt.executeQuery (sql); 
  If (rs.next ()) ( 
  CLOB clob = ((OracleResultSet) rs). GetCLOB (1); 
  If (clob! = Null) ( 
  Reader is clob.getCharacterStream = (); 
  BufferedReader br = new BufferedReader (is); 
  String s = br.readLine (); 
  While (s! = Null) ( 
  Content + = s +","; 
  S = br.readLine (); 
  ) 
  ) 

  ) 
  Rs.close (); 
  Stmt.close (); 
  Con.close (); 
  System.out.println ( "clob:" + content); 
  System.out.println ————- ("————- query ok "); 
  ) Catch (Exception ee) ( 
  System.out.println ( "query:" + ee); 
  ) 

  ) 
  ) 

ASP.net2.0 learning materials Summary

  ASP.net2.0 learning materials Summary 
  Posted on 2005-12-23 14:50 XMLTea reading (841) Comments (1) There is removable collection network used for the category: 1> ASP.net development 
  "Asp.net 2.0 unveil" Download 
  Http://www.fixdown.com/soft/19605.asp 

  Upcoming "Advanced Programming ASP.NET 2.0" (early January sale) 
  Http://www.china-pub.com/computers/common/info.asp?id=28152 

  Http://beta.asp.net/QUICKSTART/aspnet/default.aspx 

  Http://msdn.microsoft.com/asp.net/ 

  Http://msdn.microsoft.com/vstudio/express/vwd/learning/default.aspx 
  More learning materials in the very, no asp, asp.net1.1 basis to the people of 

  Another headache for the English can also look at the Chinese msdn information: 
  1, the use of standard formation ASP.NET Web 2.0 Web site 
  Http://www.microsoft.com/china/msdn/library/webservices/asp.net/ASPNETusStan.mspx 
  2, ASP.NET 2.0 Conversion common problems and solutions 
  Http://www.microsoft.com/china/msdn/library/webservices/asp.net/dnasppupgradingaspnet.mspx 
  3, the internal changes in ASP.NET 2.0 (for Beta 2 Update) 
  Http://www.microsoft.com/china/msdn/library/webservices/asp.net/dnvs05Internals.mspx 
  4, ASP.NET 2.0 and data binding controls: new perspective, new approach 
  Http://www.microsoft.com/china/msdn/library/webservices/asp.net/dnasppdatabound.mspx 
  5, ASP.NET 2.0 in the data source controls 
  Http://www.microsoft.com/china/msdn/library/webservices/asp.net/us0501DataPoints.mspx 
  6, in ASP.NET 2.0 in creating Web applications theme 
  Http://www.microsoft.com/china/msdn/library/webservices/asp.net/dnvs05themes.mspx 
  7, ASP.NET 2.0 features improved cache 
  Http://www.microsoft.com/china/msdn/library/webservices/asp.net/CachingNT2.mspx 
  8, ASP.NET 2.0 in the Web site operators 
  Http://www.microsoft.com/china/msdn/library/webservices/asp.net/USdnvs05sitemaint.mspx 
  9, using ASP.NET 2.0 create custom Web controls 
  Http://www.microsoft.com/china/msdn/library/webservices/asp.net/USdnvs05custwebcon.mspx 
  10, the new Data Grid Profile 
  Http://www.microsoft.com/china/msdn/library/langtool/vsdotnet/vs05a9.mspx 

  Some Internet users also related articles: 
  1, ASP.NET 2.0 Web Part create applications 
  Http://ghd258.cnblogs.com/archive/2005/10/10/251585.html 
  Http://ghd258.cnblogs.com/archive/2005/11/22/282367.html 
  2, ADO.NET 2.0 (app_offline.htm) 
  Http://ghd258.cnblogs.com/archive/2005/11/18/279296.html 
  3, ASP.NET 2.0 verify the function of the new controls 
  Http://ghd258.cnblogs.com/archive/2005/10/27/263421.html 
  4, ASP.NET 2.0 to achieve inter-page 
  Http://ghd258.cnblogs.com/archive/2005/10/26/262511.html 
  5, ASP.NET 2.0 personalized configuration (profile) 
  Http://ghd258.cnblogs.com/archive/2005/10/20/258434.html 
  6, ASP.NET 2.0, a new realm refresh pages 
  Http://ghd258.cnblogs.com/archive/2005/10/12/253399.html 
  7, ASP.NET 2.0 new controls, management appearance, layout and other user experience 
  Http://ghd258.cnblogs.com/archive/2005/10/10/251589.html 
  8, pages in ASP.NET 2.0 Beta2 compiler model changes 
  Http://blog.joycode.com/kaneboy/archive/2004/11/18/39176.aspx 

  ASP.NET 2.0 new features (only for the development of staff) 
  Http://www.w3coder.com/alphatalks/aspnet20.aspx 
  Http://www.chinacs.net/archives/11/2004/08/10/1908.html 

  2006-10-26 archiving News 
  Http://tech.acnow.net/Html/Web/ASPNET/ASPNET_Skill/archive/Record_2006_10_26.shtml 

  Http://msdn2.microsoft.com/zh-cn/library/system.net.mail.smtpfailedrecipientsexception (VS.80). Aspx 

  NET resources 
  Http://www.dotneturls.com/gb2312/ 

  Microsoft ASP.NET 2.0 Official Website 
  Http://www.asp.net/cn/ 

  Aspx in 51 | source release 
  Http://www.51aspx.com/ 

Tomcat5.0 under JNDI javax.naming.NameNotFoundException: Name jdbc is not bound in this Context solve the problem

  Tomcat under the JNDI is just a gift, not commercial server stability.    This is wrong because the configuration file, the proposed Congtouzailai again. 

  The first step, the overall configuration of the data source jndi 

  Second, to amend server.xml.    Generally right after the completion of the first step, the system automatically server.xml changes, but there is a need to change to local 

<GlobalNamingResources>
  <Environment Value="30" type="java.lang.Integer" name="simpleValue"/> 
  <Resource Type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" auth="Container" name="UserDatabase"/> 
  <Resource Type="javax.sql.DataSource" auth="Container" name="jdbc/v3"/> 
  <Resource Type="javax.sql.DataSource" auth="Container" name="jdbc/v3hd"/> 
  <ResourceParams Name="UserDatabase"> 
<parameter>
  <name> Factory </ name> 
  <value> Org.apache.catalina.users.MemoryUserDatabaseFactory </ value> 
  </ Parameter> 
<parameter>
  <name> Pathname </ name> 
  <value> Conf / tomcat-users.xml </ value> 
  </ Parameter> 
  </ ResourceParams> 
  <ResourceParams Name="jdbc/v3"> 
  .    .    .    .    .    . 
  </ GlobalNamingResources> 

  Red areas to add. 

  The second step, the adaptation of web.xml file 

  Mainly In "/ web-app> Add the following before 

<resource-ref>
  <description> DB2 Datasource v3hd </ description> 
  <res-ref-name> Jdbc / XXX </ res-ref-name> 
  <res-type> Javax.sql.DataSource </ res-type> 
  <res-auth> Container </ res-auth> 
  </ Resource-ref> 

  The third step is to modify application of the xml, usually in the Tomcat 5.0 \ conf \ Catalina \ localhost \, for example myproject.xml, add the following: 

  <ResourceLink Global="jdbc/XX" name="jdbc/XX" type="javax.sql.DataSource"/> 

  Then, re-starting tomcat! 

StringTokenizer in Delphi achieve functional modules

  We know that there are StringTokenizer in Java, string handling is very convenient, but Delphi did not provide this feature, I made reference to this function Java language version of Delphi and C # version.    We hope to provide a user-friendly.    Hope that the exhibitions.    Zengqingsong@sohu.com 

  Unit SkyStringTokenizer; 
  (String of class Author: Mr Qingsong: 2004/2/21 (2003 New Year's Eve) 
  ) 

  Interface 

  Uses 
  SysUtils, Classes; 
  Type 
  IIterator = interface 
  Function hasNext (): boolean; 
  Function next (): string; 
  End; 
  Type 
  TSkyStringTokenizer = class (TComponent, IIterator) 
  Private 
  Tokens: TStringList; 
  Index: integer; 
  Data: string; 
  Delimiter: string; 
  Procedure init (dataLine: string; delim: string); 
  Function CharacterInTokens (ch: string; const sl: TStringList): boolean; 
  Function StringToCharArray (delim: string): TStringList; 
  Function SplitString (source, ch: string): Tstringlist; 

  Protected 
  Protected declarations) ( 
  Public 
  Public declarations) ( 
  Constructor create (dataLine: string); overload; 
  Constructor Create (dataLine: string; delim: string); overload; 
  Destructor destroy (); override; 
  Function hasNext (): boolean; 
  Function next (): string; 

  Published 
  Published declarations) ( 
  End; 

  Procedure Register; 

  Implementation 

  Procedure Register; 
  Begin 
  RegisterComponents ( 'SkyDevKit' [TSkyStringTokenizer]); 
  End; 

  () TStringTokenizer 

  Function TSkyStringTokenizer.hasNext: boolean; 
  Begin 
  Result: = (index <tokens.Count - 1); 
  End; 

  Procedure TSkyStringTokenizer.init (dataLine, delim: string); 
  Begin 
  Tokens: = TStringList.Create (); 
  Delimiter: delim =; 
  Data: = dataLine; 
  Tokens: = SplitString (data, delimiter); 
  / / Tokens: = data.Split (delimiter.ToCharArray ()); 
  Index: = 1; 
  End; 

  Function TSkyStringTokenizer.next: string; 
  Var 
  S: string; 
  Begin 
  Inc (index); 
  S: = tokens [index]; 
  While ((length (s) <= 0) and (index <tokens.Count)) do 
  Begin 
  Inc (index); 
  S: = tokens [index]; 
  End; 
  Result: = s; 

  End; 

  Function TSkyStringTokenizer.StringToCharArray (delim: string): TStringList; 
  Var 
  Sl: TStringList; 
  I: Integer; 
  Begin 
  Sl: = TStringList.Create (); 
  For I: = 1 to length (delim) do / / Iterate 
  Begin 
  Sl.Append (copy (delim, i, 1)); 
  End; / / for 
  Result: = sl; 
  End; 

  Constructor TSkyStringTokenizer.Create (dataLine, delim: string); 
  Begin 
  Inherited Create (nil); 
  Self.init (dataLine, delim); 
  End; 

  Constructor TSkyStringTokenizer.Create (dataLine: string); 
  Begin 
  Inherited Create (nil); 
  Self.init (dataLine, ''); 
  End; 

  Function TSkyStringTokenizer.SplitString (source, ch: string): tstringlist; 
  Var 
  Temp: string; 
  / / I: integer; 
  Sl: TStringList; 
  Index: integer; 
  Begin 
  Then if ch ='' 
  Ch: = ''; 

  Sl: = TStringList.Create (); 
  Result: = tstringlist.Create (); 
  Sl: = self.StringToCharArray (ch); 

  Temp: =''; 
  For Index: = 1 to length (source) do / / Iterate 
  Begin 
  If not CharacterInTokens (source [index], sl) then 
  Begin 
  Temp: = temp + source [Index]; 
  End 
  Else 
  Begin 
  Result.Add (temp); 
  Temp: =''; 
  End; / / if 
  End; / / for 
  If (temp <>'') then 
  Result.Add (temp); 
  Sl.Free; 
  End; 

  Function TSkyStringTokenizer.CharacterInTokens (ch: string; 
  Const sl: TStringList): boolean; 
  Var 
  Index: integer; 
  / / I: Integer; 
  Begin 
  Result: = false; 
  For Index: = 0 to sl.Count - 1 do / / Iterate 
  Begin 
  Result: = result or (ch = sl [Index]); 
  If ch = (sl then [index] 
  Begin 
  Result: = true; 
  Break; 
  End; 
  ) 
  End; / / for 
  End; 

  Destructor TSkyStringTokenizer.destroy; 
  Begin 
  Tokens.Free; 
  Inherited; 
  End; 

  End. 

  / / Below are the C # version, I did not write the initial version of 

  Using System; 

  Namespace CsharpPats 
  ( 
  / / String Tokenizer class 
  (Public class StringTokenizer 
  Private string data, delimiter; 
  Private string [] tokens; 
  Private int index; 
  Public StringTokenizer (string dataLine) ( 
  Init (dataLine, ""); 
  ) 
  Private void init (String dataLine, string delim) ( 
  Delim = delimiter; 
  Data = dataLine; 
  Data.Split tokens = (delimiter.ToCharArray ()); 
  Index = 0; 
  ) 
  Public StringTokenizer (string dataLine, string delim) ( 
  Init (dataLine, delim); 
  ) 
  Public bool hasMoreElements () ( 
  Return (index <(tokens.Length)); 
  ) 
  Public string nextElement () ( 
  Tokens string s = [index + +]; 
  While ((s.Length <= 0) & & (index <tokens.Length)) 
  S = tokens [index + +]; 
  Return s; 
  ) 
  ) 
  ) 

An array of Java and C / C + + array of distinction

  In a study with colleagues, we referred to the JAVA return to the array of problems because he has the C / C + + in that the array of JAVA with C / C + + is distributed in the same stack. However he forgot JAVA must be an array of new distribution in the pile. Therefore, as long as you need this array, it will always exist. then for such a function: 

  GetIntArray int [] () 

  ( 

  Int [] p = new int [10]; 

  For (int auiCount = 0; auiCount <10; auiCount + +) 

  ( 

  P = auiCount [auiCount]; 

  ) 

  Return p; 

  ) 

  Also will be able to achieve the desired objective. 

keep looking »