<?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>K. Aning&#039;s Web Log</title>
	<atom:link href="http://blog.kaning.co.uk/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.kaning.co.uk</link>
	<description>Web development for the inexperienced and mildly skilled</description>
	<lastBuildDate>Fri, 30 Jul 2010 09:54:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Full Text Indexing with Zend_Search_Lucene</title>
		<link>http://blog.kaning.co.uk/archives/231</link>
		<comments>http://blog.kaning.co.uk/archives/231#comments</comments>
		<pubDate>Fri, 30 Jul 2010 09:54:39 +0000</pubDate>
		<dc:creator>Kwabena Aning</dc:creator>
				<category><![CDATA[Zend]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Lucene]]></category>
		<category><![CDATA[Zend_Search_Lucene]]></category>

		<guid isPermaLink="false">http://blog.kaning.co.uk/?p=231</guid>
		<description><![CDATA[To provide a robust search facility for content you have stored on a MySQL database, you may be thinking of using MySQLs builting full text indexing facility. This comes with the MyISAM storage engine and can be slightly limiting especially &#8230; <a href="http://blog.kaning.co.uk/archives/231">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>To provide a robust search facility for content you have stored on a MySQL database, you may be thinking of using MySQLs builting full text indexing facility. This comes with the MyISAM storage engine and can be slightly limiting especially if you would like to use foreign keys and such. So queries such has the following:</p>
<pre class="brush:sql"> "SELECT *, MATCH (page_content, page_title) AGAINST
(:keywords IN BOOLEAN MODE) AS relevance
FROM pages WHERE MATCH (page_content, page_title) AGAINST
(:keywords2 IN BOOLEAN MODE) ORDER BY relevance DESC";</pre>
<p>may not work for you although this may be how you want to go.</p>
<p>The best way I have found is to leave the indexing to another service in general. Enter Zend_Search_Lucene, i believe this is a PHP port of the Apache Lucene project written in Java&#8230;.</p>
<p>So basically we start by creating our index and document, personally i like to remove my personal classes and all that from the Zend Application as often as I can that way it&#8217;s mostly untainted and I can then use the same Zend Application with multiple custom code bases, enough on that already. However you chose to go you need a version of the following:</p>
<pre class="brush:php">class My_SearchService {

    protected
    $indexPath,
    $pageService,
    $pageIndexPath,
    $newsIndexPath,
    $document,
    $pageIndex;

    public function setIndexPath($indexPath) {
        $this-&gt;indexPath = $indexPath;
    }

    public function __construct($indexPath = NULL) {
        if (is_null($indexPath)) {
            $indexPath = APPLICATION_PATH . '/indexes/';
        }
        $this-&gt;setIndexPath($indexPath);
        $this-&gt;pageIndexPath = $this-&gt;indexPath . 'pageindex';
        $this-&gt;newsindexPath = $this-&gt;indexPath . 'newsindex';
        $this-&gt;pageService = new My_PageService();
    }

    public function createPageIndex() {
        $this-&gt;pageIndex = Zend_Search_Lucene::create($this-&gt;pageIndexPath);
// this is a simple Zend_Db_Table object returning data from my database
        $pages = $this-&gt;pageService-&gt;getAllPages()-&gt;toArray();

        foreach ($pages as $page) {
            $this-&gt;pageIndex
-&gt;addDocument(new My_Controller_Plugin_PageIndexer($page));
        }

        // commit index
        $this-&gt;pageIndex-&gt;commit();
    }

}</pre>
<p>This is assuming you have a folder structure that looks a bit like</p>
<p>/applications<br />
&#8211;/everything else here<br />
/library<br />
&#8211;/My<br />
&#8211;/PageService.php<br />
&#8212;&#8211;/Controller<br />
&#8212;&#8212;&#8212;-/Plugin<br />
&#8212;&#8212;&#8212;&#8212;&#8211;/PageIndexer.php</p>
<p>Our PageIndexer is just out extension of Zend_Search_Lucene_Document this is what we will be querying for all our page search needs.</p>
<pre class="brush:php">/**
 * Description of PageIndexer
 *
 * @author kaning
 */
class STEMNET_Controller_Plugin_PageIndexer extends Zend_Search_Lucene_Document {

    /**
     * Constructor. Creates our indexable document and adds all
     * necessary fields to it using the passed in document
     */
    public function __construct($document) {
       $this-&gt;addField(Zend_Search_Lucene_Field::Keyword('page_id', $document['page_id']));
        $this-&gt;addField(Zend_Search_Lucene_Field::UnIndexed('name', $document['page_name']));
        $this-&gt;addField(Zend_Search_Lucene_Field::UnIndexed('created', $document['publishdate']));
        $this-&gt;addField(Zend_Search_Lucene_Field::UnIndexed('caption', $document['page_caption']));
        $this-&gt;addField(Zend_Search_Lucene_Field::Text('title', $document['page_title']));
        $this-&gt;addField(Zend_Search_Lucene_Field::UnStored('content', $document['page_content']));
    }

}</pre>
<p>Not much introduction here besides the fact that I am adding the fields I want in my index bear in mind that the field data I am adding simply corresponds to what the Zend_Db_table select query returned for me.</p>
<p>Bear in mind that you really need to create the index only once. You will be updating it in subsequent times.</p>
<p>I formed the basis of this post from this <a title="PHPRiot website" href="http://www.phpriot.com/articles/zend-search-lucene" target="_blank">tutorial.</a> Look it up for more information</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 438px; width: 1px; height: 1px; overflow: hidden;">class STEMNET_SearchService {</p>
<p>protected<br />
$indexPath,<br />
$pageService,<br />
$pageIndexPath,<br />
$newsIndexPath,<br />
$document,<br />
$pageIndex;</p>
<p>public function setIndexPath($indexPath) {<br />
$this-&gt;indexPath = $indexPath;<br />
}</p>
<p>public function __construct($indexPath = NULL) {<br />
if (is_null($indexPath)) {<br />
$indexPath = APPLICATION_PATH . &#8216;/indexes/&#8217;;<br />
}<br />
$this-&gt;setIndexPath($indexPath);<br />
$this-&gt;pageIndexPath = $this-&gt;indexPath . &#8216;pageindex&#8217;;<br />
$this-&gt;newsindexPath = $this-&gt;indexPath . &#8216;newsindex&#8217;;<br />
$this-&gt;pageService = new STEMNET_PageService();<br />
}</p>
<p>public function createPageIndex() {<br />
$this-&gt;pageIndex = Zend_Search_Lucene::create($this-&gt;pageIndexPath);<br />
$pages = $this-&gt;pageService-&gt;getAllPages();</p>
<p>foreach ($pages as $page) {<br />
$this-&gt;pageIndex-&gt;addDocument(new STEMNET_Controller_Plugin_PageIndexer($page));<br />
}</p>
<p>// commit index<br />
$this-&gt;pageIndex-&gt;commit();<br />
}</p>
<p>}</p></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.kaning.co.uk/archives/231/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A question on Zend_Acls</title>
		<link>http://blog.kaning.co.uk/archives/228</link>
		<comments>http://blog.kaning.co.uk/archives/228#comments</comments>
		<pubDate>Wed, 28 Jul 2010 08:47:01 +0000</pubDate>
		<dc:creator>Kwabena Aning</dc:creator>
				<category><![CDATA[MVC Frameworks]]></category>
		<category><![CDATA[Zend]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Zend_Acl]]></category>

		<guid isPermaLink="false">http://blog.kaning.co.uk/?p=228</guid>
		<description><![CDATA[So I have been playing with the Zend_Acl for a while now and I managed to integrate it with this site I am working on. I am however asking myself a few questions here. What is the best way to &#8230; <a href="http://blog.kaning.co.uk/archives/228">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So I have been playing with the Zend_Acl for a while now and I managed to integrate it with this site I am working on.</p>
<p>I am however asking myself a few questions here. What is the best way to implement an ACL, which by the way is an Access Control List. On one hand I can do my &#8220;isAllowed&#8221; checks at the controller level, but do I want the user to get that far?</p>
<p>The other option is to implement our acl in the bootstrap file which always runs first and so makes it easier to check access even before the user gets to the routing and all that.</p>
<p>Now my problem is that I am a big fan of the MVC concept and by the very dynamic nature of the way I am working on this project, my ACLs are provided by a separate datastore i.e a database.</p>
<p>I don&#8217;t want to start calling in database adaptors and all that at bootstrap level, because that is just not nice. So I suppose the option here is to go with restricting access at in the init function of my controller.</p>
<p>Par example:</p>
<pre class="brush:php">$this-&gt;authObject = Zend_Auth::getInstance();
        // if not logged in, redirect to login form
        if (!$this-&gt;authObject-&gt;hasIdentity()) {
            $returnURL = urlencode('/admin');
            $this-&gt;_redirect('/login?returnUrl=' . $returnURL);
        } else {
            $this-&gt;userData = $this-&gt;authObject-&gt;getStorage();
            $this-&gt;userRole = $this-&gt;userData-&gt;read()-&gt;role;
        }
//some other instantiations here
if($this-&gt;accessControl-&gt;isAllowed($this-&gt;userRole)){
            $adminNavigation = Zend_Registry::get('AdminNavigation');
            $this-&gt;view-&gt;sideNavigation = $adminNavigation;

            $uri = $this-&gt;_request-&gt;getPathInfo();
            $this-&gt;view-&gt;uri = $uri;
        }else{
            $miscNavigation = Zend_Registry::get('MiscNavigation');
            $this-&gt;view-&gt;sideNavigation = $miscNavigation;
            $this-&gt;view-&gt;errorMessage = "This account does not have
enough permissions to be here";
        }</pre>
<p>You may notice from all this that I have an Admin Controller and based on our isAllowed value, we provide either an admin navigation or a misc one.</p>
<p>Obviously this can be rewritten to fit the purpose but it&#8217;s an example of using ACLs at the controller level.</p>
<p>Feedback welcome</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kaning.co.uk/archives/228/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A note on CAPTCHA decorators and Zend_Form_&#8230;</title>
		<link>http://blog.kaning.co.uk/archives/222</link>
		<comments>http://blog.kaning.co.uk/archives/222#comments</comments>
		<pubDate>Fri, 09 Jul 2010 14:45:43 +0000</pubDate>
		<dc:creator>Kwabena Aning</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Zend]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Zend_Form]]></category>

		<guid isPermaLink="false">http://blog.kaning.co.uk/?p=222</guid>
		<description><![CDATA[So if you have been struggling with setting up decorators with Zend_Form_Element_Captcha, here&#8217;s a note. I used to get an additional textbox with the hash returned by Zend creating the captcha image. And if you were stumped as to how &#8230; <a href="http://blog.kaning.co.uk/archives/222">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So if you have been struggling with setting up decorators with Zend_Form_Element_Captcha, here&#8217;s a note.</p>
<p>I used to get an additional textbox with the hash returned by Zend creating the captcha image. And if you were stumped as to how to remove them from your display try the following.</p>
<p>First of all your form element please note that I extracted this from my extension of the Zend_Form class</p>
<pre>
<pre class="brush:php">$captcha = new Zend_Form_Element_Captcha('captcha',
 array('label' =&gt; 'Type in the text you see in the image',
 'captcha' =&gt; array('captcha' =&gt; 'Image',
 'wordLen' =&gt; 6,
 'timeout' =&gt; 300,
 'height' =&gt; 60,
 'width' =&gt; 250,
 'font' =&gt; APPLICATION_PATH . '/../public/assets/fonts/arial.ttf',
 'fontSize' =&gt; 30,
 'imgDir' =&gt; APPLICATION_PATH . '/../public/assets/captcha/',
 'imgUrl' =&gt; 'http://' . $_SERVER['HTTP_HOST'] . '/assets/captcha/',
 ))
 );// there are certainly more options here but not necessary for my purposes.
//You can try altering the noise levels in the captcha image such as how many
// dots and lines should be created wiuth the image
// google noise levels in Zend_Form_Element_Captcha</pre>
</pre>
<p>This generates my captcha and I can add it to my form by going with</p>
<pre>
<pre class="brush:php">$this-&gt;addElements(array($email,$captcha,$submit));</pre>
</pre>
<p>Bear in mind that $name and $email and $submit are also new instances of their respective Zend_Form elements. In other words don&#8217;t include them if you&#8217;re copying and pasting.</p>
<p>Now after adding your elements you have to define a separate decorator for the Captcha because it&#8217;s obviously different from other form elements so here goes:</p>
<pre>
<pre class="brush:php">$captcha-&gt;setDecorators(array(
 'Captcha',
 'Errors',
 array('Label', array('separator' =&gt; '&lt;br /&gt;', 'requiredPrefix' =&gt; '* ')),
 array('HtmlTag', array('tag' =&gt; 'p', 'class' =&gt; 'form-element'))
 )
 );</pre>
</pre>
<p>Hope it&#8217;s helpful</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kaning.co.uk/archives/222/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Having multiple instances of Zend Navigation in a single View</title>
		<link>http://blog.kaning.co.uk/archives/216</link>
		<comments>http://blog.kaning.co.uk/archives/216#comments</comments>
		<pubDate>Fri, 09 Jul 2010 10:30:44 +0000</pubDate>
		<dc:creator>Kwabena Aning</dc:creator>
				<category><![CDATA[MVC Frameworks]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Zend]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[Zend_Navigation]]></category>

		<guid isPermaLink="false">http://blog.kaning.co.uk/?p=216</guid>
		<description><![CDATA[so I have been playing around with the Zend Framework rather extensively over the past few weeks and it has been a very rewarding experience. I am posting this here because it was a bit difficult finding a work around &#8230; <a href="http://blog.kaning.co.uk/archives/216">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>so I have been playing around with the Zend Framework rather extensively over the past few weeks and it has been a very rewarding experience.</p>
<p>I am posting this here because it was a bit difficult finding a work around for the issue I describe below.</p>
<p>Zend Navigation had been giving me a lot of problems especially because I could not get the Navigation object passed to my view object to render two different navigation configs. The top menu which remains the same for all pages and is rendered in my layout and other sub menus rendered in my individual view pages.</p>
<p>Now getting to it:</p>
<p>in my bootstrap I initialise my navigation with something like this.</p>
<pre>
<pre class="brush:php">$config = new Zend_Config_Xml(APPLICATION_PATH . '/configs/navigation.xml', 'nav');
 $miscNavConfig = new Zend_Config_Xml(APPLICATION_PATH . '/configs/miscnavigation.xml', 'nav');
 $navigation = new Zend_Navigation($config);
 $miscNavigation = new Zend_Navigation($miscNavConfig);
 Zend_Registry::set(Zend_Navigation, $navigation);
 Zend_Registry::set('MiscNavigation', $miscNavigation);
 $view-&gt;navigation($navigation);</pre>
</pre>
<p>Now  lines 2, 4, and 6 are the new lines I have added for additional nagivation. I beleive you should be able to add new configurations as you move along if you need to.</p>
<p>The next bit was retrieving the sub navigation in my controller:</p>
<pre>
<pre class="brush:php">$miscNavigation = Zend_Registry::get('MiscNavigation');
$this-&gt;view-&gt;miscnavigation = $miscNavigation;</pre>
</pre>
<p>You can do this in your view but because I route several of my views through this controller I want to have to do it only once.</p>
<p>And finally in my view:</p>
<pre>
<pre class="brush:php">$options = array('ulClass' =&gt; 'submenu');
echo($this-&gt;navigation()-&gt;menu()-&gt;renderMenu($this-&gt;miscnavigation, $options));</pre>
</pre>
<p>Bear in mind that I use the renderMenu method instead of passing $this-&gt;miscnavigation into the menu method. If you do that you will overwrite any other instances of menu you have on the page with the miscnavigation object.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kaning.co.uk/archives/216/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu Lucid Lynx</title>
		<link>http://blog.kaning.co.uk/archives/211</link>
		<comments>http://blog.kaning.co.uk/archives/211#comments</comments>
		<pubDate>Fri, 30 Apr 2010 08:34:57 +0000</pubDate>
		<dc:creator>Kwabena Aning</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.kaning.co.uk/archives/211</guid>
		<description><![CDATA[That&#8217;s the feeling right now. It&#8217;s out now so download here and try it out.]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://blog.kaning.co.uk/wp-content/uploads/2010/04/Lynx_pardinus.png" rel="lightbox[211]"><img class="size-medium wp-image-210 aligncenter" title="Lynx_pardinus" src="http://blog.kaning.co.uk/wp-content/uploads/2010/04/Lynx_pardinus-300x199.png" alt="" width="300" height="199" /></a></p>
<p style="text-align: center;">That&#8217;s the feeling right now. It&#8217;s out now so download <a href="http://www.ubuntu.com" target="_blank">here</a> and try it out.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kaning.co.uk/archives/211/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nerd Test</title>
		<link>http://blog.kaning.co.uk/archives/198</link>
		<comments>http://blog.kaning.co.uk/archives/198#comments</comments>
		<pubDate>Wed, 21 Apr 2010 13:10:50 +0000</pubDate>
		<dc:creator>Kwabena Aning</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[funny]]></category>

		<guid isPermaLink="false">http://blog.kaning.co.uk/?p=198</guid>
		<description><![CDATA[This is what the nerd test had to say about me. and on the advanced one]]></description>
			<content:encoded><![CDATA[<p>This is what the nerd test had to say about me.</p>
<p><a href="http://www.nerdtests.com/ft_nq.php"><br />
<img src="http://www.nerdtests.com/images/ft/nq/3da57b0395.gif" alt="I am nerdier than 93% of all people. Are you a nerd? Click here to take the Nerd Test, get geeky images and jokes, and write on the nerd forum!" /></a></p>
<p>and on the advanced one</p>
<p><a href="http://www.nerdtests.com/ft_nt2.php"><br />
<img src="http://www.nerdtests.com/images/badge/nt2/f96c48ec8574772e.png" alt="NerdTests.com says I'm a Kinda Dorky Nerd God.  Click here to take the Nerd Test, get geeky images and jokes, and write on the nerd forum!" /><br />
</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kaning.co.uk/archives/198/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Too Long</title>
		<link>http://blog.kaning.co.uk/archives/196</link>
		<comments>http://blog.kaning.co.uk/archives/196#comments</comments>
		<pubDate>Thu, 25 Mar 2010 09:46:14 +0000</pubDate>
		<dc:creator>Kwabena Aning</dc:creator>
				<category><![CDATA[REST]]></category>
		<category><![CDATA[Service Oriented Architecture]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[gaming]]></category>
		<category><![CDATA[mokocharlie]]></category>
		<category><![CDATA[web services]]></category>

		<guid isPermaLink="false">http://blog.kaning.co.uk/?p=196</guid>
		<description><![CDATA[So over the past few months I have not written anything here at all. Simply because I have been really busy with quite a few things and I am working under the assumption that I will be really busy for &#8230; <a href="http://blog.kaning.co.uk/archives/196">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So over the past few months I have not written anything here at all. Simply because I have been really busy with quite a few things and I am working under the assumption that I will be really busy for a while to come. I got some time now and I thought I should write something here.</p>
<p>What has got me busy over the past few weeks has been a Research Proposal. This is for a PhD and I really hope to get a place in the 2010/2011 academic year. It is obviously going to be in computing (Web Services and Quality of Service).</p>
<p>I have also been testing out all these new web 2.0 technologies and all that comes with it. The first was <a href="http://seesmic.com" target="_blank">seesmic</a>: I even got the blackberry app and all worked for a bit and then I got tired of it. I believe it was really about the feel of the application rather than how it worked, because I think it works fine I still prefer ubertwitter for those purposes.</p>
<p>Then I thought to myself, my facebook profile: I don&#8217;t remember the last time I actively updated that. At first I had my status automatically updated through my twitter updates. I am not sure at which point that bridge was hacked but I started updating my facebook pages in Japanese and trying to sell anyone who bothered to translate what was on there a wii or something like that. Goes without saying&#8230; I burnt that bridge really quickly &#8211; uninstalled my facebook-twitter app and basically haven&#8217;t used that profile for anything besides testing facebook integration with <a href="http://mokocharlie.com" target="_blank">mokocharlie.com</a> version 3 (which is coming out soon by the way).</p>
<p>I decided then to try a cross between my twitter account and a blog in the present incarnation it&#8217;s a service called tumblr. I even altered my A record so that this blog was redirected to my tumblr blog. This infatuation lasted for all of 5 minutes playing around with it. What really turned me off the whole thing were the buttons on the top of the blog. They were constantly telling people to join tumblr or subscribe to my blog. I don&#8217;t mind having those buttons on my blog. I just want the option to do whatever I want with my page especially when it&#8217;s as <em>themable</em> as tumblr is. They even make your profile picture into a favicon and all that, I was impressed with the web 2.0 ruby on rails feel to the whole thing. I just wasn&#8217;t that sold&#8230;</p>
<p>Finally traded in my Wii, I love the machine and it works beautifully since the day I bought it (the day it was launched), I have had absolutely no issues with it at all. It&#8217;s been stable, fun and exhilarating. The problem I have with it though is that week in week out I see all these awesome titles released to the darkside (PS3 and XBox 360) and I feel like I&#8217;m missing out on all the action. I have always been a Nintendo fan and I believe if they were to release a higher spec version of the console that was actually able to compete with all those eye watering titles I will get myself one. For now however, I want to play some God Of War 3. And that&#8217;s not on the Wii nor on the XBox so it is with a saddened heart that I say this that I am looking to get a PS3 sometime over the next few days at the expense of my Wii &#8212; sad times.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kaning.co.uk/archives/196/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>a note on json_de/encode</title>
		<link>http://blog.kaning.co.uk/archives/193</link>
		<comments>http://blog.kaning.co.uk/archives/193#comments</comments>
		<pubDate>Mon, 14 Dec 2009 13:26:19 +0000</pubDate>
		<dc:creator>Kwabena Aning</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[json]]></category>

		<guid isPermaLink="false">http://blog.kaning.co.uk/?p=193</guid>
		<description><![CDATA[I just thought I should quickly post this note simply because I know a few people might have problems with parsing it with the above functions. I would like first to say that json_encode and json_decode are PHP 5.2.0+ methods &#8230; <a href="http://blog.kaning.co.uk/archives/193">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I just thought I should quickly post this note simply because I know a few people might have problems with parsing it with the above functions.</p>
<p>I would like first to say that json_encode and json_decode are PHP 5.2.0+ methods of parsing and dealing with Javascript Simple Object Notation. basically looks a bit like this {&#8220;key&#8221;:&#8221;value&#8221;}. The idea is to be able to do useful things with objects like these and stepping through the key and value pairs while doing something with them.</p>
<p>The problem however is you sometimes get JSON sent as a string through an HTTP method like $_POST and the quotes in there are automatically (well in my case). escaped with backslashes like this {\&#8221;jsonkey\&#8221;:\&#8221;jsonvalue\&#8221;}. Before you actually call json_decode on your json data use the built in stripslashes function first. so your code should look like this in one line</p>
<p>$json_array = json_decode(stripslashes($jsonObject));</p>
<p>hope this helps someone.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kaning.co.uk/archives/193/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>bug with fcbkcomplete when loading through ajax</title>
		<link>http://blog.kaning.co.uk/archives/186</link>
		<comments>http://blog.kaning.co.uk/archives/186#comments</comments>
		<pubDate>Tue, 01 Dec 2009 16:52:34 +0000</pubDate>
		<dc:creator>Kwabena Aning</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://blog.kaning.co.uk/?p=186</guid>
		<description><![CDATA[If you find that your jquery autocomplete plug-in specifically the fcbkcomplete variant works nicely when you load the entire document, but doesn&#8217;t work when you make requests through ajax to display the content in a dv tag, you might want &#8230; <a href="http://blog.kaning.co.uk/archives/186">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you find that your <a title="FCBKComplete" href="http://www.emposha.com/javascript/fcbkcomplete.html" target="_blank">jquery autocomplete plug-in specifically the fcbkcomplete</a> variant works nicely when you load the entire document, but doesn&#8217;t work when you make requests through ajax to display the content in a dv tag, you might want to try this.</p>
<p>Basically if it&#8217;s inited in a page that was requested through ajax with content passed into a div tag. It doesn&#8217;t display the autocomplete suggestions. I found this but to be caused by width being set to &#8220;0px&#8221; in the message_to_feed &lt;li&gt; attribute.</p>
<p>My workaround for this was to add<br />
feed.css(&#8220;width&#8221;, &#8220;512px&#8221;); // set to default width</p>
<p>on lines 407, and 416 in jquery.fcbkcomplete.js.</p>
<p>I have commented on this on the <a title="fcbkcomplete developers site" href="http://www.emposha.com/javascript/fcbkcomplete.html" target="_blank">developers site</a> hope he picks it up.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kaning.co.uk/archives/186/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Simple Social Network Database Structure</title>
		<link>http://blog.kaning.co.uk/archives/183</link>
		<comments>http://blog.kaning.co.uk/archives/183#comments</comments>
		<pubDate>Fri, 27 Nov 2009 12:24:57 +0000</pubDate>
		<dc:creator>Kwabena Aning</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[mokocharlie]]></category>

		<guid isPermaLink="false">http://blog.kaning.co.uk/?p=183</guid>
		<description><![CDATA[I am obviously not looking to build a second facebook or myspace or &#60;insert new web 2.0 social network name here&#62; but my idea is very simple for my mokocharlie.com market platform. We want to have traders who can network &#8230; <a href="http://blog.kaning.co.uk/archives/183">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I am obviously not looking to build a second facebook or myspace or &lt;insert new web 2.0 social network name here&gt; but my idea is very simple for my mokocharlie.com market platform. We want to have traders who can network with each other. Share ideas, messages and even advertisement credits. This idea obviously would require the use some sort of database infrastructure that can describe connections between two users at the most basic level.</p>
<p>The easiest way to do this would be to have as your first level, a user table, with all the user data for your purposes. Then the next thing would be to create another table for confirmed connections.</p>
<p>Then another table for pending connections. This will obviously hold your friend requests and so on and after they are confirmed, they are moved to the confirmed connections table. From where you can do all sorts of things.I am obviously not going to go into the internals of my market platform but the structure for the database could be as follows:</p>
<p>usertable<br />
user_id<br />
firstname<br />
lastname<br />
email<br />
password<br />
&#8230;<br />
user_verified</p>
<p>confirmed_connections<br />
connection_id<br />
user_id<br />
friend_id</p>
<p>pending_connections<br />
connection_id<br />
user_id<br />
friend_id</p>
<p>the details are really up to you as many roads lead to Rome, but one must of course make sure that the information is consistent. So that your application logic makes sure that the connections from pending&#8230; are moved to confirmed and not just copied or a user would have quite a few duplicate friends.</p>
<p>That&#8217;s my take on this, I am open to any other suggestions on making this better.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kaning.co.uk/archives/183/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
