<?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: choudhmh</title>
    <description>The latest articles on DEV Community by choudhmh (@choudhmh).</description>
    <link>https://dev.to/choudhmh</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%2F1084321%2F26a9338c-a079-431c-8347-17a146c11ad8.png</url>
      <title>DEV Community: choudhmh</title>
      <link>https://dev.to/choudhmh</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/choudhmh"/>
    <language>en</language>
    <item>
      <title>Unable to display data from Database</title>
      <dc:creator>choudhmh</dc:creator>
      <pubDate>Wed, 28 Feb 2024 08:51:08 +0000</pubDate>
      <link>https://dev.to/choudhmh/unable-to-display-data-from-database-505m</link>
      <guid>https://dev.to/choudhmh/unable-to-display-data-from-database-505m</guid>
      <description>&lt;p&gt;Hello;&lt;br&gt;
I’m using React with axios and mysql. I’m trying to display data from the database. I’m managed to fetch the data and it shows the fetch data on my console.&lt;br&gt;
But for some reason i’m finding it diffcult to show that fetched data on my webpage. I’ve looked around for issues but none seem to lead me to any help.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7lrg3m3b6qw74o90xnrn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7lrg3m3b6qw74o90xnrn.png" alt="Image description" width="800" height="225"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Front end&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const Display = () =&amp;gt; {
  const [user, setUser] = useState([]);

  useEffect(() =&amp;gt; {
    axios
      .get("http://localhost:8081/login")
      .then((res) =&amp;gt; {
        console.log(res.data); // debugging
        // Set user to res.data.user if it's an array, else set to an empty array
        setUser(Array.isArray(res.data.user) ? res.data.user : []);
      })
      .catch((err) =&amp;gt; console.log(err));
  }, []);


  const userDetails = user.map((item) =&amp;gt; (
    &amp;lt;tr key={item.id}&amp;gt; 
      &amp;lt;td&amp;gt;{item.id}&amp;lt;/td&amp;gt;
      &amp;lt;td&amp;gt;{item.name}&amp;lt;/td&amp;gt;
      &amp;lt;td&amp;gt;{item.email}&amp;lt;/td&amp;gt;
      &amp;lt;td&amp;gt;{item.password}&amp;lt;/td&amp;gt;
    &amp;lt;/tr&amp;gt;
  ));

  return (
    &amp;lt;div&amp;gt;
      Update
      &amp;lt;div&amp;gt;
        &amp;lt;table className="table"&amp;gt; 
          &amp;lt;thead&amp;gt;
            &amp;lt;tr&amp;gt;
              &amp;lt;th scope="col"&amp;gt;#&amp;lt;/th&amp;gt;
              &amp;lt;th scope="col"&amp;gt;Name&amp;lt;/th&amp;gt;
              &amp;lt;th scope="col"&amp;gt;Email&amp;lt;/th&amp;gt;
              &amp;lt;th scope="col"&amp;gt;Password&amp;lt;/th&amp;gt;
            &amp;lt;/tr&amp;gt;
          &amp;lt;/thead&amp;gt;
          &amp;lt;tbody&amp;gt;
            {userDetails}
          &amp;lt;/tbody&amp;gt;
        &amp;lt;/table&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};

export default Display;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The backend server code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;app.get('/login', (req, res) =&amp;gt;{
    const sql = "SELECT * FROM login";
    db.query(sql, (err, data) =&amp;gt; {
        if (err) {
            console.error(err);
            return res.json({ error: 'An error occurred' });
        }

        console.log(data);
        return res.json({ success: true, data: data });
    });
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Face Detection</title>
      <dc:creator>choudhmh</dc:creator>
      <pubDate>Wed, 17 May 2023 09:12:48 +0000</pubDate>
      <link>https://dev.to/choudhmh/face-detection-2886</link>
      <guid>https://dev.to/choudhmh/face-detection-2886</guid>
      <description>&lt;p&gt;Good Day, &lt;br&gt;
Hoping someone can direct me. I've written this code in React to identify faces using the webcam from set images stored a the labels folder and also to identify emotions from the faces detected. &lt;/p&gt;

&lt;p&gt;I need guidance on how i can rewrite the function in react (at the moment in JS) The faces cannot be identified, not sure where i am going wrong but it cannot match the faces from the labels folder to identify which face is which. I'm new to React. I&lt;/p&gt;

&lt;p&gt;I also getting emotions from the face to working and it shows up but not he identification. Below is part of the code which needs to be rewritten in React which i'm not sure how to do:&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; {
    startVideo();
    videoRef &amp;amp;&amp;amp; loadModels();
    getLabeledFaceDescriptions();
  }, []);



  function getLabeledFaceDescriptions() {

    const labels = [
      "Bibinur",
      "Emunrich",
      "Mukthar",
      "Nursultan Ahmetsha",
      "Mahmud",
      "Kayrbek",
      "Saltanat",
      "Ablay",
      "Makkabhat",
      "Sandugash_8B",
      "Makhabbat_Zharimbetova",
      "Kamilya_Nuryshova",
    ];
    return Promise.all(
      labels.map(async (label) =&amp;gt; {
        const descriptions = [];
        //const expression = [];
        for (let i = 1; i &amp;lt;= 2; i++) {
          const img = await faceapi.fetchImage(`/labels/${label}/${i}.png`);

          const labeledFaceDescriptors = await getLabeledFaceDescriptions();
          const faceMatcher = new faceapi.FaceMatcher(labeledFaceDescriptors);

          const detections = await faceapi
            .detectSingleFace(img)
            .withFaceLandmarks()
            .withFaceExpressions()
            .withFaceDescriptor();
          descriptions.push(detections.descriptor);

          console.log(detections.descriptor)


        }
        return new faceapi.LabeledFaceDescriptors(label, descriptions);

      })

    );

    }

  return (
    &amp;lt;div&amp;gt;
      &amp;lt;video crossOrigin="anonymous" ref={videoRef} autoPlay&amp;gt;&amp;lt;/video&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}

export default App;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
  </channel>
</rss>
