<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Japh</title>
	
	<link>http://japh.com.au</link>
	<description>Web developer, technologist, innovator. I love the internet.</description>
	<lastBuildDate>Mon, 01 Jun 2009 01:35:37 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/JaphethThomson" /><feedburner:info uri="japheththomson" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Get yourself a Satellite developer</title>
		<link>http://feedproxy.google.com/~r/JaphethThomson/~3/CfzKGO212gI/</link>
		<comments>http://japh.com.au/general/get-yourself-a-satellite-developer/#comments</comments>
		<pubDate>Sat, 30 May 2009 05:08:34 +0000</pubDate>
		<dc:creator>Japh</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[General Chatter]]></category>

		<guid isPermaLink="false">http://japh.com.au/?p=151</guid>
		<description><![CDATA[The new Satellite website is now live!
If you don&#8217;t already know, I recently started full-time freelance development.  The idea is that anyone who needs development work done, wherever they are, can contact me to help out on their project.
Whether you are a freelance designer who needs some development done (or even some training), or [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>The new <a title="Satellite - International Web Development" href="http://satellitedev.com">Satellite website</a> is now live!</p>
<p>If you don&#8217;t already know, I recently started full-time freelance development.  The idea is that anyone who needs development work done, wherever they are, can contact me to help out on their project.</p>
<p>Whether you are a freelance designer who needs some development done (or even some training), or a freelance developer who needs an extra pair of hands, or even a bigger business who needs to bring someone else in on a project&#8230;  <a title="Satellite - International Web Development" href="http://satellitedev.com">I&#8217;m available for hire!</a></p>
<p>I would love to hear any feedback on the new website too, so feel free to leave any comments in that regard as well.</p>


<p>No related posts.</p><img src="http://feeds.feedburner.com/~r/JaphethThomson/~4/CfzKGO212gI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://japh.com.au/general/get-yourself-a-satellite-developer/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		<feedburner:origLink>http://japh.com.au/general/get-yourself-a-satellite-developer/</feedburner:origLink></item>
		<item>
		<title>WP-IE6Update plugin for WordPress</title>
		<link>http://feedproxy.google.com/~r/JaphethThomson/~3/Q0lDBhEC4LY/</link>
		<comments>http://japh.com.au/plugins/wp-ie6update/#comments</comments>
		<pubDate>Sun, 19 Apr 2009 07:15:12 +0000</pubDate>
		<dc:creator>Japh</dc:creator>
				<category><![CDATA[Plugins]]></category>

		<guid isPermaLink="false">http://japh.com.au/?p=135</guid>
		<description><![CDATA[Everyone wishes they could get rid of IE6, and now there&#8217;s a nice, elegant way to prompt users to upgrade!  The website for IE6Update provides a snippet of code to place between the &#60;head&#62;&#60;/head&#62; tags on your website, which will then trigger a small warning bar on users of IE6 prompting them to update to [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>Everyone wishes they could get rid of IE6, and now there&#8217;s a nice, elegant way to prompt users to upgrade!  The website for <a title="IE6Update" href="http://ie6update.com">IE6Update</a> provides a snippet of code to place between the &lt;head&gt;&lt;/head&gt; tags on your website, which will then trigger a small warning bar on users of IE6 prompting them to update to IE8.</p>
<p>I liked the idea so much, I decided that rather than simply copy their code snippet for my website, I&#8217;d make a handy little WP Plugin I could install on any of my sites.  Save me editing themes etc!</p>
<p>If you want the plugin, here it is: <a title="WP-IE6Update" href="http://wordpress.org/extend/plugins/wp-ie6update/">Download</a><a title="TAR.GZ format (1.223 kb)" href="/demos/wp-ie6update/wp-ie6update.tar.gz"></a></p>
<p>If you want to know more about IE6Update, you can read their blog post about it <a title="Announcing IE6 Update" href="http://almost.done21.com/2009/04/announcing-ie6-update-help-kill-internet-explorer-6/">Announcing IE6 Update &#8211; Help kill Internet Explorer 6</a></p>
<p><strong>Update:</strong> The download link above now points to the WordPress official extensions directory for download.</p>


<p>No related posts.</p><img src="http://feeds.feedburner.com/~r/JaphethThomson/~4/Q0lDBhEC4LY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://japh.com.au/plugins/wp-ie6update/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		<feedburner:origLink>http://japh.com.au/plugins/wp-ie6update/</feedburner:origLink></item>
		<item>
		<title>Custom default Gravatar in WordPress 2.7</title>
		<link>http://feedproxy.google.com/~r/JaphethThomson/~3/xhAj04vBXI4/</link>
		<comments>http://japh.com.au/php/custom-default-gravatar-in-wordpress/#comments</comments>
		<pubDate>Thu, 02 Apr 2009 03:45:06 +0000</pubDate>
		<dc:creator>Japh</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://japh.com.au/?p=124</guid>
		<description><![CDATA[If you&#8217;ve been using WordPress for a little while, and don&#8217;t really much like the default options you have to choose from when a commenter doesn&#8217;t have their own Gravatar, why not make your own?
Make yourself a little square image to use that matches in with your theme, and then insert the following line of [...]


Related posts:<ol><li><a href='http://japh.com.au/plugins/wp-ie6update/' rel='bookmark' title='Permanent Link: WP-IE6Update plugin for WordPress'>WP-IE6Update plugin for WordPress</a> <small>Everyone wishes they could get rid of IE6, and now...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve been using WordPress for a little while, and don&#8217;t really much like the default options you have to choose from when a commenter doesn&#8217;t have their own Gravatar, why not make your own?</p>
<p>Make yourself a little square image to use that matches in with your theme, and then insert the following line of code:</p>

<div class="wp_codebox"><table><tr id="p1242"><td class="code" id="p124code2"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> get_avatar<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$comment</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">86</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'http://example.com/custom-default-av.png'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p><strong>Note:</strong> you must provide the full absolute URL for your image.</p>
<p>What this line does, is show a Gravatar for the user if they have one, and if not, show your custom one instead. The number &#8220;86&#8243; is the pixel width and height you want the Gravatars to display at.</p>
<p>Remember that this will only work in WordPress 2.7+, or possibly in older versions if you have the Gravatar plugin installed (not tested).</p>
<p><strong>Update:</strong> If you don&#8217;t know what a Gravatar is, check out the comments.  The avatar&#8217;s shown beside each comment are automatically pulled in from Gravatar&#8217;s service, so you upload your avatar once, and it appears everywhere when you comment etc.  Get yourself one here: <a href="http://gravatar.com/">Gravatar</a></p>


<p>Related posts:<ol><li><a href='http://japh.com.au/plugins/wp-ie6update/' rel='bookmark' title='Permanent Link: WP-IE6Update plugin for WordPress'>WP-IE6Update plugin for WordPress</a> <small>Everyone wishes they could get rid of IE6, and now...</small></li>
</ol></p><img src="http://feeds.feedburner.com/~r/JaphethThomson/~4/xhAj04vBXI4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://japh.com.au/php/custom-default-gravatar-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		<feedburner:origLink>http://japh.com.au/php/custom-default-gravatar-in-wordpress/</feedburner:origLink></item>
		<item>
		<title>Time-sensitive CSS</title>
		<link>http://feedproxy.google.com/~r/JaphethThomson/~3/dBn53zTihlM/</link>
		<comments>http://japh.com.au/html/time-sensitive-css/#comments</comments>
		<pubDate>Tue, 31 Mar 2009 09:18:28 +0000</pubDate>
		<dc:creator>Japh</dc:creator>
				<category><![CDATA[Cascading Stylesheets]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://japh.com.au/?p=115</guid>
		<description><![CDATA[Have you ever wanted to load a specific stylesheet depending on what time it is?  It is actually very easy to do!
View Demo
I&#8217;m using jQuery in this just because it makes it look a little simpler, it&#8217;s not much more complex to do without jQuery&#8230; but let&#8217;s face it, you&#8217;re probably already using jQuery [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>Have you ever wanted to load a specific stylesheet depending on what time it is?  It is actually very easy to do!</p>
<p><a href="/demos/115/">View Demo</a></p>
<p>I&#8217;m using jQuery in this just because it makes it look a little simpler, it&#8217;s not much more complex to do without jQuery&#8230; but let&#8217;s face it, you&#8217;re probably already using jQuery anyway, so why not  <img src='http://japh.com.au/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Make yourself a new file to put your javascript into, I&#8217;ve called mine &#8220;script.js&#8221;.  Include the new javascript file by putting this line in your HTML &lt;head&gt;&lt;/head&gt; section with the following line:</p>

<div class="wp_codebox"><table><tr id="p1155"><td class="code" id="p115code5"><pre class="html" style="font-family:monospace;">&lt;script type=&quot;text/javascript&quot; src=&quot;script.js&quot;&gt;&lt;/script&gt;</pre></td></tr></table></div>

<p>Now open your &#8220;script.js&#8221; file, and put the following lump of code into it:</p>

<div class="wp_codebox"><table><tr id="p1156"><td class="code" id="p115code6"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// This line depends on jQuery, and tells the browser to kick off this stuff once</span>
<span style="color: #006600; font-style: italic;">// everything's fully loaded</span>
$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #006600; font-style: italic;">// These two lines make set a Date variable with the current date and time</span>
    <span style="color: #003366; font-weight: bold;">var</span> currentDate <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> currentHour <span style="color: #339933;">=</span> currentDate.<span style="color: #660066;">getHours</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// Here we're creating a new &lt;link /&gt; to insert in the &lt;head&gt;&lt;/head&gt;</span>
    <span style="color: #003366; font-weight: bold;">var</span> newCSS <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'link'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    newCSS.<span style="color: #660066;">type</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'text/css'</span><span style="color: #339933;">;</span>
    newCSS.<span style="color: #660066;">rel</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'stylesheet'</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// This is where you can determine when to use which stylesheet.</span>
    <span style="color: #006600; font-style: italic;">// If the current hour is before 9am or 8pm (or later), use &quot;night.css&quot;</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>currentHour <span style="color: #339933;">&lt;</span> <span style="color: #CC0000;">9</span> <span style="color: #339933;">||</span> currentHour <span style="color: #339933;">&gt;=</span> <span style="color: #CC0000;">20</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        newCSS.<span style="color: #660066;">href</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'css/night.css'</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #006600; font-style: italic;">// Otherwise, use &quot;day.css&quot;</span>
    <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
        newCSS.<span style="color: #660066;">href</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'css/day.css'</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #006600; font-style: italic;">// This line actually does the deed, and attaches the selected stylesheet</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;head&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">append</span><span style="color: #009900;">&#40;</span>newCSS<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// This line isn't necessary, it's just showing the actual time in the demo.</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.satellite&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span>currentDate.<span style="color: #660066;">toTimeString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Read the commenting to understand what&#8217;s actually going on there, but that should do it!  Easier than you thought, I bet  <img src='http://japh.com.au/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>If you have any questions or suggestions, leave a comment!</p>


<p>No related posts.</p><img src="http://feeds.feedburner.com/~r/JaphethThomson/~4/dBn53zTihlM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://japh.com.au/html/time-sensitive-css/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		<feedburner:origLink>http://japh.com.au/html/time-sensitive-css/</feedburner:origLink></item>
		<item>
		<title>Excuse me while I change in front of you!</title>
		<link>http://feedproxy.google.com/~r/JaphethThomson/~3/Da6Xnh-0ymU/</link>
		<comments>http://japh.com.au/general/excuse-me-while-i-change-in-front-of-you/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 02:59:47 +0000</pubDate>
		<dc:creator>Japh</dc:creator>
				<category><![CDATA[General Chatter]]></category>

		<guid isPermaLink="false">http://japh.com.au/?p=111</guid>
		<description><![CDATA[Have you ever seen that in shopping centres when a new store is moving in where an old store used to be?  I liked it, thought it was clever, and now I&#8217;ve used it!
So I&#8217;ve decided to shift to a different domain name, and have (again) re-skinned the blog.  This time, I think I&#8217;ll stick [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>Have you ever seen that in shopping centres when a new store is moving in where an old store used to be?  I liked it, thought it was clever, and now I&#8217;ve used it!</p>
<p>So I&#8217;ve decided to shift to a different domain name, and have (again) re-skinned the blog.  This time, I think I&#8217;ll stick with it.  Maybe a few tweaks here and there.  I also hope to blog a little more, and do a few guest posts around the place, which I&#8217;ll link to from here as well.</p>
<p>While I&#8217;m here, I might just tell you about an iPhone app I recently tried and love.  It&#8217;s called <a href="http://instapaper.com">Instapaper</a> and it&#8217;s fantastic!</p>
<p>You&#8217;ve possibly already heard of it, but if you haven&#8217;t, I suggest you give it a try.  I read quite a few different blog posts around the place, some from feeds in Google Reader, and some that people link to on <a href="http://twitter.com/japh">Twitter</a>.  More often than not though, I&#8217;m not in a position to read a full article right at that moment, and this is where Instapaper comes in.  What to do when I&#8217;m lining up to use the ATM, or sitting in a small room contemplating life?  I could read those articles!</p>
<p>Instapaper provides a bookmark you can use to say &#8220;Read later&#8221;, and it&#8217;ll save the page (in a readable format) to your Instapaper account, which you can then open on the iPhone.  The big bonus for me, is that it actually downloads the articles to your phone, so even if you have no connectivity you can still read them (assuming you sync while you still have a connection).  Considering the coverage some of the networks local to my area have, this is a particularly awesome feature.</p>
<p>Keen to hear your thoughts, both on Instapaper, and the blog in general, so feel free to leave a comment.</p>


<p>No related posts.</p><img src="http://feeds.feedburner.com/~r/JaphethThomson/~4/Da6Xnh-0ymU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://japh.com.au/general/excuse-me-while-i-change-in-front-of-you/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://japh.com.au/general/excuse-me-while-i-change-in-front-of-you/</feedburner:origLink></item>
		<item>
		<title>Must-have iPhone apps (update)</title>
		<link>http://feedproxy.google.com/~r/JaphethThomson/~3/B2YDes-wRpc/</link>
		<comments>http://japh.com.au/general/must-have-iphone-apps-update/#comments</comments>
		<pubDate>Thu, 12 Mar 2009 04:16:50 +0000</pubDate>
		<dc:creator>Japh</dc:creator>
				<category><![CDATA[General Chatter]]></category>

		<guid isPermaLink="false">http://japheththomson.com/?p=96</guid>
		<description><![CDATA[It&#8217;s been about six months since I got my iPhone, so I figure it&#8217;s time to revise the must-have app list.  I&#8217;m not going to list all the apps I have installed, just the ones I&#8217;d recommend to a new iPhone owner (Luke, I&#8217;m looking at you. Congrats!)
The list is as follows (prices are [...]


Related posts:<ol><li><a href='http://japh.com.au/general/excuse-me-while-i-change-in-front-of-you/' rel='bookmark' title='Permanent Link: Excuse me while I change in front of you!'>Excuse me while I change in front of you!</a> <small>Have you ever seen that in shopping centres when a...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been about six months since I got my iPhone, so I figure it&#8217;s time to revise the must-have app list.  I&#8217;m not going to list all the apps I have installed, just the ones I&#8217;d recommend to a new iPhone owner (Luke, I&#8217;m looking at you. Congrats!)<br />
The list is as follows (prices are as of 13th March, 2009):</p>
<ul>
<li><span class="Apple-style-span" style="font-weight: bold">Currency</span> (free)</li>
<li><span class="Apple-style-span" style="font-weight: bold">DomainScout</span> (free)</li>
<li><span class="Apple-style-span" style="font-weight: bold">eBay Mobile</span> (free) (official app this time!)</li>
<li><span class="Apple-style-span" style="font-weight: bold"><del datetime="2009-03-13T08:22:04+00:00">FTP On The Go</del></span> ($12.99 AUD, stricken from the list&#8230; poor value for money)</li>
<li><span class="Apple-style-span" style="font-weight: bold">Google Earth</span> (free)</li>
<li><span class="Apple-style-span" style="font-weight: bold">Google Mobile App</span> (free)</li>
<li><span class="Apple-style-span" style="font-weight: bold">iSSH</span> ($5.99 AUD)</li>
<li><span class="Apple-style-span" style="font-weight: bold">Koi Pond</span> ($1.19 AUD) (ok, this one&#8217;s not really a <em>must</em>-have&#8230; but it&#8217;s relaxing)</li>
<li><span class="Apple-style-span" style="font-weight: bold">Live Poker</span> (free)</li>
<li><span class="Apple-style-span" style="font-weight: bold">Midomi</span> (free)</li>
<li><span class="Apple-style-span" style="font-weight: bold">Ocarina</span> ($1.19 AUD) (by Smule, they do really nicely made apps)</li>
<li><span class="Apple-style-span" style="font-weight: bold">OzWeather</span> ($2.49 AUD) (better for us Aussies than the Yahoo one, comes from <a title="Bureau of Meteorology" href="http://www.bom.gov.au" target="_blank">BoM</a>)</li>
<li><span class="Apple-style-span" style="font-weight: bold">reMovem</span> ($4.99 AUD) (I mainly bought this one for my wife&#8230;)</li>
<li><span class="Apple-style-span" style="font-weight: bold">SnapTell</span> (free) (like Midomi, but for books and DVD covers, etc.)</li>
<li><span class="Apple-style-span" style="font-weight: bold">Tweetie</span> ($3.99 AUD) (yes, <a title="Twitter" href="http://twitter.com" target="_blank">Twitter</a> is all the rage right now, so get this and follow <a title="@japh" href="http://twitter.com/japh" target="_blank">@japh</a>.)</li>
<li><span class="Apple-style-span" style="font-weight: bold">Units</span> (free)</li>
<li><span class="Apple-style-span" style="font-weight: bold">Wikipanion</span> (free)</li>
<li><span class="Apple-style-span" style="font-weight: bold">WordPress</span> (free)</li>
<li><span class="Apple-style-span" style="font-weight: bold">Zenbe Lists</span> ($3.99 AUD) (You&#8217;ll need to create an account at <a title="Zenbe Lists" href="http://lists.zenbe.com/" target="_blank">http://lists.zenbe.com/</a>)</li>
<li><span class="Apple-style-span" style="font-weight: bold"><a title="Zen Bound" href="http://zenbound.com/">Zen Bound</a></span> ($5.99 AUD) (an AMAZING game!)</li>
</ul>
<p>So that&#8217;s the update in alphabetical order, if you know of any other must-haves, let me know!</p>


<p>Related posts:<ol><li><a href='http://japh.com.au/general/excuse-me-while-i-change-in-front-of-you/' rel='bookmark' title='Permanent Link: Excuse me while I change in front of you!'>Excuse me while I change in front of you!</a> <small>Have you ever seen that in shopping centres when a...</small></li>
</ol></p><img src="http://feeds.feedburner.com/~r/JaphethThomson/~4/B2YDes-wRpc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://japh.com.au/general/must-have-iphone-apps-update/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		<feedburner:origLink>http://japh.com.au/general/must-have-iphone-apps-update/</feedburner:origLink></item>
		<item>
		<title>Sending scheduled emails with PHP</title>
		<link>http://feedproxy.google.com/~r/JaphethThomson/~3/W-t_OnL4IfY/</link>
		<comments>http://japh.com.au/development/sending-scheduled-emails-with-php/#comments</comments>
		<pubDate>Fri, 06 Mar 2009 14:09:33 +0000</pubDate>
		<dc:creator>Japh</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[PHP cron email]]></category>

		<guid isPermaLink="false">http://japheththomson.com/?p=83</guid>
		<description><![CDATA[Ok, so there are two main topics being covered here:

Sending emails with PHP
Running PHP scripts with a cronjob


Sending emails with PHP
Step 1
First of all, we&#8217;re going to install the PEAR::Mail package.  PHP&#8217;s built-in mail() function isn&#8217;t particularly secure, so using an actual SMTP email account seems nicer  :)
If you don&#8217;t already have PEAR::Mail installed, you [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>Ok, so there are two main topics being covered here:</p>
<ol>
<li>Sending emails with PHP</li>
<li>Running PHP scripts with a cronjob</li>
</ol>
<p><span id="more-83"></span></p>
<h3>Sending emails with PHP</h3>
<p><strong>Step 1</strong></p>
<p>First of all, we&#8217;re going to install the PEAR::Mail package.  PHP&#8217;s built-in mail() function isn&#8217;t particularly secure, so using an actual SMTP email account seems nicer  :)</p>
<p>If you don&#8217;t already have PEAR::Mail installed, you may need to request from your host that they install it.  If you have SSH / shell access to your server, you can probably do it yourself by running the following command:</p>

<div class="wp_codebox"><table><tr id="p8312"><td class="code" id="p83code12"><pre class="php" style="font-family:monospace;">pear install <a href="http://www.php.net/mail"><span style="color: #990000;">mail</span></a></pre></td></tr></table></div>

<p>Now you should be able to use this library with the following code in the top of your PHP script:</p>

<div class="wp_codebox"><table><tr id="p8313"><td class="code" id="p83code13"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Mail.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>This may seem odd, because you have no Mail.php file in your web root, but trust me it works.  This is because PEAR is in PHP&#8217;s path variables, so if it doesn&#8217;t find the Mail.php file in your web root, it already knows to look there.</p>
<p><strong>Step 2</strong></p>
<p>The next part is actually writing some PHP that will send a message.  You will need a few details of your mail server for this bit, such as SMTP server name, your username and your password.  You will also need an email address to send to, and one to send from, of course!</p>

<div class="wp_codebox"><table><tr id="p8314"><td class="code" id="p83code14"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">require_once</span> <span style="color: #0000ff;">&quot;Mail.php&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Inclusion of PEAR::Mail</span>
<span style="color: #000088;">$from</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Joe Bloggs &lt;j.bloggs@domain.com&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$to</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;John Citizen &lt;citizenj@exampledomain.com&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$subject</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Test message&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$message</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Test message.'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$host</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;smtp.domain.com&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$username</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;jbloggs&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$password</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;password&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$headers</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a> <span style="color: #009900;">&#40;</span>
    <span style="color: #0000ff;">'From'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$from</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'To'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$to</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'Subject'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$subject</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Now we will create an SMTP object with the appropriate details</span>
<span style="color: #000088;">$smtp</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/mail"><span style="color: #990000;">Mail</span></a><span style="color: #339933;">::</span><span style="color: #004000;">factory</span><span style="color: #009900;">&#40;</span>
    <span style="color: #0000ff;">'smtp'</span><span style="color: #339933;">,</span>
    <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a> <span style="color: #009900;">&#40;</span>
        <span style="color: #0000ff;">'host'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$host</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'auth'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'username'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$username</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'password'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$password</span>
    <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Here we actually send the email</span>
<span style="color: #000088;">$mail</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$smtp</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">send</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$to</span><span style="color: #339933;">,</span> <span style="color: #000088;">$headers</span><span style="color: #339933;">,</span> <span style="color: #000088;">$message</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// And check for errors, or if the email was sent successfully</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>PEAR<span style="color: #339933;">::</span><span style="color: #004000;">isError</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$mail</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">echo</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;p&gt;&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$mail</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;/p&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">echo</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;p&gt;Message successfully sent!&lt;/p&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>I&#8217;ve put some comments in this script, just to make sure you know what&#8217;s going on, but basically that&#8217;s it!</p>
<h3>Running PHP scripts with a cronjob</h3>
<p><strong>Step 3</strong></p>
<p>Using cronjobs seems difficult, and some people are put off by the slightly archaic looking format&#8230;  but they&#8217;re actually very simple.  You put multiple entries (cronjobs) into the crontab, and then they run!  Look at the following crontab entry:</p>

<div class="wp_codebox"><table><tr id="p8315"><td class="code" id="p83code15"><pre class="php" style="font-family:monospace;"><span style="color: #cc66cc;">0</span> <span style="color: #339933;">*</span> <span style="color: #339933;">*</span> <span style="color: #339933;">*</span> <span style="color: #339933;">*</span> <span style="color: #339933;">/</span>usr<span style="color: #339933;">/</span>local<span style="color: #339933;">/</span>bin<span style="color: #339933;">/</span>php <span style="color: #339933;">-</span>q <span style="color: #339933;">/</span>path<span style="color: #339933;">/</span>to<span style="color: #339933;">/</span>script<span style="color: #339933;">/</span>schedule<span style="color: #339933;">.</span>php</pre></td></tr></table></div>

<p>What this says is, everytime the minute is 0 (i.e. on the hour), run that command.  Look at this crontab entry:</p>

<div class="wp_codebox"><table><tr id="p8316"><td class="code" id="p83code16"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">*/</span><span style="color: #cc66cc;">5</span> <span style="color: #cc66cc;">2</span> <span style="color: #339933;">*</span> <span style="color: #339933;">*</span> <span style="color: #339933;">*</span> <span style="color: #339933;">/</span>usr<span style="color: #339933;">/</span>local<span style="color: #339933;">/</span>bin<span style="color: #339933;">/</span>php <span style="color: #339933;">-</span>q <span style="color: #339933;">/</span>path<span style="color: #339933;">/</span>to<span style="color: #339933;">/</span>script<span style="color: #339933;">/</span>schedule<span style="color: #339933;">.</span>php</pre></td></tr></table></div>

<p>This one says, each time the minute is a multiple of 5 (i.e. every 5 minutes) and the hour is 2 (i.e. 2:00am), run that command.</p>
<p>So that&#8217;s basically it!  With both those entries in the crontab, our emails will be sent every hour on the hour, and also every 5 minutes between 2:00am and 2:59am.</p>
<p>Hopefully this helps some people.  If you have any questions, or if I made any mistakes, feel free to let me know in the comments  :)</p>


<p>No related posts.</p><img src="http://feeds.feedburner.com/~r/JaphethThomson/~4/W-t_OnL4IfY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://japh.com.au/development/sending-scheduled-emails-with-php/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://japh.com.au/development/sending-scheduled-emails-with-php/</feedburner:origLink></item>
		<item>
		<title>Please vote for Cali!</title>
		<link>http://feedproxy.google.com/~r/JaphethThomson/~3/7awFO15dFu0/</link>
		<comments>http://japh.com.au/general/please-vote-for-cali/#comments</comments>
		<pubDate>Wed, 04 Mar 2009 23:57:04 +0000</pubDate>
		<dc:creator>Japh</dc:creator>
				<category><![CDATA[General Chatter]]></category>

		<guid isPermaLink="false">http://japheththomson.com/?p=80</guid>
		<description><![CDATA[You may (or maybe not, I guess) have heard of &#8220;The Best Job In The World&#8221; website?  Well they&#8217;re down to finalists now!  50 finalists, the top 11 of which will be sent to Australia to continue the selection process.
As a follower of GeekBrief, I&#8217;d like to support Cali Lewis coming on over to Australia [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>You may (or maybe not, I guess) have heard of &#8220;<a title="The Best Job In The World" href="http://www.islandreefjob.com/">The Best Job In The World</a>&#8221; website?  Well they&#8217;re down to finalists now!  50 finalists, the top 11 of which will be sent to Australia to continue the selection process.</p>
<p>As a follower of GeekBrief, I&#8217;d like to support Cali Lewis coming on over to Australia and briefing from our beautiful coast for a while!  So if you could please send her a vote (at least one, but one each day would be nice!), that would be much appreciated.</p>
<p>You can vote here:  <a title="Vote for Cali Lewis - Island Reef Job" href="http://www.islandreefjob.com/Cali">http://www.islandreefjob.com/Cali</a></p>
<p><!-- Smart Youtube --><span class="youtube"><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/ZVfn_Sb7rUc&amp;rel=1&amp;color1=3a3a3a&amp;color2=999999&amp;border=0&amp;fs=1&amp;hl=en&amp;autoplay=0&amp;showinfo=0&amp;iv_load_policy=3&amp;showsearch=0" /><param name="allowFullScreen" value="true" /><embed wmode="transparent" src="http://www.youtube.com/v/ZVfn_Sb7rUc&amp;rel=1&amp;color1=3a3a3a&amp;color2=999999&amp;border=0&amp;fs=1&amp;hl=en&amp;autoplay=0&amp;showinfo=0&amp;iv_load_policy=3&amp;showsearch=0" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="355" ></embed><param name="wmode" value="transparent" /></object></span></p>


<p>No related posts.</p><img src="http://feeds.feedburner.com/~r/JaphethThomson/~4/7awFO15dFu0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://japh.com.au/general/please-vote-for-cali/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://japh.com.au/general/please-vote-for-cali/</feedburner:origLink></item>
		<item>
		<title>First NETTUTS Tutorial Posted!</title>
		<link>http://feedproxy.google.com/~r/JaphethThomson/~3/ZrVUnj3Yp8s/</link>
		<comments>http://japh.com.au/general/first-nettuts-tutorial-posted/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 10:39:09 +0000</pubDate>
		<dc:creator>Japh</dc:creator>
				<category><![CDATA[General Chatter]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://japheththomson.com/?p=78</guid>
		<description><![CDATA[I wrote my first tutorial for NETTUTS recently and it was published last night.
Title: Create a Slick Flickr Gallery with SimplePie
 Description: I&#8217;ve wanted to write a tutorial for quite some time now, and APIs have always been a particular interest of mine. So with my wife&#8217;s recent foray into photography, I decided a Flickr [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>I wrote my first tutorial for <a title="NETTUTS" href="http://net.tutsplus.com" target="_blank">NETTUTS</a> recently and it was published last night.</p>
<p><strong>Title</strong>: <a title="Create a Slick Flickr Gallery with SimplePie" href="http://net.tutsplus.com/tutorials/php/create-a-slick-flickr-gallery-with-simplepie/">Create a Slick Flickr Gallery with SimplePie</a><br />
<strong> Description</strong>: I&#8217;ve wanted to write a tutorial for quite some time now, and APIs have always been a particular interest of mine. So with my wife&#8217;s recent foray into photography, I decided a Flickr tutorial would be first cab off the rank! Using RSS, Flickr and jQuery all together was pretty fun too.</p>
<p>Check it out!  <img src='http://japh.com.au/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>


<p>No related posts.</p><img src="http://feeds.feedburner.com/~r/JaphethThomson/~4/ZrVUnj3Yp8s" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://japh.com.au/general/first-nettuts-tutorial-posted/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://japh.com.au/general/first-nettuts-tutorial-posted/</feedburner:origLink></item>
		<item>
		<title>Tracking memory usage</title>
		<link>http://feedproxy.google.com/~r/JaphethThomson/~3/L3o1WAWPElo/</link>
		<comments>http://japh.com.au/general/tracking-memory-usage/#comments</comments>
		<pubDate>Fri, 06 Feb 2009 12:35:51 +0000</pubDate>
		<dc:creator>Japh</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[General Chatter]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://japheththomson.com/?p=67</guid>
		<description><![CDATA[Recently I received a warning from my host that I was WAY over my memory limit.  I had some long running processes going, and a few cron scripts that altogether were using about 220mb out of my 120mb of allowed memory usage&#8230;  oops!
Anyway, there&#8217;s currently no way from my control panel to see [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>Recently I received a warning from my host that I was WAY over my memory limit.  I had some long running processes going, and a few cron scripts that altogether were using about 220mb out of my 120mb of allowed memory usage&#8230;  oops!</p>
<p>Anyway, there&#8217;s currently no way from my control panel to see how memory I&#8217;m currently using, I have to run a command from a terminal, and certainly no way to tell usage over time.  So, after looking at a thread my hosting provider pointed me to, I decided to have a play with the Google Charts API!<br />
<span id="more-67"></span><br />
This is a pretty rudimentary solution, but it&#8217;s working so far for me.</p>
<p><strong>1. A very simple bash script</strong></p>

<div class="wp_codebox"><table><tr id="p6721"><td class="code" id="p67code21"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #c20cb9; font-weight: bold;">ps</span> <span style="color: #660033;">-u</span> username <span style="color: #660033;">-o</span> pid,rss,<span style="color: #7a0874; font-weight: bold;">command</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-e</span> mpm <span style="color: #660033;">-v</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{sum+=$2} END {print &quot;,&quot;, sum}'</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>webroot<span style="color: #000000; font-weight: bold;">/</span>mem<span style="color: #000000; font-weight: bold;">/</span>memdata.csv</pre></td></tr></table></div>

<p>The script basically just outputs the current memory usage at the time of running and appends it to a CSV file.</p>
<p><strong>2. Add the script to the crontab</strong></p>
<p>By running the following command (or one similar), I edit my crontab:</p>

<div class="wp_codebox"><table><tr id="p6722"><td class="code" id="p67code22"><pre class="bash" style="font-family:monospace;">crontab <span style="color: #660033;">-e</span></pre></td></tr></table></div>

<p>I then insert this line:</p>

<div class="wp_codebox"><table><tr id="p6723"><td class="code" id="p67code23"><pre class="bash" style="font-family:monospace;"><span style="color: #000000;">0</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>full<span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>script<span style="color: #000000; font-weight: bold;">/</span>memlogger</pre></td></tr></table></div>

<p>So now that bash script will be run every hour, on the hour.</p>
<p><strong>3. Writing a PHP script to display a Google Chart</strong></p>

<div class="wp_codebox"><table><tr id="p6724"><td class="code" id="p67code24"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">// Settings</span>
<span style="color: #000088;">$max_mem</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">120</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Your memory limit, in MB</span>
<span style="color: #000088;">$data_file</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'memdata.csv'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$chart_width</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">550</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$chart_height</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">400</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #339933;">&lt;!</span>DOCTYPE html <span style="color: #000000; font-weight: bold;">PUBLIC</span> <span style="color: #0000ff;">&quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;</span> <span style="color: #0000ff;">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>html xmlns<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://www.w3.org/1999/xhtml&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>meta http<span style="color: #339933;">-</span>equiv<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Content-Type&quot;</span> content<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/html; charset=utf-8&quot;</span> <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;</span>title<span style="color: #339933;">&gt;</span>Memory Usage<span style="color: #339933;">&lt;/</span>title<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>head<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;</span>body<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>h2<span style="color: #339933;">&gt;</span>Memory Usage<span style="color: #339933;">&lt;/</span>h2<span style="color: #339933;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$md</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/file_get_contents"><span style="color: #990000;">file_get_contents</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data_file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$md</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/preg_replace"><span style="color: #990000;">preg_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/(\s+|\n)/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$md</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$md</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/explode"><span style="color: #990000;">explode</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">','</span><span style="color: #339933;">,</span> <span style="color: #000088;">$md</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<a href="http://www.php.net/array_shift"><span style="color: #990000;">array_shift</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$md</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$max</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$min</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$md</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$v</span> <span style="color: #339933;">&gt;</span> <span style="color: #000088;">$max</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$max</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$v</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000088;">$base</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$max</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$base</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$max_mem</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">1024</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> <span style="color: #000088;">$max</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$base</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/round"><span style="color: #990000;">round</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$base</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #339933;">&lt;</span>p<span style="color: #339933;">&gt;&lt;</span>img src<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://chart.apis.google.com/chart?cht=lc&amp;chd=t:&lt;?php echo implode(',', <span style="color: #006699; font-weight: bold;">$md</span>); ?&gt;&amp;chs=&lt;?php echo <span style="color: #006699; font-weight: bold;">$chart_width</span>; ?&gt;x&lt;?php echo <span style="color: #006699; font-weight: bold;">$chart_height</span>; ?&gt;&amp;chxt=y,r&amp;chxr=0,&lt;?php echo <span style="color: #006699; font-weight: bold;">$min</span>; ?&gt;,&lt;?php echo <span style="color: #006699; font-weight: bold;">$max</span>; ?&gt;|1,&lt;?php echo <span style="color: #006699; font-weight: bold;">$min</span>; ?&gt;,&lt;?php echo <span style="color: #006699; font-weight: bold;">$max</span>; ?&gt;&amp;chds=&lt;?php echo <span style="color: #006699; font-weight: bold;">$min</span>; ?&gt;,&lt;?php echo <span style="color: #006699; font-weight: bold;">$max</span>; ?&gt;&amp;chm=r,FF0000,0,&lt;?php echo <span style="color: #006699; font-weight: bold;">$base</span>; ?&gt;,&lt;?php echo <span style="color: #006699; font-weight: bold;">$base</span>+0.005; ?&gt;&quot;</span> <span style="color: #339933;">/&gt;&lt;/</span>p<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>body<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>html<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>This code basically just imports the data into an array, and then works a few things out for proper axis labelling, and away it goes!  It&#8217;s pretty quick and dirty, and could probably have been done nicer&#8230;  maybe I&#8217;ll come back and fix it up some time.</p>
<p>It also uses your memory limit amount to show a red line on the graph if you go over  <img src='http://japh.com.au/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Here&#8217;s the chart using some sample data:<br />
<img src="http://japh.com.au/wp-content/uploads/2009/02/memory-usage-chart-300x245.jpg" alt="Memory Usage Chart" title="Memory Usage Chart" width="300" height="245" class="alignnone size-medium wp-image-75" /></p>


<p>No related posts.</p><img src="http://feeds.feedburner.com/~r/JaphethThomson/~4/L3o1WAWPElo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://japh.com.au/general/tracking-memory-usage/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://japh.com.au/general/tracking-memory-usage/</feedburner:origLink></item>
	</channel>
</rss><!-- This site's performance optimized by W3 Total Cache. Dramatically improve the speed and reliability of your blog!

Learn more about our WordPress Plugins: http://www.w3-edge.com/wordpress-plugins/


Served from: localhost.localdomain @ 2010-03-09 18:36:47 -->
