<?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>tonicooperi.eu</title>
	<atom:link href="http://www.tonicooperi.eu/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tonicooperi.eu</link>
	<description>Io non ho particolari talenti, sono solo appassionatamente curioso.. ;)</description>
	<lastBuildDate>Thu, 13 May 2010 09:16:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Neo Freerunner I&#8217;m coming back! :)</title>
		<link>http://www.tonicooperi.eu/2010/05/11/neo-freerunner-im-coming-back/</link>
		<comments>http://www.tonicooperi.eu/2010/05/11/neo-freerunner-im-coming-back/#comments</comments>
		<pubDate>Tue, 11 May 2010 20:01:16 +0000</pubDate>
		<dc:creator>tonicooperi</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tecnologia]]></category>
		<category><![CDATA[Neo Freerunner]]></category>

		<guid isPermaLink="false">http://www.tonicooperi.eu/?p=421</guid>
		<description><![CDATA[Ebbene è proprio così!!    Dopo circa 1 anno di abbandono totale (causa idiozia)  sono fiero di comunicarvi che a breve ri-riceverò il mio nuovo e bellissimo Openmoko Neo Freerunner (maggiori informazioni su questo cellulare-pc li trovate nel Wiki ufficiale). Questa volta riceverò il modello GTA02A7++, ordinato da qui, che comprende molti [...]]]></description>
			<content:encoded><![CDATA[<p>Ebbene è proprio così!! <img src='http://www.tonicooperi.eu/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  <img src="http://www.tonicooperi.eu/wp-content/uploads/2010/05/openmoko_neo_freerunner-228x300.jpg" alt="" title="openmoko_neo_freerunner" width="228" height="300" class="alignright size-medium wp-image-438" /> Dopo circa 1 anno di abbandono totale (causa idiozia)  sono fiero di comunicarvi che a breve ri-riceverò il mio nuovo e bellissimo <strong>Openmoko Neo Freerunner</strong> (maggiori informazioni su questo cellulare-pc li trovate nel <a href="http://wiki.openmoko.org/wiki/Neo_FreeRunner/it">Wiki ufficiale</a>). Questa volta riceverò il modello GTA02A7++, ordinato da <a href="http://www.handheld-linux.com/wiki.php?page=Neo%20Freerunner&#038;gclid=CPj1467YsaECFQUFZgodlC0cAA">qui</a>, che comprende molti fix hardware e in più una Debug Board. Costo totale circa 332€ compreso di spese di spedizione! <img src='http://www.tonicooperi.eu/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  Sarò pazzo ma non immaginate neanche quanto mi possa essere pentito a vendere il <em>mokkolo</em> l&#8217; anno scorso!..Ovviamente mi sto già informando sul software da caricare sul Neo. Oltre a SHR, Debian e QtMoko, che non mancheranno sul mio gioiellino, sono contento di aver trovato una nuova distribuzione di nome <a href="http://sourceforge.net/apps/mediawiki/neophysis/index.php?title=Main_Page">neoPhysis</a> che è italiana!..Si trova ancora in fase di sviluppo ma non dubito che possa crescere bene..Inoltre vi linko il portale italiano sul telefoninux che è <a href="http://forum.telefoninux.org/">forum.telefoninux.org</a> dove troverete tutto ciò che vi serve per iniziare e continuare col vostro Neo, e moltissima gente davvero molto preparata in grado di aiutarvi!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tonicooperi.eu/2010/05/11/neo-freerunner-im-coming-back/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Arduino e fotoresistenza</title>
		<link>http://www.tonicooperi.eu/2010/04/27/arduino-e-fotoresistenza/</link>
		<comments>http://www.tonicooperi.eu/2010/04/27/arduino-e-fotoresistenza/#comments</comments>
		<pubDate>Tue, 27 Apr 2010 22:44:21 +0000</pubDate>
		<dc:creator>tonicooperi</dc:creator>
				<category><![CDATA[Elettronica]]></category>
		<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[Guide]]></category>

		<guid isPermaLink="false">http://www.tonicooperi.eu/?p=407</guid>
		<description><![CDATA[Eccomi di nuovo online!   Stasera ci occuperemo di collegare una comunissima fotoresistenza ad Arduino e in base alla luce presente si accenderà un Led. Sembra difficile? Non lo è per niente. 
Per realizzare tutto ciò, in primis, diamo un&#8217; occhiata ai collegamenti fisici da fare tra i vari componenti. La fotoresistenza e una [...]]]></description>
			<content:encoded><![CDATA[<p>Eccomi di nuovo online! <img src='http://www.tonicooperi.eu/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  Stasera ci occuperemo di collegare una comunissima <strong>fotoresistenza</strong> ad Arduino e in base alla luce presente si accenderà un Led. Sembra difficile? Non lo è per niente. <img src="http://www.tonicooperi.eu/wp-content/uploads/2010/04/27042010284-300x225.jpg" alt="" title="27042010284" width="300" height="225" class="alignright size-medium wp-image-410" /><br />
Per realizzare tutto ciò, in primis, diamo un&#8217; occhiata ai collegamenti fisici da fare tra i vari componenti. La fotoresistenza e una resistenza da 1kOhm vanno collegati in serie. Fatto questo colleghiamo al piedino lontano dalla resitenza della fotoresistenza (scusate ma sembra un gioco di parole-.-) la 5V di Arduino e dal lato della resistenza colleghiamo il GND. Dopodichè dove il piedino della fotoresistenza è collegato alla resistenza, esattamente lì, colleghiamo al pin digitale 1. Poi ovviamente collegate un Led al pin 13 di Arduino. Posto il pdf di uno schemino fatto da me. Magari si capisce meglio va. <img src='http://www.tonicooperi.eu/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  <a href='http://www.tonicooperi.eu/wp-content/uploads/2010/04/photoresistor.pdf'>Schemino collegamenti</a></p>
<p>E adesso veniamo al codice che spiegherò subito dopo:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #993333;">int</span> light<span style="color: #339933;">;</span>
<span style="color: #993333;">int</span> ledPin <span style="color: #339933;">=</span> <span style="color: #0000dd;">13</span><span style="color: #339933;">;</span>
<span style="color: #993333;">int</span> photoresistor <span style="color: #339933;">=</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #993333;">void</span> setup<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  Serial.<span style="color: #202020;">begin</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">9600</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  pinMode<span style="color: #009900;">&#40;</span>ledPin<span style="color: #339933;">,</span> OUTPUT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #993333;">void</span> loop<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  light <span style="color: #339933;">=</span> analogRead<span style="color: #009900;">&#40;</span>photoresistor<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  light <span style="color: #339933;">=</span> constrain<span style="color: #009900;">&#40;</span>light<span style="color: #339933;">,</span> <span style="color: #0000dd;">970</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">1023</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//&lt;-- il 970 potete cambiarlo </span>
  light <span style="color: #339933;">=</span> map<span style="color: #009900;">&#40;</span>light<span style="color: #339933;">,</span> <span style="color: #0000dd;">970</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">1023</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">255</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//in base alle vostre &quot;condizioni&quot;</span>
  analogWrite<span style="color: #009900;">&#40;</span>ledPin<span style="color: #339933;">,</span> light<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  Serial.<span style="color: #202020;">println</span><span style="color: #009900;">&#40;</span>light<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>In pratica tutto questo funziona così. La fotoresistenza, dalla &#8220;lettura analogica&#8221;, prende un valore tra 0 e 1023. Giocando con la quantità luce di che c&#8217; era in stanza ho realizzato che avrei voluto che il Led si accendesse a 970. La funzione <em>constrain</em> è utilizzata in modo tale che solo i valori tra 970 e 1023 vengano presi in considerazione. In pratica se sono presenti altri valori non compresi in quel range la funzione resitituisce 0. La funzione <em>map</em> è usata per <em>mappare</em> questo valore (che sceglierete voi) ad un valore di PWN (che va da 0 a 255) in modo tale da far accendere il Led.</p>
<p>Benissimo provateci anche voi e per ogni dubbio o osservazione o quello che vi pare non esitate a contattarmi. Vi lascio con un video dimostrativo di tutto ciò. <img src='http://www.tonicooperi.eu/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  Alla prossimaaaaaa <img src='http://www.tonicooperi.eu/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/M3arIEzbY6o&#038;hl=it&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/M3arIEzbY6o&#038;hl=it&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tonicooperi.eu/2010/04/27/arduino-e-fotoresistenza/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>2 Shift Register! :)</title>
		<link>http://www.tonicooperi.eu/2010/04/21/2-shift-register/</link>
		<comments>http://www.tonicooperi.eu/2010/04/21/2-shift-register/#comments</comments>
		<pubDate>Wed, 21 Apr 2010 13:06:51 +0000</pubDate>
		<dc:creator>tonicooperi</dc:creator>
				<category><![CDATA[Elettronica]]></category>
		<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[C]]></category>

		<guid isPermaLink="false">http://www.tonicooperi.eu/?p=400</guid>
		<description><![CDATA[Ecco di seguito, foto e video,  della versione con 2 shift register 74HC595 collegati ad Arduino  


Se ve lo state chiedendo..si, stavo guardando i simpson  
]]></description>
			<content:encoded><![CDATA[<p>Ecco di seguito, foto e video,  della versione con 2 shift register 74HC595 collegati ad Arduino <img src='http://www.tonicooperi.eu/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p><img src="http://www.tonicooperi.eu/wp-content/uploads/2010/04/21042010283-1024x768.jpg" alt="" title="21042010283" width="662" height="496" class="aligncenter size-large wp-image-401" /></p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/VxA6DokP8tw&#038;hl=it&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/VxA6DokP8tw&#038;hl=it&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
<p>Se ve lo state chiedendo..si, stavo guardando i simpson <img src='http://www.tonicooperi.eu/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.tonicooperi.eu/2010/04/21/2-shift-register/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Arduino e Shift Register 74HC595</title>
		<link>http://www.tonicooperi.eu/2010/04/21/arduino-e-shift-register-74hc595/</link>
		<comments>http://www.tonicooperi.eu/2010/04/21/arduino-e-shift-register-74hc595/#comments</comments>
		<pubDate>Wed, 21 Apr 2010 09:51:12 +0000</pubDate>
		<dc:creator>tonicooperi</dc:creator>
				<category><![CDATA[Elettronica]]></category>
		<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[C]]></category>

		<guid isPermaLink="false">http://www.tonicooperi.eu/?p=384</guid>
		<description><![CDATA[  Ecoomi di nuovo qui dopo un bel periodo di inattività!..   Eh si, ho avuto abbastanza da fare in questi ultimi due mesi e non sono riuscito a dedicare tanto tempo al blog..Tuttavia i progettini con Arduino continuavano ad esserci e alcuni sono riuscito a portarli a termine..
Quello che vi mostro oggi [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.tonicooperi.eu/wp-content/uploads/2010/04/20042010279.jpg"><img src="http://www.tonicooperi.eu/wp-content/uploads/2010/04/20042010279-300x225.jpg" alt="" title="20042010279" width="300" height="225" class="alignright size-medium wp-image-385" /></a>  Ecoomi di nuovo qui dopo un bel periodo di inattività!.. <img src='http://www.tonicooperi.eu/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  Eh si, ho avuto abbastanza da fare in questi ultimi due mesi e non sono riuscito a dedicare tanto tempo al blog..Tuttavia i progettini con Arduino continuavano ad esserci e alcuni sono riuscito a portarli a termine..<br />
Quello che vi mostro oggi è un semplicissimo esempio su come usare lo shift register 74HC595 per usare solamente 3 pin dell&#8217; Arduino per controllare 8 LED..Tutto ciò è scritto nel tutorial ufficiale di Arduino, precisamente <a href="http://www.arduino.cc/en/Tutorial/ShiftOut">qui</a>. Non è per niente una cosa difficile da fare anche se ho avuto qualche problemino con i collegamenti <img src='http://www.tonicooperi.eu/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> .. Sottolineo il fatto che nel realizzare il circuito non ho usato un condensatore come scritto nel tutorial, ma alla fine funziona tutto benissimo. Un video in cui mostro lo shift e Arduino a lavoro lo trovate <a href="http://www.flickr.com/photos/tonicooperi/4539813625/">qui</a> e alcune foto sono presenti nel mio album di Flickr.<br />
Prometto di non abbandonare mai più così tanto il mio blog, quindi vi assicuro che ci rivedremo molto presto (spero <img src='http://www.tonicooperi.eu/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> , speriamo!).<br />
Alla prossima!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tonicooperi.eu/2010/04/21/arduino-e-shift-register-74hc595/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Controllare Led dal Web con Arduino</title>
		<link>http://www.tonicooperi.eu/2010/03/08/controllare-led-dal-web-con-arduino/</link>
		<comments>http://www.tonicooperi.eu/2010/03/08/controllare-led-dal-web-con-arduino/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 19:06:21 +0000</pubDate>
		<dc:creator>tonicooperi</dc:creator>
				<category><![CDATA[Elettronica]]></category>
		<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[C]]></category>

		<guid isPermaLink="false">http://www.tonicooperi.eu/?p=375</guid>
		<description><![CDATA[Prendendo spunto da qui sono riuscito a controllore 4 Led collegati ad Arduino dal web.   In pratica lo sketch proposto da Instructables crea un web server sull&#8217; Arduino e, con l&#8217; aggiunta di qualche funzione di libreria (led.h, wstring.h ecc.), è in grado di controllare lo stato dei Led (on, off). Inoltre, genialata [...]]]></description>
			<content:encoded><![CDATA[<p>Prendendo spunto da <a href="http://www.instructables.com/id/Ethernet-Shield-LED-WEB-SERVER/">qui</a> sono riuscito a controllore 4<img class="alignright size-medium wp-image-376" title="" src="http://www.tonicooperi.eu/wp-content/uploads/2010/03/08032010264-300x225.jpg" alt="" width="300" height="225" /> Led collegati ad Arduino dal web. <img src='http://www.tonicooperi.eu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  In pratica lo sketch proposto da Instructables crea un web server sull&#8217; Arduino e, con l&#8217; aggiunta di qualche funzione di libreria (led.h, wstring.h ecc.), è in grado di controllare lo stato dei Led (on, off). Inoltre, genialata del creatore dello sketch <img src='http://www.tonicooperi.eu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> , Arduino aggiorna lo stato del nostro Twitter in automatico ad ogni cambiamento di stato dei Led. <img src='http://www.tonicooperi.eu/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  Tutto quello di cui abbiamo bisogno è una Arduino, l&#8217; Ethernet Shield (ovviamente!), un paio di Led e un router.<br />
Tutto ciò fa capire che con qualche piccola modifica qua e là è possibile realizzare sketch in grado di controllare svariati oggetti, ad esempio servo motori, per creare progettini interessanti.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tonicooperi.eu/2010/03/08/controllare-led-dal-web-con-arduino/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Si inizia con Arduino!(Quasi)</title>
		<link>http://www.tonicooperi.eu/2010/03/06/si-inizia-con-arduinoquasi/</link>
		<comments>http://www.tonicooperi.eu/2010/03/06/si-inizia-con-arduinoquasi/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 15:31:54 +0000</pubDate>
		<dc:creator>tonicooperi</dc:creator>
				<category><![CDATA[Elettronica]]></category>
		<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[C]]></category>

		<guid isPermaLink="false">http://www.tonicooperi.eu/?p=368</guid>
		<description><![CDATA[In attesa del 10 di marzo, giorno in cui è fissato l&#8217; orale di analisi matematica, ho deciso di dilettarmi giusto 5 minuti con Arduino! 
Il risultato è un trio di LED lampeggianti prima in sequenza e poi emettendo una specie di flash. Ciò di cui mi sono servito è: 3 LED, 3 resistenze, l&#8217; [...]]]></description>
			<content:encoded><![CDATA[<p>In attesa del 10 di marzo, giorno in cui è fissato l&#8217; orale di analisi matematica, ho deciso di dilettarmi giusto 5 minuti con Arduino! <img src='http://www.tonicooperi.eu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Il risultato è un trio di LED lampeggianti prima in sequenza e poi emettendo una specie di flash. Ciò di cui mi sono servito è: 3 LED, 3 resistenze, l&#8217; Arduino Duemilanove, un pò di C e ovviamente un attimo di pazienza. Ecco fatto. <img src='http://www.tonicooperi.eu/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #993333;">int</span> ledPin1 <span style="color: #339933;">=</span>  <span style="color: #0000dd;">10</span><span style="color: #339933;">;</span>    <span style="color: #666666; font-style: italic;">// LED connected to digital pin 10</span>
<span style="color: #993333;">int</span> ledPin2 <span style="color: #339933;">=</span>  <span style="color: #0000dd;">11</span><span style="color: #339933;">;</span>    <span style="color: #666666; font-style: italic;">// LED connected to digital pin 11</span>
<span style="color: #993333;">int</span> ledPin3 <span style="color: #339933;">=</span>  <span style="color: #0000dd;">12</span><span style="color: #339933;">;</span>    <span style="color: #666666; font-style: italic;">// LED connected to digital pin 12</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// The setup() method runs once, when the sketch starts</span>
&nbsp;
<span style="color: #993333;">void</span> setup<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>   <span style="color: #009900;">&#123;</span>                
  <span style="color: #666666; font-style: italic;">// initialize the digital pin as an output:</span>
  pinMode<span style="color: #009900;">&#40;</span>ledPin1<span style="color: #339933;">,</span> OUTPUT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  pinMode<span style="color: #009900;">&#40;</span>ledPin2<span style="color: #339933;">,</span> OUTPUT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
  pinMode<span style="color: #009900;">&#40;</span>ledPin3<span style="color: #339933;">,</span> OUTPUT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// the loop() method runs over and over again,</span>
<span style="color: #666666; font-style: italic;">// as long as the Arduino has power</span>
&nbsp;
<span style="color: #993333;">void</span> loop<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>                     
<span style="color: #009900;">&#123;</span>
  digitalWrite<span style="color: #009900;">&#40;</span>ledPin1<span style="color: #339933;">,</span> HIGH<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>   <span style="color: #666666; font-style: italic;">// set the LED on</span>
  delay<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>                   <span style="color: #666666; font-style: italic;">// wait for a second</span>
  digitalWrite<span style="color: #009900;">&#40;</span>ledPin1<span style="color: #339933;">,</span> LOW<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>    <span style="color: #666666; font-style: italic;">//set the LED off</span>
  delay<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">100</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>                  
  digitalWrite<span style="color: #009900;">&#40;</span>ledPin2<span style="color: #339933;">,</span> HIGH<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  delay<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>                  
  digitalWrite<span style="color: #009900;">&#40;</span>ledPin2<span style="color: #339933;">,</span> LOW<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  delay<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">100</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  digitalWrite<span style="color: #009900;">&#40;</span>ledPin3<span style="color: #339933;">,</span> HIGH<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>    
  delay<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>                  
  digitalWrite<span style="color: #009900;">&#40;</span>ledPin3<span style="color: #339933;">,</span> LOW<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  delay<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">100</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  digitalWrite<span style="color: #009900;">&#40;</span>ledPin1<span style="color: #339933;">,</span> HIGH<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  digitalWrite<span style="color: #009900;">&#40;</span>ledPin2<span style="color: #339933;">,</span> HIGH<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>   
  digitalWrite<span style="color: #009900;">&#40;</span>ledPin3<span style="color: #339933;">,</span> HIGH<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>   
  delay<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">100</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  digitalWrite<span style="color: #009900;">&#40;</span>ledPin1<span style="color: #339933;">,</span> LOW<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  digitalWrite<span style="color: #009900;">&#40;</span>ledPin2<span style="color: #339933;">,</span> LOW<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  digitalWrite<span style="color: #009900;">&#40;</span>ledPin3<span style="color: #339933;">,</span> LOW<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  delay<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">100</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  digitalWrite<span style="color: #009900;">&#40;</span>ledPin1<span style="color: #339933;">,</span> HIGH<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  digitalWrite<span style="color: #009900;">&#40;</span>ledPin2<span style="color: #339933;">,</span> HIGH<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>   
  digitalWrite<span style="color: #009900;">&#40;</span>ledPin3<span style="color: #339933;">,</span> HIGH<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>   
  delay<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">100</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  digitalWrite<span style="color: #009900;">&#40;</span>ledPin1<span style="color: #339933;">,</span> LOW<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  digitalWrite<span style="color: #009900;">&#40;</span>ledPin2<span style="color: #339933;">,</span> LOW<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  digitalWrite<span style="color: #009900;">&#40;</span>ledPin3<span style="color: #339933;">,</span> LOW<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  delay<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Questo che segue è il risultato filmato con la videocamera (scusate per la qualita ma è un cellulare <img src='http://www.tonicooperi.eu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ).</p>
<p><object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/ZNlRLvrbqeQ&#038;hl=it_IT&#038;fs=1&#038;rel=0&#038;color1=0x3a3a3a&#038;color2=0x999999"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/ZNlRLvrbqeQ&#038;hl=it_IT&#038;fs=1&#038;rel=0&#038;color1=0x3a3a3a&#038;color2=0x999999" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tonicooperi.eu/2010/03/06/si-inizia-con-arduinoquasi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vettori allocati dinamicamente</title>
		<link>http://www.tonicooperi.eu/2010/02/01/vettori-allocati-dinamicamente/</link>
		<comments>http://www.tonicooperi.eu/2010/02/01/vettori-allocati-dinamicamente/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 01:22:47 +0000</pubDate>
		<dc:creator>tonicooperi</dc:creator>
				<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[C]]></category>

		<guid isPermaLink="false">http://www.tonicooperi.eu/?p=349</guid>
		<description><![CDATA[Allocare, deallocare, reallocare == malloc()/calloc(,), free(), realloc(,) 
Semplicissimo esempio con i vettori.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include &#60;stdio.h&#62;
#include &#60;stdlib.h&#62;
&#160;
int main&#40;&#41;
&#123;
	int i;
	int *vet = calloc&#40;10, sizeof &#40;int&#41;&#41;;
&#160;
	if &#40;vet == NULL&#41;
	    printf&#40;&#34;ERRORE! Memoria non allocata!&#34;&#41;;
	else &#123;
	    printf&#40;&#34;Creato dinamicamente un vettore di 10 elementi &#34;
				&#34;con calloc()\n&#34;&#41;;
		for&#40;i=0;i&#60;10;i++&#41;
			vet&#91; i &#93; = i * 13;
		for&#40;i=0;i&#60;10;i++&#41;
			printf&#40;&#34;[%d]-&#62;&#34;, vet&#91; i &#93;&#41;;
		printf&#40;&#34;[END]\n&#34;&#41;;
	&#125;
&#160;
	int *tmp = [...]]]></description>
			<content:encoded><![CDATA[<p>Allocare, deallocare, reallocare == malloc()/calloc(,), free(), realloc(,) <img src='http://www.tonicooperi.eu/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /><br />
Semplicissimo esempio con i vettori.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#include &lt;stdio.h&gt;</span>
<span style="color: #339933;">#include &lt;stdlib.h&gt;</span>
&nbsp;
<span style="color: #993333;">int</span> main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #993333;">int</span> i<span style="color: #339933;">;</span>
	<span style="color: #993333;">int</span> <span style="color: #339933;">*</span>vet <span style="color: #339933;">=</span> calloc<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">10</span><span style="color: #339933;">,</span> <span style="color: #993333;">sizeof</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>vet <span style="color: #339933;">==</span> NULL<span style="color: #009900;">&#41;</span>
	    <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;ERRORE! Memoria non allocata!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
	    <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Creato dinamicamente un vettore di 10 elementi &quot;</span>
				<span style="color: #ff0000;">&quot;con calloc()<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>i<span style="color: #339933;">&lt;</span><span style="color: #0000dd;">10</span><span style="color: #339933;">;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
			vet<span style="color: #009900;">&#91;</span> i <span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> i <span style="color: #339933;">*</span> <span style="color: #0000dd;">13</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>i<span style="color: #339933;">&lt;</span><span style="color: #0000dd;">10</span><span style="color: #339933;">;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
			<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;[%d]-&gt;&quot;</span><span style="color: #339933;">,</span> vet<span style="color: #009900;">&#91;</span> i <span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;[END]<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #993333;">int</span> <span style="color: #339933;">*</span>tmp <span style="color: #339933;">=</span> realloc<span style="color: #009900;">&#40;</span>vet<span style="color: #339933;">,</span> <span style="color: #0000dd;">20</span> <span style="color: #339933;">*</span> <span style="color: #993333;">sizeof</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>tmp <span style="color: #339933;">!=</span> NULL<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Spazio memoria modificato con realloc()<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
				<span style="color: #ff0000;">&quot;Adesso il vettore ha 20 elementi<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>i<span style="color: #339933;">&lt;</span><span style="color: #0000dd;">20</span><span style="color: #339933;">;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
			tmp<span style="color: #009900;">&#91;</span> i <span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> i <span style="color: #339933;">+</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>i<span style="color: #339933;">&lt;</span><span style="color: #0000dd;">20</span><span style="color: #339933;">;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
			<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;[%d]-&gt;&quot;</span><span style="color: #339933;">,</span> tmp<span style="color: #009900;">&#91;</span> i <span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;[END]<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Memoria deallocata con free()<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		free<span style="color: #009900;">&#40;</span>tmp<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		tmp <span style="color: #339933;">=</span> NULL<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">else</span>
		<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;ERRORE! Memoria non allocata<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> EXIT_SUCCESS<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.tonicooperi.eu/2010/02/01/vettori-allocati-dinamicamente/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Vettori bidimensionali..alteresì conosciuti come Matrici</title>
		<link>http://www.tonicooperi.eu/2010/01/31/vettori-bidimensionali-alteresi-conosciuti-come-matrici/</link>
		<comments>http://www.tonicooperi.eu/2010/01/31/vettori-bidimensionali-alteresi-conosciuti-come-matrici/#comments</comments>
		<pubDate>Sun, 31 Jan 2010 22:21:08 +0000</pubDate>
		<dc:creator>tonicooperi</dc:creator>
				<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[C]]></category>

		<guid isPermaLink="false">http://www.tonicooperi.eu/?p=308</guid>
		<description><![CDATA[Cosa sarà mai un vettore bidimensionale??? O.O&#8230;Bene..Una semplice matrice. 
Prendendo spunto da questo, cosa che ovviamente &#8220;ancora&#8221; non so fare nè in python nè in altri linguaggi, ho deciso di creare un programmino simile, ma non con quelle funzionalità.
Questo semplicissimo programmino crea una matrice 10&#215;10 riempiendola con valori da 0 a 99 che non si [...]]]></description>
			<content:encoded><![CDATA[<p>Cosa sarà mai un <em>vettore bidimensionale</em>??? O.O&#8230;Bene..Una semplice <strong>matrice</strong>. <img src='http://www.tonicooperi.eu/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /><br />
Prendendo spunto da <a href="http://codegolf.com/grid-computing"><strong>questo</strong></a>, cosa che ovviamente &#8220;ancora&#8221; non so fare nè in python nè in altri linguaggi, ho deciso di creare un programmino simile, ma non con quelle funzionalità.<br />
Questo semplicissimo programmino crea una matrice 10&#215;10 riempiendola con valori da 0 a 99 che non si ripetono mai. Fatto ciò visualizza la matrice e stampa su terminale la somma dei valori di ogni colonna. Essi verranno analizzati e alla fine verrà stampato il massimo risultato tra tutti quelli di ogni colonna.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/*
&nbsp;
 grid.c
&nbsp;
 Copyright 2010 Antonio Murdaca &lt;tonicooperi13@tonicooperi.eu&gt;
&nbsp;
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation, either version 3 of the License, or
     (at your option) any later version.
&nbsp;
     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
     GNU General Public License for more details.
&nbsp;
     You should have received a copy of the GNU General Public License
     along with this program. If not, see &lt;http://www.gnu.org/licenses/&gt;.
&nbsp;
*/</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* Semplice programma che opera su una matrice 10x10 */</span>
&nbsp;
<span style="color: #339933;">#include &lt;stdio.h&gt;</span>
<span style="color: #339933;">#include &lt;stdlib.h&gt;</span>
<span style="color: #339933;">#include &lt;time.h&gt;</span>
&nbsp;
<span style="color: #339933;">#define SIZE 10</span>
&nbsp;
<span style="color: #993333;">int</span> grid<span style="color: #009900;">&#91;</span> SIZE <span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span> SIZE <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #808080; font-style: italic;">/* MATRICE 10x10 */</span>
<span style="color: #993333;">int</span> row<span style="color: #339933;">;</span>	<span style="color: #808080; font-style: italic;">/* RIGHE */</span>
<span style="color: #993333;">int</span> column<span style="color: #339933;">;</span>	<span style="color: #808080; font-style: italic;">/* COLONNE */</span>
&nbsp;
<span style="color: #993333;">int</span> checkNumber<span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> n<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #808080; font-style: italic;">/* VERICFICO CHE DEI VALORI NON SI RIPETANO */</span>
	<span style="color: #993333;">int</span> i<span style="color: #339933;">,</span> k<span style="color: #339933;">;</span>
	<span style="color: #993333;">int</span> check <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>i<span style="color: #339933;">&lt;</span>SIZE<span style="color: #339933;">;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
		<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>k <span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>k<span style="color: #339933;">&lt;</span>SIZE<span style="color: #339933;">;</span>k<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
			<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>n <span style="color: #339933;">==</span> grid <span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>k<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
				check <span style="color: #339933;">=</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">return</span> check<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #993333;">void</span> riempi<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #808080; font-style: italic;">/* RIEMPIO LA MATRICE CON VALORI CASUALI */</span>
	srand<span style="color: #009900;">&#40;</span> time<span style="color: #009900;">&#40;</span>NULL<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #993333;">int</span> c<span style="color: #339933;">,</span> i<span style="color: #339933;">;</span>
	<span style="color: #993333;">int</span> contatore <span style="color: #339933;">=</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span>row<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>row<span style="color: #339933;">&lt;</span>SIZE<span style="color: #339933;">;</span>row<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
		<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span>column<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>column<span style="color: #339933;">&lt;</span>SIZE<span style="color: #339933;">;</span>column<span style="color: #339933;">++,</span>contatore<span style="color: #339933;">&lt;=</span><span style="color: #0000dd;">99</span><span style="color: #009900;">&#41;</span>		
		<span style="color: #009900;">&#123;</span>
			<span style="color: #993333;">int</span> check<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">do</span>
			<span style="color: #009900;">&#123;</span>
				c <span style="color: #339933;">=</span> rand<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">%</span> <span style="color: #0000dd;">100</span><span style="color: #339933;">;</span>
				check <span style="color: #339933;">=</span> checkNumber<span style="color: #009900;">&#40;</span>c<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span>check <span style="color: #339933;">==</span> <span style="color: #0000dd;">1</span> <span style="color: #339933;">&amp;&amp;</span> contatore <span style="color: #339933;">&lt;=</span> <span style="color: #0000dd;">99</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			grid<span style="color: #009900;">&#91;</span> row <span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span> column <span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> c<span style="color: #339933;">;</span>
			contatore<span style="color: #339933;">++;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>i<span style="color: #339933;">&lt;</span><span style="color: #0000dd;">100</span><span style="color: #339933;">;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
				<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>checkNumber<span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span>
					grid<span style="color: #009900;">&#91;</span> SIZE <span style="color: #339933;">-</span> <span style="color: #0000dd;">1</span> <span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span> SIZE <span style="color: #339933;">-</span> <span style="color: #0000dd;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> i<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #993333;">int</span> somma_e_max<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #993333;">int</span> max<span style="color: #009900;">&#91;</span>SIZE<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #993333;">int</span> totcol <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
	<span style="color: #993333;">int</span> i<span style="color: #339933;">,</span> pass<span style="color: #339933;">;</span>
	<span style="color: #993333;">int</span> massimo<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #808080; font-style: italic;">/* SOMMA DEGLI ELEMENTI DI OGNI COLONNA */</span>
	<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>column<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>column<span style="color: #339933;">&lt;</span>SIZE<span style="color: #339933;">;</span>column<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>row<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>row<span style="color: #339933;">&lt;</span>SIZE<span style="color: #339933;">;</span>row<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
			totcol <span style="color: #339933;">+=</span> grid<span style="color: #009900;">&#91;</span> row <span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span> column <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	max<span style="color: #009900;">&#91;</span> column <span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> totcol<span style="color: #339933;">;</span>
	<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot; %2d &quot;</span><span style="color: #339933;">,</span> totcol<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	totcol <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #808080; font-style: italic;">/* DETERMINO IL MASSIMO RISULTATO DELLE SOMME PRECEDENTI */</span>
	<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>i<span style="color: #339933;">&lt;</span>SIZE<span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		 <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>max<span style="color: #009900;">&#91;</span> i <span style="color: #009900;">&#93;</span> <span style="color: #339933;">&gt;</span> max<span style="color: #009900;">&#91;</span> i <span style="color: #339933;">+</span> <span style="color: #0000dd;">1</span> <span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			massimo <span style="color: #339933;">=</span> max<span style="color: #009900;">&#91;</span> i <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>	
			max<span style="color: #009900;">&#91;</span> i <span style="color: #339933;">+</span> <span style="color: #0000dd;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> max<span style="color: #009900;">&#91;</span> i <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
			massimo <span style="color: #339933;">=</span> max<span style="color: #009900;">&#91;</span> i <span style="color: #339933;">+</span> <span style="color: #0000dd;">1</span> <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>	
	<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot; Il massimo risultato è %d<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> massimo<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #993333;">int</span> main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	riempi<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>row<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>row<span style="color: #339933;">&lt;</span>SIZE<span style="color: #339933;">;</span>row<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>   <span style="color: #808080; font-style: italic;">/* VISUALIZZO LA MATRICE */</span>
		<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>column<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>column<span style="color: #339933;">&lt;</span>SIZE<span style="color: #339933;">;</span>column<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
			<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%4d &quot;</span><span style="color: #339933;">,</span> grid<span style="color: #009900;">&#91;</span> row <span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span> column <span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	somma_e_max<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> EXIT_SUCCESS<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Questo è un possibile output:</p>
<p><a href="http://www.tonicooperi.eu/wp-content/uploads/2010/01/Schermata.png"><img src="http://www.tonicooperi.eu/wp-content/uploads/2010/01/Schermata-300x175.png" alt="" title="Schermata" width="300" height="175" class="alignleft size-medium wp-image-307" /></a><br /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tonicooperi.eu/2010/01/31/vettori-bidimensionali-alteresi-conosciuti-come-matrici/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Python, PEP8 e repository su github.com</title>
		<link>http://www.tonicooperi.eu/2010/01/29/python-pep8-e-repository-su-github-com/</link>
		<comments>http://www.tonicooperi.eu/2010/01/29/python-pep8-e-repository-su-github-com/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 22:38:33 +0000</pubDate>
		<dc:creator>tonicooperi</dc:creator>
				<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.tonicooperi.eu/?p=291</guid>
		<description><![CDATA[Oggi è un grande giorno!!!  &#8230;Ebbene si, proprio oggi ho deciso di ampliare le mie conoscenze in fatto di programmazione. E ho deciso di implementare in me stesso le conoscenze riguardo Python.  ..Difatti ho già iniziato a scrivere qualche piccolo programmino così, tanto per iniziare, e mi sto aiutando col libro &#8220;Dive into [...]]]></description>
			<content:encoded><![CDATA[<p>Oggi è un grande giorno!!! <img src='http://www.tonicooperi.eu/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> &#8230;Ebbene si, proprio oggi ho deciso di ampliare le mie conoscenze in fatto di programmazione. E ho deciso di implementare in me stesso le conoscenze riguardo <strong><a href="http://www.python.org/">Python</a></strong>. <img src='http://www.tonicooperi.eu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> <img src="http://www.tonicooperi.eu/wp-content/uploads/2010/01/python-logo-glassy-235x300.png" alt="" title="python-logo-glassy" width="235" height="300" class="alignright size-medium wp-image-293" />..Difatti ho già iniziato a scrivere qualche piccolo programmino così, tanto per iniziare, e mi sto aiutando col libro <a href="http://diveintopython3.org/"><em>&#8220;Dive into Python 3&#8243;</em></a>, che a dir la verità è fatto davvero bene. Almeno per chi ha qualche &#8220;basettina&#8221; di programmazione.<br />
In contemporanea, mentre girovagavo nel sito di Python, ho scoperto la <strong><a href="http://www.python.org/dev/peps/pep-0008/">PEP8</a></strong>. La PEP8 è una specifica di Python che indica come si dovrebbe scrivere il codice (definisce come deve essere l’ indentazione ecc.). E fu così che trovai questo utilissimo script: <a href="http://github.com/jcrocholl/pep8/raw/master/pep8.py">http://github.com/jcrocholl/pep8/raw/master/pep8.py</a>. Questo programma verifica se il codice scritto è conforme alla PEP8. Per usarlo digitate da terminale <em>python pep8.py &#8211;filename-patterns codicedaverificare.py</em>..et voilà!..Scopriremo all&#8217; istante se abbiamo effettivamente scritto codice python in maniera adeguata!<br />
Un&#8217; altra fantastica notizia riguarda sempre me. <img src='http://www.tonicooperi.eu/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  Mi sono registrato su <a href="http://github.com//"><strong>github.com</strong></a>. Potete trovare tutti i programmi che scriverò d&#8217; ora in avanti qui: <a href="http://github.com/tonicooperi">http://github.com/tonicooperi</a>.<br />
Per oggi è tutto. <img src='http://www.tonicooperi.eu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
A presto!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tonicooperi.eu/2010/01/29/python-pep8-e-repository-su-github-com/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Processi e sostituzione del programma in esecuzione</title>
		<link>http://www.tonicooperi.eu/2010/01/28/processi-e-sostituzione-del-programma-in-esecuzione/</link>
		<comments>http://www.tonicooperi.eu/2010/01/28/processi-e-sostituzione-del-programma-in-esecuzione/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 18:32:37 +0000</pubDate>
		<dc:creator>tonicooperi</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[C]]></category>

		<guid isPermaLink="false">http://www.tonicooperi.eu/?p=273</guid>
		<description><![CDATA[Un semplicissimo esempio riguardo l&#8217; uso delle più comuni funzioni per gestire i processi, ovviamente solo sotto Linux: pid_t fork( );, pid_t getpid( );, pid_t waitpid(pid_t pid, int *status, int options);, void exit(int);.
I due programmi sono strettamente correlati tra loro in quanto il primo, richiamando la funzione int execl (char *nome_programma, char *arg0, char *arg1, [...]]]></description>
			<content:encoded><![CDATA[<p>Un semplicissimo esempio riguardo l&#8217; uso delle più comuni funzioni per gestire i processi, ovviamente solo sotto Linux: <em>pid_t fork( );, pid_t getpid( );, pid_t waitpid(pid_t pid, int *status, int options);, void exit(int);</em>.<br />
I due programmi sono strettamente correlati tra loro in quanto il primo, richiamando la funzione <em>int execl (char *nome_programma, char *arg0, char *arg1, &#8230;NULL );</em>, sostituisce la sua esecuzione con quella del secondo programma passandogli 4 parametri. Il secondo programma, il broswer Icecat (potete scegliere quale volete), aprirà 3 pagine web. <img src='http://www.tonicooperi.eu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Che divertimento. <img src='http://www.tonicooperi.eu/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/*
&nbsp;
 pidexecl.c
&nbsp;
 Copyright 2010 Antonio Murdaca &lt;tonicooperi13@tonicooperi.eu&gt;
&nbsp;
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation, either version 3 of the License, or
     (at your option) any later version.
&nbsp;
     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
     GNU General Public License for more details.
&nbsp;
     You should have received a copy of the GNU General Public License
     along with this program. If not, see &lt;http://www.gnu.org/licenses/&gt;.
&nbsp;
*/</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* Semplice esempio sulla creazione di nuovi processi e un pò della
   loro gestione. Inoltre è presente l' uso della funzione
   int execl (char *nome_programma, char *arg0, char *arg1,...NULL );.
   che sostituisce il primo programma con un altro.
   Il broswer Icecat /usr/bin/icecat (sostituibile con uno qualsiasi)
   aprirà 3 pagine web in 3 schede.
   I numeri di printf (Es. &quot;2.&quot;) aiutano a capire l' ordine &quot;cronologico&quot;
   dell' esecuzione delle funzioni sui processi. */</span>
&nbsp;
<span style="color: #339933;">#include &lt;stdio.h&gt;</span>
<span style="color: #339933;">#include &lt;stdlib.h&gt;</span>
<span style="color: #339933;">#include &lt;sys/types.h&gt;</span>
<span style="color: #339933;">#include &lt;unistd.h&gt;</span>
&nbsp;
<span style="color: #993333;">int</span> main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
pid_t pid<span style="color: #339933;">,</span> pid1<span style="color: #339933;">,</span> pid2<span style="color: #339933;">;</span>
<span style="color: #993333;">int</span> status<span style="color: #339933;">,</span> status1<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #993333;">char</span> p1<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #ff0000;">&quot;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #993333;">char</span> p2<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #ff0000;">&quot;tonicooperi.eu&quot;</span><span style="color: #339933;">;</span>
<span style="color: #993333;">char</span> p3<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #ff0000;">&quot;google.it&quot;</span><span style="color: #339933;">;</span>
<span style="color: #993333;">char</span> p4<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #ff0000;">&quot;google.it&quot;</span><span style="color: #339933;">;</span>
&nbsp;
pid<span style="color: #339933;">=</span>fork<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>pid<span style="color: #339933;">==</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		pid<span style="color: #339933;">=</span>getpid<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;3.Sono il primo processo figlio con PID=%d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> pid<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		pid2<span style="color: #339933;">=</span>fork<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>pid2<span style="color: #339933;">==</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				pid2<span style="color: #339933;">=</span>getpid<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;5.Sono il primo processo generato da PID=%d&quot;</span>
							<span style="color: #ff0000;">&quot; prima di morire,<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
							<span style="color: #ff0000;">&quot;6.il mio PID invece è&quot;</span>
							<span style="color: #ff0000;">&quot; %d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span>pid<span style="color: #339933;">,</span>pid2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				exit<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">26</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		pid<span style="color: #339933;">=</span>waitpid<span style="color: #009900;">&#40;</span>pid2<span style="color: #339933;">,&amp;</span>status1<span style="color: #339933;">,</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;7.Il processo %d è morto con Stato=%d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span>pid2<span style="color: #339933;">,</span>status1<span style="color: #339933;">/</span><span style="color: #0000dd;">256</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		exit<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">13</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
		pid1<span style="color: #339933;">=</span>getpid<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;1.Sono il processo padre con PID=%d,<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
		<span style="color: #ff0000;">&quot;2.ho creato il primo processo figlio con PID=%d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> pid1<span style="color: #339933;">,</span> pid<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		pid1<span style="color: #339933;">=</span>waitpid<span style="color: #009900;">&#40;</span>pid<span style="color: #339933;">,&amp;</span>status<span style="color: #339933;">,</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
		<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;4.Il primo processo figlio PID=%d è morto con Stato=%d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span>
			 pid<span style="color: #339933;">,</span> status<span style="color: #339933;">/</span><span style="color: #0000dd;">256</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>8.PID=%d passa 4 parametri, e poi muore, con execl() &quot;</span>
			<span style="color: #ff0000;">&quot;al programma /usr/bin/icecat<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> getpid<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		execl<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;/usr/bin/icecat&quot;</span><span style="color: #339933;">,</span> p1<span style="color: #339933;">,</span> p2<span style="color: #339933;">,</span> p3<span style="color: #339933;">,</span> p4<span style="color: #339933;">,</span> NULL<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		exit<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">return</span> EXIT_SUCCESS<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.tonicooperi.eu/2010/01/28/processi-e-sostituzione-del-programma-in-esecuzione/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
