<?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: Christian Cedeno</title>
    <description>The latest articles on DEV Community by Christian Cedeno (@cedsengine).</description>
    <link>https://dev.to/cedsengine</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%2F927943%2Fe7c67a68-7a57-4a6e-93b2-c8e7fb979712.jpg</url>
      <title>DEV Community: Christian Cedeno</title>
      <link>https://dev.to/cedsengine</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/cedsengine"/>
    <language>en</language>
    <item>
      <title>Scrape the web with puppeteer!</title>
      <dc:creator>Christian Cedeno</dc:creator>
      <pubDate>Wed, 28 Aug 2024 14:38:31 +0000</pubDate>
      <link>https://dev.to/cedsengine/scrape-the-web-with-puppeteer-2hmh</link>
      <guid>https://dev.to/cedsengine/scrape-the-web-with-puppeteer-2hmh</guid>
      <description>&lt;h4&gt;
  
  
  Puppeteer full guide pt.1
&lt;/h4&gt;

&lt;h2&gt;
  
  
  Puppeteer: The Power Tool for Web Automation
&lt;/h2&gt;

&lt;p&gt;In today's fast-paced web development landscape, automation is key—and that's where Puppeteer comes in. Developed by Google, Puppeteer is a powerful Node.js library that allows developers to control Chrome browsers using JavaScript. Whether you're navigating the web in headless mode for efficiency or in a full browser for visual feedback, Puppeteer makes it easier than ever to automate tasks like web scraping, testing, and more. With Puppeteer, what once required manual effort is now just a script away.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why web scraping?
&lt;/h3&gt;

&lt;p&gt;In a recent project, I worked with a client who needed a landing page for his forex trading community. He wanted something similar to the stock tickers you see on MarketWatch or Yahoo Finance, but instead of stocks, he wanted real-time currency conversion rates for $1 USD displayed across the site.&lt;/p&gt;

&lt;p&gt;While there are APIs available that could provide the data—with usage limits and monthly fees—I saw an opportunity to create a custom solution using Puppeteer. By investing some time upfront, I was able to scrape and display the data for free, ultimately saving my client from recurring costs.&lt;/p&gt;

&lt;p&gt;Clients website: &lt;a href="https://majesticpips.com/" rel="noopener noreferrer"&gt;Majesticpips.com&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Setting up puppeteer made simple
&lt;/h3&gt;

&lt;p&gt;Before we can start scraping the web for all its glory, we must install puppeteer to our application.&lt;/p&gt;

&lt;p&gt;Just as described on the &lt;a href="https://pptr.dev/" rel="noopener noreferrer"&gt;docs&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;Install library using your choice of npm, yarn or pnpm.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;npm i puppeteer&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;yarn add puppeteer&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;pnpm add puppeteer&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This will download compatible version of chrome during installation which is easier for beginners to get things up and running quickly. &lt;/p&gt;

&lt;p&gt;If you are a more seasoned developer and have specific chrome/chromium version you'd like to work with; then installing these packages  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;npm i puppeteer-core&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;yarn add puppeteer-core&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;pnpm add puppeteer-core&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;would be best for you, the package will be lightweight as it only installs puppeteer and leaves the chrome version up to you to decide.&lt;/p&gt;

&lt;p&gt;Installing 'puppeteer' is the better option for first time tester. It simplifies the setup and ensures you have a working version of Chromium, allowing you to focus on writing your scripts.&lt;/p&gt;

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

&lt;p&gt;now on your JS file, you'd want to import puppeteer for applications using ES module systems(ES6 standards) with node versions 12 and above.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;import puppeteer from 'puppeteer';&lt;/code&gt; (recommended)&lt;br&gt;
or &lt;br&gt;
&lt;code&gt;import puppeteer from 'puppeteer-core';&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;or you can use the require syntax for commonJs module system for Node.js that is also compatible with older versions of Node.js.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;const puppeteer = require('puppeteer');&lt;/code&gt;&lt;br&gt;
or &lt;br&gt;
&lt;code&gt;const puppeteer = require('puppeteer-core');&lt;/code&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Step 3
&lt;/h3&gt;

&lt;p&gt;After importing Puppeteer, we can start writing the commands to perform web scraping. The code below shows what you'll need to use.&lt;/p&gt;

&lt;p&gt;We launch the browser using these methods provided by the library.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const browser = await puppeteer.launch();

const page = await browser.newPage();

await browser.close();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;puppeteer.launch()&lt;/code&gt; = This method launches a new browser instance.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;browser.newPage()&lt;/code&gt; = This method creates a new page (or tab) within the browser instance.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;browser.close()&lt;/code&gt; = This method closes the browser instance.&lt;/p&gt;

&lt;p&gt;In puppeteer.launch(), we can pass arguments to customize the browser launch according to our preferences. We’ll cover this in more detail in part 2. However, by default, puppeteer.launch() has preset values, such as headless mode being set to true.&lt;/p&gt;

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

&lt;p&gt;The browser has been launched, and we now have a page ready to surf the web. Let's navigate to the website where we'll scrape some data.&lt;/p&gt;

&lt;p&gt;For this example, we'll be scraping data from a &lt;a href="https://quotes.toscrape.com/" rel="noopener noreferrer"&gt;qoutes website&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; await page.goto(https://quotes.toscrape.com/)

 await page.screenshot({ path: 'screenshot.png' })
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I've added await page.screenshot({ path: 'screenshot.png' }) to the mix. This is a great tool to ensure everything is going according to plan. When this code executes, you'll have an image file in your project directory capturing the current state of the website you're scraping. You can also adjust the file name to your liking.&lt;/p&gt;

&lt;p&gt;If everything checks out then proceed to step 5.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5
&lt;/h3&gt;

&lt;p&gt;Now that our script is taking shape, let’s dive into the key part where we extract data from the web page. Here's how our script looks so far:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const puppeteer = require('puppeteer');

(async () =&amp;gt; {

const browser = await puppeteer.launch();

const page = await browser.newPage();

await page.goto(https://quotes.toscrape.com/)

await page.screenshot({ path: 'screenshot.png' })

 const quotesScraper = await page.evaluate(() =&amp;gt; {

const quotes = document.querySelectorAll(".quote"); 
    const quotesArray = [];

   for (const quote of quotes) { 
       const texts = quote.querySelector(".text").innerText; 
         const author = quote.querySelector(".author").innerText;  

        quotesArray.push({
           quote: texts,
           author
         });

     }
     return quotesArray;
});

console.log(quotesScraper);

await browser.close();

})();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To verify that the data was successfully scraped, we can run node "server-file-name" in the CLI, and the data will be displayed in the console using &lt;code&gt;console.log(quotesScraper);&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;[
  {
    quote: '“The world as we have created it is a process of our thinking. It cannot be changed without changing our thinking.”',
    author: 'Albert Einstein'
  },
  {
    quote: '“It is our choices, Harry, that show what we truly are, far more than our abilities.”',
    author: 'J.K. Rowling'
  },
  {
    quote: '“There are only two ways to live your life. One is as though nothing is a miracle. The other is as though everything is a miracle.”',
    author: 'Albert Einstein'
  },
  {
    quote: '“The person, be it gentleman or lady, who has not pleasure in a good novel, must be intolerably stupid.”',
    author: 'Jane Austen'
  },
  {
    quote: "“Imperfection is beauty, madness is genius and it's better to be absolutely ridiculous than absolutely boring.”",
    author: 'Marilyn Monroe'
  }
....
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;await page.evaluate(() =&amp;gt; { ... })&lt;/code&gt;: This is where the magic happens. The evaluate method allows us to run JavaScript code within the context of the page we're scraping. It's as if you're opening the browser's developer console and running the code directly on the page.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;const quotes = document.querySelectorAll(".quote");&lt;/code&gt;: Here, we're selecting all elements on the page that match the .quote class. This gives us a NodeList of quote elements.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;const quotesArray = [];&lt;/code&gt;: We initialize an empty array to store the quotes we extract.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;for (const quote of quotes) { ... }&lt;/code&gt;: This loop iterates over each quote element. For each one, we extract the text of the quote and the author.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;quotesArray.push({ quote: texts, author });&lt;/code&gt;: For each quote, we create an object containing the quote text and the author, then push this object into the quotesArray.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;return quotesArray;&lt;/code&gt;: Finally, we return the array of quotes, which is then stored in quotesScraper in our Node.js environment.&lt;/p&gt;

&lt;p&gt;This method of extracting data is powerful because it allows you to interact with the page just like a user would, but in an automated and programmatic way.&lt;/p&gt;

&lt;h4&gt;
  
  
  Closing the Browser
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;await browser.close();&lt;/code&gt;: After scraping the data, it's important to close the browser to free up resources. This line ensures that the browser instance we launched is properly shut down.&lt;/p&gt;

&lt;h4&gt;
  
  
  Looking Ahead to Part 2
&lt;/h4&gt;

&lt;p&gt;With this script, you've successfully scraped data from a website using Puppeteer. But we're just scratching the surface of what's possible. In Part 2, we’ll explore more advanced techniques like handling dynamic content and use Express.JS to create API functionality of scrapped data.  Stay tuned as we delve deeper into the world of Puppeteer!&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>node</category>
      <category>javascript</category>
      <category>express</category>
    </item>
    <item>
      <title>JS stacks DS&amp;A intro</title>
      <dc:creator>Christian Cedeno</dc:creator>
      <pubDate>Wed, 14 Aug 2024 20:37:42 +0000</pubDate>
      <link>https://dev.to/cedsengine/js-stacks-dsa-intro-bl3</link>
      <guid>https://dev.to/cedsengine/js-stacks-dsa-intro-bl3</guid>
      <description>&lt;p&gt;If you use any modern device, you’ve likely encountered stack operations, even if you didn’t realize it. Stacks are fundamental in many programming tasks, from managing function calls to enabling undo operations.&lt;/p&gt;

&lt;h3&gt;
  
  
  What are Stacks?
&lt;/h3&gt;

&lt;p&gt;Stacks are a linear data structure that follows order of operations organizing data in a LIFO or FILO structure. &lt;/p&gt;

&lt;p&gt;LIFO: Last in, First out.&lt;/p&gt;

&lt;p&gt;FILO: First in, Last out.&lt;/p&gt;

&lt;p&gt;Stacks are used to perform operations on a collection of elements such as adding and removing elements, displaying top elements and displaying if collection is empty or full.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;For example:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;When you are on your web browser currently visiting &lt;a href="http://www.ESPN.com" rel="noopener noreferrer"&gt;www.ESPN.com&lt;/a&gt; and you accidentally click on a ad for Chicago White Sox baseball tickets. We added to our stack, maybe not intentionally but now it's at the top of our stack. Then we realize that the Chicago White Sox have lost 15 games in a row. Well ... let's hit that back button(removing that element from the top of the stack).&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%2Fe2161xxscdlw2udvo4c7.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%2Fe2161xxscdlw2udvo4c7.png" alt="browser undo button" width="255" height="101"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Yes, that one right up there. This demonstrates the LIFO principle in stacks operations, we are leaving(removing) the last visited page from our history(or Stacks) to return to &lt;a href="http://www.ESPN.com" rel="noopener noreferrer"&gt;www.ESPN.com&lt;/a&gt; ... maybe next year White Sox's.&lt;/p&gt;

&lt;p&gt;Stacks operations are used often in applications that need to maintain order web browser history, undo and redo on text editors and  function call stacks to name a few.&lt;/p&gt;

&lt;p&gt;Functions commonly used when altering stacks are as follows:&lt;/p&gt;

&lt;p&gt;.Push = to add element onto a stack.&lt;/p&gt;

&lt;p&gt;.pop = to remove top element from a stack.&lt;/p&gt;

&lt;p&gt;.peek = to display the top element of a stack.&lt;/p&gt;

&lt;p&gt;.length/.size = to determine the total of indexes in a stack. Javascript uses (.length)&lt;/p&gt;

&lt;p&gt;.isEmpty = checks if a stack is empty.&lt;/p&gt;

&lt;p&gt;.isFull = checks if a stack is full; if array has a fixed size.&lt;/p&gt;

&lt;p&gt;Stacks data structure can be created with a stacks class or with a regular array. &lt;/p&gt;

&lt;p&gt;Implementing stacks without class:&lt;/p&gt;

&lt;p&gt;When performing stacks operations without a stacks class, we simulate stack operations with an array.&lt;/p&gt;

&lt;p&gt;Below will be an example of using the stacks operations to reverse an array of numbers. I will use JSON.stringify to compare the values of the array outcome to the desire array outcome.&lt;/p&gt;

&lt;p&gt;Ex:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Reverse an array using stack operations

let number = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; // original array
let numberList = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]; // reversed array
let ordernumberList = []; // array to store the reversed order

// Loop through the numberList array to reverse its order
for (var i = 0; i &amp;lt; number.length; i++) {
  let currentValue = numberList.pop(); // using the key .pop method to remove the last element from numberList
  ordernumberList.push(currentValue); // using the key .push method to push the popped element into ordernumberList
}

console.log(ordernumberList + " vs " + number); // compare the arrays

// Convert both arrays into JSON strings for comparison
if (JSON.stringify(ordernumberList) === JSON.stringify(number)) {
  console.log("The number list is reversed: " + ordernumberList);
  return ordernumberList;
} else {
  console.log("The number list is not reversed: " + ordernumberList);
}

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

&lt;/div&gt;



&lt;p&gt;I want to highlight the &lt;code&gt;if-else&lt;/code&gt; statement at the very end. I used the &lt;code&gt;JSON.stringify&lt;/code&gt; method to compare the two arrays because, without it, the comparison would return false, triggering the else condition, even though the arrays have identical content. This happens because, when comparing arrays in JavaScript, the comparison checks their references (i.e., their memory locations) rather than the actual content inside the arrays.&lt;/p&gt;

&lt;p&gt;As we can see throughout the &lt;code&gt;for-loop&lt;/code&gt;, our method &lt;code&gt;.pop&lt;/code&gt; (removed) the last index in the numberList array first(LIFO). Then using the &lt;code&gt;.push&lt;/code&gt; method to add it into the new array ordernumberList, reversing the original array.  &lt;/p&gt;

&lt;p&gt;FILO comes in on the new array formulated as the first indexes pushed into ordernumberList array will be the last ones out(FILO) if ever modified with the stacks operations.&lt;/p&gt;

&lt;p&gt;In this article, we’ve explored how stacks operate using the LIFO and FILO principles, implemented stack operations in JavaScript. Understanding stacks is essential for many programming tasks, as seen  in real-world scenarios like web browsing.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Unraveling Rails Serialization: Formatting Web APIs</title>
      <dc:creator>Christian Cedeno</dc:creator>
      <pubDate>Wed, 22 Nov 2023 13:11:36 +0000</pubDate>
      <link>https://dev.to/cedsengine/unraveling-rails-serialization-formatting-web-apis-2dla</link>
      <guid>https://dev.to/cedsengine/unraveling-rails-serialization-formatting-web-apis-2dla</guid>
      <description>&lt;p&gt;Hello, I'm Christian, and I'm excited to guide you through a comprehensive mini-series focused on mastering serialization in Ruby on Rails. Throughout this series, we will dive into the essentials of Rails serializers, explore their efficiency, and discuss how to customize and optimize them for peak performance. Additionally, we'll uncover best practices to ensure your serialization processes are seamless and effective.&lt;/p&gt;

&lt;h3&gt;
  
  
  What are serializers?
&lt;/h3&gt;

&lt;p&gt;In Rails, dealing with complex data structures, such as objects, can be challenging. Fortunately, Rails provides us with a powerful tool: serializers. This can be utilized in various aspects of your programming journey.&lt;/p&gt;

&lt;p&gt;Web APIs: Streamlining the process of sending and receiving data.&lt;/p&gt;

&lt;h3&gt;
  
  
  Web APIs
&lt;/h3&gt;

&lt;p&gt;Web APIs brings your application to life. Usually the backbone of an application, providing the platform with data to animate the functionalities making the web application dynamic. Serialization aids web APIs, by transforming information into consistently formatted data for client and server side to transmit data efficiently between each other. Data is commonly formatted to readable JSON , XML or others for specific use cases. This allows the transmission of data to flow through application seamlessly.&lt;/p&gt;

&lt;h3&gt;
  
  
  Choosing the Best Format
&lt;/h3&gt;

&lt;h4&gt;
  
  
  JSON: Javascript Object Notation
&lt;/h4&gt;

&lt;p&gt;JSON is the most widely used format in modern web APIs due to its simplicity, readability, and ease of use in web applications.&lt;/p&gt;

&lt;p&gt;It represents data as key-value pairs, resembling JavaScript object syntax, which makes it a natural choice for web applications, especially those using JavaScript.&lt;/p&gt;

&lt;h5&gt;
  
  
  JSON API format example
&lt;/h5&gt;

&lt;p&gt;&lt;code&gt;{&lt;br&gt;
“id”: 1,&lt;br&gt;
“first_name”: “John”,&lt;br&gt;
“last_name”: “Smith”,&lt;br&gt;
“age”: 25&lt;br&gt;
}&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
Benefits: It's easily parsed by browsers and server-side languages, and supported natively by JavaScript.&lt;/p&gt;

&lt;h4&gt;
  
  
  XML: eXtensible Markup Language
&lt;/h4&gt;

&lt;p&gt;XML is historically popular, especially in SOAP (Simple Object Access Protocol) based APIs and enterprise systems.&lt;/p&gt;

&lt;p&gt;It uses tags (similar to HTML) to define objects and their attributes.&lt;/p&gt;

&lt;h5&gt;
  
  
  XML API format example
&lt;/h5&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;user&amp;gt;&lt;br&gt;
&amp;lt;id&amp;gt;1&amp;lt;/id&amp;gt;&lt;br&gt;
&amp;lt;name&amp;gt;John Doe&amp;lt;/name&amp;gt;&lt;br&gt;
&amp;lt;email&amp;gt;john.doe@example.com&amp;lt;/email&amp;gt;&lt;br&gt;
&amp;lt;/user&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Benefits: Self-descriptive, hierarchical, and suitable for complex data structures, though it tends to provide more excessive information compared to JSON.&lt;/p&gt;

&lt;h3&gt;
  
  
  Additional formats include:
&lt;/h3&gt;

&lt;h4&gt;
  
  
  CSV (Comma-Separated Values)
&lt;/h4&gt;

&lt;p&gt;CSV, although not commonly used for web applications. CSV is used to represent tabular data(data displayed in columns and rows, ex: spreadsheets).&lt;/p&gt;

&lt;p&gt;CSV is a great format for importing and exporting data to be read by spreadsheet softwares(excel, google spreadsheets, etc.)&lt;/p&gt;

&lt;h4&gt;
  
  
  Protobuf (Protocol buffers)
&lt;/h4&gt;

&lt;p&gt;A binary serialization format developed by google. It’s known to be more efficient relative to speed and size compared to its counter part JSON and XML formats.&lt;br&gt;
This is your ideal format for high performance and low latency applications.&lt;/p&gt;

&lt;p&gt;In conclusion WebAPIs can be parsed into many different formats. The choice of data format—be it JSON, XML, CSV, or Protobuf, a chosen format heavily relies on the requirements, performance and consideration needs of the application and the environment it operates on. With many data formats to choose from, mastering serializers within Ruby on Rails, developers can significantly elevate the functionality and user experience of their web applications, turning what might seem like a challenging endeavor into a more approachable and rewarding one.&lt;/p&gt;

</description>
      <category>ruby</category>
      <category>rails</category>
      <category>tutorial</category>
      <category>programming</category>
    </item>
    <item>
      <title>Building a QR code generator</title>
      <dc:creator>Christian Cedeno</dc:creator>
      <pubDate>Sun, 16 Apr 2023 02:07:47 +0000</pubDate>
      <link>https://dev.to/cedsengine/building-a-qr-code-generator-onj</link>
      <guid>https://dev.to/cedsengine/building-a-qr-code-generator-onj</guid>
      <description>&lt;h2&gt;
  
  
  What is a QR code?
&lt;/h2&gt;

&lt;p&gt;QR code is a later version of a data matrix barcode invented in japan in 1994, data matrix barcode was used to label automotive parts, these labels when scanned would output information pertaining to the automotive part the code referenced. This was a great way to have accessible information contained and hidden only to be accessed when needed. &lt;/p&gt;

&lt;p&gt;Qr codes are widely used to store a variety information for business and personal use. From links to websites, advertisements, contact info, restaurant menus and payment processing etc. QR codes hold more information than data matrix barcode and makes information easier to access for anyone with a smart device camera. &lt;/p&gt;

&lt;p&gt;I will be walking you through a simple QR code generator application made with Javascript and HTML using the JS library called qrcode on the CDNJS platform (&lt;a href="https://cdnjs.com/libraries/qrcode" rel="noopener noreferrer"&gt;https://cdnjs.com/libraries/qrcode&lt;/a&gt;). However, for those who want to use a Framework there are Node packages for QR code generation as well (&lt;a href="https://www.npmjs.com/package/qrcode#highlights" rel="noopener noreferrer"&gt;https://www.npmjs.com/package/qrcode#highlights&lt;/a&gt;). &lt;/p&gt;

&lt;h3&gt;
  
  
  Let’s Build!
&lt;/h3&gt;

&lt;p&gt;To begin the Process of building out your QR code generator we will add the Qr code script into the head of our HTML structure.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;script 
src="https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js" 
  integrity="sha512-CNgIRecGo7nphbeZ04Sc13ka07paqdeTu0WR1IM4kNcpmBAUSHSQX0FslNhTDadL4O5SAGapGt4FodqL8My0mA==" 
   crossorigin="anonymous" referrerpolicy="no-referrer"&amp;gt;
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the example below a form element is created for users to submit a URL and the size of the Qr code they prefer. (This library will also allow users to pick the color of the Qr code also if you are interested.)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;form id="generate-form"&amp;gt;
  &amp;lt;input id="url"
         type="url" 
           placeholder="Enter URL here"
/&amp;gt;

  &amp;lt;select id="size"&amp;gt;
    &amp;lt;option value="100"&amp;gt;100x100&amp;lt;/option&amp;gt;
    &amp;lt;option value="200"&amp;gt;200x200&amp;lt;/option&amp;gt;
    &amp;lt;option value="300" selected&amp;gt;300x300&amp;lt;/option&amp;gt;
    &amp;lt;option value="400"&amp;gt;400x400&amp;lt;/option&amp;gt;
    &amp;lt;option value="500"&amp;gt;500x500&amp;lt;/option&amp;gt;
    &amp;lt;option value="600"&amp;gt;600x600&amp;lt;/option&amp;gt;
    &amp;lt;option value="700"&amp;gt;700x700&amp;lt;/option&amp;gt;
&amp;lt;/select&amp;gt;

   &amp;lt;button type="submit"&amp;gt; 
         Generate QR Code
   &amp;lt;/button&amp;gt;

&amp;lt;/form&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The form element will submit the URL and size value needed for QR code generator functionality. &lt;/p&gt;

&lt;h3&gt;
  
  
  Javascript functionality
&lt;/h3&gt;

&lt;p&gt;Begin with declaring two variables, form element and the element that will display the Qr code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const form = document.getElementById('generate-form');
const qr = document.getElementById('qrcode');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next add this code provided by the library we are using, generateQRCode() will take in two arguments and generate the QR code correlated to the arguments passed in.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const generateQRCode = (url, size) =&amp;gt; {
        const qrcode = new QRCode('qrcode', {
            text: url, 
            width: size, 
            height: size
        })
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Submit function
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const form = document.getElementById('generate-form');
const qr = document.getElementById('qrcode');

const generateQRCode = (url, size) =&amp;gt; {
   const qrcode = new QRCode('qrcode', {
        text: url, 
        width: size, 
        height: size
      })
  };

const onSubmit = (e) =&amp;gt; {
e.preventdefault();

const url = document.getElementById('url').value;
    const size = document.getElementById('size').value;
if(url === '') {
        alert('Please enter a URL');
    } else {
generateQRCode(url, size);
  }
};

form.addEventListener("submit", onSubmit);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two variables are declared to contain the input value, a if statement to ensure filled input, if not alert user to fill input and lastly calling the generateQRCode function with the passed in arguments. &lt;/p&gt;

&lt;p&gt;To give onSubmit functionality to form element we add event listener to listen for form submissions of Qr code and pass in the event "submit" follow by the function onSubmit.&lt;/p&gt;

&lt;h4&gt;
  
  
  With this you should have a functioning Qr code generator!
&lt;/h4&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Functional Email Form in React with EmailJS</title>
      <dc:creator>Christian Cedeno</dc:creator>
      <pubDate>Fri, 10 Mar 2023 18:19:33 +0000</pubDate>
      <link>https://dev.to/cedsengine/functional-email-form-in-react-with-emailjs-5ehn</link>
      <guid>https://dev.to/cedsengine/functional-email-form-in-react-with-emailjs-5ehn</guid>
      <description>&lt;p&gt;Require installs: &lt;code&gt;$ npm install @emailjs/browser --save&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Email has been one of the worlds best form of communication for several decades. However, with the rise of text messaging and social media, emails dominance has been challenge in recent years. Email still remains relevant in todays world due to its variety forms of usage, for example it's used as a professional way of online communication, has a great use case for user verification and its efficient for sending data, images, files, etc. &lt;/p&gt;

&lt;p&gt;Email is essential part of any web application, With emailJS its never been easier to implement a functional email form to your application. I’ll be walking you through the steps to get a functioning email form for your react app!&lt;/p&gt;

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

&lt;p&gt;Before we touch any code, we must create an account below. This will take you to &lt;a href="http://EmailJs.com" rel="noopener noreferrer"&gt;EmailJs.com&lt;/a&gt;, here you can create a free Account and have access to receive 200 emails per month completely FREE! &lt;/p&gt;

&lt;p&gt;&lt;a href="https://dashboard.emailjs.com/sign-up" rel="noopener noreferrer"&gt;Send email from Javascript - no server code required | EmailJS&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once your account has been created and you have signed into your account, on the tab to the left of the page you’ll see “&lt;strong&gt;Email services&lt;/strong&gt;” click it.  This is where you’ll pick a email service that you want to receive emails to, allow access.&lt;/p&gt;

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

&lt;p&gt;We will then create a email template, this is located on the tab on the left of the page. Customize the template to your preference. &lt;/p&gt;

&lt;p&gt;Keep in mind the value that is placed inside double curly bracket(Template parameters) will be referenced in your input element name attribute. &lt;/p&gt;

&lt;h3&gt;
  
  
  below is a example of my template:
&lt;/h3&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%2Fo2fxcyatwbkm9yetq0cr.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%2Fo2fxcyatwbkm9yetq0cr.png" alt="Image description" width="800" height="576"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To the right of the screen you’ll see a “To Email*” make sure your recipient email is listed and the “From Email*” check box is mark as checked. All other inputs on the right of the screen is &lt;strong&gt;optional&lt;/strong&gt;. &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%2Fd3qsjo0h9kmxb9a1pbz0.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%2Fd3qsjo0h9kmxb9a1pbz0.png" alt="Image description" width="800" height="939"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Make sure to test out your email!&lt;/strong&gt;&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%2Fd7q5c67wdt8isy99w7j9.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%2Fd7q5c67wdt8isy99w7j9.png" alt="Image description" width="800" height="633"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;Time to code! Let’s get a react application running with the code below. Side note emailJS can also be used with Angular, Vue.Js, Svelte and Wix code as well, there are examples of this on the emailJS docs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="nx"&gt;$&lt;/span&gt; &lt;span class="nx"&gt;npx&lt;/span&gt; &lt;span class="nx"&gt;create&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;react&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;app-name&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="nx"&gt;$&lt;/span&gt; &lt;span class="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;start&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once the react application is up and running, install emailJS.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="nx"&gt;$&lt;/span&gt; &lt;span class="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;install&lt;/span&gt; &lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;emailjs&lt;/span&gt;&lt;span class="sr"&gt;/browser --sav&lt;/span&gt;&lt;span class="err"&gt;e
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will install and save into your package json dependency.&lt;/p&gt;

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

&lt;p&gt;The next step is to designate a component to import emailJS.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&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;useRef&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="nx"&gt;emailjs&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;@emailjs/browser&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ContactUs&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;form&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useRef&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the example above emailJs is imported to the ContactUs component. &lt;/p&gt;

&lt;p&gt;useRef hook is imported also, useRef will remember the information put in the input element. It will then send that information to the emailJs server. &lt;/p&gt;

&lt;p&gt;Next will be the function we add to this component that requires service ID, template ID and API Key that all can be found in your emailJS account.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;sendEmail&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&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;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;preventDefault&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

    &lt;span class="nx"&gt;emailjs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sendForm&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;YOUR_SERVICE_ID&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="s1"&gt;YOUR_TEMPLATE_ID&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;form&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;YOUR_PUBLIC_KEY&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;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;result&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;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&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="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&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;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&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="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;*&lt;em&gt;below is examples of where to find the required input: *&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Service ID&lt;/strong&gt;&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%2Ft7gwaoyiekr7coz8cfrt.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%2Ft7gwaoyiekr7coz8cfrt.png" alt="Image description" width="800" height="250"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Template ID&lt;/strong&gt;&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%2Fcpz8bz4zfgaswwv2jy6c.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%2Fcpz8bz4zfgaswwv2jy6c.png" alt="Image description" width="800" height="174"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;API key&lt;/strong&gt; &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%2Fomqohcj4csxdbvfvvun9.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%2Fomqohcj4csxdbvfvvun9.png" alt="Image description" width="800" height="268"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;All that is left is to add the sendEmail function as a onSubmit event and useRef hook to the Form element lastly a “name” attribute to each input elements that correlates to the email template parameters.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;form&lt;/span&gt; &lt;span class="err"&gt;**&lt;/span&gt;&lt;span class="na"&gt;ref&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;form&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="err"&gt;**&lt;/span&gt; &lt;span class="err"&gt;**&lt;/span&gt;&lt;span class="na"&gt;onSubmit&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;sendEmail&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="err"&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="nt"&gt;label&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Name&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;label&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="nt"&gt;input&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="err"&gt;**&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"name"&lt;/span&gt;&lt;span class="err"&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="nt"&gt;label&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Email&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;label&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="nt"&gt;input&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"email"&lt;/span&gt; &lt;span class="err"&gt;**&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"email"&lt;/span&gt;&lt;span class="err"&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="nt"&gt;label&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Message&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;label&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="nt"&gt;textarea&lt;/span&gt; &lt;span class="err"&gt;**&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"message"&lt;/span&gt;&lt;span class="err"&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="nt"&gt;input&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"submit"&lt;/span&gt; &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Send"&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="nt"&gt;form&lt;/span&gt;&lt;span class="p"&gt;&amp;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;The name attributes above correlates to the email template parameters displayed below.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt; &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%2F7k0hm5wpof8dzg8wzjca.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%2F7k0hm5wpof8dzg8wzjca.png" alt="Image description" width="800" height="576"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The name attribute’s value in the input element must match what’s in the double curly bracket. This is how emailJS knows where the value is intended to be displayed in the email.&lt;/p&gt;

&lt;p&gt;You now have a fully functional way to receive emails from users on your web application!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>react</category>
      <category>tutorial</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Using Axios Guide</title>
      <dc:creator>Christian Cedeno</dc:creator>
      <pubDate>Mon, 12 Dec 2022 06:23:54 +0000</pubDate>
      <link>https://dev.to/cedsengine/using-axios-guide-10a2</link>
      <guid>https://dev.to/cedsengine/using-axios-guide-10a2</guid>
      <description>&lt;p&gt;&lt;em&gt;Below is a beginner guide on how to install and use Axios in React.js&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  how to install
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;using npm:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;$ npm install axios&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;using yarn:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;$ yarn add axios&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  how to import:
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;import axios from 'axios';&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The import must be added to the top of the react component axios is being implemented in.&lt;/p&gt;

&lt;h3&gt;
  
  
  Axios usage:
&lt;/h3&gt;

&lt;p&gt;Axios is a HTTP client library used in React JS and Vanilla JS to make request to a specified endpoint. These request are known as HTTP request. The request usually made are &lt;strong&gt;GET&lt;/strong&gt; which is known as Read in CRUD, &lt;strong&gt;POST&lt;/strong&gt; is known as Create in CRUD, &lt;strong&gt;PATCH&lt;/strong&gt;  is to update in CRUD and lastly &lt;strong&gt;DELETE&lt;/strong&gt;.  &lt;/p&gt;

&lt;h3&gt;
  
  
  HTTP Request Examples
&lt;/h3&gt;

&lt;h3&gt;
  
  
  GET Request:
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&lt;br&gt;
const [post, setPost] = useState([]);&lt;br&gt;
    useEffect(() =&amp;gt; {&lt;br&gt;
    axios.get('url')&lt;br&gt;
   .then((response) =&amp;gt; {&lt;br&gt;
      setPost(response.data);&lt;br&gt;
    });&lt;br&gt;
  }, []);&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  POST Request:
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;function createPost() {&lt;br&gt;
    axios.post(baseURL, {&lt;br&gt;
        title: "Hello World!",&lt;br&gt;
        body: "my latest post."&lt;br&gt;
      })&lt;br&gt;
      .then((response) =&amp;gt; {&lt;br&gt;
        setPost(response.data);&lt;br&gt;
      });&lt;br&gt;
  }&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  PATCH request:
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;function updatePost() {&lt;br&gt;
    axios.patch(&lt;/code&gt;url/${id}&lt;code&gt;, {&lt;br&gt;
        body: "an update of my latest post."&lt;br&gt;
      })&lt;br&gt;
      .then((response) =&amp;gt; {&lt;br&gt;
        setPost(response.data);&lt;br&gt;
      });&lt;br&gt;
  }&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  DELETE Request:
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;function deletePost() {&lt;br&gt;
    axios.delete(&lt;/code&gt;url/${id}&lt;code&gt;)&lt;br&gt;
      .then(() =&amp;gt; {&lt;br&gt;
        alert("Post deleted!");&lt;br&gt;
        setPost(null)&lt;br&gt;
      });&lt;br&gt;
  }&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Using async and await:
&lt;/h3&gt;

&lt;p&gt;async-await syntax in axios allows for less code since the &lt;strong&gt;.then&lt;/strong&gt; and &lt;strong&gt;.catch&lt;/strong&gt; callback functions aren't needed. &lt;/p&gt;

&lt;h3&gt;
  
  
  GET Request with Async-Await
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;const [post, setPost] = useState([]);&lt;br&gt;
const client = axios.create({&lt;br&gt;
  baseURL: "https://jsonplaceholder.typicode.com/posts" &lt;br&gt;
});&lt;br&gt;
useEffect(() =&amp;gt; {&lt;br&gt;
     async function getPost() {&lt;br&gt;
      const response = await client.get("/1");&lt;br&gt;
      setPost(response.data);&lt;br&gt;
    }&lt;br&gt;
    getPost();&lt;br&gt;
  }, []);&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Why should you consider using axios to make your http request:
&lt;/h3&gt;

&lt;p&gt;Axios have built in crud functions to make request simple.&lt;br&gt;
 &lt;em&gt;Ex:&lt;/em&gt; axios.get, axios.patch, axios.post, axios.delete.&lt;/p&gt;

&lt;p&gt;You'll use less lines of code to make endpoint request since request with axios requires only one &lt;strong&gt;.then()&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>discuss</category>
    </item>
    <item>
      <title>What the CRUD Active Record</title>
      <dc:creator>Christian Cedeno</dc:creator>
      <pubDate>Thu, 17 Nov 2022 09:14:49 +0000</pubDate>
      <link>https://dev.to/cedsengine/what-the-crud-active-record-1cd2</link>
      <guid>https://dev.to/cedsengine/what-the-crud-active-record-1cd2</guid>
      <description>&lt;p&gt;&lt;em&gt;The following will be a tutorial on CRUD methods used in ruby Active Record to manipulate(read/write)data. Learn more about Active Record here &lt;a href="https://guides.rubyonrails.org/active_record_basics.html" rel="noopener noreferrer"&gt;Active Record documentation&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CRUD?&lt;/strong&gt; &lt;br&gt;
What is it, what does it mean? If you aren't familiar already with CRUD, I can help explain the concepts briefly.&lt;br&gt;
CRUD is an acronym for CREATE, READ, UPDATE and DELETE.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why CRUD?&lt;/strong&gt; &lt;br&gt;
CRUD is used heavily in programming as a way to communicate with stored data. These so called stored data usually come from API's and or databases. To access or manipulate the information we use CRUD. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CRUD examples&lt;/strong&gt;&lt;br&gt;
Below I will demonstrate the usage of the crud methods and the output of these invoked methods. I recommend referring to the Active Record documentation for any clarifications! &lt;a href="https://guides.rubyonrails.org/active_record_basics.html#crud-reading-and-writing-data" rel="noopener noreferrer"&gt;CRUD methods&lt;/a&gt; &lt;/p&gt;


&lt;h1&gt;
  
  
  Create
&lt;/h1&gt;

&lt;p&gt;In active record, we can create objects using either the .new method or the .create method. We use the .create method to create and save a new object. Normally in Active Record the .create method is invoked on a Ruby class to create instances of said class. This method takes in a argument in the form of variables or hash.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//.create method 

adele_album = Album.create(song1: "hello", song2: "someone like you")

or

adele_song = Song.create("hello")

// .new method

album = Album.new
album.song1 = "hello"
album.song2 = "someone like you"
album.save
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When creating a new object with the .new method it is required to use the save method for the object to persist in the database unlike the .create method which creates and saves the object all together. &lt;/p&gt;




&lt;h1&gt;
  
  
  Read
&lt;/h1&gt;

&lt;p&gt;Active Records makes retrieving data from the database fairly easy, think of it as a getter method since it returns based on the method invoked. &lt;/p&gt;

&lt;p&gt;for example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//the .all method will return all instances of album. 

Album.all
=&amp;gt; [song1: "hello", song2: "someone like you"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//the .find method returns based on the id passed in as a argument. 

Album.find(2)
=&amp;gt; [song2: "someone like you"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Keep in mind when using Active Record 'id' are autonomously generated by active record when objects are created with the .create method or when saved aft6edr using the .new method.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//the first and last method returns the first object/instance //in the class and the last method returns the last //object/instance

Album.first
=&amp;gt;[song1: "hello"]

Album.last
=&amp;gt;[song2: "someone like you"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  Update
&lt;/h1&gt;

&lt;p&gt;Before we are able to update a object it must first be read. This will give us the exact object we want to update. Update can be done with the .save method or the .update method.&lt;br&gt;
.save method is best used for objects not already present in the database, the .update is best used on a object present in a database that needs to be altered.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//for objects not already in the database we use .save

song = Album.find_by(song1: "hello")
song.song1 = "Rolling in the deep"
song.save

or 

song = Album.find_by(song1: "hello")
song.update(song1: "Rolling in the deep")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;check the database to make sure changes were made.&lt;/p&gt;




&lt;h1&gt;
  
  
  delete
&lt;/h1&gt;

&lt;p&gt;When deleting objects you can read the object or pass in the object as a argument depending on the delete method used. Below will be several examples of the delete method.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//when using the .destroy method, read the object first. 
first_song = Album.first 
first_song.destroy

//the code above can be short handed 
Album.first.destroy 

//we can be specific with the key and values of a class //instance we want to destroy by using the .destroy_by method
//this method takes in an argument of what you want deleted

//however the destroy_by will delete all instances that have //the argument passed in, in this example all song1 keys with //the value "hello" will be deleted.

Album.destroy_by(song1: "hello")

//to delete all instances in a class use the .destroy_all //method

Album.destroy_all

//all instances in the Album class will be deleted.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>programming</category>
      <category>ruby</category>
      <category>database</category>
      <category>help</category>
    </item>
    <item>
      <title>Ruby: nested hash iterations</title>
      <dc:creator>Christian Cedeno</dc:creator>
      <pubDate>Sat, 15 Oct 2022 15:59:58 +0000</pubDate>
      <link>https://dev.to/cedsengine/ruby-nested-hash-iterations-4l3b</link>
      <guid>https://dev.to/cedsengine/ruby-nested-hash-iterations-4l3b</guid>
      <description>&lt;h2&gt;
  
  
  How to iterate over nested hashes in ruby?
&lt;/h2&gt;

&lt;p&gt;Before we can iterate through nested hashes, we must first know what a hash is. &lt;/p&gt;

&lt;p&gt;hash: a hash is a collection of keys and values enclosed in curly brackets, hashes are identical to javascript objects.&lt;/p&gt;

&lt;p&gt;nested hash ex:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; apple = {
 "Hardware Products" =&amp;gt; {
   :computers =&amp;gt; "Mac",
   :laptops =&amp;gt; ["Macbook Pro", "Macbook Air"],
   :tablets =&amp;gt; ["Ipad Air", "Ipad Pro"],
   :phones =&amp;gt; "Iphone"
   },
   "Software Products" =&amp;gt; {
    :entertainment =&amp;gt; ["Apple Music", "Apple Tv", "Apple Podcast"],
    :finance =&amp;gt; ["Apple Wallet", "Apple Card"],
    :other =&amp;gt; ["Apple Fitness", "Apple Maps"]
   }
   }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;nested hash of Apple's Hardware and Software products&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The code block above is an example of a nested hash. A &lt;u&gt;nested hash&lt;/u&gt; is normally a &lt;strong&gt;value pair&lt;/strong&gt; in a hash. &lt;/p&gt;

&lt;p&gt;Now that we are clear on what a hash is, how do we iterate over the nested hash? &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example deliverable:&lt;/strong&gt; &lt;em&gt;output the :finance value["Apple Wallet", "Apple Card"]to the terminal.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;step 1&lt;/u&gt;: &lt;br&gt;
    Iterate over the parent hash using each method, set two parameters to reference the key and value (&lt;strong&gt;product_type, inventory&lt;/strong&gt;).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;finance_products = apple.each do |product_type, inventory|
puts "product_type: #{product_type}"
puts "inventory: #{inventory}"
end

=&amp;gt; product_type =&amp;gt; "Hardware Products"

=&amp;gt; inventory: =&amp;gt; {
   computers =&amp;gt; "Mac",
   laptops =&amp;gt; ["Macbook Pro", "Macbook Air"],
   tablets =&amp;gt; ["Ipad Air", "Ipad Pro"],
   phones =&amp;gt; "Iphone"
   }

=&amp;gt; product_type =&amp;gt; "Software Products"

=&amp;gt; inventory: =&amp;gt; {
 :entertainment =&amp;gt; ["Apple Music", "Apple Tv", "Apple Podcast"],
 :finance =&amp;gt; ["Apple Wallet", "Apple Card"],
 :other =&amp;gt; ["Apple Fitness", "Apple Maps"]
}

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

&lt;/div&gt;



&lt;p&gt;&lt;u&gt;step 2&lt;/u&gt;: &lt;br&gt;
    Using a &lt;a href="https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/conditionals" rel="noopener noreferrer"&gt;conditional statement&lt;/a&gt;  &lt;em&gt;(more on conditionals here)&lt;/em&gt; we access the value in "Software Products". Then iterate over value(&lt;strong&gt;inventory&lt;/strong&gt;) and pass 2 parameters, these will reference the nested hash keys and values!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;finance_products = apple.each do |product_type, inventory|

if product_type == "Software Products"

inventory.each do |product, type|
puts "product: #{product}"
puts "type: #{type}"
    end
   end
  end

"terminal output"

product: entertainment
type: ["Apple Music", "Apple Tv", "Apple Podcast"]
product: finance
type: ["Apple Wallet", "Apple Card"]
product: other
type: ["Apple Fitness", "Apple Maps"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;u&gt;step 3&lt;/u&gt;: &lt;br&gt;
    Using a conditional statement to retrieve the :finance key from (&lt;strong&gt;product&lt;/strong&gt;), we then iterate over the values(&lt;strong&gt;type&lt;/strong&gt;) using each method and pass a parameter(&lt;strong&gt;finance&lt;/strong&gt;) and print (&lt;strong&gt;finance&lt;/strong&gt;) to meet the deliverable.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;finance_products = apple.each do |product_type, inventory|

if product_type == "Software Products"

inventory.each do |product, type|

if product == :finance

type.each do |finance|
puts "#{finance}"

    end
   end
  end
 end 
end

"terminal output"

Apple Wallet
Apple Card
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>ruby</category>
      <category>programming</category>
      <category>tutorial</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Taking the LEAP p1</title>
      <dc:creator>Christian Cedeno</dc:creator>
      <pubDate>Mon, 19 Sep 2022 00:50:11 +0000</pubDate>
      <link>https://dev.to/cedsengine/taking-the-leap-p1-4g97</link>
      <guid>https://dev.to/cedsengine/taking-the-leap-p1-4g97</guid>
      <description>&lt;h1&gt;
  
  
  Thinking about it
&lt;/h1&gt;

&lt;p&gt;These are three &lt;em&gt;phases&lt;/em&gt; I gone through before making the decision to take the &lt;strong&gt;LEAP!&lt;/strong&gt; and become a software engineer part 1.  &lt;/p&gt;

&lt;p&gt;We've all gone through it, At some point in life we had that discussion with ourselves. I want to change careers, I want something more challenging to do, I want a new field of work. For those individuals i'm happy to tell you, you aren't alone. I too was in this position, I planned on transitioning from Physical Therapy to Accounting until a patient of mine convinced me to give Software Engineering a try. I did some googling and realized how cool the tech field was. But I needed to do some self reflecting before going forth with this decision.I asked myself three questions:&lt;/p&gt;

&lt;p&gt;"Why do I want to join tech?"&lt;/p&gt;

&lt;p&gt;"Is this the best fit for me?"&lt;/p&gt;

&lt;p&gt;"How do I plan on achieving this?" &lt;/p&gt;

&lt;p&gt;asking myself these questions were crucial, NEVER rush a decision. Below are my reasoning and thought  process.   &lt;/p&gt;

&lt;h2&gt;
  
  
  Why I wanted to join tech?
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Technology is the backbone in today's society, all the advancement in technology has lead to a more connected, convenient and informative way of life. I've had the privilege of watching technology grow over the past decades and seeing the impact of softwares like educational platforms, financial technology apps, Social media. This was a big motivator for me to get into tech, the ability to create and impact many lives through software was inspiring to me and it is why I decided to learn software engineering.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Is this the best fit for me?
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;You may be asking "how do I know if this is the best fit for me?" The way I found out for myself was by going on youtube, learning about the industry from others currently in it. I used beginner friendly apps like mimo and challenged myself with web apps like &lt;a href="https://freecodecamp.org" rel="noopener noreferrer"&gt;https://freecodecamp.org&lt;/a&gt;. By applying myself I was able to know if tech was a good fit for me. I paid attention to my ability in problem solving and my approach on it. I observed how it made me feel when I was stuck on the same problem/errors for hours. I Come to realize how entertained I was by the challenge of creating working lines of code. I noticed how fast time flew by when I began coding, hours would go by and I would not sense any kind of fatigue. I knew it was right for me when being consistent with learning didn't feel like a chore. &lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  How do I plan on achieving this?
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;My approach to becoming a software engineer is to get better everyday, learn a minimum of one concept a day. When you understand the overall concept of a method, you will better understand how to implement your knowledge. I will also get comfortable with googling things I don't know! it'll serve me well.  Google, stackOverflow, w3Schools are great resources to use when you are coding these are your tools.
Repetition and consistency is how I plan to achieve my goals of becoming a full stack engineer. I'm currently attending 
Flatiron school's software engineer bootcamp!&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This was my thought process through my decision to take the leap on becoming a full stack engineer. &lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>codenewbie</category>
      <category>firstpost</category>
    </item>
  </channel>
</rss>
