<?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>Web Development Learnings &#187; Steve</title>
	<atom:link href="http://stevethomas.com.au/author/admin/feed" rel="self" type="application/rss+xml" />
	<link>http://stevethomas.com.au</link>
	<description>according to Steve Thomas</description>
	<lastBuildDate>Wed, 04 Jan 2012 08:07:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>How to Run Cron Jobs in CodeIgniter</title>
		<link>http://stevethomas.com.au/php/how-to-run-cron-jobs-in-codeigniter.html</link>
		<comments>http://stevethomas.com.au/php/how-to-run-cron-jobs-in-codeigniter.html#comments</comments>
		<pubDate>Wed, 04 Jan 2012 07:33:07 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://stevethomas.com.au/?p=258</guid>
		<description><![CDATA[<p>After a fair bit of <a href="http://www.google.com.au/#hl=en&#38;cp=17&#38;gs_id=1v&#38;xhr=t&#38;q=codeigniter+cron+job&#38;fp=b37e0351d48c1ee9" target="_blank">trawling</a> Google, I got the impression that setting up a cron job in codeigniter was going to be a bit tricky.</p>
<p>The two potential solutions I discovered were:</p>
<ol>
<li>execute the &#8220;wget&#8221; command to replicate a normal browser request, which then exposes my cron functionality to the big wide world and creates some additional unnecessary overheads, or</li>
<li>Create a bespoke front controller a bit like the existing index.php but specifically for cron jobs</li>
</ol>
<p>Neither of these options sound particularly ideal to me, and <strong>thankfully, there is a better way</strong> (and it turned out to be a case of <a href="http://codeigniter.com/user_guide/general/cli.html" target="_blank">RTFM</a>).</p>
<p>Firstly, just create a normal controller. I creatively called mine Cron.</p>
<p>Note the call to $this-&#62;input-&#62;is_cli_request() which ensures that <strong>this controller cannot be accessed directly from a url</strong>.</p>
<p>Next we setup our cron job as you would any other, except that you provide the path in a special format.</p>
<blockquote><p>php /path/to/index.php controller_name method_name ["params"]</p></blockquote>
<p>The first part is either the command &#8220;php&#8221; or your server path to php.</p>
<p>The second part is the absolute path to your CI front controller, eg. /path/to/index.php.</p>
<p>The third part is the controller name, followed by the method name, followed by optional parameters.</p>
<p>The CI manual gives the example:</p>
<blockquote><p>php /path/to/index.php cron foo</p></blockquote>
<p>If that doesn&#8217;t work you might need to specify your path to php. I set mine as follows:</p>
<blockquote><p>/usr/local/bin/php -f /home/clinic/public_html/index.php cron foo</p></blockquote>
<p>You can even pass parameters in quotes, which have the same effect as parameters in regular url requests!</p>
<blockquote><p>/usr/local/bin/php -f /home/clinic/public_html/index.php cron foo &#8220;beer&#8221;</p></blockquote>
<p><img title="impressive" src="http://stevethomas.com.au/wp-content/uploads/2012/01/images.jpg" alt="" width="225" height="225" /></p>
]]></description>
		<wfw:commentRss>http://stevethomas.com.au/php/how-to-run-cron-jobs-in-codeigniter.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automatically Submit Google CSE</title>
		<link>http://stevethomas.com.au/web-design/automatically-submit-google-cse.html</link>
		<comments>http://stevethomas.com.au/web-design/automatically-submit-google-cse.html#comments</comments>
		<pubDate>Fri, 27 May 2011 23:55:38 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://stevethomas.com.au/?p=226</guid>
		<description><![CDATA[<p>This tutorial outlines two techniques to customise <a href="http://www.google.com/cse/">Google&#8217;s Custom Search Engine</a>:</p>
<ol>
<li>Generating your own custom styled search form</li>
<li>Fetching the search results on page load rather than the default which requires the Google provided search form to be submitted</li>
</ol>
<p>This enables you to place your custom styled search form anywhere on your site (for example in a global site header), and when the form is submitted the search results are automatically loaded as soon as the user lands on the search page &#8211; as opposed to the default behavior which requires submission of the Google provided search box.</p>
<p>This is a sample global form that I use in my header file, which submits to the url &#8220;/search&#8221;. I will leave the CSS side to your imagination.</p>
<p>On my search page, the following code displays the Google CSE search box and pre-loads the results which are passed in from PHP&#8217;s $_GET. Don&#8217;t forget to replace myUniqueID with your Google CSE unique ID.</p>
]]></description>
		<wfw:commentRss>http://stevethomas.com.au/web-design/automatically-submit-google-cse.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CodeIgniter Getting Started Surprises</title>
		<link>http://stevethomas.com.au/php/codeigniter-getting-started-surprises.html</link>
		<comments>http://stevethomas.com.au/php/codeigniter-getting-started-surprises.html#comments</comments>
		<pubDate>Mon, 25 Apr 2011 03:02:54 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://stevethomas.com.au/?p=185</guid>
		<description><![CDATA[<p>I&#8217;ve been looking into the CodeIgniter PHP framework (CI)  for a couple of weeks and want to document some of the surprises and caveats I have discovered. Coming from a non-framework background, I was surprised at how similar the CI conventions are to my own pseudo &#8220;framework&#8221; that I use on my projects &#8211; so I guess I must&#8217;ve been doing something right so far!</p>
<p>This is what i&#8217;ve learnt.</p>
<h3>CI is backwards compatible with PHP4</h3>
<p><strong></strong>Which, in my opinion is something they should rectify &#8211; ie. retire support in the next major release and move forward. From what I have read about CI vs Kohana (a CI fork), it seems that CI is sacrificing pretty autoloading simply because they remain backwards compatible.</p>
<p><em><span style="color: #ff0000;">Edit:</span> This is actually incorrect, as of version 2.0.2 the minimum required version of PHP is 5.1.6. Thats to Dale for pointing this out in the comments.</em></p>
<h3>The MVC structure is superb, however&#8230;</h3>
<p><strong></strong>Alot of tutorials i&#8217;ve watched lean towards using helper functions within views, such as for forms. From a developer perspective thats fine, however you can imagine a designer having problems with form_open() when he wants to add a simple class or ID. The upside is that they are just helpers &#8211; if you don&#8217;t like them, don&#8217;t use them.</p>
<h3>Speaking of functions</h3>
<p><strong></strong>I was surprised to discover the folder full of procedural helper functions. This is nice in terms of using functions anywhere inside the application, although it does seem a little out of place in an OOP framework. It would be nice to see these converted into classes.</p>
<h3>Default session security is awful</h3>
<p><strong></strong>Usually a PHP session&#8217;s data is stored server side and only a small cookie is kept client side to track a user session. However in CI, the session data is stored <em>client</em>&#8230; <a href="http://stevethomas.com.au/php/codeigniter-getting-started-surprises.html" class="read_more">Read more</a></p>]]></description>
		<wfw:commentRss>http://stevethomas.com.au/php/codeigniter-getting-started-surprises.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Google-O-Meter tutorial with examples</title>
		<link>http://stevethomas.com.au/notes/google-o-meter-tutorial-with-examples.html</link>
		<comments>http://stevethomas.com.au/notes/google-o-meter-tutorial-with-examples.html#comments</comments>
		<pubDate>Mon, 14 Mar 2011 08:56:33 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Notes]]></category>

		<guid isPermaLink="false">http://stevethomas.com.au/?p=158</guid>
		<description><![CDATA[<p>I came across the Google-o-meter widget in the Google Charts API today, and had a perfect use for it in my current pet project, <a href="http://www.convictrecords.com.au">convict records</a>.</p>
<p>For the uninitiated, the Google Charts API allows you to request an image with query string parameters and format it in various different ways to produce a pretty graph.</p>
<p>I wanted to display the severity of a convict&#8217;s sentence, relative to the known minimum and maximum sentence terms of other convicts I had in my database.</p>
<p>It took a little wrangling before I discovered that I really only needed a few parameters to achieve what I wanted &#8211; the final request HTML looked like this:</p>
<p>Lets break that down a little.</p>
<h3>Range and Indicator Position</h3>
<p>The Google-o-meter defaults to a range of 0-100, therefore the easiest way to position your indicator is if you can create a percentage value from 0-100. It does also support custom ranges but that is beyond the scope of this tutorial.</p>
<p>How do we determine the position of the indicator (in PHP)?</p>
<p>The sentence severity is the sum of the sentence term in question, divided my the maximum known sentence (in my case 47 years, multiplied by 100, and finally rounded for good measure. This gives a percentage result somewhere between 0-100%. 23 years = 50%, 47 years = 100% and so on.</p>
<h3>Other Parameters</h3>
<p>Now that the sentence severity is known, all that is left to do is to pass the parameters to the Google Charts API.</p>
<ul>
<li><strong>chs=240&#215;100</strong><br />
The dimensions of the image length x height. *important* if you change the height value here, make sure you also change the &#60;img&#62; width and height attributes</li>
<li><strong>cht=gm<br />
</strong>The chart type &#8211; gm = google-o-meter</li>
<li><strong>chco=555555,FAFA05&#124;FF0000<br />
</strong>The indicator hexadecimal colour followed by the start colour and end colour (the</li></ul><p>&#8230; <a href="http://stevethomas.com.au/notes/google-o-meter-tutorial-with-examples.html" class="read_more">Read more</a></p>]]></description>
		<wfw:commentRss>http://stevethomas.com.au/notes/google-o-meter-tutorial-with-examples.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Convict Records of Australia</title>
		<link>http://stevethomas.com.au/announcements/convict-records-of-australia.html</link>
		<comments>http://stevethomas.com.au/announcements/convict-records-of-australia.html#comments</comments>
		<pubDate>Sun, 13 Feb 2011 22:34:33 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Announcements]]></category>

		<guid isPermaLink="false">http://stevethomas.com.au/?p=151</guid>
		<description><![CDATA[<p>Are you the descendant of a convict?</p>
<p>Utilising just released data from the State Library of Queensland, I have put together a searchable database of the British Convict transportation register. Over 123,000 of the 160,000 convicts transported to Australia are in this database &#8211; check out your families <a href="http://www.convictrecords.com.au">Convict Records</a>!</p>
<p>I have already found some interesting facts &#8211; Did You Know: 603 convicts carried the name John Smith &#8211; the most common name in the records?</p>
<p>Don&#8217;t miss the <a href="http://www.convictrecords.com.au/facts">convict facts</a> for all sorts of weird and interesting things.  Over time I will be adding information about the First Fleet, Second Fleet and Third Fleet, the lifestyle of convicts and more.</p>
<p>Did I mention its free?</p>
]]></description>
		<wfw:commentRss>http://stevethomas.com.au/announcements/convict-records-of-australia.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>jQuery Datepicker Ajax Request to Highlight Days from MySQL</title>
		<link>http://stevethomas.com.au/jquery/jquery-datepicker-ajax-request-to-highlight-days-from-mysql.html</link>
		<comments>http://stevethomas.com.au/jquery/jquery-datepicker-ajax-request-to-highlight-days-from-mysql.html#comments</comments>
		<pubDate>Mon, 24 Jan 2011 08:44:55 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://stevethomas.com.au/?p=114</guid>
		<description><![CDATA[<p>With a bit of fiddling you can retrieve a bunch of dates in a given timespan from the database (or elsewhere) and make your <a href="http://jqueryui.com/demos/datepicker/" target="_blank">jQuery UI Datepicker</a> a bit more practical and informative.</p>
<p>A method within the Datepicker plugin called <a href="http://jqueryui.com/demos/datepicker/#event-beforeShowDay" target="_blank">beforeShowDay</a> can do the following magic:</p>
<ol>
<li> disable a given day from selection</li>
<li> add a CSS class to a given day</li>
<li>add a tooltip to a given day</li>
</ol>
<p>Whilst it is probably a bit easier to make the ajax request itself using the beforeShowDay method, that puts us in the uncomfortable position of making 30+ ajax requests, one for every day displayed. If we are showing 2 months or the page has more than one datepicker, thats 60+ requests!</p>
<p>The better option is to make a single request onload, and an additional request whenever the month or year is changed.</p>
<p>The purpose of my implementation is to highlight days which have no due items in my <a href="http://www.studiotime.com.au" target="_blank">Studiotime time management</a> web software. This allows me to select a due date without worrying about whether I have other items already due on that day. You can just as easily check for other parameters relevant to your application &#8211; you need only adjust the sql query.</p>
<p>Lets start with the freeDays array and the onload javascript on the datepicker input.</p>
<p>So now we have a working method of requesting a php page on every page load and again every time the month or year selectors are changed.  Lets have a look at how the PHP and MySQL script looks:</p>
<p>The CSS rule is as follows: </p>
<p><strong>Disclaimer:</strong> I am no jQuery ninja and produced this tutorial by combining various other resources that I have linked to below. If you have any suggestions or improvements let&#8230; <a href="http://stevethomas.com.au/jquery/jquery-datepicker-ajax-request-to-highlight-days-from-mysql.html" class="read_more">Read more</a></p>]]></description>
		<wfw:commentRss>http://stevethomas.com.au/jquery/jquery-datepicker-ajax-request-to-highlight-days-from-mysql.html/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Notes for Installing Symphony CMS on Ubuntu</title>
		<link>http://stevethomas.com.au/notes/notes-for-installing-symphony-cms-on-ubuntu.html</link>
		<comments>http://stevethomas.com.au/notes/notes-for-installing-symphony-cms-on-ubuntu.html#comments</comments>
		<pubDate>Fri, 19 Nov 2010 06:12:29 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Notes]]></category>

		<guid isPermaLink="false">http://stevethomas.com.au/?p=108</guid>
		<description><![CDATA[<p><a href="http://symphony-cms.com/">Symphony CMS</a> is relatively easy to install on a Ubuntu server.</p>
<p>Here are a couple of commands I issued on a clean Ubuntu install to get everthing I needed for Symphony CMS, including cloning the git archive.</p>
<p><strong>Important notes:</strong></p>
<ul>
<li>I chose to make a symbolic link from /var/www to my user directory, to skip writing a new apache site-available file, however for production purposes I would suggest to write a new proper apache2 site configuration file</li>
<li>The default apache2 site-enabled file has &#8220;AllowOverride None&#8221; &#8211; this needs to be changed to &#8220;AllowOverride All&#8221; for mod_rewrite to work</li>
<li>The <strong>php5-xsl package is vital</strong> for XSLT to work!</li>
</ul>
<p><code><br />
<span style="color: #333333;"> sudo apt-get install git-core apache2 php5 mysql-server php5-mysql php5-xsl<br />
## now that mysql is installed, create a database and database user and GRANT PRIVILEGES ##<br />
sudo a2enmod rewrite<br />
sudo vi /etc/apache2/sites-enabled/000-default (change AllowOverride None to AllowOverride All)<br />
sudo /etc/init.d/apache2 restart<br />
cd /home/steve<br />
mkdir symphony-cms<br />
cd symphony-cms<br />
git clone git://github.com/symphonycms/symphony-2.git<br />
cd symphony-2<br />
git submodule update --init<br />
git clone git://github.com/symphonycms/workspace.git<br />
ln -s /home/steve/symphony-cms/symphony-2 /var/www/symphony<br />
chmod -R 777 /home/steve/symphony-cms/symphony-2/workspace<br />
chmod 777 /home/steve/symphony-cms/symphony-2<br />
## run web configuration now at yourwebsite.com/install.php ##<br />
chmod -R 755 workspace<br />
rm install.php install.sql workspace/install.sql update.php</span><br />
</code></p>
<p>See the git documentation for <a href="https://github.com/symphonycms/symphony-2">further reading</a>.</p>
<p>If you need any clarifications, ask away in the comments section.</p>
]]></description>
		<wfw:commentRss>http://stevethomas.com.au/notes/notes-for-installing-symphony-cms-on-ubuntu.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Moving backups between servers using WHM and cPanel</title>
		<link>http://stevethomas.com.au/web-hosting/moving-backups-between-servers-using-whm-and-cpanel.html</link>
		<comments>http://stevethomas.com.au/web-hosting/moving-backups-between-servers-using-whm-and-cpanel.html#comments</comments>
		<pubDate>Thu, 18 Dec 2008 01:24:18 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Web Hosting]]></category>

		<guid isPermaLink="false">http://stevethomas.com.au/?p=60</guid>
		<description><![CDATA[<p>It is surprisingly easy to move an account (website) from one cPanel based server to another.</p>
<ol>
<li>First, open cPanel on the old server, and go to the backups tab.</li>
<li>Next, select Generate/Download a Full Backup</li>
<li>Select Remote FTP server from the dropdown menu. At this point, enter the FTP details of any account on the new server. Any standard account will do, however <strong>do not</strong> create an account for the site that is to be moved on the new server beforehand, as you will only have to delete it again to restore the backup.</li>
<li>For the port option, usually 21 is the correct value.</li>
<li>Leave the Remote Dir value blank unless you have specifically created a folder for the backup (its easy to find anyway).</li>
<li>Once you press the Generate Backup button, cPanel will begin to create an archive of the entire site contents, including mail, mysql, logs, web files. Depending on the size of the site this might take a few minutes. (But god damn servers can transfer between each other quickly!).</li>
<li>Once the email notification arrives that the backup has been transferred, login to the new server as root. If you don&#8217;t have root privileges you might wish to contact your hosting company and hopefully they can take over from here.</li>
<li>The backup file will usually be located in /home/username/backup-mm.dd.yyyy_xx-xx-xx_oldusername.tar.gz</li>
<li>From the command line, navigate to the backup location, and enter something along the lines of<br />
mv backup-12.18.2008_11-08-09_oldusername.tar.gz /home</li>
<li>In WHM on the new server, select Restore a Full Backup/cpmove file. At this point it should detect the archive located in /home/. If not you must have put the archive in the wrong place.  Enter the old username and press Restore &#8211; thats it!</li>
</ol>
<p>How much better is that than moving an account database by&#8230; <a href="http://stevethomas.com.au/web-hosting/moving-backups-between-servers-using-whm-and-cpanel.html" class="read_more">Read more</a></p>]]></description>
		<wfw:commentRss>http://stevethomas.com.au/web-hosting/moving-backups-between-servers-using-whm-and-cpanel.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>5 Questions Web Developers Need To Ask Themselves</title>
		<link>http://stevethomas.com.au/rants/5-questions-web-developers-need-to-ask-themselves.html</link>
		<comments>http://stevethomas.com.au/rants/5-questions-web-developers-need-to-ask-themselves.html#comments</comments>
		<pubDate>Thu, 06 Nov 2008 13:19:43 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[Rants]]></category>

		<guid isPermaLink="false">http://stevethomas.com.au/?p=56</guid>
		<description><![CDATA[<p>It&#8217;s all very well for developers to create visionary frameworks and applications that only they understand &#8211; that is the freedom that makes web development great &#8211; until someone on the outside tries to work with it!</p>
<p>As far as i&#8217;m concerned, at the very least, the view/template of a web application needs to be changeable even to a web designer who has zero to minimal experience working with dynamic websites. Why &#8211; when we can create &#8220;beautiful&#8221; applications with minimal code repetition &#8211; because you are breaking the brilliance of code seperation. Its no different to seperating style and content. Lets face &#8211; usually, designers are good at design, and programmers are good at programming. Therefore the two skills need to co-exist, happily.</p>
<p><strong>5 Questions to ask yourself:</strong></p>
<p>1. How long would it take a pure web designer (HTML + CSS only) to change any element on any page?</p>
<p>2. How long would it take an average programmer to make some basic functionality changes, such as adding a new database table and running some pre-existing sanitation functions?</p>
<p>3. I&#8217;m looking at the website index. If I download index.php (or whatever) how many breadcrumbs do I have to follow to change, for example, the sidebar?</p>
<p>4. Is the folder structure sensible, and have the old files and folders been deleted?</p>
<p>5. Am I coding in a style that only I fully understand, on a commercial project that may rightfully be worked on by other developers that I may never speak to?</p>
]]></description>
		<wfw:commentRss>http://stevethomas.com.au/rants/5-questions-web-developers-need-to-ask-themselves.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to duplicate a phpBB3 theme</title>
		<link>http://stevethomas.com.au/php/how-to-duplicate-a-phpbb3-theme.html</link>
		<comments>http://stevethomas.com.au/php/how-to-duplicate-a-phpbb3-theme.html#comments</comments>
		<pubDate>Wed, 02 Jul 2008 01:51:16 +0000</pubDate>
		<dc:creator>Steve</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://stevethomas.com.au/?p=51</guid>
		<description><![CDATA[<p>If you ever want to duplicate an existing phpBB3 theme, you might be sorely frustrated when you can&#8217;t seem to get any of your changes to take hold. It is sometimes necessary to go to the ACP, and hit purge the cache, however there is a further trick.</p>
<p>First, duplicate the theme folder you want to start with, and rename to your theme name.</p>
<p>Second, you need to go to the theme folder, and open style.cfg, /imageset/imageset.cfg, /template/template.cfg, /theme/theme.cfg, in a text editor. All of these files contain name = value. Rename all of these to your theme name.</p>
<p>Upload all of these changes, then head to the ACP and go to the &#8220;styles&#8221; tab. Click install on your theme.  On the left hand menu, go to each of the style components, and select install for each one. Then head back to the main styles page and click &#8220;details&#8221; for your theme. Select the imageset, template and theme from the dropdown menu.</p>
<p>Now you should be done!</p>
]]></description>
		<wfw:commentRss>http://stevethomas.com.au/php/how-to-duplicate-a-phpbb3-theme.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

