<?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 Bharat Kumar Makhija on Medium]]></title>
        <description><![CDATA[Stories by Bharat Kumar Makhija on Medium]]></description>
        <link>https://medium.com/@bharatmakhija?source=rss-8fbadc7ba6d1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*q5u1s6-3Vr_vZrLUqO8k2g.jpeg</url>
            <title>Stories by Bharat Kumar Makhija on Medium</title>
            <link>https://medium.com/@bharatmakhija?source=rss-8fbadc7ba6d1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 15:25:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bharatmakhija/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[You’re Not Utilizing C++’s Full Potential If you are not using these in 2024]]></title>
            <link>https://medium.com/@bharatmakhija/youre-not-utilizing-c-s-full-potential-if-you-are-not-using-these-in-2024-2d1099f9183f?source=rss-8fbadc7ba6d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/2d1099f9183f</guid>
            <category><![CDATA[cplusplus]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[codingbootcamp]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[c-programming]]></category>
            <dc:creator><![CDATA[Bharat Kumar Makhija]]></dc:creator>
            <pubDate>Mon, 02 Sep 2024 12:46:33 GMT</pubDate>
            <atom:updated>2024-09-02T12:46:33.612Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4lq0DHjOp9vb51tf" /><figcaption>Photo by <a href="https://unsplash.com/@carlgonz?utm_source=medium&amp;utm_medium=referral">Carlos Gonzalez</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>C++ is a powerful and versatile programming language, but it comes with a steep learning curve. Even seasoned developers might not be aware of some of the hidden gems and lesser-known tricks that C++ offers. Here are 10 C++ tricks that can make your coding life easier and your programs more efficient.</p><h3>1. Lambda Expressions</h3><p><strong>Description:</strong> Lambda expressions provide a concise way to create anonymous functions, which can be used inline wherever quick, short-term functionality is needed.</p><p><strong>Where to Use:</strong> Use lambda expressions for quick function objects, especially in algorithms like std::sort or std::for_each. Sorting a list of custom objects based on a specific attribute without writing a separate comparator function.</p><pre>#include &lt;vector&gt;<br>#include &lt;algorithm&gt;<br>#include &lt;iostream&gt;<br><br>void sortVector() {<br>    std::vector&lt;int&gt; vec = {5, 3, 2, 8, 6};<br>    std::sort(vec.begin(), vec.end(), [](int a, int b) { return a &lt; b; });<br>    for (int num : vec) {<br>        std::cout &lt;&lt; num &lt;&lt; &quot; &quot;;<br>    }<br>    std::cout &lt;&lt; std::endl;<br>}</pre><h3>2. Range-based for Loop</h3><p><strong>Description:</strong> This loop simplifies iteration over containers, making the code more readable and less error-prone.</p><p><strong>Where to Use:</strong> Use range-based for loops whenever you need to iterate over an entire container. For instance, iterating over a collection of log messages to print them.</p><pre>#include &lt;vector&gt;<br>#include &lt;iostream&gt;<br><br>void printLogMessages(const std::vector&lt;std::string&gt;&amp; logs) {<br>    for (const auto&amp; log : logs) {<br>        std::cout &lt;&lt; log &lt;&lt; std::endl;<br>    }<br>}</pre><h3>3. Smart Pointers</h3><p><strong>Description:</strong> Smart pointers (std::unique_ptr, std::shared_ptr, and std::weak_ptr) help manage dynamic memory automatically, preventing memory leaks and dangling pointers.</p><p><strong>Where to Use:</strong> Use smart pointers instead of raw pointers for dynamic memory management to ensure proper resource cleanup. For instance managing the lifecycle of a complex resource, such as a database connection, to ensure it is properly released.</p><pre>#include &lt;memory&gt;<br>#include &lt;iostream&gt;<br><br>void useSmartPointer() {<br>    std::shared_ptr&lt;int&gt; p1 = std::make_shared&lt;int&gt;(10);<br>    std::weak_ptr&lt;int&gt; wp = p1;<br>    <br>    if (auto sp = wp.lock()) {<br>        std::cout &lt;&lt; *sp &lt;&lt; std::endl;<br>    }<br>}</pre><pre>#include &lt;memory&gt;<br>#include &lt;iostream&gt;<br><br>class DatabaseConnection {<br>public:<br>    DatabaseConnection() { std::cout &lt;&lt; &quot;Connected to database\n&quot;; }<br>    ~DatabaseConnection() { std::cout &lt;&lt; &quot;Disconnected from database\n&quot;; }<br>};<br><br>void manageDatabaseConnection() {<br>    std::unique_ptr&lt;DatabaseConnection&gt; dbConn = std::make_unique&lt;DatabaseConnection&gt;();<br>    // Connection is automatically closed when dbConn goes out of scope<br>}</pre><h3>4. Constexpr for Compile-time Constants</h3><p><strong>Description:</strong> The constexpr keyword allows the evaluation of expressions at compile time, which can lead to performance improvements.</p><p><strong>Where to Use:</strong> Use constexpr for constant expressions that can be evaluated at compile time, like mathematical functions.Precomputing mathematical constants or lookup tables can improve runtime performance.</p><pre>constexpr int factorial(int n) {<br>    return n &lt;= 1 ? 1 : (n * factorial(n - 1));<br>}<br><br>constexpr int value = factorial(5);</pre><h3>5. Structured Bindings</h3><p><strong>Description:</strong> Structured bindings allow you to unpack tuples, pairs, and structs into individual variables.</p><p><strong>Where to Use:</strong> Use structured bindings to improve readability when working with tuples or structs.</p><pre>#include &lt;tuple&gt;<br>#include &lt;iostream&gt;<br><br>std::tuple&lt;int, double, std::string&gt; getValues() {<br>    return std::make_tuple(1, 2.5, &quot;example&quot;);<br>}<br><br>void useStructuredBindings() {<br>    auto [a, b, c] = getValues();<br>    std::cout &lt;&lt; a &lt;&lt; &quot;, &quot; &lt;&lt; b &lt;&lt; &quot;, &quot; &lt;&lt; c &lt;&lt; std::endl;<br>}</pre><h3>6. std::optional</h3><p><strong>Description:</strong> std::optional is a wrapper that may or may not contain a value, providing a safer alternative to using pointers or sentinel values for optional data.</p><p><strong>Where to Use:</strong> Use std::optional to represent optional values that may be absent.</p><pre>#include &lt;optional&gt;<br>#include &lt;iostream&gt;<br><br>std::optional&lt;int&gt; findValue(bool condition) {<br>    if (condition) {<br>        return 42;<br>    }<br>    return std::nullopt;<br>}<br><br>void useOptional() {<br>    auto value = findValue(true);<br>    if (value) {<br>        std::cout &lt;&lt; &quot;Value found: &quot; &lt;&lt; *value &lt;&lt; std::endl;<br>    } else {<br>        std::cout &lt;&lt; &quot;Value not found&quot; &lt;&lt; std::endl;<br>    }<br>}</pre><h3>7. Move Semantics</h3><p><strong>Description:</strong> Move semantics allow the resources owned by an object to be transferred to another object without copying, which can significantly improve performance.</p><p><strong>Where to Use:</strong> Use move semantics when working with temporary objects or in classes that manage resources. It can be used for transferring ownership of large data structures to avoid expensive deep copies.</p><pre>#include &lt;string&gt;<br>#include &lt;iostream&gt;<br><br>void useMoveSemantics() {<br>    std::string str = &quot;Hello&quot;;<br>    std::string movedStr = std::move(str);<br>    std::cout &lt;&lt; movedStr &lt;&lt; std::endl;<br>}</pre><h3>8. RAII (Resource Acquisition Is Initialization)</h3><p><strong>Description:</strong> RAII ensures that resources are properly released when they go out of scope, preventing resource leaks.</p><p><strong>Where to Use:</strong> Use RAII for managing resources like file handles, mutexes, and dynamic memory.</p><pre>#include &lt;iostream&gt;<br>#include &lt;memory&gt;<br><br>class Resource {<br>public:<br>    Resource() { std::cout &lt;&lt; &quot;Resource acquired\n&quot;; }<br>    ~Resource() { std::cout &lt;&lt; &quot;Resource released\n&quot;; }<br>};<br><br>void useResource() {<br>    std::unique_ptr&lt;Resource&gt; res = std::make_unique&lt;Resource&gt;();<br>}</pre><h3>9. std::any</h3><p><strong>Description:</strong> std::any can hold any type of value, providing a type-safe alternative to void pointers.</p><p><strong>Where to Use:</strong> Use std::any when you need to store values of different types in a single container.</p><pre>#include &lt;any&gt;<br>#include &lt;iostream&gt;<br><br>void useAny() {<br>    std::any value = 42;<br>    value = std::string(&quot;Hello, World!&quot;);<br><br>    if (value.type() == typeid(std::string)) {<br>        std::cout &lt;&lt; std::any_cast&lt;std::string&gt;(value) &lt;&lt; std::endl;<br>    }<br>}</pre><h3>10. Inline Variables</h3><p><strong>Description:</strong> Inline variables allow a variable to be defined in a header file without causing multiple definition errors.</p><p><strong>Where to Use:</strong> Use inline variables for constants and static data members that need to be defined in header files.</p><pre>struct Constants {<br>    inline static const int value = 42;<br>};<br><br>void useInlineVariable() {<br>    std::cout &lt;&lt; Constants::value &lt;&lt; std::endl;<br>}</pre><h3>Conclusion</h3><p>These C++ tricks can help you write more efficient, readable, and maintainable code. By leveraging these lesser-known features, you can improve your programming skills and make the most out of the powerful capabilities that C++ offers. Whether you are a beginner or an experienced developer, there’s always something new to learn in the world of C++. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2d1099f9183f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Joys and Woes of Version Control]]></title>
            <link>https://medium.com/@bharatmakhija/the-joys-and-woes-of-version-control-b94e1a238697?source=rss-8fbadc7ba6d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/b94e1a238697</guid>
            <category><![CDATA[git]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[version-control]]></category>
            <dc:creator><![CDATA[Bharat Kumar Makhija]]></dc:creator>
            <pubDate>Mon, 22 Jul 2024 21:13:54 GMT</pubDate>
            <atom:updated>2024-07-22T21:13:54.220Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QjXP5jUx6i__nr0u" /><figcaption>Photo by <a href="https://unsplash.com/@praveentcom?utm_source=medium&amp;utm_medium=referral">Praveen Thirumurugan</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>The Situation</h3><p>Picture this: it’s a crisp Monday morning. You’re sipping your artisanal coffee, basking in the glow of your dual monitors. Today is the day you finally tackle that long-overdue feature. You open your code editor, crack your knuckles, and take a deep breath. Then you remember — you need to pull the latest changes from the repository. No big deal, right? Just a simple git pull and you’re off to the races.</p><p>But wait! Your terminal explodes with a wall of text. Merge conflicts! Suddenly, your idyllic morning transforms into a battleground of code, where every line could be your last. Welcome to the wonderful world of version control.</p><h3>The Task</h3><p>Version control systems (VCS) are supposed to make our lives easier. They help us track changes, collaborate with teammates, and prevent the dreaded “It works on my machine” syndrome. But let’s be real — they also bring their own set of unique challenges.</p><p>Take Git, for example. It’s the industry standard for VCS, and for good reason. It’s powerful, flexible, and incredibly efficient. It’s also the software equivalent of a Rubik’s cube, capable of making you feel like a genius one moment and a complete fool the next.</p><p>Here’s a quick rundown of the typical Git workflow:</p><ol><li>Clone the repository</li><li>Create a new branch</li><li>Make some changes</li><li>Commit those changes</li><li>Push the changes to the remote repository</li><li>Open a pull request</li><li>Merge the pull request</li><li>Repeat ad infinitum</li></ol><p>Sounds simple enough, right? Oh, my sweet summer child.</p><h3>The Drama</h3><p>Let’s talk about merge conflicts. They’re the version control equivalent of being stuck in traffic on a Friday evening. You know you’re eventually going to get home, but you have no idea how long it will take or what kind of detours you’ll need to take.</p><p>Imagine you and your teammate both decide to refactor the same piece of code. You make your changes, feeling all proud and productive, and push your branch. Then you try to merge your changes into the main branch, only to discover that your teammate’s changes conflict with yours. Now you’re stuck in a digital showdown, trying to figure out whose code will reign supreme.</p><p>And let’s not even get started on the notorious rebase. It’s like the secret menu item at your favorite burger joint – only seasoned developers seem to know about it, and even fewer understand how to use it without causing complete chaos. Rebase promises to keep your commit history clean and linear, but one wrong move and you’re knee-deep in a mess of detached HEADs and missing commits. It’s like trying to fold a fitted sheet – technically possible, but usually ends in tears.</p><h3>The Humor</h3><p>Despite its quirks, Git has a certain charm. Who hasn’t chuckled at a commit message like “Fixed a bug” or “Made things better”? And let’s be honest, there’s a strange satisfaction in finally resolving a tricky merge conflict, like successfully untangling a pair of earbuds.</p><p>There’s also the camaraderie that comes from shared Git struggles. Every developer has a war story — the time they accidentally committed sensitive information, or when they force-pushed to the main branch and sent their team into a panic. These experiences become badges of honor, proof that you’ve braved the wilds of version control and lived to tell the tale.</p><h3>The Solution</h3><p>So, how do we tame the beast that is version control? Here are a few tips:</p><ol><li><strong>Commit often</strong>: Small, frequent commits make it easier to track changes and resolve conflicts.</li><li><strong>Write meaningful commit messages</strong>: Future you (and your teammates) will thank you.</li><li><strong>Branch wisely</strong>: Use branches for new features, bug fixes, and experiments. Keep the main branch clean.</li><li><strong>Pull before you push</strong>: Syncing with the remote repository before pushing your changes helps avoid conflicts.</li><li><strong>Don’t fear the rebase</strong>: Learn how to use it properly, and it will become a powerful tool in your Git arsenal.</li></ol><h3>The Conclusion</h3><p>At the end of the day, version control is like flossing — you might not always enjoy it, but you know it’s good for you. Embrace the quirks, laugh at the frustrations, and celebrate the victories. Because in the ever-evolving world of software development, version control is the glue that holds our code (and our sanity) together.</p><p>So next time you find yourself in a merge conflict, just remember — it’s all part of the journey. And who knows? Maybe one day you’ll look back and laugh at the time you accidentally force-pushed to the main branch. Or maybe not. Either way, happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b94e1a238697" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unlocking the Secrets of Backend Development: Alex’s Road to Success]]></title>
            <link>https://medium.com/@bharatmakhija/unlocking-the-secrets-of-backend-development-alexs-road-to-success-5d11217e8ca6?source=rss-8fbadc7ba6d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/5d11217e8ca6</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Bharat Kumar Makhija]]></dc:creator>
            <pubDate>Fri, 05 Jul 2024 16:36:08 GMT</pubDate>
            <atom:updated>2024-07-05T16:36:08.372Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ucxCnnESfmRg_rvfodTQ4A.jpeg" /></figure><p><em>Grab your favorite coding beverage and buckle up your seat belts, fellow backend developers, because the tech rollercoaster of 2024 is about to take us on a wild ride!</em></p><p>Picture this as a tale of backend heroes seeking the ultimate power-ups to conquer the digital realms and build applications that are as robust as a developer’s coffee addiction :P. So, put on your coding capes and let’s embark on this engaging and enlightening journey into the tech-savvy wonderland!</p><p><em>Let me tell you a story of a software developer. Lets call him Alex, working in a tech company called InnovateTech.</em></p><p><em>In the beginning, InnovateTech’s applications were monolithic giants, cumbersome and difficult to maintain. It was getting difficult to maintain it day by day, let alone the deployments. It was taking ages for developers to build the code successfully on their local machine. Alex was wondering what could be done differently that will fix the problem at hand.</em></p><p><em>Alex, went to the Tech Guru of the town Techtopia. <br>Explaining the problem to tech guru, guru told him to read about microservice architecture.</em></p><h4>Microservices Architecture</h4><p>Imagine you’re running a restaurant with various services — there’s the kitchen, the reservation system, the billing counter, and the delivery service. In a traditional monolithic approach, it’s like having all these services combined into one giant restaurant with a single manager overseeing everything.</p><p>Now, picture the restaurant adopting a microservices architecture. Each service becomes its own mini-restaurant, fully equipped to handle its specific task. The kitchen focuses solely on cooking, the reservation system manages bookings, the billing counter handles payments, and the delivery service takes care of getting orders to customers.</p><p><em>Here’s the brilliance: </em>if the delivery service wants to improve its route planning or the kitchen wants to try a new cooking technique, they can do so without disrupting the entire restaurant. Each “mini-restaurant” operates independently, yet they seamlessly work together to provide a complete dining experience.</p><p>So, microservices in the restaurant analogy mean breaking down the traditional monolithic restaurant into specialized, independent services that can adapt, evolve, and collaborate efficiently. It’s like running a culinary symphony where each section plays its own tune, contributing to the overall harmony of the dining experience.</p><p>Every backend developer should deeply understand what microservices are, how they are created and managed. Read on more from below link.</p><p><a href="https://www.freecodecamp.org/news/microservices-architecture-for-humans/">Microservices Architecture for Humans</a></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FlTAcCNbJ7KE%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DlTAcCNbJ7KE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FlTAcCNbJ7KE%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/080bcefdc36633f0876f7bace779a549/href">https://medium.com/media/080bcefdc36633f0876f7bace779a549/href</a></iframe><blockquote><em>Now with Microservices knowledge, Alex broke down the big monolith to microservices and separated the responsibilities. Its became easy to develop, scale independently and deploy. Testing on local is a possibility now and the team is Happy. But little did alex know that it is not the end…</em></blockquote><p><em>With So Many Services at hand, it was becoming a nightmare to manage and deploy to production, handle failures and ensure the builds are passing. <br>Alex again went to Guru and explained the problem. Guru asked him to use standard CI/CD pipeline to handle such issues.</em></p><h4>CI/CD Pipelines</h4><p>Though less focused but still a important part to learn. Continuous Integration and Continuous Deployment (CI/CD) pipelines are crucial for automating the software development lifecycle. Backend developers should master tools like <a href="https://www.jenkins.io/">Jenkins</a>, <a href="https://docs.gitlab.com/ee/ci/">GitLab C</a>I or <a href="https://docs.github.com/en/actions">GitHub Actions</a> to streamline the process of building, testing, and deploying applications, ensuring rapid and reliable releases.</p><p><em>With CI/CD Pipelines life got easier again but it was short lived. One of the managers in the team said the overall cost for managing these many services is quite high and their use cases are not that resource intensives. What should they possibly do. It&#39;s not like they can remove un-necessary servers which are continuously running even though the traffic is minimal.</em></p><p><em>Well, Yes You can — Guru Said. </em><strong><em>Enter ServerLess Architecture.</em></strong></p><h4>Serverless Computing</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NMb_5fmwJur7m0TZ" /><figcaption>Photo by <a href="https://unsplash.com/@feliperpv?utm_source=medium&amp;utm_medium=referral">Felipe Vieira</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Imagine you want to bake a cake, but instead of worrying about buying an oven, setting the temperature, and keeping an eye on the baking time, you just hand over the recipe to a magical baking genie. This genie takes care of everything — providing the oven, adjusting the temperature, and letting you know when the cake is ready.</p><p>In the world of technology, serverless computing is a bit like that magical baking genie. Traditionally, when you build a website or an application, you need to deal with servers — the machines that store and process your code. With serverless computing, you don’t have to worry about those servers.</p><p>You write your code in small, independent functions, and when someone uses your app, the serverless platform automatically takes care of running those functions. It’s like paying only for the exact amount of oven time your cake needs, rather than buying the whole oven.</p><blockquote>In essence, serverless computing allows developers to focus solely on writing code without the hassle of managing servers.</blockquote><p>Serverless architecture continues to be a game-changer in backend development. Platforms like <a href="https://docs.aws.amazon.com/lambda/latest/dg/getting-started.html">AWS Lambda</a>, <a href="https://learn.microsoft.com/en-us/azure/azure-functions/functions-get-started?pivots=programming-language-csharp">Azure Functions</a>, and <a href="https://cloud.google.com/functions/docs/tutorials/http">Google Cloud</a> Functions allow developers to focus on writing code without the burden of managing servers. Learning serverless computing can lead to more scalable and cost-effective solutions. You can hover over and read more from their get started documentation.</p><p><em>Okey, so coming back to our story….</em></p><p><em>Alex did move couple of services to serverless architecture to save the cost. Which company won’t be happy saving good load of money. Time went on, Things were going in peace. <br>They setup on another mission to optimize their APIs and reduce their response time. Again TechGuru as the savior helped them</em></p><p>Guru suggested to checkout GraphQL to optimized on the data they need.</p><h4><strong>GraphQL (</strong>Graph Query Language<strong>)</strong></h4><p>GraphQL has gained widespread adoption for its ability to streamline API development and provide more efficient data retrieval compared to traditional REST APIs.</p><p>Imagine you’re at a restaurant, and you’re trying to order a meal. In the traditional world of REST (Representational State Transfer) APIs, it’s like being handed a fixed menu. You can only choose from the dishes listed, and sometimes you get more information than you need.</p><p>Now, enter GraphQL — it’s like having a friendly chef who asks, “What exactly do you want?” With GraphQL, you can specify the exact information you need, and the server responds with just that. It’s like customizing your order, ensuring you get the precise data without any extra fluff. In essence, GraphQL is a more flexible and efficient way for applications to communicate with servers, allowing you to request only the specific data you’re interested in, making your interactions with the server as tailored as ordering your favorite dish at a restaurant.</p><p>Backend developers should invest time in learning GraphQL to take advantage of its flexibility and power in building modern, data-driven applications.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FyWzKJPw_VzM%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DyWzKJPw_VzM&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FyWzKJPw_VzM%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/8041a75aae39f678990d2bc2b47c0130/href">https://medium.com/media/8041a75aae39f678990d2bc2b47c0130/href</a></iframe><p>Few more links:<a href="https://graphql.org/learn/"><br>Introduction to GraphQL</a><br><a href="https://www.freecodecamp.org/news/a-beginners-guide-to-graphql-86f849ce1bec/">A Beginner’s guide to GraphQL</a></p><p>Alex finally moved to using GraphQL and optimized the response time. Time went on, service grew and the complexity as it.</p><p>One more Problem for Alex:</p><p><em>They were now deploying services across different servers of windows, linux etc. It was difficult managing the library and dependencis across environments. Also another issue was monitor and bring down theinstances, auto-scale etc.</em> <br><strong>Enter Containerization and Orchestration engine.</strong></p><h4><strong>Containerization and </strong>Orchestration Engine</h4><p>Imagine you’re moving to a new home, and you want to pack your belongings in boxes. Each box contains specific items — clothes, kitchenware, books — neatly organized and ready to be transported. In the world of software, containerization is like these well-packed boxes.</p><p>When developers create applications, they often rely on various software libraries and dependencies. <strong>Containerization</strong> is a way to package all these components together in a neat, self-contained box — a container. Each container holds everything an application needs to run smoothly, making it easy to move, deploy, and run consistently across different environments.</p><p>Now Imagine you’re hosting a grand event, like a music festival, where multiple performers are scheduled to play on different stages. Coordinating the timing, order, and performance of each artist is a challenging task. In this scenario, an orchestration engine is like the event manager who ensures that each artist starts and finishes their performance at the right time, manages stage setups, and handles any unexpected changes smoothly. The orchestration engine brings order to the chaos, making the entire event a seamless experience for the audience.</p><p><em>Learning Docker for containerization and Kubernetes for orchestration is crucial for backend developers to ensure consistency across different environments and efficient management of containerized applications.</em></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FTlHvYWVUZyc%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DTlHvYWVUZyc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FTlHvYWVUZyc%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/fe850a8b259c39470bcdc6489c88f9ee/href">https://medium.com/media/fe850a8b259c39470bcdc6489c88f9ee/href</a></iframe><p>And Alex’s Journey will continue in the second part of this article where we will touch base on new challenges and new technological advancements Alex will face. Stay tuned for More!</p><p>I hope you got some take aways. Thanks for reading the article. Chao!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5d11217e8ca6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Brain Teasers, can you outsmart these logical puzzles ?]]></title>
            <link>https://medium.com/@bharatmakhija/brain-teasers-can-you-outsmart-these-logical-puzzles-973d63ab7116?source=rss-8fbadc7ba6d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/973d63ab7116</guid>
            <category><![CDATA[critical-thinking]]></category>
            <category><![CDATA[puzzle]]></category>
            <category><![CDATA[logical-thinking]]></category>
            <category><![CDATA[games]]></category>
            <category><![CDATA[problem-solving]]></category>
            <dc:creator><![CDATA[Bharat Kumar Makhija]]></dc:creator>
            <pubDate>Sat, 28 Jan 2023 18:05:56 GMT</pubDate>
            <atom:updated>2023-01-28T18:05:56.399Z</atom:updated>
            <content:encoded><![CDATA[<h3>Brain Teasers, can you outsmart these logical puzzles ?</h3><blockquote>Logical puzzles are good because they help improve problem-solving and critical thinking skills. Not to mention these can be fun and enjoyable. You might find few of these in interviews sometimes.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ctKIA1LRNabxQYf34pdJcw.jpeg" /><figcaption>credits: <a href="https://unsplash.com/@jupp">Jonathan Kemper (@jupp) | Unsplash Photo Community</a></figcaption></figure><p>So, lets get started:</p><h4><strong>1. The Light Bulb Mystery</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*0E3YOqhe5DeNVkrUbbGNsg.jpeg" /><figcaption>The light bulb mystery</figcaption></figure><p>You are in a room with three light switches. Each controls one of three light bulbs in a separate room. You can turn the switches on and off, but you cannot see the light bulbs. How can you determine which switch controls which light bulb in least number of operations (note: single operation includes turning multiple switches on/off together) ?</p><p><strong><em>Solution:</em></strong> You can find out which switch controls which bulb in just two operations. Take some time and think before reading the solution. <br>Here’s one possible approaches:</p><p><em>1st Approach:</em></p><p>Operation 1: Flip switch 1 on and leave it on for a few minutes.</p><p>Operation 2: Flip switch 1 off and turn switch 2 on.</p><p>Go into the room. The bulb that is on is controlled by switch 2. The bulb that is off and hot to the touch is controlled by switch 1. The bulb that is off and cold is controlled by switch 3.</p><p><em>2nd Approach:</em></p><p>Operation 1: Turn on switch 1 and switch 2.</p><p>Go into the room, the bulb that is off is controlled by switch 3. Go back to the room where switches are located.</p><p>Operation 2: Turn off switch 2.</p><p>Go into the room, if the bulb that was on goes off, it was controlled by switch 2. if not it was controlled by switch 1.</p><h4><strong>2. The Heavyweight Challenge</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*W_AIqx9yogwWuPqUKJGkbw.png" /><figcaption>Image of The famous 12 ball puzzle.</figcaption></figure><p>You have 12 balls, identical in every way except one of them is slightly heavier than the others. You have a balance scale. How can you determine which ball is the heavier one with minimum number of weighings ?</p><p><strong><em>Solution: (There can be multiple ways to solve, this is one of the solutions)</em></strong></p><p>Out of 12 balls, keep 2 balls aside. Now divide remaining 10 balls into two group of 5 balls each.</p><p>Operation 1: Weigh the group of 5 balls each. If both sides of balance weigh equal it means none of the side contains heavier ball. If any of the side weights more, that heavier ball belongs in that group of 5.</p><p>If its first i.e. both sides weight is same. Then one of the balls among two left out balls is heavier. Next we will weight 2 remaining balls, so we found the solution is 2 weighing here.</p><p>But If its later, then now we have 5 balls and we want to find heavier ball.<br>Keep 1 aside, balance 2 of them. If the balance is equal, the one kept aside is the heavier one. Here also we reach to solution in 2 operations.</p><p>But if one side of balance weighs more, then now we are left with 2 balls and one of them is heavier and for which, we will have to balance again. So in this case it will take 3 operations.</p><h4><strong>3. </strong>The Name Game: Can you guess the name of the fifth son?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yQ66dRkY7FlzVvhK" /><figcaption>Photo by <a href="https://unsplash.com/ja/@larm?utm_source=medium&amp;utm_medium=referral">Larm Rmah</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>A man has five sons, and he wants to give them all a unique name. He names the first Monday’s Child, the second Tuesday’s Child, the third Wednesday’s Child, the fourth Thursday’s Child, and the fifth Friday’s Child. What is the name of the fifth son?</p><p><strong><em>Solution:</em></strong></p><p>The fifth son’s name is Friday’s Child.</p><h4><strong>4. </strong>The Hotel Room Mystery: Where Did the Dollar Go?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6B5wU_4hPps5z-AX" /><figcaption>Photo by <a href="https://unsplash.com/@wildlittlethingsphoto?utm_source=medium&amp;utm_medium=referral">Helena Lopes</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Three guests check into a hotel room. The clerk says the bill is $30, so each guest pays $10. Later the clerk realizes the bill should only have been $25. To rectify this, he gives the bellhop $5 to return to the guests. On the way to the room, the bellhop realizes that he can’t divide the money equally. As he is a honest man, he decides to keep $2 for himself and give the guests $1 each. Now, each guest has paid $9, total is $27. And the bellhop has $2. Where is the remaining dollar?</p><p><strong><em>Solution:</em></strong></p><p>The exact sum mentioned in the riddle is computed as:</p><blockquote><strong><em>SUM = $9 (payment by Guest 1) +<br></em></strong><em> </em><strong><em>$9 (payment by Guest 2) +<br></em></strong><em> </em><strong><em>$9 (payment by Guest 3) +<br></em></strong><em> </em><strong><em>$2 (money in bellhop’s pocket)</em></strong></blockquote><p>The trick here is to realize that this is not a sum of the money that the three people paid originally, as that would need to include the money the clerk has ($25). This is instead a sum of a smaller amount the people could have paid ($9 × 3 people = $27), added with the additional money that the clerk would not have needed had they paid that smaller amount ($27 paid — $25 actual cost = $2). Another way to say this is, the $27 already includes the bellhop’s tip. To add the $2 to the $27 would be to double-count it. So, the three guests’ cost of the room, including the bellhop’s tip, is $27. Each of the 3 guests has $1 in his pocket, totaling $3. When added to the $27 revised cost of the room (including tip to the bellhop), the total is $30.</p><p>To illustrate the issue through equations:</p><blockquote><em>1) 10 + 10 + 10 = 30</em></blockquote><blockquote><em>2) 10 + 10 + 10 = 25 + 2 + 3</em></blockquote><blockquote><em>3) 10 + 10 + 10–3 = 25 + 2 + 3–3 (adding -3 to both sides of the equation to cancel out the +3 on the right side)</em></blockquote><blockquote><em>4) 10–1 + 10–1 + 10–1 = 25 + 2</em></blockquote><blockquote><em>5) 9 + 9 + 9 = 25 + 2 (obs: tip to bellhop has already been paid)</em></blockquote><blockquote><em>6) 27 = 27</em></blockquote><p>For more details check out the <a href="https://en.wikipedia.org/wiki/Missing_dollar_riddle">wiki link</a>.</p><h4>5. The Jug Riddle</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*c8jEyr1eopTv0FYx" /><figcaption>Photo by <a href="https://unsplash.com/@pafuxu?utm_source=medium&amp;utm_medium=referral">Kouji Tsuru</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>You have a five quart jug and a three quart jug, and an unlimited supply of water. How can you measure exactly four quarts?</p><p><strong><em>Solution:</em></strong></p><p>Fill the five quart jug and pour the water into the three quart jug, leaving two quarts in the five quart jug. Empty the three quart jug. Now pour the two quarts from the five quart jug into the three quart jug. Fill the five quart jug again, and pour water into the three quart jug until it is full. The amount of water left in the five quart jug is the desired four quarts.</p><h4>6. The Poisoned Wine Challenge</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/990/1*_NrXzj0FtcXBLpskbXhvxw.jpeg" /></figure><p>A king has 1000 bottles of wine, but one bottle is poisoned. The poison will take effect within 24 hours of consumption. The king wants to find the poisoned bottle, but he only has 24 hours and a team of 10 testers. How can the king find the poisoned bottle in the least amount of time?</p><p><strong><em>Solution:</em></strong></p><p>One possible solution is to divide the bottles into 10 groups of 100 bottles each and have one tester try a bottle from each group, which would take a total of 10 days. Another possible solution is to use a binary search approach, where the king would divide the bottles into two groups of 500 and have a tester try a bottle from one of the groups. If the tester doesn’t die, the king would repeat the process with the remaining group until the poisoned bottle is found, which would take a maximum of 10 days.</p><p>The optimal solution, however, would be to divide the bottles into 10 groups of 100 bottles and have each tester drink one bottle from each group, resulting in the poisoned bottle being identified on the same day, with only 10 testers.</p><p>Please clap if you liked the effort and want to read more such puzzles.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=973d63ab7116" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learn how to elevate your system’s performance with multi-level caching]]></title>
            <link>https://medium.com/@bharatmakhija/learn-how-to-elevate-your-systems-performance-with-multi-level-caching-511efb774a6e?source=rss-8fbadc7ba6d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/511efb774a6e</guid>
            <category><![CDATA[pc]]></category>
            <category><![CDATA[cpu]]></category>
            <category><![CDATA[cache]]></category>
            <category><![CDATA[laptop]]></category>
            <category><![CDATA[pc-assembly]]></category>
            <dc:creator><![CDATA[Bharat Kumar Makhija]]></dc:creator>
            <pubDate>Wed, 25 Jan 2023 15:37:10 GMT</pubDate>
            <atom:updated>2023-01-25T15:37:10.153Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FINEOwLGvd12_j_6cItgug.png" /><figcaption>Image created from Mid Journey</figcaption></figure><p><strong>Let me first quickly touch base on what exactly is Cache memory ?</strong></p><p>Cache memory is like a small room in a big house, where the computer stores things it uses frequently. When the computer needs something, it first checks this small room (cache memory) before going to the big room (main memory) or the garage (disk storage) to get it. This is because it’s faster for the computer to get things from the small room than from the big room or the garage.</p><h4><strong>What is Multi-Level caching ?</strong></h4><blockquote>Multi-level caching, also known as hierarchical caching, is a technique used to improve the performance of computer systems by utilizing multiple levels of cache memory.</blockquote><p>In continuation with above reference, In multi-level caching, there are multiple rooms or levels of cache memory, each with a different size and speed. The first room is the smallest and fastest, and it’s located right next to the computer’s “brain” (processor). It is called L1 cache. The second room is a bit larger and slower, and it’s located on the same chip as the processor, called L2 cache. The third room is even larger and slower, and it’s located on the motherboard which is called L3 cache.</p><blockquote>Each level of cache (L1, L2 and L3) serves a different purpose.</blockquote><p>L1 cache is used to store data that the processor is currently working on, while L2 cache is used to store data that the processor may need to access soon. L3 cache is used to store data that is less likely to be needed by the processor, but may still be accessed occasionally.</p><p>The benefit of multi-level caching is that it allows the processor to quickly access the data it needs, without having to access the main memory or storage. This can greatly improve the performance of the system, as accessing main memory or storage is much slower than accessing cache memory.</p><p>However, there is also a downside to multi-level caching. As the levels of cache increase, so does the complexity of the system. This can make it more difficult to design and optimize the system, and can also increase the cost of the system.</p><p>Here are some rough estimates for access time for different types of memory:</p><ul><li>L1 cache: ~1–2 nanoseconds</li><li>L2 cache: ~5–10 nanoseconds</li><li>L3 cache: ~10–20 nanoseconds</li><li>Main memory (DRAM): ~60–100 nanoseconds</li><li>Disk storage (HDD): ~5–10 milliseconds</li><li>Disk storage (SSD): ~0.1–1 milliseconds</li></ul><p>It’s important to note that these are approximate figures and the exact timings may vary. Also, the access time for main memory and disk storage can be affected by other factors such as disk fragmentation, disk seek time etc.</p><p>In summary, L1 cache has the fastest access time, followed by L2 and L3 cache, main memory, and finally disk storage. The difference in access time between the different levels of cache and main memory is relatively small, however, the difference between main memory and disk storage is significant.</p><p>Overall, multi-level caching is a powerful technique that can greatly improve the performance of computer systems.</p><p>Given the information provided, you now understand what to consider from a caching perspective when buying or building a new PC. I will delve further into the different types of caches available on the market and how to incorporate them into your own PC build in a separate article. Please indicate your interest by clapping if you wish to learn more or enjoyed this article.</p><p>Until next time!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=511efb774a6e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unlock the secrets to seamless streaming with Netflix’s expert video delivery techniques!]]></title>
            <link>https://medium.com/@bharatmakhija/unlock-the-secrets-to-seamless-streaming-with-netflixs-expert-video-delivery-techniques-525b64ad43ee?source=rss-8fbadc7ba6d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/525b64ad43ee</guid>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[netflix]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Bharat Kumar Makhija]]></dc:creator>
            <pubDate>Tue, 03 Jan 2023 18:30:01 GMT</pubDate>
            <atom:updated>2023-01-03T18:30:01.014Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1KK9IdPyum63eY7y" /><figcaption>Photo by <a href="https://unsplash.com/es/@freestocks?utm_source=medium&amp;utm_medium=referral">freestocks</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Netflix uses a combination of techniques to stream high quality video at fast speeds. Some of these include:</p><ol><li><strong><em>Adaptive bitrate streaming</em></strong>: This allows Netflix to automatically adjust the quality of the video stream based on the user’s Internet connection speed. This ensures that the user always gets the best possible quality without experiencing buffering or other playback issues.</li><li><strong><em>Multiple CDN</em></strong> (Content Delivery Network) providers: Netflix uses multiple CDN providers to deliver its content to users around the world. This allows the company to deliver high quality video streams with low latency and high reliability.</li><li><strong><em>Optimized encoding</em></strong>: Netflix uses advanced encoding techniques to deliver high quality video at low bitrates. This allows the company to deliver high quality video streams even over relatively low-bandwidth connections.</li><li><strong><em>Predictive algorithms</em></strong>: Netflix uses predictive algorithms to anticipate what content a user is likely to watch next, and pre-loads this content in the background. This allows the company to start streaming the next piece of content almost instantly, providing a seamless viewing experience.</li></ol><blockquote>Lets dive in to few of these for better understanding:</blockquote><h3><strong>Why Netflix uses multiple CDNs ?</strong></h3><p>Netflix uses multiple CDN (Content Delivery Network) providers to deliver its content to users around the world. This allows the company to deliver high quality video streams with low latency and high reliability.</p><p>CDN providers operate a network of servers located in strategic locations around the world. When a user requests to stream a video from Netflix, the content is delivered to them from the CDN server that is closest to their location. This minimizes the distance the data has to travel, resulting in faster delivery times and a better viewing experience for the user.</p><p>By using multiple CDN providers, Netflix is able to distribute its content across a wider network of servers, which can help to improve the reliability and availability of its streaming service. If one CDN provider experiences an outage or other issue, the other providers can continue to deliver content to users, ensuring a consistent streaming experience.</p><blockquote>Although, these third party CDNs are doing good, Netflix has also developed its own CDN called <a href="https://about.netflix.com/en/news/how-netflix-works-with-isps-around-the-globe-to-deliver-a-great-viewing-experience">“Open Connect”</a> through which it directly delivers the content to the ISPs around the globe.</blockquote><h4>How open connect works ?</h4><p>It works by placing servers in Internet service providers (ISPs) around the world, which allows Netflix to deliver content directly to ISPs. This helps to reduce the load on the public internet and improve the streaming quality for Netflix members.</p><p>When a Netflix member wants to watch a piece of content, the Netflix app or website sends a request to the Open Connect network. The request is routed to the nearest Open Connect server, which delivers the content to the member’s device. The content is then played back on the device, allowing the member to watch it in real-time.</p><p>Open Connect is designed to be efficient and scalable, so it can handle a large volume of requests from Netflix members around the world. It also allows Netflix to customize the content delivery process for different ISPs, which helps to optimize the streaming experience for different regions and network environments.</p><h3>Why should we encode ?</h3><p>Optimized encoding is a technique used to deliver high quality video at low bitrates. By optimizing the way video is encoded, it is possible to deliver the same quality video using less data, which can be especially important when streaming video over low-bandwidth connections.</p><p>There are several techniques that can be used to optimize video encoding:</p><ol><li>Video resolution: One way to reduce the amount of data required to stream video is to reduce the resolution of the video. By decreasing the number of pixels in the video, it is possible to reduce the file size and stream the video more efficiently.</li><li>Frame rate: Another way to optimize video encoding is to reduce the frame rate of the video. By decreasing the number of frames per second, it is possible to reduce the file size and stream the video more efficiently.</li><li>Bitrate: The bitrate of a video is the amount of data used to encode each second of video. By reducing the bitrate, it is possible to stream the video more efficiently.</li><li>Codecs: Different codecs (short for “coder-decoder”) can be used to encode and compress video in different ways. Some codecs are more efficient at encoding video than others, and can be used to reduce the file size and stream the video more efficiently.</li></ol><blockquote>The company uses a variety of codecs (short for “coder-decoder”) to encode and compress its video content, including H.264, H.265, VP9, and AV1.</blockquote><p>By using these and other techniques, it is possible to deliver high quality video at low bitrates, which can be important when streaming video over low-bandwidth connections.</p><h3><strong><em>What are predictive algorithms ?</em></strong></h3><p>Predictive algorithms are a type of machine learning algorithm that are used to make predictions or forecasts based on data. These algorithms analyze patterns in data and use this information to make predictions about future events.</p><p>Predictive algorithms can be used in a variety of applications, such as predicting stock prices, identifying credit card fraud, or recommending products to customers.</p><p>In the context of streaming video, predictive algorithms can be used to anticipate what content a user is likely to watch next, and pre-load this content in the background. This allows the streaming service to start streaming the next piece of content almost instantly, providing a seamless viewing experience for the user.</p><p>Predictive algorithms can be trained using various machine learning techniques, such as supervised learning, unsupervised learning, or reinforcement learning. The specific technique used will depend on the nature of the data being analyzed and the prediction being made.</p><blockquote>Overall, these techniques allow Netflix to deliver high quality video streams to users around the world with minimal buffering or other playback issues.</blockquote><h3>Netflix’s Open Source tools(Optional):</h3><blockquote><em>Netflix has developed a number of open source tools and technologies to improve the efficiency and reliability of its streaming service, including the </em>Netflix Conductor workflow orchestration platform and the Netflix Eureka service discovery system.</blockquote><h4><strong>Netflix’s Conductor workflow orchestration platform:</strong></h4><p>Netflix Conductor is an open-source workflow orchestration platform that was developed by Netflix to manage and coordinate the execution of tasks within their microservices architecture. It allows Netflix engineers to define, execute, and monitor complex workflows that span multiple microservices, helping to ensure that tasks are performed in the correct order and that dependencies between tasks are properly managed.<br>Conductor is designed to be highly scalable and fault-tolerant, so it can handle a large volume of workflow executions without experiencing downtime or performance issues.</p><p><strong><em>Netflix has open-sourced Conductor, so it is now available for anyone to use.</em></strong> It is widely used by organizations around the world to manage and orchestrate complex workflows within their own microservices architectures. You can find it <a href="https://github.com/Netflix/conductor">here</a> on GitHub.</p><h4><strong>Netflix’s Eureka:</strong></h4><p>Netflix Eureka is a service discovery system that was developed by Netflix to help manage and scale its microservices architecture. Eureka is a server-based service that runs on the Netflix infrastructure and is used to track the availability of services that are running within the Netflix ecosystem.</p><p>Eureka works by maintaining a registry of all the services that are running within the Netflix infrastructure. When a service comes online, it registers itself with Eureka, providing information about its hostname and port number. Other services that depend on this service can then use Eureka to discover its location and connect to it.</p><p>Eureka helps to improve the reliability and scalability of the Netflix infrastructure by making it easy for services to discover and connect to other services.</p><blockquote>There are multiple other projects. You can find all open source Netflix’s project <a href="https://github.com/Netflix">here</a>.</blockquote><p>If you enjoyed this article, please consider giving it a few claps to help others discover it. Your support is greatly appreciated!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=525b64ad43ee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How your company knows if you have published a secret in public GitHub repository]]></title>
            <link>https://medium.com/@bharatmakhija/how-your-company-knows-if-you-have-published-a-secret-in-public-github-repository-e42fa1c509ec?source=rss-8fbadc7ba6d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/e42fa1c509ec</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-security]]></category>
            <category><![CDATA[secrets]]></category>
            <dc:creator><![CDATA[Bharat Kumar Makhija]]></dc:creator>
            <pubDate>Sun, 17 Jul 2022 08:21:37 GMT</pubDate>
            <atom:updated>2022-07-17T08:21:37.080Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EoSJt4neqGj1o1dQ" /><figcaption>Photo by <a href="https://unsplash.com/@markusspiske?utm_source=medium&amp;utm_medium=referral">Markus Spiske</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><blockquote>It is very important to have top-notch security in current times to avoid breaches and ensure credentials are safe. When it comes to security, one must be aware of what secrets are. Why should they be protected? What are the advanced modern steps we can use to protect secret leaks? What security measures are software companies using to prevent these leaks? This article discusses one of the approaches which is followed across companies.</blockquote><h4><strong>What is a secret?</strong></h4><p>If your project is communicating with some external service, it might need some kind of key or token for authentication. These keys and tokens authenticate your identity to the called service. If these are stolen, anyone else can act on behalf of your project to call the service. Such keys, tokens etc. are called secrets.</p><p>Tip:<em> Secrets should always be stored in dedicated secured location outside of repository.</em></p><h4><strong>What goes behind the scenes when a secret is published in a public repository?</strong></h4><p>I’ll try to keep it short and explain how it works. Whenever you run a git push command to push new changes in your repository. GitHub runs a secret scan on the pushed changes. GitHub tries to match the secret with the patterns provided by the partner companies (<em>part of </em><strong><em>secret scanning partner program</em></strong>) and if there is a match, GitHub informs the company about the potential secret leak. Then the corresponding company can take appropriate action i.e. First it will definitely send the alert to the user via email, and then it can either invalidate the secret itself or leave it on the user to take some action. It will depend on the risk involved with the secret leak.</p><h4><strong>How can one sign up for a secret scanning partner program?</strong></h4><p>To sign up for the secret scanning partner program, one needs to contact GitHub at <a href="/service/mailto:secret-scanning@github.com">secret-scanning@github.com</a>, and get the process started. You can read more <a href="https://docs.github.com/en/developers/overview/secret-scanning-partner-program#contact-github-to-get-the-process-started"><em>here</em></a>.</p><p><strong><em>What is needed from a service provider end?</em></strong></p><p>We need to provide 3 things to GitHub so that they can configure scanning of secrets generated by our service.</p><ol><li>We need to provide a regex that will closely match the secrets generated by our services. Tip: Be as precise as possible to avoid false positives.</li><li>We need to provide a human readable name so it can be mapped to some type. For instance, if you have a look at the snapshot, Adobe has different secrets and corresponding names.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*i9j0WVPOUn895PzrgVnXAA.png" /><figcaption>Image taken from GitHub public document; link attached in next line</figcaption></figure><p>You can find the entire list of partners <a href="https://docs.github.com/en/code-security/secret-scanning/secret-scanning-patterns#supported-secrets-for-partner-patterns"><em>here</em></a>.</p><p>3. Expose an HTTPS endpoint which GitHub secret scanner service can call; in case it finds a potential leak. Click <a href="https://docs.github.com/en/developers/overview/secret-scanning-partner-program#create-a-secret-alert-service"><em>here</em> </a>to know how to create a secret alert service.</p><h4><strong>What are default settings for public and private repositories?</strong></h4><p>For public repositories it&#39;s enabled by default. For private repositories, scanning needs to be enabled by repository administrators or organization owners.</p><h4><strong>Advanced secret security for organizations</strong></h4><p>Big organizations can sign up for Advanced secret security scan. Advanced security scanning shifts the secret scanning to a level up. i.e. It looks for secrets before a git push command is accepted. If the file contains secret, push will not be allowed.</p><p>Basically, it shifts the scanning mode from reactive (after git push is accepted) to proactive (before git push is accepted) mode. This is termed as ‘<strong><em>Secret scanning push protection</em></strong>’.</p><p>Organizations with GitHub Advanced Security can enable secret scanning’s push protection capability at the repository and organization levels with just one click in the UI or via the API.</p><p>For <strong>enabling at Organization level</strong>. Go to Organization main page -&gt; settings -&gt; Code security and analysis -&gt; GitHub Advanced Security -&gt; Secret Scanning -&gt; Push Protection. Click on enable all.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/643/1*e1LBfJv-HDHHT3_-xaswGQ.png" /><figcaption>Image taken from GitHub documentation</figcaption></figure><p>One can also select to automatically enable for private repositories.</p><p>For <strong>enabling at repository level</strong>. Go to <em>Repository page -&gt; settings -&gt; Code security and analysis -&gt; Secret scanning -&gt; Push Protection</em>. Click on Enable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*j3DRv9nG6_m2wp0AApfzhQ.png" /><figcaption>Image taken from GitHub documentation</figcaption></figure><p>I hope this has given you a good insight into what goes behind the scenes when a secret is published. I’ll meet you in the next article. Bye!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e42fa1c509ec" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[10X software engineer? How to be one]]></title>
            <link>https://medium.com/@bharatmakhija/10x-software-engineer-how-to-be-one-c13ebe0e9f1d?source=rss-8fbadc7ba6d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/c13ebe0e9f1d</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[10x-engineer]]></category>
            <dc:creator><![CDATA[Bharat Kumar Makhija]]></dc:creator>
            <pubDate>Tue, 12 Jul 2022 04:51:37 GMT</pubDate>
            <atom:updated>2022-07-12T04:56:51.507Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>If you are here, I would assume you are looking for a way to be better. Not just to be better but to be Awesome at your work.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BB28CwErLADPPLMj" /></figure><p>What is a 10X engineer?</p><p>10X engineer is such a buzz word these days that different people have different expectations when they hear this word. So, it makes sense to explicitly state what a 10X engineer stands for.</p><p>10X engineer is Not someone who writes code very fast and finishes multiple tasks in a day. 10X engineer is also not someone who has learnt all the algorithms and design patterns under the sun. 10X engineer is also not someone who picks up the most difficult task.</p><p>But instead, a10X engineer is one who strives to be better at coding, tries to write the best code possible but humble enough to accept corrections or rewrites. 10X engineer is one who tries to complete the work in time but if needed, doesn’t hesitate to push back. A 10X engineer is one who first tries to look for a solution that requires minimal or zero code changes instead of adding more code to maintain later. A 10X engineer is one who even though knows a lot of algorithms, design patterns and what not, or no matter how much experience they have gained, are still humble enough to accept that they can be wrong and team’s combined knowledge and decision prevails over an individual&#39;s knowledge and expertise. 10X engineer is one who is curious enough to learn new things, try new things. 10X engineer is one who is a clean coder and a pragmatic programmer. 10X engineer is one who inspires everyone else to be a 10X engineer themselves.</p><p>Anyone willing can be a 10X engineer, we all know ‘HOW’ somewhere deep inside but we either fail at bringing it to our conscious levels or we are afraid of it. People get afraid just by thinking what will happen if they actually become that good? Will there be too much pressure? Will they be able to handle it? so on and so forth.</p><p>On reading the points below, you might say you don’t have time for all this. Remember, No one has. If you are striving to be better than anyone else, you have to do something which others are not doing. You need to invest time and sweat in this. OfCourse, it&#39;s a choice.</p><p>I dare you to set a goal to be better every day. I dare you to commit to the points discussed below and reinvent yourselves.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6QyiG5CBAzOQFiwo" /></figure><h4><strong>1. Make the roots stronger — Understand Common Technology</strong></h4><p>For software engineers technology is changing every day. If you switch a team let alone company, almost entire tech stack changes. That said there are a few things which are adapted almost everywhere, across teams and companies. Our first goal should be to best in those. Make sure no one else has to invest their time teaching you these basics when you join. The first one is version control — git, beanstalk, perforce etc. Git is commonly used in open-source projects and also by many Tech companies, so having a good understanding of git is a must.</p><p>Next is cloud services. Almost every company is moving their services to the cloud. Having a good understanding of cloud concepts will definitely provide you with an edge. Develop a good understanding of cloud concepts of at least one vendor Azure, AWS, Google cloud etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/536/1*6n5ZnT884Z-8Uq0-AunSOg.png" /></figure><h4><strong>2. Read a lot, Understand the current services in use</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SCSIvDNWq6sooJuW" /></figure><p>Read the code of the services you have. Try to understand the design. Try to rewrite one of the services, let it be half cooked but at least tie up the components. This will not only give you an understanding of the current code but also make you think in terms of current design. Create a mental map or create a low-level diagram, create some documentation to note down what you understood. You may or may not be working on it currently but doing so will help greatly in the near future whenever some work comes in that area or whenever some discussion is going on.</p><p>As stated in a famous quote “<em>Tomorrows battle is won during today’s practice</em>”</p><p>By doing this slowly over time you will realize that now your domain is broadened, you know many things in your team. You are slowly becoming one of the go-to people of the team.</p><h4><strong>3. Sharp your axe and save repeated efforts when possible</strong></h4><p>“<em>If I only had an hour to chop down a tree, I would spend the first 45 minutes sharpening my axe</em>.” — Abraham Lincoln.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*xx-Me_VtXnBcSSUut5yDAw.png" /></figure><p>Many developers make this mistake. When you get one task you don’t think about what is the best way to do it. Does it require code changes at all? Can we solve the problem without adding more code, which will mean less code to manage in future. Which tool should I use? Am I using all the help the latest tools can provide to write better code? For instance, if you are writing a UI code, which editor you should use and why? Are there any extensions to help you to complete the code faster?</p><p>Do you know the shortcuts your IDE provides? Maybe to generate a template code or to autocomplete. Have a quick search. I am sure you will definitely find something that will help you in your next project. Thank me later :P</p><p>Automate — Write scripts and automate the manual task that you have to do again and again. For instance, you need to run some queries daily to fetch some data, write a script to do it and fix it to run daily on scheduled time.</p><h4><strong>4. Have an eagle&#39;s eye — Search.</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DQXFkqHYyksedrF-" /></figure><p>It&#39;s a very basic, often underestimated but a required skill. Well, what does it take to search? Just write what you want to search for in your search engine, open the first few links. Done?</p><p>No. If you are searching for something technical, it’s important that you clearly explicitly mention the version of whatever software/language/framework you are searching for. Ensure you are not reading results which are very old and not relevant any more.</p><p>Make a habit of searching in documentation first. Try to take multiple references and if something works for you, don’t forget to promote the answer.</p><p>If you hit the dead end, feel free to ask questions. One place which I am sure you must have encountered is stack overflow. Take help of the community and help back by answering questions on topics you have expertise on.</p><h4><strong>5. Do code reviews</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0PWEcK5xW6eyND4vZgvs7g.png" /></figure><p>Code reviews are the best. They give you good technical insight of what others are doing in your team/organization and what current work is going on, at what stage that work is. Especially in case the team is scattered across Geo and time zones. Not only will we be up to date with the work but also the tech stack and language advancements.</p><p>I would suggest just giving 15 mins daily to do code reviews, even if you are asked to review or not. Also take up a repository/project in which you are interested in working and you know very little about it. Slowly you will realize that not only you are getting a grasp on the code and what it&#39;s doing, you will find yourself actually reviewing the code, leaving comments. This will show your peers and seniors that you are improving and they can trust you with more complex tasks in the future.</p><h4>6. If you understand everything, you must be misinformed!</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*w5v34Ft_jzmDkrQb" /></figure><p>If you are not asking questions that simply means either you understand everything on the topic being discussed, in that case you should be the one talking and asking others to ask questions, if not, probably your mind is somewhere else, you don’t find the topic interesting enough for your attention.</p><p>If it&#39;s later, then some action is needed. If you are sure the topic is of no use to you, feel free to save your energy and drop out from the conversation. Don’t feel obligated to attend each and every meeting or discussion just because everyone else is attending, because it will be you in the end who will be doing your work. You should control how your time is being invested, as energy and time is limited. One should remember that</p><p>“Time and Energy spent doing one thing is the time and energy spent not doing the other thing”.</p><p>On the contrary, if you think the topic is of use to you but you know very little about the topic being discussed. Better you should ask questions and try to understand more. If you think you asking questions will kill others time, acknowledge that you don’t know much about this but are interested. Ask for resources to read or ask someone who knows if they can give more detailed KT. This will benefit all.</p><p>I’ll close this by saying, always strive to be an ideal student. This is what an ideal student should be as defined by Chanakya:</p><p><em>The ideal student is one who tries to learn in any situation, from anyone be it someone you like or dislike, one who is not bothered about what others will think of them. One who understands that no question is a stupid question. Their only objective is to learn and grow.</em></p><h4><strong>7. Challenge yourself, Practice a lot!</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AyLm3lVyd6X3sD9i" /></figure><p>Yes, even though you are learning a lot, investing time in points above but if you are not practicing enough, you won’t be able to cement your learnt concepts.</p><p>I would suggest challenging yourself. For instance, how much time does it take for you to scaffold a project from scratch and write a basic API that returns some text?</p><p>How much time does it take you to deploy your existing service to a cloud or a VM in cloud? Basically, practice writing code, not just work but on your own too. Do questions in some coding platform, take part in hackathons, make plugins, games, whatever you feel like. Try to take them to completion. You will realize that all the knowledge you have been gathering will be a very powerful tool at your disposal, you will automatically be following the best industry practices, writing the latest top-notch code, using the latest tech stack.</p><p>I would close this by saying that if you can follow just 1% of this daily (Curious why just 1%, search for it) in your life, in a matter of months you will be a 10X version of your current self. All the Best!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c13ebe0e9f1d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting started with Django using  VS Code on Windows 10]]></title>
            <link>https://medium.com/@bharatmakhija/getting-started-with-django-using-vs-code-on-windows-10-d1d5c7bc363?source=rss-8fbadc7ba6d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/d1d5c7bc363</guid>
            <category><![CDATA[windows-10]]></category>
            <category><![CDATA[django-debugging]]></category>
            <category><![CDATA[vscode]]></category>
            <category><![CDATA[django]]></category>
            <dc:creator><![CDATA[Bharat Kumar Makhija]]></dc:creator>
            <pubDate>Sun, 30 Aug 2020 10:20:38 GMT</pubDate>
            <atom:updated>2020-08-30T12:43:25.191Z</atom:updated>
            <content:encoded><![CDATA[<h3>Getting started with Django using VS Code on Windows 10</h3><h4>This is for developers who quickly want to get started with writing Django projects with VS Code.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mWeKumsKHx2Bn1_ogdGXpQ.png" /></figure><p>Step 1 and 2 are specifically for Windows 10. If you have Python and VS Code installed, feel free to skip #1 and #2. #3 and onward are generic steps. This article does not get into details of Django but explains how to create Django project, how to setup virtual environment for the project and how to debug the code using VS Code. So let’s get started.</p><ul><li><a href="#d154">Installing Python 3 (If you already have it installed, skip this step)</a></li><li><a href="#6728">Installing VS Code</a></li><li><a href="#edad">Installing Required Extensions</a></li><li><a href="#4963">Create a folder and open VS Code</a></li><li><a href="#1cce">Setting up powershell as terminal window in VS Code</a></li><li><a href="#18a8">Create virtual environment</a></li><li><a href="#5318">Install Django and other required packages using pip</a></li><li><a href="#c811">Create a Django Project</a></li><li><a href="#fd57">Running Django Server</a></li><li><a href="#c821">Setting up Python Interpreter in VS Code</a></li><li><a href="#9e1f">Debugging Django Project from VS Code</a></li></ul><h4><strong>1. Installing Python 3</strong> (If you already have it installed, skip this step)</h4><p>Go to <a href="https://www.python.org/downloads/windows/">Python.org</a> and find suitable download for your windows machine. You can choose from installing a stable version or pre-release version. I am going to download the latest stable release which is 3.7.9 while writing this.</p><p>1.1) From the Files you can select either the zip file or installer directly as per your machine configuration.</p><figure><img alt="Different installers" src="https://cdn-images-1.medium.com/max/1024/1*4g9RZ3TFsdrsjhj-10ZSVw.png" /><figcaption>Different Installers</figcaption></figure><p>1.2) If you don’t know which one to install, you can check your System type configuration by going into <em>This PC -&gt; Properties.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2x1mCB2gPpf-GC6CxDLpWQ.png" /></figure><p>1.3) I picked the executable installer which during setup will show the path where python will be installed.<strong> Make Sure to select the checkbox to add it to class path</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/987/1*LuVpkBTDo3bBGwgADWzJGQ.png" /></figure><p>1.4) Once installation completes, Make sure to disable the long path limits. This will not break anything but will allow python to use long path names.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/613/1*4QgVpxhaXh1LyAzYoc6V9w.png" /></figure><p>1.5) Verify if the installation went successful, Open Powershell (or command prompt) and run <strong>python --version</strong> and it should display the version installed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/430/1*k-TcwA-6ZOErosBV1-UjAQ.png" /></figure><h4><strong>Step 2:</strong> <strong>Installing VS Code</strong></h4><p>Go to <a href="https://code.visualstudio.com/download">code.visualstudio.com</a> and download the VS Code. Double click the installer, accept the agreement and keep going next. Finally you will reach Select Additional Tasks setup page as shown in image below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*cdicm2khZS8powpmsaPJDg.png" /></figure><p><strong>Make sure to select Add to PATH.</strong> This will allow you to open vs code directly from powershell or command prompt by writing “<strong><em>code .</em></strong>”. You can select to add open with code from windows explorer file and/or directory context menu as well. In the next window click on Install.</p><h4><strong>Step 3: Installing Required Extensions</strong></h4><p>Open VS Code, go to extensions tab and install these extensions:</p><ol><li>Python Extension: It is provided by Microsoft. You can find more details in its open source GitHub repository(<a href="https://github.com/Microsoft/vscode-python">here</a>).</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A3EuoQ0iiTEuPHThkEMR_Q.png" /></figure><p>2. Search for Django and install django-intellisense. It provides django code auto completion.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*87yNqKbJyyh-0dZ3RFD8Yg.png" /></figure><h4><strong>Step 4: Create a folder and open VS Code</strong></h4><p>Open Powershell in Administrator mode and go to location where you want to create your django project workspace. Use following command to create a folder.</p><pre>mkdir &lt;folder_name&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b--tlF00twGMD7H866faqw.png" /></figure><p>I choose the name “DjangoTest”,<strong><em> cd</em></strong> to DjangoTest folder and open VS Code using <strong><em>code .</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aja0sPXzL4p0q65Lb7KoHw.png" /></figure><h4>Step 5: Setting up powershell as terminal window in VS Code</h4><p>5.1) Open VS Code integrated terminal using <strong>CTRL + ` </strong>in VS code.</p><p>5.2) Click on the dropdown button in VS code as shown in below image and click on Select Default shell</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N1p48Q3kuGdcp6s2AS3vAA.png" /></figure><p>It will open up a window where we can select terminal from different options we have. Select Powershell as terminal window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oaKQuKbBiKBu9AbSFfjlsA.png" /></figure><h4><strong>Step 6: Create virtual environment</strong></h4><p>Use command “python -m venv &lt;env_name&gt;” and then run ls command. It should show a folder created( Note: If python2 is installed, try using python3 in above command). I have used superenv as env_name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HCda_bF5KACLgYRptWPRBQ.png" /></figure><p>Next is activate the virtual environment by running following command:</p><pre><strong><em>.\&lt;env_name&gt;\scripts\activate</em></strong></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ckFh4BeTRCbKQFKRsJ_uHw.png" /><figcaption>As you can see the virtual environment is activated.</figcaption></figure><h4><strong>Step 7: Install Django and other required packages using pip</strong></h4><p>7.1: Open VS Code terminal and activate the virtual environment.</p><p>7.2: Install Django using following command:</p><pre>pip install django</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/881/1*uC3qRqelv5UKhVe4j5o2VA.png" /></figure><p>7.3: Verify if django is installed using following command:</p><pre>django-admin --version</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3fm3GRQsmn9czUzfbI7PGA.png" /><figcaption>This command will show the version of django installed.</figcaption></figure><h4><strong>Step 8: Create a Django Project</strong></h4><p>Create a django project using following command:</p><pre>django-admin startproject &lt;projectname&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EPQOBVBK032Cr5e00-S-xQ.png" /></figure><p>I choose name as <strong><em>mysite</em></strong>, you can choose anything. After this folder with name <em>mysite</em> will get created in DjangoTest.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LBAtTFG4wlTGLOXpcLkfDQ.png" /></figure><p>If you explore mysite contains these files:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/503/1*SApZ7lSKLMfENhbnhyFA_Q.png" /></figure><p>I will write a separate article to cover details of these files. For now lets move forward with the setup.</p><h4><strong>Step 9: Running Django Server</strong></h4><p>9.1: Run following command to start django server:</p><pre>python &lt;path_to_manage.py&gt;\manage.py runserver</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sfiMWEef-1DCq8IOlTW30Q.png" /><figcaption><em>As you can see in image , it says “You have 18 unapplied migrations”. I will discuss this in separate article. For now, just go ahead and click on localhost link below.</em></figcaption></figure><p>It will start running django server at <a href="http://localhost:8000/">localhost:8000</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mv3LMY3RRgoP8UybBRL8gQ.png" /></figure><h4><strong>Step 10: Setting up Python Interpreter in VS Code</strong></h4><p>First step is to select python interpreter in vs code. In VS Code, enter this shortcut for opening Command Palette window:</p><pre>Ctrl + shift + P (For windows)</pre><p><em>[Optional]: You can change these shortcuts by modifying the </em><a href="https://code.visualstudio.com/docs/getstarted/keybindings"><em>key-Bindings</em></a><em>.</em></p><p>It will open up a window like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/1*BAe_79gVeE0nXwvQyBMqxg.png" /></figure><p>click on <em>python:Select Interpreter</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*rHg6uhmASP26YOg-_TBtIQ.png" /></figure><p>Then select the python of virtual environment superenv. Once its selected it will start showing in bottom left of IDE.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tI4x9NSI5BUQoHBX9rtrjg.png" /><figcaption>Image showing python interpreter is selected from virtual environment superenv</figcaption></figure><blockquote>This will ensure whatever libraries you have installed in your virtual environment are accessible in VS Code.</blockquote><h4><strong>Step 11:</strong> <strong>Debugging Django Project from VS Code</strong></h4><p>11.1) Go to your django project and open any file (open any file from sites folder).</p><p>11.2) Follow steps as shown in image below. This will create a django launch.json file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_QmWSPLamJRtsB_ys_oXew.png" /><figcaption>Follow the steps 1, 2 and 3 as shown in image.</figcaption></figure><p>It will ask for path where manage.py is present. By default it points to workspace folder( which is <em>DjangoTest </em>in this case).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n9mG8hrXjbQ33qM6x9H6Og.png" /></figure><p>11.3) Add django project name(<strong><em>mysite</em></strong>, in this case) in the path to complete the path to manage.py</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IgVtfEjuNXZoukOCo9DBJQ.png" /></figure><p>Press Enter. It will create a launch.json file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*G12avfKPCiy3Bfm-9S8IVA.png" /><figcaption>launch.json file</figcaption></figure><p>Now we are all set. Go to Urls.py and set a break point as shown.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/1*NttQ3nj-YA0osMD9-h8eCA.png" /></figure><p>11.4) Now go to run and start debugging by clicking green arrow. Follow steps as shown in below image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QO4PWYK9dHKfrOy7Fhl-9A.png" /><figcaption>Follow the steps as shown in image.</figcaption></figure><p>Now, we can see that debugger came to our breakpoint.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*joCAjQJR5ZA_Eqhg8NkAxw.png" /></figure><p>So that’s that. This concludes my article here. Happy Coding! PEACE!!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d1d5c7bc363" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>