<?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>Another blog</title>
	<atom:link href="http://flakron.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://flakron.net</link>
	<description></description>
	<lastBuildDate>Wed, 07 Sep 2011 20:22:47 +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>Integer to Hexadecimal</title>
		<link>http://flakron.net/2011/09/07/integer-to-hexadecimal/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=integer-to-hexadecimal</link>
		<comments>http://flakron.net/2011/09/07/integer-to-hexadecimal/#comments</comments>
		<pubDate>Wed, 07 Sep 2011 20:22:47 +0000</pubDate>
		<dc:creator>Flakron Bytyqi</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://flakron.net/?p=160</guid>
		<description><![CDATA[Today, I was asked how to convert an integer to hexadecimal, at first I thought I remembered it, sat down and got blocked. Well I didn&#8217;t remember, well that was embarrassing. So I learned it again (imagine how I felt when I found how stupid I was). Lets start. First step, take one number (integer ... <a href="http://flakron.net/2011/09/07/integer-to-hexadecimal/">Continue Reading</a>]]></description>
			<content:encoded><![CDATA[<p>Today, I was asked how to convert an integer to hexadecimal, at first I thought I remembered it, sat down and got blocked. Well I didn&#8217;t remember, well that was embarrassing. So I learned it again (imagine how I felt when I found how stupid I was). Lets start.</p>
<p>First step, take one number (integer of course), 23 for example</p>
<p>Second step,  divide our number by 16 and write down the remainder (in our case it&#8217;s 7, and the result is 1)</p>
<p>Third step, divide the result again with 16 (result is 0 and the remainder is 1)</p>
<p>Fourth step, take the remainders from the last, in our case it&#8217;s 1 7 so the hexadecimal representation of number 23 is 17.</p>
<p>&nbsp;</p>
<p>See you in the next step</p>
]]></content:encoded>
			<wfw:commentRss>http://flakron.net/2011/09/07/integer-to-hexadecimal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The early morning post</title>
		<link>http://flakron.net/2010/10/26/the-early-morning-post/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=the-early-morning-post</link>
		<comments>http://flakron.net/2010/10/26/the-early-morning-post/#comments</comments>
		<pubDate>Tue, 26 Oct 2010 05:51:51 +0000</pubDate>
		<dc:creator>Flakron Bytyqi</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://flakron.net/?p=147</guid>
		<description><![CDATA[Everyone, sometime, has their early morning post, well this is mine. What I decided to talk about is MySQL and Java as a background service  (While listening to &#8220;The Deep Dark Woods &#8211; Charlie&#8217;s (Is Coming Down)&#8221;). Hell of a combination. MySQL (version any, mine is 5.0xx for production, 5.1 local) Whenever you build a ... <a href="http://flakron.net/2010/10/26/the-early-morning-post/">Continue Reading</a>]]></description>
			<content:encoded><![CDATA[<p>Everyone, sometime, has their early morning post, well this is mine.</p>
<p>What I decided to talk about is MySQL and Java as a background service  (While listening to &#8220;The Deep Dark Woods &#8211; Charlie&#8217;s (Is Coming Down)&#8221;). Hell of a combination.</p>
<p><span style="font-size: medium;"><strong><br />
</strong></span></p>
<p><span style="font-size: medium;"><strong>MySQL (version any, mine is 5.0xx for production, 5.1 local)</strong></span></p>
<p>Whenever you build a database from scratch, please, please (I&#8217;m begging on my knees), if you have no idea and no clue, contact someone and ask for advice. Why?</p>
<p>1. Whenever you leave that database to someone else, that someone will be fucked.</p>
<p>2. You will be fucked</p>
<p>3. You again will be fucked</p>
<p>You might ask, what is this double-fucking of your self? Well when deciding your column data types also including database engine (Innodb or MyISAM?), when having a small database up to 10 000 records on some table with varchar type for a column that holds a unix timestamp or something of the same kind, you might not see the difference in the speed. But what if those records multiply to a range from 10 000 to the 100 000 000 or more? Well this where the fucking begins. You might remember the golden times when every query would last at most 0.00016, but now those are over and a simple</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #993333; font-weight: bold;">COUNT</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">FROM</span> some_table</pre></div></div>

<p>lasts at least 2sec &#8211; 3sec, and</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span> id<span style="color: #66cc66;">,</span> some_column<span style="color: #66cc66;">,</span> some_other_column <span style="color: #993333; font-weight: bold;">FROM</span> some_table <span style="color: #993333; font-weight: bold;">WHERE</span> some_very_other_column &amp;gt; <span style="color: #cc66cc;">2456789</span></pre></div></div>

<p>will last 15 sec. You really don&#8217;t want to see this. Well I had to fix it.</p>
<p>What are the golden steps to the enlightening of our poor hearts and minds with proper knowledge to apply changes to the database for a decent speed up?</p>
<p>1. Convert all the column data types to what they should be</p>
<p>If a column holds only int(11) types, please make sure the column is of that type, If it holds a decimal(8,8) value, make it a such value. (This will give you a performance boost, so big that your ego will explode)</p>
<p>2. When querying the database with</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span> id<span style="color: #66cc66;">,</span> some_column<span style="color: #66cc66;">,</span> some_other_column <span style="color: #993333; font-weight: bold;">FROM</span> some_table <span style="color: #993333; font-weight: bold;">WHERE</span> some_very_other_column &amp;gt; <span style="color: #cc66cc;">2456789</span></pre></div></div>

<p>you might think, what the hell should I speed up here? Well let me give you the golden and damn simple solution</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span> some_table<span style="color: #66cc66;">.</span>id<span style="color: #66cc66;">,</span> some_table<span style="color: #66cc66;">.</span>some_column<span style="color: #66cc66;">,</span> some_table<span style="color: #66cc66;">.</span>some_other_column <span style="color: #993333; font-weight: bold;">FROM</span> some_table <span style="color: #993333; font-weight: bold;">WHERE</span> some_table<span style="color: #66cc66;">.</span>some_very_other_column &amp;gt; <span style="color: #cc66cc;">2456789</span></pre></div></div>

<p>This will get you your results from your grandma speed database for about 10%-20% faster. You ask why? Read the MySQL documentation it has the right answer for you</p>
<p>With only these 2 steps, you got yourself a 510%-520% database boost. If you read more from the MySQL documentation you might even get more speed and reliability from your database.</p>
<p><span style="font-size: medium;"><strong>Java as a background service</strong></span></p>
<p>You have now evolved, from the scratchy monkey, to this high skilled ninja, and are writing java applications that take hundreds of information per second. You are in your golden age. But hell the server is going down every 2-3 days, even if it has installed the almighty GNU/Linux some flashy speedy distro. You see the services crashing with the &#8220;too many open files in system&#8221;, you have no clue what that is, until you read something which happens rarely, and find out that you might as well increase the system limits to 10000 with &#8216;ulimit -n 10000&#8242;. And now you are the king of the hill or your chair at least.</p>
<p>4 days have passed and the server hasn&#8217;t gone down, nor it&#8217;s services are crashing. Damn that feels good, just as you are about to drink your glorious coffee, made from best coffee makers of the world (Nescaffe Classic), your services start to go down as if I was shooting them down with a AK47 from 1 meter distance.</p>
<p>There is one solution to this, usually there is this application not to name it (of course it is your java app) that opens some connections but doesn&#8217;t close them all properly after receiving/sending information. You think that all the connections are closed after a while, but what if I told you that only 80% of those connections are closed while 20% stay in CLOSE_WAIT (ask google what it is) state. They stay in that state, since the network (internet of course) where we chat, play games and watch porn, isn&#8217;t reliable at all. It looses packets, it even mutilates them to the unknown.</p>
<p>The simplest solution to this is: close your beautiful sockets, that&#8217;s all, really, I mean it. Of course some times you might still encounter problems, but this will save your ass from getting fired today, tomorrow you get the chance to screw something else.</p>
<p>After a bunch of dirty words and a shoot down with AK47, I end it here. Bye, see you in the next post (hopefully with a job :p).</p>
]]></content:encoded>
			<wfw:commentRss>http://flakron.net/2010/10/26/the-early-morning-post/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Document templates with odtPHP and CodeIgniter 1.7.2</title>
		<link>http://flakron.net/2010/08/27/document-templates-with-odtphp-and-codeigniter-1-7-2/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=document-templates-with-odtphp-and-codeigniter-1-7-2</link>
		<comments>http://flakron.net/2010/08/27/document-templates-with-odtphp-and-codeigniter-1-7-2/#comments</comments>
		<pubDate>Fri, 27 Aug 2010 18:28:16 +0000</pubDate>
		<dc:creator>Flakron Bytyqi</dc:creator>
				<category><![CDATA[1.7.x]]></category>
		<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[Framework]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP4]]></category>
		<category><![CDATA[PHP5]]></category>

		<guid isPermaLink="false">http://flakron.net/?p=134</guid>
		<description><![CDATA[If you want to generate documents from your data (database, xml or any other source), I’ve found that odtPHP does a very good job. So here is a simple tutorial on how to use this library. 1. Download odtPHP from http://www.odtphp.com/index.php?i=download 2. Extract the zip file somewhere where you like, you will see there will ... <a href="http://flakron.net/2010/08/27/document-templates-with-odtphp-and-codeigniter-1-7-2/">Continue Reading</a>]]></description>
			<content:encoded><![CDATA[<p>If you want to generate documents from your data (database, xml or any other source), I’ve found that odtPHP does a very good job. So here is a simple tutorial on how to use this library.</p>
<p>1. Download odtPHP from http://www.odtphp.com/index.php?i=download</p>
<p>2. Extract the zip file somewhere where you like, you will see there will be two folders “library” and “tests”. Rename the “library” folder to “odtPHP” and put it in your codeigniter “plugin” folder.</p>
<p>3. In the plugin folder create the file “odf_pi.php”, and put this content inside</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;odtPHP/odf.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>4. For the library to work, you need a temporary folder where odfPHP can write to when generating the document. Create a folder in the root of your application, name it for example “tmp”, then open your index.php file of your CI app, and put this line</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'TMP_PATH'</span><span style="color: #339933;">,</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">SELF</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'tmp/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>just beneath this line</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'BASEPATH'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$system_folder</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>5. Open file “odf.php”, you’ve got this array at the beginning of the file</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000088;">$config</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
        <span style="color: #0000ff;">'ZIP_PROXY'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'PclZipProxy'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'DELIMITER_LEFT'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'{'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'DELIMITER_RIGHT'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'}'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'PATH_TO_TMP'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">null</span>
       <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>replace</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #0000ff;">'PATH_TO_TMP'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">null</span></pre></div></div>

<p>with</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #0000ff;">'PATH_TO_TMP'</span> <span style="color: #339933;">=&gt;</span> TMP_PATH</pre></div></div>

<p>With this final step, the configuration is done. Now here is a simple function on how to use the plugin.</p>
<p>When creating the template with Open Office, make sure you put the variables to be filled, like in this example</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">{title}</pre></div></div>

<p>function code to export the generated document</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">plugin</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'odf'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//path of the template file</span>
<span style="color: #000088;">$odf</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> odf<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;assets/odt/template.odt&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//fill the template with the variables</span>
<span style="color: #000088;">$odf</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setVars</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'title'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Hello World!!!'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//export the file</span>
<span style="color: #000088;">$odf</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">exportAsAttachedFile</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'export.odt'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://flakron.net/2010/08/27/document-templates-with-odtphp-and-codeigniter-1-7-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>First official project</title>
		<link>http://flakron.net/2010/07/05/first-official-project/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=first-official-project</link>
		<comments>http://flakron.net/2010/07/05/first-official-project/#comments</comments>
		<pubDate>Mon, 05 Jul 2010 07:09:00 +0000</pubDate>
		<dc:creator>Flakron Bytyqi</dc:creator>
				<category><![CDATA[FB.Auth]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[project]]></category>

		<guid isPermaLink="false">http://flakron.net/?p=96</guid>
		<description><![CDATA[Last night (very late night), I decided to start my first official project. Check it out here FB.Auth]]></description>
			<content:encoded><![CDATA[<p>Last night (very late night), I decided to start my first official project.</p>
<p>Check it out here <a href="http://flakron.net/?page_id=25">FB.Auth</a></p>
]]></content:encoded>
			<wfw:commentRss>http://flakron.net/2010/07/05/first-official-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ajax IE caching problems</title>
		<link>http://flakron.net/2010/07/01/ajax-ie-caching-problems/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=ajax-ie-caching-problems</link>
		<comments>http://flakron.net/2010/07/01/ajax-ie-caching-problems/#comments</comments>
		<pubDate>Thu, 01 Jul 2010 08:34:35 +0000</pubDate>
		<dc:creator>Flakron Bytyqi</dc:creator>
				<category><![CDATA[6.x]]></category>
		<category><![CDATA[7.x]]></category>
		<category><![CDATA[8.x]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Internet Explorer]]></category>

		<guid isPermaLink="false">http://flakron.net/?p=84</guid>
		<description><![CDATA[Yesterday, half of my day instead of doing productive work, I spent it searching to find a solutions so that IE (Internet Explorer), stops caching ajax get results. Found several suggestions, but the one that worked for me was this &#60;meta http-equiv='expires' content='0'&#62; &#60;meta http-equiv='pragma' content='no-cache'&#62; Hope it helps anyone as it did me.]]></description>
			<content:encoded><![CDATA[<p>Yesterday, half of my day instead of doing productive work, I spent it searching to find a solutions so that IE (Internet Explorer), stops caching ajax get results. Found several suggestions, but the one that worked for me was this</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;meta http-equiv='expires' content='0'&gt;
&lt;meta http-equiv='pragma' content='no-cache'&gt;</pre></div></div>

<p>Hope it helps anyone as it did me.</p>
]]></content:encoded>
			<wfw:commentRss>http://flakron.net/2010/07/01/ajax-ie-caching-problems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CodeIgniter 1.7.x and Timezone</title>
		<link>http://flakron.net/2010/04/01/codeigniter-1-7-x-and-timezone/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=codeigniter-1-7-x-and-timezone</link>
		<comments>http://flakron.net/2010/04/01/codeigniter-1-7-x-and-timezone/#comments</comments>
		<pubDate>Thu, 01 Apr 2010 07:18:24 +0000</pubDate>
		<dc:creator>Flakron Bytyqi</dc:creator>
				<category><![CDATA[1.7.x]]></category>
		<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://flakron.net/?p=67</guid>
		<description><![CDATA[Just yesterday I saw a post on the Codeigniter forum, it was a question about setting the timezone every time a query is run. I had a similar problem before so this is the solution I used class Master_model extends Model&#123; public function __construct&#40;&#41;&#123; parent::__construct&#40;&#41;; &#160; $this-&#62;set_timezone&#40;&#41;; &#125; &#160; public function set_timezone&#40;&#41;&#123; $this-&#62;db-&#62;query&#40;&#34;SET time_zone='+0:00'&#34;&#41;; &#125; ... <a href="http://flakron.net/2010/04/01/codeigniter-1-7-x-and-timezone/">Continue Reading</a>]]></description>
			<content:encoded><![CDATA[<p>Just yesterday I saw a post on the Codeigniter forum, it was a question about setting the timezone every time a query is run. I had a similar problem before so this is the solution I used</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> Master_model <span style="color: #000000; font-weight: bold;">extends</span> Model<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        parent<span style="color: #339933;">::</span>__construct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_timezone</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> set_timezone<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SET time_zone='+0:00'&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> Some_model <span style="color: #000000; font-weight: bold;">extends</span> Master_model<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        parent<span style="color: #339933;">::</span>__construct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>By using this method I can write custom functions and logic that I can use in other models without repeating the same code every time.</p>
<p>See you in the next post.</p>
]]></content:encoded>
			<wfw:commentRss>http://flakron.net/2010/04/01/codeigniter-1-7-x-and-timezone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP 4&amp;5 constructor</title>
		<link>http://flakron.net/2010/03/30/php-45-constructor/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-45-constructor</link>
		<comments>http://flakron.net/2010/03/30/php-45-constructor/#comments</comments>
		<pubDate>Tue, 30 Mar 2010 10:50:48 +0000</pubDate>
		<dc:creator>Flakron Bytyqi</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP4]]></category>
		<category><![CDATA[PHP5]]></category>

		<guid isPermaLink="false">http://flakron.net/?p=61</guid>
		<description><![CDATA[When developing different kind of applications, there will come a time when you&#8217;ll be deploying your application in different versions of php (4.x or 5.x). Several times I had to go through the php classes and modify the php contructor from /** * PHP 4 Compatible Constructor */ function myClass&#40;&#41; &#123; //some code here &#125; ... <a href="http://flakron.net/2010/03/30/php-45-constructor/">Continue Reading</a>]]></description>
			<content:encoded><![CDATA[<p>When developing different kind of applications, there will come a time when you&#8217;ll be deploying your application in different versions of php (4.x or 5.x). Several times I had to go through the php classes and modify the php contructor from</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
* PHP 4 Compatible Constructor
*/</span>
<span style="color: #000000; font-weight: bold;">function</span> myClass<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
	<span style="color: #666666; font-style: italic;">//some code here</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>to</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
* PHP 5 Constructor
*/</span>
<span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">//some code here</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>and lately to save myself from the stupidity, I combined these two to this</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
* PHP 4 Compatible Constructor
*/</span>
<span style="color: #000000; font-weight: bold;">function</span> myClass<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
	<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>__construct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009933; font-style: italic;">/**
* PHP 5 Constructor
*/</span>
<span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">//some code here</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>With this little change your application will be a bit more near compatibility to php4 and php5.</p>
<p>See you on the next post.</p>
]]></content:encoded>
			<wfw:commentRss>http://flakron.net/2010/03/30/php-45-constructor/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MySQL 5.x Data Types – String Types – CHAR and VARCHAR &#8211; Day 3</title>
		<link>http://flakron.net/2010/03/01/mysql-5-x-data-types-%e2%80%93-string-types-%e2%80%93-char-and-varchar/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mysql-5-x-data-types-%25e2%2580%2593-string-types-%25e2%2580%2593-char-and-varchar</link>
		<comments>http://flakron.net/2010/03/01/mysql-5-x-data-types-%e2%80%93-string-types-%e2%80%93-char-and-varchar/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 20:18:50 +0000</pubDate>
		<dc:creator>Flakron Bytyqi</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://flakron.net/?p=53</guid>
		<description><![CDATA[CHAR and VARCHAR data types are pretty similar but with some differences between them. CHAR is saved in fixed length (the same length you used when declaring the column), whilst VARCHAR is saved in variable length. Lets take an example, using this table CREATE TABLE lengths&#40; column_char CHAR&#40;5&#41;, column_varchar VARCHAR&#40;5&#41; &#41;; If I insert two ... <a href="http://flakron.net/2010/03/01/mysql-5-x-data-types-%e2%80%93-string-types-%e2%80%93-char-and-varchar/">Continue Reading</a>]]></description>
			<content:encoded><![CDATA[<p>CHAR and VARCHAR data types are pretty similar but with some differences between them.</p>
<p>CHAR is saved in fixed length (the same length you used when declaring the column), whilst VARCHAR is saved in variable length. Lets take an example, using this table</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> lengths<span style="color: #66cc66;">&#40;</span>
	column_char <span style="color: #993333; font-weight: bold;">CHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
	column_varchar <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>If I insert two values in the table, like</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> lengths<span style="color: #66cc66;">&#40;</span>column_char<span style="color: #66cc66;">,</span> column_varchar<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'yes'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'yes'</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>In the column that saves the data in VARCHAR the size will be 3 bytes, while in CHAR it will be 5 bytes (why the hell?? Remember fixed length and variable length). Depending on MySQL version CHAR and VARCHAR might be handled differently upon insertion and extraction, for further details visit the MySQL documentation site.</p>
<p>Many times I&#8217;ve seen that file contents are saved in a VARCHAR, please avoid that use BLOB data type, that&#8217;s why it&#8217;s been invented.</p>
<p>See you in the next post.</p>
]]></content:encoded>
			<wfw:commentRss>http://flakron.net/2010/03/01/mysql-5-x-data-types-%e2%80%93-string-types-%e2%80%93-char-and-varchar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL 5.x Data Types – String Types &#8211; Day 2</title>
		<link>http://flakron.net/2010/02/25/mysql-5-x-data-types-%e2%80%93-string-types-day-2/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mysql-5-x-data-types-%25e2%2580%2593-string-types-day-2</link>
		<comments>http://flakron.net/2010/02/25/mysql-5-x-data-types-%e2%80%93-string-types-day-2/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 21:36:37 +0000</pubDate>
		<dc:creator>Flakron Bytyqi</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://flakron.net/?p=49</guid>
		<description><![CDATA[I am starting with String data types of MySQL. Categorized under string data types in MySQL, we have these types CHAR and VARCHAR types BINARY and VARBINARY types BLOB and TEXT types ENUM type SET type Following the next posts, I will explain each of them and their usage. See you in the next post.]]></description>
			<content:encoded><![CDATA[<p>I am starting with String data types of MySQL.</p>
<p>Categorized under string data types in MySQL, we have these types</p>
<ol>
<li>CHAR and VARCHAR types</li>
<li>BINARY and VARBINARY types</li>
<li>BLOB and TEXT types</li>
<li>ENUM type</li>
<li>SET type</li>
</ol>
<p>Following the next posts, I will explain each of them and their usage.</p>
<p>See you in the next post.</p>
]]></content:encoded>
			<wfw:commentRss>http://flakron.net/2010/02/25/mysql-5-x-data-types-%e2%80%93-string-types-day-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP count() function</title>
		<link>http://flakron.net/2010/02/24/php-count-function/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-count-function</link>
		<comments>http://flakron.net/2010/02/24/php-count-function/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 13:16:53 +0000</pubDate>
		<dc:creator>Flakron Bytyqi</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://flakron.net/?p=46</guid>
		<description><![CDATA[Today while working I needed to count an array, I knew the function count(), everything was working, until the array was empty, in which case count() function was returning 1. It was wrong, in which case, a solution to all this misunderstanding was this simple code snippet if&#40;is_array&#40;$list_of_something&#41;&#41; &#123; $count = count&#40;$list_of_something&#41;; //some other code ... <a href="http://flakron.net/2010/02/24/php-count-function/">Continue Reading</a>]]></description>
			<content:encoded><![CDATA[<p>Today while working I needed to count an array, I knew the function count(), everything was working, until the array was empty, in which case count() function was returning 1. It was wrong, in which case, a solution to all this misunderstanding was this simple code snippet</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$list_of_something</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
     <span style="color: #000088;">$count</span> <span style="color: #339933;">=</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$list_of_something</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #666666; font-style: italic;">//some other code</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://flakron.net/2010/02/24/php-count-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

