<?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: souvik</title>
    <description>The latest articles on DEV Community by souvik (@souvik_ns).</description>
    <link>https://dev.to/souvik_ns</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%2F284205%2Fc5b69f2c-3bb4-4da8-bcfe-5c500aeff7e6.jpg</url>
      <title>DEV Community: souvik</title>
      <link>https://dev.to/souvik_ns</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/souvik_ns"/>
    <language>en</language>
    <item>
      <title>CLI parser for Ink js </title>
      <dc:creator>souvik</dc:creator>
      <pubDate>Mon, 03 May 2021 16:52:23 +0000</pubDate>
      <link>https://dev.to/souvik_ns/cli-parser-for-ink-js-d3j</link>
      <guid>https://dev.to/souvik_ns/cli-parser-for-ink-js-d3j</guid>
      <description>&lt;p&gt;I recently stumbled upon &lt;a href="https://github.com/vadimdemedes/ink#getting-started"&gt;ink&lt;/a&gt;, and really liked it. Ink provides the same component-based UI building experience that React offers in the browser, but for command-line apps.&lt;/p&gt;

&lt;p&gt;for CLI parsing we can use any libraries out there, but all the libraries accept &lt;code&gt;string&lt;/code&gt; for the help text. I really wanted a library that would be light and also help render ink components, so as to leverage the beautiful &lt;code&gt;ink&lt;/code&gt; library. So I am currently working on &lt;a href="https://github.com/Souvikns/ink-cli-parser"&gt;https://github.com/Souvikns/ink-cli-parser&lt;/a&gt; where users can pass ink component is a help string.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;parser&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./index&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;FC&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Newline&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;ink&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Help&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;FC&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;any&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&amp;gt;&lt;/span&gt;

        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Text&lt;/span&gt; &lt;span class="na"&gt;backgroundColor&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"greenBright"&lt;/span&gt; &lt;span class="na"&gt;bold&lt;/span&gt; &lt;span class="na"&gt;color&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"white"&lt;/span&gt; &lt;span class="p"&gt;&amp;gt;&lt;/span&gt; USAGE &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Newline&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;$ cli-command &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;command&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; [options]&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Newline&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Text&lt;/span&gt; &lt;span class="na"&gt;backgroundColor&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"cyanBright"&lt;/span&gt; &lt;span class="na"&gt;bold&lt;/span&gt; &lt;span class="na"&gt;color&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"white"&lt;/span&gt; &lt;span class="p"&gt;&amp;gt;&lt;/span&gt; COMMANDS &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Newline&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Text&lt;/span&gt; &lt;span class="na"&gt;color&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"cyanBright"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;new&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; creates a new file&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Text&lt;/span&gt; &lt;span class="na"&gt;color&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"cyanBright"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;duplicate&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; duplicates a existing file&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Newline&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Text&lt;/span&gt; &lt;span class="na"&gt;backgroundColor&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"yellowBright"&lt;/span&gt; &lt;span class="na"&gt;bold&lt;/span&gt; &lt;span class="na"&gt;color&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"black"&lt;/span&gt; &lt;span class="p"&gt;&amp;gt;&lt;/span&gt; OPTIONS &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Newline&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Text&lt;/span&gt; &lt;span class="na"&gt;color&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"yellowBright"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;--random&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; prints random data&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;

    &lt;span class="p"&gt;&amp;lt;/&amp;gt;&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;cli&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;parser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;Help&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;cli&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;// {inputs: [], flags: {h: true}}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Do check it out any thoughts are welcomed. &lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>typescript</category>
      <category>beginners</category>
      <category>node</category>
      <category>opensource</category>
    </item>
    <item>
      <title>My Hacktoberfest Project 😊</title>
      <dc:creator>souvik</dc:creator>
      <pubDate>Sat, 26 Sep 2020 22:58:34 +0000</pubDate>
      <link>https://dev.to/souvik_ns/my-hacktoberfest-project-18cc</link>
      <guid>https://dev.to/souvik_ns/my-hacktoberfest-project-18cc</guid>
      <description>&lt;p&gt;I started my open source journey with &lt;strong&gt;Hacktoberfest&lt;/strong&gt; last year. I have come a long way and learned new things, thanks to open source. This year I am very happy and excited to create my own project for hacktoberfest. Though I have very little skills in maintaining projects, I suppose I could learn it this year. &lt;/p&gt;

&lt;h2&gt;
  
  
  This is what I created 🙃.
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/Souvikns/JContainer"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PPqJBjY1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github-readme-stats.vercel.app/api/pin/%3Fusername%3DSouvikns%26repo%3DJContainer%26theme%3Ddracula" alt="ReadMe Card"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  About
&lt;/h3&gt;

&lt;p&gt;The main idea behind the project is to create a prebuilt &lt;strong&gt;REST API&lt;/strong&gt; for all our data storage needs. With the help of &lt;a href="https://vercel.com"&gt;vercel&lt;/a&gt;, we can set it up with just a click. &lt;br&gt;
After deploying it, you can use the &lt;strong&gt;REST API&lt;/strong&gt; to interact with this container and store your data. &lt;/p&gt;

&lt;h3&gt;
  
  
  Yeah I know what you are thinking 😋
&lt;/h3&gt;

&lt;p&gt;If it's an API won't anyone be able to access my data? The first time when you enter your container you set up a passcode and it generates an &lt;code&gt;API_KEY&lt;/code&gt;. Then you need to pass the &lt;code&gt;API_KEY&lt;/code&gt; in the headers to authenticate yourself. Anyone with the &lt;code&gt;API_KEY&lt;/code&gt;can access your data so, keep it safe.&lt;/p&gt;




&lt;blockquote&gt;
&lt;p&gt;The project is at its early stage, do check it out and show some love. Leave a star if you like it. 😊&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://github.com/Souvikns/JContainer/issues"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cjNfHp1f--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://img.shields.io/github/issues/Souvikns/JContainer%3Fstyle%3Dfor-the-badge" alt="GitHub issues"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>hacktoberfest</category>
      <category>javascript</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>State management in React made easy</title>
      <dc:creator>souvik</dc:creator>
      <pubDate>Mon, 07 Sep 2020 15:18:39 +0000</pubDate>
      <link>https://dev.to/souvik_ns/state-management-in-react-made-easy-13a9</link>
      <guid>https://dev.to/souvik_ns/state-management-in-react-made-easy-13a9</guid>
      <description>&lt;p&gt;If you are using react to build web apps, you would know managing state is fairly complex, you either have to use big state management libraries like &lt;strong&gt;redux&lt;/strong&gt; or use context api. Both approaches needs you to write a lot of boilerplate code, even to work on a small and easy to build feature. &lt;/p&gt;

&lt;p&gt;I faced a lot of these problems, thus I created this util library called &lt;a href="https://github.com/Ninja-Developers/kladi"&gt;kladi&lt;/a&gt;. It is built using context api. Using &lt;strong&gt;kladi&lt;/strong&gt; is fairly simple.&lt;/p&gt;

&lt;h2&gt;
  
  
  Here is how easy it is to use
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;First, install kladi by typing &lt;code&gt;npm i kladi&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Then you need to wrap your base component with a provider so that all components in your component tree gets the global state.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight jsx"&gt;&lt;code&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Provider&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;kladi&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;ReactDOM&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react-dom&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./App&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;ReactDOM&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Provider&lt;/span&gt; &lt;span class="na"&gt;initialState&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;count&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;App&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Provider&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;,&lt;/span&gt;
  &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;root&lt;/span&gt;&lt;span class="dl"&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;you can pass an initial state object for you access anywhere in the component tree. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now to access your state anywhere from the component tree use the hook provided by &lt;strong&gt;kladi&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;kladi&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;props&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setCount&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;count&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setName&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;name&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Kladi&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&amp;gt;&lt;/span&gt;
&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; 
&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;onClick&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;setCount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;count&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="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Press&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;&amp;lt;/&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;yes you can create a new state in the fly and also access them in other components as well. Well, it does look like the &lt;code&gt;useState&lt;/code&gt; hook from &lt;code&gt;react&lt;/code&gt;, but this state is global. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To create and access state you need to maintain a unique string value. &lt;br&gt;
also to create a new state, you have to provide a default value, but if you are accessing a state that is already present then you don't need to provide the default value. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;blockquote&gt;
&lt;p&gt;This library is new and under development, if you use this library and found any bugs pls create an issue &lt;a href="https://github.com/Ninja-Developers/kladi/issues"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
    </item>
    <item>
      <title>How to make a CLI application in python </title>
      <dc:creator>souvik</dc:creator>
      <pubDate>Mon, 16 Mar 2020 21:29:33 +0000</pubDate>
      <link>https://dev.to/souvik_ns/how-to-make-a-cli-application-in-python-5am2</link>
      <guid>https://dev.to/souvik_ns/how-to-make-a-cli-application-in-python-5am2</guid>
      <description>&lt;h1&gt;
  
  
  Create an express-generator application of our own.
&lt;/h1&gt;

&lt;p&gt;We will use &lt;strong&gt;python&lt;/strong&gt; and &lt;strong&gt;docopt&lt;/strong&gt; to create a &lt;strong&gt;CLI&lt;/strong&gt; application. &lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Install docopt.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;pip install docopt&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;To know more about docopt &lt;a href="http://docopt.org/"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;To use docopt we need to create a docstring in python
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;'''create-express-app.
Usage:
    create-express-app.py (-h | --help)
    create-express-app.py --version
    create-express-app.py check 
    create-express-app.py create &amp;lt;params&amp;gt;
Options:
    -h --help   Show this screen
    --version   Show Version 
'''
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 3:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Now all we have to do is to import docopt and parse the input
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from docopt import docopt 
if __name__ == '__main__':
   arguments = docopt(__doc__,version='1.0.0')
   print(arguments)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 4:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Now we have to write functions to handle the parsed inputs &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The &lt;code&gt;arguments&lt;/code&gt; variable returns a dictionary &lt;br&gt;
we can then check for the command we are looking and perform the function&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if arguments['check'] == True:
        check()
    elif arguments['create'] == True:
        create(arguments['&amp;lt;params&amp;gt;'])
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  The &lt;code&gt;create&lt;/code&gt; function :
&lt;/h3&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def create(params):
    import os 
    import subprocess
    os.mkdir(params)
    path = './'+params
    os.chdir(path)
    os.system("npm init -y")
    os.system("type nul &amp;gt; app.js")
    os.system("npm i express body-parser")
    os.system("code ..")
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;In the create function we are building the project to do the following task:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;run npm init &lt;/li&gt;
&lt;li&gt;Create a file named app.js &lt;/li&gt;
&lt;li&gt;install the express and body-parser npm packages &lt;/li&gt;
&lt;li&gt;and open the directory in visual studio code.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To check out the complete code &lt;a href="https://github.com/Souvikns/create_express_app"&gt;here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
    </item>
    <item>
      <title>Best way to learn about architectural styles for android?</title>
      <dc:creator>souvik</dc:creator>
      <pubDate>Sun, 08 Dec 2019 16:58:53 +0000</pubDate>
      <link>https://dev.to/souvik_ns/best-way-to-learn-about-architectural-styles-for-android-59of</link>
      <guid>https://dev.to/souvik_ns/best-way-to-learn-about-architectural-styles-for-android-59of</guid>
      <description>&lt;p&gt;Can anyone suggest any good way to learn different architectural styles for android?  &lt;/p&gt;

</description>
      <category>android</category>
      <category>help</category>
    </item>
    <item>
      <title>Using .gitignore files </title>
      <dc:creator>souvik</dc:creator>
      <pubDate>Sat, 07 Dec 2019 04:49:13 +0000</pubDate>
      <link>https://dev.to/souvik_ns/using-gitignore-files-849</link>
      <guid>https://dev.to/souvik_ns/using-gitignore-files-849</guid>
      <description>&lt;p&gt;Sometimes your project that you are going to upload to GitHub contains some very important data that you don’t want the whole internet to see. Thus to tackle this problem it is very essential to maintain a &lt;b&gt;.gitignore&lt;/b&gt; file that excludes the different files that you don’t want to be uploaded.&lt;/p&gt;

&lt;h4&gt;Some common examples of files that you don’t want to get uploaded to the git servers are:&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;dependency caches, such as the contents of /node_modules or /packages.&lt;/li&gt;
&lt;li&gt;compiled code, such as .o , . pyc , etc&lt;/li&gt;
&lt;li&gt;build output directories, such as /bin, /out, or /target&lt;/li&gt;
&lt;li&gt;files generated at runtime, such as .log, .lock, or .tmp&lt;/li&gt;
&lt;li&gt;hidden system files, such as .DS_Store or Thumbs.db&lt;/li&gt;
&lt;li&gt;personal IDE config files, such as .idea/workspace.xml&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Git sees every file in your working copy as one of the three things &lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt; Tracked - a file which has been previously committed &lt;/li&gt;
&lt;li&gt; Untracked - a file which has not been committed before &lt;/li&gt;
&lt;li&gt; Ignored - a file which git was explicitly told to ignore &lt;/li&gt;
&lt;/ul&gt;
&lt;br&gt;

&lt;p&gt;There is no code to toggle gitignore, it is a file that you have to create before committing and maintain it regularly. You have to put names of the files that you want to ignore. &lt;br&gt;
&lt;b&gt;A gitignore file specifies intentionally untracked files that git should ignore. Files already tracked by git are not affected.&lt;/b&gt;
&lt;/p&gt;





&lt;h5&gt;To learn more about &lt;b&gt;.gitignore&lt;/b&gt; files click here &lt;a href="https://git-scm.com/docs/gitignore"&gt;here&lt;/a&gt;
&lt;/h5&gt;

&lt;h5&gt;click &lt;a href="https://github.com/github/gitignore"&gt;here&lt;/a&gt; to Check out the pre-made gitignore file templates. Use this list to populate the .gitignore template choosers available in the GitHub.com interface when creating new repositories and files.
 &lt;/h5&gt;

</description>
      <category>git</category>
      <category>github</category>
      <category>beginners</category>
    </item>
    <item>
      <title>How to use Repository Templates in GitHub?</title>
      <dc:creator>souvik</dc:creator>
      <pubDate>Fri, 06 Dec 2019 07:26:44 +0000</pubDate>
      <link>https://dev.to/souvik_ns/how-to-use-repository-templates-in-github-mi2</link>
      <guid>https://dev.to/souvik_ns/how-to-use-repository-templates-in-github-mi2</guid>
      <description>&lt;p&gt;This is a fairly new to GitHub feature released in 2019. In the post i am going to speak about this new feature and how to used it. &lt;/p&gt;

&lt;h3&gt;Benefits of using repository template&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Spend less time repeating code 
&lt;/li&gt;
&lt;li&gt;Focus on building new things &lt;/li&gt;
&lt;li&gt;Less manual configuration&lt;/li&gt;
&lt;li&gt;Sharing boilerplate code across codebase&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Features of repository template&lt;/h3&gt;


&lt;ul&gt;

&lt;li&gt;Copy the entire repository files to a brand new repository &lt;/li&gt;

&lt;li&gt;Every template has a new url endpoint called &lt;b&gt;/generate&lt;/b&gt;
&lt;/li&gt;

&lt;li&gt;Share repository template through your organization or other github users &lt;/li&gt;






&lt;h2&gt;How to use this awesome feature&lt;/h2&gt;


&lt;/ul&gt;
&lt;ol&gt;
&lt;li&gt;On github, navigate to the main page of the repository&lt;/li&gt;
&lt;li&gt;Under the repository name click settings 
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7mcz9piF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github-images.s3.amazonaws.com/enterprise/2.15/assets/images/help/repository/repo-actions-settings.png"&gt;
&lt;/li&gt;
&lt;li&gt;Select template repository
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lMp7KHzE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://help.github.com/assets/images/help/repository/template-repository-checkbox.png"&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;How to create a repository from a template&lt;/h2&gt;



&lt;ol&gt;

&lt;li&gt;On, navigate to the github main page of the repository &lt;/li&gt;

&lt;li&gt;Above the file list click &lt;b&gt;Use this template&lt;/b&gt;
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VvHg_2On--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://help.github.com/assets/images/help/repository/use-this-template-button.png"&gt;
&lt;/li&gt;

&lt;li&gt;Use the owner drop down menu and select the account you want to own the repository
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UPd5J4uj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://help.github.com/assets/images/help/repository/create-repository-owner.png"&gt;
 &lt;/li&gt;

&lt;li&gt;Type the name for your repository, and select the account you want to own the repository
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ato_I1BZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://help.github.com/assets/images/help/repository/create-repository-name.png"&gt;
&lt;/li&gt;

&lt;li&gt;Choose to make the repository either public or private. Public repositories are visible to the public, while private repositories are only accessible to you, and people you share them with.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HWRbvlN2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://help.github.com/assets/images/help/repository/create-repository-public-private.png"&gt;
&lt;/li&gt;

&lt;li&gt;Optionally, if the personal account or organization in which you're creating uses any GitHub Apps from GitHub Marketplace, select any apps you'd like to use in the repository.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QXfHeAqK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://help.github.com/assets/images/help/repository/create-repository-choose-marketplace-apps.png"&gt;
&lt;/li&gt;

&lt;li&gt;Click &lt;b&gt;Create repository from template&lt;/b&gt;
&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>github</category>
      <category>codequality</category>
      <category>productivity</category>
    </item>
    <item>
      <title>The State of Developer Ecosystem 2019</title>
      <dc:creator>souvik</dc:creator>
      <pubDate>Wed, 04 Dec 2019 00:58:48 +0000</pubDate>
      <link>https://dev.to/souvik_ns/the-state-of-developer-ecosystem-2019-2n5i</link>
      <guid>https://dev.to/souvik_ns/the-state-of-developer-ecosystem-2019-2n5i</guid>
      <description>&lt;h2&gt;
  
  
  In the beginning of 2019 jet-brains polled almost 7,000 developers to identify the state of developer ecosystem
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Key takeaways
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;Java&lt;/em&gt; &lt;br&gt;
The most popular programming language &lt;/p&gt;

&lt;p&gt;&lt;em&gt;JavaScript&lt;/em&gt;&lt;br&gt;
The most used overall programming language &lt;/p&gt;

&lt;p&gt;&lt;em&gt;GO&lt;/em&gt;&lt;br&gt;
The most promising programming language &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Python&lt;/em&gt; &lt;br&gt;
Most studied language&lt;/p&gt;

&lt;h4&gt;
  
  
  What Programming language programmers have used in the last year
&lt;/h4&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;language&lt;/th&gt;
&lt;th&gt;used&lt;/th&gt;
&lt;th&gt;migrate&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;JavaScript&lt;/td&gt;
&lt;td&gt;69%&lt;/td&gt;
&lt;td&gt;5%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;HTML&lt;/td&gt;
&lt;td&gt;61%&lt;/td&gt;
&lt;td&gt;2%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SQL&lt;/td&gt;
&lt;td&gt;56%&lt;/td&gt;
&lt;td&gt;2%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Java&lt;/td&gt;
&lt;td&gt;50%&lt;/td&gt;
&lt;td&gt;4%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;python&lt;/td&gt;
&lt;td&gt;49%&lt;/td&gt;
&lt;td&gt;9%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h4&gt;
  
  
  Operating System
&lt;/h4&gt;

&lt;p&gt;Operating system is very important for development and here is some stats for the operating systems used among the 7,000 developers that took the survey.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Windows&lt;/th&gt;
&lt;th&gt;Mac&lt;/th&gt;
&lt;th&gt;Unix/Linux&lt;/th&gt;
&lt;th&gt;others&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;57%&lt;/td&gt;
&lt;td&gt;49%&lt;/td&gt;
&lt;td&gt;48%&lt;/td&gt;
&lt;td&gt;1%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;This proves that Chrome Os still has long way to go even after Linux support&lt;/em&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Applications created
&lt;/h4&gt;

&lt;p&gt;This was categorized according to two parts, applications developers are writing to earn money and those only out of hobby &lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Application&lt;/th&gt;
&lt;th&gt;for living&lt;/th&gt;
&lt;th&gt;as a hobby&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Web back-end&lt;/td&gt;
&lt;td&gt;60%&lt;/td&gt;
&lt;td&gt;39%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;web front-end&lt;/td&gt;
&lt;td&gt;46%&lt;/td&gt;
&lt;td&gt;37%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mobile application&lt;/td&gt;
&lt;td&gt;23%&lt;/td&gt;
&lt;td&gt;27%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Data Analysis&lt;/td&gt;
&lt;td&gt;13%&lt;/td&gt;
&lt;td&gt;11%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Machine Learning&lt;/td&gt;
&lt;td&gt;7%&lt;/td&gt;
&lt;td&gt;16%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Games&lt;/td&gt;
&lt;td&gt;4%&lt;/td&gt;
&lt;td&gt;17%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;By looking at this stats we can argue that developers really love, game development and machine learning&lt;/em&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Mobile
&lt;/h4&gt;

&lt;p&gt;For which mobile operating system developers are developing &lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Operating System&lt;/th&gt;
&lt;th&gt;ratio&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Android&lt;/td&gt;
&lt;td&gt;83%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ios&lt;/td&gt;
&lt;td&gt;59%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;other&lt;/td&gt;
&lt;td&gt;3%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Two thirds of mobile developers use native tools to develop for mobile OS. Every other developer uses cross-platform technologies or frameworks.&lt;/p&gt;




&lt;p&gt;Please visit &lt;a href="https://www.jetbrains.com/lp/devecosystem-2019/"&gt;here&lt;/a&gt; for more stats.&lt;/p&gt;

</description>
      <category>news</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Manipulate Linked List to reduce insertion time complexity </title>
      <dc:creator>souvik</dc:creator>
      <pubDate>Tue, 03 Dec 2019 00:33:12 +0000</pubDate>
      <link>https://dev.to/souvik_ns/linked-list-better-than-arrays-335d</link>
      <guid>https://dev.to/souvik_ns/linked-list-better-than-arrays-335d</guid>
      <description>&lt;p&gt;Arrays is a collections of items stored at contiguous memory location. It stores multiple data of same type. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sCSVmIWy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/u1mih6smj4vw675qb1x9.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sCSVmIWy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/u1mih6smj4vw675qb1x9.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now the retrieving data from a arrays is very easy, all we have to do is to get the data from the position.&lt;br&gt;
&lt;code&gt;arr[pos];&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;But insertion and deletion is very &lt;strong&gt;costly&lt;/strong&gt;. &lt;br&gt;
As arrays are static every time a new element has to be inserted at the end , a new array is created and the we have to loop through the whole array inserting the all the previous elements an then the new element is reached at the end. &lt;br&gt;
The time complexity is always &lt;strong&gt;n&lt;/strong&gt; as it has to traverse the array.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;This problem could be solved using linked list if we can manipulate it.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;br&gt;
class Node{&lt;br&gt;
  Node* head=NULL;&lt;br&gt;
  Node* tail=NULL; // Maintaining a pointer that points to the end&lt;br&gt;
  void insert(int data){&lt;br&gt;
    Node* node= new Node;&lt;br&gt;
    node-&amp;gt;data=data;&lt;br&gt;
    if(head==NULL){&lt;br&gt;
      head=node;&lt;br&gt;
    }else{&lt;br&gt;
      // no need to traverse the complete linked list as we already&lt;br&gt;
      // have a pointer pointing to the end&lt;br&gt;
      // all we have to do add a pointer after that pointer&lt;br&gt;
      tail-&amp;gt;next=node;&lt;br&gt;
      tail=tail-&amp;gt;next;&lt;br&gt;
    }&lt;br&gt;
  }&lt;br&gt;
};&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;By maintaining a pointer that points to the end of the linked list we can reduce the time complexity of the insertion. Now we can insert at linear time.  &lt;/p&gt;

</description>
      <category>cpp</category>
    </item>
  </channel>
</rss>
