<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Saqiba Juna on Medium]]></title>
        <description><![CDATA[Stories by Saqiba Juna on Medium]]></description>
        <link>https://medium.com/@saqibajuna?source=rss-fc3bbc373676------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*10yZcL_vhz-iQngk</url>
            <title>Stories by Saqiba Juna on Medium</title>
            <link>https://medium.com/@saqibajuna?source=rss-fc3bbc373676------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 18:57:06 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@saqibajuna/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Shopify API Integration Using FastAPI, MongoDB and Streamlit]]></title>
            <link>https://medium.com/@saqibajuna/shopify-api-integration-using-fastapi-mongodb-and-streamlit-0fb7e60d811d?source=rss-fc3bbc373676------2</link>
            <guid isPermaLink="false">https://medium.com/p/0fb7e60d811d</guid>
            <dc:creator><![CDATA[Saqiba Juna]]></dc:creator>
            <pubDate>Sun, 26 Jan 2025 18:31:43 GMT</pubDate>
            <atom:updated>2025-01-26T18:34:00.193Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*5azAYfagp7Mqgyqk4IcGGQ.png" /></figure><h3>Introduction</h3><p>Integrating Shopify with modern web frameworks can be challenging, but it unlocks immense potential for automating order management, building dashboards, and creating seamless workflows. This blog demonstrates how to integrate Shopify APIs using <strong>FastAPI</strong> for backend API handling and <strong>Streamlit</strong> for creating a user-friendly dashboard to visualize Shopify data in real-time.</p><h3>Why FastAPI and Streamlit?</h3><ul><li><strong>FastAPI</strong>: Known for its high performance, ease of use, and strong typing, FastAPI is perfect for building RESTful APIs that handle Shopify order data efficiently.</li><li><strong>Streamlit</strong>: This framework enables you to create interactive dashboards with minimal code, making data exploration and visualization straightforward.</li></ul><p>Combining these two frameworks ensures a robust solution for managing and analyzing Shopify data.</p><h3>Key Features</h3><p><strong>Fetch Shopify Orders</strong>:</p><ul><li>Pull all orders using Shopify APIs and store the data in a <strong>MongoDB</strong> database for persistent storage.</li></ul><p><strong>Interactive Dashboard</strong>:</p><ul><li>Use <strong>Streamlit</strong> to display Shopify orders and generate insights from the data.</li></ul><p><strong>Scalable Architecture</strong>:</p><ul><li>Separation of concerns: FastAPI handles the backend logic, while Streamlit focuses on frontend visualization.</li></ul><h3>Architecture Overview</h3><p>The application consists of the following components:</p><p><strong>FastAPI Backend</strong>:</p><ul><li>Manages API integrations and communicates with Shopify and MongoDB.</li></ul><p><strong>MongoDB</strong>:</p><ul><li>Stores the Shopify order data.</li></ul><p><strong>Streamlit Frontend</strong>:</p><ul><li>Visualizes the stored data interactively</li></ul><h3>Step-by-Step Implementation</h3><p>For code repository: <a href="https://github.com/saqiba123/shopify-app-using-fastapi-and-streamlit">Link</a></p><h4>1. Set Up the Environment</h4><ul><li>Install dependencies:</li><li>pip install fastapi uvicorn streamlit pymongo python-dotenv</li><li>Create a .env file to store environment variables for:</li><li>Shopify API credentials</li><li>MongoDB connection string</li></ul><h4>2. Build the FastAPI Application</h4><ul><li><strong>main.py</strong>: FastAPI entry point to handle API routes.</li><li><strong>shopify_controller.py</strong>: Implements endpoints to fetch Shopify orders and save them to MongoDB.</li><li><strong>shopify_service.py</strong>: Encapsulates the business logic, including Shopify API calls and data transformations.</li></ul><h4>3. Develop the Streamlit Dashboard</h4><ul><li><strong>streamlit_dashboard.py</strong>: Fetches data from MongoDB and displays it interactively.</li></ul><h3>Running the Application</h3><ol><li>Start the FastAPI server:</li></ol><ul><li>uvicorn main:app --reload</li></ul><ol><li>Run the Streamlit dashboard:</li></ol><ul><li>streamlit run streamlit_dashboard.py</li></ul><h3>Results</h3><ul><li><strong>API Performance</strong>: FastAPI ensures rapid order retrieval and data storage.</li><li><strong>Interactive Dashboard</strong>: Streamlit allows non-technical users to explore Shopify order data visually.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M_WZixbLNAH_UxLbLmXBqQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rahcFFvvhe2juVTlNEyuhQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0gGtj-JV92pg_IguRwp76g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E-yCEos6_86GeYWw-6l1Ow.png" /></figure><h3>Conclusion</h3><p>This mini-project demonstrates how to efficiently integrate Shopify APIs with FastAPI and visualize the data using Streamlit. By separating backend logic from frontend visualization, the architecture remains clean, scalable, and easy to maintain.</p><p>Feel free to extend this application by adding advanced analytics, notifications, or user authentication for more robust use cases.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0fb7e60d811d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[YAML & TOML: What Needs to Know for Configurations Files]]></title>
            <link>https://medium.com/@saqibajuna/yaml-toml-what-needs-to-know-for-configurations-files-f6a64f710295?source=rss-fc3bbc373676------2</link>
            <guid isPermaLink="false">https://medium.com/p/f6a64f710295</guid>
            <dc:creator><![CDATA[Saqiba Juna]]></dc:creator>
            <pubDate>Mon, 13 Jan 2025 13:19:32 GMT</pubDate>
            <atom:updated>2025-01-13T13:19:32.567Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*j0zjos_RPRdZbsocY2RHEg.png" /></figure><p>In the world of software development, managing configurations effectively is critical, especially when building scalable systems, APIs, and tools. While YAML (YAML Ain’t Markup Language) has been a long-standing favourite for configuration files, TOML (Tom’s Obvious, Minimal Language) has emerged as a strong contender, particularly in languages like Rust, Python, and Go. With TOML’s growing popularity — partly thanks to its use in <strong>Cargo</strong>, Rust’s package manager — developers are often confused about when to use YAML versus TOML.</p><h3>When to Use YAML</h3><p>YAML is highly flexible, making it suitable for complex configurations with deep hierarchies. If your application requires structured data like dictionaries, lists, and nested values, YAML is the better choice. Its flexibility, however, can lead to errors (e.g., improper indentation) and make it harder to debug.</p><h4>Best Use Cases for YAML:</h4><ul><li><strong>CI/CD Pipelines</strong>: YAML is widely used in tools like GitHub Actions, GitLab CI/CD, and CircleCI due to its ability to represent complex workflows.</li><li><strong>Kubernetes Configurations</strong>: YAML excels in defining Kubernetes manifests like deployments and services.</li><li><strong>Data with Nested Structures</strong>: Applications requiring multi-level configurations, such as application settings in frameworks like Django.</li><li><strong>Localization of the status Messages:</strong> Localization is a powerful way to centralize and standardize error and success messages in your applications.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*W1BFAcS0rdAJ76UzXDOOBA.png" /></figure><h3>When to Use TOML</h3><p>TOML is designed to be simple and unambiguous, making it ideal for smaller configurations with fewer nested structures. It shines when you need strict typing and a straightforward syntax that avoids YAML’s ambiguity. TOML’s simplicity has made it a preferred choice for configuration management in modern tools like Rust’s <strong>Cargo</strong>, Python’s <strong>Poetry</strong>, and Go’s libraries.</p><h4>Best Use Cases for TOML:</h4><ul><li><strong>Rust Projects</strong>: Rust uses TOML natively in its Cargo.toml file for dependency and project configuration.</li><li><strong>Package Managers</strong>: Tools like Python’s Poetry use TOML for dependency management, ensuring minimal errors.</li></ul><p>Rust Cargo Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*HicWowWd7EEoL_MJV9BfeQ.png" /></figure><h3>Key Challenges Developers Face</h3><ol><li><strong>Overengineering with YAML</strong>: Developers often misuse YAML for simple configurations, resulting in overly complex and error-prone files. For example, defining deeply nested settings for a CLI tool when a simple key-value structure in TOML would suffice.</li><li><strong>Lack of Strictness in YAML</strong>: YAML’s permissiveness can lead to hard-to-diagnose errors (e.g., accidental tab usage or ambiguous syntax). TOML enforces strict formatting, reducing such issues.</li><li><strong>Limited Awareness of TOML</strong>: Many developers default to YAML because of familiarity, even when TOML is a better fit for the task. Rust developers, in particular, often prefer TOML for its native ecosystem support.</li></ol><h4>Here’s a quick guide to help you decide:</h4><h4>Use <strong>YAML</strong> if:</h4><ul><li>Your configurations are deeply nested or hierarchical.</li><li>You’re working with tools that natively support YAML (e.g., Kubernetes, CI/CD pipelines).</li><li>You need a human-readable configuration for non-developers.</li></ul><h4>Use <strong>TOML</strong> if:</h4><ul><li>Your project is written in Rust, Python or relies on tools like Poetry or Cargo.</li><li>You prefer stricter syntax to avoid ambiguity.</li><li>Your configuration is simple and doesn’t require nesting.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f6a64f710295" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Connect Redis to Django for Caching Data]]></title>
            <link>https://medium.com/@saqibajuna/how-to-connect-redis-to-django-for-caching-data-0ca0bea97d72?source=rss-fc3bbc373676------2</link>
            <guid isPermaLink="false">https://medium.com/p/0ca0bea97d72</guid>
            <category><![CDATA[django]]></category>
            <category><![CDATA[cache]]></category>
            <category><![CDATA[redis]]></category>
            <dc:creator><![CDATA[Saqiba Juna]]></dc:creator>
            <pubDate>Thu, 21 Nov 2024 14:13:02 GMT</pubDate>
            <atom:updated>2024-11-21T14:20:50.144Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/955/1*P3KT_IbuldqOTd1tkoZwgw.png" /></figure><p>Redis is a powerful, in-memory key-value store commonly used for caching, session storage, and real-time data processing. Integrating Redis with Django enhances application performance by reducing database queries and latency.</p><h3>Why Redis Is Needed? — Use Cases</h3><h4>1. Caching</h4><p>Redis caches frequently accessed data, such as API responses or database query results, in memory, making data retrieval nearly instant.<br><strong>Example</strong>: Storing product data for an e-commerce site to reduce repeated database queries.</p><h4>2. Session Storage</h4><p>Redis is a popular alternative to default database-backed session storage due to its speed and ability to handle large-scale, concurrent requests.<br><strong>Example</strong>: Storing user session tokens for authentication in a high-traffic web application.</p><h4>3. Real-Time Applications</h4><p>Redis excels in real-time systems requiring low-latency operations.<br><strong>Example</strong>: Tracking live chat messages or updating a leaderboard in real-time.</p><h4>4. Rate Limiting</h4><p>Redis can be used to implement rate-limiting mechanisms for APIs.<br><strong>Example</strong>: Restricting users to 100 requests per hour.</p><h3><strong>Installation of Redis</strong></h3><blockquote>You can install Redis on your local machine by following the official <a href="https://redis.io/docs/latest/operate/oss_and_stack/install/install-redis/">Redis installation guide</a>.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*koBXJInznHRia31NPyrMiw.png" /></figure><h3><strong>Integrating Redis to Django project</strong></h3><p>To connect Django with Redis, we’ll use the django-redis library, which simplifies interaction with Redis as a Django cache backend.</p><h4>Step 1: Install django-redis</h4><blockquote>pip install django-redis</blockquote><h4>Step 2: Configure Django for Redis</h4><p>Update your settings.py file to use Redis as the caching backend:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QJM6qHlnUSd5F0YfAe41cw.png" /></figure><h4>Step 3: Using Redis for Caching in Django</h4><p>Here’s a Django view that fetches data from Redis if available, or from the database otherwise:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1UsVtTkspfrvC_Qx5t2DXw.png" /></figure><h4>Step 4: Verify the Cache in Redis CLI</h4><p>Run the Django server and load the view. Check Redis to verify the data is cached:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*B1UWTsWBIXO23Wnv5TgMjQ.png" /></figure><h3>Why Redis is a Game-Changer for Django</h3><ul><li><strong>Speed</strong>: In-memory storage makes Redis blazingly fast compared to traditional databases.</li><li><strong>Scalability</strong>: Redis handles thousands of operations per second, making it ideal for high-traffic applications.</li><li><strong>Flexibility</strong>: Supports diverse data structures like strings, lists, hashes, and sets, enabling complex use cases.</li><li><strong>Ease of Use</strong>: django-redis provides a seamless way to integrate Redis into Django projects.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0ca0bea97d72" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MongoDB Cloud Connection and API Data Integration]]></title>
            <link>https://medium.com/@saqibajuna/mongodb-cloud-connection-and-api-data-integration-e058b580e3f9?source=rss-fc3bbc373676------2</link>
            <guid isPermaLink="false">https://medium.com/p/e058b580e3f9</guid>
            <dc:creator><![CDATA[Saqiba Juna]]></dc:creator>
            <pubDate>Fri, 23 Aug 2024 23:33:51 GMT</pubDate>
            <atom:updated>2024-08-23T23:33:51.982Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*tZA97GCl6TzXc30Qe9Qhww.png" /></figure><p>In today’s data-driven world, seamlessly integrating data from various sources into a robust database is crucial for developing scalable and efficient applications. In this guide, we’ll walk through the process of connecting to MongoDB Cloud and using a dummy API to store data, offering a practical example to illustrate these concepts.</p><h4><strong>MongoDB Atlas Account</strong></h4><p>MongoDB Atlas provides a fully managed cloud database service that makes it easy to set up, operate, and scale MongoDB deployments.</p><h4>Why MongoDB Atlas?</h4><p>MongoDB Atlas is a fully-managed cloud database service that provides high availability, scalability, and security. It offers a free tier that includes 512 MB of storage, making it perfect for small projects or learning purposes. With Atlas, you don’t have to worry about managing the underlying infrastructure, allowing you to focus on building your application. Click here to create free account <a href="https://account.mongodb.com/account/login?_ga=2.18283513.197895119.1724454124-2053420921.1724454124">Link</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E1r-edXWIaEOiTdXWcVtVg.png" /></figure><h4><strong>Python Environment</strong></h4><p>Ensure you have Python installed on your machine along with the required libraries. We’ll be using pymongo for MongoDB interactions and requests for API calls.</p><blockquote>pip install pymongo requests python-dotenv</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j1hRyDqNt_AAsVl7kd27uw.png" /></figure><h3>Step 1: Connecting to MongoDB Cloud</h3><p>To connect to MongoDB Cloud, we’ll use the pymongo library. Start by creating a Python function to establish a connection to your MongoDB instance. Here’s a sample function and sample mongodb url:</p><blockquote>Mongodb_url : mongodb+srv://username:password@cluster0.mongodb.net/</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VEfK5qYeHJGkrDtcMNBT0g.png" /></figure><p>In this code:</p><ul><li>We use load_dotenv() to load environment variables from a .env file.</li><li>connect_to_mongodb() connects to the MongoDB instance using the connection string retrieved from environment variables.</li></ul><h3>Step 2: Fetching Data from a Dummy API</h3><p>We’ll use the requests library to fetch data from a dummy API. For this example, we’ll use <a href="https://jsonplaceholder.typicode.com/">JSONPlaceholder</a>, a free fake online REST API that can be used for testing and prototyping.</p><h3>Step 3: Storing Data in MongoDB</h3><p>Once we have the data, we need to store it in our MongoDB collection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/927/1*YQfQDnGrwZNWSJRg6DHoEg.png" /></figure><p>In this code:</p><ul><li>fetch_and_store_data() combines the steps of connecting to MongoDB, fetching data from the API, and inserting the data into the database.</li><li>We handle potential exceptions that might occur during data insertion and store data successfully.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3qOYX0PabXnXPNCw6aZ0pw.png" /></figure><h3>Conclusion</h3><p>Integrating MongoDB Cloud with an API is a powerful way to manage and store data for your applications. By following this guide, you’ve learned how to connect to a MongoDB Cloud instance, fetch data from a dummy API, and store it efficiently. This process can be adapted for various real-world scenarios, enhancing your data management strategies.</p><p>Happy Learning!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e058b580e3f9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Docker: Getting Started with Core Commands]]></title>
            <link>https://medium.com/@saqibajuna/docker-getting-started-with-core-commands-d79308ee5534?source=rss-fc3bbc373676------2</link>
            <guid isPermaLink="false">https://medium.com/p/d79308ee5534</guid>
            <dc:creator><![CDATA[Saqiba Juna]]></dc:creator>
            <pubDate>Fri, 05 Jul 2024 04:36:32 GMT</pubDate>
            <atom:updated>2024-07-05T04:36:32.092Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-82uJTsu32irO8-J-A7bgQ.png" /></figure><h3>Introduction</h3><p>Docker is an open-source platform that uses containerization to enable developers to package applications along with their dependencies and environment into a single, portable container. This ensures that the application behaves the same, regardless of where it is deployed.</p><h4>Containers</h4><p>Containers are isolated environments that run applications along with all their dependencies, ensuring that they work seamlessly across different environments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xrfZmyg7dm_WNIV6" /></figure><h4>Docker Image</h4><p>A Docker image is a read-only template that contains a set of instructions for creating a container. It includes the application code, libraries, environment variables, and other configuration files. Images are used to create and run Docker containers. They can be stored in repositories such as Docker Hub for easy distribution and sharing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5U0s6KpCGoo-X3BV" /></figure><h3>Installing Docker</h3><p>Docker can be installed on various operating systems, including Windows, macOS, and Linux. Download Link: <a href="https://www.docker.com/products/docker-desktop/">Docker</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FfApocEQ2076dhW9HVqLEw.png" /></figure><p>Here are the basic steps to install Docker:</p><h4>On Windows</h4><ol><li><strong>Download Docker Desktop</strong>: Go to the Docker Hub and download Docker Desktop for Windows.</li><li><strong>Install Docker Desktop</strong>: Run the installer and follow the instructions.</li><li><strong>Start Docker Desktop</strong>: After installation, launch Docker Desktop from the Start menu.</li></ol><h4>On macOS</h4><ol><li><strong>Download Docker Desktop</strong>: Visit the Docker Hub and download Docker Desktop for Mac.</li><li><strong>Install Docker Desktop</strong>: Open the downloaded .dmg file and drag the Docker icon to the Applications folder.</li><li><strong>Start Docker Desktop</strong>: Launch Docker from the Applications folder.</li></ol><h3>Basic Docker Commands</h3><h4>Checking Docker Installation</h4><ul><li>To check if Docker is running on your system, first open up then docker desktop and open your terminal you can use the following command:</li></ul><pre>docker ps</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*hemStG6Hu7kj8YAW9qTPCw.png" /></figure><ul><li>To check the Docker version, use:</li></ul><pre>docker -v</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*QJ4N_UC-RE8kB-M-JFncVg.png" /></figure><h4>Running an Ubuntu Container</h4><ul><li>To run an interactive Ubuntu container, initially it will download the image after then it will run use the following command:</li></ul><pre>docker run -it ubuntu</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hUXg3_RlBpa6i8P5ZEgY7A.png" /></figure><h4>Listing Containers</h4><ul><li>To list all active containers, use:</li></ul><pre>docker container ls</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ux3-OliPSEW-rCu41wE64w.png" /></figure><ul><li>To list all containers (both running and stopped), use:</li></ul><pre>docker container ls -a</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S-NeHOZ9wkhqLyO_QNt5XQ.png" /></figure><h4>Starting and Stopping Containers</h4><ul><li>To start a container that has been stopped, use:</li></ul><pre>docker start container_name<br>for example:<br>docker start optimistic_stonebraker</pre><ul><li>To stop a running container, use:</li></ul><pre>docker stop container_name<br>for example:<br>docker stop optimistic_stonebraker</pre><h4>Executing Commands in a Running Container</h4><ul><li>To execute a command inside a running container, use:</li></ul><pre>docker exec container_name command_name</pre><ul><li>For example, to list files in a container:</li></ul><pre>docker exec container_name ls</pre><ul><li>To open an interactive bash shell inside a running container, use:</li></ul><pre>docker exec -it container_name bash</pre><h4>Managing Docker Images</h4><ul><li>To list all Docker images, use:</li></ul><pre>docker images Or docker image ls</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oo1z2PCWvrWcqKcc9Cmc0Q.png" /></figure><ul><li>To pull and run an image, use:</li></ul><pre>docker run -it image_name</pre><h4>Port Mapping</h4><p>When you run a containerized application, you might want to expose its ports to the host system. For example, if you have a Node.js app running on port 3000 inside the container and a Python app on port 8000, you can map these to different ports on the host.</p><ul><li>To run a container with port mapping, use:</li></ul><pre>docker run -it -p host_port:container_port image_name</pre><p>For example:</p><pre>docker run -it -p 8081:8000 python</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/0*tdYbkRzLQtAPzK4c" /></figure><h4>Environment Variables</h4><ul><li>To pass environment variables to a container, use:</li></ul><pre>docker run -it -p host_port:container_port -e key=value image_name</pre><p>For example:</p><pre>docker run -it -p 8080:8080 -e email=&quot;yourname@gmail.com&quot; -e password=&quot;xyz3311&quot; python</pre><h4>Creating a Node.js Application with Docker</h4><p>To create a Node.js application in Visual Studio Code, start by opening VSCode and creating a new project folder. Initialize the project by running npm init in the terminal to generate a package.json file. Next, create a main.js file and write your Node.js code. Install any necessary dependencies, such as Express, by running npm install.</p><h4>Step 1: Initialize a Node.js Application</h4><ul><li>First, create a package.json file:</li></ul><pre>npm init</pre><ul><li>Then, install Express:</li></ul><pre>npm i express</pre><ul><li>Create a main.js file and add your application code.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FJG8AFPo52FrYwUI-Hs9Dg.png" /></figure><h4>Step 2: Create a Dockerfile</h4><p>A Dockerfile is a script containing instructions on how to build a Docker image. Create a Dockerfile (without any extension) with the following content:</p><pre>FROM ubuntu</pre><pre>RUN apt-get update</pre><pre>RUN apt-get install -y curl</pre><pre>RUN apt-get upgrade -y</pre><pre>RUN curl -sL https://deb.nodesource.com/setup_20.x | bash -</pre><pre>RUN apt-get install -y nodejs</pre><pre>COPY package.json package.json</pre><pre>COPY package-lock.json package-lock.json</pre><pre>COPY main.js main.js</pre><pre>RUN npm install</pre><pre>ENTRYPOINT [ &quot;node&quot;,&quot;main.js&quot; ]</pre><ul><li><strong>Environment Setup</strong>: Start with an Ubuntu image, update and upgrade packages, and install curl.</li><li><strong>Install Node.js</strong>: Download and set up Node.js version 20, then install it.</li><li><strong>Prepare &amp; Run App</strong>: Copy application files, install dependencies, and set the entry point to run the app with Node.js.</li></ul><h4>Step 3: Build the Docker Image</h4><p>Navigate to your project directory and build the Docker image:</p><pre>docker build -t your-image-name .</pre><p>This command creates a local Docker image that you can see in Docker Desktop.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*GPiC3xnfzNLzfD5EsrluHA.png" /></figure><h4>Step 4: Run the Docker Container</h4><p>To run your newly created Docker image, use:</p><pre>docker run -it your-image-name</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/0*4-1w34dmcJkp_sRU" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gdopiQaEYDjr3D1f" /></figure><h4>Conclusion</h4><p>This is a basic introduction to Docker and demonstrates how to use it to containerize a simple Node.js application. Docker is a powerful tool that simplifies the process of deploying and managing applications, ensuring consistency across different environments. For more advanced usage, you can explore Docker’s extensive documentation and features.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d79308ee5534" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How To Interact With SOAP API Using Python]]></title>
            <link>https://medium.com/@saqibajuna/how-to-interact-with-soap-api-using-python-1bfb2d35253b?source=rss-fc3bbc373676------2</link>
            <guid isPermaLink="false">https://medium.com/p/1bfb2d35253b</guid>
            <dc:creator><![CDATA[Saqiba Juna]]></dc:creator>
            <pubDate>Sat, 01 Jun 2024 19:48:14 GMT</pubDate>
            <atom:updated>2024-06-01T19:48:14.370Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Iutb91As0AkWLrNyv6aGIQ.png" /></figure><p>SOAP (Simple Object Access Protocol) may seem outdated compared to today’s RESTful APIs, but it’s still a strong and reliable protocol for web services, especially in businesses. This guide will show you how to use Python and the zeep library to interact with a SOAP API, specifically the CountryInfoService, a public SOAP service. Here’s the WSDL link.</p><pre>http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL</pre><h3>Why Use SOAP?</h3><p>SOAP is a protocol for structured information exchange in web services, offering a standardized messaging format. Unlike REST, SOAP is not just a style but a defined protocol. It’s favored for its strong security, transaction support, and ACID compliance, making it ideal for enterprise applications where these features are essential.</p><h3>SOAP vs. RESTful APIs</h3><p>While both SOAP and RESTful APIs facilitate communication between client and server, they have distinct differences:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W45IiK5ZQ8epJ0jIQoVX8w.png" /></figure><h3>Python library : zeep</h3><p>zeep is a Python library that makes it easy to interact with SOAP services. It provides a high-level API to access web services described by WSDL (Web Services Description Language).</p><h3>Installation</h3><p>First, ensure you have Python installed. You’ll also need the zeep library, which you can install via pip:</p><pre>pip install zeep</pre><h3>Setting Up the Client</h3><p>To start, we need to create a client to interact with the SOAP service. Here’s how you set it up:</p><pre>from zeep import Client<br>wsdl = &#39;http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL&#39;<br>client = Client(wsdl)</pre><p>This initializes the client with the WSDL URL of the CountryInfoService.</p><h3>Listing Available Operations</h3><p>Before making requests, it’s useful to know what operations are available. You can list all operations provided by the service with the following function:</p><pre>def ListOfOperations():<br>    for name, service in client.wsdl.services.items():<br>        print(f&quot;Service Name: {name}&quot;)<br>        for port in service.ports.values():<br>            print(f&quot; Port: {port.name}&quot;)<br>            for operation in port.binding._operations.values():<br>                print(f&quot;    Operation: {operation.name}&quot;)</pre><pre>ListOfOperations()</pre><pre>Output:<br>Service Name:CountryInfoService<br> port: Port: CountryInfoServiceSoap (Soap11Binding: {http://www.oorsprong.org/websamples.countryinfo}CountryInfoServiceSoapBinding)<br>    Operation: ListOfContinentsByName<br>    Operation: ListOfContinentsByCode<br>    Operation: ListOfCurrenciesByName<br>    Operation: ListOfCurrenciesByCode<br>    Operation: CurrencyName<br>    Operation: ListOfCountryNamesByCode<br>    Operation: ListOfCountryNamesByName<br>    Operation: ListOfCountryNamesGroupedByContinent<br>    Operation: CountryName<br>    Operation: CountryISOCode<br>    Operation: CapitalCity<br>    Operation: CountryCurrency<br>    Operation: CountryFlag<br>    Operation: CountryIntPhoneCode<br>    Operation: FullCountryInfo<br>    Operation: FullCountryInfoAllCountries<br>    Operation: CountriesUsingCurrency<br>    Operation: ListOfLanguagesByName<br>    Operation: ListOfLanguagesByCode<br>    Operation: LanguageName</pre><h3>Fetching List of Continents</h3><p>Next, let’s fetch a list of continents. The Continents function below calls the appropriate SOAP operation and prints the result:</p><pre>def Continents():<br>    try:<br>        continents_response = client.service.ListOfContinentsByName()<br>        print(&quot;Continents:&quot;)<br>        for continent in continents_response:<br>            print(f&quot;  {continent.sName} ({continent.sCode})&quot;)<br>    except Exception as e:<br>        print(f&quot;Error: {e}&quot;)</pre><pre>Continents()</pre><pre>Output:<br>Continents:<br>  Africa (AF)<br>  Antarctica (AN)<br>  Asia (AS)<br>  Europe (EU)<br>  Ocenania (OC)<br>  The Americas (AM)</pre><h3>Fetching Country Currency and Flag</h3><p>Finally, let’s retrieve the currency and flag for a given country. Here’s a function to do that:</p><pre>def getCountryCurrencyAndFlag(country_code):<br>    try:<br>        currency_response = client.service.CountryCurrency(sCountryISOCode=country_code)<br>        print(f&quot;Currency for {country_code}: {currency_response.sName} ({currency_response.sISOCode})&quot;)<br>        flag_response = client.service.CountryFlag(sCountryISOCode=country_code)<br>        print(f&quot;Flag URL for {country_code}: {flag_response}&quot;)<br>    except Exception as e:<br>        print(e)</pre><pre>getCountryCurrencyAndFlag(&quot;US&quot;)</pre><pre>Output:<br>Currency for US: Dollars (USD)<br>Flag URL for US: http://www.oorsprong.org/WebSamples.CountryInfo/Flags/USA.jpg</pre><p>This function takes an ISO country code as input and prints the country’s currency and flag URL.</p><h3>Conclusion</h3><p>Using SOAP APIs with Python is straightforward with the zeep library. While SOAP may not be as popular as REST in modern web development, its robustness and standardized protocol make it invaluable in certain contexts, especially in enterprise applications.</p><p>In this guide, we demonstrated how to set up a SOAP client, list available operations, and fetch specific information from the CountryInfoService. Whether you’re maintaining legacy systems or building secure enterprise applications, understanding how to work with SOAP APIs is a valuable skill. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1bfb2d35253b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Simple Email Sender Web App with Django]]></title>
            <link>https://medium.com/@saqibajuna/building-a-simple-email-sender-web-app-with-django-73c6fb5f24b3?source=rss-fc3bbc373676------2</link>
            <guid isPermaLink="false">https://medium.com/p/73c6fb5f24b3</guid>
            <dc:creator><![CDATA[Saqiba Juna]]></dc:creator>
            <pubDate>Sat, 09 Mar 2024 19:45:54 GMT</pubDate>
            <atom:updated>2024-05-10T12:02:20.981Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Oui4EhIqBzu_eJq3.gif" /></figure><p>Are you looking to add email-sending functionality to your Django web application? In this post, I’ll guide you through the steps to create a simple email sender web app using Django. By the end of this tutorial, you’ll have a fully functional web app that allows users to send emails with ease.</p><h3>Introduction</h3><p>Adding email-sending capabilities to a web app can be a valuable feature for many projects. Whether it’s sending notifications, newsletters, or invitations, having the ability to communicate with users via email is essential. With Django, a powerful web framework for Python, we can easily implement this functionality.</p><h3>Prerequisites</h3><p>Before we begin, make sure you have the following installed:</p><ul><li>Python</li><li>Django</li><li>An email server (e.g., SMTP server)</li></ul><h3>Step 1: Setting Up the Django Project</h3><p>First, let’s create a new Django project and set up the necessary components.</p><pre>django-admin startproject emailsender<br>cd emailsender</pre><h3>Step 2: Creating the Email Sender App</h3><p>Now, let’s create a Django app for our email sender functionality.</p><pre>python manage.py startapp app</pre><h3>Step 3: Setting Up the Email Configuration</h3><p>Configure Django to use your email server for sending emails. Update the settings.py file with your email server settings.</p><pre># settings.py</pre><pre>import environ</pre><pre>env = environ.Env()</pre><pre>environ.Env.read_env()</pre><pre># Email Variables ...</pre><pre>EMAIL_BACKEND = &#39;django.core.mail.backends.smtp.EmailBackend&#39;</pre><pre>EMAIL_HOST = env(&#39;EMAIL_HOST&#39;)</pre><pre>EMAIL_PORT = 587</pre><pre>EMAIL_USE_TLS = True</pre><pre>EMAIL_HOST_USER = env(&#39;EMAIL_HOST_USER&#39;)</pre><pre>EMAIL_HOST_PASSWORD = env(&#39;EMAIL_HOST_PASSWORD&#39;)</pre><h3>Step 4: Setting Up App Password from Gmail</h3><p>For Gmail users, setting up an app password to authenticate with Gmail’s SMTP server securely is recommended. Visit your Google Account settings, navigate to Security, and generate an app password for your Django web app. Replace the EMAIL_HOST_PASSWORD in your .env file with the app password generated. If you don’t get of “apppasswords” option there then follow this link to achieve the app’s password, if you already set 2-step verification ON:</p><p><a href="https://myaccount.google.com/apppasswords">https://myaccount.google.com/apppasswords</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/853/1*18jVEDNIJCqMhjG0VAopgA.png" /></figure><h3>Step 5: Creating the Email Sending Form</h3><p>Create HTML templates for the email-sending form (index.html) and the success page (success.html) inside the app/templates/app/ directory.</p><h3>Step 6: Implementing Views and URLs</h3><p>Define views and URL patterns for handling the email-sending functionality.</p><pre># views.py</pre><pre>from django.shortcuts import render</pre><pre>from django.core.mail import send_mail</pre><pre>from django.http import HttpResponseRedirect</pre><pre>from django.urls import reverse</pre><pre>from django.conf import settings</pre><pre># Create your views here.</pre><pre>def email_sent_success(request):</pre><pre>return render(request, &#39;app/success.html&#39;)<br></pre><pre>def email_sender(request):</pre><pre>if request.method == &quot;POST&quot;:</pre><pre>recipient = request.POST.get(&#39;recipient&#39;, &#39;&#39;)</pre><pre>subject = request.POST.get(&#39;subject&#39;,&#39;&#39;)</pre><pre>message = request.POST.get(&#39;message&#39;,&#39;&#39;)</pre><pre>send_mail(subject, message, settings.EMAIL_HOST_USER, [recipient] )</pre><pre># Redirect to a success page</pre><pre>return HttpResponseRedirect(reverse(&#39;email_sent_success&#39;))</pre><pre># urls.py</pre><pre>from django.urls import include, path</pre><pre>from . import views</pre><pre>urlpatterns = [</pre><pre>path(&#39;&#39;, views.email_sender, name=&quot;email_sender&quot;),</pre><pre>path(&#39;email/sent/success/&#39;, views.email_sent_success, name=&#39;email_sent_success&#39;),</pre><pre>]</pre><h3>Step 7: Testing and Deployment</h3><p>Test your email sender web app locally by running the development server (python manage.py runserver). Once satisfied, you can deploy your Django project to a hosting provider to make it accessible to users.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*aDwRFOqIE11ME4sK-S1slQ.png" /></figure><h3>Conclusion</h3><p>Successfully built a simple email sender web app with Django. This project serves as a foundation for adding more advanced features, such as email templates, attachments, and user authentication. Feel free to explore Django’s documentation for more information on extending your web app.</p><p>Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=73c6fb5f24b3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unlocking API Potential: A Gentle Introduction to Django Rest Framework]]></title>
            <link>https://medium.com/@saqibajuna/unlocking-api-potential-a-gentle-introduction-to-django-rest-framework-c226aec073df?source=rss-fc3bbc373676------2</link>
            <guid isPermaLink="false">https://medium.com/p/c226aec073df</guid>
            <dc:creator><![CDATA[Saqiba Juna]]></dc:creator>
            <pubDate>Thu, 28 Dec 2023 04:34:11 GMT</pubDate>
            <atom:updated>2023-12-28T06:44:55.393Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*l-U13XNWR-vZg4IM.jpg" /></figure><p>The Django Rest Framework (DRF) is an essential tool for crafting scalable and reliable Python APIs. Expanding upon the features of Django, a high-level web framework, DRF empowers developers to create robust RESTful APIs effortlessly. This framework streamlines the development process, freeing developers to focus on building effective and feature-rich APIs by simplifying tasks such as processing HTTP requests, serialization, authentication, and more. Thanks to its intuitive design, extensive documentation, and wealth of built-in capabilities, web developers seeking a sophisticated and efficient solution for Django APIs cannot overlook the Django Rest Framework.</p><p>Let’s start with creating a folder and inside that create a Python environment for installing particular libraries. Establishing a separate Python environment is crucial for maintaining project dependencies and avoiding conflicts with other projects on your system. It ensures a clean and isolated environment, allowing you to manage and install only the libraries required for your current project, thereby preventing version clashes and promoting reproducibility in your development workflow. Let&#39;s start…</p><p>$ python -m venv new_env</p><p>This command will help you to create a new environment for the project. Also, activate the environment</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/757/1*y-y3AM0nRpUX1UuS2egntg.png" /></figure><p>Now install django and djangorestframework libraries.</p><p>For Django: $ pip install django</p><p>For Rest_Framework: $ pip install djangorestframework</p><p>After completing this next step is to create a project and app for the Django project.</p><p>For creating the project:<strong> $ django-admin startproject project</strong></p><p>move to that project you will see the following files:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*z_2ncDic3oYNIvjNHrlh7A.png" /></figure><p>To create an app for this either you can use the $ django-admin startapp app command or $ python manage.py startapp app this command will work in creating an app. manage.py in Django serves as a command-line utility for various tasks. From running migrations to starting the development server, this script is indispensable for managing and controlling Django projects efficiently. Its versatility and simplicity make it the central command hub for handling key aspects of Django application development.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/223/1*feVrkFUfoz8SJP-zLQkDNw.png" /></figure><p>You can see the app is created. In your project, install the app and rest_framework by adding ‘your_app_name’ and ‘rest_framework’ to the INSTALLED_APPS list in the settings.py file. Ensure they are properly configured to leverage the functionalities of the newly added components.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wBKHWZu5oYJg6WQwjaUBIw.png" /></figure><p>After executing python manage.py runserver command, open your web browser and navigate to http://127.0.0.1:8000/ or http://localhost:8000/. If the server is running successfully, you should see the Django development server’s default welcome page. This confirms that your server is up and running locally.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OYP9GBIONimHlkRzkahDQw.png" /></figure><p>To stop the Django development server in the terminal, press Ctrl + C. This keyboard shortcut will send a termination signal to the server, allowing it to shut down properly. Ensure you are in the terminal or command prompt where the server is running, and pressing Ctrl + C once will initiate the shutdown process.</p><p>In your project’s urls.py file, add the following line to include the URLs from the &#39;app. urls&#39; module:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/1*0Jho1ldXZ-ik3lgEDsbX3w.png" /></figure><p>Then, in your app’s directory, create a new file named urls.py if it doesn&#39;t exist, and paste the same code from the project&#39;s urls.py. Modify it to include views from the app&#39;s views.py:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/981/1*XMIAMJkPyNiRbWyZllicFA.png" /></figure><p>we’ve created a Django model Product with fields for the product&#39;s name, description, and price. The model includes a __str__ method to provide a human-readable representation of each product instance.</p><p>Additionally, we’ve crafted a view named product_detail that retrieves a specific product based on its ID and renders a template (assumed to be named &#39;product_detail.html&#39;) with information about the product.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1021/1*OAT4r-TOZzHH3fhWpJmkZw.png" /></figure><p>To apply the changes made in the models to the database, run the following commands:</p><pre>python manage.py makemigrations</pre><p>This command will generate migration files based on the changes in your models.</p><pre>python manage.py migrate</pre><p>This command will apply those migrations to the database, creating the necessary tables for your Product model. These commands are essential whenever you make changes to your models to ensure that your database schema is updated accordingly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/1*yHitHmcS_0iYj2ZNMdhxig.png" /></figure><p>you can register the Product model in the Django admin by adding the model in the admin.py file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*ImWb4CDh8MDt_fxza3Zt-g.png" /></figure><p>Now To create a superuser for the Django admin panel, run:</p><pre>python manage.py createsuperuser</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*AX3ifES52Oj5M01evyT3SQ.png" /></figure><p>Then, go to the following URL in your browser, log in using the superuser credentials, and access the admin panel: Run the server</p><pre>$ python manage.py runserver</pre><p>and Go to the following URL:</p><pre>http://localhost:8000/admin/</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/1*8r0rO8rqMQfm6mbIFAF0jQ.png" /></figure><p>Add credentials and Log in and you will see your defined model over there!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ie2HbW0GEJjK9-SxdMYybQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*YxXb-si7n1luWzPjNRlS-w.png" /></figure><p>To view this data in a simple HTML page add view and create a file index.html in app/templates/app folder…</p><p>views.py</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BV8aJ1Jharll-ZqKg9O23Q.png" /></figure><p>and index.html file and run the server again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qg-tsIqbRX7SiRnwU8hHcA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K82Z1M4DbQOgnR4EVim4gA.png" /></figure><p>The next step for utilizing the rest_framework for get data and post data we simply to create a serializers.py file in the app folder and <strong>getdata</strong> and <strong>postdata</strong> views at views.py and add URLs for that at urls.py file of the app. serializers.py file is</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*APHataqWTRXz7ctvRhUXkQ.png" /></figure><p>Add the following views and URLs</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z4tLTuQPDEb1fMxIJKefAQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*2YqzITkROlnqkSa6Dq8Vdw.png" /></figure><p>The get_info View handles GET requests to <a href="http://127.0.0.1:8000/getinfo/">http://127.0.0.1:8000/getinfo/</a>, fetching all product data and returning it as JSON.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*85OQlmVd2nDmDzepxHtEYA.png" /></figure><p>The post_info View handles POST requests to <a href="http://127.0.0.1:8000/postinfo/">http://127.0.0.1:8000/postinfo/</a>, creating a new product entry based on the posted data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-W7qUGp3e20KvzCgy8ROzg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JUJ7tC90lKvzMEoiP3X02A.png" /></figure><p>In conclusion, this provides a comprehensive guide to integrating Django Rest Framework for building robust APIs. It begins with fundamental steps like creating a Python environment and installing packages, followed by a demonstration of seamlessly integrating the Django Rest Framework with a simple Product model and views.</p><p>The importance of the manage.py file in managing migrations and ensuring a smooth development experience is highlighted, along with a step-by-step guide for creating a superuser and utilizing the Django admin panel.</p><p>The showcases a practical example of rendering product information on a web page, employing HTML templates and CSS for a polished presentation. The inclusion of endpoints for posting and retrieving data underscores the Django Rest Framework’s versatility in handling CRUD operations.</p><p>As technology evolves, Django Rest Framework emerges as an invaluable tool for developers seeking efficient and straightforward API development. Readers, whether seasoned developers or Django newcomers are equipped to harness the framework’s capabilities, enhancing the robustness and scalability of their projects. This piece serves as a valuable resource for navigating the power of Django Rest Framework in web development endeavours. Happy coding!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c226aec073df" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Key Concepts of Deep Learning!]]></title>
            <link>https://medium.com/@saqibajuna/key-concepts-of-deep-learning-2578fc33bbd2?source=rss-fc3bbc373676------2</link>
            <guid isPermaLink="false">https://medium.com/p/2578fc33bbd2</guid>
            <category><![CDATA[basic-concept]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Saqiba Juna]]></dc:creator>
            <pubDate>Fri, 13 Jan 2023 12:47:51 GMT</pubDate>
            <atom:updated>2023-01-13T12:48:53.042Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*R3_01yyUgtUxBPdT.jpeg" /></figure><p><em>“Is artificial intelligence less than our intelligence?” — Spike Jonze</em></p><h3><strong>What is Deep Learning?</strong></h3><p>Deep learning does complex calculations on vast volumes of data using artificial neural networks. It is a subset of artificial intelligence that is based on how the human brain is organized and functions. Machines are trained using deep learning algorithms by learning from examples. Deep learning is frequently used in sectors like healthcare, eCommerce, entertainment, and advertisements.</p><h3><strong>Defining Neural Networks</strong></h3><p>The neural network is structured like the human brain and consists of artificial neurons, also known as nodes. These nodes are stacked next to each other in three layers:</p><ol><li>The input layer</li><li>The hidden layer(s)</li><li>The output layer</li></ol><p>Data provides each node with information in the form of inputs. The node multiplies the inputs with random weights, calculates them, and adds a bias. Finally, nonlinear functions, also known as activation functions, are applied to determine which neuron to fire.</p><h3><strong>How do Deep Learning Algorithms Work?</strong></h3><p>Deep learning algorithms use self-learning representations, but they also rely on ANNs, which simulate how the brain processes information. To extract features, classify objects, and identify relevant data patterns, algorithms exploit unknown elements in the input distribution throughout the training phase. This takes place on several levels, employing the algorithms to create the models, much like training machines to learn for themselves. Deep learning models employ several algorithms. Although no network is thought to be flawless, some algorithms are more effective at carrying out particular tasks. It’s beneficial to have a thorough understanding of all major algorithms to select the appropriate ones.</p><h3><strong>Types of Algorithms used in Deep Learning</strong></h3><blockquote>Here is the list of the top 10 most popular deep learning algorithms:</blockquote><p>1. Convolutional Neural Networks (CNNs)</p><p>2. Long Short Term Memory Networks (LSTMs)</p><p>3. Recurrent Neural Networks (RNNs)</p><p>4. Generative Adversarial Networks (GANs)</p><p>5. Radial Basis Function Networks (RBFNs)</p><p>6. Multilayer Perceptrons (MLPs)</p><p>7. Self-Organizing Maps (SOMs)</p><p>8. Deep Belief Networks (DBNs)</p><p>9. Restricted Boltzmann Machines (RBMs)</p><p>10. Autoencoders</p><h3>Basic Terminologies in neural networks:</h3><ol><li>one <strong>epoch</strong> = one forward pass and one backward pass of <em>all</em> the training examples</li><li><strong>batch size</strong> = the number of training examples in one forward/backward pass. The higher the batch size, the more memory space you’ll need.</li><li>number of <strong>iterations</strong> = number of passes, each pass using [batch size] number of examples. To be clear, one pass = one forward pass + one backward pass (we do not count the forward pass and backward pass as two different passes).</li></ol><p>Example: if you have 1000 training examples, and your batch size is 500, then it will take 2 iterations to complete 1 epoch.</p><p><strong>Happy Learning!!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2578fc33bbd2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Essential Steps for Exploratory Data Analysis (EDA)]]></title>
            <link>https://medium.com/@saqibajuna/essential-steps-for-exploratory-data-analysis-eda-297a73cf6039?source=rss-fc3bbc373676------2</link>
            <guid isPermaLink="false">https://medium.com/p/297a73cf6039</guid>
            <dc:creator><![CDATA[Saqiba Juna]]></dc:creator>
            <pubDate>Fri, 23 Sep 2022 17:56:07 GMT</pubDate>
            <atom:updated>2023-01-08T05:49:13.276Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>“I am always doing that which I cannot do, in order that I may learn how to do it.” </strong>Pablo Picasso</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gln2Qm2DRFc7AFBM.jpg" /></figure><h3>Exploratory Data Analysis</h3><p>Exploratory data analysis is the critical process of preliminary data analysis to find patterns, identify anomalies, test hypotheses, and double-check assumptions with the aid of summary statistics and visualizations. Following are some of the basic steps related to EDA:</p><h3>Step 1: Import the libraries</h3><p>In [ ]:</p><pre><strong>import</strong> pandas <strong>as</strong> pd<br><strong>import</strong> numpy <strong>as</strong> np<br><strong>import</strong> seaborn <strong>as</strong> sns<br><strong>import</strong> matplotlib.pyplot <strong>as</strong> plt</pre><h3>Step 2: Import Dataset</h3><p>In [ ]:</p><pre>data <strong>=</strong> sns<strong>.</strong>load_dataset(&#39;tips&#39;)<br>data<strong>.</strong>head()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*l1Tb6GbRFgCipPrvmSlWrw.png" /></figure><h3>Step 3: Size of the dataset</h3><p>In [ ]:</p><pre>shape<strong>=</strong>data<strong>.</strong>shape<br>print(&quot;Size of dataset&quot;,shape)<br>rows, columns <strong>=</strong> shape<br>print(&quot;Number of rows&quot;,rows)<br>print(&quot;Number of columns&quot;,columns)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/343/1*4jF6J9XbFsvdYWmkzN_QyA.png" /></figure><h3>Step 4: Data types of the dataset</h3><p>In [ ]:</p><pre>data<strong>.</strong>info()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/466/1*7OFQTy16LtLnH52lTGWQoQ.png" /></figure><h3>Step 5: Statistical Analysis of the dataset</h3><p>In [ ]:</p><pre>data<strong>.</strong>describe()<strong>.</strong>T</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*QaSCtrbuIh0E5SuL6OAyKQ.png" /></figure><h3>Step 6: Find Missing values</h3><p>In [ ]:</p><pre>data<strong>.</strong>isnull()<strong>.</strong>sum()</pre><p>Out[ ]:</p><pre>total_bill    0<br>tip           0<br>sex           0<br>smoker        0<br>day           0<br>time          0<br>size          0<br>dtype: int64</pre><h3>Step 7: Count the values</h3><p>In [ ]:</p><pre>data<strong>.</strong>value_counts()</pre><p>Out[ ]:</p><pre>total_bill  tip    sex     smoker  day   time    size<br>13.00       2.00   Female  Yes     Thur  Lunch   2       2<br>3.07        1.00   Female  Yes     Sat   Dinner  1       1<br>22.23       5.00   Male    No      Sun   Dinner  2       1<br>20.69       2.45   Female  No      Sat   Dinner  4       1<br>            5.00   Male    No      Sun   Dinner  5       1<br>                                                        ..<br>15.53       3.00   Male    Yes     Sat   Dinner  2       1<br>15.69       1.50   Male    Yes     Sun   Dinner  2       1<br>            3.00   Male    Yes     Sat   Dinner  3       1<br>15.77       2.23   Female  No      Sat   Dinner  2       1<br>50.81       10.00  Male    Yes     Sat   Dinner  3       1<br>Length: 243, dtype: int64</pre><p>In [ ]:</p><pre>data[&#39;sex&#39;]<strong>.</strong>value_counts()</pre><p>Out[ ]:</p><pre>Male      157<br>Female     87<br>Name: sex, dtype: int64</pre><h3>Step 8: Find the unique values in a particular column</h3><p>In [ ]:</p><pre>data[&#39;time&#39;]<strong>.</strong>unique()</pre><p>Out[ ]:</p><pre>[&#39;Dinner&#39;, &#39;Lunch&#39;]<br>Categories (2, object): [&#39;Lunch&#39;, &#39;Dinner&#39;]</pre><p>In [ ]:</p><pre>data[&#39;tip&#39;]<strong>.</strong>unique()</pre><p>Out[ ]:</p><pre>array([ 1.01,  1.66,  3.5 ,  3.31,  3.61,  4.71,  2.  ,  3.12,  1.96,<br>        3.23,  1.71,  5.  ,  1.57,  3.  ,  3.02,  3.92,  1.67,  3.71,<br>        3.35,  4.08,  2.75,  2.23,  7.58,  3.18,  2.34,  4.3 ,  1.45,<br>        2.5 ,  2.45,  3.27,  3.6 ,  3.07,  2.31,  2.24,  2.54,  3.06,<br>        1.32,  5.6 ,  6.  ,  2.05,  2.6 ,  5.2 ,  1.56,  4.34,  3.51,<br>        1.5 ,  1.76,  6.73,  3.21,  1.98,  3.76,  2.64,  3.15,  2.47,<br>        1.  ,  2.01,  2.09,  1.97,  3.14,  2.2 ,  1.25,  3.08,  4.  ,<br>        2.71,  3.4 ,  1.83,  2.03,  5.17,  5.85,  3.25,  4.73,  3.48,<br>        1.64,  4.06,  4.29,  2.55,  5.07,  1.8 ,  2.92,  1.68,  2.52,<br>        4.2 ,  1.48,  2.18,  2.83,  6.7 ,  2.3 ,  1.36,  1.63,  1.73,<br>        2.74,  5.14,  3.75,  2.61,  4.5 ,  1.61, 10.  ,  3.16,  5.15,<br>        3.11,  3.55,  3.68,  5.65,  6.5 ,  4.19,  2.56,  2.02,  1.44,<br>        3.41,  5.16,  9.  ,  1.1 ,  3.09,  1.92,  1.58,  2.72,  2.88,<br>        3.39,  1.47,  1.17,  4.67,  5.92,  1.75])</pre><h3>Step 9: Show the number of columns at the dinner time</h3><p>In [ ]:</p><pre>data[data<strong>.</strong>time <strong>==</strong>&#39;Dinner&#39;]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/516/1*mRJ_YKLYeJBSReJZwXnIeA.png" /></figure><h3>step 10: Check the normality of the dataset</h3><h3>Standard normal distribution</h3><p>In [ ]:</p><pre><em>#check the normality of total bill </em><br>sns<strong>.</strong>histplot(data[&#39;total_bill&#39;])</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/1*3gb1g_8FK-2DFHvlkSjoFA.png" /></figure><pre><em>#check the normality of tip</em><br>sns<strong>.</strong>histplot(data[&#39;tip&#39;])</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*4vgAERbX7lhUomRH_1vAXA.png" /></figure><pre><em>#check the normality of overall dataset</em><br>sns<strong>.</strong>histplot(data)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/1*oVA2lxt1Q54-J_fcawk5mA.png" /></figure><pre>In [ ]:<br>sns<strong>.</strong>boxplot(data[&#39;tip&#39;],color<strong>=</strong>&#39;green&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*-iBmbB-EHd0U6bdoOA4F6A.png" /></figure><h3>Step 11: Compute the correlation between variables</h3><p>In [ ]:</p><pre><em># correlation</em><br>corr<strong>=</strong>data<strong>.</strong>corr(method<strong>=</strong>&#39;pearson&#39;)<br>corr</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/398/1*aLpZAzqNqLCRuQtrpDQk2w.png" /></figure><pre>In [ ]:<br>sns<strong>.</strong>heatmap(corr, annot<strong>=True</strong>)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/1*6fFIK2xh_vhPOXBRKcm1WA.png" /></figure><h3>Step 12: Pair plot</h3><p>In [ ]:</p><pre>sns<strong>.</strong>pairplot(corr)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*8LKdVviK4hvkL0OfLKGvRg.png" /></figure><h3>Step 13: To compute the skewness and kurtosis of any variable</h3><p>In [ ]:</p><pre>data[&#39;tip&#39;]<strong>.</strong>agg([&#39;skew&#39;,&#39;kurtosis&#39;])<strong>.</strong>transpose()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/471/1*uVRBSROdfHQSfT_Ca7rjJw.png" /></figure><h4>Happy Learning!!</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=297a73cf6039" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>