<?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: Hadil Hijazi</title>
    <description>The latest articles on DEV Community by Hadil Hijazi (@hihijazi).</description>
    <link>https://dev.to/hihijazi</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%2F1216431%2Fd3511dd6-abf7-4aa8-a4ad-39700cb63d27.png</url>
      <title>DEV Community: Hadil Hijazi</title>
      <link>https://dev.to/hihijazi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hihijazi"/>
    <language>en</language>
    <item>
      <title>HTTP Methods (GET/POST) &amp; Retrieving From Data</title>
      <dc:creator>Hadil Hijazi</dc:creator>
      <pubDate>Mon, 12 Feb 2024 22:29:47 +0000</pubDate>
      <link>https://dev.to/hihijazi/http-methods-getpost-retrieving-from-data-8cm</link>
      <guid>https://dev.to/hihijazi/http-methods-getpost-retrieving-from-data-8cm</guid>
      <description>&lt;p&gt;In the web development world, understanding the fundamental HTTP methods - GET and POST - is essential. These methods serve as conduits for transmitting information between servers and clients. Let's delve into the disparities between these two methods and explore a basic example of retrieving form data to elucidate their functionalities further.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GET Request&lt;/strong&gt;&lt;br&gt;
GET is a ubiquitous HTTP method primarily utilized for fetching or retrieving data from a server. When employing GET, data can be appended to the URL directly, as seen in examples like &lt;a href="http://localhost5000/login" rel="noopener noreferrer"&gt;http://localhost5000/login&lt;/a&gt;. However, it's imperative to note that data sent via GET isn't encrypted, rendering it susceptible to interception, thus compromising security.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;POST Request&lt;/strong&gt;&lt;br&gt;
In contrast, the POST method offers a more secure means of data transmission. Typically employed for sending form data, POST ensures that sensitive information remains encrypted during transit. Unlike GET, data submitted via POST isn't appended to the URL and isn't stored on the server unless explicitly directed, such as saving it to a database.&lt;/p&gt;

&lt;p&gt;Basic Example: &lt;/p&gt;

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

&lt;p&gt;Imagine a scenario where a user inputs data into a dialog box on a webpage. Upon submission, this data is sent to the server via a POST request. Subsequently, the entered information is displayed on another webpage, illustrating the flow of data transmission.&lt;/p&gt;

&lt;p&gt;Let's consider the implementation of a login page named "login." Within the decorator, both GET and POST methods are specified, allowing for different types of requests. By default, accessing these pages initiates a GET request, prioritizing simplicity over security. However, incorporating methods=["POST", "GET"] facilitates flexibility in handling various types of requests.&lt;/p&gt;

&lt;p&gt;Next, we construct the form where users input their credentials. Once the form is built and rendered, users can interact with it on the webpage.&lt;/p&gt;

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

&lt;p&gt;Upon submission of the form, the webpage undergoes a transition, signaling the utilization of the POST method. Refreshing the page alters the response to a GET request, reflecting the change in request type.&lt;/p&gt;

&lt;p&gt;To discern between GET and POST requests within the login function, importing the request module becomes imperative. Conditional statements, such as if request.method, enable developers to ascertain the type of request received.&lt;/p&gt;

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

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

&lt;p&gt;In the case of a POST request, retrieving data from the form input box is paramount. Utilizing request.form['nm'], developers can extract the entered data, subsequently redirecting users to a personalized webpage where their name is prominently displayed.&lt;/p&gt;

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

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

&lt;p&gt;This example underscores the seamless retrieval of information from a form, highlighting the efficacy of HTTP methods in facilitating secure data transmission.&lt;/p&gt;

</description>
      <category>http</category>
      <category>getmethod</category>
      <category>postmethod</category>
      <category>flask</category>
    </item>
    <item>
      <title>Understanding Python Classes and Instances: Building the Blueprint for Objects</title>
      <dc:creator>Hadil Hijazi</dc:creator>
      <pubDate>Mon, 22 Jan 2024 15:05:43 +0000</pubDate>
      <link>https://dev.to/hihijazi/understanding-python-classes-and-instances-building-the-blueprint-for-objects-2f6m</link>
      <guid>https://dev.to/hihijazi/understanding-python-classes-and-instances-building-the-blueprint-for-objects-2f6m</guid>
      <description>&lt;p&gt;In the world of Python programming, classes and instances play a crucial role in creating organized and efficient code. Imagine developing a dog walking app, where managing information about individual dogs is essential. This is where classes come into play, serving as blueprints that define how to build objects with specific characteristics and behaviors.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Defining a Class:&lt;/strong&gt;&lt;br&gt;
A class in Python is like a template or blueprint, encapsulating both data and functionality. It acts as a guide for creating objects, with the ability to produce instances based on the class template. The class is declared using the class keyword, followed by the class name. Class names typically start with a capital letter, and if composed of multiple words, follow the UpperCamelCase convention.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Creating Instances of Classes:&lt;/strong&gt;&lt;br&gt;
Instances, also known as objects, are specific working copies of a class. They are created by calling the class's constructor function, often named &lt;strong&gt;init&lt;/strong&gt;(). This special method initializes a new instance with default or specified values. For example, in our dog walking app, we can create a Dog class with specific attributes and behaviors related to dogs.&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%2Foeanl3shtzmyzu0hxzr9.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%2Foeanl3shtzmyzu0hxzr9.png" alt="Image description" width="416" height="300"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, fido and snoopy are instances of the Dog class, representing individual dogs within our app. Each instance is a unique object in memory, even though they share the same class blueprint.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Different Instances are Different Objects:&lt;/strong&gt;&lt;br&gt;
Creating multiple instances of a class results in distinct objects, each with its own memory location. This uniqueness is essential, as it allows for the independent manipulation of different objects created from the same class. Python communicates this distinction by providing a unique identifier for each instance, such as &amp;lt;&lt;strong&gt;main&lt;/strong&gt;.Dog object at 0x1049a87f0&amp;gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt;&lt;br&gt;
In conclusion, understanding Python classes and instances is fundamental for building well-structured and scalable programs. Classes serve as blueprints, defining the characteristics and behaviors of objects, while instances represent specific occurrences of those objects. The ability to create multiple instances allows for versatility and efficient management of data within a program. As you delve into Python programming, mastering the concepts of classes and instances opens the door to creating robust and modular code, laying the foundation for successful software development.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Props vs. State</title>
      <dc:creator>Hadil Hijazi</dc:creator>
      <pubDate>Fri, 29 Dec 2023 20:18:43 +0000</pubDate>
      <link>https://dev.to/hihijazi/props-vs-state-fde</link>
      <guid>https://dev.to/hihijazi/props-vs-state-fde</guid>
      <description>&lt;p&gt;&lt;strong&gt;What is React.js?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;React can manage your data and properly render your application when your data changes. Below I will it explain it in the most simplest way possible. &lt;/p&gt;

&lt;p&gt;There are two main ways with React. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Props and State&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Props&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--b49xzjnG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://media3.giphy.com/media/l0HlEoBftRyKwIEes/giphy.gif%3Fcid%3Decf05e47zvwdcq9ew81x71m83quzs9a7wn570fdnt36uhp2p%26ep%3Dv1_gifs_search%26rid%3Dgiphy.gif%26ct%3Dg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--b49xzjnG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://media3.giphy.com/media/l0HlEoBftRyKwIEes/giphy.gif%3Fcid%3Decf05e47zvwdcq9ew81x71m83quzs9a7wn570fdnt36uhp2p%26ep%3Dv1_gifs_search%26rid%3Dgiphy.gif%26ct%3Dg" width="480" height="359"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Props are arguments to a function. &lt;/p&gt;

&lt;p&gt;When a component is created inside a react and you want to render it, you will pass the props that you want to give it.  &lt;/p&gt;

&lt;p&gt;For example: A counter application&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bMcJqc4q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://media4.giphy.com/media/iGRJmLpy8moXiWpvjX/200w.webp%3Fcid%3Decf05e47yga337pgz9hf7690lofrp37ka1xu1ady2rvgt7s0%26ep%3Dv1_gifs_search%26rid%3D200w.webp%26ct%3Dg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bMcJqc4q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://media4.giphy.com/media/iGRJmLpy8moXiWpvjX/200w.webp%3Fcid%3Decf05e47yga337pgz9hf7690lofrp37ka1xu1ady2rvgt7s0%26ep%3Dv1_gifs_search%26rid%3D200w.webp%26ct%3Dg" width="200" height="200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What you want to pass, is the initial count. Essentially what your count should start at. So you're going to pass your counter components' initial count inside the props. &lt;/p&gt;

&lt;p&gt;In the counter app, the initial count should be 0. So, we need to pass that through in the props. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--81Kamu39--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/td7i73qur15ofdczyuzf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--81Kamu39--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/td7i73qur15ofdczyuzf.png" alt="Image description" width="800" height="429"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Props is used for things you pass to functions. They are what you want to initialize your component to or what you want your component to render like. &lt;/p&gt;

&lt;p&gt;Another time Props can be used is for if you want to display something to the user that has a title and a subtitle. &lt;/p&gt;

&lt;p&gt;It also needs to be stored in the Props because what you want your component or function to take is going to be the Props. &lt;/p&gt;

&lt;p&gt;In our case, the component is stored in the title and the subtitle.  So we’re passing them through the Props. &lt;/p&gt;

&lt;p&gt;Then, the app knows if those Props change at some point. If something else in the application changes those Props it will rerender that component for us.  Because our Props are now different. &lt;/p&gt;

&lt;p&gt;Props if useful for displaying information inside a component without hard coding it.  Essentially, it’s available to a function. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;State&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;State is something inside a component.&lt;/p&gt;

&lt;p&gt;Props is something you pass into a component. &lt;/p&gt;

&lt;p&gt;State is handled inside that component and you can update it inside the component. &lt;/p&gt;

&lt;p&gt;Props are handled outside the component and must be updated outside the component. &lt;/p&gt;

&lt;p&gt;In the counter app, the current up to date count is handled inside the state.  &lt;/p&gt;

&lt;p&gt;So, while we pass the initial count in the props, we’re setting the state to the initial count and inside of our component that is handled in our counter.  We managed to update our counter to increase it or to decrease it depending on what the user does.  And we’re using state for that.  &lt;/p&gt;

&lt;p&gt;State is used when you make changes inside the application it will rerender that section of the app.  &lt;/p&gt;

&lt;p&gt;State is helpful for when you want to update or rerender your app based on something the user has done.  &lt;/p&gt;

&lt;p&gt;If you want to change something in the app, you need to store it in state so it properly rerenders when it changes. &lt;/p&gt;

&lt;p&gt;State is also good for inside a form on an application.  &lt;/p&gt;

&lt;p&gt;If there is an input element, checkbox/select box, that needs to be updated by the user state will be used to store what they are updating the value to.  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RSnB5pzF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fltpkjr8rejuce4ks4hu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RSnB5pzF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fltpkjr8rejuce4ks4hu.png" alt="Image description" width="698" height="508"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>innerHTML property in JavaScript</title>
      <dc:creator>Hadil Hijazi</dc:creator>
      <pubDate>Mon, 04 Dec 2023 15:21:42 +0000</pubDate>
      <link>https://dev.to/hihijazi/innerhtml-property-in-javascript-15i8</link>
      <guid>https://dev.to/hihijazi/innerhtml-property-in-javascript-15i8</guid>
      <description>&lt;p&gt;InnerHTML property in Javascript&lt;/p&gt;

&lt;p&gt;For the past few weeks, I have been learning about JavaScript in the context of Web Development.  JavaScript is a very important programming language for the Web.  HTML and CSS can be updated via JavaScript.  It is also the most commonly used programming language world wide. &lt;/p&gt;

&lt;p&gt;InnerHTML property is a method in JavaScript that users use to clear the contents div in HTML.  This method is useful in Web development because it solves a minor issue.  For example, I was working on an assignment, where I encountered an error after writing my code.  The assignment I was working on required me to display details of a certain item when it gets clicked on.  Each time I clicked on a specific item, the page would refresh and display all the details of every item in the list.  &lt;/p&gt;

&lt;p&gt;I knew that I was missing something and here is where I figured out  clearing the content of div in HTML.  I then figured out that I needed to add .innerHTML = "". in my function.  This was a great lesson I learned about clearing the contents of a specific div element. &lt;/p&gt;

&lt;p&gt;If for example we are talking about a Robots web page.  And we have a list of Robots, within each Robot name we have a picture of and some details about it.&lt;br&gt;&lt;br&gt;
This is an example of the index.html file &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZXR1U4Wb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aiyh5y1s0meebj8vcryz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZXR1U4Wb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aiyh5y1s0meebj8vcryz.png" alt="Image description" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can insert a . innerHTML = "" in the displayRobotDetails function.&lt;br&gt;
The function would look something like this : &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NWKvRjiw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rrrm8bf9in537eis2udv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NWKvRjiw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rrrm8bf9in537eis2udv.png" alt="Image description" width="744" height="220"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this scenario, we are using the .innerHTML = "" in order to clear the content dynamics.  We have to do this so that we get the details/images or other data we want separately.  In this case, when we click on a robot name from the web page, we would only be able to view the details of that specific robot. This method is one of two methods available to clear the contents of the div.  &lt;/p&gt;

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