<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Rahul on Medium]]></title>
        <description><![CDATA[Stories by Rahul on Medium]]></description>
        <link>https://medium.com/@rahul-tawar?source=rss-6ba4d2bdd3f6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*P_nGyrNhx5ythAFsSSJr2A.jpeg</url>
            <title>Stories by Rahul on Medium</title>
            <link>https://medium.com/@rahul-tawar?source=rss-6ba4d2bdd3f6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 11:27:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rahul-tawar/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Rigvedic Gods that were revered in the Ancient Syria]]></title>
            <link>https://rahul-tawar.medium.com/the-rigvedic-gods-that-were-revered-in-the-ancient-syria-624cadc47bff?source=rss-6ba4d2bdd3f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/624cadc47bff</guid>
            <category><![CDATA[history]]></category>
            <category><![CDATA[ancient-history]]></category>
            <category><![CDATA[archeology]]></category>
            <category><![CDATA[linguistics]]></category>
            <category><![CDATA[india]]></category>
            <dc:creator><![CDATA[Rahul]]></dc:creator>
            <pubDate>Sun, 19 Jul 2026 18:18:43 GMT</pubDate>
            <atom:updated>2026-07-19T18:18:43.738Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/848/0*ZP8YduvFymsvTA7H" /></figure><p>The modern Indo-Aryan people today, we naturally associate them with the northern half of the Indian subcontinent — from Sindh in the west to Tripura in the east. For at least three and a half millennia, the Indo-Aryan languages have been spoken across this vast region.</p><p>Yet history presents us with an interesting puzzle.</p><p>Around <strong>1500–1300 BCE</strong>, in a kingdom located not in India but in <strong>northern Syria, southeastern Anatolia, and northern Iraq</strong>, we surprisingly encounter rulers with Indo-Aryan names, treaties invoking Vedic deities such as <strong>Mitra, Varuna, Indra, and the Nasatyas</strong>, and horse-training terminology that closely resembles early Indo-Aryan vocabulary.</p><p>This kingdom was known as the <strong>Mitanni Kingdom</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Jo2pUaWaWNt8AHVc.png" /></figure><p>But how did Indo-Aryan linguistic and religious elements appear over 3,000 kilometers west of the Indian subcontinent?</p><h3>The Political Landscape of the Ancient Near East</h3><p>To understand the Mitanni, we must first understand the region in which they existed.</p><p>During the second half of the second millennium BCE, the Fertile Crescent was dominated by several powerful kingdoms. Together these were the major powers of the ancient west asia, near-east.</p><h3>The Egyptian New Kingdom</h3><p>To the southwest, Egypt had entered its <strong>New Kingdom</strong> after expelling the Hyksos rulers from the Nile Delta. This period marked the beginning of Egypt’s greatest imperial age. Egyptian armies frequently campaigned into the Levant(Mostly the region of modern-day Israel, Jordan) bringing them into direct contact with the kingdoms of Western Asia.</p><h3>The Hittite Kingdom</h3><p>To the north, on the Anatolian Plateau, ruled the <strong>Hittites</strong>, an Indo-European-speaking civilization whose capital was Hattusa. They were among the strongest military powers of the Bronze Age and would become the greatest rivals of the Mitanni.</p><h3>Babylonia and Mesopotamia</h3><p>To the southeast lay the ancient cities of Mesopotamia, centered on the Tigris and Euphrates rivers. Although Babylon remained culturally influential, political control in Mesopotamia shifted between different dynasties throughout this period.</p><p>Situated between these three great powers was the Mitanni Kingdom, occupying one of the most strategically important regions of the ancient Near East.</p><h3>The Mitanni Kingdom</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lLaQaHaOm1PzGV2q.jpg" /></figure><p>The Mitanni present one of history’s most fascinating cultural combinations.</p><p>The overwhelming majority of the population spoke <strong>Hurrian</strong>, a language unrelated to either the Semitic languages of Mesopotamia or the Indo-European languages spoken by the Hittites.</p><p>Yet the ruling aristrocrates preserved unmistakable Indo-Aryan elements.</p><p>Several Mitanni kings had names that can be explained through Indo-Aryan linguistics, and royal treaties invoked deities from the Vedic civilization:</p><ul><li>Mitra</li><li>Varuna</li><li>Indra</li><li>The Nasatyas (Ashvins)</li></ul><p>These names appear in official diplomatic documents, making them among the earliest written references to these Indo-Aryan gods outside South Asia.</p><p>This suggests that while the kingdom itself was predominantly Hurrian, its ruling aristocracy either originated from an Indo-Aryan-speaking tradition or had absorbed a strong Indo-Aryan cultural influence.</p><h3>The Horse Training Manual</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xwEQPxwAbbhHf0ri" /></figure><p>One of the strongest pieces of evidence comes from a horse-training manual composed by <strong>Kikkuli</strong>, a horse trainer associated with the Hittite court.</p><p>The manual itself is written in the <strong>Hittite language</strong>, not Sanskrit.</p><p>However, it contains several technical terms that closely resemble early Indo-Aryan vocabulary.</p><p>Examples include:</p><ul><li><strong>aika-wartanna:</strong> “One lap”</li><li><strong>tera-wartanna:</strong> “Three laps”</li><li><strong>panza-wartanna:</strong> “Five laps”</li><li><strong>satta-wartanna:</strong> “Seven laps”</li><li><strong>nāwa-wartanna:</strong> “Nine laps”</li></ul><p>Horse breeding and chariot warfare represented cutting-edge military technology during the Bronze Age. The preservation of Indo-Aryan technical vocabulary in this context suggests that Indo-Aryan specialists possessed considerable expertise in this field.</p><h3>The relation with the Egyptian Pharohs</h3><p>The Mitanni did not exist in isolation.</p><p>One of the richest sources for understanding their diplomacy comes from the <strong>Amarna Letters</strong>, a collection of clay tablets discovered in Egypt.</p><p>These letters document correspondence between the Egyptian pharaohs and the kings of Mitanni.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GCc_dMK_1Jbx7OoJ" /></figure><p>Although, I do not understand a atomic letter of this script but it’s deciphered and summarized as something like this:</p><blockquote>The letters exchanged between the Mitanni king <strong>Tushratta</strong> and the Egyptian pharaoh reveal a relationship based on diplomacy rather than warfare. They discuss royal marriages, exchanges of luxurious gifts such as gold, requests for military cooperation, and the balance of power against the expanding Hittite Empire.</blockquote><p>Initially, Egypt and Mitanni competed for influence in the Levant.</p><p>However, as the Hittite Kingdom expanded southward, the geopolitical situation changed.</p><p>The old rivals became allies.</p><p>Royal marriages strengthened this alliance. One Mitanni princess was married into the Egyptian royal family, illustrating how diplomacy in the Bronze Age was often conducted through dynastic marriages rather than permanent embassies.</p><h3>The Decline of the Mitanni Kingdom</h3><p>During the fourteenth century BCE, the Mitanni increasingly came under pressure from both the Hittites in the northwest and the rising Assyrian state in Mesopotamia.</p><p>Internal succession disputes weakened the kingdom further.</p><p>Eventually, the Hittites defeated the Mitanni, and later the Assyrians absorbed what remained of their territory.</p><p>Their political state disappeared.</p><p>Their historical mystery survived.</p><h3>The Indo-Aryan Puzzle</h3><p>How do historians explain the Indo-Aryan presence in the Mitanni Kingdom?</p><p>Several hypotheses have been proposed.</p><h3>Indo-Aryan Migration</h3><p>The most widely accepted explanation among modern linguists suggests that Indo-Aryan-speaking groups moved south from the Eurasian Steppe into Central Asia. From there, different branches spread in different directions — one eventually reaching the Indian subcontinent, while another left traces among the Mitanni elite in northern Syria.</p><h3>Cultural Transmission</h3><p>Some scholars suggest that the Indo-Aryan element represented a relatively small military or aristocratic class that became the ruling elite over a predominantly Hurrian population.</p><h3>Out of India Theory</h3><p>Another hypothesis proposes that Indo-Aryan languages originated within the Indian subcontinent and later spread westward into regions such as Iran and Syria.</p><p>This remains a minority position in contemporary historical linguistics but continues to be discussed by some scholars.</p><p>The Mitanni evidence alone does not conclusively prove either theory. Instead, it demonstrates that Indo-Aryan linguistic and religious traditions had reached Western Asia by the mid-second millennium BCE.</p><h3>Why the Mitanni Matter</h3><p>The Mitanni Kingdom reminds us that the ancient world was far more interconnected than we often imagine.</p><p>More than 3,400 years ago:</p><ul><li>Egyptian pharaohs exchanged diplomatic letters with Mitanni kings.</li><li>Hittite scribes recorded Indo-Aryan technical vocabulary.</li><li>Hurrian-speaking populations lived under rulers who invoked Vedic deities.</li><li>Chariots, diplomats, merchants, and ideas crossed thousands of kilometers long before the Silk Road reached its greatest prominence.</li></ul><p>The Mitanni challenge the modern tendency to view ancient civilizations as isolated worlds.</p><p>Instead, they reveal a Bronze Age connected by diplomacy, warfare, trade, and the movement of languages and ideas across continents.</p><p>Although the Mitanni Kingdom eventually disappeared, it left behind one of history’s most intriguing puzzles — a small but remarkable window into the early interactions between the Indo-Aryan world and the civilizations of the ancient Near East.</p><h3>Glossary</h3><p><strong>Anatolia</strong> — The large peninsula forming most of present-day Turkey, home to the Hittite civilization during the Bronze Age.</p><p><strong>Mitanni</strong> — A Bronze Age kingdom in northern Syria, southeastern Anatolia, and northern Iraq (c. 1500–1300 BCE).</p><p><strong>Hurrian</strong> — The primary language spoken by the people of the Mitanni Kingdom.</p><p><strong>Indo-Aryan</strong> — A branch of the Indo-Iranian language family that includes Vedic Sanskrit and most modern North Indian languages.</p><p><strong>Hittites</strong> — An Indo-European-speaking civilization that ruled much of ancient Anatolia.</p><p><strong>Amarna Letters</strong> — A collection of diplomatic clay tablets exchanged between Egypt and the great kingdoms of the Late Bronze Age.</p><p><strong>Cuneiform</strong> — A wedge-shaped writing system used across ancient Mesopotamia and the Near East.</p><p><strong>Kikkuli Manual</strong> — A Hittite horse-training manual containing several technical terms of Indo-Aryan origin.</p><p><strong>Fertile Crescent</strong> — A fertile region stretching from Egypt through the Levant to Mesopotamia, often called the cradle of civilization.</p><p>PS: I remain deeply sceptical of The Aryan Migration Theory.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=624cadc47bff" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Node.Js is not single-threaded the way you think.]]></title>
            <link>https://rahul-tawar.medium.com/node-js-is-not-single-threaded-the-way-you-think-2aeec905a46e?source=rss-6ba4d2bdd3f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/2aeec905a46e</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Rahul]]></dc:creator>
            <pubDate>Sat, 23 May 2026 20:45:29 GMT</pubDate>
            <atom:updated>2026-05-23T20:45:29.378Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1lAJxxVuo0NXAQ-T.png" /></figure><p>Every backend babe often hears or preaches the mantra:</p><blockquote><em>“Node.Js is single-threaded”</em></blockquote><p>Philosophically, that statement is sound.</p><p>But architecturally, it can be deeply misleading.</p><p>Deeper you go, there are more parameters to it.</p><ul><li>async programming</li><li>event loops</li><li>sockets</li><li>operating systems</li><li>scalability</li><li>and why Node.Js design was sexy in the first place.</li></ul><p>This article is about building the mental model of the Node.Js execution.</p><h3>JavaScript vs Node.js: The First Misconception</h3><p>JavaScript and Node.Js same entity, it’s just that Node.Js has got these additional array of APIs. I used to believe this at the beginning of my backend journey.</p><p>They are not.</p><p>JavaScript is a language.</p><p>Node.Js is a runtime.</p><p>JavaScript itself does not know how to:</p><ul><li>read files</li><li>open sockets</li><li>create servers</li><li>access the operating system</li><li>schedule timers</li></ul><p>Pure JavaScript only defines language features:</p><ul><li>variables</li><li>objects</li><li>closures</li><li>promises</li><li>functions</li></ul><p>That’s it.</p><p>So where do APIs like these come from?</p><pre>fs.readFile()<br>setTimeout()<br>http.createServer()</pre><p>Not from JavaScript.</p><p>They come from the runtime, the host environment. It could be Browser, Node or Deno.</p><h3>The Browser Already Solved This Problem</h3><p>Before Node.Js existed, browsers already had a runtime architecture.</p><p>A browser is not “just rendering HTML.”</p><p>Modern browsers contain:</p><ul><li>rendering engines</li><li>networking systems</li><li>event systems</li><li>memory managers</li><li>JavaScript engines</li></ul><p>Google Chrome embeds the V8 engine to execute JavaScript.</p><p>But V8 alone only executes JavaScript code.</p><p>It does not:</p><ul><li>access the filesystem</li><li>manage sockets</li><li>perform networking</li></ul><p>The browser exposes those capabilities to JavaScript through bindings.</p><h3>Enter Node.Js</h3><p>The browser’s event-driven model was incredibly efficient for handling asynchronous work.</p><p>As I became more entrenched in my study on backend systems, I realized traditional backend servers at the time mostly followed this architecture:</p><pre>1 request = 1 thread</pre><p>Each incoming request created or occupied an operating system thread.</p><p>For more information overload, a full-fledged thread requires roughly from 1 MB to 8MB, multiply this with 50000 request</p><p>That thread would:</p><ul><li>wait for databases</li><li>wait for files</li><li>wait for APIs</li><li>wait for networks</li></ul><p>Most of the time, threads were not computing.</p><p>They were waiting.</p><p>This caused:</p><ul><li>massive memory usage</li><li>expensive context switching</li><li>scheduler overhead</li></ul><p>This became known as the C10K problem:</p><blockquote><em>How do you efficiently handle 10,000 concurrent connections?</em></blockquote><p>Node.Js Philosophy</p><blockquote><em>Don’t dedicate threads to waiting.</em></blockquote><p>Let the operating system handle waiting.</p><h3>The Real Node.Js Architecture</h3><p>Most people imagine Node.Js like this:</p><pre>Request → Thread → Response</pre><p>But Node actually works more like this:</p><pre>JavaScript<br>    ↓<br>V8 Engine<br>    ↓<br>Node.js Bindings<br>    ↓<br>libuv<br>    ↓<br>Operating System</pre><p>This is core architecture of the Node.Js.</p><h3>One JavaScript Thread, Many Native Threads</h3><p>Your JavaScript code runs on:</p><ul><li>one main thread</li><li>one call stack</li></ul><p>At any instant, only one JavaScript frame executes.</p><p>But underneath the surface, Node.Js internally uses:</p><ul><li>libuv worker threads</li><li>garbage collector threads</li><li>V8 compiler threads</li><li>OS networking threads</li></ul><p>This is why saying:</p><blockquote><em>“Node.Js is single-threaded”</em></blockquote><p>without context is incomplete.</p><h3>libuv</h3><p>The real magic behind Node.Js is libuv.</p><p>libuv is a cross-platform asynchronous systems library written in C.</p><p>Which means it’s cross-platform, it’s system library and it’s asynchronous.</p><p>It provides:</p><ul><li>the event loop</li><li>async networking</li><li>timers</li><li>threadpools</li><li>filesystem operations</li><li>process management</li></ul><p>Most importantly, it integrates deeply with operating system event notification systems.</p><p>On Linux, this means epoll.</p><h3>What epoll Changed</h3><p>Imagine monitoring 50,000 sockets manually:</p><pre>Check socket 1<br>Check socket 2<br>Check socket 3<br>...</pre><p>That would waste enormous CPU resources.</p><p>Instead, epoll allows Node.Js to tell the kernel:</p><blockquote><em>“Wake me only when something becomes ready.”</em></blockquote><p>This is event-driven IO.</p><p>The CPU literally sleeps until work exists.</p><p>That’s one of the biggest reasons Node.Js scales so well.</p><h3>Sockets: The Most Important Abstraction</h3><p>A socket is not a thread.</p><p>This is another huge misconception.</p><p>A socket is:</p><blockquote><em>a kernel-managed communication endpoint.</em></blockquote><p>When 50,000 clients connect to a Node.Js server:</p><p>Node.Js does NOT create:</p><ul><li>50,000 threads</li><li>50,000 call stacks</li></ul><p>Instead:</p><ul><li>the operating system manages thousands of sockets</li><li>Node.Js reacts only when sockets become active</li></ul><p>This drastically reduces:</p><ul><li>memory usage</li><li>scheduler overhead</li><li>CPU context switching</li></ul><h3>What Actually Happens During Async IO</h3><p>Suppose you write:</p><pre>const response = await fetch(url);</pre><p>Many developers imagine:</p><ul><li>JavaScript pauses</li><li>the call stack waits</li><li>the thread blocks</li></ul><p>That’s not what happens. Await is just a syntax sugar here!!!</p><p>Instead:</p><ol><li>JavaScript initiates the network request</li><li>Node delegates the work to the operating system</li><li>The JavaScript stack becomes empty</li><li>The event loop continues running</li><li>The OS notifies Node when the socket becomes ready</li><li>The callback resumes execution later</li></ol><p>JavaScript is not “doing many things simultaneously.”</p><p>The operating system is.</p><p>Node.Js is orchestrating events.</p><h3>Bindings: The Bridge Between JS and Native Code</h3><p>Another hidden layer most developers never think about:</p><p>Bindings.</p><p>Bindings are the glue between:</p><ul><li>JavaScript</li><li>native C/C++ code</li></ul><p>When you call:</p><pre>fs.readFile()</pre><p>JavaScript itself does not read the file.</p><p>Instead:</p><ul><li>Node bindings translate JS values into native structures</li><li>libuv coordinates the async operation</li><li>the operating system performs the actual IO</li></ul><p>Without bindings, Node.Js would just be V8 executing arithmetic.</p><p>Bindings are what transform JavaScript into a systems runtime.</p><h3>Why CPU-Heavy computation fucks Node.Js</h3><p>Node.Js excels at IO-heavy workloads.</p><p>But CPU-heavy computation is different.</p><p>If you block the JavaScript thread:</p><pre>while(true){}</pre><p>the event loop stops progressing.</p><p>Now:</p><ul><li>callbacks cannot execute</li><li>timers cannot fire</li><li>incoming requests stall</li></ul><p>This is why Node.Js performs beautifully for:</p><ul><li>APIs</li><li>realtime systems</li><li>chat applications</li><li>streaming</li></ul><p>but needs careful architecture for:</p><ul><li>ML inference</li><li>video encoding</li><li>heavy computation</li></ul><h3>Node.Js Scalability</h3><p>Node.Js scalability does not come from JavaScript itself.</p><p>It comes from:</p><ul><li>kernel event notification systems</li><li>non-blocking IO</li><li>efficient event loops</li><li>asynchronous runtime design</li></ul><h3>So Is Node.Js Single-Threaded?</h3><p>JavaScript execution in Node.Js is single-threaded.</p><p>But the Node.Js runtime itself is absolutely not single-threaded.</p><p>That distinction matters most.</p><p>Got a question drop it below. Be sure to clap👏 and follow if you loved it.</p><p>Follow me on: <a href="https://x.com/therahultawar">X</a>, <a href="http://www.linkedin.com/in/rahultawar">Linkedin</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2aeec905a46e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Habits deficit]]></title>
            <link>https://rahul-tawar.medium.com/habits-deficit-162b7da51af6?source=rss-6ba4d2bdd3f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/162b7da51af6</guid>
            <category><![CDATA[habits]]></category>
            <category><![CDATA[psychology]]></category>
            <category><![CDATA[mental-health]]></category>
            <dc:creator><![CDATA[Rahul]]></dc:creator>
            <pubDate>Mon, 10 Nov 2025 18:17:53 GMT</pubDate>
            <atom:updated>2025-11-10T18:17:53.577Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*luqdHYWXBuk2cxm474gEmQ.png" /></figure><h3>The Hypothesis</h3><p>We all have habits, those default actions that you execute in any given state. Unfortunately, some habits are good, some are bad, based on one’s perspective.</p><p>But excess of bad habits causes what I call, <strong>Habits deficit!</strong></p><blockquote>Let’s look to understand why the brain has this habit mechanism</blockquote><p>Broadly speaking, the brain’s consciousness mechanism can only focus on one thing at a time. It’s uni-dimensional. But we are multi-tasking species, right? So our brain needs to deliberately delegate learned tasks to the subconscious mind. So, when the brain’s neuron circuits master one task or set of tasks, it is essentially outsourced to the subconscious mind. And finally, it becomes a habit.</p><p>Each habit has a latent reward associated with it. In reinforcement learning, we call it a positive or a negative reward based on the agent’s action in achieving the desired goal. Bad and good habits both constitute , in a way, to your desired goal.</p><p>So, negative minus the positive habits, we end up with a habits deficit, simple mathematics! This simple habit calculus exists in every dimension of our lives. Be it work, health, or finance.</p><p>And mostly, we all have a habit deficit in possibly every dimension of our lives. Except for some demigods who have habits surplus.</p><p>Opening Instagram, switching to another YouTube video, it’s a constant rush of new information(or much better “noise”). These habits form without you even realizing it. It’s their in-built feature.</p><p>Fortunately, we have positive habits as well.</p><h3>The Wrong Way</h3><p>Watching some internet celebrities, possibly emulating them, would be a good-looking but often fragile solution. One of the major crises of the modern internet civilization is that we often try to imitate the habits of our best internet celebrities, which is not bad at first glance, but we often see their “<strong>on-screen habits</strong>”, not their “<strong>off-screen habits</strong>”, that complements them. We, then, eventually fail in this because our current habit calculus isn’t commensurate with theirs.</p><p>The more sustainable approach would be internal; <strong>FIX YOUR OWN HABITS CALCULAS</strong></p><p>So, coming back to the topic again, our main objective is to push these habits indifference which is currently in the negative region, towards the positive region.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dVWbIw_3mZGG6odocLcLaw.png" /></figure><h3>My Views</h3><p>So, how do we do this? Apparently, I don’t seem to have a very good answer; multiple books exist on Habits, James Clear, Tony Robbins, and Charles Duhigg, to name a few. These experts have more to say than I.</p><p>But here’s what I do personally. I focus on forming new good habits, being completely conscious when I execute my negative habits, and carefully removing them. Simple, sometimes I fail, sometimes I succeed.</p><p>Second, is social media, of course! If social media isn’t your potential or current source of income, then quit it right away. It does more harm than good. Sounds philosophical, but yeah, it works. Personal testimony, mine.</p><p>Before you start fantasizing that one day, my negative habits will become zero, hold on! Habits form, without you even realizing them. It’s their innate in-built feature; it is you who later labels them as positive or negative.</p><p>And remember, Current You is the overall product of your habits. So, let’s improve them.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=162b7da51af6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Search-R1: A Novel approach to reasoning and retrieval]]></title>
            <link>https://rahul-tawar.medium.com/search-r1-a-novel-approach-to-reasoning-and-retrieval-bcfcc2400351?source=rss-6ba4d2bdd3f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/bcfcc2400351</guid>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[llm-optimization]]></category>
            <dc:creator><![CDATA[Rahul]]></dc:creator>
            <pubDate>Wed, 02 Apr 2025 12:58:44 GMT</pubDate>
            <atom:updated>2025-04-02T12:58:44.473Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*yAQckDZ9IPRkLoGJqBbjRA.png" /><figcaption>arxiv.org</figcaption></figure><p>Recently, i came across a research paper on arxiv titled <strong>“Search‑R1: Training LLMs to Reason and Leverage Search Engines with Reinforcement Learning”</strong></p><p>This study presents a new approach for optimizing LLMs by integrating real-time information retrieval into their reasoning processes.</p><h3>Search-R1</h3><p>Acquiring external knowledge and up-to-date information is essential for effective reasoning and text generation in LLMs. Traditional retrieval augmentation and tool-use training approaches — where a search engine is treated just as an external tool — often lack the flexibility needed for complex multi-turn retrieval or require large-scale supervised data. Further, prompting advanced LLMs with reasoning capabilities during inference to use search engines is not optimal, since the LLM does not learn how to interact optimally with the search engine.</p><p>The Search-R1 framework, based on the ideas behind DeepSeek R1, is designed to improve the reasoning and retrieval capabilities of LLMs by integrating multi-turn retrieval, reinforcement learning (RL), and efficient token masking. Unlike standard LLMs that rely solely on static pretraining(remember, early days of ChatGPT), Search-R1 retrieves relevant information during inference, leading to more accurate, context-aware, and factual responses.</p><h3><strong>Multi-Turn Retrieval &amp; Reasoning</strong></h3><p>In standard RAG systems, a model typically performs a one-shot retrieval — fetching relevant documents once before generating an answer. In contrast, Search‑R1 adopts an <strong>iterative multi‑turn retrieval strategy</strong>. Here’s how it works:</p><ol><li><strong>Initial Reasoning:</strong> The model begins by generating internal reasoning steps, enclosed within &lt;think&gt; ... &lt;/think&gt; tags.</li><li><strong>Identifying Knowledge Gaps:</strong> When the model detects that its internal knowledge is insufficient to confidently answer the question, it triggers a search query. This query is encapsulated within &lt;search&gt; ... &lt;/search&gt; tags.</li><li><strong>Retrieval &amp; Integration:</strong> The search engine returns relevant documents, which are then inserted into the ongoing reasoning process within &lt;information&gt; ... &lt;/information&gt; tags.</li><li><strong>Iterative Refinement:</strong> The model uses this newly acquired information to further refine its reasoning. This loop continues until it can confidently provide a final answer wrapped in &lt;answer&gt; ... &lt;/answer&gt; tags.</li></ol><p>This process imitates how we humans research complex topics — by iteratively refining our search queries and integrating new insights until we arrive at a comprehensive understanding.</p><h3><strong>Reinforcement Learning with a Search Engine</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zhslD9ZDjd_NWc9i_Dlrmg.png" /><figcaption>Bowen et al</figcaption></figure><p>This horrific yet sexy-looking equation, represents reinforcement learning framework with a search engine R, where</p><p>π θ ​ is the policy LLM, 𝜋 ref ​ is the reference LLM, 𝑟 𝜙​ is the reward function, and 𝐷 KL​ denotes the KL divergence. Unlike traditional LLMs that generate rollouts solely from 𝜋 𝜃 ( ⋅ ∣ 𝑥 ), Search‑R1 uses 𝜋 𝜃 ( ⋅ ∣ 𝑥 ; 𝑅 ) — integrating external retrieval 𝑅 into its reasoning. This interleaved approach enables more effective decision-making on complex tasks.</p><blockquote><strong>RL Algorithms: PPO vs. GRPO</strong></blockquote><p>Search‑R1 is compatible with different RL methods:</p><ul><li><strong>Proximal Policy Optimization (PPO):</strong> Provides conservative and stable policy updates using a critic-based approach.</li><li><strong>Group Relative Policy Optimization (GRPO):</strong> Often converges faster by leveraging group rewards without a separate value function, though it may sometimes be less stable.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mUO1Avoyooh7YJ6knl8-sQ.png" /></figure><p>This RL setup allows the model to learn the optimal balance between when to rely on its internal knowledge and when to trigger an external search, leading to more robust and contextually accurate answers.</p><h3><strong>Retrieved Token Masking for Stable Optimization</strong></h3><p>One challenge with integrating retrieval into LLM reasoning is the risk of the model over-relying on potentially noisy or irrelevant retrieved information. Search‑R1 tackles this with <strong>retrieved token masking</strong>:</p><ul><li><strong>How It Works:</strong> During RL training, the loss is computed only over tokens that the LLM generates on its own, while the tokens coming from external search results are “masked” so that they do not affect the gradient updates.</li><li><strong>The Benefit:</strong> This ensures that the retrieved information is used solely as supplementary context rather than being directly copied, thereby reducing the risk of propagating inaccuracies and stabilizing the training process.</li></ul><h3><strong>Experiments</strong></h3><p>The authors of Search‑R1 conducted extensive experiments on seven question-answering datasets, demonstrating that the framework consistently outperforms strong baseline models</p><ul><li><strong>Performance Improvements:</strong> Relative gains of 26% for Qwen2.5–7B, 21% for Qwen2.5–3B, and 10% for LLaMA3.2–3B were observed.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WErUfPYgEgvBR99JtgSoJg.png" /></figure><ul><li><strong>Generalization:</strong> Both base models and instruction-tuned variants benefit, although instruction-tuned models converge faster during training.</li><li><strong>Stability:</strong> The use of KL regularization and retrieved token masking ensures that the training remains stable even when the model is subjected to multi-turn retrieval tasks.</li></ul><p>These results highlight the framework’s potential to revolutionize how LLMs interact with external data, making them more dynamic, accurate, and context-aware.</p><h3>Conclusion</h3><p>Search‑R1 represents a major step forward in the evolution of large language models. By integrating multi‑turn retrieval, reinforcement learning optimization, and advanced techniques like retrieved token masking, it addresses the limitations of traditional, static LLMs. The model is now capable of self-regulated research — iteratively refining its reasoning with real‑time information — which can lead to more precise and factually reliable responses.</p><p>For those interested in a deep dive into the technical details, the full research paper on arXiv</p><p><a href="https://arxiv.org/pdf/2503.09516">https://arxiv.org/pdf/2503.09516</a></p><p>Have questions drop it below. Be sure to clap👏 and follow if you loved it.</p><p>Follow me on: <a href="https://x.com/therahultawar">X</a>, <a href="http://www.linkedin.com/in/rahultawar">Linkedin</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bcfcc2400351" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Recurrent Neural Networks Explained]]></title>
            <link>https://rahul-tawar.medium.com/recurrent-neural-networks-explained-b78db8c92810?source=rss-6ba4d2bdd3f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/b78db8c92810</guid>
            <category><![CDATA[generative-ai]]></category>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Rahul]]></dc:creator>
            <pubDate>Fri, 29 Nov 2024 18:16:03 GMT</pubDate>
            <atom:updated>2024-11-29T18:16:03.445Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*Y5RILEF1N4j9nkh7hqUwww.png" /></figure><p>So, what are RNNs? RNNs are deep learning models which process sequential data(data that has order like text-documents, time-series data etc) unlike simple feed forward neural network which learns patterns from the independent data.</p><h3>Why feed forward neural network sucks at processing Sequential Data?</h3><p>Simple answer, they aren’t built for it. Here’s why:</p><blockquote><strong>1. No memory, No context</strong></blockquote><p>These neural nets processes the input data independently in a single time stamp so they do not have any context of previous or future input data. But sequential data, like sentences or time-series, needs memory. Imagine trying to predict the next word in a sentence without knowing what came before. For example, you need to have the context of the first page while reading the second page of the book</p><blockquote><strong>2. They do not care about the order</strong></blockquote><p>In a sequence, <em>order matters</em>. Words like <em>“eat,”</em> <em>“cat,”</em> and <em>“fish”</em> make sense in a specific order. A feed forward network? It may end up like <em>“fish eat cat”</em> — and that’s not the story you’re trying to tell.</p><h3>What are RNNs?</h3><p>Recurrent Neural Nets have a built-in feedback loop that enables them to retain information from previous inputs. Second, RNNs process input data into multiple time steps. This makes them ideal for tasks requiring context, like language modeling, speech recognition, and sequence prediction.</p><p>Key innovation in RNNs is <strong>hidden state </strong>which is shared across all neurons inside the hidden layer for subsequent time steps, which acts as a memory of Neural networks. At each time step, the network takes the current input and the previous hidden state to compute the next hidden state and output. This recurrent behavior allows RNNs to model dependencies in data across time or position.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*ZIX9V9gIOzAPXahCk4uEag.png" /><figcaption>X is input vector, h is hidden state.</figcaption></figure><h3>How does RNN is trained</h3><blockquote><strong>Forward Propogation through time</strong></blockquote><p>RNNs process inputs sequentially:</p><ol><li>Each input is combined with the network’s hidden state.</li><li>The hidden state is updated at each time step, maintaining context.</li><li>Outputs are generated based on the current input and hidden state.</li></ol><p>Mathematically,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*aow61thCBgg2vCD_ZQyV8g.png" /><figcaption>So, U, W, h are learnable parameters</figcaption></figure><blockquote><strong>Back proping through time, BPTT</strong></blockquote><ol><li>Gradients are calculated for each time step.</li><li>Updates propagate backward, adjusting weights for all previous steps.</li></ol><p>Challenges:</p><ul><li><strong>Vanishing Gradient Problem</strong>: Gradients diminish over long sequences, hindering learning. (topic for another article)</li><li><strong>Exploding Gradients</strong>: Large gradients can destabilize training.</li></ul><h3>Implementation of basic RNN in tensorflow</h3><pre>import tensorflow as tf<br>from tensorflow.keras.models import Sequential<br>from tensorflow.keras.layers import SimpleRNN, Dense<br><br># Dataset Example <br>data = [[i+j for i in range(5)] for j in range(100)]<br># Data 5 X 100 matrix<br>&#39;&#39;&#39;[<br>  [0, 1, 2, 3, 4],   # j = 0<br>  [1, 2, 3, 4, 5],   # j = 1<br>  [2, 3, 4, 5, 6],   # j = 2<br>  ...<br>  [99, 100, 101, 102, 103]  # j = 99<br>]&#39;&#39;&#39;<br><br>X = [row[:-1] for row in data]<br>y = [row[-1] for row in data]<br><br>&#39;&#39;&#39;<br>  X                Y<br>[0, 1, 2, 3]    4   # j = 0<br>[1, 2, 3, 4]    5   # j = 1<br>[2, 3, 4, 5]    6   # j = 2<br>...<br>[99, 100, 101, 102]   103   # j = 99<br>&#39;&#39;&#39;<br><br><br># Model<br>model = Sequential([<br>    SimpleRNN(10, activation=&#39;relu&#39;, input_shape=(4, 1)),<br>    Dense(1)<br>])<br><br>model.compile(optimizer=&#39;adam&#39;, loss=&#39;mse&#39;)<br><br># Reshape and Train<br>import numpy as np<br>X, y = np.array(X).reshape(-1, 4, 1), np.array(y)<br>model.fit(X, y, epochs=20, batch_size=16)<br># epochs -&gt; one complete cycle of forward and backward prop<br># batch_size -&gt; the number of data points processes at one step</pre><p>So, this was it. We covered the essentials of Recurrent Neural Networks and how they laid the foundation for more advanced models like LSTMs and GRUs. In the next article, we will dive deeper into <strong>LSTM </strong>and <strong>GRU</strong> networks, examining how they work, their architecture, and their practical applications in the world of deep learning.</p><p>Have questions drop down below. Be sure to clap👏 and follow if you loved it.</p><p>Follow me on: <a href="https://x.com/therahultawar">X</a>, <a href="http://www.linkedin.com/in/rahultawar">Linkedin</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b78db8c92810" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting started with NGINX: A step-by-step guide]]></title>
            <link>https://rahul-tawar.medium.com/getting-started-with-nginx-a-step-by-step-guide-a0e1f9d53ecd?source=rss-6ba4d2bdd3f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/a0e1f9d53ecd</guid>
            <category><![CDATA[nginx]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[web-server]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Rahul]]></dc:creator>
            <pubDate>Sun, 17 Nov 2024 18:44:24 GMT</pubDate>
            <atom:updated>2024-11-17T18:44:24.743Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/860/0*Kn165q4QsDvRyS5a" /></figure><p>First of all, it’s “engine-x.” yeah, weird name! NGINX is the most powerful and efficient tool available for web development and system administration tasks. It functions as a HTTP/HTTPS web server, reverse proxying, load balancing and few more.</p><p>Let’s break down these key concepts and dive into the basics of NGINX, from installation to advanced configuration.</p><blockquote><strong>Key features of NGINX you should master</strong></blockquote><h3>1. Installation and Configuration</h3><p>Learning how to install NGINX on different operating systems, configure the basic setup, and customize it for your needs is the first step in mastering this tool. Understanding different installation methods, whether from repositories or from source code, will help you adapt to any environment​</p><h4>Installation on Linux machine</h4><p>To install NGINX on Ubuntu, you can use the following commands:</p><pre>sudo apt update<br>sudo apt install nginx</pre><p>Once installed, you can verify that NGINX is working by checking its status:</p><pre>sudo systemctl status nginx</pre><p>If you didn’t fuck it up, you should see a message like this.</p><pre>● nginx.service - A high performance web server and a reverse proxy server<br>   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)<br>   Active: active (running) since Sat 2024-11-17 09:00:00 UTC; 1h 15min ago<br>     Docs: man:nginx(8)<br>  Process: 12345 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)<br> Main PID: 12346 (nginx)<br>    Tasks: 3 (limit: 4627)<br>   Memory: 5.4M<br>   CGroup: /system.slice/nginx.service<br>           ├─12346 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;<br>           └─12347 nginx: worker process<br><br>Nov 17 09:00:00 hostname systemd[1]: Started A high performance web server and a reverse proxy server.</pre><h4>Starting and Stopping NGINX</h4><p>To start or stop the NGINX service, use:</p><pre>sudo systemctl start nginx<br>sudo systemctl stop nginx</pre><p>To restart NGINX (e.g., after updating its configuration):</p><pre>sudo systemctl restart nginx</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*DCMzedSBmBTFb9fq" /><figcaption>Quick tip: Be cautious while editing the NGINX config file</figcaption></figure><h3>2. Reverse Proxy Setup</h3><p>One of NGINX’s standout features is its ability to act as a reverse proxy. This means you can configure NGINX to forward requests to another server while handling incoming HTTP requests. This is especially useful when you have multiple microservices or backend applications running independently​</p><p>Here’s a simple example of a reverse proxy configuration:</p><ol><li>Open the NGINX configuration file:</li></ol><pre>sudo nano /etc/nginx/sites-available/default</pre><ol><li>Edit the file to forward traffic to your backend server (e.g., Node.js server):</li></ol><pre>server {<br>    listen 80; # 443 for https protocol<br>    server_name yourdomain.com;  <br>    location / {<br>        proxy_pass http://127.0.0.1:3000;  # Backend server<br>        proxy_set_header Host $host;<br>        proxy_set_header X-Real-IP $remote_addr;<br>        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>        proxy_set_header X-Forwarded-Proto $scheme;<br>    }<br>}</pre><ol><li>Save and exit the file, then test your configuration:</li></ol><pre>sudo nginx -t</pre><ol><li>If the test is succesful, reload NGINX:</li></ol><pre>sudo systemctl reload nginx</pre><h3>3. SSL/TLS Encryption</h3><p>Security is important, and NGINX helps you secure your websites with SSL/TLS certificates. Understanding how to integrate Let’s Encrypt for automatic certificate renewal and configuring NGINX for secure HTTPS communication is essential for modern web applications​</p><p>Here’s how to enable SSL with Let’s Encrypt using Certbot:</p><ol><li>Install Certbot:</li></ol><pre>sudo apt install certbot python3-certbot-nginx</pre><ol><li>Obtain and install the SSL certificate:</li></ol><pre>sudo certbot --nginx -d yourdomain.com</pre><p>Certbot will automatically configure your NGINX server to use HTTPS.</p><h3>4. Load Balancing</h3><p>NGINX can distribute incoming traffic across multiple backend servers to ensure no single server is overwhelmed. Mastering the art of setting up load balancing in NGINX will help you build scalable systems that are resilient and performant​</p><p>Here’s an example configuration for load balancing:</p><pre>http {<br>    upstream backend {<br>        server backend1.example.com;<br>        server backend2.example.com;<br>        server backend3.example.com;<br>    }</pre><pre>    server {<br>        location / {<br>            proxy_pass http://backend;<br>        }<br>    }<br>}</pre><p>NGINX will distribute incoming traffic across the three backend servers defined in the upstream block.</p><h3>5. Caching for</h3><p>NGINX’s caching capabilities allow you to serve static content efficiently and reduce load on backend systems. Configuring caching can significantly speed up the delivery of assets like images, CSS, and JavaScript files​</p><p>Here’s a basic caching setup:</p><pre>server {<br>    location /images/ {<br>        root /var/www/html;<br>        expires 30d;<br>        add_header Cache-Control &quot;public&quot;;<br>    }<br>}</pre><p>This configuration tells NGINX to cache images for 30 days.</p><h3><strong>Conclusion: Mastering NGINX for Performance and Scalability</strong></h3><p>By mastering the installation, configuration, reverse proxying, SSL/TLS encryption, load balancing, and caching features of NGINX, you can create efficient, secure, and scalable web applications. Whether you are just starting out or looking to optimize your NGINX setup, these techniques will help you leverage the full power of NGINX.</p><p>For additional tutorials and advanced configurations, explore topics like <strong>NGINX performance tuning</strong> and <strong>microservice architecture with NGINX</strong>. With these skills, you’ll be well on your way to building fast, reliable, and secure web applications.</p><p>That’s it now you’re ready to flex on your programmer friend.</p><p>Have questions drop down below. Be sure to clap👏 and follow if you loved it</p><p>Follow me on: <a href="https://x.com/therahultawar">X</a>, <a href="http://www.linkedin.com/in/rahultawar">Linkedin</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a0e1f9d53ecd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React 19 Coming Soon!]]></title>
            <link>https://rahul-tawar.medium.com/react-19-coming-soon-23c63bc9700c?source=rss-6ba4d2bdd3f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/23c63bc9700c</guid>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Rahul]]></dc:creator>
            <pubDate>Sat, 25 May 2024 08:14:26 GMT</pubDate>
            <atom:updated>2024-05-25T08:18:26.806Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/860/0*-G81EVWfR882YLEF" /></figure><p>ReactJS, a popular library for building user interfaces (remember it’s not a framework) for building single page applications(SPAs), has been a blockbuster since its release almost 11 years ago.</p><p>Before Jumping into the React19</p><blockquote><strong><em>A Quick Backstory.</em></strong></blockquote><p>The landscape of web development is dynamic. Many tools, libraries, and languages come and go without even being noticed. But few of them thrive, ReactJS is one of them.</p><p>React offers Virtual DOM, Component-based architecture, Unidirectional data flow, and JSX syntax that took everyone by storm back then. Thus, quickly gained an ecosystem of millions.</p><h3>Let’s Understand these!</h3><p><strong>Virtual DOM.</strong></p><p>Virtual DOM is a lightweight, in-memory representation of the Document Object Model(DOM). When we interact with a site, consider YouTube, when we subscribe to the channel of a creator or interact with it in any manner the DOM needs to update. Here the problem is that the browser takes centuries to update the DOM. In React, changes are first applied to Virtual DOM and under the hood, React plays with the browser DOM making the updation process efficient and quicker.</p><p>2. <strong>Component-based architecture.</strong></p><p>Components are the foundation of building UI, combining them the front-end of an application is built. Components are reusable, you haven’t possibly seen the layouts of YouTube videos thumbnails are dissimilar to each other, until and unless your browser sucks at rendering it. Components have a declarative syntax.</p><pre>import React from &#39;react&#39;;<br><br>const Article = (props) =&gt; {<br>  return (<br>    &lt;div className=&quot;article&quot;&gt;<br>      &lt;h2&gt;{props.title}&lt;/h2&gt;<br>      &lt;p&gt;{props.content}&lt;/p&gt;<br>      &lt;p&gt;Published on: {props.date}&lt;/p&gt;<br>    &lt;/div&gt;<br>  );<br>}<br><br>export default Article;</pre><p>3. <strong>Unidirectional flow.</strong></p><p>React ensures the unidirectional flow of data by passing down the data from the parent component to the child component. This guarantees efficient state management of the application and multiple re-renders.</p><p>4. <strong>JSX.</strong></p><p>JSX is simply an extension of JavaScript that allows you to write HTML-like markup within a JS file.</p><pre>const Greeting = () =&gt; {<br>  const name = &#39;John&#39;;<br><br>  return (<br>    &lt;div&gt;<br>      &lt;h1&gt;Hello, {name}!&lt;/h1&gt;<br>      &lt;p&gt;Welcome to my website.&lt;/p&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><p>So, this was React in 30 seconds.</p><p>Enough for the backstory. Back to React 19.</p><blockquote><strong>React 19.</strong></blockquote><p>While the previous version of React was themed on concurrent mode for performance optimization, React 19 is focused on streamlining workflows and Developer Experience, DX.</p><h4><em>What’s new?</em></h4><blockquote><strong><em>Actions</em></strong></blockquote><p>Actions are the brand new feature coming out from React. The action feature simplifies asynchronous data handling operations and state updates. React does the heavy lifting, behind the scenes for the tasks involved in these operations.</p><p>Actions involve:</p><p><strong>Automatic Data Submission Management:</strong> When you define an Action (typically an async function), React takes care of submitting the data and updating the state accordingly. This eliminates the need for manual handling of data submission logic.</p><p><strong>Optimistic Updates (with useOptimistic Hook):</strong> Actions work with the new useOptimistic hook to allow optimistic updates. This means you can update the UI to reflect the expected outcome (e.g., showing a success message) even before the request finishes, providing a smoother user experience.</p><p><strong>Form Handling (with useFormStatus Hook):</strong> There’s a dedicated useFormStatus hook that simplifies handling form submissions using Actions. It provides functionalities similar to the general Action features but specifically tailored for forms.</p><p>Let’s consider before and after code snippets:</p><p>Before Actions</p><pre>function UpdatePasswordForm() {<br>  const [currentPassword, setCurrentPassword] = useState(&#39;&#39;);<br>  const [newPassword, setNewPassword] = useState(&#39;&#39;);<br>  const [confirmPassword, setConfirmPassword] = useState(&#39;&#39;);<br>  const [error, setError] = useState(null);<br>  const [success, setSuccess] = useState(false);<br><br>  const handleSubmit = async (event) =&gt; {<br>    event.preventDefault();<br>    setError(null);<br>    setSuccess(false);<br><br>    if (newPassword !== confirmPassword) {<br>      setError(&#39;Passwords do not match&#39;);<br>      return;<br>    }<br><br>    try {<br>      // Make API call to update password<br>      const response = await fetch(&#39;/api/update-password&#39;, {<br>        method: &#39;POST&#39;,<br>        body: JSON.stringify({ currentPassword, newPassword }),<br>      });<br><br>      if (!response.ok) {<br>        throw new Error(&#39;Failed to update password&#39;);<br>      }<br><br>      setSuccess(true);<br>      setCurrentPassword(&#39;&#39;);<br>      setNewPassword(&#39;&#39;);<br>      setConfirmPassword(&#39;&#39;);<br>    } catch (error) {<br>      setError(error.message);<br>    }<br>  };<br>}</pre><p>After Actions,</p><pre>function UpdatePasswordForm() {<br>  const [currentPassword, setCurrentPassword] = useState(&#39;&#39;);<br>  const [newPassword, setNewPassword] = useState(&#39;&#39;);<br>  const [confirmPassword, setConfirmPassword] = useState(&#39;&#39;);<br>  const [dispatch] = useReducer(reducer, initialState);<br><br>  const updatePasswordAction = useAction(async (currentPassword, newPassword) =&gt; {<br>    if (newPassword !== confirmPassword) {<br>      throw new Error(&#39;Passwords do not match&#39;);<br>    }<br><br>    // Make API call to update password<br>    const response = await fetch(&#39;/api/update-password&#39;, {<br>      method: &#39;POST&#39;,<br>      body: JSON.stringify({ currentPassword, newPassword }),<br>    });<br><br>    if (!response.ok) {<br>      throw new Error(&#39;Failed to update password&#39;);<br>    }<br><br>    dispatch({ type: &#39;UPDATE_PASSWORD_SUCCESS&#39; });<br>  });<br><br>const initialState = {<br>  error: null,<br>};<br><br>const reducer = (state, action) =&gt; {<br>  switch (action.type) {<br>    case &#39;UPDATE_PASSWORD_REQUEST&#39;:<br>      return { ...state }; // Can be used to show loading indicator</pre><blockquote><strong>The new hook, useOptimistic</strong></blockquote><p>Still in the labs, This hook allows you to implement optimistic updates in your applications. Optimistic updates are actions that change the state of UI even before the server confirmation.</p><p>Let’s say you are liking your crush’s Instagram post, UI instantly changes but back in the door, the Server is yet to confirm it and increase the like count of your crush’s post!</p><pre>function UpdateLikeCount({currentLikes, onUpdateLikes}) {<br>  const [likeCount, setLikeCount] = useOptimistic(0);<br><br>  const likeButtonClickAction = async formData =&gt; {<br>    setLikeCount(likeCount+=1); <br>};<br></pre><p>That was just the simple explanation, Don’t judge my coding skills</p><blockquote><strong>The use API</strong></blockquote><p>Not a hook, it’s an API. It’s designed to provide more concise way to access resources like context or promise. The use API simplifies the process of accessing the asynchronous data or context values.</p><pre>const userProfilePromise = fetch(`/api/users/${userId}`);<br><br>function UserProfile() {<br>  const user = use(userProfilePromise);<br><br>  return (<br>    &lt;div&gt;<br>      {user ? (<br>        &lt;&gt;<br>          &lt;h1&gt;{user.name}&lt;/h1&gt;<br>          &lt;img src={user.profilePictureUrl} alt=&quot;Profile Picture&quot; /&gt;<br>        &lt;/&gt;<br>      ) : (<br>        &lt;p&gt;Loading profile...&lt;/p&gt;<br>      )}<br>    &lt;/div&gt;<br>  );<br>}</pre><p>I have to admit that ChatGPT writes very good code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/0*s6mdwSPf4oisS-oY.gif" /></figure><blockquote><strong>Finally the Spotlight, React is developing its compiler!</strong></blockquote><p>React compiler is experimental and the meta team has open-sourced it to the limited community.</p><p>React complier automatically optimizes the react apps during the build process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/333/0*dGHhE3JJbwcO3T_5" /><figcaption>React developers who uses useCallback and useMemo</figcaption></figure><p>Let’s understand the How.</p><p>A. Analyzes your React code and understands the “Rules of React.”</p><p>B. Applies optimizations like:</p><p>i. Memoization: Reduces redundant re-renders by caching component outputs.</p><p>ii. Dead code elimination: Removes unused code from the final bundle.</p><p>C. Integrates with ESLint to provide feedback about potential optimization opportunities in your code.</p><p>Disclaimer: The hooks and APIs haven’t had a stable release yet.</p><p>Dear Beginners, SORRY for any inconvenience caused🙄.</p><p>Be sure to clap👏 and follow if you loved it</p><p>Follow me on: <a href="https://x.com/therahultawar">X</a>, <a href="http://www.linkedin.com/in/rahultawar">Linkedin</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=23c63bc9700c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Google’s F*#king Tech Reveal.]]></title>
            <link>https://rahul-tawar.medium.com/googles-f-king-tech-reveal-f92435a7e1f2?source=rss-6ba4d2bdd3f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/f92435a7e1f2</guid>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Rahul]]></dc:creator>
            <pubDate>Wed, 15 May 2024 12:38:06 GMT</pubDate>
            <atom:updated>2024-05-15T14:30:22.643Z</atom:updated>
            <content:encoded><![CDATA[<h3>Google’s F*#king Tech Reveal</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7CY6XDcBhXreqYZx69RSGA.png" /></figure><p>As AI Sprint is catching fire, hours after OpenAI’s GPT-4o model release, Google showed what’s in their bank. Here are the things you need to know for tech dorks!</p><blockquote><strong><em>AI democratization for developers!</em></strong></blockquote><p>Democratizing AI was at the core of the GoogleIO 2024 event, making AI available for every developer from a senior level to a folk, just wrote his first “hello, world!” program.</p><p><strong>1. Firebase Genkit.</strong></p><p>A new or possibly the first Generative AI framework as of my memory, allowing NodeJS to build a backend for AI features in their app.</p><p><strong>2. AI and ML stuff.</strong></p><p>Google is making AI and machine learning more accessible to developers, with breakthroughs like the 2 million context window in 1.5 Pro and the ability to join the Google AI Studio waitlist This will avail the developers with multi-model foundational models with up to 2 million context windows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*_Ub1_p1A01Ug62Hy" /></figure><blockquote><strong><em>Google’s quest for creative AI</em></strong></blockquote><ol><li><strong>Veo</strong></li></ol><p>A new generative video model, can create 1080p video based on text, image, and video-based prompts. This tool can be used in a tool called VideoFX, giving video editors and creators a new way of making videos.</p><p><strong>2. Imagen 3</strong></p><p>A generative AI model, can output high-quality images based on text prompts. This technology has the potential to revolutionize the way content creators work, allowing them to generate high-quality visuals quickly and efficiently.</p><p><strong>3. Music AI Sandbox</strong></p><p>YouTube tool that helps creators make more music by mixing different styles and creating something original. Creators can request specific patterns to be provided for them, in a specific way, as a tool to help them create music.</p><p><strong>4. AI Overviews</strong></p><p>No more googling on Google, based on the Gemini model, Google AI Overview is a feature that provides a summary of the main points and key information related to a search query. It uses artificial intelligence (AI) to analyze the search results and generate a concise overview of the topic. This feature aims to help users quickly understand the main ideas and concepts related to their search query, making it easier to find the information they need.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/0*Xw-fh3H0mAK-KfiR" /></figure><p>But why I’m sensing this just a copy of Brave, Answer with AI feature, the same UI, the same concept?</p><p><strong>5. Integration of the Gemini model into the Google Workspace,</strong></p><p>Those giant stacks of unread mails fear us all, with the Gemini model it’s all easy. Gemini will point out the urgent mails, summarize them, and write a response with just a few clicks. Gemini is all also integrated with another workplace like notebooks.</p><blockquote><strong><em>And finally THE PROJECT ASTRA.</em></strong></blockquote><ol><li>This Project Astra is a new AI agent. It’s designed to be a multimodal assistant, meaning it can answer user queries through various inputs like text, audio, or even video.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*r213Vvq5OSztO9ez" /></figure><p>Here’s what this Project Astra from Google can do:</p><ul><li>Respond to user queries in real time through text, audio, or video.</li><li>Identify objects within a user’s field of view (through video input).</li><li>Explain code functionalities.</li><li>Assist with creative tasks like generating names or alliterations.</li><li>Integrate with the Gemini app through the Gemini Live interface.</li></ul><p>Watch the demo <a href="https://www.youtube.com/watch?v=nXVvvRhiGjI">https://www.youtube.com/watch?v=nXVvvRhiGjI</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/0*GL6N_29BFg4NQly3" /></figure><p>This is definitely going to be GPT-4o vs Astra. But for me Samantha is growing up 🥰 from the movie <a href="https://en.wikipedia.org/wiki/Her_(film)"><em>her</em></a><em>, </em>give it watch definitely a good movie for a lone like you 🤝.</p><p>But overall these models are just wow. Makes one rethink that are we heading toward AGI much faster than the experts say in those clickbait podcasts. Or it’s already been developed who knows?</p><p>Finally, these advancements are wonderful, Because, you know, who doesn’t love the idea of machines taking over our jobs and possibly our entire existence?🤣 So, cheers to the future, where the only certainty is uncertainty,</p><pre>if(Liked blog?){<br>  alert(&#39;Share it and follow me!&#39;)<br>} else {<br>  console.log(&#39;We are enemies now&#39;)<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f92435a7e1f2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>