<?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>BinaryKitten&#039;s Blog &#187; BinaryKitten</title>
	<atom:link href="http://binarykitten.me.uk/author/admin/feed" rel="self" type="application/rss+xml" />
	<link>http://binarykitten.me.uk</link>
	<description></description>
	<lastBuildDate>Thu, 09 Sep 2010 10:33:55 +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>Don&#8217;t use IsValid in your Doctrine Models &#8211; a warning</title>
		<link>http://binarykitten.me.uk/dev/324-dont-use-isvalid-in-your-doctrine-models-a-warning.html</link>
		<comments>http://binarykitten.me.uk/dev/324-dont-use-isvalid-in-your-doctrine-models-a-warning.html#comments</comments>
		<pubDate>Thu, 09 Sep 2010 10:33:55 +0000</pubDate>
		<dc:creator>BinaryKitten</dc:creator>
				<category><![CDATA[Doctrine]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[DB]]></category>
		<category><![CDATA[dev]]></category>
		<category><![CDATA[doctrine]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://binarykitten.me.uk/?p=324</guid>
		<description><![CDATA[Recently for a project i&#8217;ve been making heavy use of Doctrine. In one of the models I had a method to check to see if the object was valid under a certain set of conditions. I named this function isValid .. and it had 2 params. Little did I know that this was actually overriding [...]]]></description>
			<content:encoded><![CDATA[<p>Recently for a project i&#8217;ve been making heavy use of Doctrine. In one of the models I had a method to check to see if the object was valid under a certain set of conditions. I named this function isValid .. and it had 2 params. Little did I know that this was actually overriding an existing deep rooted isValid which gets fired on saving the object to the DB. Bummer. </p>
<p>So this is a quick warning to all you Doctrine users. Unless you want to actually override the isValid method for saving, call your check method function something else!</p>
]]></content:encoded>
			<wfw:commentRss>http://binarykitten.me.uk/dev/324-dont-use-isvalid-in-your-doctrine-models-a-warning.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BinaryKitten Presents on Hiatus</title>
		<link>http://binarykitten.me.uk/personal/318-binarykitten-presents-on-hiatus.html</link>
		<comments>http://binarykitten.me.uk/personal/318-binarykitten-presents-on-hiatus.html#comments</comments>
		<pubDate>Tue, 07 Sep 2010 08:00:12 +0000</pubDate>
		<dc:creator>BinaryKitten</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://binarykitten.me.uk/?p=318</guid>
		<description><![CDATA[Well looks like my Tutorial/class has been put on semi-permanent suspension. Hopefully it will still be available in the end. Oh well still, Come along to PHPNW10 Conference and see my talk on Zend_Tool See you all there]]></description>
			<content:encoded><![CDATA[<p>Well looks like my Tutorial/class has been put on semi-permanent suspension. </p>
<p>Hopefully it will still be available in the end. Oh well still, Come along to <a href="http://conference.phpnw.org.uk/phpnw10/" title="Link to the conference site">PHPNW10 Conference</a> and see my talk on <a href="http://conference.phpnw.org.uk/phpnw10/schedule/using-zend_tool/" title="Link to the talk page">Zend_Tool</a> <img src='http://binarykitten.me.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </p>
<p>See you all there</p>
]]></content:encoded>
			<wfw:commentRss>http://binarykitten.me.uk/personal/318-binarykitten-presents-on-hiatus.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BinaryKitten Presents&#8230;</title>
		<link>http://binarykitten.me.uk/personal/313-binarykitten-presents-html-css-for-novices.html</link>
		<comments>http://binarykitten.me.uk/personal/313-binarykitten-presents-html-css-for-novices.html#comments</comments>
		<pubDate>Mon, 30 Aug 2010 08:39:22 +0000</pubDate>
		<dc:creator>BinaryKitten</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[websites]]></category>
		<category><![CDATA[workshop]]></category>

		<guid isPermaLink="false">http://binarykitten.me.uk/?p=313</guid>
		<description><![CDATA[I'd Like to (possibly Prematurely, but definitely Proudly) Announce that I'm going to be giving a 2 day workshop entitled HTML/CSS for Novices. ]]></description>
			<content:encoded><![CDATA[<p>I&#8217;d Like to (possibly Prematurely, but definitely Proudly) Announce that I&#8217;m going to be giving a 2 day workshop entitled HTML/CSS for Novices.<br />
<span id="more-313"></span><br />
This workshop will cover (obviously) HTML + CSS on 1 day each.</p>
<p>The Course will be held on a Sunday and will split over two consecutive weekends.<br />
Day 1: HTML<br />
This will cover HTML, What it is, how it&#8217;s used and what you can do with it.<br />
It will also include covering of some of the currently usable HTML5 tags.</p>
<p>Day 2: CSS<br />
This will cover CSS, What it is, how it works and how that applies to HTML.<br />
We shall also cover a smidgeon of CSS3.</p>
<p>Provisionally this course will take place in October.<br />
Please do keep an eye out for more information, I shall be updating with more details as I have them</p>
]]></content:encoded>
			<wfw:commentRss>http://binarykitten.me.uk/personal/313-binarykitten-presents-html-css-for-novices.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Speaking at PHPNW10</title>
		<link>http://binarykitten.me.uk/personal/309-speaking-at-phpnw10.html</link>
		<comments>http://binarykitten.me.uk/personal/309-speaking-at-phpnw10.html#comments</comments>
		<pubDate>Mon, 02 Aug 2010 21:15:07 +0000</pubDate>
		<dc:creator>BinaryKitten</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://binarykitten.me.uk/?p=309</guid>
		<description><![CDATA[Just a quick note as am really shocked and grateful to be speaking at this years PHP North West Conference in the UK. I shall be presenting a talk entitled &#8220;Using Zend_Tool&#8221; which I hope that many people will find useful. If you haven&#8217;t got your ticket yet, please do. The Conference is not only [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick note as am really shocked and grateful to be speaking at this years PHP North West Conference in the UK.<br />
I shall be presenting a talk entitled &#8220;Using Zend_Tool&#8221; which I hope that many people will find useful.</p>
<p>If you haven&#8217;t got your ticket yet, please do. The Conference is not only a great way to learn new things but it&#8217;s also a great place to socialise with your fellow developers.</p>
<p>I Hope to see you all there.</p>
]]></content:encoded>
			<wfw:commentRss>http://binarykitten.me.uk/personal/309-speaking-at-phpnw10.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Active Module Config V2</title>
		<link>http://binarykitten.me.uk/dev/zend-framework/296-active-module-config-v2.html</link>
		<comments>http://binarykitten.me.uk/dev/zend-framework/296-active-module-config-v2.html#comments</comments>
		<pubDate>Fri, 18 Jun 2010 00:55:26 +0000</pubDate>
		<dc:creator>BinaryKitten</dc:creator>
				<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://binarykitten.me.uk/?p=296</guid>
		<description><![CDATA[A brand new version of my previously Released Front controller plugin for Zend Framework. Since the last version of the plugin, I&#8217;ve used and cleaned and tried to maintain it. It just ended up unwieldy. So I set about creating this new version. Does exactly the same as the last one, just should be a [...]]]></description>
			<content:encoded><![CDATA[<p>A brand new version of my previously Released Front controller plugin for Zend Framework.<br />
<span id="more-296"></span><br />
Since the last version of the plugin, I&#8217;ve used and cleaned and tried to maintain it. It just ended up unwieldy. So I set about creating this new version. Does exactly the same as the last one, just should be a lot easier to see what it&#8217;s doing and when.</p>
<p>So I present to you active Module Config V2</p>
<p>Many thanks to Paul Bouzakis (<a href="http://twitter.com/paul_eye">@paul_eye</a>) for the pointers in ways to make this more readable and concise</p>
<pre class="brush: php">
&lt;?php
class BinaryKitten_ModuleConfig extends Zend_Controller_Plugin_Abstract
{
    /**@var string The Init Name aka initModule */
    private $_moduleInitName = &#039;&#039;;

    public function routeShutdown(Zend_Controller_Request_Abstract $request)
    {
        $activeModuleName = $request-&gt;getModuleName();
        $this-&gt;_moduleInitName = $activeModuleName.&quot;Init&quot;;

        $appBootstrap = $this-&gt;_getMainBootstrap();
        $activeModuleBootstrap = $this-&gt;_getActiveBootstrap($appBootstrap, $activeModuleName);
        $this-&gt;_processApplicationBootstrap($appBootstrap);
        if ($activeModuleBootstrap instanceof Zend_Application_Module_Bootstrap) {
            $this-&gt;_processActiveModuleBootstrap($activeModuleBootstrap);
        }
    }

    /*****************************************************************
     * Gets the Main Boostrap Object
     *
     * @return Zend_Application_Bootstrap_Bootstrap Main Bootstrap
     *****************************************************************/
    private function _getMainBootstrap()
    {
        $frontController = Zend_Controller_Front::getInstance();
        $bootstrap =  $frontController-&gt;getParam(&#039;bootstrap&#039;);
        return $bootstrap;
    }

    /*******************************************************************************
     * Gets the Current Active Module&#039;s Boostrap Object
     *
     * @param Zend_Application_Bootstrap_Bootstap $appBootstrap The Main Bootstrap
     * @param String $activeModuleName The name to find.
     * @return Zend_Application_Module_Bootstrap Active Module Bootstrap
     ******************************************************************************/
    private function _getActiveBootstrap($appBootstrap, $activeModuleName)
    {
        $moduleList = $appBootstrap-&gt;modules;
        if (isset($moduleList[$activeModuleName])) {
            $activeModule = $moduleList[$activeModuleName];
        } else {
            $activeModule = $appBootstrap;
        }
        return $activeModule;
    }

     /*********************************************************
     * Process the methods from within the main bootstrap
     * @param Zend_Application_Bootstrap_BootstrapAbstract $appBootstrap The Application Bootstrap;
     **********************************************************/
    private function _processApplicationBootstrap($appBootstrap)
    {
        $moduleInitNameLength = strlen($this-&gt;_moduleInitName);
        $bootstrapMethodNames = get_class_methods($appBootstrap);
        foreach ($bootstrapMethodNames as $key=&gt;$method) {
            $runMethod = false;
            $methodNameLength = strlen($method);
            if ($this-&gt;_isModuleNameInitMethod($method)) {
                $resource = call_user_func(array($appBootstrap, $method));
                $resourceName = substr($method, $moduleInitNameLength);
                if (!is_null($resource)) {
                    $this-&gt;storeResource($resource, $resourceName, $appBootstrap);
                }
            }
        }
    }

    /*********************************************************
     * Process the methods from within the main bootstrap
     * @param Zend_Application_Module_Bootstrap $activeModuleBootstrap The &quot;Active&quot;  Modules&#039;s Bootstrap;
     **********************************************************/
    private function _processActiveModuleBootstrap($activeModuleBootstrap)
    {
        $moduleInitNameLength = strlen($this-&gt;_moduleInitName);
        $methodNames = get_class_methods($activeModuleBootstrap);
        foreach ($methodNames as $key=&gt;$method) {
            $runMethod = false;
            if ($this-&gt;_isActiveInitMethod($method)) {
                $resourceName = substr($method, 10);
                $runMethod = true;
            } elseif ($this-&gt;_isModuleNameInitMethod($method)) {
                $resourceName = substr($method, $moduleInitNameLength);
                $runMethod = true;
            }
            if ($runMethod) {
                $resource = call_user_func(array($activeModuleBootstrap, $method));
                if (!is_null($resource)) {
                    $this-&gt;storeResource($resource, $resourceName, $activeModuleBootstrap);
                }
            }
        }
    }

    /*******************************************************
     * Check to see if the method is in style of ModulenameInitXXX
     * @param string $method The method name to check
     ********************************************************/
    private function _isModuleNameInitMethod($method)
    {
        $methodNameLength = strlen($method);
        $moduleInitNameLength = strlen($this-&gt;_moduleInitName);
        $methodNameLonger = ($moduleInitNameLength &lt; $methodNameLength);
        $methodNameBeginMatch = $this-&gt;_moduleInitName == substr($method, 0, $moduleInitNameLength);
        return $methodNameLonger &amp;&amp; $methodNameBeginMatch;
    }

    /*******************************************************
     * Check to see if the method is in style of activeInitXXX
     * @param string $method The method name to check
     ********************************************************/
    private function _isActiveInitMethod($method)
    {
        $methodNameLength = strlen($method);
        $methodNameLonger = ($methodNameLength &gt; 10);
        $methodNameBeginMatch = &#039;activeInit&#039; === substr($method, 0, 10);
        return $methodNameLonger &amp;&amp; $methodNameBeginMatch;
    }

    /***********************************
     * Store the resource returned by the function so that it can be &quot;bootstrapped&quot;
     * @param misc $resource The Resource to be stored
     * @param string $name the name of the resource
     * @param Zend_Application_Bootstrap_BootstrapAbstract $bootstrap The Bootstrap against which to store the resource
     ********************/
    private function storeResource($resource, $name, $bootstrap)
    {
        // Store the resource.. not sure how to do this yet.. if you do let me know! <img src='http://binarykitten.me.uk/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />
    }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://binarykitten.me.uk/dev/zend-framework/296-active-module-config-v2.html/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>HTML5 Data attributes and jQuery&#8217;s .data &#8211; pairing made in heaven</title>
		<link>http://binarykitten.me.uk/dev/jq-plugins/288-html5-data-attributes-and-jquerys-data-pairing-made-in-heaven.html</link>
		<comments>http://binarykitten.me.uk/dev/jq-plugins/288-html5-data-attributes-and-jquerys-data-pairing-made-in-heaven.html#comments</comments>
		<pubDate>Wed, 12 May 2010 17:19:20 +0000</pubDate>
		<dc:creator>BinaryKitten</dc:creator>
				<category><![CDATA[jQuery Plugins]]></category>

		<guid isPermaLink="false">http://binarykitten.me.uk/?p=288</guid>
		<description><![CDATA[I really like the idea of the data-* properties in the spec for HTML5, unfortunately they&#8217;re not supported directly by any browser it seems yet; even jQuery 1.4.2 doesn&#8217;t really support them (due to the non-browser support I guess). Anyway, I really wanted to make use of them in an application I&#8217;ve been using and [...]]]></description>
			<content:encoded><![CDATA[<p>I really like the idea of the data-* properties in the spec for HTML5, unfortunately they&#8217;re not supported directly by any browser it seems yet; even jQuery 1.4.2 doesn&#8217;t really support them (due to the non-browser support I guess).</p>
<p>Anyway, I really wanted to make use of them in an application I&#8217;ve been using and after reading John Resig&#8217;s (<a href="http://twitter.com/jresig">@jresig</a>) post on the subject (<a href="http://ejohn.org/blog/html-5-data-attributes/" target="_blank">http://ejohn.org/blog/html-5-data-attributes/</a>) I set about adding a little snippet to extend jQuery&#8217;s .data so that it would support these parameters. So here is the small plugin that will extend the data function in jQuery to enable access to this functionality.</p>
<p>Enjoy</p>
<pre class="brush: javascript">
(function($){
    $.fn.extend({
        &#039;_data&#039;: $.fn.data,
        &#039;data&#039; : function( key, value ) {
            if ( typeof key === &quot;undefined&quot; &amp;&amp; this.length ) {
                return jQuery.data( this[0] );
            } else if ( typeof key === &quot;object&quot; ) {
                return this.each(function() {
                    jQuery.data( this, key );
                });
            }
            var retValue;
            retValue = $.fn._data(key, value);
            if (&#039;undefined&#039; == (typeof retValue) || retValue.length == 0) {
                var nakedElem = this.get(0);
                if (nakedElem.hasOwnProperty(&#039;dataset&#039;)) {
                    if (&#039;undefined&#039; != (typeof nakedElem.dataset[key])) {
                        retValue = nakedElem.dataset[key];
                    }
                } else {
                    retValue = this.attr(&#039;data-&#039;+key);
                }
            }
            return retValue;
        }
    });
})(jQuery);
</pre>
<p>All comments are gratefully received <img src='http://binarykitten.me.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://binarykitten.me.uk/dev/jq-plugins/288-html5-data-attributes-and-jquerys-data-pairing-made-in-heaven.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Plans</title>
		<link>http://binarykitten.me.uk/personal/286-plans.html</link>
		<comments>http://binarykitten.me.uk/personal/286-plans.html#comments</comments>
		<pubDate>Wed, 05 May 2010 15:55:00 +0000</pubDate>
		<dc:creator>BinaryKitten</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://binarykitten.me.uk/?p=286</guid>
		<description><![CDATA[Recently i&#8217;ve been working on new bits and pieces for projects.. updating existing items and working towards having a nice base of extended components for both Zend Framework and jQuery. On My Workbench at the moment is an update to the keyz jQuery plugin which adds all but the keychain functionality to the system. Also [...]]]></description>
			<content:encoded><![CDATA[<p>Recently i&#8217;ve been working on new bits and pieces for projects.. updating existing items and working towards having a nice base of extended components for both Zend Framework and jQuery. </p>
<p>On My Workbench at the moment is an update to the keyz jQuery plugin which adds all but the keychain functionality to the system. Also have been working on a multi page form component for Zend Framework.</p>
<p>Still working on working out the kinks in both before making a release.</p>
<p>Yesterday (May 4th &#8212; Star Wars Day .. lol) saw me sign the Zend Framwork Contributor License Agreement and send it off to Zend. Still no word as yet, but fingers crossed. </p>
<p>I&#8217;ve also bought myself an XBOX 360 (and a few games), you&#8217;ll find me on XBL as my usual nick.</p>
<p>Things seem to be going well at the moment, but only time will tell.</p>
]]></content:encoded>
			<wfw:commentRss>http://binarykitten.me.uk/personal/286-plans.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Per form stylesheet with Zend_Form</title>
		<link>http://binarykitten.me.uk/dev/zend-framework/274-per-form-stylesheet-with-zend_form.html</link>
		<comments>http://binarykitten.me.uk/dev/zend-framework/274-per-form-stylesheet-with-zend_form.html#comments</comments>
		<pubDate>Mon, 01 Mar 2010 21:58:04 +0000</pubDate>
		<dc:creator>BinaryKitten</dc:creator>
				<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://binarykitten.me.uk/?p=274</guid>
		<description><![CDATA[I needed to have certain form styles attached when a form is in use. I didn&#8217;t want to do this from the controller each and every time as it was really was only to do with the form and I might want to use the form with it&#8217;s own stylesheet in other places. The Solution [...]]]></description>
			<content:encoded><![CDATA[<p>I needed to have certain form styles attached when a form is in use. I didn&#8217;t want to do this from the controller each and every time as it was really was only to do with the form and I might want to use the form with it&#8217;s own stylesheet in other places.<br />
<span id="more-274"></span></p>
<h3>The Solution</h3>
<p>The solution is to extend Zend_form and use the extended version as the basis for all the forms in the application. Here is my Form class.<br />
<code>
<pre class="brush: php">
&lt;?php
class BinaryKitten_Form extends Zend_Form
{
    private $_stylesheets = array(
        &#039;main&#039;=&gt;array(&#039;href&#039;=&gt;&#039;/css/form.css&#039;, &#039;media&#039;=&gt;&#039;screen&#039;)
    );

    public function addStylesheet($href,$media=&#039;screen&#039;)
    {
        $this-&gt;_stylesheets[basename($href)] = array(
            &quot;href&quot;=&gt;$href,
            &quot;media&quot;=&gt;$media
        );
    }

    public function removeStylesheet($href)
    {
        unset($this-&gt;_stylesheets[basename($href)]);
    }

    public function clearStylesheets()
    {
        $this-&gt;_stylesheets = array();
    }

    public function render(Zend_View_Interface $view = null)
    {
        if (null !== $view) {
            $this-&gt;setView($view);
        }
        else {
            $view = $this-&gt;getView();
        }

        foreach ($this-&gt;_stylesheets as $stylesheet) {
            $view-&gt;headLink()-&gt;appendStylesheet($stylesheet[&#039;href&#039;], $stylesheet[&#039;media&#039;]);
        }

        $content = &#039;&#039;;
        foreach ($this-&gt;getDecorators() as $decorator) {
            $decorator-&gt;setElement($this);
            $content = $decorator-&gt;render($content);
        }
        return $content;
    }
}
</pre>
<p></code></p>
<p>Of course you would extend it as usual to create a new form&#8230;.</p>
<pre class="brush: php">
&lt;?php
class BinaryKitten_Form_LoginForm extends BinaryKitten_Form
{
    public function __construct($option = null)
    {
        parent::__construct($option);
        $decorators = array(
            array(&#039;ViewHelper&#039;),
            array(&#039;Label&#039;, array(
                &#039;requiredSuffix&#039;=&gt;&quot; *&quot;
            )),
            array(&#039;HtmlTag&#039;, array(&#039;tag&#039;=&gt;&#039;div&#039;))
        );

        $username = new Zend_Form_Element_Text(&#039;username&#039;);
        $username
            -&gt;setLabel(&#039;Username&#039;)
            -&gt;setRequired(true)
            -&gt;addValidator(&#039;NotEmpty&#039;, true)
            -&gt;addFilter(&quot;StringTrim&quot;)
            -&gt;addErrorMessage(&#039;Please Enter your Username&#039;)
            -&gt;setDecorators($decorators);

        $password = new Zend_Form_Element_Password(&#039;password&#039;);
        $password
            -&gt;setLabel(&#039;Password&#039;)
            -&gt;setRequired(true)
            -&gt;addValidator(&#039;NotEmpty&#039;, true)
            -&gt;addFilter(&quot;StringTrim&quot;)
            -&gt;addErrorMessage(&#039;Please Enter your Password&#039;)
            -&gt;setDecorators($decorators);

        $loginButton = new Zend_Form_Element_Submit(&#039;login&#039;);
        $loginButton
            -&gt;setValue(&#039;login&#039;);

        $this
            -&gt;addElements(
                array(
                    $username,
                    $password,
                    $loginButton
                )
            )
            -&gt;setMethod(&#039;post&#039;)
            -&gt;setName(&#039;loginForm&#039;)
            -&gt;addDecorator(
                array(&#039;mytag&#039; =&gt; &#039;HtmlTag&#039;), array(&#039;tag&#039; =&gt; &#039;div&#039;)
            )
            -&gt;removeDecorator(&#039;HtmlTag&#039;);

        $this-&gt;addStylesheet(&#039;/css/loginform.css&#039;,&#039;screen&#039;);
    }
}
</pre>
<p>And then as usual in you controller:</p>
<pre class="brush: php">
$form = new BinaryKitten_Form_LoginForm();
$this-&gt;view-&gt;form = $form;
</pre>
<p>and of course, echo it out in the view<br />
[sourcecoe lang="php"]<br />
echo $this->form;<br />
[/sourcecode]</p>
<p>And that&#8217;s it, Simple.<br />
Hopefully this will help someone out there</p>
]]></content:encoded>
			<wfw:commentRss>http://binarykitten.me.uk/dev/zend-framework/274-per-form-stylesheet-with-zend_form.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>jQuery Keyz Plugin</title>
		<link>http://binarykitten.me.uk/dev/jq-plugins/259-jquery-keyz-plugin.html</link>
		<comments>http://binarykitten.me.uk/dev/jq-plugins/259-jquery-keyz-plugin.html#comments</comments>
		<pubDate>Wed, 24 Feb 2010 15:20:45 +0000</pubDate>
		<dc:creator>BinaryKitten</dc:creator>
				<category><![CDATA[jQuery Plugins]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[keypress]]></category>
		<category><![CDATA[plugins]]></category>

		<guid isPermaLink="false">http://binarykitten.me.uk/?p=259</guid>
		<description><![CDATA[The purpose of this plugin is to easily facilitate the end user to create and hook key presses for their own use. Usually you would need to know what key links with which keycode etc. Usage It&#8217;s as easy as these steps: Include jquery &#8211; either from CDN or local source Include jquery.keyz.js call the [...]]]></description>
			<content:encoded><![CDATA[<p>The purpose of this plugin is to easily facilitate the end user to  create and hook key presses for their own use. Usually you would need to know what key links with which keycode etc.</p>
<h3>Usage</h3>
<p>It&#8217;s as easy as these steps:</p>
<ol>
<li>Include jquery &#8211; either from CDN or local source</li>
<li>Include jquery.keyz.js</li>
<li>call the following within your document ready or after the item exists</li>
</ol>
<pre class="brush: javascript">
$(&#039;selector&#039;).keyz({
&quot;enter&quot;: function(ctl,sft,alt,event) {
alert(&#039;you pressed enter!&#039;);
}
});
</pre>
<p>this will hook the enter key and raise an alert when pressed.</p>
<p>If you  want to cancel the key either return false from the function or set the  value to false like so:</p>
<pre class="brush: javascript">
$(&#039;selector&#039;).keyz({
&quot;enter&quot;: function(ctl,sft,alt,event) {
return false;
}
});
</pre>
<p>OR</p>
<pre class="brush: javascript">
$(&#039;selector&#039;).keyz({
&quot;enter&quot;:false
});</pre>
<p>You can either use the key names in singular or in a grouping like so:</p>
<pre class="brush: javascript">
$(&#039;selector&#039;).keyz({
&quot;enter&quot;: function(ctl,sft,alt,event) {
/* single key */
return false;
},
&quot;F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12&quot;: function(ctl,sft,alt,event) {
/* mapped to all F-Keys */
return false;
}
});
</pre>
<p>Download jquery.keyz.js here: <a href="/keyzDemo/jquery.keyz.js">Full Source</a> &amp;&amp;  <a href="/keyzDemo/jquery.keyz.gc.js">Google Closure Compiled version</a></p>
<p>Visit the demo page here: <a href="/keyzDemo/">Full Source</a></p>
<h3>Planned Features</h3>
<ul>
<li>support for keypress chains .. passing a sequence of keys and an event firing upon completion</li>
<li><span style="text-decoration: line-through;">support for all three key states &#8211; presently only triggers on key down</span> &#8211; Added in 1.0.2</li>
<li>to add some <a href="http://paulirish.com/2010/duck-punching-with-jquery/" target="_blank">duck punching</a> to add the keyname to the event for the three standard events</li>
</ul>
<h3>Supported Keys</h3>
<p>The keys listed below are the current ones supported by the plugin.<br />
They also support the hyphenated name eg numpad-1 or in upper case like &#8220;F1&#8243; or &#8220;f1&#8243;</p>
<ul>
<li>enter</li>
<li>return</li>
<li>esc</li>
<li>escape</li>
<li>numerics</li>
<li>upper</li>
<li>lower</li>
<li>alphanumeric</li>
<li>tab</li>
<li>shift</li>
<li>alt</li>
<li>ctrl</li>
<li>f1</li>
<li>f2</li>
<li>f3</li>
<li>f4</li>
<li>f5</li>
<li>f6</li>
<li>f7</li>
<li>f8</li>
<li>f9</li>
<li>f10</li>
<li>f11</li>
<li>f12</li>
<li>caps</li>
<li>capslock</li>
<li>numlock</li>
<li>winflag</li>
<li>winkey</li>
<li>windows</li>
<li>scrolllock</li>
<li>left</li>
<li>up</li>
<li>right</li>
<li>down</li>
<li>volumeup</li>
<li>volumedown</li>
<li>menu</li>
<li>contextmenu</li>
<li>backspace</li>
<li>pause</li>
<li>break</li>
<li>pausebreak</li>
<li>pageup</li>
<li>pagedown</li>
<li>end</li>
<li>home</li>
<li>insert</li>
<li>del</li>
<li>delete</li>
<li>numpad0</li>
<li>numpad1</li>
<li>numpad2</li>
<li>numpad3</li>
<li>numpad4</li>
<li>numpad5</li>
<li>numpad6</li>
<li>numpad7</li>
<li>numpad8</li>
<li>numpad9</li>
<li>*</li>
<li>multiply</li>
<li>+</li>
<li>add</li>
<li>-</li>
<li>subtract</li>
<li>.</li>
<li>fullstop</li>
<li>decimal</li>
<li>/</li>
<li>divide</li>
<li>;</li>
<li>semicolon</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://binarykitten.me.uk/dev/jq-plugins/259-jquery-keyz-plugin.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Integrating PHP CodeSniffer with Activestate Komodo Edit</title>
		<link>http://binarykitten.me.uk/dev/219-integrating-php-codesniffer-with-activestate-komodo-edit.html</link>
		<comments>http://binarykitten.me.uk/dev/219-integrating-php-codesniffer-with-activestate-komodo-edit.html#comments</comments>
		<pubDate>Mon, 15 Feb 2010 02:34:26 +0000</pubDate>
		<dc:creator>BinaryKitten</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Activestate]]></category>
		<category><![CDATA[Coding Standards]]></category>
		<category><![CDATA[Komodo]]></category>
		<category><![CDATA[Komodo Edit]]></category>
		<category><![CDATA[PHP_CodeSniffer]]></category>
		<category><![CDATA[Standards]]></category>

		<guid isPermaLink="false">http://binarykitten.me.uk/?p=219</guid>
		<description><![CDATA[I&#8217;ve recently been looking into standards of code and how they would apply to myself and my code. To enable this, I&#8217;ve recently installed PHP_CodeSniffer and for a few days been using this on the command line.. which by itself isn&#8217;t bad, though I really wanted to have something inside my editor of choice (happens [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently been looking into standards of code and how they would apply to myself and my code. To enable this, I&#8217;ve recently installed PHP_CodeSniffer and for a few days been using this on the command line.. which by itself isn&#8217;t bad, though I really wanted to have something inside my editor of choice (happens to be Komodo Edit).<span id="more-219"></span></p>
<h2>Setting up Pear</h2>
<p>Since I will be using Pear to install the code sniffer we might as well cover that to start with.<br />
There are lots of tutorials out there with the aim of helping you to get pear installed no matter what the platform. I Will leave that job for them. What I will do is cover how to get it running easily with WampServer from <a href="http://www.wampserver.com/en/">http://www.wampserver.com/en/</a> Please do Note that this is all on a Windows Based machine</p>
<ol>
<li>Open a command prompt</li>
<li>Make a note of your php Directory&#8230; you will need this in a few places<br />
&#8220;WAMPDIR\bin\php\PHPVERSION&#8221;<br />
where WAMPDIR = the directory WampServer is installed to<br />
and PHPVERSION = php+version number..<br />
i&#8217;m using php 5.2.11 on wampserver so the location for me looks like this<br />
&#8220;D:\Wamp\bin\php\php5.2.11&#8243;</li>
<li>CD /D PHPDIR &#8211; where PHPDIR is the location you should have noted down in the last step</li>
<li>Type go-pear and watch as it installs</li>
<li>bring up the Advanced system properties</li>
<li>Environment Variables</li>
<li>Edit Path to add your php folder prefixed with a ;<br />
e.g. for my path was already c:\SharedLibs  so that became<br />
c:\SharedLibs;d:\wamp\bin\php\php5.2.11 &#8211; Close and save all settings</li>
</ol>
<h2>Installing PHP_CodeSniffer via Pear</h2>
<p>Now that I had pear installed I could use it to install PHP_CodeSniffer, this was a simple task with 1 line of code..<br />
<code>pear install PHP_Codesniffer</code> and that was it.. Actually I tell a small lie here, to make it work within the confines of other folders was to do as follows:</p>
<ol>
<li>Open the phpcs.bat file that resides in the php folder outlined above in notepad or similar editor</li>
<li>Change &#8220;./php.exe&#8221; to &#8220;php.exe&#8221;, save the file and close</li>
</ol>
<p>Now we are ready to run PHP_Codesniffer.</p>
<h2>Setting up Komodo Edit</h2>
<p>To start with, I use Komodo Edit for this, that is because that is what I use. I thoroughly recommend it over the likes of notepad++ etc mainly because of its feature set, and the way that it handles code completion from the project. But enough of all this, lets get down to creating a &#8220;run Command&#8221; for the active Tab/File in Komodo.</p>
<ol>
<li>Click Tools, then Run Commandin the R<span style="text-decoration: underline;">u</span>n box enter the following:</li>
<li><code>phpcs -n --standard=%(ask:Which Standard do you wish to use?:ZEND) --report=emacs "%F"</code>Check the <span style="text-decoration: underline;">A</span>dd to Toolbox optionToggle the More options So you can see the Advanced Options Panemake sure the &#8220;Run in&#8221; is set to Command Output TabCheck the &#8220;Parse Output with:&#8221; checkbox and enter the following in the select field:
<pre class="brush: text">
^(?P&lt;file&gt;.*):(?P&lt;line&gt;\d+):(?P&lt;column&gt;\d+):(?P&lt;content&gt;.*)
                     </pre>
</li>
<li>Check the &#8220;Show parsed output as a list&#8221; checkbox</li>
<li>Click the <span style="text-decoration: underline;">N</span>ew button to begin adding a envrionment variable</li>
<li>Set the &#8220;Variable Name&#8221; to PATH and the &#8220;Variable Value&#8221; to the location of PHP_Codesniffer &#8211; If you are following through this is the same as step 2 of &#8220;setting up pear&#8221;- then click ok</li>
<li>click <span style="text-decoration: underline;">R</span>un button &#8211; PHP_CodeSniffer will run and then will ask you for the standard you wish to check against .. by default It&#8217;s set to ZEND</li>
<li>Lastly right click the toolbox entry and bring up the properties. The Top left Text entry is the &#8220;nice name&#8221; for this. You can also assign keys to launch this command later</li>
</ol>
<p>Now you have successfully created a run Tool in Komodo that will run PHP_Codesniffer against the active file and will output the results in a nice list in the command output tab at the bottom panel. I chose the emacs output method as it was easier to get nice looking format without the \&#8221; escape sequence appearing in the &#8220;content&#8221;. The Reason for the regex and the list is that it will now allow you to double click and entry and it will jump to the right spot in the file.</p>
<p>I&#8217;ve also included a Komodo Package of 3 run time commands .. 1 for file, 1 for all files in the project and 1 for all files the directory shared with the currently active file. You can download them here: <a href="/CodeSniff.kpz">CodeSniff Package</a> &#8211; <strong>Recommended to Right-Click &#8211; Save Target as etc</strong> &#8211; This packages comes with predefined keystrokes </p>
<ul>
<li>CTRL+L,CTRL+S,CTRL+F to Codesniff the currently Active file</li>
<li>CTRL+L,CTRL+S,CTRL+P to Codesniff all files in the Project</li>
<li>CTRL+L,CTRL+S,CTRL+D to Codesniff all files in the Active File&#8217;s Directory</li>
</ul>
<p>I do hope that this will prove as useful for someone else as it has for me, comments are welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://binarykitten.me.uk/dev/219-integrating-php-codesniffer-with-activestate-komodo-edit.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
