<?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: Mamun Hossain</title>
    <description>The latest articles on DEV Community by Mamun Hossain (@targetcoder).</description>
    <link>https://dev.to/targetcoder</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%2F418549%2Fc9f95438-9bf3-4e0e-9b96-b504774a3e8c.png</url>
      <title>DEV Community: Mamun Hossain</title>
      <link>https://dev.to/targetcoder</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/targetcoder"/>
    <language>en</language>
    <item>
      <title>How to convert a Set to an Array? – JavaScript</title>
      <dc:creator>Mamun Hossain</dc:creator>
      <pubDate>Sat, 27 Feb 2021 07:09:48 +0000</pubDate>
      <link>https://dev.to/targetcoder/how-to-convert-a-set-to-an-array-javascript-1nf3</link>
      <guid>https://dev.to/targetcoder/how-to-convert-a-set-to-an-array-javascript-1nf3</guid>
      <description>&lt;p&gt;When you remove the duplicate numbers from an array with &lt;code&gt;new Set()&lt;/code&gt; method, it turns into a set instead of an array like this&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;let&lt;/span&gt; &lt;span class="nx"&gt;duplicates&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="c1"&gt;// remove the duplicates&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;noDuplicates&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;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;duplicates&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// output Set {1,2,3,4,5,6}&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;Duplicates may happen by posting/collecting same value from one/different sources, or by &lt;code&gt;concat()&lt;/code&gt; arrays. &lt;/p&gt;

&lt;p&gt;And you can convert that set to an array again. &lt;/p&gt;

&lt;h2&gt;
  
  
  Solution 1:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;duplicates&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="c1"&gt;// remove the duplicates&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;noDuplicates&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;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;duplicates&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// output {1,2,3,4,5,6}&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;arrayWithNoDuplicates&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;noDuplicates&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// output [1,2,3,4,5,6]&lt;/span&gt;


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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Solution 2:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;duplicates&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="c1"&gt;// remove the duplicates&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;noDuplicates&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;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;duplicates&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// output {1,2,3,4,5,6}&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;arrayWithNoDuplicates&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[...&lt;/span&gt;&lt;span class="nx"&gt;noDupicates&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="c1"&gt;// output [1,2,3,4,5,6]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Solution 3:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;duplicates&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&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;noDuplicates&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;duplicates&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;span class="c1"&gt;// output [1,2,3,4,5,6]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Solution 4:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;duplicates&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&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;noDuplicates&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[...&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;duplicates&lt;/span&gt;&lt;span class="p"&gt;)];&lt;/span&gt;

&lt;span class="c1"&gt;// output [1,2,3,4,5,6]&lt;/span&gt;

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Apply
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;4&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;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&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;c&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;concat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;b&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;d&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;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;c&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;e&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;d&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// or in one line&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;f&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;concat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)));&lt;/span&gt;

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

&lt;/div&gt;






&lt;p&gt;Source : &lt;a href="https://tradecoder.com/dev/javascript/how-to-convert-a-set-to-an-array/" rel="noopener noreferrer"&gt;How to convert a Set to an Array? – JavaScript | tradecoder&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>tradecoder</category>
    </item>
    <item>
      <title>How to get only required data fields from mongoDB</title>
      <dc:creator>Mamun Hossain</dc:creator>
      <pubDate>Wed, 09 Dec 2020 10:56:42 +0000</pubDate>
      <link>https://dev.to/targetcoder/how-to-get-only-required-data-fields-from-mongodb-5b0p</link>
      <guid>https://dev.to/targetcoder/how-to-get-only-required-data-fields-from-mongodb-5b0p</guid>
      <description>&lt;p&gt;If you are looking for a solution to get only the required fields data from mongoDB, this simple solution can help you without any side effect&lt;/p&gt;

&lt;p&gt;Say, you have this data fields in your database&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        meetingId,
        meetingDate,
        noticeDate,
        title,
        agenda,
        venue,
        notice,
        noticeDistribution,
        chairedBy,
        participants,
        minutes,
        minutesPreparedBy,
        minutesApprovedBy,
        minutesDistribuion,
        status,
        username,
        userid
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But you need to send only &lt;code&gt;minutes&lt;/code&gt; and &lt;code&gt;minutesApprovedBy&lt;/code&gt; fields, then you can go this way,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yourDB.find({}, {minutes:true, minutesApprovedBy:true})
.then(data=&amp;gt;res.send(data))
.catch(err=&amp;gt;res.send(err))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The field you need, put together with a value to &lt;code&gt;true&lt;/code&gt; as shown above. This will return only those fields (filter) from the database. You can also use &lt;code&gt;findOne({}, {})&lt;/code&gt; where necessary.&lt;/p&gt;

</description>
      <category>mongodb</category>
      <category>node</category>
      <category>javascript</category>
      <category>tradecoder</category>
    </item>
    <item>
      <title>How to run Front End and Backend together in React.js and Express.js with 'concurrently' package</title>
      <dc:creator>Mamun Hossain</dc:creator>
      <pubDate>Sun, 08 Nov 2020 10:21:17 +0000</pubDate>
      <link>https://dev.to/targetcoder/how-to-run-front-end-and-backend-together-in-react-js-and-express-js-with-concurrently-package-5fga</link>
      <guid>https://dev.to/targetcoder/how-to-run-front-end-and-backend-together-in-react-js-and-express-js-with-concurrently-package-5fga</guid>
      <description>&lt;h1&gt;
  
  
  Run Front End and Backend Concurrently
&lt;/h1&gt;

&lt;p&gt;If you are looking for a way to run Front End and Backend together with React.js and Express.js, you may simply follow these steps:&lt;/p&gt;

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

&lt;p&gt;Install 'concurrently' &lt;br&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install concurrently --save
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;Find the script start in package.json file &lt;br&gt;&lt;br&gt;
By default the script looks like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"start": "react-scripts start",
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;First add concurrently to that script like this with backslashes and quote marks&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"start": "concurrently \"react-scripts start\" ",
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Look, now if you run &lt;code&gt;npm start&lt;/code&gt; it will call &lt;code&gt;concurrently&lt;/code&gt; first which will run the 'react-scripts start' command and if you want to add more command you have to add the scripts (commands) like the above format with backslashes and quote marks for each scripts, let's do it in the next step&lt;/p&gt;

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

&lt;p&gt;Add more scripts to concurrently. Now, if we have a backend folder with backend codes, first we need to move onto the &lt;code&gt;backend&lt;/code&gt; directory (&lt;code&gt;cd backend&lt;/code&gt;) (use necessary command to move onto your relevant folder), then at the same time we will call &lt;code&gt;nodemon&lt;/code&gt; which will run our &lt;code&gt;server.js&lt;/code&gt; file (&lt;code&gt;nodemon server&lt;/code&gt;), let's do it&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"start": "concurrently \"react-scripts start\" \"cd backend &amp;amp;&amp;amp; nodemon server\"",
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it. Now you can use a single command and run front end and backend concurrently from your main/root project folder.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>react</category>
      <category>node</category>
      <category>javascript</category>
      <category>tradecoder</category>
    </item>
    <item>
      <title>How to fix - UnhandledPromiseRejectionWarning: MongoParseError: URI does not have hostname, domain name and tld</title>
      <dc:creator>Mamun Hossain</dc:creator>
      <pubDate>Thu, 05 Nov 2020 08:59:57 +0000</pubDate>
      <link>https://dev.to/targetcoder/how-to-fix-unhandledpromiserejectionwarning-mongoparseerror-uri-does-not-have-hostname-domain-name-and-tld-3hpj</link>
      <guid>https://dev.to/targetcoder/how-to-fix-unhandledpromiserejectionwarning-mongoparseerror-uri-does-not-have-hostname-domain-name-and-tld-3hpj</guid>
      <description>&lt;p&gt;A solution for MongoParseError (UnhandledPromiseRejectionWarning: MongoParseError: URI does not have hostname, domain name and tld... )&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(node:2436) UnhandledPromiseRejectionWarning: MongoParseError: URI does not have hostname, domain name and tld
    at parseSrvConnectionString (E:\mern\mongo-office\backend\node_modules\mongodb\lib\core\uri_parser.js:45:21)
    at parseConnectionString (E:\mern\mongo-office\backend\node_modules\mongodb\lib\core\uri_parser.js:587:12)
    at connect (E:\mern\mongo-office\backend\node_modules\mongodb\lib\operations\connect.js:282:3)
    at E:\mern\mongo-office\backend\node_modules\mongodb\lib\mongo_client.js:223:5
    at maybePromise (E:\mern\mongo-office\backend\node_modules\mongodb\lib\utils.js:662:3)
    at MongoClient.connect (E:\mern\mongo-office\backend\node_modules\mongodb\lib\mongo_client.js:219:10)
    at E:\mern\mongo-office\backend\node_modules\mongoose\lib\connection.js:791:12
    at new Promise (&amp;lt;anonymous&amp;gt;)
    at NativeConnection.Connection.openUri (E:\mern\mongo-office\backend\node_modules\mongoose\lib\connection.js:788:19)
    at E:\mern\mongo-office\backend\node_modules\mongoose\lib\index.js:342:10
    at E:\mern\mongo-office\backend\node_modules\mongoose\lib\helpers\promiseOrCallback.js:31:5
    at new Promise (&amp;lt;anonymous&amp;gt;)
    at promiseOrCallback (E:\mern\mongo-office\backend\node_modules\mongoose\lib\helpers\promiseOrCallback.js:30:10)
    at Mongoose.connect (E:\mern\mongo-office\backend\node_modules\mongoose\lib\index.js:341:10)
    at Object.&amp;lt;anonymous&amp;gt; (E:\mern\mongo-office\backend\server.js:11:10)
    at Module._compile (internal/modules/cjs/loader.js:1076:30)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:2436) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
(node:2436) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with
a non-zero exit code.

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

&lt;/div&gt;



&lt;p&gt;If you think everything in your MONGO_URI is ok but face this problem with mongoDB connection, &lt;/p&gt;

&lt;h2&gt;
  
  
  you can simply solve this issue by following these steps:
&lt;/h2&gt;

&lt;p&gt;Check your MONGO_URI in &lt;code&gt;.env&lt;/code&gt; file if your password has any special character like &lt;code&gt;#, @, !&lt;/code&gt; and so on. &lt;/p&gt;

&lt;p&gt;If found, just change your password from the MongoDB account for that database username and make it without those characters. Use the new password to your MONGO_URI.&lt;/p&gt;

&lt;p&gt;The problem is solved! Now run the server again. &lt;/p&gt;

</description>
      <category>mongodb</category>
      <category>node</category>
      <category>javascript</category>
      <category>tradecoder</category>
    </item>
    <item>
      <title>How to fix the value of dynamically generated html id attribute</title>
      <dc:creator>Mamun Hossain</dc:creator>
      <pubDate>Mon, 31 Aug 2020 05:50:03 +0000</pubDate>
      <link>https://dev.to/targetcoder/how-to-fix-the-value-of-dynamically-generated-html-id-attribute-1mif</link>
      <guid>https://dev.to/targetcoder/how-to-fix-the-value-of-dynamically-generated-html-id-attribute-1mif</guid>
      <description>&lt;h2&gt;
  
  
  The main issue:
&lt;/h2&gt;

&lt;p&gt;If you set a value to an id attribute started with a number, CSS won't work with that and the navigation to that id will fail to execute. &lt;/p&gt;

&lt;h2&gt;
  
  
  A short description:
&lt;/h2&gt;

&lt;p&gt;If you need to set the value of id (s) from a unique data source, if the source-data contains such a value started with a number, if you need to set target to that id in your project, your code won't work with that part, and it will be very difficult to find out the problem if the project is a big one. &lt;/p&gt;

&lt;p&gt;Sometimes, you can not imagine the reason behind this issue because the other parts with the same code will be working!&lt;/p&gt;

&lt;p&gt;So, it is very common to get trouble while generating it automatically from a data source.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to solve this issue:
&lt;/h2&gt;

&lt;p&gt;To solve this issue we can add a text before the source data, like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;id={`mytext${source-data}`}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and set the target value like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{`#mytext${source-data}`}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is just an example (JavaScript, React.js), you need to follow your own code relevant syntax to implement the solution. &lt;/p&gt;

&lt;p&gt;Follow me on: &lt;br&gt;
&lt;a href="https://linkedin.com/in/thetradecoder" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/thetradecoder" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;br&gt;
&lt;a href="https://twitter.com/thetradecoder" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>html</category>
      <category>tradecoder</category>
    </item>
    <item>
      <title>How to run useEffect() only once in React.js - (React Hooks)</title>
      <dc:creator>Mamun Hossain</dc:creator>
      <pubDate>Sat, 29 Aug 2020 05:37:49 +0000</pubDate>
      <link>https://dev.to/targetcoder/how-to-run-useeffect-only-once-in-react-js-react-hooks-mbh</link>
      <guid>https://dev.to/targetcoder/how-to-run-useeffect-only-once-in-react-js-react-hooks-mbh</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import {useEffect} from "react";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Just add an empty array&lt;br&gt;
after the callback function&lt;br&gt;
separated by a comma &lt;/p&gt;

&lt;p&gt;&lt;code&gt;useEffect(callback, []);&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;useEffect(()=&amp;gt;{}, []);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Why do you need to run useEffect() only once?
&lt;/h2&gt;

&lt;p&gt;When you setState inside useEffect() from a data source, it will be continuously updating with the source value, and outside the useEffect() if you have an onChange event handler to setState to another value- that won't work. To solve this, you need to call useEffect() only once.&lt;/p&gt;

</description>
      <category>react</category>
      <category>tradecoder</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How to fix error- nodemon.ps1 cannot be loaded because running scripts is disabled on this system</title>
      <dc:creator>Mamun Hossain</dc:creator>
      <pubDate>Sat, 15 Aug 2020 06:03:23 +0000</pubDate>
      <link>https://dev.to/targetcoder/how-to-fix-error-nodemon-ps1-cannot-be-loaded-because-running-scripts-is-disabled-on-this-system-34fe</link>
      <guid>https://dev.to/targetcoder/how-to-fix-error-nodemon-ps1-cannot-be-loaded-because-running-scripts-is-disabled-on-this-system-34fe</guid>
      <description>&lt;p&gt;A solution for running nodemon on local machine error on Windows :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nodemon.ps1 cannot be loaded because running scripts is disabled on this system. For more 
information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So if you ever get this error, simply you can follow these steps to solve the issue-&lt;/p&gt;

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

&lt;p&gt;Open Windows PowerShell with Run As Administrator. &lt;/p&gt;

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

&lt;p&gt;As you see the error is about_Execution_Policies, first to see what's there in the present execution policy. Use this command on Windows PowerShell to get it&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Get-ExecutionPolicy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here you'll see 'Restricted'. So, this is the main reason- running scripts on this system is 'Restricted'.&lt;/p&gt;

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

&lt;p&gt;Now we need to change this policy to allow the operation. Use this command to make it Unrestricted -&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Set-ExecutionPolicy Unrestricted
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here you'll get a prompt message. Press Y to change it&lt;/p&gt;

&lt;p&gt;That's it. To ensure, you may check the execution policy status by this command again&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Get-ExecutionPolicy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You'll get the output 'Unrestricted'&lt;/p&gt;

&lt;p&gt;The problem is solved. Now you can use nodemon on your machine.&lt;/p&gt;

</description>
      <category>node</category>
      <category>nodemon</category>
      <category>discuss</category>
      <category>webdev</category>
    </item>
    <item>
      <title>D3js Treemap Diagram</title>
      <dc:creator>Mamun Hossain</dc:creator>
      <pubDate>Wed, 15 Jul 2020 11:03:57 +0000</pubDate>
      <link>https://dev.to/targetcoder/d3js-treemap-diagram-1kac</link>
      <guid>https://dev.to/targetcoder/d3js-treemap-diagram-1kac</guid>
      <description>&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/thetradecoder/embed/oNbPMdZ?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Data presentation with D3js and Reactjs. Best selling movies, A #freeCodeCamp data-visualization project. &lt;/p&gt;

&lt;p&gt;Need your valuable feedback on the project for any development. &lt;/p&gt;

&lt;p&gt;Thank you. &lt;/p&gt;

</description>
      <category>codepen</category>
      <category>datascience</category>
      <category>d3js</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Data visualization with D3js Choropleth Map</title>
      <dc:creator>Mamun Hossain</dc:creator>
      <pubDate>Sun, 12 Jul 2020 04:23:14 +0000</pubDate>
      <link>https://dev.to/targetcoder/data-visualization-with-d3js-choropleth-map-4fok</link>
      <guid>https://dev.to/targetcoder/data-visualization-with-d3js-choropleth-map-4fok</guid>
      <description>&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/thetradecoder/embed/yLeEZKZ?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Here is my first D3js Choropleth Map project as a learning progress, United States Educational Attainment Presentation.  need your valuable feedback. &lt;/p&gt;

&lt;p&gt;Thank you. &lt;/p&gt;

</description>
      <category>codepen</category>
      <category>datascience</category>
      <category>javascript</category>
      <category>d3js</category>
    </item>
    <item>
      <title>CSS Transform Effects</title>
      <dc:creator>Mamun Hossain</dc:creator>
      <pubDate>Sun, 05 Jul 2020 15:38:25 +0000</pubDate>
      <link>https://dev.to/targetcoder/css-transform-effects-l0l</link>
      <guid>https://dev.to/targetcoder/css-transform-effects-l0l</guid>
      <description>&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/thetradecoder/embed/JjdBVPm?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>codepen</category>
      <category>css</category>
    </item>
    <item>
      <title>Global Heat Map - A simple project with D3 &amp; React on CodePen</title>
      <dc:creator>Mamun Hossain</dc:creator>
      <pubDate>Sat, 04 Jul 2020 05:18:05 +0000</pubDate>
      <link>https://dev.to/targetcoder/global-heat-map-a-simple-project-with-d3-react-on-codepen-1lm1</link>
      <guid>https://dev.to/targetcoder/global-heat-map-a-simple-project-with-d3-react-on-codepen-1lm1</guid>
      <description>&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/thetradecoder/embed/pogpMMz?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;I would expect some your valuable feedback with code review on the project. &lt;/p&gt;

&lt;p&gt;Thank you. &lt;/p&gt;

</description>
      <category>codepen</category>
      <category>datascience</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
    <item>
      <title>D3js Scatterplot Presentation</title>
      <dc:creator>Mamun Hossain</dc:creator>
      <pubDate>Tue, 30 Jun 2020 06:49:13 +0000</pubDate>
      <link>https://dev.to/targetcoder/d3js-scatterplot-presentation-1n78</link>
      <guid>https://dev.to/targetcoder/d3js-scatterplot-presentation-1n78</guid>
      <description>&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/thetradecoder/embed/OJMxdGb?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;br&gt;
A simple scatterplot presentation using (codepen)  D3js and Reactjs&lt;/p&gt;

</description>
      <category>codepen</category>
      <category>react</category>
      <category>datascience</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
