<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Arun Prakash on Medium]]></title>
        <description><![CDATA[Stories by Arun Prakash on Medium]]></description>
        <link>https://medium.com/@reach2arunprakash?source=rss-eb2dcb73c8b8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Arun Prakash on Medium</title>
            <link>https://medium.com/@reach2arunprakash?source=rss-eb2dcb73c8b8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 17:18:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@reach2arunprakash/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[GUVI Codekata Javascript]]></title>
            <link>https://medium.com/@reach2arunprakash/guvi-codekata-javascript-8d0e88d35630?source=rss-eb2dcb73c8b8------2</link>
            <guid isPermaLink="false">https://medium.com/p/8d0e88d35630</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[guvi]]></category>
            <category><![CDATA[code-kata]]></category>
            <dc:creator><![CDATA[Arun Prakash]]></dc:creator>
            <pubDate>Sat, 16 May 2020 06:28:58 GMT</pubDate>
            <atom:updated>2020-05-28T05:55:15.125Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://www.guvi.in/code-kata">GUVI | Learn to code in your native language</a></p><p>What’s Codekata?</p><p>Codekata a series of programs curated by experts from the industry. Practising on Codekata will take your coding skills to next level. We will recommend your profile to recruiting companies based on your performance in Codekata. You can be a better programmer and crack interviews by completing Codekata.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*CZA71Rv1c7fVKaft.jpg" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FzWRRVsz5P7s%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DzWRRVsz5P7s&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FzWRRVsz5P7s%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/f896f20fbd5e8e6501c3ed2fecd54ff4/href">https://medium.com/media/f896f20fbd5e8e6501c3ed2fecd54ff4/href</a></iframe><p>Description of the same video below.</p><p>If you are a first timer the below javascript code has 2 parts</p><ol><li>to be ignored as a beginner</li><li>to be solved as a beginner</li></ol><p><strong>Part to be Ignored(till you understand Nodejs):</strong></p><p>Can I skip as a newbie?</p><p><strong>yes</strong></p><p>Line numbers 1 to 9 and 15. Why I need to ignore and what do these lines do ???</p><p>Read below</p><p>These lines can be ignored</p><ol><li><strong>Line 1 :</strong> Import a module called readline</li><li><strong>Line 2 — 4: </strong>Creates and ref for readline</li><li><strong>Line 5:</strong>Declares a variable with name userInput ( which is an array). This array is the key for you.</li><li><strong>Line 6 &amp; 7: </strong>Opens the input stream and reads the data and pushes it to UserInput array.</li><li><strong>Line 9 &amp; 15:</strong>Closes the input stream as the input is over</li></ol><p><strong>Part to be solved:</strong></p><ol><li><strong>Line 10 : </strong>Gets the first line and splits based on space. The result is stored in variable called data which is an array E.g: if the input is 1 2 the data array will be [‘1’,’2&#39;].</li><li><strong>Line 11&amp; 12: </strong>Get the value from the data array and stored in a &amp; b. The split data will be string so we use parseInt to convert that to integer. If you want just string then don’t need to use parseInt. Now a will have 1 and b will have 2</li><li><strong>Line 13:</strong>This is the place where you need to write your logic for the problem you choose in <strong>codekata</strong>.</li><li><strong>Line 14:</strong>This is the sample to print you result. This can be part of your logic or separate.</li></ol><pre>1 const readline = require(&#39;readline&#39;);<br>2 const inp = readline.createInterface({<br>3  input: process.stdin<br>4 });<br>5 const userInput = [];<br>6 inp.on(&quot;line&quot;, (data) =&gt; {<br>7 userInput.push(data);<br>8 });<br>9 inp.on(&quot;close&quot;, () =&gt; {</pre><pre>10 var data = userInput[0].split(&quot; &quot;);<br>11 var a = parseInt(data[0]);<br>12 var b = parseInt(data[1]);<br>13 <br>14  console.log(a+b);<br>15 });</pre><h3><strong>Reading Single line input in JS ( Nodejs)</strong></h3><p>Eg Add 2 number and print</p><p>Input:</p><p>1 2</p><p>Output:</p><p>3</p><pre>const readline = require(&#39;readline&#39;);<br>const inp = readline.createInterface({<br>  input: process.stdin<br>});<br>const userInput = [];<br>inp.on(&quot;line&quot;, (data) =&gt; {<br> userInput.push(data);<br>});<br>inp.on(&quot;close&quot;, () =&gt; {<br>var data = userInput[0].split(&quot; &quot;);<br>var a = parseInt(data[0]);<br>var b = parseInt(data[1]);<br> <br> console.log(a+b);<br>});</pre><p><strong>Eg 3:</strong></p><p>You are provided with two numbers. Find and print the smaller number.</p><p><strong>Sample Input :</strong><br>23 1</p><p><strong>Sample Output :</strong><br>1</p><pre>const readline = require(&#39;readline&#39;);<br>const inp = readline.createInterface({<br>  input: process.stdin<br>});<br>const userInput = [];<br>inp.on(&quot;line&quot;, (data) =&gt; {<br> userInput.push(data);<br>});<br>inp.on(&quot;close&quot;, () =&gt; {<br>var data = userInput[0].split(&quot; &quot;);</pre><pre>var a = parseInt(data[0]);<br> var b = parseInt(data[1]);<br> <br> if(a&gt;b)<br> {<br> console.log(b);<br> }else<br> {<br> console.log(a);<br> } <br>});</pre><h3>Reading Multi-line input in JS ( Nodejs)</h3><p>You are provided with two numbers. Find and print the smaller number.</p><p><strong>Sample Input :</strong><br>23<br>1</p><p><strong>Sample Output :</strong><br>1</p><pre>const readline = require(&#39;readline&#39;);<br>const inp = readline.createInterface({<br>  input: process.stdin<br>});</pre><pre>const userInput = [];</pre><pre>inp.on(&quot;line&quot;, (data) =&gt; {<br> userInput.push(data);<br>});<br>inp.on(&quot;close&quot;, () =&gt; {</pre><pre>var a = parseInt(userInput[0]);<br> var b = parseInt(userInput[1]);<br> <br> if(a&gt;b)<br> {<br> console.log(b);<br> }else<br> {<br> console.log(a);<br> }</pre><pre>});</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8d0e88d35630" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[www.guvi.io/zen]]></title>
            <link>https://medium.com/@reach2arunprakash/www-guvi-io-zen-d395deec1373?source=rss-eb2dcb73c8b8------2</link>
            <guid isPermaLink="false">https://medium.com/p/d395deec1373</guid>
            <category><![CDATA[guvi]]></category>
            <category><![CDATA[basics]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[zen]]></category>
            <category><![CDATA[json]]></category>
            <dc:creator><![CDATA[Arun Prakash]]></dc:creator>
            <pubDate>Thu, 07 May 2020 02:41:14 GMT</pubDate>
            <atom:updated>2020-07-01T17:08:14.683Z</atom:updated>
            <content:encoded><![CDATA[<p>Preread: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Loops_and_iteration">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Loops_and_iteration</a></p><h3>GUVI: Zen Class — Variables Arrays &amp; Objects</h3><pre>&lt;!DOCTYPE html&gt;<br>  &lt;html&gt;<br>    &lt;head&gt;<br>      &lt;title&gt;JavaScript Beginners&lt;/title&gt;<br>      &lt;script src=&quot;script.js&quot;&gt;&lt;/script&gt;<br>    &lt;/head&gt;<br>    &lt;body&gt;<br>    &lt;/body&gt;<br>    &lt;/html</pre><p>script.js</p><pre>console.log(&quot;hello world&quot;)</pre><h3><strong>Task 1: Simple Programs todo for variables</strong></h3><ol><li>Declare four variables without assigning values and print them in console</li><li>How to get value of the variable myvar as output</li></ol><pre>var myvar= 1;<br>console.log(&quot;myvar&quot;);</pre><p>3. Declare variables to store your first name, last name, marital status, country and age in multiple lines</p><p>4. Declare variables to store your first name, last name, marital status, country and age in a single line</p><p>5. Declare variables and assign string, boolean, undefined and null data types</p><pre>I am 25 years old. </pre><pre>You are 30 years old.</pre><p>6. Convert the string to integer</p><ul><li>parseInt()</li><li>Number()</li><li>Plus sign(+)</li></ul><p>7. Write 6 statement which provide truthy &amp; falsey values.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — -</p><h3>Task 2: Simple Programs todo for Operators</h3><ol><li>Square of a number</li><li>Swapping 2 numbers</li><li>Addition of 3 numbers</li><li>Celsius to Fahrenheit conversion</li><li>Meter to miles</li><li>Pounds to kg</li><li>Calculate Batting Average</li><li>Calculate five test scores and print their average</li><li>Power of any number x ^ y.</li><li>Calculate Simple Interest</li><li>Calculate area of an equilateral triangle</li><li>Area Of Isosceles Triangle</li><li>Volume Of Sphere</li><li>Volume Of Prism</li><li>Find area of a triangle.</li><li>Give the Actual cost and Sold cost, Calculate Discount Of Product</li><li>Given their radius of a circle and find its diameter, circumference and area.</li><li>Given two numbers and perform all arithmetic operations.</li><li>Display the asterisk pattern as shown below(No loop needed): <br> *****<br> *****<br> *****<br> *****<br> *****</li><li>Calculate electricity bill?<br>For example, a consumer consumes 100 watts per hour daily for one month. Calculate the total energy bill of that consumer if per unit rate is 10?</li><li>Program To Calculate CGPA</li></ol><h3>Task 3: Simple Programs todo for Condition , Looping and Arrays</h3><ol><li>Write a loop that makes seven calls to console.log to output the following triangle:</li></ol><pre>#<br>##<br>###<br>####<br>#####<br>######<br>#######</pre><p>2. Iterate through the string array and print it contents</p><pre>      var strArray= [&quot;&lt;option&gt;Jazz&lt;/option&gt;&quot;,<br>      ,&quot;&lt;option&gt;Blues&lt;/option&gt;&quot;,<br>      ,&quot;&lt;option&gt;New Age&lt;/option&gt;&quot;,<br>      ,&quot;&lt;option&gt;Classical&lt;/option&gt;&quot;,<br>      ,&quot;&lt;option&gt;Opera&lt;/option&gt;&quot;]</pre><p><strong>Arrays</strong>:</p><p>var myarray=[11,22,33,44,55]</p><p>write a code to count the elements in the array . Don’t use length property</p><p>Declare an empty array;<br> — — — — — — — — — — — — — — -<br>Create an array called foods holds the names of your top 20 favorite foods, starting with the best food.</p><p>let foods=[]</p><p>— — — — — — — — — — — — — — — -<br>Foods variable holds the names of your top 20 favorite foods, starting with the best food. How can you find your fifth favorite food?</p><p>let foods=[]</p><p>Find the length of your foods array<br> — — — — — — — — — — — — — — — -<br>Starting from the existing friends variable below, change the element that is currently “Mari” to “Munnabai”.</p><p>let friends = [<br> “Mari”,<br> “MaryJane”,<br> “CaptianAmerica”,<br> “Munnabai”,<br> “Jeff”,<br> “AAK chandran”<br>];</p><p>function dataHandling(input){<br>for (var i = 0; i &lt; input.length; i++) {<br> <br> }<br>}</p><p>dataHandling(friends);</p><p>— — — — — — — — — — — — — — — -<br>Starting from the friends variable below, Loop and Print the names till you meet CaptianAmerica.</p><p>const friends = [<br> “Mari”,<br> “MaryJane”,<br> “CaptianAmerica”,<br> “Munnabai”,<br> “Jeff”,<br> “AAK chandran”<br>];</p><p>function dataHandling(input){<br>for (var i = 0; i &lt; input.length; i++) {<br> <br> }<br>}</p><p>dataHandling(friends);</p><p>— — — — — — — — — — — — — — — -<br>Find the person is ur friend or not.</p><p>const friends = [<br> “Mari”,<br> “MaryJane”,<br> “CaptianAmerica”,<br> “Munnabai”,<br> “Jeff”,<br> “AAK chandran”<br>];</p><p>function dataHandling(input, name){<br>for (var i = 0; i &lt; input.length; i++) {<br> <br> }<br>}</p><p>let found = dataHandling(friends,”Jeff”);</p><p>console.log(found);</p><p>— — — — — — — — — — — — — — — -<br>We have two lists of friends below. Use array methods to combine them into one alphabetically-sorted list.</p><p>var friends1 = [<br> “Mari”,<br> “MaryJane”,<br> “CaptianAmerica”,<br> “Munnabai”,<br> “Jeff”,<br> “AAK chandran”<br>];</p><p>var friends2 = [<br> “Gabbar”,<br> “Rajinikanth”,<br> “Mass”,<br> “Spiderman”,<br> “Jeff”,<br> “ET”<br>];</p><p>function dataHandling(input){<br>//Your code goes here<br>}</p><p>dataHandling(friends);</p><p>— — — — — — — — — — — — — — — -</p><ol><li>Get the first item, the middle item and the last item of the array</li></ol><p>2. Add your name to the end of the friends array, and add another name to beginning.</p><p>3. Add Mr or Ms to the names in the friends array.</p><p>4. Concat all the names the friends array and return as comma “,” seperated string.</p><p>5. Find the friends names who has letter ‘a’ and return the list.</p><p>6. Find the avg length of all the friends names. Get the individual length of the names and do the avg.</p><p>7. Find the names and return the list starting with letter M.</p><p>8. Find the name with max characters and return the name.</p><p>9. Find the name with min characters and return the name.</p><p>— — — — — — — — — — — — — — — -</p><p>Find the average in the array below. <br>Make sure you add only the numbers and do avg.</p><p>const friendsInfo = [6, 12, ‘Mari’, 1, true, ‘Munnabai’, ‘200’, ‘CaptianAmerica’, 8, 10];</p><p>— — — — — — — — — — — — — — — -<br>Print the contents of the input variable</p><p>var input = [<br> [“0001”, “Roman Alamsyah”, “Bandar Lampung”, “21/05/1989”, “Membaca”],<br> [“0002”, “Dika Sembiring”, “Medan”, “10/10/1992”, “Bermain Gitar”],<br> [“0003”, “Winona”, “Ambon”, “25/12/1965”, “Memasak”],<br> [“0004”, “Bintang Senjaya”, “Martapura”, “6/4/1970”, “Berkebun”]<br> ]</p><p>function dataHandling(input){<br>for (var i = 0; i &lt; input.length; i++) {<br> //Your code goes here</p><p>}<br>}</p><p>dataHandling(input);</p><p>— — — — — — — — — — — — — — — -</p><p><strong>Objects:</strong></p><p>What the output</p><pre>myobject = {1:one,”11&quot;:1,”name”:”arun”}</pre><pre>console.log(myobject.11); <br>console.log(myobject.name);</pre><p>Add a new key value pair to myobject<br>key : ten<br>value : ten</p><pre>myobject = {1:one,”11&quot;:1,”name”:”arun”}</pre><pre>//your code goes here</pre><pre>console.log(myobject);</pre><pre>{&quot;1&quot;:&quot;one&quot;,&quot;11&quot;:1,&quot;name&quot;:&quot;arun&quot;,&quot;ten&quot;:&quot;ten&quot;} // Quotes might not get displayed that fine.</pre><p>Write out an object literal to represent the data below.</p><p>Guvi, Geek, 6, IIT-M RP,Chennai.</p><p>— — — — — — — — — — — — — — — -</p><p>How would you represent the following data using a combination of object literals and arrays? (You can describe a strategy without typing or writing out the whole thing.)</p><p>Guvi, Geek, 6, IIT-M RP,Chennai.<br>Amazon, Inc, 31, SP Infocity, Chennai.<br>Google, Alphabet, 34 Amphitheater Parkway, MountainView.<br>Tesla, Inc , 32, 333 Santana Row,San Jose.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d395deec1373" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[www.guvi.io/zen]]></title>
            <link>https://medium.com/@reach2arunprakash/www-guvi-io-zen-4fa483a7d359?source=rss-eb2dcb73c8b8------2</link>
            <guid isPermaLink="false">https://medium.com/p/4fa483a7d359</guid>
            <category><![CDATA[looping]]></category>
            <category><![CDATA[basics]]></category>
            <category><![CDATA[zen]]></category>
            <category><![CDATA[guvi]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Arun Prakash]]></dc:creator>
            <pubDate>Tue, 05 May 2020 18:06:26 GMT</pubDate>
            <atom:updated>2020-05-29T03:29:26.911Z</atom:updated>
            <content:encoded><![CDATA[<h3>GUVI: Zen Class — Part 2 : Find the culprits and nail them — debugging javascript loops</h3><p>Write a code to print the numbers in the array</p><p><strong>Output</strong>: 1234567891011</p><pre>var numsArr = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];</pre><pre>var new_string = “”;<br> <br>for (var i = 1; i &lt; 11; i--) {<br> new_string += numsArr[i] <br>}</pre><pre>console.log(new_string);</pre><p>Write a code to print the numbers in the array</p><p><strong>Output</strong>: 1,2,3,4,5,6,7,8,9,10,11</p><pre>var numsArr = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];</pre><pre>var new_string = “”;<br> <br>for (var i = 1; i &lt; 11; i++) {<br> new_string += numsArr[i] + , <br>}</pre><pre>console.log(new_string);</pre><p>Write a code to print from last to first with spaces (Make sure there is no space after the last element 1)</p><p><strong>Output</strong>: 11 10 9 8 7 6 5 4 3 2 1</p><pre>var new_string = “”;<br> <br>for (var i = 11; i &gt; 0; i — ) {<br> new_string += numsArr[i] + “ “ <br>}<br>console.log(new_string);</pre><p>Write a code to replace the array value — If the number is even, replace it with ‘even’.</p><p><strong>Output</strong>:[ 1, “even”, 3, “even”, 5, “even”, 7, “even”, 9, “even”, … ]</p><pre>var numsArr = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];</pre><pre>for (var i = 0; i &lt;=10; i++) {<br> if(numsArr[i] %2 == 0 )<br> {<br> numsArr[i] = odd<br> }<br>}<br>console.log(numsArr);</pre><p>Write a code to replace the array value — If the index is even, replace it with ‘even’.</p><p><strong>Output</strong>: [ “even”, 2, “even”, 4, “even”, 6, “even”, 8, “even”, 10, … ]</p><pre>var numsArr = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];</pre><pre>for (var i = 0; i &lt;=10; i++) {<br> if(numsArr[i] %2 == 0 )<br> {<br> numsArr[i] = even<br> }<br>}<br>console.log(numsArr);</pre><p>Write a code to add all the numbers in the array</p><p>Output: 66</p><pre>var numsArr = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];</pre><pre>for (var i = 0; i &lt;=10; i++) {<br> var sum;<br> sum += numsArr[i]<br>}<br>console.log(sum);</pre><p>Write a code to add the even numbers only<br><strong>Output</strong>: 30</p><pre>var numsArr = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];<br>var sum=0;</pre><pre>for (var i = 0; i &lt;10; i++) {<br> if(numsArr[i]%2==0);<br> sum += numsArr[i]<br>}<br>console.log(sum);</pre><p>Write a code to add the even numbers and subract the odd numbers<br><strong>Output</strong>: 94</p><pre>var numsArr = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];<br>var sum=100;</pre><pre>for (var i = 0; i &lt;=10; i++) {<br> if(numsArr[i]%2!=0);<br> {<br> sum += numsArr[i]<br> }<br> else<br> {<br> sum -= numsArr[i]<br> }<br>}<br>console.log(sum);</pre><p>Write a code to print inner arrays<br><strong>Output</strong>:</p><p>Array(5) [ 1, 2, 3, 4, 5 ]<br>Array(6) [ 6, 7, 8, 9, 10, 11 ]</p><pre>var numsArr = [[1, 2, 3, 4, 5][ 6, 7, 8, 9, 10, 11]];<br>for (var i = 0; i &lt; numsArr.length; i++); {<br> console.log( numsArr[i])<br>}</pre><p>Write a code to print elements in the inner arrays<br><strong>Output</strong>: 1234567891011</p><pre>var numsArr = [[1, 2, 3, 4, 5],[ 6, 7, 8, 9, 10, 11]];<br>var str_all=0;</pre><pre>for (var i = 0; i &lt; numsArr.length; i++) {<br> var inner_array = numsArr[i];<br> for(var j = 0 ; j &lt; inner_array.length;i++ )<br>     str_all +=inner_array[j]<br>}<br>console.log(str_all);</pre><p>Write a code to replace the array value — If the index is even, replace it with ‘even’.</p><p><strong>Output</strong>: [ [“even”, 2, “even”, 4, “even”], [6, “even”, 8, “even”, 10, …] ]</p><pre>var numsArr = [[1, 2, 3, 4, 5],[ 6, 7, 8, 9, 10, 11]];<br>var str_all=0;</pre><pre>for (var i = 0; i &lt; numsArr.length; i++) {<br> var inner_array = numsArr[i];<br> for(var j = 0 ; j &lt; inner_array.length;i++ )<br>      if(numsArr[i] %2 == 0 )<br>      {<br>         numsArr[i] = even<br>       }<br>}<br>console.log(numsArr);</pre><p>Write a code to print elements in the inner arrays in reverse<br><strong>Output</strong>: 11 10 9 8 7 6 5 4 3 2 1</p><pre>var numsArr = [[1, 2, 3, 4, 5],[ 6, 7, 8, 9, 10, 11]];<br>var str_all=0;</pre><pre>for (var i = 0; i &lt; numsArr.length; i++) {<br> var inner_array = numsArr[i];<br> for(var j = inner_array.length; j &lt; 0 ;j-- )<br>     str_all +=inner_array[j]<br>}<br>console.log(str_all);</pre><p>Write a code to add elements in the inner arrays based on odd or even values<br><strong>Output</strong>: <br>36<br>30</p><pre>var numsArr = [[1, 2, 3, 4, 5],[ 6, 7, 8, 9, 10, 11]];<br>var sum_odd=0;<br>var sum_even=0;</pre><pre>for (var i = 0; i &lt; numsArr.length; i++) {<br> var inner_array = numsArr[i];<br> for(var j = 0 ; j &lt; inner_array.length;j++ ){<br> if(numsArr[i]%2!=0)<br> {<br> sum_odd += numsArr[i]<br> }<br> else<br> {<br> sum_even += numsArr[i]<br> }<br>}<br>}<br>console.log(sum_odd);<br>console.log(sum_even);</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4fa483a7d359" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GUVI: Zen Class — Find the culprits and nail them]]></title>
            <link>https://medium.com/@reach2arunprakash/guvi-zen-class-find-the-culprits-and-nail-them-9ee6c67c44fb?source=rss-eb2dcb73c8b8------2</link>
            <guid isPermaLink="false">https://medium.com/p/9ee6c67c44fb</guid>
            <category><![CDATA[basics]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[guvi]]></category>
            <category><![CDATA[debugging]]></category>
            <category><![CDATA[zen-class]]></category>
            <dc:creator><![CDATA[Arun Prakash]]></dc:creator>
            <pubDate>Tue, 05 May 2020 16:12:49 GMT</pubDate>
            <atom:updated>2020-05-29T03:32:42.128Z</atom:updated>
            <content:encoded><![CDATA[<h3><a href="http://www.guvi.io/zen">www.guvi.io/zen</a></h3><h3>GUVI: Zen Class — Part 1:<strong> Find the culprits and nail them — debugging javascript</strong></h3><p>Once you are familiar with basic syntax you can reinforce your understanding by solving these simple snippets</p><p><strong>Find the culprit</strong></p><p>fix.html</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;body&gt;<br> &lt;script&gt;<br> alert( “I’m JavaScript!’);<br> &lt;/script&gt;<br> Whats the error in this ?<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -</p><p><strong>Find the culprit and invoke the alert</strong></p><p>fix.html</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;body&gt;<br> &lt;script src=”script.js”&gt;&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>scripts.js</p><pre>alert(“I’m invoked!”);</pre><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -</p><p><strong>Explain the below how it works</strong></p><p>explain.html</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;body&gt;<br> &lt;script src=”script.js”&gt;&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>script.js</p><pre>alert(&quot;I&#39;m JavaScript!&quot;);<br>alert(&#39;Hello&#39;) // this line is not having semicolon<br>alert(`Wor<br> ld`)<br>alert(3 +<br>1<br>+ 2); // this is multiple line code and its working</pre><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -</p><p><strong>Fix the below to alert </strong>Guvi geek</p><p>fix.html</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;body&gt;<br> &lt;script src=”script.js”&gt;&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>script.js</p><pre>let admin=9, fname=10.5; <br>fname = &quot;Guvi&quot;;<br>lname = &quot;geek&quot;<br>admin = fname+lname;</pre><pre>alert( admin ); // &quot;Guvi geek&quot;</pre><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -</p><p><strong>Fix the below to alert </strong>hello Guvi geek</p><p>fix.html</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;body&gt;<br> &lt;script src=”script.js”&gt;&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>script.js</p><pre>let fname=10.5; <br>fname = &quot;Guvi&quot;;<br>lname = &quot;geek&quot;</pre><pre>let name = fname+lname;</pre><pre>alert( &#39;hello ${name}&#39; );</pre><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -</p><p><strong>Fix the below to alert sum of two numbers</strong></p><p>fix.html</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;body&gt;<br> &lt;script src=”script.js”&gt;&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>script.js</p><pre>let a = prompt(&quot;First number?&quot;);<br>let b = prompt(&quot;Second number?&quot;);<br>alert(a + b);</pre><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -</p><p><strong>Fix the below to alert sum of two numbers</strong></p><p>fix.html</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;body&gt;<br> &lt;script src=”script.js”&gt;&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>script.js</p><pre>let a = prompt(&quot;First number?&quot;);<br>let b = prompt(&quot;Second number?&quot;);<br>alert(a + b);</pre><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -</p><p><strong>If you run the below scritpt you will get “</strong>Code is Blasted<strong>”</strong></p><p><strong>Explain Why the Code is blasted and how to diffuse it and get “</strong>Diffused<strong>”.</strong></p><p>fix.html</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;body&gt;<br> &lt;script src=”script.js”&gt;&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>script.js</p><pre>var a = &quot;2&quot; &gt; &quot;12&quot;;</pre><pre>//Don&#39;t touch below this<br>if (a) {<br>  console.log(&quot;Code is Blasted&quot;)<br>}<br>else<br>{<br>  console.log(&quot;Diffused&quot;) <br>}</pre><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -</p><p><strong>How to get the success in console.</strong></p><p>fix.html</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;body&gt;<br> &lt;script src=”script.js”&gt;&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>script.js</p><pre>let a = prompt(&quot;Enter a number?&quot;);</pre><pre>//Don&#39;t modify any code below this</pre><pre>if (a) {<br> console.log( &#39;OMG it works for any number inc 0&#39; );<br>}<br>else<br>{<br> console.log( &quot;Success&quot; );<br>}</pre><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -</p><p><strong>How to get the correct score in console.</strong></p><p>fix.html</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;body&gt;<br> &lt;script src=”script.js”&gt;&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>script.js</p><pre>let value = prompt(&#39;How many runs you scored in this ball&#39;);<br>if (value === 4) {<br>      console.log(&quot;You hit a Four&quot;);<br>} else if (value === 6) {<br>      console.log(&quot;You hit a Six&quot;);<br>} else {<br>      console.log(&quot;I couldn&#39;t figure out&quot;);<br>}</pre><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -</p><p><strong>Fix the code to welcome the Employee</strong></p><p>fix.html</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;body&gt;<br> &lt;script src=”script.js”&gt;&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>script.js</p><pre>let login = &#39;Employee&#39;;<br>let message = (login == &#39;Employee&#39;) ? :<br>  (login == &#39;Director&#39;) ? &#39;Greetings&#39; :<br>  (login == &#39;&#39;) ? &#39;No login&#39; :<br>  &#39;&#39;;</pre><pre>console.log(message);</pre><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -</p><p><strong>Fix the code to welcome the boss</strong></p><p>fix.html</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;body&gt;<br> &lt;script src=”script.js”&gt;&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>script.js</p><pre>// You cant change the value of the msg<br>let message;</pre><pre>if (null || 2 || undefined )<br>{<br> let message = &quot;welcome boss&quot;;<br>}<br>else<br>{<br> let message = &quot;Go away&quot;;<br>}<br>  console.log(message);</pre><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -</p><p><strong>Fix the code to welcome the boss</strong></p><p>fix.html</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;body&gt;<br> &lt;script src=”script.js”&gt;&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>script.js</p><pre>let message;<br>let lock = 2;</pre><pre>//Dont change any code below this </pre><pre>if (null || lock || undefined )<br>{<br>  message = &quot;Go away&quot;;<br>}<br>else<br>{<br> message = &quot;welcome&quot;;<br>}<br>  console.log(message);</pre><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -</p><p><strong>Fix the code to welcome the boss</strong></p><p>fix.html</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;body&gt;<br> &lt;script src=”script.js”&gt;&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>script.js</p><pre>let message;<br>let lock = 2;</pre><pre>//Dont change any code below this</pre><pre>if (lock &amp;&amp; &quot; &quot; || undefined )<br>{<br>  message = &quot;Go away&quot;;<br>}<br>else<br>{<br> message = &quot;welcome&quot;;<br>}<br>console.log(message);</pre><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -</p><p><strong>Change the code to print</strong></p><p>3</p><p>2</p><p>1</p><p>fix.html</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;body&gt;<br> &lt;script src=”script.js”&gt;&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>script.js</p><pre>//You can change only 2 characters</pre><pre>let i = 3;</pre><pre>while (i) {<br>  console.log( --i );<br>}</pre><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -</p><p><strong>Change the code to print 1 to 10 in 4 lines</strong></p><p>fix.html</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;body&gt;<br> &lt;script src=”script.js”&gt;&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>script.js</p><pre>let num = 1<br>console.log(num)<br>num += 1<br>console.log(num)<br>num += 1<br>console.log(num)<br>num += 1<br>console.log(num)<br>num += 1<br>console.log(num)<br>num += 1<br>console.log(num)<br>num += 1<br>console.log(num)<br>num += 1<br>console.log(num)<br>num += 1<br>console.log(num)<br>num += 1<br>console.log(num)</pre><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -</p><p><strong>Change the code to print even numbers</strong></p><p>fix.html</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;body&gt;<br> &lt;script src=”script.js”&gt;&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>script.js</p><pre>//You are allowed to modify only one character </pre><pre>for (let num = 2; num &lt;= 20; num += 1) {<br>  console.log(num)<br>}</pre><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -</p><p><strong>Change the code to print all the gifts</strong></p><p>fix.html</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;body&gt;<br> &lt;script src=”script.js”&gt;&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>script.js</p><pre>let gifts = [&quot;teddy bear&quot;, &quot;drone&quot;, &quot;doll&quot;];</pre><pre>for (let i = 0; i &lt; 3; i++) {<br>  console.log(&#39;Wrapped ${&#39;gifts[i]&#39;} and added a bow!&#39;);<br>}</pre><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -</p><p><strong>Fix the code to disarm the bomb.</strong></p><p>fix.html</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;body&gt;<br> &lt;script src=”script.js”&gt;&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>script.js</p><pre>let countdown = 100;</pre><pre>while (countdown &gt; 0) {<br>  countdown--;<br>  if(countdown == 0)<br>  {<br>   console.log(&quot;bomb triggered&quot;);<br>  }<br>}</pre><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -</p><p>Whats the msg printed and why?</p><pre>var lemein = “0”;<br>var lemeout = 0;<br>var msg = “”;</pre><pre>if (lemein) {<br> msg += “hi”;<br> }</pre><pre>if (lemeout) {<br> msg += ‘Hello’;<br>}</pre><pre>console.log(msg);</pre><p>Whats the msg printed and why? Guess you answer before running it.</p><pre>var lemein = “0”;<br>var lemeout = 0;<br>var msg = “”;</pre><pre>if (lemein) {<br> msg += “hi”;<br> }</pre><pre>if (lemeout) {<br> msg += ‘Hello’;<br>}</pre><pre>console.log(msg);</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ee6c67c44fb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GUVI Zen — Simple debugging tasks:]]></title>
            <link>https://medium.com/@reach2arunprakash/guvi-zen-simple-debugging-tasks-adcdc2d3249d?source=rss-eb2dcb73c8b8------2</link>
            <guid isPermaLink="false">https://medium.com/p/adcdc2d3249d</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[zen]]></category>
            <category><![CDATA[arun-prakash]]></category>
            <category><![CDATA[guvi]]></category>
            <dc:creator><![CDATA[Arun Prakash]]></dc:creator>
            <pubDate>Mon, 04 May 2020 15:48:25 GMT</pubDate>
            <atom:updated>2020-05-17T14:41:08.517Z</atom:updated>
            <content:encoded><![CDATA[<h3><a href="http://www.guvi.io/zen">www.guvi.io/zen</a></h3><h3>GUVI: Zen Class — Part 3: Find the culprits and nail them — debugging javascript</h3><p><strong>Fix the code to get the largest of three.</strong></p><p>Code:</p><pre>aa = (f,s,t) =&gt; {<br> let f,s,t;<br> console.log(f,s,t);<br> if(f&gt;s &amp;&amp;f&gt;t){<br> console.log(f)}<br> else if(s&gt;f &amp;&amp; s&gt;t){<br> console.log(s)}<br> else{<br> console.log(t)}<br>}</pre><pre>aa(1,2,3);</pre><p>— — — — — — — — — — — — — — — — — — — — — — — — —<br><strong>Fix the code to Sum of the digits present in the number</strong></p><p>Code:</p><pre>let n = 123;</pre><pre>console.log(add(n));</pre><pre>function add(n)<br>{<br>let sum = 10;<br>for(var i=0;i&lt;n.length;i++){<br> sum+=n[i]<br> }<br> return sum;<br>}</pre><p>— — — — — — — — — — — — — — — — — — — — — — — — —</p><p><strong>Fix the code to Sum of all numbers using IIFE function</strong></p><p>Code:</p><pre>const arr = [9,8,5,6,4,3,2,1];</pre><pre>(function() {<br> let sum = 0;<br> for (var i = 0; i &lt;= arr.length; i++);{<br> sum += arr[i];<br> }<br> console.log(sum);<br> return sum;<br>})();</pre><p>— — — — — — — — — — — — — — — — — — — — — — — — —</p><p><strong>Fix the code to gen Title caps.</strong></p><p>Code:</p><pre>var arr = [“guvi”, “geek”, “zen”, “fullstack”];</pre><pre>var ano = function(arro) {<br> for (var i = 0; i &lt;= arro.length; i++) {<br> console.log(arro[i][0].toUpperCase() + arro[i].substr(1));<br> }<br>}<br>ano();</pre><p>— — — — — — — — — — — — — — — — — — — — — — — — —</p><p><strong>Fix the code to return the Prime numbers</strong></p><p>Code:</p><pre>const newArray=[1,3,2,5,10];<br>const myPrime=newArray.filter(num=&gt;{<br> for(let i=2;i&lt;=num;i++){<br> if(num%i===0)<br> {<br> return true;<br> }<br> }<br> return num===1;<br>});<br>console.log(myPrime);</pre><p>— — — — — — — — — — — — — — — — — — — — — — — — —</p><p><strong>Fix the code to sum the number in that array</strong></p><p>Code:</p><pre>const num = [10, 20, 30, 40,50,60,70,80,90,100] <br>const sum = (a, b) =&gt;<br> a + b<br>const sum = num.reduce(sum)<br>console.log(sum);</pre><p>— — — — — — — — — — — — — — — — — — — — — — — — —</p><p><strong>Fix the code to rotate an array by k times and return rotated array using IIFE function</strong></p><p>Code:</p><pre>var arr = [1, 2, 3, 6, 8, 6, 1, 9, 10, 12, 13];<br>var k = 3;<br>k = arr.length % k;<br>(function() {<br> arr = {};<br> out = arr.slice(k + 1, arr.length);<br> var count = out.length;<br> for (var i = 0; i &lt; k + 1; i++) {<br> out[count] = arr[i];<br> count += 1;<br> }<br> console.log(out);})();</pre><p>— — — — — — — — — — — — — — — — — — — — — — — — —</p><p><strong>Fix the code to gen Title caps.</strong></p><p>Code:</p><pre>var arr = [“guvi”, “geek”, “zen”, “fullstack”];</pre><pre>(function() {<br> for (var i = 0; i &lt;= arr.length; i++) {<br> console.log(arr[0][i].toUpperCase() + arr[i].substr(1));<br> }<br>})();</pre><p>— — — — — — — — — — — — — — — — — — — — — — — — —</p><p><strong>print all odd numbers in an array using IIFE function</strong></p><p>Code:</p><pre>var arr = [1, 2, 3, 5, 7, 79, 7, 2, 6, 9, 4];</pre><pre>(function() {<br> for (var i = 0; i &lt; arr.length; i++) {<br> if (arr[i] % 2 === 0) {<br> console.log(arr[i]);<br> }}<br>})();</pre><p>— — — — — — — — — — — — — — — — — — — — — — — — —</p><p><strong>Fix the code to reverse.</strong></p><p>Code:</p><pre>(function(str){<br> str1 = str.split(“ “).reverse().join(“”);<br> console.log(str1); <br>})(“abcd”)</pre><p>— — — — — — — — — — — — — — — — — — — — — — — — —</p><p><strong>Fix the code to remove duplicates.</strong></p><p>Code:</p><pre>var res = function(arr){<br> for(var i=0; i &lt; arr.length; i++){<br> newArr = [];<br> if(newArr.indexOf(arr[i]) == -1) {<br> newArr.push(arr[i]);<br> } }<br> console.log(newArr)<br>}</pre><pre>res([“guvi”,”geek”,”guvi”,”duplicate”,”geeK”])<br></pre><p>— — — — — — — — — — — — — — — — — — — — — — — — —</p><p><strong>Fix the code to give the below output:</strong></p><p>Expected Output:</p><p>[<br>{firstName: “Vasanth”, lastName: “Raja”, age: 24, role: “JSWizard”},<br>{firstName: “Sri”, lastName: “Devi”, age: 28, role: “Coder”}<br>]</p><p>Code:</p><pre>var array =[[[“firstname”,”vasanth”],[“lastname”,”Raje”],[“age”,24],[“role”,”JSWizard”]],[[“firstname”,”Sri”],[“lastname”,”Devi”],[“age”,28],[“role”, “Coder”]]];<br>var final=[]<br>while(array.length!=0)<br>{<br> var outer_remove = array.shift();<br> <br> while(outer_remove.length!=0)<br> {<br> var inner_remove = outer_remove.shift()<br> var key = inner_remove[0]<br> var value =inner_remove[1]<br> new_object[key]=value<br> }<br> final.push(new_object)</pre><pre>}</pre><p>— — — — — — — — — — — — — — — — — — — — — — — — —</p><p><strong>Fix the code to give the below output:</strong></p><p>Sum of odd numbers in an array</p><p>Code:</p><pre><br>var as=[12,34,5,6,2,56,6,2,1];<br>var s=as.reduce(function(a,c){<br> if(c%2!=0)<br> {<br> return a+c;<br> }<br> return a;});<br>console.log(s);</pre><p>— — — — — — — — — — — — — — — — — — — — — — — — —</p><p><strong>Fix the code to give the below output:</strong></p><p>Swap the odd and even digits</p><p>Code:</p><pre>aa = data=&gt;{<br> var a=data;<br>for(i=0;i&lt;a.length-1;i++){<br> var l=’’;<br> var s=a[i+1]<br> var b=a[i]<br> l+=s<br> l+=b<br> i=i+1<br>}<br>if((a.length%2)!=0){<br> l+=a[a.length-1]<br>}<br>console.log(l);<br>}</pre><pre>aa(“1234”);</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=adcdc2d3249d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Scalability for Dummies — Short Notes collection]]></title>
            <link>https://medium.com/@reach2arunprakash/scalability-for-dummies-short-notes-collection-b373b4d7f05f?source=rss-eb2dcb73c8b8------2</link>
            <guid isPermaLink="false">https://medium.com/p/b373b4d7f05f</guid>
            <category><![CDATA[scalability]]></category>
            <dc:creator><![CDATA[Arun Prakash]]></dc:creator>
            <pubDate>Sun, 19 Jan 2020 18:33:03 GMT</pubDate>
            <atom:updated>2020-01-19T18:33:03.236Z</atom:updated>
            <content:encoded><![CDATA[<h3>Scalability for Dummies — Short Notes collection</h3><h3>Difference between scaling horizontally and vertically</h3><p><strong>Scalability</strong> is the property of a system to handle a growing amount of work by adding resources to the system</p><p>Resources fall into two broad categories: horizontal and vertical</p><p><strong>Scale-out — Horizontal scaling </strong>means that you scale by adding more machines into your pool of resources whereas</p><p>Scaling horizontally ===&gt; Thousands of minions will do the work together for you.</p><p><strong>Scale-up — Vertical scaling </strong>means that you scale by adding more power (CPU, RAM) to an existing machine.</p><p>Scaling vertically ===&gt; One big hulk will do all the work for you.</p><p><strong>Pros &amp; Cons:</strong></p><p>Vertical scaling is</p><blockquote>Typically costly, Since you need to buy a bigger machine</blockquote><blockquote>It does not make the system fault tolerant, i.e if you are scaling application running with single server, if that server goes down, your system will go down.</blockquote><blockquote>Vertical scaling may require your system to go down for a moment when process takes place.</blockquote><blockquote>Increasing resources on a server requires a restart and put your system down.</blockquote><p>Horizontal Scaling is</p><blockquote>Cost Effective</blockquote><blockquote>But you have to design the architecture for it .</blockquote><blockquote>Fault tolerant as multiple server are the to handle.</blockquote><blockquote>This will increase the load on the Ops team to maintain and deploy all the servers</blockquote><h3>CS75 (Summer 2012) Lecture 9 Scalability Harvard Web Development David Malan</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F-W9F__D3oY4%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D-W9F__D3oY4&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F-W9F__D3oY4%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/14ce8c0f94f7d5bf2be8a1b8e1c9af37/href">https://medium.com/media/14ce8c0f94f7d5bf2be8a1b8e1c9af37/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b373b4d7f05f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DS Interview Questions -Beginner Level]]></title>
            <link>https://medium.com/@reach2arunprakash/ds-interview-questions-beginner-level-cc5ee769dec1?source=rss-eb2dcb73c8b8------2</link>
            <guid isPermaLink="false">https://medium.com/p/cc5ee769dec1</guid>
            <category><![CDATA[interview-questions]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[sd]]></category>
            <dc:creator><![CDATA[Arun Prakash]]></dc:creator>
            <pubDate>Sun, 19 Jan 2020 18:10:33 GMT</pubDate>
            <atom:updated>2020-01-19T18:10:33.380Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>General List</strong></p><ul><li>Find the most frequent integer in an array</li><li>Find pairs in an integer array whose sum is equal to 10 (bonus: do it in linear time)</li><li>Given 2 integer arrays, determine of the 2nd array is a rotated version of the 1st array.</li><li>Ex. Original Array A={1,2,3,5,6,7,8} Rotated Array B={5,6,7,8,1,2,3}</li><li>Write fibbonaci iteratively and recursively (bonus: use dynamic programming)</li><li>Find the only element in an array that only occurs once.</li><li>Find the common elements of 2 int arrays</li><li>Implement binary search of a sorted array of integers</li><li>Implement binary search in a rotated array (ex. {5,6,7,8,1,2,3})</li><li>Use dynamic programming to find the first X prime numbers</li><li>Write a function that prints out the binary form of an int</li><li>Implement parseInt</li><li>Implement squareroot function</li><li>Implement an exponent function (bonus: now try in log(n) time)</li><li>Write a multiply function that multiples 2 integers without using *</li><li>Given n points, return the top k points that are closest to the origin</li><li>We’re going to find “Word Twins”, which are pairs of English words, at least 4 letters long, where the first three letters of one are the last three letters of another. For example, “strategy” and “Egypt”.</li><li>Given a 3*3 matrix, and 1–8 numbers in random order, 1 place as space. Write code to find the min exchange of numbers to make the matrix in order.</li><li>5 4 1 1 2 3 3 2 ---&gt; 8 4 7 8 6 7 6</li><li>There is k parenthesis, write code to calculate how many permutations could have. For 2 parenthesis, there is 2 permutations: ()() and (()).</li><li><strong>HARD</strong>: Given a function rand5() that returns a random int between 0 and 5, implement rand7()</li><li><strong>HARD</strong>: Given a 2D array of 1s and 0s, count the number of “islands of 1s” (e.g. groups of connecting 1s) <strong>Arrays Additional</strong></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cc5ee769dec1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Top 9 Strings problems]]></title>
            <link>https://medium.com/@reach2arunprakash/top-9-strings-problems-241a271bcfc1?source=rss-eb2dcb73c8b8------2</link>
            <guid isPermaLink="false">https://medium.com/p/241a271bcfc1</guid>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[sd]]></category>
            <category><![CDATA[string]]></category>
            <category><![CDATA[persistent-datastructures]]></category>
            <dc:creator><![CDATA[Arun Prakash]]></dc:creator>
            <pubDate>Sun, 19 Jan 2020 18:09:22 GMT</pubDate>
            <atom:updated>2020-01-19T18:09:22.439Z</atom:updated>
            <content:encoded><![CDATA[<ul><li>Find the first non-repeated character in a String</li><li>Reverse a String iteratively and recursively</li><li>Determine if 2 Strings are anagrams</li><li>Check if String is a palindrome</li><li>Check if a String is composed of all unique characters</li><li>Determine if a String is an int or a double</li><li><strong>HARD</strong>: Find the longest palindrome in a String</li><li><strong>HARD</strong>: Print all permutations of a String</li><li><strong>HARD</strong>: Given a single-line text String and a maximum width value, write the function ‘String justify(String text, int maxWidth)’ that formats the input text using full-justification, i.e., extra spaces on each line are equally distributed between the words; the first word on each line is flushed left and the last word on each line is flushed right</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=241a271bcfc1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Zen Javascript workouts — Jquery]]></title>
            <link>https://medium.com/@reach2arunprakash/zen-javascript-workouts-jquery-e89d1ec46ae6?source=rss-eb2dcb73c8b8------2</link>
            <guid isPermaLink="false">https://medium.com/p/e89d1ec46ae6</guid>
            <dc:creator><![CDATA[Arun Prakash]]></dc:creator>
            <pubDate>Sat, 21 Dec 2019 03:08:28 GMT</pubDate>
            <atom:updated>2019-12-21T03:08:28.909Z</atom:updated>
            <content:encoded><![CDATA[<p>Where to pick</p><pre>&lt;script src=&quot;https://code.jquery.com/jquery-2.1.4.js&quot;&gt;&lt;/script&gt;</pre><h3>Javascript and DOM</h3><pre>/* Javascript and DOM */</pre><pre>// It is very important to make sure that the DOM has finished<br>// loading the HTML content before we can reliably use jQuery</pre><pre>// The following code will allow you to run jQuery once the DOM is ready<br>$(document).ready(function() {</pre><pre>    /* Retrieving an element&#39;s text */</pre><pre>    //You can find any DOM element and it&#39;s text using this syntax:<br>    // text() is a method offered by jQuery<br>    $(&quot;h1&quot;).text(); //returns &quot;jQuery Basics&quot;</pre><pre>    //text() allows you to modify the text node<br>    $(&quot;h1&quot;).text(&quot;jQuery: Basics&quot;)<br>    $(input).val(); //get the value from text box <br></pre><pre>});</pre><h3>Task 1 : Check if jQuery is loaded</h3><h3>Task 1 : Add new div to your website</h3><h3>onlineTask 1 : Scroll to the top of the page with jQuery.</h3><h3>Task 1 : Disable right click menu in html page using jQuery</h3><h3>Task 1 : Find the class of the clicked element</h3><h3>Task 1 : If You would like to change sizes of Your div/button with one click :)</h3><h3>Task 1 : Find the secret</h3><pre>&lt;button id=&quot;clicker&quot;&gt;Click me to show a hidden secret!&lt;/button&gt;<br>&lt;div id=&quot;secret&quot; style=&quot;display: none&quot;&gt;I am a hidden secret.&lt;/div&gt;</pre><h3>Task 1 : Modify the text value</h3><p>Create an HTML file sample1.html in your text editor.</p><p>It should have</p><ol><li>A div with a text “Change me”</li><li>Button “Change!” and</li><li>An Input box</li></ol><ul><li>The <strong>Change!</strong> button has the id=&quot;button_change&quot;</li><li>The input field has the id=&quot;input_color&quot;</li><li>All occurrences of the desired text to be replaced are enclosed within &lt;div&gt; tags, and have the class=&quot;cow_color&quot;.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/0*ymEJFm5g1K1aU31G.png" /></figure><p>Time to complete: 15 mins</p><p>You will need to:</p><ol><li>Select the <strong>Change!</strong> button.</li><li>Set a click listener on the button to capture click events.</li><li>Retrieve and store the value currently in the input field.</li><li>Replace the text with the stored value.</li></ol><h3>Task 2: Attributes, Classes and CSS Manipulation</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/0*_Nx8iHCMhShePNyN.png" /></figure><h3>Task 4: Canvas Manipulation</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/372/0*07wUC8NjsR5OSo9f.png" /></figure><p><strong>Task 5: Canvas Manipulation</strong></p><p>Read the below article and replicate the tasks</p><p>Time to complete : 70 mins</p><p>https://www.codeproject.com/Articles/246701/jQuery-for-Beginners</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e89d1ec46ae6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Basic MySQL Tutorial]]></title>
            <link>https://medium.com/@reach2arunprakash/a-basic-mysql-tutorial-c22b5ad23181?source=rss-eb2dcb73c8b8------2</link>
            <guid isPermaLink="false">https://medium.com/p/c22b5ad23181</guid>
            <category><![CDATA[mysql-workbench]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[mysql]]></category>
            <dc:creator><![CDATA[Arun Prakash]]></dc:creator>
            <pubDate>Fri, 20 Sep 2019 05:20:06 GMT</pubDate>
            <atom:updated>2019-09-20T05:20:06.453Z</atom:updated>
            <content:encoded><![CDATA[<p>MySQL is the most popular Open Source Relational SQL database management system that helps users store, organize, and retrieve data. It is a very powerful program with a lot of flexibility — this tutorial will provide the simplest introduction to MySQL</p><p>How to Install MySQL on Ubuntu and CentOS</p><p>If you don’t have MySQL installed on your machine, you can quickly download it.</p><p>Windows:<br><a href="https://dev.mysql.com/downloads/installer/">https://dev.mysql.com/downloads/installer/</a></p><p>How to Access the MySQL shell</p><p>Once you have MySQL installed on your machine, you can access the MySQL shell by typing the following command into command prompt:</p><p>mysql -u root -p</p><p>After entering the root MySQL password into the prompt (not to be confused with the root machine password), you will be able to start building your MySQL database.</p><p>Two points to keep in mind:</p><p>1. You have to end the MySQL commands with a “semicolon;”.<br> 2. MySQL commands line is not case sensitive.</p><p>How to Create and Delete a MySQL Database</p><p>MySQL organizes its information into databases; each one can hold tables with specific data.</p><p>You can quickly check what databases are available by typing:</p><p>SHOW DATABASES;</p><p>Your screen should look something like this:</p><p>mysql&gt; SHOW DATABASES;<br>+ — — — — — — — — — — +<br>| Database |<br>+ — — — — — — — — — — +<br>| information_schema |<br>| mysql |<br>| performance_schema |<br>| test |<br>+ — — — — — — — — — — +<br>4 rows in set (0.01 sec)</p><p>Creating a database is very easy:</p><p>CREATE DATABASE database name;</p><p>In this case, for example, we will call our database “GUVI.”</p><p>mysql&gt; SHOW DATABASES;<br>+ — — — — — — — — — — +<br>| Database |<br>+ — — — — — — — — — — +<br>| information_schema |<br>| GUVI |<br>| mysql |<br>| performance_schema |<br>| test |<br>+ — — — — — — — — — — +<br>5 rows in set (0.00 sec)</p><p>In MySQL, the phrase most often used to delete objects is Drop. You would delete a MySQL database with this command:</p><p>DROP DATABASE database name;</p><p>How to Access a MySQL Database</p><p>Once we have a new database, we can begin to fill it with information.</p><p>The first step is to create a new table within the larger database.</p><p>Let’s open up the database we want to use:</p><p>USE GUVI;</p><p>In the same way that you could check the available databases, you can also see an overview of the tables that the database contains.</p><p>SHOW tables;</p><p>Since this is a new database, MySQL has nothing to show, and you will get a message that says, “Empty set”<br>How to Create a MySQL Table</p><p>Let’s imagine that we are planning a get together of friends. We can use MySQL to track the details of the event.</p><p>Let’s create a new MySQL table:</p><p>CREATE TABLE Shared_Library_Reader (id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, <br>name VARCHAR(20),<br>Book_Name VARCHAR(30),<br>confirmed CHAR(1), <br>signup_date DATE);</p><p>This command accomplishes a number of things:</p><p>It has created a table called Shared_Library_Reader within the directory, GUVI.<br> We have set up 5 columns in the table — id, name, Book_Name, confirmed, and signup date.<br> The “id” column has a command (INT NOT NULL PRIMARY KEY AUTO_INCREMENT) that auMSDatically numbers each row.<br> The “name” column has been limited by the VARCHAR command to be under 20 characters long.<br> The “Book_Name” column designates the Book_Name each person will bring. The VARCHAR limits text to be under 30 characters.<br> The “confirmed” column records whether the person has RSVP’d with one letter, Y or N.<br> The “date” column will show when they signed up for the event. MySQL requires that dates be written as yyyy-mm-dd</p><p>Let’s take a look at how the table appears within the database using the “SHOW TABLES;” command:</p><p>mysql&gt; SHOW TABLES;<br>+ — — — — — — — — — — — — — — — — +<br>| Tables_in_GUVI |<br>+ — — — — — — — — — — — — — — — — +<br>| Shared_Library_Reader |<br>+ — — — — — — — — — — — — — — — — +<br>1 row in set (0.01 sec)</p><p>We can remind ourselves about the table’s organization with this command:</p><p>DESCRIBE Shared_Library_Reader;</p><p>Keep in mind throughout that, although the MySQL command line does not pay attention to cases, the table and database names are case sensitive: Shared_Library_Reader is not the same as Shared_Library_Reader or Shared_Library_Reader.</p><p>mysql&gt;DESCRIBE Shared_Library_Reader;<br>+ — — — — — — -+ — — — — — — -+ — — — + — — -+ — — — — -+ — — — — — — — — +<br>| Field | Type | Null | Key | Default | Extra |<br>+ — — — — — — -+ — — — — — — -+ — — — + — — -+ — — — — -+ — — — — — — — — +<br>| id | int(11) | NO | PRI | NULL | auto_increment |<br>| name | varchar(20) | YES | | NULL | |<br>| Book_Name | varchar(30) | YES | | NULL | |<br>| confirmed | char(1) | YES | | NULL | |<br>| signup_date | date | YES | | NULL | |<br>+ — — — — — — -+ — — — — — — -+ — — — + — — -+ — — — — -+ — — — — — — — — +<br>5 rows in set (0.01 sec)</p><p>How to Add Information to a MySQL Table</p><p>We have a working table for our party. Now it’s time to start filling in the details.</p><p>Use this format to insert information into each row:</p><p>INSERT INTO `Shared_Library_Reader` (`id`,`name`,`Book_Name`,`confirmed`,`signup_date`) VALUES (NULL, “John”, “Casonova”,”Y”, ‘2012–04–11’);</p><p>Once you input that in, you will see the words:</p><p>Query OK, 1 row affected (0.00 sec)</p><p>Let’s add a couple more people to our group:</p><p>INSERT INTO `Shared_Library_Reader` (`id`,`name`,`Book_Name`,`confirmed`,`signup_date`) VALUES (NULL, “Virat”, “Inevitable”,”N”, ‘2012–04–14’);<br>INSERT INTO `Shared_Library_Reader` (`id`,`name`,`Book_Name`,`confirmed`,`signup_date`) VALUES (NULL, “MSD”, “MOTM”,”Y”, ‘2012–04–18’);<br>INSERT INTO `Shared_Library_Reader` (`id`,`name`,`Book_Name`,`confirmed`,`signup_date`) VALUES (NULL, “Tull”, “Solid”,”Y”, ‘2012–04–10’);</p><p>We can take a look at our table:</p><p>mysql&gt; SELECT * FROM Shared_Library_Reader;<br>+ — — + — — — -+ — — — — — — — — + — — — — — -+ — — — — — — -+<br>| id | name | Book_Name | confirmed | signup_date |<br>+ — — + — — — -+ — — — — — — — -+ — — — — — -+ — — — — — — -+<br>| 1 | John | Casonova | Y | 2012–04–11 |<br>| 2 | Virat | Inevitable | N | 2012–04–14 |<br>| 3 | MSD | MOTM | Y | 2012–04–18 |<br>| 4 | Tull | Solid | Y | 2012–04–10 |<br>+ — — + — — — -+ — — — — — — — -+ — — — — — -+ — — — — — — -+<br>4 rows in set (0.00 sec)</p><p>How to Update Information in the Table</p><p>Now that we have started our Shared_Library_Reader list, we can address any possible changes. For example: Virat has confirmed that she is attending, so we are going to update that in the table.</p><p>UPDATE `Shared_Library_Reader` <br>SET <br>`confirmed` = ‘Y’ <br>WHERE `Shared_Library_Reader`.`name` =’Virat’;</p><p>You can also use this command to add information into specific cells, even if they are empty.<br>How to Add and Delete a Column</p><p>We are creating a handy chart, but it is missing some important information: our attendees’ emails.</p><p>We can easily add this:</p><p>ALTER TABLE Shared_Library_Reader ADD email VARCHAR(40);</p><p>This command puts the new column called “email” at the end of the table by default, and the VARCHAR command limits it to 40 characters.</p><p>However, if you need to place that column in a specific spot in the table, we can add one more phrase to the command.</p><p>ALTER TABLE Shared_Library_Reader ADD email VARCHAR(40) AFTER name;</p><p>Now the new “email” column goes after the column “name”.</p><p>Just as you can add a column, you can delete one as well:</p><p>ALTER TABLE Shared_Library_Reader DROP email;</p><p>I guess we will never know how to reach the picnickers.<br>How to Delete a Row</p><p>If needed, you can also delete rows from the table with the following command:</p><p>DELETE from [table name] where [column name]=[field text];</p><p>For example, if Virat suddenly realized that she will not be able to participate in the Shared_Library_Reader after all, we could quickly eliminate her details.</p><p>mysql&gt; DELETE from Shared_Library_Reader where name=’Virat’;<br>Query OK, 1 row affected (0.00 sec)</p><p>mysql&gt; SELECT * FROM Shared_Library_Reader;<br>+ — — + — — — + — — — — — -+ — — — — — -+ — — — — — — -+<br>| id | name | Book_Name | confirmed | signup_date |<br>+ — — + — — — + — — — — — -+ — — — — — -+ — — — — — — -+<br>| 1 | John | Casonova | Y | 2012–04–11 |<br>| 3 | MSD | MOTM | Y | 2012–04–18 |<br>| 4 | Tull | Solid | Y | 2012–04–10 |<br>+ — — + — — — + — — — — — -+ — — — — — -+ — — — — — — -+<br>3 rows in set (0.00 sec)</p><p>This is a basic tutorial and you can start learning other concepts from here…..</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c22b5ad23181" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>