<?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>Amit Yadav &#187; FAQs  Help  and Tutorials</title>
	<atom:link href="http://www.amityadav.name/tag/faqs-help-and-tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.amityadav.name</link>
	<description>Things to know for effective coding</description>
	<lastBuildDate>Fri, 19 Aug 2011 17:51:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Namazu with PHP5 on Linux</title>
		<link>http://www.amityadav.name/namazu-with-php5-on-linux/</link>
		<comments>http://www.amityadav.name/namazu-with-php5-on-linux/#comments</comments>
		<pubDate>Tue, 28 Sep 2010 06:31:36 +0000</pubDate>
		<dc:creator>Amit</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Common Gateway Interface]]></category>
		<category><![CDATA[FAQs  Help  and Tutorials]]></category>
		<category><![CDATA[Microsoft Windows]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Open source]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.amityadav.name/?p=713</guid>
		<description><![CDATA[Namazu is a full-text search engine intended for easy use is what the namazu site tells its users. I have already worked on namazu and it worked amazingly fast. Recently i started working on a project having tens &#38; thousands of records and it was cumbersome for MySQL to work efficiently under that much load. [...]]]></description>
			<content:encoded><![CDATA[<p>Namazu is a <a class="zem_slink" href="http://en.wikipedia.org/wiki/Full_text_search" rel="wikipedia" title="Full text search">full-text</a> <a class="zem_slink" href="http://en.wikipedia.org/wiki/Web_search_engine" rel="wikipedia" title="Web search engine">search engine</a> intended for easy use is what the <a href="http://www.namazu.org/" target="_blank">namazu </a>site tells its users. I have already worked on <a href="http://www.namazu.org/" target="_blank">namazu </a>and it worked amazingly fast. Recently i started working on a project having tens &amp; thousands of records and it was cumbersome for <a class="zem_slink" href="http://www.mysql.com" rel="homepage" title="MySQL">MySQL</a> to work efficiently under that much load. I decided to use namazu for that but unfortunately i was working on a <a class="zem_slink" href="http://www.microsoft.com/WINDOWS" rel="homepage" title="Windows">windows</a> based platform and its very difficult to configure PHP5 with namazu on windows. I was able to install namazu easily on windows. One can use the <a class="zem_slink" href="http://en.wikipedia.org/wiki/Common_Gateway_Interface" rel="wikipedia" title="Common Gateway Interface">CGI</a> mode to use <a href="http://www.namazu.org/" target="_blank">namazu </a>on windows but installing namazu as a <a class="zem_slink" href="http://www.php.net/" rel="homepage" title="PHP">PHP</a> extension is difficult at least for me at this time.</p>
<p>But i was able to install namazu on LINUX and was also able to install namazu as a PHP extension on LINUX. While stumbling though site searching for installing namazu with PHP5 i got&nbsp;<a href="http://www.koderz.org/index.php?id=438" target="_blank">this&nbsp;</a>link which describes how one can install namazu on LINUX and its PHP extension also.</p>
<p>I will keep on searching how to get namazu as a PHP extension, meanwhile you can use <a href="http://www.koderz.org/index.php?id=438" target="_blank">this </a>link to get namazu working on LINUX.</p>
<div class="zemanta-pixie" style="margin-top:10px;height:15px"><img alt="" class="zemanta-pixie-img" src="http://img.zemanta.com/pixy.gif?x-id=7fd4f451-2156-47f4-b259-eb29cc05a06d" style="border:none;float:right" /><script defer="defer" src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></div>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.amityadav.name%2Fnamazu-with-php5-on-linux%2F&amp;title=Namazu%20with%20PHP5%20on%20Linux" id="wpa2a_2"><img src="http://www.amityadav.name/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.amityadav.name/namazu-with-php5-on-linux/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Javascript: Ways to iterate over an array</title>
		<link>http://www.amityadav.name/javascript-ways-to-iterate-over-an-array/</link>
		<comments>http://www.amityadav.name/javascript-ways-to-iterate-over-an-array/#comments</comments>
		<pubDate>Sun, 26 Apr 2009 18:36:16 +0000</pubDate>
		<dc:creator>Amit</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Array]]></category>
		<category><![CDATA[Edward Lee]]></category>
		<category><![CDATA[FAQs  Help  and Tutorials]]></category>
		<category><![CDATA[Iteration]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Languages]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.amityadav.name/?p=259</guid>
		<description><![CDATA[for each in: JAVASCRIPT: for each (var item in [1, 2, 3]) alert(item); JavaScript 1.6 added the Array.forEach method: JAVASCRIPT: [1, 2, 3].forEach(function(item) { alert(item) }); JavaScript 1.7 added array comprehensions for array initialization: JAVASCRIPT: var squares = [item * item for each (item in [1, 2, 3])]; I just realized I can (ab)use comprehensions [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Statements/for_each...in">for  each in</a>:</p>
<div class="syntax_hilite"><span style="font-weight: bold; color: #000000;">JAVASCRIPT:</span></p>
<div id="javascript-13">
<div class="javascript">
<ol>
<li style="font-weight: bold; color: #26536a;">
<div style="font-weight: normal; color: #000000; font-family: 'Courier New',Courier,monospace;"><span style="font-weight: bold; color: #000066;">for</span> each <span style="font-weight: bold; color: #006600;">(</span><span style="font-weight: bold; color: #003366;">var</span> <span style="font-weight: bold; color: #000066;">item</span> <span style="font-weight: bold; color: #000066;">in</span> <span style="font-weight: bold; color: #006600;">[</span><span style="color: #800000;">1</span>, <span style="color: #800000;">2</span>, <span style="color: #800000;">3</span><span style="font-weight: bold; color: #006600;">]</span><span style="font-weight: bold; color: #006600;">)</span> <span style="color: #000066;">alert</span><span style="font-weight: bold; color: #006600;">(</span><span style="font-weight: bold; color: #000066;">item</span><span style="font-weight: bold; color: #006600;">)</span>;</div>
</li>
</ol>
</div>
</div>
</div>
<p><a href="https://developer.mozilla.org/en/New_in_JavaScript_1.6">JavaScript  1.6</a> added the <a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array/forEach">Array.forEach  method</a>:</p></blockquote>
<blockquote>
<div class="syntax_hilite"><span style="font-weight: bold; color: #000000;">JAVASCRIPT:</span></p>
<div id="javascript-14">
<div class="javascript">
<ol>
<li style="font-weight: bold; color: #26536a;">
<div style="font-weight: normal; color: #000000; font-family: 'Courier New',Courier,monospace;"><span style="font-weight: bold; color: #006600;">[</span><span style="color: #800000;">1</span>, <span style="color: #800000;">2</span>, <span style="color: #800000;">3</span><span style="font-weight: bold; color: #006600;">]</span>.<span style="color: #006600;">forEach</span><span style="font-weight: bold; color: #006600;">(</span><span style="font-weight: bold; color: #003366;">function</span><span style="font-weight: bold; color: #006600;">(</span><span style="font-weight: bold; color: #000066;">item</span><span style="font-weight: bold; color: #006600;">)</span> <span style="font-weight: bold; color: #006600;">{</span> <span style="color: #000066;">alert</span><span style="font-weight: bold; color: #006600;">(</span><span style="font-weight: bold; color: #000066;">item</span><span style="font-weight: bold; color: #006600;">)</span> <span style="font-weight: bold; color: #006600;">}</span><span style="font-weight: bold; color: #006600;">)</span>;</div>
</li>
</ol>
</div>
</div>
</div>
</blockquote>
<p><a href="https://developer.mozilla.org/En/New_in_JavaScript_1.7">JavaScript  1.7</a> added <a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Working_with_Arrays#Array_comprehensions">array  comprehensions</a> for array initialization:</p>
<blockquote><p><span style="font-weight: bold; color: #000000;">JAVASCRIPT:</span></p>
<div class="syntax_hilite">
<div id="javascript-15">
<div class="javascript">
<ol>
<li style="font-weight: bold; color: #26536a;">
<div style="font-weight: normal; color: #000000; font-family: 'Courier New',Courier,monospace;"><span style="font-weight: bold; color: #003366;">var</span> squares = <span style="font-weight: bold; color: #006600;">[</span><span style="font-weight: bold; color: #000066;">item</span> * <span style="font-weight: bold; color: #000066;">item</span> <span style="font-weight: bold; color: #000066;">for</span> each <span style="font-weight: bold; color: #006600;">(</span><span style="font-weight: bold; color: #000066;">item</span> <span style="font-weight: bold; color: #000066;">in</span> <span style="font-weight: bold; color: #006600;">[</span><span style="color: #800000;">1</span>, <span style="color: #800000;">2</span>, <span style="color: #800000;">3</span><span style="font-weight: bold; color: #006600;">]</span><span style="font-weight: bold; color: #006600;">)</span><span style="font-weight: bold; color: #006600;">]</span>;</div>
</li>
</ol>
</div>
</div>
</div>
</blockquote>
<p>I just realized I can (ab)use comprehensions to <a class="zem_slink" title="Iteration" rel="wikipedia" href="http://en.wikipedia.org/wiki/Iteration">iterate</a> <a class="zem_slink" title="Array" rel="wikipedia" href="http://en.wikipedia.org/wiki/Array">arrays</a> with <a class="zem_slink" title="Perl" rel="homepage" href="http://www.perl.org/">Perl</a>-like  syntax by throwing away the result:</p>
<blockquote>
<div class="syntax_hilite"><span style="font-weight: bold; color: #000000;">JAVASCRIPT:</span></p>
<div id="javascript-16">
<div class="javascript">
<ol>
<li style="font-weight: bold; color: #26536a;">
<div style="font-weight: normal; color: #000000; font-family: 'Courier New',Courier,monospace;"><span style="font-weight: bold; color: #006600;">[</span><span style="color: #000066;">alert</span><span style="font-weight: bold; color: #006600;">(</span><span style="font-weight: bold; color: #000066;">item</span><span style="font-weight: bold; color: #006600;">)</span> <span style="font-weight: bold; color: #000066;">for</span> each <span style="font-weight: bold; color: #006600;">(</span><span style="font-weight: bold; color: #000066;">item</span> <span style="font-weight: bold; color: #000066;">in</span> <span style="font-weight: bold; color: #006600;">[</span><span style="color: #800000;">1</span>, <span style="color: #800000;">2</span>, <span style="color: #800000;">3</span><span style="font-weight: bold; color: #006600;">]</span><span style="font-weight: bold; color: #006600;">)</span><span style="font-weight: bold; color: #006600;">]</span>;</div>
</li>
</ol>
</div>
</div>
</div>
</blockquote>
<p>I can iterate object properties the same way:</p>
<blockquote>
<div class="syntax_hilite"><span style="font-weight: bold; color: #000000;">JAVASCRIPT:</span></p>
<div id="javascript-17">
<div class="javascript">
<ol>
<li style="font-weight: bold; color: #26536a;">
<div style="font-weight: normal; color: #000000; font-family: 'Courier New',Courier,monospace;"><span style="font-weight: bold; color: #003366;">var</span> <a class="zem_slink" title="Obj" rel="wikipedia" href="http://en.wikipedia.org/wiki/Obj">obj</a> = <span style="font-weight: bold; color: #006600;">{</span> foo: <span style="color: #800000;">1</span>, bar: <span style="color: #800000;">2</span>,  baz: <span style="color: #800000;">3</span> <span style="font-weight: bold; color: #006600;">}</span>;</div>
</li>
<li style="font-weight: normal; color: #3a6a8b; font-style: normal; font-family: 'Courier New',Courier,monospace;">
<div style="font-weight: normal; color: #000000; font-family: 'Courier New',Courier,monospace;"><span style="font-weight: bold; color: #006600;">[</span><span style="color: #000066;">alert</span><span style="font-weight: bold; color: #006600;">(</span><span style="color: #000066;">name</span> + <span style="color: #3366cc;">"="</span> +  obj<span style="font-weight: bold; color: #006600;">[</span><span style="color: #000066;">name</span><span style="font-weight: bold; color: #006600;">]</span><span style="font-weight: bold; color: #006600;">)</span> <span style="font-weight: bold; color: #000066;">for</span> <span style="font-weight: bold; color: #006600;">(</span><span style="color: #000066;">name</span> <span style="font-weight: bold; color: #000066;">in</span> obj<span style="font-weight: bold; color: #006600;">)</span><span style="font-weight: bold; color: #006600;">]</span>;</div>
</li>
</ol>
</div>
</div>
</div>
</blockquote>
<p><a class="zem_slink" title="Edward Lee (archbishop)" rel="wikipedia" href="http://en.wikipedia.org/wiki/Edward_Lee_%28archbishop%29">Edward Lee</a> points out how to use <a class="zem_slink" title="Iterator" rel="wikipedia" href="http://en.wikipedia.org/wiki/Iterator">Iterators</a>:</p>
<blockquote>
<div class="syntax_hilite"><span style="font-weight: bold; color: #000000;">JAVASCRIPT:</span></p>
<div id="javascript-18">
<div class="javascript">
<ol>
<li style="font-weight: bold; color: #26536a;">
<div style="font-weight: normal; color: #000000; font-family: 'Courier New',Courier,monospace;"><span style="font-weight: bold; color: #006600;">[</span><span style="color: #000066;">alert</span><span style="font-weight: bold; color: #006600;">(</span>key + <span style="color: #3366cc;">"="</span> + val<span style="font-weight: bold; color: #006600;">)</span> <span style="font-weight: bold; color: #000066;">for</span> <span style="font-weight: bold; color: #006600;">(</span><span style="font-weight: bold; color: #006600;">[</span>key, val<span style="font-weight: bold; color: #006600;">]</span> <span style="font-weight: bold; color: #000066;">in</span> Iterator<span style="font-weight: bold; color: #006600;">(</span><span style="font-weight: bold; color: #006600;">{</span>a:<span style="color: #800000;">1</span>,b:<span style="color: #800000;">2</span>,c:<span style="color: #800000;">3</span><span style="font-weight: bold; color: #006600;">}</span><span style="font-weight: bold; color: #006600;">)</span><span style="font-weight: bold; color: #006600;">)</span><span style="font-weight: bold; color: #006600;">]</span></div>
</li>
</ol>
</div>
</div>
</div>
</blockquote>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/pixy.gif?x-id=bd6ecd20-d4fd-4e18-9806-a11d90a3b1e1" alt="" /><span class="zem-script more-related pretty-attribution"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.amityadav.name%2Fjavascript-ways-to-iterate-over-an-array%2F&amp;title=Javascript%3A%20Ways%20to%20iterate%20over%20an%20array" id="wpa2a_4"><img src="http://www.amityadav.name/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.amityadav.name/javascript-ways-to-iterate-over-an-array/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails flash messages helper</title>
		<link>http://www.amityadav.name/rails-flash-messages-helper/</link>
		<comments>http://www.amityadav.name/rails-flash-messages-helper/#comments</comments>
		<pubDate>Tue, 17 Feb 2009 07:49:05 +0000</pubDate>
		<dc:creator>Amit</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Adobe Flash]]></category>
		<category><![CDATA[Data Formats]]></category>
		<category><![CDATA[FAQs  Help  and Tutorials]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Markup Languages]]></category>
		<category><![CDATA[Multimedia]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.amityadav.name/?p=204</guid>
		<description><![CDATA[display_flash(:error) # to display a specific flash message display_flash # to display all flash messages ?View Code RUBY1 2 3 4 5 6 7 8 9 10 11 12 13 # Methods added to this helper will be available to all templates in the application. module ApplicationHelper FLASH_TYPES = &#91;:error, :warning, :success, :message&#93; def display_flash&#40;type [...]]]></description>
			<content:encoded><![CDATA[<p>display_flash(:error) # to display a specific flash message<br />
display_flash # to display all flash messages</p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Zemified by Zemanta" href="http://reblog.zemanta.com/zemified/ffe347df-3e6c-4ef5-9aa0-d78b7728bc11/"></a></div>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p204code2'); return false;">View Code</a> RUBY</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2042"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code" id="p204code2"><pre class="ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;"># Methods added to this helper will be available to all templates in the application.</span>
<span style="color:#9966CC; font-weight:bold;">module</span> ApplicationHelper
  FLASH_TYPES = <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:error</span>, <span style="color:#ff3333; font-weight:bold;">:warning</span>, <span style="color:#ff3333; font-weight:bold;">:success</span>, <span style="color:#ff3333; font-weight:bold;">:message</span><span style="color:#006600; font-weight:bold;">&#93;</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> display_flash<span style="color:#006600; font-weight:bold;">&#40;</span>type = <span style="color:#0000FF; font-weight:bold;">nil</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    html = <span style="color:#996600;">&quot;&quot;</span>
    <span style="color:#9966CC; font-weight:bold;">if</span> type.<span style="color:#0000FF; font-weight:bold;">nil</span>?
      FLASH_TYPES.<span style="color:#9900CC;">each</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>name<span style="color:#006600; font-weight:bold;">|</span> html <span style="color:#006600; font-weight:bold;">&amp;</span>lt;<span style="color:#006600; font-weight:bold;">&amp;</span>lt; display_flash<span style="color:#006600; font-weight:bold;">&#40;</span>name<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
    <span style="color:#9966CC; font-weight:bold;">else</span>
      <span style="color:#0000FF; font-weight:bold;">return</span> flash<span style="color:#006600; font-weight:bold;">&#91;</span>type<span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">blank</span>? ? <span style="color:#996600;">&quot;&quot;</span> : <span style="color:#996600;">&quot;#{flash[type]}&quot;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
    html
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.amityadav.name%2Frails-flash-messages-helper%2F&amp;title=Rails%20flash%20messages%20helper" id="wpa2a_6"><img src="http://www.amityadav.name/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.amityadav.name/rails-flash-messages-helper/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

