<?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>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>
	<lastBuildDate>Mon, 06 Dec 2010 14:11:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.2</generator>
		<item>
		<title>Android &#8211; how to develop directly on a phone</title>
		<link>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/mobile-dev/android/android-how-to-develop-directly-on-a-phone</link>
		<comments>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/mobile-dev/android/android-how-to-develop-directly-on-a-phone#comments</comments>
		<pubDate>Mon, 06 Dec 2010 14:10:32 +0000</pubDate>
		<dc:creator>Daniele Occhipinti</dc:creator>
				<category><![CDATA[Android]]></category>

		<guid isPermaLink="false">http://www.danieleocchipinti.com/blog-linux-php-lamp-web/?p=324</guid>
		<description><![CDATA[There are severe problem with using the Android Emulator on a netbook / mini-laptop. It is much better to use your phone. That&#8217;s it: you develop on Eclipse and run and debug the program directly on your phone. In order &#8230; <a href="http://www.danieleocchipinti.com/blog-linux-php-lamp-web/mobile-dev/android/android-how-to-develop-directly-on-a-phone">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>There are severe problem with using the Android Emulator on a netbook / mini-laptop.</p>
<p>It is much better to use your phone. That&#8217;s it: you develop on Eclipse and run and debug the program directly on your phone.</p>
<p>In order to do this you need 3 steps:</p>
<ul>
<li>set up Eclipse to be able to develop for Android (basically install the ADT plugin) as explained here: <a href="http://developer.android.com/sdk/eclipse-adt.html#installing">http://developer.android.com/sdk/eclipse-adt.html#installing</a></li>
<li>link the mobile and your development workstation with the USB cable that comes with the phone</li>
<li>enable logging on your Android device to be able to debug:
<ul>
<li><span class="code">echo 1 &gt; /sys/kernel/logger/log_main/enable</span> // ** &#8217;1&#8242; is enable                 log_main</li>
<li><span class="code">echo 2 &gt;/sys/kernel/logger/log_main/priority</span> // ** &#8217;2&#8242; is the log level</li>
</ul>
</li>
</ul>
<p><span style="font-size: medium;"><span style="line-height: 24px;">Now, you can install your application on the device by doing:</span></span><br />
<span class="code">/home/dan/android-sdk-linux_x86/tools/adb install -r /home/dan/MyAppForAndroid/bin/MyAppForAndroid.apk</span></p>
<p><span style="font-size: medium;"><span style="line-height: 24px;">You can uninstall the application by doing:</span></span></p>
<p><span class="code">/home/dan/android-sdk-linux_x86/tools/adb uninstall com.myapp.android.app</span></p>
<p><span style="font-size: small;">You can check the log on the device:</span></p>
<p><span class="code">/home/dan/android-sdk-linux_x86/tools/adb logcat</span></p>
<p>You can check the log on the device, restricting to the messages from your application:</p>
<p><span class="code">/home/dan/android-sdk-linux_x86/tools/adb logcat | grep &#8216;MyApp&#8217;</span></p>
<p>You can reset the log:</p>
<p><span class="code">/home/dan/android-sdk-linux_x86/tools/adb logcat -c</span></p>
<p>In your application you can add an entry to the log:</p>
<p><span class="code">Log.e(&#8220;MYAPP&#8221;, &#8220;message to log&#8221;);</span></p>
<p>If you want to log the whole backtrace of an exception:</p>
<div class="code">try {<br />
// code buggy code<br />
} catch (Exception e)<br />
Log.e(&#8220;MYAPP&#8221;, &#8220;exception&#8221;, e);<br />
}</div>
]]></content:encoded>
			<wfw:commentRss>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/mobile-dev/android/android-how-to-develop-directly-on-a-phone/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android drawable default icons &#8211; they are free to use</title>
		<link>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/mobile-dev/android/android-drawable-default-icons-they-are-free-to-use</link>
		<comments>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/mobile-dev/android/android-drawable-default-icons-they-are-free-to-use#comments</comments>
		<pubDate>Mon, 06 Dec 2010 13:44:36 +0000</pubDate>
		<dc:creator>Daniele Occhipinti</dc:creator>
				<category><![CDATA[Android]]></category>

		<guid isPermaLink="false">http://www.danieleocchipinti.com/blog-linux-php-lamp-web/?p=322</guid>
		<description><![CDATA[http://androiddrawableexplorer.appspot.com/]]></description>
			<content:encoded><![CDATA[<p>http://androiddrawableexplorer.appspot.com/</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/mobile-dev/android/android-drawable-default-icons-they-are-free-to-use/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android how to read and write files</title>
		<link>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/mobile-dev/android/android-how-to-read-and-write-files</link>
		<comments>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/mobile-dev/android/android-how-to-read-and-write-files#comments</comments>
		<pubDate>Mon, 06 Dec 2010 13:43:12 +0000</pubDate>
		<dc:creator>Daniele Occhipinti</dc:creator>
				<category><![CDATA[Android]]></category>

		<guid isPermaLink="false">http://www.danieleocchipinti.com/blog-linux-php-lamp-web/?p=320</guid>
		<description><![CDATA[http://huuah.com/android-writing-and-reading-files/]]></description>
			<content:encoded><![CDATA[<p>http://huuah.com/android-writing-and-reading-files/</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/mobile-dev/android/android-how-to-read-and-write-files/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Uncompress on the fly when copying a file from a remove location with scp</title>
		<link>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/linux/linux-command-line/uncompress-on-the-fly-when-copying-a-file-from-a-remove-location-with-scp</link>
		<comments>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/linux/linux-command-line/uncompress-on-the-fly-when-copying-a-file-from-a-remove-location-with-scp#comments</comments>
		<pubDate>Sat, 06 Nov 2010 12:04:48 +0000</pubDate>
		<dc:creator>Daniele Occhipinti</dc:creator>
				<category><![CDATA[Linux Command Line]]></category>
		<category><![CDATA[scp]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://www.danieleocchipinti.com/blog-linux-php-lamp-web/?p=318</guid>
		<description><![CDATA[Don&#8217;t use scp, do it with ssh: ssh backups@server "cat /home/backups/backup_2010-09-27.tar.gz"&#124; tar zxvf - You can probably use something similar also for: Compress on the fly when copying a file from a remove location with scp]]></description>
			<content:encoded><![CDATA[<p>Don&#8217;t use scp, do it with ssh:</p>
<p><code>ssh backups@server "cat /home/backups/backup_2010-09-27.tar.gz"| tar zxvf -</code></p>
<p>You can probably use something similar also for:<br />
Compress on the fly when copying a file from a remove location with scp</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/linux/linux-command-line/uncompress-on-the-fly-when-copying-a-file-from-a-remove-location-with-scp/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up an encrypted volume on an external hard drive on CentOS</title>
		<link>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/linux/redhat-centos/setting-up-an-encrypted-volume-on-an-external-hard-drive-on-centos</link>
		<comments>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/linux/redhat-centos/setting-up-an-encrypted-volume-on-an-external-hard-drive-on-centos#comments</comments>
		<pubDate>Sat, 06 Nov 2010 11:55:07 +0000</pubDate>
		<dc:creator>Daniele Occhipinti</dc:creator>
				<category><![CDATA[Redhat / CentOS]]></category>
		<category><![CDATA[System Administration]]></category>

		<guid isPermaLink="false">http://www.danieleocchipinti.com/blog-linux-php-lamp-web/?p=312</guid>
		<description><![CDATA[Make sure the version of your kernel is 2.6.16 or later with support for device mappers. Please replace XXXXX with the device Linux allocates the driver to (i.e.: /dev/sdc1). Use the dmesg command to find that out. Preparing the volume &#8230; <a href="http://www.danieleocchipinti.com/blog-linux-php-lamp-web/linux/redhat-centos/setting-up-an-encrypted-volume-on-an-external-hard-drive-on-centos">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Make sure the version of your kernel is 2.6.16 or later with support for device mappers.<br />
Please replace XXXXX with the device Linux allocates the driver to (i.e.: /dev/sdc1). Use the dmesg command to find that out.</p>
<p><strong>Preparing the volume</strong><br />
_ su<br />
_ yum install lvm2 cryptsetup-luks<br />
_ umount XXXXX<br />
_ filling the HD with random stuff<br />
/sbin/badblocks -c 10240 -s -w -t random -v XXXXX<br />
_ /sbin/cryptsetup luksFormat &#8211;verbose &#8211;verify-passphrase XXXXX<br />
_ opening the encrypted device and assign it to a virtual /dev/mapper/backup device:<br />
/sbin/cryptsetup luksOpen XXXXX backup<br />
_ creating a filesystem on the encrypted device:<br />
/sbin/mkfs.ext3 -j -m 1 -O dir_index,filetype,sparse_super /dev/mapper/backup<br />
_ creating a mount point for future use<br />
mkdir /mnt/backup<br />
_ closing the volume<br />
/sbin/cryptsetup luksClose /dev/mapper/backup<br />
_ probably you want to be able to open the device without typing a password. For that go to the &#8220;Using cryptsetup without typing a password&#8221; paragraph</p>
<p><strong>Opening and mounting the volume:</strong><br />
_ su<br />
_ /sbin/cryptsetup luksOpen XXXXX backup<br />
_ mount /dev/mapper/backup /mnt/backup</p>
<p><strong>Closing the volume:</strong><br />
_ umount /mnt/backup<br />
_ /sbin/cryptsetup luksClose /dev/mapper/backup</p>
<p><strong>Using cryptsetup without typing a password:</strong><br />
Set up:<br />
_ Creating an binary file with the hash of a key:<br />
hashalot -n 32 ripemd160 &gt; volume_key<br />
_ /sbin/cryptsetup luksAddKey XXXXX myvol<br />
From then on you can open the volume this way, without typing a password:<br />
_ /sbin/cryptsetup luksOpen -d volume_key XXXXX backup</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/linux/redhat-centos/setting-up-an-encrypted-volume-on-an-external-hard-drive-on-centos/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux bash &#8211; tar tricks</title>
		<link>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/linux/linux-command-line/linux-bash-tar-tricks</link>
		<comments>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/linux/linux-command-line/linux-bash-tar-tricks#comments</comments>
		<pubDate>Sat, 06 Nov 2010 11:52:51 +0000</pubDate>
		<dc:creator>Daniele Occhipinti</dc:creator>
				<category><![CDATA[Linux Command Line]]></category>
		<category><![CDATA[tar]]></category>

		<guid isPermaLink="false">http://www.danieleocchipinti.com/blog-linux-php-lamp-web/?p=310</guid>
		<description><![CDATA[Change directory: tar xzvf /var/backups/dbserver/dbserver-backup*.tar.gz -C /var/backups/dbserver Specifing the destination file: tar --create -zvPh -f /tmp/backup.tar.gz /usr/local/bin /usr/local /etc/var/spool/cron /var/svn /home/*/.ssh /home/*/.bash*]]></description>
			<content:encoded><![CDATA[<p>Change directory:<br />
<code>tar xzvf /var/backups/dbserver/dbserver-backup*.tar.gz -C /var/backups/dbserver</code></p>
<p>Specifing the destination file:<br />
<code>tar --create -zvPh -f /tmp/backup.tar.gz /usr/local/bin /usr/local /etc/var/spool/cron /var/svn /home/*/.ssh /home/*/.bash*</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/linux/linux-command-line/linux-bash-tar-tricks/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Implement Selenium tests</title>
		<link>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/web-development/php/implement-selenium-tests</link>
		<comments>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/web-development/php/implement-selenium-tests#comments</comments>
		<pubDate>Sat, 06 Nov 2010 10:29:11 +0000</pubDate>
		<dc:creator>Daniele Occhipinti</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.danieleocchipinti.com/blog-linux-php-lamp-web/?p=306</guid>
		<description><![CDATA[Installing Selenium 1.0 and write tests with PHP _ The documentation is very good: http://seleniumhq.org/docs/ _ Donwload Selenium RC from here: http://seleniumhq.org/download/ _ When you extract it, there will be a directory with the server and a number of directories &#8230; <a href="http://www.danieleocchipinti.com/blog-linux-php-lamp-web/web-development/php/implement-selenium-tests">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Installing Selenium 1.0 and write tests with PHP<br />
_ The documentation is very good: http://seleniumhq.org/docs/<br />
_ Donwload Selenium RC from here: http://seleniumhq.org/download/<br />
_ When you extract it, there will be a directory with the server and a<br />
number of directories<br />
with the clients, depending on the language you intend to use<br />
_ The server will make the browser(s) available to the tests (so it must<br />
have a graphical Desktop environment and the browser installed)<br />
_ The tests will be launched on the client<br />
_ Obviously client and server can sit on the same machine<br />
_ To run the server:<br />
java -jar selenium-server-1.0.3/selenium-server.jar<br />
_ On the client you need to have PHPUnit installed in order to run the tests<br />
_ In the directory selenium-php-client-driver-1.0.1 you have extracted,<br />
create a new test file myTest.php , like this one:</p>
<pre>
< ?php
require_once 'PHPUnit/Extensions/SeleniumTestCase.php';
class Example extends PHPUnit_Extensions_SeleniumTestCase
{
	public static $browsers = array(
			array('name' => 'Firefox on Linux',
			'browser' => '*firefox',
			// 'browser' => '*firefox /usr/bin/firefox',
			'host' => 'localhost',
			'port' => 4444,
			'timeout' => 30000,
			),
			array('name' => 'Chrome on Linux',
			'browser' => '*chrome /home/daniele/chrome/chrome-wrapper',
			'host' => 'localhost',
			'port' => 4444,
			'timeout' => 30000,
			)
		);
		protected function setUp()
		{
			$this->setBrowserUrl("http://www.mysite.com";);
		}

		public function testMyTestCase()
		{
			$this->open("/");
			$this->click("link=contactus");
			$this->waitForPageToLoad("30000");
			try {
				$this->assertTrue($this->isTextPresent("Hello"));
			} catch (PHPUnit_Framework_AssertionFailedError $e) {
				array_push($this->verificationErrors, $e->toString());
			}
		}
}
?>
</pre>
<p>_ to run the tests:<br />
phpunit myTest.php</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/web-development/php/implement-selenium-tests/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using a downloaded package without IDE in Java</title>
		<link>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/java/using-a-downloaded-package-without-ide-in-java</link>
		<comments>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/java/using-a-downloaded-package-without-ide-in-java#comments</comments>
		<pubDate>Sat, 06 Nov 2010 10:23:45 +0000</pubDate>
		<dc:creator>Daniele Occhipinti</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.danieleocchipinti.com/blog-linux-php-lamp-web/?p=304</guid>
		<description><![CDATA[http://stackoverflow.com/questions/4093021/java-using-a-downloaded-package-without-ide]]></description>
			<content:encoded><![CDATA[<p>http://stackoverflow.com/questions/4093021/java-using-a-downloaded-package-without-ide</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/java/using-a-downloaded-package-without-ide-in-java/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS selectors optimisation</title>
		<link>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/web-development/html-css/css-selectors-optimisation</link>
		<comments>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/web-development/html-css/css-selectors-optimisation#comments</comments>
		<pubDate>Sat, 06 Nov 2010 09:31:47 +0000</pubDate>
		<dc:creator>Daniele Occhipinti</dc:creator>
				<category><![CDATA[HTML / CSS]]></category>

		<guid isPermaLink="false">http://www.danieleocchipinti.com/blog-linux-php-lamp-web/?p=301</guid>
		<description><![CDATA[From the last chapter of &#8220;Even faster websites&#8221;. CSS selectors are matched right to left (!). That means the rightmost selector should be as less broad as possible: you should avoid * and tags as rightmost selectors. The quickest selectors &#8230; <a href="http://www.danieleocchipinti.com/blog-linux-php-lamp-web/web-development/html-css/css-selectors-optimisation">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div id="_mcePaste">From the last chapter of &#8220;Even faster websites&#8221;.</div>
<div></div>
<div id="_mcePaste">CSS selectors are matched right to left (!).</div>
<div id="_mcePaste">That means the rightmost selector should be as less broad as possible: you</div>
<div id="_mcePaste">should avoid * and tags as rightmost selectors.</div>
<div></div>
<div id="_mcePaste">The quickest selectors to be matched are:</div>
<div id="_mcePaste">_ id selectors (i.e.: #title)</div>
<div id="_mcePaste">_ tag selectors (i.e.: a)</div>
<div id="_mcePaste">_ class selectors (i.e.: .title)</div>
<div id="_mcePaste">Obviously id selectors are very easy to match.</div>
<div id="_mcePaste">Selectors like these are not easy to match but not too bad:</div>
<div id="_mcePaste">_ div &gt; a</div>
<div id="_mcePaste">_ div + a</div>
<div id="_mcePaste">because you restrict the DOM the browser needs to analyse for each a tag.</div>
<div id="_mcePaste">This instead is quite heavy to match</div>
<div id="_mcePaste">_ div p a</div>
<div id="_mcePaste">because the browser needs to checks all the ascendants for all the a tags</div>
<div></div>
<div id="_mcePaste">It is not easy to know how much that impacts performance.</div>
<div id="_mcePaste">Anyway perfomances are impacted not only when loading the page at start but</div>
<div id="_mcePaste">also when creating or changing elements in the page with Javascript (the</div>
<div id="_mcePaste">browser needs to go through all the CSS rules for the new piece of HTML</div>
<div id="_mcePaste">code)</div>
]]></content:encoded>
			<wfw:commentRss>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/web-development/html-css/css-selectors-optimisation/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu Linux on Acer Aspire AO751h</title>
		<link>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/linux/debian-ubuntu-kubuntu/ubuntu-linux-on-acer-aspire-ao751h</link>
		<comments>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/linux/debian-ubuntu-kubuntu/ubuntu-linux-on-acer-aspire-ao751h#comments</comments>
		<pubDate>Mon, 09 Aug 2010 18:20:19 +0000</pubDate>
		<dc:creator>Daniele Occhipinti</dc:creator>
				<category><![CDATA[Debian / Ubuntu / Kubuntu]]></category>

		<guid isPermaLink="false">http://www.danieleocchipinti.com/blog-linux-php-lamp-web/?p=297</guid>
		<description><![CDATA[Don&#8217;t use the Ubuntu Netbook Remix but the Desktop version. To fix the monitor resolution: https://wiki.ubuntu.com/HardwareSupportComponentsVideoCardsPoulsbo/ Wi-fi should work out of the box]]></description>
			<content:encoded><![CDATA[<p>Don&#8217;t use the Ubuntu Netbook Remix but the Desktop version.</p>
<p>To fix the monitor resolution:</p>
<p>https://wiki.ubuntu.com/HardwareSupportComponentsVideoCardsPoulsbo/</p>
<p>Wi-fi should work out of the box</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danieleocchipinti.com/blog-linux-php-lamp-web/linux/debian-ubuntu-kubuntu/ubuntu-linux-on-acer-aspire-ao751h/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

