<?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 Parul Malhotra on Medium]]></title>
        <description><![CDATA[Stories by Parul Malhotra on Medium]]></description>
        <link>https://medium.com/@parulm.business?source=rss-b996c8a29c67------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*HTxkBoypOMg2Cf8OAaEQJA@2x.jpeg</url>
            <title>Stories by Parul Malhotra on Medium</title>
            <link>https://medium.com/@parulm.business?source=rss-b996c8a29c67------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 14:01:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@parulm.business/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[How To Add Two Very Large Numbers in Javascript?]]></title>
            <link>https://levelup.gitconnected.com/how-to-add-two-very-large-numbers-in-javascript-6305ed8c5fad?source=rss-b996c8a29c67------2</link>
            <guid isPermaLink="false">https://medium.com/p/6305ed8c5fad</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Parul Malhotra]]></dc:creator>
            <pubDate>Mon, 30 Aug 2021 01:09:55 GMT</pubDate>
            <atom:updated>2021-08-30T09:00:11.967Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wylqI_uRYTmwbeFLNuyrLw.jpeg" /><figcaption>Image Credits: <strong>Unsplash</strong></figcaption></figure><p>Let us dissect a really popular <strong>algorithmic challenge</strong>, <em>Calculating the Sum of Two Very Large Numbers in Javascript</em>.</p><p>Traditionally, Javascript numbers are safe to use up to 53 bits. If you really would like to know more details, you can check my <a href="https://medium.com/better-programming/why-is-0-1-0-2-not-equal-to-0-3-in-most-programming-languages-99432310d476">last article</a> which talks about the concept of floating point numbers in Javascript.</p><h3><strong>Problem at hand</strong></h3><blockquote><em>Create an Algorithm which contains a function that takes in any two numbers but in the form of strings, and returns the sum as a string.</em></blockquote><blockquote><em>This function will be used for adding very large numbers in Javascript. The need for this program arises because you cannot store more than 53 bits as a number in pure javascript.</em></blockquote><blockquote><em>In order to perform operations on larger numbers, we convert them into strings and then perform operations on them.</em></blockquote><h3><strong>Step by Step Solution</strong></h3><p>Pseudocode for the problem goes like this:</p><figure><img alt="Pseudocode for the problem" src="https://cdn-images-1.medium.com/max/1024/1*anU1Y3rDo9FrUKnbNiR2zg.png" /><figcaption>Pseudocode</figcaption></figure><p>Let’s break this down step by step —</p><h3>Initialising two very large numbers</h3><p>Let’s say : first = “893427328497983427893248932498034289324” and second = “234859234879342897893427893274”.</p><h3>Calculating the length of both the variables</h3><p>The longer number should be the first number to be passed as a parameter to the function call as larger number should be on top during addition. In case first number is smaller, I am swapping the parameters in the function call.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4f9a45749f30523c0f31197f21a90320/href">https://medium.com/media/4f9a45749f30523c0f31197f21a90320/href</a></iframe><h3>Convert rightmost bits to numbers and add them</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d3fef63f38258fb3c77dc52506741992/href">https://medium.com/media/d3fef63f38258fb3c77dc52506741992/href</a></iframe><p>Here, <strong>diff</strong> represent the different in the length of the two variables. We are using it to reference the correct i-th element and add them. Variable <strong>temp </strong>is calculated by converting the character at the i-th position and doing modulus of 10 to get the remainder. We add the two elements from <strong>first</strong> and <strong>second</strong> variable and add <strong>carry</strong> variable to it, if any.</p><h3>Create a sum variable of type string</h3><p><strong>var sum = “”;</strong></p><p>This variable, <strong>sum</strong> is going to store the result of the summation for us.</p><h3>Store the sum’s right most bit in “sum” variable</h3><p>While performing the summation, we shall store the rightmost bits in <strong>sum</strong> variable and leftmost bits in <strong>carry </strong>variable, just like we do it in general.</p><h3>Run the loop for the entire length</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/772d6a2a09c3747d8cd807b05e68c6ae/href">https://medium.com/media/772d6a2a09c3747d8cd807b05e68c6ae/href</a></iframe><p>We keep adding the right most bits. Store them in temp variable. If it is greater than equal to 10, we take a modulus of 10 on it and store the result in sum. We keep the quotient in carry.</p><h3>For the last iteration, add the carry to sum only</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bb226256ad89c76f0f2ca2084f2dae77/href">https://medium.com/media/bb226256ad89c76f0f2ca2084f2dae77/href</a></iframe><p>In the end, we return the <strong>sum</strong> variable which now holds the summed up value of these two digits.</p><p>Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6305ed8c5fad" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/how-to-add-two-very-large-numbers-in-javascript-6305ed8c5fad">How To Add Two Very Large Numbers in Javascript?</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automating Transactional Emails Using SendGrid API and AWS Lambda]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/better-programming/automating-transactional-emails-using-sendgrid-api-and-aws-lambda-58aaf781e09f?source=rss-b996c8a29c67------2"><img src="https://cdn-images-1.medium.com/max/1640/1*PVadwJk8-MiUhUH9VVu6sA.png" width="1640"></a></p><p class="medium-feed-snippet">And getting more of your time back</p><p class="medium-feed-link"><a href="https://medium.com/better-programming/automating-transactional-emails-using-sendgrid-api-and-aws-lambda-58aaf781e09f?source=rss-b996c8a29c67------2">Continue reading on Better Programming »</a></p></div>]]></description>
            <link>https://medium.com/better-programming/automating-transactional-emails-using-sendgrid-api-and-aws-lambda-58aaf781e09f?source=rss-b996c8a29c67------2</link>
            <guid isPermaLink="false">https://medium.com/p/58aaf781e09f</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Parul Malhotra]]></dc:creator>
            <pubDate>Fri, 27 Aug 2021 13:16:05 GMT</pubDate>
            <atom:updated>2021-09-02T12:57:48.977Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[How I Became a Developer after a Hiatus?]]></title>
            <link>https://medium.com/quick-code/how-to-restart-your-career-in-it-as-a-developer-5403dd5cdc7c?source=rss-b996c8a29c67------2</link>
            <guid isPermaLink="false">https://medium.com/p/5403dd5cdc7c</guid>
            <category><![CDATA[job-hunting]]></category>
            <category><![CDATA[developer-stories]]></category>
            <category><![CDATA[programming-tips]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[startups-in-india]]></category>
            <dc:creator><![CDATA[Parul Malhotra]]></dc:creator>
            <pubDate>Tue, 24 Aug 2021 07:03:03 GMT</pubDate>
            <atom:updated>2021-08-24T13:42:47.537Z</atom:updated>
            <content:encoded><![CDATA[<p>So you think re-entering work force after a gap is a huge problem? Or may be you are stuck in testing or support projects but wanted to be a developer instead? Or may be you think it is too difficult to be a developer and hence coding is not for you. If you have such doubts, then you are at the right place to help get your doubts cleared.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ge9_FPdiMOcSPCDAhGthag.jpeg" /></figure><h3>A brief introduction to self</h3><p>Let me start by telling you briefly about myself. I am Parul, currently working as a Backend Developer since almost a year. I have an approx 5.5 years of experience of working as a QA/QA-II engineer followed by a career gap of 3.5 years. I re-entered IT as a Developer in full swing, last year and trust me when I say it has been quite fun of a ride so far!</p><p>I saw a lot of women switching from a completely non technical background to a technical job outside of India. However, still in India I see a lot of people not willing to take the risk or facing a lot of challenges when they attempt something like this. So Ithought of taking the first step and putting my story out so that it reaches all the women who need help re-entering the developer market.</p><h3>Is it tough being a developer?</h3><p>Yes and No. Well, it depends honestly. If you haven’t written a single line of code ever even then you can generate a lot of interest in coding if the language you have chosen just clicks. I started with C++ a long time ago, never developed an interest in it so decided to quit coding. This time I started with javascript and oh man! I fell in love with the entire coding thing.</p><h4>Pro Tip</h4><p>Spend some time on twitter, follow a bunch of interesting people form the tech industry, pick a language of your interest to get started with. Can be — Javascript, Python, HTML or even CSS. Spend a lot of time writing code and building stuff. Then take a decision whether you enjoy doing it or not.</p><h3>How to get started as a Developer?</h3><p>Whatever you are currently doing try and manage 2–3 hours a day and devote to coding. I joined an online bootcamp to brush up my HTML/CSS/Javascript skills followed by tons of projects in ReactJS and NodeJS. I was working as a QA-II engineer during the day and attended a bootcamp from 6am-8:30 am Monday-Friday followed by lots of home assignments to be finished for the next day and weekends. The daily assignments helped me build stuff and learn the right way.</p><h4>Pro Tip</h4><p>Join a bootcamp or learn from Freecodecamp’s website and youtube tutorials. Get stuck coding, learn how to search the right way on google/youtube, get solutions and understand why something works the way it does.</p><h3>How to prepare for Interviews?</h3><p>Be confident. One thing I was asked every time was why do you want to switch careers so late, why is there a career gap. What I did to answer them was to just say the honest answers out loud. Yeah! No one really cares about your career gap or switch if you are good at programming. So there is no need to complicate the answers. Just be honest. There is no perfect answer for it.</p><p>Next is the actual preparation for the interview. I spent 2 months only building projects using ReactJS and NodeJS. Full stack projects hosted somewhere with code and a proper readme on github helps a lot. I was pretty active on twitter as well and I used to share every new thing that I build on a daily basis which helped me to gain a lot of attention from the tech industry as well. that helped me reach out to the CTO’s of a few startups directly and I could forward my resume and work with them to get an interview invite.</p><p>Most companies want to have an online pair programming session these days where they expect you to code something live or may be add a feature to your existing projects. Practising such problems on hackerearth and other similar platforms can prepare you for the live rounds well.</p><h4>Pro Tip</h4><p>Build at least 5 projects. Put the code on github. Be active on Twitter. Share projects you build and codepen links. Show the world you are ready to face the interview. Be open to ask for work/interview opportunities. Be a part of the tech community.</p><h3>What about Data Structures and Algorithms?</h3><p>Most interviewers still expect you to answer a few problems in DS &amp; Algo. Devote a good month to prepare for the most commonly asked questions. You can practice on HackerEarth for timed problems. I got started with interviewcake.com for learning the approach to be taken to solve ds algo problems.</p><h4>Pro Tip</h4><p>Don’t leave DS Algo for the end as it takes a few tries to understand the approach that works for you. In most organizations, they just want to check if you can solve a few typical ds also questions to get an understanding of your technical skills.</p><h3>How to write a resume?</h3><p>I used the <a href="https://rx-resume.web.app/">https://rx-resume.web.app/</a> to write my resume. I made sure I write a max of 2 pages. Summarised my past experiences, my reason to switch field and listed my projects that I had built using ReactJS and NodeJS. Resumes should be short and concise. No fluff to be included.</p><h3>When do you think you are interview ready?</h3><p>You can never be fully ready in a real sense. When you feel you are good enough and confident enough to start learning through this interview process, you should start. I started with a simple goal to learn from them not to clear them right away. I knew it would take me a few failures to actually see success so I followed the easy way around — appearing to learn the different questions that are asked, the format of the interviews, how to confidently answer a problem within the time limits etc. It helped me a lot because initially after 5–6 rejections, I started getting acceptance in almost every company I applied to.</p><h3>How to get interview invites?</h3><p>Create a beautiful profile on github. List down all your projects there with a detailed README. Use that link to share on twitter and collect feedback from people. I posted on twitter that I was job-ready and looking for opportunities. A lot of people then started tagging me at relevant opportunities posts. I DM-ed CTO’s of startups I was interested in directly on Twitter in a single message stating the skills I can offer, my GitHub profile link, and a brief introduction to self. Most people were intrigued by my introduction and initiated the conversation.</p><h3>How much to ask for?</h3><p>Be very clear of what money goal you have and don’t shy away from saying that. Never undersell yourself just because you are coming back from a break or switching profiles. I took a good hike on my last CTC even though I was switching into a completely new profile. The only reason was I cleared the interview and showed them that I was ready for the role hence the negotiation worked. Also, just say no to organizations that want to hire you for a really really low CTC because they think you are new to the industry hence can’t offer a good CTC. They are probably doubting your skills so better not to go ahead with them and keep appearing for other better organizations with a better culture.</p><h3>Does your past experience count?</h3><p>Yes it does. You are a seasoned professional even if you have worked for 2 years or so. You are professional. You know the industry standards. You are much much better than a fresher who would require lots of grooming. So yes your past experience does matter even though you are re-entering after a break or switching into a slightly different role.</p><p>There are a lot of other things that I would like to share with you guys. However, keeping this article to the point so as to help people who are thinking of re-entering the job market only, for now. I will write more detailed articles on each of these processes or on Javascript. Stay tuned for more information and you can write to me at parulm.business@gmail.com with your doubts or queries.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5403dd5cdc7c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/quick-code/how-to-restart-your-career-in-it-as-a-developer-5403dd5cdc7c">How I Became a Developer after a Hiatus?</a> was originally published in <a href="https://medium.com/quick-code">Quick Code</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Beginner friendly guide to setting up ReactJs]]></title>
            <link>https://medium.com/cloudboost/a-beginner-friendly-guide-to-setting-up-reactjs-670dcd20d397?source=rss-b996c8a29c67------2</link>
            <guid isPermaLink="false">https://medium.com/p/670dcd20d397</guid>
            <category><![CDATA[javascript-development]]></category>
            <category><![CDATA[webpack]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[reactjs]]></category>
            <dc:creator><![CDATA[Parul Malhotra]]></dc:creator>
            <pubDate>Fri, 07 Feb 2020 12:04:51 GMT</pubDate>
            <atom:updated>2020-03-05T11:04:27.480Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EKKPT7TCKNmg2vVKfhsU3w.jpeg" /></figure><p>This is a basic introductory guide to React Js library. If you are somebody who has been thinking of diving into ReactJs, this article can be a basic guide to React. This is in no way exhaustive however, it does contain introduction to the most important concepts required for a beginner and installation details using various methods.</p><p>So let’s jump right in!</p><h3>What is React?</h3><p>React is an open source library created by Facebook. It is not a framework.</p><p>React is used to build interactive UI.</p><p>In React, we create components which are custom, reusable HTML elements that can be used to efficiently and quickly build UI.</p><p>React also provides a way to manage how data is stored and handled using <em>state</em> and <em>props</em>.</p><h3>Setup and Installation</h3><h4><strong>Method 1 — Using CDN</strong></h4><p>Steps -</p><ol><li>Create an html file.</li></ol><p>2. Load three CDNs in the head — React, ReactDOM, Babel.<br> (i) React — React’s top level api.<br> (ii) ReactDOM — provides DOM specific methods.<br> (iii) Babel — javascript compiler that convert ES6+ code into plain old ES5 javascript code that can run in any browser.</p><p>3. Create a div tag with an id = “root” where our component shall be displayed on the UI.</p><p>4. Create a script tag after body and define type=“text/babel” (mandatory for using Babel.</p><p>5. Create a component by the name App which extends from React.Component class. A component can be understood as a loosely coupled unit which contains both — logic and markup.</p><p>6. Define the render() method which is going to render DOM nodes. render() is a method that takes input data and returns what needs to be displayed.</p><p>7. return statement inside render() function returns the data to be displayed in the JSX format.</p><h4>What is JSX?</h4><p>JSX is a syntax extension to Javascript. It is tag syntax which is neither a string nor is html. It produces React “elements”.<br>React elements are plain javascript objects. React elements are immutable. The only way to update the UI when using React is to create a new element and pass it on to ReactDOM.render() method to display changed state. In jsx, any valid javascript expression is kept inside curly braces. React DOM makes sure to update DOM.</p><p>8. Next we pass the newly created element &lt;App/&gt; to ReactDOM.render() method alongside the document.getElementById(“root”) so as to define the entry point.</p><p>Open index.html file in the browser to see “Hello World!” getting rendered through our newly created React element.</p><p>Check out the code that went into index.html, below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YNPYQIlK-2sRRjXKxIk-Gg.png" /><figcaption>index.html</figcaption></figure><h4><strong>Method 2 — Create React App</strong></h4><p>Using the Method 1 is not a very efficient way because in the first method the code we write is not executed right-away by the browser. Instead, JSX is first converted to Javascript code so that browsers can support it. Next, the browsers execute the code. Instead, if we use a compiled version, browsers would be able to execute the code instantly.</p><p>So, JSX is first compiled to Javascript which is then converted to minified Javascript by performing code optimisations which is then passed to the client’s browser for execution, saving on a lot of resources and execution time.</p><p>A solution to this is using <a href="https://github.com/facebook/create-react-app">Create-React-App</a>. There is no need to install tools like Webpack or Babel in this case and one can directly focus on the application instead of the configuration. Everything is preconfigured to build a react app.</p><p>Create React App creates a live development server, compiles JSX, provides support for CSS and SASS modules, provides support for testing using Jest.</p><p>Lets get started with the steps-</p><ol><li>Create a Project: mkdir reactBasics.</li><li>Run this command from the parent’s folder: npx create-react-app reactBasics</li><li>Once the installation is done, move to the directory, reactBasics : cd reactBasics.</li><li>To run the app in development mode, use the command : npm start.</li><li>Open <a href="http://localhost:3000/">http://localhost:3000</a> to view the React app in action. This page will automatically reload if any changes are made. Build errors and lint warnings can be seen in the console.</li></ol><p>Inside the project structure we have two important folders — public and src. <strong>public</strong> folder consists of <strong>index.html </strong>which is the one serving the content. We are going to use a <strong>div</strong> with <strong>id = “root”</strong> in this index.html which is going to be our <strong>entry point</strong> for React.</p><p>src folder is the one which contains the React code. Let’s start by deleting all the files from the src folder. I am going to keep index.js and create three new files App.js, Fun.js and Welcome.js.</p><ul><li>index.js — This shall be used for rendering our newly created &lt;App /&gt; tag. We shall export the App component and load it in index.js</li><li>App.js — This is our component which will also be used an an aggregator for multiple React components.</li><li>Welcome.js — Second react component.</li><li>Fun.js — Third react component.</li></ul><p>Let’s start by removing all the code from index.js. Import React, {Component}, ReactDOM, index.css and App from components folder. We will use ReactDOM.render() method with the newly created &lt;App /&gt; tag to be rendered on the div element, id = “root”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IdiXsAzzxNU4nPOtwAPMNg.png" /><figcaption>index.js</figcaption></figure><p>Welcome.js component will be a class based component. Import React and create a class Fun that extends from Component class. Inside the class, we will be using render() method of the Component class to return the JSX to be displayed on the browser. In the end, we will simply export the component.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hToQaM6kFW-AhFcagB38mA.png" /><figcaption>Welcome.js</figcaption></figure><p>In the Fun.js component, we will use the functional component approach. Import React and create a function Fun() which returns the JSX. In the end, export Fun.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x4frgMKxseZqURnMSYqCUQ.png" /><figcaption>Fun.js</figcaption></figure><p>In App.js component, we will import React and both the components — Welcome and Fun. Create a class App() and return jsx which has an h1 tag, Welcome tag and a Fun tag. In the end, export it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cgUMr_HE3GeMvVJj1GI3ig.png" /><figcaption>App.js</figcaption></figure><p>When you refresh the page on localhost:3000, you should see something like this — Our very own first React app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*E7F0KezMIhMdY_jdyW5Dtw.png" /><figcaption>A very basic React app consisting of three components</figcaption></figure><p>You can install <a href="https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi">React dev tools for Chrome</a> and head over to the <strong>Components</strong> tab once you Inspect the page. You will be able to see our App component consisting of two components — Welcome and Fun, as shown below. This is a very handy tool when working with React so don’t forget to give it a try.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/434/1*X00PLkPzoub0N_hkRvmmiQ.png" /><figcaption>Components under React dev tools</figcaption></figure><h4>Method 3 — Using Webpack and Babel</h4><p>Let’s first understand what <strong>Webpack</strong> and <strong>Babel</strong> is.</p><h4>Webpack</h4><p><strong>Webpack</strong> is an open-source javascript <strong>module bundler</strong> where modules are independent reusable files or chunks of code. It takes up an application, maps the modules with its dependencies and generates one or more bundles. It treats all files and assets(fonts, images, etc.) as modules. Under the hood, it creates a <strong>dependency graph</strong> that describes how modules relate to each other using <strong>require</strong> and <strong>import</strong> statements in the correct order. It just combines everything in the correct order to create a javascript file which can then be included in an html file for execution.</p><h4>Babel</h4><p>Babel is a javascript compiler. Babel is a tool that is used to transform ECMA script 2015+ code into backward compatible code for execution in current and older versions of browsers or environments.</p><p>Let’s now look at implementation using Webpack and Babel.</p><p><strong>Step 1</strong>- Create a new directory “webpack-react-app” and cd in it.</p><p><strong>Step 2</strong>- Initialise a new project using:<strong> npm init -y</strong> to create a package.json file.</p><p><strong>Step 3</strong>- Install react and react-dom using: <strong>npm i react react-dom</strong></p><p><strong>Step 4</strong>- Install webpack, webpack-cli, webpack-dev-server and html-webpack-plugin using <strong>npm i — save-dev webpack webpack-cli webpack-dev-server html-webpack-plugin</strong></p><p><em>webpack-dev-server</em>- used for live reloading. Only used in development environment.<br><em>webpack-cli</em>- provides a set of commands to set up a custom webpack project.<br><em>html-webpack-plugin</em>- used to implifies creation of HTML files to serve your webpack bundles.</p><p><strong>Step 5</strong>- Install babel with its presets and plugins using <strong>npm i — save-dev @babel/core @babel/preset-env @babel/preset-react babel-loader</strong></p><p><em>babel/core- </em>core functionality of babel,<br><em>babel/preset-env- </em>is a preset that allows you to use the latest JavaScript without needing to micromanage which syntax transforms are needed by your target environment(s).<br><em>babel/preset-react</em>- a preset for react,<br><em>babel-loader- is </em>used by webpack to transpile Modern JS into the JS code that browsers can understand.</p><p><strong>Step 6</strong>- Install style-loader, css-loader and file-loader for styles and images.Use <strong>npm i — save-dev style-loader css-loader file-loader<br></strong> As webpack understands javascript, we are required to convert the styles and images in javascript using these loaders.</p><p><strong>Step 7</strong>- Create a babel config file <strong>.babelrc </strong>by using <strong>nano .babelrc</strong></p><p>This opens up an editor where you need to copy the below code thereby enabling webpack to use the below two presets.</p><p>{ “presets”: [“@babel/preset-env”, “@babel/preset-react”] }</p><p><strong>Step 8</strong>- Setting up <strong>directories</strong> and <strong>files</strong> for the project. Create two directories <strong>public</strong> and <strong>src</strong>. Create an <em>index.html </em>file inside <strong>public</strong> folder and our entry file <em>index.js</em> inside of <strong>src</strong> folder. Also create <em>App.js </em>file inside <strong>src</strong> folder.</p><p><strong>Step 9</strong>- Setting up webpack configuration file <strong>webpack.config.js<br></strong>Create a file webpack.config.js inside the project folder and coopy the below code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rp1hV2Cayu2zo_F7PEEUhg.png" /></figure><p><strong>entry</strong>: entry defines the entry point for the application to start execution from and webpack to start bundling from.<br><strong>output</strong>: output describes the target directory for output files. Must be an absolute path.<br><strong>devServer</strong>: an object that has a set of options which are picked up by <a href="https://github.com/webpack/webpack-dev-server">webpack-dev-server</a> and can be used to change its behaviour in various ways. We have used a simple example that gzips and serves everything from our dist/ directory in the project root.<br><strong>modules</strong>: this object defines how different types of modules within our project will be treated. It consists of an array of objects <strong>rules </strong>that uses regex to match filenames with .js and .css extension and uses the recommended loader for such files.<br><strong>mode</strong>: to define the development mode.<br><strong>plugins: </strong>plugins are used to customize the webpack build process. <em>html-webpack-plugin</em><strong> </strong>will use your custom index.html file that will be rendered by webpack-dev-server.</p><p><strong>Step 10</strong>- Create a react component <strong>App.js</strong> and render a simple h1 and h2 elements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eg2OpViGN6FHEzecZaABEQ.png" /></figure><p><strong>Step 11</strong>- Import <strong>App.js </strong>to <strong>index.js</strong> and render it on the element with id= root in public/index.html file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lpmrqLvomoo0ZBwtTo_FLQ.png" /></figure><p><strong>Step 12- </strong>Create a div element with <strong>id=”root”</strong> in <strong>public/index.html</strong> file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*gju5mz9OAiP495uCqIfR4Q.png" /></figure><p><strong>Step 13- Add the following to the scripts under package.json -<br></strong>“start”: “webpack-dev-server”, “production”: “webpack”<br>Now you can run the app by running the command- <strong>npm run start and voila your app is running!!!</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B7DnEreDUOCvNUKvndeMDg.png" /></figure><p>Hope you learnt something from the article. There’s tons more to say about this so I may add extra info when I have some free time. Feel free to ask questions if you’re struggling with anything, I love to help! 💕</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=670dcd20d397" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cloudboost/a-beginner-friendly-guide-to-setting-up-reactjs-670dcd20d397">A Beginner friendly guide to setting up ReactJs</a> was originally published in <a href="https://medium.com/cloudboost">CloudBoost</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why is 0.1 + 0.2 Not Equal to 0.3 in Most Programming Languages?]]></title>
            <link>https://medium.com/better-programming/why-is-0-1-0-2-not-equal-to-0-3-in-most-programming-languages-99432310d476?source=rss-b996c8a29c67------2</link>
            <guid isPermaLink="false">https://medium.com/p/99432310d476</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[binary]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[100daysofcode]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Parul Malhotra]]></dc:creator>
            <pubDate>Mon, 30 Sep 2019 18:08:21 GMT</pubDate>
            <atom:updated>2021-09-02T12:58:51.942Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Javascript console" src="https://cdn-images-1.medium.com/max/352/1*omAen9uiC6H13SHRw5qVwQ.png" /></figure><p>Ever since childhood, we have been taught that 0.1 + 0.2 equals 0.3. However, in the baffling world of computing, things work pretty differently.</p><p>I recently started to code in JavaScript, and while reading about data types, I noticed the strange behavior of 0.1 + 0.2 not being equal to 0.3. I resorted to <a href="https://stackoverflow.com/">Stack Overflow</a> for help and found a couple of posts that helped. Have a look below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*4EgcTv7g3YqKD15-mxl5RA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*hYVOekmH_4p2XgiU6c2trw.png" /><figcaption>Stack Overflow reference images</figcaption></figure><p>After doing a lot of research and math, I concluded this is not an error. This is math: floating-point arithmetic. Let’s dig deeper to understand what’s happening behind the scenes.</p><p><strong>Problem statement:</strong> How is it that 0.1 + 0.2 = 0.30000000000000004?</p><p>Well, if you have done programming in languages like Java or C, you must be aware of different data types used to store values. The two data types we would be considering in the discussion ahead are <em>integer</em> and <em>float.</em></p><p>Integer data types store whole numbers, while float data types store fractional numbers.</p><p>Before we proceed, let’s understand one small concept: How are numbers represented for computational purposes? Very small and very large numbers are usually stored in scientific notation. They are represented as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/259/0*iQDY7iSJn5TZ9joD.png" /></figure><p>Also, a number is normalized when it is written in scientific notation with one nonzero decimal digit before the decimal point. For example, a number 0.0005606 in scientific notation and normalized will be represented as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/152/1*Mv3QdU4WkDneMOWGpr8Ymw.png" /></figure><p><em>Significant</em> is the number of significant digits which do not include zeroes, and <em>base</em> represents the base system used — which is decimal(10) here. <em>Exponent</em> represents the number of places the radix point needs to be moved left or right to be represented correctly.</p><p>Now, there are two ways to display numbers in floating point arithmetic: single precision and double precision. Single precision uses 32 bits, and double precision uses 64 bits for floating-point arithmetic.</p><p>Unlike many other programming languages, JavaScript does not define different types of numeric data types and always stores numbers as double precision floating point numbers, following the international <a href="https://www.geeksforgeeks.org/ieee-standard-754-floating-point-numbers/">IEEE 754 standard</a>.</p><p>This format stores numbers in 64 bits, where the number (the fraction) is stored in bits 0 to 51, the exponent in bits 52 to 62, and the sign in bit 63.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*imL6DhMjEkovKn1k78IKfQ.png" /><figcaption>IEEE754 Double Precision Standard</figcaption></figure><p>Let’s represent 0.1 in 64 bit following the IEEE754 standard.</p><p>The first step is converting (0.1)base 10 to its binary equivalent (base 2).<br>To do so, we will start by multiplying 0.1 by 2 and will separate out the digit before the decimal to get the binary equivalent.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/207/1*z_sj8Rfqx068U7AHoymx9w.png" /></figure><p>On repeating this for 64 bits, we are going to arrange them in ascending order to get our mantissa, which we are going to round off to 52 bits as per the double precision standard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*JN46HCzRJly7YlqwybCoMQ.png" /><figcaption>Mantissa</figcaption></figure><p>Representing it in scientific form and rounding off to the first 52 bits will yield:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/743/1*PLER7zKzNr7nD-SXoApRBw.png" /></figure><p>The mantissa part is ready. Now for the exponent we shall use the below calculation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/466/1*ozI1EwDXAdJc-hMHLYL5ig.png" /></figure><p>Here, 11 represents the number of bits we are going to use for 64 bit representation of the exponent, and -4 represents the exponent from the scientific notation.</p><p>The final representation of the number 0.1 is :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*Fd8C4frGrb8oaegRkVw7cg.png" /></figure><p>Similarly, 0.2 would be represented as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*-ri9RCDE11ya5dOPRHBtEg.png" /></figure><p>Adding the two after making the exponents same for both would give us:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*2UcE_Li_QNaHELT84vDFtQ.png" /></figure><p>When represented in floating point, this becomes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/773/0*iu3FdpO09mq1O_jL.png" /></figure><p>This is represented by 0.1 + 0.2.</p><p>That is precisely the reason behind getting 0.1 + 0.2 = 0.30000000000000004.</p><p>Thanks for reading. Subscribe to my <a href="https://parulmalhotra.substack.com/?r=2cisn&amp;utm_campaign=pub&amp;utm_medium=web&amp;utm_source=copy">newsletter</a> for more updates on things I learn and build.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=99432310d476" width="1" height="1" alt=""><hr><p><a href="https://medium.com/better-programming/why-is-0-1-0-2-not-equal-to-0-3-in-most-programming-languages-99432310d476">Why is 0.1 + 0.2 Not Equal to 0.3 in Most Programming Languages?</a> was originally published in <a href="https://betterprogramming.pub/">Better Programming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>