From 5f326c34a809d9b54e80b8701d7d93a00fcbbb4f Mon Sep 17 00:00:00 2001 From: Martin Goik <goik@hdm-stuttgart.de> Date: Fri, 14 Jul 2017 14:52:07 +0200 Subject: [PATCH] <programmlisting language="none"> to <screen> --- Doc/Sd1/appendix.xml | 102 +- Doc/Sd1/arrays.xml | 103 +- Doc/Sd1/collections.xml | 77 +- Doc/Sd1/coreClasses.xml | 36 +- Doc/Sd1/deployment.xml | 13 +- Doc/Sd1/gettingStarted.xml | 41 +- Doc/Sd1/inheritance.xml | 11 +- Doc/Sd1/interfacesAbstractClasses.xml | 5 +- Doc/Sd1/languageFundamentals.xml | 48 +- Doc/Sd1/objectsClasses.xml | 64 +- Doc/Sd1/statements.xml | 75 +- Doc/Sd1/streams.xml | 23 +- Doc/Sda1/dom.xml | 21 +- Doc/Sda1/fo.xml | 30 +- Doc/Sda1/jdbc.xml | 47 +- Doc/Sda1/jpaintro.xml | 16 +- Doc/Sda1/prerequisites.xml | 39 +- Doc/Sda1/sax.xml | 38 +- Doc/Sda1/schema.xml | 8 +- Doc/Sda1/try.xml | 419 -------- Doc/Sda1/xmlintro.xml | 12 +- Doc/Sda1/xslt.xml | 30 +- Doc/Sda2/jpa.xml | 122 +-- Doc/Sda2/ldap.xml | 1343 ++++++++++++------------- Doc/Sdi/apache.xml | 3 +- Doc/Sdi/dns.xml | 31 +- Doc/Sdi/gettingStarted.xml | 29 +- Doc/Sdi/ldap.xml | 29 +- Doc/Sdi/mail.xml | 3 +- Doc/Sdi/samba.xml | 25 +- Doc/Tdoc/general.xml | 62 +- XmlCross/xmlcross.xml | 392 ++++---- 32 files changed, 1454 insertions(+), 1843 deletions(-) delete mode 100644 Doc/Sda1/try.xml diff --git a/Doc/Sd1/appendix.xml b/Doc/Sd1/appendix.xml index 52cd358a3..fb80dc764 100644 --- a/Doc/Sd1/appendix.xml +++ b/Doc/Sd1/appendix.xml @@ -3,6 +3,7 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" + xmlns:ns="http://docbook.org/ns/transclusion" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook"> @@ -381,13 +382,13 @@ currency table structures</link>. These allow for a simple text file representation e.g. <filename>currencies.txt</filename>:</para> - <programlisting language="none">Chinese Yuan: 9.348070 + <screen>Chinese Yuan: 9.348070 Euro: 1.264280 Japanese Yen: 153.778000 U.K. Pound Sterling: 1.102940 U.S. Dollar: 1.356070 Algerian Dinar: 148.618000 -...</programlisting> +...</screen> <para>The rates being provided here allow for converting each currency to its <link @@ -419,7 +420,7 @@ Algerian Dinar: 148.618000 <para>Consider executing <command>java</command> <option>-jar <link xlink:href="/Sd1/Ref/Src/address.zip">address.zip</link></option>:</para> - <programlisting language="none">Current person records: + <screen>Current person records: 0: Frank Bone, email: bone@re.org, phone: 885-11-87 1: Julius Caesar, email: -, phone: - @@ -437,7 +438,7 @@ Main options: 3: Delete person entry <co linkends="sd1CalloutAddressDbProject-4" xml:id="sd1CalloutAddressDbProject-4-co"/> 4: Exit -Your choice: 2</programlisting> +Your choice: 2</screen> <calloutlist> <callout arearefs="sd1CalloutAddressDbProject-1-co" @@ -508,11 +509,11 @@ Your choice: 2</programlisting> <filename>address.txt</filename> on first invocation when adding at least one person:</para> - <programlisting language="none">Frank,Bone, ,885-11-87 + <screen>Frank,Bone, ,885-11-87 Julius,Caesar, , Ee,Ff,hh,45 A,B, ,24 -Eve,Gardener, ,32-44-2234</programlisting> +Eve,Gardener, ,32-44-2234</screen> <para>Each person record is being represented by four values being separated by three commas. Empty attribute values require a single @@ -556,18 +557,18 @@ Eve,Gardener, ,32-44-2234</programlisting> We consider an example text file <filename>input.txt</filename> containing four lines:</para> - <programlisting language="none" linenumbering="numbered">Roses are nice flowers. + <literallayout linenumbering="numbered">Roses are nice flowers. Red wine is tasty The red cross acts worldwide -Mayflower used to be a ship.</programlisting> +Mayflower used to be a ship.</literallayout> <para>We search this file <filename>input.txt</filename> for the occurrence of the string <quote>flower</quote> being contained in lines 1 and 4:</para> - <programlisting language="none">> grep <emphasis role="bold">flower</emphasis> input.txt + <screen>> grep <emphasis role="bold">flower</emphasis> input.txt Roses are nice <emphasis role="bold">flower</emphasis>s. -May<emphasis role="bold">flower</emphasis> used to be a ship.</programlisting> +May<emphasis role="bold">flower</emphasis> used to be a ship.</screen> <para>Thus the <command xlink:href="http://linux.die.net/man/1/grep">grep</command> command @@ -575,10 +576,10 @@ May<emphasis role="bold">flower</emphasis> used to be a ship.</programlisting> output. Adding the command line option <option>-i</option> allows for case insensitive searches:</para> - <programlisting language="none" linenumbering="unnumbered">> grep <option>-i</option> <emphasis + <screen linenumbering="unnumbered">> grep <option>-i</option> <emphasis role="bold">red</emphasis> input.txt <emphasis role="bold">Red</emphasis> wine is tasty -The <emphasis role="bold">red</emphasis> cross acts worldwide</programlisting> +The <emphasis role="bold">red</emphasis> cross acts worldwide</screen> <para>This time all possible variants like <quote>Red</quote>, <quote>red</quote>, <quote>RED</quote> and so on will match.</para> @@ -588,30 +589,29 @@ The <emphasis role="bold">red</emphasis> cross acts worldwide</programlisting> for searching multiple files. Consider a second file <filename>inputSecond.txt</filename>:</para> - <programlisting language="none" linenumbering="numbered">Errors will show up in red. -Let's start bug fixing</programlisting> + <screen linenumbering="numbered">Errors will show up in red. +Let's start bug fixing</screen> <para>We may search for case insensitive (<option>-i</option> again) appearances of <quote>red</quote> within both files:</para> - <programlisting language="none" linenumbering="unnumbered">> grep -i <emphasis - role="bold">red</emphasis> input.txt inputSecond.txt + <screen linenumbering="unnumbered">> grep -i <emphasis role="bold">red</emphasis> input.txt inputSecond.txt input.txt:<emphasis role="bold">Red</emphasis> wine is tasty input.txt:The <emphasis role="bold">red</emphasis> cross acts worldwide -inputSecond.txt:Errors will show up in <emphasis role="bold">red</emphasis>.</programlisting> +inputSecond.txt:Errors will show up in <emphasis role="bold">red</emphasis>.</screen> <para>Finally the <option>-l</option> option will filter individual appearances just showing filenames containing matches:</para> - <programlisting language="none">> grep -l Red input.txt inputSecond.txt -input.txt</programlisting> + <screen>> grep -l Red input.txt inputSecond.txt +input.txt</screen> <para>In contrast a case insensitive search combining both <option>-i</option> and <option>-l</option> options yields:</para> - <programlisting language="none">> grep -i -l Red input.txt inputSecond.txt + <screen>> grep -i -l Red input.txt inputSecond.txt input.txt -inputSecond.txt</programlisting> +inputSecond.txt</screen> <para>The <command xlink:href="http://linux.die.net/man/1/grep">grep</command> command may @@ -622,13 +622,13 @@ inputSecond.txt</programlisting> the <link xlink:href="http://linux.die.net/man/1/find">find</link> command:</para> - <programlisting language="none">> find . -name \*.html + <screen>> find . -name \*.html ./Sd1/Wc/wc/Testdata/input.html ./Sda1/rdbmsXml2Html/TestData/climbingprice.html ./Sda1/NoCast/src/main/resources/gallery.html ./Sda1/Jdom/Html2Html/src/main/resources/imageExampleNew.html ./Sda1/Jdom/Html2Html/src/main/resources/imageExample.html -./Sda1/VerifyImgAccess/fileextref.html</programlisting> +./Sda1/VerifyImgAccess/fileextref.html</screen> <para>We want to restrict the above list to pathnames containing the string <quote>Example</quote>. This may be achieved by <link @@ -640,9 +640,9 @@ inputSecond.txt</programlisting> both processes get connected by means of the pipe symbol <quote>|</quote>:</para> - <programlisting language="none">> find . -name \*.html|grep Example + <screen>> find . -name \*.html|grep Example ./Sda1/Jdom/Html2Html/src/main/resources/imageExampleNew.html -./Sda1/Jdom/Html2Html/src/main/resources/imageExample.html</programlisting> +./Sda1/Jdom/Html2Html/src/main/resources/imageExample.html</screen> <tip> <orderedlist> @@ -696,7 +696,7 @@ inputSecond.txt</programlisting> <filename>~/.m2/repository/de/hdm-stuttgart/mi/sd1/grep/0.9/grep-0.9.jar</filename> with <quote>~</quote> denoting your home directory:</para> - <programlisting language="none">> mvn install + <screen>> mvn install [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ @@ -718,16 +718,16 @@ Tests run: 5, Failures: 0, Errors: 0, Skipped: 0 [INFO] Installing /home/goik/workspace/sd-project-summer/grep/target/grep-0.9.jar to /home/goik/.m2/repository/de/hdm-stuttgart/mi/sd1/grep/0.9/grep-0.9.jar ... -</programlisting> +</screen> <para>Due to our <code><Main-Class>de.hdm_stuttgart.mi.sd1.grep.Grep</Main-Class></code> declaration in <filename>pom.xml</filename> this jar file is executable:</para> - <programlisting language="none">> java -jar ~/.m2/repository/de/hdm-stuttgart/mi/sd1/grep/0.9/grep-0.9.jar + <screen>> java -jar ~/.m2/repository/de/hdm-stuttgart/mi/sd1/grep/0.9/grep-0.9.jar No search string given -Usage: grep [-i] [-l] searchString [file 1] [file 2] ...</programlisting> +Usage: grep [-i] [-l] searchString [file 1] [file 2] ...</screen> <para>There are further simplification steps:</para> @@ -738,10 +738,10 @@ Usage: grep [-i] [-l] searchString [file 1] [file 2] ...</programlisting> allows for omitting the <command>java</command> command:</para> - <programlisting language="none">> chmod +x ~/.m2/repository/de/hdm-stuttgart/mi/sd1/grep/0.9/grep-0.9.jar -> ~/.m2/repository/de/hdm-stuttgart/mi/sd1/grep/0.9/grep-0.9.jar + <screen>> <command>chmod</command> <option>+x</option> <filename>~/.m2/repository/de/hdm-stuttgart/mi/sd1/grep/0.9/grep-0.9.jar</filename> +> <filename>~/.m2/repository/de/hdm-stuttgart/mi/sd1/grep/0.9/grep-0.9.jar</filename> No search string given -Usage: grep [-i] [-l] searchString [file 1] [file 2] ...</programlisting> +Usage: grep [-i] [-l] searchString [file 1] [file 2] ...</screen> <para>Notice <quote>~</quote> representing a user's home directory.</para> @@ -751,13 +751,13 @@ Usage: grep [-i] [-l] searchString [file 1] [file 2] ...</programlisting> <para>We may copy the jar archive to a standard location containing executable commands:</para> - <programlisting language="none">> mkdir ~/bin + <screen>> <command>mkdir</command> <filename>~/bin</filename> > -> cp ~/.m2/repository/de/hdm-stuttgart/mi/sd1/grep/0.9/grep-0.9.jar ~/bin/jgrep +> <command>cp</command> <filename>~/.m2/repository/de/hdm-stuttgart/mi/sd1/grep/0.9/grep-0.9.jar</filename> <filename>~/bin/jgrep</filename> > -> ~/bin/jgrep +> <command>~/bin/jgrep</command> No search string given -Usage: grep [-i] [-l] searchString [file 1] [file 2] ...</programlisting> +Usage: grep [-i] [-l] searchString [file 1] [file 2] ...</screen> </listitem> <listitem> @@ -769,21 +769,21 @@ Usage: grep [-i] [-l] searchString [file 1] [file 2] ...</programlisting> using a text editor. <filename>~/.profile</filename> should contain:</para> - <programlisting language="none">PATH="$HOME/bin:$PATH"</programlisting> + <screen>PATH="$HOME/bin:$PATH"</screen> <para>After logging out and on again your PATH environment variable should contain your <filename>~/bin</filename> component:</para> - <programlisting language="none">> echo $PATH -<emphasis role="bold">/home/goik/bin</emphasis>:/usr/local/sbin:/usr/local/bin:/usr/...</programlisting> + <screen>> <command>echo</command> <envar>$PATH</envar> +<emphasis role="bold">/home/goik/bin</emphasis>:/usr/local/sbin:/usr/local/bin:/usr/...</screen> <para>You should now be able to call <command>jgrep</command> from arbitrary filesystem locations:</para> - <programlisting language="none">> cd Desktop/ + <screen>> cd Desktop/ > cat Testdata/input.txt | ./bin/mygrep red -The red cross acts worldwide</programlisting> +The red cross acts worldwide</screen> </listitem> </orderedlist> </listitem> @@ -872,8 +872,8 @@ public class AppTest { </listitem> <listitem> - <para>Using this set of pregenerated prime numbers for decomposing - arbitrary <code>int</code> values into prime factors e.g.:</para> + <para>Using this set of prime numbers for decomposing arbitrary + <code>int</code> values into prime factors e.g.:</para> <para>1050 = 2 * 3 * 5 * 5 * 7</para> </listitem> @@ -893,9 +893,9 @@ public class AppTest { (t)</code> and leaving al prime index values at <code>false (f)</code>:</para> - <programlisting language="non">Index | 0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14 ... + <screen>Index | 0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14 ... ------+--+--+--+--+--+--+--+--+--+--+---+---+---+---+--- ... -value | t| t| f| f| t| f| t| f| t| t| t| f| t| f| t ...</programlisting> +value | t| t| f| f| t| f| t| f| t| t| t| f| t| f| t ...</screen> <para>Since we intend to deal with a large number <code xlink:href="https://docs.oracle.com/javase/8/docs/api/java/lang/Integer.html#MAX_VALUE">Integer.MAX_VALUE</code> @@ -903,11 +903,11 @@ value | t| t| f| f| t| f| t| f| t| t| t| f| t| f| t ...</programlisting> numbers are never prime except for the value 2. Thus 0 will represent 1, 1 will represent 3 and n will represent 2 * n + 1:</para> - <programlisting language="non">Index | 0| 1| 2| 3| 4| 5| 6| 7| ... + <screen>Index | 0| 1| 2| 3| 4| 5| 6| 7| ... -----------+--+--+--+--+--+---+---+---+ ... represents | 1| 3| 5| 7| 9| 11| 13| 15| ... -----------+--+--+--+--+--+---+---+---+ ... -value | t| f| f| f| t| f| f| t| ...</programlisting> +value | t| f| f| f| t| f| f| t| ...</screen> <para>This requires a boolean array of just <code xlink:href="https://docs.oracle.com/javase/8/docs/api/java/lang/Integer.html#MAX_VALUE">Integer.MAX_VALUE @@ -1187,18 +1187,18 @@ public class FactorTest { <para>This yields the following output:</para> - <programlisting language="none">Value 2147483647 is prime. + <screen>Value 2147483647 is prime. Value 2147483646 is not prime. Value 2147483645 is not prime. -2147483646 = 2 * 3 * 3 * 7 * 11 * 31 * 151 * 331</programlisting> +2147483646 = 2 * 3 * 3 * 7 * 11 * 31 * 151 * 331</screen> <para>Depending on your implementation you may encounter the following heap memory related error:</para> - <programlisting language="none">Exception in thread "main" java.lang.OutOfMemoryError: Java heap space + <screen>Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at de.hdm_stuttgart.mi.prim.sieve.Sieve.initSieve(Sieve.java:75) at de.hdm_stuttgart.mi.prim.sieve.Sieve.<init>(Sieve.java:60) - at de.hdm_stuttgart.mi.prim.Driver.main(Driver.java:19)</programlisting> + at de.hdm_stuttgart.mi.prim.Driver.main(Driver.java:19)</screen> <para>The <xref linkend="glo_Java"/> virtual machine by default may not provide enough heap space. You may enlarge the default allocation by diff --git a/Doc/Sd1/arrays.xml b/Doc/Sd1/arrays.xml index 07222a31d..bb0e2c0bb 100644 --- a/Doc/Sd1/arrays.xml +++ b/Doc/Sd1/arrays.xml @@ -4,6 +4,7 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" + xmlns:ns="http://docbook.org/ns/transclusion" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook"> @@ -406,13 +407,13 @@ <para>The corresponding terminal output will read:</para> - <programlisting language="none">Mark|frequency + <screen>Mark|frequency ----+--------- 1|3 2|4 3|6 4|3 - 5|2</programlisting> + 5|2</screen> <para>Define a suitable static method and provide appropriate unit tests.</para> @@ -550,51 +551,51 @@ <col width="7%"/> <tr> - <td><programlisting language="none">xxx + <td><screen>xxx ... -...</programlisting></td> +...</screen></td> <td/> - <td><programlisting language="none">... + <td><screen>... xxx -...</programlisting></td> +...</screen></td> <td/> - <td><programlisting language="none">... + <td><screen>... ... -xxx</programlisting></td> +xxx</screen></td> <td/> - <td><programlisting language="none">x.. + <td><screen>x.. x.. -x..</programlisting></td> +x..</screen></td> <td/> - <td><programlisting language="none">.x. + <td><screen>.x. .x. -.x.</programlisting></td> +.x.</screen></td> <td/> - <td><programlisting language="none">..x + <td><screen>..x ..x -..x</programlisting></td> +..x</screen></td> <td/> - <td><programlisting language="none">x.. + <td><screen>x.. .x. -..x</programlisting></td> +..x</screen></td> <td/> - <td><programlisting language="none">..x + <td><screen>..x .x. -x..</programlisting></td> +x..</screen></td> </tr> </informaltable> </question> @@ -697,7 +698,7 @@ x..</programlisting></td> <para>This allows for console execution rather than using Eclipse:</para> - <programlisting language="none">goik@mi-ESPRIMO-P910 V1> mvn install + <screen>goik@mi-ESPRIMO-P910 V1> mvn install [INFO] Scanning for projects... ... ------------------------------------------------------- @@ -724,14 +725,14 @@ Tests run: 2, Failures: 0, Errors: 0, Skipped: 0 [INFO] Finished at: Wed Sep 23 12:54:34 CEST 2015 [INFO] Final Memory: 18M/196M [INFO] ------------------------------------------------------------------------ -</programlisting> +</screen> <para>As you can see this creates <filename>/ma/goik/.m2/repository/de/hdm-stuttgart/mi/sd1/tictactoe/0.9/tictactoe-0.9.jar</filename>. This may be executed similar to a <quote>true</quote> binary executable:</para> - <programlisting language="none">goik@mi-ESPRIMO-P910 ~> java -jar /ma/goik/.m2/.../tictactoe-0.9.jar + <screen>goik@mi-ESPRIMO-P910 ~> java -jar /ma/goik/.m2/.../tictactoe-0.9.jar Numbering scheme: 0|1|2 @@ -740,7 +741,7 @@ Numbering scheme: -+-+- 6|7|8 -Jim, please enter next field's number:</programlisting> +Jim, please enter next field's number:</screen> </answer> </qandaentry> </qandadiv> @@ -771,15 +772,15 @@ Jim, please enter next field's number:</programlisting> <informaltable border="1"> <tr> - <td><programlisting language="none">012 + <td><screen>012 345 -678</programlisting></td> +678</screen></td> <td>⇒</td> - <td><programlisting language="none">123 + <td><screen>123 456 -789</programlisting></td> +789</screen></td> </tr> </informaltable> </listitem> @@ -788,7 +789,7 @@ Jim, please enter next field's number:</programlisting> <para>The two players should have a choice about who is to start a game:</para> - <programlisting language="none">Numbering scheme: + <screen>Numbering scheme: 1|2|3 -+-+- @@ -801,7 +802,7 @@ Who is going to start? 0 = June, other = Bill 0 -June, please enter next field's number:</programlisting> +June, please enter next field's number:</screen> </listitem> <listitem> @@ -812,7 +813,7 @@ June, please enter next field's number:</programlisting> example this restriction excludes position <quote>4</quote>:</para> - <programlisting language="none">Player June(O) + <screen>Player June(O) vs. Bill(X) Free fields | | 1|2|3 @@ -821,7 +822,7 @@ O| | |5|6 -+-+- -+-+- | | 7|8|9 -Bill, please enter next field's number:</programlisting> +Bill, please enter next field's number:</screen> </listitem> </orderedlist> </glossdef> @@ -948,20 +949,20 @@ public class Driver { <para>The result might look like:</para> - <programlisting language="none">How many values do you want to summ up? 4 + <screen>How many values do you want to summ up? 4 Enter value #1 of 4: 11 Enter value #2 of 4: 22 Enter value #3 of 4: -33 Enter value #4 of 4: 1 -Sum=1</programlisting> +Sum=1</screen> <para>Modify this program to output not just the desired sum but the complete arithmetic expression:</para> - <programlisting language="none">How many values do you want to summ up? 4 + <screen>How many values do you want to summ up? 4 Enter value #1 of 4: 1 ... -<emphasis role="bold">1+2+3-5 = 1</emphasis></programlisting> +<emphasis role="bold">1+2+3-5 = 1</emphasis></screen> <para>Hints:</para> @@ -1334,7 +1335,7 @@ System.out.println(3 * b);</programlisting> <para>This yields:</para> - <programlisting language="none">0.9999999999999998</programlisting> + <screen>0.9999999999999998</screen> <para>Thus <code>assertEquals(1., b)</code> will fail due to limited arithmetic precision. <xref linkend="glo_Junit"/> provides @@ -1548,7 +1549,7 @@ public void testApp() { method allows to estimate the prime number computing performance:</para> - <programlisting language="none">Found 664579 prime numbers within 15.136 seconds.</programlisting> + <screen>Found 664579 prime numbers within 15.136 seconds.</screen> </listitem> </orderedlist> </answer> @@ -1570,7 +1571,7 @@ public void testApp() { lot computing power. Consider testing candidate value 143. Currently our implementation works like:</para> - <programlisting language="none">143 % 2 == 0 ? No. + <screen>143 % 2 == 0 ? No. 143 % 3 == 0 ? No. 143 % 4 == 0 ? No. 143 % 5 == 0 ? No. @@ -1579,7 +1580,7 @@ public void testApp() { 143 % 8 == 0 ? No. 143 % 9 == 0 ? No. 143 % 10 == 0 ? No. -143 % 11 == 0 ? Yes ==> 143 is not prime</programlisting> +143 % 11 == 0 ? Yes ==> 143 is not prime</screen> <para>Learning from <link xlink:href="https://en.wikipedia.org/wiki/Prime_factor">prime @@ -1587,11 +1588,11 @@ public void testApp() { values rather than all integer values up to the already discussed square root limit:</para> - <programlisting language="none">143 % 2 == 0 ? No. + <screen>143 % 2 == 0 ? No. 143 % 3 == 0 ? No. 143 % 5 == 0 ? No. 143 % 7 == 0 ? No. -143 % 11 == 0 ? Yes ==> 143 is not prime</programlisting> +143 % 11 == 0 ? Yes ==> 143 is not prime</screen> <para>Thus we may save a lot of operations. The trade off is even bigger for higher prime number values. This requires @@ -1631,7 +1632,7 @@ public void testApp() { <para>We save ~80% of execution time:</para> - <programlisting language="none">Found 664579 prime numbers within 2.641 seconds.</programlisting> + <screen>Found 664579 prime numbers within 2.641 seconds.</screen> <para>So the current implementation indeed adds a substantial benefit with respect to performance.</para> @@ -1661,11 +1662,11 @@ public void testApp() { current implementation lacks ordering of input values. Consider the following sample of values:</para> - <programlisting language="none">2, 7, 0, -3, 4</programlisting> + <screen>2, 7, 0, -3, 4</screen> <para>Obtaining the median requires ordering these values:</para> - <programlisting language="none">-3, 0, 2, 4, 7</programlisting> + <screen>-3, 0, 2, 4, 7</screen> <para>Thus the given sample's median is 2. Solve this exercise in the following order:</para> @@ -1769,11 +1770,11 @@ store.addValue(3);</programlisting> right thus creating a free (denoted by <quote>F</quote>) insert position:</para> - <programlisting language="none">Index values | 0| 1| 2| 3| 4| 5| ... + <screen>Index values | 0| 1| 2| 3| 4| 5| ... -----------------+--+--+--+--+-----+ ... values oldArray | 1| 2| 7| 9| | | -----------------+--+--+--+--+-----+ ... -values newArray | 1| 2| F| 7| 9| | ...</programlisting> +values newArray | 1| 2| F| 7| 9| | ...</screen> <para>You may now insert your latest value 3 at the free index position 2 ending up with a well sorted array (1, 2, @@ -1835,7 +1836,7 @@ values newArray | 1| 2| F| 7| 9| | ...</programlisting> values. Then compute both their average and median like:</para> - <programlisting language="none">How big is your sample? 5 + <screen>How big is your sample? 5 Enter value #1 of 5: 1 Enter value #2 of 5: -2 @@ -1844,7 +1845,7 @@ Enter value #4 of 5: 5 Enter value #5 of 5: 2 Your sample's average is: 1.4 -Your sample's median is: 1.0</programlisting> +Your sample's median is: 1.0</screen> </listitem> </orderedlist> </question> @@ -1936,11 +1937,11 @@ store.addValue(3);</programlisting> right thus creating a free (denoted by <quote>F</quote>) insert position:</para> - <programlisting language="none">Index values | 0| 1| 2| 3| 4| 5| ... + <screen>Index values | 0| 1| 2| 3| 4| 5| ... -----------------+--+--+--+--+-----+ ... values oldArray | 1| 2| 7| 9| | | -----------------+--+--+--+--+-----+ ... -values newArray | 1| 2| F| 7| 9| | ...</programlisting> +values newArray | 1| 2| F| 7| 9| | ...</screen> <para>You may now insert your latest value 3 at the free index position 2 ending up with a well sorted array (1, 2, @@ -2039,7 +2040,7 @@ values newArray | 1| 2| F| 7| 9| | ...</programlisting> <para>Implement a class to plot e.g. <code>sin(x)</code> or other functions in a terminal like e.g.:</para> - <programlisting language="none"> ****** + <screen> ****** ** ** * ** * * @@ -2078,7 +2079,7 @@ values newArray | 1| 2| F| 7| 9| | ...</programlisting> * * ** * ** ** - ******</programlisting> + ******</screen> </question> <answer> diff --git a/Doc/Sd1/collections.xml b/Doc/Sd1/collections.xml index cdcbe8225..0f6a12885 100644 --- a/Doc/Sd1/collections.xml +++ b/Doc/Sd1/collections.xml @@ -4,6 +4,7 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" + xmlns:ns="http://docbook.org/ns/transclusion" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook"> @@ -135,10 +136,10 @@ collection does have set semantics it only contains three elements {"Eve", "Jim", "Tom"}:</para> - <programlisting language="none">The set contains 3 elements: + <screen>The set contains 3 elements: Tom Jim -Eve</programlisting> +Eve</screen> </answer> </qandaentry> </qandadiv> @@ -199,11 +200,11 @@ Eve</programlisting> <para>This time the duplicate actually shows up:</para> - <programlisting language="none">The list contains 4 elements: + <screen>The list contains 4 elements: Eve Jim Tom -Jim</programlisting> +Jim</screen> </answer> </qandaentry> </qandadiv> @@ -251,11 +252,11 @@ Jim</programlisting> <para>This should yield the expected output:</para> - <programlisting language="none">c12:(1|2) + <screen>c12:(1|2) c12.equals(c52):false c12.equals(c12Duplicate):true c12.equals("dummy"):false -(1|2)</programlisting> +(1|2)</screen> </question> <answer> @@ -351,10 +352,10 @@ c12.equals("dummy"):false (1|2)}</code>. We however see the duplicate object appearing on standard output:</para> - <programlisting language="none">The set contains 3 elements: + <screen>The set contains 3 elements: (4|1) (1|2) -(1|2)</programlisting> +(1|2)</screen> <para>This is due to our own fault not providing a <methodname xlink:href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--">hashCode()</methodname> @@ -371,7 +372,7 @@ c12.equals("dummy"):false <para>This yields the following output:</para> - <programlisting language="none">c12.hashCode() and c12Duplicate.hashCode():1334574952,1882008996</programlisting> + <screen>c12.hashCode() and c12Duplicate.hashCode():1334574952,1882008996</screen> <para>Apparently the two instances c12 and c12Duplicate are equal to each other. Their hash codes however are different @@ -411,13 +412,13 @@ c12.equals("dummy"):false <para>This yields:</para> - <programlisting language="none">c12.hashCode() and c12Duplicate.hashCode():33,33</programlisting> + <screen>c12.hashCode() and c12Duplicate.hashCode():33,33</screen> <para>And finally:</para> - <programlisting language="none">The set contains 2 elements: + <screen>The set contains 2 elements: (1|2) -(4|1)</programlisting> +(4|1)</screen> </answer> </qandaentry> </qandadiv> @@ -442,13 +443,13 @@ c12.equals("dummy"):false <para>Consider a text file <filename>foo.txt</filename> containing:</para> - <programlisting language="none">A simple collection of words. - Some words may appear multiple times.</programlisting> + <screen>A simple collection of words. + Some words may appear multiple times.</screen> <para>We would like to retrieve a comma separated list of all words being contained within excluding duplicates.</para> - <programlisting language="none">of, multiple, collection, simple, words, may, Some, times, A, appear</programlisting> + <screen>of, multiple, collection, simple, words, may, Some, times, A, appear</screen> <para>The subsequent rules shall apply:</para> @@ -558,7 +559,7 @@ c12.equals("dummy"):false code to get the same set of words but in alphabetic order with respect to capital and small letters:</para> - <programlisting language="none">A, Some, appear, collection, may, multiple, of, simple, times, words </programlisting> + <screen>A, Some, appear, collection, may, multiple, of, simple, times, words </screen> </question> <answer> @@ -592,26 +593,26 @@ c12.equals("dummy"):false <question> <para>Strings will often be sorted alphabetically:</para> - <programlisting language="none">ant + <screen>ant apple by eye it printer van -x-ray</programlisting> +x-ray</screen> <para>In this exercise we want to sort strings by length and then alphabetically:</para> - <programlisting language="none">by + <screen>by it ant eye van apple x-ray -printer</programlisting> +printer</screen> <para>Hints:</para> @@ -674,7 +675,7 @@ public class LengthCompare implements Comparator<String> { used as primary sorting criterion with respect to report output. Consider the following example text:</para> - <programlisting language="none">One day, Einstein, Newton, and Pascal meet up + <literallayout>One day, Einstein, Newton, and Pascal meet up and decide to play a game of hide and seek. Einstein volunteered to be "It". As Einstein counted, eyes closed, to 100, Pascal ran away @@ -684,12 +685,12 @@ square on the floor around himself. When Einstein opened his eyes, he immediately saw Newton and said "I found you Newton", but Newton replied, "No, you found one Newton per square meter. -You found Pascal!"</programlisting> +You found Pascal!"</literallayout> <para>Ignoring special characters the following result shall be created:</para> - <programlisting language="none"> 6: Newton + <screen> 6: Newton 6: and 5: Einstein 3: Pascal @@ -698,7 +699,7 @@ You found Pascal!"</programlisting> 3: one 3: to 2: a -...</programlisting> +...</screen> <para>The first line tells us that the word <quote>Newton</quote> appears six times in the analyzed @@ -842,9 +843,9 @@ public class WordFrequency { <para>We want to transform address data to different destination formats. Consider the following text file data source:</para> - <programlisting language="none">"firstName","lastName","companyName","address","city", ... + <screen>"firstName","lastName","companyName","address","city", ... "Aleshia","Tomkiewicz","Alan D Rosenburg Cpa Pc","14 Tay ... -...</programlisting> +...</screen> <para>This excerpt exists as file named <filename>addresses.txt</filename> in the following Maven @@ -859,7 +860,7 @@ public class WordFrequency { <classname>de.hdm_stuttgart.mi.sd1.htmlformat.Address2text</classname> yields the following output:</para> - <programlisting language="none">"firstName","lastName","companyName","address","city", ... + <screen>"firstName","lastName","companyName","address","city", ... List of addresses: ++++++++++++++++++++++ Name:Tim Dummy @@ -872,7 +873,7 @@ E-Mail:@dummy@dummy.com ... -------------------- -End of records</programlisting> +End of records</screen> <para>This result neither uses the input data supplied by <filename>addresses.txt</filename> nor does it produce HTML output @@ -948,7 +949,7 @@ End of records</programlisting> whenever the input file contains errors. Consider the following example:</para> - <programlisting language="none">"Laquita","Hisaw,"In Communications Inc","20 Gloucester Pl #96",</programlisting> + <screen>"Laquita","Hisaw,"In Communications Inc","20 Gloucester Pl #96",</screen> <para>In this example we have no quote after <code>Hisaw</code>. This should yield a parsing @@ -984,7 +985,7 @@ End of records</programlisting> addresses.txt) of your data source from result generation:</para> - <programlisting language="none">"firstName","lastName","companyName","address","city","county","postal","phone1","phone2","email","web"</programlisting> + <screen>"firstName","lastName","companyName","address","city","county","postal","phone1","phone2","email","web"</screen> </listitem> <listitem> @@ -1349,7 +1350,7 @@ public interface Set_String { sorted set of words appearing in a text among with their respective frequencies:</para> - <programlisting language="none"> 6: Newton + <screen> 6: Newton 6: and 5: Einstein 3: Pascal @@ -1358,7 +1359,7 @@ public interface Set_String { 3: one 3: to 2: a -...</programlisting> +...</screen> <para>Achieving this result relied on implementing a helper class <classname @@ -1529,14 +1530,14 @@ public interface Set_String { examination grades ranging from level <quote>A</quote> to <quote>D</quote>:</para> - <programlisting language="none">Tim Bone, D + <screen>Tim Bone, D Eve Thunder, A Aaron King, B Joan White, B Mark Singer, C Jane Simmonds, D Ethan Clarke, C -Paula Beam, C</programlisting> +Paula Beam, C</screen> <para>Duplicate names may appear.</para> @@ -1550,11 +1551,11 @@ Paula Beam, C</programlisting> by aggregating the occurrences of marks. The current example should lead to:</para> - <programlisting language="none">Overview of marks: + <screen>Overview of marks: A: 1 B: 2 C: 3 -D: 2</programlisting> +D: 2</screen> </question> <answer> @@ -1576,11 +1577,11 @@ D: 2</programlisting> alphabetically sorted names. The current example should lead to:</para> - <programlisting language="none">Overview of marks: + <screen>Overview of marks: A: Eve Thunder B: Aaron King, Joan White C: Ethan Clarke, Mark Singer, Paula Beam -D: Jane Simmonds, Tim Bone</programlisting> +D: Jane Simmonds, Tim Bone</screen> </question> <answer> diff --git a/Doc/Sd1/coreClasses.xml b/Doc/Sd1/coreClasses.xml index 7372a16c5..cbc21c705 100644 --- a/Doc/Sd1/coreClasses.xml +++ b/Doc/Sd1/coreClasses.xml @@ -90,7 +90,7 @@ <para>This generates the following output:</para> - <programlisting language="none">v=33, d=114.32, color=ff</programlisting> + <screen>v=33, d=114.32, color=ff</screen> <para>We may prettify our code to better reflect the one to one correspondence between format strings and variables:</para> @@ -107,9 +107,9 @@ // rather than %f. v, d, color);</programlisting> - <programlisting language="none">v=33, d=Exception in thread "main" + <screen>v=33, d=Exception in thread "main" java.util.IllegalFormatConversionException: <emphasis role="bold">d != java.lang.Double</emphasis> - at java.util.Formatter$FormatSpecifier.failConversion(...</programlisting> + at java.util.Formatter$FormatSpecifier.failConversion(...</screen> </caution> </answer> </qandaentry> @@ -348,7 +348,7 @@ public class CircleAreaCalculator { <para>Consider the following string (excluding the comment):</para> - <programlisting language="none">73167176531330624919225119674426574742355349194934 + <screen>73167176531330624919225119674426574742355349194934 96983520312774506326239578318016984801869478851843 85861560789112949495459501737958331952853208805511 12540698747158523863050715693290963295227443043557 @@ -368,7 +368,7 @@ public class CircleAreaCalculator { 07198403850962455444362981230987879927244284909188 84580156166097919133875499200524063689912560717606 05886116467109405077541002256983155200055935729725 -71636269561882670428252483600823257530420752963450</programlisting> +71636269561882670428252483600823257530420752963450</screen> <para>The above sequence is meant to form a single string which has just been arranged in lines for convenience reasons.</para> @@ -460,14 +460,14 @@ public class CircleAreaCalculator { <para>This creates the following output:</para> - <programlisting language="none">7316717653133 + <screen>7316717653133 3167176531330 1671765313306 ... 5304207529634 3042075296345 -0420752963450</programlisting> +0420752963450</screen> <para>The method <methodname xlink:href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html#charAt-int-">charAt(int @@ -586,7 +586,7 @@ public class CircleAreaCalculator { digits in the fourth definition line of <code>String input = ...</code>.</para> - <programlisting language="none">The substring '5576689664895' yields the largest product value 23514624000.</programlisting> + <screen>The substring '5576689664895' yields the largest product value 23514624000.</screen> </answer> </qandaentry> </qandadiv> @@ -678,7 +678,7 @@ b1.equals(b2): true </programlisting> <programlisting language="java">System.out.println("Hashcode a1 == " + System.identityHashCode(a1) + ", Hashcode a2 == " + System.identityHashCode(a2));</programlisting> - <programlisting language="none">Hashcode a1 == 366712642, Hashcode a2 == 366712642</programlisting> + <screen>Hashcode a1 == 366712642, Hashcode a2 == 366712642</screen> <para>So <code>a1</code> and <code>a2</code> indeed point to the same object resulting in true when using the <methodname @@ -702,7 +702,7 @@ b1.equals(b2): true </programlisting> <para>This yields different values corresponding to two different objects:</para> - <programlisting language="none">Hashcode b1 == 1829164700, Hashcode b2 == 2018699554</programlisting> + <screen>Hashcode b1 == 1829164700, Hashcode b2 == 2018699554</screen> <para>Comparing these two reference values for equality the <quote>==</quote> operator thus returns @@ -788,8 +788,8 @@ b1.equals(b2): true </programlisting> <para>Having <code>name = "An" + "ton"</code> in place we get:</para> - <programlisting language="none">Content:Anton -<emphasis role="bold">Instances are equal</emphasis></programlisting> + <screen>Content:Anton +<emphasis role="bold">Instances are equal</emphasis></screen> <para>The Java compiler performs a clever optimization: The expression <code>"An" + "ton"</code> is being evaluated at compile @@ -811,8 +811,8 @@ b1.equals(b2): true </programlisting> <para>When starting from <code>name = "An".concat("ton")</code> the result is different:</para> - <programlisting language="none">Content:Anton -<emphasis role="bold">Instances are not equal</emphasis></programlisting> + <screen>Content:Anton +<emphasis role="bold">Instances are not equal</emphasis></screen> <para>This time the Java compiler is unable to dynamically resolve the expression <code>"An".concat("ton")</code> at compile time. @@ -875,7 +875,7 @@ b1.equals(b2): true </programlisting> <tr> <td>Path</td> - <td><programlisting language="none">\Users\student\Desktop\Downloads</programlisting></td> + <td><filename>\Users\student\Desktop\Downloads</filename></td> </tr> <tr> @@ -960,11 +960,11 @@ b1.equals(b2): true </programlisting> <para>On a Windows system the following output is being expected:</para> - <programlisting language="none">Filename is relative? false + <screen>Filename is relative? false Drive letter:C Directory path: \users\heinz\Desktop File basename: index -File extension: html</programlisting> +File extension: html</screen> <para>Due to the possible presence of drive letters Windows pathnames are more difficult to parse. We illustrate a possible @@ -1077,7 +1077,7 @@ File extension: html</programlisting> being part of a <xref linkend="glo_Java"/> String literal:</para> - <programlisting language="none"> String path = "C:\\programms\\openvpn\\conf\\hdm.ovpn";</programlisting> + <screen> String path = "C:\\programms\\openvpn\\conf\\hdm.ovpn";</screen> </listitem> <listitem> diff --git a/Doc/Sd1/deployment.xml b/Doc/Sd1/deployment.xml index 4565588be..e9b81ef00 100644 --- a/Doc/Sd1/deployment.xml +++ b/Doc/Sd1/deployment.xml @@ -4,6 +4,7 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" + xmlns:ns="http://docbook.org/ns/transclusion" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook"> @@ -153,9 +154,9 @@ public class ArrayMethodTest { by adding a command line interface. Consider the following console execution:</para> - <programlisting language="none">goik >java -jar statistics-1.0.jar 2 6 7 + <screen>goik >java -jar statistics-1.0.jar 2 6 7 Your sample's average is: 5.0 -Your sample's median is: 6.0</programlisting> +Your sample's median is: 6.0</screen> <para>The above example executes our Java program in a shell and supplies three command line parameters 2, 6 and 7. The program @@ -181,16 +182,16 @@ Your sample's median is: 6.0</programlisting> application thereby providing a meaningful error message:</para> - <programlisting language="none">goik >java -jar statistics-1.0.jar 1 2 three -Input string 'three' does not represent an integer value</programlisting> + <screen>goik >java -jar statistics-1.0.jar 1 2 three +Input string 'three' does not represent an integer value</screen> </listitem> <listitem> <para>If the user does not provide any input at all our program shall terminate as well:</para> - <programlisting language="none">goik >java -jar statistics-1.0.jar -No values provided</programlisting> + <screen>goik >java -jar statistics-1.0.jar +No values provided</screen> </listitem> <listitem> diff --git a/Doc/Sd1/gettingStarted.xml b/Doc/Sd1/gettingStarted.xml index 3eb908bc3..f170e3d91 100644 --- a/Doc/Sd1/gettingStarted.xml +++ b/Doc/Sd1/gettingStarted.xml @@ -4,6 +4,7 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" + xmlns:ns="http://docbook.org/ns/transclusion" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook"> @@ -492,7 +493,7 @@ <para>Execute this example. You should see the following output in Eclipse's console window:</para> - <programlisting language="none">Hello, World ...</programlisting> + <screen>Hello, World ...</screen> <para>Extend the above example to produce a whole paragraph of sentences rather than just a single line.</para> @@ -592,7 +593,7 @@ only on values of the two variables a and b being set in lines 3 and 4:</para> - <programlisting language="none">4+7=11</programlisting> + <screen>4+7=11</screen> <para>In other words: Your code shall resemble:</para> @@ -670,11 +671,11 @@ System.out.println(...);</programlisting> to a value of 3 retaining the same number of output lines:</para> - <programlisting language="none">loop # 0 + <screen>loop # 0 loop # 3 loop # 6 loop # 9 -loop # 12</programlisting> +loop # 12</screen> </listitem> </orderedlist> </question> @@ -792,15 +793,15 @@ loop # 12</programlisting> <para>Test your configuration by creating a dummy project using the command line (copy and paste to a shell window):</para> - <programlisting language="bash">mvn -e archetype:generate \ + <screen>mvn -e archetype:generate \ -DinteractiveMode=false \ -DgroupId=de.hdm_stuttgart.mi.sd1 \ -DartifactId=gettingstarted -Dversion=0.9 -DarchetypeGroupId=de.hdm-stuttgart.mi \ --DarchetypeArtifactId=mi-maven-archetype-quickstart -DarchetypeVersion=1.1</programlisting> +-DarchetypeArtifactId=mi-maven-archetype-quickstart -DarchetypeVersion=1.1</screen> <para>This should result in the following output:</para> - <programlisting language="bash">goik@hopc tmp> mvn -DinteractiveMode=false \ + <screen>goik@hopc tmp> mvn -DinteractiveMode=false \ -DgroupId=de.hdm_stuttgart.mi.sd1 \ -DartifactId=gettingstarted -Dversion=1.0 -DarchetypeGroupId=de.hdm-stuttgart.mi \ -DarchetypeArtifactId=mi-maven-archetype-quickstart -DarchetypeVersion=1.1 \ @@ -820,7 +821,7 @@ org.apache.maven.plugins:maven-archetype-plugin:RELEASE:generate [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.380 s [INFO] Finished at: 2017-06-02T12:49:05+02:00 -[INFO] Final Memory: 16M/164M</programlisting> +[INFO] Final Memory: 16M/164M</screen> <para>This creates a dummy project folder named <filename>gettingstarted</filename>.</para> @@ -833,7 +834,7 @@ org.apache.maven.plugins:maven-archetype-plugin:RELEASE:generate <xref linkend="glo_IDE"/>. We provide some explanation details regarding the above command:</para> - <programlisting language="none"><command>mvn</command> -e archetype:generate <co + <screen><command>mvn</command> -e archetype:generate <co linkends="sd1CalloutMavenCmdLine-1" xml:id="sd1CalloutMavenCmdLine-1-co"/> \ -DarchetypeGroupId=de.hdm-stuttgart.mi -DarchetypeArtifactId=mi-maven-archetype-quickstart <co @@ -846,7 +847,7 @@ org.apache.maven.plugins:maven-archetype-plugin:RELEASE:generate -Dversion=0.9 <co linkends="sd1CalloutMavenCmdLine-6" xml:id="sd1CalloutMavenCmdLine-6-co"/> \ -DinteractiveMode=false <co linkends="sd1CalloutMavenCmdLine-7" - xml:id="sd1CalloutMavenCmdLine-7-co"/></programlisting> + xml:id="sd1CalloutMavenCmdLine-7-co"/></screen> <calloutlist> <callout arearefs="sd1CalloutMavenCmdLine-1-co" @@ -889,7 +890,7 @@ org.apache.maven.plugins:maven-archetype-plugin:RELEASE:generate <glossterm><command>mvn</command> <option>compile</option></glossterm> <glossdef> - <programlisting language="none">goik@mi-ESPRIMO-P910 gettingstarted> mvn compile + <screen>goik@mi-ESPRIMO-P910 gettingstarted> mvn compile [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ @@ -906,7 +907,7 @@ org.apache.maven.plugins:maven-archetype-plugin:RELEASE:generate [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.552s -[INFO] Finished at: Sun Apr 10 20:01:01 CEST 2016</programlisting> +[INFO] Finished at: Sun Apr 10 20:01:01 CEST 2016</screen> </glossdef> </glossentry> @@ -914,7 +915,7 @@ org.apache.maven.plugins:maven-archetype-plugin:RELEASE:generate <glossterm><command>mvn</command> <option>test</option></glossterm> <glossdef> - <programlisting language="none">goik@mi-ESPRIMO-P910 gettingstarted> mvn test + <screen>goik@mi-ESPRIMO-P910 gettingstarted> mvn test [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ ... @@ -932,7 +933,7 @@ Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS -[INFO] ------------------------------------------------------------------------</programlisting> +[INFO] ------------------------------------------------------------------------</screen> </glossdef> </glossentry> @@ -941,13 +942,13 @@ Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 <option>install</option></glossterm> <glossdef> - <programlisting language="none">goik@mi-ESPRIMO-P910 gettingstarted> mvn install + <screen>goik@mi-ESPRIMO-P910 gettingstarted> mvn install [INFO] Scanning for projects... ... [INFO] [INFO] --- maven-install-plugin:2.3:install (default-install) @ gettingstarted --- [INFO] Installing ../target/<filename>gettingstarted-0.9.jar</filename> to - /ma/goik/.m2/repository/my/base/url/gettingstarted/0.9/gettingstarted-0.9.jar</programlisting> + /ma/goik/.m2/repository/my/base/url/gettingstarted/0.9/gettingstarted-0.9.jar</screen> <para>Notice the installation of <filename>gettingstarted-0.9.jar</filename> to the user's local @@ -966,12 +967,12 @@ Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 jar archive</link>. The <command>java</command> command allows for execution:</para> - <programlisting language="bash">java -jar target/gettingstarted-0.9.jar + <screen>java -jar target/gettingstarted-0.9.jar Hello World! 2017-06-02 16:06:14,901 DEBUG [main] sd1.App (App.java:21) - With respect to logging you may want to configure file 2017-06-02 16:06:14,903 DEBUG [main] sd1.App (App.java:22) - 'src/main/resources/log4j2.xml' to suit your needs. 2017-06-02 16:06:14,903 DEBUG [main] sd1.App (App.java:23) - This config file 'log4j2.xml' will result in 'A1.log' -2017-06-02 16:06:14,903 DEBUG [main] sd1.App (App.java:24) - file containing logging output as well.</programlisting> +2017-06-02 16:06:14,903 DEBUG [main] sd1.App (App.java:24) - file containing logging output as well.</screen> <para>This corresponds to a class <filename>src/main/java/de/hdm_stuttgart/mi/sd1/App.java</filename> @@ -1013,7 +1014,7 @@ public class App { <glossterm><command>mvn</command> <option>clean</option></glossterm> <glossdef> - <programlisting language="none">goik@mi-ESPRIMO-P910 gettingstarted> mvn clean + <screen>goik@mi-ESPRIMO-P910 gettingstarted> mvn clean [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ @@ -1021,7 +1022,7 @@ public class App { [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ gettingstarted --- -[INFO] Deleting /ma/goik/gettingstarted/target</programlisting> +[INFO] Deleting /ma/goik/gettingstarted/target</screen> <para>This will effectively clean up all generated <filename>*.class</filename> files.</para> diff --git a/Doc/Sd1/inheritance.xml b/Doc/Sd1/inheritance.xml index b34754cc5..17af59154 100644 --- a/Doc/Sd1/inheritance.xml +++ b/Doc/Sd1/inheritance.xml @@ -4,6 +4,7 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" + xmlns:ns="http://docbook.org/ns/transclusion" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook"> @@ -129,7 +130,7 @@ c.move(1, 5).move(-3, 7);</programlisting> <methodname>scale()</methodname> method cannot be implemented on top level of our inheritance hierarchy. We thus start by defining an abstract method in <classname>our class - Figure</classname>: </para> + Figure</classname>:</para> <programlisting language="java">/** * @@ -181,8 +182,8 @@ c.move(1, 5).move(-3, 7);</programlisting> <para>This creates the following output:</para> - <programlisting language="none">de.hdm_stuttgart.mi.sd1.figure.model.Circle@659e0bfd -de.hdm_stuttgart.mi.sd1.figure.model.Rectangle@2a139a55</programlisting> + <screen>de.hdm_stuttgart.mi.sd1.figure.model.Circle@659e0bfd +de.hdm_stuttgart.mi.sd1.figure.model.Rectangle@2a139a55</screen> <para>This result is due to the invocation of the <methodname xlink:href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--">toString()</methodname> @@ -193,8 +194,8 @@ de.hdm_stuttgart.mi.sd1.figure.model.Rectangle@2a139a55</programlisting> <classname>Rectangle</classname> accordingly to replace the above output by:</para> - <programlisting language="none">Circle (-2.0,-1.0), radius=3.5 -Rectangle (3.0,1.0), width=1.5, height=4.4</programlisting> + <screen>Circle (-2.0,-1.0), radius=3.5 +Rectangle (3.0,1.0), width=1.5, height=4.4</screen> <para>Provide appropriate unit tests.</para> diff --git a/Doc/Sd1/interfacesAbstractClasses.xml b/Doc/Sd1/interfacesAbstractClasses.xml index c274a0b2d..2844841e9 100644 --- a/Doc/Sd1/interfacesAbstractClasses.xml +++ b/Doc/Sd1/interfacesAbstractClasses.xml @@ -4,6 +4,7 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" + xmlns:ns="http://docbook.org/ns/transclusion" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook"> @@ -52,10 +53,10 @@ private static final String[] VERBS = { {thing} {verb} a {thing}.</code></quote> we may randomly generate nonsense phrases like e.g.:</para> - <programlisting language="none">The red meat now manages a bunny. + <screen>The red meat now manages a bunny. The metallic duck works together with a duck. The competitive bottle signs truce with a treehouse. -The nationwide potato buys a monitor.</programlisting> +The nationwide potato buys a monitor.</screen> <para>Implement an appropriate phrase generator obeying the following guidelines:</para> diff --git a/Doc/Sd1/languageFundamentals.xml b/Doc/Sd1/languageFundamentals.xml index 935496e37..0b3787748 100644 --- a/Doc/Sd1/languageFundamentals.xml +++ b/Doc/Sd1/languageFundamentals.xml @@ -761,10 +761,10 @@ System.out.println("Binary " + <emphasis role="bold">0b10_0011</emphasis>); System.out.println("Hex " + <emphasis role="bold">0x23</emphasis>); System.out.println("Octal " + <emphasis role="bold">043</emphasis>); </programlisting></td> - <td><programlisting language="none">Decimal 35 + <td><screen>Decimal 35 Binary 35 Hex 35 -Octal 35</programlisting></td> +Octal 35</screen></td> </tr> </informaltable> </figure> @@ -871,12 +871,12 @@ System.out.println("Sum = " + sum);</programlisting> <informaltable border="1"> <tr> - <td><programlisting language="none">Sum = -2</programlisting></td> + <td valign="top"><screen>Sum = -2</screen></td> - <td><programlisting language="none"> 01111111_11111111_11111111_11111111 + <td><screen> 01111111_11111111_11111111_11111111 + 01111111_11111111_11111111_11111111 _____________________________________ - 11111111_11111111_11111111_11111110</programlisting></td> + 11111111_11111111_11111111_11111110</screen></td> </tr> </informaltable> </figure> @@ -897,8 +897,8 @@ System.out.println("Expected value: " + Long.MAX_VALUE);</programlisting> <para>Result:</para> - <programlisting language="none"> Float value: 9223372036854776000.000000 -Expected value: 9223372036854775807</programlisting> + <screen> Float value: 9223372036854776000.000000 +Expected value: 9223372036854775807</screen> </figure> <figure xml:id="sd1_fig_floatConverter"> @@ -1262,8 +1262,8 @@ Expected value: 9223372036854775807</programlisting> <para>This yields:</para> - <programlisting language="none"> Binary:932 -Decimal:932</programlisting> + <screen> Binary:932 +Decimal:932</screen> </listitem> <listitem> @@ -1339,8 +1339,8 @@ Decimal:932</programlisting> <para>This results in the following output:</para> - <programlisting language="none">... -Decimal:512256128324</programlisting> + <screen>... +Decimal:512256128324</screen> <para>The numbers are being treated as strings rather than integer values The above code is equivalent to:</para> @@ -1415,13 +1415,13 @@ Decimal:512256128324</programlisting> <code>'#'</code> and so on to show their corresponding decimal values. The intended output is:</para> - <programlisting language="none"> : 32 + <screen> : 32 !: 33 ": 34 #: 35 $: 36 %: 37 -&: 38</programlisting> +&: 38</screen> <para>Notice the empty space being represented by decimal 32.</para> @@ -2211,7 +2211,7 @@ System.out.println("Character: " + arabicChar);</programlisting> <para>The expected output reads:</para> - <programlisting language="none">Time in seconds:15391</programlisting> + <screen>Time in seconds:15391</screen> </listitem> <listitem> @@ -2232,9 +2232,9 @@ System.out.println("Character: " + arabicChar);</programlisting> <para>The expected output reads:</para> - <programlisting language="none">Hours:4 + <screen>Hours:4 Minutes:16 -Seconds:31</programlisting> +Seconds:31</screen> <tip> <para>Consider the <link @@ -2679,11 +2679,11 @@ System.out.println(reducedValue);</programlisting> <para>Unfortunately the results are not promising. This code merely results in a runtime error:</para> - <programlisting language="none">/usr/lib/jvm/java-8-oracle/bin/java ... + <screen>/usr/lib/jvm/java-8-oracle/bin/java ... Exception in thread "main" java.lang.ArithmeticException: / by zero at qq.App.main(App.java:27) -Process finished with exit code 1</programlisting> +Process finished with exit code 1</screen> <para>Explain the underlying problem and correct Joe's error.</para> @@ -2992,9 +2992,9 @@ System.out.println(<link <para>The expected output is:</para> - <programlisting language="none">Initial capital:223.12 + <screen>Initial capital:223.12 Annual interest rate:1.5 -Capital after three years:233.31175902999993</programlisting> +Capital after three years:233.31175902999993</screen> <tip> <para>In case you are unsure read about calculating the @@ -3090,8 +3090,8 @@ System.out.println("New value=" + a); <para>This will produce the following output:</para> - <programlisting language="none">value=127 -New value=-128</programlisting> + <screen>value=127 +New value=-128</screen> <para>Explain this strange behaviour.</para> @@ -3305,7 +3305,7 @@ System.out.println("New value=" + a);</programlisting> <para>Complete the above snippet to produce the following output:</para> - <programlisting language="none">3 Games having 22 players each results in 66 players altogether.</programlisting> + <screen>3 Games having 22 players each results in 66 players altogether.</screen> </question> <answer> @@ -3530,7 +3530,7 @@ System.out.println("New value=" + a);</programlisting> <para>This will run smoothly producing the expected output:</para> - <programlisting language="none">20 + 3 + 9 = 32</programlisting> + <screen>20 + 3 + 9 = 32</screen> <para>We now prettify our variable definitions by introducing right aligning numbers thereby padding leading positions with diff --git a/Doc/Sd1/objectsClasses.xml b/Doc/Sd1/objectsClasses.xml index 99f00807b..910f840f1 100644 --- a/Doc/Sd1/objectsClasses.xml +++ b/Doc/Sd1/objectsClasses.xml @@ -4,6 +4,7 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" + xmlns:ns="http://docbook.org/ns/transclusion" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook"> @@ -196,8 +197,8 @@ <para>If installed correctly you should be able to execute the <xref linkend="glo_Java"/> compiler:</para> - <programlisting language="none">goik@pdc1:~$ javac -version -javac 1.8.0_91</programlisting> + <screen>goik@pdc1:~$ javac -version +javac 1.8.0_91</screen> <para>The above output shows a <xref linkend="glo_Java"/> 8 compiler having release level 0_91. See <uri @@ -351,12 +352,12 @@ javac 1.8.0_91</programlisting> <productname>Eclipse</productname>:</para> </informalfigure> - <programlisting language="none">git clone https://gitlab.mi.hdm-stuttgart.de/goik/GoikLectures</programlisting> + <screen>git clone https://gitlab.mi.hdm-stuttgart.de/goik/GoikLectures</screen> <para>You may as well check out via ssh if a suitable key is being configured:</para> - <programlisting language="none">git clone git@gitlab.mi.hdm-stuttgart.de:goik/GoikLectures.git</programlisting> + <screen>git clone git@gitlab.mi.hdm-stuttgart.de:goik/GoikLectures.git</screen> </listitem> <listitem> @@ -455,7 +456,7 @@ javac 1.8.0_91</programlisting> <command>mvn</command> <option>javadoc:javadoc</option> achieving the very same purpose:</para> - <programlisting language="bash">goik@hopc ~> cd Downloads/Exam + <screen>goik@hopc ~> cd Downloads/Exam goik@hopc Exam> mvn <emphasis role="bold">javadoc:javadoc</emphasis> [INFO] Scanning for projects... [INFO] @@ -467,7 +468,7 @@ Generating /ma/goik/Downloads/Exam/target/site/apidocs/allclasses-noframe.html.. Generating <emphasis role="bold">/ma/goik/Downloads/Exam/target/site/apidocs/index.html</emphasis>... Generating /ma/goik/Downloads/Exam/target/site/apidocs/overview-summary.html... Generating /ma/goik/Downloads/Exam/target/site/apidocs/help-doc.html... -</programlisting> +</screen> </section> </section> @@ -538,11 +539,11 @@ public class Driver { <para>The expected output reads:</para> - <programlisting language="none">Age:25 + <screen>Age:25 Salary:30000.00 Raising salary by 2% Age:25 -Salary:30600.00</programlisting> +Salary:30600.00</screen> </question> <answer> @@ -1686,9 +1687,9 @@ public class Driver { <para>This should produce the following output:</para> - <programlisting language="ignore">Is 1800 a leap year? false + <screen>Is 1800 a leap year? false Is 2000 a leap year? true -Is 2016 a leap year? true</programlisting> +Is 2016 a leap year? true</screen> </question> <answer> @@ -1753,10 +1754,13 @@ Is 2016 a leap year? true</programlisting> ... }</programlisting> - <para>You may test your implementation by:<programlisting - language="java"> public static void main(String[] args) { + <para>You may test your implementation by:</para> + + <programlisting language="java">public static void main(String[] args) { System.out.println("1 + 2 + ... + 150" + "=" + getSum(150)); - }</programlisting><parameter>Actually a loop is not needed +}</programlisting> + + <para><parameter>A loop is not required since:</parameter></para> <informalequation> @@ -1986,7 +1990,7 @@ Is 2016 a leap year? true</programlisting> <para>We are interested in the following output presenting the sine function rounded to three decimal places:</para> - <programlisting language="ignore"> x | sin(x) + <screen> x | sin(x) ----+------ 0 | 0.000 5 | 0.087 @@ -2008,7 +2012,7 @@ Is 2016 a leap year? true</programlisting> ----+------- 345 |-0.259 350 |-0.174 -355 |-0.087</programlisting> +355 |-0.087</screen> <para>You may also generate HTML output.</para> @@ -2712,7 +2716,7 @@ long sum = (long)a + b;</programlisting> <tr> <th>Result</th> - <td valign="top"><programlisting language="none">2: 2 + <td valign="top"><screen>2: 2 3: 6 4: 24 5: 120 @@ -2733,7 +2737,7 @@ long sum = (long)a + b;</programlisting> 20: 2432902008176640000 21: -4249290049419214848 -Largest long value:9223372036854775807</programlisting></td> +Largest long value:9223372036854775807</screen></td> </tr> </informaltable> @@ -2952,7 +2956,7 @@ Largest long value:9223372036854775807</programlisting></td> <tr> <th>Result</th> - <td valign="top"><programlisting language="none">Your chance to win when drawing 6 out of 49 is 1 : 13983816</programlisting></td> + <td valign="top"><screen>Your chance to win when drawing 6 out of 49 is 1 : 13983816</screen></td> </tr> </informaltable> </answer> @@ -3554,7 +3558,7 @@ public class Math { <para>This yields:</para> - <programlisting language="none">Max long value:9223372036854775807 + <screen>Max long value:9223372036854775807 15:1307674368000 16:20922789888000 @@ -3563,7 +3567,7 @@ public class Math { 19:121645100408832000 20:2432902008176640000 21:-4249290049419214848 -22:-1250660718674968576</programlisting> +22:-1250660718674968576</screen> <para>So starting from <inlineequation> <m:math display="inline"> @@ -4312,7 +4316,7 @@ System.out.println(factorial(3));</programlisting> <tr> <th>Result</th> - <td valign="top"><programlisting language="none">622614630 + <td valign="top"><screen>622614630 Recursive: Elapsed time:1801476567 622614630 Loop: Elapsed time:27028 @@ -4326,7 +4330,7 @@ Loop: Elapsed time:22768 End of run #9 ------------------------------- Aggregated loop time: 267557 Aggregated recursion time: 17539461906 -Ratio Recursive / Loop: 65554</programlisting></td> +Ratio Recursive / Loop: 65554</screen></td> </tr> </informaltable> @@ -4812,9 +4816,9 @@ Ratio Recursive / Loop: 65554</programlisting></td> <para>In comparison with a professional implementation we have the following results:</para> - <programlisting language="unknown">e^1=2.7180555555555554, difference=-2.262729034896438E-4 + <screen>e^1=2.7180555555555554, difference=-2.262729034896438E-4 e^2=7.355555555555555, difference=-0.033500543375095226 -e^3=19.412499999999998, difference=-0.67303692318767</programlisting> +e^3=19.412499999999998, difference=-0.67303692318767</screen> <para>Our implementation based on just 6 terms is quite good for small values of x. Larger values however exhibit growing @@ -5135,9 +5139,9 @@ e^3=19.412499999999998, difference=-0.67303692318767</programlisting> <para>Taking seven terms into account we have the following results:</para> - <programlisting language="unknown">sin(pi/2)=0.9999999999939768, difference=-6.023181953196399E-12 + <screen>sin(pi/2)=0.9999999999939768, difference=-6.023181953196399E-12 sin(pi)=-7.727858895155385E-7, difference=-7.727858895155385E-7 -sin(4 * PI)=-9143.306026012957, <emphasis role="bold">difference=-9143.306026012957</emphasis></programlisting> +sin(4 * PI)=-9143.306026012957, <emphasis role="bold">difference=-9143.306026012957</emphasis></screen> <para>As with the implementation of <inlineequation> <m:math display="inline"> @@ -5332,7 +5336,7 @@ sin(4 * PI)=-9143.306026012957, <emphasis role="bold">difference=-9143.306026012 xlink:href="Ref/api/P/math/V3/de/hdm_stuttgart/de/sd1/math/Driver.html">this test</link>:</para> - <programlisting language="unknown">Old Implementation:+++++++++++++++++++++++++++++++++++++++ + <screen>Old Implementation:+++++++++++++++++++++++++++++++++++++++ sinOld(pi/2)=0.9999999999939768, difference=-6.023181953196399E-12 sinOld(pi)=-7.727858895155385E-7, difference=-7.727858895155385E-7 @@ -5342,7 +5346,7 @@ New reorder Implementation:+++++++++++++++++++++++++++++++++++++ sin(pi/2)=1.0000000000000435, difference=4.3520742565306136E-14 sin(pi)=2.2419510618081458E-8, difference=2.2419510618081458E-8 -sin(4 * PI)=4518.2187229323445, difference=4518.2187229323445</programlisting> +sin(4 * PI)=4518.2187229323445, difference=4518.2187229323445</screen> <para>Comparing corresponding values our reordered implementation is more than 100 times more precise. For larger @@ -5361,8 +5365,8 @@ sin(4 * PI)=4518.2187229323445, difference=4518.2187229323445</programlisting> <para>This produces the following output:</para> - <programlisting language="unknown">(1 + (a - b)) - 1:-9.992007221626409E-16 -((1 + a) - b) - 1:-8.881784197001252E-16</programlisting> + <screen>(1 + (a - b)) - 1:-9.992007221626409E-16 +((1 + a) - b) - 1:-8.881784197001252E-16</screen> <para>Errors like this sum up in a power series giving rise to reasonable deviations especially if higher powers are diff --git a/Doc/Sd1/statements.xml b/Doc/Sd1/statements.xml index baadf210f..ccb62c1d5 100644 --- a/Doc/Sd1/statements.xml +++ b/Doc/Sd1/statements.xml @@ -4,6 +4,7 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" + xmlns:ns="http://docbook.org/ns/transclusion" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook"> @@ -64,25 +65,25 @@ <orderedlist> <listitem> - <programlisting language="none">Your order: + <screen>Your order: 1=Beer 2=Orange juice:1 Tell me your age please:15 -Sorry, we are not allowed to serve beer to underage customers</programlisting> +Sorry, we are not allowed to serve beer to underage customers</screen> </listitem> <listitem> - <programlisting language="none">Your order: + <screen>Your order: 1=Beer 2=Orange juice:2 -o.K.</programlisting> +o.K.</screen> </listitem> <listitem> - <programlisting language="none">Your order: + <screen>Your order: 1=Beer 2=Orange juice:4 -Sorry, invalid choice</programlisting> +Sorry, invalid choice</screen> </listitem> </orderedlist> @@ -161,8 +162,8 @@ public class BarOrder { user whether a given year is a leap year or not. The following dialogue may serve as an example:</para> - <programlisting language="none">Enter a year:1980 -Year 1980 is a leap year</programlisting> + <screen>Enter a year:1980 +Year 1980 is a leap year</screen> <para>You may reuse the user input handling code from the previous example <xref linkend="sd1SectAtTheBar"/>.</para> @@ -235,14 +236,14 @@ public class LeapYear { <para>Write an application which turns a positive integer values up to and including 10 into roman numeral representation:</para> - <programlisting language="none">Enter a number:9 -IX</programlisting> + <screen>Enter a number:9 +IX</screen> <para>If the user enters a value greater than ten the following output is to be expected:</para> - <programlisting language="none">Enter a number:14 -Decimal value 14 not yet implemented</programlisting> + <screen>Enter a number:14 +Decimal value 14 not yet implemented</screen> </question> <answer> @@ -300,13 +301,13 @@ Decimal value 14 not yet implemented</programlisting> <para>This code effectively filters odd numbers and prints only even ones:</para> - <programlisting language="none">0 + <screen>0 2 4 6 8 10 -12</programlisting> +12</screen> <para>Modify this code to work without requiring the inner <quote>if</quote> statement.</para> @@ -343,7 +344,7 @@ Decimal value 14 not yet implemented</programlisting> bottom (###) lines (possibly bad page break in the printed version of this document):</para> - <programlisting language="none"> X + <screen> X * *** ***** @@ -351,7 +352,7 @@ Decimal value 14 not yet implemented</programlisting> ********* *********** ### - ###</programlisting> + ###</screen> <tip> <para>The following example printing a triangle may serve as a @@ -379,13 +380,13 @@ Decimal value 14 not yet implemented</programlisting> <td align="center">⟹</td> - <td valign="top"><programlisting language="none">* + <td valign="top"><screen>* ** *** **** ***** ****** -*******</programlisting></td> +*******</screen></td> </tr> </informaltable> </tip> @@ -461,7 +462,7 @@ Decimal value 14 not yet implemented</programlisting> <para>Producing the following ASCII art for configurable Xmas tree sizes is a bit more challenging :</para> - <programlisting language="none"> \ / + <screen> \ / -->*<-- /_\ /_\_\ @@ -474,7 +475,7 @@ Decimal value 14 not yet implemented</programlisting> /_/_/_/_/_/_\ /_\_\_\_\_\_\ /_/_/_/_/_/_/_\ - [___]</programlisting> + [___]</screen> <tip> <para>Inside a string literal a backslash <quote>\</quote> has @@ -667,7 +668,7 @@ Decimal value 14 not yet implemented</programlisting> </m:math> </inlineequation>):</para> - <programlisting language="none">n | n * n + <screen>n | n * n --+------ 0 | 0 1 | 1 @@ -678,7 +679,7 @@ Decimal value 14 not yet implemented</programlisting> 6 | 36 7 | 49 8 | 64 -9 | 81</programlisting> +9 | 81</screen> </question> <answer> @@ -713,7 +714,7 @@ Decimal value 14 not yet implemented</programlisting> <para>Running the previous code for values beyond 9 suffers from ugly formatting:</para> - <programlisting language="none">n | n * n + <screen>n | n * n --+------ 0 | 0 1 | 1 @@ -725,7 +726,7 @@ Decimal value 14 not yet implemented</programlisting> 12 | 144 ... 19 | 361 -20 | 400</programlisting> +20 | 400</screen> <para>Modify your code by:</para> @@ -742,8 +743,7 @@ Decimal value 14 not yet implemented</programlisting> </listitem> </orderedlist> - <para>Your application's output shall look - like:<programlisting language="none"> n | n * n + <para>Your application's output shall look like:<screen> n | n * n ---+------ 0| 0 1| 1 @@ -754,7 +754,7 @@ Decimal value 14 not yet implemented</programlisting> 11| 121 ... 19| 361 - 20| 400</programlisting><tip> + 20| 400</screen><tip> <para>Read the track <link xlink:href="https://docs.oracle.com/javase/tutorial/java/data/numberformat.html">Formatting Numeric Print Output</link> and learn how to style numeric @@ -873,7 +873,7 @@ Decimal value 14 not yet implemented</programlisting> table we supply a slightly different exercise producing a multiplication table:</para> - <programlisting language="none"> * | 1 2 3 4 5 6 7 8 9 10 + <screen> * | 1 2 3 4 5 6 7 8 9 10 ---+-------------------------------------------------- 1| 1 2 3 4 5 6 7 8 9 10 2| 2 4 6 8 10 12 14 16 18 20 @@ -884,7 +884,7 @@ Decimal value 14 not yet implemented</programlisting> 7| 7 14 21 28 35 42 49 56 63 70 8| 8 16 24 32 40 48 56 64 72 80 9| 9 18 27 36 45 54 63 72 81 90 - 10| 10 20 30 40 50 60 70 80 90 100 </programlisting> + 10| 10 20 30 40 50 60 70 80 90 100 </screen> <para>The number of rows and columns are equal. Provide an appropriate parameter <code>final int limit = ...</code> so @@ -947,7 +947,7 @@ Decimal value 14 not yet implemented</programlisting> <para>It does not make sense to supply both results like e.g. 3 * 4 and 4 * 3. Modify your application to generate:</para> - <programlisting language="none"> 1| 1 + <screen> 1| 1 2| 2 4 3| 3 6 9 4| 4 8 12 16 @@ -958,7 +958,7 @@ Decimal value 14 not yet implemented</programlisting> 9| 9 18 27 36 45 54 63 72 81 10| 10 20 30 40 50 60 70 80 90 100 ---+-------------------------------------------------- - * | 1 2 3 4 5 6 7 8 9 10 </programlisting> + * | 1 2 3 4 5 6 7 8 9 10 </screen> </question> <answer> @@ -1007,7 +1007,7 @@ Decimal value 14 not yet implemented</programlisting> elements require rearranging values in blocks in order to limit wasting space:</para> - <programlisting language="none"> n | n*n n | n*n n | n*n n | n*n n | n*n + <screen> n | n*n n | n*n n | n*n n | n*n n | n*n ----+--------------+--------------+--------------+--------------+---------- 0 | 0 20 | 400 40 | 1600 60 | 3600 80 | 6400 1 | 1 21 | 441 41 | 1681 61 | 3721 81 | 6561 @@ -1029,7 +1029,7 @@ Decimal value 14 not yet implemented</programlisting> 16 | 256 36 | 1296 56 | 3136 76 | 5776 96 | 9216 17 | 289 37 | 1369 57 | 3249 77 | 5929 97 | 9409 18 | 324 38 | 1444 58 | 3364 78 | 6084 98 | 9604 - 19 | 361 39 | 1521 59 | 3481 79 | 6241 99 | 9801</programlisting> + 19 | 361 39 | 1521 59 | 3481 79 | 6241 99 | 9801</screen> <para>Building a table this way requires some parameters:</para> @@ -1398,7 +1398,7 @@ Decimal value 14 not yet implemented</programlisting> xml:lang="de">Glücksspirale</quote> a possible output reads:</para> - <programlisting language="none">Your chance to win when drawing 6 out of 49 is 1 : 13983816</programlisting> + <screen>Your chance to win when drawing 6 out of 49 is 1 : 13983816</screen> <tip> <orderedlist> @@ -1872,14 +1872,14 @@ for (int i = 2; i <= number; i++) { example. In the following example the system randomly generates the secret number 5. A possible dialogue looks like:</para> - <programlisting language="none">Try to guess my number in the range between 0 and 10: + <screen>Try to guess my number in the range between 0 and 10: You have 5 attempts Input your guess:4 Value is too low Input your guess:6 Value is too high Input your guess:5 -Congratulations! you won!</programlisting> +Congratulations! you won!</screen> <para>Regarding user input reading and random number generating methods please use the following recipe to get started:</para> @@ -1892,8 +1892,7 @@ import java.util.Random; final short maxValueInclusive = 10; // Upper inclusive limit for selecting // random final int randomValue = new Random() // a random value ranging from 0 to - .<link - xlink:href="https://docs.oracle.com/javase/8/docs/api/java/util/Random.html#nextInt--">nextInt(maxValueInclusive + 1)</link>; // maxValueInclusive. + .<link xlink:href="https://docs.oracle.com/javase/8/docs/api/java/util/Random.html#nextInt--">nextInt(maxValueInclusive + 1)</link>; // maxValueInclusive. final Scanner scan = new Scanner(System.in); System.out.print("Input a number:"); diff --git a/Doc/Sd1/streams.xml b/Doc/Sd1/streams.xml index 854af28b8..aced65f8d 100644 --- a/Doc/Sd1/streams.xml +++ b/Doc/Sd1/streams.xml @@ -4,6 +4,7 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" + xmlns:ns="http://docbook.org/ns/transclusion" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook"> @@ -106,7 +107,7 @@ final BufferedReader inputBufferedReader = new BufferedReader(fileReader);</prog <para>This solutions reacts both to inexistent files and general IO problems:</para> - <programlisting language="none">File not found: Testdata/input.java</programlisting> + <screen>File not found: Testdata/input.java</screen> <para>Two test cases deal both with readable and non-existing files: and expected exceptions:</para> @@ -150,9 +151,9 @@ final BufferedReader inputBufferedReader = new BufferedReader(fileReader);</prog for sample text files like e.g. a Java source file of similar:</para> - <programlisting language="bourne">goik >wc BoundedIntegerStore.java + <screen>goik >wc BoundedIntegerStore.java 58 198 1341 BoundedIntegerStore.java -</programlisting> +</screen> <para>What do these three numbers 58, 198 and 1341 mean? Execute <command>wc</command> <option>--help</option> or @@ -166,12 +167,12 @@ final BufferedReader inputBufferedReader = new BufferedReader(fileReader);</prog parallel thereby producing an extra line <coref linkend="sd1PlWcExtraLine"/> summing up all values:</para> - <programlisting language="bourne">goik >wc bibliography.xml swd1.xml + <screen>goik >wc bibliography.xml swd1.xml 69 83 2087 bibliography.xml 6809 18252 248894 swd1.xml <emphasis role="bold">6878 18335 250981 total</emphasis> <co xml:id="sd1PlWcExtraLine"/> -</programlisting> +</screen> </listitem> <listitem> @@ -179,8 +180,8 @@ final BufferedReader inputBufferedReader = new BufferedReader(fileReader);</prog xlink:href="https://en.wikipedia.org/wiki/Pipeline_(Unix)">pipes</link> () like:</para> - <programlisting language="bourne">goik >grep int BoundedIntegerStore.java | wc - 12 76 516</programlisting> + <screen>goik >grep int BoundedIntegerStore.java | wc + 12 76 516</screen> <para>The above output <quote>12 76 516</quote> tells us that our file <filename>BoundedIntegerStore.java</filename> does @@ -264,8 +265,8 @@ final BufferedReader inputBufferedReader = new BufferedReader(fileReader);</prog <glossterm>Reading from standard input</glossterm> <glossdef> - <programlisting language="bourne">goik >cat Testdata/input.html | java -jar target/wc-1.0.jar - 9 14 137</programlisting> + <screen>goik >cat Testdata/input.html | java -jar target/wc-1.0.jar + 9 14 137</screen> </glossdef> </glossentry> @@ -273,10 +274,10 @@ final BufferedReader inputBufferedReader = new BufferedReader(fileReader);</prog <glossterm>Passing file names as parameters</glossterm> <glossdef> - <programlisting language="bourne">goik >java -jar target/wc-1.0.jar Testdata/* + <screen>goik >java -jar target/wc-1.0.jar Testdata/* 9 14 137 Testdata/input.html 4 5 41 Testdata/model.css - 13 19 178 total</programlisting> + 13 19 178 total</screen> </glossdef> </glossentry> </glosslist> diff --git a/Doc/Sda1/dom.xml b/Doc/Sda1/dom.xml index 24e187f87..ac416c9bb 100644 --- a/Doc/Sda1/dom.xml +++ b/Doc/Sda1/dom.xml @@ -4,6 +4,7 @@ xmlns:xila="http://www.w3.org/2001/XInclude/local-attributes" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" + xmlns:ns="http://docbook.org/ns/transclusion" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook"> @@ -115,7 +116,7 @@ xlink:href="https://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-1950641247">Node</link> interface definition:</para> - <programlisting language="none">interface Node { + <literallayout>interface Node { // NodeType const unsigned short ELEMENT_NODE = 1; const unsigned short ATTRIBUTE_NODE = 2; @@ -135,7 +136,7 @@ Node insertBefore(in Node newChild, in Node refChild) raises(DOMException); - ...</programlisting> + ...</literallayout> <para>If we want to implement the <abbrev xlink:href="https://en.wikipedia.org/wiki/Interface_description_language">IDL</abbrev> @@ -551,8 +552,8 @@ public class CreateDoc { <para>This yields:</para> - <programlisting language="none">Article: Swinging headset, order number: 3218 -Article: 200W Stereo Amplifier, order number: 9921</programlisting> + <screen>Article: Swinging headset, order number: 3218 +Article: 200W Stereo Amplifier, order number: 9921</screen> <para>This example's complete code may is available for import:</para> @@ -605,7 +606,7 @@ Article: 200W Stereo Amplifier, order number: 9921</programlisting> well. For the above input the expected output of your application is:</para> - <programlisting language="none">Element memo, nesting depth = 0 + <screen>Element memo, nesting depth = 0 Element from, nesting depth = 1 Element name, nesting depth = 2 Element surname, nesting depth = 2 @@ -621,7 +622,7 @@ Element content, nesting depth = 1 Element para, nesting depth = 2 Element para, nesting depth = 2 -Document contains 15 elements and 3 attributes.</programlisting> +Document contains 15 elements and 3 attributes.</screen> </question> <answer> @@ -1514,7 +1515,7 @@ public class Article2Html { <para>The result is a list of image filename references:</para> - <programlisting language="none">inline.gif, one.gif, http://www.hdm-stuttgart.de/favicon.ico</programlisting> + <screen>inline.gif, one.gif, http://www.hdm-stuttgart.de/favicon.ico</screen> <para>Complete Maven project code:</para> @@ -1579,10 +1580,10 @@ public class Article2Html { xlink:href="https://www.ietf.org/rfc/rfc1738.txt">URL</abbrev>. A possible output for the above example reads:</para> - <programlisting language="none">xpath.CheckUrl (CheckUrl.java:51) - Protocol 'ftp' not yet implemented + <screen>xpath.CheckUrl (CheckUrl.java:51) - Protocol 'ftp' not yet implemented ftp://inexistent.com/q.png, HTTP Status: null https://www.hdm-stuttgart.de/bilder_navigation/laptop.gif, HTTP Status: OK -http://www.hdm-stuttgart.de/rotfl.gif, HTTP Status: Found</programlisting> +http://www.hdm-stuttgart.de/rotfl.gif, HTTP Status: Found</screen> <caution> <para>Notice the response code for @@ -1656,7 +1657,7 @@ http://www.hdm-stuttgart.de/rotfl.gif, HTTP Status: Found</programlisting> xlink:href="https://www.w3.org/TR/xpath">XPath</acronym> expression:</para> - <programlisting language="none">//xhtml:img[starts-with(@src, 'http://') or + <programlisting language="xpath">//xhtml:img[starts-with(@src, 'http://') or starts-with(@src, 'https://') or starts-with(@src, 'ftp://')]</programlisting> <para>Notice the prefix <quote>xhtml</quote> in the above diff --git a/Doc/Sda1/fo.xml b/Doc/Sda1/fo.xml index bfaa5af4a..a67719bbf 100644 --- a/Doc/Sda1/fo.xml +++ b/Doc/Sda1/fo.xml @@ -4,6 +4,7 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" + xmlns:ns="http://docbook.org/ns/transclusion" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook"> @@ -476,8 +477,9 @@ <para>The free chapter from <xref linkend="bib_Harold04"/> book contains additional information on extended <link xlink:href="http://www.cafeconleche.org/books/bible2/chapters/ch18.html#d1e2250">layout - definitions</link>. The <orgname xlink:href="https://www.w3.org">W3C</orgname> - as the holder of the FO standard defines the elements <link + definitions</link>. The <orgname + xlink:href="https://www.w3.org">W3C</orgname> as the holder of the FO + standard defines the elements <link xlink:href="https://www.w3.org/TR/xsl/#fo_layout-master-set">fo:layout-master-set</link>, <link xlink:href="https://www.w3.org/TR/xsl/#fo_simple-page-master">fo:simple-page-master</link> @@ -501,8 +503,8 @@ <figure xml:id="blockInline"> <title>A <link - xlink:href="https://www.w3.org/TR/xsl/#fo_block">fo:block</link> with a - <link + xlink:href="https://www.w3.org/TR/xsl/#fo_block">fo:block</link> with + a <link xlink:href="https://www.w3.org/TR/xsl/#fo_inline">fo:inline</link> descendant.</title> @@ -613,8 +615,8 @@ <para>Sometimes adjustable horizontal space between two neighbouring objects has to be filled e.g. in a book's table of contents. The <link - xlink:href="https://www.w3.org/TR/xsl/#fo_leader">fo:leader</link> serves - this purpose:</para> + xlink:href="https://www.w3.org/TR/xsl/#fo_leader">fo:leader</link> + serves this purpose:</para> <figure xml:id="leaderToc"> <title>Two simulated entries in a table of contents.</title> @@ -852,16 +854,16 @@ leader-pattern="dots"/>C<fo:leader leader-pattern="dots"/>D</fo:bloc xlink:href="https://www.w3.org/TR/2001/REC-xsl-20011015/slice6.html#fo-section">FO</abbrev> based page references. As already being discussed for <link xlink:href="https://www.w3.org/TR/xml#id">ID</link> / <link - xlink:href="https://www.w3.org/TR/xml#idref">IDREF</link> pairs we need a - link destination (anchor) and a link source. The <abbrev + xlink:href="https://www.w3.org/TR/xml#idref">IDREF</link> pairs we need + a link destination (anchor) and a link source. The <abbrev xlink:href="https://www.w3.org/TR/2001/REC-xsl-20011015/slice6.html#fo-section">FO</abbrev> standard uses the same anchor implementation as in XML for <link xlink:href="https://www.w3.org/TR/xml#id">ID</link> typed attributes: <abbrev xlink:href="https://www.w3.org/TR/2001/REC-xsl-20011015/slice6.html#fo-section">FO</abbrev> objects <emphasis>may</emphasis> have an attribute <link - xlink:href="https://www.w3.org/TR/xsl/#id">id</link> with a document wide - unique value. The <abbrev + xlink:href="https://www.w3.org/TR/xsl/#id">id</link> with a document + wide unique value. The <abbrev xlink:href="https://www.w3.org/TR/2001/REC-xsl-20011015/slice6.html#fo-section">FO</abbrev> element <link xlink:href="https://www.w3.org/TR/xsl/#fo_page-number-citation">fo:page-number-citation</link> @@ -1068,7 +1070,7 @@ leader-pattern="dots"/>C<fo:leader leader-pattern="dots"/>D</fo:bloc element contains a namespace definition for the target FO document's namespace, namely:</para> - <programlisting language="none">xmlns:xsl="http://www.w3.org/1999/XSL/Transform"</programlisting> + <literallayout>xmlns:xsl="http://www.w3.org/1999/XSL/Transform"</literallayout> <para>This is required to use elements like <link xlink:href="https://www.w3.org/TR/xsl/#fo_block">fo:block</link> @@ -1092,7 +1094,7 @@ leader-pattern="dots"/>C<fo:leader leader-pattern="dots"/>D</fo:bloc <term><emphasis>XML document instance to FO</emphasis></term> <listitem> - <programlisting language="none">xml2xml message.xml memo2fo.xsl -o message.fo</programlisting> + <screen>xml2xml message.xml memo2fo.xsl -o message.fo</screen> </listitem> </varlistentry> @@ -1100,7 +1102,7 @@ leader-pattern="dots"/>C<fo:leader leader-pattern="dots"/>D</fo:bloc <term><emphasis>FO to PDF</emphasis></term> <listitem> - <programlisting language="none">fo2pdf -fo message.fo -pdf message.pdf</programlisting> + <screen>fo2pdf -fo message.fo -pdf message.pdf</screen> </listitem> </varlistentry> </variablelist> @@ -1116,7 +1118,7 @@ leader-pattern="dots"/>C<fo:leader leader-pattern="dots"/>D</fo:bloc file is not required both steps may be combined into a single call:</para> - <programlisting language="none">fo2pdf -xml message.xml -xsl memo2fo.xsl -pdf message.pdf</programlisting> + <screen>fo2pdf -xml message.xml -xsl memo2fo.xsl -pdf message.pdf</screen> </listitem> </orderedlist> </section> diff --git a/Doc/Sda1/jdbc.xml b/Doc/Sda1/jdbc.xml index 406be4eac..205abd2f3 100644 --- a/Doc/Sda1/jdbc.xml +++ b/Doc/Sda1/jdbc.xml @@ -5,6 +5,7 @@ xmlns:xila="http://www.w3.org/2001/XInclude/local-attributes" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" + xmlns:ns="http://docbook.org/ns/transclusion" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook"> @@ -451,7 +452,7 @@ <para>Execution works as expected:</para> - <programlisting language="none">Successfully inserted 1 dataset(s)</programlisting> + <screen>Successfully inserted 1 dataset(s)</screen> <qandaset defaultlabel="qanda" xml:id="quandaentry_DupInsert"> <title>Exception on inserting objects</title> @@ -463,12 +464,12 @@ <classname>sda.jdbc.intro.v1.SimpleInsert</classname> yields the following runtime error:</para> - <programlisting language="none">Exception in thread "main" + <screen>Exception in thread "main" com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: <emphasis role="bold">Duplicate entry 'jim@foo.org' for key 'email'</emphasis> ... at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1617) - at sda.jdbc.intro.SimpleInsert.main(SimpleInsert.java:17)</programlisting> + at sda.jdbc.intro.SimpleInsert.main(SimpleInsert.java:17)</screen> <para>Why does this happen?</para> </question> @@ -965,7 +966,7 @@ public someClass { related connection parameters to a <filename>jdbc.properties</filename> file like:</para> - <programlisting language="none">SimpleInsert.jdbcUrl=jdbc:mysql://localhost:3306/hdm?useSSL=false + <programlisting language="properties">SimpleInsert.jdbcUrl=jdbc:mysql://localhost:3306/hdm?useSSL=false SimpleInsert.password=XYZ SimpleInsert.username=hdmuser</programlisting> @@ -1810,14 +1811,14 @@ public class ViewMockup implements PersistView { <para>This yields the following capture being shortened for the sake of brevity:</para> - <programlisting language="none">[... + <screen>[... 5.5.24-0ubuntu0.12.04.1.%...X*e?I1ZQ...................e,F[yoA5$T[N.mysql_native_password. A...........!.......................hdmuser <co xml:id="tcpCaptureUsername"/>......U.>S.%..~h...!.xhdm............j..../* ... INSERT INTO Person VALUES('Jim', 'jim@foo.org') <co xml:id="tcpCaptureSqlInsert"/>6... .&.#23000Duplicate entry 'jim@foo.org' for key 'email' <co - xml:id="tcpCaptureErrmsg"/></programlisting> + xml:id="tcpCaptureErrmsg"/></screen> <calloutlist> <callout arearefs="tcpCaptureUsername"> @@ -1978,8 +1979,8 @@ public class ViewMockup implements PersistView { xlink:href="https://en.wikipedia.org/wiki/Java_Database_Connectivity">JDBC</trademark> URL:</para> - <programlisting language="none">jdbc:mysql://localhost:3306/hdm?useSSL=false&<emphasis - role="bold">allowMultiQueries=true</emphasis></programlisting> + <literallayout>jdbc:mysql://localhost:3306/hdm?useSSL=false&<emphasis + role="bold">allowMultiQueries=true</emphasis></literallayout> <para>The <productname xlink:href="https://www.mysql.com">Mysql</productname> @@ -2006,7 +2007,7 @@ public class ViewMockup implements PersistView { <para>We construct a suitable string being injected to drop our <code>Person</code> table:</para> - <programlisting language="none">Jim', 'jim@c.com');DROP TABLE Person;INSERT INTO Person VALUES('Joe</programlisting> + <programlisting language="sql">Jim', 'jim@c.com');DROP TABLE Person;INSERT INTO Person VALUES('Joe</programlisting> <para>This being entered into the name field kills our <code>Table</code> relation effectively. As the error message @@ -2235,9 +2236,9 @@ public static boolean testMatch(final String word, final String regexp) { <classname>java.util.regex.Pattern</classname>. The intended output of the above application is:</para> - <programlisting language="none">The expression '[A-K].*' matches 'Eric' + <screen>The expression '[A-K].*' matches 'Eric' The expression '[^0-9]+.*' ... -...</programlisting> +...</screen> </question> <answer> @@ -2611,7 +2612,7 @@ public class SimpleInsert { xlink:href="https://docs.oracle.com/javase/8/docs/api/java/sql/PreparedStatement.html">PreparedStatement</classname> instances. An attacker may safely enter offending strings like:</para> - <programlisting language="none">Jim', 'jim@c.com');DROP TABLE Person;INSERT INTO Person VALUES('Joe</programlisting> + <programlisting language="sql">Jim', 'jim@c.com');DROP TABLE Person;INSERT INTO Person VALUES('Joe</programlisting> <para>The above string will be taken <quote>as is</quote> and thus simply becomes part of the database server's content.</para> @@ -2926,9 +2927,9 @@ while (data.next()) { </callout> </calloutlist> - <programlisting language="none">Exception in thread "main" java.sql.SQLException: Invalid value for getInt() - 'Jim' + <screen>Exception in thread "main" java.sql.SQLException: Invalid value for getInt() - 'Jim' at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073) -...</programlisting> +...</screen> <para>We may however provide <quote>compatible</quote> data records:</para> @@ -2939,7 +2940,7 @@ INSERT INTO Friends VALUES (1, <emphasis role="bold">'31'</emphasis>, '1991-10-1 <para>This time our application executes perfectly well:</para> - <programlisting language="none">1, 31, 1991-10-10</programlisting> + <screen>1, 31, 1991-10-10</screen> <para>Conclusion: The <xref linkend="glo_JDBC"/> driver performs a conversion from a string type to an integer similar @@ -2973,16 +2974,16 @@ INSERT INTO Friends VALUES (1, <emphasis role="bold">'31'</emphasis>, '1991-10-1 <para>Starting our current application yields:</para> - <programlisting language="none">1, Jim, 1991-10-10 + <screen>1, Jim, 1991-10-10 2, null, 2003-05-24 -3, Mick, 2001-12-30</programlisting> +3, Mick, 2001-12-30</screen> <para>This might be confuses with a person having the nickname <quote>null</quote>. Instead we would like to have:</para> - <programlisting language="none">1, Jim, 1991-10-10 + <screen>1, Jim, 1991-10-10 2, -Name unknown- , 2003-05-24 -3, Mick, 2001-12-30</programlisting> +3, Mick, 2001-12-30</screen> <para>Extend the current code of <classname>sda.jdbc.intro.SimpleRead</classname> to produce @@ -3062,7 +3063,7 @@ INSERT INTO Friends VALUES (1, <emphasis role="bold">'31'</emphasis>, '1991-10-1 is vulnerable to SQL injection attacks. A user my enter the following password value in the GUI:</para> - <programlisting language="none">sd' OR '1' = '1</programlisting> + <programlisting language="sql">sd' OR '1' = '1</programlisting> <para>Based on the login name <quote>fred</quote> the following SQL string is being crafted:</para> @@ -3474,7 +3475,7 @@ public class InsertPerson extends JFrame { properties file <filename>database.properties</filename>:</para> - <programlisting language="none">PersistenceHandler.jdbcUrl=jdbc:mysql://localhost:3306/hdm?useSSL=false + <programlisting language="properties">PersistenceHandler.jdbcUrl=jdbc:mysql://localhost:3306/hdm?useSSL=false PersistenceHandler.username=hdmuser <co xml:id="databaseUserHdmUsername"/> PersistenceHandler.password=<emphasis role="bold">XYZ</emphasis> <co xml:id="databaseUserHdmPassword"/></programlisting> @@ -3593,14 +3594,14 @@ INSERT INTO Description VALUES(2, 2, 'Pre-attached tent poles.');</programlistin <para>Without <code>UNIQUE(product, orderIndex)</code> the following state would become possible:</para> - <programlisting language="none">+---------+------------------------------+------------+ + <literallayout>+---------+------------------------------+------------+ | product | text | orderIndex | +---------+------------------------------+------------+ | ... | ... | ... | | 2 | Exclusive WeatherTec system. | 1 | | 2 | 4-person, 1-compartment tent.| 1 | | ... | ... | ... | -+---------+------------------------------+------------+</programlisting> ++---------+------------------------------+------------+</literallayout> <para>The presence of two distinct descriptions having identical orderIndex does not enforce the required diff --git a/Doc/Sda1/jpaintro.xml b/Doc/Sda1/jpaintro.xml index 95d662eae..9afa5b97d 100644 --- a/Doc/Sda1/jpaintro.xml +++ b/Doc/Sda1/jpaintro.xml @@ -4,6 +4,7 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" + xmlns:ns="http://docbook.org/ns/transclusion" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook"> @@ -148,7 +149,7 @@ <classname>jpaintro.university.CreateAirline</classname> yields:</para> - <programlisting language="none">... + <screen>... DEBUG [main] util.LogHelper (LogHelper.java:102) - PersistenceUnitInfo [ name: strategy_drop-and-create <co linkends="sda1HibernateSchemaLog-1" xml:id="sda1HibernateSchemaLog-1-co"/> @@ -182,7 +183,7 @@ INFO [main] dialect.Dialect ... Using dialect: org.hibernate.dialect.MySQL5Inno insert into Airline (icaoCode, name) values (?, ?) <co linkends="sda1HibernateSchemaLog-9" xml:id="sda1HibernateSchemaLog-9-co"/> -...</programlisting> +...</screen> <calloutlist> <callout arearefs="sda1HibernateSchemaLog-1-co" @@ -253,7 +254,7 @@ insert into Airline (icaoCode, name) values (?, ?) <co </listitem> <listitem> - <programlisting language="none+">SHOW CREATE TABLE Airline + <programlisting language="sql">SHOW CREATE TABLE Airline ... CREATE TABLE `Airline` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, @@ -266,7 +267,7 @@ CREATE TABLE `Airline` ( <listitem> <para>The log output contains:</para> - <programlisting language="none">... + <screen>... select airline0_.id as id1_0_, airline0_.icaoCode as icaoCode2_0_, airline0_.name as name3_0_ @@ -274,18 +275,19 @@ from Airline airline0_ where airline0_.icaoCode=? ... TRACE [main] sql.BasicBinder (BasicBinder.java:65) - binding parameter [1] as [VARCHAR] - [DLH] -...</programlisting> +...</screen> <para>Removing the SQL table alias this may be simplified:</para> - <programlisting language="none">... + <screen> +... select id, icaoCode, name from Airline where airline0_.icaoCode=? ... TRACE [main] sql.BasicBinder (BasicBinder.java:65) - binding parameter [1] as [VARCHAR] - [DLH] -...</programlisting> +...</screen> <para>This is an expected statement again using a placeholder representing the <property>icaoCode</property> search diff --git a/Doc/Sda1/prerequisites.xml b/Doc/Sda1/prerequisites.xml index 8aac8d4b0..aa0413a9a 100644 --- a/Doc/Sda1/prerequisites.xml +++ b/Doc/Sda1/prerequisites.xml @@ -4,6 +4,7 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" + xmlns:ns="http://docbook.org/ns/transclusion" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook"> @@ -236,9 +237,9 @@ This boils down to (being executed as user root or preceded by <command>sudo</command> <option>...</option>):</para> - <programlisting language="none">add-apt-repository ppa:webupd8team/java + <screen>add-apt-repository ppa:webupd8team/java apt-get update -apt-get install oracle-jdk8-installer</programlisting> +apt-get install oracle-jdk8-installer</screen> <para>During the installation process you will have to accept Oracle's license terms. If you do so this information will be cached and not be @@ -250,10 +251,10 @@ apt-get install oracle-jdk8-installer</programlisting> <option>-version</option> in a shell you should see something similar to:</para> - <programlisting language="none">goik@mi-ESPRIMO-P910 > java -version + <screen>goik@mi-ESPRIMO-P910 > java -version java version "1.8.0_60" Java(TM) SE Runtime Environment (build 1.8.0_60-b27) -Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)</programlisting> +Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)</screen> <para>The Eclipse IDE comes <link xlink:href="https://www.eclipse.org/downloads">with various @@ -298,20 +299,20 @@ Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)</programlisting> <para>We start by installing the <productname xlink:href="https://www.mysql.com">Mysql</productname> server:</para> - <programlisting language="none">root@goiki:~# aptitude install mysql-server + <screen>root@goiki:~# aptitude install mysql-server The following NEW packages will be installed: libdbd-mysql-perl{a} libdbi-perl{a} libnet-daemon-perl{a} libplrpc-perl{a} mysql-client-5.5{a} mysql-server-5.5 0 packages upgraded, 6 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B/17.8 MB of archives. After unpacking 63.2 MB will be used. -Do you want to continue? [Y/n/?]</programlisting> +Do you want to continue? [Y/n/?]</screen> <para>Hit <keycap>Y - return</keycap> to start. During the installation you will be asked for the <productname xlink:href="https://www.mysql.com">Mysql</productname> servers <quote>root</quote> (Administrator) password:</para> - <programlisting language="none">Package configuration + <screen>Package configuration ┌───────────────────────────┤ Configuring mysql-server-5.5 ├────────────────────────────┠@@ -329,7 +330,7 @@ Do you want to continue? [Y/n/?]</programlisting> └───────────────────────────────────────────────────────────────────────────────────────┘ - </programlisting> + </screen> <para>This has to be entered twice. Keep a <emphasis role="bold">permanent</emphasis> record of this entry. Alternatively set @@ -341,37 +342,37 @@ Do you want to continue? [Y/n/?]</programlisting> Server. We create a database <quote>hdm</quote> to be used for our exercises:</para> - <programlisting language="none">goik@hopc ~> mysql -u root -p + <screen>goik@hopc ~> mysql -u root -p Enter password: ... messages omitted for brevity ... mysql> <emphasis role="bold">create database hdm;</emphasis> -Query OK, 1 row affected (0.00 sec)</programlisting> +Query OK, 1 row affected (0.00 sec)</screen> <para>Following <uri xlink:href="https://dev.mysql.com/doc/refman/5.5/en/adding-users.html">https://dev.mysql.com/doc/refman/5.5/en/adding-users.html</uri> we add <code>hdmuser</code> as a new user and grant full access to the newly created database <code>hdm to him</code>:</para> - <programlisting language="none"> ... + <screen> ... mysql> <emphasis role="bold">CREATE USER 'hdmuser'@'localhost' IDENTIFIED BY 'XYZ';</emphasis> mysql> <emphasis role="bold">use hdm;</emphasis> mysql> <emphasis role="bold">GRANT ALL PRIVILEGES ON *.* TO 'hdmuser'@'localhost' WITH GRANT OPTION;</emphasis> mysql> <emphasis role="bold">FLUSH PRIVILEGES;</emphasis> mysql> exit; -Bye</programlisting> +Bye</screen> <para>You may want to test your configuration:</para> - <programlisting language="none">goik@hopc ~> mysql --user=hdmuser --password=XYZ + <screen>goik@hopc ~> mysql --user=hdmuser --password=XYZ ... messages omitted for brevity ... mysql> use hdm;show tables; Database changed Empty set (0,00 sec) -mysql></programlisting> +mysql></screen> <para>The next step is optional. The <productname xlink:href="http://www.ubuntu.com">Ubuntu</productname> <productname @@ -383,9 +384,9 @@ mysql></programlisting> out the bind-address parameter in <filename>/etc/mysql/my.cnf</filename>:</para> - <programlisting language="none"># Instead of skip-networking the default is now to listen only on + <screen># Instead of skip-networking the default is now to listen only on # localhost which is more compatible and is not less secure. -# <emphasis role="bold">bind-address = 127.0.0.1</emphasis></programlisting> +# <emphasis role="bold">bind-address = 127.0.0.1</emphasis></screen> </section> <section xml:id="sda1SqlClient"> @@ -397,17 +398,17 @@ mysql></programlisting> <productname xlink:href="https://www.mysql.com">Mysql</productname> server:</para> - <programlisting language="none">root@goiki:~# aptitude install libmysql-java</programlisting> + <screen>root@goiki:~# aptitude install libmysql-java</screen> <para>This provides the file /usr/share/java/mysql-connector-java-5.1.16.jar and two symbolic links:</para> - <programlisting language="none">goik@goiki:~$ cd /usr/share/java + <screen>goik@goiki:~$ cd /usr/share/java goik@goiki:/usr/share/java$ ls -al mysql* -rw-r--r-- 1 ... 2011 <emphasis role="bold">mysql-connector-java-5.1.16.jar</emphasis> lrwxrwxrwx 1 ... 2011 <emphasis role="bold">mysql-connector-java.jar -> mysql-connector-java-5.1.16.jar</emphasis> -lrwxrwxrwx 1 ... 2011 <emphasis role="bold">mysql.jar -> mysql-connector-java.jar</emphasis></programlisting> +lrwxrwxrwx 1 ... 2011 <emphasis role="bold">mysql.jar -> mysql-connector-java.jar</emphasis></screen> <para>A second approach works by adding the following dependency to your Maven project:</para> diff --git a/Doc/Sda1/sax.xml b/Doc/Sda1/sax.xml index 2a845fb09..3cb5bef37 100644 --- a/Doc/Sda1/sax.xml +++ b/Doc/Sda1/sax.xml @@ -471,7 +471,7 @@ public class ElementCountDriver { <para>Processing the catalog example instance yields:</para> - <programlisting language="none">Opening Document + <screen>Opening Document <emphasis role="bold">Opening "catalog"</emphasis> <co xml:id="programlisting_catalog_output"/> Content " @@ -491,7 +491,7 @@ Content " Closing "catalog" Closing Document <emphasis role="bold">Document contains 3 elements</emphasis> <co - xml:id="programlisting_catalog_elementcount"/></programlisting> + xml:id="programlisting_catalog_elementcount"/></screen> <calloutlist> <callout arearefs="programlisting_catalog_output"> @@ -642,8 +642,8 @@ public class MyErrorHandler implements ErrorHandler { <para>Our error handler method gets called yielding an informative message:</para> - <programlisting language="none">[Fatal Error] line 5, column -1:Expected "</item>" to terminate -element starting on line 4.</programlisting> + <screen>[Fatal Error] line 5, column -1:Expected "</item>" to terminate +element starting on line 4.</screen> <para>This error output is achieved by <emphasis>registering</emphasis> an instance of <classname>sax.stat.v2.MyErrorHandler</classname> to the @@ -780,14 +780,14 @@ public class AttribEventHandler extends DefaultHandler { documents and providing a list of XML Elements being contained within:</para> - <programlisting language="none">Opening Document + <screen>Opening Document <emphasis role="bold">Opening "catalog"</emphasis> Content " " <emphasis role="bold">Opening "item"</emphasis> Content "Swinging headset" Closing "item" -Content " ...</programlisting> +Content " ...</screen> <para>If an element like e.g. <tag class="starttag">item</tag> appears multiple times it will also be written to standard @@ -826,7 +826,7 @@ Content " ...</programlisting> contained <emphasis role="bold">excluding duplicates</emphasis>. The intended output for the above example is:</para> - <programlisting language="none">List of elements: {content date from memo name para subject surname to }</programlisting> + <screen>List of elements: {content date from memo name para subject surname to }</screen> <para>The corresponding handler should be implemented in a re-usable way. Thus if different XML documents are being handled @@ -959,8 +959,8 @@ public class Driver { subject. Write a SAX application to achieve the following output:</para> - <programlisting language="none">Sender: Martin Goik -Subject: Firewall problems</programlisting> + <screen>Sender: Martin Goik +Subject: Firewall problems</screen> <para>Hint: The callback implementation of <methodname>org.xml.sax.helpers.DefaultHandler.characters(char[],int,int)</methodname> @@ -1112,9 +1112,9 @@ public class MemoViewHandler extends DefaultHandler { <para>Write an application which produces the following list of non-conforming images:</para> - <programlisting language="none">Found image element 'a.gif' having attribute align='top' + <screen>Found image element 'a.gif' having attribute align='top' Found image element 'c.gif' having attribute align='bottom' -</programlisting> +</screen> <para>Write your application in a testable fashion and provide unit test(s).</para> @@ -1216,8 +1216,8 @@ Found image element 'c.gif' having attribute align='bottom' invocation the above instance shall yield the following output:</para> - <programlisting language="none">Document contains 2 block level <img> elements. -Document contains 2 inline <img> elements.</programlisting> + <screen>Document contains 2 block level <img> elements. +Document contains 2 inline <img> elements.</screen> <para>Write your application in a testable fashion and provide unit test(s).</para> @@ -1324,7 +1324,7 @@ Document contains 2 inline <img> elements.</programlisting> xlink:href="https://xerces.apache.org/xml-commons/components/resolver/tips.html">CatalogManager.properties</link> defining XML catalogs to be used and additional parameters:</para> - <programlisting language="none"># Catalogs are relative to this properties file + <literallayout># Catalogs are relative to this properties file relative-catalogs=false # Catalog list @@ -1332,7 +1332,7 @@ catalogs=\ /.../plugins/com.oxygenxml.editor_.../frameworks/xhtml/dtd/xhtmlcatalog.xml;\ /.../plugins/com.oxygenxml.editor_.../frameworks/xhtml11/dtd/xhtmlcatalog.xml # PUBLIC in favour of SYSTEM -prefer=public</programlisting> +prefer=public</literallayout> <para>This configuration uses some catalogs from the <trademark>Oxygen</trademark> <trademark>Eclipse</trademark> plugin. We @@ -1402,7 +1402,7 @@ public class NamespaceEventHandler extends DefaultHandler { being introduced only for demonstration purposes belonging to the default namespace. The result reads:</para> - <programlisting language="none">Opening Element rawName='xsl:stylesheet' + <screen>Opening Element rawName='xsl:stylesheet' namespaceUri='http://www.w3.org/1999/XSL/Transform' localName='stylesheet' -------------------------------------------- @@ -1416,7 +1416,7 @@ localName='block' -------------------------------------------- Opening Element rawName='HTML' namespaceUri='' -localName='HTML'</programlisting> +localName='HTML'</screen> <para>Now the parser tells us to which namespace a given element node belongs to. A XSLT engine for example uses this information to build two @@ -1720,7 +1720,7 @@ INSERT INTO Description VALUES('instantTent', 2, 'Exclusive WeatherTec system.') output for the previous <xref linkend="glo_XSL"/> example shall look like:</para> - <programlisting language="none">Namespace '<emphasis role="bold">http://www.w3.org/1999/xhtml</emphasis>' contains: + <screen>Namespace '<emphasis role="bold">http://www.w3.org/1999/xhtml</emphasis>' contains: <head> (1 occurrence) <p> (1 occurrence) <h1> (2 occurrences) @@ -1734,7 +1734,7 @@ Namespace '<emphasis role="bold">http://www.w3.org/1999/XSL/Transform</emphasis> <value-of> (1 occurrence) <apply-templates> (1 occurrence) <text> (2 occurrences) -<message> (1 occurrence)</programlisting> +<message> (1 occurrence)</screen> <para>Hint: Counting frequencies and grouping by namespaces may be achieved by using standard Java container implementations of diff --git a/Doc/Sda1/schema.xml b/Doc/Sda1/schema.xml index 1d08fa2a8..b6c30e49d 100644 --- a/Doc/Sda1/schema.xml +++ b/Doc/Sda1/schema.xml @@ -196,7 +196,7 @@ ?></code></emphasis> defines this header as being optional (<emphasis role="bold">should</emphasis>). In addition the <link linkend="gloss_EBNF">EBNF</link> diagram - contains:<programlisting language="none">22] prolog ::= XMLDecl<emphasis + contains:<programlisting language="ebnf">22] prolog ::= XMLDecl<emphasis role="bold">?</emphasis> <co xml:id="co_XmlDeclOptional"/>...</programlisting>The <quote>?</quote> <coref linkend="co_XmlDeclOptional"/> tells us that the header in question may appear once or may be @@ -397,7 +397,7 @@ WHERE ID=1</programlisting> statements with respect to relational databases. It adds a grammar to our XML data thereby enabling validation:</para> - <programlisting language="myxml"><?xml version="1.0" encoding="UTF-8"?> + <programlisting language="xml"><?xml version="1.0" encoding="UTF-8"?> <employee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="<emphasis role="bold">employee.xsd</emphasis>"> <id>21</id> @@ -808,9 +808,9 @@ WHERE ID=1</programlisting> <para>A validating parser thus yields a corresponding error message:</para> - <programlisting language="none">cvc-minInclusive-valid: Value '21' is not facet-valid with respect to minInclusive '200' + <screen>cvc-minInclusive-valid: Value '21' is not facet-valid with respect to minInclusive '200' for type <emphasis role="bold">'#AnonType_idemployee'</emphasis> <co - xml:id="co_ErrAnonTypeEmployee"/></programlisting> + xml:id="co_ErrAnonTypeEmployee"/></screen> <qandaset defaultlabel="qanda" xml:id="sda1QandamMessageErrorType"> <title>The type error message in detail</title> diff --git a/Doc/Sda1/try.xml b/Doc/Sda1/try.xml deleted file mode 100644 index 7c7d7e85f..000000000 --- a/Doc/Sda1/try.xml +++ /dev/null @@ -1,419 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<book version="5.1" xmlns="http://docbook.org/ns/docbook" - xmlns:xlink="http://www.w3.org/1999/xlink" - xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns:m="http://www.w3.org/1998/Math/MathML" - xmlns:html="http://www.w3.org/1999/xhtml" - xmlns:db="http://docbook.org/ns/docbook"> - <info> - <title xml:id="sda1"/> - - <author> - <personname><firstname/><surname/></personname> - - <affiliation> - <orgname/> - </affiliation> - </author> - - <pubdate/> - </info> - - <chapter xml:id="company"> - <title>Data models</title> - - <para>Wanted: A data model to represent entities and their - relationships</para> - - <section xml:id="companyRepresent"> - <title>Representing a company</title> - - <para>Entities to be represented:</para> - - <itemizedlist> - <listitem> - <para>Employee</para> - </listitem> - - <listitem> - <para>Departments</para> - </listitem> - - <listitem> - <para>Projects</para> - </listitem> - - <listitem> - <para>...</para> - </listitem> - </itemizedlist> - - <para>Relationships:</para> - - <itemizedlist> - <listitem> - <para>Each employee is being assigned to exactly one - department</para> - </listitem> - - <listitem> - <para>Each employee may participate in an arbitrary number of - projects. For each project an employee's number of weekly working - hours participation is being defined.</para> - </listitem> - - <listitem> - <para>Each department may have a parent department</para> - </listitem> - </itemizedlist> - - <para>We start creating a database table representing - <code>Department</code> entities:</para> - - <programlisting>CREATE TABLE Department( - id BIGINT PRIMARY KEY <co linkends="departmentTable-1" - xml:id="deptTableSurrogateKey"/> - ,name CHAR(20) NOT NULL UNIQUE <co linkends="departmentTable-2" - xml:id="deptTableBusinessKey"/> -)</programlisting> - - <calloutlist> - <callout arearefs="deptTableSurrogateKey" xml:id="departmentTable-1"> - <para>The <code>Department</code> table's - <emphasis>surrogate</emphasis> key</para> - </callout> - - <callout arearefs="deptTableBusinessKey" xml:id="departmentTable-2"> - <para>The <code>Department</code> table's unique name, e.g. - <quote>Sales</quote>.</para> - </callout> - </calloutlist> - - <para>Each <code>Employee</code> is being affiliated (see <coref - linkend="employeeAffiliation"/> below) with exactly one - <code>Department</code>. Its fax number is the only nullable - property.</para> - - <programlisting>CREATE TABLE Employee ( - id BIGINT PRIMARY KEY - ,number INTEGER NOT NULL UNIQUE - ,name CHAR(20) NOT NULL - ,surname CHAR(20) NOT NULL - ,department BIGINT NOT NULL REFERENCES Department <co - xml:id="employeeAffiliation"/> - ,telephone CHAR(4) NOT NULL - ,fax CHAR(4) -);</programlisting> - - <qandaset> - <qandadiv> - <qandaentry> - <question> - <para>Explain the (<acronym linkend="gloss_Sql">SQL</acronym>) - technical difference between a <code>PRIMARY KEY</code> and a - UNIQUE <acronym linkend="gloss_SqlDdl">DDL</acronym> statement - with respect to data integrity constraints.</para> - </question> - - <answer> - <para>A primary key attribute must not be <code>NULL</code> and - defines a unique set of attribute values within a given table. A - UNIQUE attribute allows <code>NULL</code> values and may thus be - complemented by a NOT NULL constraint to form a <link - linkend="glossCandidateKey">candidate key</link> for the sake of - allowing to identify <emphasis>all</emphasis> datasets of a - given table..</para> - </answer> - </qandaentry> - </qandadiv> - - <qandadiv> - <qandaentry> - <question> - <para>Explain the above notion of <emphasis>surrogate - key</emphasis>s, business keys and their roles for application - developers. Why should surrogate be preferred when defining - foreign key targets?</para> - </question> - - <answer> - <para>A surrogate key is being defined as a technical means to - reference objects on database level by foreign keys in a - <quote>sound </quote> manner. Its values are not intended to be - visible to end users and should thus not appear in e.g. <abbrev - linkend="gloss_Gui">GUI</abbrev> components. This allows - surrogate keys to be implemented by immutable attributes.</para> - - <para>On contrary business keys should not be used as reference - targets. This avoids transactional hassles being imposed by e.g. - <code>ON UPDATE CASCADE</code> and other transitive foreign key - attribute updates caused by changing business key values. The - following variant uses a business key as a foreign key - target:</para> - - <programlisting>CREATE TABLE Department( - id BIGINT PRIMARY KEY - ,name CHAR(20) NOT NULL UNIQUE <co linkends="cascadeBusinessKey-1" - xml:id="employeeDepartmentBusiness"/> -); - -CREATE TABLE Employee ( - id BIGINT PRIMARY KEY - ,number INTEGER NOT NULL UNIQUE - ,name CHAR(20) NOT NULL - ,surname CHAR(20) NOT NULL - ,department CHAR(20) NOT NULL REFERENCES Department(name) <co - linkends="cascadeBusinessKey-2" - xml:id="employeeDepartmentCascade"/> - ,telephone CHAR(4) NOT NULL - ,fax CHAR(4) -);</programlisting> - - <calloutlist> - <callout arearefs="employeeDepartmentBusiness" - xml:id="cascadeBusinessKey-1"> - <para>Defining a business key</para> - </callout> - - <callout arearefs="employeeDepartmentCascade" - xml:id="cascadeBusinessKey-2"> - <para>Referencing a business key</para> - </callout> - </calloutlist> - - <para>If we update a <code>Department.name</code> attribute, all - <code>Employee</code> datasets referencing this department have - to be changed as well. Thus the intended change of a single - attribute possibly causes a whole bunch of transitive updates - adding to potential lock conflicts in a concurrent database - application .</para> - - <para>If being intended though we should at least add a CASCADE - clause;</para> - - <programlisting>CREATE TABLE Employee ( -... - ,department CHAR(20) NOT NULL REFERENCES Department(name) - <emphasis role="bold">ON UPDATE CASCADE</emphasis> -...</programlisting> - </answer> - </qandaentry> - </qandadiv> - </qandaset> - - <para>We now add projects <coref linkend="projectEntity"/> and employee - affiliations to projects <coref linkend="projectAffiliation"/>:</para> - - <programlisting>CREATE TABLE Project ( <co xml:id="projectEntity"/> - id BIGINT PRIMARY KEY - ,number INTEGER NOT NULL UNIQUE - ,name CHAR(20) NOT NULL UNIQUE - ,status SMALLINT NOT NULL - ,CHECK (status IN (1,2,3,3)) -- planned, active, on hold, finished -- -); - -CREATE TABLE EmployeeProject ( <co xml:id="projectAffiliation"/> - employee BIGINT NOT NULL REFERENCES Employee - ,project BIGINT NOT NULL REFERENCES Project - ,PRIMARY KEY(employee, project) - ,weeklyHours INTEGER NOT NULL -)</programlisting> - - <qandaset> - <qandadiv> - <qandaentry> - <question> - <para>The property <code>status</code> has been implemented as - type <code>SMALLINT</code>. Consider the following - alternative:</para> - - <programlisting>CREATE TABLE Project ( - id BIGINT PRIMARY KEY - ,number INTEGER NOT NULL UNIQUE - ,name CHAR(20) NOT NULL UNIQUE - ,<emphasis role="bold">status CHAR(10) NOT NULL</emphasis> - ,CHECK (<emphasis role="bold">status IN ('planned', 'active', 'onHold','finished')</emphasis>) -);</programlisting> - - <para>What are the pros and cons?</para> - </question> - - <answer> - <glosslist> - <glossentry> - <glossterm>Advantage of CHAR(10) implementation</glossterm> - - <glossdef> - <para>Data residing in a database can be easily retrieved - by <code>SELECT</code> statements without having - difficulties interpreting both <code>WHERE </code>clauses - and result sets:</para> - - <programlisting>SELECT * FROM Project -WHERE status = 'active'</programlisting> - - <para>On contrary using the <code>SMALLINT</code> - implementation requires: </para> - - <programlisting>SELECT * FROM Project -WHERE status = 2 -- any clue about status definitions when lacking documentation? --</programlisting> - </glossdef> - </glossentry> - - <glossentry> - <glossterm>Advantage of <code>SMALLINT</code> - implementation</glossterm> - - <glossdef> - <para>When building applications our <code>SMALLINT</code> - status field will best be mapped as an user defined - <code>enum</code>:</para> - - <programlisting>public enum ProjectStatus { - planned - ,active - ,onHold - ,finished; -}</programlisting> - - <para>This allows for easily understandable switch - statements:</para> - - <programlisting>ProjectStatus status; - ... -switch (status) { - case planned: - ... - break; - - case active: - ... - break; - default: - ... -} -...</programlisting> - - <para>In fact starting from Java 1.7 the above - <code>switch</code> statement will work for - <classname>String</classname> objects as well:</para> - - <programlisting>String status; - ... -switch (status) { - case "planned": - ... - break; - - case "active": - ... - break; - default: - ... -}</programlisting> - - <para>But despite being syntactic sugar the above code - actually implements an <code>if ... else if ... - else</code> block relying on - <methodname>String.equals()</methodname> rather than a - true integer based jump table:</para> - - <programlisting>String status; - ... - if (status.equals("planned")) { - ... - } else if (status.equals("active")) { - } else { - ... - } -}</programlisting> - </glossdef> - </glossentry> - </glosslist> - </answer> - </qandaentry> - </qandadiv> - </qandaset> - </section> - - <section> - <title>A media store</title> - - <para>The media store example has been chosen as a second main example - in addition to the company database. It will be developed by you in a - step by step manner thereby exploring lecture related features and - technological standards.</para> - - <para>We have outlined a schema forming a building block for a company's - internal organization. You are now being expected to develop a data - model suitable to build a media store. After talking to potential - customers the following entities have been identified to be - required:</para> - - <glosslist> - <glossentry> - <glossterm>Album</glossterm> - - <glossdef> - <para>The basic building block to be sold. An album is being - composed of tracks. Each Album does have a name not necessarily - unique across your media store. Albums may be related to - performing artists.</para> - </glossdef> - </glossentry> - - <glossentry> - <glossterm>Track</glossterm> - - <glossdef> - <para>Each song belongs to exactly one Album. The smallest media - item having the following properties:</para> - - <glosslist> - <glossentry> - <glossterm>name</glossterm> - - <glossdef> - <para>A song's name is unique with respect to its - <quote>owning</quote> album.</para> - </glossdef> - </glossentry> - - <glossentry> - <glossterm>format</glossterm> - - <glossdef> - <para>One of <code>mp3</code>, <code>flac</code> or - <code>mp4</code>.</para> - </glossdef> - </glossentry> - </glosslist> - </glossdef> - </glossentry> - - <glossentry> - <glossterm>Artist</glossterm> - - <glossdef> - <para>An artist may participate in arbitrary albums. It shall be - possible to annotate an artist's <quote>lead</quote> role with - respect to an album he/she is being affiliated with.</para> - - <itemizedlist> - <listitem> - <para>name, surname</para> - </listitem> - - <listitem> - <para>sex</para> - </listitem> - </itemizedlist> - </glossdef> - </glossentry> - </glosslist> - </section> - </chapter> - - <xi:include href="glossary.xml" xpointer="element(/1)"/> -</book> diff --git a/Doc/Sda1/xmlintro.xml b/Doc/Sda1/xmlintro.xml index 0251b3e80..5d453901c 100644 --- a/Doc/Sda1/xmlintro.xml +++ b/Doc/Sda1/xmlintro.xml @@ -240,8 +240,8 @@ <userinput><command>xmlparse</command> message.xml</userinput> to start a check:</para> - <programlisting language="none"><errortext>goik>xmlparse wellformed.xml -Parsing was successful</errortext></programlisting> + <screen><errortext>goik>xmlparse wellformed.xml +Parsing was successful</errortext></screen> <para>Various XML related plugins are supplied for the <productname xlink:href="https://eclipse.org">eclipse platform</productname> like the @@ -274,10 +274,10 @@ Parsing was successful</errortext></programlisting> <para>Consequently the parser's output reads:</para> - <programlisting language="none"><errortext>goik>xmlparse omitfrom.xml + <screen><errortext>goik>xmlparse omitfrom.xml file:///ma/goik/workspace/Vorlesungen/Input/Memo/omitfrom.xml:8:3: fatal error org.xml.sax.SAXParseException: The element type "from" -must be terminated by the matching end-tag "</from>". parsing error</errortext></programlisting> +must be terminated by the matching end-tag "</from>". parsing error</errortext></screen> <para>Experienced HTML authors may be confused: In fact HTML is not an XML standard. Instead HTML belongs to the set of SGML applications. SGML is a @@ -297,9 +297,9 @@ must be terminated by the matching end-tag "</from>". parsing error</error <para>The parser echoes:</para> - <programlisting language="none"><computeroutput>file:///ma/goik/workspace/Vorlesungen/Input/Memo/nonest.xml:3:29: + <screen><computeroutput>file:///ma/goik/workspace/Vorlesungen/Input/Memo/nonest.xml:3:29: fatal error org.xml.sax.SAXParseException: The element type "to" must be -terminated by the matching end-tag "</to>". parsing error</computeroutput></programlisting> +terminated by the matching end-tag "</to>". parsing error</computeroutput></screen> <para>This type of error is caused by so called improper nesting of elements: The element <tag class="starttag">from</tag>is closed before the diff --git a/Doc/Sda1/xslt.xml b/Doc/Sda1/xslt.xml index 42451971f..45e623f65 100644 --- a/Doc/Sda1/xslt.xml +++ b/Doc/Sda1/xslt.xml @@ -3,6 +3,7 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" + xmlns:ns="http://docbook.org/ns/transclusion" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook"> @@ -177,8 +178,8 @@ both a <tag>memo</tag> document instance and a style sheet and produces the following output:</para> - <programlisting language="none"><computeroutput>[goik@mupter Memoref]$ xml2xml message.xml memo2sender.xsl -Martin Goik</computeroutput></programlisting> + <screen><computeroutput>[goik@mupter Memoref]$ xml2xml message.xml memo2sender.xsl +Martin Goik</computeroutput></screen> <para>The result is the sender's name <computeroutput>Martin Goik</computeroutput>. We may sketch the transformation principle:</para> @@ -413,8 +414,8 @@ Martin Goik</computeroutput></programlisting> <para>The <abbrev xlink:href="https://www.w3.org/Style/XSL">XSL</abbrev> presented before yields:</para> - <programlisting language="none"><computeroutput>Adam Hacker,Eve Intruder</computeroutput><emphasis - role="bold">,</emphasis></programlisting> + <screen><computeroutput>Adam Hacker,Eve Intruder</computeroutput><emphasis + role="bold">,</emphasis></screen> </figure> <para>Right now we do not bother about the trailing <quote>,</quote> after @@ -651,7 +652,7 @@ Martin Goik</computeroutput></programlisting> attribute is defined in its <tag class="starttag">to</tag> element:</para> - <programlisting language="none"><computeroutput>INSERT INTO Customer (id, name) VALUES ('goik', 'Martin Goik') + <programlisting language="sql"><computeroutput>INSERT INTO Customer (id, name) VALUES ('goik', 'Martin Goik') INSERT INTO Customer (id, name) VALUES ('eve', 'Eve intruder')</computeroutput></programlisting> <qandaset defaultlabel="qanda" xml:id="example_position_last"> @@ -665,7 +666,7 @@ INSERT INTO Customer (id, name) VALUES ('eve', 'Eve intruder')</computeroutput>< interested in a list of recipients avoiding the trailing comma:</para> - <programlisting language="none"><computeroutput>Adam Hacker,Eve Intruder</computeroutput></programlisting> + <literallayout><computeroutput>Adam Hacker,Eve Intruder</computeroutput></literallayout> <para>We may use a <tag class="element">xsl:if</tag> to insert a comma for all but the very last recipient node. This can be @@ -853,8 +854,8 @@ for (int i = 0; i < 10; i++){ xlink:href="https://www.w3.org/Style/XSL">XSL</abbrev> processor uses a default formatting rule instead:</para> - <programlisting language="none"><computeroutput>Thanks for your excellent work.Our firewall is definitely -broken! This bug has been reported by the sender.</computeroutput></programlisting> + <literallayout><computeroutput>Thanks for your excellent work.Our firewall is definitely +broken! This bug has been reported by the sender.</computeroutput></literallayout> <para>We observe that the <code>#PCDATA</code> content strings of the element itself and all (recursive) sub elements get glued together into @@ -885,7 +886,7 @@ broken! This bug has been reported by the sender.</computeroutput></programlisti element type name of a node. During the formatting process we will now see the following warning message:</para> - <programlisting language="none"><computeroutput>Error: No template defined matching element 'content'</computeroutput></programlisting> + <screen><computeroutput>Error: No template defined matching element 'content'</computeroutput></screen> <para>We note that for document nodes <tag class="starttag">xyz</tag><code>foo</code><tag class="endtag">xyz</tag> @@ -1010,11 +1011,11 @@ else { numeration up to 10. Higher numbers shall be displayed in ordinary decimal notation:</para> - <programlisting language="none"><computeroutput>I:Adam Hacker + <screen><computeroutput>I:Adam Hacker II:Eve intruder III: ... IV: ... -...</computeroutput></programlisting> +...</computeroutput></screen> <para>Though <abbrev xlink:href="https://www.w3.org/Style/XSL">XSL</abbrev> offers <link @@ -1527,7 +1528,8 @@ you need some </emphasis><em>time</em><emphasis role="bold">.</empha acting on mixed content models is defined to match <emphasis>any</emphasis> sub element nodes:</para> - <programlisting language="none">select="text()|<emphasis role="bold">*</emphasis>"</programlisting> + <programlisting language="xpath">select="text()|<emphasis + role="bold">*</emphasis>"</programlisting> </listitem> <listitem> @@ -2342,8 +2344,8 @@ Jack Eve Jude <----Tolstoi----> <co generic <link xlink:href="https://en.wikipedia.org/wiki/Tree_traversal#Depth-first_search">depth-first traversal</link> of arbitrary <xref linkend="glo_XML"/> - input documents.</parameter><programlisting - language="xsl"><xsl:template match="/ | @* | node()"> + input documents.</parameter> + <programlisting language="xsl"><xsl:template match="/ | @* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()" /> </xsl:copy> diff --git a/Doc/Sda2/jpa.xml b/Doc/Sda2/jpa.xml index 48268736e..e09e5ffe4 100644 --- a/Doc/Sda2/jpa.xml +++ b/Doc/Sda2/jpa.xml @@ -3,6 +3,7 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" + xmlns:ns="http://docbook.org/ns/transclusion" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook"> @@ -253,7 +254,7 @@ Searching the Maven repository for <code>hibernate-entitymanager</code> provides a suitable artifact:</para> - <programlisting language="none"><dependency> + <programlisting language="xml"><dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <version>5.1.0.Final</version> @@ -566,7 +567,7 @@ public class User { <classname>hibintro.v1.model.User</classname> class lacking integrity constraints completely:</para> - <programlisting language="none">package hibintro.v1.model; + <programlisting language="java">package hibintro.v1.model; @Entity public class User { String uid; @@ -600,7 +601,7 @@ public class User { linkend="commitTransaction"/> of a transaction being derived from that session:</para> - <programlisting language="none">package hibintro.v1.run; + <programlisting language="java">package hibintro.v1.run; ... public class PersistSingleUser { @@ -621,12 +622,12 @@ public class User { <para>Executing the above code yields a runtime exception:</para> - <programlisting language="none">Exception in thread "main" java.lang.ExceptionInInitializerError + <screen>Exception in thread "main" java.lang.ExceptionInInitializerError at myhibernate.intro.run.PersistUser.main(PersistUser.java:14) Caused by: org.hibernate.AnnotationException: <emphasis role="bold">No identifier specified for entity: myhibernate.intro.model.User</emphasis> ... at myhibernate.intro.util.HibernateUtil.buildConfiguration(HibernateUtil.java:17) - at myhibernate.intro.util.HibernateUtil.<clinit>(HibernateUtil.java:9)</programlisting> + at myhibernate.intro.util.HibernateUtil.<clinit>(HibernateUtil.java:9)</screen> <para>This runtime error is a little bit cryptic. The missing <quote>identifier</quote> refers to the absence of a primary key @@ -636,7 +637,7 @@ public class User { <classname>javax.persistence.Id</classname> annotation <coref linkend="primaryKeyDefinition"/>:</para> - <programlisting language="none">package hibintro.v1.model; + <programlisting language="java">package hibintro.v1.model; import javax.persistence.Entity; <emphasis role="bold">import javax.persistence.Id;</emphasis> @@ -658,7 +659,7 @@ public class User { statements in <xref linkend="hibernateConfigurationFile"/> Hibernate shows us the corresponding <code>INSERT</code> statement:</para> - <programlisting language="none">Hibernate: + <programlisting language="sql">Hibernate: insert into User @@ -676,7 +677,7 @@ public class User { <title>Database schema mapping instances of <classname>hibintro.v1.model.User</classname>.</title> - <programlisting language="none">CREATE TABLE User ( + <programlisting language="sql">CREATE TABLE User ( uid VARCHAR(255) NOT NULL PRIMARY KEY, cname VARCHAR(255) ) </programlisting> @@ -696,7 +697,7 @@ public class User { <figure xml:id="loadByClassAndPrimaryKey"> <title>Loading a single object by a primary key value.</title> - <programlisting language="none">package hibintro.v1.run; + <programlisting language="java">package hibintro.v1.run; ... public class RetrieveSingleUser { ... @@ -716,7 +717,7 @@ public class User { <para>This retrieves the expected result. Buried in other log messages we find the following SQL <quote>background</quote> statement:</para> - <programlisting language="none">... + <screen>... INFO: HHH000232: Schema update complete Hibernate: <emphasis role="bold">select @@ -727,7 +728,7 @@ public class User { where user0_.uid=?</emphasis> - Found user 'Martin Goik'</programlisting> + Found user 'Martin Goik'</screen> <qandaset defaultlabel="qanda" xml:id="quandaentry_MetodNullIfNoexist"> <title>Choosing the correct method</title> @@ -751,7 +752,7 @@ public class User { <classname>org.hibernate.ObjectNotFoundException</classname> :<coref linkend="loadUserObjectNotFoundException"/></para> - <programlisting language="none">Hibernate: + <screen>Hibernate: select user0_.uid as uid0_0_, user0_.cname as cname0_0_ @@ -766,7 +767,7 @@ public class User { at hibintro.v1.model.User_$$_javassist_0.getCname(User_$$_javassist_0.java) at hibintro.v1.run.RetrieveSingleUser.main(<emphasis role="bold">RetrieveSingleUser.java:35</emphasis>)<co xml:id="exceptionOnGetCname"/> - </programlisting> + </screen> <para>Due to <coref linkend="exceptionOnGetCname"/> the exception is being triggered by the <code>getCname()</code> @@ -781,7 +782,7 @@ public class User { method which actually returns <code>null</code> in case a primary key value does not exist:</para> - <programlisting language="none">... final User u = (User) session.get(User.class, "goik2"); + <programlisting language="java">... final User u = (User) session.get(User.class, "goik2"); if (null == u ) { System.out.println("No such user having key value 'goik2'"); ...</programlisting> @@ -798,7 +799,7 @@ public class User { database with additional <classname>hibintro.v1.model.User</classname> instances:</para> - <programlisting language="none">package hibintro.v1.run; + <programlisting language="java">package hibintro.v1.run; ... public class PersistUsers { ... @@ -825,7 +826,7 @@ public class User { instances by <abbrev xlink:href="https://docs.jboss.org/hibernate/orm/4.1/manual/en-US/html/ch16.html">HQL</abbrev>.</title> - <programlisting language="none">package hibintro.v1.run; + <programlisting language="java">package hibintro.v1.run; ... public class RetrieveAll { ... @@ -843,9 +844,9 @@ public class User { linkend="glo_HQL"/> query returns a set of <classname>hibintro.v1.model.User</classname> instances:</para> - <programlisting language="none">uid=eve, Eve Briggs - uid=goik, Martin Goik - uid=wings, Fred Wings</programlisting> + <screen>uid=eve, Eve Briggs +uid=goik, Martin Goik +uid=wings, Fred Wings</screen> <qandaset defaultlabel="qanda" xml:id="quandaentry_AnalyzeHqlResult"> <title><xref linkend="glo_HQL"/> and <xref linkend="glo_SQL"/>, @@ -858,7 +859,7 @@ public class User { For this purpose our query actually resembles standard <xref linkend="glo_SQL"/> <coref linkend="hqlWithSelect"/>:</para> - <programlisting language="none">final Query searchUsers = session.createQuery("<emphasis + <programlisting language="java">final Query searchUsers = session.createQuery("<emphasis role="bold">select uid, cname from User</emphasis>" <co xml:id="hqlWithSelect"/>); final Object queryResult <co xml:id="queryResultFromSelect"/>= searchUsers.list();</programlisting> @@ -875,7 +876,7 @@ public class User { <answer> <para>A possible implementation reads:</para> - <programlisting language="none">package hibintro.v1.run; + <programlisting language="java">package hibintro.v1.run; ... public class GetUsersAsAttributes { ... @@ -911,7 +912,7 @@ public class User { result set by an <xref linkend="glo_SQL"/> style <code>WHERE</code> clause:</para> - <programlisting language="none"> final List<User> users = (List<User>) session.createQuery( + <programlisting language="java"> final List<User> users = (List<User>) session.createQuery( "<emphasis role="bold">from User u where u.cname like '%e%'</emphasis>").list(); for (final User u: users) { System.out.println("Found user '" + u.getCname() + "'"); @@ -920,8 +921,8 @@ public class User { <para>This time we receive a true subset of <classname>hibintro.v1.model.User</classname> instances:</para> - <programlisting language="none">Found user 'Eve Briggs' - Found user 'Fred Wings'</programlisting> + <screen>Found user 'Eve Briggs' + Found user 'Fred Wings'</screen> </section> <section xml:id="criteriaBasedQueries"> @@ -1132,7 +1133,7 @@ public class User { <tr> <td valign="top"><emphasis role="bold">Java</emphasis></td> - <td valign="top"><programlisting language="none">package hibintro.v4; + <td valign="top"><programlisting language="java">package hibintro.v4; ... public class PersistSingleUser { @@ -1146,12 +1147,12 @@ public class User { <tr> <td valign="top"><emphasis role="bold">Log</emphasis></td> - <td><programlisting language="none">Exception in thread "main" javax.persistence.PersistenceException: + <td><screen>Exception in thread "main" javax.persistence.PersistenceException: org.hibernate.PropertyValueException: <emphasis role="bold">not-null property references a null or transient value</emphasis> : hibintro.v4.User.cname at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1692) ... - at hibintro.v4.PersistSingleUser.main(PersistSingleUser.java:22)</programlisting></td> + at hibintro.v4.PersistSingleUser.main(PersistSingleUser.java:22)</screen></td> </tr> </informaltable> @@ -1230,7 +1231,7 @@ public class User { xlink:href="https://en.wikipedia.org/wiki/Data_definition_language">DDL</abbrev> reads:</para> - <programlisting language="none">CREATE TABLE User ( + <programlisting language="sql">CREATE TABLE User ( uidNumber INT NOT NULL PRIMARY KEY, cname VARCHAR(255) NOT NULL, uid VARCHAR(255) NOT NULL UNIQUE @@ -1546,7 +1547,7 @@ public class User { <tr> <td valign="top"><emphasis role="bold">Java</emphasis></td> - <td valign="top"><programlisting language="none">package hibintro.v9; + <td valign="top"><programlisting language="java">package hibintro.v9; import org.hibernate.type.Type; ... @@ -1564,7 +1565,7 @@ public class User { <tr> <td valign="top"><emphasis role="bold">Sql</emphasis></td> - <td><programlisting language="none">CREATE TABLE User ( + <td><programlisting language="sql">CREATE TABLE User ( uidNumber int(11) NOT NULL PRIMARY KEY, active char(1) NOT NULL, cname varchar(255) DEFAULT NULL, @@ -1601,7 +1602,7 @@ public class User { <para>Consider the following <xref linkend="glo_XML"/> dataset example:</para> - <programlisting language="none"><catalog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="cd.xsd"> + <programlisting language="xml"><catalog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="cd.xsd"> <cd id="12"> <title>Empire Burlesque</title> <artist>Bob Dylan</artist> @@ -1654,7 +1655,7 @@ public class User { </question> <answer> - <programlisting language="none"><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> + <programlisting language="xml"><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:simpleType name="money"> <xs:restriction base="xs:decimal"> @@ -1850,7 +1851,7 @@ public class User { <tr> <td valign="top"><emphasis role="bold">Java</emphasis></td> - <td valign="top"><programlisting language="none">package inherit.v1; + <td valign="top"><programlisting language="java">package inherit.v1; ... @Entity @Inheritance(strategy=InheritanceType.<emphasis role="bold">SINGLE_TABLE</emphasis>) <co @@ -1865,15 +1866,15 @@ public class User { xml:id="billingMapSingleTableIdGenerated"/> public Long getId() ... @Column(nullable = false, length = 32)public final String getNumber() ... @Temporal(TemporalType.TIMESTAMP) - @Column(nullable = false) public Date getCreated() ...</programlisting><programlisting - language="java">package inherit.v1; + @Column(nullable = false) public Date getCreated() ...</programlisting> + <programlisting language="java">package inherit.v1; ... @Entity @DiscriminatorValue(value = "Credit card" <co xml:id="billingMapSingleTableDiscriminatorCredit"/>) public class CreditCard extends BillingDetails { - ... //Nothing JPA related happens here</programlisting><programlisting - language="java">package inherit.v1; + ... //Nothing JPA related happens here</programlisting> + <programlisting language="java">package inherit.v1; ... @Entity @DiscriminatorValue(value = "Bank account" <co @@ -1983,7 +1984,7 @@ public class User { <figure xml:id="insertCreditBank"> <title>Inserting payment information</title> - <programlisting language="none">package inherit.v1; + <programlisting language="java">package inherit.v1; ... public class Persist { public static void main(String[] args) throws ParseException { @@ -2014,7 +2015,7 @@ public class User { <tr> <td valign="top"><emphasis role="bold">Java</emphasis></td> - <td valign="top"><programlisting language="none">package inherit.v1; + <td valign="top"><programlisting language="java">package inherit.v1; ... public class RetrieveCredit { public static void main(String[] args) { @@ -2077,7 +2078,7 @@ public class User { <tr> <td valign="top"><emphasis role="bold">Java</emphasis></td> - <td valign="top"><programlisting language="none">package inherit.v1; + <td valign="top"><programlisting language="java">package inherit.v1; ... public class RetrieveAll { ... @@ -2134,7 +2135,7 @@ public class User { <tr> <td valign="top"><emphasis role="bold">Java</emphasis></td> - <td valign="top"><programlisting language="none">package inherit.v2; + <td valign="top"><programlisting language="java">package inherit.v2; ... @Entity @DiscriminatorValue(value = "Bank account") public class BankAccount extends BillingDetails { @@ -2167,7 +2168,7 @@ public class User { <tr> <td valign="top"><emphasis role="bold">Java</emphasis></td> - <td valign="top"><programlisting language="none">package inherit.v2; + <td valign="top"><programlisting language="java">package inherit.v2; ... public class Persist { ... @@ -2280,7 +2281,7 @@ public class User { linkend="strategyJoinedSubclass"/> is being defined in the abstract base class <classname>inherit.joined.v1.BillingDetails</classname>:</para> - <programlisting language="none">package inherit.joined.v1; + <programlisting language="java">package inherit.joined.v1; ... @Entity @Inheritance(strategy=InheritanceType.JOINED) <co @@ -2292,7 +2293,7 @@ public class User { linkend="referenceParentClass"/> to the parent class <classname>inherit.joined.v1.BillingDetails</classname>:</para> - <programlisting language="none">package inherit.joined.v1; + <programlisting language="java">package inherit.joined.v1; ... @Entity @PrimaryKeyJoinColumn(name="parent" <co xml:id="referenceParentClass"/>, referencedColumnName="id") @@ -2334,7 +2335,7 @@ public class User { <tr> <td valign="top"><emphasis role="bold">Java</emphasis></td> - <td valign="top"><programlisting language="none">package inherit.joined.v1; + <td valign="top"><programlisting language="java">package inherit.joined.v1; ... public class RetrieveAll { ... @@ -2392,7 +2393,7 @@ public class User { <answer> <para>We take a look to the database schema:</para> - <programlisting language="none">CREATE TABLE BillingDetails ( + <programlisting language="java">CREATE TABLE BillingDetails ( id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY <co linkends="inheritJoinSqlJava-1" xml:id="inheritJoinSqlJava-1-co"/>, @@ -2576,7 +2577,7 @@ public class User { <para>Consider the following code:</para> - <programlisting language="none">package session1; + <programlisting language="java">package session1; ... public class LoadUser { ... @@ -2612,10 +2613,9 @@ public class User { being read by a different session <coref linkend="rereadInstance_2"/>. This yields the following result:</para> - <programlisting language="none"> first transaction: user.equals(user1):true <coref + <screen>first transaction: user.equals(user1):true <coref linkend="rereadInstance_1"/> - second transaction: user.equals(user2):false <coref - linkend="rereadInstance_2"/></programlisting> +second transaction: user.equals(user2):false <coref linkend="rereadInstance_2"/></screen> <para>The two instances in question definitely represent the same database entity. The two entity managers referring to different @@ -2626,7 +2626,7 @@ public class User { <code>@javax.persistence.Id</code> attribute we may generally define object equality solely based on this at tribute's value:</para> - <programlisting language="none">package session2; + <programlisting language="java">package session2; ... public class User { @@ -2699,7 +2699,7 @@ public class User { any foreign non-identical instance regardless whether it does have a database identity or not. We consider an example:</para> - <programlisting language="none">package session2; + <programlisting language="java">package session2; ... public class CompareNewlyCreated { ... @@ -2778,7 +2778,7 @@ public class User { <title>Implementing <methodname>Object.equals(Object)</methodname> by natural keys</title> - <programlisting language="none">package session3; + <programlisting language="java">package session3; @Entity @Table(uniqueConstraints={@<emphasis role="bold">UniqueConstraint(columnNames={"uid"}</emphasis>)<co @@ -2915,7 +2915,7 @@ public class User { extensible and allow for method definitions like <code>sendEmail(...)</code>:</para> - <programlisting language="none">public class Email { + <programlisting language="java">public class Email { private String emailAddress; ... @@ -2932,7 +2932,7 @@ public class User { <glossterm>Annotate class Email to be embeddable:</glossterm> <glossdef> - <programlisting language="none">package component.email; + <programlisting language="java">package component.email; <emphasis role="bold">@Embeddable</emphasis> public class Email { @@ -2947,7 +2947,7 @@ public class User { property:</glossterm> <glossdef> - <programlisting language="none">package component.email; + <programlisting language="java">package component.email; ... public class User { @@ -2962,7 +2962,7 @@ public class User { <para>We may now persist <classname>component.email.User</classname> instances:</para> - <programlisting language="none">em.getTransaction().begin(); + <programlisting language="java">em.getTransaction().begin(); { final User u = new User(123, "goik", "Martin Goik"); u.setEmailAddress(new Email("goik@hdm-stuttgart.de")); @@ -2980,7 +2980,7 @@ em.getTransaction().commit(); <para>Consider the following sketch of an <classname>Address</classname> class:</para> - <programlisting language="none">public class Address { + <programlisting language="java">public class Address { private String street; private String city; @@ -3022,7 +3022,7 @@ em.getTransaction().commit(); <para>Users may have multiple email addresses:</para> - <programlisting language="none">public class User { + <programlisting language="java">public class User { Set<Email> email; ...</programlisting> @@ -3030,7 +3030,7 @@ em.getTransaction().commit(); <para>Using embedded values we need an <code>@ElementCollection</code> declaration to achieve a proper mapping:</para> - <programlisting language="none">package component.emails; + <programlisting language="java">package component.emails; ... public class User { ... @@ -3042,7 +3042,7 @@ em.getTransaction().commit(); <para>This will map <classname>component.emails.Email</classname> entries in a separate table:</para> - <programlisting language="none">package component.emails; + <programlisting language="java">package component.emails; ... public class PersistUser { public static void main(String[] args) { diff --git a/Doc/Sda2/ldap.xml b/Doc/Sda2/ldap.xml index 0239e9f30..ed68ce445 100644 --- a/Doc/Sda2/ldap.xml +++ b/Doc/Sda2/ldap.xml @@ -1,166 +1,166 @@ - <chapter xml:id="ldap" version="5.1" xmlns="http://docbook.org/ns/docbook" - xmlns:xlink="http://www.w3.org/1999/xlink" - xmlns:xi="http://www.w3.org/2001/XInclude" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns:m="http://www.w3.org/1998/Math/MathML" - xmlns:html="http://www.w3.org/1999/xhtml" - xmlns:db="http://docbook.org/ns/docbook"> - <title><link linkend="glo_LDAP">ldap</link> and <link - linkend="glo_JDBC">JDBC</link></title> - - <section xml:id="ldapIntro"> - <title>Getting started with <xref linkend="glo_LDAP"/></title> - - <para>Resources:</para> - - <itemizedlist> - <listitem> - <para><link - xlink:href="http://www.zytrax.com/books/ldap/ch3">Schema, - objectclasses and attributes</link></para> - </listitem> +<?xml version="1.0" encoding="UTF-8"?> +<chapter version="5.1" xml:id="ldap" xmlns="http://docbook.org/ns/docbook" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:xi="http://www.w3.org/2001/XInclude" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns:ns="http://docbook.org/ns/transclusion" + xmlns:m="http://www.w3.org/1998/Math/MathML" + xmlns:html="http://www.w3.org/1999/xhtml" + xmlns:db="http://docbook.org/ns/docbook"> + <title><link linkend="glo_LDAP">ldap</link> and <link + linkend="glo_JDBC">JDBC</link></title> + + <section xml:id="ldapIntro"> + <title>Getting started with <xref linkend="glo_LDAP"/></title> + + <para>Resources:</para> + + <itemizedlist> + <listitem> + <para><link xlink:href="http://www.zytrax.com/books/ldap/ch3">Schema, + objectclasses and attributes</link></para> + </listitem> + + <listitem> + <para><link xlink:href="http://www.zytrax.com/books/ldap/apd">LDAP + Glossary</link></para> + </listitem> + </itemizedlist> + </section> + + <section xml:id="ldapSetup"> + <title>Setting up an <productname + xlink:href="http://www.openldap.org">Openldap</productname> server</title> + + <para>The MI department provides an <productname + xlink:href="http://www.openldap.org">Openldap</productname> server at each + workstation (<productname + xlink:href="http://www.ubuntu.com/desktop">Ubuntu</productname> / Linux + only). The <xref linkend="glo_LDAP"/> manager credentials are:</para> + + <glosslist> + <glossentry> + <glossterm>Bind <xref linkend="glo_DN"/>:</glossterm> + + <glossdef> + <para><code>cn=admin,dc=hdm-stuttgart,dc=de</code></para> + </glossdef> + </glossentry> + + <glossentry> + <glossterm>Bind password:</glossterm> + + <glossdef> + <para><code>XYZ</code></para> + </glossdef> + </glossentry> + </glosslist> + + <para>In addition <xref linkend="glo_Soft_ApacheDirectoryStudio"/> is in + place and may serve as a means to conveniently establish <xref + linkend="glo_LDAP"/> communications. Console geeks may use <command + xlink:href="http://tldp.org/HOWTO/LDAP-HOWTO/utilities.html">ldapmodify</command> + and friends.</para> + + <task> + <title>Set up a connection to your local <xref linkend="glo_LDAP"/> + server</title> - <listitem> - <para><link xlink:href="http://www.zytrax.com/books/ldap/apd">LDAP - Glossary</link></para> - </listitem> - </itemizedlist> - </section> + <procedure> + <step> + <para>Open <xref linkend="glo_Soft_ApacheDirectoryStudio"/>.</para> + </step> + + <step> + <para>Activate the <xref linkend="glo_LDAP"/> perspective.</para> + </step> + + <step> + <para>In the <quote>Connections</quote> window right click + <quote>New Connection ...</quote> like in <uri + xlink:href="https://directory.apache.org/studio/users-guide/ldap_browser/gettingstarted_create_connection.html">http://directory.apache.org/studio/users-guide/ldap_browser/gettingstarted_create_connection.html</uri>.</para> + </step> + + <step> + <para>Configure a connection to <parameter + xlink:href="http://www.techterms.com/definition/localhost">localhost</parameter> + using the above bind parameters.</para> + </step> + </procedure> + </task> + </section> + + <section xml:id="ldapSimpleInserts"> + <title>Adding some sample data using <xref + linkend="glo_Soft_ApacheDirectoryStudio"/></title> + + <qandaset defaultlabel="qanda" xml:id="qandaPopulateLdap"> + <title>Populating the <xref linkend="glo_DIT"/></title> + + <qandadiv> + <qandaentry> + <question> + <para>Add two departments <code>billing</code> and + <code>research</code>. Then supply corresponding user entries to + both departments by using the <link + xlink:href="https://directory.apache.org/studio/users-guide/ldap_browser/gettingstarted_browse.html">LDAP + browser view</link>. (As being mentioned previously hardcore + hackers take <link + xlink:href="http://tldp.org/HOWTO/LDAP-HOWTO/utilities.html">this + track</link> neglecting time consuming <xref linkend="glo_GUI"/> + stuff).</para> + + <para>Hint: If you do have limited understanding of <xref + linkend="glo_LDAP"/> classes an schemata you may want to create + entries containing the following <parameter + xlink:href="http://www.zytrax.com/books/ldap/apd/index.html#objectclass">objectClass</parameter> + values:</para> - <section xml:id="ldapSetup"> - <title>Setting up an <productname - xlink:href="http://www.openldap.org">Openldap</productname> - server</title> + <glosslist> + <glossentry> + <glossterm>Departments <code>billing</code> and + <code>research</code>:</glossterm> - <para>The MI department provides an <productname - xlink:href="http://www.openldap.org">Openldap</productname> server at - each workstation (<productname - xlink:href="http://www.ubuntu.com/desktop">Ubuntu</productname> / Linux - only). The <xref linkend="glo_LDAP"/> manager credentials are:</para> - - <glosslist> - <glossentry> - <glossterm>Bind <xref linkend="glo_DN"/>:</glossterm> - - <glossdef> - <para><code>cn=admin,dc=hdm-stuttgart,dc=de</code></para> - </glossdef> - </glossentry> - - <glossentry> - <glossterm>Bind password:</glossterm> - - <glossdef> - <para><code>XYZ</code></para> - </glossdef> - </glossentry> - </glosslist> - - <para>In addition <xref linkend="glo_Soft_ApacheDirectoryStudio"/> is in - place and may serve as a means to conveniently establish <xref - linkend="glo_LDAP"/> communications. Console geeks may use <command - xlink:href="http://tldp.org/HOWTO/LDAP-HOWTO/utilities.html">ldapmodify</command> - and friends.</para> - - <task> - <title>Set up a connection to your local <xref linkend="glo_LDAP"/> - server</title> - - <procedure> - <step> - <para>Open <xref linkend="glo_Soft_ApacheDirectoryStudio"/>.</para> - </step> - - <step> - <para>Activate the <xref linkend="glo_LDAP"/> perspective.</para> - </step> - - <step> - <para>In the <quote>Connections</quote> window right click - <quote>New Connection ...</quote> like in <uri - xlink:href="https://directory.apache.org/studio/users-guide/ldap_browser/gettingstarted_create_connection.html">http://directory.apache.org/studio/users-guide/ldap_browser/gettingstarted_create_connection.html</uri>.</para> - </step> - - <step> - <para>Configure a connection to <parameter - xlink:href="http://www.techterms.com/definition/localhost">localhost</parameter> - using the above bind parameters.</para> - </step> - </procedure> - </task> - </section> + <glossdef> + <itemizedlist> + <listitem> + <para><code + xlink:href="http://www.zytrax.com/books/ldap/ape/#organizationalunit">organizationalUnit</code> + (structural)</para> + </listitem> + </itemizedlist> + </glossdef> + </glossentry> - <section xml:id="ldapSimpleInserts"> - <title>Adding some sample data using <xref - linkend="glo_Soft_ApacheDirectoryStudio"/></title> + <glossentry> + <glossterm>Child user entries below <code>billing</code> and + <code>research</code>:</glossterm> - <qandaset defaultlabel="qanda" xml:id="qandaPopulateLdap"> - <title>Populating the <xref linkend="glo_DIT"/></title> + <glossdef> + <itemizedlist> + <listitem> + <para><code + xlink:href="http://www.zytrax.com/books/ldap/ape/#organizationalperson">organizationalPerson</code> + (structural) and <code + xlink:href="http://www.zytrax.com/books/ldap/ape/#posixaccount">posixAccount</code> + (auxiliary)</para> + </listitem> + </itemizedlist> + </glossdef> + </glossentry> + </glosslist> - <qandadiv> - <qandaentry> - <question> - <para>Add two departments <code>billing</code> and - <code>research</code>. Then supply corresponding user entries to - both departments by using the <link - xlink:href="https://directory.apache.org/studio/users-guide/ldap_browser/gettingstarted_browse.html">LDAP - browser view</link>. (As being mentioned previously hardcore - hackers take <link - xlink:href="http://tldp.org/HOWTO/LDAP-HOWTO/utilities.html">this - track</link> neglecting time consuming <xref linkend="glo_GUI"/> - stuff).</para> - - <para>Hint: If you do have limited understanding of <xref - linkend="glo_LDAP"/> classes an schemata you may want to create - entries containing the following <parameter - xlink:href="http://www.zytrax.com/books/ldap/apd/index.html#objectclass">objectClass</parameter> - values:</para> - - <glosslist> - <glossentry> - <glossterm>Departments <code>billing</code> and - <code>research</code>:</glossterm> - - <glossdef> - <itemizedlist> - <listitem> - <para><code - xlink:href="http://www.zytrax.com/books/ldap/ape/#organizationalunit">organizationalUnit</code> - (structural)</para> - </listitem> - </itemizedlist> - </glossdef> - </glossentry> - - <glossentry> - <glossterm>Child user entries below <code>billing</code> and - <code>research</code>:</glossterm> - - <glossdef> - <itemizedlist> - <listitem> - <para><code - xlink:href="http://www.zytrax.com/books/ldap/ape/#organizationalperson">organizationalPerson</code> - (structural) and <code - xlink:href="http://www.zytrax.com/books/ldap/ape/#posixaccount">posixAccount</code> - (auxiliary)</para> - </listitem> - </itemizedlist> - </glossdef> - </glossentry> - </glosslist> - - <para>Note that required parent <parameter - xlink:href="http://www.zytrax.com/books/ldap/apd/index.html#objectclass">objectClass</parameter> - definitions like <code>top</code> and <code - xlink:href="http://www.zytrax.com/books/ldap/ape/#person">person</code> - are being omitted here. <xref - linkend="glo_Soft_ApacheDirectoryStudio"/> will gracefully add - missing objectClasses on behalf of you automatically. The - subsequent <xref linkend="glo_LDIF"/> dump may serve as a - hint:</para> - - <programlisting language="none">... + <para>Note that required parent <parameter + xlink:href="http://www.zytrax.com/books/ldap/apd/index.html#objectclass">objectClass</parameter> + definitions like <code>top</code> and <code + xlink:href="http://www.zytrax.com/books/ldap/ape/#person">person</code> + are being omitted here. <xref + linkend="glo_Soft_ApacheDirectoryStudio"/> will gracefully add + missing objectClasses on behalf of you automatically. The + subsequent <xref linkend="glo_LDIF"/> dump may serve as a + hint:</para> + + <programlisting language="ldif">... <emphasis role="bold">dn: ou=billing,dc=hdm-stuttgart,dc=de</emphasis> objectClass: top objectClass: organizationalUnit @@ -184,80 +184,79 @@ uidNumber: 1023 ...</programlisting> - <para>Question: What is the ratio behind adding the - <code>objectClass</code> value <code>posixAccount</code>? Hint: - Try to create a corresponding dataset having two persons with - identical names within the same department.</para> - </question> - - <answer> - <para>Your result may look like:</para> - - <figure xml:id="figureLdapTwoDepartments"> - <title>Two departments billing and research populated with - sample user entries</title> - - <screenshot> - <mediaobject> - <imageobject> - <imagedata fileref="Ref/Screen/ldapSampleUsers.png"/> - </imageobject> - </mediaobject> - </screenshot> - </figure> - - <para>Without having the <code>objectClass</code> value - <code>posixAccount</code> the attribute <code>uid</code> would - be disallowed and could thus not be part of our <xref - linkend="glo_DN"/> values. This would leave us with solutions - like:</para> - - <programlisting language="none"><emphasis role="bold">dn: cn=Mee Lapinski,ou=billing,dc=hdm-stuttgart,dc=de</emphasis></programlisting> - - <para>This in turn disallows identical common names (e.g. a - second <personname>Mee Lapinski</personname>) within the same - department. Thus the auxiliary objectClass posixAccount enables - us to introduce additional mandatory <code>uid</code> attribute - being the unique identifier within a given parent scope.</para> - </answer> - </qandaentry> - </qandadiv> - </qandaset> - </section> - - <section xml:id="ldifImportExport"> - <title><xref linkend="glo_LDIF"/> export and import</title> - - <para>This section is intended to get acquainted with <xref - linkend="glo_LDIF"/> representation of <xref linkend="glo_LDAP"/> data - and requires successful completion of <xref - linkend="qandaPopulateLdap"/> as a prerequisite. You may want to read - <uri - xlink:href="http://www.zytrax.com/books/ldap/ch8">http://www.zytrax.com/books/ldap/ch8</uri>.</para> - - <qandaset defaultlabel="qanda" xml:id="qanda_ldifExportImport"> - <title>Exporting, modifying and importing <xref linkend="glo_LDAP"/> - data using the <xref linkend="glo_LDIF"/> interchange - representation.</title> - - <qandadiv> - <qandaentry> - <question> - <para>Export your current database state being left from <xref - linkend="qandaPopulateLdap"/> to an <xref linkend="glo_LDIF"/> - text file.</para> - - <para>Subsequently use this database dump file as a starting - point to create a <xref linkend="glo_LDIF"/> import file adding - a department <quote>pr</quote> (public relations) containing a - user <quote>Paul Simon</quote> with suitable attribute values to - the dataset.</para> - </question> - - <answer> - <para>Adding the new entries in question requires:</para> - - <programlisting language="none">version: 1 + <para>Question: What is the ratio behind adding the + <code>objectClass</code> value <code>posixAccount</code>? Hint: + Try to create a corresponding dataset having two persons with + identical names within the same department.</para> + </question> + + <answer> + <para>Your result may look like:</para> + + <figure xml:id="figureLdapTwoDepartments"> + <title>Two departments billing and research populated with + sample user entries</title> + + <screenshot> + <mediaobject> + <imageobject> + <imagedata fileref="Ref/Screen/ldapSampleUsers.png"/> + </imageobject> + </mediaobject> + </screenshot> + </figure> + + <para>Without having the <code>objectClass</code> value + <code>posixAccount</code> the attribute <code>uid</code> would be + disallowed and could thus not be part of our <xref + linkend="glo_DN"/> values. This would leave us with solutions + like:</para> + + <programlisting language="ldif"><emphasis role="bold">dn: cn=Mee Lapinski,ou=billing,dc=hdm-stuttgart,dc=de</emphasis></programlisting> + + <para>This in turn disallows identical common names (e.g. a second + <personname>Mee Lapinski</personname>) within the same department. + Thus the auxiliary objectClass posixAccount enables us to + introduce additional mandatory <code>uid</code> attribute being + the unique identifier within a given parent scope.</para> + </answer> + </qandaentry> + </qandadiv> + </qandaset> + </section> + + <section xml:id="ldifImportExport"> + <title><xref linkend="glo_LDIF"/> export and import</title> + + <para>This section is intended to get acquainted with <xref + linkend="glo_LDIF"/> representation of <xref linkend="glo_LDAP"/> data and + requires successful completion of <xref linkend="qandaPopulateLdap"/> as a + prerequisite. You may want to read <uri + xlink:href="http://www.zytrax.com/books/ldap/ch8">http://www.zytrax.com/books/ldap/ch8</uri>.</para> + + <qandaset defaultlabel="qanda" xml:id="qanda_ldifExportImport"> + <title>Exporting, modifying and importing <xref linkend="glo_LDAP"/> + data using the <xref linkend="glo_LDIF"/> interchange + representation.</title> + + <qandadiv> + <qandaentry> + <question> + <para>Export your current database state being left from <xref + linkend="qandaPopulateLdap"/> to an <xref linkend="glo_LDIF"/> + text file.</para> + + <para>Subsequently use this database dump file as a starting point + to create a <xref linkend="glo_LDIF"/> import file adding a + department <quote>pr</quote> (public relations) containing a user + <quote>Paul Simon</quote> with suitable attribute values to the + dataset.</para> + </question> + + <answer> + <para>Adding the new entries in question requires:</para> + + <screen>version: 1 dn: ou=pr,dc=hdm-stuttgart,dc=de objectClass: top @@ -274,496 +273,492 @@ homeDirectory: /home/tauras sn: Svetlana uid: tauras - uidNumber: 1028</programlisting> - </answer> - </qandaentry> - </qandadiv> - </qandaset> - </section> + uidNumber: 1028</screen> + </answer> + </qandaentry> + </qandadiv> + </qandaset> + </section> + + <section xml:id="ditSearch"> + <title>Searching the <xref linkend="glo_DIT"/></title> + + <para>Like relational and other database types <xref linkend="glo_LDAP"/> + provides a <link + xlink:href="http://www.zytrax.com/books/ldap/apa/search.html">query + language</link> to filter result entries.</para> + + <qandaset defaultlabel="qanda" xml:id="qanda_firstLdapQuery"> + <title>Filtering child elements</title> + + <qandadiv> + <qandaentry> + <question> + <para>Create <xref linkend="glo_LDAP"/> queries corresponding to + the following descriptions:</para> + + <orderedlist> + <listitem> + <para>All users entries within the whole <xref + linkend="glo_DIT"/> having a gidNumber value of 100.</para> + </listitem> + + <listitem> + <para>All user entries belonging to the billing department + having a <code>uid</code> value greater than 1023.</para> + </listitem> + + <listitem> + <para>All user entries within the whole <xref + linkend="glo_DIT"/> having a common name containing the + substring <quote>ei</quote>.</para> + </listitem> + + <listitem> + <para>All user entries within the whole <xref + linkend="glo_DIT"/> belonging to gidNumber == 100 or having a + <code>uid</code> value starting with letter + <quote>t</quote>.</para> + </listitem> + </orderedlist> + + <para>Hint: <xref linkend="glo_Soft_ApacheDirectoryStudio"/> + allows both for <link + xlink:href="https://directory.apache.org/studio/users-guide/ldap_browser/tools_filter_editor_dialog.html">filtering</link> + and <link + xlink:href="https://directory.apache.org/studio/users-guide/ldap_browser/gettingstarted_search.html">searching</link> + providing nifty features like attribute name completion and syntax + highlighting. For regular searches you may define:</para> + + <itemizedlist> + <listitem> + <para>The <xref linkend="glo_DIT"/> entry to start from being + identified by its <xref linkend="glo_DN"/>.</para> + </listitem> + + <listitem> + <para>The search scope being either of object, one level or + subtree.</para> + </listitem> + + <listitem> + <para>Boolean expressions based on attribute values.</para> + </listitem> + </itemizedlist> + + <para>But yes, I forgot to mention <link + xlink:href="http://tldp.org/HOWTO/LDAP-HOWTO/utilities.html">something</link>.</para> + </question> + + <answer> + <orderedlist> + <listitem> + <para><emphasis role="bold">All users entries within the whole + </emphasis><xref linkend="glo_DIT"/><emphasis role="bold"> + having a gidNumber value of 100.</emphasis></para> + + <para>Solution: <code>(gidNumber=100)</code>, starting from + top of <xref linkend="glo_DIT"/> having subtree scope.</para> + </listitem> + + <listitem> + <para><emphasis role="bold">All user entries belonging to the + billing department having a <code>uid</code> value greater + than 1023.</emphasis></para> + + <para>Solution: <code>(uidNumber>=1024)</code> starting + from <xref linkend="glo_DN"/> + <code>ou=billing,dc=hdm-stuttgart,dc=de</code> and scope + <code>one level</code>.</para> + + <para>Notice the expression <code>(uidNumber>=1024)</code> + in favour of the seemingly equivalent but syntactically + illegal counterpart <code>(uidNumber>1023)</code>.</para> + </listitem> + + <listitem> + <para><emphasis role="bold">All user entries within the whole + </emphasis><xref linkend="glo_DIT"/><emphasis role="bold"> + having a common name containing the substring + <quote>ei</quote>.</emphasis></para> + + <para>Solution: <code>(cn=*ei*)</code>, starting from top of + <xref linkend="glo_DIT"/> having subtree scope.</para> + </listitem> + + <listitem> + <para><emphasis role="bold">All user entries within the whole + </emphasis><xref linkend="glo_DIT"/><emphasis role="bold"> + belonging to gidNumber == 100 or having a <code>uid</code> + value starting with letter <quote>t</quote>.</emphasis></para> + + <para>Solution: <code>(|(gidNumber=100)(uid=t*))</code>, + starting from top of <xref linkend="glo_DIT"/> having subtree + scope.</para> + </listitem> + </orderedlist> + </answer> + </qandaentry> + </qandadiv> + </qandaset> + </section> + + <section xml:id="unix2sql2ldap"> + <title><xref linkend="glo_UNIX"/> to <xref linkend="glo_SQL"/> to <xref + linkend="glo_LDAP"/></title> + + <para><xref linkend="glo_UNIX"/> type operating systems manage users, + groups and their respective relationships in three different text + files:</para> + + <glosslist> + <glossentry> + <glossterm><filename>/etc/passwd</filename></glossterm> + + <glossdef> + <para>Users being defined on the system:</para> + + <literallayout>root:x:0:0:root:/root:/bin/bash +daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin +bin:x:2:2:bin:/bin:/usr/sbin/nologin +sys:x:3:3:sys:/dev:/usr/sbin/nologin +sync:x:4:65534:sync:/bin:/bin/sync +...</literallayout> + + <para>We illustrate the meaning of this <xref linkend="glo_CSV"/> + (actually **character** separated) by examining the first + row:</para> + + <glosslist> + <glossentry> + <glossterm>Column 1, <code>root</code>:</glossterm> + + <glossdef> + <para>The user's unique system name as being entered at + login.</para> + </glossdef> + </glossentry> + + <glossentry> + <glossterm>Column 2, x<code>:</code></glossterm> + + <glossdef> + <para>This field is not being used on current <xref + linkend="glo_UNIX"/> implementations. Historically either the + user's clear text password or its hash value was present here. + For security reasons this attribute has been moved to a third + file <filename>/etc/shadow</filename> being read access + protected to non-administrator users.</para> + </glossdef> + </glossentry> + + <glossentry> + <glossterm>Column 3, <code>0</code>:</glossterm> + + <glossdef> + <para>The user's unique integer numerical + <parameter>uid</parameter> number value.</para> + </glossdef> + </glossentry> + + <glossentry> + <glossterm>Column 4, <code>0</code>:</glossterm> + + <glossdef> + <para>The user's unique primary group integer numerical + <parameter>gid</parameter> number value. The value + <quote>0</quote> here refers to a group root of identical name + being defined in <filename>/etc/group</filename>, see next + section.</para> + </glossdef> + </glossentry> + + <glossentry> + <glossterm>Column 5, <code>root</code>:</glossterm> + + <glossdef> + <para>The user's common name. For a regular user account this + might be <quote>Jim Beam</quote> for example.</para> + </glossdef> + </glossentry> + + <glossentry> + <glossterm>Column 6, <filename>/root</filename>:</glossterm> + + <glossdef> + <para>The user's home directory. Might be /home/beam for a + user <quote>Jim Beam</quote>.</para> + </glossdef> + </glossentry> + + <glossentry> + <glossterm>Column 7, <command>/bin/bash</command>:</glossterm> + + <glossdef> + <para>The user's login shell (command interpreter. This + attribute contains a reference to a command interpreter like + <command>/bin/(t)csh</command>, <command>/bin/ksh</command> + and so on.</para> + </glossdef> + </glossentry> + </glosslist> + </glossdef> + </glossentry> + + <glossentry> + <glossterm><filename>/etc/group</filename></glossterm> + + <glossdef> + <para>This file contains all groups being defined on the + system:</para> + + <literallayout>root:x:0: +daemon:x:1: +bin:x:2: +sys:x:3: +adm:x:4:syslog,mi <co xml:id="secondaryGroupmembership"/> +tty:x:5: +...</literallayout> + + <glosslist> + <glossentry> + <glossterm>Column1,root:</glossterm> + + <glossdef> + <para>The group's name</para> + </glossdef> + </glossentry> + + <glossentry> + <glossterm>Column 2, x:</glossterm> + + <glossdef> + <para>Not used</para> + </glossdef> + </glossentry> + + <glossentry> + <glossterm>Column 3, 4:</glossterm> + + <glossdef> + <para>The group's unique <parameter>gid</parameter> + number</para> + </glossdef> + </glossentry> + + <glossentry> + <glossterm>Column 4, <code>syslog,mi</code>:</glossterm> + + <glossdef> + <para>The set <code>{syslog,mi}</code> <coref + linkend="secondaryGroupmembership"/> defines secondary group + memberships: These two users will belong to the group + <code>adm</code> in addition to their respective primary group + definition.</para> + </glossdef> + </glossentry> + </glosslist> + </glossdef> + </glossentry> + </glosslist> + + <qandaset defaultlabel="qanda" xml:id="qandUnixToSqlToLdap"> + <title>Exporting and importing data</title> + + <qandadiv> + <qandaentry> + <question> + <para>Write two applications being able to perform the following + tasks:</para> + + <orderedlist> + <listitem> + <para>Import the previously described UNIX user and group data + ton an RDBMS using <xref linkend="glo_JDBC"/>. You will have + to define a suitable SQL schema first.</para> + </listitem> + + <listitem> + <para>Transfer RDBMS data to your local <xref + linkend="glo_LDAP"/> server using <link + xlink:href="https://docs.oracle.com/javase/jndi/tutorial/ldap/misc/url.html">JNDI</link>.</para> + </listitem> + </orderedlist> + </question> + + <answer> + <annotation role="make"> + <para role="eclipse">Sda2/UnixSqlLdap/Jndi/Unix2Rdbms</para> + </annotation> + + <annotation role="make"> + <para role="eclipse">Sda2/UnixSqlLdap/Jndi/Rdbms2Ldap</para> + </annotation> + </answer> + </qandaentry> + </qandadiv> + </qandaset> + </section> + + <section xml:id="transactionsInJdbc"> + <title>Transactions in <xref linkend="glo_JDBC"/></title> + + <para>You may review some remarks on SQL standard isolation level + definitions:</para> + + <itemizedlist> + <listitem> + <para><xref linkend="glo_Javadoc"/>:</para> + + <itemizedlist> + <listitem> + <para><link + xlink:href="https://docs.oracle.com/javase/8/docs/api/java/sql/Connection.html#TRANSACTION_READ_UNCOMMITTED">TRANSACTION_READ_UNCOMMITTED</link></para> + </listitem> - <section xml:id="ditSearch"> - <title>Searching the <xref linkend="glo_DIT"/></title> + <listitem> + <para><link + xlink:href="https://docs.oracle.com/javase/8/docs/api/java/sql/Connection.html#TRANSACTION_READ_COMMITTED">TRANSACTION_READ_COMMITTED</link></para> + </listitem> - <para>Like relational and other database types <xref - linkend="glo_LDAP"/> provides a <link - xlink:href="http://www.zytrax.com/books/ldap/apa/search.html">query - language</link> to filter result entries.</para> + <listitem> + <para><link + xlink:href="https://docs.oracle.com/javase/8/docs/api/java/sql/Connection.html#TRANSACTION_REPEATABLE_READ">TRANSACTION_READ_REPEATABLE_READ</link></para> + </listitem> - <qandaset defaultlabel="qanda" xml:id="qanda_firstLdapQuery"> - <title>Filtering child elements</title> + <listitem> + <para><link + xlink:href="https://docs.oracle.com/javase/8/docs/api/java/sql/Connection.html#TRANSACTION_SERIALIZABLE">TRANSACTION_READ_SERIALIZABLE</link></para> + </listitem> + </itemizedlist> + </listitem> - <qandadiv> - <qandaentry> - <question> - <para>Create <xref linkend="glo_LDAP"/> queries corresponding to - the following descriptions:</para> + <listitem> + <para><link + xlink:href="http://www.oracle.com/technetwork/issue-archive/2005/05-nov/o65asktom-082389.html">On + Transaction Isolation Levels (Oracle)</link></para> + </listitem> - <orderedlist> - <listitem> - <para>All users entries within the whole <xref - linkend="glo_DIT"/> having a gidNumber value of 100.</para> - </listitem> + <listitem> + <para><link + xlink:href="https://technet.microsoft.com/en-us/library/ms378149(v=sql.110).aspx">Understanding + Isolation Levels (Microsoft)</link></para> + </listitem> + </itemizedlist> - <listitem> - <para>All user entries belonging to the billing department - having a <code>uid</code> value greater than 1023.</para> - </listitem> + <section xml:id="accountTransferPessimistic"> + <title>Account Transfer using pessimistic concurrency control</title> - <listitem> - <para>All user entries within the whole <xref - linkend="glo_DIT"/> having a common name containing the - substring <quote>ei</quote>.</para> - </listitem> + <qandaset defaultlabel="qanda" xml:id="qandaJdbcIsolation"> + <title>Accounts and balances</title> - <listitem> - <para>All user entries within the whole <xref - linkend="glo_DIT"/> belonging to gidNumber == 100 or having - a <code>uid</code> value starting with letter - <quote>t</quote>.</para> - </listitem> - </orderedlist> + <qandadiv> + <qandaentry> + <question> + <para>Consider the following simple schema of accounts keeping + customer balances:</para> - <para>Hint: <xref linkend="glo_Soft_ApacheDirectoryStudio"/> allows - both for <link - xlink:href="https://directory.apache.org/studio/users-guide/ldap_browser/tools_filter_editor_dialog.html">filtering</link> - and <link - xlink:href="https://directory.apache.org/studio/users-guide/ldap_browser/gettingstarted_search.html">searching</link> - providing nifty features like attribute name completion and - syntax highlighting. For regular searches you may define:</para> + <programlisting language="sql">CREATE TABLE Account ( + number INT NOT NULL PRIMARY KEY + ,balance INT NOT NULL + )</programlisting> - <itemizedlist> - <listitem> - <para>The <xref linkend="glo_DIT"/> entry to start from - being identified by its <xref linkend="glo_DN"/>.</para> - </listitem> + <para>Write two GUI applications to:</para> + <itemizedlist> <listitem> - <para>The search scope being either of object, one level or - subtree.</para> + <para>Transfer amounts from one account to another</para> </listitem> <listitem> - <para>Boolean expressions based on attribute values.</para> + <para>Get the sum of all balances</para> </listitem> </itemizedlist> - <para>But yes, I forgot to mention <link - xlink:href="http://tldp.org/HOWTO/LDAP-HOWTO/utilities.html">something</link>.</para> + <informalfigure> + <mediaobject> + <imageobject> + <imagedata fileref="Ref/Screen/accountTransferSum.png"/> + </imageobject> + </mediaobject> + </informalfigure> </question> <answer> - <orderedlist> - <listitem> - <para><emphasis role="bold">All users entries within the - whole </emphasis><xref linkend="glo_DIT"/><emphasis - role="bold"> having a gidNumber value of - 100.</emphasis></para> - - <para>Solution: <code>(gidNumber=100)</code>, starting from - top of <xref linkend="glo_DIT"/> having subtree - scope.</para> - </listitem> - - <listitem> - <para><emphasis role="bold">All user entries belonging to - the billing department having a <code>uid</code> value - greater than 1023.</emphasis></para> - - <para>Solution: <code>(uidNumber>=1024)</code> starting - from <xref linkend="glo_DN"/> - <code>ou=billing,dc=hdm-stuttgart,dc=de</code> and scope - <code>one level</code>.</para> - - <para>Notice the expression - <code>(uidNumber>=1024)</code> in favour of the seemingly - equivalent but syntactically illegal counterpart - <code>(uidNumber>1023)</code>.</para> - </listitem> - - <listitem> - <para><emphasis role="bold">All user entries within the - whole </emphasis><xref linkend="glo_DIT"/><emphasis - role="bold"> having a common name containing the substring - <quote>ei</quote>.</emphasis></para> - - <para>Solution: <code>(cn=*ei*)</code>, starting from top of - <xref linkend="glo_DIT"/> having subtree scope.</para> - </listitem> - - <listitem> - <para><emphasis role="bold">All user entries within the - whole </emphasis><xref linkend="glo_DIT"/><emphasis - role="bold"> belonging to gidNumber == 100 or having a - <code>uid</code> value starting with letter - <quote>t</quote>.</emphasis></para> - - <para>Solution: <code>(|(gidNumber=100)(uid=t*))</code>, - starting from top of <xref linkend="glo_DIT"/> having - subtree scope.</para> - </listitem> - </orderedlist> + <annotation role="make"> + <para role="eclipse">Sda2/account</para> + </annotation> </answer> </qandaentry> </qandadiv> </qandaset> </section> - <section xml:id="unix2sql2ldap"> - <title><xref linkend="glo_UNIX"/> to <xref linkend="glo_SQL"/> to <xref - linkend="glo_LDAP"/></title> - - <para><xref linkend="glo_UNIX"/> type operating systems manage users, - groups and their respective relationships in three different text - files:</para> - - <glosslist> - <glossentry> - <glossterm><filename>/etc/passwd</filename></glossterm> - - <glossdef> - <para>Users being defined on the system:</para> - - <programlisting language="none">root:x:0:0:root:/root:/bin/bash - daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin - bin:x:2:2:bin:/bin:/usr/sbin/nologin - sys:x:3:3:sys:/dev:/usr/sbin/nologin - sync:x:4:65534:sync:/bin:/bin/sync - ...</programlisting> - - <para>We illustrate the meaning of this <xref linkend="glo_CSV"/> - (actually **character** separated) by examining the first - row:</para> - - <glosslist> - <glossentry> - <glossterm>Column 1, <code>root</code>:</glossterm> - - <glossdef> - <para>The user's unique system name as being entered at - login.</para> - </glossdef> - </glossentry> - - <glossentry> - <glossterm>Column 2, x<code>:</code></glossterm> - - <glossdef> - <para>This field is not being used on current <xref - linkend="glo_UNIX"/> implementations. Historically either - the user's clear text password or its hash value was present - here. For security reasons this attribute has been moved to - a third file <filename>/etc/shadow</filename> being read - access protected to non-administrator users.</para> - </glossdef> - </glossentry> + <section xml:id="accountTransferOptimistic"> + <title>Account Transfer using optimistic concurrency control</title> - <glossentry> - <glossterm>Column 3, <code>0</code>:</glossterm> + <figure xml:id="fig_optimisticConcurrencyControl"> + <title>Optimistic concurrency control</title> - <glossdef> - <para>The user's unique integer numerical - <parameter>uid</parameter> number value.</para> - </glossdef> - </glossentry> + <mediaobject> + <imageobject> + <imagedata fileref="Ref/Fig/concurrentOptimistic.svg"/> + </imageobject> + </mediaobject> + </figure> - <glossentry> - <glossterm>Column 4, <code>0</code>:</glossterm> + <para>An interfering transaction obeying the protocol causes a + transaction failure:</para> - <glossdef> - <para>The user's unique primary group integer numerical - <parameter>gid</parameter> number value. The value - <quote>0</quote> here refers to a group root of identical - name being defined in <filename>/etc/group</filename>, see - next section.</para> - </glossdef> - </glossentry> - - <glossentry> - <glossterm>Column 5, <code>root</code>:</glossterm> - - <glossdef> - <para>The user's common name. For a regular user account - this might be <quote>Jim Beam</quote> for example.</para> - </glossdef> - </glossentry> - - <glossentry> - <glossterm>Column 6, <filename>/root</filename>:</glossterm> - - <glossdef> - <para>The user's home directory. Might be /home/beam for a - user <quote>Jim Beam</quote>.</para> - </glossdef> - </glossentry> - - <glossentry> - <glossterm>Column 7, <command>/bin/bash</command>:</glossterm> - - <glossdef> - <para>The user's login shell (command interpreter. This - attribute contains a reference to a command interpreter like - <command>/bin/(t)csh</command>, <command>/bin/ksh</command> - and so on.</para> - </glossdef> - </glossentry> - </glosslist> - </glossdef> - </glossentry> - - <glossentry> - <glossterm><filename>/etc/group</filename></glossterm> - - <glossdef> - <para>This file contains all groups being defined on the - system:</para> - - <programlisting language="none">root:x:0: - daemon:x:1: - bin:x:2: - sys:x:3: - adm:x:4:syslog,mi <co xml:id="secondaryGroupmembership"/> - tty:x:5: - ...</programlisting> - - <glosslist> - <glossentry> - <glossterm>Column1,root:</glossterm> - - <glossdef> - <para>The group's name</para> - </glossdef> - </glossentry> - - <glossentry> - <glossterm>Column 2, x:</glossterm> - - <glossdef> - <para>Not used</para> - </glossdef> - </glossentry> - - <glossentry> - <glossterm>Column 3, 4:</glossterm> + <figure xml:id="concurrentObtimisticFail"> + <title>Failure with optimistic transactions</title> - <glossdef> - <para>The group's unique <parameter>gid</parameter> - number</para> - </glossdef> - </glossentry> + <mediaobject> + <imageobject> + <imagedata fileref="Ref/Fig/concurrentOptimisticFail.svg"/> + </imageobject> + </mediaobject> + </figure> - <glossentry> - <glossterm>Column 4, <code>syslog,mi</code>:</glossterm> + <para>Considerations:</para> - <glossdef> - <para>The set <code>{syslog,mi}</code> <coref - linkend="secondaryGroupmembership"/> defines secondary group - memberships: These two users will belong to the group - <code>adm</code> in addition to their respective primary - group definition.</para> - </glossdef> - </glossentry> - </glosslist> - </glossdef> - </glossentry> - </glosslist> + <itemizedlist> + <listitem> + <para>Race conditions, time of check to time of use</para> + </listitem> + </itemizedlist> - <qandaset defaultlabel="qanda" xml:id="qandUnixToSqlToLdap"> - <title>Exporting and importing data</title> + <qandaset defaultlabel="qanda" xml:id="qandaTransferOptimistic"> + <title>Optimistic account transfer</title> <qandadiv> <qandaentry> <question> - <para>Write two applications being able to perform the following - tasks:</para> + <para>Implement your (pessimistic) account transfer application + <xref linkend="qandaJdbcIsolation"/> in an optimistic + manner:</para> - <orderedlist> + <itemizedlist> <listitem> - <para>Import the previously described UNIX user and group - data ton an RDBMS using <xref linkend="glo_JDBC"/>. You will - have to define a suitable SQL schema first.</para> + <para>Make sure both source and destination accounts get + protected against interfering transactions.</para> </listitem> <listitem> - <para>Transfer RDBMS data to your local <xref - linkend="glo_LDAP"/> server using <link - xlink:href="https://docs.oracle.com/javase/jndi/tutorial/ldap/misc/url.html">JNDI</link>.</para> + <para>Provide a means to definitely avoid deadlocks during + the second transaction section of a balance transfer + operation.</para> </listitem> - </orderedlist> - </question> - <answer> - <annotation role="make"> - <para role="eclipse">Sda2/UnixSqlLdap/Jndi/Unix2Rdbms</para> - </annotation> - - <annotation role="make"> - <para role="eclipse">Sda2/UnixSqlLdap/Jndi/Rdbms2Ldap</para> - </annotation> - </answer> + <listitem> + <para>Supply a suitable message in case of an interfering + second balance transfer</para> + </listitem> + </itemizedlist> + </question> </qandaentry> </qandadiv> </qandaset> </section> - - <section xml:id="transactionsInJdbc"> - <title>Transactions in <xref linkend="glo_JDBC"/></title> - - <para>You may review some remarks on SQL standard isolation level - definitions:</para> - - <itemizedlist> - <listitem> - <para><xref linkend="glo_Javadoc"/>:</para> - - <itemizedlist> - <listitem> - <para><link - xlink:href="https://docs.oracle.com/javase/8/docs/api/java/sql/Connection.html#TRANSACTION_READ_UNCOMMITTED">TRANSACTION_READ_UNCOMMITTED</link></para> - </listitem> - - <listitem> - <para><link - xlink:href="https://docs.oracle.com/javase/8/docs/api/java/sql/Connection.html#TRANSACTION_READ_COMMITTED">TRANSACTION_READ_COMMITTED</link></para> - </listitem> - - <listitem> - <para><link - xlink:href="https://docs.oracle.com/javase/8/docs/api/java/sql/Connection.html#TRANSACTION_REPEATABLE_READ">TRANSACTION_READ_REPEATABLE_READ</link></para> - </listitem> - - <listitem> - <para><link - xlink:href="https://docs.oracle.com/javase/8/docs/api/java/sql/Connection.html#TRANSACTION_SERIALIZABLE">TRANSACTION_READ_SERIALIZABLE</link></para> - </listitem> - </itemizedlist> - </listitem> - - <listitem> - <para><link - xlink:href="http://www.oracle.com/technetwork/issue-archive/2005/05-nov/o65asktom-082389.html">On - Transaction Isolation Levels (Oracle)</link></para> - </listitem> - - <listitem> - <para><link - xlink:href="https://technet.microsoft.com/en-us/library/ms378149(v=sql.110).aspx">Understanding - Isolation Levels (Microsoft)</link></para> - </listitem> - </itemizedlist> - - <section xml:id="accountTransferPessimistic"> - <title>Account Transfer using pessimistic concurrency control</title> - - <qandaset defaultlabel="qanda" xml:id="qandaJdbcIsolation"> - <title>Accounts and balances</title> - - <qandadiv> - <qandaentry> - <question> - <para>Consider the following simple schema of accounts keeping - customer balances:</para> - - <programlisting language="none">CREATE TABLE Account ( - number INT NOT NULL PRIMARY KEY - ,balance INT NOT NULL - )</programlisting> - - <para>Write two GUI applications to:</para> - - <itemizedlist> - <listitem> - <para>Transfer amounts from one account to another</para> - </listitem> - - <listitem> - <para>Get the sum of all balances</para> - </listitem> - </itemizedlist> - - <informalfigure> - <mediaobject> - <imageobject> - <imagedata fileref="Ref/Screen/accountTransferSum.png"/> - </imageobject> - </mediaobject> - </informalfigure> - </question> - - <answer> - <annotation role="make"> - <para role="eclipse">Sda2/account</para> - </annotation> - </answer> - </qandaentry> - </qandadiv> - </qandaset> - </section> - - <section xml:id="accountTransferOptimistic"> - <title>Account Transfer using optimistic concurrency control</title> - - <figure xml:id="fig_optimisticConcurrencyControl"> - <title>Optimistic concurrency control</title> - - <mediaobject> - <imageobject> - <imagedata fileref="Ref/Fig/concurrentOptimistic.svg"/> - </imageobject> - </mediaobject> - </figure> - - <para>An interfering transaction obeying the protocol causes a - transaction failure:</para> - - <figure xml:id="concurrentObtimisticFail"> - <title>Failure with optimistic transactions</title> - - <mediaobject> - <imageobject> - <imagedata fileref="Ref/Fig/concurrentOptimisticFail.svg"/> - </imageobject> - </mediaobject> - </figure> - - <para>Considerations:</para> - - <itemizedlist> - <listitem> - <para>Race conditions, time of check to time of use</para> - </listitem> - </itemizedlist> - - <qandaset defaultlabel="qanda" xml:id="qandaTransferOptimistic"> - <title>Optimistic account transfer</title> - - <qandadiv> - <qandaentry> - <question> - <para>Implement your (pessimistic) account transfer - application <xref linkend="qandaJdbcIsolation"/> in an - optimistic manner:</para> - - <itemizedlist> - <listitem> - <para>Make sure both source and destination accounts get - protected against interfering transactions.</para> - </listitem> - - <listitem> - <para>Provide a means to definitely avoid deadlocks during - the second transaction section of a balance transfer - operation.</para> - </listitem> - - <listitem> - <para>Supply a suitable message in case of an interfering - second balance transfer</para> - </listitem> - </itemizedlist> - </question> - </qandaentry> - </qandadiv> - </qandaset> - </section> - </section> - </chapter> + </section> +</chapter> diff --git a/Doc/Sdi/apache.xml b/Doc/Sdi/apache.xml index bfd1ea95f..7c7a549c7 100644 --- a/Doc/Sdi/apache.xml +++ b/Doc/Sdi/apache.xml @@ -4,6 +4,7 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" + xmlns:ns="http://docbook.org/ns/transclusion" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook"> @@ -29,7 +30,7 @@ may have already been installed depending on other exercises (<xref linkend="glo_LDAP"/> administration frontend?):</para> - <programlisting language="none">aptitude install apache2</programlisting> + <screen>aptitude install apache2</screen> <section xml:id="sdiApacheFirstSteps"> <title>First Steps</title> diff --git a/Doc/Sdi/dns.xml b/Doc/Sdi/dns.xml index 374bc2b65..bb0cecaab 100644 --- a/Doc/Sdi/dns.xml +++ b/Doc/Sdi/dns.xml @@ -3,6 +3,7 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" + xmlns:ns="http://docbook.org/ns/transclusion" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook"> @@ -44,7 +45,7 @@ <glossterm>Install server and utilities</glossterm> <glossdef> - <programlisting language="none">apt-get install bind9 bind9utils</programlisting> + <screen>apt-get install bind9 bind9utils</screen> </glossdef> </glossentry> @@ -55,7 +56,7 @@ <para>For debugging purposes you may want to adjust the server's log level:</para> - <programlisting language="none">logging { + <screen>logging { channel querylog{ syslog; <emphasis role="bold">severity debug 10; @@ -64,7 +65,7 @@ print-severity yes;</emphasis> }; category queries { querylog;}; -};</programlisting> +};</screen> </glossdef> </glossentry> @@ -75,19 +76,19 @@ <para>Turn off IPv6. Hint from <filename>/etc/init.d/bind9</filename>:</para> - <programlisting language="none"># Don't modify this line, change or create /etc/default/bind9. -OPTIONS=""</programlisting> + <screen># Don't modify this line, change or create /etc/default/bind9. +OPTIONS=""</screen> <para>Thus modify <filename>/etc/default/bind9</filename>:</para> - <programlisting language="none">OPTIONS="<emphasis role="bold">-4</emphasis> -u bind"</programlisting> + <screen>OPTIONS="<emphasis role="bold">-4</emphasis> -u bind"</screen> <tip> <para>Most (if not all) server configuration changes require a daemon restart or at least a configuration file reloading to become effective:</para> - <programlisting language="none">service bind9 reload</programlisting> + <screen>service bind9 reload</screen> </tip> </glossdef> </glossentry> @@ -97,7 +98,7 @@ OPTIONS=""</programlisting> <filename>/etc/bind/named.conf.options</filename></glossterm> <glossdef> - <programlisting language="none">options { + <screen>options { directory "/var/cache/bind"; recursion no; # disable resursive queries @@ -129,7 +130,7 @@ OPTIONS=""</programlisting> auth-nxdomain no; # conform to RFC1035 listen-on-v6 { any; }; -};</programlisting> +};</screen> </glossdef> </glossentry> @@ -143,7 +144,7 @@ OPTIONS=""</programlisting> </filename></glossterm> <glossdef> - <programlisting language="none">zone "mi.hdm-stuttgart.de" { + <screen>zone "mi.hdm-stuttgart.de" { type master; file "/etc/bind/zones/db.mi.hdm-stuttgart.de"; # zone file path }; @@ -151,7 +152,7 @@ OPTIONS=""</programlisting> zone "75.62.141.in-addr.arpa" { type master; file "/etc/bind/zones/db.141.62.75"; # 141.62.75.0/16 class-C subnet -};</programlisting> +};</screen> </glossdef> </glossentry> @@ -160,7 +161,7 @@ zone "75.62.141.in-addr.arpa" { </filename></glossterm> <glossdef> - <programlisting language="none">; + <screen>; ; BIND data file ; $TTL 604800 @@ -178,7 +179,7 @@ $TTL 604800 ; name servers - A records ns4.mi.hdm-stuttgart.de. IN A 141.62.75.104 -www4.mi.hdm-stuttgart.de. IN A 141.62.75.104</programlisting> +www4.mi.hdm-stuttgart.de. IN A 141.62.75.104</screen> <tip> <para>Read about the <parameter>Serial</parameter> @@ -191,7 +192,7 @@ www4.mi.hdm-stuttgart.de. IN A 141.62.75.104</programlisting> <glossterm><filename>/etc/bind/zones/db.141.62.75</filename></glossterm> <glossdef> - <programlisting language="none">; BIND reverse data file + <screen>; BIND reverse data file ; $TTL 604800 @ IN SOA ns4.mi.hdm-stuttgart.de. root.mi.hdm-stuttgart.de. ( @@ -206,7 +207,7 @@ $TTL 604800 IN NS ns4.mi.hdm-stuttgart.de. ; PTR Records -104 IN PTR sdi4a.mi.hdm-stuttgart.de. ; 141.62.75.104</programlisting> +104 IN PTR sdi4a.mi.hdm-stuttgart.de. ; 141.62.75.104</screen> </glossdef> </glossentry> </glosslist> diff --git a/Doc/Sdi/gettingStarted.xml b/Doc/Sdi/gettingStarted.xml index 9e2004928..1f41627a9 100644 --- a/Doc/Sdi/gettingStarted.xml +++ b/Doc/Sdi/gettingStarted.xml @@ -4,6 +4,7 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" + xmlns:ns="http://docbook.org/ns/transclusion" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook"> @@ -19,7 +20,7 @@ <para>Access to these virtual machines is initially being controlled by password. A client will allow you to connect:</para> - <programlisting language="none">[goik]$ <emphasis role="bold">ssh root@sdi4a.mi.hdm-stuttgart.de</emphasis> + <screen>[goik]$ <emphasis role="bold">ssh root@sdi4a.mi.hdm-stuttgart.de</emphasis> The authenticity of host 'sdi4a.mi.hdm-stuttgart.de (141.62.75.104)' can't be established. ECDSA key fingerprint is b1:ee:e1:3d:db:3c:0b:06:e9:fb:b3:ae:b8:ed:e2:a8. Are you sure you want to continue connecting (yes/no)? yes @@ -28,7 +29,7 @@ root@sdi4a.mi.hdm-stuttgart.de's password: Welcome to Ubuntu 14.04.2 LTS (GNU/Linux 2.6.32-19-pve x86_64) * Documentation: https://help.ubuntu.com/ -Last login: Fri Mar 27 08:29:40 2015 from 192.168.1.66</programlisting> +Last login: Fri Mar 27 08:29:40 2015 from 192.168.1.66</screen> <para>Since password access is generally being considered insecure (e.g. due to insufficient length or poor choice of password) we will configure @@ -39,28 +40,28 @@ Last login: Fri Mar 27 08:29:40 2015 from 192.168.1.66</programlisting> <para>Copy your public <xref linkend="glo_ssh"/> key to your remote VM still using password access:</para> - <programlisting language="none">root@goiki:~# scp /ma/goik/.ssh/id_rsa.pub root@sdi4a.mi.hdm-stuttgart.de: + <screen>root@goiki:~# scp /ma/goik/.ssh/id_rsa.pub root@sdi4a.mi.hdm-stuttgart.de: root@sdi4a.mi.hdm-stuttgart.de's password: id_rsa.pub 100% 736 0.7KB/s 00:00 -</programlisting> +</screen> </listitem> <listitem> <para>On the remote VM append your public key the the list of allowed users:</para> - <programlisting language="none">root@sdi4a:~# cat id_rsa.pub >> ~/.ssh/authorized_keys</programlisting> + <screen>root@sdi4a:~# cat id_rsa.pub >> ~/.ssh/authorized_keys</screen> </listitem> <listitem> <para>You should now be able to log in by public key:</para> - <programlisting language="none">[goik@goiki Sdi]$ ssh root@sdi4a.mi.hdm-stuttgart.de + <screen>[goik@goiki Sdi]$ ssh root@sdi4a.mi.hdm-stuttgart.de #Welcome to Ubuntu 14.04.2 LTS (GNU/Linux 2.6.32-19-pve x86_64) * Documentation: https://help.ubuntu.com/ Last login: Fri Mar 27 08:38:03 2015 from 192.168.1.66 -</programlisting> +</screen> <para>Notice the absence of a password prompt. You may want to execute <command>ssh</command> <option>-v</option> once to watch the log and @@ -73,27 +74,27 @@ Last login: Fri Mar 27 08:38:03 2015 from 192.168.1.66 <filename>/etc/ssh/sshd_config</filename>. Edit this file and look for the following lines</para> - <programlisting language="none">... + <screen>... # Change to no to disable tunnelled clear text passwords #PasswordAuthentication yes -...</programlisting> +...</screen> <para>As being proposed inside the comment remove the directive's starting comment and set its value to no:</para> - <programlisting language="none">... + <screen>... # Change to no to disable tunnelled clear text passwords PasswordAuthentication <emphasis role="bold">no</emphasis> -...</programlisting> +...</screen> <para>We need to instruct the <xref linkend="glo_ssh"/> daemon to reload its configuration:</para> - <programlisting language="none">root@sdi4a:~# reload ssh</programlisting> + <screen>root@sdi4a:~# reload ssh</screen> <para>Password login should no longer be on offer:</para> - <programlisting language="none">root@goiki:~# ssh -v root@sdi4a.mi.hdm-stuttgart.de + <screen>root@goiki:~# ssh -v root@sdi4a.mi.hdm-stuttgart.de OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014 debug1: Reading configuration data /etc/ssh/ssh_config ... @@ -106,7 +107,7 @@ debug1: Trying private key: /root/.ssh/id_dsa debug1: Trying private key: /root/.ssh/id_ecdsa debug1: Trying private key: /root/.ssh/id_ed25519 debug1: No more authentication methods to try. -Permission denied (publickey).</programlisting> +Permission denied (publickey).</screen> </listitem> </orderedlist> </section> diff --git a/Doc/Sdi/ldap.xml b/Doc/Sdi/ldap.xml index dd9753ed5..f075351c8 100644 --- a/Doc/Sdi/ldap.xml +++ b/Doc/Sdi/ldap.xml @@ -3,6 +3,7 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" + xmlns:ns="http://docbook.org/ns/transclusion" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook"> @@ -263,8 +264,8 @@ <para>You may have to install the dialog package as a prerequisite to the <productname>openldap</productname> server package:</para> - <programlisting language="none">aptitude install dialog -aptitude install slapd</programlisting> + <screen>aptitude install dialog +aptitude install slapd</screen> <para>based on the <xref linkend="glo_DNS"/> domain <code>mi.hdm-stuttgart.de</code> the default <command>slapd</command> @@ -493,7 +494,7 @@ userPassword:: e3NtZDV9YVhKL2JlVkF2TDRENk9pMFRLcDhjM3ovYTZQZzBXeHA=</programlist <command>ldapsearch</command> command is part of the <package>openldap-utils</package> package:</para> - <programlisting language="none">ldapsearch -Y EXTERNAL -H ldapi:/// -b cn=config + <screen>ldapsearch -Y EXTERNAL -H ldapi:/// -b cn=config # {0}config, config dn: olcDatabase={0}config,cn=config @@ -508,7 +509,7 @@ dn: olcDatabase={1}mdb,cn=config ... <emphasis role="bold">olcRootDN: cn=admin,dc=hdm-stuttgart,dc=de olcRootPW: {SSHA}7M0gUyHOH7cfK1z9amqgK0uQcn84AuYw</emphasis> -...</programlisting> +...</screen> <para>The above lines appear near in the tail section. We see two databases <code>{0}</code> and <code>{1}</code> representing two @@ -528,16 +529,16 @@ olcRootPW: {SSHA}7M0gUyHOH7cfK1z9amqgK0uQcn84AuYw</emphasis> of an <xref linkend="glo_LDIF"/> file adding a (possibly different) hashed password:</para> - <programlisting language="none">root@sdi8a:~# cat ~/add_olcRootPW.ldif + <screen>root@sdi8a:~# cat ~/add_olcRootPW.ldif dn: olcDatabase={0}config,cn=config add: olcRootPW -olcRootPW: {ssha}pHE+EPOG2gyRyOgjvFqsWOb5zGsGl9CD</programlisting> +olcRootPW: {ssha}pHE+EPOG2gyRyOgjvFqsWOb5zGsGl9CD</screen> <para>Activating this configuration my be effected by using <command xlink:href="http://www.openldap.org/software/man.cgi?query=ldapmodify&apropos=0&sektion=0&manpath=OpenLDAP+2.4-Release&format=html">ldapmodify</command>:</para> - <programlisting language="none">root@sdi8a:~# ldapmodify -Q -Y EXTERNAL -H ldapi:/// -f ~/add_olcRootPW.ldif -modifying entry "olcDatabase={0}config,cn=config"</programlisting> + <screen>root@sdi8a:~# ldapmodify -Q -Y EXTERNAL -H ldapi:/// -f ~/add_olcRootPW.ldif +modifying entry "olcDatabase={0}config,cn=config"</screen> <para>This activation in turn enables a new account:</para> @@ -691,7 +692,7 @@ modifying entry "olcDatabase={0}config,cn=config"</programlisting> additional <property>olcModuleLoad</property> <coref linkend="sdiLdapCoSyncprov"/> value:</para> - <programlisting language="none">dn: cn=module{0},cn=config + <programlisting language="ldif">dn: cn=module{0},cn=config objectClass: olcModuleList cn: module{0} olcModuleLoad: {0}back_mdb @@ -728,7 +729,7 @@ olcModulePath: /usr/lib/ldap</programlisting> <xref linkend="glo_LDAP"/>. Activation of OS level <xref linkend="glo_LDAP"/> user and group support is being outlined in <link xlink:href="https://wiki.debian.org/LDAP/PAM">Configuring LDAP - Authentication</link>. </para> + Authentication</link>.</para> <tip> <para>All user information (<property>uid</property>, common name, @@ -742,8 +743,8 @@ olcModulePath: /usr/lib/ldap</programlisting> linkend="glo_LDAP"/> user <property>ldaptest</property> you should see the following</para> - <programlisting language="none">$ id ldaptest -uid=1001(ldaptest) gid=1001(ldaptest) groups=1001(ldaptest)</programlisting> + <screen>$ id ldaptest +uid=1001(ldaptest) gid=1001(ldaptest) groups=1001(ldaptest)</screen> <para>A <quote>id: ‘ldaptest’: no such user</quote> message indicates your <xref linkend="glo_LDAP"/> setup does not yet work.</para> @@ -867,7 +868,7 @@ uid=1001(ldaptest) gid=1001(ldaptest) groups=1001(ldaptest)</programlisting> ou=userlist, dc=hdm-stuttgart, dc=de</code> the result should look like:</para> - <programlisting language="none">mail: mistudent@mi.hdm-stuttgart.de + <screen>mail: mistudent@mi.hdm-stuttgart.de gidNumber: 31104 cn: MI Negative Testuser objectClass[0]: posixAccount @@ -886,7 +887,7 @@ shadowLastChange: 16749 homeDirectory: /home/stud/MI/mistudent sambaNTPassword: C1E13066AA936CBF9260913EE962B8C2 sn: Testuser -matrikelNr: 98911</programlisting> +matrikelNr: 98911</screen> <para>Solution available at:</para> diff --git a/Doc/Sdi/mail.xml b/Doc/Sdi/mail.xml index 196201c8e..0e0fafc7f 100644 --- a/Doc/Sdi/mail.xml +++ b/Doc/Sdi/mail.xml @@ -3,6 +3,7 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" + xmlns:ns="http://docbook.org/ns/transclusion" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook"> @@ -135,7 +136,7 @@ defaults. Later it is maybe needed to install extra postfix-* packages.</para> - <programlisting language="none">apt-get install postfix</programlisting> + <screen>apt-get install postfix</screen> <itemizedlist> <listitem> diff --git a/Doc/Sdi/samba.xml b/Doc/Sdi/samba.xml index 6827eaa08..0b5fbcecd 100644 --- a/Doc/Sdi/samba.xml +++ b/Doc/Sdi/samba.xml @@ -3,6 +3,7 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" + xmlns:ns="http://docbook.org/ns/transclusion" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook"> @@ -42,7 +43,7 @@ <command xlink:href="http://linux.die.net/man/1/smbclient">smbclient</command>:</para> - <programlisting language="none">root@sdi4a:~# smbclient -L localhost --user smbtester + <screen>root@sdi4a:~# smbclient -L localhost --user smbtester Enter smbtester's password: Domain=[WORKGROUP] OS=[Unix] Server=[Samba 4.1.6-Ubuntu] @@ -59,7 +60,7 @@ Domain=[WORKGROUP] OS=[Unix] Server=[Samba 4.1.6-Ubuntu] Workgroup Master --------- ------- - WORKGROUP SDI4A</programlisting> + WORKGROUP SDI4A</screen> <para>Create a test file within your shared directory having some textual content.</para> @@ -69,7 +70,7 @@ Domain=[WORKGROUP] OS=[Unix] Server=[Samba 4.1.6-Ubuntu] <para>Try to mount a share from a remote client (either Windows, Mac-OS or Linux):</para> - <programlisting language="none">root@mi-ESPRIMO-P910:~# mount -t cifs //sdi4a.mi.hdm-stuttgart.de/smbtester /mnt/test/ -ouser=smbtester + <screen>root@mi-ESPRIMO-P910:~# mount -t cifs //sdi4a.mi.hdm-stuttgart.de/smbtester /mnt/test/ -ouser=smbtester Password for smbtester@//sdi4a.mi.hdm-stuttgart.de/smbtester: root@mi-ESPRIMO-P910:~# cat /mnt/test/ .bash_history q.txt .viminfo @@ -77,7 +78,7 @@ root@mi-ESPRIMO-P910:~# cat /mnt/test/q.txt Mal sehen ... root@mi-ESPRIMO-P910:~# df /mnt/test/ Filesystem 1K-blocks Used Available Use% Mounted on -//sdi4a.mi.hdm-stuttgart.de/smbtester 4048548 783608 3264940 20% /mnt/test</programlisting> +//sdi4a.mi.hdm-stuttgart.de/smbtester 4048548 783608 3264940 20% /mnt/test</screen> <tip> <itemizedlist> @@ -136,16 +137,16 @@ Filesystem 1K-blocks Used Available Use% Mounted on <filename>/etc/apt/sources.list.d/src-packages.list</filename> containing:</para> - <programlisting language="none">deb-src http://ftp.debian.org/debian jessie main contrib -deb-src http://ftp.debian.org/debian jessie-updates main contrib</programlisting> + <screen>deb-src http://ftp.debian.org/debian jessie main contrib +deb-src http://ftp.debian.org/debian jessie-updates main contrib</screen> </listitem> <listitem> <para>Update package lists and install a required helper package:</para> - <programlisting language="none">aptitude update -aptitude install dpkg-dev</programlisting> + <screen>aptitude update +aptitude install dpkg-dev</screen> </listitem> <listitem> @@ -153,10 +154,10 @@ aptitude install dpkg-dev</programlisting> xlink:href="https://bugs.launchpad.net/ubuntu/+source/smbldap-tools/+bug/997172/comments/7">comment no. 7</link>:</para> - <programlisting language="none">apt-get source smbldap-tools + <screen>apt-get source smbldap-tools cd smbldap-tools-0.9.7/ ./configure -make</programlisting> +make</screen> <para>This creates an executable <command>smbldap-config.cmd</command> replacing @@ -203,10 +204,10 @@ make</programlisting> removal of <code>*.gz</code> <code>*.1</code> and other archive files is recommended):</para> - <programlisting language="none">root@sdi4a:/var/log# cd /var/log/ + <screen>root@sdi4a:/var/log# cd /var/log/ root@sdi4a:/var/log# tail -n0 -f `find . -type f` ==> ./alternatives.log <== -...</programlisting> +...</screen> <para>This will browse all (possibly unrelated) log statements.</para> diff --git a/Doc/Tdoc/general.xml b/Doc/Tdoc/general.xml index d1b6ddd76..2584daa26 100644 --- a/Doc/Tdoc/general.xml +++ b/Doc/Tdoc/general.xml @@ -145,17 +145,17 @@ <tr> <th>HTML</th> - <td><programlisting language="none"><code><p>A paragraph</ul></code></programlisting></td> + <td><programlisting language="html"><code><p>A paragraph</ul></code></programlisting></td> <th>Docbook</th> - <td><programlisting language="none"><code><para>A paragraph</para></code></programlisting></td> + <td><programlisting language="xml"><code><para>A paragraph</para></code></programlisting></td> </tr> <tr> <th>LaTeX</th> - <td><programlisting language="none"><code>A paragraph\par</code></programlisting></td> + <td><programlisting language="latex"><code>A paragraph\par</code></programlisting></td> <th>Rendering</th> @@ -169,16 +169,16 @@ <informaltable border="1"> <tr> - <th>HTML</th> + <th valign="top">HTML</th> - <td><programlisting language="none"><code><ul> + <td valign="top"><programlisting language="html"><code><ul> <li>One</li> <li>Two</li> </ul></code></programlisting></td> - <th>Docbook</th> + <th valign="top">Docbook</th> - <td><programlisting language="none"><code><itemizedlist> + <td valign="top"><programlisting language="xml"><code><itemizedlist> <listitem> <para>One</para> </listitem> @@ -190,16 +190,16 @@ </tr> <tr> - <th>LaTeX</th> + <th valign="top">LaTeX</th> - <td><programlisting language="none"><code>\begin{itemize} + <td><programlisting language="latex"><code>\begin{itemize} \item One \item Two \end{itemize}</code></programlisting></td> - <th>Rendering</th> + <th valign="top">Rendering</th> - <td><itemizedlist> + <td valign="top"><itemizedlist> <listitem> <para>One</para> </listitem> @@ -217,9 +217,9 @@ <informaltable border="1"> <tr> - <th>HTML</th> + <th valign="top">HTML</th> - <td><programlisting language="none"><code><table> + <td><programlisting language="html"><code><table> <tr> <td>a1</td> <td>a2</td> @@ -230,9 +230,9 @@ </tr> </table></code></programlisting></td> - <th>Docbook</th> + <th valign="top">Docbook</th> - <td><programlisting language="none"><code><informaltable> + <td><programlisting language="xml"><code><informaltable> <tr> <td>a1</td> <td>a2</td> @@ -247,14 +247,14 @@ <tr> <th>LaTeX</th> - <td><programlisting language="none"><code>\begin{tabular}{ll} + <td valign="top"><programlisting language="latex"><code>\begin{tabular}{ll} a1 & a2 \\ b1 & b2 \\ \end{tabular}</code></programlisting></td> - <th>Rendering</th> + <th valign="top">Rendering</th> - <td><informaltable border="1"> + <td valign="top"><informaltable border="1"> <tr> <td valign="top">a1</td> @@ -278,12 +278,12 @@ <tr> <th>HTML</th> - <td><programlisting language="none"><code><img src= + <td><programlisting language="html"><code><img src= 'smoke.png'/></code></programlisting></td> <th>Docbook</th> - <td><programlisting language="none"><code><mediaobject> + <td><programlisting language="xml"><code><mediaobject> <imageobject> <imagedata fileref ="smoke.png"/> @@ -294,7 +294,7 @@ <tr> <th valign="top">LaTeX</th> - <td valign="top"><programlisting language="none"><code>\includegraphics + <td valign="top"><programlisting language="latex"><code>\includegraphics {smoke.png}</code></programlisting></td> <th valign="top">Rendering</th> @@ -319,7 +319,7 @@ <tr> <th>HTML / Docbook</th> - <td><programlisting language="none"><code><m:math> + <td><programlisting language="xml"><code><m:math> <m:mrow> <m:munderover> <m:mo>∫</m:mo> @@ -334,7 +334,7 @@ <tr> <th>LaTeX</th> - <td><programlisting language="none"><code>\begin{equation} + <td><programlisting language="latex"><code>\begin{equation} \int\limits_{-\infty}^{+\infty} e^{-x²} dx = \sqrt{\pi} \end{equation}</code></programlisting></td> @@ -408,7 +408,7 @@ <tr> <th>HTML</th> - <td><programlisting language="none"><code><h1 id="start" + <td><programlisting language="html"><code><h1 id="start" >First section</h1> <p>A remark.</p> @@ -419,7 +419,7 @@ <th>Docbook</th> - <td><programlisting language="none"><code><section xml:id="start"> + <td><programlisting language="xml"><code><section xml:id="start"> <title>First section</title> <para>A remark.</para> @@ -436,7 +436,7 @@ <tr> <th>LaTeX</th> - <td><programlisting language="none"><code>\section{\label{start + <td><programlisting language="latex"><code>\section{\label{start }First section} A remark. @@ -446,11 +446,11 @@ See remark at page <th>Rendering</th> - <td><programlisting language="none">First section + <td><literallayout>First section A remark -See remark at page 1.</programlisting></td> +See remark at page 1.</literallayout></td> </tr> </informaltable> </section> @@ -532,7 +532,7 @@ See remark at page 1.</programlisting></td> <tr> <th>HTML</th> - <td><programlisting language="none"><code> <body> + <td><programlisting language="html"><code> <body> ... <object name="foo" type="text/html" data="table.html"/> ... @@ -542,7 +542,7 @@ See remark at page 1.</programlisting></td> <tr> <th>Docbook</th> - <td><programlisting language="none"><code> <part xml:id="sd1"> + <td><programlisting language="xml"><code> <part xml:id="sd1"> <title>Software development 1</title> <xi:include href="Sd1/gettingStarted.xml" xpointer="element(/1)"/> <xi:include href="Sd1/languageFundamentals.xml" xpointer="element(/1)"/> @@ -552,7 +552,7 @@ See remark at page 1.</programlisting></td> <tr> <th>LaTeX</th> - <td><programlisting language="none"><code>\documentclass{article} + <td><programlisting language="latex"><code>\documentclass{article} \input{mydefs.tex} \begin{document} ... diff --git a/XmlCross/xmlcross.xml b/XmlCross/xmlcross.xml index c527a02e2..8939a9e17 100644 --- a/XmlCross/xmlcross.xml +++ b/XmlCross/xmlcross.xml @@ -688,61 +688,64 @@ <section xml:id="xmlc_sect_importantElements"> <title>Selected elements</title> - <para>Block elements are <xref linkend="glo_Docbook"/>'s building - blocks.</para> + <section xml:id="xmlc_sect_blockElements"> + <title>Block elements</title> - <figure xml:id="xmlc_fig_dbookPara"> - <title>Paragraph</title> + <para>Block elements are <xref linkend="glo_Docbook"/>'s building + blocks.</para> - <informaltable border="1"> - <tr> - <th>View</th> + <figure xml:id="xmlc_fig_dbookPara"> + <title>Paragraph</title> - <th><xref linkend="glo_Docbook"/></th> + <informaltable border="1"> + <tr> + <th>View</th> - <th>HTML</th> - </tr> + <th><xref linkend="glo_Docbook"/></th> - <tr> - <td valign="top"><para>Some text.</para></td> + <th>HTML</th> + </tr> - <td valign="top"><programlisting language="xml"><para>Some text</para></programlisting></td> + <tr> + <td valign="top"><para>Some text.</para></td> - <td><programlisting language="xml"><p <emphasis role="bold">style='color:red'</emphasis> + <td valign="top"><programlisting language="xml"><para>Some text</para></programlisting></td> + + <td><programlisting language="xml"><p <emphasis role="bold">style='color:red'</emphasis> >Some text.</p></programlisting></td> - </tr> - </informaltable> + </tr> + </informaltable> - <para>Caution: No style / formatting related parameters in <xref - linkend="glo_Docbook"/>.</para> + <para>Caution: No style / formatting related parameters in <xref + linkend="glo_Docbook"/>.</para> - <para>This is by design and on purpose.</para> - </figure> + <para>This is by design and on purpose.</para> + </figure> - <figure xml:id="xmlc_fig_dbookItemizedList"> - <title>Itemized list</title> + <figure xml:id="xmlc_fig_dbookItemizedList"> + <title>Itemized list</title> - <informaltable border="1"> - <tr> - <th>View</th> + <informaltable border="1"> + <tr> + <th>View</th> - <th><xref linkend="glo_Docbook"/></th> + <th><xref linkend="glo_Docbook"/></th> - <th>HTML</th> - </tr> + <th>HTML</th> + </tr> - <tr> - <td valign="top"><itemizedlist> - <listitem> - <para>Bee</para> - </listitem> + <tr> + <td valign="top"><itemizedlist> + <listitem> + <para>Bee</para> + </listitem> - <listitem> - <para>Ant</para> - </listitem> - </itemizedlist></td> + <listitem> + <para>Ant</para> + </listitem> + </itemizedlist></td> - <td valign="top"><programlisting language="xml"><itemizedlist> + <td valign="top"><programlisting language="xml"><itemizedlist> <listitem> <para>Bee</para> </listitem> @@ -751,7 +754,7 @@ </listitem> </itemizedlist></programlisting></td> - <td valign="top"><programlisting language="xml"><ul> + <td valign="top"><programlisting language="xml"><ul> <li> <p>Bee</p> </li> @@ -759,34 +762,34 @@ <p>Ant</p> </li> </ul></programlisting></td> - </tr> - </informaltable> - </figure> + </tr> + </informaltable> + </figure> - <figure xml:id="xmlc_fig_dbookOrderedList"> - <title>Ordered list</title> + <figure xml:id="xmlc_fig_dbookOrderedList"> + <title>Ordered list</title> - <informaltable border="1"> - <tr> - <th>View</th> + <informaltable border="1"> + <tr> + <th>View</th> - <th><xref linkend="glo_Docbook"/></th> + <th><xref linkend="glo_Docbook"/></th> - <th>HTML</th> - </tr> + <th>HTML</th> + </tr> - <tr> - <td valign="top"><itemizedlist> - <listitem> - <para>Bee</para> - </listitem> + <tr> + <td valign="top"><itemizedlist> + <listitem> + <para>Bee</para> + </listitem> - <listitem> - <para>Ant</para> - </listitem> - </itemizedlist></td> + <listitem> + <para>Ant</para> + </listitem> + </itemizedlist></td> - <td valign="top"><programlisting language="xml"><orderedlist> + <td valign="top"><programlisting language="xml"><orderedlist> <listitem> <para>Bee</para> </listitem> @@ -796,7 +799,7 @@ </listitem> </orderedlist></programlisting></td> - <td valign="top"><programlisting language="xml"><ol> + <td valign="top"><programlisting language="xml"><ol> <li> <p>Bee</p> </li> @@ -804,42 +807,42 @@ <p>Ant</p> </li> </ol></programlisting></td> - </tr> - </informaltable> - </figure> + </tr> + </informaltable> + </figure> - <figure xml:id="xmlc_fig_dbookGlossList"> - <title>Glossary list</title> + <figure xml:id="xmlc_fig_dbookGlossList"> + <title>Glossary list</title> - <informaltable border="1"> - <tr> - <th>View</th> + <informaltable border="1"> + <tr> + <th>View</th> - <th><xref linkend="glo_Docbook"/></th> + <th><xref linkend="glo_Docbook"/></th> - <th>HTML</th> - </tr> + <th>HTML</th> + </tr> - <tr> - <td valign="top"><glosslist> - <glossentry> - <glossterm>Bee</glossterm> + <tr> + <td valign="top"><glosslist> + <glossentry> + <glossterm>Bee</glossterm> - <glossdef> - <para>Insect</para> - </glossdef> - </glossentry> + <glossdef> + <para>Insect</para> + </glossdef> + </glossentry> - <glossentry> - <glossterm>Mouse</glossterm> + <glossentry> + <glossterm>Mouse</glossterm> - <glossdef> - <para>Mammal</para> - </glossdef> - </glossentry> - </glosslist></td> + <glossdef> + <para>Mammal</para> + </glossdef> + </glossentry> + </glosslist></td> - <td valign="top"><programlisting language="xml"> <glosslist> + <td valign="top"><programlisting language="xml"> <glosslist> <glossentry> <glossterm>Bee</glossterm> <glossdef> @@ -854,50 +857,50 @@ </glossentry> </glosslist></programlisting></td> - <td valign="top"><programlisting language="xml"><dl> + <td valign="top"><programlisting language="xml"><dl> <dt>Bee</dt> <dd>Insect</dd> <dt>Mouse</dt> <dd>Mammal</dd> </dl></programlisting></td> - </tr> - </informaltable> - </figure> + </tr> + </informaltable> + </figure> - <figure xml:id="xmlc_fig_dbookNestedLists"> - <title>Nested lists</title> + <figure xml:id="xmlc_fig_dbookNestedLists"> + <title>Nested lists</title> - <informaltable border="1"> - <tr> - <th>View</th> + <informaltable border="1"> + <tr> + <th>View</th> - <th><xref linkend="glo_Docbook"/></th> + <th><xref linkend="glo_Docbook"/></th> - <th>HTML</th> - </tr> + <th>HTML</th> + </tr> - <tr> - <td valign="top"><orderedlist> - <listitem> - <para>Coffee</para> - </listitem> + <tr> + <td valign="top"><orderedlist> + <listitem> + <para>Coffee</para> + </listitem> - <listitem> - <para>Tea</para> + <listitem> + <para>Tea</para> - <itemizedlist> - <listitem> - <para>black</para> - </listitem> + <itemizedlist> + <listitem> + <para>black</para> + </listitem> - <listitem> - <para>green</para> - </listitem> - </itemizedlist> - </listitem> - </orderedlist></td> + <listitem> + <para>green</para> + </listitem> + </itemizedlist> + </listitem> + </orderedlist></td> - <td valign="top"><programlisting language="xml"><orderedlist> + <td valign="top"><programlisting language="xml"><orderedlist> <listitem> <para>Coffee</para> </listitem> @@ -914,7 +917,7 @@ </listitem> </orderedlist></programlisting></td> - <td valign="top"><programlisting language="xml"><ol> + <td valign="top"><programlisting language="xml"><ol> <li> <p>Coffee</p> </li> @@ -926,30 +929,30 @@ </ul> </li> </ol></programlisting></td> - </tr> - </informaltable> - </figure> + </tr> + </informaltable> + </figure> - <figure xml:id="xmlc_fig_dbookTables"> - <title>A table</title> + <figure xml:id="xmlc_fig_dbookTables"> + <title>A table</title> - <informaltable border="1"> - <tr> - <th>View</th> + <informaltable border="1"> + <tr> + <th>View</th> - <th><xref linkend="glo_Docbook"/></th> + <th><xref linkend="glo_Docbook"/></th> - <th>HTML</th> - </tr> + <th>HTML</th> + </tr> - <tr> - <td valign="top"><!--Real table slide rendering is odd --><mediaobject> - <imageobject> - <imagedata fileref="Ref/DbookIntro/sampleTable.png"/> - </imageobject> - </mediaobject></td> + <tr> + <td valign="top"><!--Reveal.js's table slide rendering is odd --><mediaobject> + <imageobject> + <imagedata fileref="Ref/DbookIntro/sampleTable.png"/> + </imageobject> + </mediaobject></td> - <td valign="top"><programlisting language="xml"><informaltable border="1"> + <td valign="top"><programlisting language="xml"><informaltable border="1"> <tr> <th>Col 1</th> <th>Col 2</th> @@ -963,7 +966,7 @@ </tr> </informaltable></programlisting></td> - <td valign="top"><programlisting language="xml"><table border="1"> + <td valign="top"><programlisting language="xml"><table border="1"> <tr> <th>Col 1</th> <th>Col 2</th> @@ -976,44 +979,44 @@ <td colspan="2">B</td> </tr> </table></programlisting></td> - </tr> - </informaltable> - </figure> + </tr> + </informaltable> + </figure> - <figure xml:id="xmlc_fig_dbookMathmlEquation"> - <title>A <xref linkend="glo_MathML"/> equation</title> + <figure xml:id="xmlc_fig_dbookMathmlEquation"> + <title>A <xref linkend="glo_MathML"/> equation</title> - <informaltable border="1"> - <tr> - <th>View</th> + <informaltable border="1"> + <tr> + <th>View</th> - <th><xref linkend="glo_Docbook"/></th> + <th><xref linkend="glo_Docbook"/></th> - <th>HTML</th> - </tr> + <th>HTML</th> + </tr> - <tr> - <td valign="top"><informalequation> - <m:math display="block"> - <m:mrow> - <m:mi>E</m:mi> + <tr> + <td valign="top"><informalequation> + <m:math display="block"> + <m:mrow> + <m:mi>E</m:mi> - <m:mo>=</m:mo> + <m:mo>=</m:mo> - <m:mrow> - <m:mi>m</m:mi> + <m:mrow> + <m:mi>m</m:mi> - <m:msup> - <m:mi>c</m:mi> + <m:msup> + <m:mi>c</m:mi> - <m:mi>2</m:mi> - </m:msup> + <m:mi>2</m:mi> + </m:msup> + </m:mrow> </m:mrow> - </m:mrow> - </m:math> - </informalequation></td> + </m:math> + </informalequation></td> - <td valign="top"><programlisting language="xml"><informalequation> + <td valign="top"><programlisting language="xml"><informalequation> <m:math display="block"> <m:mrow> <m:mi>E</m:mi> @@ -1029,7 +1032,7 @@ </m:math> </informalequation></programlisting></td> - <td valign="top"><programlisting language="xml"><math display="block"> + <td valign="top"><programlisting language="xml"><math display="block"> <mrow> <m:mi>E</m:mi> <m:mo>=</m:mo> @@ -1042,22 +1045,22 @@ </m:mrow> </mrow> </math></programlisting></td> - </tr> - </informaltable> - </figure> + </tr> + </informaltable> + </figure> - <figure xml:id="xmlc_fig_dbookTexEquation"> - <title>A <xref linkend="glo_TeX"/> equation</title> + <figure xml:id="xmlc_fig_dbookTexEquation"> + <title>A <xref linkend="glo_TeX"/> equation</title> - <informaltable border="1"> - <tr> - <th><xref linkend="glo_Docbook"/></th> + <informaltable border="1"> + <tr> + <th><xref linkend="glo_Docbook"/></th> - <th>HTML</th> - </tr> + <th>HTML</th> + </tr> - <tr> - <td valign="top"><programlisting language="xml"><informalequation> + <tr> + <td valign="top"><programlisting language="xml"><informalequation> <mathphrase> $ |x| = \left\{ \begin{array}{rl} @@ -1067,24 +1070,25 @@ </mathphrase> </informalequation></programlisting></td> - <td valign="top"><programlisting language="xml"><span class="mathphrase"> + <td valign="top"><programlisting language="xml"><span class="mathphrase"> $ |x| = \left\{ \begin{array}{rl} -x & \mbox{if $x&lt;0$} \\ x & \mbox{otherwise} \end{array}\right.$ </span></programlisting></td> - </tr> - - <tr> - <td colspan="2" valign="top"><informalequation> - <mathphrase>$ |x| = \left\{ \begin{array}{rl} -x &\mbox{if - $x<0$} \\ x &\mbox{otherwise} \end{array} - \right.$</mathphrase> - </informalequation></td> - </tr> - </informaltable> - </figure> + </tr> + + <tr> + <td colspan="2" valign="top"><informalequation> + <mathphrase>$ |x| = \left\{ \begin{array}{rl} -x + &\mbox{if $x<0$} \\ x &\mbox{otherwise} + \end{array} \right.$</mathphrase> + </informalequation></td> + </tr> + </informaltable> + </figure> + </section> </section> <section xml:id="xmlc_sect_Schematron"> @@ -1101,6 +1105,12 @@ </figure> </section> + <section xml:id="xmlc_sect_DbookCustomize"> + <title>Customizing</title> + + <para/> + </section> + <section xml:id="xmlc_sect_profiling"> <title>Profiling</title> @@ -1114,7 +1124,7 @@ </section> <section xml:id="xmlc_sect_editorVisualStyling"> - <title>Styling the editing application</title> + <title>Styling the editor application</title> <para>CSS + plugins</para> </section> -- GitLab