<?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 sumit shinde on Medium]]></title>
        <description><![CDATA[Stories by sumit shinde on Medium]]></description>
        <link>https://medium.com/@sumitshinde84?source=rss-1e38f26b00ba------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*VbUUeL5E1nrfjJZms4Uy8A.jpeg</url>
            <title>Stories by sumit shinde on Medium</title>
            <link>https://medium.com/@sumitshinde84?source=rss-1e38f26b00ba------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 09:53:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sumitshinde84/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[My Web3 Project Idea which has potential to Success and make suceessfull to users]]></title>
            <link>https://medium.com/@sumitshinde84/my-web3-project-idea-which-has-potential-to-success-and-make-suceessfull-to-users-9b1c1c7a32e6?source=rss-1e38f26b00ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b1c1c7a32e6</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ideas]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[magic-craft]]></category>
            <dc:creator><![CDATA[sumit shinde]]></dc:creator>
            <pubDate>Sun, 31 Dec 2023 10:09:33 GMT</pubDate>
            <atom:updated>2023-12-31T10:09:33.180Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/474/1*NF7WrDfxST6B99bwfrzUgQ.jpeg" /></figure><p>In our fast-paced world, delving into crypto investments promises quick wealth but also carries significant risks. A single misstep can result in financial setbacks. Understanding the crypto market demands time, knowledge, and research, making it challenging for many. To simplify this process and lessen the need for extensive expertise, I’ve conceived a platform that connects crypto experts (referred to as “navigators”) with individuals looking to invest but lacking time or deep knowledge (referred to as “followers”).</p><p>Navigators join by linking their wallets and showcasing their expertise, experiences, and proven successful investments to attract followers. Additionally, there will be a feature allowing navigators to create their own tokens in a user-friendly manner. They can set the token’s name, price, and symbol. Once created, navigators cannot update the token information, except for the price, which will be updated according to an algorithm discussed later in this blog. Well-performing and trusted navigators will receive a green tick from our platform. To allocate the green tick, we evaluate reviews received by navigators from followers and their overall success rate, which is calculated based on the performance of their previous portfolios.</p><p>Upon joining, navigators create investment portfolios, choosing whether they will be private or public and setting a countdown. When the countdown ends, the portfolio activates, and investments are made. They can communicate and share updates on the platform.</p><p>Followers connect their wallets and select a navigator’s portfolio to invest in, starting from as little as $1. Let’s consider a navigator named Roni, whose portfolio allocation is as follows:</p><ul><li>Ether (20%)</li><li>MCRT (50%)</li><li>Bitcoin (10%)</li><li>Dogecoin (20%)</li></ul><p>Suppose five people invest $100 each, five invest $50 each, and Roni contributes $400, totaling $1100. This sum enters a smart contract and is invested according to the portfolio. Followers receive tokens from the navigator as investment proof and passes. All transactions related to subscribers will be securely stored on the blockchain.</p><p>In the case that Roni’s portfolio gains 30%, totaling $1430, when Roni withdraws, profits distribute based on the investment ratio, with Roni receiving an additional 4%. All transactions occur via a smart contract wallet, eliminating the need for a centralized wallet. Also, the price of the token will be deducted from the follower’s profit if they wish to retain the token as a pass to subscribe to Roni’s portfolio next time, or they can return the token to Roni.</p><p>Let’s break down the earnings:</p><ul><li>Roni (400 + 120) = $520</li><li>Follower who invested $100 (100 + 47.10) = $147.10</li><li>Followers who invested $50 (50 + 23.55) = $73.55</li></ul><p>Now, let’s consider the token’s profitability: If eight out of ten followers liked Roni’s portfolio and wish to invest again using Roni’s portfolio by holding the token as pass the price of that toke will get deducted by those 8 followers profit ( lets price of roni’s token is 1$ for each) , Roni earns an additional $8 from the token purchases, totaling $528. As Roni gains trust and more followers acquire Roni’s token, the token’s value increases due to a specific algorithm.</p><p>The token’s price increases due to increased demand and scarcity, influenced by the number of followers holding and using the token for future investments. As more users desire Roni’s token, its value rises according to the algorithm, rewarding both Roni and token holders for their trust and belief in the navigator’s expertise.</p><p>This platform empowers navigators to earn and establish their own tokens while enabling users to profit without requiring extensive expertise or time commitment.</p><p><strong>If anyone wants to contribute to this blog to enhance it, reach out to me at X (Twitter)</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b1c1c7a32e6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Making code faster and more memory-efficient with Node.js streams]]></title>
            <link>https://medium.com/@sumitshinde84/making-code-faster-and-more-memory-efficient-with-node-js-streams-6a7ebececb72?source=rss-1e38f26b00ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/6a7ebececb72</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[sumit shinde]]></dc:creator>
            <pubDate>Thu, 09 Nov 2023 19:43:13 GMT</pubDate>
            <atom:updated>2023-11-09T19:43:13.446Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*RQAGOpcr8PPerYGvwscXJQ.png" /></figure><h4><strong>Introduction:</strong></h4><p>Hey there, fellow devs! Today, let’s talk about something super cool — making our code faster and smarter with a little Node.js magic. You know, like giving our apps a turbo boost.</p><p>Why Should We Care?</p><p>So, imagine you’re cooking up a storm in the kitchen. You want things done fast, right? Well, our code is a bit like that. We want it to run speedy quick, but also, we don’t want it hogging up all the memory, just like we wouldn’t want our kitchen overflowing with pots and pans.</p><p>That’s where our superhero, Node.js streams, swoops in. They’re like the chefs who chop veggies as they go, not waiting for the whole watermelon to hit the chopping board. Before we jump into the nitty-gritty, let’s get comfy with what Node.js streams are and why they’re our ticket to faster, memory-savvy code. Ready for the ride? Let’s go!</p><blockquote>It’s hardware that makes a machine fast. It’s software that makes a fast machine slow.</blockquote><blockquote>— <a href="https://quotlr.com/author/craig-reucassel">Craig Reucasse</a></blockquote><h4>What are Streams?</h4><p>Streams are the backbone of Node.js applications, handling data in a smart way — bit by bit. Forget loading the entire file into your computer’s memory, streams process it chunk by chunk, saving the day for those colossal files.</p><p>Think of streaming services like YouTube — no waiting for the whole video to download. It flows to you in bite-sized pieces, letting you dive into your favorite cat videos ASAP. That’s the magic of streams!</p><p>But it’s not just for videos. Streams bring ‘composability’ to our code, like LEGO blocks for developers. In Node.js, we can mix and match code bits, passing data around with streams to create something awesome.</p><h4><strong>Understanding Buffer in Streams:</strong></h4><p>Alright, let’s break it down in simpler terms. Imagine you’re moving a huge pile of books from one place to another. Instead of trying to carry all the books at once, you use a small backpack to carry a few books at a time.</p><p>Now, in the world of computer programs like Node.js, there’s something similar to this backpack called a “<strong>buffer</strong>” It’s like a temporary holding area for data. In Node.js, this buffer is usually set to hold around <strong>16,384 bytes</strong> of data at a time.</p><p>Here’s the interesting part: when you’re dealing with a lot of data, like a really big file, the computer doesn’t try to load the entire thing into its memory all at once. That would be like trying to carry all the books in one go, and it’s just not practical.</p><p>So, instead, Node.js breaks down the data into smaller, more manageable chunks — kind of like carrying a few books at a time in your backpack. But, there’s a limit to how much can fit in this backpack (16,384 bytes to be exact).</p><p>Now, let’s say you have this massive 1-gigabyte file. The buffer can only hold a small portion of it at a time. So, it fills up the buffer with 16,384 bytes, and what about the rest of the file? Well, here’s the catch: the extra data goes straight into your computer’s memory.</p><p>Think of it like trying to carry a really, really big pile of books, and you can only fit a few in your backpack. The rest you have to hold in your hands, and if it’s too much, things might get a bit crowded. That’s what happens with your computer’s memory — it might get a bit overwhelmed if there’s too much data to handle at once.</p><p>Now, I’ll demonstrate examples of performing write operations on file using the promise-based approach. Why not the callback or synchronous approach? Well, they come with a lot of disadvantages like callback hell, blocking the event loop, etc.</p><p>We’ll explore execution times and memory usage both with streams and without streams.</p><ol><li><strong>Without stream</strong></li></ol><pre>const fs = require(&#39;fs/promises&#39;);<br><br>(async ()=&gt;{<br>  console.time(&#39;writeFile&#39;)<br>  const fileHandle = await fs.open(&#39;text.txt&#39;,&#39;w&#39;);<br><br>  for(let i = 0;i&lt;1000000;i++){<br>     await fileHandle.write(` ${i} `);<br>  }<br><br>  console.timeEnd(&#39;writeFile&#39;)<br>})()</pre><p>When you run this code using the Node command, you’ll notice that it takes approximately <strong>1 minute </strong>to complete the write operation and consumes nearly <strong>30MB of memory</strong>. Keep in mind that the execution time may vary on different machines based on their processing power.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g6w487zQBVimUC40cYmd1Q.png" /><figcaption>My task manager shows the Node.js JavaScript runtime to observe the memory usage by the above program.</figcaption></figure><p><strong>2. With Stream</strong></p><pre>const fs = require(&#39;fs/promises&#39;);<br><br>(async ()=&gt;{<br>  console.time(&#39;writeFile&#39;)<br>  const fileHandle = await fs.open(&#39;text.txt&#39;,&#39;w&#39;);<br><br>  const stream = fileHandle.createWriteStream()<br><br>  for(let i = 0;i&lt;1000000;i++){<br>     const buff = Buffer.from(` ${i}`,&#39;utf-8&#39;)<br>     stream.write(buff)<br>  }<br><br>  console.timeEnd(&#39;writeFile&#39;)<br>})()</pre><p>It takes almost 500 milliseconds to complete the write operation, which is much faster, right? However, there is an issue — it consumes almost 250MB, which is a lot. So, how do we solve this using streams? Well, we’ve already addressed the time concern.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Py5aU-2QgghIGErHJVEEHg.png" /><figcaption>My task manager shows the Node.js JavaScript runtime to observe the memory usage by the above program.</figcaption></figure><p><strong>First discuss why it is happening :</strong></p><p>This issue arises because, as we know, the internal buffer of streams has a maximum limit of 16384 bytes. When attempting to push data larger than this limit, the stream stores the remaining data in memory. How can we address this?</p><p>To resolve this, we must allow the stream buffer time to clear (drain) itself after reaching full capacity. Afterward, we can resume the operation. By doing so, the excess data will not be stored in memory.</p><p>See the code below for an illustration of how we can implement this solution:</p><pre>const fs = require(&#39;node:fs/promises&#39;);<br><br>(async () =&gt; {<br>  console.time(&#39;writeMany&#39;)<br>  const fileHandle = await fs.open(&#39;text.txt&#39;, &#39;w&#39;);<br>  const stream = fileHandle.createWriteStream();<br><br>  let i = 0;<br>  let writeNum = 1000000;<br><br>  const writeMany = () =&gt; {<br>    while (i &lt; writeNum) {<br>      const buff = Buffer.from(` ${i} `, &#39;utf-8&#39;);<br>      if (i === writeNum - 1) return stream.end(buff)<br>      if (!stream.write(buff)) break;<br>      i++;<br><br>    }<br>  }<br><br>  stream.on(&#39;drain&#39;, () =&gt; {<br>    writeMany()<br>    <br>  })<br><br>  stream.on(&#39;finish&#39;, () =&gt; {<br><br>    fileHandle.close()<br>    console.timeEnd(&#39;writeMany&#39;)<br>  })<br><br><br>  writeMany()<br>})()</pre><p>It takes almost 3 seconds to complete the write operation and it consumes almost 42MB . So, now we have successfully solved the issue .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vpj-20FKkBJMYXlG6MXJHQ.png" /><figcaption>My task manager shows the Node.js JavaScript runtime to observe the memory usage by the above program.</figcaption></figure><p>Please comment on the next Node.js topic you’d like to explore in-depth quickly. Also, let me know if you’re interested in delving even deeper into the topic of streams</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6a7ebececb72" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>