<?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"><channel><title><![CDATA[subhajit bag]]></title><description><![CDATA[subhajit bag]]></description><link>https://blog.subhajitbag.in</link><generator>RSS for Node</generator><lastBuildDate>Wed, 08 Apr 2026 14:41:14 GMT</lastBuildDate><atom:link href="https://blog.subhajitbag.in/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[How a Browser Works: A Beginner-Friendly Guide to Browser Internals]]></title><description><![CDATA[We use browsers every day to access the world's information, but what exactly happens behind that colorful icon? Most people think of a browser as just a window to the internet, but under the hood, it is one of the most complex pieces of software eve...]]></description><link>https://blog.subhajitbag.in/how-a-browser-works-a-beginner-friendly-guide-to-browser-internals</link><guid isPermaLink="true">https://blog.subhajitbag.in/how-a-browser-works-a-beginner-friendly-guide-to-browser-internals</guid><category><![CDATA[Browsers]]></category><category><![CDATA[ChaiCode]]></category><dc:creator><![CDATA[Subhajit Bag]]></dc:creator><pubDate>Sun, 01 Feb 2026 17:32:39 GMT</pubDate><content:encoded><![CDATA[<p>We use browsers every day to access the world's information, but what exactly happens behind that colorful icon? Most people think of a browser as just a window to the internet, but under the hood, it is one of the most complex pieces of software ever built.</p>
<p>Think of a browser as a <strong>high-speed factory</strong>. It takes in raw materials (code) and transforms them into a finished product (the website you see).</p>
<h3 id="heading-what-happens-when-you-press-enter">What Happens When You Press Enter?</h3>
<p>The moment you type a URL and hit Enter, a chain reaction begins. The browser doesn't "have" the website; it has to go out, find it, and build it from scratch every single time.</p>
<h3 id="heading-1-the-main-components">1. The Main Components</h3>
<p>A browser isn't just one program; it’s a collection of specialized parts:</p>
<ul>
<li><p><strong>User Interface (UI):</strong> Everything you see <em>around</em> the webpage—the address bar, back button, bookmarks, and tabs.</p>
</li>
<li><p><strong>Networking:</strong> The "delivery truck." It goes out to the internet to fetch the HTML, CSS, and JavaScript files from a server.</p>
</li>
<li><p><strong>Browser Engine:</strong> The "manager." It coordinates actions between the UI and the rendering engine.</p>
</li>
<li><p><strong>Rendering Engine:</strong> The "builder." This is the most important part—it takes the code and draws the pixels on your screen. (Examples include <em>Blink</em> in Chrome or <em>Gecko</em> in Firefox).</p>
</li>
</ul>
<h3 id="heading-2-the-power-of-parsing">2. The Power of Parsing</h3>
<p>Before the browser can build anything, it has to <strong>parse</strong> the code. Parsing is just a fancy word for "breaking something down to understand its meaning."</p>
<p><strong>The Math Analogy:</strong> If you see <code>2 + 3 * 5</code>, your brain "parses" it. You identify the numbers and the operators, and you know the order of operations. The browser does the same with code. It reads <code>&lt;div&gt;Hello&lt;/div&gt;</code> and understands that <code>&lt;div&gt;</code> is a container and "Hello" is the text inside.</p>
<h3 id="heading-3-building-the-foundation-dom-and-cssom">3. Building the Foundation: DOM and CSSOM</h3>
<p>The rendering engine creates two "blueprints" to understand your website:</p>
<h4 id="heading-the-dom-document-object-model">The DOM (Document Object Model)</h4>
<p>As the browser reads your HTML, it builds a <strong>DOM Tree</strong>.</p>
<ul>
<li><strong>Analogy:</strong> Think of it as a family tree. The <code>&lt;html&gt;</code> is the grandparent, the <code>&lt;body&gt;</code> is the parent, and <code>&lt;p&gt;</code> or <code>&lt;img&gt;</code> are the children.</li>
</ul>
<h4 id="heading-the-cssom-css-object-model">The CSSOM (CSS Object Model)</h4>
<p>While building the DOM, the browser also reads your CSS to build a CSSOM. This tells the browser the styles (colors, fonts, sizes) for each part of the DOM tree.</p>
<h3 id="heading-4-the-render-tree-putting-it-together">4. The Render Tree: Putting it Together</h3>
<p>The browser then combines the <strong>DOM</strong> and the <strong>CSSOM</strong> to create the <strong>Render Tree</strong>. The Render Tree only contains things that will actually be visible on the screen. (For example, if an element has <code>display: none</code>, it won't be in the Render Tree).</p>
<h3 id="heading-5-layout-painting-and-display">5. Layout, Painting, and Display</h3>
<p>Now that the browser knows <em>what</em> to show and <em>how</em> it should look, it has to figure out <em>where</em> it goes.</p>
<ol>
<li><p><strong>Layout (Reflow):</strong> The browser calculates the exact coordinates and size of every element on the page. If you resize your window, the browser has to do this again.</p>
</li>
<li><p><strong>Painting:</strong> The browser fills in the pixels. It draws the text, colors, images, borders, and shadows.</p>
</li>
<li><p><strong>Display:</strong> Finally, the finished "painting" is sent to your screen, and you see the website!</p>
</li>
</ol>
<h3 id="heading-summary-the-flow">Summary: The Flow</h3>
<ul>
<li><p><strong>Networking</strong> fetches the code.</p>
</li>
<li><p><strong>Parsing</strong> turns code into the <strong>DOM</strong> and <strong>CSSOM</strong>.</p>
</li>
<li><p>The <strong>Render Tree</strong> combines structure and style.</p>
</li>
<li><p><strong>Layout</strong> calculates positions.</p>
</li>
<li><p><strong>Painting</strong> draws the visuals.</p>
</li>
</ul>
<p>Don't worry if you don't remember every step! The key takeaway is that your browser is a master translator, turning text files into the interactive experiences we use every day.</p>
]]></content:encoded></item><item><title><![CDATA[CSS Selectors 101: Targeting Elements with Precision]]></title><description><![CDATA[If HTML is the skeleton of your website, then CSS is the wardrobe. But how do you tell your code, "Make this specific paragraph red, but leave the others alone"?
You use CSS Selectors. Think of selectors as a way to address specific parts of your HTM...]]></description><link>https://blog.subhajitbag.in/css-selectors-101-targeting-elements-with-precision</link><guid isPermaLink="true">https://blog.subhajitbag.in/css-selectors-101-targeting-elements-with-precision</guid><category><![CDATA[CSS]]></category><category><![CDATA[ChaiCode]]></category><dc:creator><![CDATA[Subhajit Bag]]></dc:creator><pubDate>Sun, 01 Feb 2026 17:22:39 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769966533916/59a47686-8c6e-44ec-a72b-bfe3f45ff88b.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>If HTML is the skeleton of your website, then CSS is the wardrobe. But how do you tell your code, "Make <em>this</em> specific paragraph red, but leave the others alone"?</p>
<p>You use <strong>CSS Selectors</strong>. Think of selectors as a way to address specific parts of your HTML. It’s like a mailing system: you can send a message to everyone in a city, everyone on a specific street, or just one person at a specific house.</p>
<h3 id="heading-1-the-element-selector">1. The Element Selector</h3>
<p>This is the broadest way to style. It targets <strong>every single instance</strong> of a specific HTML tag.</p>
<ul>
<li><p><strong>Syntax:</strong> <code>p { color: blue; }</code></p>
</li>
<li><p><strong>What it does:</strong> Every <code>&lt;p&gt;</code> tag on your page will now have blue text.</p>
</li>
<li><p><strong>Analogy:</strong> "Everyone wearing a blue shirt, please stand up."</p>
</li>
</ul>
<h3 id="heading-2-the-class-selector">2. The Class Selector</h3>
<p>Classes are used when you want to style a <strong>specific group</strong> of elements, regardless of what tag they are. You can use the same class on many different elements.</p>
<ul>
<li><p><strong>Syntax:</strong> Use a dot <code>.</code> followed by the class name.</p>
<ul>
<li><code>.highlight { background-color: yellow; }</code></li>
</ul>
</li>
<li><p><strong>HTML usage:</strong> <code>&lt;p class="highlight"&gt;Important text&lt;/p&gt;</code></p>
</li>
<li><p><strong>Analogy:</strong> "Everyone in the 'Photography Club' meet at the entrance."</p>
</li>
</ul>
<h3 id="heading-3-the-id-selector">3. The ID Selector</h3>
<p>An ID is <strong>unique</strong>. You should only use a specific ID once per page. It is used to target one very specific element.</p>
<ul>
<li><p><strong>Syntax:</strong> Use a hash <code>#</code> followed by the ID name.</p>
<ul>
<li><code>#main-title { font-size: 40px; }</code></li>
</ul>
</li>
<li><p><strong>HTML usage:</strong> <code>&lt;h1 id="main-title"&gt;Welcome&lt;/h1&gt;</code></p>
</li>
<li><p><strong>Analogy:</strong> "Calling Suhojit—please come to the office." (Targeting a specific individual by name).</p>
</li>
</ul>
<h3 id="heading-4-grouping-selectors">4. Grouping Selectors</h3>
<p>If you want several different elements to share the same style, you don't have to write the same code three times. You can group them with a <strong>comma</strong>.</p>
<ul>
<li><p><strong>Syntax:</strong> <code>h1, h2, p { font-family: Arial; }</code></p>
</li>
<li><p><strong>What it does:</strong> Applies the font to all H1s, H2s, and paragraphs at once.</p>
</li>
<li><p><strong>Analogy:</strong> "The soccer team, the basketball team, and the track team all need to sign this form."</p>
</li>
</ul>
<h3 id="heading-5-descendant-selectors">5. Descendant Selectors</h3>
<p>Sometimes you only want to style an element if it is <strong>inside</strong> another specific element.</p>
<ul>
<li><p><strong>Syntax:</strong> Space between selectors.</p>
<ul>
<li><code>div p { color: green; }</code></li>
</ul>
</li>
<li><p><strong>What it does:</strong> Only targets paragraphs that are inside a <code>&lt;div&gt;</code>. If a paragraph is outside, it stays the default color.</p>
</li>
<li><p><strong>Analogy:</strong> "Only the people <em>inside</em> the library must stay quiet."</p>
</li>
</ul>
<h3 id="heading-basic-priority-who-wins-specificity">Basic Priority: Who Wins? (Specificity)</h3>
<p>What happens if you tell all <code>&lt;p&gt;</code> tags to be blue, but you tell <code>.highlight</code> paragraphs to be red? CSS has a "weight" system called <strong>Specificity</strong>.</p>
<p>A simple rule of thumb for beginners is:</p>
<ol>
<li><p><strong>ID selectors</strong> are the strongest.</p>
</li>
<li><p><strong>Class selectors</strong> are medium.</p>
</li>
<li><p><strong>Element selectors</strong> are the weakest.</p>
</li>
</ol>
<p>If there is a conflict, the "stronger" selector wins!</p>
<h3 id="heading-summary">Summary</h3>
<ul>
<li><p><strong>Tag:</strong> Targets everyone.</p>
</li>
<li><p><strong>Class:</strong> Targets a specific group.</p>
</li>
<li><p><strong>ID:</strong> Targets one unique item.</p>
</li>
<li><p><strong>Comma (</strong><code>,</code>): Targets multiple groups.</p>
</li>
<li><p><strong>Space (</strong> ): Targets items inside other items.</p>
</li>
</ul>
<p>Mastering these five selectors is the foundation of everything you will build in CSS.</p>
]]></content:encoded></item><item><title><![CDATA[Emmet for HTML: A Beginner’s Guide to Writing Faster Markup]]></title><description><![CDATA[If you’ve ever spent five minutes typing out <p></p> and <div></div> over and over again, you know that writing HTML can feel a bit slow. It’s like building a house by hand-carving every single brick.
This is where Emmet comes in. Emmet is a powerful...]]></description><link>https://blog.subhajitbag.in/emmet-for-html-a-beginners-guide-to-writing-faster-markup</link><guid isPermaLink="true">https://blog.subhajitbag.in/emmet-for-html-a-beginners-guide-to-writing-faster-markup</guid><category><![CDATA[HTML5]]></category><category><![CDATA[Emmet]]></category><category><![CDATA[HTML]]></category><category><![CDATA[ChaiCode]]></category><dc:creator><![CDATA[Subhajit Bag]]></dc:creator><pubDate>Sun, 01 Feb 2026 17:18:20 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769966216569/2e8f05ed-1354-4e12-a008-72b357bb14f8.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>If you’ve ever spent five minutes typing out <code>&lt;p&gt;&lt;/p&gt;</code> and <code>&lt;div&gt;&lt;/div&gt;</code> over and over again, you know that writing HTML can feel a bit slow. It’s like building a house by hand-carving every single brick.</p>
<p>This is where <strong>Emmet</strong> comes in. Emmet is a powerful "shorthand" language built into most modern code editors (like VS Code). It allows you to type short abbreviations that instantly expand into full blocks of HTML.</p>
<h3 id="heading-what-is-emmet">What is Emmet?</h3>
<p>In simple terms, think of Emmet as <strong>Auto-correct for HTML on steroids.</strong> Instead of typing out all the brackets and closing tags, you type a simple word, hit the <code>Tab</code> key, and Emmet does the heavy lifting for you. It’s not a new language; it’s just a faster way to write the HTML you already know.</p>
<h3 id="heading-1-generating-the-boilerplate">1. Generating the Boilerplate</h3>
<p>Every HTML file needs a basic structure (the doctype, head, body, etc.).</p>
<ul>
<li><p><strong>The Manual Way:</strong> Type about 10–15 lines of code.</p>
</li>
<li><p><strong>The Emmet Way:</strong> Type <code>!</code> and press <code>Tab</code>.</p>
</li>
</ul>
<p><strong>The Result:</strong></p>
<pre><code class="lang-xml"><span class="hljs-meta">&lt;!DOCTYPE <span class="hljs-meta-keyword">html</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">html</span> <span class="hljs-attr">lang</span>=<span class="hljs-string">"en"</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">head</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">charset</span>=<span class="hljs-string">"UTF-8"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">title</span>&gt;</span>Document<span class="hljs-tag">&lt;/<span class="hljs-name">title</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">head</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">body</span>&gt;</span>

<span class="hljs-tag">&lt;/<span class="hljs-name">body</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">html</span>&gt;</span>
</code></pre>
<h3 id="heading-2-creating-elements-with-classes-and-ids">2. Creating Elements with Classes and IDs</h3>
<p>Emmet uses syntax similar to CSS selectors, making it very intuitive to learn.</p>
<ul>
<li><p><strong>For an ID:</strong> Use the <code>#</code> symbol.</p>
<ul>
<li><code>div#header</code> → <code>&lt;div id="header"&gt;&lt;/div&gt;</code></li>
</ul>
</li>
<li><p><strong>For a Class:</strong> Use the <code>.</code> symbol.</p>
<ul>
<li><code>p.intro</code> → <code>&lt;p class="intro"&gt;&lt;/p&gt;</code></li>
</ul>
</li>
</ul>
<h3 id="heading-3-nesting-creating-elements-inside-elements">3. Nesting: Creating Elements Inside Elements</h3>
<p>You can build entire structures in one line using the <code>&gt;</code> (child) symbol.</p>
<ul>
<li><p><strong>Abbreviation:</strong> <code>div&gt;ul&gt;li</code></p>
</li>
<li><p><strong>Expanded HTML:</strong></p>
</li>
</ul>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">ul</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">ul</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
</code></pre>
<h3 id="heading-4-multiplication-creating-many-elements-at-once">4. Multiplication: Creating Many Elements at Once</h3>
<p>Need a list with five items? Don't copy-paste. Use the <code>*</code> symbol.</p>
<ul>
<li><p><strong>Abbreviation:</strong> <code>ul&gt;li*5</code></p>
</li>
<li><p><strong>Expanded HTML:</strong></p>
</li>
</ul>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">ul</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">ul</span>&gt;</span>
</code></pre>
<h3 id="heading-5-adding-text-and-attributes">5. Adding Text and Attributes</h3>
<p>You can even pre-fill your tags with text or specific attributes.</p>
<ul>
<li><p><strong>Text Content:</strong> Use curly braces <code>{ }</code>.</p>
<ul>
<li><code>button{Click Me}</code> → <code>&lt;button&gt;Click Me&lt;/button&gt;</code></li>
</ul>
</li>
<li><p><strong>Attributes:</strong> Use square brackets <code>[ ]</code>.</p>
<ul>
<li><code>img[src="logo.png"]</code> → <code>&lt;img src="logo.png" alt=""&gt;</code></li>
</ul>
</li>
</ul>
<h3 id="heading-putting-it-all-together-a-pro-example">Putting it All Together: A Pro Example</h3>
<p>Imagine you need a navigation bar with three links inside a <code>nav</code> container.</p>
<p><strong>The Emmet Shortcut:</strong> <code>nav&gt;ul&gt;li*3&gt;a</code></p>
<p><strong>The Result:</strong></p>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">nav</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">ul</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">a</span> <span class="hljs-attr">href</span>=<span class="hljs-string">""</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">a</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">a</span> <span class="hljs-attr">href</span>=<span class="hljs-string">""</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">a</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">a</span> <span class="hljs-attr">href</span>=<span class="hljs-string">""</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">a</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">ul</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">nav</span>&gt;</span>
</code></pre>
<h3 id="heading-summary-why-use-emmet">Summary: Why Use Emmet?</h3>
<ul>
<li><p><strong>Speed:</strong> You can write a whole page structure in seconds.</p>
</li>
<li><p><strong>Accuracy:</strong> Emmet never forgets to close a tag or mistypes a bracket.</p>
</li>
<li><p><strong>Focus:</strong> You spend less time fighting with your keyboard and more time thinking about your design.</p>
</li>
</ul>
<p>Emmet is purely optional, but once you start using it, you’ll never want to go back to the "slow way."</p>
]]></content:encoded></item><item><title><![CDATA[Understanding HTML Tags and Elements]]></title><description><![CDATA[Think of a webpage like a human body. The CSS is the skin and clothes (the style), JavaScript is the muscles (the movement), and HTML (HyperText Markup Language) is the skeleton. It provides the structure and tells the browser exactly what kind of co...]]></description><link>https://blog.subhajitbag.in/understanding-html-tags-and-elements</link><guid isPermaLink="true">https://blog.subhajitbag.in/understanding-html-tags-and-elements</guid><category><![CDATA[HTML5]]></category><category><![CDATA[HTML]]></category><category><![CDATA[ChaiCode]]></category><dc:creator><![CDATA[Subhajit Bag]]></dc:creator><pubDate>Sun, 01 Feb 2026 17:06:30 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769965399349/9d8e10fa-3e05-4a7a-8fec-ea064c8acf55.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Think of a webpage like a human body. The CSS is the skin and clothes (the style), JavaScript is the muscles (the movement), and <strong>HTML (HyperText Markup Language)</strong> is the <strong>skeleton</strong>. It provides the structure and tells the browser exactly what kind of content it is looking at—whether it's a heading, a paragraph, or a button.</p>
<h3 id="heading-what-is-an-html-tag">What is an HTML Tag?</h3>
<p>A <strong>tag</strong> is like a label. It tells the browser, "Everything inside here should be treated as a specific type of content." Tags are wrapped in angle brackets <code>&lt; &gt;</code>.</p>
<p>Most tags come in pairs:</p>
<ol>
<li><p><strong>Opening Tag (</strong><code>&lt;p&gt;</code>): Tells the browser where the content starts.</p>
</li>
<li><p><strong>Closing Tag (</strong><code>&lt;/p&gt;</code>): Tells the browser where the content ends (notice the forward slash <code>/</code>).</p>
</li>
</ol>
<h3 id="heading-tag-vs-element-whats-the-difference">Tag vs. Element: What’s the Difference?</h3>
<p>These terms are often used interchangeably, but there is a subtle difference:</p>
<ul>
<li><p><strong>Tag:</strong> Just the markers (<code>&lt;h1&gt;</code> or <code>&lt;/h1&gt;</code>).</p>
</li>
<li><p><strong>Content:</strong> The actual text or data inside.</p>
</li>
<li><p><strong>Element:</strong> The whole package—the opening tag, the content, and the closing tag combined.</p>
</li>
</ul>
<h3 id="heading-self-closing-void-elements">Self-Closing (Void) Elements</h3>
<p>Some elements don't have "content" in the traditional sense, so they don't need a closing tag. These are called <strong>Void Elements</strong>.</p>
<ul>
<li><p><code>&lt;img&gt;</code>: Used to show an image.</p>
</li>
<li><p><code>&lt;br&gt;</code>: Used for a single line break.</p>
</li>
<li><p><code>&lt;hr&gt;</code>: Creates a horizontal line across the page.</p>
</li>
</ul>
<h3 id="heading-block-level-vs-inline-elements">Block-level vs. Inline Elements</h3>
<p>This is one of the most important concepts for building layouts. Think of these as "The Box" vs. "The Text."</p>
<h4 id="heading-1-block-level-elements">1. Block-level Elements</h4>
<p>These elements always start on a <strong>new line</strong> and take up the <strong>full width</strong> available (like a block).</p>
<ul>
<li><p><strong>Common tags:</strong> <code>&lt;div&gt;</code>, <code>&lt;h1&gt;</code> through <code>&lt;h6&gt;</code>, <code>&lt;p&gt;</code>, <code>&lt;ul&gt;</code>.</p>
</li>
<li><p><strong>Analogy:</strong> A brick in a wall.</p>
</li>
</ul>
<h4 id="heading-2-inline-elements">2. Inline Elements</h4>
<p>These elements do <strong>not</strong> start on a new line. They only take up as much width as necessary.</p>
<ul>
<li><p><strong>Common tags:</strong> <code>&lt;span&gt;</code>, <code>&lt;a&gt;</code> (links), <code>&lt;strong&gt;</code> (bold).</p>
</li>
<li><p><strong>Analogy:</strong> A word inside a sentence.</p>
</li>
</ul>
<h3 id="heading-commonly-used-tags-to-get-started">Commonly Used Tags to Get Started</h3>
<div class="hn-table">
<table>
<thead>
<tr>
<td><strong>Tag</strong></td><td><strong>Purpose</strong></td><td><strong>Type</strong></td></tr>
</thead>
<tbody>
<tr>
<td><code>&lt;h1&gt;</code> to <code>&lt;h6&gt;</code></td><td>Headings (1 is biggest, 6 is smallest)</td><td>Block</td></tr>
<tr>
<td><code>&lt;p&gt;</code></td><td>Paragraphs of text</td><td>Block</td></tr>
<tr>
<td><code>&lt;a&gt;</code></td><td>Hyperlinks to other pages</td><td>Inline</td></tr>
<tr>
<td><code>&lt;div&gt;</code></td><td>A container used to group other elements</td><td>Block</td></tr>
<tr>
<td><code>&lt;span&gt;</code></td><td>A container used for small parts of text</td><td>Inline</td></tr>
<tr>
<td><code>&lt;ul&gt;</code> &amp; <code>&lt;li&gt;</code></td><td>Unordered (bulleted) lists</td><td>Block</td></tr>
</tbody>
</table>
</div>]]></content:encoded></item><item><title><![CDATA[TCP Working: 3-Way Handshake & Reliable Communication]]></title><description><![CDATA[Imagine sending a 1,000-piece jigsaw puzzle through the mail, but instead of a box, you send each piece in its own tiny envelope. Without rules, some pieces might arrive late, some might get lost, and the receiver would have no idea how to put them t...]]></description><link>https://blog.subhajitbag.in/tcp-working-3-way-handshake-and-reliable-communication</link><guid isPermaLink="true">https://blog.subhajitbag.in/tcp-working-3-way-handshake-and-reliable-communication</guid><category><![CDATA[networking]]></category><category><![CDATA[ChaiCode]]></category><dc:creator><![CDATA[Subhajit Bag]]></dc:creator><pubDate>Sun, 01 Feb 2026 14:33:13 GMT</pubDate><content:encoded><![CDATA[<p>Imagine sending a 1,000-piece jigsaw puzzle through the mail, but instead of a box, you send each piece in its own tiny envelope. Without rules, some pieces might arrive late, some might get lost, and the receiver would have no idea how to put them together.</p>
<p>In the digital world, <strong>TCP (Transmission Control Protocol)</strong> is the set of rules that solves this. It ensures that data isn't just sent, but is received <strong>completely, in order, and without errors.</strong></p>
<h3 id="heading-why-we-need-tcp-solving-the-chaos">Why We Need TCP: Solving the Chaos</h3>
<p>If we sent data without a protocol like TCP, we would face three major problems:</p>
<ol>
<li><p><strong>Lost Data:</strong> A packet might disappear in transit, leaving you with a broken file.</p>
</li>
<li><p><strong>Out-of-Order Delivery:</strong> Packet #5 might arrive before Packet #1, making a mess of the information.</p>
</li>
<li><p><strong>Corruption:</strong> Data might get "flipped" or damaged during the journey.</p>
</li>
</ol>
<p>TCP is designed to solve these by creating a stable "virtual circuit" between two computers.</p>
<h3 id="heading-the-tcp-3-way-handshake-the-digital-greeting">The TCP 3-Way Handshake: The "Digital Greeting"</h3>
<p>Before TCP sends a single byte of real data (like a photo or a message), it must establish a connection. It does this through a process called the <strong>3-Way Handshake</strong>.</p>
<p>Think of it like a formal phone conversation:</p>
<ol>
<li><p><strong>Step 1: SYN (Synchronize)</strong></p>
<ul>
<li><strong>Computer A says:</strong> "Hey, I want to talk to you. Here is my starting sequence number so we can keep track of our messages."</li>
</ul>
</li>
<li><p><strong>Step 2: SYN-ACK (Synchronize-Acknowledgment)</strong></p>
<ul>
<li><strong>Computer B says:</strong> "I hear you! I'm ready to talk too. I received your request, and here is <em>my</em> starting sequence number so you can track my messages."</li>
</ul>
</li>
<li><p><strong>Step 3: ACK (Acknowledgment)</strong></p>
<ul>
<li><strong>Computer A says:</strong> "Got it! We are both ready. Let's start sending data."</li>
</ul>
</li>
</ol>
<p>Once this "handshake" is complete, the connection is established, and the actual data transfer begins.</p>
<h3 id="heading-how-tcp-ensures-reliability">How TCP Ensures Reliability</h3>
<p>Once the conversation starts, TCP uses a system of <strong>Sequence Numbers</strong> and <strong>Acknowledgments</strong> to stay organized.</p>
<ul>
<li><p><strong>Ordering:</strong> Every packet is numbered (e.g., 1, 2, 3). If they arrive as 1, 3, 2, TCP waits and reorders them correctly before showing them to the application.</p>
</li>
<li><p><strong>Reliability (Retransmission):</strong> If Computer A sends Packet #2 but never receives an "Acknowledgment" (ACK) back from Computer B, it assumes the packet was lost and <strong>sends it again.</strong></p>
</li>
<li><p><strong>Correctness:</strong> TCP uses a "checksum" to verify the data hasn't been corrupted. If the math doesn't add up, it asks for a fresh copy.</p>
</li>
</ul>
<h3 id="heading-closing-the-connection-the-4-way-terminate">Closing the Connection: The 4-Way Terminate</h3>
<p>When the data transfer is finished, TCP doesn't just "hang up." It follows a polite closing procedure using <strong>FIN (Finish)</strong> and <strong>ACK</strong> flags.</p>
<ol>
<li><p><strong>A sends a FIN:</strong> "I'm done sending data."</p>
</li>
<li><p><strong>B sends an ACK:</strong> "I hear you, I'm just finishing up my last few tasks."</p>
</li>
<li><p><strong>B sends a FIN:</strong> "Okay, I'm done now too."</p>
</li>
<li><p><strong>A sends an ACK:</strong> "Goodbye!"</p>
</li>
</ol>
<p>This ensures that both sides have finished their work and no data is cut off prematurely.</p>
<h3 id="heading-summary">Summary</h3>
<ul>
<li><p><strong>Handshake:</strong> Establishes trust and synchronizes numbers.</p>
</li>
<li><p><strong>Sequencing:</strong> Keeps data in the right order.</p>
</li>
<li><p><strong>Retransmission:</strong> Fixes lost data by sending it again.</p>
</li>
<li><p><strong>Termination:</strong> Closes the connection gracefully.</p>
</li>
</ul>
<p>TCP is the backbone of the web because it turns an unreliable internet into a reliable stream of information.</p>
]]></content:encoded></item><item><title><![CDATA[TCP vs UDP: When to Use What, and How TCP Relates to HTTP]]></title><description><![CDATA[TCP vs UDP: The Rules of the Internet Road
Whenever you use the internet, your data is being sent using specific rules called protocols. Think of these as the "shipping methods" for your digital packages. The two most common methods are TCP and UDP.
...]]></description><link>https://blog.subhajitbag.in/tcp-vs-udp-when-to-use-what-and-how-tcp-relates-to-http</link><guid isPermaLink="true">https://blog.subhajitbag.in/tcp-vs-udp-when-to-use-what-and-how-tcp-relates-to-http</guid><category><![CDATA[networking]]></category><category><![CDATA[ChaiCode]]></category><dc:creator><![CDATA[Subhajit Bag]]></dc:creator><pubDate>Sun, 01 Feb 2026 14:09:52 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-tcp-vs-udp-the-rules-of-the-internet-road">TCP vs UDP: The Rules of the Internet Road</h2>
<p>Whenever you use the internet, your data is being sent using specific rules called <strong>protocols</strong>. Think of these as the "shipping methods" for your digital packages. The two most common methods are <strong>TCP</strong> and <strong>UDP</strong>.</p>
<p>While they both move data, they do it in completely different ways. One is built for <strong>safety</strong>, while the other is built for <strong>speed</strong>.</p>
<h3 id="heading-what-are-tcp-and-udp">What are TCP and UDP?</h3>
<ul>
<li><p><strong>TCP (Transmission Control Protocol):</strong> This is the <strong>Reliable Courier</strong>. It ensures that every single piece of data arrives at the destination, in the correct order, without any errors. If a piece goes missing, TCP goes back and gets it.</p>
</li>
<li><p><strong>UDP (User Datagram Protocol):</strong> This is the <strong>Live Broadcaster</strong>. It fires data at the destination as fast as possible. It doesn't check if the data arrived, and it doesn't care if things show up out of order. It just keeps moving.</p>
</li>
</ul>
<h3 id="heading-key-differences-reliability-vs-speed">Key Differences: Reliability vs. Speed</h3>
<div class="hn-table">
<table>
<thead>
<tr>
<td><strong>Feature</strong></td><td><strong>TCP (Reliable)</strong></td><td><strong>UDP (Fast)</strong></td></tr>
</thead>
<tbody>
<tr>
<td><strong>Connection</strong></td><td>Must "shake hands" before talking.</td><td>Just starts sending.</td></tr>
<tr>
<td><strong>Reliability</strong></td><td>Guarantees delivery.</td><td>No guarantee; data can be lost.</td></tr>
<tr>
<td><strong>Ordering</strong></td><td>Data arrives in order (1, 2, 3).</td><td>Data arrives whenever (3, 1, 2).</td></tr>
<tr>
<td><strong>Speed</strong></td><td>Slower (due to error checking).</td><td>Much faster (no overhead).</td></tr>
</tbody>
</table>
</div><h3 id="heading-when-to-use-what-with-real-world-examples">When to Use What (With Real-World Examples)</h3>
<h4 id="heading-use-tcp-when-accuracy-is-everything">Use TCP when accuracy is everything</h4>
<p>You use TCP when losing even a tiny bit of data would break the entire thing.</p>
<ul>
<li><p><strong>Web Browsing (HTTP/HTTPS):</strong> You don't want half an image or missing text on a page.</p>
</li>
<li><p><strong>Email (SMTP/IMAP):</strong> An email with missing words is useless.</p>
</li>
<li><p><strong>File Downloads (FTP):</strong> If one "bit" is missing, the file is corrupted and won't open.</p>
</li>
</ul>
<h4 id="heading-use-udp-when-speed-is-everything">Use UDP when speed is everything</h4>
<p>You use UDP when "real-time" is more important than "perfect quality."</p>
<ul>
<li><p><strong>Video Calls (Zoom/Teams):</strong> If the internet glitches, it's better to have a tiny skip in the video than to pause the whole call to "re-download" a frame from three seconds ago.</p>
</li>
<li><p><strong>Online Gaming:</strong> You need to know where the enemy is <em>now</em>, not where they were half a second ago.</p>
</li>
<li><p><strong>Live Streaming:</strong> Speed is king to keep the broadcast live.</p>
</li>
</ul>
<h3 id="heading-what-is-http-and-where-does-it-fit">What is HTTP and Where Does It Fit?</h3>
<p>A common point of confusion for beginners is: <em>"Is HTTP the same as TCP?"</em> The answer is <strong>No</strong>. They live on different "layers" of the internet.</p>
<ul>
<li><p><strong>TCP is the Transport Layer:</strong> It handles the physical movement of data and ensures it gets there safely.</p>
</li>
<li><p><strong>HTTP is the Application Layer:</strong> It defines <strong>what</strong> the message says (e.g., "Give me the homepage of Google").</p>
</li>
</ul>
<h4 id="heading-the-layering-relationship">The Layering Relationship</h4>
<p>HTTP doesn't replace TCP; it <strong>runs on top of it</strong>. Imagine HTTP is the <strong>letter</strong> you wrote, and TCP is the <strong>envelope and the postal service</strong>. The letter (HTTP) relies on the postal service (TCP) to be delivered correctly.</p>
<h4 id="heading-why-does-http-use-tcp">Why does HTTP use TCP?</h4>
<p>Websites are complex. To load a page, your browser needs every line of code and every pixel of the logo to be perfect. Because HTTP requires 100% accuracy, it almost always chooses TCP as its "shipping method."</p>
<h3 id="heading-summary">Summary</h3>
<ul>
<li><p><strong>TCP</strong> is for when you need it done <strong>right</strong>.</p>
</li>
<li><p><strong>UDP</strong> is for when you need it done <strong>fast</strong>.</p>
</li>
<li><p><strong>HTTP</strong> is the language your browser speaks, and it uses <strong>TCP</strong> to make sure that language is heard clearly without any missing words.</p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Getting Started with cURL]]></title><description><![CDATA[Imagine you want to order a pizza. You don't just walk into the kitchen; you send a message (your order) to the restaurant's server (the person taking orders). In the digital world, a server is just a powerful computer that "serves" information—like ...]]></description><link>https://blog.subhajitbag.in/getting-started-with-curl</link><guid isPermaLink="true">https://blog.subhajitbag.in/getting-started-with-curl</guid><category><![CDATA[networking]]></category><category><![CDATA[curl]]></category><category><![CDATA[ChaiCode]]></category><dc:creator><![CDATA[Subhajit Bag]]></dc:creator><pubDate>Sat, 31 Jan 2026 17:56:30 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769882088907/ef8adca9-b101-4780-a050-1f094282764a.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Imagine you want to order a pizza. You don't just walk into the kitchen; you send a message (your order) to the restaurant's <strong>server</strong> (the person taking orders). In the digital world, a server is just a powerful computer that "serves" information—like websites, images, or data—when a client (like your browser) asks for it.</p>
<p>Usually, your browser handles this talking for you. But as a programmer, you often need to talk to these servers directly. That is where <strong>cURL</strong> comes in.</p>
<h3 id="heading-what-is-curl-in-simple-terms">What is cURL? (In Simple Terms)</h3>
<p><strong>cURL</strong> (which stands for "Client URL") is a command-line tool that lets you send and receive data to and from a server.</p>
<p>Think of it as a <strong>browser without the window</strong>. Instead of clicking buttons and seeing images, you type a "message" into your terminal, and the server sends a "message" back.</p>
<h3 id="heading-why-programmers-need-curl">Why Programmers Need cURL</h3>
<p>While browsers are great for humans, cURL is great for developers because:</p>
<ul>
<li><p><strong>It’s fast:</strong> You can test a server's response in seconds without loading a whole website.</p>
</li>
<li><p><strong>It’s precise:</strong> You can see exactly what the server is saying "under the hood."</p>
</li>
<li><p><strong>It’s automatable:</strong> You can write scripts that use cURL to check if a website is down or to upload files automatically.</p>
</li>
</ul>
<h3 id="heading-making-your-first-request">Making Your First Request</h3>
<p>Open your terminal (Command Prompt on Windows or Terminal on Mac/Linux) and type this simple command:</p>
<pre><code class="lang-bash">curl https://www.google.com
</code></pre>
<p><strong>What happened?</strong> You just told cURL to go to Google's server and ask for the contents of their homepage. The "wall of text" you see appearing is the <strong>HTML code</strong> that makes up the website. Your browser usually turns that code into a pretty page; cURL shows it to you in its raw form.</p>
<p><img src="https://encrypted-tbn0.gstatic.com/licensed-image?q=tbn:ANd9GcT0fob7XCmvcP6YUFNV9z-sUlXo6kxhcRwjat4FXiLwyEsjt-S-JKqDvl1569NKmdRn34Ep1Qz1Hkf6fqKTDsVjT8FqwSyYITu555azLWCsppUDn2E" alt="Image of client server communication model" /></p>
<p>Shutterstock</p>
<h3 id="heading-understanding-the-request-and-response">Understanding the Request and Response</h3>
<p>Every time you use cURL, a two-way conversation happens:</p>
<ol>
<li><p><strong>The Request:</strong> This is your message to the server. It includes the URL and the "Method" (how you are asking).</p>
</li>
<li><p><strong>The Response:</strong> This is the server's reply. It usually contains:</p>
<ul>
<li><p><strong>The Data:</strong> The HTML, image, or JSON data you asked for.</p>
</li>
<li><p><strong>The Status Code:</strong> A number that tells you if the request worked. For example, <strong>200</strong> means "OK," while the famous <strong>404</strong> means "Not Found."</p>
</li>
</ul>
</li>
</ol>
<h3 id="heading-talking-to-apis-get-and-post">Talking to APIs (GET and POST)</h3>
<p>When programmers talk to servers to get data (like weather info or stock prices), they use <strong>APIs</strong>. There are two main ways to send these messages:</p>
<h4 id="heading-1-get-the-give-me-request">1. GET (The "Give Me" Request)</h4>
<p>This is the default. You are asking the server to <em>give</em> you information.</p>
<pre><code class="lang-bash">curl https://api.github.com/users/octocat
</code></pre>
<p><em>This fetches public data about a specific GitHub user.</em></p>
<h4 id="heading-2-post-the-take-this-request">2. POST (The "Take This" Request)</h4>
<p>This is used when you want to <em>send</em> or <em>create</em> something on the server, like submitting a form or a comment.</p>
<pre><code class="lang-bash">curl -X POST https://example.com/login -d <span class="hljs-string">"username=user1&amp;password=123"</span>
</code></pre>
<p><em>Note: The</em> <code>-X POST</code> tells cURL the method, and <code>-d</code> stands for the "data" you are sending.</p>
<h3 id="heading-common-mistakes-beginners-make">Common Mistakes Beginners Make</h3>
<ul>
<li><p><strong>Forgetting the Protocol:</strong> If you type <code>curl</code> <a target="_blank" href="http://google.com"><code>google.com</code></a> instead of <code>curl</code> <a target="_blank" href="https://google.com"><code>https://google.com</code></a>, it might fail or behave unexpectedly. Always include the <code>http://</code> or <code>https://</code>.</p>
</li>
<li><p><strong>Ignoring Status Codes:</strong> Beginners often think if they see <em>any</em> text, it worked. Always check if you got a <strong>200 OK</strong> or an error code.</p>
</li>
<li><p><strong>Getting Overwhelmed by "Flags":</strong> cURL has hundreds of options (like <code>-v</code>, <code>-L</code>, <code>-H</code>). Don't try to learn them all at once! Stick to the basics until you're comfortable.</p>
</li>
</ul>
<h3 id="heading-conclusion">Conclusion</h3>
<p>cURL is the universal language for talking to the internet. By mastering just a few simple commands, you gain the power to interact with almost any web service on the planet.</p>
]]></content:encoded></item><item><title><![CDATA[Understanding Network Devices]]></title><description><![CDATA[When we are talking about browsing and sending data packets through the internet, we should have knowledge about Networking Devices and how they work. These devices are the silent workers that ensure your "click" reaches a server halfway across the w...]]></description><link>https://blog.subhajitbag.in/understanding-network-devices</link><guid isPermaLink="true">https://blog.subhajitbag.in/understanding-network-devices</guid><category><![CDATA[networking]]></category><category><![CDATA[ChaiCode]]></category><dc:creator><![CDATA[Subhajit Bag]]></dc:creator><pubDate>Sat, 31 Jan 2026 17:47:45 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769881626083/2e7c0c6b-6b6d-4765-8651-dc0fb7e35788.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>When we are talking about browsing and sending data packets through the internet, we should have knowledge about Networking Devices and how they work. These devices are the silent workers that ensure your "click" reaches a server halfway across the world and returns as a webpage on your screen.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769881191216/7d88ee5f-e19c-451e-b7c5-962e6e8c2859.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-what-is-a-modem">What is a Modem?</h3>
<p>A <strong>Modem</strong> is a networking device that connects your home network to your Internet Service Provider (ISP) by translating signals. The name comes from combining <strong>MOdulator</strong> and <strong>DEModulator</strong>.</p>
<ul>
<li><p><strong>Modulator:</strong> When you send data from your computer (like an email), that data is a digital series of <strong>1s and 0s</strong>. However, long-distance transmission lines (like cable or phone lines) use <strong>analog waves</strong> to carry information. The modulator converts digital data into analog signals to travel across the copper or fiber lines to the ISP.</p>
</li>
<li><p><strong>Demodulator:</strong> When your ISP sends data back to you, it arrives as an analog wave. The demodulator takes that incoming signal and converts it back into <strong>digital 1s and 0s</strong> that your devices can process.</p>
</li>
</ul>
<h3 id="heading-what-is-a-router">What is a Router?</h3>
<p>While the modem connects you to the outside world, the <strong>Router</strong> is the "Traffic Police" for your internal network.</p>
<ul>
<li><p><strong>Responsibility:</strong> The modem gives you one single public IP address. The router creates a private network and assigns unique local IP addresses to every device in your house.</p>
</li>
<li><p><strong>How it works:</strong> When a packet arrives from the modem, the router looks at the destination address and ensures the "Netflix data" goes to your TV and the "Work email" goes to your laptop. It directs traffic between your local network and the internet.</p>
</li>
</ul>
<h3 id="heading-switch-vs-hub-the-local-network-workers">Switch vs. Hub: The Local Network Workers</h3>
<p>If you have many wired devices (like a gaming console, a PC, and a smart home hub), you need a way to connect them all.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769881505538/ab2a1306-bc73-4f04-a2fb-3e7537682dd3.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p><strong>Hub (The Loudspeaker):</strong> A hub is an "unintelligent" device. When it receives a data packet, it doesn't know where it's supposed to go, so it broadcasts that packet to <strong>every single device</strong> connected to it. This creates unnecessary traffic and slows things down.</p>
</li>
<li><p><strong>Switch (The Post Office):</strong> A switch is smart. It learns the unique ID (MAC address) of every connected device. When a packet comes in, it sends it <strong>only</strong> to the specific device that needs it, keeping the network fast and efficient.</p>
</li>
</ul>
<h3 id="heading-firewall-the-security-gate">Firewall: The Security Gate</h3>
<p>A <strong>Firewall</strong> is your network's first line of defense. It sits between your internal network and the public internet to monitor and filter traffic.</p>
<ul>
<li><p><strong>Why it exists:</strong> It follows a set of security rules. If it sees an unauthorized person trying to access your computer or a suspicious program trying to send data out, it blocks the connection.</p>
</li>
<li><p><strong>Analogy:</strong> It’s like a security guard at a gated community who only lets in people on the "approved guest list."</p>
</li>
</ul>
<h3 id="heading-load-balancer-the-scaling-specialist">Load Balancer: The Scaling Specialist</h3>
<p>For professional websites with millions of users, a single server would crash under the weight. This is where a <strong>Load Balancer</strong> comes in.</p>
<ul>
<li><p><strong>How it works:</strong> It acts as a "Reverse Traffic Controller." It sits in front of a group of servers and distributes incoming requests evenly across them.</p>
</li>
<li><p><strong>Why it's needed:</strong> It ensures no single server gets overwhelmed. If one server fails, the load balancer intelligently redirects traffic to the healthy ones, keeping the website online.</p>
</li>
</ul>
<h3 id="heading-conclusion-the-grand-workflow">Conclusion: The Grand Workflow</h3>
<p>In a real-world scenario, your data follows this path:</p>
<ol>
<li><p><strong>Modem</strong> translates the signal from the ISP.</p>
</li>
<li><p><strong>Firewall</strong> checks if the data is safe to enter.</p>
</li>
<li><p><strong>Router</strong> decides which specific device gets the data.</p>
</li>
<li><p><strong>Switch</strong> sends it through the specific wire to your device.</p>
</li>
<li><p>(On the server-side) A <strong>Load Balancer</strong> ensures your request is handled by an available server.</p>
</li>
</ol>
]]></content:encoded></item><item><title><![CDATA[Tracing the Path: How DNS Resolution Works Under the Hood]]></title><description><![CDATA[When you type google.com into your browser, a complex chain of events happens in milliseconds. This process is called DNS Name Resolution. Because humans prefer names and computers prefer numbers (IP addresses), we need a "phonebook" to translate the...]]></description><link>https://blog.subhajitbag.in/tracing-the-path-how-dns-resolution-works-under-the-hood</link><guid isPermaLink="true">https://blog.subhajitbag.in/tracing-the-path-how-dns-resolution-works-under-the-hood</guid><category><![CDATA[dns]]></category><category><![CDATA[ChaiCode]]></category><dc:creator><![CDATA[Subhajit Bag]]></dc:creator><pubDate>Fri, 30 Jan 2026 13:57:47 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769781418890/99f3aa9c-2bd0-43a8-9c75-29a3b25a211b.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>When you type <a target="_blank" href="http://google.com"><code>google.com</code></a> into your browser, a complex chain of events happens in milliseconds. This process is called <strong>DNS Name Resolution</strong>. Because humans prefer names and computers prefer numbers (IP addresses), we need a "phonebook" to translate them.</p>
<p>While your browser does this automatically, engineers use a powerful command-line tool called <code>dig</code> (Domain Information Groper) to inspect exactly how this lookup happens at every layer.</p>
<h3 id="heading-what-is-the-dig-command">What is the <code>dig</code> Command?</h3>
<p><code>dig</code> is a network administration tool used for querying DNS name servers. It is the gold standard for troubleshooting DNS issues because it provides detailed information about how a domain is being resolved. Unlike simpler tools, <code>dig</code> shows you the raw answers directly from the name servers.</p>
<p>To understand the full flow, we can use <code>dig</code> to mimic the "recursive" lookup process that happens behind the scenes.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769780505677/ed5faf58-0ecf-4843-88c9-2d127acf5913.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-layer-1-the-root-name-servers-dig-ns">Layer 1: The Root Name Servers (<code>dig . NS</code>)</h3>
<p>The resolution process always starts at the very top of the hierarchy: the <strong>Root</strong>. There are 13 logical root servers worldwide.</p>
<p>To see who they are, run:</p>
<pre><code class="lang-bash">dig . NS
</code></pre>
<ul>
<li><p><strong>What this does:</strong> It asks for the <strong>NS (Name Server)</strong> records of the root (represented by a single dot <code>.</code>).</p>
</li>
<li><p><strong>The Result:</strong> You get a list of servers (like <a target="_blank" href="http://a.root-servers.net"><code>a.root-servers.net</code></a>). These servers don't know where <a target="_blank" href="http://google.com"><code>google.com</code></a> is, but they know exactly where to find the servers for <code>.com</code>.</p>
</li>
</ul>
<h3 id="heading-layer-2-the-tld-name-servers-dig-com-ns">Layer 2: The TLD Name Servers (<code>dig com NS</code>)</h3>
<p>Once the root server points us in the right direction, we move to the <strong>Top-Level Domain (TLD)</strong> layer. This is where domains like <code>.com</code>, <code>.org</code>, and <code>.net</code> are managed.</p>
<p>To find the managers of the <code>.com</code> registry, run:</p>
<pre><code class="lang-bash">dig com NS
</code></pre>
<ul>
<li><p><strong>What this does:</strong> It queries the root servers for the name servers responsible for all <code>.com</code> addresses.</p>
</li>
<li><p><strong>The Result:</strong> You’ll see names like <a target="_blank" href="http://a.gtld-servers.net"><code>a.gtld-servers.net</code></a>. These servers still don't have Google’s IP address, but they know who owns the specific record for <a target="_blank" href="http://google.com"><code>google.com</code></a>.</p>
</li>
</ul>
<h3 id="heading-layer-3-the-authoritative-name-servers-dig-googlecomhttpgooglecom-ns">Layer 3: The Authoritative Name Servers (<code>dig</code> <a target="_blank" href="http://google.com"><code>google.com</code></a> <code>NS</code>)</h3>
<p>Now we reach the final "source of truth." These are the <strong>Authoritative Name Servers</strong>. They are owned by the domain owner (Google) or their DNS provider.</p>
<p>To see Google's own servers, run:</p>
<pre><code class="lang-bash">dig google.com NS
</code></pre>
<ul>
<li><p><strong>What this does:</strong> It finds the specific servers that have the master record for Google.</p>
</li>
<li><p><strong>The Result:</strong> You get servers like <a target="_blank" href="http://ns1.google.com"><code>ns1.google.com</code></a>. These are the only servers that can give you the "Authoritative Answer."</p>
</li>
</ul>
<h3 id="heading-layer-4-the-final-ip-address-dig-googlecomhttpgooglecom">Layer 4: The Final IP Address (<code>dig</code> <a target="_blank" href="http://google.com"><code>google.com</code></a>)</h3>
<p>Finally, we ask the authoritative server for the actual address where the website lives.</p>
<p>Run the standard query:</p>
<pre><code class="lang-bash">dig google.com
</code></pre>
<ul>
<li><strong>The Answer Section:</strong> This is the most important part of the output. It returns the <strong>A record</strong> (e.g., <code>142.250.190.46</code>).</li>
</ul>
<h3 id="heading-putting-it-together-the-recursive-resolver">Putting it Together: The Recursive Resolver</h3>
<p>In the real world, your computer doesn't run these four commands. Instead, it asks a <strong>Recursive Resolver</strong> (like your ISP or 8.8.8.8).</p>
<p>The resolver does the heavy lifting: it talks to the Root, then the TLD, then the Authoritative server on your behalf, caches the result, and hands your browser the final IP. Using <code>dig</code> allows you to "see" these invisible steps.</p>
<p>Summary</p>
<ul>
<li><p><code>dig . NS</code>: Finds the Root.</p>
</li>
<li><p><code>dig com NS</code>: Finds the TLD (registry).</p>
</li>
<li><p><code>dig</code> <a target="_blank" href="http://google.com"><code>google.com</code></a> <code>NS</code>: Finds the Authoritative source.</p>
</li>
<li><p><code>dig</code> <a target="_blank" href="http://google.com"><code>google.com</code></a>: Gets the final IP address.</p>
</li>
</ul>
<p>By understanding this layered approach, you can pinpoint exactly where a DNS failure is happening—whether it's a domain registration issue (TLD) or a server configuration error (Authoritative).</p>
]]></content:encoded></item><item><title><![CDATA[DNS Record Types Explained]]></title><description><![CDATA[DNS (Domain Name System) is the internet’s phonebook, translating human-readable names (example.com) into machine-readable IP addresses (192.0.2.1192.0 .2 .1192.0.2.1). DNS records are essential instructions stored in zone files that tell browsers wh...]]></description><link>https://blog.subhajitbag.in/dns-record-types-explained</link><guid isPermaLink="true">https://blog.subhajitbag.in/dns-record-types-explained</guid><category><![CDATA[Git]]></category><category><![CDATA[ChaiCode]]></category><dc:creator><![CDATA[Subhajit Bag]]></dc:creator><pubDate>Fri, 30 Jan 2026 13:03:24 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769777170076/0f8a7d87-245b-45c0-8c3d-6cf228ea878c.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>DNS (Domain Name System) is the internet’s phonebook, translating human-readable names (example.com) into machine-readable IP addresses (192.0.2.1192.0 .2 .1192.0.2.1). DNS records are essential instructions stored in zone files that tell browsers where to find websites, direct email traffic, and verify ownership.Key records include NS (who controls the domain), A/AAAA (domain-to-IP mapping), CNAME (aliases), and TXT (verification).</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769780044336/b973c0db-3d75-4d15-81d0-6380936bb257.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-why-dns-records-are-needed">Why DNS Records Are Needed</h3>
<p>Without these records, you would have to memorize complex strings of numbers for every site you visit. DNS records provide a structured way to map your domain to various services like web hosting, email, and security verification.</p>
<h3 id="heading-1-ns-record-name-server">1. NS Record (Name Server)</h3>
<p><strong>The Responsibility Pointer:</strong> An <strong>NS Record</strong> tells the internet which DNS server is "in charge" of your domain.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769780316704/aee8617c-a6bb-47d7-8fcc-f1fa4fd36532.png" alt class="image--center mx-auto" /></p>
<ul>
<li><strong>Analogy:</strong> If you want to find someone in a large building, the NS record is the receptionist who tells you which directory to look at.</li>
</ul>
<h3 id="heading-2-a-and-aaaa-records">2. A and AAAA Records</h3>
<p><strong>The Home Address:</strong> These records map your domain directly to a server's IP address.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769780185288/4610c966-57a0-4732-8c99-68e9cf5a71e2.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p><strong>A Record:</strong> Maps a domain to an <strong>IPv4</strong> address (e.g., <code>192.0.2.1</code>).</p>
</li>
<li><p><strong>AAAA Record:</strong> Maps a domain to the newer, longer <strong>IPv6</strong> address.</p>
</li>
<li><p><strong>Analogy:</strong> This is the physical street address of your website's "house."</p>
</li>
</ul>
<h3 id="heading-3-cname-record-canonical-name">3. CNAME Record (Canonical Name)</h3>
<p><strong>The Alias:</strong> A <strong>CNAME</strong> points one domain name to another instead of an IP.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769780206172/a3957069-c4a8-462e-a870-c954398ad8d3.png" alt class="image--center mx-auto" /></p>
<ul>
<li><strong>Example:</strong> You can make <a target="_blank" href="http://shop.mysite.com"><code>shop.mysite.com</code></a> point to <a target="_blank" href="http://mysite.com"><code>mysite.com</code></a>. If the IP of <a target="_blank" href="http://mysite.com"><code>mysite.com</code></a> changes, the shop alias follows it automatically.</li>
</ul>
<h3 id="heading-4-mx-record-mail-exchanger">4. MX Record (Mail Exchanger)</h3>
<p><strong>The Post Office:</strong> The <strong>MX Record</strong> tells the internet where to send your emails.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769780236784/468629e1-aa53-40f9-a520-17752c7a515a.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p><strong>Problem it solves:</strong> Without this, emails sent to <a target="_blank" href="mailto:hello@mysite.com"><code>hello@mysite.com</code></a> wouldn't know which mail server to enter.</p>
</li>
<li><p><strong>Analogy:</strong> This is like the postal service's delivery instructions for your business's mailroom.</p>
</li>
</ul>
<h3 id="heading-5-txt-record-text">5. TXT Record (Text)</h3>
<p><strong>The Note:</strong> A <strong>TXT Record</strong> holds text information for outside services.</p>
<ul>
<li><p><strong>Use Case:</strong> It’s commonly used to verify you own the domain (for Google or Microsoft) or to set up email security (SPF/DKIM) to prevent spam.</p>
</li>
<li><p><strong>Analogy:</strong> A note taped to your door providing a verification code for a delivery driver.</p>
</li>
</ul>
<h3 id="heading-how-they-all-work-together">How They All Work Together</h3>
<p>Imagine setting up a small business website. Your DNS setup might look like this:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769780350119/1ff36535-aeb7-421c-9fa6-7b01ca966d38.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p><strong>NS:</strong> Points to your provider (e.g., Cloudflare or GoDaddy).</p>
</li>
<li><p><strong>A:</strong> Points <a target="_blank" href="http://mysite.com"><code>mysite.com</code></a> to your web host's IP.</p>
</li>
<li><p><strong>CNAME:</strong> Points <a target="_blank" href="http://www.mysite.com"><code>www.mysite.com</code></a> to <a target="_blank" href="http://mysite.com"><code>mysite.com</code></a>.</p>
</li>
<li><p><strong>MX:</strong> Points to your email provider (e.g., Gmail).</p>
</li>
<li><p><strong>TXT:</strong> A code to verify you own the site for search engines.</p>
</li>
</ul>
<h3 id="heading-summary">Summary</h3>
<p>DNS records are the unsung heroes of your online presence. Each record handles a specific "department"—A for the website, MX for email, and TXT for security. Once they are all set, your domain becomes a fully functional digital hub.</p>
]]></content:encoded></item><item><title><![CDATA[Inside Git: How It Works and the Role of the .git Folder]]></title><description><![CDATA[You've learned the essential Git commands like git add and git commit, but have you ever wondered what magic happens when you type them? Git isn't just a clever file copier; it's a sophisticated content tracker.
Understanding Git's internal mechanics...]]></description><link>https://blog.subhajitbag.in/inside-git-how-it-works-and-the-role-of-the-git-folder</link><guid isPermaLink="true">https://blog.subhajitbag.in/inside-git-how-it-works-and-the-role-of-the-git-folder</guid><category><![CDATA[Git]]></category><category><![CDATA[ChaiCode]]></category><dc:creator><![CDATA[Subhajit Bag]]></dc:creator><pubDate>Fri, 30 Jan 2026 12:39:57 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769768282294/5af19bcb-e68c-4e9c-9847-53e20558cba5.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>You've learned the essential Git commands like <code>git add</code> and <code>git commit</code>, but have you ever wondered what magic happens when you type them? Git isn't just a clever file copier; it's a sophisticated content tracker.</p>
<p>Understanding Git's internal mechanics will transform your understanding from simply <em>using</em> Git to truly <em>mastering</em> it. Let's dive into the <code>.git</code> folder and explore the core components that make version control possible.</p>
<h3 id="heading-understanding-the-git-folder-the-heart-of-your-repository">Understanding the <code>.git</code> Folder: The Heart of Your Repository</h3>
<p>When you run <code>git init</code> in a directory, Git creates a hidden <code>.git</code> folder. This isn't just some metadata; it's the <strong>entire Git repository</strong>. It contains every piece of information Git needs to track your project's history, perform operations, and maintain its integrity. Without this folder, your project is just a regular directory of files.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769776481639/84addab3-eea8-4442-bcb8-0bbc6021275e.png" alt class="image--center mx-auto" /></p>
<p>Inside <code>.git</code>, you'll find several crucial subdirectories and files:</p>
<ul>
<li><p><code>objects/</code>: This is where Git stores all your content—your files, directories, and commit history—in a highly efficient and unique format.</p>
</li>
<li><p><code>refs/</code>: Contains pointers (references) to commits, such as branches (<code>heads</code>) and tags.</p>
</li>
<li><p><code>HEAD</code>: A special pointer that indicates which branch you are currently on.</p>
</li>
<li><p><code>index</code>: Also known as the "staging area," this file records the content of your working directory that will go into the next commit.</p>
</li>
</ul>
<h3 id="heading-git-objects-the-building-blocks-of-your-project">Git Objects: The Building Blocks of Your Project</h3>
<p>Git stores everything as one of four core "objects," each identified by a unique <strong>SHA-1 hash</strong> (a 40-character hexadecimal string). These hashes are crucial for Git's integrity; if even one bit of content changes, its hash changes, meaning Git knows it's a different object.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769776460100/9187c874-3654-4ea8-88b8-b8dc4510abc2.webp" alt class="image--center mx-auto" /></p>
<ol>
<li><p><strong>Blob (Binary Large OBject):</strong></p>
<ul>
<li><p><strong>What it is:</strong> A blob object simply stores the <strong>content</strong> of a file. It doesn't contain the filename or any directory structure. If two files have identical content, Git stores only one blob and points to it twice.</p>
</li>
<li><p><strong>Analogy:</strong> Think of it as the raw data of your text file, image, or any other file.</p>
</li>
</ul>
</li>
<li><p><strong>Tree:</strong></p>
<ul>
<li><p><strong>What it is:</strong> A tree object represents a directory. It contains a list of other tree objects (subdirectories) and blob objects (files), along with their filenames, permissions, and hashes.</p>
</li>
<li><p><strong>Analogy:</strong> This is like a snapshot of a folder's contents, showing which files are inside and which subfolders exist.</p>
</li>
</ul>
</li>
<li><p><strong>Commit:</strong></p>
<ul>
<li><p><strong>What it is:</strong> A commit object holds metadata about a specific point in your project's history. It includes:</p>
<ul>
<li><p>A pointer to the top-level <strong>tree</strong> object for that commit (the entire project state).</p>
</li>
<li><p>Pointers to its <strong>parent commit(s)</strong> (showing its history).</p>
</li>
<li><p>Author and committer information.</p>
</li>
<li><p>Timestamp.</p>
</li>
<li><p>The commit message.</p>
</li>
</ul>
</li>
<li><p><strong>Analogy:</strong> A commit is the complete "snapshot" of your project at a moment in time, along with who took the picture and why.</p>
</li>
</ul>
</li>
</ol>
<h3 id="heading-how-git-tracks-changes-git-add-and-git-commit-internally">How Git Tracks Changes: <code>git add</code> and <code>git commit</code> Internally</h3>
<p>Let's trace the journey of your code when you use the two most common Git commands:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769776630451/5bbf0763-a66a-42d7-87db-3b65881d52da.png" alt class="image--center mx-auto" /></p>
<h4 id="heading-1-git-add-preparing-your-snapshot">1. <code>git add &lt;file&gt;</code>: Preparing Your Snapshot</h4>
<p>When you run <code>git add index.html</code>:</p>
<ol>
<li><p>Git takes the current content of <code>index.html</code>.</p>
</li>
<li><p>It calculates a <strong>SHA-1 hash</strong> for this content.</p>
</li>
<li><p>If a blob object with this content/hash doesn't already exist, Git compresses the content and stores it as a <strong>blob object</strong> in the <code>.git/objects/</code> directory.</p>
</li>
<li><p>Git updates the <strong>staging area</strong> (the <code>index</code> file in <code>.git</code>) to record that <code>index.html</code> (with its specific blob hash) is ready for the next commit.</p>
</li>
</ol>
<h4 id="heading-2-git-commit-m-my-commit-message-saving-your-history">2. <code>git commit -m "My commit message"</code>: Saving Your History</h4>
<p>When you run <code>git commit</code>:</p>
<ol>
<li><p>Git looks at the <strong>staging area</strong> (<code>.git/index</code>) to see which file contents (blob hashes) are prepared.</p>
</li>
<li><p>It then constructs <strong>tree objects</strong>:</p>
<ul>
<li><p>It creates a tree object for each subdirectory, linking to their respective blobs and subtrees.</p>
</li>
<li><p>Finally, it creates a top-level tree object that represents the entire project's directory structure and file contents as they are in the staging area. All these tree objects are stored in <code>.git/objects/</code>.</p>
</li>
</ul>
</li>
<li><p>Git creates a <strong>commit object</strong>:</p>
<ul>
<li><p>It points to the top-level tree object.</p>
</li>
<li><p>It records the previous commit's hash as its parent.</p>
</li>
<li><p>It adds your author, timestamp, and commit message.</p>
</li>
<li><p>This commit object is also stored in <code>.git/objects/</code>.</p>
</li>
</ul>
</li>
<li><p>Finally, Git updates the branch pointer (e.g., <code>HEAD</code> or <code>refs/heads/main</code>) to point to this new commit object.</p>
</li>
</ol>
<p>This meticulous process ensures that every commit is a complete, immutable snapshot of your project, linked to its parents to form a continuous history.</p>
<h3 id="heading-the-power-of-hashes-integrity-and-immutability">The Power of Hashes: Integrity and Immutability</h3>
<p>Git's reliance on SHA-1 hashes for every object is fundamental to its robustness:</p>
<ul>
<li><p><strong>Content Addressable:</strong> Git doesn't store files by name; it stores them by their content's hash. This means if you have the hash, you can retrieve the exact content.</p>
</li>
<li><p><strong>Data Integrity:</strong> Because the hash is derived from the content, any accidental or malicious alteration of a file or commit would immediately change its hash. Git would detect this discrepancy, guaranteeing the integrity of your history.</p>
</li>
<li><p><strong>Efficiency:</strong> If you commit the same file content multiple times, Git only stores the blob once, saving space.</p>
</li>
</ul>
<p>By understanding these internal mechanisms, you gain a powerful mental model of how Git works, helping you troubleshoot issues, understand branching, and appreciate the genius behind this essential tool.</p>
]]></content:encoded></item><item><title><![CDATA[Why Version Control Exists: The Pendrive Era of Software Development]]></title><description><![CDATA[Before Git, GitHub, and modern collaboration tools, software development looked very different. If you’ve ever seen folders named final, final_v2, or latest_final_really_this_time, congratulations—you’ve already lived through a version-control nightm...]]></description><link>https://blog.subhajitbag.in/why-version-control-exists-the-pendrive-era-of-software-development</link><guid isPermaLink="true">https://blog.subhajitbag.in/why-version-control-exists-the-pendrive-era-of-software-development</guid><category><![CDATA[Git]]></category><category><![CDATA[ChaiCode]]></category><dc:creator><![CDATA[Subhajit Bag]]></dc:creator><pubDate>Fri, 30 Jan 2026 12:16:05 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769755833205/540b4625-8391-4b66-9303-204f6cf9dd0b.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Before Git, GitHub, and modern collaboration tools, software development looked very different. If you’ve ever seen folders named <code>final</code>, <code>final_v2</code>, or <code>latest_final_really_this_time</code>, congratulations—you’ve already lived through a version-control nightmare.</p>
<p>Let’s rewind a bit and understand <strong>why version control exists</strong>, using a very real and painful analogy: <strong>the pendrive era</strong>.</p>
<h3 id="heading-the-pendrive-analogy-in-software-development">The "Pendrive Analogy" in Software Development</h3>
<p>Imagine a small team of developers working on the same project. In the not-so-distant past, their "version control system" might have looked something like this:</p>
<ul>
<li><strong>The Shared Pendrive:</strong> One developer codes for a few hours, saves the work to a pendrive, then physically hands it to another. The next person copies the files, adds their code, and passes it back.</li>
</ul>
<ul>
<li><p><strong>The "Final" Folder Dilemma:</strong> On their local machines, they'd create nested folders like <code>Project/</code>, <code>Project_final/</code>, and <code>Project_final_v2_NEW/</code>.</p>
</li>
<li><p><strong>Emailing Code:</strong> If they weren't in the same room, they would email <code>.zip</code> files back and forth, praying they were looking at the most "latest" version.</p>
</li>
</ul>
<h3 id="heading-problems-faced-before-version-control-systems">Problems Faced Before Version Control Systems</h3>
<p>The "pendrive" approach led to a nightmare of inefficiencies. Without a central system to manage code, teams faced three major, project-killing issues:</p>
<ol>
<li><p><strong>Overwriting Code:</strong> This was the "silent killer." If two developers worked on the same <code>index.html</code> file at the same time, whoever saved their version to the pendrive last would completely wipe out the other person's work. There was no way to "merge" the two different sets of changes automatically.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769775051556/62e3ee40-acf7-42fd-bd1b-ec3d3eaf69c0.png" alt class="image--center mx-auto" /></p>
</li>
<li><p><strong>Losing Changes:</strong> A corrupt pendrive, a crashed hard drive, or accidentally deleting the wrong <code>final_v2</code> folder meant hours or weeks of work vanishing forever. Without a remote backup or history, there was no way to recover what was lost.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769775119238/4ebde1a2-3f73-4b73-b4ea-4d53d5190a85.png" alt class="image--center mx-auto" /></p>
</li>
<li><p><strong>No Collaboration History:</strong> If a bug appeared, it was impossible to know who introduced it, when it happened, or why. There was no record just a collection of files with no context.</p>
</li>
</ol>
<p><strong>Why Version Control Became Mandatory</strong></p>
<p>The chaos of the "pendrive era" made two things clear: software development needed a system that offered <strong>collaboration</strong>, <strong>history</strong>, and <strong>safety</strong>.</p>
<p>Version control systems provide:</p>
<ul>
<li><p><strong>A Single Source of Truth:</strong> A central repository (like GitHub) stores the definitive history of the codebase.</p>
</li>
<li><p><strong>History and Accountability:</strong> Every change is tracked, allowing teams to roll back errors, debug issues efficiently, and understand the context behind decisions.</p>
</li>
<li><p><strong>Seamless Collaboration:</strong> Developers can work in parallel on different features without fear of overwriting each other's work, thanks to branching and merging capabilities.</p>
</li>
</ul>
<h3 id="heading-conclusion-moving-forward">Conclusion: Moving Forward</h3>
<p>The "pendrive era" wasn't just slow—it was risky. Every hour spent manually merging files was an hour taken away from actual coding.</p>
<p>By using Version Control, you replace that chaos with a <strong>safety net</strong>. You gain the freedom to experiment, the security of a full history, and the ability to collaborate without fear. If you haven't yet, now is the perfect time to leave the "final_v2" folders behind and embrace the power of Git.</p>
]]></content:encoded></item><item><title><![CDATA[Git for Beginners: Basics and Essential Commands]]></title><description><![CDATA[Today, Git is one of the most essential tools for developers. Git helps you track changes, manage code, and collaborate efficiently, whether you are working alone or in a team. This blog will walk you through what Git is, why it’s used, its core conc...]]></description><link>https://blog.subhajitbag.in/git-for-beginners-basics-and-essential-commands</link><guid isPermaLink="true">https://blog.subhajitbag.in/git-for-beginners-basics-and-essential-commands</guid><category><![CDATA[Git]]></category><category><![CDATA[ChaiCode]]></category><dc:creator><![CDATA[Subhajit Bag]]></dc:creator><pubDate>Fri, 30 Jan 2026 11:40:52 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769761187830/6add3f3f-a1ae-447c-9e61-06d22f31a7e7.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Today, Git is one of the most essential tools for developers. Git helps you track changes, manage code, and collaborate efficiently, whether you are working alone or in a team. This blog will walk you through what Git is, why it’s used, its core concepts, and the most common commands—step by step.</p>
<h2 id="heading-what-is-git">What is Git?</h2>
<p>Git is an <strong>open-source version control system</strong> that acts like a "Time Machine" for your project.</p>
<p>In simple terms, it tracks every change you make to your source code, allowing you to revert to previous versions if something breaks. Unlike older systems that rely on a central server, Git is <strong>distributed</strong>—meaning every developer has a complete copy of the project's entire history on their local computer. This makes it incredibly fast, reliable for offline work, and ensures that multiple people can collaborate on the same files simultaneously without accidentally overwriting each other's work.</p>
<h3 id="heading-why-git-is-used">Why Git is Used</h3>
<p>Git is the industry standard for three major reasons:</p>
<ul>
<li><p><strong>Tracking Changes:</strong> Git keeps a granular history of every line of code you modify. If a bug appears, you can "travel back in time" to see exactly when and where the logic changed.</p>
</li>
<li><p><strong>Seamless Collaboration:</strong> Git allows multiple developers to work on the same codebase simultaneously. It uses a "merge" system to combine everyone's work, ensuring that your teammate's new feature doesn't accidentally overwrite your bug fix.</p>
</li>
<li><p><strong>Experimentation:</strong> You can create "branches" to try out risky new ideas. If the experiment fails, you simply delete the branch; your main project remains untouched and "clean."</p>
</li>
</ul>
<h3 id="heading-git-basics-and-core-terminologies">Git Basics and Core Terminologies</h3>
<p>Before jumping into commands, you need to understand the "Big Four" concepts:</p>
<ul>
<li><p><strong>Repository (Repo):</strong> A folder where Git tracks all the changes. It’s the "project container."</p>
</li>
<li><p><strong>Commit:</strong> A snapshot of your files at a specific point in time. Think of it as a permanent record in the project's history.</p>
</li>
<li><p><strong>Branch:</strong> A parallel version of your repository. It allows you to develop features without affecting the main code.</p>
</li>
<li><p><strong>HEAD:</strong> A pointer that tells Git which branch or commit you are currently looking at.</p>
</li>
</ul>
<h3 id="heading-the-three-stages-of-git">The Three Stages of Git</h3>
<p>Understanding how Git moves files is crucial. Files exist in one of three states:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769773061238/9a1556d5-bb03-4ef8-b8df-32a102b62833.png" alt class="image--center mx-auto" /></p>
<ol>
<li><p><strong>Working Directory:</strong> Where you are currently editing files.</p>
</li>
<li><p><strong>Staging Area (Index):</strong> A "prep zone" where you pick which changes you want to include in your next snapshot.</p>
</li>
<li><p><strong>Local Repository:</strong> Where Git permanently stores the snapshots (commits).</p>
</li>
</ol>
<p><strong>Common Git Commands and</strong></p>
<p>Let's put these concepts into practice with essential commands.</p>
<p><strong>Initialization and Setup</strong></p>
<ol>
<li><p><code>git init</code>: Initializes a new Git repository in your current directory. A hidden <code>.git</code> folder is created to store all history.</p>
<pre><code class="lang-bash"> git init
</code></pre>
</li>
</ol>
<p><strong>The Basic Workflow</strong></p>
<ol>
<li><p><code>git status</code>: Checks the state of your working directory and staging area. It tells you which files are modified, which are staged, and which are untracked. Run this frequently!</p>
<pre><code class="lang-bash"> git status
</code></pre>
</li>
<li><p><code>git add &lt;file&gt;</code>: Adds a specific file (or use <code>git add .</code> for all files) from your working directory to the staging area.<strong>bash</strong></p>
<pre><code class="lang-bash"> git add index.html
 <span class="hljs-comment"># or to add all changes:</span>
 git add .
</code></pre>
</li>
<li><p><code>git commit -m "message"</code>: Records the staged changes as a new commit in the local repository. The <code>-m</code> flag lets you attach a descriptive message.<strong>bash</strong></p>
<pre><code class="lang-bash"> git commit -m <span class="hljs-string">"Add initial HTML structure for homepage"</span>
</code></pre>
</li>
</ol>
<p><strong>Viewing History</strong></p>
<ol>
<li><p><code>git log</code>: Displays a log of all previous commits in the current branch. You can see who committed what, when, and their message.</p>
<pre><code class="lang-bash"> git <span class="hljs-built_in">log</span>
</code></pre>
</li>
</ol>
<h3 id="heading-wrapping-up-your-journey-with-git">Wrapping Up: Your Journey with Git</h3>
<p>Git is more than just a tool; it’s a safety net that gives you the confidence to experiment and build complex projects. While the command line might feel intimidating at first, these five basic commands—<code>init</code>, <code>status</code>, <code>add</code>, <code>commit</code>, and <code>log</code>—will handle 90% of your daily work.</p>
]]></content:encoded></item></channel></rss>