<?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>HonkBlog&#124;TechNotes &#187; Development</title>
	<atom:link href="http://www.honk.com.au/index.php/category/dev/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.honk.com.au</link>
	<description>Notes, fixes, tips and suggestions from across my technical world</description>
	<lastBuildDate>Wed, 02 Jun 2010 13:24:50 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Convert adjacency list model to a modified preorder tree traversal (MPTT) model hierarchy</title>
		<link>http://www.honk.com.au/index.php/2010/04/22/convert-adjacency-list-model-to-a-modified-preorder-tree-traversal-mptt-model-hierarchy/</link>
		<comments>http://www.honk.com.au/index.php/2010/04/22/convert-adjacency-list-model-to-a-modified-preorder-tree-traversal-mptt-model-hierarchy/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 09:55:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Cake PHP]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Patterns]]></category>
		<category><![CDATA[adjacency list model]]></category>
		<category><![CDATA[mptt]]></category>

		<guid isPermaLink="false">http://www.honk.com.au/?p=329</guid>
		<description><![CDATA[This us more a note to self than anything else, as I trawled the internet trying to find a definitive answer to this.  Modified preorder tree traversal (MPTT) is an efficient way to store and query hierarchical data in a database.  This article on the MySQL site explains why this is the case with a neat comparison between [...]]]></description>
			<content:encoded><![CDATA[<p>This us more a note to self than anything else, as I trawled the internet trying to find a definitive answer to this.  <strong>Modified preorder tree traversal (MPTT)</strong> is an efficient way to store and query hierarchical data in a database.  <a href="http://dev.mysql.com/tech-resources/articles/hierarchical-data.html" target="_blank">This article on the MySQL site</a> explains why this is the case with a neat comparison between MPTT and a more &#8220;old school&#8221; approach which relies on a parent-child recursive relationship in the database (known as the Adjacency List Model).  I wont repeat what it says but suffice to say I&#8217;ve been experimenting with MPTT for a while and like the way it does things.</p>
<p>I use cakephp a lot and I have recently created a hierarchy of some 120,000 items, all neatly mapped with parent-child relationships but no MPTT data.  Cake&#8217;s inbuilt mechanism for <strong>converting adjacency list model to a modified preorder tree traversal (MPTT) </strong>model hierarchy was far to slow: on my PC and with this much data it was taking about a second per row, which adds up to an awfully long time to process the whole tree!</p>
<p>Given the need for this type of conversion I found it surprisingly difficult to find a script that the the Agency list to MPTT conversion, so I thought I&#8217;d document what I found here, and add to it if I find any further.</p>
<p>So, using the CakePHP naming conventions here is a script to convert Agency List to MPTT using MySQL and PHP.  This is much faster than the native <a href="http://mrphp.com.au/code/code-category/cakephp/cakephp-1-2/fun-tree-behaviour-cakephp" target="_blank">CakePHP model-&gt;recover() m</a>ethod (which rebuilds your hierarchy) which is important on big datasets obviously.  This script is based on the function in <a href="http://articles.sitepoint.com/article/hierarchical-data-database/3" target="_blank">this excellent article on MPTT</a>.</p>
<pre class="brush:php">//Make sure it doesn't time out
        set_time_limit (0);

	$con = mysql_connect("localhost","user","password");
	if (!$con){die('Could not connect: ' . mysql_error());}
	mysql_select_db("your_db", $con);

	function rebuild_tree($parent_id, $left) {
	   // the right value of this node is the left value + 1
	   $right = $left+1;   

	   // get all children of this node
	   $result = mysql_query('SELECT id FROM categories '.
	                          'WHERE parent_id="'.$parent_id.'";');   

	   while ($row = mysql_fetch_array($result)) {
	       // recursive execution of this function for each
	       // child of this node
	       // $right is the current right value, which is
	       // incremented by the rebuild_tree function
	       $right = rebuild_tree($row['id'], $right);
	   }   

	   // we've got the left value, and now that we've processed
	   // the children of this node we also know the right value
	   mysql_query('UPDATE categories SET lft='.$left.', rght='.
	                $right.' WHERE id="'.$parent_id.'";');   

	   // return the right value of this node + 1
	   return $right+1;
	}   

rebuild_tree('1',1);

mysql_close($con);</pre>
<p>Using pure traditional SQL you can use the following script apparently, but I didn&#8217;t have time to make it work in MySQL and the above processed things quickly enough.  The source of the script below is here http://data.bangtech.com/sql/nested_set_treeview.htm</p>
<pre class="brush:sql">-- Tree holds the adjacency model
CREATE TABLE Tree
(emp CHAR(10) NOT NULL,
 boss CHAR(10));

INSERT INTO Tree
SELECT emp, boss FROM Personnel;

-- Stack starts empty, will holds the nested set model
CREATE TABLE Stack
(stack_top INTEGER NOT NULL,
 emp CHAR(10) NOT NULL,
 lft INTEGER,
 rgt INTEGER);

BEGIN ATOMIC
DECLARE counter INTEGER;
DECLARE max_counter INTEGER;
DECLARE current_top INTEGER;

SET counter = 2;
SET max_counter = 2 * (SELECT COUNT(*) FROM Tree);
SET current_top = 1;

INSERT INTO Stack
SELECT 1, emp, 1, NULL
 FROM Tree
 WHERE boss IS NULL;

DELETE FROM Tree
 WHERE boss IS NULL;

WHILE counter &lt;= (max_counter - 2)
LOOP IF EXISTS (SELECT *
 FROM Stack AS S1, Tree AS T1
 WHERE S1.emp = T1.boss
 AND S1.stack_top = current_top)
 THEN
 BEGIN -- push when top has subordinates, set lft value
 INSERT INTO Stack
 SELECT (current_top + 1), MIN(T1.emp), counter, NULL
 FROM Stack AS S1, Tree AS T1
 WHERE S1.emp = T1.boss
 AND S1.stack_top = current_top;

 DELETE FROM Tree
 WHERE emp = (SELECT emp
 FROM Stack
 WHERE stack_top = current_top + 1);

 SET counter = counter + 1;
 SET current_top = current_top + 1;
 END
 ELSE
 BEGIN -- pop the stack and set rgt value
 UPDATE Stack
 SET rgt = counter,
 stack_top = -stack_top -- pops the stack
 WHERE stack_top = current_top
 SET counter = counter + 1;
 SET current_top = current_top - 1;
 END IF;
 END LOOP;
END;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.honk.com.au/index.php/2010/04/22/convert-adjacency-list-model-to-a-modified-preorder-tree-traversal-mptt-model-hierarchy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Anatomy of a Facebook Application &#8211; required viewing for architecture, FBML and FQL</title>
		<link>http://www.honk.com.au/index.php/2010/04/15/anatomy-of-a-facebook-application-required-viewing-for-architecture-fbml-and-fql/</link>
		<comments>http://www.honk.com.au/index.php/2010/04/15/anatomy-of-a-facebook-application-required-viewing-for-architecture-fbml-and-fql/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 11:42:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Facebook Apps]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[anatomy]]></category>
		<category><![CDATA[fbml]]></category>
		<category><![CDATA[fql]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://www.honk.com.au/?p=325</guid>
		<description><![CDATA[While doing some research on Facebook Apps today I came across these excellent (albeit a little old) videos on TheChickenTest on the anatomy of a Facebook application.  I&#8217;ve played around with Facebook Apss before, but to be frank have never really taken the time to get to grips with them as a whole, only ever [...]]]></description>
			<content:encoded><![CDATA[<p>While doing some research on Facebook Apps today I came across these excellent (albeit a little old) videos on <a href="http://www.thechickentest.com/2007/08/facebookcamptoronto-videos/">TheChickenTest</a> on the <strong>anatomy of a Facebook application</strong>.  I&#8217;ve played around with Facebook Apss before, but to be frank have never really taken the time to get to grips with them as a whole, only ever really focussing on spot tasks and specific requirements.</p>
<p>Check out the below, they&#8217;re required viewing as far as I&#8217;m concerned for potential Facebook App developers.</p>
<h4>Anatomy of a Facebook Application (JayGoldman, Radiant Core)</h4>
<p><object type="application/x-shockwave-flash" data="http://flash.revver.com/player/1.0/player.swf?mediaId=365010" width="480" height="392" wmode="transparent"><param name="movie" value="http://flash.revver.com/player/1.0/player.swf?mediaId=365010" /></object></p>
<h4>FBML Overview (Sunil Boodram, Trapeze Media)</h4>
<p><object type="application/x-shockwave-flash" data="http://flash.revver.com/player/1.0/player.swf?mediaId=365139" width="480" height="392" wmode="transparent"><param name="movie" value="http://flash.revver.com/player/1.0/player.swf?mediaId=365139" /></object></p>
<h4>FQL Overview (Craig Saila)</h4>
<p><object type="application/x-shockwave-flash" data="http://flash.revver.com/player/1.0/player.swf?mediaId=365184" width="480" height="392" wmode="transparent"><param name="movie" value="http://flash.revver.com/player/1.0/player.swf?mediaId=365184" /></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.honk.com.au/index.php/2010/04/15/anatomy-of-a-facebook-application-required-viewing-for-architecture-fbml-and-fql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CFDUMP equivalent in Flex?</title>
		<link>http://www.honk.com.au/index.php/2010/02/18/cfdump-equivalent-in-flex/</link>
		<comments>http://www.honk.com.au/index.php/2010/02/18/cfdump-equivalent-in-flex/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 19:45:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Learning Curve]]></category>
		<category><![CDATA[Quickstart]]></category>
		<category><![CDATA[Transition]]></category>

		<guid isPermaLink="false">http://www.honk.com.au/?p=301</guid>
		<description><![CDATA[I&#8217;ve made the leap into the world of Flex in the last day or so, and so am going through the process of &#8220;Flexing&#8221; concepts I know from other languages.  I&#8217;m going to make a note of all of them because I think they&#8217;re handy to know.
Tonight while trying to workout some functionality related to web services [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve made the leap into the world of Flex in the last day or so, and so am going through the process of &#8220;Flexing&#8221; concepts I know from other languages.  I&#8217;m going to make a note of all of them because I think they&#8217;re handy to know.</p>
<p>Tonight while trying to workout some functionality related to web services I found I needed to delve into the data being retrieved,  the need for the ever handy CFDUMP came to mind.  A look around showed that there doesn&#8217;t appear to be anything as user friendly as <strong>CFdump in Flex</strong>, but I cam across this <a href="http://www.tricedesigns.com/tricedesigns_home/blog/2006/10/objectutil-stop-debugging-old-way.html" target="_blank">article on ObjectUtil</a>.</p>
<p>Basically you can use the ObjectUtil class to dump trace data (including complex objects) to the debug window thus:</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">&lt;mx:Script&gt;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">&lt;![CDATA[</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">import mx.rpc.events.ResultEvent;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">import mx.managers.PopUpManager;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">import mx.utils.ObjectUtil;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">private function remotingCFCHandler(e:ResultEvent):void</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">{</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//Dump the result of a call to a webservice</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">trace( ObjectUtil.toString( e.result ) );</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">}</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">]]&gt;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">&lt;/mx:Script&gt;</div>
<p>&lt;mx:Script&gt;</p>
<p>&lt;![CDATA[</p>
<p>import mx.rpc.events.ResultEvent;</p>
<p>import mx.managers.PopUpManager;</p>
<p>import mx.utils.ObjectUtil;</p>
<p>private function remotingCFCHandler(e:ResultEvent):void</p>
<p>{</p>
<p>//Dump the result of a call to a webservice</p>
<p>trace( ObjectUtil.toString( e.result ) );</p>
<p>}</p>
<p>]]&gt;</p>
<p>&lt;/mx:Script&gt;</p>
<p>Which will while not quite CFDUMP will provide you (hopefully) with enough data to move past your problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.honk.com.au/index.php/2010/02/18/cfdump-equivalent-in-flex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>fb.connect.logout doesn&#8217;t work (doesn&#8217;t log user out of facebook)</title>
		<link>http://www.honk.com.au/index.php/2009/12/03/fb-connect-logout-doesnt-work-doesnt-log-user-out-of-facebook/</link>
		<comments>http://www.honk.com.au/index.php/2009/12/03/fb-connect-logout-doesnt-work-doesnt-log-user-out-of-facebook/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 10:06:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Facebook Connect]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[connect]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[logout]]></category>

		<guid isPermaLink="false">http://www.honk.com.au/?p=272</guid>
		<description><![CDATA[I&#8217;ve been doing a Facebook Connect implementation using CakePHP and was having no luck using the fb.connect.logout function.  I&#8217;m not sure whether this qualifies as a bug (dodgy code) or just a case of RTFM (or look at the examples closely) but I simply couldn&#8217;t get the fb.connect.logout function to log me out of Facebook [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been doing a Facebook Connect implementation using CakePHP and was having no luck using the fb.connect.logout function.  I&#8217;m not sure whether this qualifies as a bug (dodgy code) or just a case of RTFM (or look at the examples closely) but I simply couldn&#8217;t get the fb.connect.logout function to log me out of Facebook and consequently my own application.</p>
<p>Testing a few combinations the on</p>
<p>&lt;a href=&#8221;/users/logout&#8221; onclick=&#8221;FB.Connect.logout(logoutCallback())&#8221;&gt;Logout&lt;/a&gt;</p>
<p>(who&#8217;s logic I found here <a href="http://developers.facebook.com/docs/?u=facebook.jslib.FB.Connect.logout" target="_blank">http://developers.facebook.com/docs/?u=facebook.jslib.FB.Connect.logout</a>)</p>
<p>simply didn&#8217;t work.  The function was called as was the callback but it simply didn&#8217;t log out of Facebook.</p>
<p>The only way I could get it to work was using the logoutAndRedirect function instead, using the following:</p>
<p>&lt;a href=&#8221;#&#8221; onclick=&#8221;FB.Connect.logoutAndRedirect(&#8216;/users/logout&#8217;)&#8221;&gt;Logout&lt;/a&gt;</p>
<p>NOTE: Originally I had put a value in the href attribute (&#8220;/users/logout&#8221; thinking it would degrade nicely) but this stopped the main function from working, so as far as I can tell you must have a # symbol in the href.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.honk.com.au/index.php/2009/12/03/fb-connect-logout-doesnt-work-doesnt-log-user-out-of-facebook/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Variable is &#8220;undefined&#8221; even with cfparam Coldfusion 9</title>
		<link>http://www.honk.com.au/index.php/2009/11/26/variable-is-undefined-even-with-cfparam-coldfusion-9/</link>
		<comments>http://www.honk.com.au/index.php/2009/11/26/variable-is-undefined-even-with-cfparam-coldfusion-9/#comments</comments>
		<pubDate>Thu, 26 Nov 2009 13:00:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Coldfusion]]></category>

		<guid isPermaLink="false">http://www.honk.com.au/?p=265</guid>
		<description><![CDATA[Going through some testing as part of our upgrade to Coldfusion 9 I encountered a compatibility issue that is worth knowing about.  In Coldfusion 9 there is now a variable status &#8220;undefined&#8221;, that is the variable can exist (and appear in cfdump for example) but is not usable, it is explicitly undefined.  This [...]]]></description>
			<content:encoded><![CDATA[<p>Going through some testing as part of our upgrade to Coldfusion 9 I encountered a compatibility issue that is worth knowing about.  In Coldfusion 9 there is now a variable status &#8220;undefined&#8221;, that is the variable can exist (and appear in cfdump for example) but is not usable, it is explicitly undefined.  This is a problem because if you try and use cfparam later for example it doesn&#8217;t override the &#8220;undefined&#8221; variable.   So far the only place I&#8217;ve seen this is when using components, and then to be fair the condition arose because of some inconsistent defaulting so it&#8217;s not completely the fault of the new process but it&#8217;s worth being aware of if you are getting <strong>unexplained &#8220;undefined&#8221; errors</strong> when moving up to Coldfusion 9.</p>
<p>Ok so consider the following:</p>
<p>&lt;CFFUNCTION name=&#8221;getByCriteria&#8221; access=&#8221;public&#8221; returntype=&#8221;query&#8221; output=&#8221;false&#8221; displayname=&#8221;" hint=&#8221;"&gt;<br />
&lt;CFARGUMENT name=&#8221;child_ocl_id&#8221; required=&#8221;false&#8221; &gt;</p>
<p>This will result in an explicitly set variable that is set to &#8220;undefined&#8221; &#8211; the cfdump is thus:</p>
<p style="text-align: center;"><img class="size-medium wp-image-266 aligncenter" title="cfdump_with_undefined_variable" src="http://www.honk.com.au/wp-content/uploads/2009/11/cfdump_with_undefined_variable-300x185.png" alt="cfdump_with_undefined_variable" width="300" height="185" /></p>
<p>Note the explicitly &#8220;undefined&#8221; status as well as (what my code was expecting) the &#8220;[empty string]&#8221; status</p>
<p>This stays the same whether you add a cfparam later or not, thus:</p>
<p>&lt;CFFUNCTION name=&#8221;getByCriteria&#8221; access=&#8221;public&#8221; returntype=&#8221;query&#8221; output=&#8221;false&#8221; displayname=&#8221;" hint=&#8221;"&gt;<br />
&lt;CFARGUMENT name=&#8221;child_ocl_id&#8221; required=&#8221;false&#8221; &gt;<br />
&lt;CFPARAM name=&#8221;arguments.child_ocl_id&#8221; default=&#8221;my new default&#8221; &gt;</p>
<p>Note the above example isn&#8217;t what was in my code!  It&#8217;s just a simple explanation of the behaviour I noticed.  So just something to be aware of if you get unexplained &#8220;undefined&#8221; errors in your migration to Coldfusion 9.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.honk.com.au/index.php/2009/11/26/variable-is-undefined-even-with-cfparam-coldfusion-9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to retrieve the Facebook session key using php client api</title>
		<link>http://www.honk.com.au/index.php/2009/11/24/how-to-retrieve-the-facebook-session-key-using-php-client-api/</link>
		<comments>http://www.honk.com.au/index.php/2009/11/24/how-to-retrieve-the-facebook-session-key-using-php-client-api/#comments</comments>
		<pubDate>Tue, 24 Nov 2009 11:19:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Facebook Connect]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[notetoself]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.honk.com.au/?p=261</guid>
		<description><![CDATA[Working through an implementation of the Facebook Connect I got caught up in the tangle of documentation that surrounds it and couldn&#8217;t work out how to get the session key information so here it is a note to self about how to retrieve the Facebook session key using php client api:
$fbsessionid = $this->facebook->api_client->session_key;
]]></description>
			<content:encoded><![CDATA[<p>Working through an implementation of the Facebook Connect I got caught up in the tangle of documentation that surrounds it and couldn&#8217;t work out how to get the session key information so here it is a note to self about <strong>how to retrieve the Facebook session key using php client api</strong>:</p>
<pre class="brush:php">$fbsessionid = $this->facebook->api_client->session_key;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.honk.com.au/index.php/2009/11/24/how-to-retrieve-the-facebook-session-key-using-php-client-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP new line not showing in text</title>
		<link>http://www.honk.com.au/index.php/2009/11/23/php-new-line-not-showing-in-text/</link>
		<comments>http://www.honk.com.au/index.php/2009/11/23/php-new-line-not-showing-in-text/#comments</comments>
		<pubDate>Mon, 23 Nov 2009 09:47:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[formatting]]></category>
		<category><![CDATA[linefeed]]></category>
		<category><![CDATA[notetoself]]></category>

		<guid isPermaLink="false">http://www.honk.com.au/?p=255</guid>
		<description><![CDATA[Note to self whenever you are experiencing problems with rendering new lines in php e.g. using \n you must wrap these in double quotes not single e.g.
This will NOT work
echo ='My line with a line feed \n';
This WILL work
echo ="My line with a line feed \n";
]]></description>
			<content:encoded><![CDATA[<p>Note to self whenever you are experiencing problems with rendering new lines in php e.g. using \n you must wrap these in double quotes not single e.g.</p>
<h2>This will NOT work</h2>
<pre class="brush:php">echo ='My line with a line feed \n';</pre>
<h2>This WILL work</h2>
<pre class="brush:php">echo ="My line with a line feed \n";</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.honk.com.au/index.php/2009/11/23/php-new-line-not-showing-in-text/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Free coldfusion Diff comparison of HTML &#8211; CFX_CompareHTML</title>
		<link>http://www.honk.com.au/index.php/2009/11/16/free-coldfusion-diff-comparison-of-html-cfx_comparehtml/</link>
		<comments>http://www.honk.com.au/index.php/2009/11/16/free-coldfusion-diff-comparison-of-html-cfx_comparehtml/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 09:07:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Coldfusion]]></category>
		<category><![CDATA[Open source]]></category>

		<guid isPermaLink="false">http://www.honk.com.au/?p=247</guid>
		<description><![CDATA[The Coldfusion open source community just keeps getting stronger.  Whenever I talk to other cf programmers who are thinking of moving to another platform (there still seems to be a deep seated belief that CF is not a &#8220;real&#8221; programming language) I point them to great projects like RIAForge or a host of open [...]]]></description>
			<content:encoded><![CDATA[<p>The Coldfusion open source community just keeps getting stronger.  Whenever I talk to other cf programmers who are thinking of moving to another platform (there still seems to be a deep seated belief that CF is not a &#8220;real&#8221; programming language) I point them to great projects like <a href="http://www.riaforge.org/" target="_blank">RIAForge</a> or a host of open source tags and components that I have used recently to remind them that the community is alive and well.</p>
<p>The latest of these that I have implemented successfully is an excellent implementation of <a href="http://code.google.com/p/daisydiff/" target="_blank">DaisyDiff </a>by <a href="http://www.cfdan.com" target="_blank">Daniel Mackey</a>.  Though he has put together a direct <a href="http://www.cfdan.com/posts/CompareHTMLComponent__JAR_to_compare_two_HTML_fragments.cfm" target="_blank">Java jar implementation</a> I have opted for his<a href="http://www.cfdan.com/posts/CFX_CompareHTML_ColdFusion_HTML_diff_custom_tag.cfm" target="_blank"> CFX_CompareHTML</a> implementation because of it&#8217;s support for UTF-8 characters, he sent it on to me directly the last time I checked it wasn&#8217;t available on line (thanks Dan).</p>
<p>The free CFX_compareHTML does a <strong>DIFF analyses on formatted html</strong>, and then displays it as a combined diff output, this is useful for comparing before and after content for example and is comparable to tools such as (the very expensive) <a href="http://www.softinterface.com/MD/Document-Comparison-Software.htm" target="_blank">diffdoc</a>.  Diffdoc costs about $4000 for a server license, and while it has more applications (i.e. as a desktop tool) for web based html comparison CFX_CompareHTML is more than adequate.</p>
<p>Once installed (the one downside of CFX tags is of course the need to install them and set their path in CF admin) it&#8217;s as simple as:</p>
<p><span style="color: #800000;">&lt;cfx_CompareHTML left=<span style="color: #0000ff;">&#8220;Some HTML content&#8221;</span> right=<span style="color: #0000ff;">&#8220;Some more HTML Content&#8221;</span>&gt;</span></p>
<p><span style="color: #800000;"><span style="color: #000000;">Produces the following (nicked from CFDan.com &#8211; hope that&#8217;s ok Dan?!)</span></span></p>
<p style="text-align: center;"><span style="color: #800000;"><span style="color: #000000;"><img class="aligncenter size-medium wp-image-248" title="compareHTML" src="http://www.honk.com.au/wp-content/uploads/2009/11/compareHTML-300x207.jpg" alt="compareHTML" width="300" height="207" /></span></span></p>
<p style="text-align: left;"><span style="color: #800000;"><span style="color: #000000;">As I mentioned there are a couple of great tags/components in the CF open source world that I&#8217;ve used lately, and inspired by this excellent work I&#8217;ll be documenting them over the coming days.<br />
</span></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.honk.com.au/index.php/2009/11/16/free-coldfusion-diff-comparison-of-html-cfx_comparehtml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Error: The requested address &#8220;/&#8221; was not found on this server &#8211; CakePHP Error</title>
		<link>http://www.honk.com.au/index.php/2009/10/26/error-the-requested-address-was-not-found-on-this-server-cakephp-error/</link>
		<comments>http://www.honk.com.au/index.php/2009/10/26/error-the-requested-address-was-not-found-on-this-server-cakephp-error/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 08:13:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Cake PHP]]></category>

		<guid isPermaLink="false">http://www.honk.com.au/?p=236</guid>
		<description><![CDATA[This morning when I uploaded my site to live I came across one of those cryptic CakePHP messages Error: The requested address &#8220;/&#8221; was not found on this serverwhich I thought I&#8217;d blog about just as a note to self.  I knew I had access to everything and my Auth setup was copied from DEV where it was [...]]]></description>
			<content:encoded><![CDATA[<p>This morning when I uploaded my site to live I came across one of those cryptic CakePHP messages <strong>Error: The requested address &#8220;/&#8221; was not found on this server</strong>which I thought I&#8217;d blog about just as a note to self.  I knew I had access to everything and my Auth setup was copied from DEV where it was working so I went through my normal routine for identifying the problem.</p>
<p>In my case it turned out to be a number of issues (a missing file and a missing database table) but the process to identify and therefore fix the problem is:</p>
<ol>
<li>Make sure you set up your DATABASE_CONFIG is setup correctly (database.php)</li>
<li>Check that your tmp folder (and all of it&#8217;s sub folders) are writable (at least chmod 666 on Linux),</li>
<li>While you&#8217;re there delete all cache files from <em>all</em>of the tmp sub folders</li>
</ol>
<p> After that, if you&#8217;re still having &#8220;Error: The requested address &#8220;/&#8221; was not found on this server&#8221; then you&#8217;re likely to be missing a database table or an include file, so go into your core.php and set:</p>
<pre class="brush:php">Configure::write('debug', 2);</pre>
<p>This should reveal any remaining issues.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.honk.com.au/index.php/2009/10/26/error-the-requested-address-was-not-found-on-this-server-cakephp-error/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>What is the difference between the Auth component and the ACL component in CakePHP?</title>
		<link>http://www.honk.com.au/index.php/2009/10/24/what-is-the-difference-between-the-auth-component-and-the-acl-component-in-cakephp/</link>
		<comments>http://www.honk.com.au/index.php/2009/10/24/what-is-the-difference-between-the-auth-component-and-the-acl-component-in-cakephp/#comments</comments>
		<pubDate>Sat, 24 Oct 2009 12:33:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Auth component]]></category>
		<category><![CDATA[Cake PHP]]></category>

		<guid isPermaLink="false">http://www.honk.com.au/?p=180</guid>
		<description><![CDATA[This is a part of my  series.
One of the things that I found most confusing about implementing the Auth component and ACL was their precise relationship, how they hung together, what one was and the other wasn&#8217;t or more specifically what one did and the other didn&#8217;t.
While conceptually not complicated &#8211; the Auth Component [...]]]></description>
			<content:encoded><![CDATA[<p><strong>This is a part of my <a href="http://www.honk.com.au/index.php/2009/10/13/guide-to-setting-up-the-cakephp-auth-component/">Guide to setting up the CakePHP auth component</a> series.</strong></p>
<p>One of the things that I found most confusing about implementing the Auth component and ACL was their precise relationship, how they hung together, what one was and the other wasn&#8217;t or more specifically what one did and the other didn&#8217;t.</p>
<p>While conceptually not complicated &#8211; the <em>Auth Component</em> is something that identifies a user whereas the <em>ACL component</em> is something that takes that knowledge and says &#8220;what does this identified user have access to&#8221; &#8211; they seem (at first) so intermeshed in the &#8220;Automagic&#8221; functions of CakePHP that it can be difficult to establish what is causing what to happen.</p>
<p>I found this particularly so when, having not gone through the <a href="http://book.cakephp.org/view/641/Simple-Acl-controlled-Application" target="_blank">Simple-Acl-controlled-Application tutorial</a> kindly provided by the CakePHP team, I dropped the Auth component into my components list and lo and behold I was required to authenticate against actions I had wanted protected.</p>
<p>It wasn&#8217;t until reading this article and doing a bit of experimenting i realised that while it was definitely &#8220;Authenticating&#8221; it was not &#8220;Checking access&#8221; so none of my ACL stuff was kicking in at all.</p>
<p>An example of how the two functions seem intermeshed is the allowedActions function that is specified in the beforeFilter:</p>
<p>$this-&gt;Auth-&gt;allowedActions = array(&#8216;*&#8217;);</p>
<p>This is (as the method path shows) a function of the Auth component, but it relates to Access, in this case the actions of the controller.  This is an important function to understand, this tells the AuthComponent to allow PUBLIC access to all actions, you can of course provide a specific array of actions here as well.  The important thing to understand is that &#8220;public&#8221; is just a default state given to a non authenticated user, it is not a specific group you need to create and assign by default (which is the case in some authentication systems I&#8217;ve seen).</p>
<p>So remember that while a user can be &#8220;authenticated&#8221; that is, they are known to the system they are not necessarily being  checked against their access profile,  $this-&gt;Auth-&gt;allowedActions can confuse matters if you&#8217;re not careful because it can suggest that the authenticated person does or doesn&#8217;t have access to something (because they get redirected to the login page).</p>
<p>When working out what is tripping up a security response, use this handy guide to <a href="http://www.honk.com.au/index.php/2009/10/13/debugging-cakephp-auth-component/">Debugging CakePHP Auth component</a> which can tell you what is being validated against and thus if it is your dodgy ACL setup or just the default settings in the Auth component that are causing any problems.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.honk.com.au/index.php/2009/10/24/what-is-the-difference-between-the-auth-component-and-the-acl-component-in-cakephp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
