<?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>Massimo Zappino</title>
	<atom:link href="http://www.zappino.it/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zappino.it</link>
	<description></description>
	<lastBuildDate>Wed, 01 Feb 2012 10:22:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>KDE Dolphin thumbnail video preview</title>
		<link>http://www.zappino.it/2011/03/kde-dolphin-thumbnail-video-preview/</link>
		<comments>http://www.zappino.it/2011/03/kde-dolphin-thumbnail-video-preview/#comments</comments>
		<pubDate>Mon, 14 Mar 2011 07:27:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[(K)Ubuntu]]></category>
		<category><![CDATA[KDE]]></category>
		<category><![CDATA[mplayerthumbs video preview thumbnail]]></category>

		<guid isPermaLink="false">http://www.zappino.it/?p=319</guid>
		<description><![CDATA[If you want to see the preview of your video in Dolphin on your Kubuntu system you can simply install MPlayerThumbs.
sudo apt-get install mplayerthumbs
]]></description>
			<content:encoded><![CDATA[<p>If you want to see the preview of your video in Dolphin on your Kubuntu system you can simply install <a href="http://kde-apps.org/content/show.php?content=41180">MPlayerThumbs</a>.</p>
<blockquote><p>sudo apt-get install mplayerthumbs</p></blockquote>
<p style="text-align: center;"><a href="http://www.zappino.it/wp-content/uploads/2011/03/mplayerthumbs1.png"><img class="size-medium wp-image-323 aligncenter" title="mplayerthumbs" src="http://www.zappino.it/wp-content/uploads/2011/03/mplayerthumbs1-300x212.png" alt="" width="300" height="212" /></a></p>
<p class="wp-flattr-button"></p> <p><a href="http://www.zappino.it/?flattrss_redirect&amp;id=319&amp;md5=f5b13742193f83cfb6012d13e3b0f930" title="Flattr" target="_blank"><img src="http://www.zappino.it/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.zappino.it/2011/03/kde-dolphin-thumbnail-video-preview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to configure Xdebug on Ubuntu with Zend Server</title>
		<link>http://www.zappino.it/2011/02/how-to-configure-xdebug-on-ubuntu-with-zend-server/</link>
		<comments>http://www.zappino.it/2011/02/how-to-configure-xdebug-on-ubuntu-with-zend-server/#comments</comments>
		<pubDate>Thu, 17 Feb 2011 09:49:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[(K)Ubuntu]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[zendframework netbeans ubuntu xdebug]]></category>

		<guid isPermaLink="false">http://www.zappino.it/?p=292</guid>
		<description><![CDATA[I assume you have properly installed and configured Zend Server CE from the repository.

First of all you need to install automake:
sudo apt-get update &#38;&#38; sudo apt-get upgrade
sudo apt-get install automake
Install Xdebug with PECL as root:
# pecl install xdebug
Note: if you don't have PECL in your path you can prepend the absolute path before the ...]]></description>
			<content:encoded><![CDATA[<p>I assume you have properly <a href="/2010/01/impostare-lambiente-di-sviluppo-per-zend-framework-su-ubuntu/">installed and configured</a> Zend Server CE from the repository.</p>
<p>First of all you need to install automake:</p>
<blockquote><p>sudo apt-get update &amp;&amp; sudo apt-get upgrade<br />
sudo apt-get install automake</p></blockquote>
<p>Install <em>Xdebug</em> with <a href="http://pecl.php.net/">PECL</a> as root:</p>
<blockquote><p># pecl install xdebug</p></blockquote>
<p><strong>Note:</strong> if you don&#8217;t have <em>PECL</em> in your path you can prepend the absolute path before the command</p>
<blockquote><p># /usr/local/zend/bin/pecl install xdebug</p></blockquote>
<p>Now you must edit <em>php.ini</em> file.</p>
<blockquote><p>sudo nano /usr/local/zend/etc/php.ini</p></blockquote>
<p>Add these lines at the end of file:</p>
<blockquote><p>; Xdebug<br />
zend_extension = /usr/local/zend/lib/php_extensions/xdebug.so<br />
xdebug.remote_enable=1<br />
xdebug.remote_handler=dbgp<br />
xdebug.remote_mode=req<br />
xdebug.remote_host=127.0.0.1<br />
xdebug.remote_port=9000</p></blockquote>
<p><strong>Note:</strong> Xdebug is incompatible with the<em>Zend Debugger</em> extension. To disable this component you can log into Zend Server control page at <a href="https://localhost:10082"><em>https://localhost:10082</em></a> and navigate to tab Server Setup &gt; Components then turn off Zend Debugger. Remember to click the <em>Restart PHP</em> button to apply the changes.</p>
<h5>Links:</h5>
<ul>
<li><a href="http://www.xdebug.org/">http://www.xdebug.org</a></li>
<li><a href="http://wiki.netbeans.org/HowToConfigureXDebug">http://wiki.netbeans.org/HowToConfigureXDebug</a></li>
<li><a href="http://devzone.zend.com/article/2803">http://devzone.zend.com/article/2803</a></li>
</ul>
<p class="wp-flattr-button"></p> <p><a href="http://www.zappino.it/?flattrss_redirect&amp;id=292&amp;md5=53cf18e1b31a19e9da0869db67d7f5ba" title="Flattr" target="_blank"><img src="http://www.zappino.it/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.zappino.it/2011/02/how-to-configure-xdebug-on-ubuntu-with-zend-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install KDE 4.6 on Kubuntu</title>
		<link>http://www.zappino.it/2011/02/install-kde-4-6-on-kubuntu/</link>
		<comments>http://www.zappino.it/2011/02/install-kde-4-6-on-kubuntu/#comments</comments>
		<pubDate>Tue, 08 Feb 2011 14:59:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[(K)Ubuntu]]></category>
		<category><![CDATA[KDE]]></category>
		<category><![CDATA[kde kubuntu]]></category>

		<guid isPermaLink="false">http://www.zappino.it/?p=276</guid>
		<description><![CDATA[Kde 4.6 was released on January 26, 2011. If you want to try this new version you can follow this simple steps.

Add backports repository
sudo add-apt-repository ppa:kubuntu-ppa/backports
Update and upgrade the system
sudo apt-get update &#38;&#38; sudo apt-get upgrade
Then
sudo apt-get dist-upgrade
After reboot you can see Kde 4.6 in action.

]]></description>
			<content:encoded><![CDATA[<p>Kde 4.6 was <a title="Kde 4.6 release schedule" href="http://techbase.kde.org/Schedules/KDE4/4.6_Release_Schedule">released</a> on January 26, 2011. If you want to try this new version you can follow this simple steps.</p>
<p>Add backports repository</p>
<pre>sudo add-apt-repository ppa:kubuntu-ppa/backports</pre>
<p>Update and upgrade the system</p>
<pre>sudo apt-get update &amp;&amp; sudo apt-get upgrade</pre>
<p>Then</p>
<pre>sudo apt-get dist-upgrade</pre>
<p>After reboot you can see Kde 4.6 in action.</p>
<p><a href="http://www.zappino.it/wp-content/uploads/2011/02/46-w091.png"><img class="aligncenter size-medium wp-image-278" title="Kde 4.6" src="http://www.zappino.it/wp-content/uploads/2011/02/46-w091-300x187.png" alt="" width="300" height="187" /></a></p>
<p class="wp-flattr-button"></p> <p><a href="http://www.zappino.it/?flattrss_redirect&amp;id=276&amp;md5=7ab940b98ce02396f10b80f92f628dce" title="Flattr" target="_blank"><img src="http://www.zappino.it/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.zappino.it/2011/02/install-kde-4-6-on-kubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Set up a simple VNC server</title>
		<link>http://www.zappino.it/2010/10/set-up-a-simple-vnc-server/</link>
		<comments>http://www.zappino.it/2010/10/set-up-a-simple-vnc-server/#comments</comments>
		<pubDate>Wed, 13 Oct 2010 07:13:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[(K)Ubuntu]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[KDE]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[vnc]]></category>
		<category><![CDATA[x11vnc]]></category>

		<guid isPermaLink="false">http://www.massimozappino.it/?p=260</guid>
		<description><![CDATA[Using built in VNC server for KDE or Gnome I ran into several problems, like screen freeze or lost connection.

If you need a VNC server for your current desktop session in (K)Ubuntu you can use x11vnc.

1. install packages
sudo apt-get install x11vnc
2. set a password
x11vnc -storepasswd
3. start the server
x11vnc -forever -noxdamage -usepw
If you want to ...]]></description>
			<content:encoded><![CDATA[<p>Using built in VNC server for KDE or Gnome I ran into several problems, like screen freeze or lost connection.</p>
<p>If you need a VNC server for your <strong>current</strong> desktop session in (K)Ubuntu you can use <strong><a href="http://www.karlrunge.com/x11vnc/">x11vnc</a></strong>.</p>
<p>1. install packages</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> x11vnc</pre></div></div>

<p>2. set a password</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">x11vnc <span style="color: #660033;">-storepasswd</span></pre></div></div>

<p>3. start the server</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">x11vnc <span style="color: #660033;">-forever</span> <span style="color: #660033;">-noxdamage</span> <span style="color: #660033;">-usepw</span></pre></div></div>

<p>If you want to access your desktop via browser using a java applet you have to installa vnc-java package and use this commans:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> vnc-java
x11vnc <span style="color: #660033;">-forever</span> <span style="color: #660033;">-noxdamage</span> <span style="color: #660033;">-usepw</span> <span style="color: #660033;">-httpdir</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>vnc-java<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">-httpport</span> <span style="color: #000000;">5800</span></pre></div></div>

<p class="wp-flattr-button"></p> <p><a href="http://www.zappino.it/?flattrss_redirect&amp;id=260&amp;md5=2e4c04a887667dc11dfcd0d9fcaaefb5" title="Flattr" target="_blank"><img src="http://www.zappino.it/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.zappino.it/2010/10/set-up-a-simple-vnc-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Call-time pass-by-reference has been deprecated</title>
		<link>http://www.zappino.it/2010/02/call-time-pass-by-reference-has-been-deprecated/</link>
		<comments>http://www.zappino.it/2010/02/call-time-pass-by-reference-has-been-deprecated/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 13:29:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[deprecated]]></category>
		<category><![CDATA[reference]]></category>

		<guid isPermaLink="false">http://www.massimozappino.it/?p=248</guid>
		<description><![CDATA[If you recently upgraded PHP to version 5.3.0 or higher, you have probably encountered a message like this:

Deprecated: Call-time pass-by-reference has been deprecated in filename.php


Use &#38; when you call a function foo(&#38;$var) generates the warning message.

Remember that in 5.3 version of PHP only Call-time pass by reference is deprecated but not Passing by reference.

See ...]]></description>
			<content:encoded><![CDATA[<p>If you recently upgraded <a href="http://php.net/">PHP</a> to version 5.3.0 or higher, you have probably encountered a message like this:</p>
<p><strong><em>Deprecated: Call-time pass-by-reference has been deprecated in filename.php<br />
</em></strong></p>
<p>Use <strong><em>&amp;</em></strong> when you call a function <em>foo(&amp;$var)</em> generates the warning message.</p>
<p>Remember that in 5.3 version of PHP only <strong><em>Call-time pass by reference</em></strong> is deprecated but not <strong><em>Passing by reference</em>.</strong></p>
<p>See the example below:</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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// normal passing by reference</span>
<span style="color: #000000; font-weight: bold;">function</span> functionA<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$var</span><span style="color: #339933;">++;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// call-time passing by reference</span>
<span style="color: #000000; font-weight: bold;">function</span> functionB<span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$var</span><span style="color: #339933;">++;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// correct call</span>
functionA<span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// deprecated</span>
functionB<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>If you can&#8217;t edit existing code, for example, third-party software, you can use these work-arounds:</p>
<ol>
<li><strong>Turn off error messages</strong>: is always a good idea hide any type of error message in a <em>production site</em>. You can use <a href="http://www.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting">error_reporting(0)</a> function or if you want you can use the @ symbol before any statement. This is not a good solution of this problem.</li>
<li><strong>Allow call-time pass-by-reference in your php.ini file</strong>: in your php.ini file you can set <em>allow_call_time_pass_reference = on</em> but this is a temporary solution only until the next version.</li>
</ol>
<p><strong>Resources:</strong></p>
<ul>
<li><a href="http://it.php.net/language.references.pass">http://it.php.net/language.references.pass</a></li>
</ul>
<p class="wp-flattr-button"></p> <p><a href="http://www.zappino.it/?flattrss_redirect&amp;id=248&amp;md5=e982860cbf015a29102577fc2e26cd9f" title="Flattr" target="_blank"><img src="http://www.zappino.it/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.zappino.it/2010/02/call-time-pass-by-reference-has-been-deprecated/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UTF-8 problem with Spreadsheet Excel Writer</title>
		<link>http://www.zappino.it/2010/01/utf-8-problem-with-spreadsheet-excel-writer/</link>
		<comments>http://www.zappino.it/2010/01/utf-8-problem-with-spreadsheet-excel-writer/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 15:57:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[spreadsheet]]></category>
		<category><![CDATA[utf8]]></category>

		<guid isPermaLink="false">http://www.massimozappino.it/?p=239</guid>
		<description><![CDATA[Spreadsheet Excel Writer is a PEAR package that allows you to generate Excel documents.

When we try to generate an new Excel document using UTF-8 string we ran into a display error.

There is a simple way to fix this problem. See the example below:
$workbook = new Spreadsheet_Excel_Writer();
$workbook-&#62;send("file.xls");

// add this row
$workbook-&#62;setVersion(8);

$worksheet =&#38; $workbook-&#62;addWorksheet("My worksheet");

// add this ...]]></description>
			<content:encoded><![CDATA[<p><a href="http://pear.php.net/package/Spreadsheet_Excel_Writer">Spreadsheet Excel Writer</a> is a <a href="http://pear.php.net">PEAR</a> package that allows you to generate Excel documents.</p>
<p>When we try to generate an new Excel document using <strong>UTF-8</strong> string we ran into a display error.</p>
<p>There is a simple way to fix this problem. See the example below:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$workbook</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Spreadsheet_Excel_Writer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$workbook</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">send</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;file.xls&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// add this row</span>
<span style="color: #000088;">$workbook</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setVersion</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">8</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$worksheet</span> <span style="color: #339933;">=&amp;</span> <span style="color: #000088;">$workbook</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addWorksheet</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;My worksheet&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// add this row</span>
<span style="color: #000088;">$worksheet</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setInputEncoding</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$workbook</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p class="wp-flattr-button"></p> <p><a href="http://www.zappino.it/?flattrss_redirect&amp;id=239&amp;md5=fac749372a4186994d46de6383973212" title="Flattr" target="_blank"><img src="http://www.zappino.it/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.zappino.it/2010/01/utf-8-problem-with-spreadsheet-excel-writer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create a PHP data structure accessible like an array and an object simultaneously</title>
		<link>http://www.zappino.it/2010/01/create-a-php-data-structure-accessible-like-an-array-and-an-object-simultaneously/</link>
		<comments>http://www.zappino.it/2010/01/create-a-php-data-structure-accessible-like-an-array-and-an-object-simultaneously/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 08:58:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[object]]></category>

		<guid isPermaLink="false">http://www.massimozappino.it/?p=222</guid>
		<description><![CDATA[Often we need to operate with objects that sometimes we have to use as an array.
For example we can get an attribute from an object:
$attr = $myObject-&#62;attr;
or by array access from the same object
$attr = $myObject;
We can set data simply like an array or directly.

]]></description>
			<content:encoded><![CDATA[<p>Often we need to operate with objects that sometimes we have to use as an array.<br />
For example we can get an attribute from an object:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$attr</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$myObject</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">attr</span><span style="color: #339933;">;</span></pre></div></div>

<p>or by array access from the same object</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$attr</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$myObject</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'attr'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></pre></div></div>

<p>We can set data simply like an array or directly.</p>
<p><iframe src="http://tagmycode.com/embed/iframe/2" style="border:none;width:100%;height:100%;;" scrolling="none"></iframe></p>
<p class="wp-flattr-button"></p> <p><a href="http://www.zappino.it/?flattrss_redirect&amp;id=222&amp;md5=ce1fa373c56fa3859684be0a2789f421" title="Flattr" target="_blank"><img src="http://www.zappino.it/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.zappino.it/2010/01/create-a-php-data-structure-accessible-like-an-array-and-an-object-simultaneously/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Impostare l&#8217;ambiente di sviluppo per Zend Framework su Ubuntu</title>
		<link>http://www.zappino.it/2010/01/impostare-lambiente-di-sviluppo-per-zend-framework-su-ubuntu/</link>
		<comments>http://www.zappino.it/2010/01/impostare-lambiente-di-sviluppo-per-zend-framework-su-ubuntu/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 15:34:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[(K)Ubuntu]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[netbeans]]></category>
		<category><![CDATA[zend server]]></category>

		<guid isPermaLink="false">http://www.massimozappino.it/?p=166</guid>
		<description><![CDATA[Se vogliamo iniziare a conoscere il fantastico mondo di Zend Framework sarà necessario creare un ambiente di sviluppo adatto alle nostre esigenze. In questa guida vedremo come configurare la nostra distribuzione Ubuntu per poter lavorare in locale con tutti gli strumenti necessari.

Lo scopo di questo tutorial è quello di ottenere un sistema di sviluppo ...]]></description>
			<content:encoded><![CDATA[<p>Se vogliamo iniziare a conoscere il fantastico mondo di Zend Framework sarà necessario creare un ambiente di sviluppo adatto alle nostre esigenze. In questa guida vedremo come configurare la nostra distribuzione Ubuntu per poter lavorare in locale con tutti gli strumenti necessari.</p>
<p>Lo scopo di questo tutorial è quello di ottenere un sistema di sviluppo per Zend Framework</p>
<h4>Configurazione del sistema operativo</h4>
<p>Quello che noi vogliamo ottenere è un server <a href="http://it.wikipedia.org/wiki/LAMP_%28piattaforma%29">LAMP</a> configurato ah hoc per le nostre applicazioni web. Per prima cosa installiamo MySQL:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> mysql-server mysql-client</pre></div></div>

<p>Se vogliamo rendere accessibile il server MySQL dall&#8217;esterno dobbiamo modificare il file <em>/etc/mysql/my.conf</em></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">nano</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>my.conf</pre></div></div>

<p>e commentare la linea</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#bind 127.0.0.1</span></pre></div></div>

<p>Questa configurazione del sistema utilizzerà <a href="http://www.zend.com/en/products/server-ce/">Zend Server CE</a> che comprende la propria versione di PHP e le librerie vere e proprie di <em>Zend Framework</em>. Fortunatamente <em>Zend</em> ha messo ha disposizione i repository contenenti tutti i pacchetti per le varie distribuzioni di Linux tra cui Debian/Ubuntu. Seguiamo quindi le <a href="http://files.zend.com/help/Zend-Server-Community-Edition/zend-server-community-edition.htm#deb_installation.htm">indicazioni fornite</a> aggiungiamo il nostro repository al file <em>/etc/apt/source.list</em>.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">deb http:<span style="color: #000000; font-weight: bold;">//</span>repos.zend.com<span style="color: #000000; font-weight: bold;">/</span>zend-server<span style="color: #000000; font-weight: bold;">/</span>deb server non-free</pre></div></div>

<p><span id="more-166"></span>Recuperiamo la chiave pubblica del repository e aggiorniamo la lista dei pacchetti:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #660033;">-i</span>
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>repos.zend.com<span style="color: #000000; font-weight: bold;">/</span>deb<span style="color: #000000; font-weight: bold;">/</span>zend.key <span style="color: #660033;">-O-</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">apt-key</span> add -
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> update</pre></div></div>

<p>Possiamo ora scegliere di installare la versione 5.2 o 5.3 di PHP, procediamo con la versione 5.3.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> zend-server-ce-php-<span style="color: #000000;">5.3</span> zend-server-framework-extras</pre></div></div>

<p>Se tutto è andato a buon fine possiamo accedere al pannello di controllo di <em>Zend Studio</em> aprendo la pagina https://localhost:10082 (SSL) o http://localhost:10081 e impostiamo la nostra password di accesso.</p>
<p>Notiamo subito che il pannello di Zend Studio offre la possibilità di modificare facilmente le direttive di PHP. Modifichiamo subito la direttiva<strong><em> date.timezone</em></strong> da <em>Server setup &gt; Directives</em> e impostiamo il valore <em>UTC.</em></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">date.timezone = UTC</pre></div></div>

<h4>Configurazione server web</h4>
<p>Ora accedendo alla pagina <em>http://localhost</em> dovremmo essere in grado di vedere la pagina di benvenuto di Apache.<br />
Ipotizziamo di voler iniziare a creare la nostra prima applicazione web chiamata<strong> myapp</strong>. Sarebbe sufficiente accedere a localhost e lasciare un unico hostname, ma nel caso di più applicazioni ci troveremmo con qualche difficoltà. Utilizzeremo quindi gli efficienti <a href="http://httpd.apache.org/docs/2.2/vhosts/">Virtual Hosts</a> di Apache.</p>
<p>Modifichiamo il file <em>/etc/hosts</em> e aggiungiamo il nome <strong><em>myapp.local</em></strong> accanto all&#8217;indirizzo IP 127.0.0.1 in modo che il nostro sistema possa convertire l&#8217;hostname <em>myapp.local</em> con il rispettivo IP:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">127.0.0.1       localhost       myapp.local</pre></div></div>

<p>A questo punto creiamo il virtual host su Apache, apriamo un nuovo file myapp.local</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">nano</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>sites-available<span style="color: #000000; font-weight: bold;">/</span>myapp.local</pre></div></div>

<p>e incolliamo questi parametri:</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;">&lt;<span style="color: #000000; font-weight:bold;">virtualHost</span> _default_:<span style="color: #ff0000;">80</span>&gt;
<span style="color: #00007f;">ServerAdmin</span> webmaster@localhost
<span style="color: #00007f;">ServerName</span> myapp.local
<span style="color: #00007f;">DocumentRoot</span> /home/<span style="color: #00007f;">user</span>/projects/myapp/public
&nbsp;
&lt;<span style="color: #000000; font-weight:bold;">directory</span> <span style="color: #7f007f;">&quot;/home/user/projects/myapp/public&quot;</span>&gt;
<span style="color: #00007f;">Order</span> <span style="color: #00007f;">Deny</span>,<span style="color: #00007f;">Allow</span>
<span style="color: #00007f;">Allow</span> <span style="color: #00007f;">from</span> <span style="color: #00007f;">all</span>
<span style="color: #00007f;">Options</span> -<span style="color: #0000ff;">Indexes</span>
&lt;/<span style="color: #000000; font-weight:bold;">directory</span>&gt;
&nbsp;
<span style="color: #00007f;">ErrorLog</span> /var/log/apache2/error_myapp.log
<span style="color: #00007f;">LogLevel</span> warn
<span style="color: #00007f;">CustomLog</span> /var/log/apache2/access_myapp.log combined
<span style="color: #00007f;">ServerSignature</span> <span style="color: #0000ff;">On</span>
&lt;/<span style="color: #000000; font-weight:bold;">virtualHost</span>&gt;</pre></div></div>

<p>Potete subito notare che la DocumentRoot è <strong>/home/user/projects/myapp/public</strong>. In questo caso i file di progetto saranno posti all&#8217;interno della directory <em>/home/user/projects/myapp</em> e la directory visibile è <strong>public</strong>.<br />
Non ci resta ora che abilitare il nostro virtual host e riavviare la rete con i seguenti comandi.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> a2ensite myapp.local
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>networking restart</pre></div></div>

<p>Se in questo momento proviamo ad accedere alla pagina <a href="http://myapp.local">http://myapp.local</a> dovremmo ottenere un errore di <em>apache</em> perché non è stata trovata ancora nessun file.</p>
<h4>Configurazione IDE</h4>
<p><em>Zend</em> rilascia un proprio IDE denominato <a href="http://www.zend.com/products/studio/">Zend Studio</a>, basato su <a href="http://www.eclipse.org/">Eclipse</a> sviluppato unicamente allo scopo di progettare applicazioni web con Zend Framework. Personalmente preferisco utilizzare <a href="http://netbeans.org/">NetBeans</a> che si presta bene al nostro scopo. Possiamo quindi installare NetBeans dai repository di Ubuntu oppure direttamente scaricando il pacchetto fornito dal <a href="http://netbeans.org/downloads/index.html">sito ufficiale</a>. Nel primo caso sarà sufficiente lanciare il comando</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> netbeans</pre></div></div>

<p>. Preferisco senza dubbi installare NetBeans manualmente per due motivi: è più aggiornato ed è possibile scegliere di installare solo la versione per PHP (circa 25 MB).<br />
Scarichiamo il file <strong>netbeans-6.8-ml-php-linux.sh</strong>, rendiamolo eseguibile e lanciamolo come root:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chmod</span> +x netbeans-<span style="color: #000000;">6.8</span>-ml-php-linux.sh
<span style="color: #c20cb9; font-weight: bold;">sudo</span> .<span style="color: #000000; font-weight: bold;">/</span>netbeans-<span style="color: #000000;">6.8</span>-ml-php-linux.sh</pre></div></div>

<p>apparirà una procedura guidata che vi assisterà nell&#8217;installazione, non è necessario modificare nessun parametro.</p>
<p>Creiamo la directory  dei nostri progetti</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> ~<span style="color: #000000; font-weight: bold;">/</span>projects</pre></div></div>

<p>Dal nostro menu delle applicazioni oppure direttamente da linea di comando (netbeans) eseguiamo NetBeans. Selezioniamo <strong>New Project&#8230;</strong> dal menu<strong> File</strong>, scegliamo <strong>PHP</strong> e <strong>PHP Application</strong>, clicchiamo su <strong>Next</strong>. Diamo il nome al nostro progetto e nella casella <em>Project Name</em> e scriviamo <strong><em>myapp</em></strong> e in <em>Sources Folder</em> indichiamo il path /<em><strong>home/user/projects/myapp</strong></em> così com&#8217;era precedentemente specificato nel virtual host di apache, clicchiamo ancora su <strong>Next</strong>, lasciamo invariati i campi e siamo pronti a partire con lo sviluppo.</p>
<p>Possiamo scaricare l&#8217;esempio di progetto dalla guida ufficiale <a href="http://framework.zend.com/docs/quickstart">Zend Framework Quick Start</a> e scompattarlo nella nostra directory di progetto appena creata e vederlo in azione  alla pagina <a href="http://myapp.local/">http://myapp.local</a>.</p>
<p class="wp-flattr-button"></p> <p><a href="http://www.zappino.it/?flattrss_redirect&amp;id=166&amp;md5=e69277dc246d416cdab8324262d79fc2" title="Flattr" target="_blank"><img src="http://www.zappino.it/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.zappino.it/2010/01/impostare-lambiente-di-sviluppo-per-zend-framework-su-ubuntu/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Creare la struttura di un menu con Zend Navigation</title>
		<link>http://www.zappino.it/2010/01/creare-la-struttura-di-un-menu-con-zend-navigation/</link>
		<comments>http://www.zappino.it/2010/01/creare-la-struttura-di-un-menu-con-zend-navigation/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 15:47:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[zend navigation]]></category>

		<guid isPermaLink="false">http://www.massimozappino.it/?p=190</guid>
		<description><![CDATA[La gestione di un menu e delle relative pagine è molto semplice grazie alla classe Zend Navigation.
Il manuale di Zend Framework spiega molto bene come utilizzare questo componente. In breve il principio di funzionamento consiste nel creare oggetti pagina (Zend_Navigation_Page) che a loro volta possono contenere altre pagine. Questa struttura dati verrà poi data ...]]></description>
			<content:encoded><![CDATA[<p>La gestione di un menu e delle relative pagine è molto semplice grazie alla classe <a href="http://framework.zend.com/manual/en/zend.navigation.html">Zend Navigation</a>.<br />
Il manuale di <em>Zend Framework</em> spiega molto bene come utilizzare questo componente. In breve il principio di funzionamento consiste nel creare oggetti <strong>pagina</strong> (<em>Zend_Navigation_Page</em>) che a loro volta possono contenere altre pagine. Questa struttura dati verrà poi data in pasto alla classe <em>Zend_Navigation</em> che si occuperà di mettere a disposizione tutti i metodi necessari per la gestione del menu.</p>
<p>Possiamo creare un metodo privato all&#8217;interno del nostro <em>Bootstrap</em> per inizializzare il menu e renderlo disponibile agli <a><em><a href="http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial.navigation">helper</a> </em></a>nella <em>view</em>.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">protected <span style="color: #000000; font-weight: bold;">function</span> _initNavigation<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">bootstrap</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'layout'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$layout</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getResource</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'layout'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$view</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$layout</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getView</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// create pages</span>
        <span style="color: #000088;">$pages</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
                <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
                        <span style="color: #0000ff;">'label'</span>         <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Home'</span><span style="color: #339933;">,</span>
                        <span style="color: #0000ff;">'module'</span>        <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'default'</span><span style="color: #339933;">,</span>
                        <span style="color: #0000ff;">'controller'</span>    <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'index'</span><span style="color: #339933;">,</span>
                        <span style="color: #0000ff;">'action'</span>        <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'index'</span><span style="color: #339933;">,</span>
                        <span style="color: #0000ff;">'order'</span>         <span style="color: #339933;">=&gt;</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">100</span> <span style="color: #666666; font-style: italic;">// first page</span>
                <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
                <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
                        <span style="color: #0000ff;">'label'</span>         <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Posts'</span><span style="color: #339933;">,</span>
                        <span style="color: #0000ff;">'module'</span>        <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'default'</span><span style="color: #339933;">,</span>
                        <span style="color: #0000ff;">'controller'</span>    <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'posts'</span><span style="color: #339933;">,</span>
                        <span style="color: #0000ff;">'action'</span>        <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'index'</span><span style="color: #339933;">,</span>
                        <span style="color: #0000ff;">'visible'</span>       <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span>
                        <span style="color: #0000ff;">'pages'</span>         <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
                                <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
                                        <span style="color: #0000ff;">'label'</span>         <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Add'</span><span style="color: #339933;">,</span>
                                        <span style="color: #0000ff;">'module'</span>        <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'default'</span><span style="color: #339933;">,</span>
                                        <span style="color: #0000ff;">'controller'</span>    <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'posts'</span><span style="color: #339933;">,</span>
                                        <span style="color: #0000ff;">'action'</span>        <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'add'</span>
                                <span style="color: #009900;">&#41;</span>
                        <span style="color: #009900;">&#41;</span>
                <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
                <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
                        <span style="color: #0000ff;">'label'</span>      <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Administration'</span><span style="color: #339933;">,</span>
                        <span style="color: #0000ff;">'module'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'admin'</span><span style="color: #339933;">,</span>
                        <span style="color: #0000ff;">'controller'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'index'</span><span style="color: #339933;">,</span>
                        <span style="color: #0000ff;">'action'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'index'</span><span style="color: #339933;">,</span>
                        <span style="color: #0000ff;">'resource'</span>   <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'mvc:admin'</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// resource</span>
                <span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// create container from array</span>
        <span style="color: #000088;">$navigation</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Zend_Navigation<span style="color: #009900;">&#40;</span><span style="color: #000088;">$pages</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        Zend_Registry<span style="color: #339933;">::</span><span style="color: #004000;">set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Zend_Navigation'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$navigation</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$view</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">navigation</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$navigation</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

<p class="wp-flattr-button"></p> <p><a href="http://www.zappino.it/?flattrss_redirect&amp;id=190&amp;md5=fc768b6a41b6cecd74c3b833f6448d63" title="Flattr" target="_blank"><img src="http://www.zappino.it/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.zappino.it/2010/01/creare-la-struttura-di-un-menu-con-zend-navigation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tunnel SSH</title>
		<link>http://www.zappino.it/2010/01/tunnel-ssh/</link>
		<comments>http://www.zappino.it/2010/01/tunnel-ssh/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 09:06:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[socket]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[tunnel]]></category>

		<guid isPermaLink="false">http://www.massimozappino.it/?p=182</guid>
		<description><![CDATA[L'idea di poter creare un canale virtuale cifrato tra due computer remoti attraverso internet  permette di scambiare dati in modo sicuro e apre le porte a numerose applicazioni.

Immaginiamo di dover accedere alla nostra rete privata di casa senza l'uso di VPN da una postazione esterna alla LAN.



Chiameremo server il pc di casa che accetta ...]]></description>
			<content:encoded><![CDATA[<p>L&#8217;idea di poter creare un <a href="http://it.wikipedia.org/wiki/Tunneling">canale virtuale cifrato</a> tra due computer remoti attraverso internet  permette di scambiare dati in modo sicuro e apre le porte a numerose applicazioni.</p>
<p>Immaginiamo di dover accedere alla nostra rete privata di casa senza l&#8217;uso di <a href="http://it.wikipedia.org/wiki/Virtual_Private_Network">VPN</a> da una postazione esterna alla LAN.</p>
<p><a href="http://massimozappino.com/wp-content/uploads/2010/01/tunnel1-541.gif"><img class="aligncenter size-medium wp-image-183" title="Tunneling" src="http://www.massimozappino.it/wp-content/uploads/2010/01/tunnel1-54-300x84.gif" alt="" width="300" height="84" /></a></p>
<p>Chiameremo <em><strong>server</strong></em> il pc di casa che accetta la connessione dall&#8217;esterno sulla porta 22 e <strong><em>client</em></strong> il pc remoto dal quale vogliamo connetterci. Per creare il nostro tunnell SSH non dobbiamo far altro che lanciare il seguente comando dal <em>client</em>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #660033;">-N</span> <span style="color: #660033;">-D</span> <span style="color: #000000;">9999</span> user<span style="color: #000000; font-weight: bold;">@</span>server.mydomain.com</pre></div></div>

<p>Verrà creato un <a href="ssh -N -D 9999 max@pegaso.selfip.com">socket</a> tra client e server, l&#8217;opzione <em>-N</em> impedisce che vengano eseguiti comandi remoti mentre l&#8217;opzione <em>-D</em> 9999 specifica che vogliamo creare un socket sulla porta 9999 del client. A questo punto abbiamo un canale collegato direttamente al nostro server accessibile dal nostro browser. Per poter navigare come se fossimo sul <em>server</em> è necessario configurare firefox in modo che utilizzi il socket. Abbiamo due opzioni, una consiste nel modificare le preferenze direttamente nel browser, la seconda consiste nell&#8217;installare l&#8217;estensione <a href="http://foxyproxy.mozdev.org/">Foxy Proxy</a>. Quest&#8217;ultimo è comodo per facilitare il passaggio tra navigazione diretta e navigazione tramite socket. Nel primo caso andiamo nelle preferenze di Firefox, selezioniamo la tab Avanzate, poi la tab Rete e clicchiamo su Impostazioni di rete, selezioniamo quindi la voce &#8220;<em>Configurazione manuale del proxy</em>&#8220;. Scriviamo <strong><em>localhost</em></strong> nella casella Proxy HTTP e <strong><em>9999</em></strong> nella casella Porta.<span id="more-182"></span></p>
<p>In questo modo possiamo <a href="http://www.ip-adress.com/">notare</a> che l&#8217;IP con cui stiamo navigando non è più quello del <strong><em>client</em></strong> ma finalmente quello del <strong><em>server</em></strong>. Possiamo quindi accedere a tutta la nostra rete LAN come se fossimo davanti al <strong><em>server</em></strong> e con questa modalità possiamo accedere anche alla configurazione del router (per esempio accedendo direttamente all&#8217;indirizzo http://192.168.1.1) o a tutte le porte chiuse all&#8217;esterno.</p>
<p>Un&#8217;altra modalità di tunneling molto utile è quella che permette di aprire una connessione tra il <em><strong>client</strong></em> e il <em><strong>server</strong></em> su una determinata porta in modo da avere sulla macchina locale una porta connessa tramite tunnel direttamente a un&#8217;altra porta remota. Questa pratica è utile nel caso in cui il <strong><em>client</em></strong> si trovi all&#8217;interno di una rete aziendale con restrizioni e vogliamo connetterci a servizi bloccati per esempio (Windows Messenger, Skype, ICQ, ecc.). Il comando è simile al precedente:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #660033;">-L</span> <span style="color: #000000;">9999</span>:servizio.com:<span style="color: #000000;">80</span> user<span style="color: #000000; font-weight: bold;">@</span>mysshremote.server.com</pre></div></div>

<p>Spiaghiamo brevemente le opzioni del comando.</p>
<ul>
<li><strong>-L 9999</strong> indica che vogliamo aprire il bind sulla porta locale <strong>9999 </strong>del <em><strong>client</strong></em>.</li>
<li><strong>servizio.com:80</strong> è l&#8217;indirizzo del servizio al quale vogliamo accedere.</li>
<li><strong>user@mysshremote.server.com</strong> è il nostro <em><strong>server</strong></em> remoto al quale abbiamo accesso ssh tramite l&#8217;utente <strong>user</strong>.</li>
</ul>
<p>Ecco un esempio che ci illustra come aprire il servizio Windows Messenger sulla nostra porta locale 2000:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #660033;">-L</span> <span style="color: #000000;">2000</span>:messenger.hotmail.com:<span style="color: #000000;">1863</span> user<span style="color: #000000; font-weight: bold;">@</span>mysshremote.server.com</pre></div></div>

<p class="wp-flattr-button"></p> <p><a href="http://www.zappino.it/?flattrss_redirect&amp;id=182&amp;md5=3e1d79299ee295c2abbc694b64a76c00" title="Flattr" target="_blank"><img src="http://www.zappino.it/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.zappino.it/2010/01/tunnel-ssh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

