<?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>Shaked Klein Orbach</title>
	<atom:link href="http://www.shakedos.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.shakedos.com</link>
	<description>echo &#039;Just smile&#039;;</description>
	<lastBuildDate>Sun, 06 May 2012 23:44:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Yii Framework &#8211; introduction and more</title>
		<link>http://www.shakedos.com/yii-framework-introduction-and-more/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=yii-framework-introduction-and-more</link>
		<comments>http://www.shakedos.com/yii-framework-introduction-and-more/#comments</comments>
		<pubDate>Sun, 06 May 2012 23:39:44 +0000</pubDate>
		<dc:creator>Shaked</dc:creator>
				<category><![CDATA[Dev]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Yii Framework]]></category>
		<category><![CDATA[assets manager]]></category>
		<category><![CDATA[yii framework]]></category>
		<category><![CDATA[yii installation]]></category>
		<category><![CDATA[yii layouts]]></category>

		<guid isPermaLink="false">http://www.shakedos.com/?p=447</guid>
		<description><![CDATA[Description yiiframework.com: Yii is a high-performance PHP framework best for developing Web 2.0 applications. Yii comes with rich features: MVC, DAO/ActiveRecord, I18N/L10N, caching, authentication and role-based access control, scaffolding, testing, etc. It can reduce your development time significantly. Requirements Yii supplies an easy way to know what kind of modules and such are required to [...]]]></description>
			<content:encoded><![CDATA[<h2>Description</h2>
<blockquote><p><a href="http://www.yiiframework.com/">yiiframework.com</a>:</p>
<p>Yii is a high-performance PHP framework best for developing Web 2.0 applications.</p>
<p>Yii comes with rich features: MVC, DAO/ActiveRecord, I18N/L10N, caching, authentication and role-based access control, scaffolding, testing, etc. It can reduce your development time significantly.</p></blockquote>
<h2>Requirements</h2>
<p>Yii supplies an easy way to know what kind of modules and such are required to use its power.<br />
<span id="more-447"></span><br />
Requirements are available at <span style="color: #0000ff;">http://your-domain/path/to/yii/requirements/ <span style="color: #000000;">and should look like the following: </span></span></p>
<p><img class="alignnone" title="yii framework requirements " src="http://dl.dropbox.com/u/29571223/uploads/yiiframeworequirements.png" alt="" width="806" height="582" /></p>
<h2>Installation and a tour</h2>
<p>Yii does not require installation, <a title="Take a tour - yii framework " href="http://www.yiiframework.com/tour/" target="_blank">yii documentation</a> provides a well explained 'take a tour' page which let you generate your first 'hello world' page.</p>
<h2>How to</h2>
<p>So the question is how to do what? There are two topics which I want to write about today:</p>
<ol>
<li>Layouts</li>
<li>Assets Manager</li>
</ol>
<h3>Layouts</h3>
<p>Layouts are usually an important feature which should be a part of (almost) any MVC framework.</p>
<p>Yii framework provides us a easy way to use layouts:</p>
<ol>
<li>Create new <em>.php</em> file in  <em>protected/views/layouts/your_new_layout.php</em></li>
<li>Add your relevant data, while $content reflects the rendered data:<br />
<em>&lt;head&gt;....&lt;/head&gt;</em><br />
<em>&lt;body&gt;</em><br />
<em>  &lt;?php echo $content ?&gt; </em><br />
<em>&lt;/body&gt;</em><br />
<em>&lt;/html&gt; </em></li>
<li>Change your layout by requirements for each controller action or for the entire controller by using:<br />
<em>$this-&gt;layout = 'your_new_layout';<br />
</em>Should be look like this:<br />
function actionIndex(){<br />
<em>      $this-&gt;layout = 'your_new_layout';</em><br />
}</li>
</ol>
<div>That's it! easy, ha ?</div>
<div></div>
<h3>Assets Manager</h3>
<div>Yii framework provides a very nice way to handle assets. The thing which I like the most is where do I put my assets declarations.</div>
<div>I saw many ways to declare about assets:</div>
<div>
<ul>
<li>Part of the controller</li>
<li>Part of the HTML (inline)</li>
<li>Both</li>
<li>Weird ways which I should not even mention</li>
</ul>
</div>
<div>In my perspective, assets declaration should be part of the HTML by using PHP (or any other template system\language), for example:</div>
<div>
<pre class="brush: bash; gutter: true; first-line: 1">&lt;?php

//load scripts
$clientScript = Yii::app()-&gt;getClientScript();
$clientScript-&gt;registerScriptFile(&#039;//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js&#039;);
$clientScript-&gt;(&#039;API.js&#039;,CClientScript::POS_END); 

//load css
$clientScript-&gt;registerCssFile(&#039;//ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/start/jquery-ui.css&#039;);
$clientScript-&gt;registerCssFile($baseUrl.&#039;/css/events.css&#039;);

?&gt;
&lt;div&gt;
More HTML here
&lt;/div&gt;</pre>
</div>
<p>As you can see, I declared both JS and CSS in my HTML file , so why ?</p>
<p>As I see it the developers which should maintain the way we use our assets are the front-end developers.</p>
<p>Implementing the above code won't be enough when working on a live environment, therefor we have to solve it by using JS and CSS minifiers.<br />
This guide might not bring the best way to do that since I just want to prove my point, so please share your ways to do that.</p>
<div></div>
<div>To minify my assets I'v used  <a title="DynamicRes - Yii extension " href="http://www.yiiframework.com/extension/dynamicres/" target="_blank">DynamicRes extension</a> with the following steps:</div>
<div>
<ol>
<li>Download the extension and install it into <em>protected/extension/</em></li>
<li>Add the following to <em>protected/config/main.php</em>:
<pre class="brush: bash; gutter: true; first-line: 1">// application components
&#039;components&#039;=&gt;array(
..
..
//@see http://www.yiiframework.com/extension/dynamicres/
		  &#039;dynamicRes&#039;=&gt;array(
            &#039;class&#039; =&gt; &#039;ext.DynamicRes.DynamicRes&#039;,
            &#039;urlConfig&#039; =&gt; array( // Its fix Css, and convert Url to RealName
                &#039;baseUrl&#039;  =&gt; &#039;/&#039;, // Url of your Site (ending with /), modify it if you use subdomain
                &#039;basePath&#039; =&gt; dirname(__FILE__).&#039;/../../&#039;, // path of your site (ending with /) (No Change This)
            )
          ),
..
..</pre>
</li>
<li>Replace <em>Yii::app()-&gt;getClientScript() </em>with <em>Yii::app()-&gt;dynamicRes</em></li>
<li>You may add your env param to make your structure more dynamic</li>
</ol>
<div></div>
<div>My final implementation looks like this:</div>
<div>
<pre class="brush: bash; gutter: true; first-line: 1">/**
* ENV Settings</pre>
<pre class="brush: bash; gutter: true; first-line: 1">* TODO: should be move to Yii::app() to return ClientScript by ENV settings
 */
if (Yii::app()-&gt;params[&#039;env&#039;] == &#039;dev&#039;){
	$baseUrl = Yii::app()-&gt;request-&gt;baseUrl;
	$cs = Yii::app()-&gt;getClientScript();
} else {
	$baseUrl = &#039;&#039;;
	$cs = Yii::app()-&gt;dynamicRes;
}
//load it from google cache so no need to pack and minify
Yii::app()-&gt;getClientScript()-&gt;registerScriptFile(&#039;//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js&#039;);

	$cs-&gt;registerScriptFile($baseUrl . &#039;/js/external/underscore.js&#039;			,CClientScript::POS_END); 

	$cs-&gt;registerScriptFile($baseUrl . &#039;/js/external/Backbone.js&#039;			,CClientScript::POS_END); 

	$cs-&gt;registerCssFile($baseUrl.&#039;/css/style.css&#039;);</pre>
</div>
</div>
<h2>Summary</h2>
<p>Yii framework is an interesting toolbox which I ll continue to explore.</p>
<p>In my upcoming posts I ll write about memcache, modules and more.</p>
<p>Feel free to write\suggest\ask anything that comes in mind.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>-Shak</p>
<p>&nbsp;</p>
<div class="al2fb_like_button"><div id="fb-root"></div><script type="text/javascript">
(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=188624057851679";
  fjs.parentNode.insertBefore(js, fjs);
}(document, "script", "facebook-jssdk"));
</script>
<fb:like href="http://www.shakedos.com/yii-framework-introduction-and-more/" layout="standard" show_faces="true" width="450" action="like" font="verdana" colorscheme="light" ref="AL2FB"></fb:like></div>]]></content:encoded>
			<wfw:commentRss>http://www.shakedos.com/yii-framework-introduction-and-more/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JIRA cannot start its required plugins</title>
		<link>http://www.shakedos.com/jira-cannot-start-its-required-plugins/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jira-cannot-start-its-required-plugins</link>
		<comments>http://www.shakedos.com/jira-cannot-start-its-required-plugins/#comments</comments>
		<pubDate>Tue, 13 Mar 2012 00:17:14 +0000</pubDate>
		<dc:creator>Shaked</dc:creator>
				<category><![CDATA[JIRA]]></category>
		<category><![CDATA[jira]]></category>
		<category><![CDATA[JIRA locked]]></category>
		<category><![CDATA[JIRA plugins]]></category>
		<category><![CDATA[jiralockfile]]></category>

		<guid isPermaLink="false">http://www.shakedos.com/?p=469</guid>
		<description><![CDATA[Desription Seems that JIRA might suddenly crashes once a while. When JIRA crashes, it won't remove the "JIRA lock" and then you won't be able to use it. One of (many) reason that this problem might happen is due the lack of time that JIRA has to run its required plugins. Log file might show: [...]]]></description>
			<content:encoded><![CDATA[<h2>Desription</h2>
<p>Seems that <a title="JIRA - atalssian" href="http://atlassian.com" target="_blank">JIRA</a> might suddenly crashes once a while.</p>
<p>When JIRA crashes, it won't remove the "<a title="JIRA lock" href="http://confluence.atlassian.com/display/JIRAKB/JIRA+is+Locked" target="_blank">JIRA lock</a>" and then you won't be able to use it.</p>
<p>One of (many) reason that this problem might happen is due the lack of time that JIRA has to run its required plugins.</p>
<h3>Log file might show:</h3>
<blockquote><p>******************************************************************************<br />
JIRA 4.4 build: 649 started. You can now access JIRA through your web browser.<br />
******************************************************************************</p>
<p>2012-03-13 03:41:09,761 main FATAL [atlassian.jira.startup.JiraStartupLogger]</p>
<p>********************************************************************************************************************************************************************************************************<br />
The following plugins are required by JIRA, but have not been started: Gadget Directory Plugin (com.atlassian.gadgets.directory), Embedded Gadgets Plugin (com.atlassian.gadgets.embedded), Gadget Dashboard Plugin (com.atlassian.gadgets.dashboard), Atlassian JIRA - Plugins - Gadgets Plugin (com.atlassian.jira.gadgets), FishEye Plugin (com.atlassian.jirafisheyeplugin), Opensocial Plugin (com.atlassian.gadgets.opensocial)<br />
********************************************************************************************************************************************************************************************************</p>
<p>2012-03-13 03:41:09,761 main FATAL [atlassian.jira.upgrade.UpgradeLauncher] Skipping, JIRA is locked.<br />
2012-03-13 03:41:09,761 main INFO [atlassian.jira.scheduler.JiraSchedulerLauncher] JIRA Scheduler not started: JIRA startup checklist failed.<br />
2012-03-13 03:41:11,766 main FATAL [jira.web.dispatcher.JiraWebworkActionDispatcher]</p>
<p>******************************************<br />
JIRA startup failed, JIRA has been locked.<br />
******************************************</p></blockquote>
<h2>Solution</h2>
<ol>
<li>Stop JIRA (<em>/opt/atlassian/jira/bin/stop-jira.sh</em>)</li>
<li>Search for setenv.sh (<em>vi /opt/atlassian/jira/bin/setenv.sh</em>)</li>
<li>Change JVM_SUPPORT_RECOMMENDED_ARGS's value:<br />
<em>JVM_SUPPORT_RECOMMENDED_ARGS="-Datlassian.plugins.enable.wait=300"</em></li>
<li>Save</li>
<li>Start JIRA (<em>/opt/atlassian/jira/bin/start-jira.sh</em>)</li>
</ol>
<p>More information is available at JIRA's docs: <a href="http://confluence.atlassian.com/display/DOC/Configuring+System+Properties">http://confluence.atlassian.com/display/DOC/Configuring+System+Properties</a></p>
<p>&nbsp;</p>
<p>Please share your solutions, errors or any other relevant information.</p>
<p>Shak</p>
<div class="al2fb_like_button"><div id="fb-root"></div><script type="text/javascript">
(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=188624057851679";
  fjs.parentNode.insertBefore(js, fjs);
}(document, "script", "facebook-jssdk"));
</script>
<fb:like href="http://www.shakedos.com/jira-cannot-start-its-required-plugins/" layout="standard" show_faces="true" width="450" action="like" font="verdana" colorscheme="light" ref="AL2FB"></fb:like></div>]]></content:encoded>
			<wfw:commentRss>http://www.shakedos.com/jira-cannot-start-its-required-plugins/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating Chrome user profiles</title>
		<link>http://www.shakedos.com/creating-chrome-user-profiles/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=creating-chrome-user-profiles</link>
		<comments>http://www.shakedos.com/creating-chrome-user-profiles/#comments</comments>
		<pubDate>Sat, 11 Feb 2012 18:35:14 +0000</pubDate>
		<dc:creator>Shaked</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Accounts]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[Profiles]]></category>

		<guid isPermaLink="false">http://www.shakedos.com/?p=452</guid>
		<description><![CDATA[Description Google Chrome finally supports "Chrome profiles" Why do I need it? Finally useful tool for people who share their computer with other OR wants to have multiple profiles over the same computer for testings. How Its very easy to create new profile and manage the existing one: Download Chrome Go to "Chrome control" menu [...]]]></description>
			<content:encoded><![CDATA[<h2>Description</h2>
<p>Google Chrome finally supports "Chrome profiles"</p>
<h4>Why do I need it?</h4>
<p>Finally useful tool for people who share their computer with other <strong>OR </strong>wants to have multiple profiles over the same computer for testings.</p>
<h2>How</h2>
<p>Its very easy to create new profile and manage the existing one:</p>
<ol>
<li><a title="Google Chrome" href="https://www.google.com/chrome/" target="_blank">Download Chrome</a></li>
<li>Go to "Chrome control" menu<br />
<img class="alignnone" title="Chrome control icon" src="http://dl.dropbox.com/u/29571223/uploads/chromecontrolicon.png" alt="" width="41" height="58" /></li>
<li>Open "Preferences"</li>
<li>Go to "Personal Stuff"<br />
<img class="alignnone" title="Personal Stuff " src="http://dl.dropbox.com/u/29571223/uploads/personalstuff.png" alt="" width="432" height="174" /></li>
<li>Click on the "add new user"</li>
<li>Now you can manage your accounts through the icon on the top left (right for RTL languages) by clicking and choosing the relevant user.<br />
<img class="alignnone" title="Manage Chrome" src="http://dl.dropbox.com/u/29571223/uploads/managechrome.png" alt="" width="208" height="177" /></li>
<li>Good luck!</li>
</ol>
<p>&nbsp;</p>
<h2>Notes</h2>
<p>Creating new profile doesn't mean that your password are safe, as I noticed that my users and password are still available on other profiles as well!</p>
<p>&nbsp;</p>
<p>Enjoy <img src='http://www.shakedos.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Shak</p>
<div class="al2fb_like_button"><div id="fb-root"></div><script type="text/javascript">
(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=188624057851679";
  fjs.parentNode.insertBefore(js, fjs);
}(document, "script", "facebook-jssdk"));
</script>
<fb:like href="http://www.shakedos.com/creating-chrome-user-profiles/" layout="standard" show_faces="true" width="450" action="like" font="verdana" colorscheme="light" ref="AL2FB"></fb:like></div>]]></content:encoded>
			<wfw:commentRss>http://www.shakedos.com/creating-chrome-user-profiles/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Zend Framework, Gmail, SMTP and SSL</title>
		<link>http://www.shakedos.com/zend-framework-gmail-smtp-and-ssl/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=zend-framework-gmail-smtp-and-ssl</link>
		<comments>http://www.shakedos.com/zend-framework-gmail-smtp-and-ssl/#comments</comments>
		<pubDate>Sat, 21 Jan 2012 20:13:09 +0000</pubDate>
		<dc:creator>Shaked</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[gmail smtp php]]></category>
		<category><![CDATA[openssl and smtp]]></category>
		<category><![CDATA[zend framework smtp]]></category>

		<guid isPermaLink="false">http://www.shakedos.com/?p=437</guid>
		<description><![CDATA[Topic says everything, isn't it? Description I had a problem sending emails while using Zend Framework with Gmail account. So I had to handle different types of errors: "Unable to connect via TLS" - being created by Zend Framework Exception. "Unable to find the socket transport "https" - did you forget to enable it when [...]]]></description>
			<content:encoded><![CDATA[<p>Topic says everything, isn't it?</p>
<h2>Description</h2>
<p>I had a problem sending emails while using Zend Framework with Gmail account. So I had to handle different types of errors:</p>
<ul>
<li>"Unable to connect via TLS" - being created by Zend Framework Exception.</li>
<li>"Unable to find the socket transport "https" - did you forget to enable it when you configured PHP?" - PHP built in error message</li>
</ul>
<h2>Suggestions</h2>
<p><span id="more-437"></span></p>
<p>Before starting to code, you have to configure your PHP to work with <a title="PHP OpenSSL " href="http://www.php.net/manual/en/openssl.installation.php" target="_blank">php-openssl</a>.</p>
<p style="padding-left: 30px;"><span style="text-decoration: underline;">Linux</span>:</p>
<p style="padding-left: 30px;">Install openssl</p>
<p style="padding-left: 30px;">Install php5_openssl. I`m not sure about all of the distributions I did it only on OpenSuse:</p>
<p style="padding-left: 30px;"><em>zypper install php5_openssl</em></p>
<p style="padding-left: 30px;">I`m guessing that on CentOS it would be something like</p>
<p style="padding-left: 30px;"><em>yum install php5_openssl</em></p>
<p style="padding-left: 30px;"><em></em>And Ubuntu</p>
<p style="padding-left: 30px;"><em>apt-get install php5_openssl</em></p>
<p style="padding-left: 30px;"><span style="text-decoration: underline;">Windows</span>:</p>
<p style="padding-left: 30px;">Add<strong> <em>extension=php_openssl.dll</em></strong> to your <em>php.ini</em></p>
<p> After finishing it, please restart your apache<em>.</em></p>
<p>&nbsp;</p>
<p>Now check if the SSL module is installed:</p>
<p><em>php -m | grep ssl</em></p>
<p>will output:</p>
<p><em>openssl</em></p>
<p>Or try to check your <em>phpinfo</em>.</p>
<p>&nbsp;</p>
<p>Now you can use my code as an example:</p>
<h3><em>application.ini</em></h3>
<pre class="brush: php; gutter: true; first-line: 1">email.host 			= &#039;smtp.gmail.com&#039;
email.from		 	= &#039;info@yourdomain.com&#039;
email.name 			= &#039;Display Name&#039;
email.params.auth		= &#039;login&#039;
email.params.username 		= &#039;info@yourdomain.com&#039;
email.params.password 		= &#039;Password&#039;
email.params.ssl 		= &#039;ssl&#039;
email.params.port 		= 465

helper.perfix[] = &#039;My_Helper&#039;;</pre>
<h3><em>Bootstrap.php</em></h3>
<pre class="brush: php; gutter: true; first-line: 1">class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
    protected  function _initConfig(){
    	 $config = new Zend_Config_Ini(
            APPLICATION_PATH . &#039;/configs/application.ini&#039;,
            APPLICATION_ENV
        );
        Zend_Registry::set(&#039;appConfig&#039;,$config);
    }
    protected function _initHelpers(){
    	 $perfix = Zend_Registry::get(&#039;appConfig&#039;)-&gt;helper-&gt;perfix-&gt;toArray();
    	 Zend_Controller_Action_HelperBroker::addPrefix($perfix[0]);
    }
}</pre>
<h3><em>IndexController.php</em></h3>
<pre class="brush: php; gutter: true; first-line: 1">class IndexController {
 	public function indexAction(){
		$helper = $this-&gt;_helper-&gt;mail(array(
				 			&#039;email&#039;		=&gt; &#039;myemail@gmail.com&#039;,
				 			&#039;subject&#039; 	=&gt; &#039;test subject&#039;,
				 			&#039;message&#039;	=&gt; &#039;just a test message&#039;
				 		));
		var_dump($helper);die;
	}
}</pre>
<h3><em>Mailer.php (helper)</em></h3>
<pre class="brush: php; gutter: true; first-line: 1">class My_Helper_Mail extends Zend_Controller_Action_Helper_Abstract {
	/**
	 * @var array email has to contain those values
	 */
	private static $_keys = array(&#039;email&#039;,&#039;subject&#039;,&#039;message&#039;);
	/**
	 * @var Zend_Mail
	 */
	private $_mail;

	const MAIL_BODY_CHARSET 	= &#039;utf8&#039;;
	const VALIDATION_DATA_ERROR = &#039;Email error, key %s is required and cannot be empty.&#039;;

	/**
	 * Execute everything, enables our class to work as helper ($this-&gt;_helper-&gt;mail(array()))
	 * @params array $data (Should contain self::$_keys)
	 * @return Zend_Mail
	 */
	public function direct(array $data){
		//validate keys and values
		self::_checkData($data);

		//prepare
		$this-&gt;_prepare($data);

		return $this-&gt;_send(self::_createTransportSmtp());
	}

	/**
	 * Validate data before send
	 * @param array $data
	 * @throws My_Helper_Mail_Exception
	 */
	private static function _checkData(array $data){
		foreach(self::$_keys as $value){
			if (empty($data[$value])){
				throw new My_Helper_Mail_Exception(sprintf(
					self::VALIDATION_DATA_ERROR,
					$value
				));
			}
		}
	}

	/**
	 * Prepre mail data
	 * @param array $data
	 */
	private function _prepare(array $data){
		$oAppConfig = Zend_Registry::get(&#039;appConfig&#039;)-&gt;email;

		$this-&gt;_mail = new Zend_Mail();
		$this-&gt;_mail-&gt;addTo($data[&#039;email&#039;]);
		$this-&gt;_mail-&gt;setSubject($data[&#039;subject&#039;]);
		$this-&gt;_mail-&gt;setBodyHtml($data[&#039;message&#039;],self::MAIL_BODY_CHARSET);
		$this-&gt;_mail-&gt;setFrom($oAppConfig-&gt;from,$oAppConfig-&gt;name);
	}

	/**
	 * Setup mail settings
	 * @return Zend_Mail_Transport_Smtp
	 */
	private static function _createTransportSmtp(){
		$config = Zend_Registry::get(&#039;appConfig&#039;); 

		$host  	= $config-&gt;email-&gt;host;
		$params	= $config-&gt;email-&gt;params;

		return new Zend_Mail_Transport_Smtp($host,$params-&gt;toArray());
	}

	/**
	 * Send mail
	 * @param Zend_Mail_Transport_Smtp $transport
	 * @return Zend_Mail
	 */
	private function _send(Zend_Mail_Transport_Smtp $transport){
		return $this-&gt;_mail-&gt;send($transport);
	}
}
class My_Helper_Mail_Exception extends Zend_Exception {}</pre>
<div style="font-size: 20px;">Or you may download the files <a title="Zend Framework Mail Helper" href="http://db.tt/R15OkDdR" target="_blank">Here</a></div>
<h2>Summary</h2>
<p>Using Zend Framework is pretty straight-forward when you have all of your server settings enabled.</p>
<p>You are more then welcome to update me if you would found any other solution or a problem.</p>
<p>&nbsp;</p>
<p>-Shak</p>
<div class="al2fb_like_button"><div id="fb-root"></div><script type="text/javascript">
(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=188624057851679";
  fjs.parentNode.insertBefore(js, fjs);
}(document, "script", "facebook-jssdk"));
</script>
<fb:like href="http://www.shakedos.com/zend-framework-gmail-smtp-and-ssl/" layout="standard" show_faces="true" width="450" action="like" font="verdana" colorscheme="light" ref="AL2FB"></fb:like></div>]]></content:encoded>
			<wfw:commentRss>http://www.shakedos.com/zend-framework-gmail-smtp-and-ssl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress &#8211; avoiding wpautop method</title>
		<link>http://www.shakedos.com/wordpress-avoiding-wpautop-method/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wordpress-avoiding-wpautop-method</link>
		<comments>http://www.shakedos.com/wordpress-avoiding-wpautop-method/#comments</comments>
		<pubDate>Sun, 08 Jan 2012 09:11:16 +0000</pubDate>
		<dc:creator>Shaked</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[auto p]]></category>
		<category><![CDATA[automatic p tags]]></category>
		<category><![CDATA[remove p tag]]></category>
		<category><![CDATA[remove p tags]]></category>
		<category><![CDATA[wordpress p tag]]></category>
		<category><![CDATA[wpautop]]></category>

		<guid isPermaLink="false">http://www.shakedos.com/?p=417</guid>
		<description><![CDATA[Long time ha? So I`m working on a WordPress plugin for a while, and I found some common issues with plugins that need to be integrated with WordPress's posts. One of the main issues is the wpautop method. Description From WordPress's website: Changes double line-breaks in the text into HTML paragraphs (&#60;p&#62;...&#60;/p&#62;). WordPress uses it to [...]]]></description>
			<content:encoded><![CDATA[<p>Long time ha?</p>
<p>So I`m working on a <a title="Wordpress's website" href="http://www.wordpress.org" target="_blank">WordPress</a> plugin for a while, and I found some common issues with plugins that need to be integrated with WordPress's posts.</p>
<p>One of the main issues is the <em><a title="Codex - Function Reference/wpautop" href="http://codex.wordpress.org/Function_Reference/wpautop" target="_blank">wpautop</a></em> method.</p>
<h2>Description</h2>
<p>From WordPress's website:</p>
<blockquote><p>Changes double line-breaks in the text into HTML paragraphs (<tt>&lt;p&gt;...&lt;/p&gt;</tt>).</p>
<p>WordPress uses it to filter <a title="Template Tags/the content" href="http://codex.wordpress.org/Template_Tags/the_content">the content</a> and <a title="Template Tags/the excerpt" href="http://codex.wordpress.org/Template_Tags/the_excerpt">the excerpt</a>.</p></blockquote>
<p>Now lets dig a bit more inside ha?</p>
<pre class="brush: php; gutter: true; first-line: 1">function wpautop($pee, $br = 1) {
        if ( trim($pee) === &#039;&#039; )
                return &#039;&#039;;
        $pee = $pee . &quot;\n&quot;; // just to make things a little easier, pad the end
        $pee = preg_replace(&#039;|&lt;br /&gt;\s*&lt;br /&gt;|&#039;, &quot;\n\n&quot;, $pee);
        // Space things out a little
        $allblocks = &#039;(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|option|form|map|area|blockquote|address|math|style|input|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)&#039;;
        $pee = preg_replace(&#039;!(&lt;&#039; . $allblocks . &#039;[^&gt;]*&gt;)!&#039;, &quot;\n$1&quot;, $pee);
        $pee = preg_replace(&#039;!(&lt;/&#039; . $allblocks . &#039;&gt;)!&#039;, &quot;$1\n\n&quot;, $pee);
        $pee = str_replace(array(&quot;\r\n&quot;, &quot;\r&quot;), &quot;\n&quot;, $pee); // cross-platform newlines
        if ( strpos($pee, &#039;&lt;object&#039;) !== false ) {
                $pee = preg_replace(&#039;|\s*&lt;param([^&gt;]*)&gt;\s*|&#039;, &quot;&lt;param$1&gt;&quot;, $pee); // no pee inside object/embed
                $pee = preg_replace(&#039;|\s*&lt;/embed&gt;\s*|&#039;, &#039;&lt;/embed&gt;&#039;, $pee);
        }
        $pee = preg_replace(&quot;/\n\n+/&quot;, &quot;\n\n&quot;, $pee); // take care of duplicates
        // make paragraphs, including one at the end
        $pees = preg_split(&#039;/\n\s*\n/&#039;, $pee, -1, PREG_SPLIT_NO_EMPTY);
        $pee = &#039;&#039;;
        foreach ( $pees as $tinkle )
                $pee .= &#039;&lt;p&gt;&#039; . trim($tinkle, &quot;\n&quot;) . &quot;&lt;/p&gt;\n&quot;;
        $pee = preg_replace(&#039;|&lt;p&gt;\s*&lt;/p&gt;|&#039;, &#039;&#039;, $pee); // under certain strange conditions it could create a P of entirely whitespace
        $pee = preg_replace(&#039;!&lt;p&gt;([^&lt;]+)&lt;/(div|address|form)&gt;!&#039;, &quot;&lt;p&gt;$1&lt;/p&gt;&lt;/$2&gt;&quot;, $pee);
        $pee = preg_replace(&#039;!&lt;p&gt;\s*(&lt;/?&#039; . $allblocks . &#039;[^&gt;]*&gt;)\s*&lt;/p&gt;!&#039;, &quot;$1&quot;, $pee); // don&#039;t pee all over a tag
        $pee = preg_replace(&quot;|&lt;p&gt;(&lt;li.+?)&lt;/p&gt;|&quot;, &quot;$1&quot;, $pee); // problem with nested lists
        $pee = preg_replace(&#039;|&lt;p&gt;&lt;blockquote([^&gt;]*)&gt;|i&#039;, &quot;&lt;blockquote$1&gt;&lt;p&gt;&quot;, $pee);
        $pee = str_replace(&#039;&lt;/blockquote&gt;&lt;/p&gt;&#039;, &#039;&lt;/p&gt;&lt;/blockquote&gt;&#039;, $pee);
        $pee = preg_replace(&#039;!&lt;p&gt;\s*(&lt;/?&#039; . $allblocks . &#039;[^&gt;]*&gt;)!&#039;, &quot;$1&quot;, $pee);
        $pee = preg_replace(&#039;!(&lt;/?&#039; . $allblocks . &#039;[^&gt;]*&gt;)\s*&lt;/p&gt;!&#039;, &quot;$1&quot;, $pee);
        if ($br) {
                $pee = preg_replace_callback(&#039;/&lt;(script|style).*?&lt;\/\\1&gt;/s&#039;, &#039;_autop_newline_preservation_helper&#039;, $pee);
                $pee = preg_replace(&#039;|(?&lt;!&lt;br /&gt;)\s*\n|&#039;, &quot;&lt;br /&gt;\n&quot;, $pee); // optionally make line breaks
                $pee = str_replace(&#039;&lt;WPPreserveNewline /&gt;&#039;, &quot;\n&quot;, $pee);
        }
        $pee = preg_replace(&#039;!(&lt;/?&#039; . $allblocks . &#039;[^&gt;]*&gt;)\s*&lt;br /&gt;!&#039;, &quot;$1&quot;, $pee);
        $pee = preg_replace(&#039;!&lt;br /&gt;(\s*&lt;/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^&gt;]*&gt;)!&#039;, &#039;$1&#039;, $pee);
        if (strpos($pee, &#039;&lt;pre&#039;) !== false)
                $pee = preg_replace_callback(&#039;!(&lt;pre[^&gt;]*&gt;)(.*?)&lt;/pre&gt;!is&#039;, &#039;clean_pre&#039;, $pee );
        $pee = preg_replace( &quot;|\n&lt;/p&gt;$|&quot;, &#039;&lt;/p&gt;&#039;, $pee );
        return $pee;
}</pre>
<p>You may find more at <a href="http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/formatting.php">http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/formatting.php</a></p>
<p>As you can see, this function changes a lot of things in WordPress's posts, such as:</p>
<ul>
<li>Adding \n after (almost) each HTML tag</li>
<li>Fixing new lines to cross platform newlines (\r\n to \n)</li>
<li>Changing the &lt;object&gt; tag</li>
<li><strong>Adding &lt;p&gt; tags</strong>.</li>
<li>Cleaning empty &lt;pre&gt; tags</li>
</ul>
<p>So I marked the most important issue about this function "Adding &lt;p&gt; tags".</p>
<h4>Why is it so important for me?</h4>
<p>As I wrote before it seems that one of the biggest problems for developers that develop WordPress plugins is the <em>wpautop</em> plugin. When they are trying to modify the user's posts, they always need to struggle with the &lt;p&gt; tags and sometimes they don't know how to handle them right.</p>
<h2>Suggestions...</h2>
<p><span id="more-417"></span></p>
<h3>What to do</h3>
<p>If I remember correctly , <em>wpautop</em> priority is set to 11 by default.</p>
<p>I have split my solution into 4 steps:</p>
<ol>
<li>Mark your posts with your own "signature"</li>
<li>Create your own HTML template and don't use &lt;p&gt; tags</li>
<li>Changing <em>the_posts</em></li>
<li>Removing the &lt;p&gt; tags from my plugin's HTML</li>
</ol>
<h5>How?</h5>
<h5>Marking your posts:</h5>
<p>Include special statement inside <em>post_content</em>, for example when adding new post you may add a text "my-plugin-text-needs-to-be-manipulated", so the user's post will look like:</p>
<blockquote><p>This is a new post</p>
<p>my-plugin-text-needs-to-be-manipulated</p>
<p>Thank you all!</p></blockquote>
<h5>Changing the posts:</h5>
<p><a href="http://pastebin.com/w58WqjHP">http://pastebin.com/w58WqjHP</a></p>
<pre class="brush: php; gutter: true; first-line: 1">/**
 * Require more work but does the job.
*/
class Posts {
	const CATCH_POST_PRIORITY = -32767;
	const TEXT_TO_CHANGE = &#039;my-plugin-text-needs-to-be-manipulated&#039;;
	/*
	 * Manipulate our plugin&#039;s text\data
	 * @param array $posts
	 * @return array
	 */
	public function manipulate($posts){
		$newPosts = array();
		foreach ($posts AS $post) {
			if (false === strpos($post-&gt;post_content,self::TEXT_TO_CHANGE)
				 || !self::IsPreviewMode($post-&gt;ID)){
				$newPosts[] = $post
				continue ;
			}

			//remove new lines
			//TODO: extract your data to your HTML (real plugin uses a View object and render&#039;s the data)
			$html = str_replace(&quot;\n&quot;,&quot;&quot;,file_get_content(&quot;some.html&quot;));
			//assign back to post content
			$post-&gt;post_content = str_replace(self::TEXT_TO_CHANGE,$html,$post-&gt;post_content);
			$newPosts[] = $post;
		}
		return $newPosts;
	}

	/**
	 * Check if we are in preview mode of current post id
	 * @param int $postID
	 * @return bool
	*/
	private static function IsPreviewMode($postID){
 		return isset($_GET[&#039;preview&#039;]) &amp;&amp; isset($_GET[&#039;p&#039;]) &amp;&amp; $_GET[&#039;p&#039;] != $postID;
	}
}

$posts = new Posts;
add_action(&#039;the_posts&#039; , array($posts, &#039;manipulate&#039;), Posts::CATCH_POST_PRIORITY);</pre>
<h5>Removing the &lt;p&gt; tags</h5>
<p><a href="http://pastebin.com/afk9SJNk">http://pastebin.com/afk9SJNk</a></p>
<pre class="brush: php; gutter: true; first-line: 1">/**
 * DOM Handler
*/
class Extended_DOMDocument extends DOMDocument {
	/**
	 * @var DOMElement $pluginStauts
	*/
	private $pluginStatus = false; 

	const CONTAINER = &quot;our_plugins_class_wrapper&quot;;
	const UTF8_META = &#039;&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;&#039;; 

	public function __construct($post){
		parent::__construct(&quot;1.0&quot;, &quot;UTF-8&quot;);
		if (!@$this-&gt;loadHTML(self::UTF8_META.$post)){
			return ;
		}
		$this-&gt;isPluginInvolved();
	}

	private function isPluginInvolved(){
		$this-&gt;pluginStatus = $this-&gt;getElementByClassName(self::CONTAINER);
	}	

	/**
 	 * Remove p tags
	 * @return string
	 */
	public function removeWpAutoP(){
		$content = $this-&gt;saveHTML();
		if (!$this-&gt;pluginStatus){
			return $content;
		}
		$html = self::DOMinnerHTML($this-&gt;pluginStatus);
		return str_replace($html,preg_replace(&#039;#&lt;p&gt;(.*?)&lt;\/p&gt;#&#039;,&#039;$1&#039;,$html),$content);
	}

	/**
	 * @see http://stackoverflow.com/questions/5404941/php-domdocument-outerhtml-for-element
	 */
	public static function DOMinnerHTML($n, $outer=true) {
	    $d = new DOMDocument(&#039;1.0&#039;);
	    $b = $d-&gt;importNode($n-&gt;cloneNode(true),true);
	    $d-&gt;appendChild($b); $h = $d-&gt;saveHTML();
	    // remove outter tags
	    if (!$outer) $h = substr($h,strpos($h,&#039;&gt;&#039;)+1,-(strlen($n-&gt;nodeName)+4));
	    return $h;
	}

	/**
	* Get all elements that have a tag of $tag and class of $className
	*
	* @param string $className The class name to search for
	* @param string $tag       Tag of the items to search
	* @return array            Array of DOMNode items that match
	*/
	public function getElementsByClassName($className, $tag=&quot;*&quot;) {
		$nodes = array();
		$domNodeList = $this-&gt;getElementsByTagName($tag);
		for ($i = 0; $i &lt; $domNodeList-&gt;length; $i++) {
			$item = $domNodeList-&gt;item($i)-&gt;attributes-&gt;getNamedItem(&#039;class&#039;);
			if ($item) {
				$classes = explode(&quot; &quot;, $item-&gt;nodeValue);
				for ($j = 0; $j &lt; count($classes); $j++) {
					if ($classes[$j] == $className) {
						$nodes[] = $domNodeList-&gt;item($i);
					}
				}
			}
		}
		return $nodes;
	}

	/**
	 * Convenience method to return a single element by class name when we know there&#039;s only going to be one
	 *
	 * @param string $className The class name to search for
	 * @param string $tag       Tag of the items to search
	 * @return array            Array of DOMNode items that match
	 */
	public function getElementByClassName($className, $tag=&quot;*&quot;) {
		$nodes = $this-&gt;getElementsByClassName($className, $tag);
		return count($nodes) == 1 ? $nodes[0] : $nodes;
	}
}

// setting this filter to priority 12
add_filter(&#039;the_content&#039; , array(&#039;removeWpAutoP&#039;), 12);
/**
 * remove auto wp p tags
 * @param string $content
 * @return string
 */
function rm_wpautop($content) {
	$dom = new Extended_DOMDocument($content);
	$content = $dom-&gt;removeWpAutoP();
	return $content;
}</pre>
<h3>What not to do</h3>
<p>It's pretty easy -don't remove the filter.</p>
<h4>Why?</h4>
<p>Because removing the filter most of the time creates bugs and problems with other posts and plugins. For example, when disabling the function you would notice that sometimes the post won't have any newlines at all.</p>
<h2>Summarize</h2>
<p>Using WordPress's <em>wpautop</em> making our life very hard. As I see it, WordPress should give their developers more freedom while writing their plugins.<br />
This might not be the most useful way to write this fix, but then you may ask if its useful to use WordPress <img src='http://www.shakedos.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Some of the functions were found on Google or in different websites, I didn't write them all although I did write the "logic". I have tried to keep my sources written in the code's comments (such as <a title="Stackoverflow" href="http://www.stackoverflow.com" target="_blank">stackoverflow</a>), so if you would find something that belongs to you, please contact me to add your name or remove the script.</p>
<p>Hope this guide will help other as it helped me.</p>
<p>-Shak</p>
<div class="al2fb_like_button"><div id="fb-root"></div><script type="text/javascript">
(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=188624057851679";
  fjs.parentNode.insertBefore(js, fjs);
}(document, "script", "facebook-jssdk"));
</script>
<fb:like href="http://www.shakedos.com/wordpress-avoiding-wpautop-method/" layout="standard" show_faces="true" width="450" action="like" font="verdana" colorscheme="light" ref="AL2FB"></fb:like></div>]]></content:encoded>
			<wfw:commentRss>http://www.shakedos.com/wordpress-avoiding-wpautop-method/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Managing zip files with ZipArchive</title>
		<link>http://www.shakedos.com/php-managing-zip-files-with-ziparchive/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-managing-zip-files-with-ziparchive</link>
		<comments>http://www.shakedos.com/php-managing-zip-files-with-ziparchive/#comments</comments>
		<pubDate>Sun, 18 Dec 2011 01:17:44 +0000</pubDate>
		<dc:creator>Shaked</dc:creator>
				<category><![CDATA[OpenSuse]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[pear zip]]></category>
		<category><![CDATA[pecl zip]]></category>
		<category><![CDATA[php zip]]></category>
		<category><![CDATA[ZipArchive]]></category>

		<guid isPermaLink="false">http://www.shakedos.com/?p=396</guid>
		<description><![CDATA[Requirements PHP 5.2 or greater (would be a bit sad to know that someone is still using PHP 4)  Upgrade PEAR to latest version  Upgrade PECL to latest version  Installing PHP ZipArchive library by using PECL's zip package Installation  I will use pecl to install ZipArchive PHP library. Open terminal and execute pecl install zip Updating your php.ini: Linux: [...]]]></description>
			<content:encoded><![CDATA[<h2><span style="text-decoration: underline;">Requirements</span></h2>
<ol>
<li><span style="font-size: medium;"><a title="php.net website " href="http://www.php.net" target="_blank">PHP 5.2</a> or greater (would be a bit sad to know that someone is still using PHP 4) </span></li>
<li><span style="font-size: medium;">Upgrade <a title="PHP - PEAR" href="http://pear.php.net" target="_blank">PEAR</a> to latest version </span></li>
<li><span style="font-size: medium;">Upgrade <a title="PHP - PECL" href="http://pecl.php.net" target="_blank">PECL</a> to latest version </span></li>
<li><span style="font-size: medium;">Installing <a title="PHP ZipArchive library" href="http://www.php.net/manual/en/class.ziparchive.php" target="_blank">PHP ZipArchive</a> library by using <a title="PECL Zip Package" href="http://pecl.php.net/package/zip" target="_blank">PECL's zip package</a></span></li>
</ol>
<h2><span style="text-decoration: underline;">Installation</span> </h2>
<p><span style="font-size: medium;">I will use <em>pecl </em>to install <em>ZipArchive PHP</em> library.</span></p>
<ol>
<li><span style="font-size: medium;">Open terminal and execute <em>pecl install zip</em></span></li>
<li><span style="font-size: medium;">Updating your <em>php.ini</em>:</span></li>
<ol>
<li><span style="font-size: medium;">Linux: <a title="Find your php.ini file" href="http://www.shakedos.com/archives/402" target="_blank">find your php.ini file</a> and add "<em>extension=zip.so"</em></span></li>
<li><span style="font-size: medium;">Windows: same as one, just add "<em>extension=zip.dll</em>" </span></li>
</ol>
<li><span style="font-size: medium;">Restart httpd\apache </span></li>
<ol>
<li><span style="font-size: medium;"><em>service httpd restart</em></span></li>
<li><span style="font-size: medium;"><em>apache2ctl restart</em></span></li>
<li><span style="font-size: medium;">or any other way that you like</span></li>
</ol>
</ol>
<h2><span style="text-decoration: underline;">Usage Example</span></h2>
<p><span style="font-size: medium;">There are many different ways to use and build Zip helpers. I will just demonstrate an example for using ZipArchive. </span></p>
<p><span style="font-size: medium;"> Pastebin: <a href="http://pastebin.com/J2M0jjQG">http://pastebin.com/J2M0jjQG</a></span></p>
<p><span style="font-size: medium;"> Inline... </span></p>
<p><span id="more-396"></span></p>
<pre class="brush: php; gutter: true; first-line: 1">/**
 * ZipArchiveHelper class
*/
class ZipArchiveHelper {
	/**
	 * @var ZipArchive $_zipArchive
	*/
	private $_zipArchive;
	/**
	 * @var array $_excludeList
	*/
	private $_excludeList;

	const TIMEOUT = 5000; 

	/**
	 * Get files list by path
	 * @param string $sourcePath
	 * @return RecursiveIteratorIterator
	*/
	private function _getFilesList($sourcePath){
		$dirlist = new RecursiveDirectoryIterator($sourcePath);
		$filelist = new RecursiveIteratorIterator($dirlist);

		return $filelist;
	}

	/**
	 * Create Zip File
	 * @param string $zipFileName
	 * @param string $sourcePath
	 * @param array[optional] $excludeList
	 * @return string|false
	*/
	public function createZipFile($zipFileName,$sourcePath,array $excludeList = array()){
			//Set PHP timeout
			ini_set(&#039;max_execution_time&#039;, self::TIMEOUT);

			//set exclude list
			$this-----&gt;_excludeList = $excludeList; 

			//set new zip archive object
			$this-&gt;_setZipArchive(); 

			//generate new file
			$this-&gt;_newZipFile($zipFileName); 

			//compress
			$this-&gt;_compress($sourcePath); 

			//get status
			$retValue = $this-&gt;_zipArchive-&gt;getStatusString(); 

			//close zip archive manager
			$this-&gt;_zipArchive-&gt;close();

			return $retValue;
	}

	/**
	 * Set new ZipArchive instance
	 * Seperated and protected for future unit tests
	 * @return void
	*/
	protected function _setZipArchive(){
		$this-&gt;_zipArchive = new ZipArchive;
	}

	/**
	 * Open new|existing zip file
	 * @param int $type - 	Overwrite by default. (you may use other options, e.g ZipArchive::CREATE)
	 * @throw Exception
	 * @return void
	*/
	protected function _newZipFile($zipFileName,$type=ZipArchive::OVERWRITE){
		if ($this-&gt;_zipArchive-&gt;open(&quot;$zipFileName&quot;, $type) !== TRUE) {
				throw new Exception(&quot;Could not open archive&quot;);
		}
	}

	/**
	 * Validate file by checking if exists and not excluded type
	 * @param string $fileName
	 * @return bool
	*/
	private function _isValidFile($fileName){
		if (!is_file($fileName)){
			return false ;
		} 

		foreach($this-&gt;_excludeList as $toExclude){
			if (strpos($fileName,$toExclude) !== false){
				return false;
			}
		}	

		return true;
	}

	/**
	 * Compress to ZIP file
	 * @return bool
	*/
	private function _compress($sourcePath){
		//get file list
		$filelist = $this-&gt;_getFilesList($sourcePath); 

		//add files to new zip file
		foreach ($filelist as $fileName=&gt;$value) {
			if(!$this-&gt;_isValidFile($fileName)){
				continue ;
			}

			//you should use sprintf for this to work on both *NIX and Windows OS
			//note that str_replace is just for my example, you don&#039;t really have to use it.
			$value = sprintf(&quot;%s&quot;,str_replace($sourcePath,&#039;&#039;,$value));

			if (!$this-&gt;_zipArchive-&gt;addFile($fileName,$value)){
				 throw new Exception(&quot;ERROR: Could not add file: $fileName&quot;);
			}
		}

		return true;
	}
}
//PHP &gt;= 5.3 just throws this annoying warning
date_default_timezone_set(&#039;Asia/Jerusalem&#039;);

$zipHelper = new ZipArchiveHelper();
try {
	var_dump($zipHelper-&gt;createZipFile(
		&#039;shakedos.zip&#039;,
		&#039;/tmp/zend_debug&#039;,
		array(&#039;.svn&#039;)
	));
} catch (Exception $e){
	var_dump($e-&gt;getMessage());
}
</pre>
<h2><span style="text-decoration: underline;">Known Issues</span></h2>
<ol>
<li><span style="font-size: medium;">Did you define your PHP extension directory correct ? </span></li>
<li><span style="font-size: medium;">Windows and *NIX system works different by using the opposite slash  "/"(*NIX) or "\"(Windows) - my solution is to use <em>sprintf()</em> </span><br /><span style="font-size: medium;"> <a href="http://stackoverflow.com/questions/4620205/php-ziparchive-corrupt-in-windows">http://stackoverflow.com/questions/4620205/php-ziparchive-corrupt-in-windows</a></span></li>
<li><span style="font-size: medium;">Downloading the script sometimes requires to send some different header, the following example was taken from the <a title="Stackoverflow" href="http://stackoverflow.com" target="_blank">stackoverflow</a> link above:</span></li>
</ol>
<div><span style="font-size: small;"><br /></span></div>
<pre class="brush: bash; gutter: true; first-line: 1">header(&quot;Cache-Control: public&quot;);
header(&quot;Pragma: public&quot;);
header(&quot;Expires: 0&quot;);
header(&quot;Cache-Control: must-revalidate, post-check=0, pre-check=0&quot;);
header(&quot;Cache-Control: public&quot;);
//header(&quot;Content-Description: File Transfer&quot;);
//header(&quot;Content-type: application/zip&quot;);
header(&quot;Content-Disposition: attachment; filename=\&quot;YOUR_FILE_NAME_HERE.zip\&quot;&quot;);
//header(&quot;Content-Transfer-Encoding: binary&quot;);
header(&quot;Content-length: &quot; . filesize($filename));
</pre>
<p>&nbsp;</p>
<p><span style="font-size: small;">Hope I helped, </span></p>
<div class="al2fb_like_button"><div id="fb-root"></div><script type="text/javascript">
(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=188624057851679";
  fjs.parentNode.insertBefore(js, fjs);
}(document, "script", "facebook-jssdk"));
</script>
<fb:like href="http://www.shakedos.com/php-managing-zip-files-with-ziparchive/" layout="standard" show_faces="true" width="450" action="like" font="verdana" colorscheme="light" ref="AL2FB"></fb:like></div>]]></content:encoded>
			<wfw:commentRss>http://www.shakedos.com/php-managing-zip-files-with-ziparchive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to find your php.ini file</title>
		<link>http://www.shakedos.com/how-to-find-your-php-ini-file/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-find-your-php-ini-file</link>
		<comments>http://www.shakedos.com/how-to-find-your-php-ini-file/#comments</comments>
		<pubDate>Sun, 18 Dec 2011 00:15:03 +0000</pubDate>
		<dc:creator>Shaked</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[edit php.ini]]></category>
		<category><![CDATA[find php.ini]]></category>
		<category><![CDATA[php.ini]]></category>

		<guid isPermaLink="false">http://www.shakedos.com/?p=402</guid>
		<description><![CDATA[Finding your php.ini is pretty straight forward task:  open terminal or cmd  execute php --ini if php is undefined you should add it to your PATH or just execute "/your/path/to/php --ini" php.ini has several modes (path is different sometimes...): using one file:  Configuration File (php.ini) Path: /etc/php5/cliLoaded Configuration File: /etc/php5/cli/php.ini using several different files (will help to maintain [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-size: medium; font-family: verdana, geneva;">Finding your <em>php.ini</em> is pretty straight forward task: </span></p>
<ol>
<li><span style="font-size: medium; font-family: verdana, geneva;">open terminal or cmd </span></li>
<li><span style="font-size: medium; font-family: verdana, geneva;">execute <em>php --ini</em> if <em>php</em> is undefined you should add it to your PATH or just execute "<em>/your/path/to/php --ini"</em></span></li>
<li><span style="font-size: medium; font-family: verdana, geneva;"><em>php.ini </em>has several modes (path is different sometimes...):</span></li>
<ol>
<li><span style="font-size: medium; font-family: verdana, geneva;">using one file: </span>
<p><span style="font-size: medium; font-family: verdana, geneva;">Configuration File (php.ini) Path: /etc/php5/cli</span><br /><span style="font-size: medium; font-family: verdana, geneva;">Loaded Configuration File: /etc/php5/cli/php.ini</span></p>
</li>
<li><span style="font-size: medium; font-family: verdana, geneva;">using several different files (will help to maintain common settings between <em>cli php</em><em>.ini</em> and <em>httpd</em> <em>php.ini</em></span>
<p><span style="font-size: medium; font-family: verdana, geneva;">Scan for additional .ini files in: /etc/php5/conf.d</span><br /><span style="font-size: medium; font-family: verdana, geneva;">Additional .ini files parsed: /etc/php5/conf.d/ctype.ini,</span><br /><span style="font-size: medium; font-family: verdana, geneva;">/etc/php5/conf.d/curl.ini, </span><br /><span style="font-size: medium; font-family: verdana, geneva;">/etc/php5/conf.d/dom.ini,</span><br /><span style="font-size: medium; font-family: verdana, geneva;">/etc/php5/conf.d/gd.ini,</span><br /><span style="font-size: medium; font-family: verdana, geneva;">/etc/php5/conf.d/hash.ini,</span><br /><span style="font-size: medium; font-family: verdana, geneva;">............more .ini files here............  </span></p>
<p><span style="font-size: medium; font-family: verdana, geneva;">files content could be "<em>extension=gd.so" (unix) </em>or "<em>extension=gd.dll</em>" (<em>windows</em>)</span></li>
</ol>
<li><span style="font-size: medium; font-family: verdana, geneva;">there are two more options to get your <em>ini</em> files: </span></li>
<ol>
<li><span style="font-size: medium; font-family: verdana, geneva;">execute in cli mode: "<em>php --i | grep .ini</em>"</span></li>
<li><span style="font-size: medium; font-family: verdana, geneva;">write your own script and check via browser:</span><br /><span style="font-size: medium; font-family: verdana, geneva;"><em>&lt;?php phpinfo(); ?&gt; </em> </span></li>
</ol>
</ol>
<p><span style="font-size: medium;"><span style="font-family: verdana, geneva;">That's it, now you can just edit your </span><em style="font-family: verdana, geneva;">php.ini</em><span style="font-family: verdana, geneva;"> with anything you think you will need for future PHP programming. </span><br /><span style="font-family: verdana, geneva;">More about </span><em><span style="font-family: verdana, geneva;">php.ini</span></em> may be found at <a href="http://php.net/manual/en/ini.php">http://php.net/manual/en/ini.php</a><em><span style="font-family: verdana, geneva;"> </span></em></span></p>
<div class="al2fb_like_button"><div id="fb-root"></div><script type="text/javascript">
(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=188624057851679";
  fjs.parentNode.insertBefore(js, fjs);
}(document, "script", "facebook-jssdk"));
</script>
<fb:like href="http://www.shakedos.com/how-to-find-your-php-ini-file/" layout="standard" show_faces="true" width="450" action="like" font="verdana" colorscheme="light" ref="AL2FB"></fb:like></div>]]></content:encoded>
			<wfw:commentRss>http://www.shakedos.com/how-to-find-your-php-ini-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL Split String Function Fix (split_str)</title>
		<link>http://www.shakedos.com/mysql-split-string-function-fix-split_str/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mysql-split-string-function-fix-split_str</link>
		<comments>http://www.shakedos.com/mysql-split-string-function-fix-split_str/#comments</comments>
		<pubDate>Wed, 23 Nov 2011 23:20:57 +0000</pubDate>
		<dc:creator>Shaked</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[MySQL Split String]]></category>
		<category><![CDATA[MySQL split utf8]]></category>
		<category><![CDATA[split string]]></category>
		<category><![CDATA[split_str]]></category>

		<guid isPermaLink="false">http://www.shakedos.com/?p=367</guid>
		<description><![CDATA[While working on one my projects, I was needed to use split_str function in MySQL. I Googled for it and found two answers (which are exactly the same - one is leading to the other):  Federico Cargnelutti - MySQL Split String Function Stackoverflow - MYSQL - Array data type, split string Everything worked great while [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-family: verdana, geneva; font-size: medium;">While working on one my projects, I was needed to use split_str function in MySQL. I Googled for it and found two answers (which are exactly the same - one is leading to the other): </span></p>
<p><span style="font-family: verdana, geneva; font-size: medium;"><a title="Federico Cargnelutti - MySQL Split String Function" href="http://blog.fedecarg.com/2009/02/22/mysql-split-string-function/" target="_blank">Federico Cargnelutti - MySQL Split String Function</a></span><br/><br/><br />
<span style="font-family: verdana, geneva; font-size: medium;"><a title="Stackoverflow - MYSQL - Array data type, split string" href="http://stackoverflow.com/questions/4078838/mysql-array-data-type-split-string" target="_blank">Stackoverflow - MYSQL - Array data type, split string</a></span><br/></p>
<pre><span style="font-family: verdana, geneva; font-size: medium;">Everything worked great while using different delimiters, such as: "," , "||", "@@@", "###" or any other delimiter. I was using delimiters which their length > 1, exmaple: </span></pre>
<pre class="brush: sql; gutter: true; first-line: 1">
select split_str(‘ABC,,BA,,abc’,',,’,3);
//result: “abc”
</pre>
<p><span style="font-size: medium; font-family: verdana, geneva;">Seems good, ha? But then I`v noticed that there is a problem. When my full string contains two bytes characters (e.g: ¼), everything is breaking a part. Lets see the following exmaple:</span></p>
<pre class="brush: sql; gutter: true; first-line: 1">
select split_str(‘ABC¼,,BA,,abc’,',,’,3);
//result: “,abc” (delimiter was still there)
</pre>
<p><span style="font-size: medium; font-family: verdana, geneva;">So how do we fix it?  Seems that we need to change split_str function, all we have to do is to use <a title="MySQL CHAR_LENGHT()" href="http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_char-length" target="_blank">CHAR_LENGTH</a>() and not <a title="MySQL LENGTH()" href="http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_length" target="_blank">LENGTH()</a>. There is a difference between those functions which you can read at <a title="MySQL - CHAR_LENGTH()" href="http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_char-length" target="_blank">MySQL.com</a> website or just read the following quote: </span></p>
<blockquote>
<p><a href="http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_char-length"><code>CHAR_LENGTH(<em><code>str</code></em>)</code></a></p>
<p>Returns the length of the string <em><code>str</code></em>, measured in characters. A multi-byte character counts as a single character. This means that for a string containing five two-byte characters, <a href="http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_length"><code>LENGTH()</code></a> returns <code>10</code>, whereas <a href="http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_char-length"><code>CHAR_LENGTH()</code></a>returns <code>5</code>.</p>
</blockquote>
<p><span style="font-size: medium; font-family: verdana, geneva;"> Enough talking. This is the function after my little fix: </span></p>
<pre class="brush: sql; gutter: true; first-line: 1; highlight: [9]">
<br/>
CREATE FUNCTION SPLIT_STR(
  x VARCHAR(255),
  delim VARCHAR(12),
  pos INT
)
RETURNS VARCHAR(255)
RETURN REPLACE(SUBSTRING(SUBSTRING_INDEX(x, delim, pos),
       CHAR_LENGTH(SUBSTRING_INDEX(x, delim, pos -1)) + 1),
       delim, '');
</pre>
<p>
<span style="font-family: verdana, geneva; font-size: medium;"><br />
Then using the same example I`v used above:<br />
</span>
</p>
<pre class="brush: sql; gutter: true; first-line: 1; highlight: [3]">
<br/>
select split_str(‘ABC¼,,BA,,abc’,',,’,3);
//result: “abc”
<br/>
</pre>
<p>
<span style="font-family: verdana, geneva; font-size: medium;"><br />
I want to say thank to <a title="Federico Cargnelutti" href="http://blog.fedecarg.com/" target="_blank">Federico Cargnelutti</a> that helped us by writing the above function.<br />
<br/><br />
Shak.<br />
</span></p>
<div class="al2fb_likers"><a href="http://www.facebook.com/profile.php?id=1042185552" rel="nofollow">Or Ovadia</a> <span class="al2fb_liked">liked this post</span></div><div class="al2fb_like_button"><div id="fb-root"></div><script type="text/javascript">
(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=188624057851679";
  fjs.parentNode.insertBefore(js, fjs);
}(document, "script", "facebook-jssdk"));
</script>
<fb:like href="http://www.shakedos.com/mysql-split-string-function-fix-split_str/" layout="standard" show_faces="true" width="450" action="like" font="verdana" colorscheme="light" ref="AL2FB"></fb:like></div>]]></content:encoded>
			<wfw:commentRss>http://www.shakedos.com/mysql-split-string-function-fix-split_str/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setup\Configure Zend Debugger</title>
		<link>http://www.shakedos.com/setupconfigure-zend-debugger/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=setupconfigure-zend-debugger</link>
		<comments>http://www.shakedos.com/setupconfigure-zend-debugger/#comments</comments>
		<pubDate>Sun, 20 Nov 2011 21:44:58 +0000</pubDate>
		<dc:creator>Shaked</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[php debugger]]></category>
		<category><![CDATA[zend debugger]]></category>
		<category><![CDATA[zend studio]]></category>

		<guid isPermaLink="false">http://www.shakedos.com/?p=380</guid>
		<description><![CDATA[Using a debugger is very important while writing code, so lets see how to do it with PHP and Zend Debugger:  Install Eclipse or Zend Studio  If you have installed Eclipse, you should install two more things:  PDT (PHP Development Tools) Zend Debugger After extracting everything, search for ZendDebugger.so path Edit your php.ini or create another [...]]]></description>
			<content:encoded><![CDATA[<style>
#zend_debuger_setup_configure img { width: 450px; }
</style>
<div id="zend_debuger_setup_configure">
<p><span style="font-size: medium;">Using a debugger is very important while writing code, so lets see how to do it with PHP and Zend Debugger: </span></p>
<ol>
<li><span style="font-size: medium;">Install <a title="Eclipse" href="http://www.eclipse.org/" target="_blank">Eclipse</a> or <a title="Zend - The PHP Company " href="http://www.zend.com/" target="_blank">Zend Studio</a> </span></li>
<li><span style="font-size: medium;">If you have installed Eclipse, you should install two more things:</span></li>
<ol>
<li><span style="font-size: medium;"> <a title="PDT - PHP Development Tools" href="http://eclipse.org/pdt/downloads/" target="_blank">PDT</a> (PHP Development Tools)</span></li>
<li><span style="font-size: medium;"><a title="Zend Debugger" href="http://www.zend.com/en/community/pdt" target="_blank">Zend Debugger</a></span></li>
</ol>
<li><span style="font-size: medium;">After extracting everything, search for <em>ZendDebugger.so</em> path</span></li>
<li><span style="font-size: medium;">Edit your <em>php.ini</em> or create another ini --> <em>zend.ini</em> which will <a title="Loading .ini files with PHP" href="http://stackoverflow.com/questions/1391808/how-do-i-include-a-php-ini-file-in-another-php-ini-file" target="_blank">have to be loaded by your PHP</a> and add:</span><br /> 
<pre class="brush: shell; gutter: true; first-line: 1">; Loading Zend Debugger Extension
zend_extension=/your/path/to/ZendDebugger.so
;
; use 127.0.0.1 for local host, or you another local network IP
zend_debugger.allow_hosts=127.0.0.1
;
;
Expose Zend Debugger
;
;
never - do not expose (default)
;
always - expose to whoever want to know
;
allowed_hosts - expose only if request comes from an IP listed above
;
zend_debugger.expost_remotely=always
</pre>
</li>
<li><span style="font-size: medium;">Save &amp; Restart Apache</span></li>
<li><span style="font-size: medium;">Verify your<em> <a title="phpinfo();" href="http://php.net/manual/en/function.phpinfo.php" target="_blank">phpinfo()</a></em></span></li>
<ol>
<li><a title="PHP: phpinfo() Zend Debugger settings " href="http://www.shakedos.com/wp-content/plugins/pressbox/pressbox.php?display=/public/uploads/zend_debugger4.png&amp;_wpnonce=4f2457de9f" target="_blank"><img src="http://www.shakedos.com/wp-content/plugins/pressbox/pressbox.php?display=/public/uploads/zend_debugger4.png&_wpnonce=cccba26108" /></a></li>
</ol>
<li><span style="font-size: medium;">Download <a title="Zend Debugger - FireFox Extension (Addon\Toolbar)" href="http://www.zend.com/en/products/studio/downloads" target="_blank">FireFox</a> or <a title="Zend Debugger - Chrome Extension" href="http://www.d23.nl/zend-debugger-toolbar-extension-for-chrome/" target="_blank">Chrome Extension</a> (Chrome extension is <span style="text-decoration: underline;"><strong>not</strong></span> official extension by Zend) </span></li>
<li><span style="font-size: medium;">Configure Eclipse \ Zend Studio settings:</span></li>
<ol>
<li><a title="Zend Studio Settings for Zend Debugger" href="http://www.shakedos.com/wp-content/plugins/pressbox/pressbox.php?display=/public/uploads/zend_debugger_2.png&amp;_wpnonce=4f2457de9f" target="_blank"><img src="http://www.shakedos.com/wp-content/plugins/pressbox/pressbox.php?display=/public/uploads/zend_debugger_2.png&_wpnonce=cccba26108" /></a></li>
<li><a title="Zend Studio Settings for Zend Deugger" href="http://www.shakedos.com/wp-content/plugins/pressbox/pressbox.php?display=/public/uploads/zend_debugger.png&amp;_wpnonce=4f2457de9f" target="_blank"><img src="http://www.shakedos.com/wp-content/plugins/pressbox/pressbox.php?display=/public/uploads/zend_debugger.png&_wpnonce=cccba26108" /></a></li>
</ol>
<li><span style="font-size: medium;">Configure your extension settings:</span></li>
<ol>
<li><a title="Zend Extension Settings for Zend Debugger" href="http://www.shakedos.com/wp-content/plugins/pressbox/pressbox.php?display=/public/uploads/zend_debugger_3.png&amp;_wpnonce=4f2457de9f" target="_blank"><img src="http://www.shakedos.com/wp-content/plugins/pressbox/pressbox.php?display=/public/uploads/zend_debugger_3.png&_wpnonce=cccba26108" /></a></li>
</ol>
<li><span style="font-size: medium;">Start debugging!:) </span></li>
</ol>
<div><span style="font-size: medium;">Helpful links: </span></div>
<div><span style="font-size: medium;"><a title="cmanon.com" href="http://cmanon.com/blog/computer/programming/zend-debugger-eclipse-apache/" target="_blank">cmanon.com</a></span></div>
<div><span style="font-size: medium;"><a title="Stackoverflow - PHP 5.3.5 and Zend Debugger" href="http://stackoverflow.com/questions/7188149/php-5-3-5-with-zend-debugger" target="_blank">stackoverflow - PHP 5.3.5 and Zend Debugger</a></span></div>
<div> </div>
<div><span style="font-size: medium;"><a title="How to install Zend Debugger on Windows without Zend Core/Platform" href="http://www.devcha.com/2008/01/how-to-install-zend-debugger-on-windows.html" target="_blank">devcha.com - Installing Zend Debugger on Windows</a></span></div>
<p>&nbsp;</p>
<p><span style="font-size: medium;"><span style="text-decoration: underline;">Note for Zend Studio 8.x users</span>: </span></p>
<p><span style="font-size: medium;">I suggest that you will update your Zend Studio application by using the following instructions: </span></p>
<p><span style="font-size: medium;"><a href="http://forums.zend.com/viewtopic.php?f=59&amp;t=10468">http://forums.zend.com/viewtopic.php?f=59&amp;t=10468</a></span></p>
<p>Enjoy!</p>
</div>
<div class="al2fb_likers"><a href="http://www.facebook.com/profile.php?id=595370654" rel="nofollow">Yuval Halfon</a> <span class="al2fb_liked">liked this post</span></div><div class="al2fb_like_button"><div id="fb-root"></div><script type="text/javascript">
(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=188624057851679";
  fjs.parentNode.insertBefore(js, fjs);
}(document, "script", "facebook-jssdk"));
</script>
<fb:like href="http://www.shakedos.com/setupconfigure-zend-debugger/" layout="standard" show_faces="true" width="450" action="like" font="verdana" colorscheme="light" ref="AL2FB"></fb:like></div>]]></content:encoded>
			<wfw:commentRss>http://www.shakedos.com/setupconfigure-zend-debugger/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHP: Insert\Update MySQL BIT(1) field</title>
		<link>http://www.shakedos.com/php-insertupdate-mysql-bit1-field/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-insertupdate-mysql-bit1-field</link>
		<comments>http://www.shakedos.com/php-insertupdate-mysql-bit1-field/#comments</comments>
		<pubDate>Fri, 18 Nov 2011 21:03:00 +0000</pubDate>
		<dc:creator>Shaked</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[bit data type]]></category>
		<category><![CDATA[BIT datatype]]></category>
		<category><![CDATA[BIT field]]></category>
		<category><![CDATA[MySQL bool]]></category>
		<category><![CDATA[MySQL boolean]]></category>

		<guid isPermaLink="false">http://www.shakedos.com/?p=356</guid>
		<description><![CDATA[Today I`v noticed to interested things:  A nice sentence or a motto that I really liked:  "When you do a search, and it comes back with no results, it’s a sign that you need to write something." (Taken from Here  Didn't find any straight answer on Google for my question: "How to insert\update a bit field [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-size: medium;">Today I`v noticed to interested things: </span></p>
<ol>
<li><span style="font-size: medium;">A nice sentence or a motto that I really liked: </span>
<p><span style="font-size: medium;">"When you do a search, and it comes back with no results, it’s a sign that you need to write something." (Taken from <a title="Gordon P. Hemsley Linguist by day. Web developer by night." href="http://gphemsley.wordpress.com/2010/02/08/php-mysql-and-the-bit-field-type/" target="_blank">Here</a></span><br /> </li>
<li><span style="font-size: medium;">Didn't find any straight answer on Google for my question: "How to insert\update a bit field with PHP": </span></li>
</ol>
<p style="padding-left: 30px;"><span style="font-size: medium;">So with MySQL you would use:</span></p>
<pre class="brush: sql; gutter: true; first-line: 1">INSERT INTO t SET b = b'1'; // Or b'0' </pre>
<p style="padding-left: 30px;"> <span style="font-size: medium;">And with PHP you would use boolean type: </span></p>
<pre class="brush: php; gutter: true; first-line: 1">

//$db instanceof ActiveRecord, that's only for the following example
//you can use other ways to insert\update your MySQL DB. 

$db-&gt;insert(array('b'=&gt;true,'c'=&gt;false)); //true = b'1' , false = b'0'

$db-&gt;update(array('b'=&gt;true,'c'=&gt;false)); //true = b'1' , false = b'0'
</pre>
<p>Hope I helped, </span><br />
Shak.</span></p>
<div><code><br /></code></div>
<div class="al2fb_like_button"><div id="fb-root"></div><script type="text/javascript">
(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=188624057851679";
  fjs.parentNode.insertBefore(js, fjs);
}(document, "script", "facebook-jssdk"));
</script>
<fb:like href="http://www.shakedos.com/php-insertupdate-mysql-bit1-field/" layout="standard" show_faces="true" width="450" action="like" font="verdana" colorscheme="light" ref="AL2FB"></fb:like></div>]]></content:encoded>
			<wfw:commentRss>http://www.shakedos.com/php-insertupdate-mysql-bit1-field/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

