<?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>IoSmanetto.it - Blog programmazione e webdesign &#187; funzione</title>
	<atom:link href="http://www.iosmanetto.it/tag/funzione/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.iosmanetto.it</link>
	<description>Il blog per tutti gli smanettoni del pc. Ogni giorno nuovi articoli sul webdesign e sulla programmazione</description>
	<lastBuildDate>Sat, 16 Apr 2011 16:19:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>GotoXY sul compilatore DevC++</title>
		<link>http://www.iosmanetto.it/cpp/gotoxy-sul-compilatore-devc/</link>
		<comments>http://www.iosmanetto.it/cpp/gotoxy-sul-compilatore-devc/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 21:10:23 +0000</pubDate>
		<dc:creator>Gregorio</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[funzione]]></category>

		<guid isPermaLink="false">http://www.iosmanetto.it/?p=425</guid>
		<description><![CDATA[Lo scopo della funzione gotoxy, presente nella libreria conio.h , è quello di spostare il cursore della console. DevC++ non contiene la libreria perciò,se non vogliamo installarla, l&#8217;unica soluzione è quella di creare la funzione: #include &#60;windows.h&#62; #include &#60;stdio.h&#62; #include &#60;iostream.h&#62; void gotoxy&#40;int x,int y&#41;&#123; HANDLE HConsole; CONSOLE_SCREEN_BUFFER_INFO ConsoleInfo; HConsole = GetStdHandle&#40;STD_OUTPUT_HANDLE&#41;; ConsoleInfo.dwCursorPosition.X = x; [...]]]></description>
			<content:encoded><![CDATA[<p>Lo scopo della funzione <strong>gotoxy</strong>, presente nella libreria <em>conio.h</em> , è quello di spostare il cursore della console.<br />
DevC++ non contiene la libreria perciò,se non vogliamo installarla, l&#8217;unica soluzione è quella di creare la funzione:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#include &lt;windows.h&gt;</span>
<span style="color: #339933;">#include &lt;stdio.h&gt;</span>
<span style="color: #339933;">#include &lt;iostream.h&gt;</span>
<span style="color: #993333;">void</span> gotoxy<span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> x<span style="color: #339933;">,</span><span style="color: #993333;">int</span> y<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>     
     HANDLE HConsole<span style="color: #339933;">;</span>
     CONSOLE_SCREEN_BUFFER_INFO ConsoleInfo<span style="color: #339933;">;</span>     
     HConsole <span style="color: #339933;">=</span> GetStdHandle<span style="color: #009900;">&#40;</span>STD_OUTPUT_HANDLE<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     ConsoleInfo.<span style="color: #202020;">dwCursorPosition</span>.<span style="color: #202020;">X</span> <span style="color: #339933;">=</span> x<span style="color: #339933;">;</span>
     ConsoleInfo.<span style="color: #202020;">dwCursorPosition</span>.<span style="color: #202020;">Y</span> <span style="color: #339933;">=</span> y<span style="color: #339933;">;</span>     
     SetConsoleCursorPosition<span style="color: #009900;">&#40;</span>HConsole<span style="color: #339933;">,</span>ConsoleInfo.<span style="color: #202020;">dwCursorPosition</span><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>
    gotoxy<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">3</span><span style="color: #339933;">,</span><span style="color: #0000dd;">2</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;IOSMANETTO.it<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    gotoxy<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">3</span><span style="color: #339933;">,</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    system<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;pause&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

<p><strong>HANDLE HConsole;</strong> HANDLE è simile ad un puntatore ma è piu&#8217; complesso.<br/><br />
<strong>CONSOLE_SCREEN_BUFFER_INFO ConsoleInfo;</strong> Dichiariamo ConsoleInfo come struttura CONSOLE_SCREEN_BUFFER_INFO . La struttura contiene informazioni sulla console come la posizione del cursore, il colore del testo e dello sfondo ecc.<br/><br />
<strong>HConsole = GetStdHandle(STD_OUTPUT_HANDLE);</strong> Otteniamo l&#8217;Handle della console<br/><br />
<strong>ConsoleInfo.dwCursorPosition.X = x; ConsoleInfo.dwCursorPosition.Y = y; </strong>  Inseriamo le nuove coordinate<br/><br />
<strong>SetConsoleCursorPosition(HConsole,ConsoleInfo.dwCursorPosition);</strong> <br/>SetConsoleCursorPosition setta la posizione del cursore. Come parametri passiamo l&#8217;handle della console e la nuova posizione. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.iosmanetto.it/cpp/gotoxy-sul-compilatore-devc/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Download di un file VB.NET</title>
		<link>http://www.iosmanetto.it/vbnet/download-di-un-file-vb-net/</link>
		<comments>http://www.iosmanetto.it/vbnet/download-di-un-file-vb-net/#comments</comments>
		<pubDate>Tue, 29 Dec 2009 00:35:32 +0000</pubDate>
		<dc:creator>Gregorio</dc:creator>
				<category><![CDATA[vb.net]]></category>
		<category><![CDATA[funzione]]></category>

		<guid isPermaLink="false">http://www.iosmanetto.it/?p=233</guid>
		<description><![CDATA[Il framework .net della Microsoft ha veramente cambiato il modo di programmare . Prima per realizzare il seguente programma, occorrevano parecchi minuti se non ore . Scaricare un file da internet è davvero semplice. Ecco un esempio : Sub main() Try Dim webC As New Net.WebClient Dim patchFile As String = &#34;http://www.google.it/intl/it_it/images/logo.gif&#34; Dim filename As [...]]]></description>
			<content:encoded><![CDATA[<p>Il <strong>framework .net</strong> della <strong>Microsoft </strong>ha veramente cambiato il modo di programmare .  Prima per realizzare il seguente programma, occorrevano parecchi minuti se non ore .</p>
<p>Scaricare un file da internet è davvero semplice. Ecco un esempio :</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Sub</span> main()
Try
  <span style="color: #000080;">Dim</span> webC <span style="color: #000080;">As</span> <span style="color: #000080;">New</span> Net.WebClient
  <span style="color: #000080;">Dim</span> patchFile <span style="color: #000080;">As</span> <span style="color: #000080;">String</span> = <span style="color: #800000;">&quot;http://www.google.it/intl/it_it/images/logo.gif&quot;</span>
  <span style="color: #000080;">Dim</span> filename <span style="color: #000080;">As</span> <span style="color: #000080;">String</span> = patchFile.Substring(patchFile.LastIndexOf(<span style="color: #800000;">&quot;/&quot;</span>) + 1)
  webC.DownloadFile(patchFile, filename)
Catch ex <span style="color: #000080;">As</span> Exception
  MsgBox(ex)
<span style="color: #000080;">End</span> Try
<span style="color: #000080;">End</span> <span style="color: #000080;">Sub</span></pre></div></div>

<ol>
<li>Sto utilizzando un progetto console di visual studio. Sub Main è la routine principale . Viene invocata all&#8217;inizio del programma</li>
<li>Try..Catch..End Try è un importante costrutto per la gestione degli errori. Se all&#8217;interno di TRY si genera un errore , il programma non viene interrotto , ma viene eseguito il codice all&#8217;interno di CATCH</li>
<li>Instanziamo la classe Net.WebClient nell&#8217;oggetto  <em>WebC</em></li>
<li><em>patchFile</em> è l&#8217;indirizzo del file</li>
<li><em>filename</em> è il nome del file . <em>patchFile.LastIndexOf(&#8220;/&#8221;)</em> restituisce la posizione dell&#8217;ultimo / . Con patchFile.Substring ritagliamo i caratteri che ci servono</li>
<li>DownloadFile è il cuore dello script . Come primo parametro occorre fornire l&#8217;indirizzo http del file. Il secondo parametro è invece l&#8217;indirizzo di destinazione</li>
</ol>
<p>
L&#8217;indirizzo di destinazione puo&#8217; essere anche del tipo &#8220;C:\mydocument\nomefile.tipo&#8221;. Se passiamo solamante il nome del file, come nell&#8217;esempio sopra, il download viene salvato nella cartella bin del progetto (Visual Studio 2008\Projects\nameproject\nameproject\bin)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iosmanetto.it/vbnet/download-di-un-file-vb-net/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Visualizzare il codice html di una pagina web con VB.NET</title>
		<link>http://www.iosmanetto.it/vbnet/visualizzare-il-codice-html-di-una-pagina-web-con-vb-net/</link>
		<comments>http://www.iosmanetto.it/vbnet/visualizzare-il-codice-html-di-una-pagina-web-con-vb-net/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 11:48:43 +0000</pubDate>
		<dc:creator>Gregorio</dc:creator>
				<category><![CDATA[vb.net]]></category>
		<category><![CDATA[funzione]]></category>

		<guid isPermaLink="false">http://www.iosmanetto.it/?p=223</guid>
		<description><![CDATA[Vi segnalo questa interessante funzione. Ci permette di leggere il codice html di una pagina web. Function getHtmlCode(ByVal url As String) As String Dim WebRequest As Net.HttpWebRequest Dim WebResponse As Net.WebResponse Dim stream As IO.Stream Dim streamReader As IO.StreamReader Try WebRequest = Net.WebRequest.Create(url) WebRequest.Timeout = 10000 WebResponse = WebRequest.GetResponse stream = WebResponse .GetResponseStream streamReader = [...]]]></description>
			<content:encoded><![CDATA[<p>Vi segnalo questa interessante funzione. Ci permette di leggere il codice html di una pagina web.</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Function</span> getHtmlCode(<span style="color: #000080;">ByVal</span> url <span style="color: #000080;">As</span> <span style="color: #000080;">String</span>) <span style="color: #000080;">As</span> <span style="color: #000080;">String</span>
<span style="color: #000080;">Dim</span> WebRequest <span style="color: #000080;">As</span> Net.HttpWebRequest
<span style="color: #000080;">Dim</span> WebResponse <span style="color: #000080;">As</span> Net.WebResponse
<span style="color: #000080;">Dim</span> stream <span style="color: #000080;">As</span> IO.Stream
<span style="color: #000080;">Dim</span> streamReader <span style="color: #000080;">As</span> IO.StreamReader
Try
        WebRequest = Net.WebRequest.Create(url)
        WebRequest.Timeout = 10000
        WebResponse = WebRequest.GetResponse
        stream = WebResponse .GetResponseStream
        streamReader = <span style="color: #000080;">New</span> IO.StreamReader(stream)
        Return streamReader.ReadToEnd
Catch ex <span style="color: #000080;">As</span> Exception
            MsgBox(ex.ToString)
<span style="color: #000080;">End</span> Try
<span style="color: #000080;">End</span> <span style="color: #000080;">Function</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.iosmanetto.it/vbnet/visualizzare-il-codice-html-di-una-pagina-web-con-vb-net/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

