<?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 Shah Zain on Medium]]></title>
        <description><![CDATA[Stories by Shah Zain on Medium]]></description>
        <link>https://medium.com/@shahzain009?source=rss-17470eab7d9a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*H_hWywAxlib5jc0grVJW0A.jpeg</url>
            <title>Stories by Shah Zain on Medium</title>
            <link>https://medium.com/@shahzain009?source=rss-17470eab7d9a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 10:01:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shahzain009/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[Getting Started with Jenkins on Windows: A Step-by-Step Guide (Part 1 of 3)]]></title>
            <link>https://medium.com/@shahzain009/getting-started-with-jenkins-on-windows-a-step-by-step-guide-part-1-of-3-5645256670fb?source=rss-17470eab7d9a------2</link>
            <guid isPermaLink="false">https://medium.com/p/5645256670fb</guid>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[jenkins-with-github]]></category>
            <dc:creator><![CDATA[Shah Zain]]></dc:creator>
            <pubDate>Tue, 11 Jun 2024 13:05:00 GMT</pubDate>
            <atom:updated>2024-06-11T13:07:59.381Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*xbczoyccb92qbh8WI0eUSw.png" /></figure><h3>Getting Started with Jenkins on Windows: A Step-by-Step Guide (Part 1 of 3)</h3><p>In this article, we’ll walk you through how to set up Jenkins on Windows to automate your builds. This is part 1 of a 3-part series. In part 1, we will focus on setting up Jenkins on Windows. Future parts will cover creating Docker agents, executing jobs on remote Docker containers, and configuring automatic build triggers on new commits. We’ll also include a step-by-step guide based on a comprehensive YouTube tutorial that you can follow to get up and running with Jenkins quickly and efficiently.</p><h4>Jenkins Introduction</h4><p><strong>Jenkins</strong> is a popular open-source automation server used to build, test, and deploy software. It’s highly customizable and supports continuous integration (CI) and continuous delivery (CD).</p><h4>Jenkins Infrastructure — Master Server and Agents</h4><ul><li>Jenkins operates using a master-agent architecture. The <strong>Master Server</strong> manages tasks and schedules jobs while <strong>Agents</strong> execute the jobs.</li></ul><h3>Installation (windows)</h3><p>1- Build the Jenkins BlueOcean Docker Image</p><pre>docker build -t myjenkins-blueocean:2.414.2 .</pre><p>2- Create the network ‘jenkins’</p><pre>docker network create jenkins</pre><p>Once it is created, you can use command “docker network ls” and verify that jenkins is running</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/1*ZzAe0MXT38rsHvjkx2ATrA.png" /></figure><h3>Run the Container</h3><pre>docker run --name jenkins-blueocean --restart=on-failure --detach `<br>  --network jenkins --env DOCKER_HOST=tcp://docker:2376 `<br>  --env DOCKER_CERT_PATH=/certs/client --env DOCKER_TLS_VERIFY=1 `<br>  --volume jenkins-data:/var/jenkins_home `<br>  --volume jenkins-docker-certs:/certs/client:ro `<br>  --publish 8080:8080 --publish 50000:50000 myjenkins-blueocean:2.414.2</pre><p>After this, you can confirm that Jenkins container is running using command “”docker ps”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/434/1*Jjx6Lkiqpl_rhtREtYLwrA.png" /></figure><h3>Get the Password</h3><pre>docker exec jenkins-blueocean cat /var/jenkins_home/secrets/initialAdminPassword</pre><h3>Connect to the Jenkins</h3><pre>https://localhost:8080/</pre><p>Once you hit this URL in browser, you should see following screen:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SIKEPjzpkvERj2yvx9-Gcw.png" /></figure><p>You can get password by running following command “docker exec jenkins-blueocean cat /var/jenkins_home/secrets/initialAdminPassword”</p><p>Paste the password in browser and install suggested plugins:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fJKN2CKK1o6HChbRjSj6oA.png" /></figure><p>Once it is complete, you will need to create an Admin user, and then Jenkins UI will load up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6-06KmynwgHFxLjr_U2SrQ.png" /></figure><p>Congratulations! You have set up Jenkins on your machine successfully!</p><p>In the next articles, we will go through the following:</p><ul><li>Create a Docker agent on Jenkins.</li><li>Execute Jenkins job on a remote Docker container.</li><li>Configure automatic build triggers on new commits.</li><li>Apply Jenkins configurations on a GitHub repository.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5645256670fb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Transforming an Android Phone into a Smart Webcam for Object Detection]]></title>
            <link>https://medium.com/@shahzain009/transforming-an-android-phone-into-a-smart-webcam-for-object-detection-8790fe35aeda?source=rss-17470eab7d9a------2</link>
            <guid isPermaLink="false">https://medium.com/p/8790fe35aeda</guid>
            <category><![CDATA[opencv]]></category>
            <category><![CDATA[object-detection]]></category>
            <category><![CDATA[opencv-python]]></category>
            <dc:creator><![CDATA[Shah Zain]]></dc:creator>
            <pubDate>Mon, 01 Jan 2024 08:02:07 GMT</pubDate>
            <atom:updated>2024-01-01T08:19:27.643Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/424/1*Wsal6dQDsAis8yCQQKA89g.gif" /></figure><p>Are you curious about repurposing your Android phone for a unique weekend project? 📱💻 I recently delved into a fun experiment, turning my Android device into a webcam capable of object detection. Here’s a breakdown of the project:</p><p>1. Using an Android Phone as a Webcam:</p><ul><li>Leveraged an Android app to convert the phone into a webcam streaming video over WiFi.</li><li>Accessed the video feed using OpenCV in Python.</li></ul><p>2. Object Detection with OpenCV:</p><ul><li>Employed OpenCV for video processing, detecting motion by analyzing differences between consecutive frames.</li><li>Implemented contour detection and drew rectangles around areas with significant changes, indicating movement.</li></ul><p>3. Triggering Notifications:</p><ul><li>Integrated a notification system by playing a binary sound file using Pygame’s mixer functionality when movement was detected.</li><li>Utilized multithreading to play the notification sound asynchronously.</li></ul><p>Result &amp; Potential Enhancements: This weekend project successfully demonstrated object detection based on motion in the video feed, triggering a sound notification. 🎉🔍 Possible improvements include refining object detection algorithms for accuracy, optimizing performance, and expanding the notification system to send alerts to mobile devices or emails.</p><p>This endeavor was not only a fun experiment but also highlighted the possibilities of combining diverse technologies for creative and practical purposes. 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8790fe35aeda" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring MQTT in .Net Core: A Robust Solution for IoT and Log Management]]></title>
            <link>https://medium.com/@shahzain009/exploring-mqtt-in-net-core-a-robust-solution-for-iot-and-log-management-587dbb554f88?source=rss-17470eab7d9a------2</link>
            <guid isPermaLink="false">https://medium.com/p/587dbb554f88</guid>
            <category><![CDATA[mqtt-broker]]></category>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[mqtt]]></category>
            <dc:creator><![CDATA[Shah Zain]]></dc:creator>
            <pubDate>Fri, 24 Nov 2023 10:21:24 GMT</pubDate>
            <atom:updated>2023-11-24T10:21:24.486Z</atom:updated>
            <content:encoded><![CDATA[<h3>Exploring MQTT in .Net Core: A Robust Solution for IoT and Log Management</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*GQ4XcELs7tzrN6qBgbcheQ.png" /></figure><h3>Introduction</h3><p>In the world of IoT, data is king. The ability to capture, transmit, and analyze data from a multitude of devices is what drives the value in IoT systems. One of the key components in this data pipeline is the messaging protocol used to transmit data from device to server. In this article, we will explore the use of MQTT (Message Queuing Telemetry Transport), a lightweight messaging protocol designed for IoT, in a .NET Core environment.</p><h3>What is MQTT?</h3><p>MQTT (Message Queue Telemetry Transport) is a lightweight messaging protocol that is designed for resource-constrained environments. It is widely used in the Internet of Things (IoT) and machine-to-machine (M2M) communication. MQTT is a publish-subscribe protocol, which means that clients can subscribe to topics and receive messages that are published to those topics.</p><h3>Why MQTT?</h3><p>When it comes to IoT, scalability is a crucial factor. As the number of connected devices grows, the load on the message broker, overall system, and platform can grow almost exponentially2. MQTT is designed to handle this scalability. It’s been shown that even a relatively weak server can handle over 1,000 publishers, making it a robust choice for large-scale IoT applications.</p><ul><li>Scalable: MQTT can be used to connect a large number of devices, which makes it a good choice for IoT applications.</li><li>Efficient: MQTT is a very efficient protocol, which makes it a good choice for applications that need to send and receive a lot of data.</li></ul><h3><strong>Capturing Data from a Windows Machine</strong></h3><p>There are a number of ways to capture data from a Windows machine. One way is to use the Windows Management Instrumentation (WMI) API. WMI is a set of tools that can be used to manage and monitor Windows systems. WMI can be used to collect data about a variety of things, such as CPU usage, memory usage, and network traffic.</p><h3><strong>Publishing Data to an MQTT Broker</strong></h3><p>Once you have captured data from a Windows machine, you can publish it to an MQTT broker. There are a number of MQTT brokers available, both open source and commercial. One popular open source MQTT broker is Mosquitto.</p><p>To publish data to an MQTT broker, you will need to create an MQTT client. An MQTT client is a library that allows you to connect to an MQTT broker and publish messages. There are a number of MQTT clients available for .NET Core, including MQTTnet.</p><h3>Forwarding Data to Logstash and Elasticsearch</h3><p>Once you have published data to an MQTT broker, you can forward it to Logstash and Elasticsearch. Logstash is a data processing pipeline that can be used to collect, transform, and send data to a variety of destinations. Elasticsearch is a search and analytics engine that can be used to store and analyze data.</p><p>To forward data from an MQTT broker to Logstash and Elasticsearch, you will need to create a Logstash pipeline. A Logstash pipeline is a set of instructions that tells Logstash how to process data.</p><h3><strong>Why MQTT is a Good Choice for Scalable Applications</strong></h3><p>MQTT is a good choice for scalable applications because it is a publish-subscribe protocol. This means that a single MQTT broker can handle a large number of clients. Additionally, MQTT is a very efficient protocol, which means that it can handle a lot of data traffic.</p><p>Here are some of the specific reasons why MQTT is a good choice for scalable applications:</p><ul><li>MQTT brokers can be horizontally scaled. This means that you can add more MQTT brokers to your network to handle more traffic.</li><li>MQTT clients are lightweight. This means that you can run a large number of MQTT clients on a single machine.</li><li>MQTT is a very efficient protocol. This means that MQTT can handle a lot of data traffic with a small amount of resources.</li></ul><h3>Conclusion</h3><p>MQTT is a powerful and scalable messaging protocol that is a good choice for .NET Core applications. By using MQTT, you can easily capture data from Windows machines and publish it to an MQTT broker. This data can then be forwarded to Logstash and Elasticsearch for analysis and storage.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=587dbb554f88" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jam: Bug Reporting with One-Click Precision]]></title>
            <link>https://medium.com/@shahzain009/jam-bug-reporting-with-one-click-precision-f3797e87098c?source=rss-17470eab7d9a------2</link>
            <guid isPermaLink="false">https://medium.com/p/f3797e87098c</guid>
            <category><![CDATA[quality-assurance]]></category>
            <category><![CDATA[bug-reporting]]></category>
            <dc:creator><![CDATA[Shah Zain]]></dc:creator>
            <pubDate>Sun, 17 Sep 2023 12:20:59 GMT</pubDate>
            <atom:updated>2023-09-17T12:20:59.543Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ct19vfsd77tD__O0PoGWWA.png" /></figure><p>In today’s fast-paced software development landscape, effective bug reporting is a crucial aspect of maintaining high-quality applications. Developers and testers often find themselves spending valuable time crafting detailed bug reports to communicate issues effectively. However, what if there was a way to streamline this process, allowing you to create the perfect bug report in just one click? Enter Jam, the innovative browser extension that is changing the game in bug reporting.</p><p><strong>Jam: The Bug Reporting Game Changer</strong></p><p>Jam is not your ordinary bug reporting tool. It’s a browser extension that empowers users to capture an instant replay of bugs occurring on their web applications while automatically including all the developer logs necessary for thorough bug reporting. In this article, we will explore how Jam works and why it has gained popularity among over 30,000 users, revolutionizing the way we approach bug reporting.</p><p><strong>One-Click Bug Reporting</strong></p><p>One of the standout features of Jam is its ability to simplify bug reporting down to just one click. Traditional bug reporting involves a series of complex steps, including capturing screenshots or screen recordings, writing detailed descriptions, and manually attaching logs and other relevant information. With Jam, all it takes is a single click to initiate the bug reporting process.</p><p>Imagine encountering a bug on your web application. Instead of spending precious time documenting the issue manually, you can use Jam to capture an instant replay of the bug in action. This instant replay not only provides a clear visual representation of the issue but also serves as valuable evidence for developers, making it easier to understand and reproduce the problem.</p><p>Time is of the essence in software development, and any tool that can help you save time is invaluable. Jam claims to reduce bug reporting time by a staggering 20 times. Let’s break down how it achieves this remarkable feat.</p><ol><li>Automated Logs: Jam automatically collects and includes all the developer logs required for bug reporting. This eliminates the need for users to manually search for and attach log files, saving a significant amount of time.</li><li>Instant Replay: The ability to capture an instant replay of the bug in action means that there is no ambiguity in bug reports. Developers can see exactly what happened, making it easier and quicker to diagnose and fix the issue.</li><li>Integration with Issue-Tracking Tools: Jam seamlessly integrates with popular issue-tracking tools like Jira, Linear, Asana, and more. This ensures that bug reports flow seamlessly into your existing software development workflows without any disruption.</li></ol><p><strong>Joining 30K+ Efficient Bug Reporters</strong></p><p>The numbers speak for themselves. Jam has already gained a user base of over 30,000 individuals who have recognized the value it brings to bug reporting. These users are now logging bugs faster and more efficiently, thanks to the capabilities of Jam.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f3797e87098c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Navigating API Landscapes: A Comprehensive Comparative Study of GraphQL and REST APIs]]></title>
            <link>https://medium.com/@shahzain009/navigating-api-landscapes-a-comprehensive-comparative-study-of-graphql-and-rest-paradigms-342ed1bd8dd2?source=rss-17470eab7d9a------2</link>
            <guid isPermaLink="false">https://medium.com/p/342ed1bd8dd2</guid>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[rest]]></category>
            <dc:creator><![CDATA[Shah Zain]]></dc:creator>
            <pubDate>Sat, 26 Aug 2023 13:38:12 GMT</pubDate>
            <atom:updated>2023-08-26T13:41:34.389Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/859/1*MKOIL08d0dA0w5Gq1jWdGg.png" /></figure><p>Introduction: Embarking on a journey through the API design, we find ourselves at the crossroads of GraphQL and REST-based architectures. With an extensive background as a senior software engineer, I’ve traversed the terrains of both paradigms. In this discourse, we embark on a meticulous exploration of GraphQL and REST, dissecting their nuances, strengths, limitations, and optimal contexts for implementation. By the time we conclude, you’ll possess a nuanced understanding, enabling you to make discerning architectural choices.</p><h3>REST: The Pillar of Traditional API Design</h3><h3>The Foundational Principles:</h3><p>REST, an abbreviation for Representational State Transfer, has stood as the bedrock of API design for decades. It operates on a set of predefined endpoints tied to specific resources, adhering to the conventional CRUD (Create, Read, Update, Delete) operations. Each endpoint encapsulates a particular resource state, with data delivery determined by the server — an approach that sometimes results in data inefficiencies due to fixed endpoints.</p><h3>The Strengths:</h3><ol><li>Caching: The statelessness of REST facilitates caching, optimizing performance by permitting responses to be cached for subsequent requests.</li><li>Robust Ecosystem: REST boasts a mature ecosystem with a wealth of tools, libraries, and documentation, fostering streamlined development and integration.</li><li>Elegance in Simplicity: REST’s adherence to CRUD operations renders it accessible and straightforward, particularly for scenarios with uncomplicated requirements.</li></ol><h3>The Challenges:</h3><ol><li>Data Dilemmas: REST frequently contends with over-fetching — clients receiving more data than needed — or under-fetching — resulting in multiple requests to achieve complete data retrieval.</li><li>Versioning Complexity: Evolving APIs necessitate versioning strategies, demanding meticulous planning to maintain backward compatibility.</li><li>Request Proliferation: Complex data needs often force clients to make numerous requests to endpoints, inevitably escalating network congestion.</li></ol><h3>GraphQL: A Paradigm Shift in Data Exchange</h3><h3>The Query-Centric Approach:</h3><p>Enter GraphQL, a creation of Facebook, introducing a query language empowering clients to articulate their data requirements meticulously. Departing from REST’s pre-defined endpoints, GraphQL grants clients unparalleled granularity in defining data needs.</p><h3>The Advantages:</h3><ol><li>Data Precision Enabler: GraphQL places data retrieval control in the hands of clients, eliminating data redundancy and greatly enhancing network efficiency.</li><li>Flexibility Amplified: Clients dictate the shape and content of responses, negating the need for backend modifications to accommodate UI changes.</li><li>The Erosion of Versioning: GraphQL’s introspection capabilities render versioning obsolete, allowing clients to directly query schemas, ensuring ongoing compatibility.</li></ol><h3>The Complexities:</h3><ol><li>Learning Curve: The adoption of GraphQL demands that developers acquaint themselves with its query language and underlying concepts, implying a marginally steeper learning curve.</li><li>Performance Challenges: In intricate scenarios, intricate queries can lead to performance bottlenecks if not thoughtfully structured.</li><li>Caching Conundrums: The dynamic nature of GraphQL queries complicates caching, as each query can be unique, posing challenges to conventional caching mechanisms.</li></ol><h3>Sample API Calls and Responses: REST vs GraphQL</h3><p>To better understand the practical differences between REST and GraphQL, let’s examine the formats of sample API calls and responses for both paradigms. In this hypothetical scenario, we’ll consider a simple blog application with “Posts” and “Users” as the main entities.</p><h3>REST API Calls and Responses:</h3><p>1. Get All Posts:</p><p>Request:</p><pre>GET /api/posts</pre><p>Response:</p><pre>[<br>  {<br>    &quot;id&quot;: 1,<br>    &quot;title&quot;: &quot;Introduction to REST APIs&quot;,<br>    &quot;content&quot;: &quot;REST stands for Representational State Transfer...&quot;,<br>    &quot;author&quot;: &quot;Sohaib Omer&quot;<br>  },<br>  {<br>    &quot;id&quot;: 2,<br>    &quot;title&quot;: &quot;GraphQL vs REST: A Comparison&quot;,<br>    &quot;content&quot;: &quot;GraphQL and REST are both popular API design approaches...&quot;,<br>    &quot;author&quot;: &quot;Muhammad Aneeq&quot;<br>  }<br>]</pre><p>2. Get Single Post:</p><p>Request:</p><pre>GET /api/posts/1</pre><p>Response:</p><pre>{<br>  &quot;id&quot;: 1,<br>  &quot;title&quot;: &quot;Introduction to REST APIs&quot;,<br>  &quot;content&quot;: &quot;REST stands for Representational State Transfer...&quot;,<br>  &quot;author&quot;: &quot;Sohaib Omer&quot;<br>}</pre><p>3. Create New Post:</p><p>Request: POST /api/posts</p><pre><br>Body:<br>{<br>  &quot;title&quot;: &quot;Getting Started with APIs&quot;,<br>  &quot;content&quot;: &quot;APIs are essential for modern software development...&quot;,<br>  &quot;author&quot;: &quot;Shaheer&quot;<br>}</pre><p>Response:</p><pre>{<br>  &quot;id&quot;: 3,<br>  &quot;title&quot;: &quot;Getting Started with APIs&quot;,<br>  &quot;content&quot;: &quot;APIs are essential for modern software development...&quot;,<br>  &quot;author&quot;: &quot;Shaheer&quot;<br>}</pre><h3>GraphQL API Calls and Responses:</h3><p>1. Get All Posts:</p><p>Request:</p><pre>query {<br>  posts {<br>    id<br>    title<br>    content<br>    author<br>  }<br>}</pre><p>Response:</p><pre>{<br>  &quot;data&quot;: {<br>    &quot;posts&quot;: [<br>      {<br>        &quot;id&quot;: 1,<br>        &quot;title&quot;: &quot;Introduction to REST APIs&quot;,<br>        &quot;content&quot;: &quot;REST stands for Representational State Transfer...&quot;,<br>        &quot;author&quot;: &quot;Sarwan&quot;<br>      },<br>      {<br>        &quot;id&quot;: 2,<br>        &quot;title&quot;: &quot;GraphQL vs REST: A Comparison&quot;,<br>        &quot;content&quot;: &quot;GraphQL and REST are both popular API design approaches...&quot;,<br>        &quot;author&quot;: &quot;Salman Malik&quot;<br>      }<br>    ]<br>  }<br>}</pre><p>2. Get Single Post:</p><p>Request:</p><pre>query {<br>  post(id: 1) {<br>    id<br>    title<br>    content<br>    author<br>  }<br>}</pre><p>Response:</p><pre>{<br>  &quot;data&quot;: {<br>    &quot;post&quot;: {<br>      &quot;id&quot;: 1,<br>      &quot;title&quot;: &quot;Introduction to REST APIs&quot;,<br>      &quot;content&quot;: &quot;REST stands for Representational State Transfer...&quot;,<br>      &quot;author&quot;: &quot;Sarwan&quot;<br>    }<br>  }<br>}</pre><p>3. Create New Post:</p><p>Request:</p><pre>mutation {<br>  createPost(input: {<br>    title: &quot;Getting Started with APIs&quot;,<br>    content: &quot;APIs are essential for modern software development...&quot;,<br>    author: &quot;Ibrahim&quot;<br>  }) {<br>    id<br>    title<br>    content<br>    author<br>  }<br>}</pre><p>Response:</p><pre>{<br>  &quot;data&quot;: {<br>    &quot;createPost&quot;: {<br>      &quot;id&quot;: 3,<br>      &quot;title&quot;: &quot;Getting Started with APIs&quot;,<br>      &quot;content&quot;: &quot;APIs are essential for modern software development...&quot;,<br>      &quot;author&quot;: &quot;Ibrahim&quot;<br>    }<br>  }<br>}</pre><p>By examining these sample API calls and responses, we can clearly observe the distinctive formats and interactions that define both REST and GraphQL paradigms. These examples highlight the flexibility and precision of GraphQL in contrast to the structured nature of REST. The choice between these approaches depends on your project’s requirements and the level of control you need over data retrieval.</p><h3>Strategically Selecting the Right Tool</h3><h3>The Realm of REST:</h3><ul><li>Simplicity’s Forte: REST shines in straightforward scenarios with uncomplicated data interactions, prioritizing swift, pragmatic operations.</li><li>Caching’s Cohort: When cache-friendliness is essential, REST’s statelessness becomes a valuable asset in enhancing performance.</li><li>Ecosystem’s Haven: Opt for REST when a robust ecosystem aligns harmoniously with your project’s requisites.</li></ul><h3>The Domain of GraphQL:</h3><ul><li>Data Finesse: For scenarios requiring meticulous data structures or aiming to circumvent over-fetching and under-fetching, GraphQL emerges as the victor.</li><li>Endpoint Elegance: GraphQL’s singular endpoint efficiently caters to intricate data needs, mitigating network overhead.</li><li>Adaptable Agility: In projects evolving swiftly, GraphQL’s introspective, versionless framework simplifies the process of adaptation.</li></ul><h3>Final Thoughts</h3><p>In the captivating arena of API design, GraphQL and REST are two formidable adversaries, each flaunting a distinctive array of strengths and limitations. As a seasoned software engineer, the choice between these paradigms is akin to an art form — an art refined by understanding the intricacies of your project and harmonizing them with the architectural philosophy. Equipped with a profound understanding of their intricacies, you’re poised to architect APIs that transcend performance, tailored with finesse to meet the unique demands of your application.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=342ed1bd8dd2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Optimizing API Performance in Django: How We Slashed Response Times in Half with Query…]]></title>
            <link>https://medium.com/@shahzain009/optimizing-api-performance-in-django-how-we-slashed-response-times-in-half-with-query-f79e80dd9472?source=rss-17470eab7d9a------2</link>
            <guid isPermaLink="false">https://medium.com/p/f79e80dd9472</guid>
            <category><![CDATA[django]]></category>
            <category><![CDATA[query-optimization]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[backend-development]]></category>
            <dc:creator><![CDATA[Shah Zain]]></dc:creator>
            <pubDate>Sun, 20 Aug 2023 12:11:09 GMT</pubDate>
            <atom:updated>2023-08-20T12:19:49.035Z</atom:updated>
            <content:encoded><![CDATA[<h3>Optimizing API Performance in Django: How We Slashed Response Times in Half with Query Optimizations.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hxuh2QUsINTJ5Dh2cmy-lw.png" /></figure><p>In the realm of web development, speed is the currency of user satisfaction. Our journey with Django taught us this firsthand. As we crafted a dynamic web application, we grappled with a common challenge, duplicate database queries.</p><p>These redundant queries not only strained our database but also bogged down API response times, a critical metric for user experience.</p><p><strong>Optimizing Django with Debug Toolbar and Hey</strong></p><p>Our journey through web development brought us to a pivotal challenge — API performance. Slow responses were far from ideal, and we were determined to transform our Django-powered application. Our solution? Dive into the world of duplicate queries, and locally test API response time using the Hey CLI tool. Here’s how our team made it happen.</p><p><strong>Harnessing the Power of Hey </strong><a href="https://github.com/rakyll/hey">https://github.com/rakyll/hey</a></p><p>Hey, the CLI tool that promised to quantify our API’s response time. We followed the installation guide and issued a test command:</p><p>Hey’s output provided a wealth of data. But it was more than numbers; it was a call to action. We took what we learned and applied it, optimizing our API endpoints using Django’s select_related and prefetch_related techniques. Armed with this knowledge, we launched Hey again, this time focusing on our improved API endpoints.</p><p><strong>Before Optimization:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/654/1*3DAn7Uaw8UAMJ68TLcZ48A.png" /></figure><p>Supercharging Django APIs: Taming Duplicates with select_related and prefetch_related</p><p>Duplicate queries are like traffic jams in the database world, causing slow responses and unhappy users. But fear not, Django’s got two trusty tools — select_related and prefetch_related—to clear up the congestion and make your APIs faster.</p><p>Imagine you’re fetching a user’s posts like this:</p><pre># Before optimization<br>def get_user_posts_slow(user_id):<br>    user = User.objects.get(id=user_id)<br>    posts = user.posts_set.all()<br>    return posts</pre><p>This code hit the database for each post, causing delays as users grew.</p><p>With prefetch_related, Django anticipates your needs and fetches the posts even smarter.</p><pre># optimization with prefetch_related<br>def get_user_posts_faster(user_id):<br>    user = User.objects.prefetch_related(&#39;posts&#39;).get(id=user_id)<br>    posts = user.posts_set.all()<br>    return posts</pre><p><strong>Results: Speedy Delivery:</strong></p><p>Now, let’s talk numbers. We tested with the Hey tool:</p><ul><li>Before Optimization: API responses took around 2.9 seconds.</li><li>After Further Optimization (prefetch_related): API responses down to 1.75 seconds!</li></ul><p><strong>After Optimization:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/1*Q0v2XQP7Tiw8UGZ0g2sXxA.png" /></figure><p><strong>In Conclusion: Our Path to Mastery</strong></p><p>Django’s select_related and prefetch_related emerged as the champions of performance. By taming duplicate queries, they not only sped up responses but also saved our database from getting bogged down. So, next time you&#39;re battling sluggish APIs, remember that a little optimization can go a long way!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hxuh2QUsINTJ5Dh2cmy-lw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f79e80dd9472" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>