<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="http://www.dot-commers.co.uk/gadgets/Blog/templates/atom.xsl" ?><feed xmlns="http://www.w3.org/2005/Atom">
<link rel="self"  href="http://www.dot-commers.co.uk/data/xml/blog.atom" title="Dotcommers" />
<title  type="text" >Dotcommers</title>
	<author>
		<name>Peter Davies</name>
		<uri>http://www.dot-commers.co.uk</uri>
	</author>
<subtitle  type="text" >Development through daily challenge</subtitle>
<id>http://www.dot-commers.co.uk</id>
<generator>JAWS 0.7.2</generator>
<rights  type="text" >2007, Dotcommers</rights>
<updated>2007-06-26T11:05:32+01:00</updated>
<entry>
	<title  type="text" ><![CDATA[ Search Engine Friendly URL's and Joomla ]]></title>
	<link rel="alternate"  type="text/html"  href="http://www.dot-commers.co.uk/index.php/blog/show/Search-Engine-Friendly-URLs-and-Joomla.html" title="Search Engine Friendly URL's and Joomla" />
	<author>
		<name>Peter Davies</name>
		<uri>http://www.dot-commers.co.uk/admin.php</uri>
	</author>
	<id>http://www.dot-commers.co.uk/index.php/blog/show/Search-Engine-Friendly-URLs-and-Joomla.html</id>
	<updated>2007-06-26T11:05:32+01:00</updated>
	<published>2007-06-26T10:59:58+01:00</published>
	<summary  type="html" ><![CDATA[ 	<p>I discovered that certain components do not create or implement SEF links when using <strong>SEF_Advance</strong> (from <a href="http://www.Sakic.Net">Sakic.Net</a>).</p>
	<p>For example, the URL:
http://www.juicymedia.co.uk/option,com_virtuemart/page,shop.browse/category_id,1/Itemid,54/lang,en/</p>
	<p>So we need to make the links more friendly using the “Aliases” option under the SEF_Advance administrative area. After logging in select the component from the admin menu. A list should appear (or empty if its not been used before) and the system will allow you to add a new “alias” to any static URL.</p>
	<p>So, using the new tool I made: <a href="/tools/joomla_sef_resolver.php">See Tools Menu</a></p>
	<p>Paste in the none-SEF URL from the website and click the “Submit Query” button. This will generate a super-non-friendly URL which is required by the SEF_Advance alias management which looks like this:</p>
	<p>index.php?option=com_virtuemart&#038;page=shop.browse&#038;category_id=1&#038;Itemid=54&#038;lang=en</p>
	<p>This generated URL can then be pasted into the aliases URL followed by a description (friendly) url such as “catalogue/Land-Rover-Defender” which is then translated on the website (<em>NB: the text is converted to lowercase automatically</em>).</p>
	<p>For this example, this will need doing on each category within the Virtue Mart shopping cart system.</p>
 ]]></summary>
	<content  type="html" ><![CDATA[ 	<p>I discovered that certain components do not create or implement SEF links when using <strong>SEF_Advance</strong> (from <a href="http://www.Sakic.Net">Sakic.Net</a>).</p>
	<p>For example, the URL:
http://www.juicymedia.co.uk/option,com_virtuemart/page,shop.browse/category_id,1/Itemid,54/lang,en/</p>
	<p>So we need to make the links more friendly using the “Aliases” option under the SEF_Advance administrative area. After logging in select the component from the admin menu. A list should appear (or empty if its not been used before) and the system will allow you to add a new “alias” to any static URL.</p>
	<p>So, using the new tool I made: <a href="/tools/joomla_sef_resolver.php">See Tools Menu</a></p>
	<p>Paste in the none-SEF URL from the website and click the “Submit Query” button. This will generate a super-non-friendly URL which is required by the SEF_Advance alias management which looks like this:</p>
	<p>index.php?option=com_virtuemart&#038;page=shop.browse&#038;category_id=1&#038;Itemid=54&#038;lang=en</p>
	<p>This generated URL can then be pasted into the aliases URL followed by a description (friendly) url such as “catalogue/Land-Rover-Defender” which is then translated on the website (<em>NB: the text is converted to lowercase automatically</em>).</p>
	<p>For this example, this will need doing on each category within the Virtue Mart shopping cart system.</p>
 ]]></content>
		<category scheme="http://www.dot-commers.co.uk/index.php/blog/category/18.html" term="18" label="Joomla"/>
</entry>
<entry>
	<title  type="text" ><![CDATA[ MS Word "save as HTML" and HTML Purifier ]]></title>
	<link rel="alternate"  type="text/html"  href="http://www.dot-commers.co.uk/index.php/blog/show/MS-Word-save-as-HTML-and-HTML-Purifier.html" title="MS Word "save as HTML" and HTML Purifier" />
	<author>
		<name>Peter Davies</name>
		<uri>http://www.dot-commers.co.uk/admin.php</uri>
	</author>
	<id>http://www.dot-commers.co.uk/index.php/blog/show/MS-Word-save-as-HTML-and-HTML-Purifier.html</id>
	<updated>2007-06-23T14:10:27+01:00</updated>
	<published>2007-06-23T12:19:23+01:00</published>
	<summary  type="html" ><![CDATA[ 	<p>Whilst creating this website, I realised that the mechanisms in place for saving an Microsoft Word document as HTML (filtered webpage) and then importing the source into the Jaws CMS caused quite a few issues. For example, the supposedly "filtered" saved output from MS Word is far from filtered and is likely to destroy any existing formatting that had been created by the CMS.</p>
	<p>This got me thinking and through some simple code using a recently updated HTML Purifier, I managed to extract a filtered HTML document that was suitable for generating the articles you see on the right-hand side. Through the following code I have reduced the time it takes to convert a Word document to a fully formed XHTML document.</p>
	<p>The PHP code is based around the PHP5 version of HTML Purifier 2.0:</p>
	<div class="code"><div class="php">
<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_POST</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'q'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&#160; &#160; &#160; &#160; <span style="color: #0000ff;">$dirty_html</span> = <span style="color: #0000ff;">$_POST</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'q'</span><span style="color: #66cc66;">&#93;</span>;<br />
&#160; &#160; &#160; &#160; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>!<span style="color: #0000ff;">$dirty_html</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'You must write some HTML!'</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$config</span> = HTMLPurifier_Config::<span style="color: #006600;">createDefault</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$config</span>-&gt;<span style="color: #006600;">set</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Core'</span>, <span style="color: #ff0000;">'Encoding'</span>, <span style="color: #ff0000;">'ISO-8859-1'</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$config</span>-&gt;<span style="color: #006600;">set</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'HTML'</span>, <span style="color: #ff0000;">'Doctype'</span>, <span style="color: #ff0000;">'XHTML 1.0 Transitional'</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$config</span>-&gt;<span style="color: #006600;">set</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'HTML'</span>, <span style="color: #ff0000;">'TidyLevel'</span>, <span style="color: #ff0000;">'heavy'</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$config</span>-&gt;<span style="color: #006600;">set</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Core'</span>,<span style="color: #ff0000;">'AcceptFullDocuments'</span>,<span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$config</span>-&gt;<span style="color: #006600;">set</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'HTML'</span>, <span style="color: #ff0000;">'Allowed'</span>, <span style="color: #ff0000;">'a[href|title],em,p,blockquote,img'</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$purifier</span> = <span style="color: #000000; font-weight: bold;">new</span> HTMLPurifier<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$config</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$clean_html</span> = <span style="color: #0000ff;">$purifier</span>-&gt;<span style="color: #006600;">purify</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$dirty_html</span> <span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #0000ff;">$clean_html</span>;<br />
&#160; &#160; &#160; &#160; <span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span><br />
&#160;</div></div>
	<p>Access to the working demo will be available soon in a new "tools" area of the site. Of course the combination of PHP4 and PHP5 might prove interesting - maybe link to the development server might do <img src="http://www.dot-commers.co.uk/plugins/Emoticons/images/face-smile.png" border="0" alt="face-smile.png " width="16" height="16" /> 
</p>
 ]]></summary>
	<content  type="html" ><![CDATA[ 	<p>Whilst creating this website, I realised that the mechanisms in place for saving an Microsoft Word document as HTML (filtered webpage) and then importing the source into the Jaws CMS caused quite a few issues. For example, the supposedly "filtered" saved output from MS Word is far from filtered and is likely to destroy any existing formatting that had been created by the CMS.</p>
	<p>This got me thinking and through some simple code using a recently updated HTML Purifier, I managed to extract a filtered HTML document that was suitable for generating the articles you see on the right-hand side. Through the following code I have reduced the time it takes to convert a Word document to a fully formed XHTML document.</p>
	<p>The PHP code is based around the PHP5 version of HTML Purifier 2.0:</p>
	<div class="code"><div class="php">
<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_POST</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'q'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&#160; &#160; &#160; &#160; <span style="color: #0000ff;">$dirty_html</span> = <span style="color: #0000ff;">$_POST</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'q'</span><span style="color: #66cc66;">&#93;</span>;<br />
&#160; &#160; &#160; &#160; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>!<span style="color: #0000ff;">$dirty_html</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'You must write some HTML!'</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$config</span> = HTMLPurifier_Config::<span style="color: #006600;">createDefault</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$config</span>-&gt;<span style="color: #006600;">set</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Core'</span>, <span style="color: #ff0000;">'Encoding'</span>, <span style="color: #ff0000;">'ISO-8859-1'</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$config</span>-&gt;<span style="color: #006600;">set</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'HTML'</span>, <span style="color: #ff0000;">'Doctype'</span>, <span style="color: #ff0000;">'XHTML 1.0 Transitional'</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$config</span>-&gt;<span style="color: #006600;">set</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'HTML'</span>, <span style="color: #ff0000;">'TidyLevel'</span>, <span style="color: #ff0000;">'heavy'</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$config</span>-&gt;<span style="color: #006600;">set</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Core'</span>,<span style="color: #ff0000;">'AcceptFullDocuments'</span>,<span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$config</span>-&gt;<span style="color: #006600;">set</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'HTML'</span>, <span style="color: #ff0000;">'Allowed'</span>, <span style="color: #ff0000;">'a[href|title],em,p,blockquote,img'</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$purifier</span> = <span style="color: #000000; font-weight: bold;">new</span> HTMLPurifier<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$config</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #0000ff;">$clean_html</span> = <span style="color: #0000ff;">$purifier</span>-&gt;<span style="color: #006600;">purify</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$dirty_html</span> <span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #0000ff;">$clean_html</span>;<br />
&#160; &#160; &#160; &#160; <span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span><br />
&#160;</div></div>
	<p>Access to the working demo will be available soon in a new "tools" area of the site. Of course the combination of PHP4 and PHP5 might prove interesting - maybe link to the development server might do <img src="http://www.dot-commers.co.uk/plugins/Emoticons/images/face-smile.png" border="0" alt="face-smile.png " width="16" height="16" /> 
</p>
 ]]></content>
		<category scheme="http://www.dot-commers.co.uk/index.php/blog/category/2.html" term="2" label="PHP Programming"/>
</entry>
<entry>
	<title  type="text" ><![CDATA[ Joomla "Restricted Access" when accessing mambots ]]></title>
	<link rel="alternate"  type="text/html"  href="http://www.dot-commers.co.uk/index.php/blog/show/Joomla-Restricted-Access-when-accessing-mambots.html" title="Joomla "Restricted Access" when accessing mambots" />
	<author>
		<name>Peter Davies</name>
		<uri>http://www.dot-commers.co.uk/admin.php</uri>
	</author>
	<id>http://www.dot-commers.co.uk/index.php/blog/show/Joomla-Restricted-Access-when-accessing-mambots.html</id>
	<updated>2007-06-25T14:25:18+01:00</updated>
	<published>2007-06-20T10:29:14+01:00</published>
	<summary  type="html" ><![CDATA[ 	<p>If you have had an error popup whilst attempting to access mambots in Joomla its most likley that your running version 1.0.11?</p>
	<p>If so you will need to get an official fix from the Joomla forums (registration required but it's free):
<a href="http://forum.joomla.org/index.php/topic,89866.msg455550.html#msg455550">http://forum.joomla.org/index.php/topic,89866.msg455550.html#msg455550</a></p>
	<p>Then simply upload the fix from the zip file (the zip file is called admin.mambots.php.zip) to the directory on the server containing the old file:</p>
	<p>/administrator/components/com_mambots</p>
	<p>This should fix the issue - Or simply upgrade to the latest version (1.0.12 at the time of writing).
</p>
 ]]></summary>
	<content  type="html" ><![CDATA[ 	<p>If you have had an error popup whilst attempting to access mambots in Joomla its most likley that your running version 1.0.11?</p>
	<p>If so you will need to get an official fix from the Joomla forums (registration required but it's free):
<a href="http://forum.joomla.org/index.php/topic,89866.msg455550.html#msg455550">http://forum.joomla.org/index.php/topic,89866.msg455550.html#msg455550</a></p>
	<p>Then simply upload the fix from the zip file (the zip file is called admin.mambots.php.zip) to the directory on the server containing the old file:</p>
	<p>/administrator/components/com_mambots</p>
	<p>This should fix the issue - Or simply upgrade to the latest version (1.0.12 at the time of writing).
</p>
 ]]></content>
		<category scheme="http://www.dot-commers.co.uk/index.php/blog/category/18.html" term="18" label="Joomla"/>
</entry>
<entry>
	<title  type="text" ><![CDATA[ Launching IE7 without extensions ]]></title>
	<link rel="alternate"  type="text/html"  href="http://www.dot-commers.co.uk/index.php/blog/show/Launching-IE7-without-extensions-1.html" title="Launching IE7 without extensions" />
	<author>
		<name>Peter Davies</name>
		<uri>http://www.dot-commers.co.uk/admin.php</uri>
	</author>
	<id>http://www.dot-commers.co.uk/index.php/blog/show/Launching-IE7-without-extensions-1.html</id>
	<updated>2007-06-20T10:26:37+01:00</updated>
	<published>2007-06-20T10:16:19+01:00</published>
	<summary  type="html" ><![CDATA[ 	<p>I recently had an issue with IE7 and I found a suggestion on Google by a MS Developer working on the tab system. His suggestion was to try IE7 without the extensions loaded. Well, luckily this worked allowing me to identify that on my machine the Epson laser printer toolbar was at fault.</p>
	<p>The command was: "iexplore.exe -extoff"
</p>
 ]]></summary>
	<content  type="html" ><![CDATA[ 	<p>I recently had an issue with IE7 and I found a suggestion on Google by a MS Developer working on the tab system. His suggestion was to try IE7 without the extensions loaded. Well, luckily this worked allowing me to identify that on my machine the Epson laser printer toolbar was at fault.</p>
	<p>The command was: "iexplore.exe -extoff"
</p>
 ]]></content>
		<category scheme="http://www.dot-commers.co.uk/index.php/blog/category/10.html" term="10" label="Miscellaneous"/>
</entry>
<entry>
	<title  type="text" ><![CDATA[ MySQL timestamp format to human readable ]]></title>
	<link rel="alternate"  type="text/html"  href="http://www.dot-commers.co.uk/index.php/blog/show/MySQL-timestamp-format-to-human-readable.html" title="MySQL timestamp format to human readable" />
	<author>
		<name>Peter Davies</name>
		<uri>http://www.dot-commers.co.uk/admin.php</uri>
	</author>
	<id>http://www.dot-commers.co.uk/index.php/blog/show/MySQL-timestamp-format-to-human-readable.html</id>
	<updated>2007-06-18T11:21:07+01:00</updated>
	<published>2007-06-18T11:03:22+01:00</published>
	<summary  type="html" ><![CDATA[ 	<p>Ok, I have no idea where this originally came from but its been very useful the past few years for converting the standard "0000-00-00 00:00:00" format into something useable (and that the client accepts):</p>
	<div class="code"><div class="php">
<span style="color: #000000; font-weight: bold;">function</span> mysql_timestamp_to_human<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$dt</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&#160; &#160; &#160;<span style="color: #0000ff;">$yr</span>=<a href="http://www.php.net/strval"><span style="color: #000066;">strval</span></a><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/substr"><span style="color: #000066;">substr</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$dt</span>,<span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">4</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160;<span style="color: #0000ff;">$mo</span>=<a href="http://www.php.net/strval"><span style="color: #000066;">strval</span></a><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/substr"><span style="color: #000066;">substr</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$dt</span>,<span style="color: #cc66cc;">4</span>,<span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160;<span style="color: #0000ff;">$da</span>=<a href="http://www.php.net/strval"><span style="color: #000066;">strval</span></a><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/substr"><span style="color: #000066;">substr</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$dt</span>,<span style="color: #cc66cc;">6</span>,<span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160;<span style="color: #0000ff;">$hr</span>=<a href="http://www.php.net/strval"><span style="color: #000066;">strval</span></a><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/substr"><span style="color: #000066;">substr</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$dt</span>,<span style="color: #cc66cc;">8</span>,<span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160;<span style="color: #0000ff;">$mi</span>=<a href="http://www.php.net/strval"><span style="color: #000066;">strval</span></a><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/substr"><span style="color: #000066;">substr</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$dt</span>,<span style="color: #cc66cc;">10</span>,<span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160;<span style="color: #808080; font-style: italic;">//$se=strval(substr($dt,12,2));</span><br />
&#160; &#160; &#160; &#160; <br />
&#160; &#160; &#160;<span style="color: #b1b100;">return</span> <a href="http://www.php.net/date"><span style="color: #000066;">date</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"m/d/Y H:i"</span>, <a href="http://www.php.net/mktime"><span style="color: #000066;">mktime</span></a> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$hr</span>,<span style="color: #0000ff;">$mi</span>,<span style="color: #cc66cc;">0</span>,<span style="color: #0000ff;">$mo</span>,<span style="color: #0000ff;">$da</span>,<span style="color: #0000ff;">$yr</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #ff0000;">" GMT"</span>;<br />
<span style="color: #66cc66;">&#125;</span><br />
&#160;</div></div>
 ]]></summary>
	<content  type="html" ><![CDATA[ 	<p>Ok, I have no idea where this originally came from but its been very useful the past few years for converting the standard "0000-00-00 00:00:00" format into something useable (and that the client accepts):</p>
	<div class="code"><div class="php">
<span style="color: #000000; font-weight: bold;">function</span> mysql_timestamp_to_human<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$dt</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&#160; &#160; &#160;<span style="color: #0000ff;">$yr</span>=<a href="http://www.php.net/strval"><span style="color: #000066;">strval</span></a><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/substr"><span style="color: #000066;">substr</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$dt</span>,<span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">4</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160;<span style="color: #0000ff;">$mo</span>=<a href="http://www.php.net/strval"><span style="color: #000066;">strval</span></a><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/substr"><span style="color: #000066;">substr</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$dt</span>,<span style="color: #cc66cc;">4</span>,<span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160;<span style="color: #0000ff;">$da</span>=<a href="http://www.php.net/strval"><span style="color: #000066;">strval</span></a><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/substr"><span style="color: #000066;">substr</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$dt</span>,<span style="color: #cc66cc;">6</span>,<span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160;<span style="color: #0000ff;">$hr</span>=<a href="http://www.php.net/strval"><span style="color: #000066;">strval</span></a><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/substr"><span style="color: #000066;">substr</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$dt</span>,<span style="color: #cc66cc;">8</span>,<span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160;<span style="color: #0000ff;">$mi</span>=<a href="http://www.php.net/strval"><span style="color: #000066;">strval</span></a><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/substr"><span style="color: #000066;">substr</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$dt</span>,<span style="color: #cc66cc;">10</span>,<span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160;<span style="color: #808080; font-style: italic;">//$se=strval(substr($dt,12,2));</span><br />
&#160; &#160; &#160; &#160; <br />
&#160; &#160; &#160;<span style="color: #b1b100;">return</span> <a href="http://www.php.net/date"><span style="color: #000066;">date</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"m/d/Y H:i"</span>, <a href="http://www.php.net/mktime"><span style="color: #000066;">mktime</span></a> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$hr</span>,<span style="color: #0000ff;">$mi</span>,<span style="color: #cc66cc;">0</span>,<span style="color: #0000ff;">$mo</span>,<span style="color: #0000ff;">$da</span>,<span style="color: #0000ff;">$yr</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #ff0000;">" GMT"</span>;<br />
<span style="color: #66cc66;">&#125;</span><br />
&#160;</div></div>
 ]]></content>
		<category scheme="http://www.dot-commers.co.uk/index.php/blog/category/17.html" term="17" label="MySQL"/>
</entry>
<entry>
	<title  type="text" ><![CDATA[ Backbase Combobox + PHP ]]></title>
	<link rel="alternate"  type="text/html"  href="http://www.dot-commers.co.uk/index.php/blog/show/Backbase-Combobox--PHP.html" title="Backbase Combobox + PHP" />
	<author>
		<name>Peter Davies</name>
		<uri>http://www.dot-commers.co.uk/admin.php</uri>
	</author>
	<id>http://www.dot-commers.co.uk/index.php/blog/show/Backbase-Combobox--PHP.html</id>
	<updated>2007-06-18T10:57:06+01:00</updated>
	<published>2007-06-18T09:34:40+01:00</published>
	<summary  type="html" ><![CDATA[ 	<p>Whilst working various OpenSource projects I have created various functions for constructing Backbase (client edition) code through a simple PHP class (still in development).</p>
	<p>One of the most useful functions is combobox creation.
<div class="code"><div class="php">
public <span style="color: #000000; font-weight: bold;">function</span> combobox<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$name</span>, <span style="color: #0000ff;">$values_array</span>, <span style="color: #0000ff;">$default</span>=<span style="color: #000000; font-weight: bold;">null</span>, <span style="color: #0000ff;">$size</span>=<span style="color: #cc66cc;">300</span>, <span style="color: #0000ff;">$required</span>=<span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&#160; &#160; <span style="color: #0000ff;">$req_bxml</span> = <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$required</span><span style="color: #66cc66;">&#41;</span>? <span style="color: #ff0000;">" b:required=<span style="color: #000099; font-weight: bold;">\"</span>true<span style="color: #000099; font-weight: bold;">\"</span>"</span> : <span style="color: #ff0000;">""</span>;<br />
&#160; &#160; <span style="color: #0000ff;">$bxml</span>&#160; = <span style="color: #ff0000;">'&lt;b:combobox b:width=&quot;'</span>. <span style="color: #0000ff;">$size</span> .<span style="color: #ff0000;">'px&quot; b:name=&quot;'</span>. <span style="color: #0000ff;">$name</span> .<span style="color: #ff0000;">'&quot; b:text=&quot;'</span>. <span style="color: #0000ff;">$default</span> .<span style="color: #ff0000;">'&quot;'</span>. <span style="color: #0000ff;">$req_bxml</span> .<span style="color: #ff0000;">'&gt;'</span>;<br />
&#160; &#160; <span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$values_array</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$value</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&#160; &#160; &#160; &#160; <span style="color: #0000ff;">$bxml</span> .= <span style="color: #ff0000;">'&lt;b:combo-option b:value=&quot;'</span>. <span style="color: #0000ff;">$value</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'value'</span><span style="color: #66cc66;">&#93;</span> .<span style="color: #ff0000;">'&quot;&gt;'</span>. <span style="color: #0000ff;">$value</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'name'</span><span style="color: #66cc66;">&#93;</span> .<span style="color: #ff0000;">'&lt;/b:combo-option&gt;'</span>;<br />
&#160; &#160; <span style="color: #66cc66;">&#125;</span><br />
&#160; &#160; <span style="color: #0000ff;">$bxml</span> .= <span style="color: #ff0000;">'&lt;/b:combobox&gt;'</span>;<br />
&#160; &#160; <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">$bxml</span>;<br />
<span style="color: #66cc66;">&#125;</span><br />
&#160;</div></div>
	<p>With this code you simply pass it a name followed by an array of values. The other options allow you to define a "selected" value, then the size of the combobox and whether or not it is required. The required functionality is not yet implemented into the Backbase control so best ignore it for the time being.
</p>
 ]]></summary>
	<content  type="html" ><![CDATA[ 	<p>Whilst working various OpenSource projects I have created various functions for constructing Backbase (client edition) code through a simple PHP class (still in development).</p>
	<p>One of the most useful functions is combobox creation.
<div class="code"><div class="php">
public <span style="color: #000000; font-weight: bold;">function</span> combobox<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$name</span>, <span style="color: #0000ff;">$values_array</span>, <span style="color: #0000ff;">$default</span>=<span style="color: #000000; font-weight: bold;">null</span>, <span style="color: #0000ff;">$size</span>=<span style="color: #cc66cc;">300</span>, <span style="color: #0000ff;">$required</span>=<span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&#160; &#160; <span style="color: #0000ff;">$req_bxml</span> = <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$required</span><span style="color: #66cc66;">&#41;</span>? <span style="color: #ff0000;">" b:required=<span style="color: #000099; font-weight: bold;">\"</span>true<span style="color: #000099; font-weight: bold;">\"</span>"</span> : <span style="color: #ff0000;">""</span>;<br />
&#160; &#160; <span style="color: #0000ff;">$bxml</span>&#160; = <span style="color: #ff0000;">'&lt;b:combobox b:width=&quot;'</span>. <span style="color: #0000ff;">$size</span> .<span style="color: #ff0000;">'px&quot; b:name=&quot;'</span>. <span style="color: #0000ff;">$name</span> .<span style="color: #ff0000;">'&quot; b:text=&quot;'</span>. <span style="color: #0000ff;">$default</span> .<span style="color: #ff0000;">'&quot;'</span>. <span style="color: #0000ff;">$req_bxml</span> .<span style="color: #ff0000;">'&gt;'</span>;<br />
&#160; &#160; <span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$values_array</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$value</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&#160; &#160; &#160; &#160; <span style="color: #0000ff;">$bxml</span> .= <span style="color: #ff0000;">'&lt;b:combo-option b:value=&quot;'</span>. <span style="color: #0000ff;">$value</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'value'</span><span style="color: #66cc66;">&#93;</span> .<span style="color: #ff0000;">'&quot;&gt;'</span>. <span style="color: #0000ff;">$value</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'name'</span><span style="color: #66cc66;">&#93;</span> .<span style="color: #ff0000;">'&lt;/b:combo-option&gt;'</span>;<br />
&#160; &#160; <span style="color: #66cc66;">&#125;</span><br />
&#160; &#160; <span style="color: #0000ff;">$bxml</span> .= <span style="color: #ff0000;">'&lt;/b:combobox&gt;'</span>;<br />
&#160; &#160; <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">$bxml</span>;<br />
<span style="color: #66cc66;">&#125;</span><br />
&#160;</div></div>
	<p>With this code you simply pass it a name followed by an array of values. The other options allow you to define a "selected" value, then the size of the combobox and whether or not it is required. The required functionality is not yet implemented into the Backbase control so best ignore it for the time being.
</p>
 ]]></content>
		<category scheme="http://www.dot-commers.co.uk/index.php/blog/category/5.html" term="5" label="AJAX"/>
</entry>
<entry>
	<title  type="text" ><![CDATA[ very simple Linux backup ]]></title>
	<link rel="alternate"  type="text/html"  href="http://www.dot-commers.co.uk/index.php/blog/show/very-simple-Linux-backup.html" title="very simple Linux backup" />
	<author>
		<name>Peter Davies</name>
		<uri>http://www.dot-commers.co.uk/admin.php</uri>
	</author>
	<id>http://www.dot-commers.co.uk/index.php/blog/show/very-simple-Linux-backup.html</id>
	<updated>2007-06-18T01:11:10+01:00</updated>
	<published>2007-06-18T01:10:29+01:00</published>
	<summary  type="html" ><![CDATA[ 	<p>This script will simply copy a series of files, tar and then gzip the files:</p>
	<div class="code"><div class="bash">
<span style="color: #808080; font-style: italic;">#!/bin/sh</span><br />
<span style="color: #808080; font-style: italic;"># temporary backup script</span></p>
	<p><span style="color: #0000ff;">Back_Dir=</span><span style="color: #ff0000;">"/root/scripts/backups"</span> <br />
<span style="color: #0000ff;">Vhosts_Dir=</span><span style="color: #ff0000;">"/home/httpd/vhosts"</span>&#160; </p>
	<p><span style="color: #808080; font-style: italic;"># get the date for the filename.</span><br />
<span style="color: #0000ff;">shdate=</span>`date +%b%d%y`</p>
	<p><span style="color: #808080; font-style: italic;"># save our current directory location.</span><br />
<span style="color: #0000ff;">tmp_dir=</span><span style="color: #0000ff;">$PWD</span></p>
	<p><span style="color: #808080; font-style: italic;"># change to the Backup file directory.</span><br />
<span style="color: #000066;">cd</span> <span style="color: #0000ff;">$Back_Dir</span></p>
	<p><span style="color: #808080; font-style: italic;"># create a gzip compressed tar file of the webs directory.</span><br />
tar -czf <span style="color: #0000ff;">$<span style="color: #66cc66;">&#123;</span>shdate<span style="color: #66cc66;">&#125;</span></span>.bak.tar.gz <span style="color: #0000ff;">$Vhosts_Dir</span></p>
	<p><span style="color: #808080; font-style: italic;"># return to the previous working directory.</span><br />
<span style="color: #000066;">cd</span> <span style="color: #0000ff;">$tmp_dir</span><br />
&#160;</div></div>
	<p>It might help a few users!
</p>
 ]]></summary>
	<content  type="html" ><![CDATA[ 	<p>This script will simply copy a series of files, tar and then gzip the files:</p>
	<div class="code"><div class="bash">
<span style="color: #808080; font-style: italic;">#!/bin/sh</span><br />
<span style="color: #808080; font-style: italic;"># temporary backup script</span></p>
	<p><span style="color: #0000ff;">Back_Dir=</span><span style="color: #ff0000;">"/root/scripts/backups"</span> <br />
<span style="color: #0000ff;">Vhosts_Dir=</span><span style="color: #ff0000;">"/home/httpd/vhosts"</span>&#160; </p>
	<p><span style="color: #808080; font-style: italic;"># get the date for the filename.</span><br />
<span style="color: #0000ff;">shdate=</span>`date +%b%d%y`</p>
	<p><span style="color: #808080; font-style: italic;"># save our current directory location.</span><br />
<span style="color: #0000ff;">tmp_dir=</span><span style="color: #0000ff;">$PWD</span></p>
	<p><span style="color: #808080; font-style: italic;"># change to the Backup file directory.</span><br />
<span style="color: #000066;">cd</span> <span style="color: #0000ff;">$Back_Dir</span></p>
	<p><span style="color: #808080; font-style: italic;"># create a gzip compressed tar file of the webs directory.</span><br />
tar -czf <span style="color: #0000ff;">$<span style="color: #66cc66;">&#123;</span>shdate<span style="color: #66cc66;">&#125;</span></span>.bak.tar.gz <span style="color: #0000ff;">$Vhosts_Dir</span></p>
	<p><span style="color: #808080; font-style: italic;"># return to the previous working directory.</span><br />
<span style="color: #000066;">cd</span> <span style="color: #0000ff;">$tmp_dir</span><br />
&#160;</div></div>
	<p>It might help a few users!
</p>
 ]]></content>
		<category scheme="http://www.dot-commers.co.uk/index.php/blog/category/16.html" term="16" label="Linux Backups"/>
</entry>
<entry>
	<title  type="text" ><![CDATA[ Optimise (optimize) MySQL databases ]]></title>
	<link rel="alternate"  type="text/html"  href="http://www.dot-commers.co.uk/index.php/blog/show/Optimise-optimize-MySQL-databases.html" title="Optimise (optimize) MySQL databases" />
	<author>
		<name>Peter Davies</name>
		<uri>http://www.dot-commers.co.uk/admin.php</uri>
	</author>
	<id>http://www.dot-commers.co.uk/index.php/blog/show/Optimise-optimize-MySQL-databases.html</id>
	<updated>2007-06-18T01:06:40+01:00</updated>
	<published>2007-06-18T01:03:05+01:00</published>
	<summary  type="html" ><![CDATA[ 	<p>Here is a simple script for optimizing MySQL table. You will need to set the username and password for a user with "admin" like privileges.</p>
	<div class="code"><div class="perl">
<span style="color: #808080; font-style: italic;">#!/usr/bin/perl</span><br />
<span style="color: #000000; font-weight: bold;">use</span> DBI;</p>
	<p><span style="color: #0000ff;">$dbi_host</span>=<span style="color: #ff0000;">"localhost"</span>;</p>
	<p><span style="color: #808080; font-style: italic;"># all databases</span><br />
<span style="color: #0000ff;">@dbi_u</span>=<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"admin_user"</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #0000ff;">@dbi_p</span>=<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"qwerty"</span><span style="color: #66cc66;">&#41;</span>;</p>
	<p><span style="color: #808080; font-style: italic;">#set the max count value</span><br />
<span style="color: #0000ff;">$ending_value</span> = <a href="http://www.perldoc.com/perl5.6/pod/func/scalar.html"><span style="color: #000066;">scalar</span></a><span style="color: #66cc66;">&#40;</span>_at_dbi_u<span style="color: #66cc66;">&#41;</span>;</p>
	<p><span style="color: #808080; font-style: italic;">#loop throuogh each of the above databases</span><br />
<span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$counter</span>=<span style="color: #cc66cc;">0</span> ; <span style="color: #0000ff;">$counter</span> &lt; <span style="color: #0000ff;">$ending_value</span> ; <span style="color: #0000ff;">$counter</span>++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&#160; &#160; &#160; &#160; <span style="color: #808080; font-style: italic;"># connect to data input table</span><br />
&#160; &#160; &#160; &#160; <span style="color: #0000ff;">$dbh_in</span> = DBI-&gt;<span style="color: #006600;">connect</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"dbi:mysql:host=$dbi_host"</span>, <span style="color: #0000ff;">$dbi_u</span><span style="color: #66cc66;">&#91;</span><span style="color: #0000ff;">$counter</span><span style="color: #66cc66;">&#93;</span>, <span style="color: #0000ff;">$dbi_p</span><span style="color: #66cc66;">&#91;</span><span style="color: #0000ff;">$counter</span><span style="color: #66cc66;">&#93;</span>, <span style="color: #66cc66;">&#123;</span> RaiseError =&gt; <span style="color: #cc66cc;">0</span>, AutoCommit =&gt; <span style="color: #cc66cc;">1</span> <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">or</span> <a href="http://www.perldoc.com/perl5.6/pod/func/die.html"><span style="color: #000066;">die</span></a> <span style="color: #ff0000;">"cannot connect to server"</span> . <span style="color: #0000ff;">$DBI</span>::<span style="color: #006600;">errstr</span>;<br />
&#160; &#160; &#160; &#160; <span style="color: #0000ff;">$sth_dbs</span> = <span style="color: #0000ff;">$dbh_in</span> -&gt; <span style="color: #006600;">prepare</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"SHOW DATABASES"</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; <span style="color: #0000ff;">$sth_dbs</span> -&gt; <span style="color: #006600;">execute</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; <br />
&#160; &#160; &#160; &#160; <span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$loop_db</span>=<span style="color: #cc66cc;">0</span>; <span style="color: #0000ff;">$loop_db</span>&lt;<span style="color: #0000ff;">$sth_dbs</span> -&gt; <span style="color: #006600;">rows</span>; <span style="color: #0000ff;">$loop_db</span>++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160;<span style="color: #0000ff;">@row</span> = <span style="color: #0000ff;">$sth_dbs</span> -&gt; <span style="color: #006600;">fetchrow_array</span>;<br />
&#160; &#160; &#160; &#160; <br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160;<span style="color: #808080; font-style: italic;"># databases with a '-' in their name are not handled very well</span><br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160;<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><a href="http://www.perldoc.com/perl5.6/pod/func/index.html"><span style="color: #000066;">index</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$row</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span>, <span style="color: #ff0000;">'-'</span><span style="color: #66cc66;">&#41;</span> == -<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #808080; font-style: italic;"># gen query</span><br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #0000ff;">$sth</span> = <span style="color: #0000ff;">$dbh_in</span> -&gt; <span style="color: #006600;">prepare</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"SHOW TABLES FROM "</span>.<span style="color: #0000ff;">$row</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #0000ff;">$sth</span> -&gt; <span style="color: #006600;">execute</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #0000ff;">$query</span> = <span style="color: #ff0000;">""</span>;<br />
&#160; &#160; &#160; &#160; <br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$loop_t</span>=<span style="color: #cc66cc;">0</span>; <span style="color: #0000ff;">$loop_t</span>&lt;<span style="color: #0000ff;">$sth</span> -&gt; <span style="color: #006600;">rows</span>; <span style="color: #0000ff;">$loop_t</span>++<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #0000ff;">@row2</span> = <span style="color: #0000ff;">$sth</span> -&gt; <span style="color: #006600;">fetchrow_array</span>;<br />
&#160; &#160; &#160; &#160; <br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$query</span> eq <span style="color: #ff0000;">""</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #0000ff;">$query</span> = <span style="color: #ff0000;">"OPTIMIZE TABLE "</span>;<br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #66cc66;">&#123;</span><br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #0000ff;">$query</span> .= <span style="color: #ff0000;">", "</span>;<br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #66cc66;">&#125;</span><br />
&#160; &#160; &#160; &#160; <br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #0000ff;">$query</span> .= <span style="color: #0000ff;">$row</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #ff0000;">"."</span>.<span style="color: #0000ff;">$row2</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span>;<br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #66cc66;">&#125;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #808080; font-style: italic;"># skip databases without tables</span><br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$query</span> <span style="color: #b1b100;">ne</span> <span style="color: #ff0000;">""</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<a href="http://www.perldoc.com/perl5.6/pod/func/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">"Optimizing "</span>.<span style="color: #0000ff;">$row</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #ff0000;">"...<span style="color: #000099; font-weight: bold;">\n</span>"</span>;<br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #0000ff;">$sth</span> = <span style="color: #0000ff;">$dbh_in</span> -&gt; <span style="color: #006600;">prepare</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$query</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #0000ff;">$sth</span> -&gt; <span style="color: #006600;">execute</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #66cc66;">&#125;</span><br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160;<span style="color: #66cc66;">&#125;</span><br />
&#160; &#160; &#160; &#160; <span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span><br />
&#160;</div></div>
	<p>All it does it loop through each database and optimise the tables. I would suggest a simple weekly or monthly cron job to execute the script. The script though will e-mail the cron user a list of optimised databases - simply add " >/dev/null 2>&#038;1" to the end of the crontab line to send the data to nowhere.
</p>
 ]]></summary>
	<content  type="html" ><![CDATA[ 	<p>Here is a simple script for optimizing MySQL table. You will need to set the username and password for a user with "admin" like privileges.</p>
	<div class="code"><div class="perl">
<span style="color: #808080; font-style: italic;">#!/usr/bin/perl</span><br />
<span style="color: #000000; font-weight: bold;">use</span> DBI;</p>
	<p><span style="color: #0000ff;">$dbi_host</span>=<span style="color: #ff0000;">"localhost"</span>;</p>
	<p><span style="color: #808080; font-style: italic;"># all databases</span><br />
<span style="color: #0000ff;">@dbi_u</span>=<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"admin_user"</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #0000ff;">@dbi_p</span>=<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"qwerty"</span><span style="color: #66cc66;">&#41;</span>;</p>
	<p><span style="color: #808080; font-style: italic;">#set the max count value</span><br />
<span style="color: #0000ff;">$ending_value</span> = <a href="http://www.perldoc.com/perl5.6/pod/func/scalar.html"><span style="color: #000066;">scalar</span></a><span style="color: #66cc66;">&#40;</span>_at_dbi_u<span style="color: #66cc66;">&#41;</span>;</p>
	<p><span style="color: #808080; font-style: italic;">#loop throuogh each of the above databases</span><br />
<span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$counter</span>=<span style="color: #cc66cc;">0</span> ; <span style="color: #0000ff;">$counter</span> &lt; <span style="color: #0000ff;">$ending_value</span> ; <span style="color: #0000ff;">$counter</span>++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&#160; &#160; &#160; &#160; <span style="color: #808080; font-style: italic;"># connect to data input table</span><br />
&#160; &#160; &#160; &#160; <span style="color: #0000ff;">$dbh_in</span> = DBI-&gt;<span style="color: #006600;">connect</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"dbi:mysql:host=$dbi_host"</span>, <span style="color: #0000ff;">$dbi_u</span><span style="color: #66cc66;">&#91;</span><span style="color: #0000ff;">$counter</span><span style="color: #66cc66;">&#93;</span>, <span style="color: #0000ff;">$dbi_p</span><span style="color: #66cc66;">&#91;</span><span style="color: #0000ff;">$counter</span><span style="color: #66cc66;">&#93;</span>, <span style="color: #66cc66;">&#123;</span> RaiseError =&gt; <span style="color: #cc66cc;">0</span>, AutoCommit =&gt; <span style="color: #cc66cc;">1</span> <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">or</span> <a href="http://www.perldoc.com/perl5.6/pod/func/die.html"><span style="color: #000066;">die</span></a> <span style="color: #ff0000;">"cannot connect to server"</span> . <span style="color: #0000ff;">$DBI</span>::<span style="color: #006600;">errstr</span>;<br />
&#160; &#160; &#160; &#160; <span style="color: #0000ff;">$sth_dbs</span> = <span style="color: #0000ff;">$dbh_in</span> -&gt; <span style="color: #006600;">prepare</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"SHOW DATABASES"</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; <span style="color: #0000ff;">$sth_dbs</span> -&gt; <span style="color: #006600;">execute</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160; &#160; <br />
&#160; &#160; &#160; &#160; <span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$loop_db</span>=<span style="color: #cc66cc;">0</span>; <span style="color: #0000ff;">$loop_db</span>&lt;<span style="color: #0000ff;">$sth_dbs</span> -&gt; <span style="color: #006600;">rows</span>; <span style="color: #0000ff;">$loop_db</span>++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160;<span style="color: #0000ff;">@row</span> = <span style="color: #0000ff;">$sth_dbs</span> -&gt; <span style="color: #006600;">fetchrow_array</span>;<br />
&#160; &#160; &#160; &#160; <br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160;<span style="color: #808080; font-style: italic;"># databases with a '-' in their name are not handled very well</span><br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160;<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><a href="http://www.perldoc.com/perl5.6/pod/func/index.html"><span style="color: #000066;">index</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$row</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span>, <span style="color: #ff0000;">'-'</span><span style="color: #66cc66;">&#41;</span> == -<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #808080; font-style: italic;"># gen query</span><br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #0000ff;">$sth</span> = <span style="color: #0000ff;">$dbh_in</span> -&gt; <span style="color: #006600;">prepare</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"SHOW TABLES FROM "</span>.<span style="color: #0000ff;">$row</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #0000ff;">$sth</span> -&gt; <span style="color: #006600;">execute</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #0000ff;">$query</span> = <span style="color: #ff0000;">""</span>;<br />
&#160; &#160; &#160; &#160; <br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$loop_t</span>=<span style="color: #cc66cc;">0</span>; <span style="color: #0000ff;">$loop_t</span>&lt;<span style="color: #0000ff;">$sth</span> -&gt; <span style="color: #006600;">rows</span>; <span style="color: #0000ff;">$loop_t</span>++<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #0000ff;">@row2</span> = <span style="color: #0000ff;">$sth</span> -&gt; <span style="color: #006600;">fetchrow_array</span>;<br />
&#160; &#160; &#160; &#160; <br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$query</span> eq <span style="color: #ff0000;">""</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #0000ff;">$query</span> = <span style="color: #ff0000;">"OPTIMIZE TABLE "</span>;<br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #66cc66;">&#123;</span><br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #0000ff;">$query</span> .= <span style="color: #ff0000;">", "</span>;<br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #66cc66;">&#125;</span><br />
&#160; &#160; &#160; &#160; <br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #0000ff;">$query</span> .= <span style="color: #0000ff;">$row</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #ff0000;">"."</span>.<span style="color: #0000ff;">$row2</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span>;<br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #66cc66;">&#125;</span><br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <br />
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <span style="color: #808080; font-style: italic;"># skip databases without tables</span><br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$query</span> <span style="color: #b1b100;">ne</span> <span style="color: #ff0000;">""</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<a href="http://www.perldoc.com/perl5.6/pod/func/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">"Optimizing "</span>.<span style="color: #0000ff;">$row</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #ff0000;">"...<span style="color: #000099; font-weight: bold;">\n</span>"</span>;<br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #0000ff;">$sth</span> = <span style="color: #0000ff;">$dbh_in</span> -&gt; <span style="color: #006600;">prepare</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$query</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #0000ff;">$sth</span> -&gt; <span style="color: #006600;">execute</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;<span style="color: #66cc66;">&#125;</span><br />
&#160; &#160; &#160; &#160;&#160; &#160; &#160; &#160; &#160;<span style="color: #66cc66;">&#125;</span><br />
&#160; &#160; &#160; &#160; <span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span><br />
&#160;</div></div>
	<p>All it does it loop through each database and optimise the tables. I would suggest a simple weekly or monthly cron job to execute the script. The script though will e-mail the cron user a list of optimised databases - simply add " >/dev/null 2>&#038;1" to the end of the crontab line to send the data to nowhere.
</p>
 ]]></content>
		<category scheme="http://www.dot-commers.co.uk/index.php/blog/category/17.html" term="17" label="MySQL"/>
</entry>
<entry>
	<title  type="text" ><![CDATA[ Making pre Zend Framework 1.0 applications work ]]></title>
	<link rel="alternate"  type="text/html"  href="http://www.dot-commers.co.uk/index.php/blog/show/Making-pre-Zend-Framework-10-application-work.html" title="Making pre Zend Framework 1.0 applications work" />
	<author>
		<name>Peter Davies</name>
		<uri>http://www.dot-commers.co.uk/admin.php</uri>
	</author>
	<id>http://www.dot-commers.co.uk/index.php/blog/show/Making-pre-Zend-Framework-10-application-work.html</id>
	<updated>2007-06-18T00:46:39+01:00</updated>
	<published>2007-06-18T00:21:23+01:00</published>
	<summary  type="html" ><![CDATA[ 	<p>Ok, after following ZF from its infancy I often see fundamental changes every time a new version is released. Now that the release candidate (version 1) has been released, some fundamental changes have been developed.</p>
	<p>The following PHP code pretty much solves any issues related to converting an older pre v1 RC 1 of the ZF <img src="http://www.dot-commers.co.uk/plugins/Emoticons/images/face-smile.png" border="0" alt="face-smile.png " width="16" height="16" />. Its a slight generalisation together with the change in "toArray" in the majority of functions:</p>
	<div class="code"><div class="php">
<span style="color: #808080; font-style: italic;">/* -- set a non-existent error handler + view renderer -- */</span><br />
<span style="color: #0000ff;">$controller</span>-&gt;<span style="color: #006600;">returnResponse</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #0000ff;">$controller</span>-&gt;<span style="color: #006600;">setParam</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'useDefaultControllerAlways'</span>, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #0000ff;">$controller</span>-&gt;<span style="color: #006600;">setParam</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'noErrorHandler'</span>, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #0000ff;">$controller</span>-&gt;<span style="color: #006600;">setParam</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'noViewRenderer'</span>, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #0000ff;">$response</span> = <span style="color: #0000ff;">$controller</span>-&gt;<span style="color: #006600;">dispatch</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></div>
	<p>The idea being that during the next release of any software that uses the above code, you re-engineer the system to cope with errors, and the new view rendering process.
</p>
 ]]></summary>
	<content  type="html" ><![CDATA[ 	<p>Ok, after following ZF from its infancy I often see fundamental changes every time a new version is released. Now that the release candidate (version 1) has been released, some fundamental changes have been developed.</p>
	<p>The following PHP code pretty much solves any issues related to converting an older pre v1 RC 1 of the ZF <img src="http://www.dot-commers.co.uk/plugins/Emoticons/images/face-smile.png" border="0" alt="face-smile.png " width="16" height="16" />. Its a slight generalisation together with the change in "toArray" in the majority of functions:</p>
	<div class="code"><div class="php">
<span style="color: #808080; font-style: italic;">/* -- set a non-existent error handler + view renderer -- */</span><br />
<span style="color: #0000ff;">$controller</span>-&gt;<span style="color: #006600;">returnResponse</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #0000ff;">$controller</span>-&gt;<span style="color: #006600;">setParam</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'useDefaultControllerAlways'</span>, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #0000ff;">$controller</span>-&gt;<span style="color: #006600;">setParam</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'noErrorHandler'</span>, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #0000ff;">$controller</span>-&gt;<span style="color: #006600;">setParam</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'noViewRenderer'</span>, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #0000ff;">$response</span> = <span style="color: #0000ff;">$controller</span>-&gt;<span style="color: #006600;">dispatch</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></div>
	<p>The idea being that during the next release of any software that uses the above code, you re-engineer the system to cope with errors, and the new view rendering process.
</p>
 ]]></content>
		<category scheme="http://www.dot-commers.co.uk/index.php/blog/category/4.html" term="4" label="Zend Framework"/>
</entry>
<entry>
	<title  type="text" ><![CDATA[ New Dotcommers website released!! ]]></title>
	<link rel="alternate"  type="text/html"  href="http://www.dot-commers.co.uk/index.php/blog/show/New-Dotcommers-website-released.html" title="New Dotcommers website released!!" />
	<author>
		<name>Peter Davies</name>
		<uri>http://www.dot-commers.co.uk/admin.php</uri>
	</author>
	<id>http://www.dot-commers.co.uk/index.php/blog/show/New-Dotcommers-website-released.html</id>
	<updated>2007-06-18T00:02:48+01:00</updated>
	<published>2007-06-17T00:21:47+01:00</published>
	<summary  type="html" ><![CDATA[ 	<p>This is the first posting on the new Dotcommers website which is built using a new <a href="index.php?gadget=Glossary&amp;action=ViewTerm&amp;term=CMS"><acronym title="Content Management System
">CMS</acronym></a> called <a href="index.php?gadget=Glossary&amp;action=ViewTerm&amp;term=Jaws"><acronym title="Jaws is a Framework and Content Management System for building dynamic web sites. It aims to be User Friendly giving ease of use and lots of ways to customize web sites, but at the same time is Developer Friendly, it offers a simple and powerful framework to hack your own modules.
">Jaws</acronym></a>. This <a href="index.php?gadget=Glossary&amp;action=ViewTerm&amp;term=CMS"><acronym title="Content Management System
">CMS</acronym></a> unlike some of the other larger-scale applications (such as <a href="http://www.joomla.org" title="Joomla! Open Source CMS" target="_blank">Joomla</a>) provides a very simple mechanism for inputting new articles.</p>
	<p>The Jaws application provides extensive blogging capabilities together with sophisticated <a href="index.php?gadget=Glossary&amp;action=ViewTerm&amp;term=RSS"><acronym title="RSS is a family of web feed formats used to publish frequently updated content such as blog entries, news headlines or podcasts. An RSS document, which is called a feed, web feed, or channel, contains either a summary of content from an associated web site or the full text. RSS makes it possible for people to keep up with their favorite web sites in an automated manner that's easier than checking them manually.</p>
	<p>RSS content can be read using software called a feed reader or an aggregator. The user subscribes to a feed by entering the feeds link into the reader or by clicking an RSS icon in a browser that initiates the subscription process. The reader checks the user's subscribed feeds regularly for new content, downloading any updates that it finds.</p>
	<p>The initials RSS are used to refer to the following formats:</p>
	<p>* Really Simple Syndication (RSS 2.0)<br />
* RDF Site Summary (RSS 1.0 and RSS 0.90)<br />
* Rich Site Summary (RSS 0.91)</p>
	<p>RSS formats are specified using XML, a generic specification for the creation of data formats.
">RSS</acronym></a> and ATOM feed generation.</p>
	<p>This "blog" as such will have articles and downloads available for anybody to view, together with many random articles relating to whatever might popup during a days work.
</p>
 ]]></summary>
	<content  type="html" ><![CDATA[ 	<p>This is the first posting on the new Dotcommers website which is built using a new <a href="index.php?gadget=Glossary&amp;action=ViewTerm&amp;term=CMS"><acronym title="Content Management System
">CMS</acronym></a> called <a href="index.php?gadget=Glossary&amp;action=ViewTerm&amp;term=Jaws"><acronym title="Jaws is a Framework and Content Management System for building dynamic web sites. It aims to be User Friendly giving ease of use and lots of ways to customize web sites, but at the same time is Developer Friendly, it offers a simple and powerful framework to hack your own modules.
">Jaws</acronym></a>. This <a href="index.php?gadget=Glossary&amp;action=ViewTerm&amp;term=CMS"><acronym title="Content Management System
">CMS</acronym></a> unlike some of the other larger-scale applications (such as <a href="http://www.joomla.org" title="Joomla! Open Source CMS" target="_blank">Joomla</a>) provides a very simple mechanism for inputting new articles.</p>
	<p>The Jaws application provides extensive blogging capabilities together with sophisticated <a href="index.php?gadget=Glossary&amp;action=ViewTerm&amp;term=RSS"><acronym title="RSS is a family of web feed formats used to publish frequently updated content such as blog entries, news headlines or podcasts. An RSS document, which is called a feed, web feed, or channel, contains either a summary of content from an associated web site or the full text. RSS makes it possible for people to keep up with their favorite web sites in an automated manner that's easier than checking them manually.</p>
	<p>RSS content can be read using software called a feed reader or an aggregator. The user subscribes to a feed by entering the feeds link into the reader or by clicking an RSS icon in a browser that initiates the subscription process. The reader checks the user's subscribed feeds regularly for new content, downloading any updates that it finds.</p>
	<p>The initials RSS are used to refer to the following formats:</p>
	<p>* Really Simple Syndication (RSS 2.0)<br />
* RDF Site Summary (RSS 1.0 and RSS 0.90)<br />
* Rich Site Summary (RSS 0.91)</p>
	<p>RSS formats are specified using XML, a generic specification for the creation of data formats.
">RSS</acronym></a> and ATOM feed generation.</p>
	<p>This "blog" as such will have articles and downloads available for anybody to view, together with many random articles relating to whatever might popup during a days work.
</p>
 ]]></content>
		<category scheme="http://www.dot-commers.co.uk/index.php/blog/category/1.html" term="1" label="General"/>
</entry>
</feed>