<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>OXT blog</title>
	<atom:link href="http://blog.o-x-t.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.o-x-t.com</link>
	<description>"People say nothing is impossible, but I do nothing every day." - Whinnie The Pooh</description>
	<lastBuildDate>Sat, 06 Mar 2010 13:27:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Extra spacing in TinyMCE after pasting from Word</title>
		<link>http://blog.o-x-t.com/2010/03/06/extra-spacing-in-tinymce-after-pasting-from-word/</link>
		<comments>http://blog.o-x-t.com/2010/03/06/extra-spacing-in-tinymce-after-pasting-from-word/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 13:26:02 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[TinyMCE]]></category>
		<category><![CDATA[Word]]></category>

		<guid isPermaLink="false">http://blog.o-x-t.com/?p=235</guid>
		<description><![CDATA[TinyMCE can add extra empty paragraphs when you insert text from Word. TinyMCE simply wraps each newline into paragraph.
To solve it you need to follow these steps:

Enable paste plugin.
Add handler for parsing inserted text

So your TinyMCE code will look like:

  tinyMCE.init&#40;&#123;
        ...
      [...]]]></description>
			<content:encoded><![CDATA[<p>TinyMCE can add extra empty paragraphs when you insert text from Word. TinyMCE simply wraps each newline into paragraph.<br />
To solve it you need to follow these steps:</p>
<ol>
<li>Enable <code>paste</code> plugin.</li>
<li>Add handler for parsing inserted text</li>
</ol>
<p>So your TinyMCE code will look like:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">  tinyMCE.<span style="color: #660066;">init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
        ...
      	<span style="color: #660066;">plugins</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;paste&quot;</span><span style="color: #339933;">,</span>
      	paste_auto_cleanup_on_paste <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
      	paste_postprocess <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>pl<span style="color: #339933;">,</span> o<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #006600; font-style: italic;">// remove extra line breaks</span>
            o.<span style="color: #660066;">node</span>.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> o.<span style="color: #660066;">node</span>.<span style="color: #660066;">innerHTML</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/&lt;p.*&gt;\s*(&lt;br&gt;|&amp;nbsp;)\s*&lt;\/p&gt;/ig</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>See more info on the <a href="http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste">official wiki</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.o-x-t.com/2010/03/06/extra-spacing-in-tinymce-after-pasting-from-word/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Doctrine Sluggable and translit</title>
		<link>http://blog.o-x-t.com/2010/02/01/doctrine-sluggable-and-translit/</link>
		<comments>http://blog.o-x-t.com/2010/02/01/doctrine-sluggable-and-translit/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 00:45:02 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[doctrine]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[translit]]></category>

		<guid isPermaLink="false">http://blog.o-x-t.com/?p=230</guid>
		<description><![CDATA[Doctrine Sluggable behaviour doesn&#8217;t work with non-ASCII characters &#8211; it just removes them from the slug. For some languages, e.g. Russian with Cyrillic alphabet, it becomes unusable. The obvious way is to use transliteration.
Luckily Doctrine has easy way to do that, you can pass method for building slug:

Artist:
  actAs:
    Sluggable:
  [...]]]></description>
			<content:encoded><![CDATA[<p>Doctrine Sluggable behaviour doesn&#8217;t work with non-ASCII characters &#8211; it just removes them from the slug. For some languages, e.g. Russian with Cyrillic alphabet, it becomes unusable. The obvious way is to use transliteration.<br />
Luckily Doctrine has easy way to do that, you can pass method for building slug:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">Artist:
  actAs:
    Sluggable:
      fields: <span style="color:#006600; font-weight:bold;">&#91;</span>name<span style="color:#006600; font-weight:bold;">&#93;</span>
      builder: <span style="color:#006600; font-weight:bold;">&#91;</span>oxtSluggableTranslit, urlize<span style="color:#006600; font-weight:bold;">&#93;</span></pre></div></div>

<p>The easiest way I found to transliterate non-ASCII text is to use <a href="http://pecl.php.net/package/translit">PECL translit package</a>. For Debian-based systems you can install it with <code>dh-make-php</code>.<br />
Here&#8217;s the code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> oxtSluggableTranslit
<span style="color: #009900;">&#123;</span>
  <span style="color: #009933; font-style: italic;">/**
   * Convert any passed string to a url friendly string. Converts 'My first blog post' to 'my-first-blog-post'
   *
   * @param  string $text  Text to urlize
   * @return string $text  Urlized text
   */</span>
  static <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> urlize<span style="color: #009900;">&#40;</span><span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">return</span> Doctrine_Inflector<span style="color: #339933;">::</span><span style="color: #004000;">urlize</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">transliterate</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$text</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cyrillic_transliterate'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'remove_punctuation'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'utf-8'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'utf-8'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>You can view all available transliterate filters by running</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">php <span style="color: #660033;">-r</span> <span style="color: #ff0000;">'print_r(transliterate_filters_get());'</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.o-x-t.com/2010/02/01/doctrine-sluggable-and-translit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Symfony, propel and long running scripts</title>
		<link>http://blog.o-x-t.com/2009/11/28/symfony-propel-and-long-running-scripts/</link>
		<comments>http://blog.o-x-t.com/2009/11/28/symfony-propel-and-long-running-scripts/#comments</comments>
		<pubDate>Sat, 28 Nov 2009 15:25:18 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[propel]]></category>
		<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://blog.o-x-t.com/?p=228</guid>
		<description><![CDATA[For long running scripts in symfony with propel ORM you may experience problems with memory usage. To avoid them make sure to disable propel instance caching by calling this code at the beginning of the script:

Propel::disableInstancePooling&#40;&#41;;

Propel by default caches in memory all fetched database objects. That means that for scripts with extensive db usage or [...]]]></description>
			<content:encoded><![CDATA[<p>For long running scripts in symfony with propel ORM you may experience problems with memory usage. To avoid them make sure to disable propel instance caching by calling this code at the beginning of the script:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">Propel<span style="color: #339933;">::</span><span style="color: #004000;">disableInstancePooling</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Propel by default caches in memory all fetched database objects. That means that for scripts with extensive db usage or long running time you may hit php <code>memory_limit</code> sooner or later.<br />
Starting with propel 1.3 shipped with symfony 1.3 and 1.4 which are about to be released you&#8217;ll be able to disable instance pooling in database yaml config.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.o-x-t.com/2009/11/28/symfony-propel-and-long-running-scripts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Disable menu bar in gnome-terminal</title>
		<link>http://blog.o-x-t.com/2009/10/18/disable-menu-bar-in-gnome-terminal/</link>
		<comments>http://blog.o-x-t.com/2009/10/18/disable-menu-bar-in-gnome-terminal/#comments</comments>
		<pubDate>Sun, 18 Oct 2009 18:54:36 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Operating systems]]></category>
		<category><![CDATA[gnome]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://blog.o-x-t.com/?p=222</guid>
		<description><![CDATA[You can easily hide menu bar for gnome-terminal at a runtime. Obviously it&#8217;s rarely used and you can save some screen space by hiding it.
To hide it for newly opened terminal windows by default change this flag in gnome config:
/apps/gnome-terminal/profiles/Default/default_show_menubar to false.

gconftool --type boolean --set /apps/gnome-terminal/profiles/Default/default_show_menubar false

]]></description>
			<content:encoded><![CDATA[<p>You can easily hide menu bar for gnome-terminal at a runtime. Obviously it&#8217;s rarely used and you can save some screen space by hiding it.</p>
<p>To hide it for newly opened terminal windows by default change this flag in gnome config:<br />
<code>/apps/gnome-terminal/profiles/Default/default_show_menubar</code> to false.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gconftool <span style="color: #660033;">--type</span> boolean <span style="color: #660033;">--set</span> <span style="color: #000000; font-weight: bold;">/</span>apps<span style="color: #000000; font-weight: bold;">/</span>gnome-terminal<span style="color: #000000; font-weight: bold;">/</span>profiles<span style="color: #000000; font-weight: bold;">/</span>Default<span style="color: #000000; font-weight: bold;">/</span>default_show_menubar <span style="color: #c20cb9; font-weight: bold;">false</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.o-x-t.com/2009/10/18/disable-menu-bar-in-gnome-terminal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>symfony: sfValidatorFile &#8211; invalid mime type (text/plain) for PNG images</title>
		<link>http://blog.o-x-t.com/2009/07/27/symfony-sfvalidatorfile-invalid-mime-type-textplain-for-png-images/</link>
		<comments>http://blog.o-x-t.com/2009/07/27/symfony-sfvalidatorfile-invalid-mime-type-textplain-for-png-images/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 13:47:02 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://blog.o-x-t.com/?p=217</guid>
		<description><![CDATA[On some systems sfValidatorFile may give you an error when trying to upoad PNG images. It says that it has invalid mime type &#8211; text/plain, though you have 'mime_types' = 'web_images' and other image formats work well.
It may be caused by wrong result from mime_content_type() function. To check if it&#8217;s your case create simple php [...]]]></description>
			<content:encoded><![CDATA[<p>On some systems <code>sfValidatorFile</code> may give you an error when trying to upoad PNG images. It says that it has invalid mime type &#8211; text/plain, though you have <code>'mime_types' = 'web_images'</code> and other image formats work well.</p>
<p>It may be caused by wrong result from <code>mime_content_type()</code> function. To check if it&#8217;s your case create simple php script with just one line:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">echo</span> <span style="color: #990000;">mime_content_type</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'path_to_your_png_image'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>If it will give you <code>text/plain</code> then you have three options:</p>
<ol>
<li>Upgrade your PHP to 5.3.0, though I doubt it&#8217;s available for most *nix distributions at this time.</li>
<li>Install PECL package <a href="http://pecl.php.net/package/Fileinfo">Fileinfo</a>.</li>
<li>The easiest, modify form class.</li>
</ol>
<p>In first two options <code>sfValidatorFile</code> will use <code>finfo_open</code> function prior to <code>mime_content_type</code> and it should give correct results for PNG image. However, upgrading PHP or installing PECL package isn&#8217;t always possible.</p>
<p>The simplest way to fix this bug is to apply small modifications to your form class, just reorder mime type guessers:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> configure<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">validatorSchema</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'image'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> sfValidatorFile<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
      <span style="color: #0000ff;">'required'</span>	<span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span>
      <span style="color: #0000ff;">'path'</span>       <span style="color: #339933;">=&gt;</span> sfConfig<span style="color: #339933;">::</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'sf_upload_dir'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/directory'</span><span style="color: #339933;">,</span>
      <span style="color: #0000ff;">'mime_types'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'web_images'</span>
    <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">validatorSchema</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'image'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setOption</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'mime_type_guessers'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
    <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">validatorSchema</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'image'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'guessFromFileinfo'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">validatorSchema</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'image'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'guessFromFileBinary'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">validatorSchema</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'image'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'guessFromMimeContentType'</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>In this case validator will first try <code>fileinfo</code> (which should be available since PHP 5.3.0), then <code>'file -bi'</code> which should work correctly on *nix platform and only if both failed it will use <code>mime_content_type</code></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.o-x-t.com/2009/07/27/symfony-sfvalidatorfile-invalid-mime-type-textplain-for-png-images/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Calling phing tasks from Eclipse</title>
		<link>http://blog.o-x-t.com/2009/06/11/calling-phing-tasks-from-eclipse/</link>
		<comments>http://blog.o-x-t.com/2009/06/11/calling-phing-tasks-from-eclipse/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 12:16:27 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[phing]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.o-x-t.com/?p=211</guid>
		<description><![CDATA[Here you can read how to run phing tasks using built-in Ant tool in Eclipse.
In this post I&#8217;ll describe what to do if your phing task requires user input. The solution is simple &#8211; ask for user property in ant and pass it back to phing:


&#60;?xml version=&#34;1.0&#34; encoding=&#34;UTF-8&#34;?&#62;
&#60;project name=&#34;project_name&#34;&#62;
	&#60;property name=&#34;phing.command&#34; value=&#34;phing&#34; /&#62;
	&#60;target name=&#34;task_name&#34; description=&#34;Task description&#34;&#62;
		&#60;input [...]]]></description>
			<content:encoded><![CDATA[<p>Here you can read <a href="http://www.insidewebdev.com/2008/08/16/using-eclipse-ant-with-phing/">how to run phing tasks using built-in Ant tool in Eclipse</a>.</p>
<p>In this post I&#8217;ll describe what to do if your phing task requires user input. The solution is simple &#8211; ask for user property in ant and pass it back to phing:<br />
<span id="more-211"></span></p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;project</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;project_name&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;phing.command&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;phing&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;task_name&quot;</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;Task description&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">message</span>=<span style="color: #ff0000;">&quot;Input property&quot;</span></span>
<span style="color: #009900;">			<span style="color: #000066;">addproperty</span>=<span style="color: #ff0000;">&quot;property_name&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">executable</span>=<span style="color: #ff0000;">&quot;${phing.command}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">line</span>=<span style="color: #ff0000;">&quot;-Dphing_task_property=${property_name}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">line</span>=<span style="color: #ff0000;">&quot;phing_task_name&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/project<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>You also need to tell phing not to wait for user input if we&#8217;ve passed property via command line. For phing task <code>propertyPrompt</code> use attribute <code>useExistingValue="true"</code>.</p>
<p>If your phing property has default value you need to specify this default value in ant input task also.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.o-x-t.com/2009/06/11/calling-phing-tasks-from-eclipse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add absolute link menu item to user menu in Drupal</title>
		<link>http://blog.o-x-t.com/2009/05/21/add-absolute-link-menu-item-to-user-menu-in-drupal/</link>
		<comments>http://blog.o-x-t.com/2009/05/21/add-absolute-link-menu-item-to-user-menu-in-drupal/#comments</comments>
		<pubDate>Wed, 20 May 2009 22:58:26 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.o-x-t.com/?p=207</guid>
		<description><![CDATA[First of all, user menu (local tasks) in Drupal cannot be edited via admin. To add items to the menu you need to create new module and implement hook_menu() in it.
The following example shows how to do it in Drupal 6:

function yourmodule_menu&#40;&#41; &#123;
  $items&#91;'http://some.url'&#93; = array&#40;
    'tab_root'	=&#62; 'user',
    [...]]]></description>
			<content:encoded><![CDATA[<p>First of all, user menu (local tasks) in Drupal cannot be edited via admin. To add items to the menu you need to create new module and implement hook_menu() in it.<br />
The following example shows how to do it in Drupal 6:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> yourmodule_menu<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$items</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'http://some.url'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
    <span style="color: #0000ff;">'tab_root'</span>	<span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'user'</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'tab_parent'</span>	<span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'user'</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'External URL'</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'page callback'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'user_page'</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'access callback'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'user_is_anonymous'</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'type'</span> <span style="color: #339933;">=&gt;</span> MENU_LOCAL_TASK<span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'weight'</span>	<span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">5</span>
  <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$items</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Change &#8216;access callback&#8217; to whatever function (or constant) you want, but don&#8217;t forget to set &#8216;page callback&#8217;. It is being checked when building menu structure even if we don&#8217;t have any page callback actually.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.o-x-t.com/2009/05/21/add-absolute-link-menu-item-to-user-menu-in-drupal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>symfony l10n &#8211; going further</title>
		<link>http://blog.o-x-t.com/2009/04/19/symfony-l10n-going-further/</link>
		<comments>http://blog.o-x-t.com/2009/04/19/symfony-l10n-going-further/#comments</comments>
		<pubDate>Sun, 19 Apr 2009 20:39:16 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[l10n]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://blog.o-x-t.com/?p=180</guid>
		<description><![CDATA[As you may know symfony offers localized objects out of the box. It gives you an easy way to have different data for different cultures.
Sometimes it is not enough. I needed two localized version of website but with completely different content &#8211; everything including users, admin and super admin. Both version were supposed to run [...]]]></description>
			<content:encoded><![CDATA[<p>As you may know symfony offers localized objects out of the box. It gives you an easy way to have different data for different cultures.</p>
<p>Sometimes it is not enough. I needed two localized version of website but with completely different content &#8211; everything including users, admin and super admin. Both version were supposed to run under the same domain and to be distinguished just by locale part in the url. I was too lazy and didn&#8217;t want to copy applications or projects (moreover, it is a problem in the future, you&#8217;ll have to modify each copy). So, I decided to use different databases with exact schema for different cultures.</p>
<p>Here&#8217;s guide how to implement this.<br />
<span id="more-180"></span></p>
<p>First of all, I need to extract locale parameter from the url. That is easy, you&#8217;ll find it in the symfony docs.<br />
Routes config (routing.yml):</p>
<pre>
action:
  url:   /:locale/:module/:action/*
  requirements: {locale: nl|be}
</pre>
<p>I needed only NL and BE locales.</p>
<p>Then, you need to setup two databases. I was using symfony 1.1 with doctrine, but it should be possible for 1.2 also and propel or whatever ORM you are convenient with. Doctrine is able to work with multiple connections. However, I don&#8217;t need multiple connections. I need them both defined but I need only one current connection for every request. So I&#8217;m defining two connections but not specifying any binding to connection in model schema.<br />
Databases config (databases.yml):</p>
<pre>
all:
  belgium:
    class:          sfDoctrineDatabase
    param:
      dsn:          mysql://user_be:pass_be@host_be/db_be
  primary:
    class:          sfDoctrineDatabase
    param:
      dsn:          mysql://user_nl:pass_nl@host_nl/db_nl
</pre>
<p>If you check your application at this moment it will use connection last defined.</p>
<p>So, now I only need to switch between these connections. I can do it with filters.<br />
filters.yml:</p>
<pre>
rendering: ~
security:  ~
l10n:
  class: l10nFilter
cache:     ~
common:    ~
execution: ~
</pre>
<p>And the filter itself:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> l10nFilter <span style="color: #000000; font-weight: bold;">extends</span> sfFilter 
<span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> execute<span style="color: #009900;">&#40;</span><span style="color: #000088;">$filterChain</span><span style="color: #009900;">&#41;</span> 
  <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isFirstCall</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$locale</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getContext</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRequest</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getParameter</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'locale'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #666666; font-style: italic;">//sanitize locale</span>
      <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getContext</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getUser</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'locale'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$locale</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$connection</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$locale</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'be'</span><span style="color: #009900;">&#41;</span> ? <span style="color: #0000ff;">'belgium'</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">'primary'</span><span style="color: #339933;">;</span>
      Doctrine_Manager<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setCurrentConnection</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$connection</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000088;">$filterChain</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">execute</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>That&#8217;s it.</p>
<p>The small issue is that if you are going to use symfony db tasks (e.g. migrations or data population) you&#8217;ll need to set additional environments:<br />
databases.yml:</p>
<pre>
prod_be:
  primary:
    class:          sfDoctrineDatabase
    param:
      dsn:          mysql://user_be:pass_be@host_be/db_be
prod_nl:
  primary:
    class:          sfDoctrineDatabase
    param:
      dsn:          mysql://user_nl:pass_nl@host_nl/db_nl
</pre>
<p>And call your tasks twice for each pseudo-environment by adding &#8211;env=prod_be or &#8211;env=prod_nl.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.o-x-t.com/2009/04/19/symfony-l10n-going-further/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hierarchical clustering using C++</title>
		<link>http://blog.o-x-t.com/2009/01/23/hierarchical_clustering/</link>
		<comments>http://blog.o-x-t.com/2009/01/23/hierarchical_clustering/#comments</comments>
		<pubDate>Fri, 23 Jan 2009 12:46:19 +0000</pubDate>
		<dc:creator>Atuk</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Hierarchical clustering]]></category>
		<category><![CDATA[STL]]></category>

		<guid isPermaLink="false">http://blog.o-x-t.com/?p=155</guid>
		<description><![CDATA[Our aim is to implement hierarchical clustering algorithm with O(N*N*log(N)) complexity using STL.
The idea of hierarchical clustering is merging two nearest clusters on every step starting from N one-element clusters. To find two nearest clusters on step K we need (N-K+1)x(N-K+1) matrix of distances between current clusters. We need, in worst case, N times of [...]]]></description>
			<content:encoded><![CDATA[<p>Our aim is to implement hierarchical clustering algorithm with O(N*N*log(N)) complexity using STL.</p>
<p>The idea of hierarchical clustering is merging two nearest clusters on every step starting from N one-element clusters. To find two nearest clusters on step K we need (N-K+1)x(N-K+1) matrix of distances between current clusters. We need, in worst case, N times of updating and finding minimum in sequence of NxN, (N-1)x(N-1), (N-2)x(N-2), &#8230;, 1&#215;1 matrix.  So, in usual realization of HC algorithm it should cost you O(N*N*N) operations.</p>
<p>To improve algorithm complexity up to O(N*N*log(N)) we can use vector V of similar to priority queues structures. V[i] should consist of sorted by distance points P(i,j) where distance is distance between clusters i and j. Our similar to priority queues data structure should support: ability to extract minimal element with complexity O(1), ability to delete element with complexity O(log(n)), and ability to add and element with complexity O(log(n)).</p>
<p>Standard STL priority_queue allows us to extract minimum and add element with required time, but it has no ability to find quickly an element, so we can&#8217;t delete elements with complexity O(log(n)). I propose to use set or multiset STL structure instead. Set and multiset uses &#8220;red-black tree&#8221; data structure with O(log(n)) complexity of deletion and insertion. Also, in STL sets all elements stored in sorted order and we can easily access to minimum (maximum) element [using standard begin() or end() methods].</p>
<p>In my realization I used following structure to store distances and cluster&#8217;s indexes:</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">struct</span> distances
<span style="color: #008000;">&#123;</span>
	<span style="color: #0000ff;">double</span> dist<span style="color: #008080;">;</span>
	<span style="color: #0000ff;">int</span> index<span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span></pre></div></div>

<p>Also I defined appropriate comparing operator so that elements in my set always sorted in right order.</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">struct</span> Cmp<span style="color: #008000;">&#123;</span>
	<span style="color: #0000ff;">bool</span> operator<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">const</span> distances d1, <span style="color: #0000ff;">const</span> distances d2<span style="color: #008000;">&#41;</span> <span style="color: #0000ff;">const</span>
	<span style="color: #008000;">&#123;</span>
		<span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>d1.<span style="color: #007788;">dist</span> <span style="color: #000080;">==</span> d2.<span style="color: #007788;">dist</span><span style="color: #008000;">&#41;</span>
		<span style="color: #008000;">&#123;</span>
			<span style="color: #0000ff;">return</span> d1.<span style="color: #007788;">index</span> <span style="color: #000040;">&amp;</span>lt<span style="color: #008080;">;</span> d2.<span style="color: #007788;">index</span><span style="color: #008080;">;</span>
		<span style="color: #008000;">&#125;</span>
		<span style="color: #0000ff;">return</span> d1.<span style="color: #007788;">dist</span> <span style="color: #000040;">&amp;</span>lt<span style="color: #008080;">;</span> d2.<span style="color: #007788;">dist</span><span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span></pre></div></div>

<p>Then declaration of our vector of sets should look like this one:</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;">std<span style="color: #008080;">::</span><span style="color: #007788;">vector</span><span style="color: #000040;">&amp;</span>gt<span style="color: #008080;">;</span> P<span style="color: #008080;">;</span></pre></div></div>

<p>Here is source codes with sample input file and some comments:</p>
<p><a href="http://blog.o-x-t.com/wp-content/uploads/2009/01/sources.zip">sources.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.o-x-t.com/2009/01/23/hierarchical_clustering/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Problems with SSE2 in OpenCV</title>
		<link>http://blog.o-x-t.com/2009/01/06/problems-with-sse2-in-opencv/</link>
		<comments>http://blog.o-x-t.com/2009/01/06/problems-with-sse2-in-opencv/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 05:32:53 +0000</pubDate>
		<dc:creator>Atuk</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[OpenCV]]></category>
		<category><![CDATA[SSE2]]></category>

		<guid isPermaLink="false">http://blog.o-x-t.com/?p=141</guid>
		<description><![CDATA[When I tried to use some methods from OpenCV library (for example CvResize()) in my MS Visual Studio 2005 project I encountered with errors in cxtypes.h header file near

#if CV_SSE2
__m128d t = _mm_load_sd&#40; &#38;value &#41;;
int i = _mm_cvtsd_si32&#40;t&#41;;
return i - _mm_movemask_pd&#40;_mm_cmplt_sd&#40;t,_mm_cvtsi32_sd&#40;t,i&#41;&#41;&#41;;
#else
....

These errors were related with SSE2. The problem is that my AMD Sempron 2200+ family [...]]]></description>
			<content:encoded><![CDATA[<p>When I tried to use some methods from OpenCV library (for example CvResize()) in my MS Visual Studio 2005 project I encountered with errors in cxtypes.h header file near</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #339900;">#if CV_SSE2</span>
__m128d t <span style="color: #000080;">=</span> _mm_load_sd<span style="color: #008000;">&#40;</span> <span style="color: #000040;">&amp;</span>value <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
<span style="color: #0000ff;">int</span> i <span style="color: #000080;">=</span> _mm_cvtsd_si32<span style="color: #008000;">&#40;</span>t<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
<span style="color: #0000ff;">return</span> i <span style="color: #000040;">-</span> _mm_movemask_pd<span style="color: #008000;">&#40;</span>_mm_cmplt_sd<span style="color: #008000;">&#40;</span>t,_mm_cvtsi32_sd<span style="color: #008000;">&#40;</span>t,i<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
<span style="color: #339900;">#else</span>
....</pre></div></div>

<p>These errors were related with SSE2. The problem is that my AMD Sempron 2200+ family 6 (x86 family 6 model 8 ) processor do not support SSE2 instructions. SSE &#8211; Streaming SIMD Extensions 2 are extends on MMX instructions to operate on special registers to increase computational speed in some cases.</p>
<p>To fix these problems you need to set CV_SSE2 variable to 0 in cxcore&#8217;s cxtypes.h (near 65 line).<br />
For example like here:</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #666666;">//  #if defined WIN32 &amp;amp;&amp;amp; (!defined WIN64 || defined EM64T) &amp;&amp; </span>
<span style="color: #666666;">//      (_MSC_VER &gt;= 1400 || defined CV_ICC) </span>
<span style="color: #666666;">//      || (defined __SSE2__ &amp;&amp; defined __GNUC__ &amp;&amp; __GNUC__ &gt;= 4)</span>
<span style="color: #666666;">//    #include </span>
<span style="color: #666666;">//    #define CV_SSE2 1</span>
<span style="color: #666666;">//  #else</span>
    <span style="color: #339900;">#define CV_SSE2 0</span>
<span style="color: #666666;">//  #endif</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.o-x-t.com/2009/01/06/problems-with-sse2-in-opencv/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
