<?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: Kwaku Duah</title>
    <description>The latest articles on DEV Community by Kwaku Duah (@thekalderon).</description>
    <link>https://dev.to/thekalderon</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%2F1071085%2F0ae4386d-d42a-4a5d-810a-3df546800303.jpeg</url>
      <title>DEV Community: Kwaku Duah</title>
      <link>https://dev.to/thekalderon</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/thekalderon"/>
    <language>en</language>
    <item>
      <title>Building an Artificial Neural Network to make Predictions with Machine Learning.</title>
      <dc:creator>Kwaku Duah</dc:creator>
      <pubDate>Thu, 17 Apr 2025 15:38:05 +0000</pubDate>
      <link>https://dev.to/thekalderon/building-an-artificial-neural-network-to-make-predictions-with-machine-learning-5bpf</link>
      <guid>https://dev.to/thekalderon/building-an-artificial-neural-network-to-make-predictions-with-machine-learning-5bpf</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Artificial Neural Networks (ANNs) are computational models inspired by the human brain's biological neural networks. They are designed to simulate the way humans learn and process information. By recognizing patterns, approximating functions, and optimizing tasks, ANNs serve as the backbone of many artificial intelligence (AI) applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  Biological Inspiration
&lt;/h2&gt;

&lt;p&gt;In the human brain, neurons are the fundamental units that transmit signals. Each neuron receives input, processes it, and passes the result to other neurons. ANNs replicate this behavior by using nodes (artificial neurons) organized in layers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Input Layer&lt;/strong&gt;: Takes in raw data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hidden Layers&lt;/strong&gt;: Perform intermediate computations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Output Layer&lt;/strong&gt;: Produces the final result.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each connection between neurons has an associated &lt;strong&gt;weight&lt;/strong&gt; which is adjusted during training.&lt;/p&gt;

&lt;h2&gt;
  
  
  Structure of an ANN
&lt;/h2&gt;

&lt;p&gt;An ANN typically consists of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Neurons&lt;/strong&gt;: Basic processing units.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Layers&lt;/strong&gt;: Organized into input, hidden, and output.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Weights and Biases&lt;/strong&gt;: Parameters adjusted during training.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Activation Function&lt;/strong&gt;: Determines the output of a neuron.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Common activation functions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Sigmoid&lt;/strong&gt;: ( \sigma(x) = \frac{1}{1 + e^{-x}} )&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ReLU (Rectified Linear Unit)&lt;/strong&gt;: ( f(x) = \max(0, x) )&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tanh&lt;/strong&gt;: ( \tanh(x) = \frac{e^x - e^{-x}}{e^x + e^{-x}} )&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Training an ANN
&lt;/h2&gt;

&lt;p&gt;Training involves adjusting the weights and biases to minimize error using a method called &lt;strong&gt;Backpropagation&lt;/strong&gt;. The key steps are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Forward Propagation&lt;/strong&gt;: Calculate outputs based on current weights.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Loss Calculation&lt;/strong&gt;: Compute the error (e.g., Mean Squared Error).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Backpropagation&lt;/strong&gt;: Adjust weights using gradients.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Optimization&lt;/strong&gt;: Apply an algorithm like &lt;strong&gt;Stochastic Gradient Descent (SGD)&lt;/strong&gt; or &lt;strong&gt;Adam&lt;/strong&gt; to update weights.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Python Implementation of a Simple ANN (From Scratch)
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;numpy&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;sigmoid&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;sigmoid_derivative&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Input data (4 samples, 2 features)
&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;([[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
              &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
              &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
              &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]])&lt;/span&gt;

&lt;span class="c1"&gt;# Output data (4 samples, 1 output)
&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;([[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
              &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
              &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
              &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]])&lt;/span&gt;  &lt;span class="c1"&gt;# XOR problem
&lt;/span&gt;
&lt;span class="c1"&gt;# Seed random numbers for reproducibility
&lt;/span&gt;&lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;seed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Initialize weights randomly with mean 0
&lt;/span&gt;&lt;span class="n"&gt;input_layer_neurons&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
&lt;span class="n"&gt;hidden_layer_neurons&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;
&lt;span class="n"&gt;output_neurons&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;

&lt;span class="n"&gt;weights_input_hidden&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;random&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;input_layer_neurons&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;hidden_layer_neurons&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="n"&gt;weights_hidden_output&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;random&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;hidden_layer_neurons&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;output_neurons&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;

&lt;span class="c1"&gt;# Training process
&lt;/span&gt;&lt;span class="n"&gt;epochs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10000&lt;/span&gt;
&lt;span class="n"&gt;learning_rate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.1&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;epoch&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;epochs&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="c1"&gt;# Forward propagation
&lt;/span&gt;    &lt;span class="n"&gt;hidden_input&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;weights_input_hidden&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;hidden_output&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;sigmoid&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hidden_input&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;final_input&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hidden_output&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;weights_hidden_output&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;predicted_output&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;sigmoid&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;final_input&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Backpropagation
&lt;/span&gt;    &lt;span class="n"&gt;error&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;predicted_output&lt;/span&gt;
    &lt;span class="n"&gt;d_predicted_output&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;error&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nf"&gt;sigmoid_derivative&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;predicted_output&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;error_hidden_layer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;d_predicted_output&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;weights_hidden_output&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;d_hidden_layer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;error_hidden_layer&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nf"&gt;sigmoid_derivative&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hidden_output&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Updating Weights
&lt;/span&gt;    &lt;span class="n"&gt;weights_hidden_output&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;hidden_output&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;d_predicted_output&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;learning_rate&lt;/span&gt;
    &lt;span class="n"&gt;weights_input_hidden&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;d_hidden_layer&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;learning_rate&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;epoch&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;loss&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;mean&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;square&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Epoch &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;epoch&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; Loss: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;loss&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Final output
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;Final Predicted Output:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;predicted_output&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Applications of ANN
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Computer Vision&lt;/strong&gt;: Image classification, object detection&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Natural Language Processing (NLP)&lt;/strong&gt;: Language translation, sentiment analysis&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Healthcare&lt;/strong&gt;: Disease prediction, medical image analysis&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Finance&lt;/strong&gt;: Fraud detection, algorithmic trading&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Robotics&lt;/strong&gt;: Autonomous navigation, control systems&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;Artificial Neural Networks are powerful tools capable of learning from data and making complex decisions. They consist of layers of interconnected neurons that adapt through training. As data-driven models, their effectiveness continues to grow with more data, better algorithms, and advanced hardware.&lt;/p&gt;

</description>
      <category>python</category>
      <category>machinelearning</category>
      <category>numpy</category>
      <category>jupyternotebook</category>
    </item>
    <item>
      <title>JDK Setup On Linux, Windows, Mac</title>
      <dc:creator>Kwaku Duah</dc:creator>
      <pubDate>Mon, 16 Sep 2024 09:56:02 +0000</pubDate>
      <link>https://dev.to/thekalderon/jdk-setup-on-linux-windows-mac-5d5e</link>
      <guid>https://dev.to/thekalderon/jdk-setup-on-linux-windows-mac-5d5e</guid>
      <description>&lt;h1&gt;
  
  
  🚀 Setting Up JDK on Windows, macOS, and Linux – Complete Guide
&lt;/h1&gt;

&lt;p&gt;If you're starting out with &lt;strong&gt;Java programming&lt;/strong&gt;, your first essential step is to install the &lt;strong&gt;Java Development Kit (JDK)&lt;/strong&gt;. The JDK contains all the tools required to compile, debug, and run Java programs.&lt;/p&gt;

&lt;p&gt;In this guide, I’ll walk you through the JDK setup process on &lt;strong&gt;Windows&lt;/strong&gt;, &lt;strong&gt;macOS&lt;/strong&gt;, and &lt;strong&gt;Linux&lt;/strong&gt;, and also show you how to run your first Java program!&lt;/p&gt;




&lt;h2&gt;
  
  
  🪟 1. Setting Up JDK on Windows
&lt;/h2&gt;

&lt;h3&gt;
  
  
  ✅ Step 1: Download the JDK
&lt;/h3&gt;

&lt;p&gt;Go to either the &lt;a href="https://www.oracle.com/java/technologies/javase-downloads.html" rel="noopener noreferrer"&gt;Oracle JDK&lt;/a&gt; or &lt;a href="https://jdk.java.net/" rel="noopener noreferrer"&gt;OpenJDK&lt;/a&gt; site.&lt;br&gt;&lt;br&gt;
Choose the correct installer (e.g., &lt;code&gt;jdk-21_windows-x64_bin.exe&lt;/code&gt;) for your system.&lt;/p&gt;
&lt;h3&gt;
  
  
  ✅ Step 2: Install the JDK
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Run the installer and follow the prompts.
&lt;/li&gt;
&lt;li&gt;Accept the license agreement and select the default installation path:
&lt;code&gt;C:\Program Files\Java\jdk-&amp;lt;version&amp;gt;&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  ✅ Step 3: Set Environment Variables
&lt;/h3&gt;

&lt;p&gt;To run Java from the command line, add the JDK &lt;code&gt;bin&lt;/code&gt; directory to your &lt;code&gt;PATH&lt;/code&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open System Properties → Advanced → Environment Variables
&lt;/li&gt;
&lt;li&gt;Under &lt;strong&gt;System Variables&lt;/strong&gt;, edit the &lt;code&gt;Path&lt;/code&gt; variable.
&lt;/li&gt;
&lt;li&gt;Add:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   C:\Program Files\Java\jdk-&amp;lt;version&amp;gt;\bin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  ✅ Step 4: Verify Installation
&lt;/h3&gt;

&lt;p&gt;Open Command Prompt and run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;java &lt;span class="nt"&gt;-version&lt;/span&gt;
javac &lt;span class="nt"&gt;-version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🍎 2. Setting Up JDK on macOS
&lt;/h2&gt;

&lt;h3&gt;
  
  
  ✅ Step 1: Download the JDK
&lt;/h3&gt;

&lt;p&gt;Head over to &lt;a href="https://www.oracle.com/java/technologies/javase-jdk21-downloads.html" rel="noopener noreferrer"&gt;Oracle&lt;/a&gt; or &lt;a href="https://adoptium.net/" rel="noopener noreferrer"&gt;Adoptium&lt;/a&gt; and download the &lt;code&gt;.dmg&lt;/code&gt; file for macOS.&lt;/p&gt;

&lt;h3&gt;
  
  
  ✅ Step 2: Install the JDK
&lt;/h3&gt;

&lt;p&gt;Double-click the &lt;code&gt;.dmg&lt;/code&gt; and follow the wizard.&lt;br&gt;&lt;br&gt;
JDK will be installed in &lt;code&gt;/Library/Java/JavaVirtualMachines/&lt;/code&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  ✅ Step 3: Set Environment Variables
&lt;/h3&gt;

&lt;p&gt;Edit your shell config file based on your terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nano ~/.zshrc     &lt;span class="c"&gt;# For zsh users&lt;/span&gt;
nano ~/.bash_profile   &lt;span class="c"&gt;# For bash users&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add these lines:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;JAVA_HOME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;/usr/libexec/java_home&lt;span class="si"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$JAVA_HOME&lt;/span&gt;/bin:&lt;span class="nv"&gt;$PATH&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Reload config:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;source&lt;/span&gt; ~/.zshrc
&lt;span class="c"&gt;# or&lt;/span&gt;
&lt;span class="nb"&gt;source&lt;/span&gt; ~/.bash_profile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  ✅ Step 4: Verify Installation
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;java &lt;span class="nt"&gt;-version&lt;/span&gt;
javac &lt;span class="nt"&gt;-version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🐧 3. Setting Up JDK on Linux
&lt;/h2&gt;

&lt;h3&gt;
  
  
  ✅ Step 1: Install via Terminal
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Ubuntu/Debian:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;openjdk-21-jdk
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Fedora/CentOS/RHEL:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;dnf &lt;span class="nb"&gt;install &lt;/span&gt;java-21-openjdk-devel
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Arch Linux:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;pacman &lt;span class="nt"&gt;-S&lt;/span&gt; jdk21-openjdk
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  ✅ Step 2: Configure JAVA_HOME
&lt;/h3&gt;

&lt;p&gt;Edit your shell config file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nano ~/.bashrc    &lt;span class="c"&gt;# or ~/.zshrc&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;JAVA_HOME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;dirname&lt;/span&gt; &lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;dirname&lt;/span&gt; &lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;readlink&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; &lt;span class="si"&gt;$(&lt;/span&gt;which javac&lt;span class="si"&gt;))))&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$JAVA_HOME&lt;/span&gt;/bin:&lt;span class="nv"&gt;$PATH&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then reload:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;source&lt;/span&gt; ~/.bashrc
&lt;span class="c"&gt;# or&lt;/span&gt;
&lt;span class="nb"&gt;source&lt;/span&gt; ~/.zshrc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  ✅ Step 3: Verify Installation
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;java &lt;span class="nt"&gt;-version&lt;/span&gt;
javac &lt;span class="nt"&gt;-version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  💻 Writing and Running Your First Java Program
&lt;/h2&gt;

&lt;h3&gt;
  
  
  ✍️ Step 1: Create a Java File
&lt;/h3&gt;

&lt;p&gt;Save this as &lt;code&gt;HelloWorld.java&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;HelloWorld&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Hello, World!"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  ⚙️ Step 2: Compile the Program
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;javac HelloWorld.java
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This creates a &lt;code&gt;HelloWorld.class&lt;/code&gt; file.&lt;/p&gt;

&lt;h3&gt;
  
  
  ▶️ Step 3: Run the Program
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;java HelloWorld
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Hello, World!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  📚 Bonus: Intro to Data Structures &amp;amp; Algorithms (DSA) in Java
&lt;/h2&gt;

&lt;p&gt;Now that your JDK is ready, here’s a glimpse of what you can build next:&lt;/p&gt;

&lt;h3&gt;
  
  
  🔢 Basic Data Structures:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Arrays&lt;/strong&gt;: Linear collection of items in memory.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Linked Lists&lt;/strong&gt;: Nodes with data + pointer to the next.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stacks&lt;/strong&gt;: LIFO structure.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Queues&lt;/strong&gt;: FIFO structure.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hash Tables&lt;/strong&gt;: Key-value mappings.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Trees&lt;/strong&gt;: Hierarchical structure (Binary Tree, BST).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Graphs&lt;/strong&gt;: Nodes + edges (great for pathfinding, social networks, etc.).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  ⚙️ Basic Algorithms:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Sorting&lt;/strong&gt;: Bubble, Merge, Quick.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Searching&lt;/strong&gt;: Linear, Binary.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Traversal&lt;/strong&gt;: DFS, BFS (especially useful in trees and graphs).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Mastering DSA is essential for technical interviews and solving real-world coding challenges.&lt;/p&gt;




&lt;h2&gt;
  
  
  🎉 Conclusion
&lt;/h2&gt;

&lt;p&gt;Setting up the JDK is your gateway into the powerful world of Java. Whether you're building full-stack web apps, preparing for coding interviews, or diving into open-source projects—this setup will serve as your foundation.&lt;/p&gt;

&lt;p&gt;If you found this guide helpful, consider following me on &lt;a href="https://dev.to/thekalderon"&gt;Dev.to&lt;/a&gt; for more tutorials on Python, Java, and full-stack development.&lt;/p&gt;

&lt;p&gt;Happy coding! 💻⚡&lt;/p&gt;

</description>
      <category>java</category>
      <category>jdk</category>
      <category>javaprogramming</category>
      <category>webdev</category>
    </item>
    <item>
      <title>INSTALL SLACK ON LINUX MINT 21.1</title>
      <dc:creator>Kwaku Duah</dc:creator>
      <pubDate>Tue, 30 May 2023 22:58:00 +0000</pubDate>
      <link>https://dev.to/thekalderon/install-slack-on-linux-mint-211-59di</link>
      <guid>https://dev.to/thekalderon/install-slack-on-linux-mint-211-59di</guid>
      <description>&lt;p&gt;&lt;strong&gt;Slack remains an effective messaging platform that connects businesses and communities together in a peculiar space.&lt;/strong&gt; Chatrooms on Slack are called &lt;strong&gt;channels&lt;/strong&gt;, and they connect developers, professionals, and community members.&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;Pros Of Using Slack&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The following are advantages of using Slack, in no particular order:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Slack can be used by individuals to host files and personal resources.
&lt;/li&gt;
&lt;li&gt;Slack is flexible and available for all businesses worldwide.
&lt;/li&gt;
&lt;li&gt;Slack is designed for businesses and allows resources to be updated at once by members in a community.
&lt;/li&gt;
&lt;li&gt;Slack allows users to search through over 10,000 messages.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;TABLE OF CONTENTS&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Download Slack For Linux
&lt;/li&gt;
&lt;li&gt;Install Dependencies
&lt;/li&gt;
&lt;li&gt;Install Slack
&lt;/li&gt;
&lt;li&gt;Conclusion
&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;Download Slack For Linux&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Update your Linux system to fetch the latest security patches from the repositories with the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get update  
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get upgrade
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Visit the official website of &lt;a href="https://www.slack.com/downloads/linux" rel="noopener noreferrer"&gt;Slack&lt;/a&gt; and download the &lt;code&gt;RPM version&lt;/code&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The &lt;code&gt;RPM&lt;/code&gt; version cannot be installed on Debian-based operating systems like Ubuntu or Linux Mint.&lt;br&gt;&lt;br&gt;
In this tutorial, I will use a workaround to convert the &lt;code&gt;RPM&lt;/code&gt; version to a &lt;code&gt;DEB&lt;/code&gt; version, which is installable on Debian-based systems.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F49ssg9efhqnc7nse915r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F49ssg9efhqnc7nse915r.png" alt="Slack Download" width="723" height="556"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;Installing Dependencies&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Conversion of an &lt;code&gt;RPM&lt;/code&gt; package to a &lt;code&gt;DEB&lt;/code&gt; package requires a Linux utility called &lt;strong&gt;Alien&lt;/strong&gt;. Alien is a conversion program that converts different Linux software packages to &lt;code&gt;.deb&lt;/code&gt; files for installation.&lt;/p&gt;

&lt;p&gt;Install Alien using the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install &lt;/span&gt;alien
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.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%2Fvkdlapukioe6vkre2ax5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fvkdlapukioe6vkre2ax5.png" alt="conversion" width="800" height="220"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is the downloaded &lt;code&gt;RPM package&lt;/code&gt; located at:&lt;br&gt;&lt;br&gt;
&lt;strong&gt;&lt;code&gt;home/.../Downloads/Programs&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F7kpzied76r91oxaihdcm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F7kpzied76r91oxaihdcm.png" alt="File" width="800" height="411"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Convert the RPM file to a DEB file using Alien:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;alien slack-4.32.122-0.1.el8.x86_64.rpm
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Replace the Slack package filename with the version you downloaded.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F0hb2asrqglfmzd1sbjof.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F0hb2asrqglfmzd1sbjof.png" alt="Alien conversion" width="800" height="237"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This command will convert the &lt;code&gt;.rpm&lt;/code&gt; file to a &lt;code&gt;.deb&lt;/code&gt; file, which can now be installed on all Debian-based operating systems.&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;Install Slack&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Install the newly created &lt;code&gt;.deb&lt;/code&gt; package on Linux Mint using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install&lt;/span&gt; ./slack_4.32.122-1.1_amd64.deb
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.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%2Fet4oeclmdnpvjnkez025.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fet4oeclmdnpvjnkez025.png" alt="six" width="800" height="283"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To confirm the installation and check the installed Slack version, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;slack &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.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%2Fxx39dx5xrutcz0pgnx5i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fxx39dx5xrutcz0pgnx5i.png" alt="seven" width="800" height="31"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;And ta-da! 🎉&lt;br&gt;&lt;br&gt;
This is a working &lt;strong&gt;Slack Desktop&lt;/strong&gt; on Linux Mint.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fj236vyncexk8gr4xtc3w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fj236vyncexk8gr4xtc3w.png" alt="Working" width="800" height="517"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Full Stack Todo WebApp With React and Python-Django.</title>
      <dc:creator>Kwaku Duah</dc:creator>
      <pubDate>Wed, 24 May 2023 00:33:27 +0000</pubDate>
      <link>https://dev.to/thekalderon/full-stack-todo-webapp-with-react-and-python-django-4472</link>
      <guid>https://dev.to/thekalderon/full-stack-todo-webapp-with-react-and-python-django-4472</guid>
      <description>&lt;p&gt;This is a detailed tutorial on how to build a full stack To-Do application using React Javascript Framework and Django Web Framework.&lt;/p&gt;

&lt;p&gt;React is a framework that is used for building Single Page Applications (SPAs). React was introduced by Facebook (now Meta) and has a wonderful community of developers and a slick &lt;a href="https://react.dev/" rel="noopener noreferrer"&gt;documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Django, on the other hand, is a simple web framework that aims to simplify web development. Django has a lot of ready-made libraries and vibrant &lt;a href="https://docs.djangoproject.com/en/4.2/" rel="noopener noreferrer"&gt;documentation&lt;/a&gt; that supports developer needs.&lt;/p&gt;

&lt;p&gt;In this application, the React framework serves as the client-side that handles the UI (User Interface). It also gets and sends data via requests to the Django backend with an API built atop the Django REST Framework (DRF).&lt;/p&gt;

&lt;p&gt;This web application allows users to create tasks and mark the tasks as &lt;strong&gt;complete&lt;/strong&gt; or &lt;strong&gt;incomplete&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  PREREQUISITES
&lt;/h2&gt;

&lt;p&gt;In this tutorial, you must have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set up a local programming environment for &lt;a href="https://www.digitalocean.com/community/tutorials/how-to-install-python-3-and-set-up-a-local-programming-environment-on-ubuntu-20-04" rel="noopener noreferrer"&gt;Python 3&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Set up &lt;a href="https://www.digitalocean.com/community/tutorial_series/how-to-install-node-js-and-create-a-local-development-environment" rel="noopener noreferrer"&gt;Node.js&lt;/a&gt; on your local development environment&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  SETTING UP DJANGO BACKEND
&lt;/h2&gt;

&lt;p&gt;Create a new project directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;react-django-todo
&lt;span class="nb"&gt;cd &lt;/span&gt;react-django-todo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install and activate a virtual environment using Pipenv:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;pipenv
pipenv shell
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install Django:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pipenv &lt;span class="nb"&gt;install &lt;/span&gt;django
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Start a new Django project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;django-admin startproject backend
&lt;span class="nb"&gt;cd &lt;/span&gt;backend
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a Django app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python3 manage.py startapp todo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Perform initial migrations:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python3 manage.py migrate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run the server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python3 manage.py runserver
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Visit &lt;code&gt;http://localhost:8000&lt;/code&gt; in your browser to confirm the setup.&lt;/p&gt;

&lt;h2&gt;
  
  
  REGISTERING THE &lt;code&gt;todo&lt;/code&gt; APPLICATION IN DJANGO
&lt;/h2&gt;

&lt;p&gt;Add &lt;code&gt;'todo'&lt;/code&gt; to &lt;code&gt;INSTALLED_APPS&lt;/code&gt; in &lt;code&gt;backend/settings.py&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  CREATING A &lt;code&gt;Todo&lt;/code&gt; MODEL
&lt;/h2&gt;

&lt;p&gt;In &lt;code&gt;todo/models.py&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;django.db&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Todo&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Model&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;title&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;CharField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max_length&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;description&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;TextField&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;completed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;BooleanField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;default&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__str__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Migrate the model:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python3 manage.py makemigrations todo
python3 manage.py migrate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  REGISTERING THE MODEL IN ADMIN
&lt;/h2&gt;

&lt;p&gt;In &lt;code&gt;todo/admin.py&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;django.contrib&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;admin&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;.models&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Todo&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;TodoAdmin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;admin&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ModelAdmin&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;list_display&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;title&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;description&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;completed&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;admin&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;site&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;register&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Todo&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;TodoAdmin&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a superuser:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python3 manage.py createsuperuser
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Login to the admin at &lt;code&gt;http://localhost:8000/admin&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  SETTING UP APIs
&lt;/h2&gt;

&lt;p&gt;Install DRF and CORS headers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pipenv &lt;span class="nb"&gt;install &lt;/span&gt;djangorestframework django-cors-headers
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Update &lt;code&gt;INSTALLED_APPS&lt;/code&gt; in &lt;code&gt;settings.py&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;INSTALLED_APPS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;...,&lt;/span&gt;
    &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;rest_framework&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;corsheaders&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;todo&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add the CORS settings:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;CORS_ORIGIN_WHITELIST&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;http://localhost:3000&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  CREATING SERIALIZERS
&lt;/h2&gt;

&lt;p&gt;In &lt;code&gt;todo/serializers.py&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;rest_framework&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;serializers&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;.models&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Todo&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;TodoSerializer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;serializers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ModelSerializer&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Meta&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Todo&lt;/span&gt;
        &lt;span class="n"&gt;fields&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;id&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;title&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;description&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;completed&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  CREATING VIEWS
&lt;/h2&gt;

&lt;p&gt;In &lt;code&gt;todo/views.py&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;rest_framework&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;viewsets&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;.serializers&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;TodoSerializer&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;.models&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Todo&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;TodoView&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;viewsets&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ModelViewSet&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;serializer_class&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;TodoSerializer&lt;/span&gt;
    &lt;span class="n"&gt;queryset&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Todo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;objects&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  ADDING ROUTES
&lt;/h2&gt;

&lt;p&gt;In &lt;code&gt;backend/urls.py&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;django.contrib&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;admin&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;django.urls&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;include&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;rest_framework&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;routers&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;todo&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;views&lt;/span&gt;

&lt;span class="n"&gt;router&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;routers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DefaultRouter&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;router&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;register&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;r&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;todos&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;views&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;TodoView&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;todo&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;urlpatterns&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="nf"&gt;path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;admin/&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;admin&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;site&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;urls&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="nf"&gt;path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;api/&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;include&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;router&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;urls&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;h2&gt;
  
  
  SETTING UP THE FRONTEND
&lt;/h2&gt;

&lt;p&gt;Create the frontend:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ..
npx create-react-app frontend
&lt;span class="nb"&gt;cd &lt;/span&gt;frontend
npm start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install Bootstrap and Reactstrap:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;bootstrap reactstrap &lt;span class="nt"&gt;--legacy-peer-deps&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In &lt;code&gt;frontend/index.js&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&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;ReactDOM&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-dom&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;bootstrap/dist/css/bootstrap.css&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./index.css&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;App&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;./App&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;reportWebVitals&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;./reportWebVitals&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;ReactDOM&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;StrictMode&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;App&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/React.StrictMode&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;,
&lt;/span&gt;  &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;root&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;reportWebVitals&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In &lt;code&gt;frontend/App.js&lt;/code&gt;, you can now build your UI logic and interact with the API endpoints at &lt;code&gt;http://localhost:8000/api/todos/&lt;/code&gt;.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>django</category>
      <category>react</category>
      <category>api</category>
    </item>
    <item>
      <title>USE SPARE ANDROID PHONE AS WEBCAM FOR YOUR PC.</title>
      <dc:creator>Kwaku Duah</dc:creator>
      <pubDate>Mon, 15 May 2023 22:14:16 +0000</pubDate>
      <link>https://dev.to/thekalderon/use-spare-android-phone-as-webcam-for-your-pc-58o5</link>
      <guid>https://dev.to/thekalderon/use-spare-android-phone-as-webcam-for-your-pc-58o5</guid>
      <description>&lt;h1&gt;
  
  
  🔧 Turn Your Spare Android Phone into a Webcam for Linux!
&lt;/h1&gt;

&lt;p&gt;Ever had that awkward moment when you're all set for a video interview on your PC—only to find out your webcam quality is &lt;em&gt;atrocious&lt;/em&gt;?&lt;/p&gt;

&lt;p&gt;Breathe easy. You can turn that spare Android phone lying around into a &lt;strong&gt;high-quality webcam&lt;/strong&gt; for your Linux PC!&lt;/p&gt;

&lt;p&gt;Chances are, that old phone has a camera that's leagues better than your laptop's built-in one. Since webcams are pricey, this budget-friendly guide has you covered.&lt;/p&gt;




&lt;h3&gt;
  
  
  ✅ What You Need:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;An Android Phone
&lt;/li&gt;
&lt;li&gt;USB Cable
&lt;/li&gt;
&lt;li&gt;A Linux PC
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is a beginner-friendly tutorial. Just follow along step-by-step, and you’ll be ready to roll.&lt;/p&gt;




&lt;h2&gt;
  
  
  📚 Table of Contents:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
Prepare the Android Phone
&lt;/li&gt;
&lt;li&gt;
Install Dependencies on the PC
&lt;/li&gt;
&lt;li&gt;
Configure the Phone with the PC
&lt;/li&gt;
&lt;li&gt;
Launch the Phone’s Camera as Webcam
&lt;/li&gt;
&lt;li&gt;
Conclusion
&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  🛠️ Prepare the Android Phone
&lt;/h2&gt;

&lt;p&gt;Android runs on the Linux kernel. A few tweaks and we’re good to go.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to &lt;code&gt;Settings &amp;gt; About Phone&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Tap &lt;strong&gt;Build Number&lt;/strong&gt; 7 times to activate Developer Mode
&lt;/li&gt;
&lt;li&gt;Go back, open &lt;strong&gt;Developer Options&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Toggle on &lt;strong&gt;USB Debugging&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Connect your phone via USB to your Linux PC&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  📦 Install Dependencies on the PC
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Open a terminal and run:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;android-tools-adb &lt;span class="nt"&gt;-y&lt;/span&gt;
adb devices
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your Android phone will ask to allow USB debugging. Accept it.&lt;/p&gt;

&lt;p&gt;🔹 &lt;strong&gt;ADB&lt;/strong&gt; stands for Android Debug Bridge.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Install &lt;a href="https://github.com/Genymobile/scrcpy" rel="noopener noreferrer"&gt;&lt;strong&gt;scrcpy&lt;/strong&gt;&lt;/a&gt; (Screen Copy tool):
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;scrcpy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then launch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;scrcpy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This mirrors your phone screen to the PC.&lt;/p&gt;




&lt;h2&gt;
  
  
  ⚙️ Configure the Camera with PC
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Install &lt;code&gt;ffmpeg&lt;/code&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;ffmpeg &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Clone and install &lt;strong&gt;v4l2loopback&lt;/strong&gt; to create a virtual camera:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/umlaeute/v4l2loopback
&lt;span class="nb"&gt;cd &lt;/span&gt;v4l2loopback
make &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;sudo &lt;/span&gt;make &lt;span class="nb"&gt;install
sudo &lt;/span&gt;depmod &lt;span class="nt"&gt;-a&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;modprobe v4l2loopback
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  📲 Setting Up the Android Camera
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Install &lt;strong&gt;&lt;a href="https://play.google.com/store/apps/details?id=com.pas.webcam&amp;amp;hl=en_IN&amp;amp;gl=US" rel="noopener noreferrer"&gt;IP Webcam&lt;/a&gt;&lt;/strong&gt; from the Play Store.  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: The free version has ads. Consider going premium for a smoother experience.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open the app and scroll down to tap &lt;strong&gt;Start Server&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You'll see an IPv4 address at the bottom (e.g., &lt;code&gt;http://192.168.x.x:8080&lt;/code&gt;)&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  🔄 Port Forwarding via ADB
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;List devices:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;adb devices &lt;span class="nt"&gt;-l&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;List of devices attached
affhh41a device usb: product:phone brand device transport_id:2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Export the device ID:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;ANDROID_SERIAL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;affhh41a
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Forward the port:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;adb forward tcp:8080 tcp:8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now visit:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;http://localhost:8080&lt;/code&gt; – full IP Webcam interface
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;http://localhost:8080/video&lt;/code&gt; – direct video stream (use &lt;strong&gt;Firefox&lt;/strong&gt; only)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Ft9q04x8wywmk4syu91n7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Ft9q04x8wywmk4syu91n7.png" alt="IP Webcam Interface" width="800" height="387"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🎥 Create a Virtual Webcam
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Run this to create the virtual webcam:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;modprobe v4l2loopback
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;List available devices:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;v4l2-ctl &lt;span class="nt"&gt;--list-devices&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your new virtual webcam is likely &lt;code&gt;/dev/video2&lt;/code&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  🚀 Redirect the Video Stream
&lt;/h2&gt;

&lt;p&gt;Use &lt;code&gt;ffmpeg&lt;/code&gt; to pipe the stream to your virtual webcam:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;ffmpeg &lt;span class="nt"&gt;-i&lt;/span&gt; http://localhost:8080/video &lt;span class="nt"&gt;-vf&lt;/span&gt; &lt;span class="nv"&gt;format&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;yuv420p &lt;span class="nt"&gt;-f&lt;/span&gt; v4l2 /dev/video2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, applications like &lt;strong&gt;Google Meet, Zoom, OBS, or OpenCV&lt;/strong&gt; can use your phone as a webcam 🎉&lt;/p&gt;




&lt;h3&gt;
  
  
  🎬 Webcam in Google Meet (via Firefox):
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F5411487%2F131579281-2e5b0e6f-8da2-4983-ae77-bc5c1b3e847b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F5411487%2F131579281-2e5b0e6f-8da2-4983-ae77-bc5c1b3e847b.png" alt="Google Meet using virtual webcam" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  🔴 OBS Studio Preview:
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F5411487%2F131579298-6be7e237-b0ad-45d1-9389-b58f22d76d91.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F5411487%2F131579298-6be7e237-b0ad-45d1-9389-b58f22d76d91.png" alt="OBS Studio Virtual Camera" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  ✅ Conclusion
&lt;/h2&gt;

&lt;p&gt;While there isn’t a GUI to handle all this, the command-line workflow with tools like &lt;code&gt;scrcpy&lt;/code&gt;, &lt;code&gt;adb&lt;/code&gt;, and &lt;code&gt;ffmpeg&lt;/code&gt; makes it totally doable—even for beginners.&lt;/p&gt;

&lt;p&gt;Questions? Suggestions? Drop them in the comments—your feedback is golden!&lt;/p&gt;

</description>
      <category>android</category>
      <category>linux</category>
      <category>scrcpy</category>
      <category>webcam</category>
    </item>
    <item>
      <title>Formatting External Drives On Linux Using Gparted.</title>
      <dc:creator>Kwaku Duah</dc:creator>
      <pubDate>Sun, 07 May 2023 23:33:23 +0000</pubDate>
      <link>https://dev.to/thekalderon/formatting-external-drives-on-linux-using-gparted-5goa</link>
      <guid>https://dev.to/thekalderon/formatting-external-drives-on-linux-using-gparted-5goa</guid>
      <description>&lt;p&gt;Formatting a pendrive or external hard drive can sometimes be a real pain. There are a variety of tools that can be used to format a drive. Commandline tools, third party premium software and open source tools like gparted.&lt;br&gt;
Gparted is a free partition tool that is used for disk management.It allows for creating, moving and deleting a partition on a drive.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F7qj1kjc29ks7iicpr5hf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F7qj1kjc29ks7iicpr5hf.png" alt="GUI of Gparted" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Table Of Content&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Installation of gparted on linux&lt;/li&gt;
&lt;li&gt;Formatting a drive with gparted&lt;/li&gt;
&lt;li&gt;Labelling a drive after formatting&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Installation of gparted on linux&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Gparted can  be installed in several forms. However, the method I will discuss here is with the use of the Command Line Interface(CLI).&lt;br&gt;
Firstly, update the repositories on the linux installation with the command:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fm4ssfyx9tj4386a971fd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fm4ssfyx9tj4386a971fd.png" alt="CLI on linux" width="712" height="170"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After a successful update of all the programs, the next command to run is:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F7cd65prou4p7342v27du.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F7cd65prou4p7342v27du.png" alt="gparted installed successfully" width="783" height="181"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can then run the command &lt;code&gt;gparted&lt;/code&gt; in the terminal to open the application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Formatting the drive in gparted&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;From the top right corner of the display, select from the partitions dropdown the partition or device you want to work on.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fj4zhv7u6lhr6sur5gkhu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fj4zhv7u6lhr6sur5gkhu.png" alt="device" width="800" height="96"&gt;&lt;/a&gt;&lt;br&gt;
Exercise caution by double checking that you have selected the right device.Right-click on the device and a popup will appear like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fsc63n3vutpcscrbq1nns.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fsc63n3vutpcscrbq1nns.png" alt="Popup" width="800" height="449"&gt;&lt;/a&gt;&lt;br&gt;
Unmount the device/partition you selected.&lt;br&gt;
From the popup, click on 'format to' to have all the possible formats you can format the drive to displayed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F3l80h4pizo7rplkudvfb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F3l80h4pizo7rplkudvfb.png" alt="last popup" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select from the dropdown list the format you want the drive to be formatted to among NTFS(New Technology File System), FAT 16, FAT 32 and a whole lot.&lt;br&gt;
Depending on the size of the drive, the operation may be done quickly or it will take some time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Labelling the filesystem&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Furthermore, once the formatting is completed, right-click on the device and from the popup choose 'label filesytem'.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fz2e8dacika8l6wxfil3w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fz2e8dacika8l6wxfil3w.png" alt="label" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The device will show as the name defined above when mounted in any computer.&lt;br&gt;
Gparted is an advanced software that can be used to make a bootable to use on live partitions without data loss.&lt;br&gt;
That is a beyond the scope of this tutorial.&lt;br&gt;
Ta-da, you have successfully learned how to use gparted.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>gparted</category>
      <category>formatting</category>
      <category>drives</category>
    </item>
    <item>
      <title>CRUD Notes Web App In Javascript.</title>
      <dc:creator>Kwaku Duah</dc:creator>
      <pubDate>Sat, 06 May 2023 19:26:11 +0000</pubDate>
      <link>https://dev.to/thekalderon/crud-notes-web-app-in-javascript-2h36</link>
      <guid>https://dev.to/thekalderon/crud-notes-web-app-in-javascript-2h36</guid>
      <description>&lt;p&gt;Javascript is a high-level progamming language that can be used to build modern web applications. It has evolved over the years as only a front-end/UI language to having the full capability of been deployed for back-end development.&lt;br&gt;
In this project, we will use Javascript to build a simple password generator web application and deploy it to vercel.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Table Of Content&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set Up Development Environment&lt;/li&gt;
&lt;li&gt;Create the frame, style the UI&lt;/li&gt;
&lt;li&gt;Add the logic to complete the program&lt;/li&gt;
&lt;li&gt;Commit the project to github&lt;/li&gt;
&lt;li&gt;Deploy to vercel for hosting&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Set Up Development Environment&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is a simple project that is beginner friendly. However, having prior knowledge in HTML, CSS and Javascript will help matters.In this tutorial, I will be using commands on the Command Line Interface(CLI) to create,read and update folders and files. However, it is not mandatory to have knowledge of the command line.&lt;br&gt;
Create a new folder where all the files that will be created will be housed. Issue this command on the Linux Terminal:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mkdir notesapp&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;On Windows, simply create a new folder 'noteapp'.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create the frame, style the UI&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;HyperText Markup Language(HTML) is a standardized way for tagging text files on the World Wide Web(www). HTML provides the frame for the structure of webpages. This may be likened to a building a house. The house entirely rests on the foundation and in web application design, HTML plays a similar role. &lt;br&gt;
However, Cascading Style Sheets(CSS) describes how HMTL elements will look like on a webpage. Fonts, colors and styles on webpages are entirely done with CSS. In relation to the building of a house example, paints,designs, and decorations will be the CSS of the house.&lt;br&gt;
In this project, we will create a root HTML file named; 'index.html'.&lt;br&gt;
Using the terminal, enter this command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;touch index.html&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;On Windows OS, create a new file named 'index.html'&lt;br&gt;
Contents of the HTML file:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;br&gt;
&amp;lt;html lang="en"&amp;gt;&lt;br&gt;
&amp;lt;head&amp;gt;&lt;br&gt;
    &amp;lt;meta charset="UTF-8"&amp;gt;&lt;br&gt;
    &amp;lt;link rel="stylesheet" href="style.css"&amp;gt;&lt;br&gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;&lt;br&gt;
    &amp;lt;title&amp;gt;Notes App In Pure HTML CSS JS&amp;lt;/title&amp;gt;&lt;br&gt;
    &amp;lt;link rel="stylesheet" href="https://unicons.iconscout.com/release/v4.0.0/css/line.css"&amp;gt;&lt;br&gt;
&amp;lt;/head&amp;gt;&lt;br&gt;
&amp;lt;body&amp;gt;&lt;br&gt;
    &amp;lt;div class="popup-box"&amp;gt;&lt;br&gt;
      &amp;lt;div class="popup"&amp;gt;&lt;br&gt;
        &amp;lt;div class="content"&amp;gt;&lt;br&gt;
          &amp;lt;header&amp;gt;&lt;br&gt;
            &amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br&gt;
            &amp;lt;i class="uil uil-times"&amp;gt;&amp;lt;/i&amp;gt;&lt;br&gt;
          &amp;lt;/header&amp;gt;&lt;br&gt;
          &amp;lt;form action="#"&amp;gt;&lt;br&gt;
            &amp;lt;div class="row title"&amp;gt;&lt;br&gt;
              &amp;lt;label&amp;gt;Title&amp;lt;/label&amp;gt;&lt;br&gt;
              &amp;lt;input type="text" spellcheck="false"&amp;gt;&lt;br&gt;
            &amp;lt;/div&amp;gt;&lt;br&gt;
            &amp;lt;div class="row description"&amp;gt;&lt;br&gt;
              &amp;lt;label&amp;gt;Description&amp;lt;/label&amp;gt;&lt;br&gt;
              &amp;lt;textarea spellcheck="false"&amp;gt;&amp;lt;/textarea&amp;gt;&lt;br&gt;
            &amp;lt;/div&amp;gt;&lt;br&gt;
            &amp;lt;button&amp;gt;&amp;lt;/button&amp;gt;&lt;br&gt;
          &amp;lt;/form&amp;gt;&lt;br&gt;
        &amp;lt;/div&amp;gt;&lt;br&gt;
      &amp;lt;/div&amp;gt;&lt;br&gt;
    &amp;lt;/div&amp;gt;&lt;br&gt;
    &amp;lt;div class="wrapper"&amp;gt;&lt;br&gt;
      &amp;lt;li class="add-box"&amp;gt;&lt;br&gt;
        &amp;lt;div class="icon"&amp;gt;&amp;lt;i class="uil uil-plus"&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/div&amp;gt;&lt;br&gt;
        &amp;lt;p&amp;gt;Add New Note&amp;lt;/p&amp;gt;&lt;br&gt;
      &amp;lt;/li&amp;gt;&lt;br&gt;
    &amp;lt;/div&amp;gt;&lt;br&gt;
    &amp;lt;div class="footer"&amp;gt;&lt;br&gt;
      &amp;lt;p&amp;gt;Made by kdwebdeveloper&amp;lt;a href="https://kdwebdeveloper.vercel.app/"&amp;gt; Porfolio &amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;br&gt;
    &amp;lt;/div&amp;gt;&lt;br&gt;
    &amp;lt;script src="script.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;br&gt;
  &amp;lt;/body&amp;gt;&lt;br&gt;
&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This is the structure of the web application. Now, we need to choose fonts, colors and give design the page beautifully with CSS.&lt;br&gt;
In the linux terminal, issue the command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;touch style.css&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;On Windows, create a file 'style.css'&lt;/p&gt;

&lt;p&gt;Note: You must create the two files all in the same folder "notesapp".&lt;br&gt;
Link the CSS file 'style.css' to the web page with an with the HTML 'link element' in the 'head' element in the HTML structure.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fmxucydtw6hyh0553b2xl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fmxucydtw6hyh0553b2xl.png" alt="Linking CSS to HTML" width="739" height="146"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is the content for the CSS file 'style.css'.&lt;/p&gt;

&lt;p&gt;`* {&lt;br&gt;
    list-style: none;&lt;br&gt;
    padding: 0;&lt;br&gt;
    margin:0;&lt;br&gt;
    box-sizing: border-box;&lt;br&gt;
    font-family: 'Raleway', sans-serif;&lt;br&gt;
}&lt;br&gt;
body {&lt;br&gt;
    background-image: linear-gradient(to right, rgba(127,127,67,0.5), rgb(97, 141, 61));&lt;/p&gt;

&lt;p&gt;}&lt;br&gt;
::selection{&lt;br&gt;
  color: #fff;&lt;br&gt;
  background: #618cf8;&lt;br&gt;
}&lt;br&gt;
.wrapper{&lt;br&gt;
  margin: 50px;&lt;br&gt;
  display: grid;&lt;br&gt;
  gap: 25px;&lt;br&gt;
  grid-template-columns: repeat(auto-fill, 265px);&lt;br&gt;
}&lt;br&gt;
.wrapper li{&lt;br&gt;
  height: 250px;&lt;br&gt;
  list-style: none;&lt;br&gt;
  border-radius: 5px;&lt;br&gt;
  padding: 15px 20px 20px;&lt;br&gt;
  background: #fff;&lt;br&gt;
  box-shadow: 0 4px 8px rgba(0,0,0,0.05);&lt;br&gt;
}&lt;br&gt;
.add-box, .icon, .bottom-content, &lt;br&gt;
.popup, header, .settings .menu li{&lt;br&gt;
  display: flex;&lt;br&gt;
  align-items: center;&lt;br&gt;
  justify-content: space-between;&lt;br&gt;
}&lt;br&gt;
.add-box{&lt;br&gt;
  cursor: pointer;&lt;br&gt;
  flex-direction: column;&lt;br&gt;
  justify-content: center;&lt;br&gt;
}&lt;br&gt;
.add-box .icon{&lt;br&gt;
  height: 78px;&lt;br&gt;
  width: 78px;&lt;br&gt;
  color: #88ABFF;&lt;br&gt;
  font-size: 40px;&lt;br&gt;
  border-radius: 50%;&lt;br&gt;
  justify-content: center;&lt;br&gt;
  border: 2px solid #88ABFF;&lt;br&gt;
}&lt;br&gt;
.add-box p{&lt;br&gt;
  color: #88ABFF;&lt;br&gt;
  font-weight: 500;&lt;br&gt;
  margin-top: 20px;&lt;br&gt;
}&lt;br&gt;
.note{&lt;br&gt;
  display: flex;&lt;br&gt;
  flex-direction: column;&lt;br&gt;
  justify-content: space-between;&lt;br&gt;
}&lt;br&gt;
.note .details{&lt;br&gt;
  max-height: 165px;&lt;br&gt;
  overflow-y: auto;&lt;br&gt;
}&lt;br&gt;
.note .details::-webkit-scrollbar,&lt;br&gt;
.popup textarea::-webkit-scrollbar{&lt;br&gt;
  width: 0;&lt;br&gt;
}&lt;br&gt;
.note .details:hover::-webkit-scrollbar,&lt;br&gt;
.popup textarea:hover::-webkit-scrollbar{&lt;br&gt;
  width: 5px;&lt;br&gt;
}&lt;br&gt;
.note .details:hover::-webkit-scrollbar-track,&lt;br&gt;
.popup textarea:hover::-webkit-scrollbar-track{&lt;br&gt;
  background: #f1f1f1;&lt;br&gt;
  border-radius: 25px;&lt;br&gt;
}&lt;br&gt;
.note .details:hover::-webkit-scrollbar-thumb,&lt;br&gt;
.popup textarea:hover::-webkit-scrollbar-thumb{&lt;br&gt;
  background: #e6e6e6;&lt;br&gt;
  border-radius: 25px;&lt;br&gt;
}&lt;br&gt;
.note p{&lt;br&gt;
  font-size: 22px;&lt;br&gt;
  font-weight: 500;&lt;br&gt;
}&lt;br&gt;
.note span{&lt;br&gt;
  display: block;&lt;br&gt;
  color: #575757;&lt;br&gt;
  font-size: 16px;&lt;br&gt;
  margin-top: 5px;&lt;br&gt;
}&lt;br&gt;
.note .bottom-content{&lt;br&gt;
  padding-top: 10px;&lt;br&gt;
  border-top: 1px solid #ccc;&lt;br&gt;
}&lt;br&gt;
.bottom-content span{&lt;br&gt;
  color: #6D6D6D;&lt;br&gt;
  font-size: 14px;&lt;br&gt;
}&lt;br&gt;
.bottom-content .settings{&lt;br&gt;
  position: relative;&lt;br&gt;
}&lt;br&gt;
.bottom-content .settings i{&lt;br&gt;
  color: #6D6D6D;&lt;br&gt;
  cursor: pointer;&lt;br&gt;
  font-size: 15px;&lt;br&gt;
}&lt;br&gt;
.settings .menu{&lt;br&gt;
  z-index: 1;&lt;br&gt;
  bottom: 0;&lt;br&gt;
  right: -5px;&lt;br&gt;
  padding: 5px 0;&lt;br&gt;
  background: #fff;&lt;br&gt;
  position: absolute;&lt;br&gt;
  border-radius: 4px;&lt;br&gt;
  transform: scale(0);&lt;br&gt;
  transform-origin: bottom right;&lt;br&gt;
  box-shadow: 0 0 6px rgba(0,0,0,0.15);&lt;br&gt;
  transition: transform 0.2s ease;&lt;br&gt;
}&lt;br&gt;
.settings.show .menu{&lt;br&gt;
  transform: scale(1);&lt;br&gt;
}&lt;br&gt;
.settings .menu li{&lt;br&gt;
  height: 25px;&lt;br&gt;
  font-size: 16px;&lt;br&gt;
  margin-bottom: 2px;&lt;br&gt;
  padding: 17px 15px;&lt;br&gt;
  cursor: pointer;&lt;br&gt;
  box-shadow: none;&lt;br&gt;
  border-radius: 0;&lt;br&gt;
  justify-content: flex-start;&lt;br&gt;
}&lt;br&gt;
.menu li:last-child{&lt;br&gt;
  margin-bottom: 0;&lt;br&gt;
}&lt;br&gt;
.menu li:hover{&lt;br&gt;
  background: #f5f5f5;&lt;br&gt;
}&lt;br&gt;
.menu li i{&lt;br&gt;
  padding-right: 8px;&lt;br&gt;
}&lt;br&gt;
.popup-box{&lt;br&gt;
  position: fixed;&lt;br&gt;
  top: 0;&lt;br&gt;
  left: 0;&lt;br&gt;
  z-index: 2;&lt;br&gt;
  height: 100%;&lt;br&gt;
  width: 100%;&lt;br&gt;
  background: rgba(0,0,0,0.4);&lt;br&gt;
}&lt;br&gt;
.popup-box .popup{&lt;br&gt;
  position: absolute;&lt;br&gt;
  top: 50%;&lt;br&gt;
  left: 50%;&lt;br&gt;
  z-index: 3;&lt;br&gt;
  width: 100%;&lt;br&gt;
  max-width: 400px;&lt;br&gt;
  justify-content: center;&lt;br&gt;
  transform: translate(-50%, -50%) scale(0.95);&lt;br&gt;
}&lt;br&gt;
.popup-box, .popup{&lt;br&gt;
  opacity: 0;&lt;br&gt;
  pointer-events: none;&lt;br&gt;
  transition: all 0.25s ease;&lt;br&gt;
}&lt;br&gt;
.popup-box.show, .popup-box.show .popup{&lt;br&gt;
  opacity: 1;&lt;br&gt;
  pointer-events: auto;&lt;br&gt;
}&lt;br&gt;
.popup-box.show .popup{&lt;br&gt;
  transform: translate(-50%, -50%) scale(1);&lt;br&gt;
}&lt;br&gt;
.popup .content{&lt;br&gt;
  border-radius: 5px;&lt;br&gt;
  background: #fff;&lt;br&gt;
  width: calc(100% - 15px);&lt;br&gt;
  box-shadow: 0 0 15px rgba(0,0,0,0.1);&lt;br&gt;
}&lt;br&gt;
.content header{&lt;br&gt;
  padding: 15px 25px;&lt;br&gt;
  border-bottom: 1px solid #ccc;&lt;br&gt;
}&lt;br&gt;
.content header p{&lt;br&gt;
  font-size: 20px;&lt;br&gt;
  font-weight: 500;&lt;br&gt;
}&lt;br&gt;
.content header i{&lt;br&gt;
  color: #8b8989;&lt;br&gt;
  cursor: pointer;&lt;br&gt;
  font-size: 23px;&lt;br&gt;
}&lt;br&gt;
.content form{&lt;br&gt;
  margin: 15px 25px 35px;&lt;br&gt;
}&lt;br&gt;
.content form .row{&lt;br&gt;
  margin-bottom: 20px;&lt;br&gt;
}&lt;br&gt;
form .row label{&lt;br&gt;
  font-size: 18px;&lt;br&gt;
  display: block;&lt;br&gt;
  margin-bottom: 6px;&lt;br&gt;
}&lt;br&gt;
form :where(input, textarea){&lt;br&gt;
  height: 50px;&lt;br&gt;
  width: 100%;&lt;br&gt;
  outline: none;&lt;br&gt;
  font-size: 17px;&lt;br&gt;
  padding: 0 15px;&lt;br&gt;
  border-radius: 4px;&lt;br&gt;
  border: 1px solid #999;&lt;br&gt;
}&lt;br&gt;
form :where(input, textarea):focus{&lt;br&gt;
  box-shadow: 0 2px 4px rgba(0,0,0,0.11);&lt;br&gt;
}&lt;br&gt;
form .row textarea{&lt;br&gt;
  height: 150px;&lt;br&gt;
  resize: none;&lt;br&gt;
  padding: 8px 15px;&lt;br&gt;
}&lt;br&gt;
form button{&lt;br&gt;
  width: 100%;&lt;br&gt;
  height: 50px;&lt;br&gt;
  color: #fff;&lt;br&gt;
  outline: none;&lt;br&gt;
  border: none;&lt;br&gt;
  cursor: pointer;&lt;br&gt;
  font-size: 17px;&lt;br&gt;
  border-radius: 4px;&lt;br&gt;
  background: #6A93F8;&lt;br&gt;
}&lt;br&gt;
&lt;a class="mentioned-user" href="https://dev.to/media"&gt;@media&lt;/a&gt; (max-width: 660px){&lt;br&gt;
  .wrapper{&lt;br&gt;
    margin: 15px;&lt;br&gt;
    gap: 15px;&lt;br&gt;
    grid-template-columns: repeat(auto-fill, 100%);&lt;br&gt;
  }&lt;br&gt;
  .popup-box .popup{&lt;br&gt;
    max-width: calc(100% - 15px);&lt;br&gt;
  }&lt;br&gt;
  .bottom-content .settings i{&lt;br&gt;
    font-size: 17px;&lt;br&gt;
  }&lt;br&gt;
}&lt;br&gt;
.footer p{&lt;br&gt;
  float:inline-start;&lt;br&gt;
}`&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fmjrzgl9t07tbq4qy4dpk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fmjrzgl9t07tbq4qy4dpk.png" alt="Look of the page" width="800" height="351"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Add Logic To Complete the project&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The (User Interface)UI of the page is now just as we want it, now proceed to add logic to the application. Javascript is a highly dynamic language and it will allow us to achieve that effect.&lt;br&gt;
Create a new file 'script.js'. With the terminal, issue the command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;touch script.js&lt;/code&gt; in the root directory in addition to the index.html file and style.css files.&lt;/p&gt;

&lt;p&gt;We proceed to link the 'script.js' file to the 'index.html' file to render the javascript file with HTML script tag.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F694d8n4dgpqfch41iulg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F694d8n4dgpqfch41iulg.png" alt="script" width="369" height="55"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is the content of the 'script.js' javascript file:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fypimmb9b50so2gkrfqw4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fypimmb9b50so2gkrfqw4.png" alt="Snippet of js" width="800" height="451"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Do not worry, I will attach the link to the source code.&lt;br&gt;
Now we have a notes app written entirely in Javascript.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commit the project to Github&lt;/strong&gt;&lt;br&gt;
Goto &lt;a href="//www.github.com"&gt;github&lt;/a&gt; and sign up for account or sign in if you have an account.&lt;br&gt;
Create a new repository and commit the project to github.&lt;br&gt;
This is how it will look like:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fl44wjmm92dggdlozll1w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fl44wjmm92dggdlozll1w.png" alt="Uploaded file to github" width="800" height="164"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Deploy the project to vercel for hosting&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Goto &lt;a href="//www.vercel.com"&gt;vercel&lt;/a&gt; and sign up for an account with github.Goto the dashboard and click on deploy a project. Select the repostory you created and ta-da!, the project is live.&lt;br&gt;
Here is link to the web application we just created:&lt;br&gt;
&lt;a href="https://noteapp-smoky.vercel.app/" rel="noopener noreferrer"&gt;notesapp&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This is the link to the source code at &lt;a href="https://github.com/Kalderon-Sheikhman/noteapp" rel="noopener noreferrer"&gt;github&lt;/a&gt;.&lt;br&gt;
Feedbacks are welcome!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>html</category>
      <category>css</category>
      <category>vercel</category>
    </item>
    <item>
      <title>Javascript Password Generator.</title>
      <dc:creator>Kwaku Duah</dc:creator>
      <pubDate>Tue, 02 May 2023 22:11:47 +0000</pubDate>
      <link>https://dev.to/thekalderon/javascript-password-generator-5gg</link>
      <guid>https://dev.to/thekalderon/javascript-password-generator-5gg</guid>
      <description>&lt;p&gt;Javascript is a high-level programming language that is efficient and performant. Javascript has evolved over the years as only a language good for the front-end.&lt;br&gt;
Javascript can be used to do server-side rendering and hence it is used to build fullstack applications.&lt;br&gt;
In this project,HTML, CSS and Javascript is used to build a password generator web application. This web application has been deployed to vercel on with this link &lt;a href="https://password-generator-chi-sand.vercel.app/" rel="noopener noreferrer"&gt;password generator app&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Table Of Content&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Setting up environment&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Building index.html, styles.css&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Javascript code to complete the application&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Committing the project to git&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Signing up to Vercel with github&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Deploying web app to vercel&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Setting Up Environment&lt;/strong&gt;&lt;br&gt;
This project makes use of only HTML,CSS and Javascript.&lt;br&gt;
Create a folder with any desired name. On linux use this command:&lt;br&gt;
&lt;code&gt;mkdir jspassword&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Change from your current directory to the new directory with the command:&lt;br&gt;
&lt;code&gt;cd jspassword&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Building Index.html and Styles.css&lt;/strong&gt;&lt;br&gt;
Create a new file with the name 'index.html.&lt;br&gt;
If you are using the Command Line Interface(CLI), issue the command:&lt;br&gt;
&lt;code&gt;touch index.html&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This file will contain the structure/frame of the page.&lt;br&gt;
Content of the index.html&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;br&gt;
&amp;lt;html lang="en"&amp;gt;&lt;br&gt;
&amp;lt;head&amp;gt;&lt;br&gt;
    &amp;lt;meta charset="UTF-8"&amp;gt;&lt;br&gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;&lt;br&gt;
    &amp;lt;title&amp;gt;Password Generator&amp;lt;/title&amp;gt;&lt;br&gt;
    &amp;lt;link rel="stylesheet" href="style.css"&amp;gt;&lt;br&gt;
&amp;lt;/head&amp;gt;&lt;br&gt;
&amp;lt;body&amp;gt;&lt;br&gt;
    &amp;lt;div class="box"&amp;gt;&lt;br&gt;
        &amp;lt;h2&amp;gt;Password Generator&amp;lt;/h2&amp;gt;&lt;br&gt;
        &amp;lt;input type="text" name="" placeholder="Create password" id="password" readonly required&amp;gt;&lt;br&gt;
        &amp;lt;table&amp;gt;&lt;br&gt;
            &amp;lt;th&amp;gt;&amp;lt;div id="button" class="btn1"onclick="genPassword()"&amp;gt;Generate&amp;lt;/div&amp;gt;&amp;lt;/th&amp;gt;&lt;br&gt;
            &amp;lt;th&amp;gt;&amp;lt;a  id="button" class="btn2" onclick="copyPassword()"&amp;gt;Copy&amp;lt;/a&amp;gt;&amp;lt;/th&amp;gt;&lt;br&gt;
         &amp;lt;/table&amp;gt;&lt;br&gt;
    &amp;lt;/div&amp;gt;&lt;br&gt;
    &amp;lt;script src="script.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;br&gt;
&amp;lt;/body&amp;gt;&lt;br&gt;
&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Furthermore, the heading texts, buttons needs to be arranged and styled nicely. This effect is achieved with the styles.css file.&lt;br&gt;
The 'index.html' is linked with the styles.css with the following line:&lt;br&gt;
&lt;code&gt;&amp;lt;link rel="stylesheet" href="style.css"&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This is the content of the styles.css file:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;*&lt;/code&gt; &lt;code&gt;{&lt;br&gt;
    margin: 0;&lt;br&gt;
    padding: 0;&lt;br&gt;
    user-select: none;&lt;br&gt;
    box-sizing: border-box;&lt;br&gt;
}&lt;br&gt;
body {&lt;br&gt;
    background-color: rgb(79, 75, 75);&lt;br&gt;
}&lt;br&gt;
.box {&lt;br&gt;
    background-color: rgb(176, 169, 169);&lt;br&gt;
    padding: 40px ;&lt;br&gt;
    border-radius: 30px;&lt;br&gt;
    box-shadow: 8px 5px 14px -1px rgb(94, 94, 94);&lt;br&gt;
    -webkit-box-shadow: 8px 5px 14px -1px rgba(94, 94, 94);&lt;br&gt;
    -moz-box-shadow: 8px 5px 14px -1px rgba(94, 94, 94);&lt;br&gt;
    position: absolute;&lt;br&gt;
    top: 50%;&lt;br&gt;
    left: 50%;&lt;br&gt;
    transform: translate(-50%, -50%);&lt;br&gt;
    overflow:hidden;&lt;br&gt;
}&lt;br&gt;
@media (min-width:600px) and (max-width:720px){&lt;br&gt;
    body{&lt;br&gt;
        background-color: lightseagreen; &lt;br&gt;
    }&lt;br&gt;
    .box{&lt;br&gt;
        height: 100vh;&lt;br&gt;
        width:100%;&lt;br&gt;
        overflow: hidden;&lt;br&gt;
        padding:20px;&lt;br&gt;
    }&lt;br&gt;
}&lt;br&gt;
.box h2 {&lt;br&gt;
    margin-bottom: 40px;&lt;br&gt;
    text-align: center;&lt;br&gt;
    font-size: 26px;&lt;br&gt;
    color: black;&lt;br&gt;
    font-family: Roboto;&lt;br&gt;
}&lt;br&gt;
input {&lt;br&gt;
    padding: 20px;&lt;br&gt;
    user-select: none;&lt;br&gt;
    height: 50px;&lt;br&gt;
    width: 400px;&lt;br&gt;
    border-radius: 6px;&lt;br&gt;
    border: none;&lt;br&gt;
    border: 2px solid black;&lt;br&gt;
    outline: none;&lt;br&gt;
    font-size: 22px;&lt;br&gt;
}&lt;br&gt;
input::placeholder {&lt;br&gt;
    font-size: 23px;&lt;br&gt;
}&lt;/code&gt;&lt;br&gt;
&lt;code&gt;#button {&lt;br&gt;
    font-family: sans-serif;&lt;br&gt;
    font-size: 15px;&lt;br&gt;
    margin-top: 40px;&lt;br&gt;
    width: 155px;&lt;br&gt;
    height: 50px;&lt;br&gt;
    text-align: center;&lt;br&gt;
    background-color: #14e5;&lt;br&gt;
    display: flex;&lt;br&gt;
    color: rgb(255, 255, 255);&lt;br&gt;
    justify-content: center;&lt;br&gt;
    align-items: center;&lt;br&gt;
    cursor: pointer;&lt;br&gt;
    border-radius: 7px;&lt;br&gt;
    transition: 300ms ease-in-out;&lt;br&gt;
}&lt;br&gt;
.btn2 {&lt;br&gt;
    margin-left: 85px;&lt;br&gt;
}&lt;/code&gt;&lt;br&gt;
&lt;code&gt;#button:hover {&lt;br&gt;
    color: white;&lt;br&gt;
    background-color: black;&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Most importantly, buttons, header texts are arranged nicely like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fw5phy5ltvgfs601aqp5x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fw5phy5ltvgfs601aqp5x.png" alt="password generator webapp" width="800" height="413"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The HTML and CSS files were responsible for framing and design/look of the web application. In clearer terms, HTML will be likened to the foundation/structure of a house whereas CSS refers to the painting/aesthetics of the web page.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Javascript code to complete the application&lt;/strong&gt;&lt;br&gt;
Javascript is the language that will provide the logic for the web application.&lt;br&gt;
Javascript functions like the in-built random function will used to generate different passwords upon each iteration.&lt;br&gt;
A new variable labelled 'password' declared with the 'let'  keyword will be used to define the element to define logic for in this project.&lt;br&gt;
In the same directory;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;index.html&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;style.css&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;script.js&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;here we have added script.js.&lt;br&gt;
Earlier, we added script.js to the index.html file.This is the snippet:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;script src="script.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This is the code for the script.js:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;let password = document.getElementById("password");&lt;br&gt;
function genPassword() {&lt;br&gt;
    var chars = "0123456789abcdefghakshSNUAI2425NYfijklmnopqrstuvwxyz!@#$%^&amp;amp;*()ABCDEFGHIJKLMNOPQRSTUVWXYZ";&lt;br&gt;
    var passwordLength = 12;&lt;br&gt;
    var password = "";&lt;br&gt;
    for (var i = 0; i &amp;lt;= passwordLength; i++) {&lt;br&gt;
        var randomNumber = Math.floor(Math.random() * chars.length);&lt;br&gt;
        password += chars.substring(randomNumber, randomNumber + 1);&lt;br&gt;
    }&lt;br&gt;
    document.getElementById("password").value = password;&lt;br&gt;
}&lt;br&gt;
function copyPassword() {&lt;br&gt;
    var copyText = document.getElementById("password");&lt;br&gt;
    copyText.select();&lt;br&gt;
    copyText.setSelectionRange(0, 999);&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The directory 'jspassword' now contains three files namely; index.html,styles.css and script.js.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Committing the Project To Github&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Goto &lt;a href="//www.github.com"&gt;github&lt;/a&gt; and sign up for a new account.&lt;/p&gt;

&lt;p&gt;Create a new repository and commit the files to github with the following commands:&lt;br&gt;
&lt;code&gt;git init&lt;br&gt;
git add .&lt;br&gt;
git commit - m "JSPASSWORD APP"&lt;br&gt;
git branch -M main&lt;br&gt;
git remote add origin (paste your ssh or httpS link of the git repostory you created)&lt;br&gt;
git push -u origin main&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Your completed push to github will look like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fvt2illjgx32c3s3szgmf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fvt2illjgx32c3s3szgmf.png" alt="Look of push to git" width="800" height="142"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Deploying to vercel&lt;/strong&gt;&lt;br&gt;
Goto &lt;a href="//www.vercel.com"&gt;vercel&lt;/a&gt; and signup for an account with Github.&lt;br&gt;
On the top right corner, there is an &lt;strong&gt;add new project&lt;/strong&gt;.&lt;br&gt;
Select that option and link your github account.&lt;br&gt;
Select the git repository you just created and wait for sometime.&lt;br&gt;
Kudos, you just deployed a &lt;strong&gt;password generator application to the whole world for free&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fsk1il0btbatudcf0x9yx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fsk1il0btbatudcf0x9yx.png" alt="Vercel interface after deployment" width="800" height="271"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is a link to the &lt;a href="https://github.com/Kalderon-Sheikhman/Password-Generator" rel="noopener noreferrer"&gt;source code for the project&lt;/a&gt;.&lt;br&gt;
That is it!, you have deployed a password generator web application built with javascript!&lt;br&gt;
Follow me on &lt;a href="//www.twitter.com/thekinping"&gt;twitter&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>My Journey Into Tech.</title>
      <dc:creator>Kwaku Duah</dc:creator>
      <pubDate>Tue, 02 May 2023 19:57:02 +0000</pubDate>
      <link>https://dev.to/thekalderon/my-journey-into-tech-12l2</link>
      <guid>https://dev.to/thekalderon/my-journey-into-tech-12l2</guid>
      <description>&lt;p&gt;Learning to code can be a tedious task when you do not know where to start from. There are several programming languages available for use to acccomplish various tasks.&lt;br&gt;
Low-level programming languages have two categories: &lt;strong&gt;assembly language&lt;/strong&gt; and &lt;strong&gt;machine code&lt;/strong&gt; have steep learning curves.Hoewever, high-level programming languages like Python,C++,C# are easier to start with a bit of grit and determination.&lt;/p&gt;

&lt;p&gt;This is a quick privy into my tech journey. I started with the idea of using another operating system besides Windows OS(Operating System).A thorough research gave me a foray into all the possibilities of using Linux OS. I quickly settled with Linux Mint between Ubuntu and Linux Mint. It was evident from all the blogs I read from that Linux Mint was a bit faster than Ubuntu on devices with the similar specifications.&lt;/p&gt;

&lt;p&gt;I watched several videos to acquaint myself with knowledge of dual booting Windows OS alongside Linux Mint OS. The use of linux mint opened up a world of possibilities and I  settled with choosing to code. The big question of where to begin and what language to begin with arose. I started first of all by taking courses on familiarizing myself with the linux Command Line Interface(CLI). The creating of files, folders, deleting of files, copying of files and moving of files with commands felt like magic to me at first. I was honestly enthralled with this new possibility and decided to dig deeper.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F83oyydrp0y364bbfb1b3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F83oyydrp0y364bbfb1b3.png" alt="A picture of a terminal" width="732" height="353"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Bootcamps offer ways to learn to code. There are other platforms like &lt;a href="//www.freecodecamp.org"&gt;freecodecamp&lt;/a&gt; that are donor-supported and they have self-paced courses in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Front-end development&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Back-end development&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Database&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Datascience&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Machine Learning&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I started with the first course and took introductory courses in HTML, CSS and Javascript.&lt;br&gt;
I gave up along the way to focus on my final year project which was to be done using Machine Learning(ML).&lt;br&gt;
That is a topic for another day,sigh.&lt;/p&gt;

&lt;p&gt;Twitter remains one of the best things to have ever happened to me. I found a link &lt;a href="https://foundation.blacksintechnology.net" rel="noopener noreferrer"&gt;blacks in tech foundation&lt;/a&gt; where donors have either paid in full or partial for courses on Coursera, Udemy and other platforms to be accessed freely by all most especially by underprivileged black communities. I took on a software developer course from &lt;strong&gt;Meta&lt;/strong&gt; through Coursera in both front-end development and back-end development.I took courses in the following stacks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;HTML&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;CSS&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Programming in Javascript&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;React&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Advanced React&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Principles of UI/UX&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Git&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;...and back-end development stacks in:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Programming in Python&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Django Web Framework&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;APIs&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;MySQL Database&lt;br&gt;
The curriculum took me through an entire stack to become a full stack software developer.&lt;br&gt;
Project oriented courses and I took about 8 months to complete the entire stack and all projects.&lt;br&gt;
This is a link to my portfolio website &lt;a href="https://kdwebdeveloper.vercel.app" rel="noopener noreferrer"&gt;kdwebdeveloper&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fhomyyyfhbpkx2ym2orhq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fhomyyyfhbpkx2ym2orhq.png" alt="Snapshot of my portfolio page" width="800" height="406"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Ft0t0s9zdeanety9l70dt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Ft0t0s9zdeanety9l70dt.png" alt="My certifications" width="800" height="218"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is my third year in tech and I am proud to have had the chance, desire and attitude to persevere through it all.Glory to God Almighty.&lt;br&gt;
This is a link to my &lt;a href="//www.github.com/kalderon-sheikhman"&gt;github&lt;/a&gt;.&lt;br&gt;
Follow me on &lt;a href="//www.twitter.com/thekinping"&gt;twitter&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>html</category>
      <category>vercel</category>
    </item>
    <item>
      <title>Build A Weather App With Django.</title>
      <dc:creator>Kwaku Duah</dc:creator>
      <pubDate>Thu, 27 Apr 2023 01:52:42 +0000</pubDate>
      <link>https://dev.to/thekalderon/build-a-weather-app-with-django-1a0c</link>
      <guid>https://dev.to/thekalderon/build-a-weather-app-with-django-1a0c</guid>
      <description>&lt;p&gt;In this tutorial, I will build a weather web application using python, django web framework and Open Weather Map API. In order to do this, I will use python requests to call the Open Weather Map API.&lt;/p&gt;

&lt;p&gt;Current weather data can be accessed freely by creating an account at &lt;a href="https://openweathermap.org/api" rel="noopener noreferrer"&gt;OPen Weather Map API&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Table Of Contents&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Installation&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Admin Dashboard&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Creating the project&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Calling the Open Weather API in our code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Creating a template and displaying data in it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Creating a form&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Conclusion&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is simple application that will fetch weather data for varying cities. However, we will make use of a database and a form element so knowledge from this project can be applied to complicated projects in the future.&lt;/p&gt;

&lt;p&gt;Python 3.0 and Django 4 were used to code this project. It is a beginner friendly project but people with a tint of experience will find it much easier to follow. A preview of how the application will look like has been shown below:&lt;br&gt;
&lt;a href="https://media2.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%2Fvwmya0eil9h764z8j31z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fvwmya0eil9h764z8j31z.png" alt="A preview" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F6ohavphrwspxi2mryprt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F6ohavphrwspxi2mryprt.png" alt="A preview" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Installation&lt;/strong&gt;&lt;br&gt;
The installation of python-django follows the same process of installing other frameworks of python.&lt;br&gt;
Note: It is very important to create a virtual environment for this project. This allows the developer the flexibility of opting for any particular version of python,django without needing to cause a system wide change.&lt;br&gt;
In this article, I will be using pipenv to create the virtual environment. You can create a directory, navigate into the directory and follow the instructions.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;pipenv install django&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This will install the latest version of Django.&lt;br&gt;
Once Django has been installed successfully, in the next step you will generate a project in django.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;django-admin startproject weatherproj .&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;New files will be generated in the directory akin to this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fisdxyx0c7buyuyk9m20u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fisdxyx0c7buyuyk9m20u.png" alt="Project Directory" width="578" height="74"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is the directory with the file 'manage.py' which is essential for deployment to the server.&lt;br&gt;
You can run this command to check if so far your project deploys on the local server:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;python3 manage.py runserver&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fd8pgavs4ycv3aypjrqu3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fd8pgavs4ycv3aypjrqu3.png" alt="Successful installation" width="800" height="545"&gt;&lt;/a&gt;&lt;br&gt;
If you see this page you have installed django correctly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Admin Dashboard&lt;/strong&gt;&lt;br&gt;
Django comes with an admin dashboard that allows for Creating, Reading, Updating and Deleting(CRUD) as a super user.&lt;br&gt;
Now in order to view our admin dashboard, we will &lt;strong&gt;migrate our database&lt;/strong&gt; which means django created predefined tables for default apps. TO do this, you will use the migrate command. Stop the server with CTRL + C and run:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;python3 manage.py makemigrations&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;python3 manage.py migrate&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After running these commands, django created a SQLite database for this project. You can check your directory to confirm the presence of a &lt;strong&gt;db.sqlite3&lt;/strong&gt; file.&lt;br&gt;
By default, several tables are created by django in the database. However, the cons of SQLite database such as insecurity will not hinder this project in anyway.This is a minimal project with emphasis on acquisition of knowledge for test projects. Secure databases such as MySQL may however be used for projects with otherwise sensitive data.&lt;/p&gt;

&lt;p&gt;The database comes with a user table which will be used to store any users in our application. This table has an admin user which we will allow us to access the admin dashboard.&lt;br&gt;
To create an admin user, we will run the &lt;strong&gt;createsuperuser&lt;/strong&gt; command.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;python3 manage.py createsuperuser&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Follow the instructions to input name, email address and password for your admin user.&lt;br&gt;
Once you are done with that, you have to restart the server again and access the admin dashboard.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;python3  manage.py runserver&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;then goto the link 127.0.0.1:8000/admin&lt;/strong&gt;&lt;br&gt;
The reason why we can access this endpoint is that admin is defined in the urls.py at the project level (weatherproj).&lt;br&gt;
Login to the admin dashboard with your credentials. You should see a page like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F8n539e2cyhxg4g99k8ly.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F8n539e2cyhxg4g99k8ly.png" alt="Admin Dashboard" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Groups and Users represent two models in Django. Models are representations of tables in code form. I encourage you to click around in the dashboard and exercise in caution in the deletion of users else you will have to createsuperuser again.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Creating the App&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Django allows for the separation of functionality in projects in smaller chunks called apps. App is a confusing term since it generally represents entire codebases, projects.However, in Django, app refers to a specific funtionality in your project.Furthermore, a quick look at &lt;strong&gt;settings.py&lt;/strong&gt; file shows a section with heading &lt;strong&gt;INSTALLED_APPS&lt;/strong&gt; list.&lt;/p&gt;

&lt;p&gt;The first on the list, django.contrib.admin is what we used for the admin user. This further elaborates the fact that pieces of functionality called apps in django is what is collectively used to build a project.&lt;/p&gt;

&lt;p&gt;In our weatherproj, we need to create an app to handle another functionality.This is the command to create an app.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;python3 manage.py startapp weatherapp&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After running the commmand, a Django app called &lt;strong&gt;weatherapp&lt;/strong&gt; folder is generated in the directory.&lt;br&gt;
Navigate to the repository with the command&lt;br&gt;
&lt;code&gt;cd weatherapp&lt;/code&gt;&lt;br&gt;
and add a new file called &lt;strong&gt;urls.py&lt;/strong&gt;.&lt;br&gt;
&lt;code&gt;weatherproj/weatherapp/urls.py&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;from django.urls import path&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;urlpatterns = [&lt;br&gt;
]&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;There is a similar file in the weatherproj directory. The difference between the urls.py file at the app level(weatherapp) and urls.py file at the project level(weatherproj) is that the former contains all the URLS that are relevant to the app itself.This further buttresses the point of apps in Django representing separate functionalites in the project as each app has urls.py file with relevant URL links to itself.&lt;/p&gt;

&lt;p&gt;Navigate to the project directory(weatherproj) and in the &lt;strong&gt;settings.py&lt;/strong&gt; file add the name of the app we just created(weatherapp) to the list of &lt;strong&gt;INSTALLED_APPS&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fx7jx0lp9ccsixj8905po.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fx7jx0lp9ccsixj8905po.png" alt="view" width="504" height="322"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The app &lt;strong&gt;weatherapp&lt;/strong&gt; will now be used by Django in the weatherproj project.&lt;/p&gt;

&lt;p&gt;Navigate to the project level urls.py and alter it to point to our apps urls.py. To do that, we need to add a line below the existing path for admin dashboard. We need to import 'include' so we can properly point our apps urls.py.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;from django.contrib import admin&lt;/code&gt;&lt;br&gt;
&lt;code&gt;from django.urls import path,include&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;urlpatterns = [&lt;/code&gt;&lt;br&gt;
    &lt;code&gt;path('admin/', admin.site.urls),&lt;/code&gt;&lt;br&gt;
    &lt;code&gt;path('', include('weatherapp.urls')),&lt;/code&gt;&lt;br&gt;
&lt;code&gt;]&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The empty path string indicates we are not using any endpoint as an entry to the app. Instead, the app is allowed to handle the endpoints.Defining a string like 'weather' would have forced us to access that endpoint with ('weather/').&lt;br&gt;
This would mean to access it, we would have to use that endpoint in &lt;strong&gt;127.0.0.1:8000/weather/&lt;/strong&gt; to access anything related to the weatherapp. This is a simple project and we will not be using that approach.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Templating and Modifying the Views.py file&lt;/strong&gt;&lt;br&gt;
A template in Django is simply an HTML file that allows for extra syntax to make it dynamic than an ordinary HTML file. This dynamics include adding loops, if statements and variables.&lt;/p&gt;

&lt;p&gt;Navigate to the weatherapp directory and enter these commands:&lt;br&gt;
&lt;code&gt;mkdir templates&lt;/code&gt;&lt;br&gt;
&lt;code&gt;cd templates&lt;/code&gt;&lt;br&gt;
&lt;code&gt;mkdir weatherapp&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Becareful to note the addition of a new directory with same name as our app.Django combines template directories from the various apps we have and to prevent duplication by repeating the name of the app.&lt;br&gt;
Navigate to the template folder, then to the weatherapp and create an &lt;strong&gt;index.html&lt;/strong&gt;. This will the template and it is named index.html because it will be at root level and be the topmost element. This is the HTML to use for the template:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;br&gt;
&amp;lt;html lang="en"&amp;gt;&lt;br&gt;
&amp;lt;head&amp;gt;&lt;br&gt;
    &amp;lt;meta charset="UTF-8"&amp;gt;&lt;br&gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;&lt;br&gt;
    &amp;lt;title&amp;gt;What is the current weather?&amp;lt;/title&amp;gt;&lt;br&gt;
    &amp;lt;link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.6.2/css/bulma.css" /&amp;gt;&lt;br&gt;
&amp;lt;/head&amp;gt;&lt;br&gt;
&amp;lt;body&amp;gt;&lt;br&gt;
    &amp;lt;section class="hero is-primary"&amp;gt;&lt;br&gt;
        &amp;lt;div class="hero-body"&amp;gt;&lt;br&gt;
            &amp;lt;div class="container"&amp;gt;&lt;br&gt;
                &amp;lt;h1 class="title"&amp;gt;&lt;br&gt;
                    What's the weather like?&lt;br&gt;
                &amp;lt;/h1&amp;gt;&lt;br&gt;
            &amp;lt;/div&amp;gt;&lt;br&gt;
        &amp;lt;/div&amp;gt;&lt;br&gt;
    &amp;lt;/section&amp;gt;&lt;br&gt;
    &amp;lt;section class="section"&amp;gt;&lt;br&gt;
        &amp;lt;div class="container"&amp;gt;&lt;br&gt;
            &amp;lt;div class="columns"&amp;gt;&lt;br&gt;
                &amp;lt;div class="column is-offset-4 is-4"&amp;gt;&lt;br&gt;
                    &amp;lt;form method="POST"&amp;gt;&lt;br&gt;
                        {% csrf_token %}&lt;br&gt;
                        &amp;lt;div class="field has-addons"&amp;gt;&lt;br&gt;
                            &amp;lt;div class="control is-expanded"&amp;gt;&lt;br&gt;
                                {{ form.name }}&lt;br&gt;
                            &amp;lt;/div&amp;gt;&lt;br&gt;
                            &amp;lt;div class="control"&amp;gt;&lt;br&gt;
                                &amp;lt;button class="button is-info"&amp;gt;&lt;br&gt;
                                    Add New City&lt;br&gt;
                                &amp;lt;/button&amp;gt;&lt;br&gt;
                            &amp;lt;/div&amp;gt;&lt;br&gt;
                        &amp;lt;/div&amp;gt;&lt;br&gt;
                    &amp;lt;/form&amp;gt;&lt;br&gt;
                &amp;lt;/div&amp;gt;&lt;br&gt;
            &amp;lt;/div&amp;gt;&lt;br&gt;
        &amp;lt;/div&amp;gt;&lt;br&gt;
    &amp;lt;/section&amp;gt;&lt;br&gt;
    &amp;lt;section class="section"&amp;gt;&lt;br&gt;
        &amp;lt;div class="container"&amp;gt;&lt;br&gt;
            &amp;lt;div class="columns"&amp;gt;&lt;br&gt;
                &amp;lt;div class="column is-offset-4 is-4"&amp;gt;&lt;br&gt;
                    {% for weather in weather_data %}&lt;br&gt;
                    &amp;lt;div class="box"&amp;gt;&lt;br&gt;
                        &amp;lt;article class="media"&amp;gt;&lt;br&gt;
                            &amp;lt;div class="media-left"&amp;gt;&lt;br&gt;
                                &amp;lt;figure class="image is-50x50"&amp;gt;&lt;br&gt;
                                    &amp;lt;img src="http://openweathermap.org/img/w/{{ weather.icon }}.png" alt="Image"&amp;gt;&lt;br&gt;
                                &amp;lt;/figure&amp;gt;&lt;br&gt;
                            &amp;lt;/div&amp;gt;&lt;br&gt;
                            &amp;lt;div class="media-content"&amp;gt;&lt;br&gt;
                                &amp;lt;div class="content"&amp;gt;&lt;br&gt;
                                    &amp;lt;p&amp;gt;&lt;br&gt;
                                        &amp;lt;span class="title"&amp;gt;{{ weather.city }}&amp;lt;/span&amp;gt;&lt;br&gt;
                                        &amp;lt;br&amp;gt;&lt;br&gt;
                                        &amp;lt;span class="subtitle"&amp;gt;{{ weather.temperature }}° F&amp;lt;/span&amp;gt;&lt;br&gt;
                                        &amp;lt;br&amp;gt; {{ weather.description }}&lt;br&gt;
                                    &amp;lt;/p&amp;gt;&lt;br&gt;
                                &amp;lt;/div&amp;gt;&lt;br&gt;
                            &amp;lt;/div&amp;gt;&lt;br&gt;
                        &amp;lt;/article&amp;gt;&lt;br&gt;
                    &amp;lt;/div&amp;gt;&lt;br&gt;
                    {% endfor %}&lt;br&gt;
                &amp;lt;/div&amp;gt;&lt;br&gt;
            &amp;lt;/div&amp;gt;&lt;br&gt;
        &amp;lt;/div&amp;gt;&lt;br&gt;
    &amp;lt;/section&amp;gt;&lt;br&gt;
    &amp;lt;footer class="footer"&amp;gt;&lt;br&gt;
        &amp;lt;h2&amp;gt;Made by KDUAH of &amp;lt;a href="kdwebdeveloper.vercel.app"&amp;gt;PCkingpin INC&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;&lt;br&gt;
        &amp;lt;p&amp;gt;Contact Developer through duah229@gmail.com&amp;lt;/p&amp;gt;&lt;br&gt;
    &amp;lt;/footer&amp;gt;&lt;br&gt;
&amp;lt;/body&amp;gt;&lt;br&gt;
&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;With the creation of the template successful, we will create a view and with URL combination render this to be displayed in the app.&lt;/p&gt;

&lt;p&gt;Views in Django are either functions or classes. In this tutorial, we will be creating a simple function in our &lt;strong&gt;views.py&lt;/strong&gt; file.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;from django.shortcuts import render&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;def index(request):&lt;/code&gt;&lt;br&gt;
    &lt;code&gt;return render(request, 'weatherapp/index.html')&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Add the URL that will send the request to this view. At the app level, update the urlpatterns list.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;from django.urls import path&lt;br&gt;
from . import views&lt;br&gt;
urlpatterns = [&lt;br&gt;
    path('',views.index),&lt;br&gt;
]&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;This allows us to reference the view we just created.Django will route to the view function we just created.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Using the Open Weather API&lt;/strong&gt;&lt;br&gt;
Goto Open Weather Map API &lt;a href="https://openweathermap.org/api" rel="noopener noreferrer"&gt;Open Weather Map API&lt;/a&gt; and sign up.&lt;br&gt;
Confirm your email and click on your username, generate an API key.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fbcnpl85aign5jfsvszr6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fbcnpl85aign5jfsvszr6.png" alt="openweather api" width="800" height="333"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The endpoint we will use is written below and you can insert your generated API key to access the data. Note, it may take a few minutes for your API to become active.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;https://api.openweathermap.org/data/2.5/weather?q={}&amp;amp;units=imperial&amp;amp;appid=YOUR_API_KEY&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After that, let us install python requests which is what we will  use to access the data in our app with this command.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;pipenv install requests&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Let us update the views.py to send a request to the URL we have.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;from django.shortcuts import render&lt;br&gt;
import requests&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;p&gt;&lt;code&gt;def index(request):&lt;br&gt;
    url = 'http://api.openweathermap.org/data/2.5/weather?q={}&amp;amp;units=imperial&amp;amp;appid=YOUR_APP_KEY'&lt;br&gt;
    city = 'Las Vegas'&lt;br&gt;
    city_weather = requests.get(url.format(city)).json() #request the API data and convert the JSON to Python data types&lt;br&gt;
    return render(request, 'weather/index.html')&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;With those lines, we have added the URL that we will send requests to. We will make the part of the city a placholder for when users add their own cities.&lt;/p&gt;

&lt;p&gt;Finally, we will send the request to the URL using the city and get the JSON representation of that city. If we print that to the console we can see the same data we saw when we put the URL in our address bar.&lt;/p&gt;

&lt;p&gt;If you start your server again and reload the page, you’ll see the data get printed to your console.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Creating a Weather App in Django Using Python Requests&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Displaying the Data in the Template&lt;br&gt;
Next, we need to pass the data to the template so it can be displayed to the user.&lt;/p&gt;

&lt;p&gt;Let us create a dictionary to hold all of the data we need. Of the data returned to us, we need temp, description, and icon.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;def index(request):&lt;br&gt;
       weather = {&lt;br&gt;
         'city' : city,&lt;br&gt;
         'temperature' : city_weather['main']['temp'],&lt;br&gt;
         'description' : city_weather['weather'][0]['description'],&lt;br&gt;
         'icon' : city_weather['weather'][0]['icon']&lt;br&gt;
     }&lt;br&gt;
     return render(request, 'weather/index.html')&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Now that we all the information we want, we can pass that to the template. To pass it to the template, we’ll create a variable called context. This will be a dictionary that allows us to use its values inside of the template.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;def index(request):&lt;br&gt;
       context = {'weather' : weather}&lt;br&gt;
       return render(request, 'weather/index.html', context)&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;And then in render, we will add the context as the third argument.&lt;/p&gt;

&lt;p&gt;With the weather data added inside of context, lets go to the template to add the data.&lt;/p&gt;

&lt;p&gt;Inside of the template, all we need to do is modify the HTML to use variables instead of the values I typed in. Variables will use&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;{{ }}&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
 tags, and they will reference anything inside of your context dictionary.&lt;/p&gt;

&lt;p&gt;Note that Django converts dictionary keys so you can only access them using dot notation. For example, weather.city will give us the city name. We don’t use weather['city'] like we would in Python.&lt;/p&gt;

&lt;p&gt;And then in render, we will add the context as the third argument.&lt;/p&gt;

&lt;p&gt;With the weather data added inside of context, lets go to the template to add the data.&lt;/p&gt;

&lt;p&gt;Inside of the template, all we need to do is modify the HTML to use variables instead of the values I typed in. Variables will use&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;{{ }}&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
 tags, and they will reference anything inside of your context dictionary.&lt;/p&gt;

&lt;p&gt;Note that Django converts dictionary keys so you can only access them using dot notation. For example, weather.city will give us the city name. We don’t use weather['city'] like we would in Python.&lt;/p&gt;

&lt;p&gt;Find the box div, and update it to this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;div class="box"&amp;gt;&lt;br&gt;
    &amp;lt;article class="media"&amp;gt;&lt;br&gt;
        &amp;lt;div class="media-left"&amp;gt;&lt;br&gt;
            &amp;lt;figure class="image is-50x50"&amp;gt;&lt;br&gt;
                &amp;lt;img src="http://openweathermap.org/img/w/{{ weather.icon }}.png" alt="Image"&amp;gt;&lt;br&gt;
            &amp;lt;/figure&amp;gt;&lt;br&gt;
        &amp;lt;/div&amp;gt;&lt;br&gt;
        &amp;lt;div class="media-content"&amp;gt;&lt;br&gt;
            &amp;lt;div class="content"&amp;gt;&lt;br&gt;
                &amp;lt;p&amp;gt;&lt;br&gt;
                    &amp;lt;span class="title"&amp;gt;{{ weather.city }}&amp;lt;/span&amp;gt;&lt;br&gt;
                    &amp;lt;br&amp;gt;&lt;br&gt;
                    &amp;lt;span class="subtitle"&amp;gt;{{ weather.temperature }}° F&amp;lt;/span&amp;gt;&lt;br&gt;
                    &amp;lt;br&amp;gt; {{ weather.description }}&lt;br&gt;
                &amp;lt;/p&amp;gt;&lt;br&gt;
            &amp;lt;/div&amp;gt;&lt;br&gt;
        &amp;lt;/div&amp;gt;&lt;br&gt;
    &amp;lt;/article&amp;gt;&lt;br&gt;
&amp;lt;/div&amp;gt;&lt;/code&gt;`&lt;/p&gt;

&lt;p&gt;With all the variables replaced, we should now see the current weather for our city.&lt;/p&gt;

&lt;p&gt;Creating a Weather App in Django Using Python Requests&lt;/p&gt;

&lt;p&gt;Great! Now we can see the weather for one city, but we had to hard code the city. What we want to do now is pull from the database and show the cities that are in our database.&lt;/p&gt;

&lt;p&gt;To do that, we will create a table in our database to hold the cities that we want to know the weather for. We will create a model for this.&lt;/p&gt;

&lt;p&gt;Go to the &lt;strong&gt;models.py&lt;/strong&gt; in your weather app, and add the following:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;from django.db import models&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;class City(models.Model):&lt;br&gt;
    name = models.CharField(max_length=25)&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```def _str_(self): #show the actual city name on the dashboard
    return self.name```

```class Meta: #show the plural of city as cities instead of citys
    verbose_name_plural = 'cities'```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;This will create a table in our database that will have a column called name, which is the name of the city. This city will be a charfield, which is just a string.&lt;/p&gt;

&lt;p&gt;To get these changes in the database, we have to run makemigrations to generate the code to update the database and migrate to apply those changes. Here are the commands&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;python manage.py makemigrations&lt;br&gt;
python manage.py migrate&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;We need to make it to where we can see this model on our admin dashboard. To do that, we need to register it in our admin.py file.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;from django.contrib import admin&lt;br&gt;
from .models import City&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;admin.site.register(City)&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You’ll see the city as an option on the admin dashboard.&lt;/p&gt;

&lt;p&gt;Creating a Weather App in Django Using Python Requests&lt;/p&gt;

&lt;p&gt;We can then go into the admin dashboard and add some cities. I will start with three: London, Tokyo, and Las Vegas.&lt;/p&gt;

&lt;p&gt;Creating a Weather App&lt;/p&gt;

&lt;p&gt;With the entries in the database, we need to query these entries in our view. Start by importing the City model and then querying that model for all objects.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;from django.shortcuts import render&lt;br&gt;
import requests&lt;br&gt;
from .models import City&lt;/code&gt;&lt;code&gt;&lt;/code&gt;`&lt;/p&gt;

&lt;p&gt;&lt;code&gt;`def index(request):&lt;br&gt;
    url = 'http://api.openweathermap.org/data/2.5/weather?q={}&amp;amp;units=imperial&amp;amp;appid=YOUR_APP_KEY'&lt;br&gt;
    cities = City.objects.all()`&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Since we have the list of cities, we want to loop over them and get the weather for each one and add it to a list that will eventually be passed to the template.&lt;/p&gt;

&lt;p&gt;This will just a variation of what we did in the first case. The other difference is we are looping and appending each dictionary to a list. We will remove the original city variable in favor a city variable in the loop.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;`def index(request):&lt;br&gt;
    weather_data = []`&lt;/code&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`for city in cities:`

    ```city_weather = requests.get(url.format(city)).json() #request the API data and convert the JSON to Python data types```

    ```weather = {
        'city' : city,
        'temperature' : city_weather['main']['temp'],
        'description' : city_weather['weather'][0]['description'],
        'icon' : city_weather['weather'][0]['icon']
    }```

    ```weather_data.append(weather)```

```context = {'weather_data' : weather_data}```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Cool, so we have the data. Now let’s update the context to pass this list instead of a single dictionary.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`context = {'weather_data' : weather_data}`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Next, inside of the template, we need to loop over this list and generate the HTML for each city in the list. To do this, we can put a for loop around the HTML that generates a single box for the city.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;`&amp;lt;div class="column is-offset-4 is-4"&amp;gt;&lt;br&gt;
    {% for weather in weather_data %}&lt;br&gt;
    &amp;lt;div class="box"&amp;gt;&lt;br&gt;
        &amp;lt;article class="media"&amp;gt;&lt;br&gt;
            &amp;lt;div class="media-left"&amp;gt;&lt;br&gt;
                &amp;lt;figure class="image is-50x50"&amp;gt;&lt;br&gt;
                    &amp;lt;img src="http://openweathermap.org/img/w/{{ weather.icon }}.png" alt="Image"&amp;gt;&lt;br&gt;
                &amp;lt;/figure&amp;gt;&lt;br&gt;
            &amp;lt;/div&amp;gt;&lt;br&gt;
            &amp;lt;div class="media-content"&amp;gt;&lt;br&gt;
                &amp;lt;div class="content"&amp;gt;&lt;br&gt;
                    &amp;lt;p&amp;gt;&lt;br&gt;
                        &amp;lt;span class="title"&amp;gt;{{ weather.city }}&amp;lt;/span&amp;gt;&lt;br&gt;
                        &amp;lt;br&amp;gt;&lt;br&gt;
                        &amp;lt;span class="subtitle"&amp;gt;{{ weather.temperature }}° F&amp;lt;/span&amp;gt;&lt;br&gt;
                        &amp;lt;br&amp;gt; {{ weather.description }}&lt;br&gt;
                    &amp;lt;/p&amp;gt;&lt;br&gt;
                &amp;lt;/div&amp;gt;&lt;br&gt;
            &amp;lt;/div&amp;gt;&lt;br&gt;
        &amp;lt;/article&amp;gt;&lt;br&gt;
    &amp;lt;/div&amp;gt;&lt;br&gt;
    {% endfor %}&lt;br&gt;
&amp;lt;/div&amp;gt;`&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Awesome! Now we can see the data for all the cities we have in the database.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Creating the Form&lt;/strong&gt;&lt;br&gt;
The last thing we want to do is allow the user to add a city directly in the form.&lt;/p&gt;

&lt;p&gt;To do that, we need to create a form. We could create the form directly, but since our form will have exactly the same field as our model, we can use a ModelForm.&lt;/p&gt;

&lt;p&gt;Create a new file called forms.py.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;`from django.forms import ModelForm, TextInput&lt;br&gt;
from . models import City`&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;`class CityForm(ModelForm):&lt;br&gt;
    class Meta:&lt;br&gt;
        model = City&lt;br&gt;
        fields = ['name']&lt;br&gt;
        widgets = {&lt;br&gt;
            'name': TextInput(attrs={'class' : 'input', 'placeholder' : 'City Name'}),&lt;br&gt;
        }`&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To do that, lets update the index video to create the form. We will replace the old city variable at the same time since we no longer need it. We also need to update the context so the form gets passed to the template.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;`def index(request):&lt;br&gt;
    form = CityForm()`&lt;/code&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```weather_data = []```
```context = {'weather_data' : weather_data, 'form' : form}```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now in the template, let’s update the form section to use the form from our view and a csrf_token, which is necessary for POST requests in Django.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;`&amp;lt;form method="POST"&amp;gt;&lt;br&gt;
    {% csrf_token %}&lt;br&gt;
    &amp;lt;div class="field has-addons"&amp;gt;&lt;br&gt;
        &amp;lt;div class="control is-expanded"&amp;gt;&lt;br&gt;
            {{ form.name }}&lt;br&gt;
        &amp;lt;/div&amp;gt;&lt;br&gt;
        &amp;lt;div class="control"&amp;gt;&lt;br&gt;
            &amp;lt;button class="button is-info"&amp;gt;&lt;br&gt;
                Add City&lt;br&gt;
            &amp;lt;/button&amp;gt;&lt;br&gt;
        &amp;lt;/div&amp;gt;&lt;br&gt;
    &amp;lt;/div&amp;gt;&lt;br&gt;
&amp;lt;/form&amp;gt;`&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;With the form in our HTML working, we now need to handle the form data as it comes in. For that, we’ll create an if block checking for a POST request. We need to add the check for the type of request before we start grabbing the weather data so we immediately get the data for the city we add.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;`def index(request):&lt;br&gt;
    cities = City.objects.all() #return all the cities in the database`&lt;/code&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```url = 'http://api.openweathermap.org/data/2.5/weather?q={}&amp;amp;units=imperial&amp;amp;appid=YOUR_APP_KEY'```

```if request.method == 'POST': # only true if form is submitted
    form = CityForm(request.POST) # add actual request data to form for processing
    form.save()```

```form = CityForm()```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;By passing request.POST, we will be able to validate the form data.&lt;/p&gt;

&lt;p&gt;Now you should be able to type in the name of a city, click add, and see it show up. I’ll add Miami as the next city.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Creating a Weather App in Django&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When we drop out of the if block, the form will be recreated so we can add another city if we choose. The rest of the code will behave in the same way.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F4gl8ymhtpjgkw5rkje8c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F4gl8ymhtpjgkw5rkje8c.png" alt="VSCODE DEMO" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this article, we had to work with various parts of Django to get this working: views, models, forms, and templates. We also had to use the Python library requests to get the actual weather data. So even though the app is simple, you will use many of the same concepts in apps with more complexity.&lt;/p&gt;

&lt;p&gt;Here is a link to the project in github:&lt;br&gt;
&lt;a href="https://github.com/Kalderon-Sheikhman/Weather-App-Django" rel="noopener noreferrer"&gt;Github&lt;/a&gt;&lt;br&gt;
Feel free to clone and modify.&lt;/p&gt;

</description>
      <category>python</category>
      <category>django</category>
      <category>openweather</category>
      <category>api</category>
    </item>
    <item>
      <title>LAMP STACK</title>
      <dc:creator>Kwaku Duah</dc:creator>
      <pubDate>Mon, 24 Apr 2023 22:44:19 +0000</pubDate>
      <link>https://dev.to/thekalderon/lamp-stack-12jg</link>
      <guid>https://dev.to/thekalderon/lamp-stack-12jg</guid>
      <description>&lt;p&gt;Website design is at an all time high since the internet brigdes the gap between the world. In the past, making websites were reserved for those with high IQ's.Presently, there are so many tools and frameworks that have made it easier.&lt;/p&gt;

&lt;p&gt;Frameworks like ReactJS, VueJS, AngularJS provide a structure within which developers are supposed to build removing the redundant work developers do everytime.&lt;br&gt;
ReactJS was made by Facebook now Meta in 2011 and it gained popularity around 2013.&lt;br&gt;
A major feature it had was the possibility to work on the DOM(Document 0bject Module) intra the framework before rendering to the webpage. Moreover, SPA (Songle Page Applications) which means resources loaded as and when needed improved user experience.&lt;/p&gt;

&lt;p&gt;The aformentioned frameworks almost perform the same tasks. There is wordpress which has the backend written in PHP and it is flexible as it allows developers to tweak themes and add plugins to build full stack web applications in the minimum possible time.LAMP stack as it is called represents Linux, Apache, MySQL and PHP.&lt;/p&gt;

&lt;p&gt;Installing wordpress on a linux machine:&lt;br&gt;
a) &lt;code&gt;sudo apt-get install apache2&lt;/code&gt;&lt;br&gt;
b) &lt;code&gt;sudo apt-get install mysql-server&lt;/code&gt;&lt;br&gt;
c)&lt;code&gt;sudo apt-get install php&lt;/code&gt;&lt;br&gt;
This is a MD and ....&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;``&lt;/li&gt;
&lt;/ol&gt;

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