<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><!-- generator="wordpress/2.3.2" --><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Repository</title>
	<link>http://celoria.netsons.org/wordpress</link>
	<description>evviva il copia e incolla :)</description>
	<pubDate>Wed, 21 May 2008 16:09:05 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.2</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/netsons/IOcj" type="application/rss+xml" /><feedburner:browserFriendly></feedburner:browserFriendly><item>
		<title>Change root password of Muse X-Duo Raid Thermaltake</title>
		<link>http://celoria.netsons.org/wordpress/?p=131</link>
		<comments>http://celoria.netsons.org/wordpress/?p=131#comments</comments>
		<pubDate>Mon, 31 Mar 2008 11:37:12 +0000</pubDate>
		<dc:creator>Paolo Celoria</dc:creator>
		
		<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">http://celoria.netsons.org/wordpress/?p=131</guid>
		<description><![CDATA[Firmware 1.7.1
Thermaltake not provides root password for this NAS.
It is possible to change it.
You need to change /etc/passwd file where passwords (encrypted) are stored.
Download Sancho to control Mldonkey server. Install it.
Go to your admin interface of NAS. Login as admin. Go to section Advanced and start your DownaloadStation (mldonkey).
Now run Sancho to connect to mldonkey [...]]]></description>
			<content:encoded><![CDATA[<p>Firmware 1.7.1</p>
<p>Thermaltake not provides root password for this NAS.<br />
It is possible to change it.</p>
<p>You need to change /etc/passwd file where passwords (encrypted) are stored.</p>
<p><a href="http://sancho-gui.sourceforge.net/" title="sancho" target="_blank">Download Sancho</a> to control Mldonkey server. Install it.<br />
Go to your admin interface of NAS. Login as admin. Go to section Advanced and start your DownaloadStation (mldonkey).</p>
<p>Now run Sancho to connect to mldonkey server. Put ip of your NAS and admin password.<br />
On Sancho search for a button named Console. Click it and now you can send commands to server with the last one row at bottom.<br />
Mldonkey run as root ad you can lunch commands as a shell.<br />
Unlikely if you write &#8220;passwd&#8221; you can&#8217;t change root password because the console not support remote prompt.<br />
But you can run che command &#8220;/bin/chmod 777 /etc/passwd&#8221;. So anyone can write on password file.</p>
<p>Now you need an access thru telnet or ssh.<br />
On Sancho, write the command &#8220;/bin/chsh -s /bin/bash admin.<br />
Now open your putty or a Prompt-command and write &#8220;telnet 192.168.X.Y&#8221; (192.168.X.Y is ip of your NAS).<br />
Enter admin as login and your password.<br />
You are in.</p>
<p>Now you can run &#8220;vi /etc/passwd&#8221;.<br />
first line is similar to:<br />
<tt><font size="-1">root:75hv0xCjznz1U</font></tt><tt><font size="-1">75hv0xCjznz1U</font></tt><tt><font size="-1">:500:600,700,701,702:&#8230;..</font></tt></p>
<p>and other lines, one is similar to<br />
<tt><font size="-1">admin:7asd5hasdv0xCjznz1U</font></tt><tt><font size="-1">75hv0xCjznz1U</font></tt><tt><font size="-1">:500:600,700,701,702:&#8230;..</font></tt></p>
<p>copy the string of the second field (separated from &#8220;:&#8221;) (es:<tt><font size="-1">7asd5hasdv0xCjznz1U</font></tt><tt><font size="-1">75hv0xCjznz1U</font></tt>) in the second field of the&#8221;root line&#8221;.</p>
<p>Example:<br />
<tt><font size="-1">root:7asd5hasdv0xCjznz1U</font></tt><tt><font size="-1">75hv0xCjznz1U</font></tt><tt><font size="-1">:500:600,700,701,702:&#8230;..</font></tt></p>
<p>So your root password is the same of admin password.<br />
Save /etc/passwd and now you know root password.</p>
<p>If you prefer you can login as root and run passwd to change root password.<br />
Reset permissions of /etc/passwd file with &#8220;/bin/chmod 755 /etc/passwd&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://celoria.netsons.org/wordpress/?feed=rss2&amp;p=131</wfw:commentRss>
		</item>
		<item>
		<title>Richiesta conferma nell’invio di una form</title>
		<link>http://celoria.netsons.org/wordpress/?p=130</link>
		<comments>http://celoria.netsons.org/wordpress/?p=130#comments</comments>
		<pubDate>Thu, 24 Jan 2008 12:51:33 +0000</pubDate>
		<dc:creator>Paolo Celoria</dc:creator>
		
		<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">http://celoria.netsons.org/wordpress/?p=130</guid>
		<description><![CDATA[
function confirmSubmit() {
var agree=confirm(&#34;Confermi ?&#34;);
if (agree)
return true ;
else
return false ;
}


&#60;form action=&#34;&#34; onsubmit=&#34;return confirmSubmit()&#34;&#62;...

]]></description>
			<content:encoded><![CDATA[<pre class="syntax-highlight:javascript">
function confirmSubmit() {
var agree=confirm(&quot;Confermi ?&quot;);
if (agree)
return true ;
else
return false ;
}
</pre>
<pre class="syntax-highlight:html">
&lt;form action=&quot;&quot; onsubmit=&quot;return confirmSubmit()&quot;&gt;...
</pre>
]]></content:encoded>
			<wfw:commentRss>http://celoria.netsons.org/wordpress/?feed=rss2&amp;p=130</wfw:commentRss>
		</item>
		<item>
		<title>Troncare una stringa dopo ‘tot’ parole</title>
		<link>http://celoria.netsons.org/wordpress/?p=129</link>
		<comments>http://celoria.netsons.org/wordpress/?p=129#comments</comments>
		<pubDate>Thu, 24 Jan 2008 12:36:21 +0000</pubDate>
		<dc:creator>Paolo Celoria</dc:creator>
		
		<category><![CDATA[Php]]></category>

		<category><![CDATA[trunc string]]></category>

		<guid isPermaLink="false">http://celoria.netsons.org/wordpress/?p=129</guid>
		<description><![CDATA[In sostituzione del testo elimnato è possible inserire $terminal_string. Per esempio potrebbe essere un &#8216;[..]&#8217; per far capire che il testo contina.

function trunc($phrase, $max_words, $terminal_string){
       $phrase_array = explode(' ',$phrase);
       if(count($phrase_array) &#62; $max_words &#38;&#38; $max_words &#62; 0)
        [...]]]></description>
			<content:encoded><![CDATA[<p>In sostituzione del testo elimnato è possible inserire $terminal_string. Per esempio potrebbe essere un &#8216;[..]&#8217; per far capire che il testo contina.</p>
<pre class="syntax-highlight:php">
function trunc($phrase, $max_words, $terminal_string){
       $phrase_array = explode(' ',$phrase);
       if(count($phrase_array) &gt; $max_words &amp;&amp; $max_words &gt; 0)
          $phrase = implode(' ',array_slice($phrase_array, 0, $max_words)) . $terminal_string;
       return $phrase;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://celoria.netsons.org/wordpress/?feed=rss2&amp;p=129</wfw:commentRss>
		</item>
		<item>
		<title>Conoscere l’estensione dal nome di un file</title>
		<link>http://celoria.netsons.org/wordpress/?p=128</link>
		<comments>http://celoria.netsons.org/wordpress/?p=128#comments</comments>
		<pubDate>Thu, 24 Jan 2008 12:33:27 +0000</pubDate>
		<dc:creator>Paolo Celoria</dc:creator>
		
		<category><![CDATA[Php]]></category>

		<category><![CDATA[file]]></category>

		<guid isPermaLink="false">http://celoria.netsons.org/wordpress/?p=128</guid>
		<description><![CDATA[
function getExtension($file){
        $dots = explode(&#34;.&#34;, $file);
        return strtolower($dots[count($dots)-1]);
}

]]></description>
			<content:encoded><![CDATA[<pre class="syntax-highlight:php">
function getExtension($file){
        $dots = explode(&quot;.&quot;, $file);
        return strtolower($dots[count($dots)-1]);
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://celoria.netsons.org/wordpress/?feed=rss2&amp;p=128</wfw:commentRss>
		</item>
		<item>
		<title>Stripslashes ricorsiva su un array</title>
		<link>http://celoria.netsons.org/wordpress/?p=127</link>
		<comments>http://celoria.netsons.org/wordpress/?p=127#comments</comments>
		<pubDate>Thu, 24 Jan 2008 12:30:25 +0000</pubDate>
		<dc:creator>Paolo Celoria</dc:creator>
		
		<category><![CDATA[Php]]></category>

		<category><![CDATA[array]]></category>

		<category><![CDATA[stripslashesm]]></category>

		<guid isPermaLink="false">http://celoria.netsons.org/wordpress/?p=127</guid>
		<description><![CDATA[A volte può essere utile fare uno stripslashes su ogni elemento dell&#8217;array.

function stripslashes_deep($value)
{
$value = is_array($value) ?
array_map('stripslashes_deep', $value) :
stripslashes($value);

return $value;
}

]]></description>
			<content:encoded><![CDATA[<p>A volte può essere utile fare uno stripslashes su ogni elemento dell&#8217;array.</p>
<pre class="syntax-highlight:php">
function stripslashes_deep($value)
{
$value = is_array($value) ?
array_map('stripslashes_deep', $value) :
stripslashes($value);

return $value;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://celoria.netsons.org/wordpress/?feed=rss2&amp;p=127</wfw:commentRss>
		</item>
		<item>
		<title>Elminare da una stringa caratteri non validi</title>
		<link>http://celoria.netsons.org/wordpress/?p=126</link>
		<comments>http://celoria.netsons.org/wordpress/?p=126#comments</comments>
		<pubDate>Thu, 24 Jan 2008 12:27:14 +0000</pubDate>
		<dc:creator>Paolo Celoria</dc:creator>
		
		<category><![CDATA[Php]]></category>

		<category><![CDATA[replace]]></category>

		<category><![CDATA[strings]]></category>

		<guid isPermaLink="false">http://celoria.netsons.org/wordpress/?p=126</guid>
		<description><![CDATA[In realtà è molto potente, ma per capire come funziona bisogna iniziare con gli esempi facile 
Questa riga di codice permette di levare da $originaltext&#8221; i caratteri che non siano cifre, lettere minuscole, punto, underscore e meno.

$strippedtext = preg_replace('/[^0-9a-z._-]/i','',$originaltext);

]]></description>
			<content:encoded><![CDATA[<p>In realtà è molto potente, ma per capire come funziona bisogna iniziare con gli esempi facile <img src='http://celoria.netsons.org/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Questa riga di codice permette di levare da $originaltext&#8221; i caratteri che non siano cifre, lettere minuscole, punto, underscore e meno.</p>
<pre class="syntax-highlight:php">
$strippedtext = preg_replace('/[^0-9a-z._-]/i','',$originaltext);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://celoria.netsons.org/wordpress/?feed=rss2&amp;p=126</wfw:commentRss>
		</item>
		<item>
		<title>Paginazione in php, con aggiunta di un filtro alla query</title>
		<link>http://celoria.netsons.org/wordpress/?p=123</link>
		<comments>http://celoria.netsons.org/wordpress/?p=123#comments</comments>
		<pubDate>Sat, 12 Jan 2008 16:56:23 +0000</pubDate>
		<dc:creator>Paolo Celoria</dc:creator>
		
		<category><![CDATA[MySql]]></category>

		<category><![CDATA[Php]]></category>

		<category><![CDATA[filtro]]></category>

		<category><![CDATA[num_rows]]></category>

		<category><![CDATA[paginazione]]></category>

		<guid isPermaLink="false">http://celoria.netsons.org/wordpress/?p=123</guid>
		<description><![CDATA[Creare una semplicissima paginazione da una query sql.
In aggiunta c&#8217;e&#8217; la possibilità di passare un filtro (in questo caso sul campo &#8216;colore&#8217; della tabella del database).
La variabile $filtro impostata a &#8216;any&#8217; impedisce al filtro di eseguire la sua azione; può essere utile nel caso volessimo utilizzare anche un filtro con il campo &#8216;colore&#8217; uguale a [...]]]></description>
			<content:encoded><![CDATA[<p>Creare una semplicissima paginazione da una query sql.<br />
In aggiunta c&#8217;e&#8217; la possibilità di passare un filtro (in questo caso sul campo &#8216;colore&#8217; della tabella del database).<br />
La variabile $filtro impostata a &#8216;any&#8217; impedisce al filtro di eseguire la sua azione; può essere utile nel caso volessimo utilizzare anche un filtro con il campo &#8216;colore&#8217; uguale a stringa vuota.</p>
<pre class="syntax-highlight:php">

$elems_per_page = 10; // Elementi per ogni pagina
$page = $_GET[page];
if(!($page)) {
$page = 1;
}
$primo = ($page-1) * $elems_per_page ;

$sql = &quot;&quot;;
if($filtro &amp;&amp; $filtro != &quot;any&quot;) {
$sql = &quot; AND colore = '$filtro'&quot;;
}
$query = &quot;SELECT * FROM matite_colorate WHERE 1 $sql&quot;;
$result = mysql_query($query) or die(&quot;Select last failed $query&quot;);
$num_rows = mysql_num_rows($result);

$tot_pagine = ceil($num_rows / $elems_per_page);
$prev_page = $page - 1;
$next_page = $page + 1;

if($prev_page &gt; 0)
echo &quot;&lt;a href='?filtro=$filtro&amp;page=$prev_page'&gt;pagina precedente&lt;/a&gt;  &quot;;
if($tot_pagine &gt; 0)
echo &quot;pagina $page di $tot_pagine   &quot;;
if($next_page &lt;= $tot_pagine)
echo &quot;&lt;a href='?filtro=$filtro&amp;page=$next_page'&gt; pagina successiva&lt;/a&gt;&quot;;

$query .= &quot; ORDER BY id LIMIT $primo, $elems_per_page&quot;;
$result = mysql_query($query) or die(&quot;Select last failed $query&quot;);
$num_rows = mysql_num_rows($result);

// ora è possibile utilizzare $result per listare solo gli elementi della pagina corrente

while ($line = mysql_fetch_assoc($result))  {
........
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://celoria.netsons.org/wordpress/?feed=rss2&amp;p=123</wfw:commentRss>
		</item>
		<item>
		<title>Arrotondamento</title>
		<link>http://celoria.netsons.org/wordpress/?p=122</link>
		<comments>http://celoria.netsons.org/wordpress/?p=122#comments</comments>
		<pubDate>Sat, 12 Jan 2008 12:00:06 +0000</pubDate>
		<dc:creator>Paolo Celoria</dc:creator>
		
		<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">http://celoria.netsons.org/wordpress/?p=122</guid>
		<description><![CDATA[Funzioni offerte da php per arrotondare un numero.

round($bla, $cifredecimali);

ceil($bla / $blu); // arrotondamento per eccesso

floor($bla / $bli); // arrotondamento per difetto

]]></description>
			<content:encoded><![CDATA[<p>Funzioni offerte da php per arrotondare un numero.</p>
<pre class="syntax-highlight:php">
round($bla, $cifredecimali);

ceil($bla / $blu); // arrotondamento per eccesso

floor($bla / $bli); // arrotondamento per difetto
</pre>
]]></content:encoded>
			<wfw:commentRss>http://celoria.netsons.org/wordpress/?feed=rss2&amp;p=122</wfw:commentRss>
		</item>
		<item>
		<title>Errori di php direttamente nella pagina</title>
		<link>http://celoria.netsons.org/wordpress/?p=121</link>
		<comments>http://celoria.netsons.org/wordpress/?p=121#comments</comments>
		<pubDate>Thu, 03 Jan 2008 09:58:38 +0000</pubDate>
		<dc:creator>Paolo Celoria</dc:creator>
		
		<category><![CDATA[Php]]></category>

		<category><![CDATA[error]]></category>

		<category><![CDATA[error_reporting]]></category>

		<category><![CDATA[php.ini]]></category>

		<category><![CDATA[warning]]></category>

		<guid isPermaLink="false">http://celoria.netsons.org/wordpress/index.php/2008/01/03/errori-di-php-direttamente-nella-pagina/</guid>
		<description><![CDATA[Solitamente le impostazioni del php.ini disabilitano la scrittura degli errori di php direttamente nelle pagine.
Questo comando permette invece di sovrascrivere tali impostazioni. Molto utile in caso vogliamo avere la dicitura degli errori di php direttamente nella pagina, soprattutto in fase di debug.
Con questa dicitura verranno scritti tutti gli errori tranne i NOTICE che non sono [...]]]></description>
			<content:encoded><![CDATA[<p>Solitamente le impostazioni del php.ini disabilitano la scrittura degli errori di php direttamente nelle pagine.<br />
Questo comando permette invece di sovrascrivere tali impostazioni. Molto utile in caso vogliamo avere la dicitura degli errori di php direttamente nella pagina, soprattutto in fase di debug.<br />
Con questa dicitura verranno scritti tutti gli errori tranne i NOTICE che non sono veri e propri errori ma che php scrive a tonnellare.<br />
Da riportare all&#8217;inizio della pagina php.</p>
<pre class="syntax-highlight:php">
error_reporting(E_ALL ^ E_NOTICE);
</pre>
<p><a href="http://www.php.net/error_reporting" target="_blank">Per altre info.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://celoria.netsons.org/wordpress/?feed=rss2&amp;p=121</wfw:commentRss>
		</item>
		<item>
		<title>Creare un backup di mysql senza phpmyadmin</title>
		<link>http://celoria.netsons.org/wordpress/?p=120</link>
		<comments>http://celoria.netsons.org/wordpress/?p=120#comments</comments>
		<pubDate>Wed, 02 Jan 2008 14:43:57 +0000</pubDate>
		<dc:creator>Paolo Celoria</dc:creator>
		
		<category><![CDATA[MySql]]></category>

		<category><![CDATA[Php]]></category>

		<category><![CDATA[mysqldump]]></category>

		<guid isPermaLink="false">http://celoria.netsons.org/wordpress/index.php/2008/01/02/test-per-il-codice/</guid>
		<description><![CDATA[Ecco come fare il backup di un database se non si dispone di phpmyadmin e non si ha accesso al server per eseguire un mysqldump.
Il codice php restituisce un file di testo contenente un mysqldump.

header('Content-type: application/txt');
header('Content-Disposition: attachment; filename=&#34;'.date(&#34;Ymd&#34;).'_netsonsdump.sql&#34;');

$server = &#34;mysql5.netsons.org&#34;; /* in genere localhost */
$user = &#34;celoria&#34;; /* utente di mysql */
$pass = &#34;password&#34;;
$db = [...]]]></description>
			<content:encoded><![CDATA[<p>Ecco come fare il backup di un database se non si dispone di phpmyadmin e non si ha accesso al server per eseguire un mysqldump.<br />
Il codice php restituisce un file di testo contenente un mysqldump.</p>
<pre class="syntax-highlight:php">
header('Content-type: application/txt');
header('Content-Disposition: attachment; filename=&quot;'.date(&quot;Ymd&quot;).'_netsonsdump.sql&quot;');

$server = &quot;mysql5.netsons.org&quot;; /* in genere localhost */
$user = &quot;celoria&quot;; /* utente di mysql */
$pass = &quot;password&quot;;
$db = &quot;celoria&quot;;

mysql_connect($server, $user, $pass);
mysql_select_db($db);
$tables = mysql_list_tables($db);
while ($td = mysql_fetch_array($tables))
{
	$table = $td[0];
	$r = mysql_query(&quot;SHOW CREATE TABLE `$table`&quot;);
	if ($r)	{
		$insert_sql = &quot;&quot;;
		$d = mysql_fetch_array($r);
		$d[1] .= &quot;;&quot;;
		$SQL[] = str_replace(&quot;\n&quot;, &quot;&quot;, $d[1]);
		$table_query = mysql_query(&quot;SELECT * FROM `$table`&quot;);
		$num_fields = mysql_num_fields($table_query);
		while ($fetch_row = mysql_fetch_array($table_query)) {
			$insert_sql .= &quot;INSERT INTO $table VALUES(&quot;;
			for ($n=1;$n&lt;=$num_fields;$n++)	{
				$m = $n - 1;
				$insert_sql .= &quot;'&quot;.mysql_real_escape_string($fetch_row[$m]).&quot;', &quot;;
			}
			$insert_sql = substr($insert_sql,0,-2);
			$insert_sql .= &quot;);\n&quot;;
		}
		if ($insert_sql!= &quot;&quot;) {
			$SQL[] = $insert_sql;
		}
	}
}

echo implode(&quot;\r&quot;, $SQL);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://celoria.netsons.org/wordpress/?feed=rss2&amp;p=120</wfw:commentRss>
		</item>
	</channel>
</rss>
