<?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 Ankita Panigrahi on Medium]]></title>
        <description><![CDATA[Stories by Ankita Panigrahi on Medium]]></description>
        <link>https://medium.com/@ankitapanigrahi?source=rss-7dcefa824824------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*1rZsM4reifi-Lidm0J4LIQ.jpeg</url>
            <title>Stories by Ankita Panigrahi on Medium</title>
            <link>https://medium.com/@ankitapanigrahi?source=rss-7dcefa824824------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 14:25:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ankitapanigrahi/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 does a CDN work?]]></title>
            <link>https://ankitapanigrahi.medium.com/how-does-a-cdn-work-ea05c9f487cf?source=rss-7dcefa824824------2</link>
            <guid isPermaLink="false">https://medium.com/p/ea05c9f487cf</guid>
            <category><![CDATA[cdn]]></category>
            <category><![CDATA[static-site]]></category>
            <category><![CDATA[web-services]]></category>
            <category><![CDATA[content-delivery-network]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Ankita Panigrahi]]></dc:creator>
            <pubDate>Tue, 15 Feb 2022 04:34:34 GMT</pubDate>
            <atom:updated>2022-02-15T04:34:34.797Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>What is CDN (Content delivery network)?</strong></p><p>A <strong>content delivery network</strong> (CDN) is a group of geographically distributed servers that speed up the delivery of web content by bringing it closer to where users are. (Source: Google)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*QP-WQWq7YYLgDgp0mi__9Q.png" /></figure><p>It is used to deliver static files in a faster way</p><p>So basically, when we request a web page from different geographical areas, the request will go to the server. This process will take time to render the page for the user hence increasing the turnaround time. Now CDN comes to picture</p><p><strong>How is it done?</strong></p><ol><li>Caching</li><li>Customized data for different device types or location</li><li>Fast</li></ol><p>Before the server, we have an entity called cache (write once, update never). For the first time, it will take data from the server and store it in the cache or if there is some invalidation like invalidate every 1 hour. So for 1 hour, we can use the cached version, and then it will get the requests from the server.</p><p>One problem with cache is if this crashes, everything crashes. That’s where distributed cache comes into the picture.</p><p>Another problem is we are storing a lot of data in the cache. For e.g., we are storing customized HTML pages according to location or language. A person sitting in India will have a lot of irrelevant information from the caching.</p><p>This can be solved by <strong>sharding </strong>which is basically splitting the cache based on the location of the user. So the distributed cache will work in a way like a group of the cache will belong to a particular location and so on. As a result, the number of unique files in the cache grows, the number of requests to the origin decreases, and the speed of content delivery increases.</p><p>We have a global distribution system in our cloud which is hosted in a single country, for eg, the USA. A person staying in India requests a page and the requests travel all the way to the USA and come back. For this scenario, we will create a cache in India or southeast Asia, for e.g, China and India can use the same cache. This ensures faster delivery.</p><p>If you have a website that is supposed to be used by people across the globe, then you should make use of CDN to minimize turnaround time. Some Popular CDNs are Cloudflare, Cloudfront by Amazon.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ea05c9f487cf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How next.js handles routing]]></title>
            <link>https://ankitapanigrahi.medium.com/how-next-js-handles-routing-1bce79d1c0e4?source=rss-7dcefa824824------2</link>
            <guid isPermaLink="false">https://medium.com/p/1bce79d1c0e4</guid>
            <category><![CDATA[typscript]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[reactjs]]></category>
            <dc:creator><![CDATA[Ankita Panigrahi]]></dc:creator>
            <pubDate>Tue, 25 Jan 2022 17:31:06 GMT</pubDate>
            <atom:updated>2022-01-25T17:31:06.528Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-y87CRQQzOdXyOgrq2CfFw.png" /></figure><p><em>When I first saw how beautifully routing is handled by next.js, at that moment I knew I was in love.</em></p><p>In React, we always need to use an external package(<a href="https://www.npmjs.com/package/react-router-dom">i.e react-router-dom</a>) and define which path leads to which component. It was always a pain.</p><p><a href="https://nextjs.org/learn/basics/create-nextjs-app?utm_source=next-site&amp;utm_medium=homepage-cta&amp;utm_campaign=next-website">Next.js</a> introduces routing which requires no external package and no extra overhead of describing the path or components. Not only that, it ensures we maintain a folder structure.</p><p>When we create a next.js application, it gives us folder name <strong>pages</strong>. Inside the pages, we have <strong>index.tsx(or .jsx) </strong>which is the entry point.</p><p>So if you are in the development server, whatever you write in index.tsx, it will correspond to <a href="http://localhost:3000/training/course/984">http://localhost:3000/</a></p><p>Bear in mind if you have added a basePath in next.config.js, that would be preceded in every path. Like <strong>pages/index.tsx </strong>will correspond to<strong> </strong><a href="http://localhost:3000/training/course/984">http://localhost:3000/</a>{basePath}/</p><p>You can create folders inside pages to make other routes. Like if we want to have a products page that lists down a number of products, we can make a folder with the name <strong>products or we can create a file products.tsx. </strong>So<strong> pages/products (or pages/products/index.tsx) </strong>would corresponds to<strong> </strong><a href="http://localhost:3000/training/course/984">http://localhost:3000/</a>{basePath}/products</p><p>Now what if we want to create dynamic pages for each products. Thats where [product] comes into picture. We need to create a folder names [product] inside the <strong>products</strong> folder. So now <strong>pages/products/[product] (or pages/products/[product]/index.tsx) will correspond to </strong><a href="http://localhost:3000/training/course/984">http://localhost:3000/</a>{basePath}/products/{id}</p><p>Now, this is the next.js routing for the frontend.</p><p>Next.js also gives us a provision to write APIs inside the application. We have a <strong>/api</strong> folder inside <strong>/pages</strong> which will form API endpoint. The API endpoint would be <strong>/api/{folder}/{subfolder}/… </strong>and so on!</p><p>Keep in mind that if you have added a basePath in next.config.js, the basePath will be preceded in the API endpoint.</p><p>It would be <strong>/basePath/api/{folderName}/{subFolder}.</strong></p><p>I hope you learned something from this article!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1bce79d1c0e4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Books that will keep you hooked]]></title>
            <link>https://ankitapanigrahi.medium.com/books-that-will-keep-you-hooked-cee8fd24d440?source=rss-7dcefa824824------2</link>
            <guid isPermaLink="false">https://medium.com/p/cee8fd24d440</guid>
            <category><![CDATA[novel]]></category>
            <category><![CDATA[mystery-novels]]></category>
            <category><![CDATA[comedy-novel]]></category>
            <category><![CDATA[mystery-thriller]]></category>
            <dc:creator><![CDATA[Ankita Panigrahi]]></dc:creator>
            <pubDate>Sun, 06 Jun 2021 06:39:54 GMT</pubDate>
            <atom:updated>2021-06-06T06:42:07.720Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*IYHIf4uYwzJd0MD0_jdmBA.jpeg" /></figure><p>I have read many books in last year mostly on mystery, thriller and suspense genre and recently in comedy genre also. Most of them use the first half to build the second half due to which 50% of the initial book becomes a kind of a bore. So if you are someone who wants to read but needs books that are interesting from start to the end, here are some of the best books I have read.</p><ol><li><strong>One of us is Lying </strong>by<strong> </strong>Karen M. McManus</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/331/1*Ii5k-lhE6UjbzN5RqCyxNA.jpeg" /></figure><p>It is a suspense/mystery novel that will keep you hooked from the start to the end written by Karen M. McManus. I am shocked how this much good of a book hasn&#39;t been turned into a movie yet. It is about 4 people who are suspects in a murder mystery and how the story unfolds. Go for it. It&#39;s the best in the murder mystery genre.</p><p>2. <strong>One of us is next </strong>by<strong> </strong>Karen M. McManus</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g93936YwO8jmnjmiOh537w.jpeg" /></figure><p>The second recommendation is the sequel of the first one. I love this franchise. The theme is similar to the first one. The protagonists are different characters but somehow related to the first ones. It can be read as a separate book but after reading the 1st you will get a wholesome feeling while reading this. The story is more adventurous and has higher stakes and plot twists. Give this book series a try. You won&#39;t regret it.</p><p>3. <strong>Big Little Lies </strong>by Liane Moriarty</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yUuab72SECqIesYu1QQmNw.jpeg" /></figure><p>If you are not living under a rock, you would know this drama series. Looking at the cast, do you want any other reason to know why this would be a great read.</p><p>It has everything. The book is so well written. It has mystery, teamwork, what it means to have consent, women empowerment, motherhood, friendships, relationships.</p><p>It creates a mystery from the very first and you just need to know more with every chapter.</p><p>4. <strong>Dial A for Aunties </strong>by<strong> </strong>Jesse Q. Sutanto</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/467/1*EHPrb7zBIO7HiAUso3GNow.jpeg" /></figure><p>After reading a lot of serious books, I turned to the comedy genre. And oh god, this was hilarious. The story revolves around a Chinese family who is trying to make a family business around marriages. It has all the elements one needs to enjoy in a good mood. It is quirky, humorous, and shows the relation of a mother-daughter. It has comedy sprinkled over rom-com and murder. It gives us a perception of Chinese culture and cuisine. Being an Indian (fellow Asian) myself, I can very much relate to the protagonist.</p><p>Pick it up if you want to have a good laugh.</p><p>Some more recommendations in mystery/thriller novels include <strong>The girl with a dragon tattoo</strong>(dark), <strong>The Silent Patient</strong> (psychological fiction), <strong>The guest list, Before I go to sleep.</strong></p><p>I hope you enjoy the books.</p><p>Happy Reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cee8fd24d440" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What do developers want?]]></title>
            <link>https://ankitapanigrahi.medium.com/what-do-developers-want-b5e1915ed582?source=rss-7dcefa824824------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5e1915ed582</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[developer-productivity]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Ankita Panigrahi]]></dc:creator>
            <pubDate>Fri, 28 May 2021 13:47:48 GMT</pubDate>
            <atom:updated>2021-05-28T13:47:48.040Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8hy9j0b_p-L6PXgHtd9U6w.jpeg" /></figure><ol><li><strong>A room to breathe (trust the developer)</strong></li></ol><p>Stop asking for updates every waking hour. Scrum call doesn&#39;t happen for dancing.</p><p>Stop with unrealistic deadlines. Writing code takes time. And you have no option other than to wait. They will let you know the minute code is deployed. Trust me, we are as desperate to get the feature/bug off our backs as you are.</p><p><strong>2</strong>. <strong>Everything external that a laptop provides</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*998D93rJV0Iu40-My-t16g.jpeg" /></figure><p>This is our dream desktop setup. We can’t wait to buy all that shit so that we can work from the comforts of our beds.</p><p><strong>3. Another developer friend who has a bigger issue to resolve than us</strong></p><p><strong>The Friend</strong>: With a due date, bitch!</p><p><strong>4. A brain that can give proper ticket estimates</strong></p><p>Why is it always a spillover? Why can’t it be other way around!</p><p><strong>5. Tea/ Coffee</strong></p><p>We don&#39;t need to look at the clock to know when it’s tea o’clock.</p><p>PS: I automatically stop working at 4 pm until I get my drug!</p><p><strong>6. Magic</strong></p><p>Braindead code at night, working code in the morning. Still a dream!</p><p><strong>7. Work-life balance</strong></p><p>Sorry, scratch that, <strong>Life-work balance</strong>. Life comes first.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5e1915ed582" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to follow a Routine?]]></title>
            <link>https://ankitapanigrahi.medium.com/how-to-follow-a-routine-ce4f7ca15e9b?source=rss-7dcefa824824------2</link>
            <guid isPermaLink="false">https://medium.com/p/ce4f7ca15e9b</guid>
            <category><![CDATA[procastination]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[routine]]></category>
            <category><![CDATA[time-management-tips]]></category>
            <category><![CDATA[to-do-list]]></category>
            <dc:creator><![CDATA[Ankita Panigrahi]]></dc:creator>
            <pubDate>Sat, 13 Mar 2021 15:01:04 GMT</pubDate>
            <atom:updated>2021-03-13T15:01:04.895Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZQbS0qh8FqeLcKt1ahe_kA.jpeg" /></figure><blockquote>Success is the product of daily habits — not once-in-a-lifetime transformations.</blockquote><blockquote><em>― </em><strong><em>James Clear, </em></strong><em>Atomic Habits: An Easy &amp; Proven Way to Build Good Habits &amp; Break Bad Ones</em></blockquote><p>It is better to improve daily than doing tasks in random order. Why?</p><ol><li>You will be able to see the progress on a regular basis</li><li>It will not come into your habit and eventually you may just lose interest.</li><li>Help you do the task at hand instead of procrastinating about it because you will have something planned throughout the day. So you can’t afford to lose time.</li></ol><p>I was trying to learn French for a really long time at a very random time. Eventually, I left it there. and never looked back</p><p>Until now I hope you got why routines are important!</p><p>So how to follow one</p><ol><li><strong>Write to-do a night before or first thing in the morning.</strong></li></ol><p>It’s the way. Some of the days it’s irritating and it can be a huge pain but this is the beginning. I can assure you you won’t be able to follow the routine for long if you don’t write it somewhere and check at the end how much is completed.</p><p>2. <strong>Exercise and Meditate</strong></p><p>Exercise makes you active throughout the day and meditation helps you focus better. You will be less stressed and sleep better.</p><p>I know Meditation!!!! 10 mins( to start with) with nothing but you and maybe some music counting breaths. It seems easy but just too hard at the same time. 2 mins will feel like 20. But it is important with the whole world so stressed out. It will take time(months) but please take 20 minutes out of your life for this. It helps me reduce anxiety.</p><p>3. <strong>Block your social media.</strong></p><p>Hear me out. Instagram fuels me even now also. I post many things and sometimes scroll through the black hole of reels. It’s fun, addictive which is its intent only. But it is not helpful for you. It makes you feel miserable. I have put a stop of 30mins in my Instagram. In iOS, you can control it with screen time and for Android, there are so many apps (ActionDash, Stay focused).</p><p>Stop the notifications from Whatsapp, Instagram, or any other apps you drain your energy into (which was mostly used by me). What it does is stop you from checking your phone in the middle of an important task if some messages pop up.</p><p>Replace social media time with something else. For me, it was Sudoku.😂</p><p>4. <strong>Rest</strong></p><p>You will be able to do all this only after you have a good night&#39;s sleep. Read a book at night. Sleep for at least 7 hours. I can’t function without that.</p><p>And choose a thing. Be a morning or a night person. If you can’t, choose morning. Well by morning I don’t mean 5 am. Try to wake up by 7 am.</p><p>This is my routine which is exactly the same all days with some extra sleeping time on weekends.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RkBIRBDQKPn9mYyx" /></figure><p>*BF: Breakfast</p><p>Routines would be repetitive. Heck, mine is the same for all days.</p><p>As you can see above I am not able to complete all my tasks. Sometimes it&#39;s 20%. Some days( Thank you, periods), it’s zero and my Insta Netflix screen time crosses 4–5 hours.</p><p>What I want to say is it’s okay if you can’t complete all your daily tasks. We are not robots. I am following this routine for the past 7–8 months. It took me 2 months to adapt and realize I won’t be able to complete all the tasks. I have completed only 3–4 times all the tasks.</p><p>Don’t beat yourself up. Improve day by day. Love yourself and try to complete as much as possible.</p><p>If you like the article please click on the clap. You can also follow me on <a href="https://ankitapanigrahi.wordpress.com/">Wordpress</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ce4f7ca15e9b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Prototype chaining in Javascript]]></title>
            <link>https://ankitapanigrahi.medium.com/prototype-chaining-in-js-23252e7b543?source=rss-7dcefa824824------2</link>
            <guid isPermaLink="false">https://medium.com/p/23252e7b543</guid>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[prototype-chain]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Ankita Panigrahi]]></dc:creator>
            <pubDate>Fri, 05 Mar 2021 07:13:20 GMT</pubDate>
            <atom:updated>2021-03-05T07:18:00.240Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is a prototype?</h3><p>Javascript is considered as a prototypal language which means that we can inherit methods and properties from the object which will act as a template.</p><pre>function Person(first, last, age, gender, interests) {<br>  this.name = {<br>    &#39;first&#39;: first,<br>    &#39;last&#39; : last<br>  };<br>  this.age = age;<br>  this.gender = gender;<br>}</pre><pre>let person1 = new Person(&#39;Bob&#39;, &#39;Smith&#39;, 32, &#39;male&#39;, [&#39;music&#39;, &#39;skiing&#39;]);</pre><p>The <strong>new</strong> keyword tells us that the Person is not a regular function, it’s a constructor function meaning make a new object and assign that object to the keyword <strong>this</strong>.</p><p>We can access the properties of person1 by person1.name, person1.age, etc.</p><p>But if we see all the properties of person1 in a console, we would see person1.valueOf(), person1. toString(), person1. hasOwnProperty(). So from where all these are coming from.</p><p>So person1 inherits from Person which in itself inherits the property of Object.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*BZlufuUeR7Lb6BPo.png" /></figure><p>This is basically prototype chaining.</p><p>With every property requested in person1, the browser will check if person1 has the property. If yes then evaluate it. If no, then it will go one level up and check whether, its prototype object, Person has the property. If yes execute it. If not it will go to the last level, that is, Object(Person’s prototype object)</p><p>So methods like valueOf() or toString () are defined on Object.prototype</p><p>If you like the article please click on the clap. You can also follow me on <a href="https://ankitapanigrahi.wordpress.com/">Wordpress</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=23252e7b543" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why everyone should read more?]]></title>
            <link>https://ankitapanigrahi.medium.com/why-everyone-should-read-more-632e43b78178?source=rss-7dcefa824824------2</link>
            <guid isPermaLink="false">https://medium.com/p/632e43b78178</guid>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[time-mana]]></category>
            <category><![CDATA[books]]></category>
            <category><![CDATA[fiction]]></category>
            <category><![CDATA[reading]]></category>
            <dc:creator><![CDATA[Ankita Panigrahi]]></dc:creator>
            <pubDate>Fri, 19 Feb 2021 07:25:31 GMT</pubDate>
            <atom:updated>2021-02-21T06:15:32.500Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qUznQTSVC9JMpqVrWcZJGQ.jpeg" /></figure><p>Well, to sleep better. The End!</p><p>Now for the sake of the article, I have to write more than 6 words. So here we go.</p><p>I was preparing for MBA and had read all the classics available still got very poor marks in English. So to hell with Shakespeare. I am also very new to reading books( voluntarily ). I started last year and completed like 16 books( My personal achievement ). Reading does improve your English which is required in today’s world. It improves your grammar as well. But the most important thing, you can finally say how crap the movie was as compared to the books.</p><p>I simultaneously read two types of books: Fiction and productivity.</p><p>Why Fictional?</p><ol><li>To sleep better</li><li>I cut down my Instagram time and gave that to this. Once you reach the climax of the book, Instagram will fail before this.</li><li>It is the smarter thing to replace the time if you looking out to cut down screen time.</li><li>To use my Kindle.</li></ol><p>Why Productivity?</p><ol><li>If you are looking to how to change your lifestyle into a healthier one, this is the way.</li><li>The point of productivity books is not to boost you forever. You take some points from it, apply them, and put them into your habits.</li><li>I got to know from examples how many people are like me and then they try to solve the issue little by little, one at a time.</li><li>Yes you can gain all the things from youtube videos but again screen time</li><li>My day goes way better with workouts, productivity books, and meditation. I read every day about productivity so I become more conscious about how I am spending my time.</li></ol><p>Last year recommendations for productivity books: <a href="https://medium.com/@ankitapanigrahi/books-to-enrich-your-mental-health-95b85ca9e291">https://medium.com/@ankitapanigrahi/books-to-enrich-your-mental-health-95b85ca9e291</a></p><p>I will have new recommendations in a separate article.</p><p>I hope it helps you to be interested in reading more. Please like and you can also follow me on <a href="https://ankitapanigrahi.wordpress.com/">WordPress</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=632e43b78178" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Commit graph from the lens of different Git operations]]></title>
            <link>https://ankitapanigrahi.medium.com/commit-graph-from-the-lens-of-different-git-operations-da2e6232fc15?source=rss-7dcefa824824------2</link>
            <guid isPermaLink="false">https://medium.com/p/da2e6232fc15</guid>
            <category><![CDATA[git-merge]]></category>
            <category><![CDATA[git-rebase]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Ankita Panigrahi]]></dc:creator>
            <pubDate>Mon, 03 Aug 2020 14:28:39 GMT</pubDate>
            <atom:updated>2020-08-03T19:25:33.029Z</atom:updated>
            <content:encoded><![CDATA[<h3>Commit graph from the lens of different git operations</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TeVxAdMEVB2-Jbop.png" /></figure><p>As developers, we have all used git at one point or another. In this article, I am going to explain the commit graph through various kinds of merge we can do.</p><p>There are three types of merging. We have basic merge, squash &amp; merge and rebase.</p><p>Before going through each git operations, I wanted to explain the base commit graph I will be using throughout.</p><p><em>NOTE: I have used the below git command to see the graph</em></p><pre>git log --graph --abbrev-commit --decorate --date=relative --all</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*wpEbhj7nQV-PHLDTP_btSw.png" /></figure><p>If you understood the image above, You can skip this part and go to <a href="#461c">merge directly</a>.</p><p>So, initially, we have a master branch after running the command <em>git init </em>in our empty project folder. We made 2 commits in master(340175c, 55b9887), and for the ease of understanding, I have given commit message as ‘1 master’, ‘2 master’ which means the number of the commit and the branch. After that, I checked out a branch ‘feature’ and made 2 more commits there(1222581, 009bd98). Then coming back to master again. And made one more commit(76d6b19). From that, I checkout another branch that is release and made 3 more commits in this branch (db09a1b, 2a94511, 3cfc723). And finally, checkout to master for the last time ( I promise), and made 2 more commits (a7ad6e5, 12f14eb).</p><p>I hope we are on the same page until now.</p><p><strong>So What’s next?</strong></p><p>Now our goal is to have all the features of ‘feature’ branch into our ‘master’ branch.</p><p>Let’s go then.</p><ol><li><strong>Merge</strong></li></ol><p>Currently, the HEAD or the tip of the branch we are on is master as you can see in the above figure also. In master, we need to run a git operation</p><pre>git merge feature</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/574/1*-rBHlw-1IBOg7krV_LO4Ig.png" /></figure><p>As you can see in the above diagram, the latest commit of feature is showing an arrow or a merge kind of sign into the latest master branch. Before merging, git will ask you to have a merge commit asking why this merge is required. It gives us a default commit message or we can change it according to our convenience.</p><p>If we see the git log now, it will show all the commits of master and feature branch included pointing out that it has been descended from both of the branches. I will tell you why am I focussing on git log when we cover <strong><em>squash &amp; merge.</em></strong> And with that, we have finished merging for this part. Let’s go-to squash and merge.</p><p>2. <strong>Squash &amp; merge</strong></p><p>Squash and merge, as the name suggests, squash all the commits of feature branch into one and put it on top of the master branch.</p><p><em>Why we need squash and merge?</em></p><p>Imagine you are working on a feature and made 10 commits in your local branch. When you merge the code with the master branch (let’s say), where your other teammates also merge their code, they don’t need to know how many commits you have made. They just need one commit that will represent all of commits of ‘feature’ branch.</p><p>So for squash, you need to run</p><pre>git merge --squash feature</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*jjm5JU35N2GSvtuu2BXJjw.png" /></figure><p>Here the commits of feature (1222581, 009bd98) are squashed into one (dc195d1) and put on top of ‘master’ branch</p><p>This will also prompt you to have a commit message. As you can see, there is no merging sign from feature to master. If you see the git log here, you won’t see the commits 1222581, 009bd98 which you were able to see in git log when we have done basic merge. This is because squash and merge don’t actually merge the feature branch into the commit, rather it squashes the feature branch commits and puts it on top of the master. The HEAD ( dc195d1) will have no relation to the feature branch. It has not been descended from the feature branch, unlike in basic merge. It will just show a new squashed commit (dc195d1) which will have feature branch squashed commits.</p><p>With this, we have completed our squash and merge as well. Let’s now head to rebase</p><p>3) <strong>Rebase</strong></p><p>NOTE<em>: We are assuming no conflicts while rebasing for now. In the last two-part, we could have just resolved the conflicts and committed them. It’s different for rebase. I will cover that in a separate blog.</em></p><p>So what is Rebase?</p><p>As the name suggests, it merges by changing the base of a branch🙄. Okay, I will try again.</p><p>What we will try to do is to change the base of feature branch form 2nd commit of master (55b9887) to make it look like it is checked out from latest commit of master (12f14eb). Okay, let’s deal with it from graph perspective.</p><p>The HEAD now is at the feature branch.</p><p>From here, we need to run</p><pre>git rebase master</pre><p>Initially, we had,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*wpEbhj7nQV-PHLDTP_btSw.png" /></figure><p>We can see here that the feature branch is checked out from the 2nd commit of master(55b9887).</p><p>After running ‘git rebase master` on feature branch, we will get,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/596/1*zj30YzU03mW3Cpi-y5BpJg.png" /></figure><p><em>Note: I have checked out into ‘master’ branch.</em></p><p>We can see the HEAD is at master and the feature is not checked out from the 2nd commit of ‘master’ branch (55b9887) as before but from our latest commit on master (12f14eb). And you can also notice that the commit IDs also changed for the two commits made in ‘feature’ branch which was previously 1222581, 009bd98 and now it is 8d122f6, 27d0291</p><p>So we can say now, the base for the feature branch has changed.</p><p>That’s how rebase works.</p><p>But our work here is not done. ‘master’ branch still doesn&#39;t have the changes from feature since the HEAD is at 12f14eb.</p><p>Now we are going to do exactly the same thing in ‘master’ branch which we did in ‘feature’ branch.</p><p>Let’s go.</p><p>Now we are at ‘master’ branch. Now we would run</p><pre>git rebase feature</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/556/1*i1JIlzTt_tfS-enbmcICEQ.png" /></figure><p>Now we would be able to see ‘feature’ commits in master. The master and feature branch are both pointing to the same commit.</p><p>And finally, that’s how rebase works.</p><p>There might be many cases in rebase where things can go haywire while rebasing.</p><p>One case might be when you will try to initially do rebase in master before doing it in ‘feature’ branch. Try it out. The result would be fun😅 and I will not even go for conflicts. It would be a real delight.</p><p>I will cover other eccentricities of rebase in another blog.</p><p>So why to use rebase over merge or squash &amp; merge?</p><ol><li>So as we can see in the above image, it is giving us a linear picture while preserving our commits, yes with different commit IDs, but we are getting all our commits. So when more developers merge their code in a single branch, the project history would be cleaner when rebase is used compared to merge.</li><li>We don&#39;t have to do unnecessary merge commit while rebasing.</li></ol><p>So this is all about different git operations and their respective graphs look. And all the merge operations have their own advantages and complications. So choose wisely for your team.</p><p>Happy Blogging!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da2e6232fc15" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Books to enrich your mental health]]></title>
            <link>https://ankitapanigrahi.medium.com/books-to-enrich-your-mental-health-95b85ca9e291?source=rss-7dcefa824824------2</link>
            <guid isPermaLink="false">https://medium.com/p/95b85ca9e291</guid>
            <category><![CDATA[mental-health]]></category>
            <category><![CDATA[self-improvement]]></category>
            <dc:creator><![CDATA[Ankita Panigrahi]]></dc:creator>
            <pubDate>Sun, 08 Mar 2020 13:38:12 GMT</pubDate>
            <atom:updated>2020-03-08T13:38:12.879Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*VZ0naHjmxmqb84wXHG1XuA.jpeg" /></figure><p>From the time I can remember I always thought I was different. But it took me my childhood and teenage years to realize that oh, I was different but in a very wrong way. My mentality was way worse than an average human being. The time I realized that I turned to read various books and articles on how to think, how to go about your day, how to be positive and most importantly how to change how you think</p><p>So if you are someone who thinks they need to work on shifting their mentality, this article is for you. and if you are someone who thinks they have a great thinking process, you should definitely read this article because no person has reached nirvana in that.</p><p>So here are my 5 favorite books that I turned to when life gives me lemons</p><ol><li><strong>The Secret </strong>by <a href="https://www.google.com/search?q=Rhonda+Byrne&amp;stick=H4sIAAAAAAAAAOPgE-LSz9U3MDVJMkkyVwKzjQotk4yStGSyk630k_Lzs_XLizJLSlLz4svzi7KtEktLMvKLFrHyBGXk56UkKjhVFuWl7mBlBACC3XrsSgAAAA&amp;sa=X&amp;ved=2ahUKEwjBnpC65oroAhVZ8HMBHXJbA2QQmxMoATAtegQIDxAD">Rhonda Byrne</a></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hGM0ZIzxrCr6E4Zlx6hgmw.jpeg" /></figure><p>No brownie points for guessing the first book. You got to read this book at whichever point you are in your life. I had read it a minimum of 4 times and whenever I am at my lowest point I turned to this. This book gives hope and makes us understand that whatever we want it’s completely up to us. Good or bad. It forces us to think positive even when we are distraught. In real life, I can see the secret work in both a positive or negative manner.</p><p>2. <strong>The monk who sold his Ferrari </strong>by <a href="https://www.google.com/search?q=Robin+Sharma&amp;stick=H4sIAAAAAAAAAOPgE-LSz9U3MDM3Ns2rUOIEsTMMjSxKtGSyk630k_Lzs_XLizJLSlLz4svzi7KtEktLMvKLFrHyBOUnZeYpBGckFuUm7mBlBADONTaLSQAAAA&amp;sa=X&amp;ved=2ahUKEwipq4DI5oroAhXr6XMBHSiiDVkQmxMoATAtegQIEBAD">Robin Sharma</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/325/1*zYEvUUXQIRwhteTGHhMDIw.jpeg" /></figure><p>This one might seem a little delusional from the laymen’s perspective but comprehending at least one or two teachings from this gem makes it worth the read. It teaches us how to be more peaceful and content in your life. What we need to do to lead a happy life and how it&#39;s not always about money or being ambitious. It teaches us the importance of meditation, how physical health is important, the importance of early awakening, music, vegetarian food, knowledge, etc.</p><p>3. <strong>No Excuses</strong> by <a href="https://www.google.com/search?q=Brian+Tracy&amp;stick=H4sIAAAAAAAAAOPgE-LRT9c3NErKrarMTbNU4tTP1TcwS7JMSdKSyU620k_Kz8_WLy_KLClJzYsvzy_KtkosLcnIL1rEyu1UlJmYpxBSlJhcuYOVEQBeNQgTSgAAAA&amp;sa=X&amp;ved=2ahUKEwjB7N7Z5oroAhXc7XMBHeo-ASkQmxMoATAXegQIEBAD">Brian Tracy</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*BRscfdKWEFsaSQw4u_72yw.jpeg" /></figure><p>As the name suggests, it tells us the importance of self-discipline and how procrastination and hope of instant gratifications(not considering long term goals) are the main villains. It mainly focuses on personal growth, business, and money goals and your overall happiness.</p><p><strong>4. The compound effect </strong>by <a href="https://www.google.com/search?q=Darren+Hardy&amp;stick=H4sIAAAAAAAAAOPgE-LRT9c3NEoqSDHLzTVU4tLP1TcoMTU0LkrTkslOttJPys_P1i8vyiwpSc2LL88vyrZKLC3JyC9axMrjklhUlJqn4JFYlFK5g5URABkrPDlMAAAA&amp;sa=X&amp;ved=2ahUKEwi8uZHF6YroAhX-8HMBHZ5KA6oQmxMoATAtegQIEBAD">Darren Hardy</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/361/1*MmZBjMkIXb4zoSwuLUDdWQ.jpeg" /></figure><p>The compound effect teaches us how small simple steps taken every day over a period of a long time will result in something absolutely beautiful and how most people not seeing the result instantly leave whatever they were doing to nurture their life. It teaches us, in the end, it all boils down to our choices that we make every moment of our day to day life. This book has some practical figures and hands-on that shows us how easily we are wasting our time and money on useless things every day and how to keep track of those.</p><p>5. <strong>Unf*ck Yourself </strong>by<strong> </strong><a href="https://www.google.com/search?bih=661&amp;biw=1440&amp;hl=en&amp;q=Gary+John+Bishop&amp;stick=H4sIAAAAAAAAAOPgE-LVT9c3NEw2LTY3Nc4wUIJw04zTq5IyyjK0ZLKTrfST8vOz9cuLMktKUvPiy_OLsq0SS0sy8osWsQq4JxZVKnjlZ-QpOGUWZ-QX7GBlBACy0jIXVAAAAA&amp;sa=X&amp;ved=2ahUKEwi_28KV7IroAhUj7XMBHQXHDtIQmxMoATARegQIDxAD">Gary John Bishop</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/311/1*BUps1lgoPHUq9XtsNq3NZg.jpeg" /></figure><p>This is the book I am currently reading and I am already going gaga over it without even completing. This basically tells us that we are always winning in whatever we are doing and before you take it as a compliment, it is not. For example, if you are putting things off, you are winning at that. You have to decide where you want to win. The second important thing this book teaches us is that uncertainty is the only certainty you should certainly embrace😎</p><p>These are my top 5 suggestions and any book you read on self-improvement, you will notice that it has some parts of ‘The Secret’ in it. So I will highly recommend reading ‘The Secret’ first.</p><p>In conclusion, I want to say, read books about whatever thing you are lacking and wanted to improve. Even you are taking 1–2 lessons from any book, that’s worth it. To all people who are struggling or thinks they are not good enough, I want to say ‘You are awesome’. It’s all in your mind. I am one of you and have to make conscious decisions every day to have confidence in myself. Walk out of that toxic relationship/job, change the environment which is not giving you any motivation, work on your physical health(it helps mentally also). In the end, all that matters is your happiness and that will come by setting goals and achieving them.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=95b85ca9e291" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Promises in Javascript]]></title>
            <link>https://ankitapanigrahi.medium.com/promises-in-javascript-40367c45dca0?source=rss-7dcefa824824------2</link>
            <guid isPermaLink="false">https://medium.com/p/40367c45dca0</guid>
            <category><![CDATA[promises]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[asynchronous-javascript]]></category>
            <category><![CDATA[callback]]></category>
            <dc:creator><![CDATA[Ankita Panigrahi]]></dc:creator>
            <pubDate>Wed, 26 Feb 2020 04:38:41 GMT</pubDate>
            <atom:updated>2020-02-26T04:38:41.013Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0pWvsvbzZpfNO-ZZSylijg.png" /></figure><p><strong>Promises</strong>: is used to handle <a href="https://medium.com/@ankitapanigrahi/concurrency-in-javascript-76ac0188b286">asynchronous operations in Javascript</a>.</p><blockquote>What we are basically trying to achieve is synchronizing asynchronicity in Javascript</blockquote><p>Before going with promise, let’s understand callbacks.</p><h4><strong>Callbacks</strong></h4><p>For JavaScript to know when an asynchronous operation has a result (a result being either returned data or an error that occurred during the operation), it points to a function that will be executed once that result is ready. This function is what we call a “callback function”. Mainly when we make external API calls, we would need callback and until we get our data, Javascript keeps doing its normal execution.</p><pre>fetch(&#39;<a href="https://jsonplaceholder.typicode.com/todos/1&#39;">https://jsonplaceholder.typicode.com/todos/1&#39;</a>, (error, response) =&gt; {<br>    if (error) {<br>        //Handle error<br>    } else {<br>        //go Nuts! <br>    }</pre><p>But if we have multiple callbacks when one function needs the data of the previous function. For example:</p><pre>getData(function(x){<br>    getMoreData(x, function(y){<br>        getMoreData(y, function(z){ <br>            ...<br>        });<br>    });<br>});</pre><p>This is called callback hell.</p><p>Apart from complexity as we can see as the function grows, error handling is repeated for every callback and it will go haywire when we loop through asynchronous calls.</p><p>Here comes Promise as promised. 😆</p><h4><strong>Promises</strong></h4><p>It works the same way as a callback but makes the error handling less verbose by chaining the functions in resolve and reject state. Promises are asynchronous</p><pre>let promise=new Promise((resolve,reject)=&gt;{<br>  setTimeout(()=&gt;{<br>    let error=false<br>    if(!error)<br>      resolve(&#39;Done&#39;)<br>    else <br>      reject(&#39;Not Done&#39;)<br>  },1000)<br>  <br>promise<br>.then((data)=&gt;console.log(data)) //Done<br>.catch((error)=&gt;console.log(error))</pre><p>Here the error variable is false, it is calling the then block of ‘promise’ through resolve and if an error would have been true it would have called the catch block and the output would have been ‘Not Done’</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*7VGa2xYxBQs_Ab33C13-KQ.jpeg" /></figure><p>As seen in the above figure, a promise has three states</p><ol><li>Pending: when the results are computing. (initial state of each Promise)</li><li>Resolved: the result was computed successfully</li><li>Rejected: a failure occurred during computation.</li></ol><p>A lot of asynchronous APIs are implemented using promise. E.g:<a href="https://github.com/axios/axios"> Axios</a> is a popular ‘Promise based HTTP client for the browser and node.js’</p><pre>const axios = require(‘axios’);<br>axios.get(‘<a href="http://www.somepage.com'/">http://www.somepage.com&#39;</a>)<br>.then(function (response) { // Reponse being the result of the first request<br>    // Returns another promise to the next .then(..) in the chain<br>    return axios.get(`<a href="http://www.somepage.com/$%7Bresponse.someValue%7D%60">http://www.somepage.com/${response.someValue}`</a>);<br>})<br>.then(function response { // Reponse being the result of the second request<br>    // Handle response<br>})<br>.catch(function (error) {<br>    // Handle error.<br>});</pre><p>We can also chain then block as shown above in which ‘response’ for each then block is coming from preceding request.</p><p>Promises helped to mitigate the callback hell but it still relies on callbacks in then and catch method. It paved a way for async-await in <a href="https://en.wikipedia.org/wiki/ECMAScript#8th_Edition_-_ECMAScript_2017">ECMAScript 2017</a> that proved to be the cherry on top for Promise. It allows us to write a promise-based code as if it is synchronous.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=40367c45dca0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>