<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" version="2.0">

<channel>
	<title>casarini.org</title>
	
	<link>http://www.casarini.org/blog</link>
	<description>happy hacking</description>
	<pubDate>Fri, 26 Dec 2008 22:31:16 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.5</generator>
	<language>en</language>
	<creativeCommons:license>http://creativecommons.org/licenses/by/3.0/</creativeCommons:license>		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/casarini" type="application/rss+xml" /><item>
		<title>How to copy all child elements except specific one</title>
		<link>http://www.casarini.org/blog/archives/65</link>
		<comments>http://www.casarini.org/blog/archives/65#comments</comments>
		<pubDate>Fri, 26 Dec 2008 22:31:16 +0000</pubDate>
		<dc:creator>paolo</dc:creator>
		
		<category><![CDATA[XSL]]></category>

		<category><![CDATA[english]]></category>

		<category><![CDATA[hacking]]></category>

		<guid isPermaLink="false">http://www.casarini.org/blog/?p=65</guid>
		<description><![CDATA[If you need to copy an XML document to another filtering it from a specific element node, a good solution could be the use of XSL. The starting point is the so called "identity" template as introduced with an example in the XSLT Recommendation itself:
PLAIN TEXT
XML:




&#60;xsl:template match="@*&#124;node()"&#62;


&#160; &#160; &#60;xsl:copy&#62;


&#160; &#160; &#160; &#160; &#60;xsl:apply-templates select="@*&#124;node()"/&#62;


&#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>If you need to copy an XML document to another filtering it from a specific element node, a good solution could be the use of XSL. The starting point is the so called "identity" template as introduced with an <a href="http://www.w3.org/TR/xslt#copying">example</a> in the XSLT Recommendation itself:</p>
<div class="igBar"><span id="lxml-7"><a href="#" onclick="javascript:showPlainTxt('xml-7'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">XML:</span>
<div id="xml-7">
<div class="xml">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;xsl</span>:template <span style="color: #000066;">match</span>=<span style="color: #ff0000;">"@*|node()"</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;xsl</span>:copy<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;xsl</span>:apply-templates <span style="color: #000066;">select</span>=<span style="color: #ff0000;">"@*|node()"</span><span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/xsl</span>:copy<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/xsl</span>:template<span style="font-weight: bold; color: black;">&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
The above template copies all attributes, @*, and all nodes being children of other nodes, node(): element nodes, text nodes, comment nodes and processing instruction nodes. Everything is copied. "Recursion" in the above case is when the template ends its job by calling other templates including itself.</p>
<p>Copying everything is no fun but becomes very useful when we add exceptions to the copying. It gets useful when we "copy everything but". The step by step approach in the copying is the big trick. For each attribute, element, etc., we can decide to do something else by adding other templates overruling the copying behavior.</p>
<p>Let's start hacking our XSL stylesheet to do something more fun...<br />
<span id="more-65"></span></p>
<h3>1. The Input</h3>
<p>In the examples we will use the following file as xml input.</p>
<div class="igBar"><span id="lxml-8"><a href="#" onclick="javascript:showPlainTxt('xml-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">XML:</span>
<div id="xml-8">
<div class="xml">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;</span>?xml <span style="color: #000066;">version</span>=<span style="color: #ff0000;">"1.0"</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">"UTF-8"</span>?<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #00bbdd;">&lt;!DOCTYPE book PUBLIC &quot;-//OASIS//DTD DocBook XML V4.4//EN&quot;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;http://www.docbook.org/xml/4.4/docbookx.dtd&quot;&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;book<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;bookinfo<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;title<span style="font-weight: bold; color: black;">&gt;</span></span></span>Beginning XML<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/title<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/bookinfo<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;part<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;title<span style="font-weight: bold; color: black;">&gt;</span></span></span>First Part <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/title<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;chapter<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;title<span style="font-weight: bold; color: black;">&gt;</span></span></span>What is XML?<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/title<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;para<span style="font-weight: bold; color: black;">&gt;</span></span></span>bla bla<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/para<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/chapter<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;chapter<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;title<span style="font-weight: bold; color: black;">&gt;</span></span></span>Well-Formed XML.<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/title<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;para<span style="font-weight: bold; color: black;">&gt;</span></span></span>bla bla<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/para<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/chapter<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/part<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;part<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;title<span style="font-weight: bold; color: black;">&gt;</span></span></span>Second Part <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/title<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;chapter<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;title<span style="font-weight: bold; color: black;">&gt;</span></span></span>XML Namespaces.<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/title<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;para<span style="font-weight: bold; color: black;">&gt;</span></span></span>bla bla<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/para<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/chapter<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;chapter<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;title<span style="font-weight: bold; color: black;">&gt;</span></span></span>XSLT.<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/title<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;para<span style="font-weight: bold; color: black;">&gt;</span></span></span>bla bla<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/para<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/chapter<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/part<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/book<span style="font-weight: bold; color: black;">&gt;</span></span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h3>2. Filter a specific element</h3>
<h4>2.1. The Stylesheet</h4>
<div class="igBar"><span id="lxml-9"><a href="#" onclick="javascript:showPlainTxt('xml-9'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">XML:</span>
<div id="xml-9">
<div class="xml">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;xsl</span>:template <span style="color: #000066;">match</span>=<span style="color: #ff0000;">"@*|node()"</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;xsl</span>:copy<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;xsl</span>:apply-templates <span style="color: #000066;">select</span>=<span style="color: #ff0000;">"@*|node()"</span><span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/xsl</span>:copy<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/xsl</span>:template<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;xsl</span>:template <span style="color: #000066;">match</span>=<span style="color: #ff0000;">"part"</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;xsl</span>:copy-of <span style="color: #000066;">select</span>=<span style="color: #ff0000;">"*[not(self::thisElement)]"</span><span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/xsl</span>:template<span style="font-weight: bold; color: black;">&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
The first template matches all attributes and all nodes being children of other nodes, and copies them over.</p>
<p>The second template matches the <code>part</code> elements of the context element and makes a copy of them discarting the <code>self::thisElement</code>. The first template puts node after node in context making it possible for the second template to match the <code>part</code> elements.</p>
<h4>2.2. The Output</h4>
<div class="igBar"><span id="lxml-10"><a href="#" onclick="javascript:showPlainTxt('xml-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">XML:</span>
<div id="xml-10">
<div class="xml">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;</span>?xml <span style="color: #000066;">version</span>=<span style="color: #ff0000;">"1.0"</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">"UTF-8"</span>?<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #00bbdd;">&lt;!DOCTYPE book PUBLIC &quot;-//OASIS//DTD DocBook XML V4.4//EN&quot;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;http://www.docbook.org/xml/4.4/docbookx.dtd&quot;&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;book<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;bookinfo<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;title<span style="font-weight: bold; color: black;">&gt;</span></span></span>Beginning XML<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/title<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/bookinfo<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;title<span style="font-weight: bold; color: black;">&gt;</span></span></span>First Part <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/title<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;chapter<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;title<span style="font-weight: bold; color: black;">&gt;</span></span></span>What is XML?<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/title<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;para<span style="font-weight: bold; color: black;">&gt;</span></span></span>bla bla<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/para<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/chapter<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;chapter<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;title<span style="font-weight: bold; color: black;">&gt;</span></span></span>Well-Formed XML.<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/title<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;para<span style="font-weight: bold; color: black;">&gt;</span></span></span>bla bla<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/para<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/chapter<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;title<span style="font-weight: bold; color: black;">&gt;</span></span></span>Second Part <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/title<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;chapter<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;title<span style="font-weight: bold; color: black;">&gt;</span></span></span>XML Namespaces.<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/title<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;para<span style="font-weight: bold; color: black;">&gt;</span></span></span>bla bla<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/para<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/chapter<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;chapter<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;title<span style="font-weight: bold; color: black;">&gt;</span></span></span>XSLT.<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/title<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;para<span style="font-weight: bold; color: black;">&gt;</span></span></span>bla bla<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/para<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/chapter<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/book<span style="font-weight: bold; color: black;">&gt;</span></span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
The output is not valid because part's title has been copied as all the other childs of <code>part</code> elements.</p>
<h3>3. Filter a specific element and one of its child</h3>
<h4>3.1. The Stylesheet</h4>
<div class="igBar"><span id="lxml-11"><a href="#" onclick="javascript:showPlainTxt('xml-11'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">XML:</span>
<div id="xml-11">
<div class="xml">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;xsl</span>:template <span style="color: #000066;">match</span>=<span style="color: #ff0000;">"@*|node()"</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;xsl</span>:copy<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;xsl</span>:apply-templates <span style="color: #000066;">select</span>=<span style="color: #ff0000;">"@*|node()"</span><span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/xsl</span>:copy<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/xsl</span>:template<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;xsl</span>:template <span style="color: #000066;">match</span>=<span style="color: #ff0000;">"part"</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;xsl</span>:for-each <span style="color: #000066;">select</span>=<span style="color: #ff0000;">"*"</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;xsl</span>:if <span style="color: #000066;">test</span>=<span style="color: #ff0000;">"name()!='title'"</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;xsl</span>:copy<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;xsl</span>:apply-templates <span style="color: #000066;">select</span>=<span style="color: #ff0000;">"@*|node()"</span><span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/xsl</span>:copy<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/xsl</span>:if<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/xsl</span>:for-each<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/xsl</span>:template<span style="font-weight: bold; color: black;">&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
As before, the first template matches all attributes and all nodes being children of other nodes, and copies them over.</p>
<p>The second template matches the <code>part</code> elements of the context element and makes a copy of their childs skipping those of them called <code>title</code>.</p>
<h4>3.2. The Output</h4>
<div class="igBar"><span id="lxml-12"><a href="#" onclick="javascript:showPlainTxt('xml-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">XML:</span>
<div id="xml-12">
<div class="xml">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;</span>?xml <span style="color: #000066;">version</span>=<span style="color: #ff0000;">"1.0"</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">"UTF-8"</span>?<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #00bbdd;">&lt;!DOCTYPE book</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; PUBLIC &quot;-//OASIS//DTD DocBook XML V4.5//EN&quot; &quot;http://www.docbook.org/xml/4.5/docbookx.dtd&quot;&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;book<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;bookinfo<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;title<span style="font-weight: bold; color: black;">&gt;</span></span></span>Beginning XML<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/title<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/bookinfo<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;chapter<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;title<span style="font-weight: bold; color: black;">&gt;</span></span></span>What is XML?<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/title<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;para<span style="font-weight: bold; color: black;">&gt;</span></span></span>bla bla<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/para<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/chapter<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;chapter<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;title<span style="font-weight: bold; color: black;">&gt;</span></span></span>Well-Formed XML.<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/title<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;para<span style="font-weight: bold; color: black;">&gt;</span></span></span>bla bla<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/para<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/chapter<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;chapter<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;title<span style="font-weight: bold; color: black;">&gt;</span></span></span>XML Namespaces.<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/title<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;para<span style="font-weight: bold; color: black;">&gt;</span></span></span>bla bla<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/para<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/chapter<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;chapter<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;title<span style="font-weight: bold; color: black;">&gt;</span></span></span>XSLT.<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/title<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;para<span style="font-weight: bold; color: black;">&gt;</span></span></span>bla bla<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/para<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/chapter<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/book<span style="font-weight: bold; color: black;">&gt;</span></span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
That's all: <code>part</code> elements has been filtered!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.casarini.org/blog/archives/65/feed</wfw:commentRss>
		</item>
		<item>
		<title>Ernesto Assante, Copio, dunque sono.</title>
		<link>http://www.casarini.org/blog/archives/59</link>
		<comments>http://www.casarini.org/blog/archives/59#comments</comments>
		<pubDate>Sun, 14 Dec 2008 22:48:00 +0000</pubDate>
		<dc:creator>paolo</dc:creator>
		
		<category><![CDATA[libri]]></category>

		<guid isPermaLink="false">http://www.casarini.org/blog/?p=59</guid>
		<description><![CDATA[Copio per realizzare la cassetta da ascoltare in macchina o da regalare alla fidanzata e nel farlo mi esprimo, creo qualcosa di mio, che mi identifica e dunque sono. Così riassumo come l'autore di questo ottimo saggio spiega come il dominio della copia sia passato col tempo dalle case discografiche al consumatore.
Il saggio in questione [...]]]></description>
			<content:encoded><![CDATA[<p><img alt="" src="/images/assante_cover.png" title="Ernesto Assante, Copio, dunque sono." align="left" width="120" height="180" /><b>Copio</b> per realizzare la cassetta da ascoltare in macchina o da regalare alla fidanzata e nel farlo mi esprimo, creo qualcosa di mio, che mi identifica e <b>dunque sono</b>. Così riassumo come l'autore di questo ottimo <a href="http://ilmiolibro.kataweb.it/libro.asp?id=75965">saggio</a> spiega come il dominio della copia sia passato col tempo dalle case discografiche al consumatore.</p>
<p>Il saggio in questione però parte dal principio, da quando dicendo "Vado a comprare la quinta di Beethoven" si intendeva lo spartito e non il cd, vengono toccati tutti i passaggi culturali legati alla musica e ai supporti su cui essa è stata scritta e registrata nell'arco del tempo. L'autore scrive con uno stile chiaro, molto ben documentato e per nulla pesante. A parte il titolo provocatorio, il libro in questione è un ottimo saggio che racconta della musica e dei sui supporti, dei musicisti e delle persone che hanno lavorato, inventato e amato per e grazie alla musica.</p>
<p>Il viaggio che Assante ci fa fare nel tempo con il suo racconto è piacevole e pervaso dell'amore che, evidentemente, lui stesso ha per la musica e per quegli oggetti che, come consumatore di musica, ha comprato, collezionato e curato. Anche la musica vista come bene di consumo viene portata allo scoperto e come essa attraverso i suoi modi di essere fruita non sia tanto <i>"importante per la soddisfazione che può generare ma per come agisca in qualità di marchio di differenziazione socio-culturale"</i>.</p>
<p>Ho letto con piacere questo libro anche se, forse, non l'avrei mai comprato se non avesse avuto quel titolo un po' provocatorio e se non fosse stato pubblicato affidandosi a un sito di "self publishing" come <i>ilmiolibro.it</i>.<br />
<span id="more-59"></span><br />
Ero curioso di prendere un libro sul <i>ilmiolibro.it</i> per analizzare dal punto di vista tecnico l'oggetto libro in sé oltre che il suo contenuto. Così ho approfittato dell'occasione e mi è andata decisamente bene dal punto di vista del contenuto, un po' meno bene, e questo era forse prevedibile, dal punto di vista tecnico.</p>
<p>Ci troviamo davanti, infatti, a qualcosa di meno di una edizione economica di un libro stampato da una casa editrice tradizionale, la copertina è di pessima qualità e, a fine libro, nella parte centrale (sul bordo dove si appoggiano le dita per sfogliare) la pellicola che la riveste ha incominciato a saltare via e la rilegatura a colla non è delle migliori.<br/><br />
Vista quindi la qualità dell'opera mi chiedo perché l'autore non abbia preferito affidare il suo lavoro ad una casa editrice, sono sicuro avrebbe trovato chi glielo avrebbe pubblicato. Forse non l'avrebbero pubblicato con gli stessi tempi o forse ragioni di opportunità visto lo sforzo pubblicitario che <em>ilmiolibro.it</em> sta operando per affermarsi come alternativa valida per autori esordienti.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.casarini.org/blog/archives/59/feed</wfw:commentRss>
		</item>
		<item>
		<title>Speed up web session access</title>
		<link>http://www.casarini.org/blog/archives/32</link>
		<comments>http://www.casarini.org/blog/archives/32#comments</comments>
		<pubDate>Sat, 29 Nov 2008 20:46:17 +0000</pubDate>
		<dc:creator>paolo</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[english]]></category>

		<category><![CDATA[hacking]]></category>

		<guid isPermaLink="false">http://www.casarini.org/blog/?p=32</guid>
		<description><![CDATA[I recently solved a problem common to many heavy used web application following an idea of a friend of mine.
The problem is how to efficently manage the sessions of a web application when the number of them is high (500,000 for example) and the use of them his quite frequent (&#732;50,000 pages/day in my case).
A [...]]]></description>
			<content:encoded><![CDATA[<p>I recently solved a problem common to many heavy used web application following an idea of a <a href="http://www.codeflyer.com/">friend</a> of mine.</p>
<p>The problem is how to efficently manage the sessions of a web application when the number of them is high (500,000 for example) and the use of them his quite frequent (&tilde;50,000 pages/day in my case).</p>
<p>A common approach is to store web sessions in a database table where the <em>session identifier</em> and the <em>expiry date</em> are indexed, but due to the fact that each time a session is used (read) is also updated (written), while the number of them grows, the time spent to update the indexes associated to the web session table grows too. The result of this situation, relatively to the hardware you use, is that to update a session the application could take 2-5 seconds: a time that is not adequate to the world wide web.</p>
<p>So a better solution has to be applied or better we have to adapt the databse solution to the number of sessions that has to be managed.</p>
<p>I don't consider my solution particulary smart, but it's very simple, effective and could easily scale...<br />
<span id="more-32"></span><br />
As I already said, the idea is very simple and is to spread the sessions uniformly over more than one table. The number of tables should be proportional to the sessions to manage.</p>
<p>The solution is built on the default implementation of the database handler for web sessions provided by the <a href="http://adodb.sourceforge.net/">ADOdb library</a> for PHP. The default implementation is based on the <code>sessions/adodb-session.php</code> file, that contains the database handler, and on a table with the following schema:</p>
<div class="igBar"><span id="lsql-16"><a href="#" onclick="javascript:showPlainTxt('sql-16'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-16">
<div class="sql">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`sessions`</span> <span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #ff0000;">`sesskey`</span> varchar<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">32</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">BINARY</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">''</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #ff0000;">`expiry`</span> int<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">11</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">UNSIGNED</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'0'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #ff0000;">`expireref`</span> varchar<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">64</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">''</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #ff0000;">`data`</span> longtext,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span>&nbsp; <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">`sesskey`</span><span style="color:#006600; font-weight:bold;">&#41;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #993333; font-weight: bold;">KEY</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">`expity`</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span> TYPE=MyISAM </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The bigger problem of this solution is to find a fast algorithm  to spread the sessions uniformly over more tables. In my case, I solved this problem taking advange from the way the session identifiers are created. Infact, these indentifiers are generated calculating the <code>md5</code> string from a random integer (see the code below) and I decided to use the first character of the identifier string to choose on which table persist the corresponding session.</p>
<div class="igBar"><span id="lphp-17"><a href="#" onclick="javascript:showPlainTxt('php-17'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-17">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// how the session identifier is generated</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$sesskey</span> = <a href="http://www.php.net/md5"><span style="color:#000066;">md5</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/uniqid"><span style="color:#000066;">uniqid</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/rand"><span style="color:#000066;">rand</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>, <span style="color:#000000; font-weight:bold;">true</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>To prepare the backend (a MySql database in my case), I created 16 tables like the one described above with the following names:<br />
<code>sessions_0</code>, <code>sessions_1</code>, <code>sessions_2</code>, <code>sessions_3</code>, <code>sessions_4</code>, <code>sessions_5</code>, <code>sessions_6</code>, <code>sessions_7</code>, <code>sessions_8</code>, <code>sessions_9</code>, <code>sessions_a</code>, <code>sessions_b</code>, <code>sessions_c</code>, <code>sessions_d</code>, <code>sessions_e</code>, <code>sessions_f</code>.</p>
<p>Then I've modified the default ADOdb session handler to work on the right table taking as discriminant factor the identifier of the session to manage. The changes I made are very simple, as an example, the code below show the pached lines of the <code>read</code> and <code>write</code> functions:</p>
<div class="igBar"><span id="lphp-18"><a href="#" onclick="javascript:showPlainTxt('php-18'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-18">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">/*</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp; Slurp in the session variables and return the serialized string</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">*/</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/static"><span style="color:#000066;">static</span></a> <span style="color:#000000; font-weight:bold;">function</span> read<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$key</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$conn</span>&nbsp; &nbsp;=&amp; ADODB_Session::_conn<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$data</span>&nbsp; &nbsp;= ADODB_Session::<span style="color:#006600;">dataFieldName</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$filter</span>&nbsp;= ADODB_Session::<span style="color:#006600;">filter</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$table</span>&nbsp; = ADODB_Session::<span style="color:#006600;">table</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> . <span style="color:#FF0000;">'_'</span> . <span style="color:#0000FF;">$key</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; ...</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">/*!</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp; Write the serialized data to a database.</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">&nbsp; &nbsp; If the data has not been modified since the last read(), we do not write.</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">*/</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/static"><span style="color:#000066;">static</span></a> <span style="color:#000000; font-weight:bold;">function</span> write<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$key</span>, <span style="color:#0000FF;">$val</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/global"><span style="color:#000066;">global</span></a> <span style="color:#0000FF;">$ADODB_SESSION_READONLY</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>!<a href="http://www.php.net/empty"><span style="color:#000066;">empty</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$ADODB_SESSION_READONLY</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#616100;">return</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$clob</span>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;= ADODB_Session::<span style="color:#006600;">clob</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$conn</span>&nbsp; &nbsp;&nbsp; &nbsp;=&amp; ADODB_Session::_conn<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$crc</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = ADODB_Session::_crc<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$data</span>&nbsp; &nbsp;&nbsp; &nbsp;= ADODB_Session::<span style="color:#006600;">dataFieldName</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$debug</span>&nbsp; &nbsp; = ADODB_Session::<span style="color:#006600;">debug</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$driver</span>&nbsp;&nbsp;= ADODB_Session::<span style="color:#006600;">driver</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$expire_notify</span>&nbsp; = ADODB_Session::<span style="color:#006600;">expireNotify</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$filter</span>&nbsp;&nbsp;= ADODB_Session::<span style="color:#006600;">filter</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$lifetime</span>&nbsp; &nbsp;&nbsp; &nbsp;= ADODB_Session::<span style="color:#006600;">lifetime</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$table</span>&nbsp; &nbsp; = ADODB_Session::<span style="color:#006600;">table</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> . <span style="color:#FF0000;">'_'</span> . <span style="color:#0000FF;">$key</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; ... </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The patch to apply to the <code>gc</code> function is a little more complex because this function has to loop on all tables and delete old sessions: this patch is left as an exercise for the reader <img src='http://www.casarini.org/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>For me, the solution described above rocks and I think it can also scale easily taking as descriminant factor 2 or even 3 characters from the session identifier and using the <code>%</code> math operator to limit the tables needed.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.casarini.org/blog/archives/32/feed</wfw:commentRss>
		</item>
		<item>
		<title>CyBook, Open eBook e Kanji</title>
		<link>http://www.casarini.org/blog/archives/29</link>
		<comments>http://www.casarini.org/blog/archives/29#comments</comments>
		<pubDate>Thu, 23 Oct 2008 21:54:40 +0000</pubDate>
		<dc:creator>paolo</dc:creator>
		
		<category><![CDATA[digital publishing]]></category>

		<category><![CDATA[hardware]]></category>

		<category><![CDATA[libri]]></category>

		<guid isPermaLink="false">http://www.casarini.org/blog/archives/29</guid>
		<description><![CDATA[Grazie al CyBook Tour ho avuto la possibilità di provate uno dei più interessanti eBook reader basati sulla tecnologia E Ink attualmente in commercio. L'oggetto in questione è il CyBook Gen3 (nella foto) della francesce Bookeen.
Per lavoro mi interesso eBook e per essere più precisi di ePublishing e quindi la settimana di prova che mi [...]]]></description>
			<content:encoded><![CDATA[<p>Grazie al <a href="http://cybook-tour.simplicissimus.it/">CyBook Tour</a> ho avuto la possibilità di provate uno dei più interessanti eBook reader basati sulla tecnologia <img src="/images/Cybook-in-hand.jpg" align="left" width="150"><a href="http://it.wikipedia.org/wiki/E-ink">E Ink</a> attualmente in commercio. L'oggetto in questione è il <a href="http://www.bookeen.com/ebook/ebook-reading-device.aspx">CyBook Gen3</a> (nella foto) della francesce Bookeen.</p>
<p>Per lavoro mi interesso eBook e per essere più precisi di ePublishing e quindi la settimana di prova che mi è stata concessa mi ha dato la possibilità di verificare alcune curiosità legate al mondo degli eBook reader di questo genere. In particolare mi sono soffermato a studiare i formati supportati e quali difficoltà si incontrano nella produzione di libri in tali formati perché siano utilmente fruibili su device di questo genere, soprattutto considerando di partire dai formati già disponibili all'interno di una produzione libraria tradizionale.<br />
<span id="more-29"></span></p>
<h3>Formati "supportati"</h3>
<p>Nella scheda tecnica del prodotto sul sito del produttore c'è l'<a href="http://www.bookeen.com/specs/ebook-software.aspx">elenco dettagliato</a> dei formati di file supportati e non li sto a ripetere, sono tanti e si ha l'impressione di avere la possibilità di trasferire con facilità la propria libreria di eBook sul device e incominciare a godersi da subito la spettacolarità della tecnologia E Ink.<br />
In realtà questo è vero solo in parte, per tutti i formati di file di tipo ''reflowable'' come il MobiPocket&trade; e il PalmDoc il godimento è garantito, la lettura è subito piacevole e l'effetto di grande impatto. Per tutti quei formati di file che invece contengono al loro interno indicazioni precise sul layout della pagina come il PDF e in certi casi l'HTML, la lettura è spesso scomoda e non ottimale amenochè i file nei formati in questione non siano stati reimpaginati appositamente come quelli presenti sul dispositivo in demo.</p>
<h4>PDF non ottimizzati</h4>
<p>Il caso più frequente che penso si debba prendere in considerazione è quello della lettura di libri, o più in generale documenti, in formato PDF che già possediamo e che vogliamo leggere sul nostro nuovo dispositivo. Nella maggior parte dei casi avremo a nostra disposizione PDF fatti per essere stampanti su fogli A4. Tali documenti visualizzati sul CyBook, anche se ci mettiamo a giocare con le varie possibilità di zoom, difficilmente riusciranno ad essere visualizzati per interno nello schermo di 6" a disposizione rimanendo leggibili. Per mantenere la leggibilità di documenti PDF di questo genere, il software permette la gestione di una pagina più grande dello schermo consentendo di spostarci con i tasti cursore ma, a mio avviso, così facendo la lettura diventa scomoda e alla fine stancante.</p>
<h4>Open eBook (.epub) ignorato</h4>
<p>Recentemente si sta diffondendo un formato tecnologicamente piuttosto interessante per l'ePublishing chiamato <i>Open eBook</i>. Tale formato è sostenuto e sviluppato dall'<a href="http://www.openebook.org/">International Digital Publishing Forum</a> e si sta affermando grazie al fatto che aziende come Adobe con il suo <a href="http://www.adobe.com/products/digitaleditions/">Adobe Digital Editions</a> e Amazon con il reader e il writer di file in formato MobiPocket&trade; lo hanno incominciato a supportare seriamente.<br />
Purtroppo, almeno per ora, tale formato non è tra quelli supportati dal CyBook. Se lo diventasse in maniera completa, non esiterei a comprarmi un CyBook come strumento di lavoro e... di divertimento ;-).</p>
<h3>Kanji</h3>
<p>Ho un <a href="http://www.codeflyer.com/">amico</a> con cui lavoro appassionato del Giappone, della cultura giapponese e che studia il giapponese, e così ho fatto giocare anche lui con il CyBook che mi è stato prestato per vedere se era possibile leggere libri scritti con i kanji giapponesi.<br />
Il primo approccio è stato deludente: file di testo in formato UTF-8 pieni di kanji non vengono visualizzati correttamente. Poi ha creato un documento PDF con una serie di kanji utilizzando una font che li contiene (un normale Arial un po' carrozzato), nel PDF è stato caricato automaticamente anche la font e sul CyBook i kanji erano perfettamente leggibili.<br />
Infine facendo qualche ricerca ha capito anche come rendere possibile la lettura di file in formato MobiPocket&trade; con i kanji. La cosa è piuttosto semplice, basta avere una font che li contiene e dopo averla messa a disposizione del MobiPocket&trade; reader del CyBook copiandola nella cartella <code>Font</code>, bisogna scegliere tale font come quella che il CyBook deve utilizzare nella visualizzazione al posto di quella di default (il cambio della font per la visualizzazione è una operazione prevista dal menu disponibile durante la lettura di file in formati di tipo ''reflowable'').</p>
<h3>Conclusioni</h3>
<p>Il CyBook Gen3 è sicuramente uno dei migliori lettori di eBook basati su tecnologia E Ink in commercio. &Egrave;, a mio avviso, l'unico che si avvicina come dimensioni, peso e praticità d'uso a un libro vero, da infilare nella borsa da lavoro prima di uscire e leggerselo mentre si è sull'autobus. Certo è soprattutto adatto alla lettura di un romanzo o di un saggio e poco si presta alla consultazione di un manuale, ma per la fruizione di questi ultimi la tecnologia deve ancora fare "qualche" passo in avanti.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.casarini.org/blog/archives/29/feed</wfw:commentRss>
		</item>
		<item>
		<title>Delete files recursively with a specific extension</title>
		<link>http://www.casarini.org/blog/archives/28</link>
		<comments>http://www.casarini.org/blog/archives/28#comments</comments>
		<pubDate>Wed, 10 Sep 2008 20:14:41 +0000</pubDate>
		<dc:creator>paolo</dc:creator>
		
		<category><![CDATA[english]]></category>

		<category><![CDATA[hacking]]></category>

		<guid isPermaLink="false">http://www.casarini.org/blog/archives/28</guid>
		<description><![CDATA[If you want to delete, for example, only .bak files throughout a directory tree you can try with the following command:

$ find . -name *.bak -exec rm {} \;

Using the same approach you can solve more complex problems. For example you can delete recursively all directories older than one week:

$ find . -mtime +7 -type [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to delete, for example, only .bak files throughout a directory tree you can try with the following command:<br />
<code><br />
$ find . -name *.bak -exec rm {} \;<br />
</code></p>
<p>Using the same approach you can solve more complex problems. For example you can delete recursively all <i>directories</i> older than one week:<br />
<code><br />
$ find . -mtime +7 -type d -exec rm -rf {} \;<br />
</code></p>
<p>Another example, for subversion users, could be the way to <i>clean up</i> a check-out directory:<br />
<code><br />
$ find . -name lock -exec rm {} \;<br />
</code></p>
<p>Or a way to drop all <i>.svn</i> metadata directories:<br />
<code><br />
$ find . -name .svn -exec -type d rm -rf {} \;<br />
</code></p>
<p>Now it's up to you to <i>find</i> other examples...</p>
]]></content:encoded>
			<wfw:commentRss>http://www.casarini.org/blog/archives/28/feed</wfw:commentRss>
		</item>
		<item>
		<title>Paolo Legrenzi, Credere</title>
		<link>http://www.casarini.org/blog/archives/27</link>
		<comments>http://www.casarini.org/blog/archives/27#comments</comments>
		<pubDate>Sun, 24 Aug 2008 21:19:28 +0000</pubDate>
		<dc:creator>paolo</dc:creator>
		
		<category><![CDATA[libri]]></category>

		<guid isPermaLink="false">http://www.casarini.org/blog/archives/27</guid>
		<description><![CDATA[La lettura attenta del saggio di Paolo Legrenzi sul credere fornisce gli strumenti per capire quando sia importante, nella nostra vita quotidiana, il credere ciò di cui non siamo siamo certi. Se non credessimo nelle cose, in noi stessi e negli altri la vita sarebbe impossibile.
Ho letto con piacere questo libro, l'ho trovato stimolante e [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.mulino.it/edizioni/volumi/image/copertine/12437.gif" alt="copertina" align='left'/>La lettura attenta del <a href="http://www.mulino.it/edizioni/volumi/scheda_volume.php?vista=scheda&#038;ISBNART=12437">saggio di Paolo Legrenzi sul <i>credere</i></a> fornisce gli strumenti per capire quando sia importante, nella nostra vita quotidiana, il <i>credere</i> ciò di cui non siamo siamo certi. Se non credessimo nelle cose, in noi stessi e negli altri la vita sarebbe impossibile.<br />
Ho letto con piacere questo libro, l'ho trovato stimolante e accurato: l'autore spiega con esempi e molti riferimenti alla letteratura tutti i meccanismi del <i>credere</i> in tutte le sue forme.</p>
<p>Molto interessante l'analisi dei meccanismi attraverso i quali noi <i>supercrediamo</i> quando dobbiamo dare delle stime riguardo a noi, al nostro lavoro, alle nostre scelte e conoscenze. In particolare, questo <i>supercredere</i> lo vedo applicare da me e dai miei colleghi e collaboratori giornalmente nel lavoro che faccio (consulente software).<br />
Immediatamente si spiega perché la realizzazione di software è spesso in ritardo rispetto alla data di consegna prevista, e perché un buon project manager deve saper applicare il giusto "moltiplicatore" di <i>stima a finire</i> in base alla propensione al <i>supercredere</i> di ciascun elemento del suo team: appliccare i giusti moltiplicatori aiuta a fare una stima complessiva più accurata.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.casarini.org/blog/archives/27/feed</wfw:commentRss>
		</item>
		<item>
		<title>Nako for kids</title>
		<link>http://www.casarini.org/blog/archives/26</link>
		<comments>http://www.casarini.org/blog/archives/26#comments</comments>
		<pubDate>Wed, 20 Aug 2008 11:42:14 +0000</pubDate>
		<dc:creator>paolo</dc:creator>
		
		<category><![CDATA[Maemo]]></category>

		<category><![CDATA[hacking]]></category>

		<guid isPermaLink="false">http://www.casarini.org/blog/archives/26</guid>
		<description><![CDATA[In vacanza in montagna con una bimba di 3 anni e mezzo e con un bimbo di due e mezzo, nelle giornate di mal tempo (per fortuna poche quest'anno) bisogna inventarsi cose divertenti che possano, almeno in parte sostituire la possibilità di correre nei prati.
Così mi sono messo a cercare se c'era un giochino da [...]]]></description>
			<content:encoded><![CDATA[<p>In vacanza in montagna con una bimba di 3 anni e mezzo e con un bimbo di due e mezzo, nelle giornate di mal tempo (per fortuna poche quest'anno) bisogna inventarsi cose divertenti che possano, almeno in parte sostituire la possibilità di correre nei prati.</p>
<p>Così mi sono messo a cercare se c'era un giochino da installare sul mio Nokia N800 che fosse stimolante per loro. Mi sono ricordato di <a href="http://koti.welho.com/jpavelek/tmp/770/">Nako</a>, un gioco di memoria non troppo difficile (tipo BIS) da far provare alla mia figlia più grande.</p>
<p>Il gioco, nella sua versione facile con 15 coppie di figure da trovare, potrebbe essere adatto, ma le figure mostrate di default sono le foto delle vacanze dell'autore: sicuramente libere da copyrigth, ma poco interessanti per un bambino.</p>
<p>Per fortuna l'applicazione permette d'usare set di immagini auto-prodotti. Sfruttando questa possibilità me ne sono fatto uno che i miei figli potessero apprezzare. Le icone usate le ho raccattate in giro per Internet e visto che prepare il file unico con le 21 icone è facile ma non banale né immediato, lo metto a disposizione per chi lo volesse usare.</p>
<p>Il file è un'unica immagine bmp di dimensione 2100x70 contenente le 21 icone (100x70 ciascuna) con estensione .tileset da posizionare nella directory /home/user/MyDocs/.images</p>
<p><a href="http://www.casarini.org/images/4kids.tileset">Scarica il file</a></p>
<p>Quello seguente è uno screenshot di Nako che mostra una partita fatta con il mio set di icone.<br />
<img src="/images/Nako4kids02.png" alt="screenshot" height="240" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.casarini.org/blog/archives/26/feed</wfw:commentRss>
		</item>
		<item>
		<title>Modem Alcatel X020 su Mac OSX</title>
		<link>http://www.casarini.org/blog/archives/25</link>
		<comments>http://www.casarini.org/blog/archives/25#comments</comments>
		<pubDate>Wed, 23 Jul 2008 21:15:08 +0000</pubDate>
		<dc:creator>paolo</dc:creator>
		
		<category><![CDATA[hardware]]></category>

		<category><![CDATA[mobile]]></category>

		<guid isPermaLink="false">http://www.casarini.org/blog/archives/25</guid>
		<description><![CDATA[Avevo bisogno di un modem HSDPA da attaccare al mio MacBook che non fosse vincolato ad alcun operatore, che costasse poco e che facesse bene il suo mestiere.
Così per 79&#8364; ho acquistato il SUPERINTERNETPACK di Wind con all'interno il modem Alcatel OneTouch X020. Sulla scatola c'è scritto che è necessario avere Windows XP o Vista, [...]]]></description>
			<content:encoded><![CDATA[<p><img src="/images/Alcatel X020.jpg" align="right" height="200">Avevo bisogno di un modem HSDPA da attaccare al mio MacBook che non fosse vincolato ad alcun operatore, che costasse poco e che facesse bene il suo mestiere.</p>
<p>Così per 79&euro; ho acquistato il SUPERINTERNETPACK di Wind con all'interno il modem <a href="http://www.wind.it/it/telefoni/telefono56.phtml?sez=Aziende">Alcatel OneTouch X020</a>. Sulla scatola c'è scritto che è necessario avere Windows XP o Vista, ma fidandomi del venditore l'ho provata sul mio Mac (con Mac OSX 10.5.4) è tutto ha funzionato a meraviglia!</p>
<p><span id="more-25"></span></p>
<h2>Installazione e primo utilizzo</h2>
<ul>
<li>Ho preso la mia USIM di 3 con il piano tarriffario B.MAIL 900 e l'ho inserita nel modem come descritto nella <i>Guida Rapida</i>;</li>
<li>ho collegato il modem ha una porta USB del mio MacBook;</li>
<li>poco dopo il modem viene visto come disco (chiamato "USB MODEM"), al suo interno oltre ai manuali in varie lingue e i driver per Windows, c'è un eseguibile per Mac OSX chiamato "Start USB Modem";</li>
<li>ho eseguito il programma "Start USB Modem": la prima volta chiede la password di amministrazione per l'installazione dei driver, alla fine dell'installazione chiede di effettuare un riavvio del sistema;
<li>
<li>dopo aver effettuato il riavvio del sistema il modem usb viene nuovamente visto come disco e rilanciando l'applicazione "Start USB Modem", questa volta, parte un applicazione dall'interfaccia molto semplice (nel caso abbiate un PIN di protezione vi verrà richiesto);<img src="/images/alcatel1.png" width="308"></li>
<li>ora bisogna impostare il profilo di connessione selezionando <i>Settings->Connection Profile...</i>;</li>
<li>nel dialog che appare premere il tasto <i>Add</i> per aggiungere un profilo: di seguito ho riportato i dati che io ho impostato per il mio profilo;<img src="/images/alcatel2.png" width="300"></li>
<li>una volta creato il proprio profilo bisogna impostarlo come quello di default, selezionadolo e premendo l'apposito bottone;<img src="/images/alcatel4.png" height="350"></li>
<li>ora si è pronti per connersi a Internet... basta premere il bottone <i>Connect</i> sull'interfaccia principale<img src="/images/alcatel3.png" width="308"/></li>
</ul>
<h2>Conclusioni</h2>
<p>L'ho fatta un po' lunga per essere molto dettagliato ma le operazioni sono state tutte semplici e intuitive.<br />
Tra i <i>Settings</i> sono disponibili anche altre impostazioni che non sono stato a descrivere perché non essenziali per collegarsi la prima volta, ma che potrebbero essere utili per alcuni usi specifici. Tra queste la possibilità di fissare un operatore, il protocollo e la frequenza da utilizzare.<br />
Nell'applicazione per Mac OSX non ho trovato alcune delle funzionalità descritte come la possibilità di inviare SMS e di organizzare i contatti che, evidentemente, sono disponibili solo per la piattaforma Windows.<br />
Per ora l'ho provata solo in città sotto copertura HSDPA con risultati eccellenti, sia per la velocità che per la stabilità della connessione.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.casarini.org/blog/archives/25/feed</wfw:commentRss>
		</item>
		<item>
		<title>Upgrade a WM6 per Treo™ 750 per utenti H3G</title>
		<link>http://www.casarini.org/blog/archives/24</link>
		<comments>http://www.casarini.org/blog/archives/24#comments</comments>
		<pubDate>Sun, 20 Jul 2008 21:50:43 +0000</pubDate>
		<dc:creator>paolo</dc:creator>
		
		<category><![CDATA[mobile]]></category>

		<guid isPermaLink="false">http://www.casarini.org/blog/archives/24</guid>
		<description><![CDATA[Non so esattamente da quando ma è disponibile (finalmente) l'upgrade a Windows Mobile 6 per i Palm Treo 750 marcati 3.
L'applicazione (2.31) e le istruzioni per effettuare l'upgrade sono disponibili direttamente su sito della Palm.
Questo post l'ho fatto principalmente per H3G Italia i cui operatori del mitico 139 sostengono ancora che tale upgrade non sia [...]]]></description>
			<content:encoded><![CDATA[<p>Non so esattamente da quando ma è disponibile (finalmente) l'upgrade a Windows Mobile 6 per i Palm Treo 750 marcati 3.</p>
<p>L'applicazione (2.31) e le istruzioni per effettuare l'upgrade sono disponibili direttamente su <a href="http://kb.palm.com/SRVS/CGI-BIN/WEBCGI.EXE/,/?New,E=0000000001077334167,St=6,D=876,K=6732,TS={BEDA9904-CFE7-4201-9DC7-F128B80F5BBB},Question=obj(170):obj(308),Case=Obj(2249),VARSET_FIRSTTIME=YES" target="_new">sito della Palm</a>.</p>
<p>Questo post l'ho fatto principalmente per H3G Italia i cui operatori del <em>mitico</em> 139 sostengono ancora che tale upgrade non sia disponibile.</p>
<p>Per quanto riguarda l'upgrade in sé l'ho effettuato senza problema alcuno seguendo scrupolosamente le indicazioni.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.casarini.org/blog/archives/24/feed</wfw:commentRss>
		</item>
		<item>
		<title>Google Maps come strumento di puntamento</title>
		<link>http://www.casarini.org/blog/archives/23</link>
		<comments>http://www.casarini.org/blog/archives/23#comments</comments>
		<pubDate>Sun, 20 Jul 2008 21:31:50 +0000</pubDate>
		<dc:creator>paolo</dc:creator>
		
		<category><![CDATA[misc]]></category>

		<guid isPermaLink="false">http://www.casarini.org/blog/archives/23</guid>
		<description><![CDATA[Niente di pericoloso o in qualche modo collegato ad usi impropri, ma semplicemente voglio raccontare un caso d'uso del famoso servizio di Google.
Penso vi sia capitato che qualcuno vi inviti in luoghi che il vostro GPS non conosce o che semplicemente non conosce in termini di indirizzo inteso come nome della via e numero civico. [...]]]></description>
			<content:encoded><![CDATA[<p>Niente di pericoloso o in qualche modo collegato ad usi impropri, ma semplicemente voglio raccontare un caso d'uso del famoso servizio di Google.</p>
<p>Penso vi sia capitato che qualcuno vi inviti in luoghi che il vostro GPS non conosce o che semplicemente non conosce in termini di indirizzo inteso come nome della via e numero civico. A volte poi il luogo non ha semplicemente indirizzo.<br />
In questi casi bisogna affidarsi alle indicazioni di chi ci invita, alle nostre capacità e a volte alla fortuna.</p>
<p>Assumendo che abbiate un GPS stradale e che tale strumento abbia la possibilità di guidarvi in luogo dandone la posizione tramite le esatte coordinate di latitudine e longitudine, il problema si risolve facilmente con il nostro amico <a href="http://www.google.com/maps">Google Maps</a>.</p>
<p><span id="more-23"></span></p>
<p>Spesso, infatti, le indicazioni che ci vengono date sono sufficienti per trovare il luogo su Google Maps. Tramite le varie viste possiamo sincerarci dell'esattezza del luogo individuato e con la calma della nostra postazione di consultazione possiamo verificare tutte le indicazioni ed essere certi di aver individuato il luogo esatto di destinazione.<br />
Una volta trovato il luogo clicchiamo con il tasto destro nel punto che ci interessa raggiungere e selezioniamo <i>"Indicazioni stradali fino a qui"</i>. Facendo questa operazione ci verranno date le coordinate del punto esatto di destinazione in termini di latitudine e longitudine (in forma decimale).</p>
<p>Ad esempio: 44.494313,11.346779 (ovvero Lat 44,494313 Long 11,346779)</p>
<p>Ora basterà impostare tale coordinate nel nostro GPS per essere guidati a destinazione.<br />
Nel mio caso, in questo modo, il mio GPS mi ha portato esattamente a destinazione mostrandomi la strada anche all'interno del giardino dell'abitazione dove mi stavo recando.</p>
<p><strong>Note</strong></p>
<ul>
<li>Nel caso, come nel mio, il vostro dispositivo GPS prevedesse la possibilità di specificare le coordinate solo in termini di gradi minuti e secondi e non prevedesse la forma decimale fornita da Google Maps, ho trovato molto utile il tool di conversione disponibile <a href="http://www.fcc.gov/mb/audio/bickel/DDDMMSS-decimal.html">qui</a>.</li>
<li>Nel caso vi interessasse sapere il luogo puntato dalle coordinate sopra indicate, sono le due torri nel centro di Bologna</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.casarini.org/blog/archives/23/feed</wfw:commentRss>
		</item>
	</channel>
</rss>
