<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Rounit Ranjan Sinha</title>
    <description>The latest articles on Forem by Rounit Ranjan Sinha (@rounit08).</description>
    <link>https://forem.com/rounit08</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F670203%2Fec456f36-26d3-4d8e-8fa1-10309f526bc4.jpg</url>
      <title>Forem: Rounit Ranjan Sinha</title>
      <link>https://forem.com/rounit08</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/rounit08"/>
    <language>en</language>
    <item>
      <title>Web Performance Optimization Techniques</title>
      <dc:creator>Rounit Ranjan Sinha</dc:creator>
      <pubDate>Tue, 09 Apr 2024 06:42:36 +0000</pubDate>
      <link>https://forem.com/rounit08/web-performance-optimization-techniques-1n9h</link>
      <guid>https://forem.com/rounit08/web-performance-optimization-techniques-1n9h</guid>
      <description>&lt;p&gt;If Web Performance is Thanos, then LCP, FID &amp;amp; CLS are the infinity stones.&lt;/p&gt;

&lt;p&gt;So, in the multiverse of web development every web developer must be aware about the web performance techniques, so that the website developed by them must give seamless user experience.&lt;/p&gt;

&lt;p&gt;Let's understand these abbrev in deep.&lt;/p&gt;

&lt;p&gt;=&amp;gt; LCP - Largest Contentful Paint: (this is related to loading of the website)&lt;br&gt;
When a website loads it fetch a bunch of assets from the server like the CSS, HTML, JS, media etc., then it paints on your browser, so you are now able to see the stuffs. By minimizing this largest paint we can achieve a faster load.&lt;/p&gt;

&lt;p&gt;Good &amp;lt; 2.5 sec &amp;lt; needs improvement &amp;lt; 4 sec &amp;lt; Poor&lt;br&gt;
&amp;amp; BAD LCP == BAD SEO&lt;/p&gt;

&lt;p&gt;How to find it and fix it?&lt;br&gt;
When you go to the networks tab in inspect element window and examine the network waterfall.&lt;/p&gt;

&lt;p&gt;To fix this:&lt;br&gt;
1) Reduce resource load time: Compressing the images, use bare minimum types of fonts.&lt;br&gt;
2) Use a CDN(content delivery network): Serve the assets from the CDN&lt;br&gt;
3) Blocking JS: Suppose you have to run some JS before showing and image, you should avoid this. &lt;strong&gt;this is why Server side frameworks like Next.js have taken favour over SPAs like React. As a SPA, React has to run some JS before running the original content on initial rendering&lt;/strong&gt;*.&lt;br&gt;
4)Preload time: You can give priority to some stuffs to be discovered first,&lt;br&gt;
"&lt;br&gt;
also we can set fetching priority to images like&lt;br&gt;
"&lt;a href="/logo.png" class="article-body-image-wrapper"&gt;&lt;img src="/logo.png" alt="logo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;=&amp;gt;FID - First Input Delay (this is related to the interactivity)&lt;br&gt;
This is the time between a user interacts with the page and gets the result.&lt;/p&gt;

&lt;p&gt;Suppose there is a button on the website, and when the user clicks that button (let's say clicked at 12:00 AM), and when the result comes (suppose the result arrives at 12:01 AM), the time between these events (in this example, 1 second) will be the First Input Delay (FID).&lt;/p&gt;

&lt;p&gt;(bhai like the temporal dead zone while declaring variables using let and const, ifykyk)&lt;/p&gt;

&lt;p&gt;Good &amp;lt; 100ms &amp;lt; needs improvement &amp;lt; 300ms &amp;lt; Poor&lt;/p&gt;

&lt;p&gt;The only way to optimize this is by reducing the JS execution, one can use web workers for this or to lazy load.&lt;/p&gt;

&lt;p&gt;=&amp;gt;CLS - Content Layout Shift (this is related to the visual stability)&lt;br&gt;
It indicates how much the elements on a page move around during the loading process.&lt;/p&gt;

&lt;p&gt;imagine you're reading a recipe online. As you're about to click on the ingredients list, suddenly an image loads above it, pushing the ingredients down the page. This sudden movement can be frustrating because just when you're about to use the ingredients, they move out of reach.&lt;/p&gt;

&lt;p&gt;Good &amp;lt; 0.1 &amp;lt; needs improvement &amp;lt; 0.25 &amp;lt; Poor&lt;/p&gt;

&lt;p&gt;To improve this the image must have it's fixed width and height or you may use css' aspect ratio property.&lt;/p&gt;

&lt;p&gt;"Egdm makkhan website banane ka"&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Full vs Complete BiNARY TREEs</title>
      <dc:creator>Rounit Ranjan Sinha</dc:creator>
      <pubDate>Sat, 20 Jan 2024 02:12:25 +0000</pubDate>
      <link>https://forem.com/rounit08/full-vs-complete-binary-trees-ka5</link>
      <guid>https://forem.com/rounit08/full-vs-complete-binary-trees-ka5</guid>
      <description>&lt;p&gt;To understand this concept about &lt;strong&gt;Binary tree&lt;/strong&gt; we have to learn about &lt;em&gt;Binary tree representation in Array&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;When the &lt;em&gt;node is at index i&lt;/em&gt;, then the &lt;em&gt;left child is at index 2*i _and _right child will be positioned at index i*2+1&lt;/em&gt; and &lt;em&gt;it's parent must be at i/2&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;After the binary tree representation as an array we can say&lt;/p&gt;

&lt;p&gt;=&amp;gt;&lt;br&gt;
&lt;strong&gt;Full Binary tree&lt;/strong&gt;: If the binary tree is full with all the max nodes it can take corresponding to the height and adding another node to the binary tree will increase the height then it's known as Full BT&lt;/p&gt;

&lt;p&gt;How to check max nodes according to the height?&lt;br&gt;
Ans = Using formula_** 2^(h+1) - 1**_, where h is the height of BT&lt;/p&gt;

&lt;p&gt;=&amp;gt;&lt;br&gt;
&lt;strong&gt;Complete Binary tree:&lt;/strong&gt; When the binary tree is represented in the form of an Array, and up to the length of the array if all the elements are present then it's complete Binary tree else it's not&lt;/p&gt;

&lt;p&gt;Some real life examples to use BT&lt;br&gt;
=&amp;gt;&lt;br&gt;
&lt;strong&gt;Navigation Trees:&lt;/strong&gt;&lt;br&gt;
In website development, hierarchical navigation menus are common. Each menu item can have zero or more sub-items, forming a tree structure. This structure is useful for organizing and displaying a website's navigation hierarchy.&lt;br&gt;
Home&lt;br&gt;
|-- About&lt;br&gt;
| |-- Team&lt;br&gt;
| |-- History&lt;br&gt;
|-- Products&lt;br&gt;
| |-- Product A&lt;br&gt;
| |-- Product B&lt;br&gt;
|-- Contact&lt;/p&gt;

&lt;p&gt;=&amp;gt;&lt;br&gt;
&lt;strong&gt;Comment Threads:&lt;/strong&gt;&lt;br&gt;
For comment systems on blogs or forums, replies to comments often form a tree structure. Each comment can have multiple replies, creating a threaded discussion.&lt;/p&gt;

&lt;p&gt;Comment 1&lt;br&gt;
|-- Reply 1.1&lt;br&gt;
|-- Reply 1.2&lt;br&gt;
| |-- Reply 1.2.1&lt;br&gt;
Comment 2&lt;br&gt;
|-- Reply 2.1&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F11ob5olxlxsvxsge8qxr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F11ob5olxlxsvxsge8qxr.png" alt="Image description" width="800" height="557"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>datastructures</category>
      <category>javascript</category>
      <category>programming</category>
    </item>
    <item>
      <title>Implement Dynamic Programming in a cake shop (with code)</title>
      <dc:creator>Rounit Ranjan Sinha</dc:creator>
      <pubDate>Tue, 16 Jan 2024 15:11:25 +0000</pubDate>
      <link>https://forem.com/rounit08/implement-dynamic-programming-in-a-cake-shop-with-code-50la</link>
      <guid>https://forem.com/rounit08/implement-dynamic-programming-in-a-cake-shop-with-code-50la</guid>
      <description>&lt;p&gt;Suppose you own a cake shop and decided to redecide your menu because you want to maximize your profit by selecting the most valuable cakes to include in your menu.&lt;br&gt;
Each cake has a weight ( chota cake, mota cake) and a value (paisaaa).&lt;br&gt;
The goal is to determine the maximum total value you can obtain with a given maximum weight capacity for your menu.&lt;/p&gt;

&lt;p&gt;Code explanation&lt;br&gt;
1) Initialize the Table (menu banane ke lie page toh laoge na)&lt;/p&gt;

&lt;p&gt;const dp = Array(cakes.length + 1).fill(null).map(() =&amp;gt; Array(capacity + 1).fill(0));&lt;/p&gt;

&lt;p&gt;This line initializes a 2D array (dp) to store solutions to subproblems. The array has rows for each cake and columns for different weight capacities.&lt;/p&gt;

&lt;p&gt;2) Dynamic Programming Iteration:&lt;br&gt;
for (let i = 1; i &amp;lt;= cakes.length; i++) { const currentCake = cakes[i - 1]; for (let w = 0; w &amp;lt;= capacity; w++) {&lt;br&gt;
The outer loop (i) goes through each cake, and the inner loop (w) goes through each possible weight capacity.&lt;/p&gt;

&lt;p&gt;3)Decision Making:&lt;br&gt;
if (currentCake.weight &amp;gt; w) { // If the current cake is too heavy for the remaining capacity, skip it&lt;br&gt;
dp[i][w] = dp[i - 1][w]; } else { // Max value between including and excluding the current cake&lt;br&gt;
dp[i][w] = Math.max(dp[i - 1][w], dp[i - 1][w - currentCake.weight] + currentCake.value); }&lt;br&gt;
Here, the code decides whether to include the current cake or not. If the cake is too heavy for the remaining capacity, it skips it. Otherwise, it calculates the maximum value between including the current cake and excluding it.&lt;/p&gt;

&lt;p&gt;4) Result Extraction: (bas ab menu print kr do)&lt;/p&gt;

&lt;p&gt;return dp[cakes.length][capacity];&lt;/p&gt;

&lt;p&gt;The final result is stored in the bottom-right cell of the dp table, representing the maximum profit considering all cakes and the given capacity.&lt;/p&gt;

&lt;p&gt;Example Usage:&lt;br&gt;
const cakes = [ { weight: 2, value: 15 }, { weight: 3, value: 20 }, { weight: 1, value: 10 }, ]; const capacity = 5; const maxProfit = maxCakeValue(cakes, capacity); console.log("Maximum profit:", maxProfit);&lt;/p&gt;

&lt;p&gt;Real-world Explanation:&lt;br&gt;
The maxCakeValue function helps you decide which cakes to include in your menu to maximize your profit, given the limited space (capacity) available on your menu display. The example usage with the cakes array and capacity variable shows how you can apply this function to find the maximum profit for your specific cakes and menu capacity.&lt;/p&gt;

&lt;p&gt;Developer Rounit ❌&lt;br&gt;
Baker Rounit ✅&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kySDP6wl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u4ti2zz16txtmubh383m.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kySDP6wl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u4ti2zz16txtmubh383m.jpg" alt="Image description" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>datastructures</category>
      <category>javascript</category>
      <category>programming</category>
    </item>
    <item>
      <title>Git vs GitHub(cake version)</title>
      <dc:creator>Rounit Ranjan Sinha</dc:creator>
      <pubDate>Sun, 14 Jan 2024 06:31:40 +0000</pubDate>
      <link>https://forem.com/rounit08/git-vs-githubcake-version-3hh0</link>
      <guid>https://forem.com/rounit08/git-vs-githubcake-version-3hh0</guid>
      <description>&lt;p&gt;While talking about Git and GitHub, generally people gets confused in these two and assume these two same, but what we have to do LOL&lt;br&gt;
hum toh chalo cake khane !&lt;/p&gt;

&lt;p&gt;𝐂𝐚𝐤𝐞 𝐒𝐡𝐨𝐩 𝐚𝐬 𝐚 𝐏𝐫𝐨𝐣𝐞𝐜𝐭:&lt;/p&gt;

&lt;p&gt;Rounit's Bakery (Project): The cake shop is a project, and the cakes you bake are the different versions or stages of the project.&lt;/p&gt;

&lt;p&gt;𝐆𝐢𝐭 as a 𝐑𝐞𝐜𝐢𝐩𝐞 𝐁𝐨𝐨𝐤:&lt;/p&gt;

&lt;p&gt;Recipe Book (Git): The recipe book is like Git. It keeps track of all the recipes (code) and any changes made to them over time. Each chef (developer) can have their own copy of the recipe book.&lt;/p&gt;

&lt;p&gt;𝐆𝐢𝐭𝐇𝐮𝐛 as a 𝐂𝐞𝐧𝐭𝐫𝐚𝐥𝐢𝐳𝐞𝐝 𝐁𝐚𝐤𝐞𝐫𝐲:&lt;/p&gt;

&lt;p&gt;Bakery Headquarters (GitHub): The bakery headquarters is like GitHub. It's a central place where all the recipe books (Git repositories) are stored. Chefs (developers) can share their recipes, collaborate on new cakes, and review each other's work.&lt;/p&gt;

&lt;p&gt;𝐁𝐫𝐚𝐧𝐜𝐡𝐞𝐬 as  𝐃𝐢𝐟𝐟𝐞𝐫𝐞𝐧𝐭 𝐂𝐚𝐤𝐞 𝐅𝐥𝐚𝐯𝐨𝐫𝐬:&lt;/p&gt;

&lt;p&gt;Cake Flavors (Branches): Imagine you have different branches for different cake flavors. Each branch represents a different development path or feature. For example, there's a "Chocolate" branch and a "Vanilla" branch.&lt;/p&gt;

&lt;p&gt;𝐂𝐨𝐦𝐦𝐢𝐭𝐬 a 𝐂𝐚𝐤𝐞 𝐑𝐞𝐜𝐢𝐩𝐞𝐬:&lt;/p&gt;

&lt;p&gt;Cake Recipe (Commit):&lt;/p&gt;

&lt;p&gt;Each commit is like a specific recipe in the recipe book. It represents a snapshot of the cake at a particular point in time. Chefs (developers) can add new recipes (commits) to the book as they make changes to the cake.&lt;/p&gt;

&lt;p&gt;𝐏𝐮𝐥𝐥 𝐑𝐞𝐪𝐮𝐞𝐬𝐭𝐬 as  𝐂𝐚𝐤𝐞 𝐑𝐞𝐯𝐢𝐞𝐰𝐬&lt;br&gt;
Cake Review (Pull Request): When a chef (developer) finishes baking a new cake layer or toppings (feature), they can submit it for review. This is like creating a pull request. Other chefs can review the cake, suggest changes, and decide whether to merge the new flavor into the main collection.&lt;/p&gt;

&lt;p&gt;Cake khate raho, seekhte raho!&lt;/p&gt;

&lt;p&gt;Follow #rounitsinha&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>github</category>
    </item>
    <item>
      <title>𝐖𝐡𝐚𝐭 𝐢𝐬 𝐰𝐰𝐰? 𝐖𝐡𝐚𝐭 𝐢𝐬 𝐰𝐰𝐰𝟐 &amp; 𝐰𝐰𝐰𝟑? 𝐈𝐧𝐭𝐞𝐫𝐧𝐞𝐭, 𝐖𝐖𝐖, 𝐁𝐫𝐨𝐰𝐬𝐞𝐫</title>
      <dc:creator>Rounit Ranjan Sinha</dc:creator>
      <pubDate>Sat, 13 Jan 2024 05:38:25 +0000</pubDate>
      <link>https://forem.com/rounit08/--443j</link>
      <guid>https://forem.com/rounit08/--443j</guid>
      <description>&lt;p&gt;=&amp;gt;𝐈𝐧𝐭𝐞𝐫𝐧𝐞𝐭:&lt;/p&gt;

&lt;p&gt;𝐀𝐧𝐚𝐥𝐨𝐠𝐲: The entire marketplace where different shops, including the cake shop, exist.&lt;/p&gt;

&lt;p&gt;𝐄𝐱𝐩𝐥𝐚𝐧𝐚𝐭𝐢𝐨𝐧: In the context of the Internet, think of it as the global network connecting computers, servers, and devices worldwide. It's the infrastructure that enables communication and data exchange between various entities.&lt;/p&gt;

&lt;p&gt;=&amp;gt;𝐖𝐨𝐫𝐥𝐝 𝐖𝐢𝐝𝐞 𝐖𝐞𝐛 (𝐖𝐖𝐖):&lt;/p&gt;

&lt;p&gt;𝐀𝐧𝐚𝐥𝐨𝐠𝐲: The cake shop within the marketplace.&lt;/p&gt;

&lt;p&gt;𝐄𝐱𝐩𝐥𝐚𝐧𝐚𝐭𝐢𝐨𝐧: The World Wide Web is a specific service on the Internet. It's like a collection of interconnected documents and multimedia content (cakes and products) that can be accessed through web browsers. Each website has its own unique address (URL), similar to how the cake shop has its specific location in the marketplace.&lt;/p&gt;

&lt;p&gt;=&amp;gt;𝐖𝐞𝐛 𝐁𝐫𝐨𝐰𝐬𝐞𝐫:&lt;/p&gt;

&lt;p&gt;𝐀𝐧𝐚𝐥𝐨𝐠𝐲: The pathway or route customers take to navigate through the marketplace and reach the cake shop.&lt;/p&gt;

&lt;p&gt;𝐄𝐱𝐩𝐥𝐚𝐧𝐚𝐭𝐢𝐨𝐧: A web browser (e.g., Chrome, Firefox, Safari) is the software tool that allows users to access and explore the content available on the World Wide Web. It acts as the means by which users navigate the Internet and visit specific websites.&lt;/p&gt;

&lt;p&gt;Recently, I visited the HnM website(for window shopping, paise nhi h, refer kr do for job 😉 ) and got to see their URL has www2, I was like what?how?why? then I read about that and got to know&lt;/p&gt;

&lt;p&gt;The terms "www2" and "www3" are sometimes used in URLs to identify specific web servers within a larger domain. However, this usage is not standardized, and its meaning can vary depending on the organization or website owner.&lt;/p&gt;

&lt;p&gt;Here are a couple of possible explanations for the use of "www2" and "www3":&lt;/p&gt;

&lt;p&gt;𝗟𝗼𝗮𝗱 𝗕𝗮𝗹𝗮𝗻𝗰𝗶𝗻𝗴:&lt;/p&gt;

&lt;p&gt;In some cases, websites use multiple servers to distribute the load and improve performance. The "www2" or "www3" subdomains might be used to direct traffic to different servers for load balancing purposes.&lt;/p&gt;

&lt;p&gt;𝐒𝐮𝐛𝐝𝐨𝐦𝐚𝐢𝐧𝐬 𝐟𝐨𝐫 𝐒𝐩𝐞𝐜𝐢𝐟𝐢𝐜 𝐒𝐞𝐫𝐯𝐢𝐜𝐞𝐬:&lt;/p&gt;

&lt;p&gt;Large organizations or websites with various services may use different subdomains to host specific services. For example, "www" could be the main website, while "www2" and "www3" might host additional services or content.&lt;/p&gt;

&lt;p&gt;Like this is their www website :&lt;/p&gt;

&lt;p&gt;www .hm. com/ entrance. ahtml&lt;/p&gt;

&lt;p&gt;This is their Asian websites:&lt;/p&gt;

&lt;p&gt;www2. hm. com/ en_in/ index.html&lt;/p&gt;

&lt;p&gt;(given indentations in URL to avoid having HnM links on website, they can pay then will add 😉 ) &lt;/p&gt;

&lt;p&gt;Follow #rounitsinha for more&lt;/p&gt;

&lt;h1&gt;
  
  
  frontend #backend #webdevelopment #internet #frontenddevelopment #backenddevelopment
&lt;/h1&gt;

&lt;h1&gt;
  
  
  l2eseries
&lt;/h1&gt;

&lt;h1&gt;
  
  
  l2eseries
&lt;/h1&gt;

</description>
      <category>webdev</category>
      <category>internet</category>
      <category>programming</category>
      <category>javascript</category>
    </item>
    <item>
      <title>CSS and the Browser's Hardware acceleration</title>
      <dc:creator>Rounit Ranjan Sinha</dc:creator>
      <pubDate>Wed, 10 Jan 2024 03:17:33 +0000</pubDate>
      <link>https://forem.com/rounit08/css-and-the-browsers-hardware-acceleration-kpi</link>
      <guid>https://forem.com/rounit08/css-and-the-browsers-hardware-acceleration-kpi</guid>
      <description>&lt;p&gt;We know the CSS but what's this &lt;strong&gt;Hardware&lt;/strong&gt; &lt;strong&gt;acceleration&lt;/strong&gt; ?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;**Hardware&lt;/em&gt;* &lt;strong&gt;acceleration&lt;/strong&gt; is a technique used by modern web browsers to leverage the &lt;em&gt;graphical processing unit&lt;/em&gt; (&lt;strong&gt;GPU&lt;/strong&gt;) on a user's computer to accelerate rendering and improve performance, especially for graphics-intensive tasks like CSS animations and transitions.&lt;/p&gt;

&lt;p&gt;Hardware acceleration offloads certain computations from the computer's central processing unit (CPU) to the GPU. The GPU is designed specifically for rendering graphics and is highly parallelized, making it well-suited for tasks that involve manipulating and displaying visual elements, such as animations, transitions, and graphics.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;=&amp;gt; How Hardware Acceleration Works in Browsers?&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;^Graphics API:&lt;/strong&gt;&lt;br&gt;
Browsers use graphics APIs (Application Programming Interfaces) to communicate with the GPU. Common graphics APIs include OpenGL, WebGL, and Direct3D.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;^Offloading to GPU:&lt;/strong&gt;&lt;br&gt;
When a web page contains graphical elements, such as CSS animations or transitions, the browser can offload the rendering calculations to the GPU through the graphics API.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;^Parallel Processing:&lt;/strong&gt;&lt;br&gt;
The GPU can process multiple tasks simultaneously (parallel processing), which is advantageous for rendering graphics quickly. This is in contrast to the more sequential processing typically performed by the CPU.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;^Smooth Animations:&lt;/strong&gt;&lt;br&gt;
By utilizing hardware acceleration, browsers can achieve smoother animations and transitions. The GPU's parallel processing power allows for more efficient handling of graphical operations, resulting in improved frame rates and responsiveness.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;=&amp;gt; Advantages of Hardware Acceleration:&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;^Performance:&lt;/strong&gt;&lt;br&gt;
Hardware acceleration improves the performance of graphics-intensive tasks, leading to smoother animations and a more responsive user experience.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;^Efficiency:&lt;/strong&gt;&lt;br&gt;
By offloading graphical computations to the GPU, the CPU is free to handle other tasks, contributing to overall system efficiency.&lt;/p&gt;

&lt;p&gt;So, never underestimate the OG CSS and learn advance CSS, so that for animations and all (not advanced animations) avoid JS and write CSS for that, from scratch.&lt;/p&gt;

&lt;p&gt;Get your hands dirty on css here :&lt;br&gt;
&lt;a href="https://cssbattle.dev/"&gt;https://cssbattle.dev/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Checkout my profile:&lt;br&gt;
&lt;a href="https://cssbattle.dev/player/rounit08"&gt;https://cssbattle.dev/player/rounit08&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Get your hands dirty on css here :&lt;br&gt;
&lt;a href="https://cssbattle.dev/"&gt;https://cssbattle.dev/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Checkout my profile:&lt;br&gt;
&lt;a href="https://cssbattle.dev/player/rounit08"&gt;https://cssbattle.dev/player/rounit08&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Follow #rounitsinha for more&lt;/p&gt;

</description>
    </item>
    <item>
      <title>👨‍💻 Why passing GIFs in HTML's &lt;img /&gt; tag is acceptable by browsers but not the video file? 🗃</title>
      <dc:creator>Rounit Ranjan Sinha</dc:creator>
      <pubDate>Mon, 10 Jul 2023 16:17:55 +0000</pubDate>
      <link>https://forem.com/rounit08/why-passing-gifs-in-htmls-tag-is-acceptable-by-browsers-but-not-the-video-file-10e0</link>
      <guid>https://forem.com/rounit08/why-passing-gifs-in-htmls-tag-is-acceptable-by-browsers-but-not-the-video-file-10e0</guid>
      <description>&lt;p&gt;🔺 When it comes to web development, we often encounter the need to display different types of media content.&lt;br&gt;
GIF (Graphics Interchange Format) is an image file format that supports animation, making it an ideal choice for short, looped animations.&lt;/p&gt;

&lt;p&gt;🖊 Actually, it consists of a sequence of images displayed in a specific order to create the illusion of motion. Since GIF is essentially a series of static images, it can be displayed using the "img" tag just like any other image.T&lt;/p&gt;

&lt;p&gt;🔺 However, videos are a different story. Unlike GIFs, videos consist of both audio and visual data, requiring dedicated video players for playback. To accommodate this, HTML provides the  tag, specifically designed to handle video playback. With the  tag, you can include multiple source files, such as MP4 or WebM, within  tags, specifying different formats for browser compatibility.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2xBLs-4s--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/afopy8pejlfqh3xfv84v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2xBLs-4s--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/afopy8pejlfqh3xfv84v.png" alt="Image description" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Type coercion in JS, it's hierarchy?</title>
      <dc:creator>Rounit Ranjan Sinha</dc:creator>
      <pubDate>Fri, 16 Jun 2023 19:07:08 +0000</pubDate>
      <link>https://forem.com/rounit08/type-coercion-in-js-its-hierarchy-lg</link>
      <guid>https://forem.com/rounit08/type-coercion-in-js-its-hierarchy-lg</guid>
      <description>&lt;p&gt;We as a js developer often used "==" and "===" operators in js, but few of us knows about diff b/w them,&lt;/p&gt;

&lt;p&gt;"==" (Equality Operator):&lt;br&gt;
The "==" operator is used for loose equality comparison. It checks whether the operands are equal after performing type coercion if necessary. Type coercion means converting the operands to a common type before comparison.&lt;br&gt;
For example:&lt;br&gt;
console.log(5 == '5'); // true&lt;br&gt;
console.log(true == 1); // true&lt;br&gt;
In the above examples, the operands are of different types (number and string, boolean and number), but JavaScript automatically converts them to the same type for comparison.&lt;/p&gt;

&lt;p&gt;"===" (Strict Equality Operator):&lt;br&gt;
The "===" operator is used for strict equality comparison. It checks whether the operands are strictly equal without performing type coercion. Both the values and the types of the operands must match for the comparison to return true.&lt;br&gt;
For example:&lt;br&gt;
console.log(5 === '5'); // false&lt;br&gt;
console.log(true === 1); // false&lt;/p&gt;

&lt;p&gt;But "==" does type coercion, means converting to a common type before comparison. So, is there any hierarchy on which conversion depends?&lt;/p&gt;

&lt;p&gt;Yes, there is a hierarchy for type coercion in JavaScript. The coercion process follows a set of rules:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;If either operand is a &lt;code&gt;null&lt;/code&gt; or &lt;code&gt;undefined&lt;/code&gt;, they are considered equal (unless strict equality is being used with the "===" operator).&lt;/li&gt;
&lt;li&gt;If either operand is a boolean, the boolean is converted to a number (false becomes 0, true becomes 1) before comparison.&lt;/li&gt;
&lt;li&gt;If one operand is a string and the other is a number, the string is converted to a number before comparison.&lt;/li&gt;
&lt;li&gt;If one operand is an object and the other is a primitive value, the object is converted to its primitive value before comparison. This can be done using the &lt;code&gt;valueOf()&lt;/code&gt; or &lt;code&gt;toString()&lt;/code&gt; methods of the object.&lt;/li&gt;
&lt;li&gt;If the operands are both strings, they are compared as strings.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Tip:&lt;br&gt;
It's important to note that the type coercion process can sometimes lead to unexpected or non-intuitive results, which is why it's generally recommended to use the strict equality operator "===" instead of the loose equality operator "==". The strict equality operator does not perform type coercion and requires both the values and the types to match for the comparison to return true.&lt;/p&gt;

&lt;p&gt;Follow #rounitsinha for more 😝&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
      <category>react</category>
    </item>
    <item>
      <title>React's arrow of Reconciliation</title>
      <dc:creator>Rounit Ranjan Sinha</dc:creator>
      <pubDate>Mon, 05 Jun 2023 18:50:43 +0000</pubDate>
      <link>https://forem.com/rounit08/reacts-arrow-of-reconciliation-4b07</link>
      <guid>https://forem.com/rounit08/reacts-arrow-of-reconciliation-4b07</guid>
      <description>&lt;p&gt;In React, reconciliation is the process of comparing the virtual representation of a component's previous state with its new state, and determining the minimal set of changes needed to update the user interface efficiently. It's how React figures out what parts of the UI need to be updated when the state or props of a component change.&lt;/p&gt;

&lt;p&gt;Here's a step-by-step explanation of the reconciliation process in React:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Virtual DOM: React uses a virtual representation of the DOM called the Virtual DOM. It's a lightweight copy of the actual DOM.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Render: When a component's state or props change, React re-renders the component and generates a new virtual representation of the component's UI.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Diffing: React takes the previous virtual representation (from the previous render) and the new virtual representation (from the current render) and performs a process called "diffing." Diffing involves comparing the two representations and identifying the differences between them.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Update Strategy: React employs an efficient update strategy based on the diffing process. It aims to minimize the number of actual changes made to the real DOM by only applying the necessary updates.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Reconciliation: Once React has identified the differences between the previous and new virtual representations, it performs the necessary updates to the real DOM to reflect the changes. This process is called reconciliation.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;During reconciliation, React follows a few principles to optimize the update process:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Elements of different types are considered different and are completely rebuilt from scratch.&lt;/li&gt;
&lt;li&gt;React tries to update the props of components if they have the same type.&lt;/li&gt;
&lt;li&gt;React uses a "key" prop on lists of elements to improve the efficiency of updates.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By following these principles, React ensures that the user interface remains in sync with the component's state and props while minimizing unnecessary DOM manipulations, resulting in better performance.&lt;/p&gt;

&lt;p&gt;Reconciliation is a core concept in React, but you don't need to worry about it too much in your day-to-day development. React's reconciliation algorithm is highly optimized and handles most cases efficiently. However, understanding the basics of reconciliation can help you write more efficient and optimized React components when dealing with larger applications.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
      <category>react</category>
    </item>
    <item>
      <title>Understanding CSRF in Web.</title>
      <dc:creator>Rounit Ranjan Sinha</dc:creator>
      <pubDate>Sun, 04 Jun 2023 18:55:50 +0000</pubDate>
      <link>https://forem.com/rounit08/understanding-csrf-in-web-4a3</link>
      <guid>https://forem.com/rounit08/understanding-csrf-in-web-4a3</guid>
      <description>&lt;p&gt;As a web developer one needs to understand about Web Security,&lt;br&gt;
Let's talk about Cross-Site Request Forgery (CSRF), with a common example.&lt;/p&gt;

&lt;p&gt;Suppose you are single (us bros us) and want to enter a pub, but only couples are allowed. You tried, but the bouncers outside the pub gave you some kicks on your *** (less than your ex). Then you see a girl outside the pub who wants entry but is not allowed. You both pair up and then get entry inside that pub. After the party is over, you both move out from there with exchanged phone numbers 😉.&lt;/p&gt;

&lt;p&gt;Chalo bht hua, ab tech smjho!&lt;/p&gt;

&lt;p&gt;Here's an example of a CSRF attack:&lt;/p&gt;

&lt;p&gt;Let's say Rounit is browsing a social media platform called "SocialBook," where users can post messages on their profiles. When users submit a new post, the platform sends a POST request to the server to save the message.&lt;/p&gt;

&lt;p&gt;Now, suppose Rounit is logged into SocialBook(means authenticated) and comes across a malicious website while browsing the internet. This malicious website contains hidden code that automatically submits a form to create a post on Rounit's SocialBook profile without his knowledge or consent.&lt;/p&gt;

&lt;p&gt;Here's how the attack unfolds:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Rounit is logged into SocialBook and visits the malicious website.&lt;/li&gt;
&lt;li&gt;The malicious website includes a hidden form that targets SocialBook's post creation endpoint with predefined values: &lt;code&gt;&amp;lt;form action="https:/anylink" method="post"&amp;gt; &amp;lt;input value="Check out this website!"&amp;gt; &amp;lt;/form&amp;gt;&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The attacker uses JavaScript to automatically submit the form in the background without Rounit's awareness.&lt;/li&gt;
&lt;li&gt;Rounit's browser, following the attacker's instructions, sends a POST request to SocialBook's post creation endpoint with the predefined message.&lt;/li&gt;
&lt;li&gt;SocialBook's server receives the request and treats it as a legitimate request because it appears to originate from Rounit's session.&lt;/li&gt;
&lt;li&gt;The malicious message gets posted on Rounit's profile without his knowledge or consent.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In this example, the CSRF attack tricks Rounit's browser into making a request on his behalf to perform an unintended action—creating a post on his SocialBook profile—by exploiting the trust relationship between Rounit's browser and SocialBook.&lt;/p&gt;

&lt;p&gt;To protect against CSRF attacks, SocialBook can implement measures such as CSRF tokens, to ensure that requests originated from forms embedded on their own website rather than from external sources.&lt;/p&gt;

&lt;p&gt;To protect against CSRF attacks, Implement CSRF tokens: Use unique tokens in each HTML form or request that performs sensitive actions. The token should be generated server-side and embedded within the form or included as a header in AJAX requests.&lt;/p&gt;

&lt;p&gt;Follow #rounitsinha for more such contents&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>frontend</category>
    </item>
    <item>
      <title>Do browsers really understand JSX? What are transpilers?</title>
      <dc:creator>Rounit Ranjan Sinha</dc:creator>
      <pubDate>Fri, 28 Apr 2023 03:48:30 +0000</pubDate>
      <link>https://forem.com/rounit08/do-browsers-really-understand-jsx-what-are-transpilers-27ij</link>
      <guid>https://forem.com/rounit08/do-browsers-really-understand-jsx-what-are-transpilers-27ij</guid>
      <description>&lt;p&gt;Do browsers understand JSX?&lt;/p&gt;

&lt;p&gt;Short Ans - NO&lt;/p&gt;

&lt;p&gt;Long Ans - No, to render JSX in a web browser, it needs to be transpiled into regular JavaScript using a tool like Babel. The resulting JavaScript code can then be executed by the web browser.&lt;/p&gt;

&lt;p&gt;So, What it is meant to be transpiled?&lt;br&gt;
=&amp;gt; Transpiling is the process of converting source code written in one programming language into another programming language that has a similar level of abstraction.&lt;/p&gt;

&lt;p&gt;But that's what a compiler do, so what's the difference?&lt;br&gt;
=&amp;gt; Transpilers and compilers are both types of tools that convert code written in one programming language into another language, but there are some differences between them:&lt;br&gt;
1)Output language: The main difference between a transpiler and a compiler is the output language. A compiler typically translates source code into machine code that can be directly executed by a computer, while a transpiler usually converts code into a higher-level programming language that needs to be further processed or executed in a runtime environment.&lt;/p&gt;

&lt;p&gt;2)Level of abstraction: Compilers generally operate at a lower level of abstraction than transpilers.&lt;br&gt;
(The level of abstraction refers to how much detail or complexity is present in a particular idea or concept.)&lt;br&gt;
For example, let's consider the concept of a car. At a high level of abstraction, we might think of it as a vehicle that transports people or goods from one place to another. We're not concerned with the specific details of the car's mechanics, design, or history.&lt;br&gt;
On the other hand, at a low level of abstraction, we might look at specific details of a car, such as its engine, transmission, wheels, and interior features. We're now dealing with more specific and detailed information.&lt;/p&gt;

&lt;p&gt;3)Target audience: Compilers are usually intended for developers who are building low-level systems or performance-critical applications, while transpilers are more commonly used by web developers who want to write code in modern languages and still support older web browsers.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
      <category>computerscience</category>
    </item>
    <item>
      <title>Currying with placeholder support : Explained with detail.</title>
      <dc:creator>Rounit Ranjan Sinha</dc:creator>
      <pubDate>Thu, 23 Mar 2023 19:25:02 +0000</pubDate>
      <link>https://forem.com/rounit08/currying-with-placeholder-support-explained-with-detail-2jf1</link>
      <guid>https://forem.com/rounit08/currying-with-placeholder-support-explained-with-detail-2jf1</guid>
      <description>&lt;p&gt;Currying is one of the most important concepts and also most asked JavaScript/Frontend interview question.&lt;/p&gt;

&lt;p&gt;In this article we will be solving one question which uses currying and some array methods.&lt;/p&gt;

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

&lt;p&gt;So, here we have some requirements to solve this question:&lt;br&gt;
1) We have to check arguments length&lt;br&gt;
2) We have to replace the "_", placeholder.&lt;/p&gt;

&lt;p&gt;So, we have to write code inside function curry(as shown in question above.)&lt;/p&gt;

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

&lt;p&gt;So, as we know that currying is a concept in javascript in which a function returns another function expecting the next argument(s).&lt;/p&gt;

&lt;p&gt;So, here in function "curry" we had passed "func" as an argument.&lt;br&gt;
and acc to this question this argument "func" is the join function.&lt;/p&gt;

&lt;p&gt;Now, there may be a condition in which there are arguments coming to the function more than the expected function's length.&lt;/p&gt;

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

&lt;p&gt;So, we don't want extra args, here we have used the splice method.&lt;/p&gt;

&lt;p&gt;which is splicing the args from 0th position to the length of func(i.e., join here)&lt;br&gt;
=&amp;gt; args.splice(0, func.length)&lt;/p&gt;

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

&lt;p&gt;Now we need to check if the placeholder(i.e., "_" in this case) is present or not&lt;/p&gt;

&lt;p&gt;So, we have used the Array.some() method of javascript.&lt;br&gt;
**Now, let's understand that how this .some() method works, so basically it works like the filter() method but returns something else, actually as in filter method of javascript, we write some logic and if that element is present in the array then we return that element., but here in this some() method, instead of returning that element we return true if logic fits, else we return false.&lt;/p&gt;

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

&lt;p&gt;Now, there maybe the condition where there is no placeholder present and the length is also equal to the expected length.&lt;/p&gt;

&lt;p&gt;So we use the apply() method of javascript, basically this apply method accepts arguments as an array.(here in the code keyword "this" represents the function "func" itself)&lt;/p&gt;

&lt;p&gt;And now the worst can happen is there is the presence of the placeholders and now we need to replace them in order to obtain expected output.&lt;/p&gt;

&lt;p&gt;So, we need to iterate over the args to check the presence of the placeholders.&lt;/p&gt;

&lt;p&gt;Here's the complete code.&lt;/p&gt;

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

&lt;p&gt;I hope it helps :)&lt;br&gt;
Follow for more such contents&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>programming</category>
      <category>coding</category>
    </item>
  </channel>
</rss>
