<?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>iXTi's personal sandbox</title>
	
	<link>http://blog.ixti.ru</link>
	<description>Personal playground since 2006</description>
	<lastBuildDate>Fri, 03 Sep 2010 15:37:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/ixti" /><feedburner:info uri="ixti" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Translating variable strings with gettext or “How to translate Doctrine’s enums”</title>
		<link>http://feedproxy.google.com/~r/ixti/~3/68HyrfQNx80/641</link>
		<comments>http://blog.ixti.ru/archives/641#comments</comments>
		<pubDate>Fri, 03 Sep 2010 15:10:39 +0000</pubDate>
		<dc:creator>ixti</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Doctrine ORM]]></category>
		<category><![CDATA[gettext]]></category>
		<category><![CDATA[i18n]]></category>
		<category><![CDATA[orm]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://blog.ixti.ru/?p=641</guid>
		<description><![CDATA[Translating of something with gettext is well-discussed problem, so there’s no need to discuss it again. Everything works like a charm, when you dealing with string constants. But what to do if you need to translate a string retrieved from &#8230; <a href="http://blog.ixti.ru/archives/641">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Translating of something with <a href="http://www.gnu.org/software/gettext/" onclick="pageTracker._trackPageview('/outgoing/www.gnu.org/software/gettext/?referer=');">gettext</a> is well-discussed problem, so there’s no need to discuss it again. Everything works like a charm, when you dealing with string constants. But what to do if you need to translate a string retrieved from some variable, e.g. <code>_($str)</code>? Translation is not a problem at all, so if you have <code>$str</code> defined as <em>‘Text’</em>, previous call will output <em>‘Text’</em>, unless it will find a translated string with such <em>msgid</em>. Unfortunately you won’t be able to prepare a pot-file automatically with these messages. But even when you were eaten, you have at least two ways out. So let’s find some of them ;))</p>
<p>I first met this problem, while was dealing with <a href="http://www.doctrine-project.org/" onclick="pageTracker._trackPageview('/outgoing/www.doctrine-project.org/?referer=');">Doctrine</a>’s enums. So let’s define a sample model that we will use in examples, and which will show the bottle neck:</p>
<pre class="brush: php;">
&lt;?php
class Chick extends Doctrine_Record
{
    public function setTableDefinition()
    {
        $this-&gt;hasColumn('name', 'string');
        $this-&gt;hasColumn('address', 'text');
        $this-&gt;hasColumn('boobs', 'enum', null, array(
            'values' =&gt; array('cranberries', 'peaches', 'oranges', 'balloons')
        );
    }
}
</pre>
<p>As you can see every <code>Chick</code> has boobs of some type. So somewhere we’ll write them as:</p>
<pre class="brush: php;">
/** @var $chick Chick */
printf(_('%s has boobs similar to %s'), $chick-&gt;name, _($chick-&gt;boobs));
</pre>
<p><strong>Let’s do it easy</strong><br />
The most simple way to achieve our goal (pot file creation with <a href="http://www.gnu.org/software/hello/manual/gettext/xgettext-Invocation.html" onclick="pageTracker._trackPageview('/outgoing/www.gnu.org/software/hello/manual/gettext/xgettext-Invocation.html?referer=');">xgettext</a> or <a href="http://www.poedit.net/" onclick="pageTracker._trackPageview('/outgoing/www.poedit.net/?referer=');">poedit</a>) is to use a block with desired messages that will never be executed:</p>
<pre class="brush: php;">
if (0) { // will never be executed
    _('cranberries');
    _('peaches');
    _('oranges');
    _('balloons');
}
</pre>
<p>This is quite easy way. But it has very big disadvantage — you have to keep that block always up-to date — every time you change something related to the variable string, you have to pay attention on that block. So we are ready for second way now…</p>
<p><strong>Let’s do it smarter</strong><br />
Another option we can deal with variable strings is to mark such strings with something. And then gather such strings into separate dummy file that will be used as one of sources of strings but will never be used in real world. Let’s modify enum definition in the way it will have some marker, like this:</p>
<pre class="brush: php;">
// ... skipped ...
        $this-&gt;hasColumn('boobs', 'enum', null, array(
            'values' =&gt; array(
                'cranberries', //_
                'peaches', //_
                'oranges', //_
                'balloons' //_
            )
        );
// ... skipped ...
</pre>
<p>Now all we need is a some dummy parser that will be able to deal with such strings, for example, let’s write it in <a href="http://www.ruby-lang.org/" onclick="pageTracker._trackPageview('/outgoing/www.ruby-lang.org/?referer=');">Ruby</a> (so it can be included as one of <a href="http://rake.rubyforge.org/" onclick="pageTracker._trackPageview('/outgoing/rake.rubyforge.org/?referer=');">Rakefile</a> tasks):</p>
<pre class="brush: ruby;">
require 'find'

files_pattern = /\.(?:php|phtml|inc)$/

single_quoted = /'(?&gt;(?:\\.|[^'])+)'/
double_quoted = /&quot;(?&gt;(?:\\.|[^&quot;])+)&quot;/
quoted_string = /#{single_quoted}|#{double_quoted}/
match_pattern = /(#{quoted_string}).+\/\/_/

result = &quot;&lt;?php\n&quot;
Find.find('.') do |f|
  next unless File.file? f and f.match('')
  File.open(f).each_with_index do |s, i|
    m = s.match(match_pattern)
    result &lt;&lt; &quot;_(#{m[1]}); // #{f}:#{i}\n&quot; unless m.nil?
  end
end

puts result
</pre>
<p>The output of it’s execution will produce something like this:</p>
<pre class="brush: php;">
&lt;?php
_('cranberries'); // ./models/Chick.php:9
_('peaches'); // ./models/Chick.php:10
_('oranges'); // ./models/Chick.php:11
_('balloons'); // ./models/Chick.php:12
</pre>
<p>Now we can use both of described ways, and they are good enough for variable strings. But for <code>Doctrine_Record</code>’s enums there is much more beautiful way to achieve this :)) So let’s find it…</p>
<p><strong>Let’s do it our way</strong><br />
Doctrine ORM allows you to define a mutator for each property your model has. So according to our <code>Chick</code> model we can define a special getter <code>getBoobs()</code> and setter <code>setBoobs</code> which will auto translate our boobs’ types :)) Basically this can become an idea of how to achieve this with some of your objects. Here’s dummy version of such getter/setter:</p>
<pre class="brush: php;">
// ... skipped ...
    public function getBoobs()
    {
        switch ($this-&gt;_get('boobs')) {
            case 'cranberries': return _('little cranberries');
            case 'peaches': return _('smooth peaches');
            case 'oranges': return _('tasty oranges');
            case 'balloons': return _('mighty balloons');
            default: throw new Doctrine_Exception(&quot;I don't have a clue how this chick boobs looks like.&quot;);
        }
    }

    public function setBoobs($boobs)
    {
        switch (_($boobs)) {
            case 'little cranberries': return $this-&gt;_set('boobs', 'cranberries');
            case 'smooth peaches': return $this-&gt;_set('boobs', 'peaches');
            case 'tasty oranges': return $this-&gt;_set('boobs', 'oranges');
            case 'mighty balloons': return $this-&gt;_set('boobs', 'balloons');
            default: throw new Doctrine_Exception(&quot;I don't have any idea about specified boobs type.&quot;);
        }
    }
// ... skipped ...
</pre>
<p>Looks awful! Too many similar code. So let’s define a map of values like this:</p>
<pre class="brush: php;">
// ... skipped ...
    private static $_boobs = null;

    private function _getBoobs()
    {
        if (null === self::$_boobs) {
            self::$_boobs = array(
                'cranberries'   =&gt; _('little cranberries'),
                'peaches'       =&gt; _('smooth peaches'),
                'oranges'       =&gt; _('tasty oranges'),
                'balloons'      =&gt; _('mighty balloons')
            );
        }

        return self::$_boobs;
    }
// ... skipped ...
</pre>
<p>Now we have values kept in one place, so let’s extend model with mutators keeping in mind this map, so here’s final version of model:</p>
<pre class="brush: php;">
&lt;?php
class Chick extends Doctrine_Record
{
    private static $_boobs = null;

    public function setTableDefinition()
    {
        $this-&gt;hasColumn('name', 'string');
        $this-&gt;hasColumn('address', 'text');
        $this-&gt;hasColumn('boobs', 'enum', null, array(
            'values' =&gt; array_keys(self::_getBoobs())
        );
    }

    private static function _getBoobs()
    {
        if (null === self::$_boobs) {
            self::$_boobs = array(
                'cranberries'   =&gt; _('little cranberries'),
                'peaches'       =&gt; _('smooth peaches'),
                'oranges'       =&gt; _('tasty oranges'),
                'balloons'      =&gt; _('mighty baloons')
            );
        }

        return self::$_boobs;
    }

    public function getBoobs()
    {
        $boobs = self::_getBoobs();
        return $boobs[$this-&gt;_get('boobs')];
    }

    public function setBoobs($value)
    {
        if (false !== ($boobs = array_search($value, self::_getBoobs()))) {
            $value = $boobs;
        }

        return $this-&gt;_set('boobs', $value);
    }
}
</pre>
<p>So now, previous <code>printf</code> call can become:</p>
<pre class="brush: php;">
/** @var $chick Chick */
printf(_('%s has boobs as good as %s'), $chick-&gt;name, $chick-&gt;boobs);
</pre>
<p>And you might noticed that <code>setBoobs()</code> allows both translated and untranslated strings as input. So both of following lines will work as expected:</p>
<pre class="brush: php;">
/** @var $chicks Array of Chick
$chicks[0]-&gt;boobs = 'oranges';
$chicks[1]-&gt;boobs = $chicks[0]-&gt;boobs;
</pre>
<p>Now that’s all! :))</p>






	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F641&amp;title=Translating%20variable%20strings%20with%20gettext%20or%20%22How%20to%20translate%20Doctrine%27s%20enums%22&amp;notes=Translating%20of%20something%20with%20gettext%20is%20well-discussed%20problem%2C%20so%20there%27s%20no%20need%20to%20discuss%20it%20again.%20Everything%20works%20like%20a%20charm%2C%20when%20you%20dealing%20with%20string%20constants.%20But%20what%20to%20do%20if%20you%20need%20to%20translate%20a%20string%20retrieved%20from%20some%20varia" title="del.icio.us" onclick="pageTracker._trackPageview('/outgoing/delicious.com/post?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F641_amp_title=Translating_20variable_20strings_20with_20gettext_20or_20_22How_20to_20translate_20Doctrine_27s_20enums_22_amp_notes=Translating_20of_20something_20with_20gettext_20is_20well-discussed_20problem_2C_20so_20there_27s_20no_20need_20to_20discuss_20it_20again._20Everything_20works_20like_20a_20charm_2C_20when_20you_20dealing_20with_20string_20constants._20But_20what_20to_20do_20if_20you_20need_20to_20translate_20a_20string_20retrieved_20from_20some_20varia&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F641&amp;title=Translating%20variable%20strings%20with%20gettext%20or%20%22How%20to%20translate%20Doctrine%27s%20enums%22&amp;annotation=Translating%20of%20something%20with%20gettext%20is%20well-discussed%20problem%2C%20so%20there%27s%20no%20need%20to%20discuss%20it%20again.%20Everything%20works%20like%20a%20charm%2C%20when%20you%20dealing%20with%20string%20constants.%20But%20what%20to%20do%20if%20you%20need%20to%20translate%20a%20string%20retrieved%20from%20some%20varia" title="Google Bookmarks" onclick="pageTracker._trackPageview('/outgoing/www.google.com/bookmarks/mark?op=edit_amp_bkmk=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F641_amp_title=Translating_20variable_20strings_20with_20gettext_20or_20_22How_20to_20translate_20Doctrine_27s_20enums_22_amp_annotation=Translating_20of_20something_20with_20gettext_20is_20well-discussed_20problem_2C_20so_20there_27s_20no_20need_20to_20discuss_20it_20again._20Everything_20works_20like_20a_20charm_2C_20when_20you_20dealing_20with_20string_20constants._20But_20what_20to_20do_20if_20you_20need_20to_20translate_20a_20string_20retrieved_20from_20some_20varia&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://identi.ca/notice/new?status_textarea=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F641" title="Identi.ca" onclick="pageTracker._trackPageview('/outgoing/identi.ca/notice/new?status_textarea=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F641&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/identica.png" title="Identi.ca" alt="Identi.ca" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Translating%20variable%20strings%20with%20gettext%20or%20%22How%20to%20translate%20Doctrine%27s%20enums%22%20-%20http%3A%2F%2Fblog.ixti.ru%2Farchives%2F641" title="Twitter" onclick="pageTracker._trackPageview('/outgoing/twitter.com/home?status=Translating_20variable_20strings_20with_20gettext_20or_20_22How_20to_20translate_20Doctrine_27s_20enums_22_20-_20http_3A_2F_2Fblog.ixti.ru_2Farchives_2F641&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F641" title="Technorati" onclick="pageTracker._trackPageview('/outgoing/technorati.com/faves?add=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F641&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F641&amp;title=Translating%20variable%20strings%20with%20gettext%20or%20%22How%20to%20translate%20Doctrine%27s%20enums%22&amp;bodytext=Translating%20of%20something%20with%20gettext%20is%20well-discussed%20problem%2C%20so%20there%27s%20no%20need%20to%20discuss%20it%20again.%20Everything%20works%20like%20a%20charm%2C%20when%20you%20dealing%20with%20string%20constants.%20But%20what%20to%20do%20if%20you%20need%20to%20translate%20a%20string%20retrieved%20from%20some%20varia" title="Digg" onclick="pageTracker._trackPageview('/outgoing/digg.com/submit?phase=2_amp_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F641_amp_title=Translating_20variable_20strings_20with_20gettext_20or_20_22How_20to_20translate_20Doctrine_27s_20enums_22_amp_bodytext=Translating_20of_20something_20with_20gettext_20is_20well-discussed_20problem_2C_20so_20there_27s_20no_20need_20to_20discuss_20it_20again._20Everything_20works_20like_20a_20charm_2C_20when_20you_20dealing_20with_20string_20constants._20But_20what_20to_20do_20if_20you_20need_20to_20translate_20a_20string_20retrieved_20from_20some_20varia&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://slashdot.org/bookmark.pl?title=Translating%20variable%20strings%20with%20gettext%20or%20%22How%20to%20translate%20Doctrine%27s%20enums%22&amp;url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F641" title="Slashdot" onclick="pageTracker._trackPageview('/outgoing/slashdot.org/bookmark.pl?title=Translating_20variable_20strings_20with_20gettext_20or_20_22How_20to_20translate_20Doctrine_27s_20enums_22_amp_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F641&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F641&amp;t=Translating%20variable%20strings%20with%20gettext%20or%20%22How%20to%20translate%20Doctrine%27s%20enums%22" title="Facebook" onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/share.php?u=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F641_amp_t=Translating_20variable_20strings_20with_20gettext_20or_20_22How_20to_20translate_20Doctrine_27s_20enums_22&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mister-wong.com/addurl/?bm_url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F641&amp;bm_description=Translating%20variable%20strings%20with%20gettext%20or%20%22How%20to%20translate%20Doctrine%27s%20enums%22&amp;plugin=soc" title="MisterWong" onclick="pageTracker._trackPageview('/outgoing/www.mister-wong.com/addurl/?bm_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F641_amp_bm_description=Translating_20variable_20strings_20with_20gettext_20or_20_22How_20to_20translate_20Doctrine_27s_20enums_22_amp_plugin=soc&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/misterwong.png" title="MisterWong" alt="MisterWong" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F641&amp;title=Translating%20variable%20strings%20with%20gettext%20or%20%22How%20to%20translate%20Doctrine%27s%20enums%22" title="Reddit" onclick="pageTracker._trackPageview('/outgoing/reddit.com/submit?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F641_amp_title=Translating_20variable_20strings_20with_20gettext_20or_20_22How_20to_20translate_20Doctrine_27s_20enums_22&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F641&amp;title=Translating%20variable%20strings%20with%20gettext%20or%20%22How%20to%20translate%20Doctrine%27s%20enums%22" title="StumbleUpon" onclick="pageTracker._trackPageview('/outgoing/www.stumbleupon.com/submit?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F641_amp_title=Translating_20variable_20strings_20with_20gettext_20or_20_22How_20to_20translate_20Doctrine_27s_20enums_22&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F641&amp;title=Translating%20variable%20strings%20with%20gettext%20or%20%22How%20to%20translate%20Doctrine%27s%20enums%22" title="Mixx" onclick="pageTracker._trackPageview('/outgoing/www.mixx.com/submit?page_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F641_amp_title=Translating_20variable_20strings_20with_20gettext_20or_20_22How_20to_20translate_20Doctrine_27s_20enums_22&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://hellotxt.com/?status=Translating%20variable%20strings%20with%20gettext%20or%20%22How%20to%20translate%20Doctrine%27s%20enums%22+http%3A%2F%2Fblog.ixti.ru%2Farchives%2F641" title="HelloTxt" onclick="pageTracker._trackPageview('/outgoing/hellotxt.com/?status=Translating_20variable_20strings_20with_20gettext_20or_20_22How_20to_20translate_20Doctrine_27s_20enums_22+http_3A_2F_2Fblog.ixti.ru_2Farchives_2F641&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/hellotxt.png" title="HelloTxt" alt="HelloTxt" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F641&amp;title=Translating%20variable%20strings%20with%20gettext%20or%20%22How%20to%20translate%20Doctrine%27s%20enums%22&amp;source=iXTi%26%23039%3Bs+personal+sandbox+Personal+playground+since+2006&amp;summary=Translating%20of%20something%20with%20gettext%20is%20well-discussed%20problem%2C%20so%20there%27s%20no%20need%20to%20discuss%20it%20again.%20Everything%20works%20like%20a%20charm%2C%20when%20you%20dealing%20with%20string%20constants.%20But%20what%20to%20do%20if%20you%20need%20to%20translate%20a%20string%20retrieved%20from%20some%20varia" title="LinkedIn" onclick="pageTracker._trackPageview('/outgoing/www.linkedin.com/shareArticle?mini=true_amp_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F641_amp_title=Translating_20variable_20strings_20with_20gettext_20or_20_22How_20to_20translate_20Doctrine_27s_20enums_22_amp_source=iXTi_26_23039_3Bs+personal+sandbox+Personal+playground+since+2006_amp_summary=Translating_20of_20something_20with_20gettext_20is_20well-discussed_20problem_2C_20so_20there_27s_20no_20need_20to_20discuss_20it_20again._20Everything_20works_20like_20a_20charm_2C_20when_20you_20dealing_20with_20string_20constants._20But_20what_20to_20do_20if_20you_20need_20to_20translate_20a_20string_20retrieved_20from_20some_20varia&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F641&amp;partner=sociable" title="PDF" onclick="pageTracker._trackPageview('/outgoing/www.printfriendly.com/print?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F641_amp_partner=sociable&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/pdf.png" title="PDF" alt="PDF" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Translating%20variable%20strings%20with%20gettext%20or%20%22How%20to%20translate%20Doctrine%27s%20enums%22&amp;body=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F641" title="email"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F641&amp;partner=sociable" title="Print" onclick="pageTracker._trackPageview('/outgoing/www.printfriendly.com/print?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F641_amp_partner=sociable&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>


<br/><br/><img src="http://feeds.feedburner.com/~r/ixti/~4/68HyrfQNx80" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.ixti.ru/archives/641/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.ixti.ru/archives/641</feedburner:origLink></item>
		<item>
		<title>WeeChat and jabber.py</title>
		<link>http://feedproxy.google.com/~r/ixti/~3/T4PiLm5mgv8/615</link>
		<comments>http://blog.ixti.ru/archives/615#comments</comments>
		<pubDate>Sun, 01 Aug 2010 11:44:42 +0000</pubDate>
		<dc:creator>ixti</dc:creator>
				<category><![CDATA[WeeChat]]></category>
		<category><![CDATA[irc]]></category>
		<category><![CDATA[jabber]]></category>
		<category><![CDATA[patch]]></category>
		<category><![CDATA[plug-in]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[xmpp]]></category>

		<guid isPermaLink="false">http://blog.ixti.ru/?p=615</guid>
		<description><![CDATA[There’s awesome IRC client — WeeChat. It’s very powerfull and extensible. And the only thing I miss in it is full XMPP suport, so I still using tkabber for XMPP. Thankfully WeeChat has a plugin, that gives you at least &#8230; <a href="http://blog.ixti.ru/archives/615">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>There’s awesome IRC client — <a href="http://www.weechat.org/" onclick="pageTracker._trackPageview('/outgoing/www.weechat.org/?referer=');">WeeChat</a>. It’s very powerfull and extensible. And the only thing I miss in it is full XMPP suport, so I still using <a href="http://tkabber.jabber.ru/" onclick="pageTracker._trackPageview('/outgoing/tkabber.jabber.ru/?referer=');">tkabber</a> for XMPP. Thankfully WeeChat has a <a href="http://www.weechat.org/files/scripts/unofficial/jabber.py" onclick="pageTracker._trackPageview('/outgoing/www.weechat.org/files/scripts/unofficial/jabber.py?referer=');">plugin</a>, that gives you at least XMPP private messaging support. But as some of my buddies are using non-ascii it was not working properly, throwing <code>UnicodeEncodeError</code> exception…<br />
<span id="more-615"></span></p>
<p>After I have asked FlashCode about this bug, he told me that I’m free to make a patch. So after this, even the fact that I’m not very familiar with Python could not stop me to produce such. So I will appreciate any critics and comments on my patch :)) I have sent my patch to FlashCode, so probably he will include it into his repo.</p>
<p>For those who want it right now, you can grab either a patch to original plug-in or already patched version right here.</p>
<p><ins datetime="2010-08-01T18:43:33+00:00">UPDATE</ins> Sebastien (AKA FlashCode) merged this patch into repo, so it’s now publically available at unofficial WeeChat scripts repo :))</p>
<p><ins datetime="2010-08-02T16:36:21+00:00">UPDATE</ins> Woo-hoo! jabber.py is in official WeeChat repo! ;))</p>






	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F615&amp;title=WeeChat%20and%20jabber.py&amp;notes=There%27s%20awesome%20IRC%20client%20-%20WeeChat.%20It%27s%20very%20powerfull%20and%20extensible.%20And%20the%20only%20thing%20I%20miss%20in%20it%20is%20full%20XMPP%20suport%2C%20so%20I%20still%20using%20tkabber%20for%20XMPP.%20Thankfully%20WeeChat%20has%20a%20plugin%2C%20that%20gives%20you%20at%20least%20XMPP%20private%20messaging%20support." title="del.icio.us" onclick="pageTracker._trackPageview('/outgoing/delicious.com/post?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F615_amp_title=WeeChat_20and_20jabber.py_amp_notes=There_27s_20awesome_20IRC_20client_20-_20WeeChat._20It_27s_20very_20powerfull_20and_20extensible._20And_20the_20only_20thing_20I_20miss_20in_20it_20is_20full_20XMPP_20suport_2C_20so_20I_20still_20using_20tkabber_20for_20XMPP._20Thankfully_20WeeChat_20has_20a_20plugin_2C_20that_20gives_20you_20at_20least_20XMPP_20private_20messaging_20support.&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F615&amp;title=WeeChat%20and%20jabber.py&amp;annotation=There%27s%20awesome%20IRC%20client%20-%20WeeChat.%20It%27s%20very%20powerfull%20and%20extensible.%20And%20the%20only%20thing%20I%20miss%20in%20it%20is%20full%20XMPP%20suport%2C%20so%20I%20still%20using%20tkabber%20for%20XMPP.%20Thankfully%20WeeChat%20has%20a%20plugin%2C%20that%20gives%20you%20at%20least%20XMPP%20private%20messaging%20support." title="Google Bookmarks" onclick="pageTracker._trackPageview('/outgoing/www.google.com/bookmarks/mark?op=edit_amp_bkmk=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F615_amp_title=WeeChat_20and_20jabber.py_amp_annotation=There_27s_20awesome_20IRC_20client_20-_20WeeChat._20It_27s_20very_20powerfull_20and_20extensible._20And_20the_20only_20thing_20I_20miss_20in_20it_20is_20full_20XMPP_20suport_2C_20so_20I_20still_20using_20tkabber_20for_20XMPP._20Thankfully_20WeeChat_20has_20a_20plugin_2C_20that_20gives_20you_20at_20least_20XMPP_20private_20messaging_20support.&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://identi.ca/notice/new?status_textarea=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F615" title="Identi.ca" onclick="pageTracker._trackPageview('/outgoing/identi.ca/notice/new?status_textarea=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F615&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/identica.png" title="Identi.ca" alt="Identi.ca" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=WeeChat%20and%20jabber.py%20-%20http%3A%2F%2Fblog.ixti.ru%2Farchives%2F615" title="Twitter" onclick="pageTracker._trackPageview('/outgoing/twitter.com/home?status=WeeChat_20and_20jabber.py_20-_20http_3A_2F_2Fblog.ixti.ru_2Farchives_2F615&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F615" title="Technorati" onclick="pageTracker._trackPageview('/outgoing/technorati.com/faves?add=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F615&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F615&amp;title=WeeChat%20and%20jabber.py&amp;bodytext=There%27s%20awesome%20IRC%20client%20-%20WeeChat.%20It%27s%20very%20powerfull%20and%20extensible.%20And%20the%20only%20thing%20I%20miss%20in%20it%20is%20full%20XMPP%20suport%2C%20so%20I%20still%20using%20tkabber%20for%20XMPP.%20Thankfully%20WeeChat%20has%20a%20plugin%2C%20that%20gives%20you%20at%20least%20XMPP%20private%20messaging%20support." title="Digg" onclick="pageTracker._trackPageview('/outgoing/digg.com/submit?phase=2_amp_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F615_amp_title=WeeChat_20and_20jabber.py_amp_bodytext=There_27s_20awesome_20IRC_20client_20-_20WeeChat._20It_27s_20very_20powerfull_20and_20extensible._20And_20the_20only_20thing_20I_20miss_20in_20it_20is_20full_20XMPP_20suport_2C_20so_20I_20still_20using_20tkabber_20for_20XMPP._20Thankfully_20WeeChat_20has_20a_20plugin_2C_20that_20gives_20you_20at_20least_20XMPP_20private_20messaging_20support.&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://slashdot.org/bookmark.pl?title=WeeChat%20and%20jabber.py&amp;url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F615" title="Slashdot" onclick="pageTracker._trackPageview('/outgoing/slashdot.org/bookmark.pl?title=WeeChat_20and_20jabber.py_amp_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F615&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F615&amp;t=WeeChat%20and%20jabber.py" title="Facebook" onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/share.php?u=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F615_amp_t=WeeChat_20and_20jabber.py&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mister-wong.com/addurl/?bm_url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F615&amp;bm_description=WeeChat%20and%20jabber.py&amp;plugin=soc" title="MisterWong" onclick="pageTracker._trackPageview('/outgoing/www.mister-wong.com/addurl/?bm_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F615_amp_bm_description=WeeChat_20and_20jabber.py_amp_plugin=soc&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/misterwong.png" title="MisterWong" alt="MisterWong" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F615&amp;title=WeeChat%20and%20jabber.py" title="Reddit" onclick="pageTracker._trackPageview('/outgoing/reddit.com/submit?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F615_amp_title=WeeChat_20and_20jabber.py&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F615&amp;title=WeeChat%20and%20jabber.py" title="StumbleUpon" onclick="pageTracker._trackPageview('/outgoing/www.stumbleupon.com/submit?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F615_amp_title=WeeChat_20and_20jabber.py&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F615&amp;title=WeeChat%20and%20jabber.py" title="Mixx" onclick="pageTracker._trackPageview('/outgoing/www.mixx.com/submit?page_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F615_amp_title=WeeChat_20and_20jabber.py&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://hellotxt.com/?status=WeeChat%20and%20jabber.py+http%3A%2F%2Fblog.ixti.ru%2Farchives%2F615" title="HelloTxt" onclick="pageTracker._trackPageview('/outgoing/hellotxt.com/?status=WeeChat_20and_20jabber.py+http_3A_2F_2Fblog.ixti.ru_2Farchives_2F615&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/hellotxt.png" title="HelloTxt" alt="HelloTxt" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F615&amp;title=WeeChat%20and%20jabber.py&amp;source=iXTi%26%23039%3Bs+personal+sandbox+Personal+playground+since+2006&amp;summary=There%27s%20awesome%20IRC%20client%20-%20WeeChat.%20It%27s%20very%20powerfull%20and%20extensible.%20And%20the%20only%20thing%20I%20miss%20in%20it%20is%20full%20XMPP%20suport%2C%20so%20I%20still%20using%20tkabber%20for%20XMPP.%20Thankfully%20WeeChat%20has%20a%20plugin%2C%20that%20gives%20you%20at%20least%20XMPP%20private%20messaging%20support." title="LinkedIn" onclick="pageTracker._trackPageview('/outgoing/www.linkedin.com/shareArticle?mini=true_amp_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F615_amp_title=WeeChat_20and_20jabber.py_amp_source=iXTi_26_23039_3Bs+personal+sandbox+Personal+playground+since+2006_amp_summary=There_27s_20awesome_20IRC_20client_20-_20WeeChat._20It_27s_20very_20powerfull_20and_20extensible._20And_20the_20only_20thing_20I_20miss_20in_20it_20is_20full_20XMPP_20suport_2C_20so_20I_20still_20using_20tkabber_20for_20XMPP._20Thankfully_20WeeChat_20has_20a_20plugin_2C_20that_20gives_20you_20at_20least_20XMPP_20private_20messaging_20support.&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F615&amp;partner=sociable" title="PDF" onclick="pageTracker._trackPageview('/outgoing/www.printfriendly.com/print?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F615_amp_partner=sociable&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/pdf.png" title="PDF" alt="PDF" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=WeeChat%20and%20jabber.py&amp;body=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F615" title="email"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F615&amp;partner=sociable" title="Print" onclick="pageTracker._trackPageview('/outgoing/www.printfriendly.com/print?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F615_amp_partner=sociable&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>


<br/><br/><img src="http://feeds.feedburner.com/~r/ixti/~4/T4PiLm5mgv8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.ixti.ru/archives/615/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.ixti.ru/archives/615</feedburner:origLink></item>
		<item>
		<title>qTip v.1.0.0-rc3 for jQuery v.1.4.2</title>
		<link>http://feedproxy.google.com/~r/ixti/~3/GEvmcEeBqm8/605</link>
		<comments>http://blog.ixti.ru/archives/605#comments</comments>
		<pubDate>Sun, 18 Jul 2010 09:25:22 +0000</pubDate>
		<dc:creator>ixti</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[notification]]></category>
		<category><![CDATA[patch]]></category>
		<category><![CDATA[plug-in]]></category>

		<guid isPermaLink="false">http://blog.ixti.ru/?p=605</guid>
		<description><![CDATA[If you are using qTip plug-in for jQuery and have updated your jQuery to version 1.4.2, you might notice that qTip become broken. That’s because of jQuery’s change in logic of jQuery.data(el, key, data) function. Before version v.1.4.2 it returned &#8230; <a href="http://blog.ixti.ru/archives/605">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you are using <a href="http://craigsworks.com/projects/qtip/" onclick="pageTracker._trackPageview('/outgoing/craigsworks.com/projects/qtip/?referer=');">qTip plug-in</a> for <a href="http://jquery.com/" onclick="pageTracker._trackPageview('/outgoing/jquery.com/?referer=');">jQuery</a> and have updated your jQuery to version 1.4.2, you might notice that qTip become broken. That’s because of jQuery’s change in logic of <code>jQuery.data(el, key, data)</code> function. Before version v.1.4.2 it returned <code>undefined</code> upon requesting undefined data, and now it returns <code>null</code>, so <code>typeof $(this).data('qtip') == 'undefined'</code> check in the qTip fails, as <code>null</code> is <em>object</em>…<br />
<span id="more-605"></span></p>
<p>In order to avoid this (and make qTip v.1.0.0-rc3 compatible with jQuery v.1.4.2) I have extended such conditions with something like <code>null === $(this).data('qtip')</code> just to keep close to the original, but become v.1.4.2 compatible :))</p>
<p>I have already sent patch to Craig Thompson (author of qTip), so proably when he’ll have some time he will apply it and upload new version of qTip on it’s official homepage. But before it will (or will not) happen, you can grab your very own copy of patch (or simply patched version) from here.</p>
<p><ins datetime="2010-07-28T16:01:18+00:00">UPDATE:</ins> Seems like next release of jQuery will bring “broken” parts fixed again. The problem with v.1.4.2 was because of <code>$.data()</code> function returned <code>null</code> upon undefined value instead of <code>undefined</code> as previous releases. And right now in the trunk it’s code was fixed, so it returns <code>undefined</code> again :)) So instead of using this patch you can simply update your jQuery to the bleeding edge ;))</p>






	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F605&amp;title=qTip%20v.1.0.0-rc3%20for%20jQuery%20v.1.4.2&amp;notes=If%20you%20are%20using%20qTip%20plug-in%20for%20jQuery%20and%20have%20updated%20your%20jQuery%20to%20version%201.4.2%2C%20you%20might%20notice%20that%20qTip%20become%20broken.%20That%27s%20because%20of%20jQuery%27s%20change%20in%20logic%20of%20jQuery.data%28el%2C%20key%2C%20data%29%20function.%20Before%20version%20v.1.4.2%20it%20returned%20un" title="del.icio.us" onclick="pageTracker._trackPageview('/outgoing/delicious.com/post?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F605_amp_title=qTip_20v.1.0.0-rc3_20for_20jQuery_20v.1.4.2_amp_notes=If_20you_20are_20using_20qTip_20plug-in_20for_20jQuery_20and_20have_20updated_20your_20jQuery_20to_20version_201.4.2_2C_20you_20might_20notice_20that_20qTip_20become_20broken._20That_27s_20because_20of_20jQuery_27s_20change_20in_20logic_20of_20jQuery.data_28el_2C_20key_2C_20data_29_20function._20Before_20version_20v.1.4.2_20it_20returned_20un&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F605&amp;title=qTip%20v.1.0.0-rc3%20for%20jQuery%20v.1.4.2&amp;annotation=If%20you%20are%20using%20qTip%20plug-in%20for%20jQuery%20and%20have%20updated%20your%20jQuery%20to%20version%201.4.2%2C%20you%20might%20notice%20that%20qTip%20become%20broken.%20That%27s%20because%20of%20jQuery%27s%20change%20in%20logic%20of%20jQuery.data%28el%2C%20key%2C%20data%29%20function.%20Before%20version%20v.1.4.2%20it%20returned%20un" title="Google Bookmarks" onclick="pageTracker._trackPageview('/outgoing/www.google.com/bookmarks/mark?op=edit_amp_bkmk=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F605_amp_title=qTip_20v.1.0.0-rc3_20for_20jQuery_20v.1.4.2_amp_annotation=If_20you_20are_20using_20qTip_20plug-in_20for_20jQuery_20and_20have_20updated_20your_20jQuery_20to_20version_201.4.2_2C_20you_20might_20notice_20that_20qTip_20become_20broken._20That_27s_20because_20of_20jQuery_27s_20change_20in_20logic_20of_20jQuery.data_28el_2C_20key_2C_20data_29_20function._20Before_20version_20v.1.4.2_20it_20returned_20un&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://identi.ca/notice/new?status_textarea=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F605" title="Identi.ca" onclick="pageTracker._trackPageview('/outgoing/identi.ca/notice/new?status_textarea=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F605&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/identica.png" title="Identi.ca" alt="Identi.ca" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=qTip%20v.1.0.0-rc3%20for%20jQuery%20v.1.4.2%20-%20http%3A%2F%2Fblog.ixti.ru%2Farchives%2F605" title="Twitter" onclick="pageTracker._trackPageview('/outgoing/twitter.com/home?status=qTip_20v.1.0.0-rc3_20for_20jQuery_20v.1.4.2_20-_20http_3A_2F_2Fblog.ixti.ru_2Farchives_2F605&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F605" title="Technorati" onclick="pageTracker._trackPageview('/outgoing/technorati.com/faves?add=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F605&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F605&amp;title=qTip%20v.1.0.0-rc3%20for%20jQuery%20v.1.4.2&amp;bodytext=If%20you%20are%20using%20qTip%20plug-in%20for%20jQuery%20and%20have%20updated%20your%20jQuery%20to%20version%201.4.2%2C%20you%20might%20notice%20that%20qTip%20become%20broken.%20That%27s%20because%20of%20jQuery%27s%20change%20in%20logic%20of%20jQuery.data%28el%2C%20key%2C%20data%29%20function.%20Before%20version%20v.1.4.2%20it%20returned%20un" title="Digg" onclick="pageTracker._trackPageview('/outgoing/digg.com/submit?phase=2_amp_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F605_amp_title=qTip_20v.1.0.0-rc3_20for_20jQuery_20v.1.4.2_amp_bodytext=If_20you_20are_20using_20qTip_20plug-in_20for_20jQuery_20and_20have_20updated_20your_20jQuery_20to_20version_201.4.2_2C_20you_20might_20notice_20that_20qTip_20become_20broken._20That_27s_20because_20of_20jQuery_27s_20change_20in_20logic_20of_20jQuery.data_28el_2C_20key_2C_20data_29_20function._20Before_20version_20v.1.4.2_20it_20returned_20un&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://slashdot.org/bookmark.pl?title=qTip%20v.1.0.0-rc3%20for%20jQuery%20v.1.4.2&amp;url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F605" title="Slashdot" onclick="pageTracker._trackPageview('/outgoing/slashdot.org/bookmark.pl?title=qTip_20v.1.0.0-rc3_20for_20jQuery_20v.1.4.2_amp_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F605&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F605&amp;t=qTip%20v.1.0.0-rc3%20for%20jQuery%20v.1.4.2" title="Facebook" onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/share.php?u=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F605_amp_t=qTip_20v.1.0.0-rc3_20for_20jQuery_20v.1.4.2&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mister-wong.com/addurl/?bm_url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F605&amp;bm_description=qTip%20v.1.0.0-rc3%20for%20jQuery%20v.1.4.2&amp;plugin=soc" title="MisterWong" onclick="pageTracker._trackPageview('/outgoing/www.mister-wong.com/addurl/?bm_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F605_amp_bm_description=qTip_20v.1.0.0-rc3_20for_20jQuery_20v.1.4.2_amp_plugin=soc&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/misterwong.png" title="MisterWong" alt="MisterWong" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F605&amp;title=qTip%20v.1.0.0-rc3%20for%20jQuery%20v.1.4.2" title="Reddit" onclick="pageTracker._trackPageview('/outgoing/reddit.com/submit?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F605_amp_title=qTip_20v.1.0.0-rc3_20for_20jQuery_20v.1.4.2&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F605&amp;title=qTip%20v.1.0.0-rc3%20for%20jQuery%20v.1.4.2" title="StumbleUpon" onclick="pageTracker._trackPageview('/outgoing/www.stumbleupon.com/submit?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F605_amp_title=qTip_20v.1.0.0-rc3_20for_20jQuery_20v.1.4.2&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F605&amp;title=qTip%20v.1.0.0-rc3%20for%20jQuery%20v.1.4.2" title="Mixx" onclick="pageTracker._trackPageview('/outgoing/www.mixx.com/submit?page_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F605_amp_title=qTip_20v.1.0.0-rc3_20for_20jQuery_20v.1.4.2&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://hellotxt.com/?status=qTip%20v.1.0.0-rc3%20for%20jQuery%20v.1.4.2+http%3A%2F%2Fblog.ixti.ru%2Farchives%2F605" title="HelloTxt" onclick="pageTracker._trackPageview('/outgoing/hellotxt.com/?status=qTip_20v.1.0.0-rc3_20for_20jQuery_20v.1.4.2+http_3A_2F_2Fblog.ixti.ru_2Farchives_2F605&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/hellotxt.png" title="HelloTxt" alt="HelloTxt" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F605&amp;title=qTip%20v.1.0.0-rc3%20for%20jQuery%20v.1.4.2&amp;source=iXTi%26%23039%3Bs+personal+sandbox+Personal+playground+since+2006&amp;summary=If%20you%20are%20using%20qTip%20plug-in%20for%20jQuery%20and%20have%20updated%20your%20jQuery%20to%20version%201.4.2%2C%20you%20might%20notice%20that%20qTip%20become%20broken.%20That%27s%20because%20of%20jQuery%27s%20change%20in%20logic%20of%20jQuery.data%28el%2C%20key%2C%20data%29%20function.%20Before%20version%20v.1.4.2%20it%20returned%20un" title="LinkedIn" onclick="pageTracker._trackPageview('/outgoing/www.linkedin.com/shareArticle?mini=true_amp_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F605_amp_title=qTip_20v.1.0.0-rc3_20for_20jQuery_20v.1.4.2_amp_source=iXTi_26_23039_3Bs+personal+sandbox+Personal+playground+since+2006_amp_summary=If_20you_20are_20using_20qTip_20plug-in_20for_20jQuery_20and_20have_20updated_20your_20jQuery_20to_20version_201.4.2_2C_20you_20might_20notice_20that_20qTip_20become_20broken._20That_27s_20because_20of_20jQuery_27s_20change_20in_20logic_20of_20jQuery.data_28el_2C_20key_2C_20data_29_20function._20Before_20version_20v.1.4.2_20it_20returned_20un&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F605&amp;partner=sociable" title="PDF" onclick="pageTracker._trackPageview('/outgoing/www.printfriendly.com/print?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F605_amp_partner=sociable&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/pdf.png" title="PDF" alt="PDF" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=qTip%20v.1.0.0-rc3%20for%20jQuery%20v.1.4.2&amp;body=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F605" title="email"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F605&amp;partner=sociable" title="Print" onclick="pageTracker._trackPageview('/outgoing/www.printfriendly.com/print?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F605_amp_partner=sociable&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>


<br/><br/><img src="http://feeds.feedburner.com/~r/ixti/~4/GEvmcEeBqm8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.ixti.ru/archives/605/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://blog.ixti.ru/archives/605</feedburner:origLink></item>
		<item>
		<title>Fast debug someone else’s PHP application</title>
		<link>http://feedproxy.google.com/~r/ixti/~3/8-Qz9tu82Ec/597</link>
		<comments>http://blog.ixti.ru/archives/597#comments</comments>
		<pubDate>Mon, 12 Jul 2010 13:23:13 +0000</pubDate>
		<dc:creator>ixti</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[How To's]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tip]]></category>
		<category><![CDATA[tracing]]></category>

		<guid isPermaLink="false">http://blog.ixti.ru/?p=597</guid>
		<description><![CDATA[Sometimes you need to make a small fix to someone’s code (e.g. you are hacking existing application). And unfortunately 85% times you’ll meet strange bugs. Most of such bugs are because of unexpected “input”, e.g. you expect that variable should &#8230; <a href="http://blog.ixti.ru/archives/597">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Sometimes you need to make a small fix to someone’s code (e.g. you are hacking existing application). And unfortunately 85% times you’ll meet strange bugs. Most of such bugs are because of unexpected “input”, e.g. you expect that variable should be string <code>abc</code> while in fact it’s integer <code>123</code>. So to check what was “received” you’ll want to output it’s value somewhere. But (!) in 90% of times there will be NO logging system in application at all, or it will be as usefull as nothing…<br />
<span id="more-597"></span></p>
<p>Of course you can spend some time and connect your own logging system. But do you really think someone will thank you for this? Nope. If it’s not an application you are going to support long time and nobody ‘s going to pay for such improvement, there’s no such need. So what you can do? For CLI application, you can simply use <em>STDOUT</em> or <em>STDERR</em> to output some info there:</p>
<pre class="brush: php; light: true;">
fwrite(STDERR, '$var is: ' . $var);
</pre>
<p>In fact it will help even with web application, at least if you know where error log is placed in the system and if it’s enabled. But there’s more robust and easier way — <code>syslog()</code>:</p>
<pre class="brush: php; light: true;">
syslog(LOG_DEBUG, '$var is: ' . $var);
</pre>
<p>This will write a message into your system log (which is the most easy to find place) with DEBUG priority. And here’s little bit more complex but very useful snippet with output buffer control and <code>syslog()</code> functions:</p>
<pre class="brush: php; light: true;">
ob_start();
var_dump($var);
syslog(LOG_DEBUG, ob_get_clean());
</pre>
<p>But don’t forget that <code>syslog()</code> has limited length of message. :)) And in fact it’s really not the best place for such output so you should use it only for one-two times check — don’t forget to wipe out it from application once you’ll got what you wanted :))</p>
<p>And finally here’s one helping thing. When you need to figure out call trace of application’s request, you can use powerfull PHP debugger — <a href="http://www.xdebug.org/" onclick="pageTracker._trackPageview('/outgoing/www.xdebug.org/?referer=');">XDebug</a>. It has special mode in which it will trace every function/method call. To use it you might want to enable it from within CLI:</p>
<pre class="brush: plain; light: true;">
$ php -d xdebug.auto_trace=1 test.php
</pre>
<p>By default (if you have not configured tracing of XDebug) it will create a file under <code>/tmp</code> with file named something like this: <em>trace.180077614.xt</em>. File is really easy to read. So for example let’s say we have <em>test.php</em> with following content:</p>
<pre class="brush: php;">
&lt;?php
syslog(LOG_DEBUG, 'test');
echo 'boo';
</pre>
<p>For this file trace will be like this:</p>
<pre class="brush: plain; light: true;">
TRACE START [2010-07-12 13:14:55]
    0.0004     320332   -&gt; {main}() /tmp/test.php:0
    0.0198     320496     -&gt; syslog() /tmp/test.php:2
    0.0205       8252
TRACE END   [2010-07-12 13:14:56]
</pre>






	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F597&amp;title=Fast%20debug%20someone%20else%27s%20PHP%20application&amp;notes=Sometimes%20you%20need%20to%20make%20a%20small%20fix%20to%20someone%27s%20code%20%28e.g.%20you%20are%20hacking%20existing%20application%29.%20And%20unfortunately%2085%25%20times%20you%27ll%20meet%20strange%20bugs.%20Most%20of%20such%20bugs%20are%20because%20of%20unexpected%20%22input%22%2C%20e.g.%20you%20expect%20that%20variable%20should%20be%20s" title="del.icio.us" onclick="pageTracker._trackPageview('/outgoing/delicious.com/post?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F597_amp_title=Fast_20debug_20someone_20else_27s_20PHP_20application_amp_notes=Sometimes_20you_20need_20to_20make_20a_20small_20fix_20to_20someone_27s_20code_20_28e.g._20you_20are_20hacking_20existing_20application_29._20And_20unfortunately_2085_25_20times_20you_27ll_20meet_20strange_20bugs._20Most_20of_20such_20bugs_20are_20because_20of_20unexpected_20_22input_22_2C_20e.g._20you_20expect_20that_20variable_20should_20be_20s&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F597&amp;title=Fast%20debug%20someone%20else%27s%20PHP%20application&amp;annotation=Sometimes%20you%20need%20to%20make%20a%20small%20fix%20to%20someone%27s%20code%20%28e.g.%20you%20are%20hacking%20existing%20application%29.%20And%20unfortunately%2085%25%20times%20you%27ll%20meet%20strange%20bugs.%20Most%20of%20such%20bugs%20are%20because%20of%20unexpected%20%22input%22%2C%20e.g.%20you%20expect%20that%20variable%20should%20be%20s" title="Google Bookmarks" onclick="pageTracker._trackPageview('/outgoing/www.google.com/bookmarks/mark?op=edit_amp_bkmk=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F597_amp_title=Fast_20debug_20someone_20else_27s_20PHP_20application_amp_annotation=Sometimes_20you_20need_20to_20make_20a_20small_20fix_20to_20someone_27s_20code_20_28e.g._20you_20are_20hacking_20existing_20application_29._20And_20unfortunately_2085_25_20times_20you_27ll_20meet_20strange_20bugs._20Most_20of_20such_20bugs_20are_20because_20of_20unexpected_20_22input_22_2C_20e.g._20you_20expect_20that_20variable_20should_20be_20s&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://identi.ca/notice/new?status_textarea=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F597" title="Identi.ca" onclick="pageTracker._trackPageview('/outgoing/identi.ca/notice/new?status_textarea=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F597&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/identica.png" title="Identi.ca" alt="Identi.ca" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Fast%20debug%20someone%20else%27s%20PHP%20application%20-%20http%3A%2F%2Fblog.ixti.ru%2Farchives%2F597" title="Twitter" onclick="pageTracker._trackPageview('/outgoing/twitter.com/home?status=Fast_20debug_20someone_20else_27s_20PHP_20application_20-_20http_3A_2F_2Fblog.ixti.ru_2Farchives_2F597&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F597" title="Technorati" onclick="pageTracker._trackPageview('/outgoing/technorati.com/faves?add=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F597&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F597&amp;title=Fast%20debug%20someone%20else%27s%20PHP%20application&amp;bodytext=Sometimes%20you%20need%20to%20make%20a%20small%20fix%20to%20someone%27s%20code%20%28e.g.%20you%20are%20hacking%20existing%20application%29.%20And%20unfortunately%2085%25%20times%20you%27ll%20meet%20strange%20bugs.%20Most%20of%20such%20bugs%20are%20because%20of%20unexpected%20%22input%22%2C%20e.g.%20you%20expect%20that%20variable%20should%20be%20s" title="Digg" onclick="pageTracker._trackPageview('/outgoing/digg.com/submit?phase=2_amp_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F597_amp_title=Fast_20debug_20someone_20else_27s_20PHP_20application_amp_bodytext=Sometimes_20you_20need_20to_20make_20a_20small_20fix_20to_20someone_27s_20code_20_28e.g._20you_20are_20hacking_20existing_20application_29._20And_20unfortunately_2085_25_20times_20you_27ll_20meet_20strange_20bugs._20Most_20of_20such_20bugs_20are_20because_20of_20unexpected_20_22input_22_2C_20e.g._20you_20expect_20that_20variable_20should_20be_20s&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://slashdot.org/bookmark.pl?title=Fast%20debug%20someone%20else%27s%20PHP%20application&amp;url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F597" title="Slashdot" onclick="pageTracker._trackPageview('/outgoing/slashdot.org/bookmark.pl?title=Fast_20debug_20someone_20else_27s_20PHP_20application_amp_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F597&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F597&amp;t=Fast%20debug%20someone%20else%27s%20PHP%20application" title="Facebook" onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/share.php?u=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F597_amp_t=Fast_20debug_20someone_20else_27s_20PHP_20application&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mister-wong.com/addurl/?bm_url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F597&amp;bm_description=Fast%20debug%20someone%20else%27s%20PHP%20application&amp;plugin=soc" title="MisterWong" onclick="pageTracker._trackPageview('/outgoing/www.mister-wong.com/addurl/?bm_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F597_amp_bm_description=Fast_20debug_20someone_20else_27s_20PHP_20application_amp_plugin=soc&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/misterwong.png" title="MisterWong" alt="MisterWong" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F597&amp;title=Fast%20debug%20someone%20else%27s%20PHP%20application" title="Reddit" onclick="pageTracker._trackPageview('/outgoing/reddit.com/submit?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F597_amp_title=Fast_20debug_20someone_20else_27s_20PHP_20application&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F597&amp;title=Fast%20debug%20someone%20else%27s%20PHP%20application" title="StumbleUpon" onclick="pageTracker._trackPageview('/outgoing/www.stumbleupon.com/submit?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F597_amp_title=Fast_20debug_20someone_20else_27s_20PHP_20application&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F597&amp;title=Fast%20debug%20someone%20else%27s%20PHP%20application" title="Mixx" onclick="pageTracker._trackPageview('/outgoing/www.mixx.com/submit?page_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F597_amp_title=Fast_20debug_20someone_20else_27s_20PHP_20application&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://hellotxt.com/?status=Fast%20debug%20someone%20else%27s%20PHP%20application+http%3A%2F%2Fblog.ixti.ru%2Farchives%2F597" title="HelloTxt" onclick="pageTracker._trackPageview('/outgoing/hellotxt.com/?status=Fast_20debug_20someone_20else_27s_20PHP_20application+http_3A_2F_2Fblog.ixti.ru_2Farchives_2F597&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/hellotxt.png" title="HelloTxt" alt="HelloTxt" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F597&amp;title=Fast%20debug%20someone%20else%27s%20PHP%20application&amp;source=iXTi%26%23039%3Bs+personal+sandbox+Personal+playground+since+2006&amp;summary=Sometimes%20you%20need%20to%20make%20a%20small%20fix%20to%20someone%27s%20code%20%28e.g.%20you%20are%20hacking%20existing%20application%29.%20And%20unfortunately%2085%25%20times%20you%27ll%20meet%20strange%20bugs.%20Most%20of%20such%20bugs%20are%20because%20of%20unexpected%20%22input%22%2C%20e.g.%20you%20expect%20that%20variable%20should%20be%20s" title="LinkedIn" onclick="pageTracker._trackPageview('/outgoing/www.linkedin.com/shareArticle?mini=true_amp_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F597_amp_title=Fast_20debug_20someone_20else_27s_20PHP_20application_amp_source=iXTi_26_23039_3Bs+personal+sandbox+Personal+playground+since+2006_amp_summary=Sometimes_20you_20need_20to_20make_20a_20small_20fix_20to_20someone_27s_20code_20_28e.g._20you_20are_20hacking_20existing_20application_29._20And_20unfortunately_2085_25_20times_20you_27ll_20meet_20strange_20bugs._20Most_20of_20such_20bugs_20are_20because_20of_20unexpected_20_22input_22_2C_20e.g._20you_20expect_20that_20variable_20should_20be_20s&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F597&amp;partner=sociable" title="PDF" onclick="pageTracker._trackPageview('/outgoing/www.printfriendly.com/print?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F597_amp_partner=sociable&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/pdf.png" title="PDF" alt="PDF" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Fast%20debug%20someone%20else%27s%20PHP%20application&amp;body=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F597" title="email"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F597&amp;partner=sociable" title="Print" onclick="pageTracker._trackPageview('/outgoing/www.printfriendly.com/print?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F597_amp_partner=sociable&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>


<br/><br/><img src="http://feeds.feedburner.com/~r/ixti/~4/8-Qz9tu82Ec" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.ixti.ru/archives/597/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.ixti.ru/archives/597</feedburner:origLink></item>
		<item>
		<title>Adding thousands separators to a number</title>
		<link>http://feedproxy.google.com/~r/ixti/~3/p87V0tWmYWk/584</link>
		<comments>http://blog.ixti.ru/archives/584#comments</comments>
		<pubDate>Sat, 10 Jul 2010 12:20:08 +0000</pubDate>
		<dc:creator>ixti</dc:creator>
				<category><![CDATA[How To's]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[regexp]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://blog.ixti.ru/?p=584</guid>
		<description><![CDATA[Today Marco shared on his blog an idea how to add thousands separators on CLI with help of standard printf function, and Perl, and sed, and awk. So I want to extend his post with same thing but in PHP, &#8230; <a href="http://blog.ixti.ru/archives/584">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Today Marco shared on his blog an idea how to <a href="http://mydebian.blogdns.org/?p=777" onclick="pageTracker._trackPageview('/outgoing/mydebian.blogdns.org/?p=777&amp;referer=');">add thousands separators on CLI</a> with help of standard printf function, and Perl, and sed, and awk. So I want to extend his post with same thing but in PHP, Ruby and Python. Of course you can achieve same with <code>printf</code> functions of these langauages and setting correct locale, but it’s not as interesting as one-line things. :)) So here we go…<br />
<span id="more-584"></span></p>
<p><strong>PHP</strong><br />
There are many ways to achieve this. But I’m going to show the most short and clean variants :)) Let’s start with regular expressions usage. First way is to split string with regular expression into an array of chunks and then join them with comma clue, like this:</p>
<pre class="brush: plain; light: true;">
$ php -r 'echo implode(&quot;,&quot;, preg_split(&quot;/(?&lt;=\d)(?=(\d{3})+$)/&quot;, $argv[1])) . &quot;\n&quot;;' 1234
</pre>
<p>Also, you can use <code>preg_replace()</code> function:</p>
<pre class="brush: plain; light: true;">
$ php -r 'echo preg_replace(&quot;/(\d{1,3})(?=(\d{3})+$)/&quot;, &quot;\\1,&quot;, $argv[1]) . &quot;\n&quot;;' 1234
</pre>
<p>And finally you can simply use <code>number_format()</code> function:</p>
<pre class="brush: plain; light: true;">
$ php -r 'echo number_format($argv[1], 0, &quot;.&quot;, &quot;,&quot;) . &quot;\n&quot;;' 1234
</pre>
<p><strong>Ruby</strong></p>
<pre class="brush: plain; light: true;">
$ ruby -e 'puts ARGV[0].gsub(/(\d{1,3})(?=(\d{3})+$)/, &quot;\\1,&quot;)' 1234
</pre>
<p><strong>Python</strong><br />
In fact I don’t have lot’s of practice in Python every-day usage, so if you know better variant, feel free to share it and point me that I’m shit ;))</p>
<pre class="brush: plain; light: true;">
$ python -c 'import sys,re; print re.sub(r&quot;(\d{1,3})(?=(\d{3})+$)&quot;, &quot;\\1,&quot;, sys.argv[1])' 1234
</pre>
<p><ins datetime="2010-07-10T12:22:55+00:00">Update</ins></p>
<p><strong>Perl</strong><br />
Basically this is alternative version of Marco’s variant, that I’ve just posted as a comment to his post :)) So I’m placing it here jsut to keep it for myself :)) In Perl you can achieve this with only assertions (like with <code>preg_split()</code> of PHP):</p>
<pre class="brush: plain; light: true;">
$ perl -pe 's/(?&lt;=\d)(?=(\d{3})+$)/,/g' &lt;&lt;&lt; 1234
</pre>
<p>Or with only one asserion:</p>
<pre class="brush: plain; light: true;">
$ perl -pe 's/(\d{1,3})(?=(\d{3})+$)/\1,/g' &lt;&lt;&lt; 1234
</pre>






	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F584&amp;title=Adding%20thousands%20separators%20to%20a%20number&amp;notes=Today%20Marco%20shared%20on%20his%20blog%20an%20idea%20how%20to%20add%20thousands%20separators%20on%20CLI%20with%20help%20of%20standard%20printf%20function%2C%20and%20Perl%2C%20and%20sed%2C%20and%20awk.%20So%20I%20want%20to%20extend%20his%20post%20with%20same%20thing%20but%20in%20PHP%2C%20Ruby%20and%20Python.%20Of%20course%20you%20can%20achieve%20same%20" title="del.icio.us" onclick="pageTracker._trackPageview('/outgoing/delicious.com/post?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F584_amp_title=Adding_20thousands_20separators_20to_20a_20number_amp_notes=Today_20Marco_20shared_20on_20his_20blog_20an_20idea_20how_20to_20add_20thousands_20separators_20on_20CLI_20with_20help_20of_20standard_20printf_20function_2C_20and_20Perl_2C_20and_20sed_2C_20and_20awk._20So_20I_20want_20to_20extend_20his_20post_20with_20same_20thing_20but_20in_20PHP_2C_20Ruby_20and_20Python._20Of_20course_20you_20can_20achieve_20same_20&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F584&amp;title=Adding%20thousands%20separators%20to%20a%20number&amp;annotation=Today%20Marco%20shared%20on%20his%20blog%20an%20idea%20how%20to%20add%20thousands%20separators%20on%20CLI%20with%20help%20of%20standard%20printf%20function%2C%20and%20Perl%2C%20and%20sed%2C%20and%20awk.%20So%20I%20want%20to%20extend%20his%20post%20with%20same%20thing%20but%20in%20PHP%2C%20Ruby%20and%20Python.%20Of%20course%20you%20can%20achieve%20same%20" title="Google Bookmarks" onclick="pageTracker._trackPageview('/outgoing/www.google.com/bookmarks/mark?op=edit_amp_bkmk=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F584_amp_title=Adding_20thousands_20separators_20to_20a_20number_amp_annotation=Today_20Marco_20shared_20on_20his_20blog_20an_20idea_20how_20to_20add_20thousands_20separators_20on_20CLI_20with_20help_20of_20standard_20printf_20function_2C_20and_20Perl_2C_20and_20sed_2C_20and_20awk._20So_20I_20want_20to_20extend_20his_20post_20with_20same_20thing_20but_20in_20PHP_2C_20Ruby_20and_20Python._20Of_20course_20you_20can_20achieve_20same_20&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://identi.ca/notice/new?status_textarea=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F584" title="Identi.ca" onclick="pageTracker._trackPageview('/outgoing/identi.ca/notice/new?status_textarea=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F584&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/identica.png" title="Identi.ca" alt="Identi.ca" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Adding%20thousands%20separators%20to%20a%20number%20-%20http%3A%2F%2Fblog.ixti.ru%2Farchives%2F584" title="Twitter" onclick="pageTracker._trackPageview('/outgoing/twitter.com/home?status=Adding_20thousands_20separators_20to_20a_20number_20-_20http_3A_2F_2Fblog.ixti.ru_2Farchives_2F584&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F584" title="Technorati" onclick="pageTracker._trackPageview('/outgoing/technorati.com/faves?add=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F584&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F584&amp;title=Adding%20thousands%20separators%20to%20a%20number&amp;bodytext=Today%20Marco%20shared%20on%20his%20blog%20an%20idea%20how%20to%20add%20thousands%20separators%20on%20CLI%20with%20help%20of%20standard%20printf%20function%2C%20and%20Perl%2C%20and%20sed%2C%20and%20awk.%20So%20I%20want%20to%20extend%20his%20post%20with%20same%20thing%20but%20in%20PHP%2C%20Ruby%20and%20Python.%20Of%20course%20you%20can%20achieve%20same%20" title="Digg" onclick="pageTracker._trackPageview('/outgoing/digg.com/submit?phase=2_amp_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F584_amp_title=Adding_20thousands_20separators_20to_20a_20number_amp_bodytext=Today_20Marco_20shared_20on_20his_20blog_20an_20idea_20how_20to_20add_20thousands_20separators_20on_20CLI_20with_20help_20of_20standard_20printf_20function_2C_20and_20Perl_2C_20and_20sed_2C_20and_20awk._20So_20I_20want_20to_20extend_20his_20post_20with_20same_20thing_20but_20in_20PHP_2C_20Ruby_20and_20Python._20Of_20course_20you_20can_20achieve_20same_20&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://slashdot.org/bookmark.pl?title=Adding%20thousands%20separators%20to%20a%20number&amp;url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F584" title="Slashdot" onclick="pageTracker._trackPageview('/outgoing/slashdot.org/bookmark.pl?title=Adding_20thousands_20separators_20to_20a_20number_amp_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F584&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F584&amp;t=Adding%20thousands%20separators%20to%20a%20number" title="Facebook" onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/share.php?u=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F584_amp_t=Adding_20thousands_20separators_20to_20a_20number&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mister-wong.com/addurl/?bm_url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F584&amp;bm_description=Adding%20thousands%20separators%20to%20a%20number&amp;plugin=soc" title="MisterWong" onclick="pageTracker._trackPageview('/outgoing/www.mister-wong.com/addurl/?bm_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F584_amp_bm_description=Adding_20thousands_20separators_20to_20a_20number_amp_plugin=soc&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/misterwong.png" title="MisterWong" alt="MisterWong" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F584&amp;title=Adding%20thousands%20separators%20to%20a%20number" title="Reddit" onclick="pageTracker._trackPageview('/outgoing/reddit.com/submit?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F584_amp_title=Adding_20thousands_20separators_20to_20a_20number&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F584&amp;title=Adding%20thousands%20separators%20to%20a%20number" title="StumbleUpon" onclick="pageTracker._trackPageview('/outgoing/www.stumbleupon.com/submit?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F584_amp_title=Adding_20thousands_20separators_20to_20a_20number&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F584&amp;title=Adding%20thousands%20separators%20to%20a%20number" title="Mixx" onclick="pageTracker._trackPageview('/outgoing/www.mixx.com/submit?page_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F584_amp_title=Adding_20thousands_20separators_20to_20a_20number&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://hellotxt.com/?status=Adding%20thousands%20separators%20to%20a%20number+http%3A%2F%2Fblog.ixti.ru%2Farchives%2F584" title="HelloTxt" onclick="pageTracker._trackPageview('/outgoing/hellotxt.com/?status=Adding_20thousands_20separators_20to_20a_20number+http_3A_2F_2Fblog.ixti.ru_2Farchives_2F584&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/hellotxt.png" title="HelloTxt" alt="HelloTxt" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F584&amp;title=Adding%20thousands%20separators%20to%20a%20number&amp;source=iXTi%26%23039%3Bs+personal+sandbox+Personal+playground+since+2006&amp;summary=Today%20Marco%20shared%20on%20his%20blog%20an%20idea%20how%20to%20add%20thousands%20separators%20on%20CLI%20with%20help%20of%20standard%20printf%20function%2C%20and%20Perl%2C%20and%20sed%2C%20and%20awk.%20So%20I%20want%20to%20extend%20his%20post%20with%20same%20thing%20but%20in%20PHP%2C%20Ruby%20and%20Python.%20Of%20course%20you%20can%20achieve%20same%20" title="LinkedIn" onclick="pageTracker._trackPageview('/outgoing/www.linkedin.com/shareArticle?mini=true_amp_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F584_amp_title=Adding_20thousands_20separators_20to_20a_20number_amp_source=iXTi_26_23039_3Bs+personal+sandbox+Personal+playground+since+2006_amp_summary=Today_20Marco_20shared_20on_20his_20blog_20an_20idea_20how_20to_20add_20thousands_20separators_20on_20CLI_20with_20help_20of_20standard_20printf_20function_2C_20and_20Perl_2C_20and_20sed_2C_20and_20awk._20So_20I_20want_20to_20extend_20his_20post_20with_20same_20thing_20but_20in_20PHP_2C_20Ruby_20and_20Python._20Of_20course_20you_20can_20achieve_20same_20&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F584&amp;partner=sociable" title="PDF" onclick="pageTracker._trackPageview('/outgoing/www.printfriendly.com/print?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F584_amp_partner=sociable&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/pdf.png" title="PDF" alt="PDF" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Adding%20thousands%20separators%20to%20a%20number&amp;body=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F584" title="email"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F584&amp;partner=sociable" title="Print" onclick="pageTracker._trackPageview('/outgoing/www.printfriendly.com/print?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F584_amp_partner=sociable&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>


<br/><br/><img src="http://feeds.feedburner.com/~r/ixti/~4/p87V0tWmYWk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.ixti.ru/archives/584/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.ixti.ru/archives/584</feedburner:origLink></item>
		<item>
		<title>Beware of PHP’s list() function</title>
		<link>http://feedproxy.google.com/~r/ixti/~3/-6bO4X4JsdU/573</link>
		<comments>http://blog.ixti.ru/archives/573#comments</comments>
		<pubDate>Sat, 26 Jun 2010 14:55:06 +0000</pubDate>
		<dc:creator>ixti</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[gotcha]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://blog.ixti.ru/?p=573</guid>
		<description><![CDATA[If you are using list() function with variable, like this: $arr = array('green', 'apple'); list($color, $fruit) = $arr; You should pay attention to the order of variables you assign if one of them has same name as initial array. Else &#8230; <a href="http://blog.ixti.ru/archives/573">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you are using <a href="http://php.net/manual/en/function.list.php" onclick="pageTracker._trackPageview('/outgoing/php.net/manual/en/function.list.php?referer=');">list()</a> function with variable, like this:</p>
<pre class="brush: php;">
$arr = array('green', 'apple');
list($color, $fruit) = $arr;
</pre>
<p>You should pay attention to the order of variables you assign if one of them has same name as initial array. Else you’ll run into madness, trying to find a bug…<br />
<span id="more-573"></span></p>
<p>I met such bug when I found my modified version of <a href="/?p=261">form to model filler</a> not working. Well ther’s not much to say. According to PHP’s manual:</p>
<blockquote><p><strong>list()</strong> assigns the values starting with the right-most parameter.</p></blockquote>
<p>This means, that if you will place variable with same name as initial one at the most right position you’ll not receive what you expect. Here are two vivid examples that will explain it better:</p>
<p><strong>The Good</strong></p>
<pre class="brush: php;">
$name = array('John', 'Doe');
list($name, $surname) = $name;

var_dump($name);    // string(4) &quot;John&quot;
var_dump($surname); // string(3) &quot;Doe&quot;
</pre>
<p><strong>The Bad</strong></p>
<pre class="brush: php;">
$path = array('Point A', 'Point B');
list($point, $path) = $path;

var_dump($point); // string(1) &quot;P&quot;
var_dump($path);  // string(7) &quot;Point B&quot;
</pre>
<p><strong>The Queen</strong><br />
<code>list()</code> works with array directly (not a copy of an array). Let’s look at <em>the bad</em> more preciously. As <code>list()</code> assigns values from right most parameter, <code>$path</code> becomes second value of initial array, so when it’s <code>$point</code>’s turn, <code>$path</code> is a <em>Point B</em> string. But you can avoid it by passing a copy of array :)) Just prepend variable with <code>(array)</code> cast instruction:</p>
<pre class="brush: php;">
$path = array('Point A', 'Point B');
list($point, $path) = (array) $path;

var_dump($point); // string(7) &quot;Point A&quot;
var_dump($path);  // string(7) &quot;Point B&quot;
</pre>






	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F573&amp;title=Beware%20of%20PHP%27s%20list%28%29%20function&amp;notes=If%20you%20are%20using%20list%28%29%20function%20with%20variable%2C%20like%20this%3A%0D%0A%5Bphp%5D%0D%0A%24arr%20%3D%20array%28%27green%27%2C%20%27apple%27%29%3B%0D%0Alist%28%24color%2C%20%24fruit%29%20%3D%20%24arr%3B%0D%0A%5B%2Fphp%5D%0D%0AYou%20should%20pay%20attention%20to%20the%20order%20of%20variables%20you%20assign%20if%20one%20of%20them%20has%20same%20name%20as%20initial%20array.%20Els" title="del.icio.us" onclick="pageTracker._trackPageview('/outgoing/delicious.com/post?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F573_amp_title=Beware_20of_20PHP_27s_20list_28_29_20function_amp_notes=If_20you_20are_20using_20list_28_29_20function_20with_20variable_2C_20like_20this_3A_0D_0A_5Bphp_5D_0D_0A_24arr_20_3D_20array_28_27green_27_2C_20_27apple_27_29_3B_0D_0Alist_28_24color_2C_20_24fruit_29_20_3D_20_24arr_3B_0D_0A_5B_2Fphp_5D_0D_0AYou_20should_20pay_20attention_20to_20the_20order_20of_20variables_20you_20assign_20if_20one_20of_20them_20has_20same_20name_20as_20initial_20array._20Els&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F573&amp;title=Beware%20of%20PHP%27s%20list%28%29%20function&amp;annotation=If%20you%20are%20using%20list%28%29%20function%20with%20variable%2C%20like%20this%3A%0D%0A%5Bphp%5D%0D%0A%24arr%20%3D%20array%28%27green%27%2C%20%27apple%27%29%3B%0D%0Alist%28%24color%2C%20%24fruit%29%20%3D%20%24arr%3B%0D%0A%5B%2Fphp%5D%0D%0AYou%20should%20pay%20attention%20to%20the%20order%20of%20variables%20you%20assign%20if%20one%20of%20them%20has%20same%20name%20as%20initial%20array.%20Els" title="Google Bookmarks" onclick="pageTracker._trackPageview('/outgoing/www.google.com/bookmarks/mark?op=edit_amp_bkmk=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F573_amp_title=Beware_20of_20PHP_27s_20list_28_29_20function_amp_annotation=If_20you_20are_20using_20list_28_29_20function_20with_20variable_2C_20like_20this_3A_0D_0A_5Bphp_5D_0D_0A_24arr_20_3D_20array_28_27green_27_2C_20_27apple_27_29_3B_0D_0Alist_28_24color_2C_20_24fruit_29_20_3D_20_24arr_3B_0D_0A_5B_2Fphp_5D_0D_0AYou_20should_20pay_20attention_20to_20the_20order_20of_20variables_20you_20assign_20if_20one_20of_20them_20has_20same_20name_20as_20initial_20array._20Els&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://identi.ca/notice/new?status_textarea=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F573" title="Identi.ca" onclick="pageTracker._trackPageview('/outgoing/identi.ca/notice/new?status_textarea=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F573&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/identica.png" title="Identi.ca" alt="Identi.ca" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Beware%20of%20PHP%27s%20list%28%29%20function%20-%20http%3A%2F%2Fblog.ixti.ru%2Farchives%2F573" title="Twitter" onclick="pageTracker._trackPageview('/outgoing/twitter.com/home?status=Beware_20of_20PHP_27s_20list_28_29_20function_20-_20http_3A_2F_2Fblog.ixti.ru_2Farchives_2F573&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F573" title="Technorati" onclick="pageTracker._trackPageview('/outgoing/technorati.com/faves?add=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F573&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F573&amp;title=Beware%20of%20PHP%27s%20list%28%29%20function&amp;bodytext=If%20you%20are%20using%20list%28%29%20function%20with%20variable%2C%20like%20this%3A%0D%0A%5Bphp%5D%0D%0A%24arr%20%3D%20array%28%27green%27%2C%20%27apple%27%29%3B%0D%0Alist%28%24color%2C%20%24fruit%29%20%3D%20%24arr%3B%0D%0A%5B%2Fphp%5D%0D%0AYou%20should%20pay%20attention%20to%20the%20order%20of%20variables%20you%20assign%20if%20one%20of%20them%20has%20same%20name%20as%20initial%20array.%20Els" title="Digg" onclick="pageTracker._trackPageview('/outgoing/digg.com/submit?phase=2_amp_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F573_amp_title=Beware_20of_20PHP_27s_20list_28_29_20function_amp_bodytext=If_20you_20are_20using_20list_28_29_20function_20with_20variable_2C_20like_20this_3A_0D_0A_5Bphp_5D_0D_0A_24arr_20_3D_20array_28_27green_27_2C_20_27apple_27_29_3B_0D_0Alist_28_24color_2C_20_24fruit_29_20_3D_20_24arr_3B_0D_0A_5B_2Fphp_5D_0D_0AYou_20should_20pay_20attention_20to_20the_20order_20of_20variables_20you_20assign_20if_20one_20of_20them_20has_20same_20name_20as_20initial_20array._20Els&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://slashdot.org/bookmark.pl?title=Beware%20of%20PHP%27s%20list%28%29%20function&amp;url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F573" title="Slashdot" onclick="pageTracker._trackPageview('/outgoing/slashdot.org/bookmark.pl?title=Beware_20of_20PHP_27s_20list_28_29_20function_amp_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F573&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F573&amp;t=Beware%20of%20PHP%27s%20list%28%29%20function" title="Facebook" onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/share.php?u=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F573_amp_t=Beware_20of_20PHP_27s_20list_28_29_20function&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mister-wong.com/addurl/?bm_url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F573&amp;bm_description=Beware%20of%20PHP%27s%20list%28%29%20function&amp;plugin=soc" title="MisterWong" onclick="pageTracker._trackPageview('/outgoing/www.mister-wong.com/addurl/?bm_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F573_amp_bm_description=Beware_20of_20PHP_27s_20list_28_29_20function_amp_plugin=soc&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/misterwong.png" title="MisterWong" alt="MisterWong" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F573&amp;title=Beware%20of%20PHP%27s%20list%28%29%20function" title="Reddit" onclick="pageTracker._trackPageview('/outgoing/reddit.com/submit?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F573_amp_title=Beware_20of_20PHP_27s_20list_28_29_20function&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F573&amp;title=Beware%20of%20PHP%27s%20list%28%29%20function" title="StumbleUpon" onclick="pageTracker._trackPageview('/outgoing/www.stumbleupon.com/submit?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F573_amp_title=Beware_20of_20PHP_27s_20list_28_29_20function&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F573&amp;title=Beware%20of%20PHP%27s%20list%28%29%20function" title="Mixx" onclick="pageTracker._trackPageview('/outgoing/www.mixx.com/submit?page_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F573_amp_title=Beware_20of_20PHP_27s_20list_28_29_20function&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://hellotxt.com/?status=Beware%20of%20PHP%27s%20list%28%29%20function+http%3A%2F%2Fblog.ixti.ru%2Farchives%2F573" title="HelloTxt" onclick="pageTracker._trackPageview('/outgoing/hellotxt.com/?status=Beware_20of_20PHP_27s_20list_28_29_20function+http_3A_2F_2Fblog.ixti.ru_2Farchives_2F573&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/hellotxt.png" title="HelloTxt" alt="HelloTxt" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F573&amp;title=Beware%20of%20PHP%27s%20list%28%29%20function&amp;source=iXTi%26%23039%3Bs+personal+sandbox+Personal+playground+since+2006&amp;summary=If%20you%20are%20using%20list%28%29%20function%20with%20variable%2C%20like%20this%3A%0D%0A%5Bphp%5D%0D%0A%24arr%20%3D%20array%28%27green%27%2C%20%27apple%27%29%3B%0D%0Alist%28%24color%2C%20%24fruit%29%20%3D%20%24arr%3B%0D%0A%5B%2Fphp%5D%0D%0AYou%20should%20pay%20attention%20to%20the%20order%20of%20variables%20you%20assign%20if%20one%20of%20them%20has%20same%20name%20as%20initial%20array.%20Els" title="LinkedIn" onclick="pageTracker._trackPageview('/outgoing/www.linkedin.com/shareArticle?mini=true_amp_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F573_amp_title=Beware_20of_20PHP_27s_20list_28_29_20function_amp_source=iXTi_26_23039_3Bs+personal+sandbox+Personal+playground+since+2006_amp_summary=If_20you_20are_20using_20list_28_29_20function_20with_20variable_2C_20like_20this_3A_0D_0A_5Bphp_5D_0D_0A_24arr_20_3D_20array_28_27green_27_2C_20_27apple_27_29_3B_0D_0Alist_28_24color_2C_20_24fruit_29_20_3D_20_24arr_3B_0D_0A_5B_2Fphp_5D_0D_0AYou_20should_20pay_20attention_20to_20the_20order_20of_20variables_20you_20assign_20if_20one_20of_20them_20has_20same_20name_20as_20initial_20array._20Els&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F573&amp;partner=sociable" title="PDF" onclick="pageTracker._trackPageview('/outgoing/www.printfriendly.com/print?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F573_amp_partner=sociable&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/pdf.png" title="PDF" alt="PDF" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Beware%20of%20PHP%27s%20list%28%29%20function&amp;body=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F573" title="email"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F573&amp;partner=sociable" title="Print" onclick="pageTracker._trackPageview('/outgoing/www.printfriendly.com/print?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F573_amp_partner=sociable&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>


<br/><br/><img src="http://feeds.feedburner.com/~r/ixti/~4/-6bO4X4JsdU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.ixti.ru/archives/573/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.ixti.ru/archives/573</feedburner:origLink></item>
		<item>
		<title>Joomla! files and directories to ignore on versioning</title>
		<link>http://feedproxy.google.com/~r/ixti/~3/aF-e272Zxl0/565</link>
		<comments>http://blog.ixti.ru/archives/565#comments</comments>
		<pubDate>Wed, 23 Jun 2010 21:41:06 +0000</pubDate>
		<dc:creator>ixti</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Joomla!]]></category>
		<category><![CDATA[fhs]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[gitignore]]></category>

		<guid isPermaLink="false">http://blog.ixti.ru/?p=565</guid>
		<description><![CDATA[After I was hired for another project of Joomla! based website, I realized that I need a list of files and directories to ignore with the stupid content tracker. I love to keep all changes I made tracked by git. &#8230; <a href="http://blog.ixti.ru/archives/565">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>After I was hired for another project of Joomla! based website, I realized that I need a list of files and directories to ignore with the stupid content tracker. I love to keep all changes I made tracked by git. So today, I’m going to list all directories and files that are “optional” — those, which can be removed upon migration and so on…<br />
<span id="more-565"></span></p>
<p>As I track everything with git, this list is simply <code>.gitignore</code> file. But it’s easy to read and understand, so you can adopt it for your needs:</p>
<pre class="brush: plain; light: true;">
/administrator/backups/*
!/administrator/backups/index.html

/administrator/cache/*
!/administrator/cache/index.html

/cache/*
!/cache/index.html

/logs/*
!/logs/index.html

/tmp/*
!/tmp/index.html

/configuration.php
</pre>






	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F565&amp;title=Joomla%21%20files%20and%20directories%20to%20ignore%20on%20versioning&amp;notes=After%20I%20was%20hired%20for%20another%20project%20of%20Joomla%21%20based%20website%2C%20I%20realized%20that%20I%20need%20a%20list%20of%20files%20and%20directories%20to%20ignore%20with%20the%20stupid%20content%20tracker.%20I%20love%20to%20keep%20all%20changes%20I%20made%20tracked%20by%20git.%20So%20today%2C%20I%27m%20going%20to%20list%20all%20direct" title="del.icio.us" onclick="pageTracker._trackPageview('/outgoing/delicious.com/post?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F565_amp_title=Joomla_21_20files_20and_20directories_20to_20ignore_20on_20versioning_amp_notes=After_20I_20was_20hired_20for_20another_20project_20of_20Joomla_21_20based_20website_2C_20I_20realized_20that_20I_20need_20a_20list_20of_20files_20and_20directories_20to_20ignore_20with_20the_20stupid_20content_20tracker._20I_20love_20to_20keep_20all_20changes_20I_20made_20tracked_20by_20git._20So_20today_2C_20I_27m_20going_20to_20list_20all_20direct&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F565&amp;title=Joomla%21%20files%20and%20directories%20to%20ignore%20on%20versioning&amp;annotation=After%20I%20was%20hired%20for%20another%20project%20of%20Joomla%21%20based%20website%2C%20I%20realized%20that%20I%20need%20a%20list%20of%20files%20and%20directories%20to%20ignore%20with%20the%20stupid%20content%20tracker.%20I%20love%20to%20keep%20all%20changes%20I%20made%20tracked%20by%20git.%20So%20today%2C%20I%27m%20going%20to%20list%20all%20direct" title="Google Bookmarks" onclick="pageTracker._trackPageview('/outgoing/www.google.com/bookmarks/mark?op=edit_amp_bkmk=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F565_amp_title=Joomla_21_20files_20and_20directories_20to_20ignore_20on_20versioning_amp_annotation=After_20I_20was_20hired_20for_20another_20project_20of_20Joomla_21_20based_20website_2C_20I_20realized_20that_20I_20need_20a_20list_20of_20files_20and_20directories_20to_20ignore_20with_20the_20stupid_20content_20tracker._20I_20love_20to_20keep_20all_20changes_20I_20made_20tracked_20by_20git._20So_20today_2C_20I_27m_20going_20to_20list_20all_20direct&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://identi.ca/notice/new?status_textarea=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F565" title="Identi.ca" onclick="pageTracker._trackPageview('/outgoing/identi.ca/notice/new?status_textarea=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F565&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/identica.png" title="Identi.ca" alt="Identi.ca" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Joomla%21%20files%20and%20directories%20to%20ignore%20on%20versioning%20-%20http%3A%2F%2Fblog.ixti.ru%2Farchives%2F565" title="Twitter" onclick="pageTracker._trackPageview('/outgoing/twitter.com/home?status=Joomla_21_20files_20and_20directories_20to_20ignore_20on_20versioning_20-_20http_3A_2F_2Fblog.ixti.ru_2Farchives_2F565&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F565" title="Technorati" onclick="pageTracker._trackPageview('/outgoing/technorati.com/faves?add=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F565&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F565&amp;title=Joomla%21%20files%20and%20directories%20to%20ignore%20on%20versioning&amp;bodytext=After%20I%20was%20hired%20for%20another%20project%20of%20Joomla%21%20based%20website%2C%20I%20realized%20that%20I%20need%20a%20list%20of%20files%20and%20directories%20to%20ignore%20with%20the%20stupid%20content%20tracker.%20I%20love%20to%20keep%20all%20changes%20I%20made%20tracked%20by%20git.%20So%20today%2C%20I%27m%20going%20to%20list%20all%20direct" title="Digg" onclick="pageTracker._trackPageview('/outgoing/digg.com/submit?phase=2_amp_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F565_amp_title=Joomla_21_20files_20and_20directories_20to_20ignore_20on_20versioning_amp_bodytext=After_20I_20was_20hired_20for_20another_20project_20of_20Joomla_21_20based_20website_2C_20I_20realized_20that_20I_20need_20a_20list_20of_20files_20and_20directories_20to_20ignore_20with_20the_20stupid_20content_20tracker._20I_20love_20to_20keep_20all_20changes_20I_20made_20tracked_20by_20git._20So_20today_2C_20I_27m_20going_20to_20list_20all_20direct&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://slashdot.org/bookmark.pl?title=Joomla%21%20files%20and%20directories%20to%20ignore%20on%20versioning&amp;url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F565" title="Slashdot" onclick="pageTracker._trackPageview('/outgoing/slashdot.org/bookmark.pl?title=Joomla_21_20files_20and_20directories_20to_20ignore_20on_20versioning_amp_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F565&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F565&amp;t=Joomla%21%20files%20and%20directories%20to%20ignore%20on%20versioning" title="Facebook" onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/share.php?u=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F565_amp_t=Joomla_21_20files_20and_20directories_20to_20ignore_20on_20versioning&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mister-wong.com/addurl/?bm_url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F565&amp;bm_description=Joomla%21%20files%20and%20directories%20to%20ignore%20on%20versioning&amp;plugin=soc" title="MisterWong" onclick="pageTracker._trackPageview('/outgoing/www.mister-wong.com/addurl/?bm_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F565_amp_bm_description=Joomla_21_20files_20and_20directories_20to_20ignore_20on_20versioning_amp_plugin=soc&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/misterwong.png" title="MisterWong" alt="MisterWong" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F565&amp;title=Joomla%21%20files%20and%20directories%20to%20ignore%20on%20versioning" title="Reddit" onclick="pageTracker._trackPageview('/outgoing/reddit.com/submit?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F565_amp_title=Joomla_21_20files_20and_20directories_20to_20ignore_20on_20versioning&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F565&amp;title=Joomla%21%20files%20and%20directories%20to%20ignore%20on%20versioning" title="StumbleUpon" onclick="pageTracker._trackPageview('/outgoing/www.stumbleupon.com/submit?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F565_amp_title=Joomla_21_20files_20and_20directories_20to_20ignore_20on_20versioning&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F565&amp;title=Joomla%21%20files%20and%20directories%20to%20ignore%20on%20versioning" title="Mixx" onclick="pageTracker._trackPageview('/outgoing/www.mixx.com/submit?page_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F565_amp_title=Joomla_21_20files_20and_20directories_20to_20ignore_20on_20versioning&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://hellotxt.com/?status=Joomla%21%20files%20and%20directories%20to%20ignore%20on%20versioning+http%3A%2F%2Fblog.ixti.ru%2Farchives%2F565" title="HelloTxt" onclick="pageTracker._trackPageview('/outgoing/hellotxt.com/?status=Joomla_21_20files_20and_20directories_20to_20ignore_20on_20versioning+http_3A_2F_2Fblog.ixti.ru_2Farchives_2F565&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/hellotxt.png" title="HelloTxt" alt="HelloTxt" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F565&amp;title=Joomla%21%20files%20and%20directories%20to%20ignore%20on%20versioning&amp;source=iXTi%26%23039%3Bs+personal+sandbox+Personal+playground+since+2006&amp;summary=After%20I%20was%20hired%20for%20another%20project%20of%20Joomla%21%20based%20website%2C%20I%20realized%20that%20I%20need%20a%20list%20of%20files%20and%20directories%20to%20ignore%20with%20the%20stupid%20content%20tracker.%20I%20love%20to%20keep%20all%20changes%20I%20made%20tracked%20by%20git.%20So%20today%2C%20I%27m%20going%20to%20list%20all%20direct" title="LinkedIn" onclick="pageTracker._trackPageview('/outgoing/www.linkedin.com/shareArticle?mini=true_amp_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F565_amp_title=Joomla_21_20files_20and_20directories_20to_20ignore_20on_20versioning_amp_source=iXTi_26_23039_3Bs+personal+sandbox+Personal+playground+since+2006_amp_summary=After_20I_20was_20hired_20for_20another_20project_20of_20Joomla_21_20based_20website_2C_20I_20realized_20that_20I_20need_20a_20list_20of_20files_20and_20directories_20to_20ignore_20with_20the_20stupid_20content_20tracker._20I_20love_20to_20keep_20all_20changes_20I_20made_20tracked_20by_20git._20So_20today_2C_20I_27m_20going_20to_20list_20all_20direct&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F565&amp;partner=sociable" title="PDF" onclick="pageTracker._trackPageview('/outgoing/www.printfriendly.com/print?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F565_amp_partner=sociable&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/pdf.png" title="PDF" alt="PDF" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Joomla%21%20files%20and%20directories%20to%20ignore%20on%20versioning&amp;body=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F565" title="email"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F565&amp;partner=sociable" title="Print" onclick="pageTracker._trackPageview('/outgoing/www.printfriendly.com/print?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F565_amp_partner=sociable&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>


<br/><br/><img src="http://feeds.feedburner.com/~r/ixti/~4/aF-e272Zxl0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.ixti.ru/archives/565/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.ixti.ru/archives/565</feedburner:origLink></item>
		<item>
		<title>Sys­tem tray icon with Ruby and QT4</title>
		<link>http://feedproxy.google.com/~r/ixti/~3/n-WrZt1L1LQ/367</link>
		<comments>http://blog.ixti.ru/archives/367#comments</comments>
		<pubDate>Tue, 22 Jun 2010 22:19:13 +0000</pubDate>
		<dc:creator>ixti</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[How To's]]></category>
		<category><![CDATA[notification]]></category>
		<category><![CDATA[qt]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[status]]></category>
		<category><![CDATA[tray]]></category>
		<category><![CDATA[x server]]></category>

		<guid isPermaLink="false">http://blog.ixti.ru/?p=367</guid>
		<description><![CDATA[In my previous post I have showed how to create a simple system tray icon in ruby and GTK. Today, I will create exactly the same application but with QT4 instead of GTK… Before I started this, I was full &#8230; <a href="http://blog.ixti.ru/archives/367">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In my previous post I have showed how to create a simple system tray icon in ruby and GTK. Today, I will create exactly the same application but with QT4 instead of GTK… Before I started this, I was full of optimism that it will be even easier to do this with QT. I was wrong :)) Because of some differences it was not as easy as I wished it to be…<br />
<span id="more-367"></span></p>
<p>I was going to start with similar simple and really dumb example. But some restrictions of QT disallowed me. So, to show a system tray icon, you need to call <code>show</code> instance method. But before this, you must set <code>icon</code> instance property, else it will throw a corresponding exception. So here’s most simple variant:</p>
<pre class="brush: ruby;">
require 'Qt4'
app = Qt::Application.new(ARGV)
si  = Qt::SystemTrayIcon.new

si.icon = Qt::Icon.new('/path/to/some/image.png')
si.show

app.exec
</pre>
<p>There’s no stock images like in GTK, at least I didn’t found them, if you know — let me know. According to QT’s SDK there’s <code>QIcon::fromTheme()</code> static method, but unfortunately there’s no corresponding one in qt4ruby. So we can skip step with different types of icon image settings and go next. All snippets below will assume that there are <code>app</code> and <code>si</code> initializations before, and <code>app.exec</code> call after them. Now let’s make our icon start|stop blinking on left click.</p>
<p>In QT all clicks (left, middle, right, etc) are handled by one signal — <code>activated(QSystemTrayIcon::ActivationReason)</code>. Not the easiest name of the signal to remember ;)) I spent about two hours trying to understand why SDK says that <code>QStatusIcon</code> has <code>activated()</code> signal, but my app tells me that there’s no such signal. Anyway, finally I got it. Here’s sample <code>activated()</code> signal handler:</p>
<pre class="brush: ruby;">
si.connect(SIGNAL('activated(QSystemTrayIcon::ActivationReason)')) do |reason|
  case reason
    when Qt::SystemTrayIcon::Trigger:       puts 'Left Click'
    when Qt::SystemTrayIcon::MiddleClick:   puts 'Middle Click'
    when Qt::SystemTrayIcon::Context:       puts 'Right Click'
    when Qt::SystemTrayIcon::DoubleClick:   puts 'Double Click'
    else
  end
end
</pre>
<p>There’s also <code>Qt::SystemTrayIcon::Unknown</code> reason but this is not very useful IMHO. After we figured out how and where we need to handle left click, let’s make icon blinking. You probably will be surprised, but it’s not trivial as with GTK. <code>Qt::SystemTrayIcon</code> don’t have neither <code>blinking</code> instance property, nor any single method to make it blink. So to make icon blink we need to create a timer which will be replacing icon with empty one and restore original back again every 0.5 second:</p>
<pre class="brush: ruby;">
# define standard icon, alternative (blank) one and current state handler
std_icon = Qt::Icon.new('/path/to/some/image.png')
alt_icon = Qt::Icon.new
blinking = false

# assign default icon
si.icon  = std_icon
si.show

# run timer to swap icons every 0.5 second if blinking is true
Qt::Timer.new(app) do |timer|
  timer.connect(SIGNAL('timeout()')) do
    si.icon = (si.icon.isNull ? std_icon : alt_icon) if blinking
  end
  timer.start(500)
end

# finally assign left click handler
si.connect(SIGNAL('activated(QSystemTrayIcon::ActivationReason)')) do |reason|
  if Qt::SystemTrayIcon::Trigger == reason
    blinking = !blinking
    si.icon  = blinking ? alt_icon : std_icon
  end
end
</pre>
<p>OK. It was not as easy as with GTK, but still, it works :)) So now let’s create context menu with exit item. First of all we need to create a <code>Qt::Menu</code> and populate it with <code>Qt::Action</code>s:</p>
<pre class="brush: ruby;">
menu = Qt::Menu.new
quit = Qt::Action.new('&amp;Quit', menu)

quit.connect(SIGNAL(:triggered)) { app.quit }
menu.addAction(quit)
</pre>
<p>And now the most interesting part, as I told before QT’s system tray icon handles all clicks by one signal. But for context pop-up menu there’s a special instance property <code>contextMenu</code> exist. So to show a popup menu you need to assign it with <code>menu</code> so it will be popped up on right click! But remember, <code>activated(QSystemTrayIcon::ActivationReason)</code> will also be handled. So following code will pop up a menu and will output <em>Right Click</em> to the console:</p>
<pre class="brush: ruby;">
si.contextMenu = menu

si.connect(SIGNAL('activated(QSystemTrayIcon::ActivationReason)')) do |reason|
  if Qt::SystemTrayIcon::Contex == treason
    puts 'Right Click'
  end
end
</pre>
<p>And now altogether again:</p>
<pre class="brush: ruby;">
require 'Qt4'

app = Qt::Application.new(ARGV)
si  = Qt::SystemTrayIcon.new

std_icon = Qt::Icon.new('/path/to/some/image.png')
alt_icon = Qt::Icon.new
blinking = false

si.icon  = std_icon
si.show

Qt::Timer.new(app) do |timer|
  timer.connect(SIGNAL('timeout()')) do
    si.icon = (si.icon.isNull ? std_icon : alt_icon) if blinking
  end
  timer.start(500)
end

menu = Qt::Menu.new
quit = Qt::Action.new('&amp;Quit', menu)

quit.connect(SIGNAL(:triggered)) { app.quit }
menu.addAction(quit)

si.contextMenu = menu

si.connect(SIGNAL('activated(QSystemTrayIcon::ActivationReason)')) do |reason|
  case reason
    when Qt::SystemTrayIcon::Trigger
      blinking = !blinking
      si.icon  = blinking ? alt_icon : std_icon
    when Qt::SystemTrayIcon::MiddleClick:   puts 'Middle Click'
    when Qt::SystemTrayIcon::Context:       puts 'Right Click'
    when Qt::SystemTrayIcon::DoubleClick:   puts 'Double Click'
  end
end

app.exec
</pre>
<p><strong>Useful links</strong>
<ol>
<li><a href="http://rubyforge.org/projects/korundum/" onclick="pageTracker._trackPageview('/outgoing/rubyforge.org/projects/korundum/?referer=');">qt4ruby homepage</a> — packages contains good examples</li>
<li><a href="http://techbase.kde.org/Development/Tutorials/Qt4_Ruby_Tutorial" onclick="pageTracker._trackPageview('/outgoing/techbase.kde.org/Development/Tutorials/Qt4_Ruby_Tutorial?referer=');">Qt4 Ruby Tutorial</a></li>
<li><a href="http://stackoverflow.com/questions/313629/worker-threads-in-ruby" onclick="pageTracker._trackPageview('/outgoing/stackoverflow.com/questions/313629/worker-threads-in-ruby?referer=');">Qt::Timer example</a></li>
</ol>






	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F367&amp;title=Sys%C2%ADtem%20tray%20icon%20with%20Ruby%20and%C2%A0QT4&amp;notes=In%20my%20previous%20post%20I%20have%20showed%20how%20to%20create%20a%20simple%20system%20tray%20icon%20in%20ruby%20and%20GTK.%20Today%2C%20I%20will%20create%20exactly%20the%20same%20application%20but%20with%20QT4%20instead%20of%20GTK...%20Before%20I%20started%20this%2C%20I%20was%20full%20of%20optimism%20that%20it%20will%20be%20even%20easier%20to%20d" title="del.icio.us" onclick="pageTracker._trackPageview('/outgoing/delicious.com/post?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F367_amp_title=Sys_C2_ADtem_20tray_20icon_20with_20Ruby_20and_C2_A0QT4_amp_notes=In_20my_20previous_20post_20I_20have_20showed_20how_20to_20create_20a_20simple_20system_20tray_20icon_20in_20ruby_20and_20GTK._20Today_2C_20I_20will_20create_20exactly_20the_20same_20application_20but_20with_20QT4_20instead_20of_20GTK..._20Before_20I_20started_20this_2C_20I_20was_20full_20of_20optimism_20that_20it_20will_20be_20even_20easier_20to_20d&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F367&amp;title=Sys%C2%ADtem%20tray%20icon%20with%20Ruby%20and%C2%A0QT4&amp;annotation=In%20my%20previous%20post%20I%20have%20showed%20how%20to%20create%20a%20simple%20system%20tray%20icon%20in%20ruby%20and%20GTK.%20Today%2C%20I%20will%20create%20exactly%20the%20same%20application%20but%20with%20QT4%20instead%20of%20GTK...%20Before%20I%20started%20this%2C%20I%20was%20full%20of%20optimism%20that%20it%20will%20be%20even%20easier%20to%20d" title="Google Bookmarks" onclick="pageTracker._trackPageview('/outgoing/www.google.com/bookmarks/mark?op=edit_amp_bkmk=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F367_amp_title=Sys_C2_ADtem_20tray_20icon_20with_20Ruby_20and_C2_A0QT4_amp_annotation=In_20my_20previous_20post_20I_20have_20showed_20how_20to_20create_20a_20simple_20system_20tray_20icon_20in_20ruby_20and_20GTK._20Today_2C_20I_20will_20create_20exactly_20the_20same_20application_20but_20with_20QT4_20instead_20of_20GTK..._20Before_20I_20started_20this_2C_20I_20was_20full_20of_20optimism_20that_20it_20will_20be_20even_20easier_20to_20d&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://identi.ca/notice/new?status_textarea=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F367" title="Identi.ca" onclick="pageTracker._trackPageview('/outgoing/identi.ca/notice/new?status_textarea=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F367&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/identica.png" title="Identi.ca" alt="Identi.ca" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Sys%C2%ADtem%20tray%20icon%20with%20Ruby%20and%C2%A0QT4%20-%20http%3A%2F%2Fblog.ixti.ru%2Farchives%2F367" title="Twitter" onclick="pageTracker._trackPageview('/outgoing/twitter.com/home?status=Sys_C2_ADtem_20tray_20icon_20with_20Ruby_20and_C2_A0QT4_20-_20http_3A_2F_2Fblog.ixti.ru_2Farchives_2F367&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F367" title="Technorati" onclick="pageTracker._trackPageview('/outgoing/technorati.com/faves?add=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F367&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F367&amp;title=Sys%C2%ADtem%20tray%20icon%20with%20Ruby%20and%C2%A0QT4&amp;bodytext=In%20my%20previous%20post%20I%20have%20showed%20how%20to%20create%20a%20simple%20system%20tray%20icon%20in%20ruby%20and%20GTK.%20Today%2C%20I%20will%20create%20exactly%20the%20same%20application%20but%20with%20QT4%20instead%20of%20GTK...%20Before%20I%20started%20this%2C%20I%20was%20full%20of%20optimism%20that%20it%20will%20be%20even%20easier%20to%20d" title="Digg" onclick="pageTracker._trackPageview('/outgoing/digg.com/submit?phase=2_amp_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F367_amp_title=Sys_C2_ADtem_20tray_20icon_20with_20Ruby_20and_C2_A0QT4_amp_bodytext=In_20my_20previous_20post_20I_20have_20showed_20how_20to_20create_20a_20simple_20system_20tray_20icon_20in_20ruby_20and_20GTK._20Today_2C_20I_20will_20create_20exactly_20the_20same_20application_20but_20with_20QT4_20instead_20of_20GTK..._20Before_20I_20started_20this_2C_20I_20was_20full_20of_20optimism_20that_20it_20will_20be_20even_20easier_20to_20d&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://slashdot.org/bookmark.pl?title=Sys%C2%ADtem%20tray%20icon%20with%20Ruby%20and%C2%A0QT4&amp;url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F367" title="Slashdot" onclick="pageTracker._trackPageview('/outgoing/slashdot.org/bookmark.pl?title=Sys_C2_ADtem_20tray_20icon_20with_20Ruby_20and_C2_A0QT4_amp_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F367&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F367&amp;t=Sys%C2%ADtem%20tray%20icon%20with%20Ruby%20and%C2%A0QT4" title="Facebook" onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/share.php?u=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F367_amp_t=Sys_C2_ADtem_20tray_20icon_20with_20Ruby_20and_C2_A0QT4&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mister-wong.com/addurl/?bm_url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F367&amp;bm_description=Sys%C2%ADtem%20tray%20icon%20with%20Ruby%20and%C2%A0QT4&amp;plugin=soc" title="MisterWong" onclick="pageTracker._trackPageview('/outgoing/www.mister-wong.com/addurl/?bm_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F367_amp_bm_description=Sys_C2_ADtem_20tray_20icon_20with_20Ruby_20and_C2_A0QT4_amp_plugin=soc&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/misterwong.png" title="MisterWong" alt="MisterWong" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F367&amp;title=Sys%C2%ADtem%20tray%20icon%20with%20Ruby%20and%C2%A0QT4" title="Reddit" onclick="pageTracker._trackPageview('/outgoing/reddit.com/submit?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F367_amp_title=Sys_C2_ADtem_20tray_20icon_20with_20Ruby_20and_C2_A0QT4&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F367&amp;title=Sys%C2%ADtem%20tray%20icon%20with%20Ruby%20and%C2%A0QT4" title="StumbleUpon" onclick="pageTracker._trackPageview('/outgoing/www.stumbleupon.com/submit?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F367_amp_title=Sys_C2_ADtem_20tray_20icon_20with_20Ruby_20and_C2_A0QT4&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F367&amp;title=Sys%C2%ADtem%20tray%20icon%20with%20Ruby%20and%C2%A0QT4" title="Mixx" onclick="pageTracker._trackPageview('/outgoing/www.mixx.com/submit?page_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F367_amp_title=Sys_C2_ADtem_20tray_20icon_20with_20Ruby_20and_C2_A0QT4&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://hellotxt.com/?status=Sys%C2%ADtem%20tray%20icon%20with%20Ruby%20and%C2%A0QT4+http%3A%2F%2Fblog.ixti.ru%2Farchives%2F367" title="HelloTxt" onclick="pageTracker._trackPageview('/outgoing/hellotxt.com/?status=Sys_C2_ADtem_20tray_20icon_20with_20Ruby_20and_C2_A0QT4+http_3A_2F_2Fblog.ixti.ru_2Farchives_2F367&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/hellotxt.png" title="HelloTxt" alt="HelloTxt" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F367&amp;title=Sys%C2%ADtem%20tray%20icon%20with%20Ruby%20and%C2%A0QT4&amp;source=iXTi%26%23039%3Bs+personal+sandbox+Personal+playground+since+2006&amp;summary=In%20my%20previous%20post%20I%20have%20showed%20how%20to%20create%20a%20simple%20system%20tray%20icon%20in%20ruby%20and%20GTK.%20Today%2C%20I%20will%20create%20exactly%20the%20same%20application%20but%20with%20QT4%20instead%20of%20GTK...%20Before%20I%20started%20this%2C%20I%20was%20full%20of%20optimism%20that%20it%20will%20be%20even%20easier%20to%20d" title="LinkedIn" onclick="pageTracker._trackPageview('/outgoing/www.linkedin.com/shareArticle?mini=true_amp_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F367_amp_title=Sys_C2_ADtem_20tray_20icon_20with_20Ruby_20and_C2_A0QT4_amp_source=iXTi_26_23039_3Bs+personal+sandbox+Personal+playground+since+2006_amp_summary=In_20my_20previous_20post_20I_20have_20showed_20how_20to_20create_20a_20simple_20system_20tray_20icon_20in_20ruby_20and_20GTK._20Today_2C_20I_20will_20create_20exactly_20the_20same_20application_20but_20with_20QT4_20instead_20of_20GTK..._20Before_20I_20started_20this_2C_20I_20was_20full_20of_20optimism_20that_20it_20will_20be_20even_20easier_20to_20d&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F367&amp;partner=sociable" title="PDF" onclick="pageTracker._trackPageview('/outgoing/www.printfriendly.com/print?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F367_amp_partner=sociable&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/pdf.png" title="PDF" alt="PDF" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Sys%C2%ADtem%20tray%20icon%20with%20Ruby%20and%C2%A0QT4&amp;body=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F367" title="email"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F367&amp;partner=sociable" title="Print" onclick="pageTracker._trackPageview('/outgoing/www.printfriendly.com/print?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F367_amp_partner=sociable&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>


<br/><br/><img src="http://feeds.feedburner.com/~r/ixti/~4/n-WrZt1L1LQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.ixti.ru/archives/367/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.ixti.ru/archives/367</feedburner:origLink></item>
		<item>
		<title>Sys­tem tray icon with Ruby and GTK2</title>
		<link>http://feedproxy.google.com/~r/ixti/~3/zCQ-7f9E1Zg/361</link>
		<comments>http://blog.ixti.ru/archives/361#comments</comments>
		<pubDate>Wed, 16 Jun 2010 07:35:25 +0000</pubDate>
		<dc:creator>ixti</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[How To's]]></category>
		<category><![CDATA[gtk]]></category>
		<category><![CDATA[notification]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[status]]></category>
		<category><![CDATA[tray]]></category>
		<category><![CDATA[x server]]></category>

		<guid isPermaLink="false">http://blog.ixti.ru/?p=361</guid>
		<description><![CDATA[Everybody knows what system tray is. My friends (Hello, bigote and stanislavv!) were suggesting to start using FVWM and it’s pager instead of using system tray. But I was not inspired by pager. Probably because I was too lazy to &#8230; <a href="http://blog.ixti.ru/archives/361">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Everybody knows what system tray is. My friends (Hello, bigote and stanislavv!) were suggesting to start using FVWM and it’s pager instead of using system tray. But I was not inspired by pager. Probably because I was too lazy to try it in action for more than 1 minute. Anyway. One day I realized that I need something to notify me via system tray icon. So today I’m going to create a simple system tray icon in ruby with GTK step by step…<br />
<span id="more-361"></span></p>
<p>First of all let’s create a really simple (and absolutely dumb) version, which will only create a new system tray icon:</p>
<pre class="brush: ruby;">
require 'gtk2'
Gtk::StatusIcon.new
Gtk.main
</pre>
<p>As you can see, first line <code>require 'gtk2'</code> include GTK bindings. Then we creating a new instance of <code>Gtk::StatusIcon</code>. And finally run main GTK loop with <code>Gtk.main</code>. So basically first and the last lines are not very interesting and all following code snippets will be without these two lines to keep you focused on things that are really important ;)) But don’t forget them when you’ll be trying these snippets…</p>
<p>If you tried the snippet above, you might notice that it adds a blank icon into system tray. Looks at least strange, so let’s add some image to it. With GTK you can use stock image, by setting <code>stock</code> instance property of <code>StatusIcon</code>:</p>
<pre class="brush: ruby;">
si        = Gtk::StatusIcon.new
si.stock  = Gtk::Stock::DIALOG_INFO
</pre>
<p>Or you can you your own custom image by setting <code>pixbuf</code> instance property:</p>
<pre class="brush: ruby;">
si        = Gtk::StatusIcon.new
si.pixbuf = Gdk::Pixbuf.new('/path/to/some/image.png')
</pre>
<p>You can specify both <code>stock</code> and <code>pixbuf</code> — but only the last one will be used. So:</p>
<pre class="brush: ruby;">
si        = Gtk::StatusIcon.new
si.pixbuf = Gdk::Pixbuf.new('/path/to/some/image.png')
si.stock  = Gtk::Stock::DIALOG_INFO
</pre>
<p>Will initiate a system tray icon with <code>Gtk::Stock::DIALOG_INFO</code> stock image.</p>
<p>Now, when out system tray icon has a nice looking image, let’s add some funkiness. Let’s make icon start blinking on left clicking it, and stop on clicking it again. To make icon blink, you need to set <code>blinking</code> instance property to <code>true</code>, e.g.:</p>
<pre class="brush: ruby;">
si.blinking = true
</pre>
<p>But we want it to be turned on|off mouse left click. To do so, we need to connect an <code>activate</code> signal:</p>
<pre class="brush: ruby;">
si.signal_connect('activate'){ |icon| icon.blinking = !(icon.blinking?) }
</pre>
<p>Cool! Now it’s cool! But don’t stop. Let’s add a pop-up menu for mouse right clicking. To handle right click you need to use <code>popup-menu</code> signal, something like this:</p>
<pre class="brush: ruby;">
si.signal_connect('popup-menu') do |tray, button, time|
  # something to do?
end
</pre>
<p>Creating a popup-menu is little bit out of the scope, but to accomplish my first system tray idiotic application, I will show it too. First, we need to create a <code>Gtk::Menu</code> instance:</p>
<pre class="brush: ruby;">
menu = Gtk::Menu.new
</pre>
<p>Fill it with items, call <code>show_all</code> instance method, and call <code>popup</code> method when we need it to be popped up. Now let’s create a new item quit item, make it call <code>Gtk.main_quit</code> on click, and append it to the menu:</p>
<pre class="brush: ruby;">
menu = Gtk::Menu.new
quit = Gtk::ImageMenuItem.new(Gtk::Stock::QUIT)

quit.signal_connect('activate'){ Gtk.main_quit }
menu.append(quit)
menu.show_all
</pre>
<p>So all we need no is to call <code>menu.popup</code> inside <code>popup-menu</code> signal handler:</p>
<pre class="brush: ruby;">
si.signal_connect('popup-menu') do |icon, button, time|
  menu.popup(nil, nil, button, time)
end
</pre>
<p>And altogether now:</p>
<pre class="brush: ruby;">
require 'gtk2'

si        = Gtk::StatusIcon.new
si.stock  = Gtk::Stock::DIALOG_INFO

si.signal_connect('activate'){ |icon| icon.blinking = !(icon.blinking?) }

menu = Gtk::Menu.new
quit = Gtk::ImageMenuItem.new(Gtk::Stock::QUIT)

quit.signal_connect('activate'){ Gtk.main_quit }
menu.append(quit)
menu.show_all

si.signal_connect('popup-menu') do |icon, button, time|
  menu.popup(nil, nil, button, time)
end

Gtk.main
</pre>
<p>After all, I want to thank Vincent Carmona, whose example was a vivid tutorial of how to make a much smarter (than mine) system tray icon with GTK and ruby. You will find his example as an attachment to this post. I recommend you to read it, if you are still reading this ;))</p>
<p><strong>Useful links:</strong>
<ol>
<li><a href="http://ruby-gnome2.sourceforge.jp/hiki.cgi?cmd=view&#038;p=Gtk::StatusIcon" onclick="pageTracker._trackPageview('/outgoing/ruby-gnome2.sourceforge.jp/hiki.cgi?cmd=view_038_p=Gtk_StatusIcon&amp;referer=');">Gtk::StatusIcon documentation</a></li>
<li><a href="http://ruby-gnome2.sourceforge.jp/hiki.cgi?StatusIcon+example#StatusIcon+example" onclick="pageTracker._trackPageview('/outgoing/ruby-gnome2.sourceforge.jp/hiki.cgi?StatusIcon+example_StatusIcon+example&amp;referer=');">Vincent Carmona’s example</a></li>
</ol>






	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F361&amp;title=Sys%C2%ADtem%20tray%20icon%20with%20Ruby%20and%C2%A0GTK2&amp;notes=Everybody%20knows%20what%20system%20tray%20is.%20My%20friends%20%28Hello%2C%20bigote%20and%20stanislavv%21%29%20were%20suggesting%20to%20start%20using%20FVWM%20and%20it%27s%20pager%20instead%20of%20using%20system%20tray.%20But%20I%20was%20not%20inspired%20by%20pager.%20Probably%20because%20I%20was%20too%20lazy%20to%20try%20it%20in%20action%20for%20" title="del.icio.us" onclick="pageTracker._trackPageview('/outgoing/delicious.com/post?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F361_amp_title=Sys_C2_ADtem_20tray_20icon_20with_20Ruby_20and_C2_A0GTK2_amp_notes=Everybody_20knows_20what_20system_20tray_20is._20My_20friends_20_28Hello_2C_20bigote_20and_20stanislavv_21_29_20were_20suggesting_20to_20start_20using_20FVWM_20and_20it_27s_20pager_20instead_20of_20using_20system_20tray._20But_20I_20was_20not_20inspired_20by_20pager._20Probably_20because_20I_20was_20too_20lazy_20to_20try_20it_20in_20action_20for_20&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F361&amp;title=Sys%C2%ADtem%20tray%20icon%20with%20Ruby%20and%C2%A0GTK2&amp;annotation=Everybody%20knows%20what%20system%20tray%20is.%20My%20friends%20%28Hello%2C%20bigote%20and%20stanislavv%21%29%20were%20suggesting%20to%20start%20using%20FVWM%20and%20it%27s%20pager%20instead%20of%20using%20system%20tray.%20But%20I%20was%20not%20inspired%20by%20pager.%20Probably%20because%20I%20was%20too%20lazy%20to%20try%20it%20in%20action%20for%20" title="Google Bookmarks" onclick="pageTracker._trackPageview('/outgoing/www.google.com/bookmarks/mark?op=edit_amp_bkmk=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F361_amp_title=Sys_C2_ADtem_20tray_20icon_20with_20Ruby_20and_C2_A0GTK2_amp_annotation=Everybody_20knows_20what_20system_20tray_20is._20My_20friends_20_28Hello_2C_20bigote_20and_20stanislavv_21_29_20were_20suggesting_20to_20start_20using_20FVWM_20and_20it_27s_20pager_20instead_20of_20using_20system_20tray._20But_20I_20was_20not_20inspired_20by_20pager._20Probably_20because_20I_20was_20too_20lazy_20to_20try_20it_20in_20action_20for_20&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://identi.ca/notice/new?status_textarea=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F361" title="Identi.ca" onclick="pageTracker._trackPageview('/outgoing/identi.ca/notice/new?status_textarea=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F361&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/identica.png" title="Identi.ca" alt="Identi.ca" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Sys%C2%ADtem%20tray%20icon%20with%20Ruby%20and%C2%A0GTK2%20-%20http%3A%2F%2Fblog.ixti.ru%2Farchives%2F361" title="Twitter" onclick="pageTracker._trackPageview('/outgoing/twitter.com/home?status=Sys_C2_ADtem_20tray_20icon_20with_20Ruby_20and_C2_A0GTK2_20-_20http_3A_2F_2Fblog.ixti.ru_2Farchives_2F361&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F361" title="Technorati" onclick="pageTracker._trackPageview('/outgoing/technorati.com/faves?add=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F361&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F361&amp;title=Sys%C2%ADtem%20tray%20icon%20with%20Ruby%20and%C2%A0GTK2&amp;bodytext=Everybody%20knows%20what%20system%20tray%20is.%20My%20friends%20%28Hello%2C%20bigote%20and%20stanislavv%21%29%20were%20suggesting%20to%20start%20using%20FVWM%20and%20it%27s%20pager%20instead%20of%20using%20system%20tray.%20But%20I%20was%20not%20inspired%20by%20pager.%20Probably%20because%20I%20was%20too%20lazy%20to%20try%20it%20in%20action%20for%20" title="Digg" onclick="pageTracker._trackPageview('/outgoing/digg.com/submit?phase=2_amp_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F361_amp_title=Sys_C2_ADtem_20tray_20icon_20with_20Ruby_20and_C2_A0GTK2_amp_bodytext=Everybody_20knows_20what_20system_20tray_20is._20My_20friends_20_28Hello_2C_20bigote_20and_20stanislavv_21_29_20were_20suggesting_20to_20start_20using_20FVWM_20and_20it_27s_20pager_20instead_20of_20using_20system_20tray._20But_20I_20was_20not_20inspired_20by_20pager._20Probably_20because_20I_20was_20too_20lazy_20to_20try_20it_20in_20action_20for_20&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://slashdot.org/bookmark.pl?title=Sys%C2%ADtem%20tray%20icon%20with%20Ruby%20and%C2%A0GTK2&amp;url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F361" title="Slashdot" onclick="pageTracker._trackPageview('/outgoing/slashdot.org/bookmark.pl?title=Sys_C2_ADtem_20tray_20icon_20with_20Ruby_20and_C2_A0GTK2_amp_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F361&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F361&amp;t=Sys%C2%ADtem%20tray%20icon%20with%20Ruby%20and%C2%A0GTK2" title="Facebook" onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/share.php?u=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F361_amp_t=Sys_C2_ADtem_20tray_20icon_20with_20Ruby_20and_C2_A0GTK2&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mister-wong.com/addurl/?bm_url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F361&amp;bm_description=Sys%C2%ADtem%20tray%20icon%20with%20Ruby%20and%C2%A0GTK2&amp;plugin=soc" title="MisterWong" onclick="pageTracker._trackPageview('/outgoing/www.mister-wong.com/addurl/?bm_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F361_amp_bm_description=Sys_C2_ADtem_20tray_20icon_20with_20Ruby_20and_C2_A0GTK2_amp_plugin=soc&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/misterwong.png" title="MisterWong" alt="MisterWong" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F361&amp;title=Sys%C2%ADtem%20tray%20icon%20with%20Ruby%20and%C2%A0GTK2" title="Reddit" onclick="pageTracker._trackPageview('/outgoing/reddit.com/submit?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F361_amp_title=Sys_C2_ADtem_20tray_20icon_20with_20Ruby_20and_C2_A0GTK2&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F361&amp;title=Sys%C2%ADtem%20tray%20icon%20with%20Ruby%20and%C2%A0GTK2" title="StumbleUpon" onclick="pageTracker._trackPageview('/outgoing/www.stumbleupon.com/submit?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F361_amp_title=Sys_C2_ADtem_20tray_20icon_20with_20Ruby_20and_C2_A0GTK2&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F361&amp;title=Sys%C2%ADtem%20tray%20icon%20with%20Ruby%20and%C2%A0GTK2" title="Mixx" onclick="pageTracker._trackPageview('/outgoing/www.mixx.com/submit?page_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F361_amp_title=Sys_C2_ADtem_20tray_20icon_20with_20Ruby_20and_C2_A0GTK2&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://hellotxt.com/?status=Sys%C2%ADtem%20tray%20icon%20with%20Ruby%20and%C2%A0GTK2+http%3A%2F%2Fblog.ixti.ru%2Farchives%2F361" title="HelloTxt" onclick="pageTracker._trackPageview('/outgoing/hellotxt.com/?status=Sys_C2_ADtem_20tray_20icon_20with_20Ruby_20and_C2_A0GTK2+http_3A_2F_2Fblog.ixti.ru_2Farchives_2F361&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/hellotxt.png" title="HelloTxt" alt="HelloTxt" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F361&amp;title=Sys%C2%ADtem%20tray%20icon%20with%20Ruby%20and%C2%A0GTK2&amp;source=iXTi%26%23039%3Bs+personal+sandbox+Personal+playground+since+2006&amp;summary=Everybody%20knows%20what%20system%20tray%20is.%20My%20friends%20%28Hello%2C%20bigote%20and%20stanislavv%21%29%20were%20suggesting%20to%20start%20using%20FVWM%20and%20it%27s%20pager%20instead%20of%20using%20system%20tray.%20But%20I%20was%20not%20inspired%20by%20pager.%20Probably%20because%20I%20was%20too%20lazy%20to%20try%20it%20in%20action%20for%20" title="LinkedIn" onclick="pageTracker._trackPageview('/outgoing/www.linkedin.com/shareArticle?mini=true_amp_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F361_amp_title=Sys_C2_ADtem_20tray_20icon_20with_20Ruby_20and_C2_A0GTK2_amp_source=iXTi_26_23039_3Bs+personal+sandbox+Personal+playground+since+2006_amp_summary=Everybody_20knows_20what_20system_20tray_20is._20My_20friends_20_28Hello_2C_20bigote_20and_20stanislavv_21_29_20were_20suggesting_20to_20start_20using_20FVWM_20and_20it_27s_20pager_20instead_20of_20using_20system_20tray._20But_20I_20was_20not_20inspired_20by_20pager._20Probably_20because_20I_20was_20too_20lazy_20to_20try_20it_20in_20action_20for_20&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F361&amp;partner=sociable" title="PDF" onclick="pageTracker._trackPageview('/outgoing/www.printfriendly.com/print?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F361_amp_partner=sociable&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/pdf.png" title="PDF" alt="PDF" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Sys%C2%ADtem%20tray%20icon%20with%20Ruby%20and%C2%A0GTK2&amp;body=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F361" title="email"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F361&amp;partner=sociable" title="Print" onclick="pageTracker._trackPageview('/outgoing/www.printfriendly.com/print?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F361_amp_partner=sociable&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>


<br/><br/><img src="http://feeds.feedburner.com/~r/ixti/~4/zCQ-7f9E1Zg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.ixti.ru/archives/361/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.ixti.ru/archives/361</feedburner:origLink></item>
		<item>
		<title>Another step for free­dom of CRE Loaded PCI Pro</title>
		<link>http://feedproxy.google.com/~r/ixti/~3/yKQ9oS53Gv4/440</link>
		<comments>http://blog.ixti.ru/archives/440#comments</comments>
		<pubDate>Tue, 08 Jun 2010 16:38:12 +0000</pubDate>
		<dc:creator>ixti</dc:creator>
				<category><![CDATA[osCommerce]]></category>
		<category><![CDATA[cre loaded]]></category>
		<category><![CDATA[freedom]]></category>
		<category><![CDATA[gnu/gpl]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.ixti.ru/?p=440</guid>
		<description><![CDATA[This is a small improvement to previously released free version of CRE Loaded PCI Pro. After I was playing with previous release I found that (at least) after upgrading from another version this application sends an information about your web-site &#8230; <a href="http://blog.ixti.ru/archives/440">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This is a small improvement to previously released <a href="http://blog.ixti.ru/?p=343">free version</a> of <a href="http://www.creloaded.com/" onclick="pageTracker._trackPageview('/outgoing/www.creloaded.com/?referer=');">CRE Loaded PCI Pro</a>. After I was playing with previous release I found that (at least) after upgrading from another version this application sends an information about your web-site at <em>sales@creloaded.com</em> and <em>application@cremerchant.com</em> which is not cool at all. So here’s another modified version of CRE Loaded PCI Pro which is not only free as in freedom, but also does not spies for you…<br />
<span id="more-440"></span></p>
<p>Basically all you need to do is to remove a “spy” block out of <em>admin/merchant_account.php</em> file. Here’s a patch you can use to clean it out:</p>
<pre class="brush: diff;">
29,79d28
&lt;
&lt; $action = (isset($_GET['action']) ? $_GET['action'] : '');
&lt;
&lt; $error = false;
&lt; if (isset($action) &amp;&amp; ($action == 'send')) {
&lt;
&lt; $company = tep_db_prepare_input($_POST['company']);
&lt; $full_name = tep_db_prepare_input($_POST['full_name']);
&lt; $telephone = tep_db_prepare_input($_POST['telephone']);
&lt; $nightphone = tep_db_prepare_input($_POST['nightphone']);
&lt; $country_id = tep_db_prepare_input($_POST['country_id']);
&lt; $country = tep_get_country_name($country_id);
&lt; $email_address = tep_db_prepare_input($_POST['email_address']);
&lt; $businessyears = tep_db_prepare_input($_POST['businessyears']);
&lt; $website = tep_db_prepare_input($_POST['website_url']);
&lt; $processing = tep_db_prepare_input($_POST['processing']);
&lt; $start_processing = tep_db_prepare_input($_POST['start_processing']);
&lt; $comments = tep_db_prepare_input($_POST['comments']);
&lt;
&lt; if($company == '' || $full_name == '' || $telephone == '' || $website == '' || !tep_validate_email($email_address) || $full_name == 'Salvatore Iozzia' || $company == 'CRE Loaded Store' || $email_address == 'noreply@creforge.com') {
&lt; $error = true;
&lt; }
&lt;
&lt; if(!$error) {
&lt; //all good send
&lt; $message = '';
&lt; $message = &quot;\n\n&quot; . sprintf(TEXT_EMAIL_BODY_TITLE,$full_name) . &quot;\n\n&quot; .
&lt; TEXT_COMPANY_NAME . ' ' . $company . &quot;\n&quot; .
&lt; TEXT_FULL_NAME . ' ' . $full_name . &quot;\n&quot; .
&lt; TEXT_TELEPHONE . ' ' . $telephone . &quot;\n&quot; .
&lt; TEXT_NIGHT_PHONE . ' ' . $nightphone . &quot;\n&quot; .
&lt; TEXT_COUNTRY . ' ' . $country . &quot;\n&quot; .
&lt; TEXT_EMAIL_ADDRESS . ' ' . $email_address . &quot;\n&quot; .
&lt; TEXT_YEARS_IN_BUSINESS . ' ' . $businessyears . &quot;\n&quot; .
&lt; TEXT_WEBSITE . ' ' . $website . &quot;\n&quot; .
&lt; TEXT_PROCESSING . ' ' . $processing . &quot;\n&quot; .
&lt; TEXT_START_PROCESSING . ' ' . $start_processing . &quot;\n&quot; .
&lt; TEXT_COMMENTS . &quot;\n&quot; . cre_html2txt($comments) . &quot;\n&quot; .
&lt; CREM_EMAIL_SEPERATOR . &quot;\n\n&quot; .
&lt; TEXT_CUSTOMER_IP . $_SERVER['REMOTE_ADDR'] . &quot;\n&quot; .
&lt; TEXT_CUSTOMER_ISP . gethostbyaddr($_SERVER['REMOTE_ADDR']) . &quot;\n&quot;;
&lt;
&lt; @tep_mail(TEXT_SEND_TO_NAME, 'sales@creloaded.com', sprintf(TEXT_EMAIL_SUBJECT,$full_name), $message, $full_name, $email_address);
&lt; @tep_mail(TEXT_SEND_TO_NAME, 'application@cremerchant.com', sprintf(TEXT_EMAIL_SUBJECT,$full_name), $message, $full_name, $email_address);
&lt;
&lt; }
&lt;
&lt; } // end action
&lt;
&lt;   if($error) $messageStack-&gt;add('merchant', TEXT_ALL_FIELDS_REQUIRED, 'warning');
&lt;
</pre>
<p>PS If you have bought a new version CRE Loaded PCI Pro or B2B and want to bring freedom (and justice) back — just send me the distro package and I’ll help ;))</p>






	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F440&amp;title=Another%20step%20for%20free%C2%ADdom%20of%20CRE%20Loaded%20PCI%C2%A0Pro&amp;notes=This%20is%20a%20small%20improvement%20to%20previously%20released%20free%20version%20of%20CRE%20Loaded%20PCI%20Pro.%20After%20I%20was%20playing%20with%20previous%20release%20I%20found%20that%20%28at%20least%29%20after%20upgrading%20from%20another%20version%20this%20application%20sends%20an%20information%20about%20your%20web-site%20at" title="del.icio.us" onclick="pageTracker._trackPageview('/outgoing/delicious.com/post?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F440_amp_title=Another_20step_20for_20free_C2_ADdom_20of_20CRE_20Loaded_20PCI_C2_A0Pro_amp_notes=This_20is_20a_20small_20improvement_20to_20previously_20released_20free_20version_20of_20CRE_20Loaded_20PCI_20Pro._20After_20I_20was_20playing_20with_20previous_20release_20I_20found_20that_20_28at_20least_29_20after_20upgrading_20from_20another_20version_20this_20application_20sends_20an_20information_20about_20your_20web-site_20at&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F440&amp;title=Another%20step%20for%20free%C2%ADdom%20of%20CRE%20Loaded%20PCI%C2%A0Pro&amp;annotation=This%20is%20a%20small%20improvement%20to%20previously%20released%20free%20version%20of%20CRE%20Loaded%20PCI%20Pro.%20After%20I%20was%20playing%20with%20previous%20release%20I%20found%20that%20%28at%20least%29%20after%20upgrading%20from%20another%20version%20this%20application%20sends%20an%20information%20about%20your%20web-site%20at" title="Google Bookmarks" onclick="pageTracker._trackPageview('/outgoing/www.google.com/bookmarks/mark?op=edit_amp_bkmk=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F440_amp_title=Another_20step_20for_20free_C2_ADdom_20of_20CRE_20Loaded_20PCI_C2_A0Pro_amp_annotation=This_20is_20a_20small_20improvement_20to_20previously_20released_20free_20version_20of_20CRE_20Loaded_20PCI_20Pro._20After_20I_20was_20playing_20with_20previous_20release_20I_20found_20that_20_28at_20least_29_20after_20upgrading_20from_20another_20version_20this_20application_20sends_20an_20information_20about_20your_20web-site_20at&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://identi.ca/notice/new?status_textarea=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F440" title="Identi.ca" onclick="pageTracker._trackPageview('/outgoing/identi.ca/notice/new?status_textarea=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F440&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/identica.png" title="Identi.ca" alt="Identi.ca" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Another%20step%20for%20free%C2%ADdom%20of%20CRE%20Loaded%20PCI%C2%A0Pro%20-%20http%3A%2F%2Fblog.ixti.ru%2Farchives%2F440" title="Twitter" onclick="pageTracker._trackPageview('/outgoing/twitter.com/home?status=Another_20step_20for_20free_C2_ADdom_20of_20CRE_20Loaded_20PCI_C2_A0Pro_20-_20http_3A_2F_2Fblog.ixti.ru_2Farchives_2F440&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F440" title="Technorati" onclick="pageTracker._trackPageview('/outgoing/technorati.com/faves?add=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F440&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F440&amp;title=Another%20step%20for%20free%C2%ADdom%20of%20CRE%20Loaded%20PCI%C2%A0Pro&amp;bodytext=This%20is%20a%20small%20improvement%20to%20previously%20released%20free%20version%20of%20CRE%20Loaded%20PCI%20Pro.%20After%20I%20was%20playing%20with%20previous%20release%20I%20found%20that%20%28at%20least%29%20after%20upgrading%20from%20another%20version%20this%20application%20sends%20an%20information%20about%20your%20web-site%20at" title="Digg" onclick="pageTracker._trackPageview('/outgoing/digg.com/submit?phase=2_amp_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F440_amp_title=Another_20step_20for_20free_C2_ADdom_20of_20CRE_20Loaded_20PCI_C2_A0Pro_amp_bodytext=This_20is_20a_20small_20improvement_20to_20previously_20released_20free_20version_20of_20CRE_20Loaded_20PCI_20Pro._20After_20I_20was_20playing_20with_20previous_20release_20I_20found_20that_20_28at_20least_29_20after_20upgrading_20from_20another_20version_20this_20application_20sends_20an_20information_20about_20your_20web-site_20at&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://slashdot.org/bookmark.pl?title=Another%20step%20for%20free%C2%ADdom%20of%20CRE%20Loaded%20PCI%C2%A0Pro&amp;url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F440" title="Slashdot" onclick="pageTracker._trackPageview('/outgoing/slashdot.org/bookmark.pl?title=Another_20step_20for_20free_C2_ADdom_20of_20CRE_20Loaded_20PCI_C2_A0Pro_amp_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F440&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F440&amp;t=Another%20step%20for%20free%C2%ADdom%20of%20CRE%20Loaded%20PCI%C2%A0Pro" title="Facebook" onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/share.php?u=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F440_amp_t=Another_20step_20for_20free_C2_ADdom_20of_20CRE_20Loaded_20PCI_C2_A0Pro&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mister-wong.com/addurl/?bm_url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F440&amp;bm_description=Another%20step%20for%20free%C2%ADdom%20of%20CRE%20Loaded%20PCI%C2%A0Pro&amp;plugin=soc" title="MisterWong" onclick="pageTracker._trackPageview('/outgoing/www.mister-wong.com/addurl/?bm_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F440_amp_bm_description=Another_20step_20for_20free_C2_ADdom_20of_20CRE_20Loaded_20PCI_C2_A0Pro_amp_plugin=soc&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/misterwong.png" title="MisterWong" alt="MisterWong" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F440&amp;title=Another%20step%20for%20free%C2%ADdom%20of%20CRE%20Loaded%20PCI%C2%A0Pro" title="Reddit" onclick="pageTracker._trackPageview('/outgoing/reddit.com/submit?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F440_amp_title=Another_20step_20for_20free_C2_ADdom_20of_20CRE_20Loaded_20PCI_C2_A0Pro&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F440&amp;title=Another%20step%20for%20free%C2%ADdom%20of%20CRE%20Loaded%20PCI%C2%A0Pro" title="StumbleUpon" onclick="pageTracker._trackPageview('/outgoing/www.stumbleupon.com/submit?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F440_amp_title=Another_20step_20for_20free_C2_ADdom_20of_20CRE_20Loaded_20PCI_C2_A0Pro&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F440&amp;title=Another%20step%20for%20free%C2%ADdom%20of%20CRE%20Loaded%20PCI%C2%A0Pro" title="Mixx" onclick="pageTracker._trackPageview('/outgoing/www.mixx.com/submit?page_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F440_amp_title=Another_20step_20for_20free_C2_ADdom_20of_20CRE_20Loaded_20PCI_C2_A0Pro&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://hellotxt.com/?status=Another%20step%20for%20free%C2%ADdom%20of%20CRE%20Loaded%20PCI%C2%A0Pro+http%3A%2F%2Fblog.ixti.ru%2Farchives%2F440" title="HelloTxt" onclick="pageTracker._trackPageview('/outgoing/hellotxt.com/?status=Another_20step_20for_20free_C2_ADdom_20of_20CRE_20Loaded_20PCI_C2_A0Pro+http_3A_2F_2Fblog.ixti.ru_2Farchives_2F440&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/hellotxt.png" title="HelloTxt" alt="HelloTxt" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F440&amp;title=Another%20step%20for%20free%C2%ADdom%20of%20CRE%20Loaded%20PCI%C2%A0Pro&amp;source=iXTi%26%23039%3Bs+personal+sandbox+Personal+playground+since+2006&amp;summary=This%20is%20a%20small%20improvement%20to%20previously%20released%20free%20version%20of%20CRE%20Loaded%20PCI%20Pro.%20After%20I%20was%20playing%20with%20previous%20release%20I%20found%20that%20%28at%20least%29%20after%20upgrading%20from%20another%20version%20this%20application%20sends%20an%20information%20about%20your%20web-site%20at" title="LinkedIn" onclick="pageTracker._trackPageview('/outgoing/www.linkedin.com/shareArticle?mini=true_amp_url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F440_amp_title=Another_20step_20for_20free_C2_ADdom_20of_20CRE_20Loaded_20PCI_C2_A0Pro_amp_source=iXTi_26_23039_3Bs+personal+sandbox+Personal+playground+since+2006_amp_summary=This_20is_20a_20small_20improvement_20to_20previously_20released_20free_20version_20of_20CRE_20Loaded_20PCI_20Pro._20After_20I_20was_20playing_20with_20previous_20release_20I_20found_20that_20_28at_20least_29_20after_20upgrading_20from_20another_20version_20this_20application_20sends_20an_20information_20about_20your_20web-site_20at&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F440&amp;partner=sociable" title="PDF" onclick="pageTracker._trackPageview('/outgoing/www.printfriendly.com/print?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F440_amp_partner=sociable&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/pdf.png" title="PDF" alt="PDF" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Another%20step%20for%20free%C2%ADdom%20of%20CRE%20Loaded%20PCI%C2%A0Pro&amp;body=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F440" title="email"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fblog.ixti.ru%2Farchives%2F440&amp;partner=sociable" title="Print" onclick="pageTracker._trackPageview('/outgoing/www.printfriendly.com/print?url=http_3A_2F_2Fblog.ixti.ru_2Farchives_2F440_amp_partner=sociable&amp;referer=');"><img src="http://blog.ixti.ru/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>


<br/><br/><img src="http://feeds.feedburner.com/~r/ixti/~4/yKQ9oS53Gv4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.ixti.ru/archives/440/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.ixti.ru/archives/440</feedburner:origLink></item>
	</channel>
</rss>
