<?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>Random Bullshit &#187; python</title>
	<atom:link href="http://morpheus.level28.org/category/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://morpheus.level28.org</link>
	<description>Progetto B.L.O.G.</description>
	<lastBuildDate>Thu, 09 Sep 2010 00:32:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Dupefind</title>
		<link>http://morpheus.level28.org/2009/09/dupefind/</link>
		<comments>http://morpheus.level28.org/2009/09/dupefind/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 02:12:25 +0000</pubDate>
		<dc:creator>morpheus</dc:creator>
				<category><![CDATA[nerdate]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://morpheus.level28.org/archives/72-guid.html</guid>
		<description><![CDATA[Come promesso, ecco gli orrendi sorgenti dell&#039;applicazione che ho usato per generare l&#039;elenco dei codici fiscali duplicati (che non ho pubblicato &#8211; rompipalle s&#236;, aspirante suicida ancora no) e il grafico &#034;semianonimo&#034; delle relazioni tra duplicati. Riporto il contenuto del README per maggiore chiarezza: ******************************************* * Graduatorie alloggi - Ricerca duplicati * ******************************************* ======= NOTA [...]]]></description>
			<content:encoded><![CDATA[<p>Come promesso, ecco gli <a href="dupefind.tar.gz">orrendi sorgenti</a> dell&#039;applicazione che ho usato per generare l&#039;elenco dei codici fiscali duplicati (che non ho pubblicato &#8211; rompipalle s&igrave;, aspirante suicida ancora no) e il grafico &#034;semianonimo&#034; delle relazioni tra duplicati.</p>
<p>Riporto il contenuto del README per maggiore chiarezza:</p>
<pre class="code">*******************************************
* Graduatorie alloggi - Ricerca duplicati *
*******************************************

======= NOTA =======
I PDF contenenti gli elenchi sono stati scaricati da ilCapoluogo.it il
20-09-2009 tra le 15:40 e le 15:49, siete liberi di sostituirli con eventuali
elenchi aggiornati ma NON vi garantisco che questo coso continui a funzionare.
Se li sostituite, aggiornate il Makefile.

======= DISCLAIMER =======
I DATI PRODOTTI DA QUESTO SOFTWARE NON HANNO IL MINIMO VALORE LEGALE.
ZERO. NADA. NISBA.
Toglietevi subito dalla testa di usarlo per fare esposti, denunce o simili.
Ricontrollate SEMPRE *SEMPRE* _*SEMPRE*_ i dati prodotti dal software
confrontandoli manualmente con gli elenchi in PDF.
NON MI ASSUMO NESSUNA RESPONSABILITA` IN CASO DI DANNI A
PERSONE/COSE/ANIMALI/AMMINISTRATORI/COMMISSARI STRAORDINARI DERIVANTI DALL&#039;USO
PROPRIO O IMPROPRIO DI QUESTO SOFTWARE.
Se il software tira fuori il vostro nome/codice fiscale: CAZZI VOSTRI!
Gli elenchi sono pubblici (Albo Pretorio del Comune) e nessuno vi ha accusato di
alcunche&#039;, risultate solo come duplicati nelle domande.
Se questo vi comporta noia - ripeto - CAZZI VOSTRI!

======= REQUISITI DI SISTEMA =======
  * Bash (cio` implica un sistema *NIX, non garantisco nulla per cygwin)
  * GNU Make
  * GNU Grep
  * Python >=2.5 ma NON 3.x
  * python-lxml
  * python-yapgvb
  * poppler (poppler-utils su debian/ubuntu)

======= UTILIZZO =======
Digitate &#039;make&#039;. Tutto qui.
Otterrete due file interessanti:
  * duplicati.txt: l&#039;elenco dei codici fiscali duplicati e relativi
    intestatari delle domande a cui appartengono;
  * duplicati.svg: il diagramma "semianonimo" con i grafi delle relazioni tra
    duplicati.

Se volete deanonimizzare il grafo, modificate duplicati.py.
Se non sapete come farlo, attaccatevi.

 -- 21 Sett. 2009, Matteo Panella</pre>
]]></content:encoded>
			<wfw:commentRss>http://morpheus.level28.org/2009/09/dupefind/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Graduatorie alloggi: un&#039;analisi (molto) artigianale</title>
		<link>http://morpheus.level28.org/2009/09/graduatorie-alloggi-unanalisi-molto-artigianale/</link>
		<comments>http://morpheus.level28.org/2009/09/graduatorie-alloggi-unanalisi-molto-artigianale/#comments</comments>
		<pubDate>Sun, 20 Sep 2009 23:15:24 +0000</pubDate>
		<dc:creator>morpheus</dc:creator>
				<category><![CDATA[gente di un certo livello]]></category>
		<category><![CDATA[nerdate]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[real life]]></category>

		<guid isPermaLink="false">http://morpheus.level28.org/archives/71-guid.html</guid>
		<description><![CDATA[Di come vanno le cose per le C.A.S.E. e per i MAP &#8211; onestamente &#8211; non me ne dovrebbe fregare più di tanto, ho il garage agibile e vivrò lì finchè non avrò finito i lavori a casa. Però dopo aver letto le dichiarazioni di Fabio Pelini (PRC-SE), mi sono preso la briga di post-elaborare [...]]]></description>
			<content:encoded><![CDATA[<p>Di come vanno le cose per le C.A.S.E. e per i MAP &#8211; onestamente &#8211; non me ne dovrebbe fregare più di tanto, ho il garage agibile e vivrò lì finchè non avrò finito i lavori a casa.<br />
Però dopo aver letto le <a href="http://www.ilcapoluogo.com/e107_plugins/content/content.php?content.19807" target="_blank">dichiarazioni di Fabio Pelini (PRC-SE)</a>, mi sono preso la briga di post-elaborare anche io le graduatorie (con un metodo complicato &#8211; prima o poi posterò il software che ho scritto e usato) &#034;per vedere l&#039;effetto che fa&#034;.</p>
<p>Intanto cominciamo subito con un paio di perle d&#039;annata: il signor <strong>D&#039;AL√≤</strong> (sì, avete letto bene: &#034;D&#039;AL-RADICEQUADRATA-MINOREUGUALE&#034;) e un certo signor &#034;MARTINELLI&#034; privo di nome e con un codice fiscale che non ha nulla a che vedere con quel cognome.<br />
Ma questo non è niente: il risultato di questa analisi artigianale è che su <strong>23073</strong> codici fiscali <strong><span style="text-decoration: underline;">OTTANTASEI</span></strong> sono duplicati!</p>
<p>Ebbene sì, c&#039;è gente che compare in più nuclei familiari, oppure ha presentato una domanda ma si trova nel nucleo familiare di un&#039;altra domanda o addirittura ha presentato due domande. Il caso più eclatante è di due intestatari di una domanda, entrambi beneficiari di un alloggio presso le C.A.S.E.: uno figura nel nucleo familiare dell&#039;altro e viceversa!</p>
<p>Non ci credete? Ho preparato un <a href="http://morpheus.level28.org/duplicati.svg" target="_blank">diagramma in SVG</a> che illustra in forma di grafi i &#034;duplicati&#034; e le relazioni che intercorrono tra loro.<br />
I rettangoli rappresentano gli intestatari delle domande, le ellissi le persone che figurano solo come componenti di nuclei, gli archi uscenti da un nodo indicano l&#039;appartenenza al nucleo familiare di una domanda ed i colori indicano la graduatoria in cui è presente l&#039;intestatario:</p>
<ol>
<li>Rosso → beneficiario C.A.S.E.</li>
<li>Blu → beneficiario MAP</li>
<li>Ciano → in attesa di collocazione</li>
<li>Verde → non beneficiario</li>
</ol>
<p>Nel caso di domande multiple, il colore indica la domanda con assegnazione &#034;maggiore&#034; (secondo l&#039;ordine dell&#039;elenco precedente).<br />
I rettangoli isolati non sono errori (domanda doppia), né i doppi archi tra due nodi (vuol dire essenzialmente che l&#039;intestatario ha presentato due domande).<br />
Per scrupolo (leggasi: per evitare legnate), ho ritenuto opportuno sostituire i codici fiscali con una stringa semicasuale univoca.</p>
<p>Nel caso non abbiate un browser in grado di visualizzare SVG eccovi una versione ridottissima dell&#039;immagine (cliccate per ingrandire):<br />
<a href="'http://morpheus.level28.org/uploads/duplicati.png'"><!-- s9ymdb:27 --><img style="border: 1px solid; padding-left: 5px; padding-right: 5px;" src="http://morpheus.level28.org/uploads/duplicati.serendipityThumb.png" alt="Diagramma dei duplicati" width="300" height="281" /></a></p>
<p>&#034;Buona&#034; visione!</p>
]]></content:encoded>
			<wfw:commentRss>http://morpheus.level28.org/2009/09/graduatorie-alloggi-unanalisi-molto-artigianale/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FNV-0 in Python</title>
		<link>http://morpheus.level28.org/2008/06/fnv-0-in-python/</link>
		<comments>http://morpheus.level28.org/2008/06/fnv-0-in-python/#comments</comments>
		<pubDate>Mon, 16 Jun 2008 23:09:48 +0000</pubDate>
		<dc:creator>morpheus</dc:creator>
				<category><![CDATA[nerdate]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://morpheus.level28.org/archives/26-guid.html</guid>
		<description><![CDATA[Piccolo code snippet per estimatori del pitone. def fnv_hash&#40;data&#41;: &#160; &#160;&#34;&#34;&#34; &#160; &#160;Returns a 32bit FNV-0 hash of the given string. &#160; &#160; &#160;&#62;&#62;&#62; fnv_hash(&#039;3dcb910fb26bafb97e4a9660493afd9704536743&#039;) &#160; &#160;-1588890617L &#160; &#160;&#62;&#62;&#62; fnv_hash(&#039;deb114355f8b912c4f7c7f0aceac7adceaa5db10&#039;) &#160; &#160;317390073L &#160; &#160;&#34;&#34;&#34; &#160; &#160;h = long&#40;0&#41; &#160; &#160;for i in xrange&#40;len&#40;data&#41;&#41;: &#160; &#160; &#160; h += &#40;h &#60;&#60; 1&#41; + &#40;h &#60;&#60; 4&#41; [...]]]></description>
			<content:encoded><![CDATA[<p>Piccolo code snippet per estimatori del pitone.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff7700;font-weight:bold;">def</span> fnv_hash<span style="color: black;">&#40;</span>data<span style="color: black;">&#41;</span>:</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #483d8b;">&quot;&quot;</span><span style="color: #483d8b;">&quot;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #483d8b;"> &nbsp; &nbsp;Returns a 32bit FNV-0 hash of the given string.</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #483d8b;"> &nbsp; &nbsp;&gt;&gt;&gt; fnv_hash(&#039;3dcb910fb26bafb97e4a9660493afd9704536743&#039;)</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #483d8b;"> &nbsp; &nbsp;-1588890617L</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #483d8b;"> &nbsp; &nbsp;&gt;&gt;&gt; fnv_hash(&#039;deb114355f8b912c4f7c7f0aceac7adceaa5db10&#039;)</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #483d8b;"> &nbsp; &nbsp;317390073L</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #483d8b;"> &nbsp; &nbsp;&quot;</span><span style="color: #483d8b;">&quot;&quot;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;h = <span style="color: #008000;">long</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">xrange</span><span style="color: black;">&#40;</span><span style="color: #008000;">len</span><span style="color: black;">&#40;</span>data<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>:</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; h += <span style="color: black;">&#40;</span>h &lt;&lt; <span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span> + <span style="color: black;">&#40;</span>h &lt;&lt; <span style="color: #ff4500;">4</span><span style="color: black;">&#41;</span> + <span style="color: black;">&#40;</span>h &lt;&lt; <span style="color: #ff4500;">7</span><span style="color: black;">&#41;</span> + <span style="color: black;">&#40;</span>h &lt;&lt; <span style="color: #ff4500;">8</span><span style="color: black;">&#41;</span> + <span style="color: black;">&#40;</span>h &lt;&lt; <span style="color: #ff4500;">24</span><span style="color: black;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; h ^= <span style="color: #008000;">ord</span><span style="color: black;">&#40;</span>data<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #808080; font-style: italic;"># Everything after the 32th bit is meaningless</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;h &amp;= 0xffffffffL</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #808080; font-style: italic;"># Perform sign extension</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #ff7700;font-weight:bold;">if</span> h &amp; 0x80000000L:</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;h = -<span style="color: black;">&#40;</span>~<span style="color: black;">&#40;</span>h &#8211; <span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span> &amp; 0xffffffffL<span style="color: black;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #ff7700;font-weight:bold;">return</span> h</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
</ol>
</div>
<p>I compagni di merende che masticano C avranno sicuramente storto il naso vedendo sia l&#039;AND che l&#039;estensione di segno fatta in quel modo becero, quindi precisiamo:</p>
<ul>
<li>Python promuove automaticamente gli interi alla storage class superiore (<strong>ANCHE</strong> oltre i 64 bit) per evitare l&#039;overflow, quindi solo i 32 bit inferiori contengono valori sensati;</li>
<li>per quanto appena esposto, l&#039;estensione di segno non può essere effettuata con un banale OR (che promuoverebbe l&#039;intero per conservare il segno!) ma è necessario fare ricorso alla definizione scolastica di complemento a 2.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://morpheus.level28.org/2008/06/fnv-0-in-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The pasta theory of design</title>
		<link>http://morpheus.level28.org/2008/06/the-pasta-theory-of-design/</link>
		<comments>http://morpheus.level28.org/2008/06/the-pasta-theory-of-design/#comments</comments>
		<pubDate>Wed, 11 Jun 2008 15:50:58 +0000</pubDate>
		<dc:creator>morpheus</dc:creator>
				<category><![CDATA[nerdate]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://morpheus.level28.org/archives/25-guid.html</guid>
		<description><![CDATA[Spaghetti: each piece of code interacts with every other piece of code [can be implemented with GOTO, functions, objects] Lasagna: code has carefully designed layers. Each layer is, in theory independent. However low-level layers usually cannot be used easily, and high-level layers depend on low-level layers. Ravioli: each part of the code is useful by [...]]]></description>
			<content:encoded><![CDATA[<ul>
<li>Spaghetti: each piece of code interacts with every other piece of code [can be implemented with GOTO, functions, objects]</li>
<li>Lasagna: code has carefully designed layers. Each layer is, in theory independent. However low-level layers usually cannot be used easily, and high-level layers depend on low-level layers.</li>
<li>Ravioli: each part of the code is useful by itself. There is a thin layer of interfaces between various parts [the sauce]. Each part can be used elsewhere.</li>
<li>&#8230;but sometimes, the user just wants to order Ravioli, so one coarse-grain easily definable layer of abstraction on top of it all can be useful.</li>
</ul>
<p>(from <a href="http://twistedmatrix.com/">Twisted Matrix</a> documentation)</p>
]]></content:encoded>
			<wfw:commentRss>http://morpheus.level28.org/2008/06/the-pasta-theory-of-design/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
