<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SIMOTRONE WEB PAGE &#187; html</title>
	<atom:link href="http://www.simotrone.it/tag/html/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.simotrone.it</link>
	<description>Simotrone is always here!</description>
	<lastBuildDate>Sat, 04 Feb 2012 18:30:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Formatting</title>
		<link>http://www.simotrone.it/2011/09/24/formatting/</link>
		<comments>http://www.simotrone.it/2011/09/24/formatting/#comments</comments>
		<pubDate>Sat, 24 Sep 2011 05:08:22 +0000</pubDate>
		<dc:creator>Simotrone</dc:creator>
				<category><![CDATA[Binary People]]></category>
		<category><![CDATA[format]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.simotrone.it/?p=3525</guid>
		<description><![CDATA[XML: sim@idrogeno:~$ xmllint &#8211;format sim@idrogeno:~$ tidy -xml HTML: sim@idrogeno:~$ tidy -i -w 0 xmllint vale ben una messa&#8230; C&#8217;ha pure uno shell mode!]]></description>
			<content:encoded><![CDATA[<p>XML:</p>
<div class="codesnip-container" >
<div class="codesnip" style="font-family: monospace;">sim@idrogeno:~$ xmllint &#8211;format<br />
sim@idrogeno:~$ tidy -xml</div>
</div>
<p>HTML:</p>
<div class="codesnip-container" >
<div class="codesnip" style="font-family: monospace;">sim@idrogeno:~$ tidy -i -<span class="kw2">w</span> <span class="nu0">0</span></div>
</div>
<p><a href="http://www.manpagez.com/man/1/xmllint/">xmllint</a> vale ben una messa&#8230; C&#8217;ha pure uno shell mode!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.simotrone.it/2011/09/24/formatting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Re-setting dei CSS</title>
		<link>http://www.simotrone.it/2010/11/20/re-setting-dei-css/</link>
		<comments>http://www.simotrone.it/2010/11/20/re-setting-dei-css/#comments</comments>
		<pubDate>Sat, 20 Nov 2010 20:49:52 +0000</pubDate>
		<dc:creator>Simotrone</dc:creator>
				<category><![CDATA[BeyondTheHelp]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[odio]]></category>
		<category><![CDATA[webdesign]]></category>

		<guid isPermaLink="false">http://www.simotrone.it/?p=3107</guid>
		<description><![CDATA[Attualmente odio abbastanza lavorare su HTML e CSS, anche se alla fine è quello che passa il convento. Non mi piace, non mi stimola particolarmente, spesso c&#8217;è da stare attenti a mille cose per ottenere comunque risultati mediocri e dipendenti dai tiramenti di culo dei vari produttori di browser. Ogni tanto ci provo, a lavorarci [...]]]></description>
			<content:encoded><![CDATA[<p>Attualmente odio abbastanza lavorare su HTML e CSS, anche se alla fine è quello che passa il convento.<br />
Non mi piace, non mi stimola particolarmente, spesso c&#8217;è da stare attenti a mille cose per ottenere comunque risultati mediocri e dipendenti dai tiramenti di culo dei vari produttori di browser.<br />
Ogni tanto ci provo, a lavorarci coi CSS, javascript, e quelle menate lì, ma poi mi passa. Lo trovo frustrante.<br />
Comunque sono arrivato a riconoscere che probabilmente la questione è dovuta alla mia orribile ignoranza su &#8216;sta roba. Online c&#8217;è un sacco di materiale (trooooppo) e di sicuro se uno dedicasse tempo a queste cose, ne caverebbe i piedi. Credo.</p>
<p>Dunque, ora c&#8217;è l&#8217;HTML5&#8230; si avvicina a grandi passi. E io se devo fare qualcosa, vedo di farlo rispettando quell&#8217;idea. Dunque, alcuni articoli utili come riferimento:</p>
<ul>
<li><a href="http://html5doctor.com/html-5-reset-stylesheet/">HTML5 Reset Stylesheet</a>: il resetting di HTML5 secondo i <em>Doctor</em></li>
<li><a href="http://meyerweb.com/eric/tools/css/reset/">CSS Tools: Reset CSS</a>: il resetting di Meyer</li>
<li><a href="http://meyerweb.com/eric/thoughts/2007/04/18/reset-reasoning/">Reset Reasoning</a>: il perchè secondo Meyer</li>
</ul>
<p>Boh, vediamo se alla lunga comincio a capirci qualcosa.</p>
<p>Per ora, fare <em>webdesign</em> mi fa venire l&#8217;orticaria.</p>
<p>PS: IE8 non vede i tag dell&#8217;html5&#8230; questo <a href="http://html5doctor.com/html-5-boilerplates/">articolo</a> (e il codice javascript) risolvono il problema. O_o</p>
]]></content:encoded>
			<wfw:commentRss>http://www.simotrone.it/2010/11/20/re-setting-dei-css/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Webcam in html</title>
		<link>http://www.simotrone.it/2010/05/01/webcam-in-html/</link>
		<comments>http://www.simotrone.it/2010/05/01/webcam-in-html/#comments</comments>
		<pubDate>Sat, 01 May 2010 05:13:36 +0000</pubDate>
		<dc:creator>Simotrone</dc:creator>
				<category><![CDATA[Binary People]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[stream]]></category>
		<category><![CDATA[webcam]]></category>

		<guid isPermaLink="false">http://www.simotrone.it/?p=2830</guid>
		<description><![CDATA[Continuando a giocare con la webcam e motion&#8230; Bene, diciamo che abbiamo il nostro device che produce una sana serie di immagini nella amata directory preposta alla scopo, quindi abbiamo una serie di foto sequenziali, e ci interessa mostrare l&#8217;ultima su di una pagina html. Che fare? Un metodo semplice sarebbe creare una pagina html [...]]]></description>
			<content:encoded><![CDATA[<p>Continuando a giocare con la <em>webcam</em> e <strong>motion</strong>&#8230;</p>
<p>Bene, diciamo che abbiamo il nostro <em>device</em> che produce una sana serie di immagini nella amata directory preposta alla scopo, quindi abbiamo una serie di foto sequenziali, e ci interessa mostrare l&#8217;ultima su di una pagina html. Che fare?</p>
<p><img class="cornice" src="/wp-content/Download/sim-2010-04-25.jpg" alt="Mumble" /></p>
<p>Un metodo semplice sarebbe creare una pagina html statica con un <a href="http://en.wikipedia.org/wiki/Meta_refresh">meta che fa l&#8217;auto-refresh</a></p>
<div class="codesnip-container" >
<div class="codesnip" style="font-family: monospace;"><span class="sc2"><a href="http://december.com/html/4/element/meta.html"><span class="kw2">&lt;meta</span></a> <span class="kw3">http-equiv</span>=<span class="st0">&quot;refresh&quot;</span> <span class="kw3">content</span>=<span class="st0">&quot;2&quot;</span>/<span class="kw2">&gt;</span></span></div>
</div>
<p>ma ci sono metodi migliori lato server.</p>
<p>La soluzione che ho approntato è un po&#8217; macchinosa, ma almeno mi ha permesso di vedere un paio di cose interessanti.</p>
<p>Il tutto ruota attorno al <strong>content-type: multipart/x-mixed-replace;</strong> (Ho trovato info <a href="http://www.abiglime.com/webmaster/articles/cgi/032498.htm">qui</a> e <a href="http://oreilly.com/openbook/cgi/ch06_06.html">quo</a>).<br />
Essenzialmente si tratta di lasciare una connessione aperta fra client e server nella quale il secondo passa contenuti al primo dopo la chiamata (<em>server push</em>). Citando <a href="http://en.wikipedia.org/wiki/MIME#Mixed-Replace_.28Experimental.29">wikipedia</a>:</p>
<blockquote><p>Mixed-Replace (Experimental)</p>
<p>The content type multipart/x-mixed-replace was developed as part of a technology to emulate server push and streaming over HTTP.</p>
<p>All parts of a mixed-replace message have the same semantic meaning. However, each part invalidates &#8211; &#8220;replaces&#8221; &#8211; the previous parts as soon as it is received completely. Clients should process the individual parts as soon as they arrive and should not wait for the whole message to finish.</p>
<p>Originally developed by Netscape, it is still supported by Mozilla, Firefox, Safari (but not in Safari on the iPhone) and Opera, but traditionally ignored by Microsoft. It is commonly used in IP cameras as the MIME type for MJPEG streams.</p></blockquote>
<p>Quindi a parte Explorer, siamo a posto con tutti gli altri browser (strano).</p>
<p>Seguendo il libro della O&#8217;Reilly ho creato uno script cgi in perl utile per creare lo stream video (sostanzialmente il ciclo di immagini jpeg utili):</p>
<div class="codesnip-container" >
<div class="codesnip" style="font-family: monospace;"><span class="co1">#!/usr/bin/perl &nbsp; &nbsp; &nbsp; &nbsp;</span></p>
<p><span class="kw2">use</span> strict;<br />
<span class="kw2">use</span> warnings;</p>
<p><span class="kw2">sub</span> display_img <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">my</span> <span class="br0">&#40;</span><span class="re0">$file</span><span class="br0">&#41;</span> = <span class="re0">@_</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span> <a href="http://perldoc.perl.org/functions/open.html"><span class="kw3">open</span></a><span class="br0">&#40;</span>FILE, <span class="st0">&#8216;&lt;&#8217;</span>, <span class="re0">$file</span><span class="br0">&#41;</span> <span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">my</span> <span class="re0">$content_length</span> = <span class="br0">&#40;</span><a href="http://perldoc.perl.org/functions/stat.html"><span class="kw3">stat</span></a> <span class="br0">&#40;</span>FILE<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#91;</span><span class="nu0">7</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/print.html"><span class="kw3">print</span></a> <span class="st0">&quot;Content-type: image/jpeg<span class="es0">\n</span>&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/print.html"><span class="kw3">print</span></a> <span class="st0">&quot;Content-length: &quot;</span>, <span class="re0">$content_length</span>, <span class="st0">&quot;<span class="es0">\n</span><span class="es0">\n</span>&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/print.html"><span class="kw3">print</span></a> <span class="re4">&lt;FILE&gt;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/close.html"><span class="kw3">close</span></a><span class="br0">&#40;</span>FILE<span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/print.html"><span class="kw3">print</span></a> <span class="st0">&quot;Content-type: text/plain<span class="es0">\n</span><span class="es0">\n</span>&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/print.html"><span class="kw3">print</span></a> <span class="st0">&quot;&lt;p&gt;500, File Access Error, Cannot open graphic file: $file&lt;/p&gt;&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></p>
<p>$| = <span class="nu0">1</span>;</p>
<p><span class="kw1">my</span> <span class="re0">$boundary_string</span> = <span class="st0">&quot;<span class="es0">\n</span>&#8211;xstring<span class="es0">\n</span>&quot;</span>;<br />
<span class="kw1">my</span> <span class="re0">$end_string</span> = <span class="st0">&quot;<span class="es0">\n</span>&#8211;xstring&#8211;<span class="es0">\n</span>&quot;</span>;<br />
<span class="kw1">my</span> <span class="re0">$delay</span> = <span class="nu0">3</span>;<br />
<span class="kw1">my</span> <span class="re0">$img_path</span> = <span class="st0">&#8216;/var/www/webcam/&#8217;</span>;<br />
<span class="kw1">my</span> <span class="re0">$image</span> = <span class="st0">&#8216;webcam-snap.jpg&#8217;</span>;</p>
<p><a href="http://perldoc.perl.org/functions/print.html"><span class="kw3">print</span></a> <span class="st0">&quot;Content-type: multipart/x-mixed-replace; boundary=xstring&quot;</span>,<span class="st0">&quot;<span class="es0">\n</span><span class="es0">\n</span>&quot;</span>;</p>
<p><a href="http://perldoc.perl.org/functions/print.html"><span class="kw3">print</span></a> <span class="re0">$boundary_string</span>;</p>
<p><span class="kw1">while</span> <span class="br0">&#40;</span><span class="nu0">1</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; display_img <span class="br0">&#40;</span><span class="re0">$img_path</span>.<span class="re0">$image</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/print.html"><span class="kw3">print</span></a> <span class="re0">$boundary_string</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/sleep.html"><span class="kw3">sleep</span></a><span class="br0">&#40;</span><span class="re0">$delay</span><span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span><br />
<a href="http://perldoc.perl.org/functions/print.html"><span class="kw3">print</span></a> <span class="re0">$end_string</span>;</p>
<p><a href="http://perldoc.perl.org/functions/exit.html"><span class="kw3">exit</span></a><span class="br0">&#40;</span><span class="nu0">0</span><span class="br0">&#41;</span>;</div>
</div>
<p>Il <strong>$|</strong> serve per avere lo <em>stdout flushato</em> automaticamente (<strong>man perlvar</strong>).</p>
<p>Creata questa sequenza di content-type: image/jpeg l&#8217;ho cacciata dentro un html generato dal php, in modo da controllare dinamicamente 1) se motion è in uso (ovvero se la webcam è accesa) e 2) se il browser è Explorer (nel qual caso lo stream non è visualizzabile).</p>
<div class="codesnip-container" >
<div class="codesnip" style="font-family: monospace;"><span class="kw2">&lt;?php</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </p>
<p><span class="kw2">function</span> top<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$top</span> = &lt;&lt;&lt;EOF<br />
&lt;html&gt;<br />
&lt;head&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;title&gt;Webcam on H&lt;/title&gt;<br />
&nbsp; &nbsp; &lt;meta name=<span class="st0">&quot;creator&quot;</span> content=<span class="st0">&quot;Webcamd&quot;</span> /&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;style type=<span class="st0">&quot;text/css&quot;</span>&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; body <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; margin: 10px 50px;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; color: <span class="co2">#999;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; background-color: black;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; text-align: center;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; img, div.riquadro <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; border: 1px solid <span class="co2">#999;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; padding: 3px;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; width: 320px;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; height: 240px;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .Online <span class="br0">&#123;</span> color: <span class="co2">#393; } </span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .Offline &nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#123;</span> color: <span class="co2">#933; }</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; a:<a href="http://www.php.net/link"><span class="kw3">link</span></a> &nbsp;<span class="br0">&#123;</span> color: <span class="co2">#D93; } &nbsp; &nbsp;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; a:visited <span class="br0">&#123;</span> color: <span class="co2">#A43; }</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; a:hover <span class="br0">&#123;</span> color: <span class="co2">#AA3; }</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;/style&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
EOF; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="re0">$top</span>; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </p>
<p><span class="br0">&#125;</span></p>
<p><span class="kw2">function</span> foot<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$bot</span> = &lt;&lt;&lt;EOF<br />
<span class="re1">&lt;/body&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
&lt;/html&gt;</span><br />
EOF;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="re0">$bot</span>;<br />
<span class="br0">&#125;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</p>
<p><span class="kw2">function</span> body_cam<span class="br0">&#40;</span><span class="re0">$status</span>, <span class="re0">$ua</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$body</span> = <span class="st0">&#8221;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$body</span> .= <span class="st0">&quot;&lt;h1 class=<span class="es0">\&quot;</span>$status<span class="es0">\&quot;</span>&gt;Cam $status&lt;/h1&gt;&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$body</span> .= <span class="st0">&quot;&lt;div style=<span class="es0">\&quot;</span>margin: 1em 0 3em;<span class="es0">\&quot;</span>&gt;&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="re0">$status</span> == <span class="st0">&#8216;Online&#8217;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$body</span> .= <span class="br0">&#40;</span> <a href="http://www.php.net/preg_match"><span class="kw3">preg_match</span></a><span class="br0">&#40;</span><span class="st0">&#8216;/MSIE/&#8217;</span>,<span class="re0">$ua</span><span class="br0">&#41;</span> <span class="br0">&#41;</span> ? <span class="st0">&#8216;&lt;div class=&quot;riquadro&quot; style=&quot;margin: 0 auto;&quot;&gt;&lt;p class=&quot;Online&quot;&gt;Stream video non disponibile con Explorer.&lt;/p&gt;&lt;/div&gt;&#8217;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: <span class="st0">&#8216;&lt;img src=&quot;http://192.168.0.1/cgi-bin/webcam&quot;/&gt;&#8217;</span>; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$body</span> .= <span class="st0">&#8216;&lt;div class=&quot;riquadro&quot; style=&quot;margin: 0 auto;&quot;&gt;&lt;p class=&quot;Offline&quot;&gt;Webcam Offline&lt;/p&gt;&lt;/div&gt;&#8217;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$body</span> .= <span class="st0">&quot;&lt;/div&gt;&quot;</span>;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="re0">$body</span>;<br />
<span class="br0">&#125;</span></p>
<p><span class="kw2">function</span> body_extra<span class="br0">&#40;</span><span class="re0">$ua</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$body</span> = &lt;&lt;&lt;EOF<br />
&lt;div style=<span class="st0">&quot;margin: 1em 0 1em;&quot;</span>&gt;<br />
&lt;p&gt;&lt;strong&gt;User-agent:&lt;/strong&gt; <span class="re0">$ua</span>&lt;/p&gt;<br />
&lt;/div&gt;<br />
&lt;hr/&gt;<br />
&lt;p&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; Made by &lt;a href=<span class="st0">&quot;http://www.simotrone.it&quot;</span>&gt;simotrone&lt;/a&gt;,&lt;br/&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; with &lt;a href=<span class="st0">&quot;http://www.lavrsen.dk/foswiki/bin/view/Motion/WebHome&quot;</span>&gt;Motion&lt;/a&gt;.<br />
&lt;/p&gt;<br />
EOF;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="re0">$body</span>;<br />
<span class="br0">&#125;</span></p>
<p><span class="re0">$user_agent</span> = <span class="re0">$_SERVER</span><span class="br0">&#91;</span><span class="st0">&#8216;HTTP_USER_AGENT&#8217;</span><span class="br0">&#93;</span>;<br />
<span class="re0">$motion_pid</span> = <span class="st0">&#8216;/tmp/motion.pid&#8217;</span>;</p>
<p><span class="kw1">if</span> <span class="br0">&#40;</span><a href="http://www.php.net/file_exists"><span class="kw3">file_exists</span></a><span class="br0">&#40;</span><span class="re0">$motion_pid</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$status</span> = <span class="st0">&#8216;Online&#8217;</span>;<br />
<span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$status</span> = <span class="st0">&#8216;Offline&#8217;</span>;<br />
<span class="br0">&#125;</span></p>
<p><a href="http://www.php.net/echo"><span class="kw3">echo</span></a> top<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
<a href="http://www.php.net/echo"><span class="kw3">echo</span></a> body_cam<span class="br0">&#40;</span><span class="re0">$status</span>, <span class="re0">$user_agent</span><span class="br0">&#41;</span>;<br />
<a href="http://www.php.net/echo"><span class="kw3">echo</span></a> body_extra<span class="br0">&#40;</span><span class="re0">$user_agent</span><span class="br0">&#41;</span>;<br />
<a href="http://www.php.net/echo"><span class="kw3">echo</span></a> foot<span class="br0">&#40;</span><span class="br0">&#41;</span>;</p>
<p><span class="kw2">?&gt;</span></div>
</div>
<p>Buono così.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.simotrone.it/2010/05/01/webcam-in-html/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>motion</title>
		<link>http://www.simotrone.it/2010/04/28/motion/</link>
		<comments>http://www.simotrone.it/2010/04/28/motion/#comments</comments>
		<pubDate>Wed, 28 Apr 2010 05:06:22 +0000</pubDate>
		<dc:creator>Simotrone</dc:creator>
				<category><![CDATA[Binary People]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[motion]]></category>
		<category><![CDATA[webcam]]></category>

		<guid isPermaLink="false">http://www.simotrone.it/?p=2826</guid>
		<description><![CDATA[Giochicchiando con la webcam mi sono ritrovato a volerla usare da riga di comando (cosa buona per diverse ragioni), e così ho scoperto motion. Qui si trova di tutto: Motion. Dopo aver fatto riconoscere la webcam al kernel (come indicato qua), si può ottenere qualche informazione con $ v4l-info (installato tramite il pacchetto v4l-conf). Nel [...]]]></description>
			<content:encoded><![CDATA[<p>Giochicchiando con la webcam mi sono ritrovato a volerla usare da riga di comando (cosa buona per diverse ragioni), e così ho scoperto <strong>motion</strong>.<br />
Qui si trova di tutto: <a href="http://www.lavrsen.dk/foswiki/bin/view/Motion/WebHome">Motion</a>.</p>
<p>Dopo aver fatto riconoscere la webcam al kernel (come indicato <a href="http://www.simotrone.it/2010/03/20/giocando-con-la-webcam/">qua</a>), si può ottenere qualche informazione con <strong>$ v4l-info</strong> (installato tramite il pacchetto <strong>v4l-conf</strong>).<br />
Nel mio caso:</p>
<div class="codesnip-container" >
<div class="codesnip" style="font-family: monospace;">sim@idrogeno:~$ v4l-info </p>
<p><span class="re3">### v4l2 device info <span class="br0">&#91;</span>/dev/video0<span class="br0">&#93;</span> ###</span><br />
general info &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; VIDIOC_QUERYCAP &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; driver &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: <span class="st0">&quot;zc3xx&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; card &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: <span class="st0">&quot;USB Camera (046d:08d9)&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; bus_info &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: <span class="st0">&quot;usb-0000:00:02.0-1&quot;</span> &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; version &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : <span class="nu0">2.8</span><span class="nu0">.0</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; capabilities &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: 0&#215;5000001 <span class="br0">&#91;</span>VIDEO_CAPTURE,READWRITE,STREAMING<span class="br0">&#93;</span></p>
<p>standards<br />
<span class="br0">&#91;</span>&#8230;<span class="br0">&#93;</span><br />
video capture<br />
&nbsp; &nbsp; VIDIOC_ENUM_FMT<span class="br0">&#40;</span><span class="nu0">0</span>,VIDEO_CAPTURE<span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; index &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : <span class="nu0">0</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">type</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: VIDEO_CAPTURE<br />
&nbsp; &nbsp; &nbsp; &nbsp; flags &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : <span class="nu0">1</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; description &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : <span class="st0">&quot;JPEG&quot;</span> &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; pixelformat &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : 0x4745504a <span class="br0">&#91;</span>JPEG<span class="br0">&#93;</span><br />
&nbsp; &nbsp; VIDIOC_G_FMT<span class="br0">&#40;</span>VIDEO_CAPTURE<span class="br0">&#41;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">type</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: VIDEO_CAPTURE &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">fmt</span>.pix.width &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : <span class="nu0">320</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">fmt</span>.pix.height &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: <span class="nu0">240</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">fmt</span>.pix.pixelformat &nbsp; &nbsp; : 0x4745504a <span class="br0">&#91;</span>JPEG<span class="br0">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">fmt</span>.pix.field &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : NONE &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">fmt</span>.pix.bytesperline &nbsp; &nbsp;: <span class="nu0">320</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">fmt</span>.pix.sizeimage &nbsp; &nbsp; &nbsp; : <span class="nu0">29390</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">fmt</span>.pix.colorspace &nbsp; &nbsp; &nbsp;: JPEG &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">fmt</span>.pix.priv &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: <span class="nu0">1</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
<span class="br0">&#91;</span>&#8230;<span class="br0">&#93;</span></div>
</div>
<p>Avendo le dimensioni &#8220;accattabili&#8221; dalla webcam, ho dovuto solo configurare motion per convogliare una serie di screenshot in un <em>filepath</em> e poi &#8220;montarci&#8221; una pagina html sopra.</p>
<p>Una semplice configurazione di motion potrebbe essere questa:</p>
<div class="codesnip-container" >
<div class="codesnip" style="font-family: monospace;">videodevice /dev/video0<br />
input <span class="nu0">8</span></p>
<p>daemon off<br />
process_id_file /tmp/motion.pid</p>
<p>jpeg_filename webcam<br />
target_dir /var/www/webcam</p>
<p>height <span class="nu0">320</span><br />
width <span class="nu0">240</span><br />
auto_brightness on</p>
<p>minimum_frame_time <span class="nu0">2</span></div>
</div>
<p>Con questa configurazione, al lancio di motion (con <strong>daemon on</strong> va direttamente in background)  verrà salvata in /var/www/webcam/webcam.jpg la foto fatta dalla webcam ogni 2 secondi. <img src='http://www.simotrone.it/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><em>Motion</em> ha un miliardo di altre finezze, ma per ora è tutto.  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.simotrone.it/2010/04/28/motion/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>CalendarMonth.pm</title>
		<link>http://www.simotrone.it/2009/11/17/calendarmonth-pm/</link>
		<comments>http://www.simotrone.it/2009/11/17/calendarmonth-pm/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 06:11:27 +0000</pubDate>
		<dc:creator>Simotrone</dc:creator>
				<category><![CDATA[Binary People]]></category>
		<category><![CDATA[calendar]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://www.simotrone.it/?p=2392</guid>
		<description><![CDATA[Guardicchiando per un progetto mi sono imbattuto in HTML::CalendarMonth, un modulo perl interessante per la generazione di calendarietti in html. Il tutto si basa sui moduli HTML::Element che creano degli oggetti per la gestione dei singoli elementi della pagina html. Segue un esempio particolarmente brutto, ma utile ai fini di capire la logica. Il punto [...]]]></description>
			<content:encoded><![CDATA[<p>Guardicchiando per un progetto mi sono imbattuto in <strong>HTML::CalendarMonth</strong>, un modulo perl interessante per la generazione di calendarietti in html.</p>
<p>Il tutto si basa sui moduli <strong>HTML::Element</strong> che creano degli oggetti per la gestione dei singoli elementi della pagina html. Segue un esempio particolarmente brutto, ma utile ai fini di capire la logica.<br />
Il punto della questione è definire gli elementi HTML con l&#8217;apposito costruttore new(&#8216;tag&#8217;, eventuale_attributo =&gt; &#8216;come hash&#8217;); gli elementi possono poi essere gestiti con una struttura <em>parent-child</em> attraverso il metodo <strong>push_content</strong> che ordina in un array gli elementi che lo compongono.</p>
<div class="codesnip-container" >
<div class="codesnip" style="font-family: monospace;"><span class="kw2">use</span> HTML::<span class="me2">Element</span>;</p>
<p><span class="co1"># HTML::Element crea oggetti con nomi/tag e attributi.</span><br />
<span class="kw1">my</span> <span class="re0">$html</span> &nbsp;= HTML::<span class="me2">Element</span>-&gt;<span class="me1">new</span><span class="br0">&#40;</span><span class="st0">&#8216;html&#8217;</span><span class="br0">&#41;</span>;<br />
<span class="kw1">my</span> <span class="re0">$head</span> &nbsp;= HTML::<span class="me2">Element</span>-&gt;<span class="me1">new</span><span class="br0">&#40;</span><span class="st0">&#8216;head&#8217;</span><span class="br0">&#41;</span>;<br />
<span class="kw1">my</span> <span class="re0">$title</span> = HTML::<span class="me2">Element</span>-&gt;<span class="me1">new</span><span class="br0">&#40;</span><span class="st0">&#8216;title&#8217;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp;<span class="re0">$title</span>-&gt;<span class="me1">push_content</span><span class="br0">&#40;</span><span class="st0">&#8216;Titolo della pagina&#8217;</span><span class="br0">&#41;</span>;<br />
<span class="kw1">my</span> <span class="re0">$body</span> &nbsp;= HTML::<span class="me2">Element</span>-&gt;<span class="me1">new</span><span class="br0">&#40;</span><span class="st0">&#8216;body&#8217;</span><span class="br0">&#41;</span>;<br />
<span class="kw1">my</span> <span class="re0">$h1</span> &nbsp; &nbsp;= HTML::<span class="me2">Element</span>-&gt;<span class="me1">new</span><span class="br0">&#40;</span><span class="st0">&#8216;h1&#8242;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp;<span class="re0">$h1</span>-&gt;<span class="me1">push_content</span><span class="br0">&#40;</span><span class="st0">&#8216;Header nel body&#8217;</span><span class="br0">&#41;</span>;<br />
<span class="kw1">my</span> <span class="re0">$hlink</span> = HTML::<span class="me2">Element</span>-&gt;<span class="me1">new</span><span class="br0">&#40;</span><span class="st0">&#8216;a&#8217;</span>, href =&gt; <span class="st0">&#8216;http://www.simotrone.it&#8217;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp;<span class="re0">$hlink</span>-&gt;<span class="me1">push_content</span><span class="br0">&#40;</span><span class="st0">&#8216;il mio sito&#8217;</span><span class="br0">&#41;</span>;<br />
<span class="kw1">my</span> <span class="re0">$p</span> &nbsp; &nbsp; = HTML::<span class="me2">Element</span>-&gt;<span class="me1">new</span><span class="br0">&#40;</span><span class="st0">&#8216;p&#8217;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp;<span class="re0">$p</span>-&gt;<span class="me1">push_content</span><span class="br0">&#40;</span><span class="st0">&#8216;Questo paragrafo ha un link: &#8216;</span>, <span class="re0">$hlink</span>, <span class="st0">&#8216;.&#8217;</span><span class="br0">&#41;</span>;</p>
<p><span class="re0">$head</span>-&gt;<span class="me1">push_content</span><span class="br0">&#40;</span><span class="re0">$title</span><span class="br0">&#41;</span>;<br />
<span class="re0">$body</span>-&gt;<span class="me1">push_content</span><span class="br0">&#40;</span><span class="re0">$h1</span>, <span class="re0">$p</span><span class="br0">&#41;</span>;</p>
<p><span class="re0">$html</span>-&gt;<span class="me1">push_content</span><span class="br0">&#40;</span><span class="re0">$head</span>, <span class="re0">$body</span><span class="br0">&#41;</span>;</p>
<p><a href="http://perldoc.perl.org/functions/print.html"><span class="kw3">print</span></a> <span class="re0">$html</span>-&gt;<span class="me1">as_HTML</span>;</div>
</div>
<p>Per ottenere:</p>
<div class="codesnip-container" >
<div class="codesnip" style="font-family: monospace;"><span class="sc2"><a href="http://december.com/html/4/element/html.html"><span class="kw2">&lt;html&gt;</span></a></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2"><a href="http://december.com/html/4/element/head.html"><span class="kw2">&lt;head&gt;</span></a></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2"><a href="http://december.com/html/4/element/title.html"><span class="kw2">&lt;title&gt;</span></a></span>Titolo della pagina<span class="sc2"><span class="kw2">&lt;/title&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2"><span class="kw2">&lt;/head&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2"><a href="http://december.com/html/4/element/body.html"><span class="kw2">&lt;body&gt;</span></a></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2"><a href="http://december.com/html/4/element/h1.html"><span class="kw2">&lt;h1&gt;</span></a></span>Header nel body<span class="sc2"><span class="kw2">&lt;/h1&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2"><a href="http://december.com/html/4/element/p.html"><span class="kw2">&lt;p&gt;</span></a></span>Questo paragrafo ha un link: <span class="sc2"><a href="http://december.com/html/4/element/a.html"><span class="kw2">&lt;a</span></a> <span class="kw3">href</span>=<span class="st0">&quot;http://www.simotrone.it&quot;</span><span class="kw2">&gt;</span></span>il mio sito<span class="sc2"><span class="kw2">&lt;/a&gt;</span></span>.<span class="sc2"><span class="kw2">&lt;/p&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2"><span class="kw2">&lt;/body&gt;</span></span><br />
<span class="sc2"><span class="kw2">&lt;/html&gt;</span></span></div>
</div>
<p>Ok, fin qui sembra una pompa, 150 righe per ottenerne 5. Non molto economico.</p>
<p>Comunque il punto della questione era far vedere HTML::CalendarMonth, che sfruttando i moduli suddetti ritorna cose interessanti con poco codice. <img src='http://www.simotrone.it/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Con queste poche righe&#8230;</p>
<div class="codesnip-container" >
<div class="codesnip" style="font-family: monospace;"><span class="kw2">use</span> HTML::<span class="me2">AsSubs</span>;<br />
<span class="kw2">use</span> HTML::<span class="me2">CalendarMonth</span>;</p>
<p><span class="kw1">my</span> <span class="re0">$cal</span> = HTML::<span class="me2">CalendarMonth</span>-&gt;<span class="me1">new</span><span class="br0">&#40;</span> month =&gt; <span class="nu0">10</span>, year =&gt; <span class="nu0">2009</span> <span class="br0">&#41;</span>;<br />
<span class="re0">$cal</span>-&gt;<span class="me1">item</span><span class="br0">&#40;</span><span class="re0">$cal</span>-&gt;<span class="me1">year</span>, <span class="re0">$cal</span>-&gt;<span class="me1">month</span><span class="br0">&#41;</span>-&gt;<span class="me1">attr</span><span class="br0">&#40;</span>style =&gt; <span class="st0">&#8216;background-color: wheat; font-size: 150%;&#8217;</span><span class="br0">&#41;</span>;<br />
<span class="re0">$cal</span>-&gt;<span class="me1">col</span><span class="br0">&#40;</span><span class="nu0">0</span><span class="br0">&#41;</span>-&gt;<span class="me1">attr</span><span class="br0">&#40;</span>style =&gt; <span class="st0">&#8216;font-weight: bold&#8217;</span><span class="br0">&#41;</span>;<br />
<a href="http://perldoc.perl.org/functions/print.html"><span class="kw3">print</span></a> <span class="re0">$cal</span>-&gt;<span class="me1">as_HTML</span>;</div>
</div>
<p>possiamo ottenere questo:</p>
<table bgcolor="white" border="1" cellpadding="0" cellspacing="0">
<tr align="center">
<td align="left" colspan="5" style="font-weight: bold">October</td>
<td align="center" colspan="2" style="background-color: wheat; font-size: 150%;">2009</td>
</tr>
<tr align="center">
<td align="center" style="font-weight: bold">Sun</td>
<td align="center">Mon</td>
<td align="center">Tue</td>
<td align="center">Wed</td>
<td align="center">Thu</td>
<td align="center">Fri</td>
<td align="center">Sat</td>
</tr>
<tr align="center">
<td align="center" style="font-weight: bold">&nbsp; </td>
<td align="center">&nbsp; </td>
<td align="center">&nbsp; </td>
<td align="center">&nbsp; </td>
<td align="center">1</td>
<td align="center">2</td>
<td align="center">3</td>
</tr>
<tr align="center">
<td align="center" style="font-weight: bold">4</td>
<td align="center">5</td>
<td align="center">6</td>
<td align="center">7</td>
<td align="center">8</td>
<td align="center">9</td>
<td align="center">10</td>
</tr>
<tr align="center">
<td align="center" style="font-weight: bold">11</td>
<td align="center">12</td>
<td align="center">13</td>
<td align="center">14</td>
<td align="center">15</td>
<td align="center">16</td>
<td align="center">17</td>
</tr>
<tr align="center">
<td align="center" style="font-weight: bold">18</td>
<td align="center">19</td>
<td align="center">20</td>
<td align="center">21</td>
<td align="center">22</td>
<td align="center">23</td>
<td align="center">24</td>
</tr>
<tr align="center">
<td align="center" style="font-weight: bold">25</td>
<td align="center">26</td>
<td align="center">27</td>
<td align="center">28</td>
<td align="center">29</td>
<td align="center">30</td>
<td align="center">31</td>
</tr>
</table>
<p>E con la semplice aggiunta di un ciclo for che genera i mesi e di una sub possiamo ottenere un calendario molto flessibile.</p>
<div class="codesnip-container" >
<div class="codesnip" style="font-family: monospace;"><span class="kw2">sub</span> mensile <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">my</span> <span class="br0">&#40;</span><span class="re0">$mm</span>,<span class="re0">$yyyy</span><span class="br0">&#41;</span> = <span class="re0">@_</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">my</span> <span class="re0">$cal</span> = HTML::<span class="me2">CalendarMonth</span>-&gt;<span class="me1">new</span><span class="br0">&#40;</span> month =&gt; <span class="re0">$mm</span>, year =&gt; <span class="re0">$yyyy</span> <span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$cal</span>-&gt;<span class="me1">item</span><span class="br0">&#40;</span><span class="re0">$cal</span>-&gt;<span class="me1">year</span>, <span class="re0">$cal</span>-&gt;<span class="me1">month</span><span class="br0">&#41;</span>-&gt;<span class="me1">attr</span><span class="br0">&#40;</span>style =&gt; <span class="st0">&#8216;background-color: wheat; font-size: 150%;&#8217;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$cal</span>-&gt;<span class="me1">col</span><span class="br0">&#40;</span><span class="nu0">0</span><span class="br0">&#41;</span>-&gt;<span class="me1">attr</span><span class="br0">&#40;</span>style =&gt; <span class="st0">&#8216;font-weight: bold&#8217;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/print.html"><span class="kw3">print</span></a> <span class="re0">$cal</span>-&gt;<span class="me1">as_HTML</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/print.html"><span class="kw3">print</span></a> <span class="st0">&quot;<span class="es0">\n</span>&quot;</span>;<br />
<span class="br0">&#125;</span></p>
<p><span class="kw1">for</span> <span class="br0">&#40;</span><span class="nu0">1</span>,<span class="nu0">2</span>,<span class="nu0">3</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;mensile<span class="br0">&#40;</span><span class="re0">$_</span>,<span class="nu0">1979</span><span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span></div>
</div>
<p>Su Debian i pacchetti sono questi qua:</p>
<div class="codesnip-container" >
<div class="codesnip" style="font-family: monospace;">idrogeno:~<span class="re3"># dpkg -l libhtml-calendarmonth-<span class="kw2">perl</span> libhtml-element-extended-<span class="kw2">perl</span> libhtml-tableextract-perl</span><br />
<span class="re2">Desired=</span>Unknown/Install/Remove/Purge/Hold<br />
| <span class="re2">Status=</span>Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend<br />
|/ Err?=<span class="br0">&#40;</span>none<span class="br0">&#41;</span>/Reinst-required <span class="br0">&#40;</span>Status,Err: <span class="re2">uppercase=</span>bad<span class="br0">&#41;</span><br />
||/ Name &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Version &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Description<br />
+++-=================-=================-=======================<br />
ii &nbsp;libhtml-calendarm <span class="nu0">1.19</span><span class="nu0">-1</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;generate and manipulate <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; calandar months <span class="kw1">in</span> HTML<br />
ii &nbsp;libhtml-element-e <span class="nu0">1.17</span><span class="nu0">-3</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;extended HTML::Element<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; classes<br />
ii &nbsp;libhtml-tableextr <span class="nu0">2.10</span><span class="nu0">-3</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;module <span class="kw1">for</span> extracting <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; the content contained <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">in</span> tab</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.simotrone.it/2009/11/17/calendarmonth-pm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Layout html</title>
		<link>http://www.simotrone.it/2009/10/31/layout-html/</link>
		<comments>http://www.simotrone.it/2009/10/31/layout-html/#comments</comments>
		<pubDate>Sat, 31 Oct 2009 06:47:48 +0000</pubDate>
		<dc:creator>Simotrone</dc:creator>
				<category><![CDATA[Binary People]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[layout]]></category>
		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://www.simotrone.it/?p=2386</guid>
		<description><![CDATA[Tempo addietro m&#8217;ero fatto uno script in bash per scrivermi rapidamente un layout html standard (coi tag html, head, body, il doctype, ecc.). Aveva qualche opzione, ma era una cosa semplice e comunque utile. Ora posso farlo semplicemente così: $ perl -MCGI=:standard -e &#8216;print start_html(&#34;[% title %]&#34;),end_html;&#8217; &#60;!DOCTYPE html &#160; &#160; &#160; &#160; PUBLIC &#34;-//W3C//DTD [...]]]></description>
			<content:encoded><![CDATA[<p>Tempo addietro m&#8217;ero fatto uno script in bash per scrivermi rapidamente un layout html standard (coi tag html, head, body, il doctype, ecc.).</p>
<p>Aveva qualche opzione, ma era una cosa semplice e comunque utile.</p>
<p>Ora posso farlo semplicemente così:</p>
<div class="codesnip-container" >
<div class="codesnip" style="font-family: monospace;">$ perl -MCGI=:standard -e <span class="st0">&#8216;print start_html(&quot;[% title %]&quot;),end_html;&#8217;</span></p>
<p>&lt;!DOCTYPE html<br />
&nbsp; &nbsp; &nbsp; &nbsp; PUBLIC <span class="st0">&quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="st0">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;</span>&gt;<br />
&lt;html xmlns=<span class="st0">&quot;http://www.w3.org/1999/xhtml&quot;</span> lang=<span class="st0">&quot;en-US&quot;</span> xml:lang=<span class="st0">&quot;en-US&quot;</span>&gt;<br />
<span class="re4">&lt;head&gt;</span><br />
<span class="re4">&lt;title&gt;</span><span class="br0">&#91;</span>% title %<span class="br0">&#93;</span>&lt;/title&gt;<br />
&lt;meta http-equiv=<span class="st0">&quot;Content-Type&quot;</span> content=<span class="st0">&quot;text/html; charset=iso-8859-1&quot;</span> /&gt;<br />
&lt;/head&gt;<br />
<span class="re4">&lt;body&gt;</span></p>
<p>&lt;/body&gt;<br />
&lt;/html&gt;</div>
</div>
<p>Il <strong>[% title %]</strong> è per preparare il campo a <a href="http://template-toolkit.org/">TT</a>, niente di che.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.simotrone.it/2009/10/31/layout-html/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Selection con javascript</title>
		<link>http://www.simotrone.it/2009/08/22/selection-con-javascript/</link>
		<comments>http://www.simotrone.it/2009/08/22/selection-con-javascript/#comments</comments>
		<pubDate>Sat, 22 Aug 2009 06:02:41 +0000</pubDate>
		<dc:creator>Simotrone</dc:creator>
				<category><![CDATA[Binary People]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[selection]]></category>

		<guid isPermaLink="false">http://www.simotrone.it/?p=2113</guid>
		<description><![CDATA[Come &#8220;prendere&#8221; una selezione col mouse su una pagina html grazie a javascript? Semplice: si scrive una funzione js che accatta la selezione. Il problema, come al solito, è capire QUALI oggetti danno la possibilità di prendere l&#8217;evento che ci interessa e COME questi oggetti operano. (Odio i browser e javascript che sta in mezzo [...]]]></description>
			<content:encoded><![CDATA[<p>Come &#8220;prendere&#8221; una selezione col mouse su una pagina html grazie a javascript?<br />
Semplice: si scrive una funzione js che accatta la selezione. <img src='http://www.simotrone.it/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Il problema, come al solito, è capire QUALI oggetti danno la possibilità di prendere l&#8217;evento che ci interessa e COME questi oggetti operano.<br />
(Odio i browser e javascript che sta in mezzo a ste cose.) </p>
<p>Nei vari browser mozzillari <strong>getSelection</strong> restituisce il testo della selezione, mentre in Exploder l&#8217;oggetto raccattato con <strong>selection</strong> è un <a href="http://msdn.microsoft.com/en-us/library/ms535872(VS.85).aspx">TextRange</a> che va manipolato ancora un pochetto.</p>
<div class="codesnip-container" >
<div class="codesnip" style="font-family: monospace;"><span class="kw2">function</span> print_selection<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="kw2">var</span> selected = <span class="st0">&#8221;</span>;<br />
&nbsp; &nbsp; <span class="kw2">var</span> area = document.<span class="me1">getElementById</span><span class="br0">&#40;</span><span class="st0">&#8216;name_area_dove_stampare&#8217;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>document.<span class="me1">getSelection</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; selected = document.<span class="me1">getSelection</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="kw1">if</span> <span class="br0">&#40;</span>document.<span class="me1">selection</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Parte per IE</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; selected = document.<span class="me1">selection</span>.<span class="me1">createRange</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">text</span>;<br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; area.<span class="me1">value</span> = selected;<br />
<span class="br0">&#125;</span></div>
</div>
<p>Per altro sui browser come FFox si puo&#8217; fare anche un&#8217;altro numero:</p>
<div class="codesnip-container" >
<div class="codesnip" style="font-family: monospace;"><span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="kw2">var</span> area = document.<span class="me1">getElementById</span><span class="br0">&#40;</span>elemento<span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; selected = area.<span class="me1">value</span>.<span class="me1">substring</span><span class="br0">&#40;</span>area.<span class="me1">selectionStart</span>, area.<span class="me1">selectionEnd</span><span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span></div>
</div>
<p>In questo caso stiamo ottenendo la substring che inizia nella posizione dove inizia la selezione, e finisce nella posizione dove finisce la selezione (in pratica estrapola la stessa porzione di testo, capendo la posizione degli estremi con <strong>selectionStart</strong> e <strong>selectionEnd</strong>).</p>
<p>Boh, che orticaria.</p>
<p>Ah, nota interessante: <strong>Opera</strong> (che è sempre un sacco avanti) supporta entrambi i metodi (<strong>document.getSelection</strong> e <strong>document.selection</strong>)</p>
<p>Molte info accattate su <a href="http://www.quirksmode.org/dom/range_intro.html">quirksmode.org</a>.</p>
<p>Nota, se non si fosse capito: Il mio rapporto con javascript e coi CSS è decisamente conflittuale (più <em>odi</em> che <em>amo</em>, per intenderci).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.simotrone.it/2009/08/22/selection-con-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mastering CSS</title>
		<link>http://www.simotrone.it/2009/08/15/mastering-css/</link>
		<comments>http://www.simotrone.it/2009/08/15/mastering-css/#comments</comments>
		<pubDate>Sat, 15 Aug 2009 06:22:54 +0000</pubDate>
		<dc:creator>Simotrone</dc:creator>
				<category><![CDATA[Binary People]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[effetti grafici]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.simotrone.it/?p=2065</guid>
		<description><![CDATA[Un indice di un resoconto di articoli sui css, da smashingmagazine.com. Mastering CSS, Part 1: Styling Design Elements Layout and User Interface Techniques Navigation and Menu Techniques Image Styles and Galleries Typography Techniques Icons, Buttons and Links Mastering CSS, Part 2: Advanced Techniques and Tools Calendars, Lists, Tables, and Timelines iPhone CSS Techniques Form and [...]]]></description>
			<content:encoded><![CDATA[<p>Un indice di un resoconto di articoli sui css, da <a href="http://www.smashingmagazine.com">smashingmagazine.com</a>. <img src='http://www.simotrone.it/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://www.smashingmagazine.com/2009/08/03/mastering-css-styling-design-elements/">Mastering CSS, Part 1: Styling Design Elements</a></p>
<ol>
<li>Layout and User Interface Techniques</li>
<li>Navigation and Menu Techniques</li>
<li>Image Styles and Galleries</li>
<li>Typography Techniques</li>
<li>Icons, Buttons and Links</li>
</ol>
<p><a href="http://www.smashingmagazine.com/2009/08/10/mastering-css-advanced-techniques-and-tools/"><br />
Mastering CSS, Part 2: Advanced Techniques and Tools</a></p>
<ol>
<li>Calendars, Lists, Tables, and Timelines</li>
<li>iPhone CSS Techniques</li>
<li>Form and Search Techniques</li>
<li>Visualization Techniques</li>
<li>Other Handy Techniques and Tips</li>
<li>CSS3 Techniques</li>
<li>CSS Tools</li>
<li>More Articles and Resources</li>
</ol>
<p>Per ora ho usato i <a href="http://cssglobe.com/post/3875/cssg-collections-web-forms">form</a>, e letti gli articoli riguardanti le <a href="http://css-tricks.com/date-display-with-sprites/">date</a> (O_O), il <a href="http://css-tricks.com/text-blocks-over-image/">testo sulle immagini</a>, e gli <a href="http://www.sohtanaka.com/web-design/simple-page-peel-effect-with-jquery-css/">angoli da sfogliare</a> (bellissimo, provate il <a href="http://www.sohtanaka.com/web-design/examples/peeling-effect/">demo</a>!). Molto carini anche gli articoli sulle <a href="http://www.jankoatwarpspeed.com/post/2009/07/07/Adaptable-view.aspx">liste visualizzabili in maniera diversa</a> e riguardanti la <a href="http://www.smashingmagazine.com/2009/07/07/web-form-validation-best-practices-and-tutorials/">validazione dei form</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.simotrone.it/2009/08/15/mastering-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Image in text</title>
		<link>http://www.simotrone.it/2009/07/29/image-in-text/</link>
		<comments>http://www.simotrone.it/2009/07/29/image-in-text/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 05:52:55 +0000</pubDate>
		<dc:creator>Simotrone</dc:creator>
				<category><![CDATA[Binary People]]></category>
		<category><![CDATA[Visions]]></category>
		<category><![CDATA[generatore]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[immagini]]></category>
		<category><![CDATA[testo]]></category>

		<guid isPermaLink="false">http://www.simotrone.it/?p=2029</guid>
		<description><![CDATA[Ho trovato un giochino bellissimo. Inserite il testo. Date un&#8217;immagine a caso, e selezionate. Hide an image in html Genera anche il codice. Bellissimo.]]></description>
			<content:encoded><![CDATA[<p>Ho trovato un giochino bellissimo.<br />
Inserite il testo. Date un&#8217;immagine a caso, e selezionate. <img src='http://www.simotrone.it/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
<a href="http://metaatem.net/highlite/?text=Prova+a+scrivere+qualcosa+qua.&#038;image=http%3A%2F%2Ffc05.deviantart.com%2Ffs49%2Fi%2F2009%2F208%2Fc%2F9%2FNew_Logo___Renovatio_by_MadMax1987.png&#038;colors=128&#038;width=120">Hide an image in html</a><br />
Genera anche il codice.<br />
Bellissimo. <img src='http://www.simotrone.it/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.simotrone.it/2009/07/29/image-in-text/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stai sicuro!</title>
		<link>http://www.simotrone.it/2009/04/05/stai-sicuro/</link>
		<comments>http://www.simotrone.it/2009/04/05/stai-sicuro/#comments</comments>
		<pubDate>Sun, 05 Apr 2009 14:19:15 +0000</pubDate>
		<dc:creator>Simotrone</dc:creator>
				<category><![CDATA[Binary People]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[sicurezza siti]]></category>

		<guid isPermaLink="false">http://www.simotrone.it/?p=1607</guid>
		<description><![CDATA[Ok, weekend nel marasma delle webapplication. Ricapitolo un po&#8217;&#8230; * Passaggi dati non numerici (potenzialmente massicci) in POST, ritorno in GET (per forza). * Controllo in entrata di pagina (isset, is_numeric, blablabla, check di esistenza sul db). * Funzioni di escape sui dati da inserire nel db. (pg_escape_string, mysql_real_escape) * Funzioni di escape in output [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, weekend nel marasma delle webapplication.</p>
<p>Ricapitolo un po&#8217;&#8230;<br />
* Passaggi dati non numerici (potenzialmente massicci) in POST, ritorno in GET (per forza).<br />
* Controllo in entrata di pagina (isset, <a href="http://it.php.net/manual/en/function.is-numeric.php">is_numeric</a>, blablabla, check di esistenza sul db).<br />
* Funzioni di escape sui dati da inserire nel db. (<a href="http://it.php.net/manual/en/function.pg-escape-string.php">pg_escape_string</a>, <a href="http://it.php.net/manual/en/function.mysql-real-escape-string.php">mysql_real_escape</a>)<br />
* Funzioni di escape in output sul codice html (giusto per evitare scriptini e tag interpretabili): <a href="http://it.php.net/manual/en/function.htmlentities.php">htmlentities</a>.<br />
* Funzioni <a href="http://it.php.net/manual/en/function.stripslashes.php">stripslashes</a> per togliere gli escape nel db in output.<br />
* Check con regexp (<a href="http://it.php.net/manual/en/function.preg-match.php">preg_match</a>) sulle stringhe inserite, ocio ai filename con rischio per gli header serviti.</p>
<p>Un po&#8217; di storie dal <a href="http://phpsec.org/projects/guide/">php security consortium</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.simotrone.it/2009/04/05/stai-sicuro/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

