<?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>gEt DoWn ToNiGhT &#187; Software</title>
	<atom:link href="http://www.getdowntonight.co.uk/category/science-technology/software/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.getdowntonight.co.uk</link>
	<description>amusingly digressive progressive discussions</description>
	<lastBuildDate>Mon, 05 Dec 2011 22:41:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Slow and Locked MySQL Queries</title>
		<link>http://www.getdowntonight.co.uk/2010/12/slow-and-locked-mysql-queries/</link>
		<comments>http://www.getdowntonight.co.uk/2010/12/slow-and-locked-mysql-queries/#comments</comments>
		<pubDate>Fri, 17 Dec 2010 17:08:59 +0000</pubDate>
		<dc:creator>Sam</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Science and Tech]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[cpu]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[load]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[upgrade]]></category>

		<guid isPermaLink="false">http://www.getdowntonight.co.uk/?p=498</guid>
		<description><![CDATA[One of our clients&#8217; servers recently saw a huge drop in speed. None of the hardware had been changed, and while the total number of users has been steadily increasing for the last few years, it has not seen any kind of spike that I thought might cause this type of problem. In order to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.getdowntonight.co.uk/wp-content/mysql2.png"><img class="alignright size-thumbnail wp-image-394 colorbox-498" title="mysql2" src="http://www.getdowntonight.co.uk/wp-content/mysql2-150x150.png" alt="" width="90" height="90" /></a>One of our clients&#8217; servers recently saw a huge drop in speed. None of the hardware had been changed, and while the total number of users has been steadily increasing for the last few years, it has not seen any kind of spike that I thought might cause this type of problem.</p>
<p>In order to try to find the fault or problem, I had to look in many different places and discovered a lot about Linux and MySQL. I enjoy these fact finding missions, even though there are always a lot of dead ends.</p>
<p>I thought I would use this blog as a place to write down all the areas that are worth checking, in case anyone else finds themselves in this situation.</p>
<p>Things to check:</p>
<ul>
<li>The Process List</li>
<li>MySQL Slow Query Log</li>
<li>Server free disk space</li>
<li>Server memory usage</li>
<li>Server load</li>
<li>Your queries</li>
<li>Your indexes</li>
</ul>
<p>Our server was running on Linux Centos 3, and many of the commands below are Linux only. For executing the MySQL commands and queries I suggest getting something like WebYog&#8217;s excellent<a href="http://www.webyog.com/en/downloads.php" target="_blank"> SQLYog</a>, or using MySQL&#8217;s own <a href="http://dev.mysql.com/downloads/workbench/5.2.html" target="_blank">MySQL Workbench</a>.</p>
<p><strong>Listing active MySQL queries<br />
</strong></p>
<p>MySQL contains the ability to show a list of currently running queries. From within MySQL &#8211; execute the following query:</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">SHOW</span> PROCESSLIST<span style="color: #000033;">;</span></pre></div></div>

<p>This will show a list that details which users, hosts, databases are being used to execute queries &#8211; how long they have been going for, and what state they are in. Look for queries that have been running for a long time, or have the state of &#8216;locked&#8217;. For more information <a href="http://dev.mysql.com/doc/refman/5.5/en/show-processlist.html" target="_blank">see here</a>.</p>
<p><strong>Breaking down your queries</strong></p>
<p>It is crucial that you enable slow query logging and it is quite simple to set up. Edit your my.cnf file, and make sure the following is present:</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">log-slow-queries = /var/log/mysql/mysql-slow.log
long_query_time = 3</pre></div></div>

<p>(Adjust the log_query_time setting to suit the length of the query you are trying to detect)</p>
<p>Once this is in place, restart the MySQL server and start checking the new log file.</p>
<p>The MySQL command <a href="http://dev.mysql.com/doc/refman/5.1/en/using-explain.html" target="_blank">EXPLAIN</a> allows you to see a breakdown of the steps taken by MySQL to get your query results, including information about joins and the sequence of queries called. You can use the information it outputs to help optimise your own queries.</p>
<p>The utility is easy to use. Simply prefix your SELECT statement with the word EXPLAIN. eg.</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">EXPLAIN</span>
<span style="color: #990099; font-weight: bold;">SELECT</span> userName<span style="color: #000033;">,</span> firstName<span style="color: #000033;">,</span> lastName
<span style="color: #990099; font-weight: bold;">FROM</span> users
<span style="color: #990099; font-weight: bold;">WHERE</span> firstName <span style="color: #CC0099; font-weight: bold;">LIKE</span> <span style="color: #008000;">'da<span style="color: #008080; font-weight: bold;">%</span>'</span><span style="color: #000033;">;</span></pre></div></div>

<p><strong>top</strong><a href="http://www.getdowntonight.co.uk/wp-content/Screen-shot-2010-12-17-at-16.53.07.png"><img class="alignright size-thumbnail wp-image-499 colorbox-498" title="Output from the Linux top command" src="http://www.getdowntonight.co.uk/wp-content/Screen-shot-2010-12-17-at-16.53.07-150x150.png" alt="" width="150" height="150" /></a></p>
<p>This command shows you a list of applications and services running on the machine, along with some basic information about the resources they are using.</p>
<p>From here you can see the system load, free memory and the % of CPU for each process.</p>
<p>To quit and return to the shell, use CTRL+C.</p>
<p><strong>df -h</strong></p>
<p>This will show you how much free space is on your mounted drives, in human readable form.</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">[sam@webserver1 /]$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/md1              9.8G  3.9G  5.9G  40% /
none                 1014M     0 1014M   0% /dev/shm
/dev/md2               57G   31G   27G  54% /disk1</pre></div></div>

<p><strong>tail</strong></p>
<p>This is a quick way of looking at the last few lines of a log file. The following will show you the last 10 lines of the mysql log.</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">tail /var/log/mysql.log</pre></div></div>

<p>You can also specify that you want to view a specific number of lines by using the -n parameter. eg.</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">tail -n 50 /var/log/mysql.log</pre></div></div>

<p>Eventually, after going through lots of checking and tests, we discovered that the server was simply at capacity. It hadn&#8217;t been upgraded for 8 years and the number of users had quadrupled during that time &#8211; with users from 2 other continents now logging on regularly. The database was on the same hardware as the web-server software and the system was just becoming overloaded.</p>
<p>We managed to speed things up considerably before we were forced to upgrade, mostly by examining the slow-query-log and adding indexes where appropriate. Also, many of our queries were refined and tidied up &#8211; so we were definitely not wasting our time running the examinations. It has made me realise that it is probably worth going back over old code every now and then to check for potential improvements &#8211; something we only tend to do if there is a client requirement, or an OS upgrade required.</p>
<p>We have now performed a complete upgrade to the latest hardware available, with 8GB of memory, more CPU cores than I suspect are really needed, the latest Centos 5 OS and all the most recent MySQL/Apache and PHP versions &#8211; which has made the system run incredibly quickly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.getdowntonight.co.uk/2010/12/slow-and-locked-mysql-queries/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using the database from inside a helper (CodeIgniter)</title>
		<link>http://www.getdowntonight.co.uk/2010/06/using-the-database-from-inside-a-helper-codeigniter/</link>
		<comments>http://www.getdowntonight.co.uk/2010/06/using-the-database-from-inside-a-helper-codeigniter/#comments</comments>
		<pubDate>Thu, 17 Jun 2010 09:06:17 +0000</pubDate>
		<dc:creator>Sam</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[functions]]></category>
		<category><![CDATA[helper]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.getdowntonight.co.uk/?p=468</guid>
		<description><![CDATA[I have some custom functions that I store in a helper in CodeIgniter. Some of those functions need to use the database, and to do so you have to explicitly tell the function to load the Code Igniter framework and database class. Its pretty simple when you know how, but it took quite a while [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright colorbox-468" title="CodeIgniter Logo" src="http://herloct.files.wordpress.com/2009/05/ci_logo_flame.jpg" alt="" width="90" height="98" />I have some custom functions that I store in a helper in CodeIgniter. </p>
<p>Some of those functions need to use the database, and to do so you have to explicitly tell the function to load the Code Igniter framework and database class.</p>
<p>Its pretty simple when you know how, but it took quite a while to work it out.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> get_user_full_name<span style="color: #009900;">&#40;</span><span style="color: #000088;">$userId</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">//the database functions can not be called from within the helper</span>
    <span style="color: #666666; font-style: italic;">//so we have to explicitly load the functions we need in to an object</span>
    <span style="color: #666666; font-style: italic;">//that I will call ci. then we use that to access the regular stuff.</span>
    <span style="color: #000088;">$ci</span><span style="color: #339933;">=&amp;</span> get_instance<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$ci</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">database</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;">//select the required fields from the database</span>
    <span style="color: #000088;">$ci</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">select</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'firstName, lastName'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">//tell the db class the criteria</span>
    <span style="color: #000088;">$ci</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">where</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'userId'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$userId</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">//supply the table name and get the data</span>
    <span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$ci</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'user'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">//ensure that there is something in the variable - in case of no match</span>
    <span style="color: #000088;">$fullName</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">result</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">//get the full name by concatinating the first and last names</span>
        <span style="color: #000088;">$fullName</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">firstName</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot; &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">lastName</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">endforeach</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// return the full name;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$fullName</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.getdowntonight.co.uk/2010/06/using-the-database-from-inside-a-helper-codeigniter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Eclipse as a PHP IDE in Ubuntu 9.10</title>
		<link>http://www.getdowntonight.co.uk/2009/11/using-eclipse-as-a-php-ide-in-ubuntu-9-10/</link>
		<comments>http://www.getdowntonight.co.uk/2009/11/using-eclipse-as-a-php-ide-in-ubuntu-9-10/#comments</comments>
		<pubDate>Wed, 25 Nov 2009 17:05:40 +0000</pubDate>
		<dc:creator>Sam</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[ide]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.getdowntonight.co.uk/?p=405</guid>
		<description><![CDATA[This is actually much easier than any of the guides I found online make out. Firstly, install Eclipse from the repositories. Then open it up, select your default workspace (if you havent already) and then: From the Help menu, select &#8220;Install new software&#8221;. Click the &#8220;Add&#8221; button and add the following: Name: Eclipse Updates (Galileo) [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright colorbox-405" src="http://wwwbruegge.informatik.tu-muenchen.de/twiki/pub/Lehrstuhl/SysiphusGoesEclipse/eclipse.png" alt="" width="90" height="90" />This is actually much easier than any of the guides I found online make out.</p>
<p>Firstly, install <strong>Eclipse</strong> from the repositories. Then open it up, select your default workspace (if you havent already) and then:</p>
<ol>
<li>From the Help menu, select &#8220;Install new software&#8221;.</li>
<li>Click the &#8220;Add&#8221; button and add the following:
<ol></ol>
<ul>
<li><strong>Name</strong>: Eclipse Updates (Galileo)</li>
<li><strong>Location</strong>: http://download.eclipse.org/releases/galileo/</li>
</ul>
<ol></ol>
</li>
<li>Apply your changes and wait for the contents to download.</li>
<li>When all is ready, select your new source from the drop down and look for the &#8220;Programming languages&#8221; section.</li>
<li>Open it up and add the &#8220;PHP Development Tools (PDT) SDK Feature&#8221;.</li>
<li>Step through using Next and Finish etc, and after a few moments downloading and installing you now have a PHP ready IDE.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.getdowntonight.co.uk/2009/11/using-eclipse-as-a-php-ide-in-ubuntu-9-10/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Loading JSON data &#8211; the EASY way!</title>
		<link>http://www.getdowntonight.co.uk/2009/11/loading-json-data-the-easy-way/</link>
		<comments>http://www.getdowntonight.co.uk/2009/11/loading-json-data-the-easy-way/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 12:22:04 +0000</pubDate>
		<dc:creator>Sam</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[web design]]></category>

		<guid isPermaLink="false">http://www.getdowntonight.co.uk/?p=398</guid>
		<description><![CDATA[A few weeks ago I wrote a blog post about using jQuery and JSON to automatically load data from a JSON file in to name-matched controls on an HTML page. It is only now that I realise quite how powerful this is! The great thing about it is that you do not have to edit [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-403 colorbox-398" title="json160" src="http://www.getdowntonight.co.uk/wp-content/json160.gif" alt="json160" width="96" height="96" />A few weeks ago I wrote a blog post about using jQuery and JSON to automatically load data from a JSON file in to name-matched controls on an HTML page.</p>
<p><strong>It is only now that I realise quite how powerful this is!</strong></p>
<p>The great thing about it is that you do not have to edit your data-load function if you add a new field to the database. Because the jQuery function loops through all the fields in the JSON data, it will automatically insert the values in to the correct fields, providing those fields are named the same as the html form controls.</p>
<p>Here is the code again for those who dont want to check back.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$.<span style="color: #660066;">getJSON</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;/yourJson.js, function(myJson){
	$.each(myJson.rows, function(i,item) {
		 for (prop in item) {
		 	 $('#' + prop).val(item[prop]);
		 }
	});
});</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.getdowntonight.co.uk/2009/11/loading-json-data-the-easy-way/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Installing MyODBC 3.51 on Windows 7 x64</title>
		<link>http://www.getdowntonight.co.uk/2009/11/installing-myodbc-3-51-on-windows-7-x64/</link>
		<comments>http://www.getdowntonight.co.uk/2009/11/installing-myodbc-3-51-on-windows-7-x64/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 11:11:44 +0000</pubDate>
		<dc:creator>Sam</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[64 bit]]></category>
		<category><![CDATA[connector]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[myodbc]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[windows 7]]></category>

		<guid isPermaLink="false">http://www.getdowntonight.co.uk/?p=393</guid>
		<description><![CDATA[In order to get some of our 32 bit applications working on Windows 7 64 bit edition, we need to provide support for the MySQL 3.51 ODBC connector. This is actually quite simple to do, as long as you know what to look for. The ODBC manager that you are able to access from within [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-394 colorbox-393" title="mysql2" src="http://www.getdowntonight.co.uk/wp-content/mysql2.png" alt="mysql2" width="105" height="105" />In order to get some of our 32 bit applications working on Windows 7 64 bit edition, we need to provide support for the <a href="http://dev.mysql.com/downloads/connector/odbc/3.51.html" target="_blank">MySQL 3.51 ODBC</a> connector.</p>
<p>This is actually quite simple to do, as long as you know what to look for. The ODBC manager that you are able to access from within Windows is not going to work for you, but it turns out that Microsoft provide a 32 bit manager that will.</p>
<p>To use this manager, run the following command:</p>
<p><strong>c:\windows\syswow64\odbcad32.exe</strong></p>
<p>Please note that it is not good enough to just type odbcad32.exe, as there is another file in the path with the same file name (great work MS!). However, once you have opened this application up, it works in the exact same way as if you were running XP.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.getdowntonight.co.uk/2009/11/installing-myodbc-3-51-on-windows-7-x64/feed/</wfw:commentRss>
		<slash:comments>39</slash:comments>
		</item>
		<item>
		<title>Setting up a basic web server using Ubuntu 9.10 (Desktop)</title>
		<link>http://www.getdowntonight.co.uk/2009/11/setting-up-a-basic-web-server-using-ubuntu-9-10-desktop/</link>
		<comments>http://www.getdowntonight.co.uk/2009/11/setting-up-a-basic-web-server-using-ubuntu-9-10-desktop/#comments</comments>
		<pubDate>Thu, 12 Nov 2009 17:14:08 +0000</pubDate>
		<dc:creator>Sam</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[web server]]></category>
		<category><![CDATA[webserver]]></category>

		<guid isPermaLink="false">http://www.getdowntonight.co.uk/?p=366</guid>
		<description><![CDATA[I have been using Ubuntu 9.10 for a while and wanted to see how it performs as a web server. The GUI interface is very slick and it is an ideal OS for beginners and advanced users alike. I suspect that many people will want to use it as the basis for their webservers. I [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-medium wp-image-390 colorbox-366" title="Ubuntu Logo" src="http://www.getdowntonight.co.uk/wp-content/jaustin_saturated_full_logo_021_trans-300x88.png" alt="Ubuntu Logo" width="180" height="53" />I have been using Ubuntu 9.10 for a while and wanted to see how it performs as a web server. The GUI interface is very slick and it is an ideal OS for beginners and advanced users alike. I suspect that many people will want to use it as the basis for their webservers.</p>
<p>I suggest creating a virtual machine with something like VirtualBox for this. It is much more flexible that way, and you can move it to a more powerful machine if you decide you need to.</p>
<p><strong>Phase 1. Install required applications:</strong></p>
<ol>
<li>Open &#8216;Synaptic package manager&#8217; from the System/Administration menu.</li>
<li>Click the &#8216;Search&#8217; button.</li>
<li>Enter &#8216;Apache&#8217; and press return.</li>
<li>You will see an item called &#8216;Apache2&#8242; in the list of results. Click the box to the left to mark it as something you want to install.</li>
<li>Repeat this process for:
<ul>
<li>Php5</li>
<li>MySql</li>
<li>Php5-mysql</li>
</ul>
</li>
<li>Click the &#8216;Apply&#8217; button on the toolbar.</li>
<li>This will start the installation process, during which you will be prompted to provide a password for the MySQL root account. Supply a strong password and make sure you do not forget it.</li>
<li><img class="alignright size-medium wp-image-374 colorbox-366" title="It worked!" src="http://www.getdowntonight.co.uk/wp-content/Screenshot-WebServer-1-Ubuntu-9.10-Running-VirtualBox-OSE-1-300x227.png" alt="It worked!" width="180" height="136" />When everything has finished installing, I suggest rebooting. There are ways of starting the servers without rebooting, but a reboot works just as well and is much easier.</li>
<li>After you have logged back in to Ubuntu, open up Firefox and visit http://localhost.</li>
<li>You should see a page that says &#8220;It works!&#8221; which means that your webserver is now working.</li>
</ol>
<p><strong>Phase 2: Configure Virtual Hosts</strong> (So you can have more than one site on your server)</p>
<p>I have chosen to use the command line to do much of this phase rather than the GUI. For me, it is much easier to access protected system files from the shell rather than use a GUI. However, should you want to use a GUI, you will need to be running with root privileges. You can do this by entering: <strong>sudo nautilus</strong> in to a command line (and enter your password). However, the instructions below are for using the shell.</p>
<p><em>Any time you see the <strong>sudo</strong> command, that means that you will run the command as root (administrator). Linux is much more secure than Windows thanks to it being locked down by default with a standard set of permissions. It might seem like hassle to keep having to switch to be administrator but it makes things much safer. Deal with it!</em></p>
<ol>
<li>Open a new Terminal from Applications / Accessories in the menus.</li>
<li>In the terminal, enter the following commands and review the results so you know what you are doing.</li>
<li><strong>cd /etc/apache2/sites-enabled</strong> (<em>this moves you to the folder where you can define different websites</em>)</li>
<li><strong>ls</strong> (<em>lower case LS: this will show you a list of files</em>)</li>
<li><strong>sudo cp 000-default 001-mysite</strong> (<em>this will copy the default config file so you can use it as the basis for your new site</em>)</li>
<li>Enter your password when prompted (<em>this should only happen once, but if you are prompted again &#8211; just re-enter it</em>)</li>
<li><strong>sudo gedit 001-mysite</strong> (<em>this will use the gedit text editor to open and allow you to edit the new site config file</em>)</li>
<li>Change the <strong>ServerAdmin</strong> row to use your email address. ie. <strong>ServerAdmin sam@mysite.net</strong></li>
<li>Add a row below with the tag: <strong>ServerName</strong> followed by the name of your site. I will continue to use <strong>mysite.local</strong> throughout. ie. <strong>ServerName mysite.local</strong></li>
<li>Edit the row <strong>DocumentRoot</strong> so that the new path is a sub-folder of www called 001-mysite. ie. <strong>/var/www/001-mysite</strong></li>
<li>Edit the row <strong>&lt;Directory&#8230;&gt;</strong> so that the new path is also used. ie. <strong>&lt;Directory /var/www/001-mysite&gt;</strong></li>
<li>Save the file and closed GEdit.</li>
<li><img class="alignright size-medium wp-image-385 colorbox-366" title="A working PHP virtual host" src="http://www.getdowntonight.co.uk/wp-content/Screenshot-WebServer-1-Ubuntu-9.10-Running-VirtualBox-OSE-2-300x227.png" alt="A working PHP virtual host" width="180" height="136" />We now need to let your computer know that it IS mysite.local. The easiest way to do this is to edit your <strong>hosts</strong> file. There is plenty of information <a href="http://en.wikipedia.org/wiki/Hosts_file" target="_blank">online</a> about what this file does.</li>
<li>From the terminal, type: <strong>sudo gedit /etc/hosts</strong></li>
<li>Add a new row below <strong>127.0.0.1    localhost</strong> that reads: <strong>127.0.0.1     mysite.local</strong> (spaces are tabs)<strong>.<br />
</strong></li>
<li>Save the file and close GEdit.</li>
<li>Now we need to create the file structure for where the sites files will live.</li>
<li>Enter: <strong>sudo mkdir /var/www/001-mysite</strong> (this will create a new folder that will store your php/html files etc)<strong><br />
</strong></li>
<li><strong>cd /var/www/001-mysite<br />
</strong></li>
<li><strong>sudo gedit index.php</strong> (this will open the text editor again and will allow you to create the index page for your site).</li>
<li>In the text editor, enter the following bold text (including all the punctuation): <strong>&lt;?php phpinfo(); ?&gt;</strong></li>
<li>Save the file and close.</li>
<li><strong>sudo /etc/init.d/apache2 restart</strong> (this restarts the Apache service so that the new virtual host is available)<strong><br />
</strong></li>
<li>Now open firefox and visit your new site: http://mysite.local</li>
<li>You should see a whole load of information about your server, and more specifically about your PHP installation.</li>
<li>Thats it! Repeat this phase to add as many virtual hosts as you like.</li>
</ol>
<p>You will now almost certainly want to secure your server. If you have got this far then you can at least get your site(s) up and running on your local machine. Ill cover securing your server in another post.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.getdowntonight.co.uk/2009/11/setting-up-a-basic-web-server-using-ubuntu-9-10-desktop/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>HAR panel discussing copyright and file sharing</title>
		<link>http://www.getdowntonight.co.uk/2009/08/har-panel-discussing-copyright-and-file-sharing/</link>
		<comments>http://www.getdowntonight.co.uk/2009/08/har-panel-discussing-copyright-and-file-sharing/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 09:11:48 +0000</pubDate>
		<dc:creator>Sam</dc:creator>
				<category><![CDATA[Politics]]></category>
		<category><![CDATA[Science and Tech]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[copyright]]></category>
		<category><![CDATA[HAR]]></category>
		<category><![CDATA[patent]]></category>
		<category><![CDATA[pirate bay]]></category>

		<guid isPermaLink="false">http://www.getdowntonight.co.uk/?p=336</guid>
		<description><![CDATA[An interesting discussion about file sharing for those interested in DRM, copyright and patents. Most people agree that the business model based around copyright no longer works in the digital age. The question is, what other options do we have, and how many people are going to get sued along the way? HAR panel from [...]]]></description>
			<content:encoded><![CDATA[<p>An interesting discussion about file sharing for those interested in DRM, copyright and patents. Most people agree that the business model based around copyright no longer works in the digital age. The question is, what other options do we have, and how many people are going to get sued along the way?</p>
<p><object width="400" height="320"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=6128124&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=6128124&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="320"></embed></object>
<p><a href="http://vimeo.com/6128124">HAR panel</a> from <a href="http://vimeo.com/user2174020">TorrentFreak</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p><em></em></p>
<p>For information about HAR (Hacking at random) please see their website: <a href="https://wiki.har2009.org/">https://wiki.har2009.org/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.getdowntonight.co.uk/2009/08/har-panel-discussing-copyright-and-file-sharing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Voice. One number. Free. Forever?</title>
		<link>http://www.getdowntonight.co.uk/2009/07/google-voice-one-number-free-forever/</link>
		<comments>http://www.getdowntonight.co.uk/2009/07/google-voice-one-number-free-forever/#comments</comments>
		<pubDate>Tue, 28 Jul 2009 06:29:58 +0000</pubDate>
		<dc:creator>Sam</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[talk]]></category>
		<category><![CDATA[voice]]></category>

		<guid isPermaLink="false">http://www.getdowntonight.co.uk/?p=245</guid>
		<description><![CDATA[Google have launched a new service called &#8220;Google Voice&#8221; which is basically an application for your PC or your mobile which works via the internet connection, that then behaves like a telephone. They supply you with a new phone number, for free, and then you add all of your own phone numbers to it. If [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-249 colorbox-245" title="googlevoice" src="http://www.getdowntonight.co.uk/wp-content/googlevoice.JPG" alt="googlevoice" width="123" height="119" /></p>
<p>Google have launched a new service called &#8220;Google Voice&#8221; which is basically an application for your PC or your mobile which works via the internet connection, that then behaves like a telephone.</p>
<p>They supply you with a new phone number, for free, and then you add all of your own phone numbers to it. If someone calls your Google phone number &#8211; all of your phones will ring. This means that you will only ever need to give out that one number ever again! This is very useful, especially if you work internationally, as a freelancer or change mobiles often.</p>
<p>The service is only available at the moment go Google GrandCentral users, but should be launching soon to the general public.</p>
<p>The only reason I even heard about this service is that Apple have now blocked the sale of the Google Voice application from their iPhone&#8217;s App store, claiming the reason: &#8220;<em>it duplicates functionality available with the iPhone</em>&#8221; &#8211; which surely translates as: &#8220;<em>Our partners such as O2 and AT&amp;T will be forced to do something about their prices and they really dont like it</em>&#8220;&#8230;</p>
<blockquote><p>Google Voice is a service that gives you one number for all your phones, voicemail that is easy as email, and many enhanced calling features like call blocking and screening, voicemail transcripts, call conferencing, international calls, and more.</p>
<p>Google Voice is currently available for GrandCentral users only, but will be open to new users soon. In the meantime, please <a href="https://services.google.com/fb/forms/googlevoiceinvite/" target="_blank">leave us your email address </a> and we&#8217;ll notify you as soon as Google Voice becomes available. To learn more about Google Voice, check out our <a href="https://www.google.com/voice/about" target="_blank">feature videos</a>.</p></blockquote>
<p>Im sure there are probably a few problems with the software at the moment, but knowing Google they will work at it until they have an unrivaled service, just like with their Search tool and Apps. Not sure how they will pay for this, but I heard a roumor that they may eventually play adds during calls?</p>
<p>I&#8217;m looking forward to trying it out.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.getdowntonight.co.uk/2009/07/google-voice-one-number-free-forever/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Writing a component for Joomla!</title>
		<link>http://www.getdowntonight.co.uk/2009/07/writing-a-component-for-joomla/</link>
		<comments>http://www.getdowntonight.co.uk/2009/07/writing-a-component-for-joomla/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 16:40:57 +0000</pubDate>
		<dc:creator>Sam</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[crm]]></category>
		<category><![CDATA[joomla]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.getdowntonight.co.uk/?p=242</guid>
		<description><![CDATA[Today, I have written my first component for the Jooma! CRM system. Following the tutorials on the developer.joomla.org website was actually very straight forward and I have been able to create a simple component of my own. I will be working on this over the next few days / weeks and will release it to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.joomla.org" target="_blank"><img class="alignright size-medium wp-image-243 colorbox-242" title="joomla_logo_horz_color_slogan" src="http://www.getdowntonight.co.uk/wp-content/joomla_logo_horz_color_slogan-300x76.png" alt="joomla_logo_horz_color_slogan" width="210" height="53" /></a>Today, I have written my first component for the <a href="http://www.joomla.org" target="_blank">Jooma!</a> CRM system.</p>
<p>Following the tutorials on the <a href="http://developer.joomla.org" target="_blank">developer.joomla.org</a> website was actually very straight forward and I have been able to create a simple component of my own. I will be working on this over the next few days / weeks and will release it to the open source community when its done.</p>
<p>For those who haven&#8217;t heard of Joomla!, it is a template based web content management system. Once you get the hang of things you can use it to create entire websites in no time at all. It comes with loads of built in functionality and best of all, you dont need to know how to do any programming. Its almost as easy to create a web page as it is to type an email.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.getdowntonight.co.uk/2009/07/writing-a-component-for-joomla/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Aptana on Ubuntu Linux 9.04</title>
		<link>http://www.getdowntonight.co.uk/2009/07/installing-aptana-on-ubuntu-linux-9-04/</link>
		<comments>http://www.getdowntonight.co.uk/2009/07/installing-aptana-on-ubuntu-linux-9-04/#comments</comments>
		<pubDate>Sun, 26 Jul 2009 13:13:52 +0000</pubDate>
		<dc:creator>Sam</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[aptana]]></category>
		<category><![CDATA[ide]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.getdowntonight.co.uk/?p=204</guid>
		<description><![CDATA[UPDATE: With the latest version of Aptana 2 and Ubuntu 9.10 it seems you dont need to do this hack anymore. Try it without first of all, then if you get problems &#8211; apply the fixes as described. I have been using the Aptana IDE for PHP and Ajax development for a while now on [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_217" class="wp-caption alignright" style="width: 110px"><img class="size-full wp-image-217 colorbox-204" title="aptana" src="http://www.getdowntonight.co.uk/wp-content/aptana.png" alt="aptana" width="100" height="101" /><p class="wp-caption-text">Aptana Studio IDE</p></div>
<p><strong>UPDATE: With the latest version of Aptana 2 and Ubuntu 9.10 it seems you dont need to do this hack anymore. Try it without first of all, then if you get problems &#8211; apply the fixes as described.</strong></p>
<p>I have been using the Aptana IDE for PHP and Ajax development for a while now on my Windows system, and have decided that it is much better than the standard Eclipse, at least for me. I wanted to start using it on my Linux machine but encountered problems which prevented it from running.</p>
<p>It took me a while to find out how to get it to work, but thanks to Google and <a href="http://forums.aptana.com/viewtopic.php?p=24711" target="_blank">some others who have had this problem before me</a>, I now have a working Aptana Studio on my Ubuntu system.</p>
<p>Here is how to get it working:</p>
<ol>
<li>Download and extract Aptana Studio for Linux (All in one) from <a href="http://www.aptana.com/studio/download" target="_blank">here</a>.</li>
<li>Use Synaptic to install <strong>xulrunner</strong> (version 1.8).</li>
<li>Use Synaptic to install a <strong>JRE</strong>.</li>
<li>Create a text file (in your home folder etc) which we will use to set up the Aptana environment and execute the application. Call it <strong>startAptana</strong>.</li>
<li>Paste the text from below in to the new text file, and be sure to change the bottom line so that it matches the <strong>path</strong> to your Aptana installation.</li>
<li>Make the <strong>startAptana</strong> file <strong>executable</strong>.</li>
<li>Double click the <strong>startAptana</strong> file to start using <strong>Aptana</strong>, or create menu icon that links to it.</li>
</ol>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
<span style="color: #007800;">MOZILLA_FIVE_HOME</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>xulrunner
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$LD_LIBRARY_PATH</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
   <span style="color: #007800;">LD_LIBRARY_PATH</span>=<span style="color: #007800;">$MOZILLA_FIVE_HOME</span>:<span style="color: #007800;">$LD_LIBRARY_PATH</span>
<span style="color: #000000; font-weight: bold;">else</span>
   <span style="color: #007800;">LD_LIBRARY_PATH</span>=<span style="color: #007800;">$MOZILLA_FIVE_HOME</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">export</span> MOZILLA_FIVE_HOME LD_LIBRARY_PATH
<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>sam<span style="color: #000000; font-weight: bold;">/</span>Apps<span style="color: #000000; font-weight: bold;">/</span>aptana<span style="color: #000000; font-weight: bold;">/</span>AptanaStudio</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.getdowntonight.co.uk/2009/07/installing-aptana-on-ubuntu-linux-9-04/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

