
<?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"
	>

<channel>
	<title>Linux, PHP, LAMP, The Web in a blog</title>
	<atom:link href="http://www.danieleocchipinti.com/blog-linux-php-lamp-web/feed" rel="self" type="application/rss+xml" />
	<link>http://www.danieleocchipinti.com/blog-linux-php-lamp-web</link>
	<description>By a Webmaster based in London</description>
	<pubDate>Wed, 19 Nov 2008 22:07:26 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
	<language>en</language>
			<item>
		<title>Web Development with UTF8</title>
		<link>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/web-development/web-development-with-utf8</link>
		<comments>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/web-development/web-development-with-utf8#comments</comments>
		<pubDate>Sun, 16 Nov 2008 20:00:03 +0000</pubDate>
		<dc:creator>Daniele Occhipinti</dc:creator>
		
		<category><![CDATA[Web Development]]></category>

		<category><![CDATA[utf]]></category>

		<category><![CDATA[utf8]]></category>

		<guid isPermaLink="false">http://www.danieleocchipinti.com/blog-linux-php-lamp-web/?p=212</guid>
		<description><![CDATA[There are two mappings: the numerical value corresponding to a character (charset) and the binary representation of that value (encoding). UTF is a charset that has a number of encodings; utf8 is an encoding.
Thanks to utf, we can have different languages on the same webpage.


First of all, make sure the encoding of your text editor [...]]]></description>
			<content:encoded><![CDATA[<p>There are two mappings: the numerical value corresponding to a character (<em>charset</em>) and the binary representation of that value (<em>encoding</em>). UTF is a charset that has a number of encodings; utf8 is an encoding.<br />
Thanks to utf, we can have different languages on the same webpage.
</p>
<p>
First of all, make sure the encoding of your text editor is utf8.
</p>
<p><h3>PHP</h3>
<pre>header("Content-Type: text/html; charset=utf-8");</pre>
<p>You don&#8217;t need that if you managed to edit your httpd.conf properly.<br />
As long as you don&#8217;t want to mess with the content of a string, you can pass it around blindly. But as soon as you want to use any function that relies on substring operations (such as substring, wordwrap, chunk_split) you need to use the equivalent multibyte functions, obtaining prepending mb_ (you need to install the extension on PHP)
</p>
<p><h3>MySQL</h3>
<p>Similar to PHP (careful with substring and fulltext indexing) but no problem if the charset of the db is UFT8
</p>
<p><h3>Email</h3>
<p>Similar to HTML, just use:<br />
&lt;meta http-equiv=&#8221;content-type&#8221; content=&#8221;text/html; charset=utf-8&#8243; /&gt;<br />
The problem is that that meta applies only to the body but it&#8217;s quite likely you need UTF8 also for the to/from header. In that case you need a trick you can find on Google
</p>
<p><h3>HTML</h3>
<li>Don&#8217;t forget the following in your head section:<br />
&lt;meta http-equiv=&#8221;content-type&#8221; content=&#8221;text/html; charset=utf-8&#8243; /&gt;
</li>
</p>
<p><h3>Javascript</h3>
<p>It fully supports UTF8 apart from the escape() function. Google the utf8 version if you need it.
</p>
<p><h3>User Input</h3>
<p>No problem with the user input because the browser sends data back to the server using the same encoding the server is using. But there are some exceptions (very old browsers, hacking attempts,&#8230;)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/web-development/web-development-with-utf8/feed</wfw:commentRss>
		</item>
		<item>
		<title>PHP locale localization</title>
		<link>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/web-development/php/php-locale-localization</link>
		<comments>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/web-development/php/php-locale-localization#comments</comments>
		<pubDate>Sat, 15 Nov 2008 18:58:16 +0000</pubDate>
		<dc:creator>Daniele Occhipinti</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.danieleocchipinti.com/blog-linux-php-lamp-web/?p=211</guid>
		<description><![CDATA[gettext (an alias is just underscore!)
]]></description>
			<content:encoded><![CDATA[<p>gettext (an alias is just underscore!)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/web-development/php/php-locale-localization/feed</wfw:commentRss>
		</item>
		<item>
		<title>Linux - How To Split a Big File Into Several Small Files</title>
		<link>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/linux/linux-command-line/linux-how-to-split-a-big-file-into-several-small-files</link>
		<comments>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/linux/linux-command-line/linux-how-to-split-a-big-file-into-several-small-files#comments</comments>
		<pubDate>Wed, 12 Nov 2008 22:26:17 +0000</pubDate>
		<dc:creator>Daniele Occhipinti</dc:creator>
		
		<category><![CDATA[Linux Command Line]]></category>

		<category><![CDATA[split]]></category>

		<guid isPermaLink="false">http://www.danieleocchipinti.com/blog-linux-php-lamp-web/?p=210</guid>
		<description><![CDATA[split –bytes=1m /path/to/large/file /path/to/output/file/prefix
You can change the output file size by changing the –bytes=1m to your preference. You can use b, k, or m. b represent bytes, k represent kilobytes, m represent megabytes.
To restore the original file:
cat prefix* > newfilename
 To split a file using a regular expression:
 csplit filename separator &#8216;{*}&#8217;  (the last [...]]]></description>
			<content:encoded><![CDATA[<pre>split –bytes=1m /path/to/large/file /path/to/output/file/prefix</pre>
<p>You can change the output file size by changing the –bytes=1m to your preference. You can use b, k, or m. b represent bytes, k represent kilobytes, m represent megabytes.</p>
<p>To restore the original file:</p>
<pre>cat prefix* > newfilename</pre>
<p> To split a file using a regular expression:<br />
 csplit filename separator &#8216;{*}&#8217;  (the last bit is to split not just once but as many times as possible)<br />
 To restore the original files:<br />
 cat $(ls -L) >> a</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/linux/linux-command-line/linux-how-to-split-a-big-file-into-several-small-files/feed</wfw:commentRss>
		</item>
		<item>
		<title>Rsync - Deploy And Increment Backup</title>
		<link>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/linux/linux-command-line/rsync-deploy-and-increment-backup</link>
		<comments>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/linux/linux-command-line/rsync-deploy-and-increment-backup#comments</comments>
		<pubDate>Sat, 08 Nov 2008 01:32:16 +0000</pubDate>
		<dc:creator>Daniele Occhipinti</dc:creator>
		
		<category><![CDATA[Linux Command Line]]></category>

		<category><![CDATA[System Administration]]></category>

		<guid isPermaLink="false">http://www.danieleocchipinti.com/blog-linux-php-lamp-web/?p=209</guid>
		<description><![CDATA[It&#8217;s good for deploy as well.
It can be used also to do backups locally.
Very useful to move big amount of data over the Internet because of its incremental feature.
Backing up from local machine to remove backup server (with the same user):

#!/bin/bash
export RSYNC_RSH=/usr/bin/ssh
dest=backup1
user=$(whoami)
cd &#124;&#124; exit 1
rsync -aHPvz . "${user}@${dest}:."

[-z -> to compress, not necessary in LAN]
[-b [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s good for deploy as well.<br />
It can be used also to do backups locally.<br />
Very useful to move big amount of data over the Internet because of its incremental feature.</p>
<p>Backing up from local machine to remove backup server (with the same user):</p>
<pre>
#!/bin/bash
export RSYNC_RSH=/usr/bin/ssh
dest=backup1
user=$(whoami)
cd || exit 1
rsync -aHPvz . "${user}@${dest}:."
</pre>
<p>[-z -> to compress, not necessary in LAN]<br />
[-b -> backup of the already exisitng destination files]<br />
SSH is useful just if you send data over the Internet.</p>
<p>Listing the files on the backup server:<br />
#!/bin/bash<br />
dest=server1<br />
user=$(whoami)<br />
cd || exit 1<br />
rsync &#8220;${user}@${dest}:.&#8221; | more</p>
<p>Restoring (the script runs locally):<br />
#!/bin/bash<br />
dest=server1<br />
user=$(whoami)<br />
cd || exit 1<br />
for file in &#8220;$@&#8221; ; do<br />
  rsync -aHPvz &#8220;${user}@${dest}:./${file}&#8221; &#8220;./${file}&#8221;<br />
done</p>
<p>For restoring, you simply run the script, passing the names of the files to be restored as arguments on the command line.<br />
We can also restore all the files at once by using a dot as the filename</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/linux/linux-command-line/rsync-deploy-and-increment-backup/feed</wfw:commentRss>
		</item>
		<item>
		<title>Linux Command Line - Bash Scripting - Some tricks</title>
		<link>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/linux/linux-command-line/linux-command-line-bash-scripting-some-tricks</link>
		<comments>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/linux/linux-command-line/linux-command-line-bash-scripting-some-tricks#comments</comments>
		<pubDate>Wed, 05 Nov 2008 21:09:34 +0000</pubDate>
		<dc:creator>Daniele Occhipinti</dc:creator>
		
		<category><![CDATA[Linux Command Line]]></category>

		<guid isPermaLink="false">http://www.danieleocchipinti.com/blog-linux-php-lamp-web/?p=207</guid>
		<description><![CDATA[wc - print newline, word, and byte counts for each file (program for count statistics from a file)
dt = $(date)
ls -l > files.txt 2>error.txt
Redirects standard error to a file
ls -l > files.txt 2>&#038;1
Redirects standard error and standard output to the same file
Some &#8216;magic&#8217; variables:

$? is a variable that contains the return status of the most [...]]]></description>
			<content:encoded><![CDATA[<p>wc - print newline, word, and byte counts for each file (program for count statistics from a file)</p>
<p>dt = $(date)</p>
<p>ls -l > files.txt 2>error.txt<br />
Redirects standard error to a file</p>
<p>ls -l > files.txt 2>&#038;1<br />
Redirects standard error and standard output to the same file</p>
<p>Some &#8216;magic&#8217; variables:</p>
<ul>
<li>$? is a variable that contains the return status of the most recent command executed.</li>
<li>$$ is a variable that contains the process ID. This can be useful to create a unique temporary filename.</li>
<li>$0 is the name of the script itself</li>
<li>$* contains all the arguments as one string value</li>
<li>$@ contains all the arguments as an array -> you can use:<br />
for file in &#8220;$@&#8221;; do<br />
    rm file<br />
done
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/linux/linux-command-line/linux-command-line-bash-scripting-some-tricks/feed</wfw:commentRss>
		</item>
		<item>
		<title>Apache - Easy Benchmark</title>
		<link>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/benchmarch/apache-easy-benchmark</link>
		<comments>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/benchmarch/apache-easy-benchmark#comments</comments>
		<pubDate>Tue, 04 Nov 2008 23:28:56 +0000</pubDate>
		<dc:creator>Daniele Occhipinti</dc:creator>
		
		<category><![CDATA[Apache]]></category>

		<category><![CDATA[Benchmarch]]></category>

		<guid isPermaLink="false">http://www.danieleocchipinti.com/blog-linux-php-lamp-web/?p=208</guid>
		<description><![CDATA[ab -n 1000 -c 5 http://mydomain.com/bench.htm
makes 1000 separate requests for the same file with a concurrency (simultaneous requests) of 5
]]></description>
			<content:encoded><![CDATA[<p>ab -n 1000 -c 5 http://mydomain.com/bench.htm<br />
makes 1000 separate requests for the same file with a concurrency (simultaneous requests) of 5</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/benchmarch/apache-easy-benchmark/feed</wfw:commentRss>
		</item>
		<item>
		<title>PHP Profiling - Profile / Performance</title>
		<link>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/web-development/php/php-profiling-profile-performance</link>
		<comments>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/web-development/php/php-profiling-profile-performance#comments</comments>
		<pubDate>Sun, 02 Nov 2008 20:34:19 +0000</pubDate>
		<dc:creator>Daniele Occhipinti</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[profiling]]></category>

		<guid isPermaLink="false">http://www.danieleocchipinti.com/blog-linux-php-lamp-web/?p=206</guid>
		<description><![CDATA[XDebug2 + KcacheGrind
]]></description>
			<content:encoded><![CDATA[<p>XDebug2 + KcacheGrind</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/web-development/php/php-profiling-profile-performance/feed</wfw:commentRss>
		</item>
		<item>
		<title>JQuery: Example of The Structure of a File That Will Manage a Page</title>
		<link>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/web-development/javascript/jquery/jquery-example-of-the-structure-of-a-file-that-will-manage-a-page</link>
		<comments>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/web-development/javascript/jquery/jquery-example-of-the-structure-of-a-file-that-will-manage-a-page#comments</comments>
		<pubDate>Sun, 26 Oct 2008 23:23:25 +0000</pubDate>
		<dc:creator>Daniele Occhipinti</dc:creator>
		
		<category><![CDATA[JQuery]]></category>

		<guid isPermaLink="false">http://www.danieleocchipinti.com/blog-linux-php-lamp-web/?p=205</guid>
		<description><![CDATA[This is an example of the Structure of a file that will manage a page.
This is also a good example on how to manage dropdown boxes.

$(document).ready(
       function ()
       {
               [...]]]></description>
			<content:encoded><![CDATA[<p>This is an example of the Structure of a file that will manage a page.<br />
This is also a good example on how to manage dropdown boxes.</p>
<pre>
$(document).ready(
       function ()
       {
               // shows the tags related to the selected category
               function showTags()
               {
                   var categoryValue = $('#category').val(); // the selected value of the dropdown menu
                   var categoryIds = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11];

                   for (var i in categoryIds)
                   {
                       if ($('#tags_' + categoryIds[i]).css('display') == 'block')
                       {
                           $('#tags_' + categoryIds[i]).slideUp('fast');
                           $('#tags_' + categoryIds[i]).css('display', 'none');
                       }
                   }

                   $('#tags_' + categoryValue).slideDown('fast');
                   $('#tags_' + categoryValue).css('display', 'block');

                   // other examples
                  if ( ($('#smallImage').html() == "") ) // it checkes the actual content of the div
                  {
                    var id = $('#bigImageDiv').children('span').attr('id');
                  }
                  if ($('#featured:checked').val() != null) // it checkes whether the checkbox is ticked
                  {
                    // something
                  }
               }

		// showTags must be shown both when the page is loaded
		// and in the event of a change in the dropdown 'category'
               showTags();
               $('#category').change(function() { showTags() });

               // set up tool tips
               $('label').Tooltip({showURL: false, delay: 0, track: true});

               return false;
       });
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/web-development/javascript/jquery/jquery-example-of-the-structure-of-a-file-that-will-manage-a-page/feed</wfw:commentRss>
		</item>
		<item>
		<title>Creating a Button Using Gimp</title>
		<link>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/web-development/web-design/creating-a-button-using-gimp</link>
		<comments>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/web-development/web-design/creating-a-button-using-gimp#comments</comments>
		<pubDate>Sun, 26 Oct 2008 23:11:34 +0000</pubDate>
		<dc:creator>Daniele Occhipinti</dc:creator>
		
		<category><![CDATA[Web Design]]></category>

		<category><![CDATA[button]]></category>

		<guid isPermaLink="false">http://www.danieleocchipinti.com/blog-linux-php-lamp-web/?p=204</guid>
		<description><![CDATA[Creating a button with Gimp

new image 80&#215;20
select the all image with &#8216;Select Rectangular Region&#8217; tool
Menu > Select > Rounded Rectangle
Radius about 40/50
Gradient tool
Make a vercial gradient with two colors quite close
Text Editor: Sans Bold, 11px, white
Save as a gif

]]></description>
			<content:encoded><![CDATA[<p>Creating a button with Gimp</p>
<ul>
<li>new image 80&#215;20</li>
<li>select the all image with &#8216;Select Rectangular Region&#8217; tool</li>
<li>Menu > Select > Rounded Rectangle</li>
<li>Radius about 40/50</li>
<li>Gradient tool</li>
<li>Make a vercial gradient with two colors quite close</li>
<li>Text Editor: Sans Bold, 11px, white</li>
<li>Save as a gif</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/web-development/web-design/creating-a-button-using-gimp/feed</wfw:commentRss>
		</item>
		<item>
		<title>Disabling / Hiding Inner Borders Inside a Table</title>
		<link>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/web-development/web-design/disabling-hiding-inner-borders-inside-a-table</link>
		<comments>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/web-development/web-design/disabling-hiding-inner-borders-inside-a-table#comments</comments>
		<pubDate>Sun, 26 Oct 2008 23:09:14 +0000</pubDate>
		<dc:creator>Daniele Occhipinti</dc:creator>
		
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.danieleocchipinti.com/blog-linux-php-lamp-web/?p=203</guid>
		<description><![CDATA[border-collapse: collapse
]]></description>
			<content:encoded><![CDATA[<p>border-collapse: collapse</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/web-development/web-design/disabling-hiding-inner-borders-inside-a-table/feed</wfw:commentRss>
		</item>
	</channel>
</rss>
