<?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>Behçet Mutlu</title>
	<atom:link href="http://www.behcetmutlu.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.behcetmutlu.com/blog</link>
	<description>&#34;Think the future that you would want tomorrow and act today to realize it.&#34;</description>
	<lastBuildDate>Wed, 22 Feb 2012 16:27:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>FOSFacebookBundle: &#8220;The Facebook user could not be retrieved from the session.&#8221; (a possible solution)</title>
		<link>http://www.behcetmutlu.com/blog/fosfacebookbundle-the-facebook-user-could-not-be-retrieved-from-the-session-a-possible-solution/</link>
		<comments>http://www.behcetmutlu.com/blog/fosfacebookbundle-the-facebook-user-could-not-be-retrieved-from-the-session-a-possible-solution/#comments</comments>
		<pubDate>Wed, 22 Feb 2012 16:21:42 +0000</pubDate>
		<dc:creator>bekco</dc:creator>
				<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://www.behcetmutlu.com/blog/?p=221</guid>
		<description><![CDATA[If you get the message below when you try to connect to your site via Facebook Connect, The Facebook user could not be retrieved from the session. You just need to change your localhost URL on your own hosts file that Facebook can give you cookie permission of which is blocked by default for localhost [...]]]></description>
			<content:encoded><![CDATA[<p>If you get the message below when you try to connect to your site via Facebook Connect,</p>
<blockquote><p>The Facebook user could not be retrieved from the session.</p></blockquote>
<p>You just need to change your localhost URL on your own hosts file that Facebook can give you cookie permission of which is blocked by default for localhost development.<br />
To do that, just add a new line below to your hosts file;<br />
<code>127.0.0.1 localhost.local</code><br />
And do not forget to change your application settings at developer.facebook.com to allow your new application URL http://localhost.local/your_app/.</p>
<p>Thank you for reading.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.behcetmutlu.com/blog/fosfacebookbundle-the-facebook-user-could-not-be-retrieved-from-the-session-a-possible-solution/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Overall Summary of my First Week on the New Job at Enuygun.Com</title>
		<link>http://www.behcetmutlu.com/blog/overall-summary-of-my-first-week-on-the-new-job-at-enuygun-com/</link>
		<comments>http://www.behcetmutlu.com/blog/overall-summary-of-my-first-week-on-the-new-job-at-enuygun-com/#comments</comments>
		<pubDate>Fri, 17 Feb 2012 16:31:37 +0000</pubDate>
		<dc:creator>bekco</dc:creator>
				<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://www.behcetmutlu.com/blog/?p=213</guid>
		<description><![CDATA[The end of the week showed up for me and I feel like writing about my firs week at Enuygun.Com. Firstly, I haven&#8217;t learn much about the company but I think its a kind of new but successful company. I&#8217;m a senior software developer here and we&#8217;re going to build applications, services, mobile applications and [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_214" class="wp-caption alignleft" style="width: 160px"><a href="http://www.behcetmutlu.com/blog/wp-content/uploads/2012/02/enuygun.jpg"><img class="size-thumbnail wp-image-214" title="enuygun" src="http://www.behcetmutlu.com/blog/wp-content/uploads/2012/02/enuygun-e1329496250216-150x137.jpg" alt="" width="150" height="137" /></a><p class="wp-caption-text">Enuygun.com</p></div>
<p>The end of the week showed up for me and I feel like writing about my firs week at Enuygun.Com. Firstly, I haven&#8217;t learn much about the company but I think its a kind of new but successful company. I&#8217;m a senior software developer here and we&#8217;re going to build applications, services, mobile applications and an affiliate system for all we can share the growth. We are using Symfony2 as PHP framework of which I had no idea at the beginning. For the first 2 days it was like what a horrible structure that everything is bundled and you need to create new bundle to use the other bundle. At least, that&#8217;s what I think it was. After a huge concentration on research and watching some tutorials about Symfony, I now can say that, it might be the best framework to be used to develop easily implemented bundles that could be used by many applications. It&#8217;s not that none of the other frameworks don&#8217;t have the ability but it is for me now that when I think about bundled or plug in based system development is Symfony.</p>
<p>All in all, although I did not have any clue about the technology that they have been using till now, I think I made a grate performance to figure out what is what, why it is used and how I can use things while I have my developer hat put-on. So, the thing is, Enuygun.com is totally new for me and I feel like I&#8217;m going to be successful as I used to be on the previous companies. But I should note that, getting a job far away from your home is not the best choice. But it was a quick shoot. I hope I made a good decision.</p>
<p>Thank you for reading.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.behcetmutlu.com/blog/overall-summary-of-my-first-week-on-the-new-job-at-enuygun-com/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Compressing Stylesheets with PHP</title>
		<link>http://www.behcetmutlu.com/blog/compressing-stylesheets-with-php/</link>
		<comments>http://www.behcetmutlu.com/blog/compressing-stylesheets-with-php/#comments</comments>
		<pubDate>Tue, 21 Jun 2011 07:41:14 +0000</pubDate>
		<dc:creator>bekco</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming Languages]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.behcetmutlu.com/blog/?p=203</guid>
		<description><![CDATA[If you wonder what else you can do to compress your files, I found a PHP code of which is written by a German coder that is shared on another blog. Basicaly it removes spaces and back slashes to minify the included files and compress them using ob_gzhandler. header('Content-type: text/css'); ob_start("compress"); function compress($buffer) { /* [...]]]></description>
			<content:encoded><![CDATA[<p>If you wonder what else you can do to compress your files, I found a  PHP code of which is written by a German coder that is shared on another  blog. Basicaly it removes spaces and back slashes to minify the  included files and compress them using ob_gzhandler.</p>
<pre>  header('Content-type: text/css');
  ob_start("compress");
  function compress($buffer) {
    /* remove comments */
    $buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer);
    /* remove tabs, spaces, newlines, etc. */
    $buffer = str_replace(array("\r\n", "\r", "\n", "\t", '  ', '    ', '    '), '', $buffer);
    return $buffer;
  }

  /* your css files */
  include('master.css');
  include('typography.css');
  include('grid.css');
  include('print.css');
  include('handheld.css');

  ob_end_flush();</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.behcetmutlu.com/blog/compressing-stylesheets-with-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Compressing Web Site Contents, Scripts and Stylesheets</title>
		<link>http://www.behcetmutlu.com/blog/compressing-web-site-contents-scripts-and-stylesheets/</link>
		<comments>http://www.behcetmutlu.com/blog/compressing-web-site-contents-scripts-and-stylesheets/#comments</comments>
		<pubDate>Tue, 21 Jun 2011 07:15:45 +0000</pubDate>
		<dc:creator>bekco</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming Languages]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.behcetmutlu.com/blog/?p=198</guid>
		<description><![CDATA[Today I wonder how I could minify my javascript files and do a server side compression to minimize the cost of loading web site requred javasript and stylesheet files. Where to begin&#8230; I&#8217;ll start from Apache Server configuration information for server side compression and finish with YUI Compressor that helps you to minify your script [...]]]></description>
			<content:encoded><![CDATA[<p>Today I wonder how I could minify my javascript files and do a server side compression to minimize the cost of loading web site requred javasript and stylesheet files.  Where to begin&#8230; I&#8217;ll start from Apache Server configuration information for server side compression and finish with YUI Compressor that helps you to minify your script files as you should have seen those files ending with &#8220;your_script_file.min.js&#8221;.  If you are using Apache Server, you might have Deflate Module installed with your Apache installation. What you need to load this module while your your server starts is to configure your apache configuration file.</p>
<pre>LoadModule deflate_module modules/mod_deflate.so</pre>
<p>And if you have access to the <code>httpd.conf</code> then you can add following lines to it.</p>
<pre>&lt;Location /&gt;
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/x-js text/css
&lt;/Location&gt;</pre>
<p>If not; you should specify the initialization line into your htaccess file.</p>
<pre><code>&lt;IfModule mod_deflate.c&gt;
AddOutputFilterByType DEFLATE text/html text/css text/plain text/javascript text/xml application/xhtml+xml application/x-httpd-php
&lt;/IfModule&gt;
</code></pre>
<p>You might have problems to compress javascript files which has different mime types. Then, you can use followig configuration.</p>
<pre><code>AddOutputFilterByType DEFLATE application/x-javascript</code></pre>
<p>That will do.  Now, I will introduce YUI Compressor. YUI Compressor is one of Yahoo developer team product that you can <a title="Download YUI Compressor" href="http://yuilibrary.com/downloads/#yuicompressor" target="_blank">download from here</a>.   If you have dowloaded the YUI Compressor built from the site that I shared above, what you should do to compress your file is:</p>
<pre>java -jar yuicompressor-x.y.z.jar myfile.js -o myfile-min.js --charset utf-8</pre>
<p>Where, x, y and z are the version number of the YUI Compressor download.  Also you can find more information about YUI Compressor at <a href="http://developer.yahoo.com/yui/compressor/#work" target="_blank">http://developer.yahoo.com/yui/compressor/#work</a></p>
<p>Thank you for reading, I hope this will help some of you guys.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.behcetmutlu.com/blog/compressing-web-site-contents-scripts-and-stylesheets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CakePHP : Translate Behaviour : Fixing Nested Translation Problem</title>
		<link>http://www.behcetmutlu.com/blog/cakephp-translate-behaviour-translation-problem/</link>
		<comments>http://www.behcetmutlu.com/blog/cakephp-translate-behaviour-translation-problem/#comments</comments>
		<pubDate>Sun, 12 Jun 2011 20:27:51 +0000</pubDate>
		<dc:creator>bekco</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[Data Querying]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming Languages]]></category>
		<category><![CDATA[Software Engineering]]></category>

		<guid isPermaLink="false">http://www.behcetmutlu.com/blog/?p=191</guid>
		<description><![CDATA[If you ever tried to use Translation Behaviour of CakePHP you should realize that Translate Behavior does not support nested translations for the model relations. I&#8217;ve found one article that shows how to fix a similar translation problem on related models at http://groups.google.com/group/cake-php/browse_thread/thread/9b7e60900269643b%29. Unfortunately it was not a complete solution that you can implement easily [...]]]></description>
			<content:encoded><![CDATA[<p>If you ever tried to use Translation Behaviour of CakePHP you should realize that Translate Behavior does not support nested translations for the model relations. I&#8217;ve found one article that shows how to fix a similar translation problem on related models at <a href="http://groups.google.com/group/cake-php/browse_thread/thread/9b7e60900269643b%29">http://groups.google.com/group/cake-php/browse_thread/thread/9b7e60900269643b%29</a>.</p>
<p>Unfortunately it was not a complete solution that you can implement easily but it gave me a good approach to help the model to request nested queries to make Translate Behaviour work.</p>
<p>I need to warn you that this solution is not a really good one but until CakePHP team fix this issue on one of the future releases of CakePHP this would help you a lot.</p>
<p>Here is the code:</p>
<pre class="prettyprint">class AppModel extends Model {

    var $_findMethods = array(&#39;all&#39; =&gt; true, &#39;first&#39; =&gt; true, &#39;count&#39; =&gt; true,
		&#39;neighbors&#39; =&gt; true, &#39;list&#39; =&gt; true, &#39;threaded&#39; =&gt; true, &#39;translated&#39; =&gt; true);

    function _findTranslated($state, $query, $results = array()) {
        if ($state == &#39;before&#39;) {
            return array_merge($query, array(
                &#47;&#47;&#39;fields&#39; =&gt; array(&#39;id&#39;, &#39;name&#39;),
                &#47;&#47;&#39;recursive&#39; =&gt; -1
            ));
        } elseif ($state == &#39;after&#39;) {
            if (empty($results)) {
                return $results;
            }

            &#47;&#47; get the model&#39;s belongs to relation model names
            $belongsTo = Set::extract($this-&gt;belongsTo, &#39;&#47;@*&#39;);

            if(!empty($belongsTo) &amp;&amp; isset($belongsTo&#91;0&#93;) &amp;&amp; is_array($belongsTo&#91;0&#93;))
                $belongsTo = $belongsTo&#91;0&#93;;

            if(!empty($belongsTo))
                foreach($results as &amp;$result)
                {
                    foreach($belongsTo as $modelName)
                    {
                        if(isset($result&#91;$modelName&#93;) &amp;&amp;
                            isset($result&#91;$modelName&#93;&#91;&#39;id&#39;&#93;) &amp;&amp;
                            !empty($result&#91;$modelName&#93;&#91;&#39;id&#39;&#93;))
                        {

                            $data = $this-&gt;$modelName-&gt;find(&#39;first&#39;, array(
                                &#39;conditions&#39; =&gt; array(
                                    $modelName.&#39;.id&#39; =&gt; $result&#91;$modelName&#93;&#91;&#39;id&#39;&#93;
                                ),
                                &#39;recursive&#39; =&gt; -1
                            ));

                            if(!empty($data))
                                $result&#91;$modelName&#93; = $data&#91;$modelName&#93;;
                        }
                    }
                }

            return $results;
        }
    }
}</pre>
<p>What you need to do is just implement the _findTranslated method on your model or on AppModel for general usage with the $_findMethods private variable and instead of using regular find methods for example:</p>
<pre class="prettyprint">$this-&gt;Post-&gt;find(&#39;all&#39;);</pre>
<p>You should use:</p>
<pre class="prettyprint">$this-&gt;Post-&gt;find(&#39;translated&#39;);</pre>
<p>And the result will look as the same above but with translated inner relations.</p>
<p><strong>Not: </strong>I have not implement all types of the relations yet but if you find hard to add such relations let me know, I&#8217;ll do my best.</p>
<p>I hope this could help you. Please leave me some responses to make sure is helpful.</p>
<p>Thank you for reading this article.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.behcetmutlu.com/blog/cakephp-translate-behaviour-translation-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ext JS Templates &#8211; The Complete Tutorial</title>
		<link>http://www.behcetmutlu.com/blog/ext-js-templates-the-complete-tutorial/</link>
		<comments>http://www.behcetmutlu.com/blog/ext-js-templates-the-complete-tutorial/#comments</comments>
		<pubDate>Tue, 31 May 2011 12:23:54 +0000</pubDate>
		<dc:creator>bekco</dc:creator>
				<category><![CDATA[Ext JS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Programming Languages]]></category>
		<category><![CDATA[Software Engineering]]></category>

		<guid isPermaLink="false">http://www.behcetmutlu.com/blog/?p=185</guid>
		<description><![CDATA[Today I&#8217;ve searched all over the web sites to find some basic Ext JS template definitions and could not find a good resource as I needed. So, I decided to bring out one myself. Hope you will enjoy. Basics Ext JS templates have their own parsing algorithms that needs to be compiled before used and [...]]]></description>
			<content:encoded><![CDATA[<p>Today I&#8217;ve searched all over the web sites to find some basic Ext JS template definitions and could not find a good resource as I needed. So, I decided to bring out one myself. Hope you will enjoy.</p>
<h1>Basics</h1>
<p>Ext JS templates have their own parsing algorithms that needs to be compiled before used and here is a quick start to it.</p>
<h2>Defining Variables</h2>
<p>If you would like to add variables on the template you need to surround the variable name with curly parentheses (&#8216;{&#8216; and &#8216;}&#8217; ).<strong> </strong></p>
<p><strong>Example:</strong></p>
<pre class="prettyprint">{variable_name}</pre>
<h2>Using Variables in Texts</h2>
<p>To add variables into the predefined texts you can just add the variable with curly parentheses where you want to put the variable.<strong> </strong></p>
<p><strong>Example:</strong></p>
<pre class="prettyprint">This page has {page_picture_count} pictures.</pre>
<h2>Using HTML Tags on Templates</h2>
<p>It is the same way you add html tags on your Ex JS template as adding predefined text.<strong> </strong></p>
<p><strong>Example:</strong></p>
<pre class="prettyprint">&lt;a id=&#34;{id}&#34; href=&#34;{url}&#34;&gt;{text}&lt;&#47;a&gt;</pre>
<h2>Conditions</h2>
<p>You can set conditions to perform on template rendering to the parameter as well. How you do this is pretty simple.<strong> </strong></p>
<p><strong>Form:</strong></p>
<pre class="prettyprint">&lt;tpl if=&#34;your condition&#34;&gt;{field}&lt;&#47;tpl&gt;</pre>
<p><strong>Example 1 (If condition):</strong></p>
<pre class="prettyprint">&lt;tpl if=&#34;{field}==&#39;Good Example&#39;&#34;&gt;{field}&lt;&#47;tpl&gt;</pre>
<p>With this template what ever else the field variable is will not be evaluated except if it is equal to &#8216;Good Example&#8217; string.<strong> </strong></p>
<p><strong> </strong></p>
<h2>Loops</h2>
<p>You can use loops when you need to output a list of variables.<strong> </strong></p>
<p><strong>Example:</strong></p>
<pre class="prettyprint">&lt;tpl for=&#34;{parent}&#34;&gt;{child}, &lt;&#47;tpl&gt;</pre>
<p>With this template for each child in parent will be separated with columns.</p>
<p><strong>Example 2 (If and Else If condition):</strong></p>
<pre class="prettyprint">&lt;tpl if=&#34;{field}==&#39;Good Example&#39;&#34;&gt;{field}&lt;&#47;tpl&gt;
&lt;tpl if=&#34;{field}==&#39;Else Example&#39;&#34;&gt;{field}&lt;&#47;tpl&gt;</pre>
<p>With this template what ever else the field variable is will not be evaluated except if it is equal to &#8216;Good Example&#8217; or &#8216;Else Example&#8217; string.</p>
<h2>Using Predefined Functions on Templates</h2>
<p>Ext JS has internal Template functions that are useful for your templates.</p>
<p>Suppose we want to output a variable named content but we are afraid that it may take too much space. A useful feature would be able to truncate this content to 50 characters and show the user a link to view all of the content. We can use the formatting function &#8220;ellipsis&#8221; to truncate the content to only 50 characters. This function will also append &#8220;&#8230;&#8221; to indicate to our users that there is actually more content but it has been truncated.</p>
<p><strong>Example:</strong></p>
<pre class="prettyprint">&lt;div&gt;{content:ellipsis(50)}&lt;br&#47;&gt;&lt;a href=&#34;{moreLink}&#34;&gt;Read More&lt;&#47;a&gt;&lt;&#47;div&gt;</pre>
<p><strong>Here is a list of the formatting functions which you can use with Templates:</strong></p>
<p>ellipsis(length): Abbreviate your variable to a specified length and append &#8220;&#8230;&#8221;. Useful for when you want to only show the first x characters and then provide a more detailed view.</p>
<p><strong>undef:</strong> If the variable is undefined show &#8220;&#8221; instead of &#8220;undefined&#8221;</p>
<p><strong>htmlEncode: </strong>If the variable contains ampersands, less than, greater than symbols or quotes HTML escape them.</p>
<p><strong>trim:</strong> If the variable contains extra rwhite space, trim it.</p>
<p><strong>substr(start, length):</strong> Substring the variable</p>
<p><strong>lowercase:</strong> Transform the variable to all lowercase.</p>
<p><strong>uppercase:</strong> Transform the variable to all uppercase.</p>
<p><strong>capitalize:</strong> Capitalize the first letter of the variable, the remaining characters will be transformed to lowercase.</p>
<p><strong>usMoney: </strong>Format in US Dollars. ie: $10.97</p>
<p><strong>date[(format)]:</strong> Transform the variable to a date format, if the format argument is omitted uses the mask &#8216;m/d/Y&#8217;</p>
<p><strong>stripTags:</strong> Strips the variable of all html tags.</p>
<p>You can also create your own custom formatting functions by adding a new method to your template instance and calling it by prepending this. to your format function like this &#8220;{VARIABLE:this.&lt;FORMATFUNCTION&gt;}&#8221;</p>
<p>Here is a sample which adds a new function called yesNoFormat to an instance of a template. yesNoFormat is similar to a ColdFusion function which converts &#8216;truthy&#8217; values to the word &#8220;Yes&#8221; and &#8216;falsey&#8217; values to the word &#8220;No&#8221;.</p>
<pre class="prettyprint">var testCustomTpl = new Ext.Template(
    &#39;&lt;div&gt;User: {username} IsRevoked: {revoked:this.yesNoFormat}&lt;&#47;div&gt;&#39;
);
testCustomTpl.yesNoFormat = function(value) {
	return value ? &#39;Yes&#39; : &#39;No&#39;;
};
testCustomTpl.append(document.body, {username: &#39;aconran&#39;, revoked: 1});</pre>
<p><strong>Note:</strong> This post will continue when I found something else and developing some examples on Ext JS Templates.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.behcetmutlu.com/blog/ext-js-templates-the-complete-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building the Best SQL Manager With PHP (Part 2)</title>
		<link>http://www.behcetmutlu.com/blog/building-the-best-sql-manager-with-php-2/</link>
		<comments>http://www.behcetmutlu.com/blog/building-the-best-sql-manager-with-php-2/#comments</comments>
		<pubDate>Tue, 31 May 2011 06:27:12 +0000</pubDate>
		<dc:creator>bekco</dc:creator>
				<category><![CDATA[Data Querying]]></category>
		<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[MySQL Database]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming Languages]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.behcetmutlu.com/blog/?p=181</guid>
		<description><![CDATA[After a long day work on a complicated class I finally finished my requiered querying algorithm. The final output of my SQL Manager class is like select `adproperties`.*, `properties`.* FROM `adproperties` left join (select * FROM `advertisementproperties` WHERE ((`advertisementproperties`.`advertisement_id` = &#39;113&#39;))) `properties` on (`properties`.`adproperty_id` = (`adproperties`.`id`)) WHERE ((`adcategory_id` = (select `advertisements`.`adcategory_id` as adcategory FROM `advertisements` [...]]]></description>
			<content:encoded><![CDATA[<p>After a long day work on a complicated class I finally finished my requiered querying algorithm. The final output of my SQL Manager class is like</p>
<pre class="prettyprint">select
 `adproperties`.*, `properties`.*
 FROM `adproperties`
 left join (select
 *
 FROM `advertisementproperties`
  WHERE ((`advertisementproperties`.`advertisement_id` = &#39;113&#39;))) `properties` on (`properties`.`adproperty_id` = (`adproperties`.`id`))
  WHERE ((`adcategory_id` = (select
 `advertisements`.`adcategory_id` as adcategory
 FROM `advertisements`
  WHERE (((`advertisements`.`id` = &#39;113&#39;) and (`advertisements`.`account_id` = &#39;1&#39;))))))</pre>
<p>This worked for me perfectly. Even I add some more conditions on it. Later I&#8217;ll have time to fix the paranthesis problem but for the beginning, I&#8217;ll keep using this code instead of the old one.<br />
I must finaly point that, I have not tried it with other kind of configuration array but after I finish the whole it will be the perfect SQL Manager Class written in PHP ever.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.behcetmutlu.com/blog/building-the-best-sql-manager-with-php-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building the Best SQL Manager With PHP</title>
		<link>http://www.behcetmutlu.com/blog/building-the-best-sql-manager-with-php/</link>
		<comments>http://www.behcetmutlu.com/blog/building-the-best-sql-manager-with-php/#comments</comments>
		<pubDate>Sun, 29 May 2011 10:43:25 +0000</pubDate>
		<dc:creator>bekco</dc:creator>
				<category><![CDATA[Data Querying]]></category>
		<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[MySQL Database]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming Languages]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.behcetmutlu.com/blog/?p=166</guid>
		<description><![CDATA[Today I decided to improve one of my developed SQL Manager class to be able to create easy sql queries but complicated enough not to be able ease work on defining the complicated queries. With my old solution I could not be able to complete a query like below. SELECT `adproperties`.*, `properties`.* FROM `adproperties` LEFT [...]]]></description>
			<content:encoded><![CDATA[<p>Today I decided to improve one of my developed SQL Manager class to be able to create easy sql queries but complicated enough not to be able ease work on defining the complicated queries. With my old solution I could not be able to complete a query like below.</p>
<pre class="prettyprint">SELECT
`adproperties`.*,
`properties`.*
FROM `adproperties`
LEFT JOIN (SELECT *
                FROM
                `advertisementproperties`
                WHERE `advertisementproperties`.`advertisement_id` = 110) `properties`
ON `properties`.`adproperty_id` = `adproperties`.`id`
WHERE
`adcategory_id` = (SELECT
                           `advertisements`.`adcategory_id` as `adcategory`
                           FROM `advertisements`
                           WHERE `advertisements`.`id` = 110)</pre>
<p>It is something right? So, what I need to do is adding inner queries up on my old manager even on the Joining phrases and Where clauses. It is not easy to build a complete solution for SQL because you would always think on the current problem to be fixed not the whole. Even though, I could have been able to build a generalization to create search queries on the relational queries of which is also used in many projects of mine.</p>
<p>Now what I can do with it is like:</p>
<pre class="prettyprint">SELECT
`advertisementproperties`.`id`,
`advertisementproperties`.`advertisement_id`,
`advertisementproperties`.`value`,
`adproperties_rel`.`options`,
`adproperties_rel`.`type`,
`adproperties_rel`.`adcategory_id`,
`adproperties_rel`.`id` as `adproperty_id`,
`adproperties_rel`.`name`
FROM `advertisementproperties`
RIGHT JOIN `adproperties` `adproperties_rel`
ON `adproperties_rel`.`id` = `advertisementproperties`.`adproperty_id`
WHERE (
(`adproperties_rel`.`account_id` = &#39;1&#39;) or ISNULL
(`adproperties_rel`.`account_id`)) and (
(`advertisement_id` = 113) or ISNULL
(`advertisement_id`)) and
(`adproperties_rel`.`adcategory_id` = &#39;22&#39;)</pre>
<p>This code above is not able to do what I needed and it is not a good SQL query either. What I really need to do is to create better querying solution for it.</p>
<p>I started from the end to internal core of the code and firstly defined the object that I would like it to create my query:</p>
<pre class="prettyprint">$sqlMgr = new SQLManager(array(
    &#34;method&#34; =&gt; &#34;select&#34;,
    &#34;selections&#34; =&gt; array(&#34;adproperties&#34;  =&gt; &#34;*&#34;, &#34;properties&#34;  =&gt; &#34;*&#34;),
    &#34;tableName&#34; =&gt; &#34;adproperties&#34;,
    &#34;relations&#34; =&gt; array(
        &#34;properties&#34; =&gt; array(
            &#34;join&#34; =&gt; &#34;left&#34;,
            &#34;tableName&#34; =&gt; array(
                &#34;query&#34; =&gt; true,
                &#34;method&#34; =&gt; &#34;select&#34;,
                &#34;tableName&#34; =&gt; &#34;advertisementproperties&#34;,
                &#34;conditions&#34; =&gt; array(&#34;advertisementproperties&#34; =&gt; &#34;advertisement_id&#34;, &#34;=&#34; =&gt; 113)
            ),
            &#34;conditions&#34; =&gt; array(&#34;properties&#34; =&gt; &#34;adproperty_id&#34;, &#34;=&#34; =&gt; array(&#34;adproperties&#34; =&gt; &#34;id&#34;))
        )
    ),
    &#34;conditions&#34; =&gt; array(
        &#34;adcategory_id&#34;,
        &#34;=&#34; =&gt; array(
            &#34;query&#34; =&gt; true,
            &#34;method&#34; =&gt; &#34;select&#34;,
            &#34;tableName&#34; =&gt; &#34;advertisements&#34;,
            &#34;selections&#34; =&gt; array(&#34;advertisements&#34; =&gt; &#34;adcategory_id&#34;),
            &#34;fieldAliases&#34; =&gt; array(
                array(
                    &#34;table&#34; =&gt; &#34;advertisements&#34;,
                    &#34;name&#34; =&gt; &#34;adcategory_id&#34;,
                    &#34;alias&#34; =&gt; &#34;adcategory&#34;
                )
            ),
            &#34;conditions&#34; =&gt; array(array(&#34;advertisements&#34; =&gt; &#34;id&#34;, &#34;=&#34; =&gt; 113), &#34;and&#34; =&gt; array(&#34;advertisements&#34; =&gt; &#34;account_id&#34;, &#34;=&#34; =&gt; 1))
        )
    )
));</pre>
<p>This code should definitely do what I would like to do with my SQL Manager Class. Now is the time to get this configuration in to action.<br />
With my old SQL Helper I&#8217;m no where close <img src='http://www.behcetmutlu.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<pre class="prettyprint">SELECT `*`.*, `*`.*, `l_rel`.`l` as `l`, `adproperties`.`_rel`
 FROM `adproperties`
 L JOIN `l` `l_rel` ON `l_rel`.`l` = `adproperties`.`l`
  JOIN `` `_rel` ON `_rel`.`` = `adproperties`.``
 WHERE (
(`advertisements`.`adcategory_id`) and
(`_rel`.`Array`)) and ()</pre>
<p>Some of the generated query is right how it supposed to be. I&#8217;ll start from the selections.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.behcetmutlu.com/blog/building-the-best-sql-manager-with-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Jason Fried: Why work doesn&#8217;t happen at work</title>
		<link>http://www.behcetmutlu.com/blog/jason-fried-why-work-doesnt-happen-at-work/</link>
		<comments>http://www.behcetmutlu.com/blog/jason-fried-why-work-doesnt-happen-at-work/#comments</comments>
		<pubDate>Sat, 28 May 2011 09:41:06 +0000</pubDate>
		<dc:creator>bekco</dc:creator>
				<category><![CDATA[At The Office]]></category>
		<category><![CDATA[Videos]]></category>

		<guid isPermaLink="false">http://www.behcetmutlu.com/blog/?p=149</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<div style="background: none repeat scroll 0pt 0pt black; z-index: -999; width: 640px; height: 390px;" class="listStumble" id="video_box"><embed height="100%" width="100%" allowfullscreen="true" type="application/x-shockwave-flash" flashvars="ap=0&amp;vw=628&amp;vh=305&amp;vu=http://video.ted.com/talks/dynamic/JasonFried_2010X-high.flv" src="http://video.ted.com/assets/player/swf/EmbedPlayer.swf" style="" id="stumblevid" name="stumblevid" bgcolor="#000000" quality="high" wmode="opaque"></div>
]]></content:encoded>
			<wfw:commentRss>http://www.behcetmutlu.com/blog/jason-fried-why-work-doesnt-happen-at-work/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://video.ted.com/talks/dynamic/JasonFried_2010X-high.flv" length="46419519" type="video/x-flv" />
		</item>
		<item>
		<title>Ext JS 3 to 4 Migration (Part 2 of 2)</title>
		<link>http://www.behcetmutlu.com/blog/ext-js-3-to-4-migration-part-2-of-2/</link>
		<comments>http://www.behcetmutlu.com/blog/ext-js-3-to-4-migration-part-2-of-2/#comments</comments>
		<pubDate>Fri, 13 May 2011 13:19:13 +0000</pubDate>
		<dc:creator>bekco</dc:creator>
				<category><![CDATA[Ext JS]]></category>

		<guid isPermaLink="false">http://www.behcetmutlu.com/blog/?p=143</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><iframe src="http://player.vimeo.com/video/23046756?title=0&amp;byline=0&amp;portrait=0" width="640" height="400" frameborder="0"></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://www.behcetmutlu.com/blog/ext-js-3-to-4-migration-part-2-of-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

