<?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>Developer Snippets &#187; Programming Tips</title> <atom:link href="http://www.developersnippets.com/tag/programming-tips/feed/" rel="self" type="application/rss+xml" /><link>http://www.developersnippets.com</link> <description>An Embodiment for Developers</description> <lastBuildDate>Wed, 23 Nov 2011 20:40:31 +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>Comparing two Arrays and remove duplicates from Original Array using JavaScript concat and slice</title><link>http://www.developersnippets.com/2009/05/29/comparing-two-arrays-and-removing-duplicates-from-original-array-using-javascript-concat-and-slice/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=comparing-two-arrays-and-removing-duplicates-from-original-array-using-javascript-concat-and-slice</link> <comments>http://www.developersnippets.com/2009/05/29/comparing-two-arrays-and-removing-duplicates-from-original-array-using-javascript-concat-and-slice/#comments</comments> <pubDate>Fri, 29 May 2009 22:26:07 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[JavaScript]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[Programming Tips]]></category><guid isPermaLink="false">http://www.developersnippets.com/?p=1014</guid> <description><![CDATA[Introduction: I would like to say this article going to help most of the developers who are in need to remove duplicates which are present in Original array by comparing with the other array elements. If you could not understand what I am saying, look at the below example you will get an idea on [...]]]></description> <content:encoded><![CDATA[<h2>Introduction:</h2><p>I would like to say this article going to help most of the developers who are in need to remove duplicates which are present in Original array by comparing with the other array elements. If you could not understand what I am saying, look at the below example you will get an idea on how we can play with JavaScript built-in functions.</p><p><span id="more-1014"></span></p><h2>Actual Task:</h2><p>My actual task is, I have two arrays one naming <strong>Array1</strong> and other naming <strong>Array2</strong>. In <strong>Array1</strong> I have elements like &#8220;a&#8221;,&#8221;b&#8221;,&#8221;c&#8221;,&#8221;d&#8221;,&#8221;e&#8221;,&#8221;f&#8221; and in <strong>Array2</strong> I have elements like &#8220;c&#8221;,&#8221;e&#8221; only. Now, I want to remove elements &#8220;c&#8221; and &#8220;e&#8221; from Array1 (by comparing Array2), hope you have understood now whats going to be the output yeah! the output should be <strong>Output: &#8220;a&#8221;,&#8221;b&#8221;,&#8221;d&#8221;,&#8221;f&#8221;</strong>. This can be achieved using <strong>concat</strong> and <strong>slice</strong> functions. Want, to know how we can achieve this, see below for respective code snippets:</p><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script language<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;javascript&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #003366; font-weight: bold;">var</span> Array1 <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Array<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;a&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;b&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;c&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;d&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;e&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;f&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> Array2 <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Array<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;c&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;e&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i<span style="color: #339933;">&lt;</span>Array2.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> arrlen <span style="color: #339933;">=</span> Array1.<span style="color: #660066;">length</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> j <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> j<span style="color: #339933;">&lt;</span>arrlen<span style="color: #339933;">;</span> j<span style="color: #339933;">++</span><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>Array2<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> Array1<span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			Array1 <span style="color: #339933;">=</span> Array1.<span style="color: #660066;">slice</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> j<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">concat</span><span style="color: #009900;">&#40;</span>Array1.<span style="color: #660066;">slice</span><span style="color: #009900;">&#40;</span>j<span style="color: #339933;">+</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> arrlen<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: #006600; font-style: italic;">//if close</span>
	<span style="color: #009900;">&#125;</span><span style="color: #006600; font-style: italic;">//for close</span>
<span style="color: #009900;">&#125;</span><span style="color: #006600; font-style: italic;">//for close</span>
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>Array1<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></td></tr></table></div><p>Hope this might help some of the developers who are looking for the same logic. Please, let me know if you have any suggestions in making it more compatible enough by reducing lines of code.</p><div class="shr-publisher-1014"></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.developersnippets.com%2F2009%2F05%2F29%2Fcomparing-two-arrays-and-removing-duplicates-from-original-array-using-javascript-concat-and-slice%2F' data-shr_title='Comparing+two+Arrays+and+remove+duplicates+from+Original+Array+using+JavaScript+concat+and+slice'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.developersnippets.com%2F2009%2F05%2F29%2Fcomparing-two-arrays-and-removing-duplicates-from-original-array-using-javascript-concat-and-slice%2F' data-shr_title='Comparing+two+Arrays+and+remove+duplicates+from+Original+Array+using+JavaScript+concat+and+slice'></a><a class='shareaholic-tweetbutton' data-shr_count='horizontal' data-shr_href='http%3A%2F%2Fwww.developersnippets.com%2F2009%2F05%2F29%2Fcomparing-two-arrays-and-removing-duplicates-from-original-array-using-javascript-concat-and-slice%2F' data-shr_title='Comparing+two+Arrays+and+remove+duplicates+from+Original+Array+using+JavaScript+concat+and+slice'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div>]]></content:encoded> <wfw:commentRss>http://www.developersnippets.com/2009/05/29/comparing-two-arrays-and-removing-duplicates-from-original-array-using-javascript-concat-and-slice/feed/</wfw:commentRss> <slash:comments>7</slash:comments> </item> <item><title>Code Snippet of handling files in Ruby Programming Language</title><link>http://www.developersnippets.com/2008/11/01/code-snippet-of-handling-files-in-ruby-programming-language/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=code-snippet-of-handling-files-in-ruby-programming-language</link> <comments>http://www.developersnippets.com/2008/11/01/code-snippet-of-handling-files-in-ruby-programming-language/#comments</comments> <pubDate>Sat, 01 Nov 2008 17:20:38 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[Programming]]></category> <category><![CDATA[Ruby]]></category> <category><![CDATA[Programming Tips]]></category><guid isPermaLink="false">http://developersnippets.com/?p=418</guid> <description><![CDATA[In the following article we can have a look at the ways of creating new files in Ruby programming language. Also you can learn how to open and read already existing files. Finally you will learn how to rename, delete and also get information on an existing file. Creating a New File in Ruby Language [...]]]></description> <content:encoded><![CDATA[<p>In the following article we can have a look at the ways of creating new files in <a href="http://www.ruby-lang.org/en/" title="Ruby programming language">Ruby programming language</a>. Also you can learn how to <strong>open</strong> and <strong>read</strong> already existing files. Finally you will learn how to <strong>rename</strong>, <strong>delete</strong> and <strong>also get information on an existing file</strong>.<span id="more-418"></span></p><p><strong>Creating a New File in Ruby Language</strong><br /> You can create new files in Ruby using the &#8220;new&#8221; method that belongs to &#8220;file&#8221;class. The &#8220;new&#8221; method can handle two arguments, the first argument is the file name of the new file that you want to create. The second argument indicates how you want to open the file, like whether you want to access it only for reading or just writing or both and so on.</p><p><strong>Following are some of the file modes used in Ruby:</strong><br /> <strong>r </strong>-  Read only access.<br /> <strong>r+</strong> &#8211;  Read and write access.<br /> <strong>w</strong> &#8211;  Write only access.<br /> <strong>w+</strong> &#8211;  Read and write access<br /> <strong>a</strong> &#8211;  Write only access<br /> <strong>a+</strong> &#8211;  Read and write access<br /> <strong>b</strong> &#8211;  Binary file mode</p><p><strong>Example: to create a new file in &#8220;write&#8221; mode:</strong></p><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;temp.txt&quot;</span>, <span style="color:#996600;">&quot;w&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></td></tr></table></div><p><strong>To Open Existing Files in Ruby</strong><br /> Existing files can be opened using “open” method belonging to the class &#8220;File&#8221;.</p><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">file = <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#CC0066; font-weight:bold;">open</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;temp.txt&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></td></tr></table></div><p>You can open files already created in any of the modes mentioned above.<br /> <strong>Example: to open a file in read-only mode:</strong></p><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">file = <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#CC0066; font-weight:bold;">open</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;temp.txt&quot;</span>, <span style="color:#996600;">&quot;r&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></td></tr></table></div><p><strong>You can also check whether a file is already open or not using the method &#8220;closed?&#8221;.</strong></p><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">file.<span style="color:#9900CC;">closed</span>?</pre></td></tr></table></div><p><strong>Output:</strong> Returns True or False, if the file is already open then it returns &#8220;True&#8221; else &#8220;False&#8221;.<br /> <strong>To close a file, you can use &#8220;close&#8221; method belonging to class &#8220;file&#8221;.</strong></p><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">file = <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#CC0066; font-weight:bold;">open</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;temp.txt&quot;</span>, <span style="color:#996600;">&quot;r&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
file.<span style="color:#9900CC;">close</span></pre></td></tr></table></div><p><strong>How to rename and delete files in Ruby programming language?</strong><br /> To rename or delete files you can use &#8220;rename&#8221; and &#8220;delete&#8221; methods respectively.<br /> <strong>Example: Creating new file</strong></p><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;tempfile.txt&quot;</span>, <span style="color:#996600;">&quot;w&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></td></tr></table></div><p><strong>Example: Renaming an existing file</strong></p><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">rename</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;tempfile.txt&quot;</span>, <span style="color:#996600;">&quot;newfile.txt&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></td></tr></table></div><p><strong>Example: Deleting an existing file:</strong></p><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">delete</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;newfile.txt&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></td></tr></table></div><p><strong>How to get information on Files?</strong><br /> To do more than just creating and opening files you need to use other methods in class &#8220;file&#8221;.<br /> <strong>You can find whether a file exits using &#8220;exists?&#8221; method:</strong></p><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">exists</span>?<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;temp.txt&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></td></tr></table></div><p><strong>You can check whether a file is really a file or is it some directory, using &#8220;file?&#8221; method:</strong></p><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">file</span>?<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;ruby&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></td></tr></table></div><p><strong>To check whether it is a directory, use the &#8220;directory?&#8221; method:</strong></p><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">directory</span>?<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;ruby&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></td></tr></table></div><p><strong>To check whether a file is readable, use &#8220;readable?&#8221; method:</strong></p><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">readable</span>?<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;temp.txt&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></td></tr></table></div><p><strong>To check whether a file is writable, use &#8220;writable ?&#8221; method:</strong></p><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">writable</span>?<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;temp.txt&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></td></tr></table></div><p><strong>To check whether a file is executable, use &#8220;executable?&#8221; method:</strong></p><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">executable</span>?<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;temp.txt&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></td></tr></table></div><p><strong>You can get the file size using the &#8220;size&#8221; method:</strong></p><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">size</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;temp.txt&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></td></tr></table></div><p><strong>To check whether file is empty, use &#8220;zero?&#8221; method:</strong></p><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">zero</span>?<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;temp.txt&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></td></tr></table></div><p><strong>Find out the file type using &#8220;ftype&#8221; method:</strong></p><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">ftype</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;readme.txt&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></td></tr></table></div><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">ftype</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;../ruby&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></td></tr></table></div><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">ftype</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;/dev/sda5&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></td></tr></table></div><p>The above are only basics of handling files in <a href="http://www.ruby-lang.org/en/" title="Ruby programming language">Ruby programming language</a>. There is more in programing than just handling files. You need a lot of interest and hard work to master these. So, all the best to your journey into Ruby programming!</p><p><strong>Articles which you would like to read:</strong><br /> 1. <a href="http://developersnippets.com/2008/10/30/remove-duplicates-from-array-using-javascript/" title="Remove duplicates from an array using JavaScript">Remove duplicates from an array using JavaScript</a><br /> 2. <a href="http://developersnippets.com/2008/10/29/check-out-the-number-of-occurrences-using-javascript/" title="Check out the number of Occurrences using JavaScript">Check out the number of Occurrences using JavaScript</a><br /> 3. <a href="http://developersnippets.com/2008/10/27/adding-a-div-button-to-the-body-tag-dynamically-using-javascript-dom/" title="Adding a div, button to the body tag dynamically using JavaScript DOM">Adding a div, button to the body tag dynamically using JavaScript DOM</a><br /> 4. <a href="http://developersnippets.com/2008/10/19/open-e-mail-message-window-onclick-of-a-button-using-javascript/" title="Open e-mail message window onclick of a button using JavaScript">Open e-mail message window onclick of a button using JavaScript</a><br /> 5. <a href="http://developersnippets.com/2008/10/19/free-javascript-database-for-your-browser-taffy-db/" title="Free JavaScript database for your browser, Taffy DB">Free JavaScript database for your browser, Taffy DB</a><br /> 6. <a href="http://developersnippets.com/2008/09/21/javascript-visitors-browser-detection-code-snippet/" title="JavaScript Visitors Browser Detection Code Snippet">JavaScript Visitors Browser Detection Code Snippet</a><br /> 7. <a href="http://developersnippets.com/2008/09/13/netscape-is-the-navigatorappname-for-google-chrome/" title="Netscape is the 'navigator.appName' for Google Chrome">Netscape is the &#8216;navigator.appName&#8217; for Google Chrome</a><br /> 8. <a href="http://developersnippets.com/2008/09/01/error-invalid-source-html-for-this-operation/" title="Error: Invalid source HTML for this operation">Error: Invalid source HTML for this operation</a><br /> 9. <a href="http://developersnippets.com/2008/08/31/system-error-1072896658-in-ie/" title="System Error: -1072896658 in IE">System Error: -1072896658 in IE</a><br /> 10. <a href="http://developersnippets.com/2008/08/16/simple-steps-to-develop-ajax-website-%e2%80%93-developersnippets/" title="Simple steps to develop AJAX Website – DeveloperSnippets">Simple steps to develop AJAX Website – DeveloperSnippets</a></p><div class="shr-publisher-418"></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.developersnippets.com%2F2008%2F11%2F01%2Fcode-snippet-of-handling-files-in-ruby-programming-language%2F' data-shr_title='Code+Snippet+of+handling+files+in+Ruby+Programming+Language'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.developersnippets.com%2F2008%2F11%2F01%2Fcode-snippet-of-handling-files-in-ruby-programming-language%2F' data-shr_title='Code+Snippet+of+handling+files+in+Ruby+Programming+Language'></a><a class='shareaholic-tweetbutton' data-shr_count='horizontal' data-shr_href='http%3A%2F%2Fwww.developersnippets.com%2F2008%2F11%2F01%2Fcode-snippet-of-handling-files-in-ruby-programming-language%2F' data-shr_title='Code+Snippet+of+handling+files+in+Ruby+Programming+Language'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div>]]></content:encoded> <wfw:commentRss>http://www.developersnippets.com/2008/11/01/code-snippet-of-handling-files-in-ruby-programming-language/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>3 Steps to become a Good Programmer</title><link>http://www.developersnippets.com/2007/07/03/3-steps-to-become-a-good-programmer/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=3-steps-to-become-a-good-programmer</link> <comments>http://www.developersnippets.com/2007/07/03/3-steps-to-become-a-good-programmer/#comments</comments> <pubDate>Tue, 03 Jul 2007 19:03:14 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[Programming]]></category> <category><![CDATA[Programming Tips]]></category><guid isPermaLink="false">http://www.developersnippets.com/2007/07/03/3-steps-to-become-a-good-programmer/</guid> <description><![CDATA[Hmmm&#8230;. Developers this is for you guys, this is a nice presentation on becoming a Good Programmer&#8230;&#8230; 1. Learn programming languages in an efficient Way. 2. Programmer should be able to Debug the code efficiently 3. Should always try to Keep updating yourself. (Self Motivated) 1. Learn programming languages in an efficient Way: There is [...]]]></description> <content:encoded><![CDATA[<p>Hmmm&#8230;. Developers this is for you guys, this is a nice presentation on becoming a Good Programmer&#8230;&#8230;<br /> <strong>1. Learn programming languages in an efficient Way.</strong><br /> <strong>2. Programmer should be able to Debug the code efficiently</strong><br /> <strong>3. Should always try to Keep updating yourself.  (Self Motivated) </strong><br /> <span id="more-79"></span><br /> <strong>1. Learn programming languages in an efficient Way:</strong></p><p>There is a professional way of  learning any programming language. Every programming language has some common elements to learn. If we can learn the common things in a sequential manner then we can learn any other language with out others help.</p><p>Below are the common Elements of any programming language.</p><ul style="margin-top: 0in" type="square"><li class="MsoNormal">History      of the Language<span> </span></li><li class="MsoNormal">Introduction<ul style="margin-top: 0in" type="square"><li class="MsoNormal">Purpose</li><li class="MsoNormal">Features</li><li class="MsoNormal">Advantages</li><li class="MsoNormal">Limitations</li></ul></li></ul><ul style="margin-top: 0in" type="square"><li class="MsoNormal">Variables,      Keywords</li><li class="MsoNormal">Input      / Output statements</li><li class="MsoNormal">Syntax      to use, Basic programs</li><li class="MsoNormal">Conditional      Statements like if-else, while, for etc.</li><li class="MsoNormal">Arrays      to store Data</li><li class="MsoNormal">Functions      ( pre-defined &amp; User defined)</li><li class="MsoNormal">Any      File operations ( Input / Output)</li></ul><ul style="margin-top: 0in" type="square"><li class="MsoNormal">If it      is an Object-Oriented language then you need to include some common      concepts like Class, Object, Inheritance, Polymorphism, Abstraction etc.</li></ul><p class="MsoNormal">In this way you can learn any programming language easier.</p><p class="MsoNormal">Compare these with any language. It suits for almost all languages.</p><p class="MsoNormal">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p><p class="MsoNormal"><strong>2. Programmer should be able to Debug the code efficiently</strong></p><ul style="margin-top: 0in" type="square"><li class="MsoNormal">The      Most fun part in programming is Debugging.</li><li class="MsoNormal">Debugging      is fun, because it begins with a mystery. You think it should do      something, but instead it does something else. It is not always quite so      simple&#8212;Debugging requires creativity and ingenuity.</li><li class="MsoNormal">If      there is a single key to debugging is to use the <em>Divide and Conquer </em> technique      on the mystery.</li><li class="MsoNormal">Suppose,      for example, you created a program that should do ten things in a      sequence. When you run it, it crashes. Since you didn&#8217;t program it to      crash, you now have a mystery. When you look at the output, you see that      the first seven things in the sequence were run successfully. The last      three are not visible from the output, so now your mystery is smaller: â€˜It      crashed on thing #8, #9, or #10.â€™</li></ul><ul style="margin-top: 0in" type="square"><li class="MsoNormal">Through      sufficient hands-on experience on programming will automatically increases      the debugging capabilities. Important steps to follow for better      programming.</li></ul><p class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in"><span>1)</span> <span> </span> <span>Clear Documentation is must</span></p><p class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in"><span>2)</span> <span> </span> <span dir="ltr">Follow Software Engineering principles for the Programming</span></p><p class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in"><span>3)</span> <span> </span> <span dir="ltr">Should have some knowledge on testing the programs with required methods such as Black Box testing, White Box testing, Unit Testing, Integrated Testing, Performance testing etc.</span></p><p class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in"><span>4)</span> <span> </span> <span dir="ltr">Use own experiences to debug the code such as checking code with alert messages, divide and conquer method etc</span></p><p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p><p class="MsoNormal"><strong>3. Should always try to Keep updating yourself. (Self Motivated)</strong></p><p class="MsoNormal">Software      Strategy is to Live Today, we should be learning tomorrowâ€™s Advanced      Technologies, otherwise we will be lost some where.</p><p class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in"><ul style="margin-top: 0in" type="square"><li class="MsoNormal">So      keeping that in our mind, we should keep us updating with new technologies      and softwares by all means. Like</li><li class="MsoNormal">1)      Checking the upgrades, new versions.</li><li class="MsoNormal">2)      Latest Technology trends</li><li class="MsoNormal">3)      Customer Focus</li><li class="MsoNormal">4)      Browsing Technology sites, blogs, participating in discussions etc.</li><li class="MsoNormal">Follow      the above specified flow to learn any programming language</li><li class="MsoNormal">Follow      Good Programming techniques, Best Practices like Documentation, Good Logic      etc.</li><li class="MsoNormal">Learn      how to debug the program, Implement traditional techniques like Divide and      Conquer and other testing techniques.</li><li class="MsoNormal">Keep      yourself update with Latest Technology Trends.</li></ul><p>Developers!! Please let me know your thoughts on this&#8230;&#8230; I will be waiting for your valuable comments on this&#8230;&#8230; Do you guys agree with this&#8230;&#8230;</p><div class="shr-publisher-79"></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.developersnippets.com%2F2007%2F07%2F03%2F3-steps-to-become-a-good-programmer%2F' data-shr_title='3+Steps+to+become+a+Good+Programmer'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.developersnippets.com%2F2007%2F07%2F03%2F3-steps-to-become-a-good-programmer%2F' data-shr_title='3+Steps+to+become+a+Good+Programmer'></a><a class='shareaholic-tweetbutton' data-shr_count='horizontal' data-shr_href='http%3A%2F%2Fwww.developersnippets.com%2F2007%2F07%2F03%2F3-steps-to-become-a-good-programmer%2F' data-shr_title='3+Steps+to+become+a+Good+Programmer'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div>]]></content:encoded> <wfw:commentRss>http://www.developersnippets.com/2007/07/03/3-steps-to-become-a-good-programmer/feed/</wfw:commentRss> <slash:comments>11</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 2/74 queries in 1.530 seconds using disk: basic
Object Caching 1377/1504 objects using disk: basic

Served from: www.developersnippets.com @ 2012-02-04 01:58:43 -->
