<?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 Divyanshu Shekhar on Medium]]></title>
        <description><![CDATA[Stories by Divyanshu Shekhar on Medium]]></description>
        <link>https://medium.com/@imdshekhar?source=rss-8513a46471c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*A96I62Z7IDo3f5aqHe7kdQ.jpeg</url>
            <title>Stories by Divyanshu Shekhar on Medium</title>
            <link>https://medium.com/@imdshekhar?source=rss-8513a46471c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 22 May 2026 13:15:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@imdshekhar/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[Why MCP Servers Fail Silently (And Nobody Notices)]]></title>
            <link>https://medium.com/@imdshekhar/why-mcp-servers-fail-silently-and-nobody-notices-49ad0ba1afd9?source=rss-8513a46471c------2</link>
            <guid isPermaLink="false">https://medium.com/p/49ad0ba1afd9</guid>
            <category><![CDATA[mcps]]></category>
            <category><![CDATA[mcp-server]]></category>
            <category><![CDATA[openai]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[claude]]></category>
            <dc:creator><![CDATA[Divyanshu Shekhar]]></dc:creator>
            <pubDate>Wed, 07 Jan 2026 06:25:50 GMT</pubDate>
            <atom:updated>2026-01-07T07:32:01.000Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TSt9nMr1A4p3PJYsxcoURw.png" /><figcaption>MCP Failure</figcaption></figure><p>Most MCP servers don’t fail loudly.</p><p>They start up.<br>They register tools.<br>The LLM interacts with the server.<br>They return responses.</p><p>And yet, something is wrong.</p><p>The results feel inconsistent.<br>Certain tools are rarely invoked.<br>Arguments look “almost right”.<br>The agent compensates, retries, or hallucinates around gaps.</p><p>If your definition of “working” is “it didn’t crash”, your MCP server is already broken.</p><p>The uncomfortable reality is that many MCP servers fail in ways that look like success.</p><h3>MCP failures are logical, not technical</h3><p>Traditional systems fail in obvious ways.</p><p>An exception is thrown.<br>A request times out.<br>A process crashes.<br>An alert fires.</p><p>MCP systems fail differently.</p><p>A tool is technically callable but practically unusable.<br>A schema is valid but semantically wrong.<br>A required precondition is never satisfied.<br>A downstream tool never receives the data it assumes exists.</p><p>The system still produces output.</p><p>That is what makes these failures dangerous.</p><p>The most costly MCP failures do not stop execution. They degrade it.</p><h3>The contract problem nobody checks</h3><p>MCP tools are defined by contracts: schemas, descriptions, and expectations about behaviour.</p><p>In practice, those contracts drift constantly.</p><p>Fields that are required in reality are marked optional.<br>Descriptions encode behaviour that the schema never enforces.<br>Breaking changes are introduced without versioning.<br>Assumptions are documented in comments, not validated anywhere.</p><p>The uncomfortable truth is simple:</p><p>MCP has contracts, but almost nobody treats them like contracts.</p><p>There is no static validation.<br>No pre-execution enforcement.<br>No CI failure when a contract regresses.</p><p>Instead, the first real “validation” happens when an LLM tries to use the tool.</p><p>An LLM is not a contract checker. It is a probabilistic consumer.</p><h3>Tool dependency chains are invisible</h3><p>Very few MCP servers are truly flat.</p><p>Tool A prepares input for Tool B.<br>Tool C assumes Tool A has already run.<br>Tool D only makes sense if B and C succeeded.</p><p>None of this is expressed explicitly.</p><p>There is no dependency graph.<br>No execution order guarantees.<br>No visibility into which tools are structurally required for others to function.</p><p>As a result:</p><ul><li>Order-sensitive behaviour emerges unintentionally</li><li>Partial execution paths look like success</li><li>Agents hallucinate glue logic to bridge missing steps</li></ul><p>Your MCP server already has a dependency graph.</p><p>You just can’t see it.</p><h3>“We’ll catch it in testing” is a lie</h3><p>The default response to these issues is testing.</p><p>In practice, that usually means:</p><ul><li>Trying a few prompts</li><li>Watching what the agent does</li><li>Tweaking descriptions</li><li>Retrying when something looks off</li></ul><p>This is not testing. It is sampling.</p><p>Prompt-based testing is non-deterministic by design.<br>LLMs smooth over structural problems instead of exposing them.<br>Retries and self-corrections hide the real failure modes.</p><p>If your test strategy is “try a few prompts and see what happens”, you are not validating the system. You are observing it behave.</p><p>By the time a failure is visible, it has already passed through an LLM filter.</p><h3>Why this failure mode is unique to MCP</h3><p>This is not a criticism of MCP.</p><p>MCP exposes capabilities, not workflows.<br>Execution is mediated by an LLM, not a deterministic controller.<br>Control is probabilistic.<br>Failures are negotiated, not thrown.</p><p>MCP did not create these problems.<br>It removed the illusion that software is always in control.</p><p>Once you accept that, it becomes clear why traditional debugging and testing approaches fall short.</p><h3>A quiet shift in where failures should be found</h3><p>After encountering these issues repeatedly, one pattern became clear:</p><p>By the time an LLM interacts with your MCP server, it is already too late to discover structural problems.</p><p>Contracts should fail before execution.<br>Dependencies should be visible before prompts are written.<br>Unsafe changes should surface before deployment.</p><p>That line of thinking led us to experiment with analysing MCP servers statically, rather than discovering problems indirectly through LLM behaviour.</p><p>That work is documented here - Syrin: <a href="https://docs.syrin.dev/analyse">https://docs.syrin.dev/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*idMpJUQmXvBZupAucmx43w.png" /><figcaption>Syrin Analyse</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=49ad0ba1afd9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Internal Linking Automation — The Future of SEO]]></title>
            <link>https://medium.com/@imdshekhar/internal-linking-automation-the-future-of-seo-fe9b6dab4208?source=rss-8513a46471c------2</link>
            <guid isPermaLink="false">https://medium.com/p/fe9b6dab4208</guid>
            <category><![CDATA[internal-linking]]></category>
            <category><![CDATA[saas]]></category>
            <category><![CDATA[wordpress]]></category>
            <category><![CDATA[blogging]]></category>
            <category><![CDATA[seo]]></category>
            <dc:creator><![CDATA[Divyanshu Shekhar]]></dc:creator>
            <pubDate>Sun, 20 Oct 2024 08:35:10 GMT</pubDate>
            <atom:updated>2024-10-20T08:35:10.247Z</atom:updated>
            <content:encoded><![CDATA[<h3>Internal Linking Automation — The Future of SEO (SEOAutoLink)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D38CtH6NaXa6wNOw5l4qZg.png" /></figure><p>When we think about SEO, things like keywords, backlinks, and content creation often take center stage. However, one of the most overlooked yet powerful strategies for boosting your website’s visibility is <strong>internal linking</strong>. It’s simple, yet extremely effective. In this blog, we’ll explore why internal linking matters, how it can help you grow new blogs faster, and why you should start using <strong>traffic orchestration</strong> to direct visitors to your most important content.</p><p>Let’s dive in.</p><h3>What Is Internal Linking?</h3><p>Internal linking is when you link one page of your website to another. These links are important because they help visitors navigate your site and allow search engines to understand the structure of your content.</p><p>For example, if you’ve written a blog post about “SEO best practices,” you can add internal links to other related articles on your site like “keyword research,” “on-page SEO,” or “technical SEO.” This creates a network of interconnected content that makes it easier for both users and search engines to find your content.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*cqEkPOR04yZmggMiANb7Hw.png" /></figure><h3>Why Is Internal Linking Important for SEO?</h3><ol><li><strong>Improves User Experience</strong><br>Good internal linking makes your website easier to navigate. When visitors can find related articles or products easily, they tend to stay longer. This improves their experience and increases the chances that they’ll return to your site.</li><li><strong>Helps Search Engines Understand Your Content</strong><br>Search engines like Google use internal links to discover new content and understand the relationship between different pages on your site. The more relevant and connected your content is, the easier it is for Google to rank it.</li><li><strong>Distributes PageRank Across Your Website</strong><br>When one of your pages earns backlinks from other websites, it accumulates <strong>PageRank</strong> — a score Google uses to measure the importance of web pages. Internal linking helps distribute that PageRank across your site, passing the SEO “juice” to other pages. This can boost the rankings of not just the popular pages, but newer ones as well.</li></ol><h3>Internal Linking and Traffic Orchestration</h3><p>One of the most exciting things about internal linking is its ability to act as a <strong>traffic orchestrator</strong>. Imagine you’ve just written a new blog post and you want it to get more visibility. Instead of waiting for it to gain traction organically, you can direct traffic to it by linking it from your high-traffic pages. This instantly gives your new post a visibility boost without having to spend money on ads.</p><p>Not only does this help <strong>speed up indexing</strong>, but it also ensures that visitors land on the pages you care about most. This strategy can be a game-changer for sites looking to grow fast, especially if you have a lot of older content with steady traffic.</p><h3>How Internal Linking Helps Grow New Blogs</h3><p>Here’s the reality: New blogs can take time to rank on search engines. However, by using internal links from your existing high-authority pages, you can give your new posts an early boost. Think of it like giving your new content a “jump start” using the SEO power of your older, more established pages.</p><p>Let’s say you’ve got an article that regularly brings in thousands of visitors. By linking that article to a brand-new blog post, you can funnel some of that traffic directly to the new post. This leads to faster engagement, longer session times, and, most importantly, quicker indexing by search engines.</p><h3>PageRank Passing: Distributing Authority</h3><p>Earlier, we touched on <strong>PageRank</strong> — the idea that Google passes authority or “link juice” from one page to another. Internal linking plays a key role in distributing this authority across your website. It ensures that not just your most popular pages benefit from external backlinks, but that the SEO value flows to other important pages as well.</p><p>For example, if you have a cornerstone article that’s been shared widely, linked to from other websites, or even mentioned on social media, that page has a lot of PageRank. By linking it to your newer, less authoritative pages, you pass on that authority, helping those new pages climb the search rankings faster.</p><h3>Automating Internal Linking Based on Strategy</h3><p>Here’s the thing — internal linking is extremely effective, but it can also be time-consuming and difficult to manage if your site has a lot of content. And let’s be honest: manually finding and linking anchor texts isn’t the most fun task.</p><p>This is where <strong>automating internal linking</strong> comes into play. Imagine having a tool that not only automates your internal linking but also does it based on your SEO strategy and business goals. This tool would:</p><ul><li>Automatically find the best <strong>anchor texts</strong> for internal linking.</li><li>Identify <strong>orphan pages</strong> (pages without any internal links).</li><li>Help you avoid over-linking so that your internal links appear natural and not spammy.</li><li>Give you data and analytics on how your internal links are performing.</li><li>Create internal linking strategies tailored to the goals of your business — whether that’s more traffic, better ranking, or better user engagement.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ky5M2x3HRY6_UyYKZIKO1A.png" /></figure><h3>Introducing SEOAutoLink: Your Internal Linking Solution</h3><p>If you’re looking for a solution that can automate and optimize internal linking for you, look no further than <a href="https://seoautolink.com"><strong>SEOAutoLink</strong></a>. This SaaS tool is designed to handle all your internal linking needs with just a few clicks. Unlike other tools, SEOAutoLink does more than just link pages — it creates a strategic internal linking plan based on your content, your goals, and your site’s performance.</p><p>With <a href="https://seoautolink.com">SEOAutoLink</a>, you can:</p><ul><li>Automate the entire internal linking process based on <strong>custom strategies</strong>.</li><li>Receive personalized internal linking suggestions, with one-click controls for adding or removing links.</li><li>Get detailed <strong>analytics</strong> on how your internal links are helping your SEO efforts.</li><li>Use <strong>traffic orchestration</strong> to push new content by linking it to your high-traffic blogs.</li></ul><p>By using <a href="https://seoautolink.com">SEOAutoLink</a>, you can save time, improve your site’s structure, and see faster growth in your SEO rankings.</p><h3>Conclusion</h3><p>Internal linking isn’t just a small part of SEO — it’s a critical strategy that can boost your site’s ranking, improve user experience, and grow your traffic. Whether you’re a small blogger or managing a mid-sized business, effective internal linking can make a huge difference.</p><p>And if you’re serious about taking your internal linking to the next level, <strong>SEOAutoLink</strong> is the tool that can help you do it quickly and efficiently. Say goodbye to manual linking and let SEOAutoLink handle it all for you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fe9b6dab4208" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Golang Generics]]></title>
            <link>https://medium.com/@imdshekhar/golang-generics-f9d7aa9b13d1?source=rss-8513a46471c------2</link>
            <guid isPermaLink="false">https://medium.com/p/f9d7aa9b13d1</guid>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[golang-tutorial]]></category>
            <category><![CDATA[generics]]></category>
            <category><![CDATA[generic-programming]]></category>
            <dc:creator><![CDATA[Divyanshu Shekhar]]></dc:creator>
            <pubDate>Sun, 25 Jun 2023 11:23:34 GMT</pubDate>
            <atom:updated>2023-06-25T11:23:34.032Z</atom:updated>
            <content:encoded><![CDATA[<p>The wait is finally over as Go has introduced its much-anticipated feature, Golang Generics, with the release of version 1.18. We’re thrilled to dive into this fascinating addition to the language and explore how Go has implemented generics. Join us on this journey as we unravel the inner workings of Golang Generics and witness the impact it can have on your code. So without further ado, let’s embark on this adventure together!</p><h3>Understanding The Problem</h3><p>To properly understand the concept of Golang Generics, it is essential to understand the problem they aim to solve. Let’s explore this by considering a simple example.</p><p>Imagine we have a simple Add() function that takes two integers and returns their sum:</p><pre>func Add(a, b int) int {<br>    return a + b<br>}</pre><pre>func main() {<br>    fmt.Println(Add(1, 2))    // Output: 3<br>}</pre><p>This function works perfectly fine for integers, but what if we want it to accept float values as well? If we try to use a float value with our Add() function, we encounter an error:</p><pre>func main() {<br>    fmt.Println(Add(1.1, 2))    // Error: cannot use 1.1 (untyped float constant) as int value in argument to Add<br>}</pre><p>Now, you might suggest using interfaces to solve this problem, but there’s a catch. We only want the Add() function to accept integer and float values, not any other types. Unfortunately, achieving this level of specificity is not possible with interfaces alone.</p><p>This is where Golang generics come into play.</p><h3>What’s New in Go 1.18?</h3><p>In the highly anticipated release of Go version 1.18, which followed seven months after the previous version 1.17, the language introduced a game-changing feature: generics. Fulfilling its compatibility promise, Go 1.18 ensures backward compatibility with Go 1, ensuring a smooth transition for developers.</p><p>So, what exactly do these generics bring to the table? Let’s delve into the three major advancements that accompany this release:</p><p>Defining Interface Types as Sets of Types<br>Type Parameters for Functions and Types<br>Type Inference<br>Exciting, isn’t it? So, fasten your seatbelts and get ready to witness the power of generics in Go 1.18!</p><h3>What is a Generic Type?</h3><p>In programming, a generic type is a type that can be used with multiple other types, allowing for code reusability and flexibility.</p><p>It serves as a template, enabling you to write functions and data structures that work seamlessly with various data types without duplicating code.</p><h3>Generics Overview</h3><p>In order to grasp the concept of generics in Go more effectively, let’s take a moment to gain an overview of how other programming languages, such as C++ and Java, implement generics. By comparing and contrasting these implementations, we can better understand the unique approach that Golang brings to the table.</p><p>In C++, generics are achieved through templates, which allow generic functions and classes to be created. Templates enable the definition of algorithms and data structures that can work with multiple types without sacrificing type safety.</p><pre>template &lt;typename T&gt;<br>void swap(T&amp; a, T&amp; b) {<br>    T temp = a;<br>    a = b;<br>    b = temp;<br>}</pre><p>Here, T represents the generic type parameter, and it allows us to write a single swap function that works for various data types.</p><p>Java, on the other hand, introduced generics with the release of Java 5. Generics in Java are implemented using type erasure, a technique where type information is removed at runtime, making generics a compile-time feature.</p><pre>public class Box&lt;T&gt; {<br>    private T value;</pre><pre>    public void setValue(T value) {<br>        this.value = value;<br>    }</pre><pre>    public T getValue() {<br>        return value;<br>    }<br>}</pre><p>In this example, T is the type parameter that allows the Box class to work with different types of values.</p><p>Now, let’s shift our focus back to Go and explore its take on generics.</p><h3>Prerequisites</h3><p>To get started with this tutorial, you’ll need:</p><p>Go version 1.18 or greater installed: Make sure you have Go installed on your system, preferably version 1.18 or a newer release.<br>Solid understanding of Go basics: Ensure that you have a good understanding of Go’s fundamental concepts, including struct types, for loops, slices, and interfaces.<br>With these prerequisites fulfilled, we’re all set to dive into the fascinating world of Golang generics. Let’s begin our coding journey together!</p><h3>Golang Generics Syntax</h3><p>In the world of Go, generics have made their grand entrance starting from version 1.18, adding a whole new level of flexibility and power to the language. Now, let’s dive into the syntax of Golang generics, exploring how they can be used with functions and types.</p><p>Golang Generic Function Syntax<br>To define a generic function in Go, we utilize the following syntax:</p><pre>func FunctionName[T Constraint](a, b T) T {<br>    // Function Body<br>}</pre><p>In the above syntax, FunctionName represents the name of our generic function. The square brackets [T Constraint] indicate the use of a type parameter T, which can be any type constraint.</p><p>Inside the function parentheses (a, b T), we define the input parameters a and b of type T. The return type of the function is also T, denoted after the parentheses. You can replace T with any valid identifier that fits your needs.</p><p>Read full from original Post: <a href="https://hackthedeveloper.com/golang-generics/">Golang Generics</a>. <a href="https://www.google.com/search?q=golang+generics+site%3Ahackthedeveloper.com">Find the blog on Google</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f9d7aa9b13d1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python Lam]]></title>
            <link>https://medium.com/@imdshekhar/python-lam-4554550c0cd8?source=rss-8513a46471c------2</link>
            <guid isPermaLink="false">https://medium.com/p/4554550c0cd8</guid>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Divyanshu Shekhar]]></dc:creator>
            <pubDate>Mon, 19 Jun 2023 15:42:55 GMT</pubDate>
            <atom:updated>2023-06-19T15:42:55.733Z</atom:updated>
            <content:encoded><![CDATA[<h3>Python Lambda Function</h3><p>In Python, developers use lambda functions as anonymous, inline functions that can be defined and called on the fly without needing a separate function. Programmers commonly use lambda functions to pass functions as arguments to higher-order functions or to define simple, one-time-use functions.</p><p>In this article, we’ll be exploring Python lambda functions in-depth and how they work. We’ll cover their syntax, use cases, advantages, and limitations. Furthermore, we’ll provide practical examples to help us understand how to use lambda functions effectively in Python.</p><h3>Python Lambda Function Syntax</h3><p>People know the Lambda function in Python as an anonymous function that can have any number of arguments but can only contain expressions in its body.</p><p>Let’s take a closer look at the syntax of a lambda function and explore each characteristic in detail:</p><pre>lambda arguments: expression</pre><h3>Expressions Only</h3><p>A lambda function can only contain expressions, which means it cannot include statements, such as print statements or assignments, in its body.</p><p>If we try to add a statement in a lambda function, it will raise a SyntaxError.</p><pre># Invalid syntax<br>lambda x, y: print(x + y)</pre><pre># Valid syntax<br>lambda x, y: x + y</pre><h3>One Line, One Shot</h3><p>We write a lambda function as a single line of execution, which means we cannot include multiple lines of code in it.</p><p>However, we can include multiple expressions by separating them with commas.</p><p>Example of invalid Python lambda function syntax:</p><pre># Invalid syntax<br>lambda x, y:<br>    x += 1<br>    y += 1<br>    return x + y</pre><pre># Valid syntax<br>lambda x, y: (x + 1, y + 1)</pre><h3>Inference over Annotation</h3><p>A lambda function does not support type annotations, which means we cannot specify the type of arguments or the return type of a lambda function.</p><p>However, Python can infer the type of arguments and the return type of a lambda function.</p><pre># Invalid syntax<br>lambda x: int: x + 1</pre><pre># Valid syntax<br>lambda x: x + 1</pre><h3>Lambda on the Fly (IIFE)</h3><p>We can immediately invoke or execute a lambda function, which means we can call it as soon as we define it.</p><p>This is also known as an Immediately Invoked Function Expression (IIFE) in Python.</p><pre># Invalid syntax<br>(lambda x, y: x + y)(10, 20)</pre><pre># Valid syntax<br>result = (lambda x, y: x + y)(10, 20)<br>print(result)</pre><h3>Python Lambda Function Arguments</h3><p>Python lambda functions can take any number of arguments, but they can only have a single expression. Developers often use lambda functions as a substitute for named functions when the function’s functionality is simple and a named function would be excessively complex.</p><p>The arguments to a lambda function are passed in the same way as they would be for a named function. They can be positional arguments, default arguments, variable-length arguments, or keyword arguments.</p><h3>No Arguments, No Problem</h3><p>A lambda function in Python can have any number of arguments, including zero arguments. Lambda function with no arguments performs a simple operation without needing any inputs.</p><pre># a lambda function that returns the string &quot;Hello, World!&quot;<br>hello = lambda: &quot;Hello, World!&quot;<br>print(hello())  # Output: Hello, World!</pre><p>We use lambda functions with no arguments when we need to perform a simple operation that does not require any input from the user. We can use them in scenarios where we need to pass a function as an argument to another function, but the function itself does not require any arguments.</p><h3>Positional Arguments</h3><p>The lambda function takes positional arguments based on their position. This means that the first argument in the lambda function definition corresponds to the first argument passed to the function, the second argument in the lambda function definition corresponds to the second argument passed to the function, and so on.</p><pre># a lambda function that takes two positional arguments and returns their product<br>product = lambda x, y: x * y<br>print(product(2, 3))  # Output: 6</pre><p>In the above example, we have defined a lambda function product that takes two positional arguments and returns their product. We have called this lambda function and passed two arguments 2 and 3.</p><h3>Default Arguments</h3><p>The lambda function specifies a default value for an argument using default arguments when the caller does not pass the argument. If the caller does not pass an argument to a lambda function that has a default value, the function uses the default value.</p><pre># a lambda function that takes one positional argument and one default argument<br>power = lambda x, y=2: x ** y<br>print(power(3))  # Output: 9<br>print(power(3, 3))  # Output: 27</pre><p>In the above example, we have defined a lambda function power that takes one positional argument and one default argument. If we do not pass the second argument, the default value will be 2. We have called this lambda function with only one argument in the first case, and with both arguments in the second case.</p><h3>Variable-Length Arguments</h3><p>In a lambda function, we use variable-length arguments to accept an arbitrary number of arguments. We denote the variable-length argument by an asterisk (*) before the argument name. This enables the lambda function to accept any number of arguments that someone passes to it.</p><pre># a lambda function that takes a variable-length argument and returns the sum of all the numbers<br>sum_lambda = lambda *args: 0 if len(args) == 0 else args[0] + sum_lambda(*args[1:])<br>print(sum_lambda(1, 2, 3, 4))  # Output: 10</pre><p>In the above example, we have defined a lambda function sum that takes a variable-length argument and returns the sum of all the numbers passed to it.</p><p>Continue Reading: <a href="https://hackthedeveloper.com/python-lambda-function/">Python Lambda Function</a>. <a href="https://www.google.com/search?q=python+lambda+function+site%3Ahackthedeveloper.com">Find Blog on Google</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4554550c0cd8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python C]]></title>
            <link>https://medium.com/@imdshekhar/python-c-c6bc5dad5073?source=rss-8513a46471c------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6bc5dad5073</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[class-method]]></category>
            <dc:creator><![CDATA[Divyanshu Shekhar]]></dc:creator>
            <pubDate>Mon, 19 Jun 2023 15:33:01 GMT</pubDate>
            <atom:updated>2023-06-19T15:33:01.591Z</atom:updated>
            <content:encoded><![CDATA[<h3>Python Classmethod</h3><p>Python’s classmethod is a special type of method that is bound to the class rather than an instance of the class. This means that you can call a classmethod on the class itself, rather than on an instance of the class. In this guide, we will explore the ins and outs of Python classmethod, including its syntax, uses, and benefits.</p><h3>Understanding Python Methods</h3><p>Before we dive into the world of Python classmethods, it’s essential to have a solid understanding of Python methods in general.</p><p>In Python, a method is a function that belongs to an object or a class. It allows us to perform specific actions or computations on the object it’s associated with.</p><h3>Basics of Python Methods</h3><p>In Python, methods are defined within the body of a class. They have access to the data and attributes of the class and can manipulate them as necessary.</p><p>When an object invokes a method, it passes itself as the first parameter to the method, conventionally named self. This parameter allows the method to access and manipulate the object’s state.</p><pre>class MyClass:<br>    def my_method(self, arg1, arg2):<br>        # Access instance-specific data using self<br>        # Perform operations using arg1 and arg2<br>        return result</pre><h3>Invoking Methods in Python</h3><p>To invoke a method, we need an instance of the class. We create an instance by calling the class as if it were a function.</p><p>Once we have the instance, we can call its methods using the dot notation.</p><pre>my_object = MyClass()  # Create an instance of MyClass<br>result = my_object.my_method(arg1_value, arg2_value)  # Invoke the method on the instance</pre><h3>The self Parameter in Python</h3><p>The self parameter is a convention in Python, and you can use any valid variable name in its place. However, it’s best to stick with the convention to maintain consistency and make your code more readable and understandable to other developers.</p><p>The self parameter allows methods to access and modify the attributes of the instance. By using self.attribute_name, you can access the instance’s attributes within the method. Similarly, by using self.attribute_name = value, you can modify the instance’s attributes.</p><pre>class MyClass:<br>    def __init__(self, name):<br>        self.name = name</pre><pre>    def greet(self):<br>        print(f&quot;Hello, {self.name}!&quot;)</pre><pre>my_object = MyClass(&quot;Alice&quot;)<br>my_object.greet()  # Output: Hello, Alice!</pre><h3>What is a classmethod in Python?</h3><p>A classmethod, as the name suggests, is a special type of method that belongs to a class rather than an instance of the class. Unlike regular methods, classmethods can be called on the class itself without the need to create an instance of the class.</p><p>They provide a way to access and manipulate class-specific data, perform operations that are independent of any particular instance, and enable alternative constructors for class instantiation.</p><p>A classmethod is defined using the @classmethod decorator. The decorator is placed above the method definition and indicates that the method is a classmethod.</p><h3>Different Ways of Creating Python classmethod</h3><p>Python provides multiple ways to create classmethods, each with its own advantages and use cases. Let’s explore the various techniques for defining classmethods and understand when and why you might choose one over the other.</p><h3>1. Using the @classmethod Decorator</h3><p>The most common and straightforward way to create a classmethod is by using the @classmethod decorator.</p><p>As mentioned earlier, this decorator is placed before the method definition to indicate that it should be treated as a classmethod.</p><p>Example:</p><pre>class MyClass:<br>    @classmethod<br>    def my_class_method(cls, arg1, arg2):<br>        # Access class-specific data using cls<br>        # Perform operations using arg1 and arg2<br>        return result</pre><p>In this approach, the cls parameter is automatically passed to the method, representing the class itself.</p><p>It allows you to access class-specific attributes and perform operations that are relevant to the class as a whole.</p><p>Continue Reading: <a href="https://dev.to/divshekhar/python-classmethod-92i">Python Classmethod</a>. <a href="https://www.google.com/search?q=python+classmethod+site%3Ahackthedeveloper.com">Find Blog on Google</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6bc5dad5073" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python]]></title>
            <link>https://medium.com/@imdshekhar/python-5ec1e0a2933?source=rss-8513a46471c------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ec1e0a2933</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[function]]></category>
            <category><![CDATA[enumerate]]></category>
            <dc:creator><![CDATA[Divyanshu Shekhar]]></dc:creator>
            <pubDate>Mon, 19 Jun 2023 15:01:32 GMT</pubDate>
            <atom:updated>2023-06-19T15:01:32.824Z</atom:updated>
            <content:encoded><![CDATA[<h3>Python Enumerate</h3><p>Are you tired of writing complex loops in Python just to access both the index and value of each element? Say goodbye to manual indexing and welcome Python Enumerate! In this blog, we’ll show you how Enumerate simplifies iterations, improves code readability, and pairs each element with its index. Let’s dive in and unleash the power of Python Enumerate together. Oh, and don’t miss the fun fact about Python Enumerate at the end!</p><h3>Understanding The Problem</h3><p>Have you ever found yourself in a situation where you needed to iterate over a list in Python and access both the index and value of each element? If you’ve been coding in Python for a while, you might be familiar with the traditional approach of using a for loop and manually managing the indices. However, this method can quickly become tedious and prone to errors, especially when dealing with larger datasets.</p><p>Let’s consider a simple example to understand the problem. Suppose we have a list, and we want to iterate over this list and print both the index and the value, we might write something like this:</p><pre>fruits = [&quot;apple&quot;, &quot;banana&quot;, &quot;cherry&quot;]<br>for i in range(len(fruits)):<br>    print(&quot;Index:&quot;, i, &quot;Fruit:&quot;, fruits[i])</pre><p>Or something like this:</p><pre>fruits = [&quot;apple&quot;, &quot;banana&quot;, &quot;cherry&quot;]<br>i = 0<br>for fruit in fruits:<br>    print(&quot;Index:&quot;, i, &quot;Fruit:&quot;, fruit)<br>    i += 1</pre><p>Output:</p><pre>Index: 0 Fruit: apple<br>Index: 1 Fruit: banana<br>Index: 2 Fruit: cherry</pre><p>Well both approaches do the job, but it involves an extra step of either using the range function or manually maintain indices using a counter variable. This can make the code less readable and prone to off-by-one errors if we’re not careful with our index calculations.</p><p>Fortunately, Python provides us with a better solution: enumerate.</p><h3>What is Enumerate in Python?</h3><p>In Python, enumerate is a built-in function that simplifies the process of iterating over iterable objects, such as lists, or tuples, by providing an automatic index assigned to each item.</p><p>With enumerate, you no longer need to rely on traditional methods like using a counter variable or accessing elements by their indices. Instead, enumerate pairs each element of the iterable with its corresponding index, making it easier to access both the value and its position in the sequence.</p><h3>Python Enumerate Syntax</h3><p>Now that we understand what enumerate is, let’s dive into its syntax and see how we can use it in our code.</p><p>Syntax of Python enumerate:</p><p>enumerate(iterable, start=0)<br>Let’s understand the enumerate parameters:</p><ul><li>iterable: The iterable parameter represents the object that we want to iterate over. It can be any iterable, such as a list, tuple, or string.</li><li>start (optional): The start parameter allows us to customize the starting index of the enumeration. By default, it is set to 0, which means the first element in the iterable will have an index of 0. However, we can specify a different value for start if needed. For instance, if we want the enumeration to start from 1, we can set start=1. To better understand the syntax, let’s explore an example:</li></ul><pre>orgs = [&#39;google&#39;, &#39;twitter&#39;, &#39;facebook&#39;]</pre><pre>for index, org in enumerate(orgs, start=1):<br>    print(f&quot;At position {index}, we have a {org}&quot;)</pre><p>Output:</p><pre>At position 1, we have a google<br>At position 2, we have a twitter<br>At position 3, we have a facebook</pre><p>In this example, we have a list called orgs containing different types of organizations. By using enumerate, we iterate over the orgs list. The index variable represents the index or position of each organization in the list, while the org variable holds the value of the corresponding organization.</p><p>Read the full tutorial on original post: <a href="https://hackthedeveloper.com/python-enumerate/">Python Enumerate</a>. Find Blog on Google. <a href="https://www.google.com/search?q=python+enumerate+site%3Ahackthedeveloper.com">Python Enumerate</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ec1e0a2933" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Blind 75 LeetCode: Crack DSA Interview]]></title>
            <link>https://medium.com/@imdshekhar/grind-75-leetcode-crack-dsa-interview-73e1b5fabe50?source=rss-8513a46471c------2</link>
            <guid isPermaLink="false">https://medium.com/p/73e1b5fabe50</guid>
            <category><![CDATA[leetcode]]></category>
            <dc:creator><![CDATA[Divyanshu Shekhar]]></dc:creator>
            <pubDate>Mon, 19 Jun 2023 07:30:12 GMT</pubDate>
            <atom:updated>2023-06-19T11:03:09.616Z</atom:updated>
            <content:encoded><![CDATA[<p>Are you here in search of the much-talked-about Blind 75 LeetCode Questions that can potentially help you crack your interview rounds? Well, you’ve come to the right place! Originally, Blind 75 was created as a collection of LeetCode Questions, but we believe that cracking interviews requires more than just DSA skills. To truly excel, you need to become an all-rounder.</p><p>Being an all-rounder means having a strong grasp of problem-solving techniques, DSA concepts, at least intermediate knowledge of a programming language, and, most importantly, the ability to work on projects.</p><p>By following this blog, we aim to equip you with the skills needed to tackle any interview scenario with confidence. So, are you ready to embark on this exciting journey of growth and learning? Let’s get started but first, get our basics clear!</p><h3>What is Blind 75?</h3><p>Blind 75 is an effective practice technique designed to help you prepare for interview rounds by solving 75 LeetCode questions, ranging from easy to hard difficulty levels, within an 8-week timeframe. It provides a structured roadmap for your interview preparation journey. By following this approach, you can enhance your problem-solving skills and boost your chances of cracking those important interviews.</p><p>The idea behind Blind 75 is simple yet powerful. It involves dedicating a focused amount of time each day to solve LeetCode questions. The curated set of 75 questions ensures that you cover a wide range of problem types and difficulty levels, allowing you to strengthen your understanding of various concepts in data structures and algorithms.</p><h3>Why Blind 75?</h3><p>Here are some compelling reasons why Blind 75 is the go-to technique for cracking DSA interviews with ease:</p><ul><li>Proper Roadmap: Blind 75 provides a well-defined roadmap for your interview preparation. With a set goal of solving 75 LeetCode questions, you have a clear direction and a tangible target to work towards. This structured approach keeps you focused and motivated throughout your journey.</li><li>Effective use of Time: Time management is crucial during interview preparation. Blind 75 instills a sense of discipline by setting time constraints for solving each question. This practice helps you develop the ability to allocate time efficiently, improving your speed and accuracy in problem-solving.</li><li>The Habit of Problem-Solving: Blind 75 cultivates a habit of consistent problem-solving. By regularly practicing LeetCode questions, you develop a rhythm of approaching challenges, analyzing problem statements, and designing effective algorithms. This habit strengthens your problem-solving skills and enhances your ability to tackle a wide range of coding scenarios.</li><li>Important DSA Concepts: DSA (Data Structures and Algorithms) form the foundation of technical interviews. Blind 75 ensures that you encounter a diverse set of LeetCode questions, covering various DSA concepts such as arrays, linked lists, trees, graphs, dynamic programming, and more. Through this comprehensive exposure, you solidify your understanding of key concepts, enabling you to confidently apply them in interviews.</li><li>Interviewers love LeetCode Questions: LeetCode has gained immense popularity among interviewers as a reliable benchmark for assessing candidates’ technical abilities. By practicing Blind 75, you align your preparation with industry standards and interview expectations. ## Modified Blind 75 Let me ask you a question: Is simply solving LeetCode questions enough to crack interview rounds? Well, we may have different opinions on this, but what we believe is that to truly excel, we need to be well-rounded. While practicing LeetCode questions is essential, we should also focus on applying our DSA knowledge by building real-world projects.</li></ul><p>In this blog, we present a modified version of Blind 75. Don’t worry, the original Blind 75 LeetCode questions remain the same. However, we have added some extra resources for each week that will help you gain intermediate-level programming knowledge and provide project resources. This way, you’ll embark on an 8-week journey to truly grind and prepare for your interview rounds. Let’s dive into Week 1 and explore what it has to offer.</p><p>Read full on the original blog: <a href="https://hackthedeveloper.com/blind-75-leetcode-question-crack-dsa-interview/">Blind 75 LeetCode</a>. Find Blog on Google <a href="https://www.google.com/search?q=blind+75+site%3Ahackthedeveloper.com">Blind 75</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=73e1b5fabe50" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Redis Hash Commands]]></title>
            <link>https://medium.com/@imdshekhar/redis-hash-commands-f1a0f85b869?source=rss-8513a46471c------2</link>
            <guid isPermaLink="false">https://medium.com/p/f1a0f85b869</guid>
            <category><![CDATA[redis]]></category>
            <category><![CDATA[hash]]></category>
            <dc:creator><![CDATA[Divyanshu Shekhar]]></dc:creator>
            <pubDate>Sun, 18 Jun 2023 16:26:56 GMT</pubDate>
            <atom:updated>2023-06-18T16:26:56.830Z</atom:updated>
            <content:encoded><![CDATA[<h3>What are Hashes?</h3><p>Hashes are maps between the string field and the string values. You can also relate it as an object in programming.</p><p>In Redis, HASHes can store up to 4 billion field-value pairs.</p><h3>Set Multiple Field Value in Redis Hash</h3><p>HMSET in Redis is used to set multiple field-value pairs.</p><pre>hmset key field value [field value ...]</pre><h3>Redis HMSET</h3><pre>$ 127.0.0.1:6379&gt; hmset student:1 name &quot;Divyanshu Shekhar&quot; rollNo   17 class 10<br>  OK</pre><h3>Set Field in Hash</h3><p>Redis HSET is used to set a Field in a pre-existing Redis Hash.</p><pre>HSET Key Field Value</pre><h3>Redis HSET</h3><pre>$ 127.0.0.1:6379&gt; hset student:1 subject &quot;CS&quot;<br>  (integer) 1<br>$ 127.0.0.1:6379&gt; hgetall student:1<br>  1) &quot;name&quot;<br>  2) &quot;Divyanshu Shekhar&quot;<br>  3) &quot;class&quot;<br>  4) &quot;10&quot;<br>  5) &quot;subject&quot;<br>  6) &quot;CS&quot;</pre><h3>Set Field if it doesn’t exist — Redis HSETNX</h3><p>Redis HSETNX is used to first check if the field exists in the Hash. If the key doesn’t exist then it adds the field in the Hash else drops it.</p><pre>HSETNX Key Field Value</pre><h3>Redis HSETNX</h3><pre>$ 127.0.0.1:6379&gt; hsetnx student:1 marks 99<br>  (integer) 1<br>$ 127.0.0.1:6379&gt; hgetall student:1<br>  1) &quot;name&quot;<br>  2) &quot;Divyanshu Shekhar&quot;<br>  3) &quot;marks&quot;<br>  4) &quot;99&quot;</pre><p>Learn more <a href="https://hackthedeveloper.com/redis-hash-commands/">Redis Hash Commands</a> from the original Post.</p><p>Also learn how to integrate Redis with Python the blog post: <a href="https://hackthedeveloper.com/use-redis-with-python/">Use Redis with Python: The Power of In-Memory Database</a>.</p><p><a href="https://www.google.com/search?q=redis+site%3Ahttps%3A%2F%2Fhackthedeveloper.com">Find More Blogs on Redis</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f1a0f85b869" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How To Install Redis on Windows 10]]></title>
            <link>https://medium.com/@imdshekhar/how-to-install-redis-on-windows-10-67ccc4d5738d?source=rss-8513a46471c------2</link>
            <guid isPermaLink="false">https://medium.com/p/67ccc4d5738d</guid>
            <category><![CDATA[redis]]></category>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[wsl]]></category>
            <dc:creator><![CDATA[Divyanshu Shekhar]]></dc:creator>
            <pubDate>Sun, 18 Jun 2023 16:24:56 GMT</pubDate>
            <atom:updated>2023-06-18T16:24:56.272Z</atom:updated>
            <content:encoded><![CDATA[<p>Redis runs natively on Linux-based operating systems but can be installed and run on Windows 10/11 using Windows Subsystem for Linux (WSL). In this blog, we will guide you through the steps to install Redis on Windows using WSL.</p><h3>What is Redis?</h3><p>Redis full form is Remote Directory Server. Redis is a popular NO-SQL in-memory data structure store that is often used as a database, cache, and message broker.</p><p>It is widely used by developers and system administrators to improve the performance and scalability of their applications.</p><h3>What is WSL?</h3><p>WSL (Windows Subsystem for Linux) is a compatibility layer for running Linux binary executables natively on Windows.</p><p>It provides a lightweight Linux environment that runs on top of the Windows operating system, enabling users to run Linux command-line tools and applications directly on Windows without the need for a virtual machine or dual-boot setup.</p><h3>Install Redis on Windows 10/11 Using WSL</h3><p>Now when we have a brief idea of what Redis and WSL is, let’s see how we can install Redis on windows using WSL.</p><h3>Step 1: Turn on Windows Subsystem for Linux</h3><p>Before we can install Redis on Windows, we need to enable the Windows Subsystem for Linux (WSL).</p><p>WSL is a compatibility layer that enables running Linux binary executables natively on Windows 11 and Windows Server 2019.</p><p>Open PowerShell as Administrator and run the following command to enable WSL:</p><pre>Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux</pre><p>After running this command, you need to reboot your system. Note that this step only needs to be done once.</p><p>Read more on <a href="https://hackthedeveloper.com/how-to-install-redis-on-windows">How to install Redis on Windows 10</a>.<br>Find Blog on Google. <a href="https://www.google.com/search?q=install+redis+windows+site%3Dhackthedeveloper.com">Install Redis Windows</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67ccc4d5738d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Have you ever wondered how Golang manages to incorporate the concept of polymorphism, similar to…]]></title>
            <link>https://medium.com/@imdshekhar/have-you-ever-wondered-how-golang-manages-to-incorporate-the-concept-of-polymorphism-similar-to-9afb2c5dfc09?source=rss-8513a46471c------2</link>
            <guid isPermaLink="false">https://medium.com/p/9afb2c5dfc09</guid>
            <category><![CDATA[interfaces]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[golang]]></category>
            <dc:creator><![CDATA[Divyanshu Shekhar]]></dc:creator>
            <pubDate>Sun, 18 Jun 2023 16:20:25 GMT</pubDate>
            <atom:updated>2023-06-18T16:20:25.622Z</atom:updated>
            <content:encoded><![CDATA[<h3>Golang Interface: The Art of Polymorphism in Go Programming</h3><p>Have you ever wondered how Golang manages to incorporate the concept of polymorphism, similar to object-oriented programming? The secret lies in the Golang interface! In this blog, we’re going to embark on an exciting journey exploring the world of the Golang interface. From understanding their declaration and implementation to unraveling the mysteries of empty interfaces, embedding, and type assertions, we have a wealth of knowledge waiting to be discovered. So, fasten your seatbelts and get ready to dive into this knowledge-packed blog. And hey, don’t forget to stick around for a fascinating fun fact about the Golang interface at the end!</p><h3>What is Golang Interface?</h3><p>In Go, an interface is a special type that defines a set of method signatures. It serves as a blueprint for the expected behavior of a type. By using interfaces, we can write code that operates on different types without worrying about their specific implementations. It promotes flexibility and modularity in our code.</p><p>For example, in a Zoo program, we can define an Animal interface with standard methods like MakeSound() and Move(), allowing us to work with different types of animals seamlessly.</p><h3>Defining Interface in Golang</h3><p>So, we’ve just explored the definition of a Golang interface. Are you feeling a bit confused? Well, I must admit that I also find it a bit perplexing when reading the definition alone. The good news is that the best way to truly grasp any concept is to dive into how it works in practice. Once we understand its workings, we’ll be able to connect the dots and make sense of that definition. So, let’s waste no time and take a closer look at the syntax of a Golang interface.</p><p>In Go, defining an interface is quite easy I would say. We use the type keyword followed by the name we want to assign to our interface. For instance, if we want to create an interface called “Messenger”, we would write:</p><pre>type Messenger interface {<br>    // Method declarations go here<br>}</pre><pre>// OR</pre><pre>type Messenger = interface {<br>    // Method declarations go here<br>}</pre><p>To define the methods that our interface should have, we simply list them within the curly braces. Each method is declared without any implementation details, only specifying the method signature. The method signature consists of the method name, any input parameters it requires (if applicable), and the return type(s) (if applicable).</p><p>Interface with the method signature:</p><pre>type Messenger interface {<br>    Send(message string) error<br>    Receive() (string, error)<br>}</pre><pre>// OR</pre><pre>type Messenger = interface {<br>    Send(message string) error<br>    Receive() (string, error)<br>}</pre><p>In this example, the Messenger interface specifies two methods:</p><p>Send, which takes a message of type string and returns an error, and<br>Receive, which returns a string and an error.<br>Any type that implements these two methods will automatically satisfy the Messenger interface.</p><p>Next, let’s explore how we can implement these interfaces and witness their functionality firsthand.</p><p>Read the full blog on: <a href="https://hackthedeveloper.com/golang-interface-syntax/">Golang Interface</a>. Find the blog on Google. <a href="https://www.google.com/search?q=golang+interface+site%3Dhackthedeveloper.com">Golang Interface</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9afb2c5dfc09" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>