<?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>Dmitri's Blog &#187; PHP</title>
	<atom:link href="http://www.dmitri.me/blog/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dmitri.me/blog</link>
	<description>Dmitri Smirnov. Web development in Estonia.</description>
	<lastBuildDate>Tue, 10 Aug 2010 12:07:30 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Isikukoodi valideerimine</title>
		<link>http://www.dmitri.me/blog/isikukood-valideerimine/</link>
		<comments>http://www.dmitri.me/blog/isikukood-valideerimine/#comments</comments>
		<pubDate>Fri, 29 May 2009 09:29:07 +0000</pubDate>
		<dc:creator>Dmitri</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Eesti]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Rury]]></category>

		<guid isPermaLink="false">http://www.dmitri.me/blog/?p=258</guid>
		<description><![CDATA[Leidsin täna seda → Isikukood. Algoritm on selge aga näidese kood on räpp&#8230;
Siis&#8230;
Versioon PHP by Setor
Versioon PHP 2 by MiamiBC (kõige lihtsam ja arusaadavam)
Java version by Incubo
Minu versioon Ruby keeles
Mika Tuupola versioon JavaScript
Kui sul on mingi teine versioon siis saada mulle ka  
]]></description>
			<content:encoded><![CDATA[<p>Leidsin täna seda → <a href="http://et.wikipedia.org/wiki/Isikukood">Isikukood</a>. Algoritm on selge aga näidese kood on räpp&#8230;</p>
<p>Siis&#8230;</p>
<p><a href="/misc/isikukood/isikukood.phps">Versioon PHP</a> by <a href="http://www.setor.net/">Setor</a><br />
<a href="/misc/isikukood/isikukood2.phps">Versioon PHP 2</a> by MiamiBC (kõige lihtsam ja arusaadavam)<br />
<a href="/misc/isikukood/PersonalCode.java">Java version</a> by Incubo<br />
Minu <a href="/misc/isikukood/isikukood.rb">versioon</a> Ruby keeles<br />
<a href="http://www.appelsiini.net">Mika Tuupola</a> <a href="http://www.appelsiini.net/2009/9/verify-estonian-isikukood-with-javascript">versioon</a> JavaScript</p>
<p>Kui sul on mingi teine versioon siis saada mulle ka <img src='http://www.dmitri.me/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.dmitri.me/blog/isikukood-valideerimine/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Plugin &#8216;Minify&#8217; for Frog CMS</title>
		<link>http://www.dmitri.me/blog/plugin-minify-for-frog-cms/</link>
		<comments>http://www.dmitri.me/blog/plugin-minify-for-frog-cms/#comments</comments>
		<pubDate>Wed, 20 May 2009 09:25:46 +0000</pubDate>
		<dc:creator>Dmitri</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[web-development]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[frog cms]]></category>

		<guid isPermaLink="false">http://www.dmitri.me/blog/?p=235</guid>
		<description><![CDATA[About Minify
&#8216;Minify&#8217; is a plugin to minify JavaScript and/or CSS code and combine it
into one file on the fly. This will increase performance of website.
So you don&#8217;t need to do dozens HTTP request for every JavaScript or CSS file.
Minify plugin is more useful and faster with Funky cache plugin.

Usage
Install the minify plugin to your Frog [...]]]></description>
			<content:encoded><![CDATA[<h1>About Minify</h1>
<p>&#8216;Minify&#8217; is a plugin to minify JavaScript and/or CSS code and combine it<br />
into one file on the fly. This will increase performance of website.<br />
So you don&#8217;t need to do dozens HTTP request for every JavaScript or CSS file.<br />
Minify plugin is more useful and faster with <a href="http://www.appelsiini.net/projects/funky_cache">Funky cache</a> plugin.</p>
<p><span id="more-235"></span></p>
<h1>Usage</h1>
<p>Install the minify plugin to your Frog CMS plugins directory:</p>
<pre><code>
$cd /path/to/frog/plugins/
$git clone git://github.com/dknight/minify.git
</code></pre>
<h3>Activate minify plugin</h3>
<p><img src="http://www.dmitri.me/misc/minify.png" alt="" /></p>
<h3>Set the settings</h3>
<p>So next step you need to create &#8216;cache&#8217; directory in your document root and make it<br />
writable. Due to security settings most webservers doesn&#8217;t allow you to create<br />
directories dynamically, so you need to create it manually. Create it in your DOCUMENT_ROOT/cache/ and set writtable permissions.</p>
<pre><code>
$mkdir /website/root/cache/
$chmod 0666 /website/root/cache/
</code></pre>
<h3>Usage in Frog CMS</h3>
<pre><code>
&lt;?php
$jsFiles = array(
    '/public/javascripts/jquery-1.3.2.min.js',
    '/public/javascripts/jquery.validate.min.js',
    '/public/javascripts/jquery.form.js',
    '/public/javascripts/frog.js'
);
$cssFiles = array(
    'path/to/master.css',
    'path/to/subpage.css',
    'path/to/ie-fix.css'
);

$js_minify  = Minify::factory('js');
$css_minify = Minify::factory('css');
?&gt;
</code></pre>
<p>HTML:</p>
<pre><code>

...
&lt;link href="&lt;?php echo $css_minify-&gt;minify($cssFiles, true); ?&gt;" rel="stylesheet" type="text/css" /&gt;
...
&lt;script type="text/javascript" src="&lt;?php echo $js_minify-&gt;minify($files, true); ?&gt;"&gt;&lt;/script&gt;
...

</code></pre>
<p>The &#8216;minify&#8217; method can pass 3 parameters:</p>
<table border="1">
<tbody>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default</th>
</tr>
<tr>
<td>files</td>
<td>File to be minified</td>
<td>array [required]</td>
<td>array()</td>
</tr>
<tr>
<td>output</td>
<td>Output to file or raw output into string</td>
<td>boolean [optional]</td>
<td>false</td>
</tr>
<tr>
<td>fileName</td>
<td>Name of output file</td>
<td>string [optional]</td>
<td>&#8216;min.js&#8217; or &#8216;min.css&#8217;</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.dmitri.me/blog/plugin-minify-for-frog-cms/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Official Estonian currency rates with PHP</title>
		<link>http://www.dmitri.me/blog/estonian-currency-rates-php/</link>
		<comments>http://www.dmitri.me/blog/estonian-currency-rates-php/#comments</comments>
		<pubDate>Thu, 18 Dec 2008 11:35:21 +0000</pubDate>
		<dc:creator>Dmitri</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wrong world]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[me]]></category>
		<category><![CDATA[web-development]]></category>
		<category><![CDATA[work]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.dmitri.me/blog/?p=164</guid>
		<description><![CDATA[I had a bit free time today and I have written a PHP class which gets the official rates for Estonian crown. This class will be useful for internet shops or any other commercial organizations who need to keep their courses fresh.
You can download or check source. This stuff is really simple as hell, anyway [...]]]></description>
			<content:encoded><![CDATA[<p>I had a bit free time today and I have written a PHP class which gets the official rates for Estonian crown. This class will be useful for internet shops or any other commercial organizations who need to keep their courses fresh.</p>
<p>You can <a href="/misc/rates/Eesti-Money_Rates.zip">download</a> or <a href="/misc/rates/Money/Rates.phps">check source</a>. This stuff is really simple as hell, anyway there is a small documentation inside archive.<br />
<span id="more-164"></span></p>
<h3>Here you can see the most fresh Estonian currency rates</h3>
<p><iframe src="/misc/rates/fresh-rates.php" width="302px" height="1400px" frameborder="0" scrolling="no">Update your browser!</iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dmitri.me/blog/estonian-currency-rates-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Why Obama has won?</title>
		<link>http://www.dmitri.me/blog/why-obama-wins/</link>
		<comments>http://www.dmitri.me/blog/why-obama-wins/#comments</comments>
		<pubDate>Fri, 07 Nov 2008 08:52:53 +0000</pubDate>
		<dc:creator>Dmitri</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[web-development]]></category>
		<category><![CDATA[humor]]></category>
		<category><![CDATA[politycs]]></category>

		<guid isPermaLink="false">http://www.dmitri.me/blog/?p=148</guid>
		<description><![CDATA[New US. president Barack Obama wins elections because his site is written on PHP, but John McCain has ASP.NET site, so they are:
Obama vs McCain.
  
]]></description>
			<content:encoded><![CDATA[<p>New US. president Barack Obama wins elections because his site is written on PHP, but John McCain has ASP.NET site, so they are:</p>
<p><a href="http://my.barackobama.com/page/user/login?successurl[]=">Obama</a> vs <a href="http://www.johnmccain.com/Informing/News/PressReleases/Read.aspx ">McCain</a>.</p>
<p> <img src='http://www.dmitri.me/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.dmitri.me/blog/why-obama-wins/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Optimizing PNG images</title>
		<link>http://www.dmitri.me/blog/optimizing-png-images/</link>
		<comments>http://www.dmitri.me/blog/optimizing-png-images/#comments</comments>
		<pubDate>Tue, 14 Oct 2008 20:09:25 +0000</pubDate>
		<dc:creator>Dmitri</dc:creator>
				<category><![CDATA[web-development]]></category>
		<category><![CDATA[work]]></category>
		<category><![CDATA[Images]]></category>
		<category><![CDATA[Optimization]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PNG]]></category>

		<guid isPermaLink="false">http://www.dmitri.me/blog/?p=6</guid>
		<description><![CDATA[PNG is quite popular and versatile format for web, but not so as we all want. Why? Because software cannot render, save and open it correctly. Only IE6 is worth to remember, I hope soon that wretched browser will stay in far-far past. Sometimes happens that PNG&#8217;s file size is quite heavy.
OK, lets begin our [...]]]></description>
			<content:encoded><![CDATA[<p>PNG is quite popular and versatile format for web, but not so as we all want. Why? Because software cannot render, save and open it correctly. Only IE6 is worth to remember, I hope soon that wretched browser will stay in far-far past. Sometimes happens that PNG&#8217;s file size is quite heavy.</p>
<p>OK, lets begin our story. When you create a PNG files in Photoshop they seems to be quite large. “Why” you ask? I answer, because Adobe Photoshop (even CS3) don&#8217;t know how to save PNG format correctly (strange, but Adobe Fireworks does). Ok, lets see why <span id="more-6"></span></p>
<p>Look at these vivid magenta zones? What are they?</p>
<table border="0">
<tbody>
<tr>
<td width="275" align="center">
<div class="png-container"><img src="/misc/png/fire_zones.png" alt="PNG Photoshop unsaved zones" width="200" height="300" /></div>
</td>
<td width="275" align="center">
<div class="png-container"><img src="/misc/png/girl_zones.png" alt="PNG Photoshop unsaved zones" width="200" height="300" /></div>
</td>
</tr>
</tbody>
</table>
<p>These magenta zones are pixels with real transparent color values, but other transparent stuff have different data (if you fluent in Russian you can read <a href="http://www.artlebedev.ru/tools/technogrette/img/png-3/">this page</a> and learn how to remove this extra data manually in Photoshop). So we need to remove this extra data to make file size lesser.</p>
<p>As technology guy I&#8217;m too lazy to do these removing operations by hand. So I have written script to make this work faster and more happy. Moreover the script uses all power of zlib to compress PNG images, what Photoshop doesn&#8217;t fully use.</p>
<p>Script is written in PHP and I recommend to run it from command line, not from browser, because it can hang up your Firefox.</p>
<p><a href="/misc/png/optpng.zip">Download</a> or check <a href="/misc/png/optpng.phps">source</a>.</p>
<p>To run script, use this command in your console, be sure that your PHP is complied correctly with GD library:<br />
<code>$php optpng.php [dir]</code><br />
For more information see comments inside script.</p>
<h3>Some examples</h3>
<table border="0">
<tbody>
<tr>
<th width="275" align="center"><strong>Before</strong></th>
<th width="275" align="center"><strong>After</strong></th>
</tr>
<tr>
<td align="center">
<div class="png-container"><img src="/misc/png/fire.png" alt="PNG before optimization" width="200" height="300" /></div>
</td>
<td align="center">
<div class="png-container"><img src="/misc/png/fire_optimized.png" alt="PNG before optimization" width="200" height="300" /></div>
</td>
</tr>
<tr>
<td align="center"><em>59 606 bytes</em></td>
<td align="center"><em>50 915 bytes</em></td>
</tr>
<tr>
<th width="275" align="center"><strong>Before</strong></th>
<th width="275" align="center"><strong>After</strong></th>
</tr>
<tr>
<td align="center">
<div class="png-container"><img src="/misc/png/girl.png" alt="PNG before optimization" width="200" height="300" /></div>
</td>
<td align="center">
<div class="png-container"><img src="/misc/png/girl_optimized.png" alt="PNG before optimization" width="200" height="300" /></div>
</td>
</tr>
<tr>
<td align="center"><em>53 696 bytes</em></td>
<td align="center"><em>50 869 bytes</em></td>
</tr>
</tbody>
</table>
<p>In this examples we get a slight gain, but when you use more larger images your winning in size up to 50% without any lose of quality. Anyway as tests show you will win average 25% in size. See example of script <a href="/misc/png/pngtest.txt">output information</a> (265 Kb less, not bad).</p>
<p>When I learn Ruby better I will do clone in Ruby.</p>
<p>So have fun and don&#8217;t believe what you see!</p>
<p>PS. You can use much better image optimizer <a href="http://www.smushit.com">Smush it!</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dmitri.me/blog/optimizing-png-images/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
