<?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>Alexander Stetsenko</title>
	<atom:link href="http://www.stetsenko.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stetsenko.net</link>
	<description>Web developer blog :: thoughts and steps</description>
	<lastBuildDate>Mon, 30 Aug 2010 02:07:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Subversion: How to require comments</title>
		<link>http://www.stetsenko.net/2010/08/subversion-how-to-require-comments/</link>
		<comments>http://www.stetsenko.net/2010/08/subversion-how-to-require-comments/#comments</comments>
		<pubDate>Mon, 30 Aug 2010 02:07:35 +0000</pubDate>
		<dc:creator>Alexander</dc:creator>
				<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.stetsenko.net/?p=811</guid>
		<description><![CDATA[Normally developers agree and promise to write comments for each commit. Often the comments are still not written though. Subversion pre-commit hook allows to make comments required. For instance file pre-commit.tmpl contains a sample script which will reject commits if no log message is supplied, or the message is too short. However it doesn’t report [...]]]></description>
			<content:encoded><![CDATA[<p>Normally developers agree and promise to write comments for each commit. Often the comments are still not written though.</p>
<p>Subversion pre-commit hook allows to make comments required. For instance file <strong>pre-commit.tmpl</strong> contains a sample script which will reject commits if no log message is supplied, or the message is too short. However it doesn’t report back any error message (i.e. a generic “commit failed” is returned to SVN client), and there is no provision for making sure the comment is a minimum length.</p>
<p><a href="http://www.stillnetstudios.com/require-subversion-comments-minimum/">Ryan Stille came up with excellent Perl script</a> which does the job in more transparent way compare to the original shell script. It allows setting minimum length of the comment and custom error message when the message is absent or too short.</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/usr/bin/perl</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># config section</span>
<span style="color: #0000ff;">$minchars</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">4</span><span style="color: #339933;">;</span>
<span style="color: #0000ff;">$svnlook</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">'/usr/bin/svnlook'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#--------------------------------------------</span>
<span style="color: #0000ff;">$repos</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$ARGV</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #0000ff;">$txn</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$ARGV</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #0000ff;">$comment</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">`$svnlook log -t &quot;$txn&quot; &quot;$repos&quot;`</span><span style="color: #339933;">;</span>
<span style="color: #000066;">chomp</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$comment</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000066;">length</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$comment</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066;">print</span> <span style="color: #000000; font-weight: bold;">STDERR</span> <span style="color: #ff0000;">&quot;A comment is required!&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #000066;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">elsif</span> <span style="color: #009900;">&#40;</span> <span style="color: #000066;">length</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$comment</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;</span> <span style="color: #0000ff;">$minchars</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066;">print</span> <span style="color: #000000; font-weight: bold;">STDERR</span> <span style="color: #ff0000;">&quot;Comment must be at least $minchars characters.&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #000066;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000066;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><strong>Note</strong> that pre-commit.tmpl has to be renamed without the &#8220;.tmpl&#8221; on it and set as executable.</p>
<p>Of course there is no guarantee that all comments will be relevant. But at least it could work as reminder that the comment is needed <strong>right now</strong> for current commit.</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Subversion%3A+How+to+require+comments+http://bit.ly/ccIg4C" title="Post to Twitter"><img class="nothumb" src="http://www.stetsenko.net/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Subversion%3A+How+to+require+comments+http://bit.ly/ccIg4C" title="Post to Twitter">Tweet This</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.stetsenko.net/2010/08/subversion-how-to-require-comments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lady Java &#8211; JavaZone</title>
		<link>http://www.stetsenko.net/2010/08/lady-java-javazone/</link>
		<comments>http://www.stetsenko.net/2010/08/lady-java-javazone/#comments</comments>
		<pubDate>Sat, 21 Aug 2010 23:10:36 +0000</pubDate>
		<dc:creator>Alexander</dc:creator>
				<category><![CDATA[Funny stuff]]></category>

		<guid isPermaLink="false">http://www.stetsenko.net/?p=809</guid>
		<description><![CDATA[Tweet This]]></description>
			<content:encoded><![CDATA[<p><object width="480" height="295"><param name="movie" value="http://www.youtube.com/v/1JZnj4eNHXE?fs=1&amp;hl=en_US&amp;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/1JZnj4eNHXE?fs=1&amp;hl=en_US&amp;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="295"></embed></object></p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Lady+Java+%26%238211%3B+JavaZone+http://bit.ly/9y8GMh" title="Post to Twitter"><img class="nothumb" src="http://www.stetsenko.net/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Lady+Java+%26%238211%3B+JavaZone+http://bit.ly/9y8GMh" title="Post to Twitter">Tweet This</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.stetsenko.net/2010/08/lady-java-javazone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL: How to force a new unique index to drop duplicated rows</title>
		<link>http://www.stetsenko.net/2010/08/mysql-how-to-force-a-new-unique-index-to-drop-duplicated-rows/</link>
		<comments>http://www.stetsenko.net/2010/08/mysql-how-to-force-a-new-unique-index-to-drop-duplicated-rows/#comments</comments>
		<pubDate>Fri, 20 Aug 2010 01:06:58 +0000</pubDate>
		<dc:creator>Alexander</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.stetsenko.net/?p=802</guid>
		<description><![CDATA[If table is not empty, there may be duplicated records. If so a regular alter query to create a new unique index will return an error like below. ERROR 1062 (23000): Duplicate entry &#8217;132653-47&#8242; for key 1 However keyword IGNORE allows to force a new unique index to drop duplicated rows. ALTER IGNORE TABLE `t` [...]]]></description>
			<content:encoded><![CDATA[<p>If table is not empty, there may be duplicated records. If so a regular alter query to create a new unique index will return an error like below.</p>
<blockquote><p>ERROR 1062 (23000): Duplicate entry &#8217;132653-47&#8242; for key 1</p></blockquote>
<p>However keyword <strong>IGNORE</strong> allows to force a new unique index to drop duplicated rows.</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">IGNORE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`t`</span> <span style="color: #993333; font-weight: bold;">ADD</span> <span style="color: #993333; font-weight: bold;">UNIQUE</span> <span style="color: #993333; font-weight: bold;">INDEX</span> <span style="color: #ff0000;">`i`</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`f1`</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">`f2`</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>In this case the output will be something like this:</p>
<blockquote><p>Query OK, 507 rows affected (0.02 sec)<br />
Records: 507 Duplicates: 0 Warnings: 0</p></blockquote>
<p>So simply using <strong>IGNORE</strong> helps to save time on writing a custom script to clean up duplicates.</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=MySQL%3A+How+to+force+a+new+unique+index+to+drop+duplicated+rows+http://bit.ly/cg7f0r" title="Post to Twitter"><img class="nothumb" src="http://www.stetsenko.net/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=MySQL%3A+How+to+force+a+new+unique+index+to+drop+duplicated+rows+http://bit.ly/cg7f0r" title="Post to Twitter">Tweet This</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.stetsenko.net/2010/08/mysql-how-to-force-a-new-unique-index-to-drop-duplicated-rows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL 5.0 upgrade to 5.1 watchouts</title>
		<link>http://www.stetsenko.net/2010/08/mysql-5-0-upgrade-to-5-1-watchouts/</link>
		<comments>http://www.stetsenko.net/2010/08/mysql-5-0-upgrade-to-5-1-watchouts/#comments</comments>
		<pubDate>Thu, 19 Aug 2010 02:17:11 +0000</pubDate>
		<dc:creator>Alexander</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.stetsenko.net/?p=789</guid>
		<description><![CDATA[Although it might be a good time to start testing the third milestone of MySQL 5.5, I am sure many projects are still in transition between versions 5.0 and 5.1. MySQL 5.0 to 5.1 upgrade is well documented and went pretty smoothly in our case. However our project was heavily relied on stored procedures and [...]]]></description>
			<content:encoded><![CDATA[<p>Although it might be a good time to start testing the third milestone of MySQL 5.5, I am sure many projects are still in transition between versions 5.0 and 5.1.</p>
<p>MySQL 5.0 to 5.1 upgrade is well documented and went pretty smoothly in our case. However our project was heavily relied on stored procedures and that gave us some troubles to deal with.</p>
<p>The first issue was just annoying warning <strong>&#8220;Creation context of stored routine .. is invalid&#8221;</strong> for every call of any stored routine (stored procedures and functions worked as expected).</p>
<p>It turned out that the upgrade to 5.1 had added four columns to the <em>mysql.proc</em> table:</p>
<ul>
<li>character_set_client,</li>
<li>collation_connection,</li>
<li>db_collation,</li>
<li>body_utf8.</li>
</ul>
<p>Those columns were created with a default value of <strong>NULL</strong> and that was generating the warning. But if a stored procedure/function is created in &#8216;native&#8217; 5.1 environment, it has these values set to the system defaults and no warning is shown.</p>
<p>Manual altering the <em>mysql.proc</em> table and setting the value of &#8216;character_set_client&#8217;, &#8216;collation_connection&#8217; and &#8216;db_collation&#8217; to valid values prevented the error form appearing:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">UPDATE</span> proc <span style="color: #993333; font-weight: bold;">SET</span>
  character_set_client <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'utf8'</span><span style="color: #66cc66;">,</span>
  collation_connection <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'utf8_general_ci'</span><span style="color: #66cc66;">,</span>
  db_collation <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'latin1_swedish_ci'</span>;</pre></div></div>

<p>This issue was reported as <a href="http://bugs.mysql.com/bug.php?id=30731">bug</a> and marked as closed for version 5.1.21 in 2007. But it looked like it had made it back to version 5.1.4x somehow in 2010.</p>
<p>The second issue was more complicated and actually some stored procedures stopped working because of weird <strong>&#8220;Column count doesn&#8217;t match value count at row 1&#8243;</strong> error (which did not make much sense though).</p>
<p>Additional research showed that some insert queries did not work withing prepare\execute blocks due to <a href="http://dev.mysql.com/doc/refman/5.1/en/upgrading-from-previous-series.html">incompatible changes in 5.1.25 to the way that the server handles prepared statements</a>. <a href="http://bugs.mysql.com/bug.php?id=21774">The bug #21774</a> shed some light on this issue too.</p>
<p>For example the statement like below (within a stored procedure) may produce the error mentioned above:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;">DECLARE vNum INT;
&nbsp;
<span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> t <span style="color: #66cc66;">&#40;</span>f TINYINT<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #993333; font-weight: bold;">SET</span> vNum <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span>;
<span style="color: #993333; font-weight: bold;">SET</span> @sql <span style="color: #66cc66;">=</span> CONCAT<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'INSERT INTO t SELECT '</span><span style="color: #66cc66;">,</span> vNum<span style="color: #66cc66;">&#41;</span>;
&nbsp;
PREPARE QUERY <span style="color: #993333; font-weight: bold;">FROM</span> @sql;
EXECUTE QUERY;
DEALLOCATE PREPARE QUERY;</pre></div></div>

<p>Simply changing <em>vNum</em> type from <strong>INT</strong> to <strong>TINYINT</strong> helped (so the variable type matches the column type in the table).</p>
<p>I hope this will save couple hours to someone unless it has been taken care of in newer MySQL releases.</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=MySQL+5.0+upgrade+to+5.1+watchouts+http://bit.ly/ce510j" title="Post to Twitter"><img class="nothumb" src="http://www.stetsenko.net/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=MySQL+5.0+upgrade+to+5.1+watchouts+http://bit.ly/ce510j" title="Post to Twitter">Tweet This</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.stetsenko.net/2010/08/mysql-5-0-upgrade-to-5-1-watchouts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Allen Hughes &#8211; Get Back Up</title>
		<link>http://www.stetsenko.net/2010/08/allen-hughes-get-back-up/</link>
		<comments>http://www.stetsenko.net/2010/08/allen-hughes-get-back-up/#comments</comments>
		<pubDate>Sun, 08 Aug 2010 21:20:43 +0000</pubDate>
		<dc:creator>Alexander</dc:creator>
				<category><![CDATA[Music]]></category>

		<guid isPermaLink="false">http://www.stetsenko.net/?p=787</guid>
		<description><![CDATA[A good friend of mine Allen Hughes covering Toby Mac&#8217;s &#8220;Get Back Up&#8221; for the 104.7 The Fish, Opening Act contest. Tweet This]]></description>
			<content:encoded><![CDATA[<p>A good friend of mine Allen Hughes covering Toby Mac&#8217;s &#8220;Get Back Up&#8221; for the 104.7 The Fish, Opening Act contest.</p>
<p><object width="480" height="295"><param name="movie" value="http://www.youtube.com/v/fXmpAzbgH7g&amp;hl=en_US&amp;fs=1?rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/fXmpAzbgH7g&amp;hl=en_US&amp;fs=1?rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="295"></embed></object></p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Allen+Hughes+%26%238211%3B+Get+Back+Up+http://bit.ly/ay1BIS" title="Post to Twitter"><img class="nothumb" src="http://www.stetsenko.net/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Allen+Hughes+%26%238211%3B+Get+Back+Up+http://bit.ly/ay1BIS" title="Post to Twitter">Tweet This</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.stetsenko.net/2010/08/allen-hughes-get-back-up/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL: How to stop a running query?</title>
		<link>http://www.stetsenko.net/2010/08/mysql-how-to-stop-a-running-query/</link>
		<comments>http://www.stetsenko.net/2010/08/mysql-how-to-stop-a-running-query/#comments</comments>
		<pubDate>Fri, 06 Aug 2010 01:51:41 +0000</pubDate>
		<dc:creator>Alexander</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.stetsenko.net/?p=781</guid>
		<description><![CDATA[There is a magic MySQL statement KILL which allows to terminate either connection or query associated with provided thread ID. SHOW PROCESSLIST statement allows to see running threads (including thread ID). Example 1: KILL QUERY 24; terminates the statement that the connection is currently executing under thread 24, but leaves the connection itself intact. Example [...]]]></description>
			<content:encoded><![CDATA[<p>There is a <em>magic</em> MySQL statement <strong>KILL</strong> which allows to terminate either connection or query associated with provided thread ID.</p>
<p><strong>SHOW PROCESSLIST</strong> statement allows to see running threads (including thread ID).</p>
<p>Example 1:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">KILL</span> QUERY <span style="color: #cc66cc;">24</span>;</pre></div></div>

<p>terminates the statement that the connection is currently executing under thread 24, but leaves the connection itself intact.</p>
<p>Example 2:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">KILL</span> <span style="color: #cc66cc;">24</span>;</pre></div></div>

<p> or</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">KILL</span> CONNECTION <span style="color: #cc66cc;">24</span>;</pre></div></div>

<p>terminates the connection associated with the thread 24 (i.e. re-connect will be required).</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=MySQL%3A+How+to+stop+a+running+query%3F+http://bit.ly/aof37h" title="Post to Twitter"><img class="nothumb" src="http://www.stetsenko.net/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=MySQL%3A+How+to+stop+a+running+query%3F+http://bit.ly/aof37h" title="Post to Twitter">Tweet This</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.stetsenko.net/2010/08/mysql-how-to-stop-a-running-query/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to write robots.txt?</title>
		<link>http://www.stetsenko.net/2010/08/how-to-write-robots-txt/</link>
		<comments>http://www.stetsenko.net/2010/08/how-to-write-robots-txt/#comments</comments>
		<pubDate>Fri, 06 Aug 2010 01:33:31 +0000</pubDate>
		<dc:creator>Alexander</dc:creator>
				<category><![CDATA[Funny stuff]]></category>

		<guid isPermaLink="false">http://www.stetsenko.net/?p=776</guid>
		<description><![CDATA[Tweet This]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.stetsenko.net/wp-content/uploads/2010/08/robots.jpg" alt="" title="" width="377" height="376" class="aligncenter size-full wp-image-777" /></p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=How+to+write+robots.txt%3F+http://bit.ly/bzzIEf" title="Post to Twitter"><img class="nothumb" src="http://www.stetsenko.net/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=How+to+write+robots.txt%3F+http://bit.ly/bzzIEf" title="Post to Twitter">Tweet This</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.stetsenko.net/2010/08/how-to-write-robots-txt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How does motivation work?</title>
		<link>http://www.stetsenko.net/2010/07/how-does-motivation-work/</link>
		<comments>http://www.stetsenko.net/2010/07/how-does-motivation-work/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 21:55:00 +0000</pubDate>
		<dc:creator>Alexander</dc:creator>
				<category><![CDATA[Management]]></category>

		<guid isPermaLink="false">http://www.stetsenko.net/?p=768</guid>
		<description><![CDATA[Recently I have come across this great old parable of stone cutters. A man came across three stonecutters and asked them what they were doing. The first replied, “I am making a living.” The second kept on hammering while he said, “I am doing the best job of stonecutting in the entire county.” The third [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I have come across this great old parable of stone cutters.</p>
<blockquote><p>A man came across three stonecutters and asked them what they were doing. The first replied, “I am making a living.” The second kept on hammering while he said, “I am doing the best job of stonecutting in the entire county.” The third looked up with a visionary gleam in his eye and said, “I am building a cathedral.”</p></blockquote>
<p>Although these three men were doing the same job, there were three different answers. I think this is a great example of <a href="http://www.stetsenko.net/2010/06/motivation-money-vs-purpose/">motivation</a> &#8220;in action&#8221;. </p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=How+does+motivation+work%3F+http://bit.ly/93Y6Hr" title="Post to Twitter"><img class="nothumb" src="http://www.stetsenko.net/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=How+does+motivation+work%3F+http://bit.ly/93Y6Hr" title="Post to Twitter">Tweet This</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.stetsenko.net/2010/07/how-does-motivation-work/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Inception</title>
		<link>http://www.stetsenko.net/2010/07/inception/</link>
		<comments>http://www.stetsenko.net/2010/07/inception/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 20:30:12 +0000</pubDate>
		<dc:creator>Alexander</dc:creator>
				<category><![CDATA[Movies]]></category>

		<guid isPermaLink="false">http://www.stetsenko.net/?p=764</guid>
		<description><![CDATA[Inception could be the greatest action movie with the original story for a few past years. Definitely recommended to check it out! Tweet This]]></description>
			<content:encoded><![CDATA[<p><object width="480" height="295"><param name="movie" value="http://www.youtube.com/v/z75o-F6ja2I&amp;hl=en_US&amp;fs=1?rel=0&amp;hd=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/z75o-F6ja2I&amp;hl=en_US&amp;fs=1?rel=0&amp;hd=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="295"></embed></object></p>
<p>Inception could be the greatest action movie with the original story for a few past years. Definitely recommended to check it out!</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Inception+http://bit.ly/aySmkl" title="Post to Twitter"><img class="nothumb" src="http://www.stetsenko.net/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Inception+http://bit.ly/aySmkl" title="Post to Twitter">Tweet This</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.stetsenko.net/2010/07/inception/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP: How to get microseconds</title>
		<link>http://www.stetsenko.net/2010/07/php-how-to-get-microseconds/</link>
		<comments>http://www.stetsenko.net/2010/07/php-how-to-get-microseconds/#comments</comments>
		<pubDate>Sat, 17 Jul 2010 18:56:04 +0000</pubDate>
		<dc:creator>Alexander</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.stetsenko.net/?p=751</guid>
		<description><![CDATA[Sometimes it could be necessary to get time with microseconds part. Especially it is good for something like logging when multiple entries are recorded per second and preferably to know how they are spread out. At first glance everything looked very easy: print date&#40;'Y-m-d H:i:s.u'&#41; ; where u is microseconds. However it turns out PHP [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes it could be necessary to get time with microseconds part. Especially it is good for something like logging when multiple entries are recorded per second and preferably to know how they are spread out.</p>
<p>At first glance everything looked very easy:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">print</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y-m-d H:i:s.u'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span></pre></div></div>

<p>where <em>u</em> is microseconds.</p>
<p>However it turns out PHP manual has a tiny note which states</p>
<blockquote><p>Since this [date()] function only accepts integer timestamps the <em>u</em> format character is only useful when using the date_format() function with user based timestamps created with date_create().</p></blockquote>
<p>Which means that <em>u</em> kind of works but in case of calling within date() function the result is always <strong>.000000</strong>.</p>
<p>So the straight forward solution could be something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">print</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y-m-d H:i:s'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>string<span style="color: #009900;">&#41;</span><span style="color: #990000;">microtime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">8</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>But the drawback of the solution above is two calls to the time related functions which potentially may cause some accuracy issues.</p>
<p>Thus even better solution is doing just one call of time function:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">list</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$usec</span><span style="color: #339933;">,</span> <span style="color: #000088;">$sec</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span> <span style="color: #990000;">microtime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">print</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y-m-d H:i:s'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$sec</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$usec</span><span style="color: #339933;">;</span></pre></div></div>

<p align="left"><a class="tt" href="http://twitter.com/home/?status=PHP%3A+How+to+get+microseconds+http://bit.ly/af5te3" title="Post to Twitter"><img class="nothumb" src="http://www.stetsenko.net/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=PHP%3A+How+to+get+microseconds+http://bit.ly/af5te3" title="Post to Twitter">Tweet This</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.stetsenko.net/2010/07/php-how-to-get-microseconds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
