<?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 Venkat.R on Medium]]></title>
        <description><![CDATA[Stories by Venkat.R on Medium]]></description>
        <link>https://medium.com/@ramsunvtech?source=rss-c5136b83d20f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*jRA0IgRKcxmb0dQ2Z0NFuQ.png</url>
            <title>Stories by Venkat.R on Medium</title>
            <link>https://medium.com/@ramsunvtech?source=rss-c5136b83d20f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 08 Jun 2026 21:28:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ramsunvtech/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[Understanding Preteens: Ages 6 to 11 (Part 2)]]></title>
            <link>https://medium.com/2k-parenting/understanding-preteens-ages-6-to-11-part-2-4148048e8d4e?source=rss-c5136b83d20f------2</link>
            <guid isPermaLink="false">https://medium.com/p/4148048e8d4e</guid>
            <category><![CDATA[parenthood]]></category>
            <category><![CDATA[father-and-daughter]]></category>
            <category><![CDATA[parenting]]></category>
            <category><![CDATA[father-and-son]]></category>
            <category><![CDATA[fatherhood]]></category>
            <dc:creator><![CDATA[Venkat.R]]></dc:creator>
            <pubDate>Sun, 10 Dec 2023 06:27:36 GMT</pubDate>
            <atom:updated>2023-12-10T06:29:00.883Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*inD5-ZnjAhKtX1u-.jpeg" /></figure><h3>The changing bond with parents:</h3><p>Young adults seek respect and expect the same from everyone, especially their parents. They strive to be more independent. Interestingly, if someone they admire, like a respected teacher, says something is true, they’ll often take it as absolute truth, even if their parents disagree. This is because they’ve learned about right and wrong from their parents and have developed a deeper understanding. However, they can become impatient when their parents try to advise or warn them.</p><h3>Why do “bad manners” pop up?</h3><p>Children begin using adult vocabulary beyond their years, showing a desire to dress fashionably and choose their own hairstyles. They might shove all their food onto their plate at once, neglecting table manners, eating without first washing their hands, and carelessly discarding their coats and school uniforms on the floor. They often slam doors or leave them ajar.</p><p>Such behaviours can cause even the most patient parents to feel dismayed and worried about these changes.</p><p>However, these behaviours are typical signs that children are learning to discern right from wrong as they mature. Statistically, girls tend to exhibit less rebellious behaviour than boys, although they may still display subtle shifts in attitude.</p><h3>So What you can do?</h3><p>Hold on to what’s important to you. When you ask kids to do things like finish their food or wash their hands, try not to sound naggy or bossy because kids don’t like that.</p><h3>What’s Next in Part 3:</h3><p>The magic of first friendships<br>The need to be liked by everyone<br>Becoming Strict (Taking rules more seriously)<br>What is Tics?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*KNunfbd4podF7eoLOnbNUA.jpeg" /><figcaption>My daughter waving her brother</figcaption></figure><p>Join me as we continue our journey, understanding the wonders of preteen growth.</p><p><em>Note: While this article is rooted in my personal experiences, I’ve also drawn insights from the book “</em><a href="https://en.wikipedia.org/wiki/The_Common_Sense_Book_of_Baby_and_Child_Care"><em>Baby &amp; Child Care</em></a><em>” by </em><a href="https://en.wikipedia.org/wiki/Benjamin_Spock"><em>Dr. Benjamin Spock</em></a><em>. A must-read for parents seeking a deeper understanding of child development.</em>The changing bond with parents:</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4148048e8d4e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/2k-parenting/understanding-preteens-ages-6-to-11-part-2-4148048e8d4e">Understanding Preteens: Ages 6 to 11 (Part 2)</a> was originally published in <a href="https://medium.com/2k-parenting">2k-parenting</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Preteens: Ages 6 to 11 (Part 1)]]></title>
            <link>https://medium.com/2k-parenting/understanding-preteens-ages-6-to-11-part-1-f2c1e6905e7f?source=rss-c5136b83d20f------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2c1e6905e7f</guid>
            <category><![CDATA[daughters]]></category>
            <category><![CDATA[fatherhood]]></category>
            <category><![CDATA[parenting]]></category>
            <category><![CDATA[son]]></category>
            <dc:creator><![CDATA[Venkat.R]]></dc:creator>
            <pubDate>Mon, 16 Oct 2023 04:51:01 GMT</pubDate>
            <atom:updated>2023-12-10T06:31:04.181Z</atom:updated>
            <content:encoded><![CDATA[<p>As kids grow, their worlds change dramatically, especially between the ages of 6 and 11. Here’s a heartfelt look at this fascinating phase:</p><p><strong>Emerging Independence: </strong>Remember when they clung to your leg on the first day of school? Now, they’re eager to forge their own paths. Their friends’ thoughts start to matter, and they’re beginning to realize they play a role in the bigger world around them.</p><p><strong>Curiosity Blooms:</strong> Every day seems to bring a new passion. Maybe it’s counting money, perhaps it’s understanding why cars move, or even starting to pen their own little stories. They’re figuring out where their interests lie.</p><p><strong>Recalling Younger Days: </strong>When they were tinier, everything was about imitation. Daughters tried to walk in mommy’s shoes, while sons emulated dad’s every move. Back then, a gentle peck could lead to a fit of giggles, and those romantic scenes in movies? Instant facepalms!</p><p><strong>Growing Up After Six: </strong>Suddenly, those movie scenes are less awkward and more intriguing. Reading, writing, and discovering the world takes precedence. They’re less about following and more about leading their own adventures.</p><h3>What’s Next in Part 2:</h3><ul><li>The changing bond with parents</li><li>Why do “bad manners” pop up?</li><li>The magic of first friendships</li><li>The need to be liked by everyone</li><li>Becoming Strict (Taking rules more seriously)</li><li>What is Tics?</li></ul><p>Join me as we continue our journey, understanding the wonders of preteen growth.</p><p><em>Note: While this article is rooted in my personal experiences, I’ve also drawn insights from the book “</em><a href="https://en.wikipedia.org/wiki/The_Common_Sense_Book_of_Baby_and_Child_Care"><em>Baby &amp; Child Care</em></a><em>” by </em><a href="https://en.wikipedia.org/wiki/Benjamin_Spock"><em>Dr. Benjamin Spock</em></a><em>. A must-read for parents seeking a deeper understanding of child development.</em></p><p>Edit: Other Part Article Links<br><a href="https://medium.com/2k-parenting/understanding-preteens-ages-6-to-11-part-2-4148048e8d4e">Understanding Preteens: Ages 6 to 11 (Part 2)</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2c1e6905e7f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/2k-parenting/understanding-preteens-ages-6-to-11-part-1-f2c1e6905e7f">Understanding Preteens: Ages 6 to 11 (Part 1)</a> was originally published in <a href="https://medium.com/2k-parenting">2k-parenting</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Launch VCode in Command Line]]></title>
            <link>https://medium.com/html5-school/launch-vcode-in-command-line-579bc228472a?source=rss-c5136b83d20f------2</link>
            <guid isPermaLink="false">https://medium.com/p/579bc228472a</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[visual-studio-code]]></category>
            <category><![CDATA[html5]]></category>
            <category><![CDATA[vscode]]></category>
            <dc:creator><![CDATA[Venkat.R]]></dc:creator>
            <pubDate>Sun, 08 Apr 2018 05:44:20 GMT</pubDate>
            <atom:updated>2018-04-08T05:44:20.275Z</atom:updated>
            <content:encoded><![CDATA[<p>You can launch Visual Studio Code from the windows / mac terminal by typing ‘code’ after adding it to the path:</p><p>Steps to launch</p><ul><li>Launch VS Code.</li><li>Open the Command Palette (⇧⌘P in Mac) and type ‘shell command’ to find the Shell Command: Install ‘code’ command in PATH command.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/1*qZ7eZelhziDBMJzpOeif3Q.png" /><figcaption>In Visual Studio Code</figcaption></figure><ul><li>Restart the terminal for the new $PATH value to take effect. You&#39;ll be able to type &#39;code .&#39; in any folder to start editing files in that folder.</li></ul><p>In Windows, This command will be available by default.</p><h4>How to configure my own command to launch VCode ?</h4><p>In Mac: To manually add VS Code to your path</p><pre>cat &lt;&lt; EOF &gt;&gt; ~/.bash_profile<br># Add Visual Studio Code (code)<br>export PATH=&quot;\$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin&quot;<br>EOF</pre><p>In Windows, Open the Bin folder of Visual Code installed directory for example</p><pre><strong>Location:</strong> C:\Program Files\Microsoft VS Code\bin\code.cmd</pre><pre>Copy this File and rename it or follow the below command</pre><pre>$ cp C:\Program Files\Microsoft VS Code\bin\code.cmd C:\Program Files\Microsoft VS Code\bin\vscode.cmd</pre><p>Happy Coding !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=579bc228472a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/html5-school/launch-vcode-in-command-line-579bc228472a">Launch VCode in Command Line</a> was originally published in <a href="https://medium.com/html5-school">HTML5 School</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React Native: Could not connect to development server]]></title>
            <link>https://medium.com/error-healer/react-native-could-not-connect-to-development-server-2b39c7f15ddc?source=rss-c5136b83d20f------2</link>
            <guid isPermaLink="false">https://medium.com/p/2b39c7f15ddc</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[erros]]></category>
            <dc:creator><![CDATA[Venkat.R]]></dc:creator>
            <pubDate>Wed, 14 Feb 2018 08:16:52 GMT</pubDate>
            <atom:updated>2018-02-15T16:23:57.009Z</atom:updated>
            <content:encoded><![CDATA[<p>If you are a beginner to <a href="https://facebook.github.io/react-native/">React Native</a> then you would have faced this issue at least once. <a href="https://facebook.github.io/react-native/">React Native</a> connects with <a href="https://en.wikipedia.org/wiki/Emulator">Emulator</a> after <a href="https://github.com/facebook/metro">Metro</a> generate the build to serve Emulator. below is command which triggers the above process.</p><pre>react-native run-android // Connect with Android Device or Emulator<br>react-native run-ios // Connect with IOS Device or Emulator</pre><p>Lets take simple example with android, the above command run the below shell script which is part of React Native where its actually validate android SDK, Environment and device if exist.</p><p><a href="https://github.com/facebook/react-native/blob/0.54-stable/scripts/run-android-local-integration-tests.sh">https://github.com/facebook/react-native/blob/0.54-stable/scripts/run-android-local-integration-tests.sh</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*O3tpklSIb2gkDKZS45ALmQ.png" /><figcaption><a href="https://github.com/facebook/react-native/blob/0.54-stable/scripts/run-android-local-integration-tests.sh">android-local-integration-tests.sh</a></figcaption></figure><h3>Error: Emulator throws the error “Could not connect to development server” and below is the screenshot.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/345/1*M5d4QPAg40yQOx4miFinFQ.png" /><figcaption>Could not connect to development server</figcaption></figure><h3>Solution</h3><p>Basically this error tells that your current build got failed due to reasons like Code issue or dependency issue.</p><p>In order to fix this issue, solution is dead simple is below.</p><ol><li>Cancel the current process of“react-native run-android” by CTRL + C or CMD + C</li><li>Close metro bundler window command line which opened automatically.</li><li>Run the command again, “react-native run-android”</li></ol><p>Cool, Isn’t it !!</p><p>Happy Coding, Stay tuned for next error with solution !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2b39c7f15ddc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/error-healer/react-native-could-not-connect-to-development-server-2b39c7f15ddc">React Native: Could not connect to development server</a> was originally published in <a href="https://medium.com/error-healer">Error Healer</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Behind Browser (Basics — Part 1)]]></title>
            <link>https://medium.com/@ramsunvtech/behind-browser-basics-part-1-b733e9f3c0e6?source=rss-c5136b83d20f------2</link>
            <guid isPermaLink="false">https://medium.com/p/b733e9f3c0e6</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[browsers]]></category>
            <dc:creator><![CDATA[Venkat.R]]></dc:creator>
            <pubDate>Mon, 24 Jul 2017 04:45:51 GMT</pubDate>
            <atom:updated>2017-07-24T16:31:44.691Z</atom:updated>
            <content:encoded><![CDATA[<p>Browser - It’s a great idea which helps to access various applications (Web Applications) in one place and It’s most widely used software application for retrieving, presenting and traversing information resources on the World Wide Web identified by a URI/URL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*7Z5Yr1rxyZsevxYxWSgYQA.png" /><figcaption><strong>Web Browser Components (Credits — </strong><a href="https://www.html5rocks.com">https://www.html5rocks.com</a>)</figcaption></figure><blockquote>As a Web Developer, Learning Browser’s internal operations and their architecture helps you to take better decisions during development also to discover the best and worst practices.</blockquote><h3>Browser Functionality</h3><p>It’s operate to mainly display the web resources (HTML, XML, CSS, JS, JSON, PDF etc) you chose. In General, browser request it from the server and server response to the browser window. The Resource location is specified by the user using a URI (Uniform Resource Identifier).</p><blockquote><a href="https://www.w3.org/">W3C </a>maintains the specification on how browser should interpret and display the web page (HTML) and this helped to solve the compatibility issues between browsers.</blockquote><h3>Browser Components</h3><p>It has set of components with work flow. Lets have a look at each component in detail one by one.</p><h4><strong>User Interface</strong></h4><p>The Address Bar is one of the good example. It interface with user to insert URI and interacts with various component to render the web page.</p><p>There are plenty of user interfaces for various needs like Back and Forward Buttons, Bookmark, Reload, Stop and Home Buttons which you see below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/672/1*7LMdXYEbP2AK0OVxnSyAAQ.png" /><figcaption><strong>Address Bar in Chrome</strong></figcaption></figure><p>Interface Layer communicates to data layer for retrieving data and UI Backend to draw widgets as per HTTP Response body which is our HTML source code. Browser engine communicates between UI and the Rendering / Layout Engine.</p><blockquote>Now in Modern Browsers has interface (Dev Tools) which helps to see the client data like Cookies, Local Storage, Session Storage, IndexDB etc.</blockquote><h4><strong>Browser Engine</strong></h4><p>It’s a bridge between User Interface and Rendering Engine. It provides methods to initiate the loading of a URL and other actions like (reload, back and forward).</p><h4><strong>Layout / Rendering Engine</strong></h4><p>It’s able to render the content of given URL in browser screen and interprets the HTML, XML and CSS. It is single threaded. By default, It displays data according to your specified content type (MIME). For Example HTML, Images, XML, CSS, JSON, PDF etc.</p><p>Key operation of Rendering engine is HTML Parser. Each browser use various engines like Chrome and Opera uses Blink, Firefox uses Gecko, IE Edge uses EdgeHTML, Internet Explorer uses Trident, Apple Safari uses WebKit.</p><p><strong><em>What is the Flow?<br></em></strong>1. Parsing HTML document by HTML Parser convert elements to Node and create Content Tree.<br>2. Parsing Styles code / document by CSS Parser and create Render Tree.<br>3. Render Tree goes through Layout Process. Element’s Node get position coordinates.<br>4. Render Tree will be traversed and each node will be painted using the UI Back-end Layer.</p><p><strong><em>What is Dirty bit system?<br></em></strong><em>1. </em>This will be used for small changes which doesn’t require to do full layout change.<br>2. It uses incremental layout asynchronously.<br>3. It’s two flags are dirty and children are dirty.</p><p><strong>Few Other Stages</strong></p><ol><li>Width calculation - It’s calculated using the container width attribute / style attribute.</li><li>Line Breaking -During scroll, layout parent creates the extra renderers and calls layout on them.</li><li>Painting<br>1. render tree is traversed and the renderer’s “paint()” method.<br>2. Paint method call to display content on the screen.<br>3. It uses UI infrastructure component.<br>4. Painting Order (background color, background image, border, children, outline)</li></ol><h3><strong>Network</strong></h3><p>1. Networking handle all aspects of Internet Communication and handles URLs to use HTTP, FTP.<br>2. Implements a cache of retrieve documents to minimize network traffic.</p><h3>JavaScript Interpreter — Scripting Engines</h3><ol><li>JavaScript Interpreter executes the JS code and result to rendering engine.</li><li>Each browser use various scripting engines like Chrome uses <a href="https://en.wikipedia.org/wiki/V8_(JavaScript_engine)">V8</a>, Firefox uses <a href="https://en.wikipedia.org/wiki/SpiderMonkey">Spider Monkey</a>, IE Edge uses <a href="https://en.wikipedia.org/wiki/Chakra_(JavaScript_engine)">Chakra (JavaScript Engine)</a>, Internet Explorer uses <a href="https://en.wikipedia.org/wiki/Chakra_(JScript_engine)">Chakra (JScript Engine)</a>, Safari uses <a href="https://en.wikipedia.org/wiki/WebKit#JavaScriptCore">Nitro (JavaScript Core)</a></li></ol><h3>UI Back-end</h3><p>Back-end helps to draw widgets like select box, input box and check box etc.</p><h3>Data Persistence</h3><p>This layer is persistence and this helps browser to store data locally like Cookie, Local Storage, Session Storage, IndexedDB, WebSQL and FileSystem.</p><h3>Is all Modern Browsers uses the same Engine ?</h3><p>No, Each Browser Development Team developed various Rendering and Scripting Engine. Below are the Layout and Scripting engines which is used by modern browsers.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fairtable.com%2Fembed%2FshrNXggq4gUVfcBuA&amp;url=https%3A%2F%2Fairtable.com%2FshrNXggq4gUVfcBuA&amp;image=https%3A%2F%2Fstatic.airtable.com%2Fimages%2Foembed%2Fairtable.png&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=airtable" width="800" height="533" frameborder="0" scrolling="no"><a href="https://medium.com/media/623064f074162ed44bc3d7f3e0c1a517/href">https://medium.com/media/623064f074162ed44bc3d7f3e0c1a517/href</a></iframe><p>Yes, You are done and you are in the last lines of this Article but this is not end of this Story and there is few more parts soon, stay tuned !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b733e9f3c0e6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GitHub Templates]]></title>
            <link>https://medium.com/@ramsunvtech/github-templates-f9223da738a4?source=rss-c5136b83d20f------2</link>
            <guid isPermaLink="false">https://medium.com/p/f9223da738a4</guid>
            <category><![CDATA[creating-templates]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Venkat.R]]></dc:creator>
            <pubDate>Wed, 10 May 2017 07:37:44 GMT</pubDate>
            <atom:updated>2017-05-10T15:38:03.398Z</atom:updated>
            <content:encoded><![CDATA[<p>In Today’s Web Development World, Git is everlasting and powerful SCM (<a href="https://en.wikipedia.org/wiki/Version_control">Source Control Management</a>). <a href="https://github.com">GitHub</a>, which is Web based Git SCM Provider online. This Guy play a important role in all open sourced projects where you can see 95% of projects are available in the <a href="https://github.com">GitHub</a>.</p><p><a href="https://github.com">GitHub</a> is evident for contributors count soared for Open source Projects. Important to note that all Internet Giants like <a href="https://github.com/facebook">Facebook</a>, <a href="https://github.com/google">Google</a> and <a href="https://github.com/microsoft">Microsoft</a> are created their own organization and published their projects. Lets come to the point, Here we gonna discuss about GitHub Templates.</p><h3>Why do we need Templates?</h3><ol><li>GitHub introduces templates for their web forms (Issues, Pull Request etc), which can configure inputs to be pre-filled with data which will help maintainers to set up <a href="https://en.wikipedia.org/wiki/Questionnaire">questionnaire</a><strong> </strong>and help contributors to do their part bit fast.</li><li>It’s hard and tough to solve a problem when important details are missing in <a href="https://en.wikipedia.org/wiki/Distributed_version_control#Pull_requests">Pull Request</a> or in Issues by the Contributors. Both are Web forms in GitHub where you can submit without description like below which cause contributions meaning less.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IrA43ipfi_pylAY9wDf2Fw.png" /><figcaption>Bad Request — Pull Request with Empty Description</figcaption></figure><p>Let’s talk about the above <strong>Pull Request</strong> where Title and commit Message says <strong>Header Changes, </strong>It’s hard to fathom this code change by <strong>Reviewers</strong>. It may be great contribution but reviewers will become dumber and these kinds of code will give rough idea which is at high risk. It may introduce new defects because they are not very clear about the current and new behavior.</p><h3>How about with description, Lets have a look!</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9qlzbOWNZYGXXyI4ux-4Sw.png" /><figcaption>Pull Request with Description</figcaption></figure><p>Above one is good and descriptive which can be understand by targeted people but still cannot be understand by our Non Techies like <a href="https://en.wikipedia.org/wiki/Scrum_(software_development)#Scrum_Master">Scrum Masters</a>, <a href="https://en.wikipedia.org/wiki/Scrum_(software_development)#Management">Project Managers</a>, <a href="https://en.wikipedia.org/wiki/Scrum_(software_development)#Product_Owner">Product Owners</a> etc, that’s not our problem but our goal is to value the contributions and issue request which will reviewed and merged super fast than as-usual.</p><h3>So GitHub Templates Solve this problem?</h3><p>Yes. GitHub Templates helps to configure your Templates which will help to configure <a href="https://en.wikipedia.org/wiki/Questionnaire">questionnaire</a>. Now maintainers can add templates but make sure your template file names are having right conventions. below is example for ISSUE Template.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mgwHQ1NOGi8NR69GOil4RA.png" /><figcaption>GitHub Tempaltes — <a href="https://github.com/blog/2111-issue-and-pull-request-templates">https://github.com/blog/2111-issue-and-pull-request-templates</a></figcaption></figure><p>Its always good to categorize your request which may be Pull Request or Issue. Please follow the <strong>Things you should know</strong> section for few more templates in various use cases provided by <a href="https://github.com">GitHub</a>.</p><h3>Things you should know.</h3><ol><li>Add PULL_REQUEST_TEMPLATE.md for Pull Request Template.</li><li>Add Issue_TEMPLATE.md for Issue Template.</li><li>Add CONTRIBUTING.md for Contribution Guidelines.</li><li>Add CODE_OF_CONDUCT.md for Setting Coding Standard Guidelines.</li><li>Add LICENSE or LICENSE.txt for License.</li><li>You can keep it in the root directory or move all of them under directory called .github which is recently supported.</li><li>A file extension is optional, but <a href="https://en.wikipedia.org/wiki/Markdown">Markdown</a> files (.md) are supported.</li></ol><h3>You are done, check how it look like !</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/1*HXhhpOEIIfrIG5iaLJv4Cg.png" /><figcaption>GitHub — <a href="https://help.github.com/articles/creating-a-pull-request-template-for-your-repository/">https://help.github.com/articles/creating-a-pull-request-template-for-your-repository/</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/857/1*ZEV5veENVoubS2E9-2zhQw.png" /><figcaption>GitHub — <a href="https://help.github.com/articles/creating-an-issue-template-for-your-repository/">https://help.github.com/articles/creating-an-issue-template-for-your-repository/</a></figcaption></figure><p>Cool, Isn’t it !!</p><p>Happy Coding, Stay tuned for next one !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f9223da738a4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JS Promise (Part 2 - Q.js, When.js and RSVP.js)]]></title>
            <link>https://medium.com/@ramsunvtech/js-promise-part-2-q-js-when-js-and-rsvp-js-af596232525c?source=rss-c5136b83d20f------2</link>
            <guid isPermaLink="false">https://medium.com/p/af596232525c</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[promises]]></category>
            <dc:creator><![CDATA[Venkat.R]]></dc:creator>
            <pubDate>Mon, 05 Dec 2016 09:56:53 GMT</pubDate>
            <atom:updated>2018-06-14T10:40:02.830Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1u9ZMiL8mf4-RYP0md0nJA.jpeg" /><figcaption>Promise Libraries</figcaption></figure><p><a href="https://medium.com/@ramsunvtech/promises-of-promise-part-1-53f769245a53"><strong><em>&lt; Previous Article</em></strong><em> - JS Promise (Part 1 — Basics)</em></a></p><p>I would like to continue with an examination of <strong>JavaScript</strong> Promise API. Let’s have a look at <strong>Promise</strong> evolution by various libraries. below three libraries which we are going to explore on this article.</p><ol><li><a href="http://documentup.com/kriskowal/q/">Q.js</a> Library</li><li><a href="https://github.com/cujojs/when">When.js</a> Library</li><li><a href="https://github.com/tildeio/rsvp.js/">RSVP.js</a> Library</li></ol><h3>Using <a href="http://documentup.com/kriskowal/q">q.js</a></h3><p>The <a href="http://documentup.com/kriskowal/q">q.js</a> is best one for promise implementation by <a href="https://twitter.com/kriskowal">Kris Kowal</a>. It is more evident of promise evolution.</p><p>Lets have a look, What makes it special.</p><ul><li>It provides two ways to define the promise. one is very famous by Q.defer() and another one is Q.Promise().</li><li>The Q.defer() method is custom and flexible way to define promise like defining anywhere in the code likevar deferred = Q.defer(); and any time that can be resolved, rejected and notified (deferred.resolve, deferred.reject, deferred.notify).</li></ul><pre>&#39;use strict&#39;;</pre><pre>// Defined the deferred.<br>var deferred = Q.defer();</pre><pre>// Resolving with Value.<br>deferred.resolve(responseText);</pre><pre>// Reject with Error Message.<br>deferred.reject(new Error(&quot;Status code was 400&quot;));</pre><pre>// Notify during progress of promise.<br>deferred.notify(event.loaded / event.total);</pre><pre>// Return the Promise to be then-able<br>return deferred.promise;</pre><ul><li>The Q.Promise method helps to instantiate the Promise similar to native one.</li></ul><pre>// Using q.js Library.<br>  var promise = Q.Promise(function(resolve, reject, notify) {<br>    // succeed<br>    resolve(&#39;value&#39;);</pre><pre>    // or reject<br>    // reject(&#39;error&#39;);<br> });</pre><pre>// Native Promise.<br>var myPromise = new Promise(function (resolve, reject) {<br>  // Call resolve() method at the end of successful execution.</pre><pre>  // Call reject() method for your failure case.</pre><pre>});</pre><ul><li>There is third new parameter in Q.Promise() method called notify similarly third new callback in Q.then() called progressed.</li><li>Q.any is implemented like Promise.race It will return if any one of promise is get fulfilled in array of promises.</li></ul><pre>&#39;use strict&#39;;</pre><pre>Q.any(ArrayOfPromises)<br>.then(function (first) {<br>    // Any of the promises was fulfilled.<br>}, function (error) {<br>    // All of the promises were rejected.<br>});</pre><ul><li>.fail(func …) is implemented like Promise.catch. Its will catch the error which is thrown inside then method.</li></ul><pre>.then(onFulfillment, onRejection, onProgress)<br>.fail(function (error) {<br>    // We get here with either foo&#39;s error or bar&#39;s error<br>});</pre><ul><li>.done(func …) method will trigger at the end.</li></ul><p>That’s end of q.js library. below is the code for Basic, Serial and Parallel Samples.</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fcodepen.io%2Framsunvtech%2Fpen%2FQGQMrL%2F&amp;src=https%3A%2F%2Fcodepen.io%2Framsunvtech%2Fembed%2Fpreview%2FQGQMrL%3Fheight%3D600%26amp%3Bslug-hash%3DQGQMrL%26amp%3Bdefault-tabs%3Djs%2Cresult%26amp%3Bhost%3Dhttp%253A%252F%252Fcodepen.io%26amp%3Bembed-version%3D2&amp;type=text%2Fhtml&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/e37e4356b081f6610db23b54f1ebd14a/href">https://medium.com/media/e37e4356b081f6610db23b54f1ebd14a/href</a></iframe><h3>Using <a href="https://github.com/cujojs/when">When.js</a></h3><p>This library is very similar to q.js and there is not much special things to mention other than Utility methods. It’s a stand-alone components of <a href="http://cujojs.com/">cujoJS</a> (<em>cujoJS is an architectural toolkit for building modular, maintainable web applications with zero framework lock-in</em>).</p><blockquote>Important to make a note, its been used by <a href="https://github.com/systemjs/systemjs">SystemJS</a> Library (<em>Universal dynamic module loader — loads ES6 modules, AMD, CommonJS</em>).</blockquote><p>Now its very easy to explain the similar methods rather having code pen.</p><pre>// When.js Example.<br>var promise = when.promise(function(resolve, reject, notify) {<br>    // Do some work, possibly asynchronously, and then<br>    // resolve or reject.<br><br>    // DEPRECATED: You can notify of progress events<br>    // along the way if you want/need.<br><br>    resolve(awesomeResult);<br>    // or resolve(anotherPromise);<br>    // or reject(nastyError);<br>});</pre><pre>// Then-able Method<br>promise<br>.delay(1000) // delay for 1 seconds.<br>.then(function() {<br>    throw new CustomError(&#39;oops!&#39;);<br>})<br>.catch(CustomError, function(e) {<br>    // Only catch CustomError instances<br>    // all other types of errors will propagate automatically<br>})<br>.catch(function(e) {<br>    // Catch other errors<br>})</pre><p>Below is the when.js library source code defined public API. It helps to get fair idea about useful methods in when.js</p><pre>// Few portion of when.js source code.</pre><pre>// Create a pending promise<br>when.promise = promise;</pre><pre>// Create a resolved promise<br>when.resolve = Promise.resolve;</pre><pre>// Create a rejected promise<br>when.reject = Promise.reject;</pre><pre>// lift a function to return promises<br>when.lift = lift;</pre><pre>// call a function and return a promise<br>when[&#39;try&#39;] = attempt;</pre><pre>// alias for when.try<br>when.attempt = attempt;</pre><pre>// Join 2 or more promises<br>when.join = join;</pre><pre>// Resolve a list of promises<br>when.all = all;</pre><pre>// Settle a list of promises<br>when.settle = settle;</pre><pre>// One-winner race<br>when.any = lift(Promise.any);</pre><pre>// Multi-winner race<br>when.some = lift(Promise.some);</pre><pre>// First-to-settle race<br>when.race = lift(Promise.race);</pre><pre>// Array.map() for promises<br>when.map = map;</pre><pre>// Array.filter() for promises<br>when.filter = filter;</pre><pre>// Array.reduce() for promises<br>when.reduce = lift(Promise.reduce);</pre><pre>// Array.reduceRight() for promises<br>when.reduceRight = lift(Promise.reduceRight);</pre><pre>// Is something promise-like, aka thenable<br>when.isPromiseLike = isPromiseLike;</pre><pre>// Promise constructor<br>when.Promise = Promise;</pre><pre>// Create a {promise, resolve, reject} tuple<br>when.defer = defer;</pre><p>If you want to go through the when.js source code. click <a href="https://github.com/cujojs/when/blob/master/when.js#L31">here</a></p><h3>Using <a href="https://github.com/tildeio/rsvp.js/">RSVP.js</a></h3><p>It’s a lightweight library that provides tools for organising asynchronous code and tiny implementation of <a href="https://promisesaplus.com/">Promises/A+</a> as ES6 compliant and compatible with <a href="http://taskjs.org/">Task.js</a> (experimental library for ES6 using Generators).</p><p>Lets have a look at the difference comparing with Native Promise API.</p><ul><li>There is no Rejection Callback in then Method and it has only one parameter which is onFulfillment. The .catch() Method can be used to get the exceptions and rejections.</li></ul><pre>// Instantiation of RSVP Promise.<br>var rsvpPromise = new RSVP.Promise(function(resolve, reject) {<br>  // succeed<br>  resolve(value);<br>  // or reject<br>  reject(error);<br>});</pre><pre>// Then-able for Fulfillment and Catch is for Rejection.<br>rsvpPromise.then(function(value) {<br>  // success<br>}).catch(function(error) {<br>  // failure<br>});</pre><ul><li>There is no .race method Available (but .all is available for array of promise objects).</li><li>RSVP.hash() is for Objects properties values as Promises.</li><li>There is .finally() Method is available to execute at End.</li></ul><pre>// Object Properties of Promise.<br>var promises = {<br>  &quot;continent&quot;: getJSON(&quot;http:///...<a href="https://gist.githubusercontent.com/ramsunvtech/5ed84fe5fdc3c90ff50c708e213ac86f/raw/6429b20aceb3904a63fd7add16382c4fcaf47fb8/continent.json">continent.json</a>&quot;),<br>  &quot;asia&quot;: getJSON(&quot;http:///...<a href="https://gist.githubusercontent.com/ramsunvtech/bcbf0f2770bd9908381de4421db0bd81/raw/965b819b57ce64a049528e3d860c7299eb93d3f1/asia.json">asia.json</a>&quot;),<br>  &quot;india&quot;: getJSON(&quot;http:///...<a href="https://gist.githubusercontent.com/ramsunvtech/694b7fd273ce50e7ba346f467a0b5261/raw/da763f3170e0e0f05e349c79a501e332b213006e/india.json">india.json</a>&quot;)<br>};</pre><pre>RSVP.hash(promises).then(function(response) {<br>  // posts contains an array of results for the given promises<br>  console.log(response.continent);<br>  console.log(response.asia);<br>  console.log(response.india);<br>})<br>.catch(function(reason) {<br>  // if any of the promises fails.<br>})<br>.finally(function() {<br>  console.log(&#39;The End !&#39;)<br>});</pre><ul><li>Custom Error events are available to invoke an Error. example: RSVP.on(‘error’).</li><li>You can listen to various events like created, chained, fulfilled, rejected like RSVP.on(‘created’, listener); that can be called for every Promise events.</li></ul><pre>// events<br>RSVP.on(&#39;created&#39;, listener);<br>RSVP.on(&#39;chained&#39;, listener);<br>RSVP.on(&#39;fulfilled&#39;, listener);<br>RSVP.on(&#39;rejected&#39;, listener);</pre><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Framsunvtech%2Fembed%2Fpreview%2FjrRWOy%3Fheight%3D600%26amp%3Bslug-hash%3DjrRWOy%26amp%3Bdefault-tabs%3Djs%2Cresult%26amp%3Bhost%3Dhttp%253A%252F%252Fcodepen.io%26amp%3Bembed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Framsunvtech%2Fpen%2FjrRWOy%2F&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F474025.jrRWOy.small.1163aa71-789d-4c55-94d8-4e75a910cf65.png&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/28c4822d5e9f41410346b55082651ef1/href">https://medium.com/media/28c4822d5e9f41410346b55082651ef1/href</a></iframe><p>So Quick, We are in the footer of this article. Last but not least. Have a look at HTML attribute defer for similar treatment.</p><h3>HTML5 defer attribute</h3><p>The defer attribute is something similar to promise for running your element after page load completes. It’s supported only for <em>&lt;script&gt;</em> element. soon we can expect for elements like img etc.</p><pre>&lt;script src=&quot;demo_defer.js&quot; defer&gt;&lt;/script&gt;</pre><blockquote><strong>W3C Says</strong>, When set, this boolean attribute provides a hint to the user agent that the script is not going to generate any document content (e.g., no “document.write” in javascript) and thus, the user agent can continue parsing and rendering.</blockquote><p>Happy Reading, Stay tuned for my next article on jQuery and Angular Promise Implementation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=af596232525c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JS Promise (Part 1 - Basics)]]></title>
            <link>https://medium.com/@ramsunvtech/promises-of-promise-part-1-53f769245a53?source=rss-c5136b83d20f------2</link>
            <guid isPermaLink="false">https://medium.com/p/53f769245a53</guid>
            <category><![CDATA[promises]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[es6]]></category>
            <dc:creator><![CDATA[Venkat.R]]></dc:creator>
            <pubDate>Thu, 20 Oct 2016 20:07:24 GMT</pubDate>
            <atom:updated>2016-12-15T03:27:18.134Z</atom:updated>
            <content:encoded><![CDATA[<p>One of the good Features in ES6 is <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"><strong>Promises Object</strong></a> and their useful <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise#Methods"><strong>methods</strong></a> and they<strong> </strong>are called software abstraction helps to works smoothly with asynchronous operations. <strong>Promise</strong> API followed <a href="https://promisesaplus.com"><strong>Promises/A+</strong></a> Specification prior to this, there was <a href="http://wiki.commonjs.org/wiki/Promises/A"><strong>Promise/A</strong></a><strong>.</strong></p><h3>What is Promises/A and Promises/A+ ?</h3><ol><li>Both are specification for open standard but Javascript currently uses <strong>Promise/A+</strong>.</li><li>The main three reason for using <strong>Promise/A+</strong> is <strong>Three</strong> different states, <strong>Value</strong> for Fulfilment and for Rejection and <strong>thenable</strong> object. for more detail see <a href="https://promisesaplus.com/differences-from-promises-a">Differences from Promises/A</a></li><li>These <strong>Promise/A+</strong> organisation occasionally revise and address the corner cases in to new Specification.</li></ol><h3>Difference between Promise/A and /A+?</h3><ol><li>Rejection / Fulfilment method returns <strong>thenable</strong> object.</li><li>Rejection triggers catch method, if errors thrown.</li></ol><p>In short, running continuation-passing style. Let me shoot few bullets with simple diagram on <strong>Promises</strong> below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*g1EZpcctuSoa6Jcwp68SUQ.png" /><figcaption>Promise API Flow (Image Credits to MDN — <strong>Mozilla Developer Network)</strong></figcaption></figure><ol><li>It’s a placeholder for the eventual results of a deferred (and possibly asynchronous) computation.</li><li>It’s defined as an Object used for future result of an asynchronous computations.</li><li>It represent a single asynchronous operation and gives a proxy until you get an actual value.</li><li>Allows you to add handler to asynchronous of success or failure conditional actions.</li><li>Return a promise instead of final value.</li><li>It implements observer pattern (maintains a dependents and notifies them automatically of any state changes but can cause <a href="https://en.wikipedia.org/wiki/Memory_leak">memory leaks</a>, known as the <a href="https://en.wikipedia.org/wiki/Lapsed_listener_problem">lapsed listener problem</a>) and its chain-able.</li><li>It comes with integrated error handling and handles automatically fulfilled with value or reject with reason.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/854/1*G5CWw8sFK1leUVNGSEf-Ug.png" /><figcaption>Observer Pattern — Image Credit to Wikipedia</figcaption></figure><h3>Why Promises?</h3><ol><li>Promises mainly to solve <strong>Callback Hell </strong>(heavy nested callback code) and <a href="https://en.wikipedia.org/wiki/Pyramid_of_doom_(programming)">Pyramid of doom</a> Problem<strong>.</strong></li><li>Promises helps to group your asynchronous in a efficient way.</li><li>Javascript is not a new candidate for adapting Promises/A+ Specification. its been already included by other famous programming languages like Java (<a href="https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Future.html">sample</a>), Scala (<a href="http://docs.scala-lang.org/overviews/core/futures.html">sample</a>), Python (<a href="https://pypi.python.org/pypi/promise">sample</a>) and Clojure (<a href="https://clojuredocs.org/clojure.core/future">sample</a>).</li></ol><h3>Promise States</h3><p>There are three states which are below.</p><ol><li><strong>pending</strong>: Initial Case where promise instantiated.</li><li><strong>fulfilled</strong>: Success Case which means promise resolved.</li><li><strong>rejected</strong>: Failure Case which means promise rejected.</li></ol><h3>Promise Methods</h3><p>There are six methods which are below.</p><ol><li>Promise.all(<em>[promise1, promise2, …]</em>);</li><li>Promise.race(<em>[promise1, promise2, …]</em>);</li><li>Promise.reject(value);</li><li>Promise.resolve(value);</li><li>Promise.catch(onRejection);</li><li>Promise.then(onFulFillment, onRejection);</li></ol><h3>Promise Iterable Methods</h3><p>Below are the two Methods which accepts array of promises objects.</p><pre>&#39;use strict&#39;;</pre><pre>// All method<br>// Trigger `catch` Method, if any one promise rejected.<br>// Trigger `then` Method, once every promise fulfilled.</pre><pre>Promise.<strong>all</strong>([<strong>promise1</strong>, <strong>promise2</strong>]);</pre><pre>// Race method<br>// Trigger `catch` Method, if any one promise rejected.<br>// Trigger `then` Method, if any one promise fulfilled.</pre><pre>Promise.<strong>race</strong>([<strong>promise1</strong>, <strong>promise2</strong>]);</pre><h3>What is executor function ?</h3><ol><li>Executor Functions are Parameter for Promise Constructor which holds Resolve and Reject Callbacks.</li><li>It is executed immediately by the Promise implementation which provides the resolve and reject functions.</li><li>It’s Triggered before the Promise constructor even returns the created object.</li><li>The Resolve and Reject functions are bound to the promise to fulfill or reject.</li><li>It’s expected to initiate some asynchronous work and then, once that completes, call either the resolve or reject.</li></ol><h3>What is the value of Promise.length?</h3><p>It will be always one (1) due to number of constructor arguments.</p><h3>Are You Tired with above Theories?</h3><h3>No Worries. Lets see quick and interesting questions with solutions from simple to advanced level !</h3><h3>How to create / instantiate the Promise?</h3><p>Below is the Code Snippet for Simple Promise Instantiation.</p><pre>&#39;use strict&#39;;</pre><pre>// ES5<br>var myPromise = new Promise(function (resolve, reject) {<br>    // Your Code which you are unsure about execution time duration.</pre><pre>    // Call resolve() method at the end of successful execution.</pre><pre>    // Call reject() method for your failure case.</pre><pre>    // Catch method will be called automatically, if any error occurs.<br>});</pre><pre>// ES6, Example with Arrow Functions</pre><pre>var myPromise = new Promise((resolve, reject) =&gt; { ... })</pre><h3>How Promise methods can be overridden ?</h3><p>Below are the two methods can be prototyped (overridden).<br>1. Promise.prototype.catch();<br>2. Promise.prototype.then();</p><h3>How to do error handling in Promise ?</h3><p>There are two possible ways to handle errors in <strong>Promise</strong>. Defining <strong>then</strong> method with second parameter which is onRejection callback or defining <strong>catch</strong> method.</p><pre>&#39;use strict&#39;;</pre><pre>// First Approach</pre><pre>yourPromise.catch(function (error) {<br> // Your Error Callback<br>});</pre><pre>// Second Approach</pre><pre>yourPromise.then(undefined, function (error) {<br> // Your Error Callback<br>});</pre><h3>How to detect whether Promise rejected ?</h3><p>Promise triggers <strong>.catch</strong> or onRejection callback of <strong>.then</strong> method depends upon the precedence of definition.</p><pre>&#39;use strict&#39;;</pre><pre>Promise.catch(onRejected);<br>Promise.then(onFulfilled, onRejected);</pre><h3>How to combine multiple Promises in to one ?</h3><p>Use `<strong>Promise</strong>.<strong>all</strong>` Method which combines multiple promise in to one.</p><pre>&#39;use strict&#39;;</pre><pre>// Usage</pre><pre>Promise.all([Promise1, Promise2, …]).then(onFulfilled, onRejected);</pre><pre>// Example</pre><pre>var promiseCall = function (waitSecond, returnData) {<br>    return function (resolve, reject) {<br>        setTimeout(resolve, waitSecond, returnData);<br>    };<br>};</pre><pre>var p1 = new Promise(promiseCall(1000, &quot;one&quot;));<br>var p2 = new Promise(promiseCall(2000, &quot;two&quot;));<br>var p3 = new Promise(promiseCall(3000, &quot;three&quot;));<br>var p4 = new Promise(promiseCall(4000, &quot;four&quot;));<br>var p5 = new Promise(function (resolve, reject) {<br>    reject(&#39;5th Promise Rejected&#39;);<br>});</pre><pre><strong>// Calling </strong>Promise 1 - 4 in<strong> Promise.all()<br></strong>Promise.all([p1, p2, p3, p4]).then(function (value) {<br>    console.log(value);<br>}, function (reason) {<br>    // Not Called<br>    console.log(reason);<br>});</pre><pre>// Expected Output: [&quot;one&quot;, &quot;two&quot;, &quot;three&quot;, &quot;four&quot;]</pre><pre><strong>// Calling </strong>Promise 1 - 5 in<strong> Promise.all()<br></strong>Promise.all([p1, p2, p3, p4, p5]).then(function (value) {<br>    // Not Called<br>    console.log(value);<br>}, function (reason) {<br>    console.log(reason);<br>});</pre><pre>// Trigger Rejection (Second) Callback if any one is rejected.<br>// Expected Output: 5th Promise Rejected</pre><h3>What is Promise Racing ?</h3><p>As everyone aware, Racing is competition of speed. Same thing applies to Promise API. Use `<strong>Promise</strong>.<strong>race</strong>` Method which can help to evaluate which is fast</p><pre>&#39;use strict&#39;;</pre><pre>var p1 = new Promise(function(resolve, reject) { <br>    setTimeout(resolve, 500, &quot;one&quot;); <br>});<br>var p2 = new Promise(function(resolve, reject) { <br>    setTimeout(resolve, 100, &quot;two&quot;); <br>});<br><br>Promise.race([p1, p2]).then(function(value) {<br>  console.log(value); // &quot;two&quot;<br>  // Both resolve, but p2 is faster<br>});</pre><h3>What Promise.all() return for invalid parameter ?</h3><p>Promise.<strong>all</strong> method accept array of objects which is promises in nature. Let’s see How promise.all behaves for various invalid parameters.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Framsunvtech%2Fembed%2Fpreview%2FvKwLqV%3Fheight%3D600%26amp%3Bslug-hash%3DvKwLqV%26amp%3Bdefault-tabs%3Djs%2Cresult%26amp%3Bhost%3Dhttp%253A%252F%252Fcodepen.io%26amp%3Bembed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Framsunvtech%2Fpen%2FvKwLqV%2F&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fm.cdpn.io%2Fscreenshot-coming-soon-small.png&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/6e8ec447016cd504c5c5e933d5648dc3/href">https://medium.com/media/6e8ec447016cd504c5c5e933d5648dc3/href</a></iframe><h3>Why not Promise.race() with invalid parameter ?</h3><p><strong>Promise</strong>.<strong>race</strong> method also similar to all method accept array of objects. Let’s see How promise.race behaves for various invalid parameters.</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fcodepen.io%2Framsunvtech%2Fpen%2FvKwRQy%2F&amp;src=https%3A%2F%2Fcodepen.io%2Framsunvtech%2Fembed%2Fpreview%2FvKwRQy%3Fheight%3D600%26amp%3Bslug-hash%3DvKwRQy%26amp%3Bdefault-tabs%3Djs%2Cresult%26amp%3Bhost%3Dhttp%253A%252F%252Fcodepen.io%26amp%3Bembed-version%3D2&amp;type=text%2Fhtml&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/e032363a2f47a73e9b9e1731ce3ccd49/href">https://medium.com/media/e032363a2f47a73e9b9e1731ce3ccd49/href</a></iframe><h3>What’s the main difference between callback-based functions and promise-based functions ?</h3><ol><li>You don’t have to write error conditions `<em>if (err) return callback(err)</em>`.</li><li>Callback need to be invoked the right callback immediately whereas Promise can be return as promise object and invoke later.</li><li>In Promise, Anytime, When `<em>.</em><strong><em>then</em></strong><em>()</em>` method returned a promise and can be “<strong>unpacked</strong>” it to get to an actual value.</li><li>In Callback, We must explicitly handle the error and we can’t deal with that error there.</li><li>In Callback, We must call the passed callback to pass that error.</li></ol><p>In short, Promise is better than callback for future asynchronous operation.</p><h3>How many ways to resolve the Promise ?</h3><p>There are two ways, with and without instantiation.</p><pre>var responseValue = ‘Success’;</pre><pre>// First Approach<br>var directPromiseValue = Promise.resolve(responseValue);</pre><pre>// Second Approach<br>var instantiatePromise = new Promise(function (resolve) {<br> resolve(value);<br>});</pre><h3>How to resolve with hard-coded value to Promise?</h3><p>Sometimes, you will have a value already in place and you want to convert that into a true Promise. <strong>Promise.resolve()</strong> Call should be right choice.</p><pre>var directPromiseValue = Promise.resolve(&#39;Success&#39;);</pre><h3>How to reject with hard-coded value to Promise?</h3><p>Same here for error. Use <strong>Promise.reject()</strong> Call.</p><pre>var directPromiseValue = Promise.reject(&#39;Custom Error Object&#39;);</pre><p>Yes, You are done and you are in the last lines of this Article but this is not end of Promise Story and there is few more parts soon, stay tuned !</p><p>Wait is over, Have a look at next Article, <a href="https://medium.com/@ramsunvtech/js-promise-part-2-q-js-when-js-and-rsvp-js-af596232525c#.dzlqh6ski">Part 2 — Q.js, When.js and RSVP.js</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=53f769245a53" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Manage Multiple Node Versions]]></title>
            <link>https://medium.com/@ramsunvtech/manage-multiple-node-versions-e3245d5ede44?source=rss-c5136b83d20f------2</link>
            <guid isPermaLink="false">https://medium.com/p/e3245d5ede44</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[node]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Venkat.R]]></dc:creator>
            <pubDate>Thu, 29 Sep 2016 09:55:39 GMT</pubDate>
            <atom:updated>2018-06-14T10:40:52.432Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LYtWzS4B0TkwLkJKOuP46Q.jpeg" /></figure><p>Node.js is a wonderful runtime environment of the decade. When come to managing different versions of Node in same machine for different application will make your life horrible.</p><p>Don’t worry, That’s not the end of the story. This article helps on how to overcome and solve this problem with right tools. In short `<strong>nvm</strong>` and `<strong>apn</strong>` or `<strong>n</strong>` and `<strong>apn</strong>` node module is my proposal to solve this issue.</p><h4>Installing Node Version Manager</h4><p>Node Version Manager alias <strong>NVM</strong> is Node Module which helps to maintain multiple node versions in a same machine to manage various versions.</p><pre>$ npm install -g nvm</pre><pre>or</pre><pre>$ npm install -g n</pre><p>`<strong>nvm</strong>` and `<strong>n</strong>` Node Module does not support windows. use below module.</p><pre>$ npm install -g nvm-windows</pre><h4>Setting Run Time Configuration</h4><p>The Run Time Configuration alias <strong>.nvmrc </strong>file which helps to read the version by `<strong>avn</strong>` Module and you will see below, what is `<strong>avn</strong>` module about.</p><pre>$ vi .nvmrc<br>v4.4.7</pre><h4>Installing Automatic Node Version Switching</h4><p>Automatic Node Version alias AVN is Node Module which helps to switch different version.</p><p>AVN provide `<strong>avn-nvm</strong>` and `<strong>avn-n</strong>` Module for NVM and N Module compatible from reading your NVM Runtime configuration file (<strong>.nvmrc)</strong>.</p><pre>$ npm install -g avn avn-nvm avn-n</pre><h4>AVN Updates Bash Profile</h4><p>AVN Module updates below code in `<strong>~/.bash_profile</strong>` after its got installed, open this file and make sure its updated and copy this line `<strong>~/.profile</strong>`.</p><pre>$ vi ~/.profile</pre><pre>[[ -s &quot;$HOME/.avn/bin/avn.sh&quot; ]] &amp;&amp; source &quot;$HOME/.avn/bin/avn.sh&quot; # load avn</pre><h4>Setting Automatic Node Version</h4><p>After move to your project directory and create `<strong>.nvmrc</strong>` file with node version. Set up AVN by using below command. This will update the `<strong>~/.avn</strong>` File.</p><pre>$ cd &lt;project_directory&gt;<br>$ avn setup</pre><h4>Evaluate Bash Profile</h4><p>Execute the `<strong>~/.profile</strong>` only once or do it if there any change. File to make AVN commands to be available globally to invoke the command during `<strong>cd &lt;directory&gt;</strong>`</p><pre>$ source ~/.profile</pre><h4>You are done!</h4><p>Yes, you are completed the steps to switch automatically from one version to another and manage different version node projects in same machine.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e3245d5ede44" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTML5: Storage APIs]]></title>
            <link>https://medium.com/@ramsunvtech/onfocus-html5-storage-apis-b45d92aa424b?source=rss-c5136b83d20f------2</link>
            <guid isPermaLink="false">https://medium.com/p/b45d92aa424b</guid>
            <category><![CDATA[storage]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[html5]]></category>
            <dc:creator><![CDATA[Venkat.R]]></dc:creator>
            <pubDate>Mon, 08 Aug 2016 11:51:17 GMT</pubDate>
            <atom:updated>2018-06-14T10:41:28.460Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fTt61hgOPBx3gjmeFi264w.jpeg" /></figure><p>When we talk about Storage, <strong>Database</strong> will strike our mind.</p><p>Oops, if its Browser Specific then one and only <strong>Cookies</strong> will flash our eyes who preserve data in browser. This Article wakes up the one who wanted to learn more about <strong>Storage API </strong>(Local and Session Storage).</p><h3><strong>Why we need to Store data in browser ?</strong></h3><p>The Good <strong>User interface</strong> is preserve user data without redundancy which means requesting for the same user data repeatedly from the user is not a good practice.</p><p><strong><em>Simple Example</em></strong>: Typical Search Page have keyword input, after user didn’t get proper result. Search result page should have entered keyword data to continue the search.</p><p>Basically centralize the data and make it available for all the pages on particular domain.</p><h3><strong>What wrong in Cookies to have Storage API?</strong></h3><p>There is nothing wrong in Cookies. <strong>Storage API</strong> introduced for different purpose, where cookies can be read by server-side, local storage can only be read by client-side.</p><h3>Storage API</h3><p><strong>Storage API</strong> is an Interface provide access to <strong>localStorage</strong> and <strong>sessionStorage</strong>. API introduced mainly to handle multiple transactions in different windows where cookies does it for single transactions.</p><p><strong>Below is the Storage API Interface.</strong></p><pre>interface Storage {<br>  readonly attribute unsigned long <a href="https://www.w3.org/TR/webstorage/#dom-storage-length">length</a>;<br>  DOMString? <a href="https://www.w3.org/TR/webstorage/#dom-storage-key">key</a>(unsigned long index);<br>  getter DOMString? <a href="https://www.w3.org/TR/webstorage/#dom-storage-getitem">getItem</a>(DOMString key);<br>  setter void <a href="https://www.w3.org/TR/webstorage/#dom-storage-setitem">setItem</a>(DOMString key, DOMString value);<br>  deleter void <a href="https://www.w3.org/TR/webstorage/#dom-storage-removeitem">removeItem</a>(DOMString key);<br>  void <a href="https://www.w3.org/TR/webstorage/#dom-storage-clear">clear</a>();<br>};</pre><p><strong>What is lifetime of Storage?<br></strong>There is no option to set expiration time. <strong>removeItem</strong> and <strong>clear</strong> Methods are available for removing the attributes.</p><p><strong>session storage</strong> data gets cleared when the page session ends.</p><pre>// In Local Storage<br>localStorage.setItem(&#39;name&#39;, &#39;value&#39;);<br>localStorage.clear();</pre><pre>// In Session Storage<br>sessionStorage.setItem(&#39;name&#39;, &#39;value&#39;);<br>sessionStorage.removeItem(&#39;name&#39;);</pre><p><strong>Is Local Storage / Session Storage support prototyping?<br></strong>No, It is not supported. Both are <strong>Instance </strong>which is implemented from <strong>Storage API. </strong>so Storage API supports prototyping. Have a look at the below code snippet.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a8ac7c12683cca2267d536b016538029/href">https://medium.com/media/a8ac7c12683cca2267d536b016538029/href</a></iframe><p><strong>How to do exist check for localStorage / sessionStorage items?<br></strong>There is no native method to do exist check for localStorage/SessionStorage, where <strong>getItem</strong> return only null for non-exist items.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ad0c801f4ff725db22dabcc549fba3c4/href">https://medium.com/media/ad0c801f4ff725db22dabcc549fba3c4/href</a></iframe><p><strong>What is difference between local and session storage?<br></strong>localStorage data has no expiration set but sessionStorage gets cleared when the page closed (session ends).</p><p><strong>How to check the number of items in local / session storage?<br></strong>Only way is length property which is available in both objects. Take a look at below snippet.</p><pre>// In Local Storage<br>localStorage.setItem(&#39;name&#39;, &#39;value&#39;);<br>localStorage.length;</pre><pre>// In Session Storage<br>sessionStorage.setItem(&#39;name&#39;, &#39;value&#39;);<br>sessionStorage.length;</pre><p><strong>How to listen for changes?<br></strong>Methods available to listen for changes during storage method calls() like <strong>removeItem() and setItem(). </strong>There is one limitation is only listen to other tabs item changes.</p><pre>[Constructor(DOMString type, optional <a href="https://www.w3.org/TR/webstorage/#storageeventinit">StorageEventInit</a> eventInitDict)]<br>interface StorageEvent : Event {<br>  readonly attribute DOMString? <a href="https://www.w3.org/TR/webstorage/#dom-storageevent-key">key</a>;<br>  readonly attribute DOMString? <a href="https://www.w3.org/TR/webstorage/#dom-storageevent-oldvalue">oldValue</a>;<br>  readonly attribute DOMString? <a href="https://www.w3.org/TR/webstorage/#dom-storageevent-newvalue">newValue</a>;<br>  readonly attribute DOMString <a href="https://www.w3.org/TR/webstorage/#dom-storageevent-url">url</a>;<br>  readonly attribute <a href="https://www.w3.org/TR/webstorage/#storage-0">Storage</a>? <a href="https://www.w3.org/TR/webstorage/#dom-storageevent-storagearea">storageArea</a>;<br>};<br><br>dictionary StorageEventInit : EventInit {<br>  DOMString? key;<br>  DOMString? oldValue;<br>  DOMString? newValue;<br>  DOMString url;<br>  <a href="https://www.w3.org/TR/webstorage/#storage-0">Storage</a>? storageArea;<br>};</pre><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fcodepen.io%2Framsunvtech%2Fpen%2FZOmLOB%2F&amp;src=https%3A%2F%2Fcodepen.io%2Framsunvtech%2Fembed%2Fpreview%2FZOmLOB%3Fheight%3D600%26amp%3Bslug-hash%3DZOmLOB%26amp%3Bdefault-tabs%3Djs%2Cresult%26amp%3Bhost%3Dhttp%253A%252F%252Fcodepen.io%26amp%3Bembed-version%3D2&amp;type=text%2Fhtml&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/bc71987d37472e3022cab5d9413b1965/href">https://medium.com/media/bc71987d37472e3022cab5d9413b1965/href</a></iframe><p><strong>What is the disk space limit?<br></strong>Disk space is browser specific.<br><strong>Mobile Browser</strong>: (Chrome: 10MB, Android: 2MB, Firefox: 10MB, IOS Safari: 5MB)<br><strong>Desktop Browser</strong>: (Chrome: 10MB, Opera: 10MB, Firefox: 10MB, Safari: 5MB, IE: 10MB)</p><p><strong>How to see existing Storage items in Run Time ?<br></strong>There is no native method to see all but combination of existing property <strong>length </strong>and methods of <strong>key and getItem.</strong> Take a look at the below code snippet.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1d3d4ddbbad976e0397505c3ed1eebee/href">https://medium.com/media/1d3d4ddbbad976e0397505c3ed1eebee/href</a></iframe><p><strong>How to check Storage Support in browser?<br></strong>There is many ways to check. Have a look at the below code snippet.</p><pre>(typeof(Storage) !== &quot;undefined&quot;);<br>(typeof(localStorage) !== &quot;undefined&quot;);<br>(typeof(sessionStorage) !== &quot;undefined&quot;);</pre><pre>(typeof(window.Storage) !== &quot;undefined&quot;);<br>(typeof(window.localStorage) !== &quot;undefined&quot;);<br>(typeof(window.sessionStorage) !== &quot;undefined&quot;);</pre><p><strong>Disadvantages of Storage / LocalStorage ?</strong><br>1. It stores on hard drive.<br>2. localStorage is synchronous in nature, meaning when it loads it can block the main document from rendering.<br>3. localStorage is persistent. Not using a service or never visit a web site again, the data is still loaded when its browser started every time.<br><strong>Source: </strong><a href="https://hacks.mozilla.org/2012/03/there-is-no-simple-solution-for-local-storage/">https://hacks.mozilla.org/2012/03/there-is-no-simple-solution-for-local-storage/</a></p><p>Happy Reading, Have a look at the below Articles where <em>I </em>have taken Reference:</p><p><a href="https://www.w3.org/TR/webstorage/#the-storageevent-interface">https://www.w3.org/TR/webstorage/#the-storageevent-interface</a><br><a href="https://developer.mozilla.org/en-US/docs/Web/API/Storage">https://developer.mozilla.org/en-US/docs/Web/API/Storage</a><br><a href="https://www.sitepoint.com/html5-local-storage-revisited/">https://www.sitepoint.com/html5-local-storage-revisited/</a><br><a href="https://html.spec.whatwg.org/multipage/webstorage.html">https://html.spec.whatwg.org/multipage/webstorage.html</a><br><a href="http://html5demos.com/storage-events">http://html5demos.com/storage-events</a></p><p><strong>Interesting Question which you wanted to aware and answer:<br></strong><a href="http://stackoverflow.com/questions/2989284/what-is-the-max-size-of-localstorage-values">stackoverflow.com/questions/2989284/what-is-the-max-size-of-localstorage-values</a><br><a href="http://stackoverflow.com/questions/3220660/local-storage-vs-cookies">stackoverflow.com/questions/3220660/local-storage-vs-cookies</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b45d92aa424b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>