<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Seif Ahmed</title>
    <description>The latest articles on DEV Community by Seif Ahmed (@codemaster_121482).</description>
    <link>https://dev.to/codemaster_121482</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3854057%2Ff7415c1f-526d-4c1c-bb07-8a2214110605.jpg</url>
      <title>DEV Community: Seif Ahmed</title>
      <link>https://dev.to/codemaster_121482</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/codemaster_121482"/>
    <language>en</language>
    <item>
      <title>The Art of Binary Search</title>
      <dc:creator>Seif Ahmed</dc:creator>
      <pubDate>Sun, 04 Oct 2026 14:05:02 +0000</pubDate>
      <link>https://dev.to/codemaster_121482/the-art-of-binary-search-30mo</link>
      <guid>https://dev.to/codemaster_121482/the-art-of-binary-search-30mo</guid>
      <description>&lt;p&gt;Imagine you're looking up a word in a printed dictionary. You don't start at page one and read every word until you find it. Instead, you open the book to the middle. If your word comes earlier, you ignore the entire right half of the book. If it comes later, you discard the left half. You repeat this process until you land on the exact page.&lt;/p&gt;

&lt;p&gt;This great strategy is called binary search. It's a fundamental algorithm used to find the position of a target value within a sorted array. &lt;/p&gt;

&lt;p&gt;By cutting your search space in half with every single step, binary search achieves a logarithmic time complexity.&lt;/p&gt;

&lt;h3&gt;
  
  
  One Little Thing
&lt;/h3&gt;

&lt;p&gt;For binary search to work, your data must be sorted. If the data is randomized, the algorithm won't work.&lt;/p&gt;

&lt;h3&gt;
  
  
  Two Ways to Define Boundaries
&lt;/h3&gt;

&lt;p&gt;You've got to decide how to track your boundaries using two pointers: &lt;code&gt;left&lt;/code&gt; and &lt;code&gt;right&lt;/code&gt;. Devs generally choose between two standard approaches: the inclusive upper bound and the exclusive upper bound. &lt;/p&gt;

&lt;p&gt;While both ways get the job done, they change your loop conditions and how you drop halves of the array.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Inclusive Upper Bound&lt;/th&gt;
&lt;th&gt;Exclusive Upper Bound&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Initial &lt;code&gt;right&lt;/code&gt; value&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;arr.length - 1&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;arr.length&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;while&lt;/code&gt; loop condition&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;left &amp;lt;= right&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;left &amp;lt; right&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Drop right formula&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;right = mid - 1&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;right = mid&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Drop left formula&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;left = mid + 1&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;left = mid + 1&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h3&gt;
  
  
  Approach 1: The Inclusive Upper Bound
&lt;/h3&gt;

&lt;p&gt;In this traditional version, the &lt;code&gt;right&lt;/code&gt; pointer targets the last valid index of the array. The search window includes both boundary pointers.&lt;/p&gt;

&lt;h4&gt;
  
  
  1. Setup and Loop Condition
&lt;/h4&gt;

&lt;p&gt;You start by setting &lt;code&gt;left = 0&lt;/code&gt; and &lt;code&gt;right = arr.length - 1&lt;/code&gt;. The loop repeats as long as &lt;code&gt;left &amp;lt;= right&lt;/code&gt;. If the pointers cross (&lt;code&gt;left &amp;gt; right&lt;/code&gt;), it means the target item isn't in the array. You should return a specific value (e.g. &lt;code&gt;-1&lt;/code&gt;) to signal that nothing was found.&lt;/p&gt;

&lt;h4&gt;
  
  
  2. Shifting the Boundaries
&lt;/h4&gt;

&lt;p&gt;After calculating &lt;code&gt;mid = left + Math.floor((right - left) / 2)&lt;/code&gt;, you compare &lt;code&gt;arr[mid]&lt;/code&gt; to your target:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;The Match:&lt;/strong&gt; If &lt;code&gt;arr[mid] == target&lt;/code&gt;, you return &lt;code&gt;mid&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Drop the Right Side:&lt;/strong&gt; If &lt;code&gt;arr[mid] &amp;gt; target&lt;/code&gt;, the target is to the left. You update the boundary to &lt;code&gt;right = mid - 1&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Drop the Left Side:&lt;/strong&gt; If &lt;code&gt;arr[mid] &amp;lt; target&lt;/code&gt;, the target is to the right. You update the boundary to &lt;code&gt;left = mid + 1&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  3. Simple Code Example (Don't use for all cases)
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;binarySearchInclusive&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;left&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;right&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 

    &lt;span class="k"&gt;while &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;left&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="nx"&gt;right&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;mid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;left&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;floor&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;right&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;left&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;mid&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;mid&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
        &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;mid&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nx"&gt;right&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;mid&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
        &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nx"&gt;left&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;mid&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;  
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We calculate the mid index using &lt;code&gt;left + Math.floor((right - left) / 2)&lt;/code&gt; because doing standard addition (left + right) in languages like Java or C++ can overflow the maximum 32-bit integer limit if you are searching through massive datasets. This formula keeps your code 100% safe across all environments.&lt;/p&gt;




&lt;h3&gt;
  
  
  Approach 2: The Exclusive Upper Bound
&lt;/h3&gt;

&lt;p&gt;In this version, the &lt;code&gt;right&lt;/code&gt; pointer represents the index just past the last element you want to search. The search window includes &lt;code&gt;left&lt;/code&gt; but excludes &lt;code&gt;right&lt;/code&gt;. &lt;/p&gt;

&lt;h4&gt;
  
  
  1. Setup and Loop Condition
&lt;/h4&gt;

&lt;p&gt;You initialize &lt;code&gt;left = 0&lt;/code&gt; and set &lt;code&gt;right = arr.length&lt;/code&gt; (the exact length of the array). &lt;/p&gt;

&lt;p&gt;Because &lt;code&gt;right&lt;/code&gt; is exclusive, a search space where &lt;code&gt;left == right&lt;/code&gt; represents an empty range. Therefore, your loop condition changes to &lt;code&gt;left &amp;lt; right&lt;/code&gt;. Once &lt;code&gt;left&lt;/code&gt; equals &lt;code&gt;right&lt;/code&gt;, the loop exits, signaling the item wasn't found.&lt;/p&gt;

&lt;h4&gt;
  
  
  2. Shifting the Boundaries
&lt;/h4&gt;

&lt;p&gt;The main change is how &lt;code&gt;right&lt;/code&gt; is treated. If &lt;code&gt;arr[mid] &amp;gt; target&lt;/code&gt;, you drop the right half by setting &lt;code&gt;right = mid&lt;/code&gt;. You don't use &lt;code&gt;mid - 1&lt;/code&gt; since the upper bound is exclusive.&lt;/p&gt;

&lt;h4&gt;
  
  
  3. Simple Code Example (Once again, don't use for all cases)
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;binarySearchExclusive&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;left&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;right&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;while &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;left&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;right&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;mid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;left&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;floor&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;right&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;left&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;mid&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;mid&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
        &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;mid&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nx"&gt;right&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;mid&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
        &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nx"&gt;left&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;mid&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  When to Use Each?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Inclusive Upper Bound&lt;/strong&gt;: Use this version when you're looking for a single, exact match in a sorted array and want to return its index immediately.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Exclusive Upper Bound&lt;/strong&gt;: Use this version when you want to find the first occurrence of a number in an array full of duplicates or you want to insert a new number while keeping the array sorted.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Why Binary Search is a Superpower
&lt;/h3&gt;

&lt;p&gt;Imagine you've got an array of 1 million items.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Linear Search:&lt;/strong&gt; Could take up to 1,000,000 steps if you're trying to find an item at the very end of the array.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Binary Search:&lt;/strong&gt; Will find any item in roughly 20 steps. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every time you use a drop formula, you wipe out thousands of unnecessary checks. It transforms a massive data search into a quick handful of simple choices.&lt;/p&gt;

</description>
      <category>algorithms</category>
      <category>beginners</category>
      <category>computerscience</category>
      <category>programming</category>
    </item>
    <item>
      <title>Heap vs Stack Memory in C</title>
      <dc:creator>Seif Ahmed</dc:creator>
      <pubDate>Sun, 27 Sep 2026 13:17:03 +0000</pubDate>
      <link>https://dev.to/codemaster_121482/heap-vs-stack-memory-in-c-4enh</link>
      <guid>https://dev.to/codemaster_121482/heap-vs-stack-memory-in-c-4enh</guid>
      <description>&lt;p&gt;When I started learning C to expand my knowledge (I used to work with JavaScript and Node.js only), I asked myself: How to handle memory in C? I read a few articles on Google and Stack Overflow. And I found that memory in C is divided into two areas: the Stack and the Heap. &lt;/p&gt;




&lt;h2&gt;
  
  
  The Stack
&lt;/h2&gt;

&lt;p&gt;Think of the Stack like a list where short lived variables, functions, and arguments live. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The compiler always manages the stack. When a function is called, its variables are pushed onto the stack. When the function finishes, the memory is cleared automatically.&lt;/li&gt;
&lt;li&gt;It is very fast because the memory allocation is done in a sequential order.&lt;/li&gt;
&lt;li&gt;The space on the stack is limited. If you allocate too much data (like a massive array), you will run into stack overflow errors.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;myFunction&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Saved on the stack&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  The Heap
&lt;/h2&gt;

&lt;p&gt;Think of the Heap like a massive pool of data. It's an unstructured block of memory designed for dynamic allocation.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You use functions like &lt;code&gt;malloc()&lt;/code&gt; or &lt;code&gt;calloc()&lt;/code&gt; to request space. That's why you should manually free the memory when you are done or you will cause a memory leak.&lt;/li&gt;
&lt;li&gt;It's a bit slower than the stack because you need to look for and allocate the memory before adding data to it.&lt;/li&gt;
&lt;li&gt;Its only limit is the physical machine you are using.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;myHeapFunction&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;ptr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="n"&gt;malloc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;sizeof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// Allocated on the heap&lt;/span&gt;
    &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;ptr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;// Don't forget this line btw&lt;/span&gt;
    &lt;span class="n"&gt;free&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ptr&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; 
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Why Stack Overflow Happens
&lt;/h2&gt;

&lt;p&gt;A stack overflow occurs because the stack has a memory limit. For example, if you've an infinite loop, these frames stack up without being cleared. They'll cross the boundary set by the OS and your program will crash to protect the rest of the system from corruption.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Memory Leaks Happen
&lt;/h2&gt;

&lt;p&gt;Memory leaks occur in the heap because memory should be manually managed. When a program requests dynamic memory, the OS reserves a memory block for it and returns a pointer to it. The memory is freed when your program calls the &lt;code&gt;free()&lt;/code&gt; function. If your program stops before this function is called, there is no pointer to this memory block and it becomes inaccessible. This memory is reserved until the application is closed. These little bugs eat RAM and the application usually stops responding until it's forced to stop.&lt;/p&gt;




&lt;h3&gt;
  
  
  Quick Comparison
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;The Stack&lt;/th&gt;
&lt;th&gt;The Heap&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Management&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Managed by the compiler&lt;/td&gt;
&lt;td&gt;Managed by the programmer&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Lifetime&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Short lived&lt;/td&gt;
&lt;td&gt;Long lived (lasts until manually freed)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Size Limit&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Limited and fixed&lt;/td&gt;
&lt;td&gt;Limited by your machine hardware&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Allocation Speed&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Extremely fast&lt;/td&gt;
&lt;td&gt;Slower&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;p&gt;Learning this was really fun. I'm happy that I shared this with you guys.&lt;/p&gt;

</description>
      <category>computerscience</category>
      <category>learning</category>
      <category>programming</category>
    </item>
    <item>
      <title>🚀 I reached 1,001 views on DEV!</title>
      <dc:creator>Seif Ahmed</dc:creator>
      <pubDate>Mon, 21 Sep 2026 19:03:39 +0000</pubDate>
      <link>https://dev.to/codemaster_121482/i-reached-1001-views-on-dev-457k</link>
      <guid>https://dev.to/codemaster_121482/i-reached-1001-views-on-dev-457k</guid>
      <description>&lt;p&gt;I just did it! I looked at my DEV dashboard and noticed that my profile has reached &lt;strong&gt;1,001 total views&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fw4olxy71tx8krpomyja4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fw4olxy71tx8krpomyja4.png" alt=" " width="229" height="147"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;First, &lt;strong&gt;thanks to this amazing community&lt;/strong&gt;. Whether you read a full article, clicked through from Google search, left a comment, or dropped a unicorn 🦄 or heart ❤️ reaction, your engagement means the world to me. &lt;/p&gt;

&lt;p&gt;When I first started publishing, I wasn't sure if anyone would actually read what I had to say. Seeing that people have found their way to my articles 1,001 times is really motivating. Thanks again for being a part of my journey. Let's keep building, writing, and learning together! 🚀&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;What was your favorite milestone when you started content creation? Let me know in the comments below!&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>community</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Refactoring Vlox's Theme Engine 🎨</title>
      <dc:creator>Seif Ahmed</dc:creator>
      <pubDate>Tue, 01 Sep 2026 13:07:00 +0000</pubDate>
      <link>https://dev.to/codemaster_121482/refactoring-vloxs-theme-engine-57ok</link>
      <guid>https://dev.to/codemaster_121482/refactoring-vloxs-theme-engine-57ok</guid>
      <description>&lt;p&gt;Most standard theme systems swap a single global class on the &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt; element. My engine can handle many themes at once. &lt;/p&gt;




&lt;h2&gt;
  
  
  The Update:
&lt;/h2&gt;

&lt;p&gt;In the past, themes were tracked by index. I noticed that reordering the array broke saved themes for existing users. &lt;/p&gt;

&lt;p&gt;To fix this, I used unique keys for themes instead of indexes.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Configuration:
&lt;/h2&gt;

&lt;p&gt;Each unique theme contains an array of configuration objects. Every configuration object contains 4 keys:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;class&lt;/code&gt;: (Required): The target CSS class name.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;elements&lt;/code&gt;: (Required): Elements targeted immediately on page load.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;postsElements&lt;/code&gt;: (Optional): Elements targeted ONLY after Vlox posts finish loading.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;remove&lt;/code&gt;: (Optional): Specifies whether to add or remove the class.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The Logic:
&lt;/h3&gt;

&lt;p&gt;The current theme is tracked in a variable called &lt;code&gt;currentTheme&lt;/code&gt;. When a page reload happens, it reads the value from localStorage. If the value in the localStorage doesn't match any theme name, &lt;code&gt;currentTheme&lt;/code&gt; value becomes "default" without updating the broken value in localStorage. I did this to prevent Vlox from breaking other apps that may use the same localStorage key while keeping my theme engine 100% working. Also, users won't be stuck on the invalid value. Once they choose a valid theme from Vlox, the localStorage value gets updated. &lt;/p&gt;




&lt;p&gt;If you liked Vlox, please consider giving it a 🌟 on GitHub at &lt;a href="https://github.com/Hfs2024/Vlox" rel="noopener noreferrer"&gt;https://github.com/Hfs2024/Vlox&lt;/a&gt;. It means the 🌎 to me!&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>css</category>
      <category>frontend</category>
      <category>software</category>
    </item>
    <item>
      <title>You Wished for It. Here It Is. ❤️</title>
      <dc:creator>Seif Ahmed</dc:creator>
      <pubDate>Thu, 27 Aug 2026 12:18:09 +0000</pubDate>
      <link>https://dev.to/codemaster_121482/you-wished-for-it-here-it-is-335</link>
      <guid>https://dev.to/codemaster_121482/you-wished-for-it-here-it-is-335</guid>
      <description>&lt;p&gt;I know how tough it can be to build smooth, secure backend features, so I wanted to bring a little joy to your day. I made this polished gift redemption system as my little present to you!&lt;/p&gt;

&lt;h2&gt;
  
  
  How It Works:
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Security &amp;amp; Validation
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Authentication&lt;/strong&gt;: The code checks if the user is logged-in.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ID Validation&lt;/strong&gt;: It ensures the gift ID in the URL is a valid database ID.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Math Limits
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The maximum character limit allowed is &lt;strong&gt;4000 characters&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;It calculates how close the user currently is to that limit.&lt;/li&gt;
&lt;li&gt;It attempts to grant the user a &lt;strong&gt;+100 character boost&lt;/strong&gt;, capping it if they are already near the &lt;strong&gt;4000-character&lt;/strong&gt;. &lt;/li&gt;
&lt;li&gt;While the system may calculate the same &lt;code&gt;inc&lt;/code&gt; value for concurrent requests, the atomic &lt;code&gt;updateOne&lt;/code&gt; operation ensures that if applying both boosts exceeds the 4000-character limit, only the faster request succeeds.&lt;/li&gt;
&lt;li&gt; The max redemption tries admins can set for gifts is 100. Once the max tries limit is reached, whether you set it to 6, 8 or 100, the gift will no longer be usable. After a day from the gift creation date, it will automatically delete itself under any condition to save space.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Transactions (All or Nothing)
&lt;/h3&gt;

&lt;p&gt;The system starts a database transaction. This guarantees that both the gift update and the user update must succeed together. Otherwise, the entire operation rolls back.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The query looks for an active gift that the current logged-in user has not claimed yet. It increments the gift's usage count (&lt;code&gt;usedCount&lt;/code&gt;), save the user's ID in the &lt;code&gt;usedBy&lt;/code&gt; array so they cannot claim it again, and changes the status to &lt;strong&gt;"expired"&lt;/strong&gt; if it just reached its max available uses. &lt;/li&gt;
&lt;li&gt;Also, it adds the calculated character boost to the user's account. &lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;One more thing:&lt;/strong&gt; If the gift is invalid, expired or already redeemed by the logged-in user, the code aborts the transaction. Otherwise, it successfully returns a &lt;code&gt;success: true&lt;/code&gt; response.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;Hope you liked your 🎁!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>I created my X account! 🐦</title>
      <dc:creator>Seif Ahmed</dc:creator>
      <pubDate>Wed, 26 Aug 2026 06:27:25 +0000</pubDate>
      <link>https://dev.to/codemaster_121482/i-created-my-x-account-gb0</link>
      <guid>https://dev.to/codemaster_121482/i-created-my-x-account-gb0</guid>
      <description>&lt;h2&gt;
  
  
  Let's Connect (Follow for Follow! 🤝)
&lt;/h2&gt;

&lt;p&gt;I just created my X (Twitter) account to document my journey, share open-source updates, and connect with other developers. &lt;/p&gt;

&lt;p&gt;If you want to support me or just talk about tech, let's connect:&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;Follow me on X:&lt;/strong&gt; &lt;/p&gt;
&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
        &lt;div class="c-embed__cover"&gt;
          &lt;a href="https://x.com/seifahmedcoding" class="c-link align-middle" rel="noopener noreferrer"&gt;
            &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fpbs.twimg.com%2Fprofile_images%2F2090013641269460992%2FKZagBoLb_200x200.jpg" height="200" class="m-0" width="200"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="c-embed__body"&gt;
        &lt;h2 class="fs-xl lh-tight"&gt;
          &lt;a href="https://x.com/seifahmedcoding" rel="noopener noreferrer" class="c-link"&gt;
            Seif Ahmed (@seifahmedcoding) / X
          &lt;/a&gt;
        &lt;/h2&gt;
          &lt;p class="truncate-at-3"&gt;
            Creator of Vlox — the ultimate social network! I also built NanoScript — a custom DOM library for easier web development!
          &lt;/p&gt;
        &lt;div class="color-secondary fs-s flex items-center"&gt;
            &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fx.com%2Ffavicon.ico" width="32" height="32"&gt;
          x.com
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;I'm actively following back&lt;/strong&gt; everyone from the DEV community who hooks up with me there. Drop your X handle or your latest side project in the comments below so I can check out what you are building too!&lt;/p&gt;

</description>
      <category>buildinpublic</category>
      <category>community</category>
      <category>socialmedia</category>
    </item>
    <item>
      <title>Refactoring the views system in my markdown previewer!</title>
      <dc:creator>Seif Ahmed</dc:creator>
      <pubDate>Tue, 18 Aug 2026 12:30:45 +0000</pubDate>
      <link>https://dev.to/codemaster_121482/refactoring-the-views-system-in-your-gift-2nhi</link>
      <guid>https://dev.to/codemaster_121482/refactoring-the-views-system-in-your-gift-2nhi</guid>
      <description>&lt;p&gt;In the past, link views in my markdown previewer were cached in Redis. After &lt;strong&gt;10 seconds&lt;/strong&gt; from a link open, all the views were flushed using a manual loop. &lt;/p&gt;

&lt;p&gt;The old flow looked like this: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Loop &lt;strong&gt;through&lt;/strong&gt; every key (ID). &lt;/li&gt;
&lt;li&gt;Update its views separately via &lt;code&gt;updateOne&lt;/code&gt;. &lt;/li&gt;
&lt;li&gt;Move to the next until the loop ends. &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why This Is Wrong:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;N+1 Problem:&lt;/strong&gt; As the &lt;strong&gt;number of key operations grows&lt;/strong&gt;, it runs many &lt;strong&gt;separate trips&lt;/strong&gt;. Under very heavy traffic, the system can run out of resources and crash. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Duplicated Views:&lt;/strong&gt; In this old flow, I never cleared the views, even after flushing them. This caused &lt;strong&gt;a duplicated view&lt;/strong&gt; count. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No Validation:&lt;/strong&gt; The system never checked if there &lt;strong&gt;were&lt;/strong&gt; keys to update or not, running unnecessary empty operations. &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Fix:
&lt;/h2&gt;

&lt;p&gt;Instead of running many separate &lt;code&gt;updateOne&lt;/code&gt; operations, we group them into &lt;strong&gt;bulk&lt;/strong&gt; operations using &lt;code&gt;bulkWrite&lt;/code&gt;. This way, if we have 100 links viewed, we run &lt;strong&gt;1 operation&lt;/strong&gt;, unlike &lt;strong&gt;the 100 operation&lt;/strong&gt; in the old system. &lt;/p&gt;

&lt;h2&gt;
  
  
  The New Flow:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Run &lt;code&gt;hGetAll&lt;/code&gt; to get views.&lt;/li&gt;
&lt;li&gt;Check if there is valid data to &lt;strong&gt;process&lt;/strong&gt;. If not, skip this operation entirely. &lt;/li&gt;
&lt;li&gt;Map the &lt;strong&gt;ID operations&lt;/strong&gt; (Lightweight for niche apps like ours. I'm not trying to build something for billions, but a quick markdown previewer for devs like you). &lt;/li&gt;
&lt;li&gt;Send the request to the database and update with &lt;code&gt;bulkWrite&lt;/code&gt;. &lt;/li&gt;
&lt;li&gt;If the request reaches the database and is &lt;strong&gt;acknowledged&lt;/strong&gt;, delete the old views. This guarantees that if the server crashes midway, the data is not lost&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; I added &lt;code&gt;ordered: false&lt;/code&gt; because, by default, if one operation fails, the remaining operations are not executed and previous ones are not rolled back. &lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;Liked Markdown Previewer? Give it a ⭐ at &lt;a href="https://github.com/Hfs2024/Markdown-Previewer" rel="noopener noreferrer"&gt;https://github.com/Hfs2024/Markdown-Previewer&lt;/a&gt;!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>[Boost]</title>
      <dc:creator>Seif Ahmed</dc:creator>
      <pubDate>Tue, 11 Aug 2026 12:04:19 +0000</pubDate>
      <link>https://dev.to/codemaster_121482/-8pi</link>
      <guid>https://dev.to/codemaster_121482/-8pi</guid>
      <description>&lt;div class="ltag__link--embedded"&gt;
  &lt;div class="crayons-story "&gt;
  &lt;a href="https://dev.to/codemaster_121482/i-made-a-gift-for-you-42lg" class="crayons-story__hidden-navigation-link"&gt;I made a gift for you: A clean, lightweight Markdown Previewer&lt;/a&gt;


  &lt;div class="crayons-story__body crayons-story__body-full_post"&gt;
    &lt;div class="crayons-story__top"&gt;
      &lt;div class="crayons-story__meta"&gt;
        &lt;div class="crayons-story__author-pic"&gt;

          &lt;a href="/codemaster_121482" class="crayons-avatar  crayons-avatar--l  "&gt;
            &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3854057%2Ff7415c1f-526d-4c1c-bb07-8a2214110605.jpg" alt="codemaster_121482 profile" class="crayons-avatar__image" width="400" height="400"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
        &lt;div&gt;
          &lt;div&gt;
            &lt;a href="/codemaster_121482" class="crayons-story__secondary fw-medium m:hidden"&gt;
              Seif Ahmed
            &lt;/a&gt;
            &lt;div class="profile-preview-card relative mb-4 s:mb-0 fw-medium hidden m:inline-block"&gt;
              
                Seif Ahmed
                
                
              
              &lt;div id="story-author-preview-content-4314460" class="profile-preview-card__content crayons-dropdown branded-7 p-4 pt-0"&gt;
                &lt;div class="gap-4 grid"&gt;
                  &lt;div class="-mt-4"&gt;
                    &lt;a href="/codemaster_121482" class="flex"&gt;
                      &lt;span class="crayons-avatar crayons-avatar--xl mr-2 shrink-0"&gt;
                        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3854057%2Ff7415c1f-526d-4c1c-bb07-8a2214110605.jpg" class="crayons-avatar__image" alt="" width="400" height="400"&gt;
                      &lt;/span&gt;
                      &lt;span class="crayons-link crayons-subtitle-2 mt-5"&gt;Seif Ahmed&lt;/span&gt;
                    &lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div class="print-hidden"&gt;
                    
                      Follow
                    
                  &lt;/div&gt;
                  &lt;div class="author-preview-metadata-container"&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;

          &lt;/div&gt;
          &lt;a href="https://dev.to/codemaster_121482/i-made-a-gift-for-you-42lg" class="crayons-story__tertiary fs-xs"&gt;&lt;time&gt;Aug 4&lt;/time&gt;&lt;span class="time-ago-indicator-initial-placeholder"&gt;&lt;/span&gt;&lt;/a&gt;
        &lt;/div&gt;
      &lt;/div&gt;

    &lt;/div&gt;

    &lt;div class="crayons-story__indention"&gt;
      &lt;h2 class="crayons-story__title crayons-story__title-full_post"&gt;
        &lt;a href="https://dev.to/codemaster_121482/i-made-a-gift-for-you-42lg" id="article-link-4314460"&gt;
          I made a gift for you: A clean, lightweight Markdown Previewer
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;div class="crayons-story__tags"&gt;
            &lt;a class="crayons-tag crayons-tag--filled  " href="/t/showdev"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;showdev&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/github"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;github&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/opensource"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;opensource&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/webdev"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;webdev&lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="crayons-story__bottom"&gt;
        &lt;div class="crayons-story__details"&gt;
          &lt;a href="https://dev.to/codemaster_121482/i-made-a-gift-for-you-42lg" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left"&gt;
            &lt;div class="multiple_reactions_aggregate"&gt;
              &lt;span class="multiple_reactions_icons_container"&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/exploding-head-daceb38d627e6ae9b730f36a1e390fca556a4289d5a41abb2c35068ad3e2c4b5.svg" width="24" height="24"&gt;
                  &lt;/span&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/multi-unicorn-b44d6f8c23cdd00964192bedc38af3e82463978aa611b4365bd33a0f1f4f3e97.svg" width="24" height="24"&gt;
                  &lt;/span&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/sparkle-heart-5f9bee3767e18deb1bb725290cb151c25234768a0e9a2bd39370c382d02920cf.svg" width="24" height="24"&gt;
                  &lt;/span&gt;
              &lt;/span&gt;
              &lt;span class="aggregate_reactions_counter"&gt;7&lt;span class="hidden s:inline"&gt;&amp;nbsp;reactions&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/a&gt;
            &lt;a href="https://dev.to/codemaster_121482/i-made-a-gift-for-you-42lg#comments" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left flex items-center"&gt;
              

              12&lt;span class="hidden s:inline"&gt;&amp;nbsp;comments&lt;/span&gt;
            &lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="crayons-story__save"&gt;
          &lt;small class="crayons-story__tertiary fs-xs mr-2"&gt;
            1 min read
          &lt;/small&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;


</description>
    </item>
    <item>
      <title>[Boost]</title>
      <dc:creator>Seif Ahmed</dc:creator>
      <pubDate>Mon, 10 Aug 2026 18:02:14 +0000</pubDate>
      <link>https://dev.to/codemaster_121482/-496o</link>
      <guid>https://dev.to/codemaster_121482/-496o</guid>
      <description>&lt;div class="ltag__link--embedded"&gt;
  &lt;div class="crayons-story "&gt;
  &lt;a href="https://dev.to/codemaster_121482/i-made-a-gift-for-you-42lg" class="crayons-story__hidden-navigation-link"&gt;I made a gift for you: A clean, lightweight Markdown Previewer&lt;/a&gt;


  &lt;div class="crayons-story__body crayons-story__body-full_post"&gt;
    &lt;div class="crayons-story__top"&gt;
      &lt;div class="crayons-story__meta"&gt;
        &lt;div class="crayons-story__author-pic"&gt;

          &lt;a href="/codemaster_121482" class="crayons-avatar  crayons-avatar--l  "&gt;
            &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3854057%2Ff7415c1f-526d-4c1c-bb07-8a2214110605.jpg" alt="codemaster_121482 profile" class="crayons-avatar__image" width="400" height="400"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
        &lt;div&gt;
          &lt;div&gt;
            &lt;a href="/codemaster_121482" class="crayons-story__secondary fw-medium m:hidden"&gt;
              Seif Ahmed
            &lt;/a&gt;
            &lt;div class="profile-preview-card relative mb-4 s:mb-0 fw-medium hidden m:inline-block"&gt;
              
                Seif Ahmed
                
                
              
              &lt;div id="story-author-preview-content-4314460" class="profile-preview-card__content crayons-dropdown branded-7 p-4 pt-0"&gt;
                &lt;div class="gap-4 grid"&gt;
                  &lt;div class="-mt-4"&gt;
                    &lt;a href="/codemaster_121482" class="flex"&gt;
                      &lt;span class="crayons-avatar crayons-avatar--xl mr-2 shrink-0"&gt;
                        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3854057%2Ff7415c1f-526d-4c1c-bb07-8a2214110605.jpg" class="crayons-avatar__image" alt="" width="400" height="400"&gt;
                      &lt;/span&gt;
                      &lt;span class="crayons-link crayons-subtitle-2 mt-5"&gt;Seif Ahmed&lt;/span&gt;
                    &lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div class="print-hidden"&gt;
                    
                      Follow
                    
                  &lt;/div&gt;
                  &lt;div class="author-preview-metadata-container"&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;

          &lt;/div&gt;
          &lt;a href="https://dev.to/codemaster_121482/i-made-a-gift-for-you-42lg" class="crayons-story__tertiary fs-xs"&gt;&lt;time&gt;Aug 4&lt;/time&gt;&lt;span class="time-ago-indicator-initial-placeholder"&gt;&lt;/span&gt;&lt;/a&gt;
        &lt;/div&gt;
      &lt;/div&gt;

    &lt;/div&gt;

    &lt;div class="crayons-story__indention"&gt;
      &lt;h2 class="crayons-story__title crayons-story__title-full_post"&gt;
        &lt;a href="https://dev.to/codemaster_121482/i-made-a-gift-for-you-42lg" id="article-link-4314460"&gt;
          I made a gift for you: A clean, lightweight Markdown Previewer
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;div class="crayons-story__tags"&gt;
            &lt;a class="crayons-tag crayons-tag--filled  " href="/t/showdev"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;showdev&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/github"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;github&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/opensource"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;opensource&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/webdev"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;webdev&lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="crayons-story__bottom"&gt;
        &lt;div class="crayons-story__details"&gt;
          &lt;a href="https://dev.to/codemaster_121482/i-made-a-gift-for-you-42lg" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left"&gt;
            &lt;div class="multiple_reactions_aggregate"&gt;
              &lt;span class="multiple_reactions_icons_container"&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/exploding-head-daceb38d627e6ae9b730f36a1e390fca556a4289d5a41abb2c35068ad3e2c4b5.svg" width="24" height="24"&gt;
                  &lt;/span&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/multi-unicorn-b44d6f8c23cdd00964192bedc38af3e82463978aa611b4365bd33a0f1f4f3e97.svg" width="24" height="24"&gt;
                  &lt;/span&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/sparkle-heart-5f9bee3767e18deb1bb725290cb151c25234768a0e9a2bd39370c382d02920cf.svg" width="24" height="24"&gt;
                  &lt;/span&gt;
              &lt;/span&gt;
              &lt;span class="aggregate_reactions_counter"&gt;7&lt;span class="hidden s:inline"&gt;&amp;nbsp;reactions&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/a&gt;
            &lt;a href="https://dev.to/codemaster_121482/i-made-a-gift-for-you-42lg#comments" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left flex items-center"&gt;
              

              12&lt;span class="hidden s:inline"&gt;&amp;nbsp;comments&lt;/span&gt;
            &lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="crayons-story__save"&gt;
          &lt;small class="crayons-story__tertiary fs-xs mr-2"&gt;
            1 min read
          &lt;/small&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;


</description>
    </item>
    <item>
      <title>Building a password-protected link sharing workflow</title>
      <dc:creator>Seif Ahmed</dc:creator>
      <pubDate>Sun, 09 Aug 2026 14:01:05 +0000</pubDate>
      <link>https://dev.to/codemaster_121482/building-a-password-protected-link-sharing-workflow-4meb</link>
      <guid>https://dev.to/codemaster_121482/building-a-password-protected-link-sharing-workflow-4meb</guid>
      <description>&lt;p&gt;Ever wondered how to build a clean, secure system for sharing user content via unique links? It gets interesting when you have to separate public access from password-protected private shares.&lt;/p&gt;

&lt;p&gt;Here is a breakdown of how my markdown previewer handles this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;URL Activation:&lt;/strong&gt; A user opens the link &lt;code&gt;http://localhost:3000/?id=POST_ID&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;ID Extraction:&lt;/strong&gt; The frontend parses the URL and extracts the ID using &lt;code&gt;URLSearchParams&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Request Initiation:&lt;/strong&gt; If an ID is present, the frontend requests data from &lt;code&gt;/api/v1/get/save-from-link/:id&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Backend Verification:&lt;/strong&gt; The backend checks if the ID exists in the database.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Public Access:&lt;/strong&gt; If the link is public, the backend returns the content (&lt;code&gt;link.for.content&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Private Access:&lt;/strong&gt; If the link is private, the backend responds with a success signal and &lt;code&gt;need_password: true&lt;/code&gt; without sending any content.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Frontend Evaluation:&lt;/strong&gt; The frontend checks the &lt;code&gt;need_password&lt;/code&gt; flag.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Content Display:&lt;/strong&gt; If false, it renders the public content.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Password Prompt:&lt;/strong&gt; If true, a popup prompts the user to enter a password.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Rate Limiting:&lt;/strong&gt; Users get 10 password attempts per 7 minutes across all private saves globally.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Password Validation:&lt;/strong&gt; The frontend sends the ID and password to &lt;code&gt;/api/v1/validate-save-password/:id&lt;/code&gt;. &lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Security Match:&lt;/strong&gt; The backend queries the ID ensuring &lt;code&gt;status: "private"&lt;/code&gt;, then verifies the password using &lt;code&gt;await bcrypt.compare(password, link.password)&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Liked my Markdown Previewer? Please give it a ⭐ on GitHub at &lt;a href="https://github.com/Hfs2024/Markdown-Previewer" rel="noopener noreferrer"&gt;https://github.com/Hfs2024/Markdown-Previewer&lt;/a&gt;!&lt;/p&gt;

</description>
      <category>api</category>
      <category>backend</category>
      <category>security</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Why I built an ultra-light social network</title>
      <dc:creator>Seif Ahmed</dc:creator>
      <pubDate>Fri, 07 Aug 2026 19:57:15 +0000</pubDate>
      <link>https://dev.to/codemaster_121482/i-built-an-ultra-light-social-network-for-you-and-your-hobbies-hj0</link>
      <guid>https://dev.to/codemaster_121482/i-built-an-ultra-light-social-network-for-you-and-your-hobbies-hj0</guid>
      <description>&lt;p&gt;A thousand packages in the tree,&lt;br&gt;
A heavy runtime, rarely free.&lt;br&gt;
You spin up React just to write a post,&lt;br&gt;
While memory leaks consume your host.&lt;/p&gt;

&lt;p&gt;So I carved a space away from the noise,&lt;br&gt;
To bring back simplicity, speed, and choice.&lt;/p&gt;

&lt;h2&gt;
  
  
  A sanctuary for you and your hobbies
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No Virtual DOM&lt;/strong&gt; to drain your pace,&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ghost States&lt;/strong&gt; ensures you never lose your trace,&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pure NanoScript&lt;/strong&gt; flowing clean and light,&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A private network&lt;/strong&gt; built just right.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;The Bloated Way&lt;/th&gt;
&lt;th&gt;The Vlox Way&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;React (hundreds of MBs)&lt;/td&gt;
&lt;td&gt;NanoScript (a few KBs)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Complex state boilerplate&lt;/td&gt;
&lt;td&gt;Automatic Ghost State saving&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sluggish edge environment loads&lt;/td&gt;
&lt;td&gt;Instant response&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Take a breath, leave the bloat behind, and see how fast the web can be when it isn't weighed down.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🚀 &lt;strong&gt;Live Demo:&lt;/strong&gt; &lt;a href="https://vlox.containers.snapdeploy.app/" rel="noopener noreferrer"&gt;https://vlox.containers.snapdeploy.app/&lt;/a&gt; or &lt;a href="https://vlox.bonto.run/" rel="noopener noreferrer"&gt;https://vlox.bonto.run/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;⚡ &lt;strong&gt;Vlox Codebase:&lt;/strong&gt; &lt;a href="https://github.com/Hfs2024/Vlox" rel="noopener noreferrer"&gt;https://github.com/Hfs2024/Vlox&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>architecture</category>
      <category>performance</category>
      <category>showdev</category>
      <category>sideprojects</category>
    </item>
    <item>
      <title>I made a gift for you: A clean, lightweight Markdown Previewer</title>
      <dc:creator>Seif Ahmed</dc:creator>
      <pubDate>Tue, 04 Aug 2026 16:48:30 +0000</pubDate>
      <link>https://dev.to/codemaster_121482/i-made-a-gift-for-you-42lg</link>
      <guid>https://dev.to/codemaster_121482/i-made-a-gift-for-you-42lg</guid>
      <description>&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;


  
  Your browser does not support the video tag.


&lt;p&gt;You seem so tired, deep in thought,&lt;br&gt;
With every question and answer you brought.&lt;br&gt;
So as a gift to ease your view,&lt;br&gt;
I built a markdown previewer for you.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Little Rest for Your Code
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Crisp headers shine so bright and clear,&lt;/li&gt;
&lt;li&gt;Soft lists and tables now appear,&lt;/li&gt;
&lt;li&gt;No walls of text to strain your mind,&lt;/li&gt;
&lt;li&gt;Just tidy code left far behind.&lt;/li&gt;
&lt;li&gt;Then shouldn't you come here and never hide?&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Before&lt;/th&gt;
&lt;th&gt;After&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Bad design&lt;/td&gt;
&lt;td&gt;Clean design&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Weary Look&lt;/td&gt;
&lt;td&gt;Refreshed view&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;So take a break and watch it glow,&lt;br&gt;
And let your mind rest and slow.&lt;/p&gt;

&lt;p&gt;Give it a try: &lt;a href="https://github.com/Hfs2024/Markdown-Previewer" rel="noopener noreferrer"&gt;https://github.com/Hfs2024/Markdown-Previewer&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>github</category>
      <category>opensource</category>
      <category>showdev</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
