<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>I want to be free</title>
	
	<link>http://i1t2b3.com</link>
	<description>Any fool can make things bigger and more complex</description>
	<lastBuildDate>Wed, 11 Apr 2012 12:59:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/i1t2b3com" /><feedburner:info uri="i1t2b3com" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Email address RFC</title>
		<link>http://feedproxy.google.com/~r/i1t2b3com/~3/l7IiwWxYFnU/</link>
		<comments>http://i1t2b3.com/2012/02/28/email-address-rfc/#comments</comments>
		<pubDate>Tue, 28 Feb 2012 17:08:55 +0000</pubDate>
		<dc:creator>Skakunov Alexander</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[fun]]></category>

		<guid isPermaLink="false">http://i1t2b3.com/?p=852</guid>
		<description><![CDATA[It&#8217;s was entertaining to dig into email address format while working on a corresponding task. Here are a few facts that I didn&#8217;t expect to be allowed for email address: the local part of an email address can contain spaces, and it must be quoted and escaped by a back slash like &#8220;\ &#8220; the local [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s was entertaining to dig into email address format while working on a corresponding task.</p>
<p>Here are a few facts that I didn&#8217;t expect to be allowed for email address:</p>
<ul>
<li>the local part of an email address can contain spaces, and it must be quoted and escaped by a back slash like &#8220;\ &#8220;</li>
<li>the local part of an email address can contain comments! It&#8217;s put in parentheses and can be omitted. Example: &#8220;<em>john(comment).smith@example.com</em>&#8221; equals to &#8220;<em>john.smith@example.com</em>&#8220;</li>
<li>domain part can have IP instead of domain. To do that, it must be put in square braces like &#8220;john@[192.168.1.1]&#8220;</li>
</ul>
<p>Here are examples of VALID email addresses:</p>
<ul>
<li><tt>'@[10.10.10.10]</tt></li>
<li><tt>user@[IPv6:2001:db8:1ff::a0b:dbd0]</tt></li>
<li><tt>"much.more\ unusual"@example.com</tt></li>
<li><tt>"very.unusual.@.unusual.com"@example.com</tt></li>
<li><tt>"very.(),:;&lt;&gt;[]\".VERY.\"very@\\\ \"very\".unusual"@strange.example.com</tt></li>
<li><tt>0@a</tt></li>
<li><tt>!#$%&amp;'*+-/=?^_`{}|~@example.org</tt></li>
<li><tt>"()&lt;&gt;[]:;@,\\\"!#$%&amp;'*+-/=?^_`{}|\ \ \ \ \ ~\ \ \ \ \ \ \ ?\ \ \ \ \ \ \ \ \ \ \ \ ^_`{}|~.a"@example.org</tt></li>
<li><tt>""@example.org</tt></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://i1t2b3.com/2012/02/28/email-address-rfc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://i1t2b3.com/2012/02/28/email-address-rfc/</feedburner:origLink></item>
		<item>
		<title>Javascript: indexOf problem in empty array</title>
		<link>http://feedproxy.google.com/~r/i1t2b3com/~3/gzEvOcOhVVo/</link>
		<comments>http://i1t2b3.com/2012/02/03/javascriptindexof-problem-ie/#comments</comments>
		<pubDate>Fri, 03 Feb 2012 17:24:33 +0000</pubDate>
		<dc:creator>Skakunov Alexander</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://i1t2b3.com/?p=848</guid>
		<description><![CDATA[Funny, but indexOf method doesn&#8217;t work in an empty array in Internet Explorer, the method is just not defined. Eh! Forget about that and always use jQuery wrapper &#8211; $.inArray(42, [31, 42, 53]);]]></description>
			<content:encoded><![CDATA[<p>Funny, but <code>indexOf</code> method doesn&#8217;t work in an empty array in Internet Explorer, the method is just not defined. Eh!</p>
<p>Forget about that and always use jQuery wrapper &#8211;
<pre><code class="javascript">$.inArray(42, [31, 42, 53]);</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://i1t2b3.com/2012/02/03/javascriptindexof-problem-ie/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://i1t2b3.com/2012/02/03/javascriptindexof-problem-ie/</feedburner:origLink></item>
		<item>
		<title>Delete Your Code #7: Right encoding</title>
		<link>http://feedproxy.google.com/~r/i1t2b3com/~3/4pzSYeqoxeM/</link>
		<comments>http://i1t2b3.com/2012/02/02/delete-your-code-right-encoding/#comments</comments>
		<pubDate>Thu, 02 Feb 2012 15:19:59 +0000</pubDate>
		<dc:creator>Skakunov Alexander</dc:creator>
				<category><![CDATA[db]]></category>
		<category><![CDATA[delete your code]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[encoding]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://i1t2b3.com/?p=835</guid>
		<description><![CDATA[You might be surprised, but a right choise of the project text encoding can affect the project file size and amount of bugs. To avoid bugs of wrong presentation of text on your page, make sure that all database entities and the application server (PHP) use the same encoding. That helps to forget about issues [...]]]></description>
			<content:encoded><![CDATA[<p>You might be surprised, but a right choise of the project text encoding can affect the project file size and amount of bugs.</p>
<p>To avoid bugs of wrong presentation of text on your page, make sure that all database entities and the application server (PHP) use the same encoding. That helps to forget about issues connected with text presentation.</p>
<p style="text-align: center;"><img class="size-medium wp-image-837 aligncenter" title="bart simpson utf8" src="http://i1t2b3.com/wp-content/uploads/2012/02/bart-simpson-utf81-300x160.gif" alt="" width="300" height="160" /></p>
<p>On database side, make sure you set the correct encoding to:</p>
<ul>
<li>database,</li>
<li>tables,</li>
<li>columns,</li>
<li>import-export tools parameters (a big source of wrong encoding bugs),</li>
<li>corresponding SQL server variables</li>
</ul>
<p>On application server it&#8217;s usually just one query &#8211;
<pre><code class="sql">SET NAMES utf8</code></pre>
<p>Pay attention, that utf8 might be not the best choise for your project: every non-English character needs 2-6 bytes of memory, so if you built a one-language (local) project with lots of database data, consider using a 1 byte encoding like windows-1251 and save about half of the space on server file system.</p>
]]></content:encoded>
			<wfw:commentRss>http://i1t2b3.com/2012/02/02/delete-your-code-right-encoding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://i1t2b3.com/2012/02/02/delete-your-code-right-encoding/</feedburner:origLink></item>
		<item>
		<title>Delete Your Code #6: Admin Panel</title>
		<link>http://feedproxy.google.com/~r/i1t2b3com/~3/-x62Tzy6QXA/</link>
		<comments>http://i1t2b3.com/2012/01/27/delete-your-code-6-admin-panel/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 21:45:45 +0000</pubDate>
		<dc:creator>Skakunov Alexander</dc:creator>
				<category><![CDATA[delete your code]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://i1t2b3.com/?p=829</guid>
		<description><![CDATA[All of web applications I&#8217;ve built have an admin panel. Usually, that panel is a system to manage items: add a product, disable a user, delete a message. All these create-update-delete functions are common, and interface for them can be standard. That&#8217;s a way to kill some code &#8211; instead of creating a custom admin [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://i1t2b3.com/wp-content/uploads/2012/01/admin_generator1.png" alt="" title="admin generator" width="120" height="147" class="alignright size-full wp-image-832" />All of web applications I&#8217;ve built have an admin panel. Usually, that panel is a system to manage items: add a product, disable a user, delete a message.</p>
<p>All these create-update-delete functions are common, and interface for them can be standard.</p>
<p>That&#8217;s a way to kill some code &#8211; instead of creating a custom admin panel, you can build extremely fast a standard one.</p>
<p>One way to do that is to use admin generator tool of Symfony framework. As you can see in <noindex><a rel="nofollow" href="http://www.symfony-project.org/screencast/admin-generator" title="Symfony admin generator">the screencast</a></noindex>, it builds the admin interface automatically based on entities models.</p>
]]></content:encoded>
			<wfw:commentRss>http://i1t2b3.com/2012/01/27/delete-your-code-6-admin-panel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://i1t2b3.com/2012/01/27/delete-your-code-6-admin-panel/</feedburner:origLink></item>
		<item>
		<title>Delete Your Code #5: Use foreign keys</title>
		<link>http://feedproxy.google.com/~r/i1t2b3com/~3/0DaH3LLELiY/</link>
		<comments>http://i1t2b3.com/2011/12/16/delete-your-code-use-f/#comments</comments>
		<pubDate>Thu, 15 Dec 2011 21:52:45 +0000</pubDate>
		<dc:creator>Skakunov Alexander</dc:creator>
				<category><![CDATA[db]]></category>
		<category><![CDATA[delete your code]]></category>

		<guid isPermaLink="false">http://i1t2b3.com/?p=818</guid>
		<description><![CDATA[A foreign key, this classic concept of relational databases, is extremely helpful in many ways. To start with, it&#8217;s a watch dog of your database integrity — for example, it would be impossible to add user images records, if the user does not exist. No additional code, more control. Another benefit is that all depending [...]]]></description>
			<content:encoded><![CDATA[<p>A foreign key, this classic concept of relational databases, is extremely helpful in many ways.</p>
<p><img src="http://i1t2b3.com/wp-content/uploads/2011/12/on-delete-cascade.jpg" alt="" title="on delete cascade" width="200" height="200" class="alignright size-full wp-image-819" />To start with, it&#8217;s a watch dog of your database integrity — for example, it would be impossible to add user images records, if the user does not exist. No additional code, more control.</p>
<p>Another benefit is that all depending data is deleted cascadedly when the parent row gets killed. You remove a user — and voila: all images, comments, ratings and staff fly away too.</p>
<p>And third, it helps to autogenerate admin tools; for instance, in Symfony framework, the generator of admin interface relies on this info.</p>
<p>To be able to use foreign keys in your MySQL database, do 2 following steps:</p>
<ul>
<li>make sure the two tables you are connecting, are driven by InnoDB</li>
<li>ensure that the columns you connect (<code>user_id</code> in our example) are of exactly the same type, including NULL and sign allowance.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://i1t2b3.com/2011/12/16/delete-your-code-use-f/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://i1t2b3.com/2011/12/16/delete-your-code-use-f/</feedburner:origLink></item>
		<item>
		<title>Delete Your Code #4: Ambiguous terms</title>
		<link>http://feedproxy.google.com/~r/i1t2b3com/~3/7Xk8ZPuxb8c/</link>
		<comments>http://i1t2b3.com/2011/12/14/ambiguous-terms/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 21:36:31 +0000</pubDate>
		<dc:creator>Skakunov Alexander</dc:creator>
				<category><![CDATA[delete your code]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[ideas]]></category>

		<guid isPermaLink="false">http://i1t2b3.com/?p=796</guid>
		<description><![CDATA[Every application operates in a knowledge domain. File browser works with files, directories and drives. Library software deals with books and editions. Geo tool must be aware of coordinates. Idea is, developers can save time and lines of code if they agree the terms of the knowledge domain and be strict with it. Of course, [...]]]></description>
			<content:encoded><![CDATA[<p>Every application operates in a knowledge domain.</p>
<p>File browser works with files, directories and drives. Library software deals with books and editions. Geo tool must be aware of coordinates.</p>
<p>Idea is, developers can save time and lines of code if they agree the terms of the knowledge domain and be strict with it.</p>
<p><img src="http://i1t2b3.com/wp-content/uploads/2011/12/signs.jpg" alt="" title="Ambiguous terms" width="200" height="164" class="alignright size-full wp-image-800" />Of course, all of us use some terms — this rule is to use a well defined set of terms and to avoid synonyms.</p>
<p>Examples of these rule violations:</p>
<ul>
<li>&#8220;folder&#8221; vs. &#8220;directory&#8221;;</li>
<li>&#8220;date&#8221; or &#8220;timestamp&#8221;;</li>
<li>&#8220;partner&#8221; a.k.a. &#8220;affiliate&#8221;;</li>
<li>&#8220;DNS Provider&#8221; as &#8220;product supplier&#8221;;</li>
<li>short for &#8220;longitude&#8221; is &#8220;lon&#8221; or &#8220;lng&#8221;?</li>
<li>does &#8220;website address&#8221; differ from &#8220;URL&#8221;?</li>
<li>&#8220;region&#8221;, &#8220;area&#8221; and &#8220;subarea&#8221; &mdash; in contrast to ADM1, ADM2 and ADM3;</li>
<li>the application I deal with at my job has: &#8220;brand&#8221;, &#8220;model&#8221;, &#8220;market&#8221; and &#8220;platform&#8221;, which are also often called &#8220;manufacturer&#8221;, &#8220;vehicle&#8221;, &#8220;locale&#8221; and &#8220;client&#8221; respectively.</li>
</ul>
<p>If you apply this rule, you will not waste time creating the multiple mapper classes. More reusage, more OOP inheritance, more rapport. More motivation to work on a solid, well defined project with people, you talk the same language with. Isn&#8217;t this nice?</p>
]]></content:encoded>
			<wfw:commentRss>http://i1t2b3.com/2011/12/14/ambiguous-terms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://i1t2b3.com/2011/12/14/ambiguous-terms/</feedburner:origLink></item>
		<item>
		<title>Detect if city is within area</title>
		<link>http://feedproxy.google.com/~r/i1t2b3com/~3/57_OcRPuFYA/</link>
		<comments>http://i1t2b3.com/2011/12/13/detect-if-city-is-within-area/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 18:58:36 +0000</pubDate>
		<dc:creator>Skakunov Alexander</dc:creator>
				<category><![CDATA[db]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[geo]]></category>

		<guid isPermaLink="false">http://i1t2b3.com/?p=778</guid>
		<description><![CDATA[We at SunnyRentals are working a lot with geo data. The last task I was solving was inclusion of all cities in a touristic regions bounds automatically. Yes, there are MySQL spatial data types, so region border and cities coordinates can be stored in native data types, but the processing functions are not implemented right: [...]]]></description>
			<content:encoded><![CDATA[<p>We at SunnyRentals are working a lot with geo data. </p>
<p>The last task I was solving was inclusion of all cities in a touristic regions bounds automatically.</p>
<p>Yes, there are <a rel="nofollow" href="http://dev.mysql.com/doc/refman/5.1/en/mysql-spatial-datatypes.html">MySQL spatial data types</a>, so region border and cities coordinates can be stored in native data types, but the processing functions are not implemented right: they only operate on MBRs (minimum bounding rectangles) to make things simpler&#8230;</p>
<p><img src="http://i1t2b3.com/wp-content/uploads/2011/12/284_theory_fig_one1.png" alt="" title="point in polygon" width="200" height="148" class="alignright size-full wp-image-793" />So, let&#8217;s create our own MySQL function for that.</p>
<p>There are different approaches to distinguish if a point is within a given polygon. I prefered the way to iterate the edges of the polygon and check where the point relatively to the edge is &#8211; at right or at left; if the point is always at the same side, it lies within the border.</p>
<p>So we came to a fact that we need 2 functions:</p>
<ol>
<li>Distinguish the side at which the point lies from the line</li>
<li>Check that for every edge in the polygon.</li>
</ol>
<p>Here is the first function: <code class="sql">
<pre>DELIMITER //

DROP FUNCTION `GetPointPositionOfLine`//
CREATE FUNCTION `GetPointPositionOfLine`( a POINT, b POINT, p POINT) RETURNS tinyint NO SQL
  COMMENT 'Distinguish the side at which the point lies from the line'
BEGIN
  DECLARE s DOUBLE;
  SET s = (X(b) - X(a))*(Y(p) - Y(a)) - (Y(b) - Y(a))*(X(p) - X(a));
  IF s &gt; 0 THEN
    RETURN 1;
  END IF;
  IF s &lt; 0 THEN
    RETURN -1;
  END IF;
  RETURN 0;
END //</pre>
<p></code><br />
All three params are of type POINT. Points <code>a</code> and <code>b</code> are the beginning and end of the line. Point <code>p</code> is the point we check.</p>
<p>Here is the main function: <code class="sql">
<pre>DELIMITER //

DROP FUNCTION `IsPointWithin`//
CREATE FUNCTION `IsPointWithin`( ls LINESTRING, p POINT) RETURNS tinyint(1) NO SQL
BEGIN
  DECLARE i INT;
  DECLARE a, b POINT;
  DECLARE LineStringNumPoints INT;
  DECLARE Position, PrevPosition TINYINT;

  SET i = 1;
  SET PrevPosition = 0;
  SET LineStringNumPoints = NumPoints(ls);

  WHILE i &lt;= LineStringNumPoints DO
    SET a = PointN( ls, i);
    IF i = LineStringNumPoints THEN
      SET b = StartPoint( ls);
    ELSE
      SET b = PointN( ls, i+1);
    END IF;

    SET Position = GetPointPositionOfLine( a, b, p);
    IF Position &lt;&gt; 0 THEN
      IF Position &lt;&gt; PrevPosition AND PrevPosition &lt;&gt; 0 THEN
        RETURN FALSE;
      END IF;
      SET PrevPosition = Position;
    END IF;
    SET i = i + 1;
  END WHILE;
  RETURN TRUE;
END //</pre>
<p></code><br />
It checks if a point <code>p</code> lies within a polygon of type LINESTRING.</p>
<p>Usage example. Given you have coordinates of cities in the separate float columns (to keep them readable) <code>lat</code> and <code>lng</code> of <code>city</code> table, and the polygon is given as a string too &mdash; but of course you can use a column of type LINESTRING:<br />
<code class="sql">
<pre>SELECT *
FROM `city` c
WHERE IsPointWithin(GeomFromText('LINESTRING(4 8, 15 16, 23 42)'), POINT(c.`lat`, c.`lng`));
</pre>
<p></code></p>
<p>The solution works pretty fast, especially if you first limit the cities by the rectangle that the polygon lies in.</p>
]]></content:encoded>
			<wfw:commentRss>http://i1t2b3.com/2011/12/13/detect-if-city-is-within-area/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://i1t2b3.com/2011/12/13/detect-if-city-is-within-area/</feedburner:origLink></item>
		<item>
		<title>Delete Your Code #3: shorter script and style tags</title>
		<link>http://feedproxy.google.com/~r/i1t2b3com/~3/dFI2K1Iz7p0/</link>
		<comments>http://i1t2b3.com/2011/12/08/delete-your-code-short-script-style-tags/#comments</comments>
		<pubDate>Thu, 08 Dec 2011 06:54:42 +0000</pubDate>
		<dc:creator>Skakunov Alexander</dc:creator>
				<category><![CDATA[delete your code]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://i1t2b3.com/?p=764</guid>
		<description><![CDATA[At my previous job a team leader was a firm believer that &#60;script&#62; tag must be always written in a full form like: &#60;script type="text/javascript"&#62; When you have lots of javascript pieces, it becomes exhausting. Good news, there is a way to tell to browser, that default script language is JavaScript. To do that, inlcude [...]]]></description>
			<content:encoded><![CDATA[<p>At my previous job a team leader was a firm believer that <code>&lt;script&gt;</code> tag must be always written in a full form like:</p>
<p><code class="html">
<pre>&lt;script type="text/javascript"&gt;</pre>
<p></code></p>
<p>When you have lots of javascript pieces, it becomes exhausting.</p>
<p>Good news, there is a way to tell to browser, that default script language is JavaScript.</p>
<p>To do that, inlcude a special META-tag in the HEAD of your HTML document.  So if you have an inline JavaScript code for a onclick attribute of a tag, browser has no doubts it&#8217;s JavaScript.</p>
<p>Anyway, I include these lines in my projects HTML:<br />
<code class="html">
<pre>&lt;meta http-equiv="Content-Script-Type" content="text/javascript" /&gt;</pre>
<p></code></p>
<p>After that you can have just this:<br />
<code class="html">
<pre>&lt;script&gt;</pre>
<p></code></p>
<p>By the way, since it&#8217;s <code>http-equiv</code> stuff, you can set it at server side.</p>
<p>P.S. There is the same trick for CSS, but it&#8217;s seems there are no alternatives to write styles, so it is useless.</p>
]]></content:encoded>
			<wfw:commentRss>http://i1t2b3.com/2011/12/08/delete-your-code-short-script-style-tags/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://i1t2b3.com/2011/12/08/delete-your-code-short-script-style-tags/</feedburner:origLink></item>
		<item>
		<title>Delete Your Code #2: less OOP visibility keywords</title>
		<link>http://feedproxy.google.com/~r/i1t2b3com/~3/R6vDd0hc4Ro/</link>
		<comments>http://i1t2b3.com/2011/12/06/delete-your-code-1-less-oop-visibility-keywords/#comments</comments>
		<pubDate>Tue, 06 Dec 2011 17:17:11 +0000</pubDate>
		<dc:creator>Skakunov Alexander</dc:creator>
				<category><![CDATA[delete your code]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[ideas]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://i1t2b3.com/?p=740</guid>
		<description><![CDATA[Hey! I gonna describe tricks that I use to have less code. Why it is important to have less code, you ask? Less code means less bugs, less support, less developer brains waste. Today&#8217;s trick is extremely simple &#8212; when you have a long set of public, protected or private class properties, remove the visibility [...]]]></description>
			<content:encoded><![CDATA[<p>Hey! I gonna describe tricks that I use to have less code. Why it is important to have less code, you ask? Less code means less bugs, less support, less developer brains waste.</p>
<p>Today&#8217;s trick is extremely simple &mdash; when you have a long set of <code>public</code>, <code>protected</code> or <code>private</code> class properties, remove the visibility keyword set to each declaration but define it once as comma separated declaration.</p>
<p>Same applies to class constants as well.</p>
<p>Example:</p>
<p><code class="php">
<pre>// Before:
class Cat {
    const KINGDOM = 'Animalia';
    const PHYLUM  = 'Chordata';
    const FAMILY  = 'Felidae';

    public $tail;
    public $whisker = '\/';
    public $head;
    public $legs = array(1,2,3,4);
}
</pre>
<p></code></p>
<p><code class="php">
<pre>// After:
class Cat {
    const
        KINGDOM = 'Animalia',
        PHYLUM  = 'Chordata',
        FAMILY  = 'Felidae';

    public
        $tail,
        $whisker  = '\/',
        $head,
        $legs = array(1,2,3,4);
}
</pre>
<p></code></p>
<p>One benefit is that the code looks clear and it&#8217;s much easier to scan rather then to read.</p>
<p>Second benefit is when you need to change the visibility for a property, you don&#8217;t have to edit the visibility keyword near the property name (which might be an error prone process when you are tired) &mdash; you just move the line up or down, which usually has a shortcut in IDE.</p>
<p>Known disadvantage is that most documenting engines don&#8217;t support this ferature.</p>
]]></content:encoded>
			<wfw:commentRss>http://i1t2b3.com/2011/12/06/delete-your-code-1-less-oop-visibility-keywords/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://i1t2b3.com/2011/12/06/delete-your-code-1-less-oop-visibility-keywords/</feedburner:origLink></item>
		<item>
		<title>6 points against writing an own CMS</title>
		<link>http://feedproxy.google.com/~r/i1t2b3com/~3/GxgOMI1CkeE/</link>
		<comments>http://i1t2b3.com/2011/07/25/6-points-against-writing-own-cms/#comments</comments>
		<pubDate>Mon, 25 Jul 2011 19:50:29 +0000</pubDate>
		<dc:creator>Skakunov Alexander</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[ideas]]></category>

		<guid isPermaLink="false">http://i1t2b3.com/?p=734</guid>
		<description><![CDATA[Once upon a time I was asked at my job to work on company website. There was a choice among existing CMS for the website to be driven by, plus I could think about implemention of something of my own &#8212; but you know what? I didn&#8217;t feel comfortable to start a CMS from scratch. [...]]]></description>
			<content:encoded><![CDATA[<p>Once upon a time I was asked at my job to work on company website. There was a choice among existing CMS for the website to be driven by, plus I could think about implemention of something of my own &mdash; but you know what? I didn&#8217;t feel comfortable to start a CMS from scratch. Now I know why, exactly.</p>
<p>I found this nice article called <noindex><a rel="nofollow" href="http://www.contenthere.net/2007/07/homebrew-cms.html">Homebrew CMS</a> (by Seth Gottlieb)</noindex>, which lists six points of a modern content management system which you as architect should consider before a start:</p>
<ol>
<li>Versioning &mdash; it makes data model much more sophisticated;</li>
<li>Localization &mdash; should images be translated, what is your default language, etc;</li>
<li>Preview &mdash; the content being previewed must be connected with all the website and not visible to others;</li>
<li>Deployment &mdash; dependency management like images which are pasted in the content;</li>
<li>Usability &mdash;  <i>is probably the most common reason why companies abandon their home grown CMS;</i></li>
<li>Access control &mdash; your system must control not functions only, but also the data.</li>
</ol>
<p>All in all, an open source free CMS might be the best choice for you too. Spare your energy for something else.</p>
]]></content:encoded>
			<wfw:commentRss>http://i1t2b3.com/2011/07/25/6-points-against-writing-own-cms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://i1t2b3.com/2011/07/25/6-points-against-writing-own-cms/</feedburner:origLink></item>
	</channel>
</rss>

