<?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>Photogabble &#187; programming</title>
	<atom:link href="http://photogabble.co.uk/tag/programming/feed" rel="self" type="application/rss+xml" />
	<link>http://photogabble.co.uk</link>
	<description>photoblog of simon dann</description>
	<lastBuildDate>Sun, 25 Dec 2011 14:19:43 +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>Writing a template for Cube Cart.</title>
		<link>http://photogabble.co.uk/design/writing-a-template-for-cube-cart.html</link>
		<comments>http://photogabble.co.uk/design/writing-a-template-for-cube-cart.html#comments</comments>
		<pubDate>Sat, 14 Jun 2008 17:14:59 +0000</pubDate>
		<dc:creator>simon</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[cubecart]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://photogabble.co.uk/?p=679</guid>
		<description><![CDATA[My most recent client project spec is to produce an online shop, while this initially didn&#8217;t appear to be an issue for me as I am quite able to create the design. I never once thought how difficult it would be to code the template for that design. It appears that while there are only [...]]]></description>
			<content:encoded><![CDATA[<p>My most recent client project spec is to produce an online shop, while this initially didn&#8217;t appear to be an issue for me as I am quite able to create the design. I never once thought how difficult it would be to code the template for that design. It appears that while there are only a hand-full of useful online shop software packages they each use a complex and rarely documented templating system. For this project I have chosen cube cart as it includes many of the mechanisms that my client requires and out of those I have tested it appears to be the most stable and &#8220;easy&#8221; to design for. I suppose to the first time on looker, the template system utilized by WordPress would be a little confusing and while I find it easy to use, I have been working with WordPress for a considerable number of years. I only hope I can get to knowing how to use the Cube Cart template system as easily as I did with WordPress. Has anyone else developed for cube cart and do you know of any online documentation I may find of use as google has given me nothing but multiple template websites trying to sell me something.</p>
]]></content:encoded>
			<wfw:commentRss>http://photogabble.co.uk/design/writing-a-template-for-cube-cart.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Memory Bugfix</title>
		<link>http://photogabble.co.uk/technical/php-memory-bugfix.html</link>
		<comments>http://photogabble.co.uk/technical/php-memory-bugfix.html#comments</comments>
		<pubDate>Fri, 07 Sep 2007 15:12:52 +0000</pubDate>
		<dc:creator>simon</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[bugfix]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[memory-limit]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.photogabble.co.uk/2007/09/07/php-memory-bugfix/</guid>
		<description><![CDATA[Today after updating the programs running on my server to the latest builds I was met with the following error presented by wordpress: Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 79 bytes) Upon doing the usual google, I discovered a few people have been having the same problem as myself. [...]]]></description>
			<content:encoded><![CDATA[<p>Today after updating the programs running on my server to the latest builds I was met with the following error presented by wordpress:</p>
<blockquote><p>Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 79 bytes)</p></blockquote>
<p>Upon doing the usual google, I discovered a few people have been having the same problem as myself. It is however a very easy problem to fix and although I found no actual answers on the net (obviously I didn&#8217;t look hard enough) I figured it out in the end. The problem is caused by scripts requiring more memory to execute than php has available to it. By default php limits itself to 8MB and usually that is enough with which to run most scripts, however either by some error of php or the new heavier than usual requirements of todays scripts sometimes 8MB is just not enough and as you can see in my example only 79 bytes extra where needed.</p>
<p>The fix is simple, find your php.ini file open it and find the Resource Limits section. Under that heading there is a line which by default says:</p>
<blockquote><p>memory_limit = 8M    ;Maximum amount of memory a script may consume (8MB)</p></blockquote>
<p>All you need to do is change the 8M to 16M, I know that the problem is caused by scripts only needing a few extra bytes but its always nice to have a multiple of the original therefore I have doubled it, you needn&#8217;t do this changing it to 9M will fix  the problem. Once you have made the changes save the file and exit then restart your server process which in my case is apache and the problem will be fixed and all your scripts will be working <img src='http://photogabble.co.uk/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Feel free to comment if you have any other questions about this topic.</p>
]]></content:encoded>
			<wfw:commentRss>http://photogabble.co.uk/technical/php-memory-bugfix.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>time_since</title>
		<link>http://photogabble.co.uk/php/time_since.html</link>
		<comments>http://photogabble.co.uk/php/time_since.html#comments</comments>
		<pubDate>Fri, 20 Apr 2007 01:14:28 +0000</pubDate>
		<dc:creator>simon</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[time_since]]></category>

		<guid isPermaLink="false">http://www.photogabble.co.uk/2007/04/20/time_since/</guid>
		<description><![CDATA[I found it incredibly difficult to find any form of time_since function in php so to save anyone else the trouble to hunting through hundreds of useless websites here is the function you may want to use, written by Natalie Downe (you don&#8217;t want to know how long it took to hunt it down). It [...]]]></description>
			<content:encoded><![CDATA[<p>I found it incredibly difficult to find any form of time_since function in php so to save anyone else the trouble to hunting through hundreds of useless websites here is the function you may want to use, written by <a href="http://notes.natbat.net/2007/01/27/timesince/">Natalie Downe</a> (you don&#8217;t want to know how long it took to hunt it down). It takes the input in the form of the unix time stamp.</p>
<pre><code>function time_since($original) {

// array of time period chunks

$chunks = array(

array(60 * 60 * 24 * 365 , 'year' ),

array(60 * 60 * 24 * 30 , 'month' ),

array(60 * 60 * 24 * 7, 'week' ),

array(60 * 60 * 24 , 'day' ),

array(60 * 60 , 'hour' ),

array(60 , 'minute' ),

);</code><code>$today = time(); /* Current unix time */

$since = $today - $original;</code>

<code>// $j saves performing the count function each time around the loop

for ($i = 0, $j = count($chunks); $i &lt; $j; $i++) {</code>

<code>    $seconds = $chunks[$i][0];

$name = $chunks[$i][1];</code>

<code>    // finding the biggest chunk (if the chunk fits, break)

if (($count = floor($since / $seconds)) != 0) {

// DEBUG print "&lt;!-- It's $name --&gt;n";

break;

}

}</code>

<code>$print = ($count == 1) ? '1 '.$name : "$count {$name}s";</code>

<code>if ($i + 1 &lt; $j) {

// now getting the second item

$seconds2 = $chunks[$i + 1][0];

$name2 = $chunks[$i + 1][1];</code>

<code>    // add second item if it's greater than 0

if (($count2 = floor(($since - ($seconds * $count)) / $seconds2)) != 0) {

$print .= ($count2 == 1) ? ', 1 '.$name2 : ", $count2 {$name2}s";

}

}

return $print;

}</code></pre>
<p>I also found a second more compact version from <a href="http://www.byteinsider.com/article/short-and-accurate-time_since-php-function">byteinsider</a> their version (below) takes the input in the form of the MySQL  timestamp format (Y-m-d H:i:s) both functions output the same type of thing tho, so its up to you which you use.<br />
<code> </code></p>
<pre>function time_since($mysql_timestamp)

{

$names =  array('year','month','day','hour','minute','second');$r = time()-strtotime($mysql_timestamp) - date('Z');

$posted = array(date('Y',$r)-1970,date('n',$r)-1,date('d',$r)-1,

 date('G',$r)-0,date('i',$r)-0,date('s',$r)-0);

for($n = 0; $n &lt; 5 &amp;&amp; $posted[$n] == 0; $n++);

$output = $posted[$n].' '.$names[$n];

if($posted[$n] != 1) $output .='s';

if($n &lt; 5 &amp;&amp; $posted[$n+1] != 0)

{

 $output .= ' '.$posted[$n+1].' '.$names[$n+1];

 if($posted[$n+1] != 1) $output .='s';

}

return $output.' ago';

}</pre>
]]></content:encoded>
			<wfw:commentRss>http://photogabble.co.uk/php/time_since.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

