<?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 Chiranjeev Thapliyal on Medium]]></title>
        <description><![CDATA[Stories by Chiranjeev Thapliyal on Medium]]></description>
        <link>https://medium.com/@chiranjeev-thapliyal?source=rss-db8db9769a95------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*oJ5OK3_n5VWt6ZaQemUieQ.png</url>
            <title>Stories by Chiranjeev Thapliyal on Medium</title>
            <link>https://medium.com/@chiranjeev-thapliyal?source=rss-db8db9769a95------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 23:56:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@chiranjeev-thapliyal/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[Clone Faasos With ChatBot — Without libraries]]></title>
            <link>https://medium.com/@chiranjeev-thapliyal/cloning-a-website-from-scratch-d9272f9fbf14?source=rss-db8db9769a95------2</link>
            <guid isPermaLink="false">https://medium.com/p/d9272f9fbf14</guid>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Chiranjeev Thapliyal]]></dc:creator>
            <pubDate>Sun, 29 Aug 2021 14:32:21 GMT</pubDate>
            <atom:updated>2021-10-09T19:37:46.078Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qhz7PUxH6i075icPTkG9Ow.png" /><figcaption><a href="https://medium.com/u/54c92289bd33">FAASOS</a></figcaption></figure><p>In this article, you will get insights into how I and my team were able to clone the <a href="https://medium.com/u/54c92289bd33">FAASOS</a> website in just 1 week.</p><p>So you might be thinking, how can someone clone a full-fledged website like <a href="https://medium.com/u/54c92289bd33">FAASOS</a> in one week, are they lying or what. So let me tell you, you can’t achieve the exact model, but yes, we tried our best and the results we achieved were tremendous.</p><p>So let’s see, what all were we able to achieve:</p><p>The <em>left side</em> is a <strong>real</strong> website, and the <em>right sid</em>e is a <strong>clone</strong>.</p><h3><strong>Landing Page</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R9xhcRoYtJI15rnEZDsYlw.png" /></figure><h3><strong>Collections Page (Real)</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nU_HZtxKbXWFKW_jpV9BFA.png" /></figure><h3><strong>Collections Page (Clone)</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iSWQN3iqxg9riULJHZG2kA.png" /></figure><h3><strong>Checkout Page (Real)</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l5Ipe2mOmyxumspVjYfGJw.png" /></figure><h3><strong>Checkout Page (Clone)</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QEs6toqnNJ1-010vfyhYZQ.png" /></figure><h3><strong>Help &amp; Support with Bot (Real)</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j7zThBjQYlwMO1L-fUkcCg.png" /></figure><h3><strong>Help &amp; Support with Bot (Clone)</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1_0uAVtX3JQrFldyuEqNgw.png" /></figure><p>I think with this much you must have got the idea, of how close we were able to get to the real <a href="https://medium.com/u/54c92289bd33">FAASOS</a> website.</p><p>Some things to note, we can’t achieve everything because the API used by us is different from the one used in the original website, so we can’t achieve the same results. But we are proud that we cloned this much.</p><p>Now coming to the main part, <em>the code</em>, and how we <em>approached it</em>…</p><p>So for the code, you can check out our <a href="https://github.com/chiranjeev-thapliyal/faasos">repository</a>, and if you want to contribute further, you can fork and make a pull request: <a href="https://github.com/chiranjeev-thapliyal/faasos">https://github.com/chiranjeev-thapliyal/faasos</a></p><h3><strong>Front-end comes in…</strong></h3><p>Now coming to the part, of how we approached, and this is one of the crucial parts. Because that’s the first step, and the first step is always the difficult one.</p><p>For us, we started with the UI/UX and Front-end part first. To maintain consistency we first collected the following resources:</p><ul><li>Font —<a href="https://fonts.google.com/specimen/Mulish?query=mulish"> Mulish</a></li><li>Proper line heights and basic UI/UX principles (if interested you can know about <a href="https://www.invisionapp.com/inside-design/golden-ratio-designers/">Golden Ratio</a>, believe me, it’s an interesting topic)</li></ul><blockquote>Just a disclaimer — Golden ratio is also found in <a href="https://www.mathsisfun.com/numbers/nature-golden-ratio-fibonacci.html">Fibonacci Numbers</a> <em>✌</em></blockquote><ul><li>Color Codes</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*5pVA8x7gyRIregb7d-H7Sg.png" /><figcaption>Color codes <a href="https://medium.com/u/54c92289bd33">FAASOS</a></figcaption></figure><h3><strong>Backend Part Comes in…</strong></h3><p>I always underestimated the power of the backend, but when we made a bot on our own, we realized how much power does <strong>Backend</strong> with <strong>Databases</strong> can provide.</p><p>Yeah, you read it right, we created our own <strong>bot</strong>. First, we thought that it would be impossible to make our own bot, but yes we trained our bot to perform certain actions like:</p><ul><li><em>Get Recent Orders</em></li><li><em>Change Registered Number</em></li><li><em>Show Discount coupons</em></li></ul><blockquote>All the commands mentioned above are implemented by us, without any library.</blockquote><p>And for normal commands, we used <a href="https://cloud.google.com/dialogflow"><strong>DialogFlow</strong></a><strong>.</strong></p><p>Yeah, you might be thinking that we used an external library, but wait, we just used it for common commands like e.g. hi, hello, no thanks (and so on)</p><p>So if you remove this library from our project, then also it will work fine. It’s just for <em>enthusiasts</em> who like to reach to utmost potential of libraries and websites.</p><p>So I will list out all points(in order that we followed) on how we approached the backend part:</p><ul><li>Follow MVC structure (<em>models</em>, <em>views</em>, <em>controllers</em>)</li><li>Create a NoSQL database (used <a href="https://medium.com/u/db5cd12199bd">MongoDB</a> <a href="https://www.mongodb.com/cloud/atlas">Atlas</a>)</li><li>Make API for your project (used <a href="https://www.postman.com/">Postman</a> for testing)</li><li>Use token for authentication (used <a href="https://jwt.io/">JWT</a> libraries)</li></ul><p>Note that, in the current version of our app, you might not find JWT, but it was implemented in the earlier part and will be introduced in the next revision of our repository, where <a href="http://www.passportjs.org/">Passport</a> and <a href="https://jwt.io/">JWT</a> will be used.</p><p>This post would be incomplete if I don’t mention the mentors that I had, who helped me throughout the project. A special thanks to <a href="https://www.linkedin.com/in/dhaval-chheda-55888b155/">Dhaval Chheda</a>, <a href="https://www.linkedin.com/in/swanandkadam/">Swanand Kadam</a>, <a href="https://www.linkedin.com/in/saravanakumar-nagaraj/">Saravanakuman J N</a>.</p><p>I can’t cover all things in this post, but if you are eager to learn more about this repo, you can connect with us:</p><p><a href="https://www.linkedin.com/in/chiranjeev-thapliyal-605b561b8/">Chiranjeev Thapliyal</a>, <a href="https://www.linkedin.com/in/shahnawaz-malek-334789130/">Shahnawaz Malek</a>, <a href="https://www.linkedin.com/in/shantanu-pathak-a46485218/">Shantanu Pathak</a>, <a href="https://www.linkedin.com/in/mukul-kumar-922180199/">Mukul Kumar</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d9272f9fbf14" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Number Theory — Primality Test]]></title>
            <link>https://medium.com/@chiranjeev-thapliyal/number-theory-primality-test-79f9b84a7513?source=rss-db8db9769a95------2</link>
            <guid isPermaLink="false">https://medium.com/p/79f9b84a7513</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[prime-numbers]]></category>
            <category><![CDATA[number-theory]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[mathematics]]></category>
            <dc:creator><![CDATA[Chiranjeev Thapliyal]]></dc:creator>
            <pubDate>Sun, 01 Aug 2021 09:41:02 GMT</pubDate>
            <atom:updated>2021-08-01T10:47:15.450Z</atom:updated>
            <content:encoded><![CDATA[<h3>Number Theory — Primality Test</h3><p>How to find if a number is prime, optimized approach!</p><p>There will be seperate blogs for each topic in Number Theory, this is Part 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R6ci7oT3liss9UBXHGfOfw.png" /><figcaption>Find whether a given number is prime or not.</figcaption></figure><p>To give an idea of the blog, we will have 3 approaches here. We will start with the naive approach and then it will be optimized further. For those who already know the O(n) and O(sqrt(n)) solution, they can simply move to the last solution.</p><p>So let’s first understand some key points about prime numbers:</p><h3>Prime Numbers:</h3><blockquote>There are many ways to describe “Prime Numbers”, but the one which I feel is non-ambiguous is: <strong>Prime Numbers are those numbers that have exactly two factors (1 and itself).</strong></blockquote><blockquote><em>Note that 1 is neither prime nor composite.</em></blockquote><p>If you are eager to know more about this, watch this: <a href="https://www.youtube.com/watch?v=IQofiPqhJ_s">https://www.youtube.com/watch?v=IQofiPqhJ_s</a></p><p>Some examples to get you started are:</p><ol><li>2 is a prime, it’s factors are 1 and 2 (exactly two)</li><li>3 is a prime, it’s factors are 1 and 3 (again exactly two)</li><li>29 is a prime, again exactly two factors 1 and 29</li></ol><p>Now that we know about prime numbers, let’s see some approaches to find prime numbers:</p><h3>Naive Approach</h3><p>We will figure out the time complexity of the approaches at last, till then try to figure out time complexity by yourself, and see if you got that right! 💯</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XoyENtsbhZNwPUwa521y0w.png" /><figcaption>O(n) solution to find prime number</figcaption></figure><p>So, you might have figured out that it’s an O(n) solution.</p><p>Generally, we don’t have to just find if a number is prime, we generally face a number of test cases with different numbers. So, then this solution we are very slow, so let’s improvise it to O(sqrt(n)).</p><h3>Optimized solution</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xDHEnZzUwbfSB9UiN1si2Q.png" /><figcaption>O(sqrt(n)) to find if a number is prime.</figcaption></figure><p>We just added 3 characters, and the solution became O(sqrt(n)), a major improvement in time complexity also.</p><p>We just changed the condition from i &lt; num to i*i &lt;= num , but why did we do that? So let’s understand that with an example:</p><p>Let say if the number is 100, then its factors are: 1, 2, 4, 5, 10, 20, 25, 50, 100.</p><p>Better would be this,</p><ul><li>1 x 100 = 100</li><li>2 x 50 = 100</li><li>4 x 25 = 100</li><li>5 x 20 = 100</li><li>10 x 10 = 100</li></ul><p>So, we can see that for every factor its pair was on the right side of the sqrt of the number, like :</p><p>2 x 50 // Here if 2 is a factor of 100 then 50 will also be, and if we can just find the smaller factor then no need to go ahead, right?</p><p>This is the basic crux of the problem, we are just concerned with the factor that is smaller than or equal to the sqrt(n) because if the factor is greater than the square root of n then the other factor that will multiply with it would necessarily be smaller than the square root of n.</p><h3>A little more optimization is always better</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jRKgpX0rUIH7JEuW4Y072Q.png" /><figcaption>Find prime number more optimized solution</figcaption></figure><p>In theory, it won’t have any change in time complexity, it is still O(n), but in the real scenario, it will skip irrelevant numbers and will be a great improvement over the previous optimized solution. The following image will show how much improvement it is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/298/1*bmhFO69F7HLwmNY_M_EbZg.jpeg" /></figure><p>Image quality sucks here, but you can refer to: <a href="https://support.csis.pace.edu/CSISWeb/docs/techReports/techReport286.pdf">https://support.csis.pace.edu/CSISWeb/docs/techReports/techReport286.pdf</a></p><p>Let’s see what this basically did, and how we approached it:</p><p>Let’s list out some prime numbers: 2, 3, 5, 7, 11, 13, 17, 19</p><p>We can see one pattern in prime number, prime numbers other than 2 and 3 follow a pattern, they are in the form of either <strong>6k+1</strong> or <strong>6k-1</strong>:</p><ul><li>5 = 6(1) -1</li><li>7 = 6(1) + 1</li><li>11 = 6(2) -1</li><li>13 = 6(2) + 1, and so on…</li></ul><p>So we can basically use this property(pattern) to remove all the irrelevant checking and can skip on candidate prime numbers.</p><p>Note, don’t think that every number that follows 6k+1, 6k-1 is prime.</p><p>Example: 6(4) + 1 = 25, and it’s not a prime. So every prime number follows 6k+1 or 6k-1 is true, but vice-versa is not true.</p><p>The best part of <strong>The Rule of Six Algorithm</strong> is that it can be used in the <strong>Sieve of Eratosthenes</strong>, and again it will be a major improvement, though again not in theory but in practice.</p><blockquote>So now if the interviewer says, can there be any more improvements, you have one more answer to impress them!</blockquote><p>Hope that you liked this article and looking forward to feedbacks, will post more such stuff on Number Theory in the future ✌😄.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=79f9b84a7513" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>