<?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>Ruben Sargsyan &#187; text</title>
	<atom:link href="http://rubensargsyan.com/tag/text/feed/" rel="self" type="application/rss+xml" />
	<link>http://rubensargsyan.com</link>
	<description>Personal Website</description>
	<lastBuildDate>Fri, 27 Aug 2010 07:08:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Search text in the directory files</title>
		<link>http://rubensargsyan.com/search-text-in-the-directory-files/</link>
		<comments>http://rubensargsyan.com/search-text-in-the-directory-files/#comments</comments>
		<pubDate>Wed, 31 Mar 2010 07:51:49 +0000</pubDate>
		<dc:creator>Ruben Sargsyan</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[text]]></category>

		<guid isPermaLink="false">http://rubensargsyan.com/?p=324</guid>
		<description><![CDATA[An example for searching text (a word or phrase) in the directory files: &#60;?php function search_text_in_directory_files&#40;$directory, $text&#41;&#123; if&#40;file_exists&#40;$directory&#41;&#41;&#123; $files = array&#40;&#41;; &#160; if&#40;$handle=opendir&#40;$directory&#41;&#41;&#123; while&#40;&#40;$file=readdir&#40;$handle&#41;&#41;!==false&#41;&#123; if&#40;$file!=&#34;.&#34; &#38;&#38; $file!=&#34;..&#34; &#38;&#38; !is_dir&#40;$directory.&#34;/&#34;.$file&#41; &#38;&#38; file_exists&#40;$directory.&#34;/&#34;.$file&#41;&#41;&#123; $file_content = file_get_contents&#40;$directory.&#34;/&#34;.$file&#41;; &#160; if&#40;preg_match&#40;&#34;/&#34;.$text.&#34;/i&#34;,$file_content&#41;&#41;&#123; $files&#91;&#93; = $file; &#125; &#125; &#125; closedir&#40;$handle&#41;; &#125; &#160; return $files; &#125; &#160; return false; &#125; &#160; $directory = [...]]]></description>
			<content:encoded><![CDATA[<p>An example for searching text (a word or phrase) in the directory files:<span id="more-324"></span></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">function</span> search_text_in_directory_files<span style="color: #009900;">&#40;</span><span style="color: #000088;">$directory</span><span style="color: #339933;">,</span> <span style="color: #000088;">$text</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: #990000;">file_exists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$directory</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$files</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$handle</span><span style="color: #339933;">=</span><span style="color: #990000;">opendir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$directory</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #339933;">=</span><span style="color: #990000;">readdir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$handle</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">!==</span><span style="color: #009900; font-weight: bold;">false</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;">$file</span><span style="color: #339933;">!=</span><span style="color: #0000ff;">&quot;.&quot;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$file</span><span style="color: #339933;">!=</span><span style="color: #0000ff;">&quot;..&quot;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #990000;">is_dir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$directory</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">file_exists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$directory</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                    <span style="color: #000088;">$file_content</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$directory</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
                    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$text</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/i&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$file_content</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                        <span style="color: #000088;">$files</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$file</span><span style="color: #339933;">;</span>
                    <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #990000;">closedir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$handle</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$files</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$directory</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;files&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;text&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$found_files</span> <span style="color: #339933;">=</span> search_text_in_directory_files<span style="color: #009900;">&#40;</span><span style="color: #000088;">$directory</span><span style="color: #339933;">,</span><span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$found_files</span><span style="color: #339933;">===</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">echo</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Directory Not Found&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$found_files</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">echo</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Text Not Found&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$found_files</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$found_file</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">echo</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;p&gt;<span style="color: #006699; font-weight: bold;">$found_file</span>&lt;/p&gt;&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: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://rubensargsyan.com/search-text-in-the-directory-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Text counter by JavaScript</title>
		<link>http://rubensargsyan.com/text-counter-by-javascript/</link>
		<comments>http://rubensargsyan.com/text-counter-by-javascript/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 10:36:47 +0000</pubDate>
		<dc:creator>Ruben Sargsyan</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[counter]]></category>
		<category><![CDATA[text]]></category>

		<guid isPermaLink="false">http://rubensargsyan.com/?p=270</guid>
		<description><![CDATA[This is an example for adding a counter to the inputing texts of tags &#60;textarea&#62; and &#60;input&#62;: &#60;html&#62; &#160; &#60;head&#62; &#60;title&#62;Text Counter&#60;/title&#62; &#160; &#60;script type=&#34;text/javascript&#34;&#62; function text_counter&#40;textfield_id,counter_id,count&#41;&#123; count = parseInt&#40;count&#41;; &#160; document.getElementById&#40;counter_id&#41;.innerHTML = count; &#160; document.getElementById&#40;textfield_id&#41;.onpropertychange = function&#40;&#41;&#123; text_count_changed&#40;textfield_id,counter_id,count&#41;; &#125; &#125; &#160; function text_count_changed&#40;textfield_id,counter_id,count&#41;&#123; if&#40;count-parseInt&#40;document.getElementById&#40;textfield_id&#41;.value.length&#41;&#60;0&#41;&#123; document.getElementById&#40;textfield_id&#41;.value = document.getElementById&#40;textfield_id&#41;.value.substr&#40;0,count&#41;; &#125; &#160; document.getElementById&#40;counter_id&#41;.innerHTML = count-parseInt&#40;document.getElementById&#40;textfield_id&#41;.value.length&#41;; &#125; &#60;/script&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>This is an example for adding a counter to the inputing texts of tags &lt;textarea&gt; and &lt;input&gt;:<span id="more-270"></span></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">&lt;html&gt;
&nbsp;
&lt;head&gt;
  &lt;title&gt;Text Counter&lt;/title&gt;
&nbsp;
  <span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
  <span style="color: #003366; font-weight: bold;">function</span> text_counter<span style="color: #009900;">&#40;</span>textfield_id<span style="color: #339933;">,</span>counter_id<span style="color: #339933;">,</span>count<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    count <span style="color: #339933;">=</span> parseInt<span style="color: #009900;">&#40;</span>count<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span>counter_id<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> count<span style="color: #339933;">;</span>
&nbsp;
    document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span>textfield_id<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">onpropertychange</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        text_count_changed<span style="color: #009900;">&#40;</span>textfield_id<span style="color: #339933;">,</span>counter_id<span style="color: #339933;">,</span>count<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #003366; font-weight: bold;">function</span> text_count_changed<span style="color: #009900;">&#40;</span>textfield_id<span style="color: #339933;">,</span>counter_id<span style="color: #339933;">,</span>count<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>count<span style="color: #339933;">-</span>parseInt<span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span>textfield_id<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">value</span>.<span style="color: #660066;">length</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&lt;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span>textfield_id<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span>textfield_id<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">value</span>.<span style="color: #660066;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span>count<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span>counter_id<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> count<span style="color: #339933;">-</span>parseInt<span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span>textfield_id<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">value</span>.<span style="color: #660066;">length</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span>
&lt;/head&gt;
&nbsp;
&lt;body&gt;
&lt;p&gt;
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>inputtext_approving_chars_count <span style="color: #339933;">=</span> <span style="color: #CC0000;">10</span><span style="color: #339933;">;&lt;/</span>script<span style="color: #339933;">&gt;</span>
&lt;input type=&quot;text&quot; id=&quot;inputtext&quot; oninput='text_count_changed(&quot;inputtext&quot;,&quot;inputtext_counter&quot;,inputtext_approving_chars_count);'&gt; &lt;span id=&quot;inputtext_counter&quot;&gt;&lt;/span&gt;
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>text_counter<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;inputtext&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;inputtext_counter&quot;</span><span style="color: #339933;">,</span>inputtext_approving_chars_count<span style="color: #009900;">&#41;</span><span style="color: #339933;">;&lt;/</span>script<span style="color: #339933;">&gt;</span>
&lt;/p&gt;
&nbsp;
&lt;p&gt;
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>textfield_approving_chars_count <span style="color: #339933;">=</span> <span style="color: #CC0000;">255</span><span style="color: #339933;">;&lt;/</span>script<span style="color: #339933;">&gt;</span>
&lt;textarea id=&quot;textfield&quot; cols=&quot;50&quot; rows=&quot;10&quot; oninput='text_count_changed(&quot;textfield&quot;,&quot;textfield_counter&quot;,textfield_approving_chars_count);'&gt;&lt;/textarea&gt; &lt;span id=&quot;textfield_counter&quot;&gt;&lt;/span&gt;
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>text_counter<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;textfield&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;textfield_counter&quot;</span><span style="color: #339933;">,</span>textfield_approving_chars_count<span style="color: #009900;">&#41;</span><span style="color: #339933;">;&lt;/</span>script<span style="color: #339933;">&gt;</span>
&lt;/p&gt;
&nbsp;
&lt;/body&gt;
&nbsp;
&lt;/html&gt;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://rubensargsyan.com/text-counter-by-javascript/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
