<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Noel Pulido on Medium]]></title>
        <description><![CDATA[Stories by Noel Pulido on Medium]]></description>
        <link>https://medium.com/@noelpulido1229?source=rss-f7860122f1df------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*SIHjFNucU1cfoHN5</url>
            <title>Stories by Noel Pulido on Medium</title>
            <link>https://medium.com/@noelpulido1229?source=rss-f7860122f1df------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 09:47:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@noelpulido1229/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Exploring Atlas Earth: The Coolest Way to Own Virtual Land and Earn Real Rewards]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@noelpulido1229/exploring-atlas-earth-the-coolest-way-to-own-virtual-land-and-earn-real-rewards-c1d53c87b24c?source=rss-f7860122f1df------2"><img src="https://cdn-images-1.medium.com/max/2600/0*cux1DUVnKyx1YgXI" width="4096"></a></p><p class="medium-feed-snippet">If you&#x2019;ve ever dreamed of owning land in your city&#x200A;&#x2014;&#x200A;or even becoming the virtual mayor of it&#x200A;&#x2014;&#x200A;Atlas Earth turns that fantasy into a game&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@noelpulido1229/exploring-atlas-earth-the-coolest-way-to-own-virtual-land-and-earn-real-rewards-c1d53c87b24c?source=rss-f7860122f1df------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@noelpulido1229/exploring-atlas-earth-the-coolest-way-to-own-virtual-land-and-earn-real-rewards-c1d53c87b24c?source=rss-f7860122f1df------2</link>
            <guid isPermaLink="false">https://medium.com/p/c1d53c87b24c</guid>
            <category><![CDATA[mobile-games]]></category>
            <category><![CDATA[earn-money]]></category>
            <category><![CDATA[atlas-earth]]></category>
            <category><![CDATA[passive-income]]></category>
            <dc:creator><![CDATA[Noel Pulido]]></dc:creator>
            <pubDate>Sun, 13 Jul 2025 08:09:01 GMT</pubDate>
            <atom:updated>2025-07-13T08:09:01.081Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[How I Connect SQL Server to Node Express Server]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@noelpulido1229/how-i-connect-sql-server-to-node-express-server-b4782091eed1?source=rss-f7860122f1df------2"><img src="https://cdn-images-1.medium.com/max/2600/0*XEBt1-WCuDlsr9c5" width="5400"></a></p><p class="medium-feed-snippet">Assuming you already know how to create a node express server, create Js file for your node server, in this tutorial I named it server.js&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@noelpulido1229/how-i-connect-sql-server-to-node-express-server-b4782091eed1?source=rss-f7860122f1df------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@noelpulido1229/how-i-connect-sql-server-to-node-express-server-b4782091eed1?source=rss-f7860122f1df------2</link>
            <guid isPermaLink="false">https://medium.com/p/b4782091eed1</guid>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[express]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[mssql]]></category>
            <dc:creator><![CDATA[Noel Pulido]]></dc:creator>
            <pubDate>Sun, 13 Jul 2025 03:12:03 GMT</pubDate>
            <atom:updated>2025-07-13T08:21:18.274Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[How to Add Self Signed SSL Certificate in Nodejs Server]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@noelpulido1229/how-to-add-self-signed-ssl-certificate-in-nodejs-server-ce9d53c17a9c?source=rss-f7860122f1df------2"><img src="https://cdn-images-1.medium.com/max/600/1*CBpulSO7Br_vqHnekL0Dxw.png" width="600"></a></p><p class="medium-feed-snippet">So, you have managed to create an https node server, but there is this annoying `Not secure` warning that you want to get rid of.</p><p class="medium-feed-link"><a href="https://medium.com/@noelpulido1229/how-to-add-self-signed-ssl-certificate-in-nodejs-server-ce9d53c17a9c?source=rss-f7860122f1df------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@noelpulido1229/how-to-add-self-signed-ssl-certificate-in-nodejs-server-ce9d53c17a9c?source=rss-f7860122f1df------2</link>
            <guid isPermaLink="false">https://medium.com/p/ce9d53c17a9c</guid>
            <category><![CDATA[https-node-server]]></category>
            <category><![CDATA[self-signed-certificate]]></category>
            <category><![CDATA[secure-connection]]></category>
            <dc:creator><![CDATA[Noel Pulido]]></dc:creator>
            <pubDate>Tue, 30 Jul 2024 22:36:00 GMT</pubDate>
            <atom:updated>2025-07-13T08:22:45.216Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[JavaScript Promise, Async-Await]]></title>
            <link>https://medium.com/@noelpulido1229/javascript-promise-async-await-9bf5c06ccb59?source=rss-f7860122f1df------2</link>
            <guid isPermaLink="false">https://medium.com/p/9bf5c06ccb59</guid>
            <category><![CDATA[asyncawait]]></category>
            <category><![CDATA[javascript-promise]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Noel Pulido]]></dc:creator>
            <pubDate>Sat, 13 May 2023 19:15:28 GMT</pubDate>
            <atom:updated>2023-05-13T22:41:08.729Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1Zhw1LXPsIOVgrGx" /><figcaption>Photo by <a href="https://unsplash.com/@diimejii?utm_source=medium&amp;utm_medium=referral">Oladimeji Ajegbile</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>What is Promise?</h3><p>JavaScript promise is like a promise in real life. A good example is when you order something from a restaurant, like coffee for an instance. Then waiter will promise you to deliver the coffee. And this promise will have 2 results, either it is a successful delivery, which is resolved in JavaScript, or a failure delivery which is rejected in JavaScript.</p><p>Syntax for promise:</p><pre>const myPromise = new Promise((resolve, reject) =&gt; {<br>    let result = &quot;Success&quot;;<br>    if (result === &quot;Success&quot;) {<br>      resolve(&#39;Success!&#39;);<br>    } else {<br>      reject(&#39;Fail&#39;;;<br>    }<br>  });</pre><p>Below is a function that returns a promise, let us say the parameter drink is the drink that the waiter delivered to you. If the <em>drink is “coffee”, </em>it will return the resolve argument, and if not “<em>coffee</em>”, it will return the rejected argument.</p><pre>const getCoffee = (drink) =&gt; {<br>  return new Promise((resolved, reject) =&gt; {<br>    if (drink === &quot;coffee&quot;) {<br>      resolved(`Success! I ordered coffee and i received ${drink}!`);<br>    } else {<br>      reject(`Failed! I ordered coffee and i received ${drink}!`);<br>    }<br>  });<br>};</pre><h3>How to get the result?</h3><h4>Using .then .catch method</h4><p>Here is a function named that returns the <em>getCoffee</em> promise. The <em>.then </em>will return the resolved result, and .<em>catch </em>will return the rejected result.</p><pre>const getResult1 = (drink) =&gt; {<br>  getCoffee(drink)<br>    .then((msg) =&gt; console.log(msg))<br>    .catch((msg) =&gt; console.log(msg));<br>};</pre><p>if you invoke getResult1</p><pre>getResult1(&quot;coffee&quot;)<br><br>Output:<br>Success! I ordered coffee and i received coffee!</pre><pre>getResult1(&quot;milk&quot;)<br><br>Output:<br>Failed! I ordered coffee and i received milk!</pre><h4>Using async-await</h4><p>Another way of getting the promise result is using the async-await. For this instance, I made a function getResult2 and I made it asynchronous by adding the word async (see below) so I can use await in the codes in it. And we need to put <em>await </em>before the function that needs time to get result, in this case it is the <em>getCoffee</em>.</p><p>Instead of using <em>.then and .catch, </em>this function uses try-catch.</p><p>In the <em>try</em> block, it will first try to check if the function will return a success result. And if it is not successful it will go to <em>catch</em> block.</p><pre>const getResult2 = async (drink) =&gt; {<br>  try {<br>    const result = await getCoffee(drink);<br>    console.log(result); //resolve<br>  } catch (error) {<br>    console.log(error); //rejected<br>  }<br>};</pre><pre>getResult2(&quot;coffee&quot;)<br><br>Output:<br>Success! I ordered coffee and i received coffee!</pre><pre>getResult2(&quot;milk&quot;)<br><br>Output:<br>Failed! I ordered coffee and i received milk!</pre><p>Using promise get rids of the so-called call-back hell, and using async-await gives a cleaner code.</p><p>In the end, it is still the developer’s decision what to use for getting the result. Personally, I prefer using the async await as it allows me to store the result into a regular variable rather than internal variable when you are using the .<em>then</em>. Using <em>.then </em>also<em> </em>gives a lot of indentation, which makes using async await cleaner.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9bf5c06ccb59" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Coding Tips]]></title>
            <link>https://medium.com/@noelpulido1229/coding-tips-c4d2709b373e?source=rss-f7860122f1df------2</link>
            <guid isPermaLink="false">https://medium.com/p/c4d2709b373e</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[programming-tips]]></category>
            <category><![CDATA[coding-tips]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Noel Pulido]]></dc:creator>
            <pubDate>Sun, 26 Mar 2023 18:58:07 GMT</pubDate>
            <atom:updated>2023-03-26T18:58:07.688Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a0DXZj-GWDfa8DN79OoqdQ.png" /><figcaption>Photo by Elisa Ventur on Unsplash</figcaption></figure><p>I recently had a full-stack E-commerce project made in React that involves saving and retrieving data, fetching API data and some UI designs. In this kind of project as a new developer, it gets me excited to code and see the result. Some or most of the beginners like me, tends to skip important steps, that results into hard to fix errors, or hard to modify designs and codes. These are the lessons i have learned:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XESWN-XieByPN_898P8WQw.png" /><figcaption>Photo by Kaleidico on Unsplash</figcaption></figure><h3>1. Plan</h3><p>In my case, on a react project, check and see what features can be a component. And do a timetable for time management.</p><p>You can try writing your plan in a piece of paper, do a blue print.</p><p>Or use whatever program where you can do your planning.</p><p>Some coders, just visualize it in their head but personally I don&#39;t recommend it.</p><p>If you have something to look at of what to do, in most cases, it will be a continuous progress.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mg1BqDQ7IQZ-jOD84ZyOaA.png" /><figcaption>Photo by Nubelson Fernandes on Unsplash</figcaption></figure><h3>2. <strong>Don’t</strong> be frustrated</h3><p>There are codes or bugs that you cannot fix and you already spent few hours or sometimes days. Take a break! Ask google or if you know someone, ask for help. Sometimes what you need is a fresh and well rested body and mind. For me this works and most of the times, with the clear mind, i solved the problems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q-BA_QAUVMblOVTV2s-d4w.png" /><figcaption>Photo by Jonny Kennaugh on Unsplash</figcaption></figure><h3>3. Exercise, get some sunlight!</h3><p>Please do some exercises and get some sunlight. Not only for coders but for everyone, exercising reduces stress and anxiety. Go outside, and see Mr. Golden Sun. One benefit of getting sunlight is it also decreases stress, improves sleep and even our mental health.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PxXIcn7VcFgFaGBMtTW1sg.png" /><figcaption>Photo by Naassom Azevedo on Unsplash</figcaption></figure><h3>4. <strong>Coding is not everything</strong></h3><p>Some of are thinking of codes 24 hours a day (I am just exaggerating). Don&#39;t forget you have friends and family. You also need to socialize, take a break from coding once in a while.</p><p>This are my tips based on my experience and hope it helps!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c4d2709b373e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using array and array.map() to render data in React]]></title>
            <link>https://medium.com/@noelpulido1229/using-array-and-array-map-to-render-data-in-react-f0ec6425c?source=rss-f7860122f1df------2</link>
            <guid isPermaLink="false">https://medium.com/p/f0ec6425c</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[array-map]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[tutorial]]></category>
            <dc:creator><![CDATA[Noel Pulido]]></dc:creator>
            <pubDate>Mon, 06 Mar 2023 02:03:21 GMT</pubDate>
            <atom:updated>2023-03-06T02:23:00.559Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/417/1*1YehM4zhOsn8mMfDIqoBlA.jpeg" /></figure><p>For instance, we need to display 4 input elements, for “First Name”, “Last Name”, “Address” and “Age”.</p><h3>HTML</h3><p>With just pure HTML/CSS. We code it one by one and change whatever parameters that need to be changed.</p><pre>&lt;label&gt;First Name&lt;/label&gt;  &lt;input type=&quot;text&quot; /&gt;<br>&lt;label&gt;Last Name&lt;/label&gt;  &lt;input type=&quot;text&quot; /&gt;<br>&lt;label&gt;Address&lt;/label&gt;  &lt;input type=&quot;text&quot; /&gt;<br>&lt;label&gt;Age&lt;/label&gt;  &lt;input type=&quot;number&quot; /&gt;</pre><h3>REACT</h3><p>What if we need to display 50 input elements, this will be a lot of work and a lot of lines. But we will stick rendering just 4 elements. In react we can use array.map() to shorten and simplify rendering of these elements.</p><p>First of course, you need to make a component.</p><p>Then in your component, store the parameters we need in an object and store it in an array.</p><pre> const infos = [<br>        {name: &quot;firstName&quot;, labelText: &quot;First Name&quot;, type: &quot;text&quot;},<br>        {name: &quot;lastName&quot;, labelText: &quot;First Name&quot;, type: &quot;text&quot;,},<br>        {name: &quot;address&quot;, labelText: &quot;Address&quot;, type: &quot;text&quot;},<br>        {name: &quot;age&quot;, labelText: &quot;Age&quot;, type: &quot;number&quot;},<br>    ]</pre><p>Iterate and assign the values from the array and render the element like the code below.</p><p>note: Always assign a value to a key when using map and should be unique.</p><pre>return (<br>        &lt;form&gt;<br>          {infos.map((info) =&gt;(<br>              &lt;div key={info.name}&gt;<br>                  &lt;label&gt;{info.labelText} &lt;/label&gt;<br>                  &lt;input name = {info.name} type={info.type} /&gt;<br>                  &lt;hr /&gt;<br>              &lt;/div&gt;<br>          ))}<br>        &lt;/form&gt;<br>      )</pre><p>Result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/417/1*CJhHcBZxKob8XTxON099DQ.png" /></figure><p>We can also add more parameters, and use it on CSS properties such as color, left etc. I added more properties on our original array, such as labelDisplay, labelTextAlign, and labelColor.</p><pre>const infos = [<br>        {<br>            name: &quot;firstName&quot;, <br>            labelText: &quot;First Name&quot;, <br>            type: &quot;text&quot;},<br>        {<br>            name: &quot;lastName&quot;, <br>            labelText: &quot;Last Name&quot;, <br>            type: &quot;text&quot;, <br>            labelDisplay: &quot;block&quot;, <br>            labelTextAlign: &quot;right&quot;},<br>        {<br>            name: &quot;address&quot;, <br>            labelText: &quot;Address&quot;, <br>            type: &quot;text&quot;, <br>            labelColor: &quot;red&quot;},<br>        {<br>            name: &quot;age&quot;, <br>            labelText: &quot;Age&quot;, <br>            type: &quot;number&quot;,<br>            labelDisplay: &quot;block&quot;, <br>            labelTextAlign: &quot;left&quot;},<br>    ]</pre><p>And iterate the values of array, this time I used the additional properties.</p><pre>return (<br>      &lt;form style={{textAlign: &quot;left&quot;}}&gt;<br>        {infos.map((info) =&gt;(<br>            &lt;div key={info.name}&gt;<br>                &lt;label style = {{<br>                    display: info.labelDisplay, <br>                    textAlign: info.labelTextAlign,<br>                    color: info.labelColor<br>                    }}&gt;{info.labelText} &lt;/label&gt;<br>                &lt;input name = {info.name} type={info.type} /&gt;<br>                &lt;hr /&gt;<br>            &lt;/div&gt;<br>        ))}<br>      &lt;/form&gt;<br></pre><p>Notice the changes? The label “Last Name” is now aligned right, and the display is “block”. The label “Address” is now color red. And the label “Age” is now aligned left, and the display is “block”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/402/1*yiqGxYOGfNCOEW-IMb9kMA.png" /></figure><h3>Full Code</h3><p>See full code <a href="https://codepen.io/noel1229/pen/bGxRJLO">(codepen.io)</a></p><p>or</p><p>cut and paste the code below.</p><pre>import React from &#39;react&#39;;<br><br><br>class Form extends React.Component {<br>  render() {<br>    const infos = [<br>        {<br>            name: &quot;firstName&quot;, <br>            labelText: &quot;First Name&quot;, <br>            type: &quot;text&quot;},<br>        {<br>            name: &quot;lastName&quot;, <br>            labelText: &quot;Last Name&quot;, <br>            type: &quot;text&quot;, <br>            labelDisplay: &quot;block&quot;, <br>            labelTextAlign: &quot;right&quot;},<br>        {<br>            name: &quot;address&quot;, <br>            labelText: &quot;Address&quot;, <br>            type: &quot;text&quot;, <br>            labelColor: &quot;red&quot;},<br>        {<br>            name: &quot;age&quot;, <br>            labelText: &quot;Age&quot;, <br>            type: &quot;number&quot;,<br>            labelDisplay: &quot;block&quot;, <br>            labelTextAlign: &quot;left&quot;},<br>    ]<br>    <br>    return (<br>      &lt;form style={{textAlign: &quot;left&quot;}}&gt;<br>        {infos.map((info) =&gt;(<br>            &lt;div key={info.name}&gt;<br>                &lt;label style = {{<br>                    display: info.labelDisplay, <br>                    textAlign: info.labelTextAlign,<br>                    color: info.labelColor<br>                    }}&gt;{info.labelText} &lt;/label&gt;<br>                &lt;input name = {info.name} type={info.type} /&gt;<br>                &lt;hr /&gt;<br>            &lt;/div&gt;<br>        ))}<br>      &lt;/form&gt;<br>    )<br>  }<br>}<br><br>export default Form;</pre><p>If you see some repetitive codes of rendering elements, in React you can use array.map not only to shorten it, but it also simplifies the code for better understanding, especially for other coders if you are working with a group.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f0ec6425c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Use React]]></title>
            <link>https://medium.com/@noelpulido1229/why-use-react-86c3cd4de28b?source=rss-f7860122f1df------2</link>
            <guid isPermaLink="false">https://medium.com/p/86c3cd4de28b</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Noel Pulido]]></dc:creator>
            <pubDate>Wed, 01 Feb 2023 09:39:01 GMT</pubDate>
            <atom:updated>2023-02-01T16:08:01.168Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xajwBVfK0tigh3og92ePIA.png" /><figcaption>Photo by Lautaro Andreani on Unsplash</figcaption></figure><p>I just started React two weeks ago and made a small loan calculator project out of it. I am amazed on how you can write the html elements inside JavaScript codes. And some features like state and props makes it easier to update and transfer values.</p><h4>What is react?</h4><p>React is a JavaScript-based UI development library.</p><p>To learn React, you should know a bit of JavaScript and HTML, since it is a combination of JavaScript and HTML codes.</p><h4>React on repetitive codes!</h4><p>Look at the sample react code below.</p><pre>import React from &quot;react&quot;; <br><br>  <br> class DebtPaymentHistory extends React.Component { <br><br>   render() { <br><br>     const { payments } = this.props; <br><br>     return ( <br><br>       &lt;div className=&quot;table-wrapper&quot;&gt; <br><br>         &lt;table&gt; <br><br>           &lt;thead&gt; <br><br>           &lt;tr&gt; <br><br>             &lt;th&gt;Payment Id&lt;/th&gt; <br><br>             &lt;th&gt;Interest&lt;/th&gt; <br><br>             &lt;th&gt;Payment&lt;/th&gt; <br><br>             &lt;th&gt;Balance&lt;/th&gt; <br><br>           &lt;/tr&gt; <br><br>           &lt;/thead&gt; <br><br>           &lt;tbody&gt; <br><br>           {payments.map((payment) =&gt; ( <br><br>             &lt;tr key={payment.id}&gt; <br><br>               &lt;td&gt;{payment.id}&lt;/td&gt; <br><br>               &lt;td&gt;{payment.interestAmount}&lt;/td&gt; <br><br>               &lt;td&gt;{payment.paymentAmount}&lt;/td&gt; <br><br>               &lt;td&gt;{payment.balance}&lt;/td&gt; <br><br>             &lt;/tr&gt; <br><br>           ))} <br><br>           &lt;/tbody&gt;<br><br>         &lt;/table&gt; <br><br>       &lt;/div&gt; <br><br>     ); <br><br>   } <br><br> } <br><br>  <br><br> export default DebtPaymentHistory;<br></pre><p>The header &lt;th&gt; and data cell &lt;td&gt; are repetitive in this code. And because React allows writing of HTML element in JavaScript directly, dealing with repetitive lines of html elements can be easily simplified. And this can be simplified and refactored like this.</p><pre>import React from &quot;react&quot;; <br><br>  <br> class DebtPaymentHistory extends React.Component { <br><br>   render() { <br><br>     const { payments } = this.props; <br><br>     const headers = [&#39;Payment Id&#39;,&#39;Interest&#39;, &#39;Payment&#39;, &#39;Balance&#39;];<br><br>      return ( <br><br>       &lt;div className=&quot;table-wrapper&quot;&gt; <br><br>         &lt;table&gt; <br><br>           &lt;thead&gt; <br><br>           &lt;tr&gt;<br>              {headers.map((item) =&gt; (&lt;th&gt;item&lt;/th&gt;))};<br><br>           &lt;/tr&gt; <br><br>           &lt;/thead&gt; <br><br>           &lt;tbody&gt; <br><br>           {payments.map((payment) =&gt; ( <br>             const {id, interestAmount, paymentAmount, balance} = payment;<br>             &lt;tr key={payment.id}&gt; <br>                {[id, interestAmount, paymentAmount, balance].map((item) =&gt; (&lt;td&gt;item&lt;/td&gt;))};<br>             &lt;/tr&gt; <br><br>           ))} <br><br>           &lt;/tbody&gt;<br><br>         &lt;/table&gt; <br><br>       &lt;/div&gt; <br><br>     ); <br><br>   } <br><br> } <br><br>  <br><br> export default DebtPaymentHistory;<br></pre><p>For the header element &lt;th&gt;, all the header names are in array stored in headers variable. Then mapped and only used one &lt;th&gt;. Same idea with the data cell element &lt;td&gt;, but this time values was stored in multiple variables. Then those variables were stored in array and mapped. Only one &lt;td&gt; was used. And no createElement() or appendChild() method was used.</p><h4>React State</h4><p>State is a React built in object where you can store property values that belong to component. For more info about React state: <a href="https://www.w3schools.com/react/react_state.asp">https://www.w3schools.com/react/react_state.asp.</a></p><p>What cool with state is when it changes using the setState() method, the component will re-render. Look at the sample below.</p><pre>class Person extends React.Component {<br>  constructor(props) {<br>    super(props);<br>    this.state = {<br>      name: &quot;Noel&quot;<br>    };<br>  }<br>  changeName = () =&gt; {<br>    this.setState({name: &quot;Alex&quot;});<br>  }<br>  render() {<br>    return (<br>      &lt;div&gt;<br>        &lt;p&gt;My name is {this.state.name}&lt;/p&gt;<br>      <br>        &lt;button<br>          type=&quot;button&quot;<br>          onClick={this.changeName}<br>        &gt;Change name&lt;/button&gt;<br>      &lt;/div&gt;<br>    );<br>  }<br>}<br></pre><p>In this sample the state object property name has a value of “Noel&quot;. The property name value was used in the paragraph &lt;p&gt; element. And it has a button that calls a function that will change the state property name to “Alex&quot; by using the setState() method. If the button is clicked, it will not only change the value of state property name but setState() will also call the render (), meaning it will use the new name value “Alex&quot; in the paragraph &lt;p&gt; element.</p><h4>React Developer Tools</h4><p>Before I always use console.log to check if my variables have the right values. But in React, I now use React Developer Tools on my browser in order to check the state object. With this extension you can just inspect the element and see the property values of state, by clicking the Components tab and choose the component where your state lives. You can even change it directly on the Components tab for testing. Very convenient and no more console.log!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*krulkzl5pHVD92KuABSsbQ.jpeg" /></figure><h4>Why use react?</h4><p>From my perspective and as being new to React, my 3 major reasons of why we need to use React is it allows writing of HTML elements inside a JavaScript code, it has the state object for easy rendering, and the React developer tools for checking.</p><p>I am sure there will be more reasons as my journey of learning React continues.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=86c3cd4de28b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Modal Window]]></title>
            <link>https://medium.com/@noelpulido1229/modal-window-e4d555e8bccd?source=rss-f7860122f1df------2</link>
            <guid isPermaLink="false">https://medium.com/p/e4d555e8bccd</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[modal]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[css]]></category>
            <dc:creator><![CDATA[Noel Pulido]]></dc:creator>
            <pubDate>Fri, 20 Jan 2023 05:05:47 GMT</pubDate>
            <atom:updated>2023-01-22T17:48:21.345Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8J9jb2CUKybBk9Co" /><figcaption>Photo by <a href="https://unsplash.com/@izzygerosa?utm_source=medium&amp;utm_medium=referral">Izzy Gerosa</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>What is modal window? Modal window is an element that displays in front of and disables all other elements in the page.</p><p>When I have first learned about modal, I was amazed by it. I always thought you always need another html to have another window. In this article I will share what I have learned on making a modal window.</p><p>In my project, I have 2 modal windows that will be opened by 2 separate buttons.</p><h3><strong>HTML</strong></h3><p><strong>Buttons</strong></p><p>On the two buttons in our example, I used data attributes, and I named it <em>data-open</em>, and the value I assign for the <em>data-open</em> is the id of modal window that the button is going to open. This will make the job easier especially for multiple modals.</p><pre> &lt;div class=&quot;container&quot;&gt;<br>        &lt;button data-open = &quot;firstModal&quot; &gt;Show First Modal Window&lt;/button&gt;<br>        &lt;button data-open =&quot;secondModal&quot;&gt;Show Second Modal Window&lt;/button&gt;<br> &lt;/div&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/1*E-nCJasAjlWdnGCVORMCyw.png" /></figure><p>The value of data attributes will be used as the <em>id </em>of the modals for easy access of target modal to open. You will see what I mean after you finish reading this article.</p><p><strong>Modals</strong></p><p>On the two modal windows in my project, as I have mention earlier, I assigned Id same as the value of button’s data attribute.</p><p>I use a div element and assign a class <em>“modal”</em>. Inside this div element, I put another div and assign <em>“modal-dialog”</em> as a class. And inside this <em>“modal-dialog”</em> div, I put a text and a button that this example will use for closing open modal.</p><pre>&lt;div id=&quot;firstModal&quot; class=&quot;modal&quot;&gt;<br>        &lt;div class=&quot;modal-dialog&quot;&gt;<br>            &lt;div&gt;This is the first modal window&lt;/div&gt;<br>            &lt;button id=&quot;btnCloseModal&quot; data-close&gt;Close&lt;/button&gt;<br>        &lt;/div&gt;<br>    &lt;/div&gt;<br>    &lt;div id=&quot;secondModal&quot; class=&quot;modal&quot;&gt;<br>        &lt;div class=&quot;modal-dialog&quot;&gt;<br>            &lt;div &gt;This is the second modal window&lt;/div&gt;<br>            &lt;button id=&quot;btnCloseModal&quot; data-close&gt;Close&lt;/button&gt;<br>        &lt;/div&gt;<br>    &lt;/div&gt;</pre><h3><strong>CSS</strong></h3><p>I did not put too much design in this project as my concern is to show how to open and close modals. For the modals, default properties are in modal class, see code below. It should start hidden and for this example make the size to cover the whole screen. I advise setting a dark background, so viewer can focus more on the dialog box. Do not forget to assign z-index value that will make it on top of every web element.</p><pre>.modal {<br> position: fixed;<br> top: 0;<br> bottom: 0;<br> left: 0;<br> right: 0;<br> visibility: hidden;<br> width: 100%;<br> height: 100vh;<br> background: rgba(0, 0, 0, 0.8);<br> opacity: 0;<br> z-index: 99;<br> transition: all 0.35s ease-in;<br>}</pre><p>Inside our modal, we have the dialog box with the assigned “modal-dialog” class. In this case I set the height and width 30% of viewport. This dialog box will hold information that you want the user to focus.</p><pre>.modal-dialog{<br> height: 30vh;<br> width: 30vw;<br> border: 1px solid black;<br> background: white;<br>}</pre><p>Since our <em>modals</em> are hidden by default, we need a class that will make it visible. In this case I used <em>“is-visible”</em> class but should always be with <em>“modal”</em> class. See below.</p><pre>.modal.is-visible {<br> visibility: visible;<br> opacity: 1;<br>}</pre><h3><strong>JS</strong></h3><p>By default, if you look back in html file, there is no <em>“is-visible”</em> class. This will be handled by the js file, by adding it when the button is clicked and removing it when closed.</p><p><strong>Code</strong></p><p>First, I declared variables that will hold the data attribute.</p><pre>const dataOpen = &quot;[data-open]&quot;; // data attributes of two buttons that will open modals<br>const dataClose = &quot;[data-close]&quot;;// data attributes of two buttons that will close modals</pre><p>I need to get all the elements that has the specific data attribute and save it on a variable.</p><pre>let openData = document.querySelectorAll(dataOpen);<br>let closeData = document.querySelectorAll(dataClose);</pre><p>Lastly, the code below iterates for all the elements found by a certain data attribute stated above. The first for loop, iterates elements with <em>“data-open”</em> (data attribute) and the second for loop iterates elements with <em>“data-close”</em> (data attribute).<br>for this example, the value of every <em>“data-open”</em> (data attribute) is the same as the modal ID of the modal window it will open.<br>I did not assign value on <em>“data-close”</em>, as we can close the modal by a different method, by using <em>parentElement</em> method. <br>Data attribute’s value will be useful in getting element(s) by Id, for adding and removing <em>“is-visible”</em> class.</p><pre>for (const elm of openData){<br> elm.addEventListener(&#39;click&#39;,function(){ //add click event on buttons that will show modal<br> const dataOpen = this.dataset.open; // assigns the data attributes value which is the same on the modal&#39;s Id to be opened<br> document.getElementById(dataOpen).classList.add(&quot;is-visible&quot;); //get the element and add &quot;is-visible&quot; class<br> })<br>}<br>for (const elm of closeData){<br> elm.addEventListener(&#39;click&#39;,function(){ // add click event on buttons that will close modal<br> this.parentElement.parentElement.classList.remove(&quot;is-visible&quot;); get the element and remove &quot;is-visible&quot; class<br> })<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/655/1*IYhqXDQsnWyhmyBLHY3hEA.png" /><figcaption>Modal window shown after clicking the first button.</figcaption></figure><p>Using modal window is an effective way if you want the user to see or do something. It can be a simple alert, form to fill in, step by step process guide or whatever you want the user to focus and see or do.</p><p>Click the link below to see this project.</p><p><a href="https://codepen.io/noel1229/pen/eYjyYPN">Modal Window (codepen.io)</a></p><p>Hope you like it and learn something in this article. Thanks for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e4d555e8bccd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The “DRY” (Don’t Repeat Yourself) Principle]]></title>
            <link>https://medium.com/@noelpulido1229/the-dry-dont-repeat-yourself-principle-4c1854b97d9d?source=rss-f7860122f1df------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c1854b97d9d</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[dry]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Noel Pulido]]></dc:creator>
            <pubDate>Sun, 18 Dec 2022 09:21:27 GMT</pubDate>
            <atom:updated>2022-12-18T22:02:58.600Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lhKm50P0PtCSQjlk8PR5tw.jpeg" /><figcaption>Photo by DS stories from Pexels: <a href="https://www.pexels.com/photo/blue-wooden-board-game-meeples-6989944/">https://www.pexels.com/photo/blue-wooden-board-game-meeples-6989944/</a></figcaption></figure><p>This “DRY” that we are talking about is not the opposite of wet. Kidding aside, on programmer’s prospective “DRY” means Don’t Repeat Yourself. It means do not have the same code on different places of your project.</p><p><strong>“Don’t repeat yourself</strong>” (<strong>DRY</strong>) is a principle of software development aimed at reducing repetition of software patterns, replacing it with abstractions or using data normalization to avoid redundancy. -<a href="https://en.wikipedia.org/wiki/Don%27t_repeat_yourself"><em>source Wikipedia</em></a></p><p>Take a look at this example below.</p><pre>function PrintPersonOne(){<br>console.log(&#39;Noel Pulido&#39;)<br>}<br>function PrintPersonTwo(){<br>console.log(&#39;Jhoana Baronia&#39;)<br>}<br>function PrintPersonThree(){<br>console.log(&#39;Alexis Heart&#39;)<br>}</pre><p>Have you seen similarities? These functions are all having the same function of printing the name. What if we have 100 names to be printed? That would be a hundred functions if we are going to follow the above coding style. In this case we can only have one function, just put a parameter where we can pass our argument. In the case above, it should be like this:</p><pre>function PrintPerson(nameToPrint){<br>console.log(nameToPrint);<br>}</pre><p>For multiple names to be printed we can store them in an array like this.</p><pre>let namesToPrint =[&#39;Alexis&#39;, &#39;Noel&#39;, &#39;Jhoana&#39;];<br></pre><p>And we can make a function that go through each value of namesToPrint array and prints it. It goes something like this.</p><pre>PrintName = (arr) =&gt; {<br>  for(let i = 0, i &lt; arr.length, i++){<br>     console.log(arr[i]);<br>  }<br>}<br></pre><p>And finally invoke the function.</p><pre>PrintName(namesToPrint);<br></pre><p>Until now, I am sometimes guilty of not using the DRY Principle, but most of the times I catch it and getting better at it. Whenever I see codes in different places, even with minimal similarities, I still try to make it cleaner by applying the dry principle. We need to make it a habit to always double or triple check our code for somewhere in it there can be some repetitive codes that can be accomplished by one function with the help of parameters and arguments or whatever way you think to reduce repetitiveness.</p><p>For me, one of the reasons why we are having repetitive codes, are when we are just coding as it goes, without proper planning. We sometimes just ignore how our code looks like as long as it produces or shows same result. The results are good, but the codes are sloppy and all over the place, which will be hard to read by other coders. It even happens to me that after a while not seeing my codes, by the time I need to update it, I cannot even read my own code and took me a while to analyze it. So, it becomes a lesson to me to make a habit of cleaning the codes, and one of them is the DRY principle.</p><p>By following the DRY principle, not only it will make our codes shorter and cleaner, but it will also be easy to maintain. Imagine if you have a lot of repetitive codes and you need to change a line or two lines on all of those same codes, and you missed one or two, you will not get the result that you wanted to. Do not think that understanding what you code is enough, always think that some other coder will also look and update your code, so no to repetitive codes and yes to DRY principle.</p><p>This is just my few cents and hope this helps.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c1854b97d9d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JavaScript Arrays]]></title>
            <link>https://medium.com/@noelpulido1229/javascript-array-413b1febeba5?source=rss-f7860122f1df------2</link>
            <guid isPermaLink="false">https://medium.com/p/413b1febeba5</guid>
            <category><![CDATA[javascript-arrays]]></category>
            <dc:creator><![CDATA[Noel Pulido]]></dc:creator>
            <pubDate>Sun, 04 Dec 2022 21:29:34 GMT</pubDate>
            <atom:updated>2022-12-04T22:29:42.531Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ub5bYPpOk1_NrQ230HSM_w.jpeg" /><figcaption>Photo by Jose Mueses from Pexels: https://www.pexels.com/photo/photo-of-five-cars-parked-1280560/</figcaption></figure><p>What is an array? Array is a single variable with multiple values in it. Here is an example of an array</p><p>names = [&#39;Noel&#39;, &#39;Jhoana&#39;, &#39;Alexis&#39;, &#39;Rejinald&#39;]</p><p>As you can see on sample above, the variable names have 4 values in it.</p><p>Before we go farther, if we need an array in our code, we need to declare them first.</p><p><strong>Array Declaration</strong></p><p>Declare an empty array<br>let names = [ ];</p><p>Declare array with multiple values<br>let names = [&#39;Noel&#39;, &#39;Jhoana&#39;, &#39;Alexis&#39;, &#39;Rejinald&#39;]</p><p><strong>Accessing the values</strong></p><p>Each element of an array has assigned number called index. We can use index to access the values. The index starts with zero and increment by one on the next value.</p><p>Syntax: <em>arrayName</em>[index]</p><p>Example:</p><pre>let names = [’Noel’, &#39;Jhoana’, &#39;Alexis’, &#39;Rejinald’];<br>//the value &#39;Noel&#39; has an index of 0 (zero).<br>//the value &#39;Jhoana&#39; has an index of 1.<br>//the value &#39;Alexis&quot; has an index of 2.<br>//the value &#39;Rejinald&#39; has an index of 3.<br>console.log(names);<br>// output: [&#39;Noel&#39;, &#39;Jhoana&#39;, &#39;Alexis&#39;, &#39;Rejinald&#39;];<br>console.log(names[0]);<br>//output: Noel<br>console.log(names[2]);<br>//output: Alexis<br></pre><p><strong>Adding value(s) to array using push ()</strong></p><p>The <em>push</em> method adds new value(s) at the end of the array.</p><p>Syntax: <em>arrayName</em>.push(valueToAdd)</p><p>Example:</p><pre>let names = [&#39;Noel&#39;, &#39;Jhoana&#39;, &#39;Alexis&#39;, &#39;Rejinald&#39;]; <br>names.push(&#39;Che&#39;);<br>console.log(names);<br>//output<br>// [&#39;Noel&#39;, &#39;Jhoana&#39;, &#39;Alexis&#39;, &#39;Rejinald&#39;, &#39;Che&#39;]; <br></pre><p>You can also add multiple values and use comma as a separator.<br>Example:</p><pre>let names = [&#39;Noel&#39;, &#39;Jhoana&#39;, &#39;Alexis&#39;, &#39;Rejinald&#39;];<br>names.push(&#39;Che&#39;, &#39;Fe&#39;);<br>console.log(names);<br>//output<br>// [&#39;Noel&#39;, &#39;Jhoana&#39;, &#39;Alexis&#39;, &#39;Rejinald&#39;, &#39;Che&#39;, &#39;Fe&#39;]; <br></pre><p><strong>Deleting value in array using pop () method</strong></p><p>This method removes the last value in the array<br>Syntax: <em>arrayName</em>.pop()</p><p>Example:</p><pre>let names = [&#39;Noel&#39;, &#39;Jhoana&#39;, &#39;Alexis&#39;, &#39;Rejinald&#39;];<br> names.pop();<br>console.log(names);<br>//output<br>//[&#39;Noel&#39;, &#39;Jhoana&#39;, &#39;Alexis&#39;]; <br></pre><p><strong>The <em>filter</em>() method</strong></p><p>The filter method creates a new array on which every value passes the condition that was provided by a function.</p><p>Syntax: <em>arrayName</em>.filter(function)</p><p>Example:</p><pre>let numbers= [1, 3, 5, 7, 9]; <br>let filteredArray = numbers.filter(getUnderSix);<br>function getUnderSix(num){<br>     return num &lt; 6;<br>} <br>console.log(filteredArray);<br>//output<br>// [1, 3, 5]<br></pre><p><strong>My two cents</strong></p><p>Array helps us not only holding multiple values, but also on holding a group within a category. We can have an array of first name, array of fruit names so on and so forth. It also makes our code lesser, neat and easy to understand. Methods mentions above are only few that we could use to an array. See <a href="https://www.w3schools.com/js/js_arrays.asp">https://www.w3schools.com/js/js_arrays.asp</a> for more about JavaScript arrays.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=413b1febeba5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>