<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.3.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>Programing Reference For .Net,Java,C</title>
	<link>http://www.programingreference.com</link>
	<description>Just another WordPress weblog</description>
	<pubDate>Wed, 07 May 2008 03:22:57 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
	<language>en</language>
			<item>
		<title>SpringFramework (1)</title>
		<link>http://www.programingreference.com/springframework-1/</link>
		<comments>http://www.programingreference.com/springframework-1/#comments</comments>
		<pubDate>Sun, 31 Dec 2006 00:00:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Popular articles]]></category>

		<guid isPermaLink="false">http://www.programingreference.com/springframework-1</guid>
		<description><![CDATA[<p> &#160; <b>0, outlined</b>&#160; <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /></p><p> &#160; <b>What is Spring?</b>&#160; </p><p> &#160; L J2EE Framework&#160; </p><p> &#160; L The multi-tier architecture, a comprehensive and modular all levels&#160; </p><p> &#160; <b>Spring&#39;s...]]></description>
			<content:encoded><![CDATA[<p> &nbsp; <b>0, outlined</b>&nbsp; <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /></p>
<p> &nbsp; <b>What is Spring?</b>&nbsp; </p>
<p> &nbsp; L J2EE Framework&nbsp; </p>
<p> &nbsp; L The multi-tier architecture, a comprehensive and modular all levels&nbsp; </p>
<p> &nbsp; <b>Spring&#39;s goal</b>&nbsp; </p>
<p> &nbsp; L J2EE easier to use, the promotion of good programming practice&nbsp; </p>
<p> &nbsp; L that has been in existence for more use of technology&nbsp; </p>
<p> &nbsp; L facilitate transplantation between applications&nbsp; </p>
<p> &nbsp; L and other items (such as Hibernate) Integration (rather than reinvent)&nbsp; </p>
<p> &nbsp; <b>Spring benefits</b>&nbsp; </p>
<p> &nbsp; L organizations middle layer object&nbsp; </p>
<p> &nbsp; L eliminate the frequent use of Singleton&nbsp; </p>
<p> &nbsp; L applications less dependent on the extent possible, its API&nbsp; </p>
<p> &nbsp; L applications easier unit testing&nbsp; </p>
<p> &nbsp; L EJB become an alternative to the realization&nbsp; </p>
<p> &nbsp; L provide a consistent framework for data access&nbsp; </p>
<p> &nbsp; L You can choose to use a part of it independent, but it is consistent with the internal architecture of the&nbsp; </p>
<p> &nbsp; <b>Spring features</b>&nbsp; </p>
</p>
<p><?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /><v:shapetype id=_x0000_t75 stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"><v:stroke joinstyle="miter"></v:stroke><v:formulas><v:f eqn="if lineDrawn pixelLineWidth 0"></v:f><v:f eqn="sum @0 1 0"></v:f><v:f eqn="sum 0 0 @1"></v:f><v:f eqn="prod @2 1 2"></v:f><v:f eqn="prod @3 21600 pixelWidth"></v:f><v:f eqn="prod @3 21600 pixelHeight"></v:f><v:f eqn="sum @0 0 1"></v:f><v:f eqn="prod @6 1 2"></v:f><v:f eqn="prod @7 21600 pixelWidth"></v:f><v:f eqn="sum @8 21600 0"></v:f><v:f eqn="prod @7 21600 pixelHeight"></v:f><v:f eqn="sum @10 21600 0"></v:f></v:formulas><v:path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"></v:path><o:lock aspectratio="t" v:ext="edit"></o:lock></v:shapetype></p>
<p> <b><img alt="" hspace="0" src="http://openjavaproject.blogdriver.com/diary/openjavaproject/inc/f.png" align="baseline" border="0" /></b> </p>
<p> &nbsp; <b>Enterprise Architecture</b>&nbsp; </p>
<p> &nbsp; L Spring&#39;s architecture is flexible&nbsp; </p>
<p> &nbsp; L layer can all benefit from the Spring&nbsp; </p>
<p> &nbsp; <b>Scenario 1: Completely Spring Web application</b>&nbsp; </p>
<p><img alt="" hspace="0" src="http://openjavaproject.blogdriver.com/diary/openjavaproject/inc/s1.png" align="baseline" border="0" /></p>
</p>
<p> &nbsp; <b>Scenario 2: the use of third-party Web framework as the middle layer Spring</b>&nbsp; </p>
<p><img alt="" hspace="0" src="http://openjavaproject.blogdriver.com/diary/openjavaproject/inc/s2.gif" align="baseline" border="0" /></p>
</p>
<p> &nbsp; <b>Scenario 3: remote access</b>&nbsp; </p>
<p><img alt="" hspace="0" src="http://openjavaproject.blogdriver.com/diary/openjavaproject/inc/s3.gif" align="baseline" border="0" /></p>
</p>
<p> &nbsp; <b>Scenario 4: EJB packaging has been in existence for the use of POJO</b>&nbsp; </p>
</p>
<p> <strong><img alt="" hspace="0" src="http://openjavaproject.blogdriver.com/diary/openjavaproject/inc/s4.jpg" align="baseline" border="0" /></strong> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.programingreference.com/springframework-1/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Zhcon how to change the resolution</title>
		<link>http://www.programingreference.com/zhcon-how-to-change-the-resolution/</link>
		<comments>http://www.programingreference.com/zhcon-how-to-change-the-resolution/#comments</comments>
		<pubDate>Sun, 31 Dec 2006 00:00:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Popular articles]]></category>

		<guid isPermaLink="false">http://www.programingreference.com/zhcon-how-to-change-the-resolution</guid>
		<description><![CDATA[<p> &#160; To the kernel parameters-a vga&#160; <br /><br /> &#160; Lilo:&#160; <br /> &#160; Tabel to join in the party:&#160; <br /> &#160; Vga = 771&#160; <br /> &#160; NOTE:&#160; <br /> &#160; 771 representatives of 800 x600x8 at (256) color mode&#160; <br /> &#160; 791 representatives of 1024 x768x16...]]></description>
			<content:encoded><![CDATA[<p> &nbsp; To the kernel parameters-a vga&nbsp; </p>
<p> &nbsp; Lilo:&nbsp; <br /> &nbsp; Tabel to join in the party:&nbsp; <br /> &nbsp; Vga = 771&nbsp; <br /> &nbsp; NOTE:&nbsp; <br /> &nbsp; 771 representatives of 800 x600&#215;8 at (256) color mode&nbsp; <br /> &nbsp; 791 representatives of 1024 x768&#215;16 bit (65,536) color mode&nbsp; <br /> &nbsp; 792 representatives of 1024 x768&#215;32 bit (65,536) color mode&nbsp; </p>
<p> &nbsp; Grub:&nbsp; <br /> &nbsp; In image after the accession vga = 771&nbsp; <br /> &nbsp; Such as:&nbsp; <br /> &nbsp; Image = / boot/linuxzhcon-2.4.18 vga = 771&nbsp; </p>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.programingreference.com/zhcon-how-to-change-the-resolution/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Interview Luantan</title>
		<link>http://www.programingreference.com/interview-luantan/</link>
		<comments>http://www.programingreference.com/interview-luantan/#comments</comments>
		<pubDate>Sun, 31 Dec 2006 00:00:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Popular articles]]></category>

		<guid isPermaLink="false">http://www.programingreference.com/interview-luantan</guid>
		<description><![CDATA[<p> &#160; A netizen interview Posts&#160; </p><p> &#160; <em>Today, an inverted company to interview after interview results to staff not, they came up with a written test and a White Paper, some of the answers in the paper, the result is usually used in the paper by some not, I feel very lose face!</em>&#160;...]]></description>
			<content:encoded><![CDATA[<p> &nbsp; A netizen interview Posts&nbsp; </p>
<p> &nbsp; <em>Today, an inverted company to interview after interview results to staff not, they came up with a written test and a White Paper, some of the answers in the paper, the result is usually used in the paper by some not, I feel very lose face!</em>&nbsp; <br /> &nbsp; <em>Written by topic: Which know the answer to written so limited number of people who make detours after</em>&nbsp; <br /> &nbsp; <em><i>1,</i> transient statement What does that mean?</em>&nbsp; <br /> &nbsp; <em>Such as:</em>&nbsp; <br /> &nbsp; <i><em>Transient String str;</em></i>&nbsp; </p>
<p> &nbsp; <em>2, servlet statement cycle?</em>&nbsp; <br /> &nbsp; <em><i>3,</i> EJB Remote interface in the home interface to do what is the use?</em>&nbsp; <br /> &nbsp; <em><i>4,</i> the 10 HttpServlet say?</em>&nbsp; <br /> &nbsp; <em><i>5,</i> WSDL What is the acronym?</em>&nbsp; <br /> &nbsp; <em><i>6,</i> xml, html difference?</em>&nbsp; <br /> &nbsp; <em><i>7,</i> write java operation with the xml add, delete Node an example?</em>&nbsp; <br /> &nbsp; <em><i>8,</i> the application supports multiple databases to achieve transplantation, what are the solutions?</em>&nbsp; <br /> &nbsp; <em><i>9,</i> web applications replace the need to achieve dynamic interface, how do?</em>&nbsp; <br /> &nbsp; <em><i>10,</i> page write oracle under the sql statement?</em>&nbsp; </p>
<p> &nbsp; Have had to interview, had also interviewed others. Deep sympathy for the users.&nbsp; </p>
<p> &nbsp; <strong>My first.</strong>&nbsp; </p>
<p> &nbsp; Out of the University of the first in a communication to the company, a manager of Tsinghua University Department of Mathematics. No subject is a person interviews. Wanted very simple, to enter this company, courage talked with him, chatting, it is very smooth entry of this company. later and join us into the company of a group of people chatting, and he told us that the only reason for the choice is that we are the good guys.&nbsp; </p>
<p> &nbsp; Learned a lot here, doing things, be a good person.&nbsp; </p>
<p> &nbsp; <strong>On the subject of interview</strong>&nbsp; </p>
<p> &nbsp; The fact that test is not an end, the problem is even more out of the wrong. In a certain period of time, almost all companies must interview that the test, each of the topics are varied, examiners did not seem to be the true test of your ability , but to test your patience. interview I do most cattle subject to a three and a half hours, is a waste of time ah.&nbsp; <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /></p>
<p> &nbsp; Not entitled A test of a person&#39;s true ability of a person to understand the need to dig, to practice my view is that as long as he is a good man, a strong initiative people will certainly be able to adapt to his position. Find some if strong ability to master, and not doing things to come to work every day QQ Internet, and for your useful?&nbsp; </p>
<p> &nbsp; I generally subject to relatively simple, conceptual things, but also more targeted. You need to understand Java / database on these topics, in addition some simple software knowledge. Through to the final or to chat about a person feel and the.&nbsp; </p>
<p> &nbsp; <strong>Company crucial</strong>&nbsp; </p>
<p> &nbsp; I have not held companies, many things may not have experience on my experience, speak briefly&nbsp; </p>
<p> &nbsp; Specific targeted: Many companies in the recruitment of what information must be written, such as N will be multi-language, multi-technology proficiency N programmers. Look at all could not help but laugh every time, meaningful? What kind of posts, to what kind of , what kind of requirements are clear, that is to say companies need to have a certain level of the structure. while with a project can write procedures will be adjusted system can manage the allocation of resources, veterans eat regularly accompany chat generalists is running out. software industry has entered a more distinct division of the era.&nbsp; </p>
<p> &nbsp; Personnel reserve: There are many people missing in the project, the method is often thought to recruit airborne. The result is often one can not be a great role airborne, the project at greater risk. A personnel training system, and rational reserves to the company&#39;s development be of great benefit.&nbsp; </p>
<p> &nbsp; <strong>Interesting experience</strong>&nbsp; </p>
<p> &nbsp; One day, I went to a company notice of interviews, and I have every vote resume some time, strange, take a look at the attitude of went there. Interview I is a woman general manager interviews is chat, talk about the experience what. see me quite satisfied, but I asked a question, and said: I have for a long time did not resume, how you have my information. she told me that she was eliminated from the curriculum vitae, I see a pile The biographical note, I feel pretty good on the notice. could not help but sigh, I had a horse or a car or, being a Xiaobing arch dead.&nbsp; </p>
</p>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.programingreference.com/interview-luantan/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Easy to get data access layer [continued 2]</title>
		<link>http://www.programingreference.com/easy-to-get-data-access-layer-continued-2/</link>
		<comments>http://www.programingreference.com/easy-to-get-data-access-layer-continued-2/#comments</comments>
		<pubDate>Sun, 31 Dec 2006 00:00:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Popular articles]]></category>

		<guid isPermaLink="false">http://www.programingreference.com/easy-to-get-data-access-layer-continued-2</guid>
		<description><![CDATA[<p> &#160; &#39;ClsDataAccessOper such that all of the data access of the father&#160; <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /></p><p> &#160; &#39;By YuJun&#160; </p><p> &#160; &#39;Www.hahaIT.com&#160; </p><p> &#160; &#39;Hahasoft@msn.com&#160; </p><p></p><p> &#160;...]]></description>
			<content:encoded><![CDATA[<p> &nbsp; &#39;ClsDataAccessOper such that all of the data access of the father&nbsp; <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /></p>
<p> &nbsp; &#39;By YuJun&nbsp; </p>
<p> &nbsp; &#39;Www.hahaIT.com&nbsp; </p>
<p> &nbsp; &#39;Hahasoft@msn.com&nbsp; </p>
</p>
<p> &nbsp; Public Class clsDataAccessOper&nbsp; </p>
</p>
<p> &nbsp; &#39;When Update, Delete, Add method of operation failed to return to False, wrong information recorded&nbsp; </p>
<p> &nbsp; Public Shared ModifyErrorString As String&nbsp; </p>
</p>
<p> &nbsp; Private Shared Keys As New Hashtable&nbsp; </p>
</p>
<p> &nbsp; &#39;Database connection string&nbsp; </p>
<p> &nbsp; Public Shared Property ConnectionString () As String&nbsp; </p>
<p> Get </p>
<p> &nbsp; Return SqlHelper.cnnString.Trim&nbsp; </p>
<p> &nbsp; End Get&nbsp; </p>
<p> &nbsp; Set (ByVal Value As String)&nbsp; </p>
<p> &nbsp; SqlHelper.cnnString = Value.Trim&nbsp; </p>
<p> &nbsp; End Set&nbsp; </p>
<p> &nbsp; End Property&nbsp; </p>
</p>
<p> &nbsp; &#39;Update did not update the main keys, including joint primary key&nbsp; </p>
<p> &nbsp; Public Shared Function Update (ByVal o As Object) As Boolean&nbsp; </p>
<p> &nbsp; ModifyErrorString = &quot;&quot;&nbsp; </p>
<p> Try </p>
<p> &nbsp; If CType (SqlHelper.ExecuteNonQuery (SqlHelper.cnnString, CommandType.Text, SQLBuilder.Exists (o)), Int64) = 0 Then&nbsp; </p>
<p> &nbsp; Throw New Exception ( &quot;the record does not exist!&quot;)&nbsp; </p>
<p> &nbsp; End If&nbsp; </p>
<p> &nbsp; Catch ex As Exception&nbsp; </p>
<p> &nbsp; Throw ex&nbsp; </p>
<p> &nbsp; End Try&nbsp; </p>
</p>
<p> Try </p>
<p> &nbsp; SqlHelper.ExecuteNonQuery (SqlHelper.cnnString, CommandType.Text, SQLBuilder.Update (o))&nbsp; </p>
<p> &nbsp; Catch ex As Exception&nbsp; </p>
<p> &nbsp; ModifyErrorString = ex.Message&nbsp; </p>
<p> &nbsp; Return False&nbsp; </p>
<p> &nbsp; End Try&nbsp; </p>
<p> &nbsp; Return True&nbsp; </p>
<p> &nbsp; End Function&nbsp; </p>
</p>
<p> &nbsp; &#39;Delete will be neglected&nbsp; </p>
<p> &nbsp; Public Shared Function Delete (ByVal o As Object) As Boolean&nbsp; </p>
<p> &nbsp; ModifyErrorString = &quot;&quot;&nbsp; </p>
<p> Try </p>
<p> &nbsp; SqlHelper.ExecuteNonQuery (SqlHelper.cnnString, CommandType.Text, SQLBuilder.Delete (o))&nbsp; </p>
<p> &nbsp; Catch ex As Exception&nbsp; </p>
<p> &nbsp; ModifyErrorString = ex.Message&nbsp; </p>
<p> &nbsp; Return False&nbsp; </p>
<p> &nbsp; End Try&nbsp; </p>
<p> &nbsp; Return True&nbsp; </p>
<p> &nbsp; End Function&nbsp; </p>
</p>
<p> &nbsp; &#39;Add method will automatically ignore the added value of the primary key&nbsp; </p>
<p> &nbsp; Public Shared Function Add (ByVal o As Object) As Boolean&nbsp; </p>
<p> &nbsp; ModifyErrorString = &quot;&quot;&nbsp; </p>
<p> Try </p>
<p> &nbsp; SqlHelper.ExecuteNonQuery (SqlHelper.cnnString, CommandType.Text, SQLBuilder.Add (o))&nbsp; </p>
<p> &nbsp; Catch ex As Exception&nbsp; </p>
<p> &nbsp; ModifyErrorString = ex.Message&nbsp; </p>
<p> &nbsp; Return False&nbsp; </p>
<p> &nbsp; End Try&nbsp; </p>
<p> &nbsp; Return True&nbsp; </p>
<p> &nbsp; End Function&nbsp; </p>
</p>
<p> &nbsp; &#39;Universal Database Query Method&nbsp; </p>
<p> &nbsp; &#39;Heavy methods specified for the operation of the database tables to name&nbsp; </p>
<p> &nbsp; &#39;Otherwise ReturnType will describe the type of operation must be the name of the database table eg: ReturnType = &quot;clsRooms&quot; moral support TableName = &quot;tbl_Rooms&quot;&nbsp; </p>
</p>
<p> &nbsp; &#39;This query methods will be added to the Keys for conditions (HashTable), and then call Select method returns a collection of objects&nbsp; </p>
<p> &nbsp; &#39;When Keys contains special bond, will be dealing with the complex types of enquiries, see note SQLBuilder the ComplexSQL&nbsp; </p>
<p> &nbsp; &#39;This method can develop data access methods for the fixed category&nbsp; </p>
</p>
<p> &nbsp; Public Overloads Shared Function [Select] (ByVal ReturnType As Type) As ArrayList&nbsp; </p>
<p> &nbsp; Dim tableName As String&nbsp; </p>
<p> &nbsp; TableName = ReturnType.Name&nbsp; </p>
<p> &nbsp; Dim i As Int16&nbsp; </p>
<p> &nbsp; I = tableName.IndexOf ( &quot;cls&quot;) + 3&nbsp; </p>
<p> &nbsp; TableName = &quot;tbl_&quot; &amp; tableName.Substring (i, tableName.Length - i)&nbsp; </p>
<p> &nbsp; Return [Select] (ReturnType, tableName)&nbsp; </p>
<p> &nbsp; End Function&nbsp; </p>
</p>
<p> &nbsp; Public Overloads Shared Function [Select] (ByVal ReturnType As Type, ByVal TableName As String) As ArrayList&nbsp; </p>
<p> &nbsp; Dim alOut As New ArrayList&nbsp; </p>
</p>
<p> &nbsp; Dim dsDB As New Data.DataSet&nbsp; </p>
<p> &nbsp; DsDB.ReadXml (clsPersistant.DBConfigPath)&nbsp; </p>
<p> &nbsp; Dim xxxH As New Hashtable&nbsp; </p>
<p> &nbsp; Dim eachRow As Data.DataRow&nbsp; </p>
<p> &nbsp; For Each eachRow In dsDB.Tables (TableName). Rows&nbsp; </p>
<p> &nbsp; If Keys.Contains (CType (eachRow.Item ( &quot;name&quot;), String). ToLower.Trim) Then&nbsp; </p>
<p> &nbsp; XxxH.Add (CType (eachRow.Item ( &quot;dbname&quot;), String). ToLower.Trim, Keys (CType (eachRow.Item ( &quot;name&quot;), String). Trim.ToLower))&nbsp; </p>
<p> &nbsp; End If&nbsp; </p>
<p> Next </p>
</p>
<p> &nbsp; &#39;Check the legality of Keys&nbsp; </p>
<p> &nbsp; Dim dsSelect As New Data.DataSet&nbsp; </p>
<p> &nbsp; If Keys.Count xxxH.Count Then &lt;&gt;&nbsp; </p>
<p> &nbsp; Keys.Clear ()&nbsp; </p>
<p> &nbsp; Dim InvalidField As New Exception ( &quot;Without you set the field:&quot;)&nbsp; </p>
<p> &nbsp; Throw InvalidField&nbsp; </p>
<p> Else </p>
<p> &nbsp; Keys.Clear ()&nbsp; </p>
<p> Try </p>
<p> &nbsp; DsSelect = SqlHelper.ExecuteDataset (SqlHelper.cnnString, CommandType.Text, SQLBuilder.Select (xxxH, TableName))&nbsp; </p>
<p> &nbsp; Catch ex As Exception&nbsp; </p>
<p> &nbsp; Throw ex&nbsp; </p>
<p> &nbsp; End Try&nbsp; </p>
<p> &nbsp; End If&nbsp; </p>
</p>
<p> &nbsp; Dim eachSelect As Data.DataRow&nbsp; </p>
<p> &nbsp; Dim fieldName As String&nbsp; </p>
<p> &nbsp; Dim DBfieldName As String&nbsp; </p>
</p>
<p> &nbsp; For Each eachSelect In dsSelect.Tables (0). Rows&nbsp; </p>
<p> &nbsp; Dim newObject As Object = System.Activator.CreateInstance (ReturnType)&nbsp; </p>
<p> &nbsp; For Each eachRow In dsDB.Tables (TableName). Rows&nbsp; </p>
<p> &nbsp; FieldName = CType (eachRow.Item ( &quot;name&quot;), String). Trim&nbsp; </p>
<p> &nbsp; DBfieldName = CType (eachRow.Item ( &quot;dbname&quot;), String). Trim&nbsp; </p>
<p> &nbsp; CallByName (newObject, fieldName, CallType.Set, CType (eachSelect.Item (DBfieldName), String). Trim)&nbsp; </p>
<p> Next </p>
<p> &nbsp; AlOut.Add (newObject)&nbsp; </p>
<p> &nbsp; Nothing newObject =&nbsp; </p>
<p> Next </p>
<p> &nbsp; Return alOut&nbsp; </p>
<p> &nbsp; End Function&nbsp; </p>
</p>
<p> &nbsp; Public Shared WriteOnly Property SelectKeys (ByVal KeyName As String)&nbsp; </p>
<p> &nbsp; Set (ByVal Value As Object)&nbsp; </p>
<p> &nbsp; Keys.Add (KeyName.Trim.ToLower, Value)&nbsp; </p>
<p> &nbsp; End Set&nbsp; </p>
<p> &nbsp; End Property&nbsp; </p>
</p>
<p> &nbsp; &#39;Below four methods used to record movement&nbsp; </p>
<p> &nbsp; &#39;Mobile record the size of the primary key sequence mobile, only to have only one primary key and the operating table&nbsp; </p>
<p> &nbsp; &#39;The combination of the keys, to return to Nothing&nbsp; </p>
<p> &nbsp; &#39;When records or mobile end Noting return at the end, when the table is empty, First, Last Nothing return all&nbsp; </p>
<p> &nbsp; Public Shared Function First (ByVal o As Object) As Object&nbsp; </p>
<p> &nbsp; Return Move ( &quot;first&quot; o)&nbsp; </p>
<p> &nbsp; End Function&nbsp; </p>
</p>
<p> &nbsp; Public Shared Function Last (ByVal o As Object) As Object&nbsp; </p>
<p> &nbsp; Return Move ( &quot;last&quot; o)&nbsp; </p>
<p> &nbsp; End Function&nbsp; </p>
</p>
<p> &nbsp; Public Shared Function Previous (ByVal o As Object) As Object&nbsp; </p>
<p> &nbsp; Return Move ( &quot;previous&quot; o)&nbsp; </p>
<p> &nbsp; End Function&nbsp; </p>
</p>
<p> &nbsp; Public Shared Function [Next] (ByVal o As Object) As Object&nbsp; </p>
<p> &nbsp; Return Move ( &quot;next&quot;, o)&nbsp; </p>
<p> &nbsp; End Function&nbsp; </p>
</p>
<p> &nbsp; &#39;Go back to the table the number of the main keys, keyName, keyDBName record is the last one primary key&nbsp; </p>
<p> &nbsp; Private Shared Function getKey (ByRef keyName As String, ByRef keyDBName As String, ByVal TableName As String) As Int16&nbsp; </p>
<p> &nbsp; Dim keyNum As Int16 = 0&nbsp; </p>
<p> &nbsp; Dim dsDB As New DataSet&nbsp; </p>
<p> &nbsp; DsDB.ReadXml (clsPersistant.DBConfigPath)&nbsp; </p>
<p> &nbsp; Dim row As Data.DataRow&nbsp; </p>
<p> &nbsp; For Each row In dsDB.Tables (TableName). Rows&nbsp; </p>
<p> &nbsp; If row.Item (the &quot;key&quot;) = &quot;1&quot; Then&nbsp; </p>
<p> &nbsp; KeyNum keyNum + 1 =&nbsp; </p>
<p> &nbsp; KeyName = CType (row.Item ( &quot;name&quot;), String). Trim&nbsp; </p>
<p> &nbsp; KeyDBName = CType (row.Item ( &quot;dbname&quot;), String). Trim&nbsp; </p>
<p> &nbsp; Exit For&nbsp; </p>
<p> &nbsp; End If&nbsp; </p>
<p> Next </p>
<p> &nbsp; Return keyNum&nbsp; </p>
<p> &nbsp; End Function&nbsp; </p>
</p>
<p> &nbsp; &#39;For the First, Previous, Next, Last provide a common function&nbsp; </p>
<p> &nbsp; Private Shared Function Move (ByVal Type As String, ByVal o As Object) As Object&nbsp; </p>
<p> &nbsp; Dim moveSQL As String&nbsp; </p>
<p> &nbsp; Select Case Type.Trim.ToLower&nbsp; </p>
<p> &nbsp; Case &quot;first&quot;&nbsp; </p>
<p> &nbsp; MoveSQL = SQLBuilder.First (o)&nbsp; </p>
<p> &nbsp; Case &quot;last&quot;&nbsp; </p>
<p> &nbsp; MoveSQL = SQLBuilder.Last (o)&nbsp; </p>
<p> &nbsp; Case &quot;previous&quot;&nbsp; </p>
<p> &nbsp; MoveSQL = SQLBuilder.Previous (o)&nbsp; </p>
<p> &nbsp; Case &quot;next&quot;&nbsp; </p>
<p> &nbsp; MoveSQL = SQLBuilder.Next (o)&nbsp; </p>
<p> &nbsp; End Select&nbsp; </p>
</p>
<p> &nbsp; Dim typeString As String = o.GetType.ToString&nbsp; </p>
<p> &nbsp; Dim i As Int16&nbsp; </p>
<p> &nbsp; I = typeString.IndexOf ( &quot;cls&quot;) + 3&nbsp; </p>
<p> &nbsp; TypeString = &quot;tbl_&quot; &amp; typeString.Substring (i, typeString.Length - i)&nbsp; </p>
<p> &nbsp; Dim TableName As String = typeString&nbsp; </p>
</p>
<p> &nbsp; Dim keyName As String&nbsp; </p>
<p> &nbsp; Dim keyDBName As String&nbsp; </p>
<p> &nbsp; Dim tmpString As String&nbsp; </p>
<p> &nbsp; If getKey (keyName, keyDBName, TableName) = 1 Then&nbsp; </p>
<p> &nbsp; Keys.Clear ()&nbsp; </p>
<p> &nbsp; Dim ds As New Data.DataSet&nbsp; </p>
<p> &nbsp; Ds = SqlHelper.ExecuteDataset (SqlHelper.cnnString, CommandType.Text, moveSQL)&nbsp; </p>
<p> &nbsp; If ds.Tables (0). Rows.Count = 0 Then&nbsp; </p>
<p> &nbsp; Return Nothing&nbsp; </p>
<p> Else </p>
<p> &nbsp; TmpString = CType (ds.Tables (0). Rows (0). Item (keyDBName), String). Trim&nbsp; </p>
<p> &nbsp; Keys.Add (keyName.Trim.ToLower, tmpString)&nbsp; </p>
<p> &nbsp; Dim al As New ArrayList&nbsp; </p>
<p> &nbsp; Al = [Select] (o.GetType)&nbsp; </p>
<p> &nbsp; If al.Count = 1 Then&nbsp; </p>
<p> &nbsp; Return al.Item (0)&nbsp; </p>
<p> Else </p>
<p> &nbsp; Return Nothing&nbsp; </p>
<p> &nbsp; End If&nbsp; </p>
<p> &nbsp; End If&nbsp; </p>
<p> Else </p>
<p> &nbsp; Return Nothing&nbsp; </p>
<p> &nbsp; End If&nbsp; </p>
<p> &nbsp; End Function&nbsp; </p>
</p>
<p> &nbsp; End Class&nbsp; </p>
</p>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.programingreference.com/easy-to-get-data-access-layer-continued-2/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Java Object List of performance analysis and testing</title>
		<link>http://www.programingreference.com/java-object-list-of-performance-analysis-and-testing/</link>
		<comments>http://www.programingreference.com/java-object-list-of-performance-analysis-and-testing/#comments</comments>
		<pubDate>Sun, 31 Dec 2006 00:00:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Popular articles]]></category>

		<category><![CDATA[object]]></category>

		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://www.programingreference.com/java-object-list-of-performance-analysis-and-testing</guid>
		<description><![CDATA[<p> &#160; SDK provides a set order to achieve several interface java.util.List, three of which most people are familiar with the Vector, ArrayList and LinkedList.&#160; &#160; List of these is a difference between the performance of frequently asked questions.&#160; &#160; In this article, I want to...]]></description>
			<content:encoded><![CDATA[<p> &nbsp; SDK provides a set order to achieve several interface java.util.List, three of which most people are familiar with the Vector, ArrayList and LinkedList.&nbsp; &nbsp; List of these is a difference between the performance of frequently asked questions.&nbsp; &nbsp; In this article, I want to explore is LinkedList and Vector / performance difference between the ArrayList.&nbsp; </p>
<p> &nbsp; For the comprehensive analysis of the performance differences between the categories, we must know their method.&nbsp; &nbsp; Therefore, I would like the following from the point of view of performance, a brief introduction of the realization of these characteristics.&nbsp; </p>
<p> &nbsp; <strong>First, the realization of Vector and ArrayList</strong>&nbsp; </ccid></p>
<p> &nbsp; Vector and ArrayList are with a bottom of the Object [] array, the Object [] array elements to preserve.&nbsp; &nbsp; Index visit through the elements, you simply visit indexed by internal array elements:&nbsp; </p>
<p><ccid_nobr> &nbsp; Public Object get (int index)&nbsp; <br /> &nbsp; (/ / Check first whether legitimate index &#8230; here do not show this part of the code return&nbsp; <br /> &nbsp; ElementData [index];)&nbsp; </ccid_nobr></p>
<p> &nbsp; Internal arrays can be more than Vector / ArrayList object with the number of elements, both as a residual of the margin space, in order to achieve quickly add new elements.&nbsp; &nbsp; With the remaining space, adding elements of a very simple, the only new element to the preservation of an internal array of spare position, and then a new location on the margins of increase Index Value:&nbsp; </p>
<p><ccid_nobr> &nbsp; Public boolean add (Object o)&nbsp; <br /> &nbsp; (EnsureCapacity (size + 1) / / later on elementData [size + +] = o; return true;&nbsp; <br /> &nbsp; / / List.add (Object) return value)&nbsp; <br /></ccid_nobr></p>
<p> &nbsp; Set in the arbitrary elements inserted in the position specified by (rather than at the end of the pool) a little bit more complex: insertion point on the array elements must all move forward one position, and then are assigned to:&nbsp; </p>
<p><ccid_nobr> &nbsp; Public void add (int index, Object element) (&nbsp; <br /> &nbsp; / / First check whether legitimate index &#8230; here do not show this part of the code&nbsp; <br /> &nbsp; EnsureCapacity (size +1);&nbsp; <br /> &nbsp; System.arraycopy (elementData, index, elementData, index + 1,&nbsp; <br /> &nbsp; Size - index);&nbsp; <br /> &nbsp; ElementData [index] = element;&nbsp; <br /> &nbsp; Size + +;&nbsp; <br /> &nbsp; )&nbsp; <br /></ccid_nobr></p>
<p> &nbsp; The remaining space was used up, and if necessary to add more elements Vector / ArrayList object must be an even greater array of new replacement of its internal Object [] array, all the elements of an array copied to the new array.&nbsp; &nbsp; According to different versions of the SDK, the new array than the original 100% or 50% (the code shown below the expanding array of 100%):&nbsp; </p>
<p><ccid_nobr> &nbsp; Public void ensureCapacity (int minCapacity) (&nbsp; <br /> &nbsp; Int oldCapacity = elementData.length;&nbsp; <br /> &nbsp; If (minCapacity&gt; oldCapacity) (&nbsp; <br /> &nbsp; Object oldData [] = elementData;&nbsp; <br /> &nbsp; Int newCapacity = Math.max (oldCapacity * 2, minCapacity);&nbsp; <br /> &nbsp; ElementData = new Object [newCapacity];&nbsp; <br /> &nbsp; System.arraycopy (oldData, 0, elementData, 0, size);&nbsp; <br /> &nbsp; )&nbsp; <br /> &nbsp; )&nbsp; <br /></ccid_nobr></p>
<p> &nbsp; Vector ArrayList class and the principal difference is synchronization.&nbsp; &nbsp; In addition to the two serial only for the method, not a ArrayList synchronous implementation of the method is the ability to the contrary, the majority of Vector method has synchronization capabilities, either directly or indirectly.&nbsp; &nbsp; Therefore, Vector is thread-safe, but not ArrayList.&nbsp; &nbsp; This makes ArrayList than Vector fast.&nbsp; &nbsp; For some of the latest JVM, two of the differences in speed can be ignored Excluding: Strictly speaking, these JVM, these two categories the difference in speed is less than the comparative performance of these tests showed that the time difference.&nbsp; </p>
<p> &nbsp; Index to access and update through the elements, ArrayList Vector and the realization of a superior performance, as there are no checks in addition to the scope of the other expenses.&nbsp; &nbsp; Unless an array of internal expansion space must be exhausted, otherwise add to the list at the end of the element, or deleted from the list at the end of the element, it has equally outstanding performance.&nbsp; &nbsp; Insert and delete elements to the array element has to be copied (when the array must first expand, it needs to reproduce twice).&nbsp; &nbsp; Be copied and the number of elements [size-index] proportional, that is, and insert / delete points in the final index to set the distance between the location of proportion.&nbsp; &nbsp; The insert operation, the elements inserted into the set top (indexing 0), the worst performance, inserted into the final set when the plane (after the end of an existing element), the best performance.&nbsp; &nbsp; With the increasing scale of collection, array copying expenses also increasing rapidly, because each operation must insert copy of the increase in the number of the element.&nbsp; </p>
<p><ccid> &nbsp; <b>Second, the realization of LinkedList</b>&nbsp; </ccid></p>
<p> &nbsp; LinkedList through a two-way link list of nodes to achieve.&nbsp; &nbsp; Index visit to pass elements, you have to find all the nodes, until a target node:&nbsp; </p>
<p><ccid_nobr> &nbsp; Public Object get (intindex) (&nbsp; <br /> &nbsp; / / First check whether legitimate index &#8230; here do not show this part of the code&nbsp; <br /> &nbsp; Entry e = header; / / start node&nbsp; <br /> &nbsp; / / Find forward or backward, from which a specific direction than the distance&nbsp; <br /> &nbsp; / / Close decision&nbsp; <br /> &nbsp; If (index &lt;size / 2) (&nbsp; <br /> &nbsp; For (int i = 0; i &lt;= index; i + +)&nbsp; <br /> &nbsp; E = e.next;&nbsp; <br /> &nbsp; Else ()&nbsp; <br /> &nbsp; For (int i = size; i&gt; index; i -)&nbsp; <br /> &nbsp; E = e.previous;&nbsp; <br /> &nbsp; )&nbsp; <br /> &nbsp; Return e;&nbsp; <br /> &nbsp; )&nbsp; <br /></ccid_nobr></p>
<p> &nbsp; List of the insert elements are very simple: find a designated index nodes, the nodes before the close and then insert a new node:&nbsp; </p>
<p><ccid_nobr> &nbsp; Public void add (int index, Object element) (&nbsp; <br /> &nbsp; / / First check whether legitimate index &#8230; here do not show this part of the code&nbsp; <br /> &nbsp; Entry e = header; / / starting node&nbsp; <br /> &nbsp; / / Find forward or backward, from which a specific direction than the distance&nbsp; <br /> &nbsp; / / Close decision&nbsp; <br /> &nbsp; If (index &lt;size / 2) (&nbsp; <br /> &nbsp; For (int i = 0; i &lt;= index; i + +)&nbsp; <br /> &nbsp; E = e.next;&nbsp; <br /> &nbsp; Else ()&nbsp; <br /> &nbsp; For (int i = size; i&gt; index; i -)&nbsp; <br /> &nbsp; E = e.previous;&nbsp; <br /> &nbsp; )&nbsp; <br /> &nbsp; Entry newEntry = new Entry (element, e, e.previous);&nbsp; <br /> &nbsp; NewEntry.previous.next = newEntry;&nbsp; <br /> &nbsp; NewEntry.next.previous = newEntry;&nbsp; <br /> &nbsp; Size + +;&nbsp; <br /> &nbsp; )&nbsp; <br /></ccid_nobr></p>
<p> &nbsp; LinkedList security threads and other pool&nbsp; </p>
<p> &nbsp; If Java SDK should be a thread-safe, LinkedList, you can use a package of sync from Collections.synchronizedList (List) with a.&nbsp; &nbsp; However, the use of synchronous accession package for the equivalent of an indirect layer, it will bring high performance cost.&nbsp; &nbsp; When the package calls for the transfer to the packaging method, a method is the need to increase an additional Method Invocation, after simultaneous package Package approach than the method without a package two to three times slower.&nbsp; &nbsp; As the search for such complex operations, such indirect costs brought about by the call is not very prominent, but the relatively simple methods, such as access function or update function, the performance of such expenses may have serious repercussions.&nbsp; </p>
<p> &nbsp; This means that, and Vector compared to the synchronous package LinkedList performance in a significant disadvantage because Vector thread-safe and do not need to carry out any additional indirect call.&nbsp; &nbsp; If you want to have a thread-safe, LinkedList, you can copy the LinkedList several categories and the necessary means for synchronization, so you can get a faster implementation.&nbsp; &nbsp; For all other collections, which are equally effective: Only List and Map is an efficient realization of the security thread (a Vector and Hashtable).&nbsp; &nbsp; Interestingly, these two categories efficient thread-safe only to the existence of backward compatibility, and is not based on performance considerations.&nbsp; </p>
<p> &nbsp; The visit by indexing and updating of elements LinkedList achieve the performance overhead slightly, because an index visit arbitrary demand across multiple nodes.&nbsp; &nbsp; Insert element across multiple nodes in addition to the performance overhead, but also other expenses, which targets the creation node costs.&nbsp; &nbsp; In the edge, LinkedList achieve insertion and deletion of no other operating expenses, therefore, insert - removing overhead almost entirely dependent on Insert - deleted from the collection points at the end of the distance.&nbsp; </p>
<p><ccid> &nbsp; <b>Third, performance testing</b>&nbsp; </ccid></p>
<p> &nbsp; There are many different categories of these functions can be tested.&nbsp; &nbsp; LinkedList application more frequently, because people think it in the random insert and delete operations with better performance.&nbsp; &nbsp; Therefore, I am now focused on the analysis of the operation will be inserted into the performance, that is, construction sets.&nbsp; &nbsp; I tested and compared the LinkedList and ArrayList, as both are non-synchronous.&nbsp; </p>
<p> &nbsp; Insert the speed of operation from the main pool size and the location of elements inserted decision.&nbsp; &nbsp; When inserted in the location of the point and the two ends of the middle set, the worst performance and inserted into the best performance of all opportunities that arise.&nbsp; &nbsp; Therefore, I chose the three insert location (set at the beginning, middle and end), a collection of three typical Size: Medium (100 elements), and large (10,000 elements), the super-large (1 million elements).&nbsp; </p>
<p> &nbsp; In this test, I am using a JAVA SDK 1.2.0 and 1.3.0 series SUN JVM.&nbsp; &nbsp; In addition, I also used HOTSPOT JVM 2.0 to the test, version 1.3.0 SDK can be found.&nbsp; &nbsp; In the table below, all measured by the time one of the SDK 1.2 VM test time (in the form shown as 100% of the unit) for the baseline display.&nbsp; &nbsp; Test the use of the default JVM configuration, that is, the opening of the JIT compiler, for all JVM, heap space must be extended in order to avoid memory overflow error.&nbsp; &nbsp; Form record time is the average time-tested.&nbsp; &nbsp; In order to avoid the impact of refuse collection in various tests conducted between I fully compulsory liquidation of memory (see test source code for details).&nbsp; &nbsp; Pagination disk monitoring to ensure that the disk will not arise in the course of testing (any test, if it shows serious disk paging operation, were discarded).&nbsp; &nbsp; All showed a few seconds of the slow response time of the test is repeated until a clear record to a reasonable period of time.&nbsp; </p>
<p><ccid_nobr> &nbsp; Table 1: Construction of a medium-sized pool (100 elements).&nbsp; &nbsp; The figures in brackets for a collection of pre-determined size.&nbsp; &nbsp; 1.2 JVM 1.3 JVM HotSpot JVM 2.0 ArrayList always inserted into the beginning of 100% (48.0%) 184.9% (152.0%) 108.0% (66.7%) are inserted into the beginning of LinkedList 135.5% 109.1% 85.3% are inserted into ArrayList in the middle 130.0% (40.6%) 187.4% (158.0%) 84.7% (46.0%) always inserted into the middle of LinkedList 174.0% 135.0% 102.3% to ArrayList always inserted at the end of 63.3% (20.7%) 65.9% (25.0 %) 60.3% (29.3%) LinkedList always inserted into the end of 106.7% 86.3% 80.3%&nbsp; </ccid_nobr></p>
<p> &nbsp; For smaller sets, ArrayList, and the performance is very close to LinkedList.&nbsp; &nbsp; When the elements inserted into the pool at the end, that is an additional element, ArrayList in the performance of the mutation.&nbsp; &nbsp; However, additional elements are ArrayList optimized for a particular operation: If you only want a fixed size of the static pool, Java arrays (such as Object []) than any set targets have better performance.&nbsp; &nbsp; Apart from the additional operations, measured the time difference is not much data, they reflect the various JVM optimization level, and not something else.&nbsp; </p>
<p> &nbsp; For example, the set of elements inserted into the starting position, (Table 1 of the first two lines), plus LinkedList HotSpot JVM 2.0 is the best performance (85.3%), in the second position is 1.2 JVM increase ArrayList (100% ).&nbsp; &nbsp; These two results show that, in simple 1.2 JIT compiler in the implementation of iterative and reproduction, such as an array of simple operation with high efficiency.&nbsp; &nbsp; In HotSpot JVM with the complexities of the compiler optimization to improve the performance of complex operations, such as object creation (the creation LinkedList nodes), and be able to use embedded code (code-inlining) advantage.&nbsp; &nbsp; 1.3 JVM to the results seem to indicate that, in its simple operation and great performance deficiencies, it was possible in future versions of the JVM be improved.&nbsp; </p>
<p> &nbsp; Here I am particularly testing is ArrayList compared to the LinkedList Another advantage of pre-determined that the ability to set the size.&nbsp; &nbsp; Specifically, the creation of ArrayList time allows you to specify a specific size (for example, in testing for ArrayList can create with the capacity of 100 elements), so as to avoid all elements with the increasing size of the increase in collection costs.&nbsp; &nbsp; Table 1 shows that the number in parentheses set of pre-set size of the extent of the increase.&nbsp; &nbsp; LinkedList (until SDK 1.3) can not be pre-determined size.&nbsp; </p>
<p> &nbsp; In addition, ArrayList generate only a small amount of the need for refuse collection target, namely, to preserve the element of the array of internal targets, as well as each ArrayList inadequate capacity expansion, creating the need for additional internal array object.&nbsp; &nbsp; LinkedList regardless of any potential delete operation, for each of the insert operation generates a node object.&nbsp; &nbsp; Therefore, the LinkedList garbage collectors will bring a lot of work.&nbsp; &nbsp; Taking these factors into account, for any small and medium-sized pool, I would choose not to use ArrayList LinkedList.&nbsp; </p>
<p><ccid_nobr> &nbsp; Table 2: Construction of a large pool (10,000 elements) 1.2 JVM 1.3 JVM HotSpot JVM 2.0 ArrayList always inserted into the beginning of 7773% 7537% 7500% LinkedList always inserted into the beginning of 100% 90.34% 65.6% are inserted into ArrayList the middle of 3318% 3412% 3121% LinkedList always inserted into the middle of 26264% 14315% 14209% ArrayList always inserted into the end of 41.4% 41.2% 37.5% LinkedList always inserted into the end of 66.4% 73.9% 61.7%&nbsp; </ccid_nobr></p>
<p> &nbsp; Table 2 shows that a large-scale set of test results.&nbsp; &nbsp; We can see that in the event of a large-scale operation into the time, we began to experience severe performance penalty.&nbsp; &nbsp; As we have in front of the realization of the results obtained, the LinkedList, in the worst case in the elements when inserted into the middle set.&nbsp; &nbsp; In addition, we can also see, and when to use ArrayList elements inserted into the pool compared to the beginning of the worst properties, the use of the elements LinkedList when inserted into the middle of the performance pool some even worse.&nbsp; &nbsp; And the two worst performance compared to the situation, the elements inserted into the middle of ArrayList properties obviously much better.&nbsp; </p>
<p> &nbsp; Overall view, ArrayList Once again, in most cases showed better performance, including the index of the random elements inserted into the location of the situation.&nbsp; &nbsp; If you always been trying to insert elements set forward in the location of LinkedList has better performance, however, you can use a reverse ArrayList better performance, namely, the realization of the use of a dedicated, or through [size-index] mapping overturned in the index set in place.&nbsp; </p>
<p><ccid_nobr> &nbsp; Table 3: Construction of a large set (1 million elements) 1.2 JVM 1.3 JVM HotSpot JVM 2.0 ArrayList always inserted into the beginning of long, long overdue, long LinkedList always inserted into the beginning of 100% 179.5% 144.1% always inserted into ArrayList long long, long overdue, in the middle always inserted into the middle of LinkedList always too long too long too long to ArrayList inserted at the end of 38.3% 47.7% 42.9% LinkedList always inserted into the end of 65.1% 161.5% 139.9%&nbsp; </ccid_nobr></p>
<p> &nbsp; Table 3 shows the large set of test results can be derived from the table in Table 2 and the conclusions are very similar.&nbsp; &nbsp; However, Table 3 stressed that the requirements of large data sets, set type, data-processing algorithm between the right support, otherwise, you will be in fact unacceptable performance.&nbsp; &nbsp; As for performance optimization, you can construct a special address the problem of collections.&nbsp; &nbsp; The large collection, in order to obtain acceptable performance, structural special collections often is necessary.&nbsp; </p>
<p><ccid> &nbsp; <b>Fourth, for the performance of</b>&nbsp; </ccid></p>
<p> &nbsp; In the category of internal enquiries for achieving maximum performance.&nbsp; &nbsp; For enquiries these lists, all the elements iteration of the time required is a limiting factor.&nbsp; &nbsp; ArrayList / Vector category will be achieved on the elements of iteration.&nbsp; &nbsp; The following example of the total number of empty elements:&nbsp; </p>
<p><ccid_nobr> &nbsp; Int count = 0;&nbsp; <br /> &nbsp; For (int i = 0; i &lt;size; i + +)&nbsp; <br /> &nbsp; If (elementData [i] == null)&nbsp; <br /> &nbsp; Count + +; LinkedList class will search for the realization of all the nodes.&nbsp; &nbsp; All the following examples of the total number of empty elements:&nbsp; <br /> &nbsp; Node = header.next;&nbsp; <br /> &nbsp; Count = 0;&nbsp; <br /> &nbsp; For (int i = 0; i &lt;repeat; i + +, node = node.next)&nbsp; <br /> &nbsp; If (node.element == null)&nbsp; <br /> &nbsp; Count + +;&nbsp; <br /></ccid_nobr></p>
<p> &nbsp; Table 4 shows that ArrayList performance significantly exceeded the LinkedList, it once again shows ArrayList should be our preferred category.&nbsp; &nbsp; Table 5 shows the use of the List.listIterator (int), and was the object iteration ListIterator all the elements of the time required, if not in the List for internal mechanisms to achieve these iterators is essential.&nbsp; &nbsp; ArrayList once again showed a higher performance, but this is not the extent of the difference, as shown in table 4, as inconceivable.&nbsp; &nbsp; Note that Table 5 shows the absolute time equivalent Table 4 shows that the absolute time of 10 times, that is, traversing some internal ArrayList than ArrayList use ListIterator 10 times faster iteration.&nbsp; </p>
<p><ccid_nobr> &nbsp; Table 4: through internal iteration set to visit all the elements of 1.2 in 1.3 JVM HotSpot JVM 2.0 JVM ArrayList internal search 100% 106% 197% LinkedList internal search 470% 493% 448%&nbsp; </ccid_nobr></p>
<p><ccid_nobr> &nbsp; Table 5: ListIterator traversing through all the elements set in 1.2 JVM 1.3 JVM HotSpot JVM 2.0 ListIterator use iterative ArrayList 100% 118% 75.2% ListIterator use iterative ListedList 117% 186% 156%&nbsp; </ccid_nobr></p>
<p><ccid> &nbsp; <b>Concluding remarks</b>&nbsp; </ccid></p>
<p> &nbsp; The actual measurement and we have to consider other factors have clearly shows that ArrayList and Vector usually higher than LinkedList and synchronization package after the LinkedList a better performance.&nbsp; &nbsp; Even if you think that may provide better performance LinkedList the circumstances, you may amend by adding elements from ArrayList the way for better performance, for example, reversed the order of the element in the collection.&nbsp; </p>
<p> &nbsp; LinkedList there will be some cases better performance, for example, when large number of elements need to join the large pool at the beginning and at the end.&nbsp; &nbsp; But generally speaking, I suggest you use priority ArrayList / Vector category, only when they exist obvious performance problems and LinkedList to improve their performance when they use LinkedList.&nbsp; </p>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.programingreference.com/java-object-list-of-performance-analysis-and-testing/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Java 2 source Interpretation: java.util.ArrayList</title>
		<link>http://www.programingreference.com/java-2-source-interpretation-javautilarraylist/</link>
		<comments>http://www.programingreference.com/java-2-source-interpretation-javautilarraylist/#comments</comments>
		<pubDate>Sun, 31 Dec 2006 00:00:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[c++]]></category>

		<category><![CDATA[source]]></category>

		<guid isPermaLink="false">http://www.programingreference.com/java-2-source-interpretation-javautilarraylist</guid>
		<description><![CDATA[&#160; Related source download:&#160; <br /> &#160; Java.util.ArrayList&#160; <br /> &#160; Java.util.AbstractList&#160; <br /> &#160; Java.util.List&#160; <br /><br /> &#160; ArrayList List interface is a variable length arrays to achieve.&#160; &#160; List all the interface to achieve the operation,...]]></description>
			<content:encoded><![CDATA[<p>&nbsp; Related source download:&nbsp; <br /> &nbsp; Java.util.ArrayList&nbsp; <br /> &nbsp; Java.util.AbstractList&nbsp; <br /> &nbsp; Java.util.List&nbsp; </p>
<p> &nbsp; ArrayList List interface is a variable length arrays to achieve.&nbsp; &nbsp; List all the interface to achieve the operation, and allows storage null value.&nbsp; &nbsp; In addition to no synchronization, ArrayList basic equivalent to Vector.&nbsp; &nbsp; Vector in almost all of the methods have been conducted simultaneously, but only writeObject ArrayList readObject and a synchronization, such as add other (Object), remove (int) are not synchronized.&nbsp; <br />
<h4> &nbsp; 1. Storage&nbsp; </h4>
<p> &nbsp; ArrayList use an Object array storage elements.&nbsp; <br /> &nbsp; Private transient Object elementData [];&nbsp; <br /> &nbsp; ArrayList realized java.io.Serializable interface, the transient marker here do not automatically attribute this sequence of.&nbsp; &nbsp; Below will writeObject () method explained in detail why do so.&nbsp; <br />
<h3> &nbsp; 2.add and remove&nbsp; </h3>
<p> &nbsp; <b>Public boolean</b> add (Object o) (&nbsp; <br /> &nbsp; EnsureCapacity (size + 1) / / <i>Increments modCount!</i>&nbsp; <br /> &nbsp; ElementData [size + +] = o;&nbsp; <br /> &nbsp; <b>Return true;</b>&nbsp; <br /> &nbsp; )&nbsp; </p>
<p> &nbsp; Note here ensureCapacity () method, and its role is to ensure that elementData the length of the array can accommodate a new element.&nbsp; &nbsp; In the &quot;automatic variable length mechanism&quot; will be explained in detail.&nbsp; <br /> &nbsp; <b>Public</b> Object remove <b>(int</b> index) (&nbsp; <br /> &nbsp; RangeCheck (index);&nbsp; <br /> &nbsp; ModCount + +;&nbsp; <br /> &nbsp; Object oldValue = elementData [index];&nbsp; <br /> &nbsp; <b>Int numMoved</b> = size - index - 1;&nbsp; <br /> &nbsp; <b>If</b> (numMoved&gt; 0)&nbsp; <br /> &nbsp; System.arraycopy (elementData, index +1, elementData, index,&nbsp; <br /> &nbsp; NumMoved);&nbsp; <br /> &nbsp; ElementData [- size] = <i>null; / / Let gc do its work</i>&nbsp; <br /> &nbsp; <b>Return oldValue;</b>&nbsp; <br /> &nbsp; )&nbsp; </p>
<p> &nbsp; RangeCheck () to the role of border checkpoints.&nbsp; &nbsp; As ArrayList object array with a storage element, an element in the need to remove the element behind the advancement.&nbsp; &nbsp; Delete only one element of the array elements in elementData quoted in the home as null, the destruction of specific targets by the garbage collector is responsible for.&nbsp; <br /> &nbsp; ModCount role will be in the following &quot;iterator () synchronization,&quot; stated.&nbsp; <br /> &nbsp; Note: The use of the advancement of the System to provide a practical method: arraycopy (), in this case we can see that System.arraycopy () method can be carried out with an array of operation, this method is a native method, if operate with an array, the first from the source to a temporary copy of the array, the array elements of the temporary copy to the target location.&nbsp; <br />
<h3> &nbsp; 3. Automatic variable length mechanism&nbsp; </h3>
<p> &nbsp; In the case of an ArrayList, you can specify an initial capacity.&nbsp; &nbsp; This capacity is elementData the initial length of the array.&nbsp; &nbsp; If you use:&nbsp; <br /> &nbsp; ArrayList list = new <b>ArrayList</b> ();&nbsp; </p>
<p> &nbsp; Using the default capacity: 10.&nbsp; <br /> &nbsp; <b>Public</b> ArrayList () (&nbsp; <br /> &nbsp; <b>This</b> (10);&nbsp; <br /> &nbsp; )&nbsp; </p>
<p> &nbsp; ArrayList offers four add () method,&nbsp; 
<ul>
<li> &nbsp; Public boolean add (Object o)&nbsp; 
<li> &nbsp; Public void add (int index, Object element)&nbsp; 
<li> &nbsp; Public boolean addAll (Collection c)&nbsp; 
<li> &nbsp; Public boolean addAll (int index, Collection c)&nbsp; </li>
</ul>
<p> &nbsp; In each of the add () method, a first call ensureCapacity (int miniCapacity) method, this method guarantees elementData not less than the length of the array miniCapacity.&nbsp; &nbsp; ArrayList automatic variable length mechanism is in the method to achieve.&nbsp; <br /> &nbsp; <b>Public void ensureCapacity (int minCapacity)</b> (&nbsp; <br /> &nbsp; ModCount + +;&nbsp; <br /> &nbsp; <b>Int oldCapacity</b> = elementData.length;&nbsp; <br /> &nbsp; <b>If</b> (minCapacity&gt; oldCapacity) (&nbsp; <br /> &nbsp; Object oldData [] = elementData;&nbsp; <br /> &nbsp; <b>Int newCapacity</b> = (oldCapacity * 3) / 2 + 1;&nbsp; <br /> &nbsp; <b>If</b> (newCapacity &lt;minCapacity)&nbsp; <br /> &nbsp; NewCapacity = minCapacity;&nbsp; <br /> &nbsp; ElementData = <b>new</b> Object <b>[newCapacity newCapacity];</b>&nbsp; <br /> &nbsp; System.arraycopy (oldData, 0, elementData, 0, size);&nbsp; <br /> &nbsp; )&nbsp; <br /> &nbsp; )&nbsp; </p>
<p> &nbsp; In this method can be seen in the ArrayList each expansion, expanded to the original size of 1.5 times.&nbsp; <br /> &nbsp; Each add () method is the realization of similar Below is add (Object) method to achieve:&nbsp; <br /> &nbsp; <b>Public boolean</b> add (Object o) (&nbsp; <br /> &nbsp; EnsureCapacity (size + 1) / / <i>Increments modCount!</i>&nbsp; <br /> &nbsp; ElementData [size + +] = o;&nbsp; <br /> &nbsp; <b>Return true;</b>&nbsp; <br /> &nbsp; )&nbsp; </p>
<h3> &nbsp; 4.iterator () Synchronization&nbsp; </h3>
<p> &nbsp; AbstractList father in the category in the definition of an int type attributes: modCount record ArrayList structural change in the number.&nbsp; <br /> &nbsp; <b>Protected transient int modCount</b> = 0;&nbsp; </p>
<p> &nbsp; ArrayList all involved in the structural changes in the method of modCount increased value, including: add (), remove (), addAll (), removeRange () and clear () method.&nbsp; &nbsp; Call each one of these methods, the value of the Canadian modCount 1.&nbsp; <br /> &nbsp; Note: add () and addAll () method is the value of the modCount call in which the ensureCapacity () method increased.&nbsp; </p>
<p> &nbsp; AbstractList the iterator () method (ArrayList directly inherited this method) using the internal members of a private Itr, generate a Itr object (Iterator interface) return:&nbsp; <br /> &nbsp; <b>Public</b> Iterator iterator () (&nbsp; <br /> &nbsp; <b>Return new</b> Itr ();&nbsp; <br /> &nbsp; )&nbsp; </p>
<p> &nbsp; Itr realized Iterator () interface, which also defines an int type attributes: expectedModCount, this attribute in the type initialization Itr was given ArrayList object modCount the value of the attribute.&nbsp; <br /> &nbsp; <b>Int expectedModCount</b> = modCount;&nbsp; </p>
<p> &nbsp; Note: members of the internal Itr is also a member of ArrayList class, it can access all the properties and methods AbstractList.&nbsp; &nbsp; Understand this point, the realization of Itr categories can be easily understood.&nbsp; </p>
<p> &nbsp; In Itr.hasNext () method:&nbsp; <br /> &nbsp; <b>Public boolean hasNext</b> () (&nbsp; <br /> &nbsp; <b>Return</b> cursor! = Size ();&nbsp; <br /> &nbsp; )&nbsp; </p>
<p> &nbsp; Calling the AbstractList the size () method, compared the current cursor position is cross-border.&nbsp; </p>
<p> &nbsp; In Itr.next () method, also called Itr defined in the AbstractList get (int) method, the current cursor to return to the elements:&nbsp; <br /> &nbsp; <b>Public</b> Object next () (&nbsp; <br /> &nbsp; <b>Try</b> (&nbsp; <br /> &nbsp; Object next = get (cursor);&nbsp; <br /> &nbsp; CheckForComodification ();&nbsp; <br /> &nbsp; LastRet = cursor + +;&nbsp; <br /> &nbsp; <b>Return</b> next;&nbsp; <br /> &nbsp; ) <b>Catch</b> (IndexOutOfBoundsException e) (&nbsp; <br /> &nbsp; CheckForComodification ();&nbsp; <br /> &nbsp; <b>Throw new NoSuchElementException</b> ();&nbsp; <br /> &nbsp; )&nbsp; <br /> &nbsp; )&nbsp; </p>
<p> &nbsp; Note that in the next () method calls the checkForComodification () method, the synchronization of the revised inspection:&nbsp; <br /> &nbsp; <b>Final void checkForComodification</b> () (&nbsp; <br /> &nbsp; <b>If</b> (modCount! = ExpectedModCount)&nbsp; <br /> &nbsp; <b>Throw new ConcurrentModificationException</b> ();&nbsp; <br /> &nbsp; )&nbsp; </p>
<p> &nbsp; ModCount expectedModCount now and the role should be very clear.&nbsp; &nbsp; In a collection object or operation of generation at the same time, do not set targets to limit the operation of the elements, some of these operations, including possible errors or substituting the add () or remove (), and dangerous operation.&nbsp; &nbsp; AbstractList in, the use of a simple mechanism to circumvent these risks.&nbsp; &nbsp; This is modCount expectedModCount and the role of the host.&nbsp; <br />
<h3> &nbsp; 5. Sequence of support&nbsp; </h3>
<p> &nbsp; ArrayList realized java.io.Serializable interface, it can ArrayList object to the sequence of persistent storage medium.&nbsp; &nbsp; ArrayList the main attributes are defined as follows:&nbsp; 
<ul>
<li> &nbsp; Private static final long serialVersionUID = 8683452581122892189L;&nbsp; 
<li> &nbsp; Private transient Object elementData [];&nbsp; 
<li> &nbsp; Private int size;&nbsp; </li>
</ul>
<p> &nbsp; SerialVersionUID size can be seen and will automatically sequence of the medium, but elementData is defined as an array of objects of the transient.&nbsp; &nbsp; In other words ArrayList of all these elements will not be automatic serialization of the media.&nbsp; &nbsp; Why should we achieve this?&nbsp; &nbsp; ElementData array storage because the &quot;elements&quot; In fact, only one of these elements used is not really the target sequence of the application of an object is meaningless, because of the sequence-to-sequence, when you - Sequence of, the application of these objects have been impossible at the original object.&nbsp; &nbsp; So here the need for manual ArrayList elements of the operation sequence.&nbsp; &nbsp; This is writeObject () role.&nbsp; <br /> &nbsp; <b>Private synchronized void writeObject</b> (java.io.ObjectOutputStream s)&nbsp; <br /> &nbsp; <b>Throws</b> java.io.IOException (&nbsp; <br /> &nbsp; <i>/ / Write out element count, and any hidden stuff</i>&nbsp; <br /> &nbsp; S.defaultWriteObject ();&nbsp; <br /> &nbsp; <i>/ / Write out array length</i>&nbsp; <br /> &nbsp; S.writeInt (elementData.length);&nbsp; <br /> &nbsp; <i>/ / Write out all elements in the proper order.</i>&nbsp; <br /> &nbsp; <b>For (int</b> i = 0; i &lt;size; i + +)&nbsp; <br /> &nbsp; S.writeObject (elementData [i]);&nbsp; <br /> &nbsp; )&nbsp; </p>
<p> &nbsp; ElementData such elements in the array element object can be so correct sequence of the storage medium to.&nbsp; <br /> &nbsp; Corresponding readObject () in accordance with writeObject () method in the order read from the input stream:&nbsp; <br /> &nbsp; <b>Private synchronized void readObject</b> (java.io.ObjectInputStream s)&nbsp; <br /> &nbsp; <b>Throws</b> java.io.IOException, ClassNotFoundException (&nbsp; <br /> &nbsp; <i>/ / Read in size, and any hidden stuff</i>&nbsp; <br /> &nbsp; S.defaultReadObject ();&nbsp; <br /> &nbsp; <i>/ / Read in array length and allocate array</i>&nbsp; <br /> &nbsp; <b>Int</b> arrayLength = s.readInt ();&nbsp; <br /> &nbsp; ElementData = <b>new</b> Object [arrayLength];&nbsp; <br /> &nbsp; <i>/ / Read in all elements in the proper order.</i>&nbsp; <br /> &nbsp; <b>For (int</b> i = 0; i &lt;size; i + +)&nbsp; <br /> &nbsp; ElementData s.readObject [i] = ();&nbsp; <br /> &nbsp; )&nbsp; </p>
]]></content:encoded>
			<wfw:commentRss>http://www.programingreference.com/java-2-source-interpretation-javautilarraylist/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Regular Expression Analysis using C # documents (updated)</title>
		<link>http://www.programingreference.com/regular-expression-analysis-using-c-documents-updated/</link>
		<comments>http://www.programingreference.com/regular-expression-analysis-using-c-documents-updated/#comments</comments>
		<pubDate>Sun, 31 Dec 2006 00:00:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Popular articles]]></category>

		<category><![CDATA[expression]]></category>

		<guid isPermaLink="false">http://www.programingreference.com/regular-expression-analysis-using-c-documents-updated</guid>
		<description><![CDATA[<p><style type="text"><!-- body{ font-family:Verdana; font-size:small; } p{ margin-top:6px; margin-bottom:6px; } .cscodes{ background-color:#F4F4F4; border:3px; border-color:#999999; font-family:Verdana; font-size:8.25pt; margin-left:10px; } p.MsoNormal { margin:0cm; margin-bottom:1px; text-align:justify;...]]></description>
			<content:encoded><![CDATA[<p>
<style type="text"><!-- body{ font-family:Verdana; font-size:small; } p{ margin-top:6px; margin-bottom:6px; } .cscodes{ background-color:#F4F4F4; border:3px; border-color:#999999; font-family:Verdana; font-size:8.25pt; margin-left:10px; } p.MsoNormal { margin:0cm; margin-bottom:1px; text-align:justify; text-justify:inter-ideograph; color:black; } --></style>
<p> &nbsp; Regular Expression Analysis using C # documents (Updated) Jack H Hansen [2004-07-28] Keywords C # Regular Expression (Regular Expression) Syntax Highlighting presumably many readers have written to the code by syntax coloring process.&nbsp; &nbsp; And this in a period of time before it is a very difficult task.&nbsp; &nbsp; Code you need to write a large number of grammar - and this is often the most difficult part.&nbsp; &nbsp; Until, the regular expression (Regular Expression) the emergence, we will be able to work from the heavy relief.&nbsp; &nbsp; Regular expressions are a number of methods available (standard mode), so that we can efficiently create, modify and string comparison, as well as the rapid analysis of large text and data to search, remove and replace text mode <sup>[1].</sup>&nbsp; &nbsp; DotNET Framework provides System.Text.RegularExpression namespace to achieve their commitment to the function.&nbsp;
<p> &nbsp; 1. A regular expression <sup>[2]</sup>&nbsp; </p>
<p> &nbsp; First of all, I would like to briefly talk about the regular expression.&nbsp; </p>
<p> &nbsp; Regular expressions are the first by the mathematician Stephen Kleene made in 1956, he is in the natural language of incremental research results on the basis of the past.&nbsp; &nbsp; With the integrity of the regular expression syntax used in the form of matching characters regard, the melt was later applied to the field of information technology.&nbsp; &nbsp; Since then, the regular expression through periods of development, and now has been the standard ISO (International Standards Organization) approved by the Open Group and organizations identified.&nbsp; </p>
<p> &nbsp; The regular expression is not a language, but it can be used in a document or characters in the Find and replace text of a standard.&nbsp; &nbsp; It has two standards: a regular expression (BRE), Extended Regular Expression (ERE).&nbsp; &nbsp; ERE including BRE other functions and other concepts.&nbsp; </p>
<p> &nbsp; Xsh have advanced, egrep, sed, vi and UNIX platforms under the program the regular expression.&nbsp; &nbsp; They can be adopted by many languages, such as HTML and XML, which usually is only adopted a subset of the standard.&nbsp; &nbsp; Along with the regular expression transplanted to cross-platform programming language development, its functions are increasingly integrity, and extensive use gradually.&nbsp; </p>
<p> &nbsp; 2. Related to the expression&nbsp; </p>
<p> &nbsp; Is the regular expression I can only so much - it is not a small body of knowledge, not the few words to explain.&nbsp; &nbsp; Here, I only introduced with C # syntax analysis related to a guitar string matching.&nbsp; &nbsp; Please refer to the detailed contents of the collection points Blog Regular Expression Specification [The Open Group].&nbsp; &nbsp; Also, if you have a regular expression of a considerable understanding, then you can skip Below each one explained to complete as soon as possible the full text.&nbsp; </p>
<p> &nbsp; I&gt; string &quot;(\ \ ?.)*?&quot;&nbsp; </p>
<p> &nbsp; In addition to the regular expression. $ ^ ([(|) * +? \, The other characters with their own match.&nbsp; &nbsp; In the above Shizi, the quotation mark on both sides of the matching string is that on both sides of the quotes.&nbsp; &nbsp; &quot;\ \&quot; Said a &quot;\&quot; character.&nbsp; &nbsp; Following behind the &quot;?&quot; Said match zero or one character.&nbsp; &nbsp; &quot;.&quot; With the exception \ n characters from any match.&nbsp; </p>
<p> &nbsp; &quot;()&quot; That capture the match in the string.&nbsp; &nbsp; Usage () caught under the order from left brackets automatically No. 1.&nbsp; &nbsp; Capture elements of a code zero capture by the regular expression pattern matching text.&nbsp; &nbsp; Parentheses after the &quot;*&quot; indicated the existence of one or more of such strings.&nbsp; &nbsp; Namely, &quot;*&quot; is the role in the &quot;(\ \?.)&quot;.&nbsp; </p>
<p> &nbsp; &quot;?&quot; The existence of empty string can also be captured.&nbsp; </p>
<p> &nbsp; Ii&gt; verbatim string&quot;(&quot;&quot;|.)*?&quot;&nbsp; </p>
<p> &nbsp; Matching similar to the @ &quot;Hello&quot; and &quot;World&quot; and &quot;!&quot; String.&nbsp; </p>
<p> &nbsp; And use | (vertical) separation of any characters matching a term, for example, cat | dog | tiger.&nbsp; &nbsp; The most successful use of the left side of the match.&nbsp; </p>
<p> &nbsp; Iii&gt; C # documentation information in the xml element / / / \ s *&lt;.*&gt;&nbsp; </p>
<p> &nbsp; C # automated matching XML documents.&nbsp; &nbsp; &quot;\ S&quot; any blank characters.&nbsp; &nbsp; It must be noted that, please do not be modified case.&nbsp; &nbsp; Because in the regular expression is case sensitive, in its wildcard in the case characters often said exactly the opposite meaning.&nbsp; &nbsp; For example, &quot;\ S&quot; that any non-blank characters.&nbsp; &nbsp; (Below &quot;\ Z&quot; is such)&nbsp; </p>
<p> &nbsp; Iv&gt; C # documentation of the contents of information / / / \ s? .*&nbsp; </p>
<p> &nbsp; V&gt; empty row ^ \ s * \ Z&nbsp; </p>
<p> &nbsp; &quot;^&quot; Designated match must appear at the beginning or in the string to the beginning.&nbsp; &nbsp; &quot;\ Z&quot; said designated match must appear on the end of a string or the end of the string \ n before.&nbsp; </p>
<p> &nbsp; Vi&gt; C # Notes / / .*&nbsp; </p>
<p> &nbsp; Vii&gt; C # keyword (abstract | where | while | yield) (1) (\. | (\ S )+|;|,| \ (| \ [) (1)&nbsp; </p>
<p> &nbsp; Space constraints, only listed here a few keywords (C # at least 80 keywords ^_^)ã€‚&nbsp; &nbsp; It must be noted that the left parser will match the success of the first.&nbsp; &nbsp; Therefore, the relationship has included the word should pay attention to the order: Includes have to be included on those before.&nbsp; &nbsp; For example: (in | int) will be its analytical Chabudao int, it should be (int | in).&nbsp; </p>
<p> &nbsp; In addition to all the brackets (\ (| \ [| \ (| \) | \] | \)).&nbsp; </p>
<p> &nbsp; 3. Related with the members <sup>[3]</sup>&nbsp; </p>
<p>
<p> [Serializable] </p>
<p> &nbsp; Public class Regex: ISerializable&nbsp; </p>
<p> &nbsp; / / That can not be changed is the regular expression.&nbsp; </p>
<p> &nbsp; <strong>Regex</strong> class includes a number of static methods, so that you do not need explicit <strong>Regex</strong> object can be used to create a regular expression.&nbsp; &nbsp; Use the static method is equivalent to <strong>Regex</strong> object structure, the use of the object once and then their destruction.&nbsp; </p>
<p> &nbsp; <strong>Regex</strong> class is not changed (read-only), and has inherent security thread.&nbsp; &nbsp; In any thread can create <strong>Regex</strong> object, and shared among threads.&nbsp; </p>
<p> &nbsp; Excerpt from Microsoft over the development of documentation.&nbsp; &nbsp; We also need to use several of its members:&nbsp; </p>
<p> &nbsp;&nbsp; / / Designated input in the search string Regex specified in the constructor function of the regular expression <span>matches.&nbsp;&nbsp; </p>
<p> &nbsp; Public Match Match (&nbsp; </p>
<p> &nbsp; String intput&nbsp; </p>
<p> ) </p>
<p> &nbsp; Match of the&nbsp; </p>
<p> [Serializable] </p>
<p> &nbsp; Public class Match: Group&nbsp; </p>
<p> &nbsp; / / That is the regular expression matching individual results.&nbsp; &nbsp; Group related to the detailed information, please refer to Microsoft&#39;s development document.&nbsp; </p>
<p> &nbsp; We will use the following members&nbsp; </p>
<p> &nbsp; / / String found in the original capture of a string of initial position to start from scratch.&nbsp; </p>
<p> &nbsp; Public int Index (get;)&nbsp; </p>
</p>
<p> &nbsp; / / Capture of the length of the string.&nbsp; </p>
<p> &nbsp; Public int Length (get;)&nbsp; </p>
</p>
<p> &nbsp; / / By matching the actual capture of a string.&nbsp; </p>
<p> &nbsp; Public int Value (get;)&nbsp; </p>
</p>
<p> &nbsp; / / Get a value, the value of matching the success of instructions.&nbsp; </p>
<p> &nbsp; Public bool Success (get;)&nbsp; </p>
</p>
<p> &nbsp; / / Get from the regular expression matching collection of the group.&nbsp; </p>
<p> &nbsp; Public virtual GroupCollection Groups (get;)&nbsp; </p>
</p>
<p> &nbsp; / / From the end of a match here (in the last match of the character after character)&nbsp; </p>
<p> &nbsp; / / Return a matching contains the results of a new Match.&nbsp; </p>
<p> &nbsp; Public Match NextMatch ();&nbsp; </p>
<p> &nbsp; Group category, as well as the corresponding members (listed above of the members of the Match, by the first four attributes are inherited from the Group category, these members will no longer be an exhaustive list).&nbsp; </p>
<p> &nbsp; Matching string must Regex instance of the class initialization time specified.&nbsp; &nbsp; You can use the constructor function creates an instance, use it and then destroyed it.&nbsp; &nbsp; Or directly use the static method, which is equivalent to creation of examples.&nbsp; &nbsp; However, after testing, I found that the static method to slightly slower than compiled Regex object.&nbsp; &nbsp; See below for a group of test data:&nbsp; </p>
<p><center><img alt="" hspace="0" src="/images/blog_csdn_net/matrix2003b/28471/o_test_001.jpg" align="baseline" border="0" /></center>
<p> &nbsp; 4. Write code&nbsp; </p>
<p> &nbsp; We now need to set out in section III of the C # language element analysis.&nbsp; &nbsp; I have taken a progressive analysis (if we are to take more of the need to amend the relevant expression <sup>[4]).</sup>&nbsp; </p>
<p> &nbsp; Using System.Text.RegularExpression;&nbsp; </p>
<p> &nbsp; / / &#8230; Some other codes &#8230;&nbsp; </p>
<p> &nbsp; / / Create Regex first examples (string analytical example).&nbsp; </p>
<p> &nbsp; Regex DoubleQuotedString = new Regex ( &quot;\&quot; (\ \ \ \ ?.)*? \ &quot;&quot;);&nbsp; </p>
<p> &nbsp; / / And then to match string.&nbsp; </p>
<p> &nbsp; Match m;&nbsp; </p>
<p> &nbsp; For (m = DoubleQuotedString.Match (strSomeCodes); m.Success; m.NextMatch ()) (&nbsp; </p>
<p> &nbsp; Foreach (Group g in m.Groups) (&nbsp; </p>
<p> &nbsp; / / Do some drawings&nbsp; </p>
<p> &nbsp; )&nbsp; </p>
<p> &nbsp; )&nbsp; </p>
<p> &nbsp; The remaining issue is the color code has written.&nbsp; </p>
<p> &nbsp; 5. Source code&nbsp; </p>
<p> <img alt="" hspace="0" src="/images/blog_csdn_net/matrix2003b/28471/o_download.jpg" align="baseline" border="0" />
</p>
<p> &nbsp; Note:&nbsp; </p>
<p> &nbsp; [1] &quot;canâ€¦â€¦ text mode&quot; since the primers. NET Framework conventional reference in the regular expression language elements&nbsp; </p>
<p> &nbsp; [2] Introduction here is the expression of the regular expression is a brief introduction of the reference ZDNet China in the development of technology and related content.&nbsp; </p>
<p> &nbsp; [3] of this section and in the function of the signatures were from the Notes and Microsoft documents.&nbsp; </p>
<p> &nbsp; [4] Analysis more details, please see the trip. NET Framework conventional reference to the regular expression language elements&nbsp; </p>
</p>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.programingreference.com/regular-expression-analysis-using-c-documents-updated/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Network Security Code</title>
		<link>http://www.programingreference.com/network-security-code/</link>
		<comments>http://www.programingreference.com/network-security-code/#comments</comments>
		<pubDate>Sun, 31 Dec 2006 00:00:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Open source]]></category>

		<category><![CDATA[network]]></category>

		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://www.programingreference.com/network-security-code</guid>
		<description><![CDATA[&#160; 1. Not to download software from small site, not to run &#34;good intentions&#34; of prawns, such as software patches, beware of people with ulterior motives were exploited!&#160; &#160; This can prevent Trojan horses and black drug nemesis, NoSkyNet such software running.&#160; <BR><BR> &#160;...]]></description>
			<content:encoded><![CDATA[<p>&nbsp; 1. Not to download software from small site, not to run &quot;good intentions&quot; of prawns, such as software patches, beware of people with ulterior motives were exploited!&nbsp; &nbsp; This can prevent Trojan horses and black drug nemesis, NoSkyNet such software running.&nbsp; <BR><BR> &nbsp; 2. Vigilance of the people not familiar with the E-Mail to not opening, with the annex should more carefully.&nbsp; &nbsp; Another acquaintance of the operator is to E-Mail, on the annex which must carefully, your friends might inadvertently harm your (his computer was infected with the Trojan horse, but he may not know their own).&nbsp; <BR><BR> &nbsp; 3. Triad installed antivirus software, download antivirus software with anti-triad operation before inspection software, such as Jinshan drug tyrants can be identified and drug nemesis, NoSkyNet and that the black hole above 2001, and software, such as anti-triad &quot;Trojan nemesis&quot; can check Shentou a network.&nbsp; <BR><BR> &nbsp; 4. Attention to the registry HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows \ Curren Version and HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion, all &quot;Run&quot; from the beginning of the keys, there are no suspicious file names.&nbsp; &nbsp; If there is, we need to delete the corresponding keys, then delete the corresponding applications.&nbsp; <BR><BR> &nbsp; 5. Group launched System.ini and Win.ini and Trojan horses like also to the hidden places, we should pay attention to inspect these places.&nbsp; <BR><BR> &nbsp; 6. Preferably through a proxy to access the Internet, the only way to hide their true IP, those who know your IP through to attack you, the person would lose their objective.&nbsp; <BR><BR> &nbsp; 7. Never suspected Skynet &quot;trouble&quot; Skynet is somewhat like lying in the West Tang Seng, but since you chose it, we must live with it &quot;wordy&quot; is the so-called &quot;wordy&quot; is the day The network repeatedly remind you, protect you, and therefore depends on careful, in the end what is the procedure to connect operation.&nbsp; <BR><BR> &nbsp; 8. Pay attention to his speech in the Internet, as far as possible not guilty, the true hacker is not unprovoked attack you.&nbsp; &nbsp; Only those who &quot;gray&quot; indiscriminate attacks off before, the methods used against them please 6.&nbsp; <BR><BR> &nbsp; The purpose of this paper is that we should not too superstitious firewall, to improve their own quality, enhance their awareness of network security.&nbsp; &nbsp; If we can achieve this, I would like to pledge&nbsp; </p>
]]></content:encoded>
			<wfw:commentRss>http://www.programingreference.com/network-security-code/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Universal Storage process. Find the only non-deleted records</title>
		<link>http://www.programingreference.com/universal-storage-process-find-the-only-non-deleted-records/</link>
		<comments>http://www.programingreference.com/universal-storage-process-find-the-only-non-deleted-records/#comments</comments>
		<pubDate>Sun, 31 Dec 2006 00:00:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Security]]></category>

		<category><![CDATA[storage]]></category>

		<guid isPermaLink="false">http://www.programingreference.com/universal-storage-process-find-the-only-non-deleted-records</guid>
		<description><![CDATA[<p> &#160; / *&#160; <br /> &#160; Name: spAll_DeleteNoneUnique&#160; <br /> &#160; Input: to the table and the field List&#160; <br /> &#160; Output:&#160; <br /> &#160; Call: spAll_DeleteNoneUnique table, field List&#160; <br /> &#160; Description: Universal Storage process. Find the only non-deleted...]]></description>
			<content:encoded><![CDATA[<p> &nbsp; / *&nbsp; <br /> &nbsp; Name: spAll_DeleteNoneUnique&nbsp; <br /> &nbsp; Input: to the table and the field List&nbsp; <br /> &nbsp; Output:&nbsp; <br /> &nbsp; Call: spAll_DeleteNoneUnique table, field List&nbsp; <br /> &nbsp; Description: Universal Storage process. Find the only non-deleted records&nbsp; <br /> &nbsp; Author: Dili JF Senders&nbsp; <br /> &nbsp; E-mail: dili@wellknow.net&nbsp; <br /> &nbsp; Web site: http://www.wellknow.net&nbsp; <br /> &nbsp; Update: 20040610&nbsp; <br /> &nbsp; Support: http://bbs.wellknow.net&nbsp; <br /> &nbsp; Copyright: relaying, please specify the source: the creation of the future thinking Wellknow.net&nbsp; <br /> &nbsp; * /&nbsp; <br /> &nbsp; CREATE PROCEDURE spAll_DeleteNoneUnique&nbsp; <br /> &nbsp; / *&nbsp; <br /> ( <br /> &nbsp; @ Parameter1 datatype = default value,&nbsp; <br /> &nbsp; @ Parameter2 datatype OUTPUT&nbsp; <br /> ) <br /> &nbsp; * /&nbsp; <br /> ( <br /> &nbsp; @ TableName VARCHAR (50),&nbsp; <br /> &nbsp; @ Fields VARCHAR (500)&nbsp; <br /> ) <br /> AS <br /> &nbsp; SET NOCOUNT ON&nbsp; </p>
<p> &nbsp; DECLARE @ sSQL VARCHAR (1000)&nbsp; </p>
<p> &nbsp; SET @ sSQL = &#39;SELECT COUNT (*) AS few records,&#39;&nbsp; <br /> &nbsp; SET sSQL = @ @ @ sSQL + Fields&nbsp; <br /> &nbsp; SET = @ @ sSQL sSQL + &#39;FROM&#39; + @ TableName&nbsp; <br /> &nbsp; SET = @ @ sSQL sSQL + &#39;GROUP BY&#39; + @ Fields&nbsp; <br /> &nbsp; SET = @ @ sSQL sSQL + &#39;HAVING (COUNT (*)&gt; 1)&#39;&nbsp; </p>
<p> &nbsp; PRINT @ sSQL&nbsp; <br /> &nbsp; &#8212; EXEC (@ sSQL)&nbsp; <br /> &nbsp; &#8212; SELECT * FROM StockReceiveDQ&nbsp; </p>
<p> &nbsp; SET NOCOUNT OFF&nbsp; </p>
<p> GO </p>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.programingreference.com/universal-storage-process-find-the-only-non-deleted-records/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Log4j: backup files automatically set</title>
		<link>http://www.programingreference.com/log4j-backup-files-automatically-set/</link>
		<comments>http://www.programingreference.com/log4j-backup-files-automatically-set/#comments</comments>
		<pubDate>Sun, 31 Dec 2006 00:00:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.programingreference.com/log4j-backup-files-automatically-set</guid>
		<description><![CDATA[&#160; We have developed the B / S system, a general in the service end of the day-to-day operation of log records.&#160; &#160; Preservation of a form of log files, we often encounter a problem: log files too large.&#160; &#160; Fast on the log files available on the log information is also a problem.&#160;...]]></description>
			<content:encoded><![CDATA[<p>&nbsp; We have developed the B / S system, a general in the service end of the day-to-day operation of log records.&nbsp; &nbsp; Preservation of a form of log files, we often encounter a problem: log files too large.&nbsp; &nbsp; Fast on the log files available on the log information is also a problem.&nbsp; &nbsp; Therefore, I hope that we can produce a daily or monthly log files, such documents not too large.&nbsp; &nbsp; According to the log file size or to judge, exceeds the size, automatically add a new log file.&nbsp; <br /> &nbsp; In log4j in the realization of these two methods are as simple as in the configuration file can be set up.&nbsp; </p>
<p> &nbsp; First, a certain period of time in accordance with the log files, configuration files are as follows:&nbsp; <br /> &nbsp; # Set root logger level to ERROR and its only appender to A1.&nbsp; <br /> &nbsp; Log4j.rootLogger = ERROR, R&nbsp; </p>
<p> &nbsp; # R is set to be a DailyRollingFileAppender.&nbsp; <br /> &nbsp; Log4j.appender.R = org.apache.log4j.DailyRollingFileAppender&nbsp; </p>
<p> &nbsp; Log4j.appender.R.File = backup.log&nbsp; <br /> &nbsp; Log4j.appender.R.DatePattern = &#39;.&#39; Yyyy-MM-dd&nbsp; <br /> &nbsp; Log4j.appender.R.layout = org.apache.log4j.PatternLayout&nbsp; <br /> &nbsp; Log4j.appender.R.layout.ConversionPattern =% d (-yyyy-MM-dd HH: mm: ss) [% c] - [% p]% m% n&nbsp; </p>
<p> &nbsp; Configuration is more than produce a backup paper every day.&nbsp; &nbsp; Backup documents which name is backup.log.&nbsp; <br /> &nbsp; Specific results is this: the day the information recorded in the log backup.log document, the day before recorded in the name of backup.log.yyyy-mm-dd documents.&nbsp; <br /> &nbsp; Similarly, if a document can be produced per month to amend the above configurations:&nbsp; <br /> &nbsp; Will be&nbsp; <br /> &nbsp; Log4j.appender.R.DatePattern = &#39;.&#39; Yyyy-MM-dd&nbsp; <br /> &nbsp; Read&nbsp; <br /> &nbsp; Log4j.appender.R.DatePattern = &#39;.&#39; Yyyy-MM&nbsp; </p>
<p> &nbsp; Second, according to the log file size of a new log file automatically&nbsp; <br /> &nbsp; Configuration file reads as follows:&nbsp; </p>
<p> &nbsp; # Set root logger level to ERROR and its only appender to A1.&nbsp; <br /> &nbsp; Log4j.rootLogger = ERROR, R&nbsp; </p>
<p> &nbsp; # R is set to be a RollingFileAppender.&nbsp; <br /> &nbsp; Log4j.appender.R = org.apache.log4j.RollingFileAppender&nbsp; </p>
<p> &nbsp; Log4j.appender.R.File = backup.log&nbsp; <br /> &nbsp; # Log4j.appender.R.MaxFileSize = 100KB&nbsp; </p>
<p> &nbsp; Keep one backup file #&nbsp; <br /> &nbsp; Log4j.appender.R.MaxBackupIndex = 1&nbsp; <br /> &nbsp; Log4j.appender.R.layout = org.apache.log4j.PatternLayout&nbsp; <br /> &nbsp; Log4j.appender.R.layout.ConversionPattern =% d (-yyyy-MM-dd HH: mm: ss) [% c] - [% p]% m% n&nbsp; </p>
<p> &nbsp; Of which:&nbsp; <br /> &nbsp; # Log file size&nbsp; <br /> &nbsp; Log4j.appender.R.MaxFileSize = 100KB&nbsp; <br /> &nbsp; # Save a backup files&nbsp; <br /> &nbsp; Log4j.appender.R.MaxBackupIndex = 1&nbsp; </p>
]]></content:encoded>
			<wfw:commentRss>http://www.programingreference.com/log4j-backup-files-automatically-set/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.637 seconds -->
<!-- Cached page served by WP-Cache -->
