<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Avishek Patra</title>
    <description>The latest articles on DEV Community by Avishek Patra (@avishekp86).</description>
    <link>https://dev.to/avishekp86</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F336836%2F1d2833f0-cb3e-4971-8b62-f2494abe697d.jpg</url>
      <title>DEV Community: Avishek Patra</title>
      <link>https://dev.to/avishekp86</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/avishekp86"/>
    <language>en</language>
    <item>
      <title>Kunth-Morris-Pratt(KMP) Algorithm For Pattern Searching</title>
      <dc:creator>Avishek Patra</dc:creator>
      <pubDate>Thu, 19 Mar 2020 17:35:27 +0000</pubDate>
      <link>https://dev.to/avishekp86/kunth-morris-pratt-kmp-algorithm-for-pattern-searching-19p6</link>
      <guid>https://dev.to/avishekp86/kunth-morris-pratt-kmp-algorithm-for-pattern-searching-19p6</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Pattern searching is an important problem in computer science. When we do search for a string in notepad/word file or browser or database, pattern searching algorithms are used to show the search results. Here is the list of available algorithms available to for this Job&lt;/p&gt;

&lt;p&gt;Read the whole article here&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="https://medium.com/@avishekp86/kunth-morris-pratt-kmp-algorithm-for-pattern-searching-552661788e6b" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DwfhGhQZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/fit/c/96/96/1%2A8irnp-vH4-nE9ONGKt-5lw.jpeg" alt="Avishek Patra"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://medium.com/@avishekp86/kunth-morris-pratt-kmp-algorithm-for-pattern-searching-552661788e6b" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Kunth-Morris-Pratt(KMP) Algorithm For Pattern Searching | by Avishek Patra | Medium&lt;/h2&gt;
      &lt;h3&gt;Avishek Patra ・ &lt;time&gt;Mar 19, 2020&lt;/time&gt; ・ 7 min read
      &lt;div class="ltag__link__servicename"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KBvj_QRD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/medium_icon-90d5232a5da2369849f285fa499c8005e750a788fdbf34f5844d5f2201aae736.svg" alt="Medium Logo"&gt;
        Medium
      &lt;/div&gt;
    &lt;/h3&gt;
&lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;p&gt;If you've liked this article then please follow me on &lt;a href="https://www.twitter.com/avishekp86"&gt;twitter&lt;/a&gt; to encourage me to write more article like this.&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>javascript</category>
      <category>codenewbie</category>
      <category>dotnet</category>
    </item>
    <item>
      <title>Best way to get all prime numbers (Sieve of Eratosthenes)</title>
      <dc:creator>Avishek Patra</dc:creator>
      <pubDate>Sun, 15 Mar 2020 16:00:22 +0000</pubDate>
      <link>https://dev.to/avishekp86/best-way-to-get-all-prime-numbers-sieve-of-eratosthenes-k8e</link>
      <guid>https://dev.to/avishekp86/best-way-to-get-all-prime-numbers-sieve-of-eratosthenes-k8e</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In almost every interviews, an optimized way of searching is a very common thing nowadays, especially when it comes to numbers it becomes more interesting. Today we will be discussing one of the most popular questions among the interviewers, finding all the prime numbers from a series of 0 to 1 million numbers. Looping through from 0 to 1 million number will definitely give you the desired outcome however in terms of performance and time complexity it will not perform good, so the catch is if this is not the ideal way of doing this then what will be the other option. &lt;/p&gt;

&lt;p&gt;From the title, most of you have already guessed its something called "Sieve of  Eratosthenes" well this is an ancient algorithm to eliminate all the prime numbers from a long series. Let's find out what does this algorithm says&lt;/p&gt;

&lt;h2&gt;
  
  
  Sieve of  Eratosthenes
&lt;/h2&gt;

&lt;p&gt;Wikipedia says "In mathematics, the Sieve of Eratosthenes is a simple and ingenious ancient algorithm for finding all prime numbers up to any given limit." &lt;/p&gt;

&lt;h3&gt;
  
  
  How does it do
&lt;/h3&gt;

&lt;p&gt;It does so by iteratively marking as composite (i.e., not prime) the multiples of each prime, starting with the first prime number, 2. The multiples of a given prime are generated as a sequence of numbers starting from that prime, with a constant difference between them that is equal to that prime.[1] This is the sieve's key distinction from using trial division to sequentially test each candidate number for divisibility by each prime.&lt;/p&gt;

&lt;h3&gt;
  
  
  Algorithm &amp;amp; Implementation
&lt;/h3&gt;

&lt;p&gt;The algorithm says the following&lt;/p&gt;

&lt;p&gt;A &lt;strong&gt;prime number&lt;/strong&gt; is a natural number that has exactly two distinct natural number divisors: the number 1 and itself.&lt;/p&gt;

&lt;p&gt;To find all the prime numbers less than or equal to a given integer n by Eratosthenes' method:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a list of consecutive integers from 2 through n: (2, 3, 4, ..., n).&lt;/li&gt;
&lt;li&gt;Initially, let p equal 2, the smallest prime number.&lt;/li&gt;
&lt;li&gt;Enumerate the multiples of p by counting in increments of p from 2p to n, and mark them in the list (these will be 2p, 3p, 4p, ...; the p itself should not be marked).&lt;/li&gt;
&lt;li&gt;Find the first number greater than p in the list that is not marked. If there was no such number, stop. Otherwise, let p now equal this new number (which is the next prime), and repeat from step 3.&lt;/li&gt;
&lt;li&gt;When the algorithm terminates, the numbers remaining not marked in the list are all the primes below n.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;See how cleverly it manage to find all the prime numbers in an efficient way. Now let's look at the implementation of the algorithm. We will be doing it by using javascript.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;GenerateSieve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;max&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Creating an array indicating whether numbers are prime.&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;is_prime&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;max&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;=&lt;/span&gt;&lt;span class="nx"&gt;max&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;is_prime&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;//Crossing out multiplies&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;=&lt;/span&gt;&lt;span class="nx"&gt;max&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;//Check if its prime&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;is_prime&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="c1"&gt;//Eliminate the multiplies of i&lt;/span&gt;
            &lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;=&lt;/span&gt;&lt;span class="nx"&gt;max&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="o"&gt;+=&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
                &lt;span class="nx"&gt;is_prime&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;is_prime&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lets understand the code line by line&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;    &lt;span class="c1"&gt;// Creating an array indicating whether numbers are prime.&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;is_prime&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;max&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the above snippet, you can see we are creating an array&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;   &lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;=&lt;/span&gt;&lt;span class="nx"&gt;max&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;is_prime&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Through this loop, we are marking all the numbers in the array as a prime number, except 0,1 and 2 as we know already know about their prime and non-prime stands&lt;/p&gt;

&lt;p&gt;0,1 being non-prime numbers and 2 being the smallest prime number, we have initialized the loop from 2 and mark all the numbers beyond that as prime numbers. So as of now, all the elements are prime numbers in the &lt;strong&gt;is_prime&lt;/strong&gt; array.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;    &lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;=&lt;/span&gt;&lt;span class="nx"&gt;max&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;//Check if its prime&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;is_prime&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="c1"&gt;//Eliminate the multiplies of i&lt;/span&gt;
            &lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;=&lt;/span&gt;&lt;span class="nx"&gt;max&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="o"&gt;+=&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
                &lt;span class="nx"&gt;is_prime&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;j&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here in the first loop, we are iterating through each element starting from 2 and then in the second loop we are eliminating the composite numbers from the &lt;strong&gt;_is_prime&lt;/strong&gt; array, so in forward we are already removing the composite numbers from the array so as a result the outer loop may run for nth number and inner loop will not run for that time as the following statement will stop it running&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;   &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;is_prime&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
   &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="p"&gt;....&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Hope, the algorithm and its implementation now clear. The complete implementation of this algorithm can be found in both &lt;a href="https://github.com/patravishek/sieveoferatosthenes_node" rel="noopener noreferrer"&gt;javascript&lt;/a&gt; and in &lt;a href="https://github.com/patravishek/sieveoferatosthenes" rel="noopener noreferrer"&gt;c#&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So if you've liked this article then please like it, this will give me confidence to write more article in future. Also if you want to get daily updates or resolve any of your doubts on your #100daysofcode program then feel free to DM me on twitter. My twitter handle is &lt;a class="mentioned-user" href="https://dev.to/avishekp86"&gt;@avishekp86&lt;/a&gt;&lt;/p&gt;

</description>
      <category>100daysofcode</category>
      <category>codenewbie</category>
      <category>javascript</category>
      <category>algorithms</category>
    </item>
    <item>
      <title>Generics in Typescript
</title>
      <dc:creator>Avishek Patra</dc:creator>
      <pubDate>Sat, 14 Mar 2020 18:59:38 +0000</pubDate>
      <link>https://dev.to/avishekp86/generics-in-typescript-14hm</link>
      <guid>https://dev.to/avishekp86/generics-in-typescript-14hm</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A major part of software engineering is building components that not only have well-defined and consistent APIs but are also reusable. Components that are capable of working on the data of today, as well as the data of tomorrow, will give you the most flexible capabilities for building up large software systems.&lt;br&gt;
In languages like C# and Java, one of the main ways for creating reusable components is generics, that is, being able to create a component that can work over a variety of types rather than a single one. This allows users to consume these components and use their own types.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Interested to know more? Read the complete article from here&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag__link"&gt;
  &lt;a href="https://medium.com/@avishekp86/generics-in-typescript-69586b13bbfd" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DwfhGhQZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/fit/c/96/96/1%2A8irnp-vH4-nE9ONGKt-5lw.jpeg" alt="Avishek Patra"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://medium.com/@avishekp86/generics-in-typescript-69586b13bbfd" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;How to Create Generics in Typescript | Medium&lt;/h2&gt;
      &lt;h3&gt;Avishek Patra ・ &lt;time&gt;Mar 14, 2020&lt;/time&gt; ・ 6 min read
      &lt;div class="ltag__link__servicename"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KBvj_QRD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/medium_icon-90d5232a5da2369849f285fa499c8005e750a788fdbf34f5844d5f2201aae736.svg" alt="Medium Logo"&gt;
        Medium
      &lt;/div&gt;
    &lt;/h3&gt;
&lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;p&gt;If you want me to write the entire article on dev.to then please let me know via comments here or twitter. My twitter handle is &lt;a href="https://twitter.com/avishekp86"&gt;https://twitter.com/avishekp86&lt;/a&gt;&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>codenewbie</category>
      <category>100daysofcode</category>
      <category>generics</category>
    </item>
    <item>
      <title>Step by Step building a PWA in Angular 8</title>
      <dc:creator>Avishek Patra</dc:creator>
      <pubDate>Fri, 06 Mar 2020 14:10:38 +0000</pubDate>
      <link>https://dev.to/avishekp86/step-by-step-building-a-pwa-in-angular-8-3jm2</link>
      <guid>https://dev.to/avishekp86/step-by-step-building-a-pwa-in-angular-8-3jm2</guid>
      <description>&lt;p&gt;Creating a Progressive Web Application, the application which can be run as like a native app from the mobile devices and regular sites from a browser, using Angular 8, I have consumed a simple REST API and displayed the data in the landing page.&lt;/p&gt;

&lt;p&gt;Read the detailed article here in &lt;a href="https://medium.com"&gt;medium&lt;/a&gt;&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="https://medium.com/@avishekpatra.1986/step-by-step-building-a-pwa-in-angular-8-eb85443491b7" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DwfhGhQZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/fit/c/96/96/1%2A8irnp-vH4-nE9ONGKt-5lw.jpeg" alt="Avishek Patra"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://medium.com/@avishekpatra.1986/step-by-step-building-a-pwa-in-angular-8-eb85443491b7" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Step by Step building a PWA in Angular 8 | by Avishek Patra | Medium&lt;/h2&gt;
      &lt;h3&gt;Avishek Patra ・ &lt;time&gt;Mar 6, 2020&lt;/time&gt; ・ 11 min read
      &lt;div class="ltag__link__servicename"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KBvj_QRD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/medium_icon-90d5232a5da2369849f285fa499c8005e750a788fdbf34f5844d5f2201aae736.svg" alt="Medium Logo"&gt;
        Medium
      &lt;/div&gt;
    &lt;/h3&gt;
&lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;p&gt;The source code is available on (GitHub)[&lt;a href="https://github.com/patravishek/pwa-angular"&gt;https://github.com/patravishek/pwa-angular&lt;/a&gt;]&lt;/p&gt;

&lt;p&gt;On completion of the tutorial, you should be able to build a similar application like shown below&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7vCsYfQK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/0j3smrnq5h8p2x1f61l1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7vCsYfQK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/0j3smrnq5h8p2x1f61l1.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you love the tutorial please like or comment so more tutorial can bring afterwards.&lt;/p&gt;

</description>
      <category>pwa</category>
      <category>angular</category>
      <category>newdev</category>
      <category>100daysofcode</category>
    </item>
    <item>
      <title>Creating Extension for VS-Code</title>
      <dc:creator>Avishek Patra</dc:creator>
      <pubDate>Wed, 26 Feb 2020 11:46:57 +0000</pubDate>
      <link>https://dev.to/avishekp86/creating-extension-for-vs-code-25pm</link>
      <guid>https://dev.to/avishekp86/creating-extension-for-vs-code-25pm</guid>
      <description>&lt;p&gt;Originally posted on Medium.com. I am sharing the medium embedded link here, if you want me to repost the entire article on dev.to then let me know by the comments section.&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="https://medium.com/@avishekpatra.1986/creating-extension-for-vs-code-741a26fa0f74" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DwfhGhQZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/fit/c/96/96/1%2A8irnp-vH4-nE9ONGKt-5lw.jpeg" alt="Avishek Patra"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://medium.com/@avishekpatra.1986/creating-extension-for-vs-code-741a26fa0f74" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Creating Extension for VS-Code. Almost all of us have used extensions… | by Avishek Patra | Medium&lt;/h2&gt;
      &lt;h3&gt;Avishek Patra ・ &lt;time&gt;Mar 12, 2020&lt;/time&gt; ・ 7 min read
      &lt;div class="ltag__link__servicename"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KBvj_QRD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/medium_icon-90d5232a5da2369849f285fa499c8005e750a788fdbf34f5844d5f2201aae736.svg" alt="Medium Logo"&gt;
        Medium
      &lt;/div&gt;
    &lt;/h3&gt;
&lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>vscode</category>
      <category>javascript</category>
      <category>tutorial</category>
      <category>100daysofcode</category>
    </item>
    <item>
      <title>Adding swagger through VSCode</title>
      <dc:creator>Avishek Patra</dc:creator>
      <pubDate>Fri, 21 Feb 2020 11:18:42 +0000</pubDate>
      <link>https://dev.to/avishekp86/adding-swagger-through-vscode-525p</link>
      <guid>https://dev.to/avishekp86/adding-swagger-through-vscode-525p</guid>
      <description>&lt;p&gt;API is the backbone of any website, now when you develop and API then documenting the API would be a very important part. Now manual documentation is good but interactive documentation with tests always better than the previous. So what if there are some tools that are already present which do your job almost automatically. &lt;/p&gt;

&lt;p&gt;"Swagger"(&lt;a href="https://swagger.io/" rel="noopener noreferrer"&gt;https://swagger.io/&lt;/a&gt;) does this work very swiftly. It's an Open Source product, it takes care of the following areas of an API Project very swiftly&lt;/p&gt;

&lt;p&gt;&lt;em&gt;API Design&lt;/em&gt;&lt;br&gt;
&lt;em&gt;API Development&lt;/em&gt;&lt;br&gt;
&lt;em&gt;API Documentation&lt;/em&gt;&lt;br&gt;
&lt;em&gt;API Testing&lt;/em&gt;&lt;br&gt;
&lt;em&gt;API Mocking and Virtualization&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;It can be integrated with any of the languages that supports API development. &lt;/p&gt;

&lt;p&gt;Today we’ll be going through the steps through which we can add swagger in our API Project.&lt;/p&gt;

&lt;p&gt;We will see the implementation of the swagger on an AspNetCore API project using vs-code.&lt;/p&gt;

&lt;p&gt;Now, let’s Open the .NET CLI or console and write the following command&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;dotnet new webapi&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This will create a web API project without swagger added.&lt;/p&gt;

&lt;p&gt;Directory Structure will look something like below since I'm using vs-code to develop the API the screenshot is showing the vs-code explorer window&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fug57rv22klmw7gmt1u2m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fug57rv22klmw7gmt1u2m.png" alt="Directory Structure" width="387" height="359"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now let's follow the steps below to add swagger Nuget in our project.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Step 1: Add NuGet Package&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Open the vs-code terminal and run the following command&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;dotnet add TodoApi.csproj package Swashbuckle.AspNetCore&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Step 2: Add &amp;amp; Configure Swagger to Middleware&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now we have to modify the ConfigureServices Method&lt;/p&gt;

&lt;p&gt;&lt;em&gt;public void ConfigureServices(IServiceCollection services)&lt;br&gt;
{&lt;br&gt;
services.AddMvc();&lt;br&gt;
services.AddSwaggerGen(c =&amp;gt;&lt;br&gt;
{&lt;br&gt;
c.SwaggerDoc("v1", new Info { Title = "My API", Version = "v1" });&lt;br&gt;
});&lt;br&gt;
}&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now add &lt;strong&gt;using Swashbuckle.AspNetCore.Swagger;&lt;/strong&gt; so that compiler could know from where the reference of Info class should be taken.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Step 3: Letting the middleware know about the swagger UI and the endpoint information&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Navigate to the &lt;em&gt;configure&lt;/em&gt; method of &lt;em&gt;Startup.cs&lt;/em&gt; and add the following code&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;app.UseSwagger();&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;// Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.), specifying the Swagger JSON endpoint.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;app.UseSwaggerUI(c =&amp;gt;&lt;br&gt;
{&lt;br&gt;
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");&lt;br&gt;
});&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;And we are done, so let's test our implementation, open the vs-code terminal again and then run the following command:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;dotnet run&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This should run the application, once it starts running we can see how swagger is managing the API documentation.&lt;/p&gt;

&lt;p&gt;Open Chrome or any other browser of your choice and post the following URL&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;a href="http://localhost:" rel="noopener noreferrer"&gt;http://localhost:&lt;/a&gt;/swagger/&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;you should be using the port number on which your application has been started. Now on your browser you should see the swagger documentation like below&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fkwkjn76chxvqr9vr0eoc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fkwkjn76chxvqr9vr0eoc.png" alt="Alt Text" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So simple right. If you've liked this tutorial then please follow me on &lt;a href="https://twitter.com/avishekp86" rel="noopener noreferrer"&gt;twitter&lt;/a&gt; and &lt;a href="https://dev.to/avishekp86"&gt;dev.to&lt;/a&gt;&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>vscode</category>
    </item>
  </channel>
</rss>
