<?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 Bilal Imran on Medium]]></title>
        <description><![CDATA[Stories by Bilal Imran on Medium]]></description>
        <link>https://medium.com/@bilalcodes?source=rss-a1e977d5d5cf------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ev4AaISduj4AajUS_fRJ6Q.jpeg</url>
            <title>Stories by Bilal Imran on Medium</title>
            <link>https://medium.com/@bilalcodes?source=rss-a1e977d5d5cf------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 22:35:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bilalcodes/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[Maxinggg Obsidian with AI for FREE]]></title>
            <link>https://blog.devgenius.io/maxinggg-obsidian-with-ai-for-free-8312d8c34d7a?source=rss-a1e977d5d5cf------2</link>
            <guid isPermaLink="false">https://medium.com/p/8312d8c34d7a</guid>
            <category><![CDATA[ollama]]></category>
            <category><![CDATA[obsidian]]></category>
            <category><![CDATA[co-pilot]]></category>
            <category><![CDATA[notetaking]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Bilal Imran]]></dc:creator>
            <pubDate>Sun, 12 Apr 2026 19:36:01 GMT</pubDate>
            <atom:updated>2026-04-12T19:36:01.212Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sCaZjJPh7-3LbjYBZHzxZw.png" /></figure><p>Your <strong>second brain</strong> holds your best ideas, your unfinished projects, and your personal thoughts. Why would you upload all of that to a corporate cloud just to use <strong>AI</strong>?</p><p>Today, we are going to max out <em>Obsidian</em> with a <strong>powerful, completely free</strong> AI assistant that <strong>lives entirely on your machine</strong>. No subscriptions, no cloud syncing, no data mining. Just you, Obsidian, and a two-step setup…</p><p>1- Ollama<br>2- Obsidian Plug — Copilot</p><p>That’s ALL :)</p><p>Let’s get this going 🫡 !!!!</p><h3>Ollama:</h3><p>1- Install Ollama application -&gt; <a href="https://ollama.com/download">https://ollama.com/download</a><br>You can either use CLI or download application.<br>I’m using the application to preview.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LLVIW0zsH9De1vIzijpPMQ.png" /></figure><p>2- Download qwen 3.5. ( Currently the best version for local :) )</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z7b5MOddfrDpRggPuJxr6Q.png" /></figure><h3>Obsidian:</h3><p>1- Open Settings -&gt; Community Plugins -&gt; Browse</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fr97fVdDUep5oe8y7oGXKQ.png" /></figure><p>2- Search for the plugin called Copilot. Install and Enable it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*R37Ukr7TdtUeg7yj3HWB5Q.png" /></figure><p>3-Open Copilot to do the setup for Ollama qwen 3.5.<br>Settings -&gt; Community Plugins -&gt; Copilot -&gt; Add Model</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KcmYi0kVQBBxZBWFyFdTUA.png" /></figure><p>4- Use the following values.</p><p>Model Name: qwen3.5:latest<br>Display Name: Ollama<br>Base URL: <a href="http://localhost:11434/">http://localhost:11434</a><br>CORS: ✅</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5oHQoIqNPUecDdmsXNBT6Q.png" /></figure><p>5- Make the Ollama as default Model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N-1XjKc6pT-BdLi6dNW7Xg.png" /></figure><p>6- Once enabled, a chat icon would be enable on the left.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*BADeJNsny5boU5QlRKmS0g.png" /></figure><p>7- Open Copilot and you’re done :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m-a1bn_74kDakY5sFG8Gag.png" /></figure><p>Yes that’s all. Go ahead and use your own AI model for taking notes and handling tasks in Obsidian privately and turn it into an AI powerhouse for exactly $0.00.</p><h3>Bonus Tips and Prompts:</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F25753345&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fbrace-yourself-bonusiscoming-gif-25753345&amp;image=https%3A%2F%2Fmedia.tenor.com%2FJzclzbpc7qUAAAAN%2Fbrace-yourself-bonusiscoming.png&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/67a3ae4c1e3ef1b8ebab7b19868742cc/href">https://medium.com/media/67a3ae4c1e3ef1b8ebab7b19868742cc/href</a></iframe><p>1- Highlight the text that you want to edit. Copilot gives options to refactor them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JGd0_c3ITpOTAQ_NHW-W3g.png" /></figure><p>2- Edit Prompts according to your preference, as most of them don’t work with the default prompt.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*bcHZ2FDjT2RFE6SiE9wt2A.png" /></figure><p>The above files are editable and you can also add custom prompts :)</p><h4>3- I’m providing some custom prompts.</h4><p><strong>File:</strong> Fix grammar and spelling.md</p><blockquote><em>Act as an expert editor. Fix all grammar, punctuation, and spelling errors in the following text. Preserve all markdown formatting, line breaks, and special characters. Do not change the original tone. Output ONLY the corrected text without any conversational filler, greetings, or explanations.</em></blockquote><blockquote><em>Text to edit: {{selection}}</em></blockquote><p><strong>File:</strong> Simplify.md</p><blockquote><em>Rewrite the following text to vastly improve readability. Use shorter sentences, simpler vocabulary, and active voice. Remove academic jargon but keep the core meaning exactly the same. Output ONLY the rewritten text without any introductory remarks.</em></blockquote><blockquote><em>Text to simplify: {{selection}}</em></blockquote><p><strong>File:</strong> Make shorter.md</p><blockquote><em>Act as a ruthless editor. Condense the following text to make it punchy and concise. Remove all fluff, repetition, and unnecessary adjectives, but retain all key information and core arguments. Output ONLY the shortened text.</em></blockquote><blockquote><em>Text to shorten: {{selection}}</em></blockquote><p><strong>File:</strong> Make longer.md</p><blockquote><em>Act as an expert writer. Expand on the ideas in the following text. Add relevant examples, deeper explanations, and logical transitions to make it more comprehensive. Match the original tone.</em></blockquote><blockquote><em>Text to expand: {{selection}}</em></blockquote><p><strong>File:</strong> Summarize.md</p><blockquote><em>Read the following text and provide a highly concise summary. Format your response exactly like this: </em><strong><em>TL;DR:</em></strong><em> [A single sentence summarizing the main point] </em><strong><em>Key Takeaways:</em></strong></blockquote><ul><li>[Bullet point 1]</li><li>[Bullet point 2]</li><li>[Bullet point 3] Do not add any other text.</li></ul><blockquote><em>Text to summarize: {{selection}}</em></blockquote><p><strong>File:</strong> Explain like I am 5.md</p><blockquote><em>Explain the concepts in the following text simply and clearly, using an analogy that a 5-year-old would easily understand. Avoid all technical jargon. Keep it engaging and fun.</em></blockquote><blockquote><em>Text to explain: {{selection}}</em></blockquote><p><strong>File:</strong> Generate glossary.md</p><blockquote><em>Identify the key terms, jargon, and complex concepts in the following text. Generate a Markdown table with two columns: &quot;Term&quot; and &quot;Definition&quot;. Make the definitions concise. Output ONLY the Markdown table and nothing else.</em></blockquote><blockquote><em>Text to analyze: {{selection}}</em></blockquote><p>Enjoy your new, supercharged local AI! :)</p><p>If this guide helped you piece it all together without the headache.<br>I’d massively appreciate it if you could leave an <strong>upvote</strong> and <strong>subscribe</strong>.</p><p>Also, let me know in the comments which local model (like Qwen, Llama, or something else) you ended up using for your vault!<br>THANKS !</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F2218754133828871165&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fbaby-ai-130-backpack-supreme-backpack-baby-tuff-baby-meme-gif-2218754133828871165&amp;image=https%3A%2F%2Fmedia.tenor.com%2FHsqZIRbMo_0AAAAN%2Fbaby-ai-130-backpack-supreme-backpack.png&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/c67cad3100ada2fe60f7c545b39fce7c/href">https://medium.com/media/c67cad3100ada2fe60f7c545b39fce7c/href</a></iframe><p>#Obsidian #AI #Copilot #Notetaking #Opensource</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8312d8c34d7a" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/maxinggg-obsidian-with-ai-for-free-8312d8c34d7a">Maxinggg Obsidian with AI for FREE</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[0/1 Knapsack Problem- Life is all about the choices you make :)]]></title>
            <link>https://blog.devgenius.io/0-1-knapsack-problem-life-is-all-about-the-choices-you-make-a2df315e5fa7?source=rss-a1e977d5d5cf------2</link>
            <guid isPermaLink="false">https://medium.com/p/a2df315e5fa7</guid>
            <category><![CDATA[dynamic-programming]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[knapsack-problem]]></category>
            <category><![CDATA[data-structure-algorithm]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Bilal Imran]]></dc:creator>
            <pubDate>Sun, 23 Nov 2025 09:32:05 GMT</pubDate>
            <atom:updated>2025-11-23T09:32:05.325Z</atom:updated>
            <content:encoded><![CDATA[<h3>0/1 Knapsack Problem- Life is all about the choices you make :)</h3><p>If you’ve ever packed for a trip staring at your bag like “ HOW AM I SUPPOSED TO FIT ALL THIS ? WITHOUT EXCEEDING THE WEIGHT LIMIT ???” <br>Wellll, you’ve encountered the real world version of Knapsack Problem!!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F6129722563912020695&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fmonkey-macaco-monkey-backpack-monkey-school-monkey-cute-gif-6129722563912020695&amp;image=https%3A%2F%2Fmedia.tenor.com%2FVREmMfmsMtcAAAAN%2Fmonkey-macaco.png&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/1e0e192c260a5379ec361eeecf968be8/href">https://medium.com/media/1e0e192c260a5379ec361eeecf968be8/href</a></iframe><p>This Problem will give you the foundation for many problem solving questions.</p><h3>What is the 0/1 Knapsack Problem?</h3><p>The 0/1 Knapsack problem is all about finding the most valuable combination of items that can fit into a bag with <strong>limited capacity.</strong><br> The “0/1” part means you either <strong><em>take an item (1) or leave it (0)</em></strong> there is <em>no breaking items into pieces </em>(that would be the fractional knapsack, a different beast altogether).</p><p>So really, it all comes down to just <strong>two choices</strong>: -&gt; #Take or #Leave !</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v_d12_pMINZxIJ3Y1y_HhA.png" /></figure><h3>Problem Statement:</h3><ul><li>You have a knapsack with weight capacity W</li><li>You have n items, each with:</li><li>A weight wt[i]</li><li>A value v[i]</li><li>Result: Maximize the total value while staying within the weight limit!!</li></ul><h3>Example:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6BemtikbS0dPrrEPKyDPCg.png" /></figure><p>Ask yourself: <strong>what should we pick to maximize the value?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XY9oQNkl-C-vngSKzysJ7Q.png" /></figure><p>The answer is … you’re correct it’s <strong>17 !!!! <br></strong>We’ll select the items at index <strong>0 and 3</strong>.</p><h3>Approach:</h3><p><strong>Base Case:<br></strong>If you don’t have <strong>any items</strong> OR your <strong>bag has no capacity</strong>, you won’t be able to get anything right ? So the value would be <strong>0</strong>!!!!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F19279732&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fjohnwall-nba-gif-19279732&amp;image=https%3A%2F%2Fmedia.tenor.com%2FxZOxMl8nxfkAAAAN%2Fjohnwall-nba.png&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/aa66391716b2e2575427f43fdc5accdd/href">https://medium.com/media/aa66391716b2e2575427f43fdc5accdd/href</a></iframe><pre># Base case: no items left or no capacity<br>if n == 0 or capacity == 0:<br>    return 0</pre><p>That goes our base condition! Great work :)</p><p>Now, what if the current item is <strong>too heavy</strong> for your bag?… then you have to LEAVE that item (sadly)</p><pre># If current item is too heavy, skip it<br>if weights[n-1] &gt; capacity:<br>    return knapsack(weights, values, capacity, n-1) #LEAVE IT BRO</pre><p>But what if your bag has capacity to store the items ? What happens in that case ?</p><p>Well, then we have two choices !</p><p>Either to TAKE or LEAVE.</p><pre># Otherwise, find max of:<br># 1. Take current item<br># 2. Leave current item<br><br>take = values[n-1] + knapsack(weights, capacity - weights[n-1], n-1)<br><br>leave = knapsack(weights, values, capacity, n-1)<br><br>return max(take, leave)</pre><p>As, we want to return the maximum value, so we’re asking our function to either pick or leave, but whatever you choose, give me the maximum value you can get!!</p><h3>Code:</h3><pre>def knapsack(weights, values, capacity, n):<br>    # Base case: no items left or no capacity<br>    if n == 0 or capacity == 0:<br>        return 0<br>    <br>    # If current item is too heavy, skip it<br>    if weights[n-1] &gt; capacity:<br>        return knapsack(weights, values, capacity, n-1) #LEAVE IT BRO<br>    <br>    # Otherwise, find max of:<br>    # 1. Take current item<br>    # 2. Leave current item<br><br>    take = values[n-1] + knapsack(weights, capacity - weights[n-1], n-1)<br><br>    leave = knapsack(weights, values, capacity, n-1)<br>    <br>    return max(take, leave)</pre><h3>Time Complexity</h3><p>For each element we are having 2 choices. So for n elements, we’ll have…</p><pre>Time Complexity: O(2^n) </pre><p>We have a better optimized version of the knapsack problem !!! Wait for the optimized version :)</p><h3><a href="https://www.geeksforgeeks.org/dsa/what-is-memoization-a-complete-tutorial/#how-memoization-technique-is-used-in-dynamic-programming">Memoization</a>:</h3><p><a href="https://tenor.com/view/simba-the-lion-king-rafiki-hit-the-past-can-hurt-gif-12917792">https://tenor.com/view/simba-the-lion-king-rafiki-hit-the-past-can-hurt-gif-12917792</a>We now want to optimize the operations/calls to the knapsack function.<br>To optimize, we will do the same thing that we do in our day-to-day life… Don’t calculate again, if you have already calculated it!!!</p><p>What does that even mean in this context?<br>Well, we are telling our program to:</p><blockquote>“Hey, if you’ve already solved this exact sub-problem (with these specific weights, values, capacity, and item count), just return the stored result instead of recalculating!”</blockquote><p>We’ll use a 2D array (or dictionary) to store already-computed results for each combination of remaining <strong>n </strong>and <strong>capacity</strong>.</p><pre>def knapsack_memo(weights, values, capacity, n, dp):<br>    # Base case: no items left or no capacity<br>    if n == 0 or capacity == 0:<br>        return 0<br>    <br>    # If value already computed, return it ( Saving the same calls again)<br>    if dp[n][capacity] != -1:<br>        return dp[n][capacity]<br><br>    # If item too heavy, skip it<br>    if weights[n-1] &gt; capacity:<br>        dp[n][capacity] = knapsack_memo(weights, values, capacity, n-1, dp)<br>        return dp[n][capacity]<br>    <br>    # Otherwise, find the max of take or leave<br>    take = values[n-1] + knapsack_memo(weights, values, capacity - weights[n-1], n-1, dp)<br>    leave = knapsack_memo(weights, values, capacity, n-1, dp)<br>    <br>    dp[n][capacity] = max(take, leave)<br>    return dp[n][capacity]<br><br>n = len(values)<br>dp = [[-1 for _ in range(capacity + 1)] for _ in range(n + 1)]<br>ans = knapsack_memo(weights, values, capacity, n, dp)<br>print(ans)</pre><h3>Time Complexity:</h3><p><strong><em>O(n * W) </em></strong>: We only compute each (n, capacity) pair once!</p><h3>Space Complexity:</h3><p><strong><em>O(n * W)</em></strong>: for the memoization table (and O(n) for recursion depth, if we get picky :) ).</p><h3><strong>Dynamic programming( Tabulation):</strong></h3><p>Tabulation is the bottom-up approach. Instead of relying on recursion (and worrying about stack overflows), we build a table from scratch. Think of it like filling out a spreadsheet row-by-row. You start from the simplest cases (0 items, 0 capacity) and gradually build up to the final answer. NO RECURSION. JUST ITERATION.</p><p>Remember when you were packing for that trip? You didn’t just guess what fits. You started small:</p><blockquote>“If my bag can hold 1kg, what can I fit? If it can hold 2kg, what’s the best combo?”</blockquote><p>You systematically checked each possibility. Tabulation does exactly that!</p><p>I will share the code with you below, and I want you to tell me the difference between the Memoization and tabular one.</p><pre>def knapsack_tabulation(weights, values, capacity):<br>    n = len(weights)<br>    # Create a DP table (rows: items, cols: capacity)<br>    dp = [[0] * (capacity + 1) for _ in range(n + 1)]<br>    <br>    # Fill the table<br>    for i in range(1, n + 1):  # Iterate over items<br>        for w in range(1, capacity + 1):  # Iterate over capacities<br>            # If current item can&#39;t fit<br>            if weights[i-1] &gt; w:<br>                dp[i][w] = dp[i-1][w]  # Skip it<br>            else:<br>                # Take or leave?<br>                take = values[i-1] + dp[i-1][w - weights[i-1]]<br>                leave = dp[i-1][w]<br>                dp[i][w] = max(take, leave)<br>    <br>    return dp[n][capacity]  # Final answer!!!!!!!!!!!!!!!!</pre><p>Now after looking at the code, tell me what was the thing that we have to change ?</p><p>Yess Sir, you’re right!!!!!!</p><ul><li>Replaced the recursion with the for loops.</li><li>Fill the table row by row.</li><li><em>dp[i][w] </em>represents the maximum value we can get using the first <strong><em>i</em></strong> items and a knapsack capacity of <strong><em>w</em>.</strong></li></ul><p>NOW, let’s see how to fill the table…</p><h3>How to fill the table:</h3><h4>Base Case:</h4><ul><li>If there are no items (i = 0) or no capacity (w = 0), the max value is …… 0.</li><li>So, the first row and column of our table are all 0.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/1*f8eu5lFU7d0dPv5yNKR-mw.png" /></figure><h3>Fill the table row by row:</h3><p>For each item i (from 1 to n) and each capacity w (from 1 to W):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/753/1*rJiD899NDt7Rnik7gGIk-Q.png" /></figure><p>Now without reading the code again, write it on your own :)</p><h3>Time &amp; Space Complexity:</h3><ul><li>Time: <strong><em>O(n * W)</em></strong><br>→ We fill <strong><em>n * W </em></strong>cells in the table.</li><li>Space: <strong><em>O(n * W)</em></strong><br>→ Storing the entire DP table.</li></ul><h4>Optimization Tip:</h4><p>We can reduce space to O(W) by using a 1D array (since we only need the previous row to compute the current one). But let’s save that for a future deep dive! :)</p><p>If you liked this article? Please clap 👏 and share it with fellow developers!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a2df315e5fa7" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/0-1-knapsack-problem-life-is-all-about-the-choices-you-make-a2df315e5fa7">0/1 Knapsack Problem- Life is all about the choices you make :)</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What’s new in C#14 | with Examples]]></title>
            <link>https://blog.devgenius.io/whats-new-in-c-14-with-examples-b514886b43b6?source=rss-a1e977d5d5cf------2</link>
            <guid isPermaLink="false">https://medium.com/p/b514886b43b6</guid>
            <category><![CDATA[c-sharp-programming]]></category>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Bilal Imran]]></dc:creator>
            <pubDate>Sat, 18 Oct 2025 13:11:59 GMT</pubDate>
            <atom:updated>2025-10-27T12:08:26.326Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/593/1*LE95O0941aroD0GR-lSjIg.png" /></figure><p>C# 14 is supported on .NET 10. It includes the following features, with examples!!</p><h3>nameof with Unbound Generic Types:</h3><p>Previously, using nameof with generic types required specifying type arguments:</p><pre>// Old way - required type argument<br>var name = nameof(List&lt;int&gt;); // Returns &quot;List&quot;</pre><p>C# 14 allows you to use unbound generic types:</p><pre>// New way - unbound generic<br>var name = nameof(List&lt;&gt;); // Returns &quot;List&quot;<br>var dictionaryName = nameof(Dictionary&lt;,&gt;); // Returns &quot;Dictionary&quot;</pre><h3>The field keyword:</h3><p>Previously, if you wanted to ensure that a string property couldn&#39;t be set to null, you had to declare a backing field and implement both accessors:</p><pre>private string _msg;<br>public string Message<br>{<br>    get =&gt; _msg;<br>    set =&gt; _msg = value ?? throw new ArgumentNullException(nameof(value));<br>}</pre><p>You can now simplify your code to:</p><pre>public string Message<br>{<br>    get;<br>    set =&gt; field = value ?? throw new ArgumentNullException(nameof(value));<br>}</pre><p>You can declare a body for one or both accessors for a field backed property.</p><h3>More implicit conversions of Span&lt;T&gt; and ReadOnlySpan&lt;T&gt;:</h3><p>Span&lt;T&gt; and ReadOnlySpan&lt;T&gt; are essential for high-performance, allocation-free code. However, you often had to explicitly convert collections like arrays or lists to a span before passing them to a method.</p><pre>public class SpanOperations<br>{<br>    // Implicit conversion from array to Span&lt;T&gt;<br>    public void ProcessData(Span&lt;int&gt; data)<br>    {<br>        for (int i = 0; i &lt; data.Length; i++)<br>        {<br>            data[i] *= 2;<br>        }<br>    }<br>    <br>    // More natural calling syntax<br>    public void Example()<br>    {<br>        int[] numbers = { 1, 2, 3, 4, 5 };<br>        <br>        // Implicit conversion - cleaner syntax<br>        ProcessData(numbers);<br>        <br>        // Also works with stack-allocated arrays<br>        Span&lt;int&gt; stackNumbers = stackalloc int[] { 1, 2, 3 };<br>        ProcessData(stackNumbers);<br>    }<br>    <br>    // ReadOnlySpan&lt;T&gt; improvements<br>    public int Sum(ReadOnlySpan&lt;int&gt; values)<br>    {<br>        int total = 0;<br>        foreach (var value in values)<br>        {<br>            total += value;<br>        }<br>        return total;<br>    }<br>    <br>    public void ReadOnlyExample()<br>    {<br>        int[] data = { 1, 2, 3, 4, 5 };<br>        <br>        // Implicit conversions work seamlessly<br>        var result = Sum(data);<br>        var result2 = Sum(new[] { 10, 20, 30 });<br>        var result3 = Sum(stackalloc int[] { 100, 200 });<br>    }<br>}</pre><h3>Parameter Modifiers in Lambda Expressions:</h3><p>When using <em>ref</em>, <em>in</em>, or <em>out </em>parameters in a lambda, you were forced to explicitly type the parameters, even when the compiler could have inferred them. C# 14 removes this requirement.</p><p>The Old Way:</p><pre>// A delegate that takes a ref parameter<br>delegate void NumberMutator(ref int number);<br><br>NumberMutator doubler = (ref int n) =&gt; n *= 2; // Type &#39;int&#39; was required</pre><p>The C#14 Way:</p><pre>delegate void NumberMutator(ref int number);<br>// The compiler can infer the type, so you only need the modifier<br><br>// ref parameters - modify in place<br>NumberMutator doubler = (ref n) =&gt; n *= 2; <br>// in parameters - read-only reference<br>NumberMutator tripler = (in n) =&gt; Console.WriteLine(n * 3);// in parameters - read-only reference</pre><h3>Partial Instance Constructors and Partial Events:</h3><p>Partial methods and properties have been a cornerstone for source generators. C# 14 expands this power to constructors and events, allowing generators to inject initialization logic or event handling code seamlessly.</p><pre>// You declare a partial constructor, signaling the generator can implement it<br>public partial class MyGeneratedService<br>{<br>    private readonly ILogger _logger;<br><br>    partial MyGeneratedService(ILogger logger); // The declaration<br>}</pre><pre>// The generator provides the implementation<br>public partial class MyGeneratedService<br>{<br>    // The implementation<br>    partial MyGeneratedService(ILogger logger)<br>    {<br>        _logger = logger;<br>        _logger.Log(&quot;MyGeneratedService has been constructed!&quot;);<br>    }<br>}</pre><p>Partial Events:</p><pre>// File: DataService.Designer.cs<br>public partial class DataService<br>{<br>    // Designer-generated event declaration<br>    public partial event EventHandler&lt;DataEventArgs&gt; DataReceived;<br>}<br><br>// File: DataService.cs<br>public partial class DataService<br>{<br>    // Custom event implementation<br>    public partial event EventHandler&lt;DataEventArgs&gt; DataReceived<br>    {<br>        add<br>        {<br>            field += value;<br>            Console.WriteLine(&quot;Subscriber added to DataReceived&quot;);<br>        }<br>        remove<br>        {<br>            field -= value;<br>            Console.WriteLine(&quot;Subscriber removed from DataReceived&quot;);<br>        }<br>    }<br>    <br>    protected virtual void OnDataReceived(DataEventArgs e)<br>    {<br>        DataReceived?.Invoke(this, e);<br>    }<br>}<br><br>public class DataEventArgs : EventArgs<br>{<br>    public string Data { get; set; }<br>}</pre><h3>Extension Blocks:</h3><p>Extension blocks allow you to group related extension methods and introduce extension properties.</p><pre>// A single block for all extensions on &#39;int&#39;<br>public extension int<br>{<br>    // A regular instance extension method<br>    public bool IsEven() =&gt; this % 2 == 0;<br><br>    // An INSTANCE extension property<br>    public bool IsOdd =&gt; this % 2 != 0;<br><br>    // A STATIC extension property<br>    public static int Answer =&gt; 42;<br><br>    // A STATIC extension method!<br>    public static int Parse(string s) =&gt; int.Parse(s);<br>}<br><br><br>int myNumber = 5;<br>Console.WriteLine(myNumber.IsEven()); // False<br>Console.WriteLine(myNumber.IsOdd);    // True<br><br>Console.WriteLine(int.Answer);        // 42 (Accessed like a real static property)<br>Console.WriteLine(int.Parse(&quot;123&quot;));  // 123 (Accessed like a real static method)</pre><h3>Null-Conditional Assignment (?=):</h3><p>The null-conditional assignment operator assigns a value only if the target is null. Replaces the verbose if (x == null) x = y; pattern.</p><pre>Dictionary&lt;string, List&lt;int&gt;&gt; scores = new();<br>string student = &quot;Nora&quot;;<br><br>// Old Way<br>if (scores[student] == null)<br>{<br>    scores[student] = new List&lt;int&gt;();<br>}<br><br>// C# 14 Way<br>scores[student] ?= new List&lt;int&gt;(); // Assigns only if the value is null</pre><h3>User-defined compound assignment operators :</h3><p>You can now define the behavior of compound assignment operators for your custom types, which can be more efficient than the default <strong>x = x + y</strong> expansion.</p><p>Customize how +=, -=, *=, /=, and other compound assignments work for your types.</p><pre>public struct Vector2D<br>{<br>    public double X { get; set; }<br>    public double Y { get; set; }<br>    <br>    // Define custom += operator<br>    public static Vector2D operator +=(Vector2D left, Vector2D right)<br>    {<br>        return new Vector2D<br>        {<br>            X = left.X + right.X,<br>            Y = left.Y + right.Y<br>        };<br>    }<br>    <br>    // Define custom -= operator<br>    public static Vector2D operator -=(Vector2D left, Vector2D right)<br>    {<br>        return new Vector2D<br>        {<br>            X = left.X - right.X,<br>            Y = left.Y - right.Y<br>        };<br>    }<br>    <br>    // Define custom *= operator (scalar multiplication)<br>    public static Vector2D operator *=(Vector2D vector, double scalar)<br>    {<br>        return new Vector2D<br>        {<br>            X = vector.X * scalar,<br>            Y = vector.Y * scalar<br>        };<br>    }<br>}<br><br>// Usage<br>public void VectorMath()<br>{<br>    var v1 = new Vector2D { X = 3, Y = 4 };<br>    var v2 = new Vector2D { X = 1, Y = 2 };<br>    <br>    v1 += v2;  // v1 is now (4, 6)<br>    v1 -= v2;  // v1 is back to (3, 4)<br>    v1 *= 2;   // v1 is now (6, 8)<br>}</pre><h3>User-defined increment (++) and decrement (--) operators:</h3><p>Your custom types can now behave just like built-in numeric types. Define custom behavior for ++ and -- operators (both prefix and postfix).</p><pre>public struct Counter<br>{<br>    public int Value { get; private set; }<br>    <br>    // Prefix increment: ++counter<br>    public static Counter operator ++(Counter counter)<br>    {<br>        counter.Value++;<br>        Console.WriteLine($&quot;Incremented to {counter.Value}&quot;);<br>        return counter;<br>    }<br>    <br>    // Prefix decrement: --counter<br>    public static Counter operator --(Counter counter)<br>    {<br>        counter.Value--;<br>        Console.WriteLine($&quot;Decremented to {counter.Value}&quot;);<br>        return counter;<br>    }<br>}<br><br>public void CounterExample()<br>{<br>    var counter = new Counter();<br>    <br>    ++counter;  // Output: &quot;Incremented to 1&quot;<br>    ++counter;  // Output: &quot;Incremented to 2&quot;<br>    --counter;  // Output: &quot;Decremented to 1&quot;<br>}</pre><p><em>Follow me for more C# and .NET content. Happy coding! :)</em></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F10683245175159970035&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Flove-happy-cute-nice-pet-gif-10683245175159970035&amp;image=https%3A%2F%2Fmedia.tenor.com%2FlEKC4nHQ2PMAAAAN%2Flove-happy.png&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/5914d52a8b965b5be5efcaa7b3393924/href">https://medium.com/media/5914d52a8b965b5be5efcaa7b3393924/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b514886b43b6" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/whats-new-in-c-14-with-examples-b514886b43b6">What’s new in C#14 | with Examples</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lambda functions | Python | Quick guide !]]></title>
            <link>https://python.plainenglish.io/lambda-functions-python-quick-guide-c8452c950328?source=rss-a1e977d5d5cf------2</link>
            <guid isPermaLink="false">https://medium.com/p/c8452c950328</guid>
            <category><![CDATA[lambda-function]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Bilal Imran]]></dc:creator>
            <pubDate>Sat, 04 Oct 2025 19:16:09 GMT</pubDate>
            <atom:updated>2025-10-29T14:37:38.062Z</atom:updated>
            <content:encoded><![CDATA[<h3>Lambda functions | Python | Quick guide !</h3><p>If you’re a programmer, you know naming a function can sometimes take more brainpower than writing it😛. And when you just need a quick one‑liner to get the job done — <em>enter the lambda function.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/374/0*FXliLEeOVISLzK8X.gif" /></figure><p>Lambda functions are Python’s way of saying:</p><blockquote>“Don’t overthink it, just write the logic and move on.”</blockquote><p>They’re short, anonymous, and perfect for quick operations where defining a full function feels overkill.</p><h3>1. What is a Lambda Function?</h3><p>A lambda function (also called an anonymous function) is a small, inline function defined using the lambda keyword. Unlike regular functions defined with def, lambdas don’t require a name and are typically used for short, throwaway operations.</p><h3>Syntax</h3><pre>lambda arguments: expression</pre><ul><li>arguments: Comma-separated input parameters (optional).</li><li>expression: A single expression that gets evaluated and returned.</li></ul><h3>Example: A Simple Lambda Function</h3><pre># Regular function<br>def square(x):<br>    return x ** 2<br><br># Equivalent lambda - Easy? Right? :)<br>square_lambda = lambda x: x ** 2<br><br>print(square(5))        # Output: 25<br>print(square_lambda(5)) # Output: 25</pre><blockquote>Note: Lambdas are best for single-expression functions — avoid complex logic inside them.</blockquote><h4>Example: Using map() and filter()</h4><pre>numbers = [1, 2, 3, 4, 5]<br><br># Double each number<br>doubled = list(map(lambda x: x * 2, numbers))<br>print(doubled)  # [2, 4, 6, 8, 10]<br><br># Filter even numbers<br>evens = list(filter(lambda x: x % 2 == 0, numbers))<br>print(evens)    # [2, 4]<br></pre><h4>Example: Sorting with a Custom Key</h4><pre>students = [(&quot;Alex&quot;, 25), (&quot;Bob&quot;, 20), (&quot;Paul&quot;, 22)]<br># Sort by age<br>sorted_students = sorted(students, key=lambda x: x[1])<br>print(sorted_students)  # [(&#39;Bob&#39;, 20), (&#39;Paul&#39;, 22), (&#39;Alex&#39;, 25)]</pre><h3>3. Lambda vs. Regular Functions</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_yk_PRXwr9RQY6xG9NheUg.png" /></figure><blockquote>Rule of Thumb: If your function is more than one expression, use def instead.</blockquote><h3>Further Reading</h3><ul><li><a href="https://docs.python.org/3/tutorial/controlflow.html#lambda-expressions">Python Documentation: Lambda</a></li></ul><p>Liked this article? Clap 👏 and share it with fellow Pythonistas!</p><p>#Python #Programming #Lambda #FunctionalProgramming #DataScience</p><h3>A message from our Founder</h3><p><strong>Hey, </strong><a href="https://linkedin.com/in/sunilsandhu"><strong>Sunil</strong></a><strong> here.</strong> I wanted to take a moment to thank you for reading until the end and for being a part of this community.</p><p>Did you know that our team run these publications as a volunteer effort to over 3.5m monthly readers? <strong>We don’t receive any funding, we do this to support the community. ❤️</strong></p><p>If you want to show some love, please take a moment to <strong>follow me on </strong><a href="https://linkedin.com/in/sunilsandhu"><strong>LinkedIn</strong></a><strong>, </strong><a href="https://tiktok.com/@messyfounder"><strong>TikTok</strong></a>, <a href="https://instagram.com/sunilsandhu"><strong>Instagram</strong></a>. You can also subscribe to our <a href="https://newsletter.plainenglish.io/"><strong>weekly newsletter</strong></a>.</p><p>And before you go, don’t forget to <strong>clap</strong> and <strong>follow</strong> the writer️!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c8452c950328" width="1" height="1" alt=""><hr><p><a href="https://python.plainenglish.io/lambda-functions-python-quick-guide-c8452c950328">Lambda functions | Python | Quick guide !</a> was originally published in <a href="https://python.plainenglish.io/">Python in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python List Methods]]></title>
            <link>https://blog.devgenius.io/python-list-methods-9dabbc35c0c5?source=rss-a1e977d5d5cf------2</link>
            <guid isPermaLink="false">https://medium.com/p/9dabbc35c0c5</guid>
            <category><![CDATA[append]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[lists]]></category>
            <category><![CDATA[python-programming]]></category>
            <dc:creator><![CDATA[Bilal Imran]]></dc:creator>
            <pubDate>Thu, 02 Oct 2025 12:08:37 GMT</pubDate>
            <atom:updated>2025-10-27T12:08:40.632Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*igaVCI8ZNFKaZ7EPcdxoMw.png" /></figure><p>Python lists are one of the most versatile and commonly used data structures. They come with a rich set of built-in methods that make manipulating and working with lists efficient and straightforward. In this blog, we’ll explore the essential list methods with clear syntax and practical examples.</p><h3>List.append()</h3><p>This is the most used method to add a list element at the end of the list.</p><p>Syntax:</p><pre>list.append(element)</pre><p>Examples:</p><pre>listElements = [1, 2, 3, 4]<br>print(listElements)  # [1, 2, 3, 4]<br><br>listElements.append(5)<br>print(listElements)  # [1, 2, 3, 4, 5]</pre><h3>List.pop()</h3><p>This method removes the last element in the list. It has an optional parameter that will remove the element at that particular index.</p><p>Syntax:</p><pre>list.pop()<br>list.pop(index)</pre><p>Examples:</p><pre>listElements = [1, 2, 3, 4]<br>print(listElements)  # [1, 2, 3, 4]<br><br>listElements.pop()<br>print(listElements)  # [1, 2, 3]<br><br>fruits = [&quot;apple&quot;, &quot;banana&quot;, &quot;strawberry&quot;]<br>fruits.pop(1)  # It will remove the element present on index 1 -&gt; banana<br>print(fruits)  # [&quot;apple&quot;, &quot;strawberry&quot;]</pre><h3>List.insert()</h3><p>This method inserts an element at a specified position in the list.</p><p>Syntax:</p><pre>list.insert(index, element)</pre><p>Examples:</p><pre>colors = [&quot;red&quot;, &quot;blue&quot;, &quot;green&quot;]<br>print(colors)  # [&quot;red&quot;, &quot;blue&quot;, &quot;green&quot;]<br><br>colors.insert(1, &quot;yellow&quot;)<br>print(colors)  # [&quot;red&quot;, &quot;yellow&quot;, &quot;blue&quot;, &quot;green&quot;]<br><br>colors.insert(0, &quot;purple&quot;)<br>print(colors)  # [&quot;purple&quot;, &quot;red&quot;, &quot;yellow&quot;, &quot;blue&quot;, &quot;green&quot;]</pre><h3>List.remove()</h3><p>This method removes the first occurrence of the specified element from the list.</p><p>Syntax:</p><pre>list.remove(element)</pre><p>Examples:</p><pre>numbers = [1, 2, 3, 2, 4]<br>print(numbers)  # [1, 2, 3, 2, 4]<br><br>numbers.remove(2)<br>print(numbers)  # [1, 3, 2, 4]<br><br>fruits = [&quot;apple&quot;, &quot;banana&quot;, &quot;apple&quot;, &quot;orange&quot;]<br>fruits.remove(&quot;apple&quot;)<br>print(fruits)  # [&quot;banana&quot;, &quot;apple&quot;, &quot;orange&quot;]</pre><h3>List.extend()</h3><p>This method adds all elements of an iterable (list, tuple, string, etc.) to the end of the list.</p><p>Syntax:</p><pre>list.extend(iterable)</pre><p>Examples:</p><pre>list1 = [1, 2, 3]<br>list2 = [4, 5, 6]<br>list1.extend(list2)<br>print(list1)  # [1, 2, 3, 4, 5, 6]<br><br>letters = [&#39;a&#39;, &#39;b&#39;]<br>letters.extend(&#39;cd&#39;)<br>print(letters)  # [&#39;a&#39;, &#39;b&#39;, &#39;c&#39;, &#39;d&#39;]</pre><h3>List.index()</h3><p>This method returns the index of the first occurrence of the specified element.</p><p>Syntax:</p><pre>list.index(element)<br>list.index(element, start, end)  # Optional start and end parameters</pre><p>Examples:</p><pre>fruits = [&quot;apple&quot;, &quot;banana&quot;, &quot;cherry&quot;, &quot;banana&quot;]<br><br>print(fruits.index(&quot;banana&quot;))  # 1<br>print(fruits.index(&quot;banana&quot;, 2))  # 3 (searches from index 2 onwards)<br><br># print(fruits.index(&quot;grape&quot;))  # ValueError: &#39;grape&#39; is not in list</pre><h3>List.count()</h3><p>This method returns the number of times a specified element appears in the list.</p><p>Syntax:</p><pre>list.count(element)</pre><p>Examples:</p><pre>numbers = [1, 2, 3, 2, 2, 4]<br>print(numbers.count(2))  # 3<br>print(numbers.count(5))  # 0<br><br>fruits = [&quot;apple&quot;, &quot;banana&quot;, &quot;apple&quot;]<br>print(fruits.count(&quot;apple&quot;))  # 2</pre><h3>List.sort()</h3><p>This method sorts the list in ascending order by default. It can also sort in descending order or based on a custom key function.</p><p>Syntax:</p><pre>list.sort()<br>list.sort(reverse=True)<br>list.sort(key=function)</pre><p>Examples:</p><pre>numbers = [3, 1, 4, 1, 5]<br>numbers.sort()<br>print(numbers)  # [1, 1, 3, 4, 5]<br><br>numbers.sort(reverse=True)<br>print(numbers)  # [5, 4, 3, 1, 1]<br><br>fruits = [&quot;banana&quot;, &quot;apple&quot;, &quot;cherry&quot;]<br>fruits.sort(key=len)  # Sort by length of string<br>print(fruits)  # [&quot;apple&quot;, &quot;banana&quot;, &quot;cherry&quot;]</pre><h3>List.reverse()</h3><p>This method reverses the order of elements in the list.</p><p>Syntax:</p><pre>list.reverse()</pre><p>Examples:</p><pre>numbers = [1, 2, 3, 4, 5]<br>numbers.reverse()<br>print(numbers)  # [5, 4, 3, 2, 1]<br><br>letters = [&#39;a&#39;, &#39;b&#39;, &#39;c&#39;]<br>letters.reverse()<br>print(letters)  # [&#39;c&#39;, &#39;b&#39;, &#39;a&#39;]</pre><h3>List.copy()</h3><p>This method returns a shallow copy of the list.</p><p>Syntax:</p><pre>list.copy()</pre><p>Examples:</p><pre>original = [1, 2, 3, 4]<br>copy_list = original.copy()<br>print(copy_list)  # [1, 2, 3, 4]<br><br># Modifying the copy doesn&#39;t affect the original<br>copy_list.append(5)<br>print(original)   # [1, 2, 3, 4]<br>print(copy_list)  # [1, 2, 3, 4, 5]</pre><h3>List.clear()</h3><p>This method removes all elements from the list, leaving it empty.</p><p>Syntax:</p><pre>list.clear()</pre><p>Examples:</p><pre>numbers = [1, 2, 3, 4, 5]<br>print(numbers)  # [1, 2, 3, 4, 5]<br><br>numbers.clear()<br>print(numbers)  # []</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*udVlpUj-D2ylDsr0K01GuA.png" /></figure><p>Understanding these list methods will significantly enhance your Python programming skills and make your code more efficient and readable. Practice using these methods in different scenarios to become proficient with Python lists!</p><p>Thank you :) Cheers 🥂</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9dabbc35c0c5" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/python-list-methods-9dabbc35c0c5">Python List Methods</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>