<?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>stoimen &#8211; stoimen&#039;s web log</title>
	<atom:link href="/author/stoimen/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>on web development</description>
	<lastBuildDate>Tue, 13 Feb 2018 08:18:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.3</generator>
	<item>
		<title>Zend Framework &#8211; quick tutorial (part 3) &#8211; front controller plugins</title>
		<link>/2009/06/19/zend-framework-quick-tutorial-part-3-front-controller-plugins/</link>
		<comments>/2009/06/19/zend-framework-quick-tutorial-part-3-front-controller-plugins/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 13:01:02 +0000</pubDate>
		<dc:creator><![CDATA[stoimen]]></dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[front_controller]]></category>
		<category><![CDATA[front_controller_plugin]]></category>
		<category><![CDATA[quick start]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">/?p=67</guid>
		<description><![CDATA[Why writing a front controller plugin? Almost every application uses a database connection and acl module. Why doing this in the bootstrap and to mantain many lines of code there, instead of making it clear and mantainable. Of course you can have all these lines of code in your bootstrap, but you know for serious &#8230; <a href="/2009/06/19/zend-framework-quick-tutorial-part-3-front-controller-plugins/" class="more-link">Continue reading <span class="screen-reader-text">Zend Framework &#8211; quick tutorial (part 3) &#8211; front controller plugins</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/07/06/zend-framework-simple-acl-front-controller-plugin/" rel="bookmark" title="Zend Framework: Simple Acl Front Controller Plugin">Zend Framework: Simple Acl Front Controller Plugin </a></li>
<li><a href="/2008/08/11/zend-framework-quick-tutorial-part-2-directory-layout-and-bootstrapping/" rel="bookmark" title="Zend Framework &#8211; quick tutorial (part 2)">Zend Framework &#8211; quick tutorial (part 2) </a></li>
<li><a href="/2008/08/05/zend-framework-quick-tutorial-part-1-introduction/" rel="bookmark" title="Zend Framework &#8211; quick tutorial (part 1)">Zend Framework &#8211; quick tutorial (part 1) </a></li>
<li><a href="/2009/10/27/zend-framework-custom-urls/" rel="bookmark" title="Zend Framework custom URLs">Zend Framework custom URLs </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>Why writing a front controller plugin?</h2>
<p>Almost every application uses a database connection and acl module. Why doing this in the bootstrap and to mantain many lines of code there, instead of making it clear and mantainable. Of course you can have all these lines of code in your bootstrap, but you know for serious applications that recently will become an obstacle. That&#8217;s why Zend Framework allows you to use Front_Controller plugin.</p>
<h2>First in you bootstrap add those lines of code</h2>
<pre lang="php" escaped="true">
/*
 * add a simple plugin to the controller
 */

$front-&gt;registerPlugin(new Zend_Controller_Plugin_Init())
      -&gt;registerPlugin(new Zend_Controller_Plugin_Acl());
</pre>
<p>These two classes (Zend_Controller_Plugin_Init and Zend_Controller_Plugin_Acl) should be placed in two different files with the same names in Controller/Plugins directory under Zend folder, and garantee you that both classes will be instanciated before starting the front controller.<span id="more-67"></span></p>
<p>There is the example of Zend_Controller_Plugin_Init:</p>
<pre lang="php" escaped="true">&lt;?php

/** Zend_Acl */
require_once 'Zend/Acl.php';

/** Zend_Controller_Plugin_Abstract */
require_once 'Zend/Controller/Plugin/Abstract.php';

/**
 * Front Controller Plugin
 */
final class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
{

/**
 * @var Zend_Acl
 **/
protected $_acl;

/**
 * @var string
 **/
protected $_roleName;

/**
 * @var array
 **/
protected $_errorPage;

/**
 * Constructor
 *
 * @param mixed $aclData
 * @param $roleName
 * @return void
 **/
public function __construct()
{

// define the error controller
$this-&gt;_errorPage = array('module' =&gt; 'default', 'controller' =&gt; 'error',
    'action' =&gt; 'denied');

$this-&gt;_roleName = 'defaultRole';
// if (null !== $this-&gt;_acl) {
$this-&gt;_initAcl();
// }

}

/**
 * Returns the ACL object
 *
 * @return Zend_Acl
 **/
public function getAcl()
{
    return $this-&gt;_acl;
}

/**
 * Sets the ACL role to use
 *
 * @param string $roleName
 * @return void
 **/
public function setRoleName($roleName)
{
    $this-&gt;_roleName = $roleName;
}

/**
 * Returns the ACL role used
 *
 * @return string
 * @author
 **/
public function getRoleName()
{
    return $this-&gt;_roleName;
}

/**
 * Sets the error page
 *
 * @param string $action
 * @param string $controller
 * @param string $module
 * @return void
 **/
public function setErrorPage($action, $controller = 'error', $module = null)
{
$this-&gt;_errorPage = array('module' =&gt; $module,
    'controller' =&gt; $controller,
    'action' =&gt; $action);
}

/**
 * Returns the error page
 *
 * @return array
 **/
public function getErrorPage()
{
    return $this-&gt;_errorPage;
}

/**
 * Predispatch
 * Checks if the current user identified by roleName has rights to the requested url (module/controller/action)
 * If not, it will call denyAccess to be redirected to errorPage
 *
 * @return void
 **/

public function preDispatch(Zend_Controller_Request_Abstract $request)
{
    $resourceName = '';
    if ($request-&gt;getModuleName() != 'default') {
    $resourceName .= $request-&gt;getModuleName() . ':';
}

$resourceName .= $request-&gt;getControllerName();

/** Check if the controller/action can be accessed by the current user */
if (!$this-&gt;getAcl()-&gt;isAllowed($this-&gt;_roleName, $resourceName, $request-&gt;getActionName())) {

/** Redirect to access denied page */
$this-&gt;denyAccess();

}

}

/**
 * Deny Access Function
 * Redirects to errorPage, this can be called from an action using the action helper
 *
 * @return void
 **/
public function denyAccess()
{
   $this-&gt;_request-&gt;setModuleName($this-&gt;_errorPage['module']);
   $this-&gt;_request-&gt;setControllerName($this-&gt;_errorPage['controller']);
   $this-&gt;_request-&gt;setActionName($this-&gt;_errorPage['action']);
}

/**
 * initialize the acl object and resources
 * for the roles used in the application
 *
 */
private function _initAcl()
{
   /*
    * define access control list
    */
   $this-&gt;_acl = new Zend_Acl();

   /**
    * define acl for default role
    */
   $this-&gt;_acl-&gt;addRole(new Zend_Acl_Role('defaultRole'))
        -&gt;add(new Zend_Acl_Resource('index'))
        -&gt;add(new Zend_Acl_Resource('portfolio'))
        -&gt;add(new Zend_Acl_Resource('user'))
        -&gt;allow('defaultRole');

   /**
    * define acl for administrator
    */
   $this-&gt;_acl-&gt;addRole(new Zend_Acl_Role('admin'))
        -&gt;add(new Zend_Acl_Resource('admin:index'))
        -&gt;add(new Zend_Acl_Resource('admin:cpanel'))
        -&gt;add(new Zend_Acl_Resource('admin:user'))
        -&gt;add(new Zend_Acl_Resource('admin:page'))
        -&gt;addRole(new Zend_Acl_Role('default'))
        -&gt;allow('admin');

   }

}

Init.php
&lt;?php

require_once 'Zend/Controller/Plugin/Abstract.php';
class Zend_Controller_Plugin_Init extends Zend_Controller_Plugin_Abstract
{
    public function __construct()
    {
        // require configuration
        require_once 'Zend/Config.php';

        // get configuration from ini file
        $config = new Zend_Config_Ini('../application/config.ini', 'dev');

        // connect to the database
        $db = new Zend_Db_Adapter_Pdo_Mysql($config-&gt;database-&gt;params);

        // assign the db adapter to be default for our models
        Zend_Db_Table::setDefaultAdapter($db);

        // register configuration at the registry
        Zend_Registry::set('config', $config);

        Zend_Registry::set('db', $db);

        // start layout mvc
        Zend_Layout::startMvc(array(
            'layoutPath' =&gt; '../application/layouts',
            'layout' =&gt; 'main'
        ));
    }

}</pre>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/07/06/zend-framework-simple-acl-front-controller-plugin/" rel="bookmark" title="Zend Framework: Simple Acl Front Controller Plugin">Zend Framework: Simple Acl Front Controller Plugin </a></li>
<li><a href="/2008/08/11/zend-framework-quick-tutorial-part-2-directory-layout-and-bootstrapping/" rel="bookmark" title="Zend Framework &#8211; quick tutorial (part 2)">Zend Framework &#8211; quick tutorial (part 2) </a></li>
<li><a href="/2008/08/05/zend-framework-quick-tutorial-part-1-introduction/" rel="bookmark" title="Zend Framework &#8211; quick tutorial (part 1)">Zend Framework &#8211; quick tutorial (part 1) </a></li>
<li><a href="/2009/10/27/zend-framework-custom-urls/" rel="bookmark" title="Zend Framework custom URLs">Zend Framework custom URLs </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2009/06/19/zend-framework-quick-tutorial-part-3-front-controller-plugins/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>The SWFObject method createSWF problem</title>
		<link>/2009/05/14/the-swfobject-method-createswf-problem/</link>
		<comments>/2009/05/14/the-swfobject-method-createswf-problem/#respond</comments>
		<pubDate>Thu, 14 May 2009 11:36:47 +0000</pubDate>
		<dc:creator><![CDATA[stoimen]]></dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[createSWF]]></category>
		<category><![CDATA[embedSWF]]></category>
		<category><![CDATA[ie]]></category>
		<category><![CDATA[problem]]></category>
		<category><![CDATA[SWFObject]]></category>
		<category><![CDATA[transparent]]></category>
		<category><![CDATA[wmode]]></category>

		<guid isPermaLink="false">/?p=568</guid>
		<description><![CDATA[The Problem Although the SWFObject method &#8211; createSWF is working fine under IE sets the wmode not to be transparent but with the strange value of window, i.e. &#60;PARAM name=&#8221;WMode&#8221; value=&#8221;Window&#8221; /&#62; The Solution is &#8230; to replace the createSWF method calls with other SWFObject method &#8211; embedSWF. There you can simply describe the desired &#8230; <a href="/2009/05/14/the-swfobject-method-createswf-problem/" class="more-link">Continue reading <span class="screen-reader-text">The SWFObject method createSWF problem</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2009/06/24/__flash_removecallback-problem-on-ie6/" rel="bookmark" title="__flash__removeCallback problem on IE6">__flash__removeCallback problem on IE6 </a></li>
<li><a href="/2009/04/14/load-flash-swf-in-hidden-div/" rel="bookmark" title="load flash .swf in hidden div">load flash .swf in hidden div </a></li>
<li><a href="/2009/02/10/ie-6-problem-with-flash-z-index/" rel="bookmark" title="IE 6 problem with flash z-index">IE 6 problem with flash z-index </a></li>
<li><a href="/2009/02/09/ie-externalinterface-communication-problem/" rel="bookmark" title="IE &#038; ExternalInterface communication problem">IE &#038; ExternalInterface communication problem </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>The Problem</h2>
<p>Although the SWFObject method &#8211; createSWF is working fine under IE sets the wmode not to be transparent but with the strange value of window, i.e. &lt;PARAM name=&#8221;WMode&#8221; value=&#8221;Window&#8221; /&gt;</p>
<h2>The Solution is &#8230;</h2>
<p>to replace the createSWF method calls with other SWFObject method &#8211; embedSWF. There you can simply describe the desired wmode for the flash.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2009/06/24/__flash_removecallback-problem-on-ie6/" rel="bookmark" title="__flash__removeCallback problem on IE6">__flash__removeCallback problem on IE6 </a></li>
<li><a href="/2009/04/14/load-flash-swf-in-hidden-div/" rel="bookmark" title="load flash .swf in hidden div">load flash .swf in hidden div </a></li>
<li><a href="/2009/02/10/ie-6-problem-with-flash-z-index/" rel="bookmark" title="IE 6 problem with flash z-index">IE 6 problem with flash z-index </a></li>
<li><a href="/2009/02/09/ie-externalinterface-communication-problem/" rel="bookmark" title="IE &#038; ExternalInterface communication problem">IE &#038; ExternalInterface communication problem </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2009/05/14/the-swfobject-method-createswf-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zend_Date with dates before 1901</title>
		<link>/2009/05/12/zend_date-with-dates-before-1901/</link>
		<comments>/2009/05/12/zend_date-with-dates-before-1901/#respond</comments>
		<pubDate>Tue, 12 May 2009 12:30:58 +0000</pubDate>
		<dc:creator><![CDATA[stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[issue]]></category>
		<category><![CDATA[zend_date]]></category>

		<guid isPermaLink="false">/?p=562</guid>
		<description><![CDATA[Zend_Date Zend_Date is the Zend Framework module for manipulation of dates. It gives several advantages. Everybody how has dealed with dates knows that built in PHP date function cannot manage dates before 1901. With that kind of problems Zend_Date is pretty fine. How to do that If you have only Zend_Date::set($timestamp); is not enough. The &#8230; <a href="/2009/05/12/zend_date-with-dates-before-1901/" class="more-link">Continue reading <span class="screen-reader-text">Zend_Date with dates before 1901</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/04/28/zend_datesetoptions-and-format_type-in-zend-framework-1-10-3/" rel="bookmark" title="Zend_Date::setOptions and format_type in Zend Framework 1.10.3">Zend_Date::setOptions and format_type in Zend Framework 1.10.3 </a></li>
<li><a href="/2010/01/22/zend_date-make-it-work-and-benefit-with-locales/" rel="bookmark" title="Zend_Date &#8211; make it work and benefit with locales">Zend_Date &#8211; make it work and benefit with locales </a></li>
<li><a href="/2009/05/12/flex-3-compare-two-dates/" rel="bookmark" title="Flex 3: compare two dates">Flex 3: compare two dates </a></li>
<li><a href="/2011/11/04/how-to-check-if-a-date-is-more-or-less-than-a-month-ago-with-php/" rel="bookmark" title="How to Check if a Date is More or Less Than a Month Ago with PHP">How to Check if a Date is More or Less Than a Month Ago with PHP </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>Zend_Date</h2>
<p>Zend_Date is the Zend Framework module for manipulation of dates. It gives several advantages. Everybody how has dealed with dates knows that built in PHP date function cannot manage dates before 1901. With that kind of problems Zend_Date is pretty fine.</p>
<h2>How to do that</h2>
<p>If you have only</p>
<blockquote><p>Zend_Date::set($timestamp);</p></blockquote>
<p>is not enough. The timestamp is an int representation and the framework cannot get the timezone from that and trows an error.</p>
<h2>The simple way to solve the problem</h2>
<p>Replace the line above with these:<span id="more-562"></span></p>
<blockquote><p>$date = new Zend_Date($timestamp);</p>
<p>$date-&gt;setTimezone(&#8216;Europe/Paris&#8217;);</p>
<p>print $date-&gt;toString(&#8216;d M y&#8217;);</p></blockquote>
<p>Now everything should be in place.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/04/28/zend_datesetoptions-and-format_type-in-zend-framework-1-10-3/" rel="bookmark" title="Zend_Date::setOptions and format_type in Zend Framework 1.10.3">Zend_Date::setOptions and format_type in Zend Framework 1.10.3 </a></li>
<li><a href="/2010/01/22/zend_date-make-it-work-and-benefit-with-locales/" rel="bookmark" title="Zend_Date &#8211; make it work and benefit with locales">Zend_Date &#8211; make it work and benefit with locales </a></li>
<li><a href="/2009/05/12/flex-3-compare-two-dates/" rel="bookmark" title="Flex 3: compare two dates">Flex 3: compare two dates </a></li>
<li><a href="/2011/11/04/how-to-check-if-a-date-is-more-or-less-than-a-month-ago-with-php/" rel="bookmark" title="How to Check if a Date is More or Less Than a Month Ago with PHP">How to Check if a Date is More or Less Than a Month Ago with PHP </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2009/05/12/zend_date-with-dates-before-1901/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex 3: compare two dates</title>
		<link>/2009/05/12/flex-3-compare-two-dates/</link>
		<comments>/2009/05/12/flex-3-compare-two-dates/#comments</comments>
		<pubDate>Tue, 12 May 2009 12:22:47 +0000</pubDate>
		<dc:creator><![CDATA[stoimen]]></dc:creator>
				<category><![CDATA[flex 3]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[compare]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[setTime]]></category>

		<guid isPermaLink="false">/?p=556</guid>
		<description><![CDATA[Theory of Operation You&#8217;re using Flex 3 and want to compare two dates. The format of the dates is string something like &#8220;2009 May 05&#8221;. The question is &#8230; What&#8217;s the best way to compare them Well if you&#8217;ve the dates as strings and you can easily conver them to something like unix timestamps. If &#8230; <a href="/2009/05/12/flex-3-compare-two-dates/" class="more-link">Continue reading <span class="screen-reader-text">Flex 3: compare two dates</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2009/05/12/zend_date-with-dates-before-1901/" rel="bookmark" title="Zend_Date with dates before 1901">Zend_Date with dates before 1901 </a></li>
<li><a href="/2009/05/20/flex-3-datechooser-utc-issue/" rel="bookmark" title="Flex 3 DateChooser UTC issue">Flex 3 DateChooser UTC issue </a></li>
<li><a href="/2009/03/01/download-custom-flex-3-datechooser-2/" rel="bookmark" title="Download Custom Flex 3 DateChooser">Download Custom Flex 3 DateChooser </a></li>
<li><a href="/2009/02/06/flex-3-custom-preloader/" rel="bookmark" title="Flex 3 Custom Preloader">Flex 3 Custom Preloader </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>Theory of Operation</h2>
<p>You&#8217;re using Flex 3 and want to compare two dates. The format of the dates is string something like &#8220;2009 May 05&#8221;. The question is &#8230;</p>
<h2>What&#8217;s the best way to compare them</h2>
<p>Well if you&#8217;ve the dates as strings and you can easily conver them to something like unix timestamps. If they are a Date object you can try lik so:<span id="more-556"></span></p>
<blockquote><p>date1 = new Date(&#8216;2009&#8217;);</p>
<p>date2 = new Date(&#8216;1990&#8217;);</p>
<p>if (date1.setTime() &lt; date2.setTime())</p></blockquote>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2009/05/12/zend_date-with-dates-before-1901/" rel="bookmark" title="Zend_Date with dates before 1901">Zend_Date with dates before 1901 </a></li>
<li><a href="/2009/05/20/flex-3-datechooser-utc-issue/" rel="bookmark" title="Flex 3 DateChooser UTC issue">Flex 3 DateChooser UTC issue </a></li>
<li><a href="/2009/03/01/download-custom-flex-3-datechooser-2/" rel="bookmark" title="Download Custom Flex 3 DateChooser">Download Custom Flex 3 DateChooser </a></li>
<li><a href="/2009/02/06/flex-3-custom-preloader/" rel="bookmark" title="Flex 3 Custom Preloader">Flex 3 Custom Preloader </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2009/05/12/flex-3-compare-two-dates/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Switch from Zend_Loader to Zend_Loader_Autoloader</title>
		<link>/2009/05/10/switch-from-zend_loader-to-zend_loader_autoloader/</link>
		<comments>/2009/05/10/switch-from-zend_loader-to-zend_loader_autoloader/#comments</comments>
		<pubDate>Sun, 10 May 2009 04:24:44 +0000</pubDate>
		<dc:creator><![CDATA[stoimen]]></dc:creator>
				<category><![CDATA[zend framework]]></category>
		<category><![CDATA[zend_loader]]></category>
		<category><![CDATA[zend_loader_autoloader]]></category>

		<guid isPermaLink="false">/?p=552</guid>
		<description><![CDATA[Zend_Loader Zend_Loader was the usual kind of autoloading in Zend Framework before version 1.8. Than simply you say: require_once &#8220;Zend/Loader.php&#8221;; Zend_Loader::registerAutoload(); That made all your application to autoload files from the library folder where usualy the Zend Framework stays. That has several things to be changed. The namespaces There where not really namespaces for autoloading. &#8230; <a href="/2009/05/10/switch-from-zend_loader-to-zend_loader_autoloader/" class="more-link">Continue reading <span class="screen-reader-text">Switch from Zend_Loader to Zend_Loader_Autoloader</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2008/08/11/zend-framework-quick-tutorial-part-2-directory-layout-and-bootstrapping/" rel="bookmark" title="Zend Framework &#8211; quick tutorial (part 2)">Zend Framework &#8211; quick tutorial (part 2) </a></li>
<li><a href="/2009/03/31/lambda-functions-in-php/" rel="bookmark" title="Lambda functions in PHP?">Lambda functions in PHP? </a></li>
<li><a href="/2010/04/16/zend_validate_alnum-doesnt-work-correctly/" rel="bookmark" title="Zend_Validate_Alnum Doesn&#8217;t Work Correctly">Zend_Validate_Alnum Doesn&#8217;t Work Correctly </a></li>
<li><a href="/2010/04/20/custom-routes-with-zend_controller_router_route/" rel="bookmark" title="Custom Routes with Zend_Controller_Router_Route">Custom Routes with Zend_Controller_Router_Route </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>Zend_Loader</h2>
<p>Zend_Loader was the usual kind of autoloading in Zend Framework before version 1.8. Than simply you say:</p>
<blockquote><p>require_once &#8220;Zend/Loader.php&#8221;;<br />
Zend_Loader::registerAutoload();</p></blockquote>
<p>That made all your application to autoload files from the library folder where usualy the Zend Framework stays. That has several things to be changed.<span id="more-552"></span></p>
<h2>The namespaces</h2>
<p>There where not really namespaces for autoloading. Everything was searched to be loaded in one single namespace. And thus there where not the functionality to remove a namespace from the game. You have everything all the time.</p>
<h2>Zend_Loader_Autoloader</h2>
<p>This is new from version 1.8 in Zend Framework. Now you should use this class to autoload your classes. There&#8217;s really namespaces and for more info and detailed information you should search the documentation of the ZF.</p>
<h2>The most simple way to switch from Zend_Loader to Zend_Loader_Autoloader</h2>
<p>That&#8217;s really simple, and I don&#8217;t understand why there&#8217;s not proper explanation how to do that in the ZF docs. You need to replaces this lines of code:</p>
<blockquote><p>require_once &#8220;Zend/Loader.php&#8221;;<br />
Zend_Loader::registerAutoload();</p></blockquote>
<p>with these:</p>
<blockquote><p>require_once &#8216;Zend/Loader/Autoloader.php&#8217;;<br />
$autoloader = Zend_Loader_Autoloader::getInstance();<br />
$autoloader-&gt;setFallbackAutoloader(true);</p></blockquote>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2008/08/11/zend-framework-quick-tutorial-part-2-directory-layout-and-bootstrapping/" rel="bookmark" title="Zend Framework &#8211; quick tutorial (part 2)">Zend Framework &#8211; quick tutorial (part 2) </a></li>
<li><a href="/2009/03/31/lambda-functions-in-php/" rel="bookmark" title="Lambda functions in PHP?">Lambda functions in PHP? </a></li>
<li><a href="/2010/04/16/zend_validate_alnum-doesnt-work-correctly/" rel="bookmark" title="Zend_Validate_Alnum Doesn&#8217;t Work Correctly">Zend_Validate_Alnum Doesn&#8217;t Work Correctly </a></li>
<li><a href="/2010/04/20/custom-routes-with-zend_controller_router_route/" rel="bookmark" title="Custom Routes with Zend_Controller_Router_Route">Custom Routes with Zend_Controller_Router_Route </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2009/05/10/switch-from-zend_loader-to-zend_loader_autoloader/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>php.ini for two web servers</title>
		<link>/2009/05/10/phpini-for-two-web-servers/</link>
		<comments>/2009/05/10/phpini-for-two-web-servers/#respond</comments>
		<pubDate>Sun, 10 May 2009 04:14:26 +0000</pubDate>
		<dc:creator><![CDATA[stoimen]]></dc:creator>
				<category><![CDATA[web development]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[php.ini]]></category>
		<category><![CDATA[web server]]></category>
		<category><![CDATA[workaround]]></category>

		<guid isPermaLink="false">/?p=551</guid>
		<description><![CDATA[Two Apaches one php.ini Yes in our case this was the fact. There were two web servers, Apache 2 in our case, and one PHP. The php.ini file was in /etc/ as usual. Everything seemed to be perfect. But however some directives in php.ini does not worked for one of the server. Why the second &#8230; <a href="/2009/05/10/phpini-for-two-web-servers/" class="more-link">Continue reading <span class="screen-reader-text">php.ini for two web servers</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/06/15/use-zend_translate-to-translate-your-web-app/" rel="bookmark" title="Use Zend_Translate to Translate Your Web App">Use Zend_Translate to Translate Your Web App </a></li>
<li><a href="/2010/01/11/what-should-be-optimized-in-one-web-page/" rel="bookmark" title="What should be optimized in one web page?">What should be optimized in one web page? </a></li>
<li><a href="/2010/01/18/what-should-i-optimize-first-in-my-web-page/" rel="bookmark" title="What should I optimize first in my web page?">What should I optimize first in my web page? </a></li>
<li><a href="/2010/01/13/optimizing-the-web-start-with-the-images/" rel="bookmark" title="Optimizing the web. Start with the images!">Optimizing the web. Start with the images! </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>Two Apaches one php.ini</h2>
<p>Yes in our case this was the fact. There were two web servers, Apache 2 in our case, and one PHP. The php.ini file was in /etc/ as usual. Everything seemed to be perfect. But however some directives in php.ini does not worked for one of the server.</p>
<h2>Why the second server does not read php.ini?</h2>
<p>Well actually when you load the php.ini for the first server it loads correctly with everthing declared in it. However when you start the second server, of course on a different port than the first one, you get all the php.ini values as if they are default.</p>
<h2>Why?</h2>
<p>That&#8217;s some feature of PHP we didn&#8217;t know. I still don&#8217;t have an explanation about it. But of cource there&#8217;s a &#8230;</p>
<h2>Workaround</h2>
<p>You can put everything for the second server in the .htaccess file, so this will act as second php.ini for the second web server</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/06/15/use-zend_translate-to-translate-your-web-app/" rel="bookmark" title="Use Zend_Translate to Translate Your Web App">Use Zend_Translate to Translate Your Web App </a></li>
<li><a href="/2010/01/11/what-should-be-optimized-in-one-web-page/" rel="bookmark" title="What should be optimized in one web page?">What should be optimized in one web page? </a></li>
<li><a href="/2010/01/18/what-should-i-optimize-first-in-my-web-page/" rel="bookmark" title="What should I optimize first in my web page?">What should I optimize first in my web page? </a></li>
<li><a href="/2010/01/13/optimizing-the-web-start-with-the-images/" rel="bookmark" title="Optimizing the web. Start with the images!">Optimizing the web. Start with the images! </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2009/05/10/phpini-for-two-web-servers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex 3 HSlider thumb gap issue</title>
		<link>/2009/04/25/flex-3-hslider-thumb-gap-issue/</link>
		<comments>/2009/04/25/flex-3-hslider-thumb-gap-issue/#comments</comments>
		<pubDate>Sat, 25 Apr 2009 15:19:33 +0000</pubDate>
		<dc:creator><![CDATA[stoimen]]></dc:creator>
				<category><![CDATA[flex 3]]></category>
		<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[gap]]></category>
		<category><![CDATA[hslider]]></category>
		<category><![CDATA[issue]]></category>
		<category><![CDATA[problem]]></category>
		<category><![CDATA[thumbs]]></category>

		<guid isPermaLink="false">/?p=547</guid>
		<description><![CDATA[Flex 3 HSlider thumb gap issue<div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2009/05/20/flex-3-datechooser-utc-issue/" rel="bookmark" title="Flex 3 DateChooser UTC issue">Flex 3 DateChooser UTC issue </a></li>
<li><a href="/2009/02/08/flash-player-with-debugger-issue/" rel="bookmark" title="flash player with debugger issue">flash player with debugger issue </a></li>
<li><a href="/2009/04/14/you-should-not-insert-an-tag-in-another-tag-ie-breaks/" rel="bookmark" title="You should not insert an &#8220;a&#8221; tag in another &#8220;a&#8221; tag! &#8230;">You should not insert an &#8220;a&#8221; tag in another &#8220;a&#8221; tag! &#8230; </a></li>
<li><a href="/2009/12/01/flex-3-netstream-video-rotation/" rel="bookmark" title="Flex 3 NetStream video rotation">Flex 3 NetStream video rotation </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>Introduction to the problem</h2>
<p>When the HSlider is set up with two or more thumbs there&#8217;s a gap between them always. The problem is that you may want to put them on one single value of the slider, but it&#8217;s not possible.</p>
<h2>First: hide your thumbs</h2>
<p>The quick solution is to make custom skin for the thumbs, setup the height and width of the thumb to be 1px and make a transparent background image for skinning them. That of course does not solve the problem. There&#8217;s still gap of 1 value between the thumbs, and still you cannot select one single value with both of them.<span id="more-547"></span></p>
<h2>Make your own thumbs</h2>
<p>It&#8217;s difficult to make the calculation and positioning of course. With that approach you&#8217;ve to be careful with the math to adjust properly the new thumbs. They can be some kind of Flex built in component. As the button control is or whatever.</p>
<h2>Hope for workaround</h2>
<p>As it appears there&#8217;s a reported bug for this issue. And I hope soon there will be a workaround or even better there&#8217;s going to be new version. Something I don&#8217;t like in commercial software.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2009/05/20/flex-3-datechooser-utc-issue/" rel="bookmark" title="Flex 3 DateChooser UTC issue">Flex 3 DateChooser UTC issue </a></li>
<li><a href="/2009/02/08/flash-player-with-debugger-issue/" rel="bookmark" title="flash player with debugger issue">flash player with debugger issue </a></li>
<li><a href="/2009/04/14/you-should-not-insert-an-tag-in-another-tag-ie-breaks/" rel="bookmark" title="You should not insert an &#8220;a&#8221; tag in another &#8220;a&#8221; tag! &#8230;">You should not insert an &#8220;a&#8221; tag in another &#8220;a&#8221; tag! &#8230; </a></li>
<li><a href="/2009/12/01/flex-3-netstream-video-rotation/" rel="bookmark" title="Flex 3 NetStream video rotation">Flex 3 NetStream video rotation </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2009/04/25/flex-3-hslider-thumb-gap-issue/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Scroll the page with JavaScript</title>
		<link>/2009/04/24/scroll-the-page-with-javascript/</link>
		<comments>/2009/04/24/scroll-the-page-with-javascript/#comments</comments>
		<pubDate>Fri, 24 Apr 2009 06:53:32 +0000</pubDate>
		<dc:creator><![CDATA[stoimen]]></dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[scroll]]></category>

		<guid isPermaLink="false">/?p=541</guid>
		<description><![CDATA[Scroll the page with JavaScript<div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2011/03/29/scroll-an-iframe-content-to-a-predefined-position/" rel="bookmark" title="Scroll an IFRAME Content to a Predefined Position">Scroll an IFRAME Content to a Predefined Position </a></li>
<li><a href="/2009/05/18/reload-the-page-with-javascript/" rel="bookmark" title="reload the page with javascript">reload the page with javascript </a></li>
<li><a href="/2009/04/08/flash-doesnt-load-in-div-with-display-none-style/" rel="bookmark" title="Flash doesn&#8217;t load in div with display:none style">Flash doesn&#8217;t load in div with display:none style </a></li>
<li><a href="/2009/12/18/whats-the-width-and-height-of-the-visible-part-of-my-browser/" rel="bookmark" title="What&#8217;s the width and height of the visible part of my browser?!">What&#8217;s the width and height of the visible part of my browser?! </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>In that case I need to scroll my page onclick event to show the fully loaded content in a &lt;div&gt;, which just loaded content.</p>
<p>That can be done with window.scrollBy(x, y). Where if you&#8217;d like to scroll vertically you&#8217;ve to change the y value.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2011/03/29/scroll-an-iframe-content-to-a-predefined-position/" rel="bookmark" title="Scroll an IFRAME Content to a Predefined Position">Scroll an IFRAME Content to a Predefined Position </a></li>
<li><a href="/2009/05/18/reload-the-page-with-javascript/" rel="bookmark" title="reload the page with javascript">reload the page with javascript </a></li>
<li><a href="/2009/04/08/flash-doesnt-load-in-div-with-display-none-style/" rel="bookmark" title="Flash doesn&#8217;t load in div with display:none style">Flash doesn&#8217;t load in div with display:none style </a></li>
<li><a href="/2009/12/18/whats-the-width-and-height-of-the-visible-part-of-my-browser/" rel="bookmark" title="What&#8217;s the width and height of the visible part of my browser?!">What&#8217;s the width and height of the visible part of my browser?! </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2009/04/24/scroll-the-page-with-javascript/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>When you should use base64 for images</title>
		<link>/2009/04/23/when-you-should-use-base64-for-images/</link>
		<comments>/2009/04/23/when-you-should-use-base64-for-images/#comments</comments>
		<pubDate>Thu, 23 Apr 2009 05:43:18 +0000</pubDate>
		<dc:creator><![CDATA[stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[base64]]></category>
		<category><![CDATA[html document]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[inline]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[request]]></category>
		<category><![CDATA[response]]></category>

		<guid isPermaLink="false">/?p=538</guid>
		<description><![CDATA[When you should use base64 for images<div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/02/05/css-sprites-go-beyond-the-limits-with-base64/" rel="bookmark" title="CSS sprites. Go beyond the limits with base64!">CSS sprites. Go beyond the limits with base64! </a></li>
<li><a href="/2010/01/13/optimizing-the-web-start-with-the-images/" rel="bookmark" title="Optimizing the web. Start with the images!">Optimizing the web. Start with the images! </a></li>
<li><a href="/2009/04/07/optimize-your-images-improve-the-performance/" rel="bookmark" title="Optimize your images &#8211; improve the performance">Optimize your images &#8211; improve the performance </a></li>
<li><a href="/2010/07/01/replace-the-broken-images-with-a-default-image-with-javascript/" rel="bookmark" title="Replace the Broken Images with a Default Image with JavaScript">Replace the Broken Images with a Default Image with JavaScript </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>Base64 and image files</h2>
<p>For those who don&#8217;t know base64 it&#8217;s an encoding format for any data. In that case with the images we can simply say, that base64 equals to text (string) representation of the image itself. In most cases you&#8217;ve image tags with src attribute pointing to the http source of the image.</p>
<h2>Overview of the problem</h2>
<p>Let&#8217;s say we&#8217;ve a HTML document with 100 images into. That&#8217;s a rare case I agree, but sometimes it happens. You&#8217;ve to preload the thumbnails of an image gallery where only one image is displayed in a bigger size. As I mentioned before the progressive JPEG suits better for a large image but for the thumbnails you&#8217;ve to use baseline JPEGs.</p>
<p><em>Note: In fact the technique with base64 representation of the images is not well known. I think that&#8217;s because there are not so much examples with pages with more than 100 images.</em></p>
<p>But anyway. We&#8217;ve the HTML document with 100 images (100 &lt;img&gt; tags). That means directly 101 requests/responses from the server. In my tests on my localhost, which is supposed to be fast enough, that case loaded 2 MB with a simple small JPEG for the image, loaded 100 times, and approximately 3 seconds. Which yet again on the localhost is extreamly slow. The image is on my machine, the server is here&#8230; what else?</p>
<h2>How to put the images inline?</h2>
<p>The other way to do that is to put all you images in you HTML document. Than the first and more important rule for optimization (see more <a title="Steve Souders faster pages" href="http://video.stoimen.com/2009/04/17/steve-souders-high-performance-web-sites-14-rules-for-faster-pages/" target="_blank">here</a>), to make fewer requests is done. You now have only one request. And with the response you&#8217;ve all 100 images. That&#8217;s good when you&#8217;ve different images, cause every repeatable element in your CSS should be made with HTTP request once and than repeated with the CSS. In other way you risk the size of the document transfered in the web.</p>
<h2>The results</h2>
<p>The second case with the inline images and the only one request is giving me an average response time of 900ms. The size of the document is bigger, yes. I had 5KB for the HTML with no base64 images, and then the size increased to 45KB. That&#8217;s 9 times more. But however 45KB is nothing for the web, instead of all those 2 MB in the previous test.</p>
<h2>How to make your images to strings?</h2>
<p>Speaking in PHP terminology there is a function called base64_encode, which with a combination of file_get_contents(imagefile), make the files a base64 string.</p>
<h2>Is there any issue?</h2>
<p>Yes there is. First you cannot have your image files in a remote server, cause file_get_contents must read only from the local filesystem. Than if you process all those files before returning them to the client, where&#8217;s the point? You lose all that time you&#8217;ve spent with the technique.</p>
<h2>The reasonable solution</h2>
<p>I think this technique is good for cases like the one described at the beggining. You&#8217;ve a page with more than 100 images. Then you&#8217;ve the base64 representation already. Let say you have it in your database as string and don&#8217;t need to convert it everytime you return the image. That may happen on upload of the image and the image enters the database with its base64 representation, and it&#8217;s done.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/02/05/css-sprites-go-beyond-the-limits-with-base64/" rel="bookmark" title="CSS sprites. Go beyond the limits with base64!">CSS sprites. Go beyond the limits with base64! </a></li>
<li><a href="/2010/01/13/optimizing-the-web-start-with-the-images/" rel="bookmark" title="Optimizing the web. Start with the images!">Optimizing the web. Start with the images! </a></li>
<li><a href="/2009/04/07/optimize-your-images-improve-the-performance/" rel="bookmark" title="Optimize your images &#8211; improve the performance">Optimize your images &#8211; improve the performance </a></li>
<li><a href="/2010/07/01/replace-the-broken-images-with-a-default-image-with-javascript/" rel="bookmark" title="Replace the Broken Images with a Default Image with JavaScript">Replace the Broken Images with a Default Image with JavaScript </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2009/04/23/when-you-should-use-base64-for-images/feed/</wfw:commentRss>
		<slash:comments>34</slash:comments>
		</item>
		<item>
		<title>Zend Framework &#8211; Disable Zend Layout</title>
		<link>/2009/04/21/zend-framework-disable-zend-layout/</link>
		<comments>/2009/04/21/zend-framework-disable-zend-layout/#comments</comments>
		<pubDate>Tue, 21 Apr 2009 05:50:41 +0000</pubDate>
		<dc:creator><![CDATA[stoimen]]></dc:creator>
				<category><![CDATA[featured]]></category>
		<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[disable layout]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[zend_layout]]></category>

		<guid isPermaLink="false">/?p=536</guid>
		<description><![CDATA[Zend Framework - Disable Zend Layout<div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/04/27/accessing-the-layout-in-zend-framework/" rel="bookmark" title="Accessing the layout() in Zend Framework">Accessing the layout() in Zend Framework </a></li>
<li><a href="/2009/06/19/zend-framework-quick-tutorial-part-3-front-controller-plugins/" rel="bookmark" title="Zend Framework &#8211; quick tutorial (part 3) &#8211; front controller plugins">Zend Framework &#8211; quick tutorial (part 3) &#8211; front controller plugins </a></li>
<li><a href="/2009/11/27/redirecting-with-zend-framework/" rel="bookmark" title="Redirecting with Zend Framework">Redirecting with Zend Framework </a></li>
<li><a href="/2010/07/07/default-error-handling-in-zend-framework/" rel="bookmark" title="Default Error Handling in Zend Framework">Default Error Handling in Zend Framework </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>What&#8217;s Zend Layout</h2>
<p>Everybody knows that sometimes you need header and footer for almost every page. In Zend Framework you don&#8217;t need to include them in every template page, as it will be if you were using Smarty for instance. You just need to use Zend_Layout. It&#8217;s easy and it&#8217;s helpful.</p>
<h2>What if you don&#8217;t need layout for a controller action?</h2>
<p>Well if you have to have a given controller action with no use of Zend_Layout, you just need to disable it.</p>
<h2>How &#8230;</h2>
<p>&#8230; simply by placing this line in you controller action:</p>
<blockquote><p>$this-&gt;_helper-&gt;layout-&gt;disableLayout();</p></blockquote>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/04/27/accessing-the-layout-in-zend-framework/" rel="bookmark" title="Accessing the layout() in Zend Framework">Accessing the layout() in Zend Framework </a></li>
<li><a href="/2009/06/19/zend-framework-quick-tutorial-part-3-front-controller-plugins/" rel="bookmark" title="Zend Framework &#8211; quick tutorial (part 3) &#8211; front controller plugins">Zend Framework &#8211; quick tutorial (part 3) &#8211; front controller plugins </a></li>
<li><a href="/2009/11/27/redirecting-with-zend-framework/" rel="bookmark" title="Redirecting with Zend Framework">Redirecting with Zend Framework </a></li>
<li><a href="/2010/07/07/default-error-handling-in-zend-framework/" rel="bookmark" title="Default Error Handling in Zend Framework">Default Error Handling in Zend Framework </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2009/04/21/zend-framework-disable-zend-layout/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
