<?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 Sanish Kumar on Medium]]></title>
        <description><![CDATA[Stories by Sanish Kumar on Medium]]></description>
        <link>https://medium.com/@sanishkr?source=rss-6f750e8a226e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*_prDZgGOJ1QmYaueWdUxaA.jpeg</url>
            <title>Stories by Sanish Kumar on Medium</title>
            <link>https://medium.com/@sanishkr?source=rss-6f750e8a226e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 11:37:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sanishkr/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[Here's How to Actually Detect Internet Connectivity]]></title>
            <link>https://medium.com/front-end-weekly/heres-how-to-actually-detect-internet-connectivity-e6cb5ae01de5?source=rss-6f750e8a226e------2</link>
            <guid isPermaLink="false">https://medium.com/p/e6cb5ae01de5</guid>
            <dc:creator><![CDATA[Sanish Kumar]]></dc:creator>
            <pubDate>Sun, 19 Apr 2026 01:02:27 GMT</pubDate>
            <atom:updated>2026-07-10T18:29:05.510Z</atom:updated>
            <content:encoded><![CDATA[<p>Your app says the user is online. The request fails anyway. Sound familiar?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_jiYIGacCSWCpTwAbwdcYA.png" /></figure><p>I’ve been there. You check navigator.onLine, it returns true, you fire off an API request... and it times out. The user stares at a spinner. Your error tracking lights up. Everyone&#39;s frustrated.</p><p>Here’s the uncomfortable truth: <strong>navigator.onLine lies to you.</strong></p><p>It doesn’t check if the user has <em>actual</em> internet connectivity. It only checks if the device has a network interface. Connected to WiFi with no internet? navigator.onLine says true. Hotel captive portal blocking everything? Still true.</p><p>I built <a href="https://www.npmjs.com/package/react-reachability">react-reachability</a> to solve this problem properly.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Ff%2F788447%3Fas_embed%3Dtrue&amp;dntp=1&amp;display_name=Upscribe&amp;url=https%3A%2F%2Fupscri.be%2F788447%2F&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/18214d8333adbb5668f31791a3202b60/href">https://medium.com/media/18214d8333adbb5668f31791a3202b60/href</a></iframe><h3>The Problem with navigator.onLine</h3><pre>// This looks reasonable...<br>if (navigator.onLine) {<br>  await fetch(&#39;/api/submit-payment&#39;);<br>}</pre><pre>// But navigator.onLine can be TRUE when:<br>// ❌ WiFi is connected but router has no internet<br>// ❌ Behind a captive portal (hotel, airport)<br>// ❌ ISP is down but local network works<br>// ❌ VPN is disconnected but WiFi is on</pre><p>The consequences are real:</p><ul><li><strong>Failed payments</strong> that users think went through</li><li><strong>Lost form data</strong> when submissions silently fail</li><li><strong>Broken real-time features</strong> that show stale data</li><li><strong>Poor UX</strong> with confusing error states</li></ul><h3>The Solution: Actual Network Probing</h3><p>react-reachability takes a different approach. Instead of trusting the browser&#39;s guess, it <strong>actually probes the network</strong> by making lightweight requests to known-reliable endpoints.</p><p>And here’s the key: it does this in a <strong>Web Worker</strong>, so your main thread stays buttery smooth.</p><h3>Key Features</h3><ul><li>🔄 <strong>Non-blocking</strong> — Probes run in a Web Worker</li><li>⚛️ <strong>React hook</strong> — useReachability() for React apps</li><li>🌐 <strong>Framework-agnostic</strong> — Core class works anywhere</li><li>🔁 <strong>Fallback URLs</strong> — Tries multiple endpoints</li><li>⚙️ <strong>Configurable</strong> — Timeout, interval, retries</li><li>📦 <strong>Zero dependencies</strong> — Only peer dep is React (optional)</li><li>🛡️ <strong>SSR-safe</strong> — Works with Next.js, Remix, etc.</li></ul><h3>How It Works</h3><pre>┌─────────────────────────────────────────────────────┐<br>│                    Main Thread                      │<br>│  ┌─────────────┐    state change    ┌────────────┐  │<br>│  │ React Hook  │ ◄────────────────  │  Monitor   │  │<br>│  │ / Listener  │                    │  Class     │  │<br>│  └─────────────┘                    └─────┬──────┘  │<br>└───────────────────────────────────────────┼─────────┘<br>                                            │ postMessage<br>┌───────────────────────────────────────────┼─────────┐<br>│                   Web Worker              ▼         │<br>│  ┌─────────────────────────────────────────────┐    │<br>│  │  Interval polling → fetch probes → result   │    │<br>│  └─────────────────────────────────────────────┘    │<br>└─────────────────────────────────────────────────────┘</pre><ol><li><strong>Web Worker</strong> handles all network probing in a separate thread</li><li><strong>Fetch requests</strong> go to reliable endpoints (Google, Cloudflare, Apple)</li><li><strong>Only state changes</strong> notify the main thread (configurable)</li><li><strong>Fallback</strong> to main-thread probing if Workers aren’t available</li></ol><h3>Quick Start: React</h3><p>Install the package:</p><pre>npm install react-reachability</pre><p>Use the hook:</p><pre>import { useReachability } from &quot;react-reachability&quot;;</pre><pre>function NetworkStatus() {<br>  const { isOnline, status, lastChecked, checkNow } = useReachability({<br>    interval: 30000, // Check every 30 seconds<br>    timeout: 5000,   // 5 second timeout per request<br>  });</pre><pre>  if (status === &quot;checking&quot;) {<br>    return &lt;div&gt;Checking connection...&lt;/div&gt;;<br>  }</pre><pre>  return (<br>    &lt;div&gt;<br>      &lt;p&gt;{isOnline ? &quot;🟢 Online&quot; : &quot;🔴 Offline&quot;}&lt;/p&gt;<br>      &lt;p&gt;Last checked: {lastChecked?.toLocaleTimeString()}&lt;/p&gt;<br>      &lt;button onClick={checkNow}&gt;Check Now&lt;/button&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><h3>Show an Offline Banner</h3><pre>function App() {<br>  const { isOnline } = useReachability();</pre><pre>  return (<br>    &lt;&gt;<br>      {isOnline === false &amp;&amp; (<br>        &lt;div className=&quot;offline-banner&quot;&gt;<br>          You&#39;re offline. Some features may not work.<br>        &lt;/div&gt;<br>      )}<br>      &lt;MainContent /&gt;<br>    &lt;/&gt;<br>  );<br>}</pre><h3>Quick Start: Vanilla JavaScript</h3><p>Not using React? No problem. The core ReachabilityMonitor class works anywhere:</p><pre>import { ReachabilityMonitor } from &quot;react-reachability&quot;;</pre><pre>const monitor = new ReachabilityMonitor({<br>  urls: [&quot;https://www.google.com/generate_204&quot;],<br>  interval: 30000,<br>  timeout: 5000,<br>  retries: 1,<br>});</pre><pre>// Subscribe to state changes<br>const unsubscribe = monitor.subscribe((state) =&gt; {<br>  console.log(&quot;Online:&quot;, state.isOnline);<br>  console.log(&quot;Status:&quot;, state.status);<br>  <br>  // Update your UI<br>  document.getElementById(&quot;status&quot;).textContent = <br>    state.isOnline ? &quot;Connected&quot; : &quot;Disconnected&quot;;<br>});</pre><pre>// Trigger manual check<br>document.getElementById(&quot;check-btn&quot;).onclick = () =&gt; {<br>  monitor.checkNow();<br>};</pre><pre>// Clean up when done<br>// unsubscribe();<br>// monitor.destroy();</pre><p>Works with Vue, Svelte, Angular, or plain HTML/JS.</p><h3>Real-World Use Cases</h3><h3>1. Offline-First Apps</h3><p>Queue actions when offline, sync when back online:</p><pre>function useOfflineQueue() {<br>  const { isOnline } = useReachability();<br>  const [queue, setQueue] = useState([]);</pre><pre>  useEffect(() =&gt; {<br>    if (isOnline &amp;&amp; queue.length &gt; 0) {<br>      // Process queued actions<br>      queue.forEach(action =&gt; processAction(action));<br>      setQueue([]);<br>    }<br>  }, [isOnline, queue]);</pre><pre>  const addToQueue = (action) =&gt; {<br>    if (isOnline) {<br>      processAction(action);<br>    } else {<br>      setQueue(prev =&gt; [...prev, action]);<br>    }<br>  };</pre><pre>  return { addToQueue, queueLength: queue.length };<br>}</pre><h3>2. Payment &amp; Checkout Flows</h3><p>Warn users before they submit:</p><pre>function CheckoutButton({ onSubmit }) {<br>  const { isOnline, checkNow } = useReachability();</pre><pre>  const handleClick = async () =&gt; {<br>    await checkNow(); // Fresh check before payment<br>    <br>    if (!isOnline) {<br>      alert(&quot;Please check your internet connection before submitting payment.&quot;);<br>      return;<br>    }<br>    <br>    onSubmit();<br>  };</pre><pre>  return (<br>    &lt;button onClick={handleClick} disabled={isOnline === false}&gt;<br>      {isOnline === false ? &quot;No Connection&quot; : &quot;Pay Now&quot;}<br>    &lt;/button&gt;<br>  );<br>}</pre><h3>3. Real-Time Dashboards</h3><p>Pause polling when disconnected:</p><pre>function Dashboard() {<br>  const { isOnline } = useReachability();<br>  const [data, setData] = useState(null);</pre><pre>  useEffect(() =&gt; {<br>    if (!isOnline) return; // Don&#39;t poll when offline</pre><pre>    const interval = setInterval(fetchDashboardData, 5000);<br>    return () =&gt; clearInterval(interval);<br>  }, [isOnline]);</pre><pre>  return (<br>    &lt;div&gt;<br>      {!isOnline &amp;&amp; &lt;div className=&quot;warning&quot;&gt;Live updates paused&lt;/div&gt;}<br>      &lt;DashboardContent data={data} /&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><h3>Configuration Options</h3><p>OptionTypeDefaultDescriptionurlsstring | string[]Google, Cloudflare, AppleEndpoints to probetimeoutnumber5000Timeout per request (ms)intervalnumber30000Polling interval (ms)retriesnumber1Retries per URLenabledbooleantrueEnable/disable monitoringnotifyOnlyOnChangebooleantrueOnly notify on state changeonLogfunction—Debug logging callback</p><blockquote><em>⚠️ </em><strong><em>Note</em></strong><em>: Setting </em><em>notifyOnlyOnChange: false will trigger callbacks every interval, which may cause unnecessary re-renders.</em></blockquote><h3>Why Web Workers?</h3><p>Network requests can be slow — especially when checking connectivity on a flaky connection. Running probes on the main thread would:</p><ul><li>Block UI interactions during requests</li><li>Cause jank in animations</li><li>Delay other JavaScript execution</li></ul><p>By offloading to a Web Worker, your app stays responsive even when probing takes several seconds.</p><h3>Get Started</h3><pre>npm install react-reachability</pre><ul><li>📦 <strong>npm</strong>: <a href="https://www.npmjs.com/package/react-reachability">react-reachability</a></li><li>🐙 <strong>GitHub</strong>: <a href="https://github.com/sanishkr/react-reachability">sanishkr/react-reachability</a></li></ul><p>Found a bug? Have a feature request? <a href="https://github.com/sanishkr/react-reachability/issues">Open an issue</a>!</p><p>If this helped you, consider giving it a ⭐ on GitHub.</p><p><em>Stop trusting </em><em>navigator.onLine. Start knowing if your users are actually connected.</em></p><p>All the medium 👏 and GitHub ⭐️ are appreciated. Thanks for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e6cb5ae01de5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/front-end-weekly/heres-how-to-actually-detect-internet-connectivity-e6cb5ae01de5">Here&#39;s How to Actually Detect Internet Connectivity</a> was originally published in <a href="https://medium.com/front-end-weekly">Frontend Weekly</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“The devs we notice” vs “The devs we need”]]></title>
            <link>https://medium.com/@sanishkr/the-heroes-we-notice-vs-the-heroes-we-need-359603101c2b?source=rss-6f750e8a226e------2</link>
            <guid isPermaLink="false">https://medium.com/p/359603101c2b</guid>
            <category><![CDATA[employees]]></category>
            <category><![CDATA[superheroes]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[software]]></category>
            <dc:creator><![CDATA[Sanish Kumar]]></dc:creator>
            <pubDate>Sat, 20 Apr 2024 10:42:52 GMT</pubDate>
            <atom:updated>2024-04-22T12:58:37.369Z</atom:updated>
            <content:encoded><![CDATA[<h3>“The heroes we notice” vs “The heroes we need”</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AwHoLqKvYcH4wtLg1pwpYg.png" /><figcaption>“The heroes we notice” vs “The heroes we need”</figcaption></figure><p>We’ve all seen them: the <strong>Heroes We Notice</strong>. In the office, it’s the person who pulls an all-nighter to fix a critical bug snafu or the one who heroically juggles multiple deadlines without breaking a sweat (or maybe just a few pencils). These mavericks become legends, their feats whispered with a mix of awe and exhaustion. Our regular saviours of the earth, the supermen or the superwomen. But if they have to turn to these heroics so often, won’t you want to dig deeper? These are the people who do subpar-quality work regularly and hence the need of regular heroics. I mean, you must of heard this “<em>If everything is a priority, then nothing is a priority</em>”, right? Basically, you need to dig into the root cause of it.</p><figure><img alt="“The heroes we notice” vs “The heroes we need”" src="https://cdn-images-1.medium.com/max/1024/1*oNXZdCfy1h6gI93r8P8JiA.jpeg" /></figure><p>Here’s the thing: what if the real heroes are the ones we completely overlook? The ones who ensure these last-minute scrambles never(rarely) happen in the first place? Let’s call them the <strong>Heroes We Need</strong>.</p><p>These are the folks who consistently deliver high-quality work, on time, every time. They don’t rely on heroics; they rely on meticulous planning, clear communication, and a commitment to excellence from the initial get-go. They’re the ones who write code that is clear and concise, the ones who anticipate potential roadblocks in projects before they erupt, and the ones who don’t leave cryptic notes in their code for future generations to decipher (looking at you, Kevin from API team).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eS7E2F-lRDKU58DN9deX6g.png" /></figure><p>The problem? Our focus often falls on the <strong>Heroes We Notice</strong>. The all-nighter warriors, the emergency firefighters — they get the praise, the recognition, and maybe even a free cup of coffee (because let’s be honest, that’s the real reward). This, in turn, can pressure everyone else to cut corners, hoping their own desperate hero moment will come.</p><blockquote>So, if “<em>Success breeds Success</em>” is true then, “<em>Mediocrity breeds Mediocrity</em>”</blockquote><p>You may wonder, how does a simple thing like this gets unnoticed and our invisible heroes go unrewarded so often? I mean, it’s so obvious to see, right? Well, my friend the answer is, you may have noticed the ones who are rewarding(so-called “leaders/managers/bla-blas”) are also people and most of them would have either belonged to the same subpar-work-superhero category if they were doing the work intead of these superheroes. Or these so-called “leaders” are too naive and still got so much to learn that they can’t tell the difference between these 2 types of heroes. In short, a lot of them don’t deserve to be “leaders” with powers to judge and reward others based on daily earth-saving-vigilante work.</p><p>And as you have seen in movies, every time such heroism is done, it leaves some corner of the world in ruins. All this heroism comes at a huge cumulative cost which if not the same superheroes then someone else has to pay for it in the future, maybe our silent heroes.</p><p>The saddest part of this story is, once you start noticing, this theory doesn’t just hold in the tech world, this shit happens in every other aspect of life.</p><p><strong>But what if we flipped the script?</strong> Imagine a world where we celebrate the <strong>Heroes We Need</strong>. A world where meeting deadlines and delivering well-crafted work is the norm, not the exception. A world where clear communication and proactive problem-solving are seen as the ultimate acts of heroism. A world where some superhero is not needed every five minutes to save the world.</p><p>Here’s how we can make that happen, not just in the office, but in every facet of life:</p><ul><li><strong>Shine a Light on the Silent Guardians:</strong> Publicly acknowledge the folks who consistently deliver. Let them know their steady excellence is the reason things run smoothly, because let’s face it, nobody enjoys constant fire drills (metaphorical or literal).</li><li><strong>Planning is Sexy (Yes, Really):</strong> Make proactive problem-solving the new cool. Celebrate those who identify potential issues before they become infernos, because let’s be honest, everyone hates scrambling at the last minute.</li><li><strong>Invest in Quality Over Quantity:</strong> Prioritize well-crafted work over breakneck speed. Give yourself (or your team) the time and resources needed to do things right the first time.</li></ul><p>By valuing the <strong>Heroes We Need</strong>, we can create a calmer, more efficient environment, whether it’s the office, our personal lives, or even our social media presence. So, let’s give a standing ovation to the quiet heroes who ensure the machine keeps running smoothly. After all, a world built on solid foundations is a lot less likely to erupt in flames (or require a superman landing every five minutes).</p><p>I am sure there might be other solutions to add to this article. If you happen to know one, please share in the comments.</p><p><em>Thank you for reading this article. Please share and clap 👏 if you liked it.</em></p><p><strong>Happy not-needing-to-be-a-superhero-every-5-minutes. ✌️</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=359603101c2b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“Twitter-Style” Floating Balloons in ReactJS — ]]></title>
            <link>https://medium.com/front-end-weekly/the-story-of-twitter-like-react-floating-balloons-5948f8f7ff58?source=rss-6f750e8a226e------2</link>
            <guid isPermaLink="false">https://medium.com/p/5948f8f7ff58</guid>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[balloons]]></category>
            <category><![CDATA[birthday-balloons]]></category>
            <category><![CDATA[react-balloons]]></category>
            <category><![CDATA[floating-ballons]]></category>
            <dc:creator><![CDATA[Sanish Kumar]]></dc:creator>
            <pubDate>Tue, 08 Mar 2022 05:48:49 GMT</pubDate>
            <atom:updated>2022-04-05T14:31:37.697Z</atom:updated>
            <content:encoded><![CDATA[<h3>ReactJS “Twitter-Style” Floating Balloons — 🎈💥</h3><figure><img alt="React Floating Balloons" src="https://cdn-images-1.medium.com/proxy/0*ZtL3nhmhCF_Yfp_M.jpg" /><figcaption>Img: <a href="https://ceilingoutfitters.com/blog/how-to-hang-balloons-filled-with-air-instead-of-helium/">https://ceilingoutfitters.com/blog/how-to-hang-balloons-filled-with-air-instead-of-helium/</a></figcaption></figure><p>So, you want to float some balloons on a webpage, huh? 🤔 🎈 Maybe, it is a birthday celebration or some other occasion. Maybe, you want to celebrate on your own website or for your users. Now, how about if you can also have a feature to pop them with burst audio 🎈💥. It would be so cool, isn’t it? 😂</p><p>I get it. A similar chain of thoughts came to my mind on my previous birthday. And most probably, you have already seen something similar, if you’ve used Twitter on your birthday. That’s where I got my motivation too.</p><figure><img alt="Twitter Birthday Balloons" src="https://cdn-images-1.medium.com/max/1024/0*RAiQDQW0Kzk_WslC.png" /><figcaption>Img: <a href="https://metro.co.uk/2015/08/04/tell-twitter-your-date-of-birth-and-it-will-shower-you-with-digital-balloons-5326986/">https://metro.co.uk/2015/08/04/tell-twitter-your-date-of-birth-and-it-will-shower-you-with-digital-balloons-5326986/</a></figcaption></figure><p><em>TL;DR</em></p><blockquote><strong><em>npm i </em></strong><a href="https://www.npmjs.com/package/react-floating-balloons"><strong><em>react-floating-balloons</em></strong></a></blockquote><ul><li>Creates custom floating balloons in ReactJS/NextJS</li><li>Custom count, msg, looping, hangOnTop, multiple colors, etc.</li><li>Supports balloon pop animation and sound</li><li>Uses React Portal and Styled-Components</li></ul><p>Thanks to this elaborate <a href="https://erdoganbavas.medium.com/creating-birthday-balloons-like-twitter-profile-no-image-5348a1dc2720">post</a>, I got off to a quick start. But it was implemented in vanilla HTML/CSS/JS. And it didn’t have a lot of customization options. On one side I thought of making a ReactJS npm library while on the other side, my mind wandered. The mind wanders when it wanders, right? 😂 I kept thinking about writing custom messages on the balloon and popping them.</p><figure><img alt="Mind Wandering" src="https://cdn-images-1.medium.com/max/371/0*Zhsjn5LJwl_DvTgn.jpg" /><figcaption>Img: <a href="https://www.shutterstock.com/image-vector/concept-escape-dream-freedom-man-leaving-1991789786">https://www.shutterstock.com/image-vector/concept-escape-dream-freedom-man-leaving-1991789786</a></figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Ff%2F788447%3Fas_embed%3Dtrue&amp;dntp=1&amp;display_name=Upscribe&amp;url=https%3A%2F%2Fupscri.be%2F788447%2F&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/18214d8333adbb5668f31791a3202b60/href">https://medium.com/media/18214d8333adbb5668f31791a3202b60/href</a></iframe><p>After stitching some code and tailoring some features, I made a working example in ReactJS. The library used for pop animation is <a href="https://www.npmjs.com/package/@mojs/core">here</a>. I was not quite happy with the code. There were two problems:</p><ol><li>Some core parts of the balloon element were still using vanilla HTML/JS/CSS.</li><li>I had a very low level of control over the customization of balloons.</li></ol><p>I also noticed a bug that the pop sound of balloons was restricted to only once in a certain time interval, even if you might have popped more balloons during the interval.</p><p>I quickly realized that any issue of CSS conflicts in UI will disappear if I used react portal here. While I was working to fix the above problems, I hit a major snag in popping the balloons in mobile browsers(touch-supported devices).</p><p>Okay, so I thought it would be cool to implement balloon pop feature on double click event. While it worked on my laptop, but when I tested the new version on mobile, nothing happened. I dug deeper into the reason and found out that all touch-supported devices don’t seem to support/work well with native desktop-browser-like double click events.</p><p>The solution: allow such devices to pop the balloons with a single click. And to recognize such devices, the easiest working solution was:</p><blockquote>const supportsTouch = “ontouchstart” in window || navigator.msMaxTouchPoints;</blockquote><p>I was releasing multiple patches and minor version updates/fixes to test and then I hit another major snag in SSR. It didn’t seem to work with NextJS. Two issues:</p><ol><li>ReferenceError: self is not defined issue, which can be easily solved by dynamic imports with { ssr: false } flag and displaying the balloon component only after CSR.</li><li><a href="https://github.com/vercel/next.js/issues/19936">Global CSS cannot be imported from within node_modules</a>. NextJS doesn’t seem to have support for this yet. The only possible working solution was to use next-global-css module with next.config.js which can be a lot of work for some devs.</li></ol><p>I realized in a few hours that the best way to get rid of most of the above and previous problems is to use styled-components.</p><p>I started to re-write all the Balloon elements and animation from scratch. Once I was done implementing all the basic features of the balloon and popping, I started adding some new features as well. Now I had full control over all the balloon elements and their customization. It became so easy to add extra features. I was able to add 2 additional features like loop, hangOnTop in only a few minutes each.</p><p>And, the “no concurrent balloon popping audio” issue was fixed too. 😊 The complete code size apart from dependencies is only <a href="https://bundlephobia.com/package/react-floating-balloons@3.0.0">~3KB</a> at the time of writing this article.</p><p>So, here is the library 🎈:</p><h4>npm i <a href="https://www.npmjs.com/package/react-floating-balloons">react-floating-balloons</a></h4><p>And, here is a basic example:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodesandbox.io%2Fembed%2F4cx9kh&amp;display_name=CodeSandbox&amp;url=https%3A%2F%2Fcodesandbox.io%2Fs%2F4cx9kh&amp;image=https%3A%2F%2Fcodesandbox.io%2Fapi%2Fv1%2Fsandboxes%2F4cx9kh%2Fscreenshot.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codesandbox" width="1000" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/5b725383d7c8a95b1681854092a60f69/href">https://medium.com/media/5b725383d7c8a95b1681854092a60f69/href</a></iframe><p>Please feel free to raise any issues <a href="https://github.com/sanishkr/react-floating-balloons/issues/new">here</a></p><h3>Learnings:</h3><ul><li>Iterate over very quickly in the beginning.</li><li>Making examples for the users while writing such libraries, provides more clarity to oneself.</li><li>Test on various kinds of devices, helps in finding bugs.</li><li>Make sure to have high levels of control over core elements and components for quick customization and lesser bugs.</li></ul><p>This library is still in its very early stages and I have a lot of Todos like props validation, more customization options, examples, and test cases.</p><p>All the medium 👏 and GitHub ⭐️ are appreciated. Thanks for reading.</p><blockquote>Happy Balloons Popping!! 🎈💥</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5948f8f7ff58" width="1" height="1" alt=""><hr><p><a href="https://medium.com/front-end-weekly/the-story-of-twitter-like-react-floating-balloons-5948f8f7ff58">“Twitter-Style” Floating Balloons in ReactJS — 🎈💥</a> was originally published in <a href="https://medium.com/front-end-weekly">Frontend Weekly</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React Progressive Graceful Image with Lazy Loading]]></title>
            <link>https://medium.com/@sanishkr/react-progressive-graceful-image-c7a45b577f5f?source=rss-6f750e8a226e------2</link>
            <guid isPermaLink="false">https://medium.com/p/c7a45b577f5f</guid>
            <category><![CDATA[image-loading]]></category>
            <category><![CDATA[progressive-image-loading]]></category>
            <category><![CDATA[intersection-observer]]></category>
            <category><![CDATA[lazy-loading]]></category>
            <category><![CDATA[reactjs]]></category>
            <dc:creator><![CDATA[Sanish Kumar]]></dc:creator>
            <pubDate>Mon, 06 Jan 2020 18:47:27 GMT</pubDate>
            <atom:updated>2020-01-31T18:27:00.917Z</atom:updated>
            <content:encoded><![CDATA[<h3>React Progressive Graceful Image with Lazy-Loading — All-in-one ReactJS npm package for Image Loading</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*btEjjGu76-cHqBA0Re-aDw.gif" /></figure><p>TLDR;</p><ul><li>npm i <a href="https://www.npmjs.com/package/react-progressive-graceful-image">react-progressive-graceful-image</a></li><li>Supports features like Custom Image Placeholder/Loader Component, srcset, lazy Loading, Graceful Loading, Progressive Image Loading.</li><li>Use of Intersection Observer and navigator.onLine (Better performance and Optimization)</li></ul><h3>Motivation</h3><p>I was working on an e-commerce PWA and you know what is there on an e-commerce platform? Images, more images and well, a lot more images. The truth is, with the increase in internet speed, images are everywhere now, be it e-commerce/social media/blog/news/dating or any other site.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*5Cn6Pwl_U0qwSCQjb0sHGQ.gif" /><figcaption>Image is Everything, Everything is Image — (Credit: Rockstar movie)</figcaption></figure><p>So what’s the big deal in loading images? Just make an <em>&lt;img src=path-to-image /&gt;</em> tag and done!! I am sure you are thinking it’s not even that easy. The problem is loading of an image takes time. Particularly, when there is a huge number of high-quality images on a single page.</p><h3><strong>Solutions</strong></h3><p>To give a better user experience, various things can be done:</p><ul><li>Image Placeholder — Keep a static image(png/svg) / a loader(gif) / a colored background div(usually grey) / a grey div with shimmer effect like the one below, until the real image is downloaded.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*shE9Vwcm-AiHynUfVIBuFQ.gif" /><figcaption>Image Loading with Shimmer effect animated placeholder</figcaption></figure><ul><li>Progressive JPEG — Use Progressive JPEG instead of a normal Baseline JPEG image, although it’s not much in the control of client-side code. Here is an example.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*Sd6bDFN6e-9-mvfvX9oXhQ.gif" /><figcaption>Baseline Image vs Progressive Image Loading</figcaption></figure><ul><li>Lazy Loading — Don’t load an image until it is visible or close to the viewport. Below gif explains it.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*7pj15y_Im6511iPaxSw3cA.gif" /><figcaption>Lazy loading</figcaption></figure><ul><li>Graceful Loading — Display the placeholder until the image is fully loaded and retry image loading even if network error happens(mostly when a device switches network for some reason like power/network failure).</li><li>Progressive Image Loading — Sites like medium, facebook, etc uses a tiny version of the real image with blur filter until the real image is downloaded and then uses some CSS transition to replace the tiny one. Here is an example.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/1*34x4V0cDOF2Wk3Mma-CrYA.gif" /><figcaption>Progressive Image Loading</figcaption></figure><ul><li>srcset attribute —used to let the browser automatically choose image based on device screen size and/or device pixel ratio(DPR).</li></ul><p>Huh? That’s a lot of information and so many things can be done. Now to build an &lt;Image/&gt; component in ReactJS with one or two of the above features is easy, but how about building an &lt;Image/&gt; component with all of the above features?</p><p><em>Drumroll, please!! Enter the savior, the superhero npm package…</em></p><blockquote><strong>npm i </strong><a href="https://www.npmjs.com/package/react-progressive-graceful-image"><strong>react-progressive-graceful-image</strong></a></blockquote><h3>Some FAQs</h3><ul><li>Why do we need various combinations together, why not implement just one variation, for example - Progressive Image Loading?</li></ul><p>— Let’s take an example. Home Page of an e-commerce has various sections, some with ads for which tiny images might be available. Since it’s a landing page that gets maximum eyeballs of visitors, hence better user experience is required. But “Search result page” or “Product description page” may serve images for which tiny images are not available(why you ask? One of the reasons, it’s costly). So we need let’s say, a grey div placeholder with shimmer effect. And as a developer, you don’t want to make multiple components for images. Similarly, there can be other use-cases. You get my point.</p><ul><li>Why do we use this npm package? Is there any other better package?</li></ul><p>— I found some really good packages like <a href="https://www.npmjs.com/package/react-shimmer">react-shimmer</a>, <a href="https://www.npmjs.com/package/react-graceful-image">react-graceful-image</a>, and <a href="https://www.npmjs.com/package/react-progressive-image">react-progressive-image</a> but honestly speaking, most of them lacked one or more important features. Like, <a href="https://www.npmjs.com/package/react-graceful-image">react-graceful-image</a> lacked shimmer effect and <a href="https://www.npmjs.com/package/react-progressive-image">react-progressive-image</a> lacked lazy-loading and graceful-loading. In fact, I started by forking <a href="https://www.npmjs.com/package/react-progressive-image">react-progressive-image</a> and adding new features from <a href="https://www.npmjs.com/package/react-graceful-image">react-graceful-image</a>. Later, I improved upon them.</p><ul><li>What about performance, optimization, and browser support?</li></ul><p>— Currently, the package size is <a href="https://bundlephobia.com/result?p=react-progressive-graceful-image@0.6.11">3.6kb</a>. I have used Intersection Observer for Lazy Loading (Better Performance) as compared to throttling scroll event listeners which run on the main thread. One big reason, Intersection Observer runs on a separate thread in the Browser. Read more about it <a href="https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API">here</a> and see it in action at <a href="https://www.npmjs.com/package/@researchgate/react-intersection-observer">@researchgate/react-intersection-observer</a> which is the only dependency of this package.</p><p>Also, the retry strategy for graceful loading in <a href="https://www.npmjs.com/package/react-graceful-image">react-graceful-image</a> was not quite optimized. It would also hang the screen sometimes when the device goes offline and a lot of image requests are sent simultaneously which would fail anyway. So I have used <a href="https://developer.mozilla.org/en-US/docs/Web/API/NavigatorOnLine/onLine"><em>navigator.onLine</em></a> based strategy for optimization.</p><p>In case Intersection Observer is not supported by a browser, its polyfill is available <a href="https://www.npmjs.com/package/intersection-observer">here</a>.</p><h3>Usage</h3><p>Great!! How do I use it? Any demo?</p><p>Here you go…</p><p><a href="https://codesandbox.io/embed/react-progressive-graceful-image-simple-example-h8jh4?fontsize=14&amp;hidenavigation=1&amp;theme=dark">react-progressive-graceful-image-simple-example - CodeSandbox</a></p><p>You can find more examples and documentation on <a href="https://www.npmjs.com/package/react-progressive-graceful-image">npm</a> or <a href="https://github.com/sanishkr/react-progressive-graceful-image">github</a>.</p><p>In case you find any issues or improvements, PRs and contributions are welcome on github.</p><p><strong>Extra Browny Stuff:</strong> Always use padding-percentage solution to wrap your custom &lt;Image/&gt; component to prevent any reflow and improve browser performance as explained in this <a href="https://medium.com/@rossbulat/lazy-image-loading-in-react-the-full-breakdown-4026619de2df">article</a>. <a href="https://gist.github.com/sanishkr/7f520f227989133a779eb49726bc77cb">Here is a small code snippet</a> to make the best use of this logic with this npm package.</p><p><em>Thank you for reading this article. Please share and clap if you liked it.</em></p><p><em>Let me know in the comments below if you want me to give more details about the code implementation of this npm package, as some have asked me personally.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c7a45b577f5f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React Components Tracking — Impressions and Clicks]]></title>
            <link>https://medium.com/@sanishkr/react-components-tracking-impressions-and-clicks-2fc9af1cc2c?source=rss-6f750e8a226e------2</link>
            <guid isPermaLink="false">https://medium.com/p/2fc9af1cc2c</guid>
            <category><![CDATA[intersection-observer]]></category>
            <category><![CDATA[tracking-user-activity]]></category>
            <category><![CDATA[viewport]]></category>
            <category><![CDATA[reactjs]]></category>
            <dc:creator><![CDATA[Sanish Kumar]]></dc:creator>
            <pubDate>Mon, 23 Sep 2019 11:59:53 GMT</pubDate>
            <atom:updated>2020-04-10T18:28:03.920Z</atom:updated>
            <content:encoded><![CDATA[<h3>React Components Tracking — Impressions and Clicks</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/1*npaDwrxcM7LVsi0eCKpMNw.gif" /><figcaption><a href="https://dev.to/maciekgrzybek/create-section-navigation-with-react-and-intersection-observer-fg0">https://dev.to/maciekgrzybek/create-section-navigation-with-react-and-intersection-observer-fg0</a></figcaption></figure><p>It all started one year back, around Aug ’18 for me. We had just launched our new marketplace of wedding vendors and service providers. Like every other B2C marketplace, our home page had few widgets(eg: Carousels, Category Links, Top Picks, Top X items in Top Selling Categories and Subcategories, Recently viewed items… etc). Some of the top carousels were paid advertisement by vendors.</p><p>Then there was SRP(Search result Page), and VDP(Vendor Description Page). Each had their own configuration of design with cards and widgets floating around dynamically.</p><p>Even some of the cards in SRP were boosted by some algorithm as they belonged to paid vendors.</p><p>Within a few days, we realized we needed a way to track all the views and clicks of every item appearing on the screen. In case you have seen your tweet’s analytics or if you have noticed impressions on your Instagram feed/stories (you need a business account), you will quickly understand what the need was or the direction in which we had to think.</p><p><strong>TL;DR</strong></p><p>We thought of some config, basic algorithm, made some API and used jQuery + waypoint to attach viewport tracking on each card item. Yeah, we were using vanilla JS back then. I am not going into details of it as it is not the best solution as compared to what I have built now.</p><h3>1 year later...</h3><p>Now I was working in an eCommerce workplace, and there came a similar requirement. Only this time, we were using ReactJS and I was supposed to track both clicks and impressions(views). Clicks tracking wouldn’t be an issue. So, I started the research about impressions tracking and came across <a href="https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API#Intersection_observer_concepts_and_usage"><strong><em>IntersectionObserver</em></strong></a> among other possible ways.</p><p>Before Intersection Observer arrived, this is what people used to do:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gaMluZieiwRR3HDyAVnNrg.png" /><figcaption><a href="https://hackernoon.com/tracking-element-visibility-with-react-and-the-intersection-observer-api-7dfaf3a47218">https://hackernoon.com/tracking-element-visibility-with-react-and-the-intersection-observer-api-7dfaf3a47218</a></figcaption></figure><p>Now, if you attach this above function to a scroll eventListener, it will work. But the only problem is the number of events fired per sec increases rapidly as you attach this to more number of elements, even when they are not in the viewport.</p><p>You might apply debouncing but it is still a performance issue and gives a lagging user experience.</p><p>What the heck is <strong><em>Intersection Observer?</em></strong></p><p>The Intersection Observer is an API provided by modern browsers to asynchronously observe changes in the intersection of a target element with an ancestor element or with a top-level document’s <a href="https://developer.mozilla.org/en-US/docs/Glossary/viewport">viewport</a>.</p><p>Let us first look into its use-cases. I mean, apart from <em>Ads Impression Tracking</em>.</p><ul><li>Lazy loading of images, or anything else for that matter, that will enter the viewport</li><li><a href="https://researchgate.github.io/react-intersection-observer/?path=/story/recipes--higher-order-component">Occlusion culling</a> — Rendering an object when we are about to enter the viewport edges</li><li><a href="https://buildingrecommenders.wordpress.com/2016/04/06/impression-discounting/">Impression discounting feedback</a> for recommendation systems</li><li>Infinite scrolling</li></ul><p>And it does all this without any performance or lagging issue. Now you are sold about the idea of it, right? Although, I am only going to talk about Ads impressions here. But, you may refer to links at the bottom of this post for other use-cases.</p><p>So, how does it work? Glad, you asked.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*9uJrogmlkRqAUWU9pH5-5g.png" /><figcaption><a href="https://hackernoon.com/tracking-element-visibility-with-react-and-the-intersection-observer-api-7dfaf3a47218">https://hackernoon.com/tracking-element-visibility-with-react-and-the-intersection-observer-api-7dfaf3a47218</a></figcaption></figure><p>It takes a <strong><em>callback</em></strong> as a parameter which is called when the element enters the viewport with the given threshold.</p><p>What are the options?</p><ul><li><strong><em>root</em></strong>: the relative element to which tracking should be done(or browser viewport by default)</li><li><strong><em>rootMargin</em></strong>: any relative margin you want to provide to root. <a href="https://researchgate.github.io/react-intersection-observer/?path=/story/examples--margin">Example</a></li><li><strong><em>threshold</em></strong>: a single number <em>between 0 and 1</em> or an array of numbers. Every time the threshold is reached, it will fire the callback function. You might trigger separate code based on each threshold as callback receives current intersectionRatio.</li></ul><p>Also, since we are doing impression tracking, our requirement might be to trigger the callback only when the component has enter ‘X%’ of it in the viewport and has stayed on the screen for at least ‘Y sec’. Looks like we need some customization. Let’s build a HOC(Higher Order Component). We will take both X(as in 100%) and Y(as in 1 second) as 1 in our example.</p><p>Also, since we are tracking Ads, we will be passing some data like tracker-id to the server log, which means we will be passing some custom `<em>data-attributes</em>` to the child component of HOC.</p><p>While we are at it, let’s also make clicks tracking a part of our HOC.</p><p>Also, clicks are required on even buttons(like: “Add to Cart” Button) but impressions are not necessarily. So, adding some optional props on our HOC.</p><p>To keep the code short, I will be using <em>@researchgate/react-intersection-observer</em> npm package.</p><pre>npm i @researchgate/react-intersection-observer</pre><p>It also exposes and <strong><em>unobserve</em></strong> function in callback which we can use if our requirement is to count only one impression per Component mount even if the user scrolls back to view the same component more than once.</p><p>So, here is our awesome HOC.</p><pre>import React, { Component } from &quot;react&quot;;</pre><pre>import Observer from &quot;@researchgate/react-intersection-observer&quot;;</pre><pre><br>class ImpressionClickTrackerHOC extends Component {</pre><pre>  handleChange = (event, unobserve) =&gt; {</pre><pre>    if (event.isIntersecting &amp;&amp; event.intersectionRatio &gt;= 1) {</pre><pre>     this.recordedTimeout = setTimeout(() =&gt; {<br>        // Send logs to server</pre><pre>        console.log(&quot;IMPRESSION&quot; , {</pre><pre>          ...event.target.dataset</pre><pre>        });</pre><pre>        /** Use this for only tracking once per mount **/</pre><pre>        // if (event.isIntersecting) {</pre><pre>        //  unobserve();</pre><pre>        // }</pre><pre>      }, 1000); // Assuming impression is valid only after 1 second</pre><pre>    return;</pre><pre>    }</pre><pre>    clearTimeout(this.recordedTimeout);</pre><pre>  };<br></pre><pre>  handleClick = event =&gt; {</pre><pre>     // Send logs to server</pre><pre>     console.log(this.props.clickEvent || &quot;UNKNOWN_CLICK_EVENT&quot;, {</pre><pre>      ...event.currentTarget.dataset</pre><pre>     });</pre><pre>  };<br></pre><pre>render() {</pre><pre>  return (</pre><pre>    &lt;Observer</pre><pre>      onChange={this.handleChange}</pre><pre>      onClick={this.handleClick}</pre><pre>      threshold={1}</pre><pre>      disabled={this.props.disableViewportTracking || false}</pre><pre>    &gt;</pre><pre>      {React.cloneElement(this.props.children, {</pre><pre>        onClick: this.handleClick</pre><pre>      })}</pre><pre>    &lt;/Observer&gt;</pre><pre>    );</pre><pre>  }</pre><pre>}</pre><pre>export default ImpressionClickTrackerHOC;</pre><ul><li>You can optionally pass ‘<em>disableViewportTracking’ </em>prop<em> </em>as<em> ‘true’</em> to disable impression tracking.</li><li>Also, it allows you to pass a custom click event name as ‘<em>clickEvent’.</em></li><li>Any other data related to tracker can be passed to the child component of the HOC as <em>data-attributes</em> and we will catch then as <strong><em>event.target.dataset</em></strong>.</li></ul><p>Here is an example of using our awesome HOC:</p><pre>&lt;ImpressionClickTrackerHOC</pre><pre>  clickEvent={`ADD-TO-CART`}</pre><pre>  disableViewportTracking={false}</pre><pre>&gt;</pre><pre>    &lt;div</pre><pre>      data-tracker-id={trackerId}</pre><pre>      data-display-name={displayName}</pre><pre>      data-listing-id={listingId}</pre><pre>    &gt;</pre><pre>       ...</pre><pre>    &lt;/div&gt;</pre><pre>&lt;/ImpressionClickTrackerHOC&gt;</pre><p><strong>Browser Support:</strong></p><p>At my point of writing, all major browsers have already started supporting this API. So, no problem at all. Worst case scenario: there is a <a href="https://github.com/w3c/IntersectionObserver/tree/master/polyfill">polyfill</a> available for this.</p><p>Reference Links:</p><ul><li><a href="https://www.npmjs.com/package/@researchgate/react-intersection-observer">https://www.npmjs.com/package/@researchgate/react-intersection-observer</a></li><li><a href="https://github.com/fkhadra/react-on-screen#demo">https://github.com/fkhadra/react-on-screen#demo</a></li><li><a href="https://www.npmjs.com/package/react-in-viewport">https://www.npmjs.com/package/react-in-viewport</a></li><li><a href="https://www.npmjs.com/package/spaniel">https://www.npmjs.com/package/spaniel</a></li><li><a href="https://hackernoon.com/tracking-element-visibility-with-react-and-the-intersection-observer-api-7dfaf3a47218">hackernoon.com/tracking-element-visibility-with-react-and-the-intersection-observer-api-7dfaf3a47218</a></li></ul><p><a href="https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API">Intersection Observer API - Web APIs | MDN</a></p><p>Other Good Reads:</p><ul><li><a href="https://github.com/w3c/IntersectionObserver/blob/master/explainer.md">https://github.com/w3c/IntersectionObserver/blob/master/explainer.md</a></li><li><a href="https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API/Timing_element_visibility">https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API/Timing_element_visibility</a></li><li><a href="https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API">https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2fc9af1cc2c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Yet another reason why a startup may never see the light of day]]></title>
            <link>https://medium.com/@sanishkr/yet-another-reason-why-a-startup-may-never-see-the-light-of-day-a85205851961?source=rss-6f750e8a226e------2</link>
            <guid isPermaLink="false">https://medium.com/p/a85205851961</guid>
            <category><![CDATA[failure]]></category>
            <category><![CDATA[entrepreneurship]]></category>
            <category><![CDATA[startup-failure]]></category>
            <category><![CDATA[startup]]></category>
            <dc:creator><![CDATA[Sanish Kumar]]></dc:creator>
            <pubDate>Sun, 17 Dec 2017 18:14:49 GMT</pubDate>
            <atom:updated>2021-12-01T18:40:35.895Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/335/1*UPzMFWApwcfmDIxar-elUg.png" /></figure><p>I have been trying to study the reasons for the failure of startups for a while. There are some quite common ones which everyone is aware of. But there are some other reasons for failure which one might not know.</p><p>Please note that the below reasons are not in any order but the mere existence of either of them in your startup may give you an equally hard time.</p><h4>1. Trying to achieve so much with so little of time &amp; resources</h4><p>This is a pretty common mistake with many of the startups. I know it&#39;s a hard time starting up but the plan should be well balanced or you may end up stressing up your employees and yourself as well.</p><p>First of all, focus on getting an MVP(minimum viable product) done. Then get the feedback from your target customer segment and start iterating on top of that as required based on priority.</p><p>Other important resources are the number of quality employees and the abundance of funds. You should try to get both of them as much as you wanna do a startup because they are the only fuels of a startup that keeps the engine running in healthy mode. If you don’t have enough funds, probably it is time you start looking for good investors. Ignore either of the above and chances are, you might freak out yourself one day. It is bitter but raw truth.</p><h4>2. Not so “focused” Upper Management</h4><p>In many of the cases, startups are founded by people like rich businessmen who already have a lot on their plates to handle in their daily lives.</p><p>In such cases, they get some new idea they want to implement as a new venture, but they fail to understand one very simple thing :</p><blockquote>A startup is like a fruit seed. You have to nurture it and take extreme care of it everyday to turn it into a giant tree with numerous fruits.</blockquote><p>If the upper management won’t take care of the daily needs, day-to-day progress and other similar issues, it is eventually bound to fail. Either it&#39;s them or they have to find a visionary CEO who truly understands the product/service being implemented, has to be there to resolve everyday needs for the team.</p><h4>3. Improper organisation in hierarchy</h4><p>I totally agree with the open working environment culture. It&#39;s really helpful but there has to be a proper organisation defined in hierarchy level as well. From day one, it has to be very clear among the employees who they report to and what their roles and responsibilities are.</p><p>In initial days of any startup, one has to wear many hats but it never means that things should not be clearly mentioned beforehand. Otherwise, it’s gonna be a big mess even within a small team.</p><p>What if there is an argument or dispute on any matter between two of the top executives(which usually happens), there has to be a ground-rule or it will end up in never-ending mess. And trust me, you can’t afford to have such things, especially in initial days of a startup.</p><p>One other point is, if you give top hierarchy in hands of wrong person, it would still end up being a failure. The people at the top of hierarchy has to set the benchmark for others to follow.</p><h4>4. Having unclear business model/plan/strategy</h4><p>This is just another very important point I have noticed with many of the startups in initial phase. I am not asking for a perfect business model. All I am asking for is to make a crystal clear business model so that after three months of starting up you don’t get confused by yourself between what you wanted to make and what you have created.</p><p>Once the basic model is done, you may now start iterating the model over time as per requirement. But the plan should always be clear in your head and so in the head of your top-level executives.</p><blockquote>Like it or not, there is a clear line between getting a million dollar idea and converting it into a successful startup.</blockquote><p>The very starting point of delayed launch or unorganized team or messed up product is bad strategy and vision by top executives. And in many of these cases, it leads to the failure of the startup even before it could start. In my opinion, it&#39;s always best to have a strategy planned over a timeline beforehand such as quarterly or half-yearly plans.</p><p>Now to track the progress, you may want to use agile concepts such as daily stand-ups and weekly sprints. Having an agile board set up online or offline helps to track and predict even the slightest of issues and forthcoming delays.</p><h4>5. Repeated delays in Product/Service Launch</h4><p>Think of it in this way :</p><blockquote>You know that your idea solves the problem to a customer segment. Imagine, by every passing day until your launch, you are loosing an opportunity to serve those people. So, basically every-time you drag or postpone your launch, you are loosing upon your business and probably someone else in the industry is gonna get benefit from that.</blockquote><p>It’s not only that. Setting a goal and working hard for it works well for you and your team as well, but with every delay you bring, you disturb your team’s synchronization. The team gets their hopes high for the launch. But it&#39;s really frustrating for them when you decide to keep dragging the launch date frequently. It also shows that you are not sure about your own execution and planning strategy which is really bad.</p><p>My suggestion, please have a proper planning and strategy before putting the team to work in the first place.</p><h4>6. Frequent changes in main model</h4><p>This point follows the previous two points.</p><p>In many of the successful startups, I have seen that they changed their initial business model to become successful. But it never means that you should keep changing your main model every time you meet up with your team. It directly reflects either of the two things: you actually don’t know what you want to build i.e, bad model planning or you are simply procrastinating due to some other silly reasons which is even worse.</p><p>Remember when you do this, you are actually wasting your time and resources and your employees’ as well. And once you build a viable business model, there is no point in changing the model before your product/service launch and getting feedback from the customers.</p><h4>7. Hiring immature and unworthy Talent for low cost</h4><p>During the initial setup process of any startup, there is always a lack of money with the founders. So, it&#39;s normal and humane for anyone to think that if they can get things done by spending less money then why to spend more.</p><p>But this is a trap, don’t fall for it. If you need to hire some employees for the initial stage, then probably it’s because you are not good enough at some particular field or maybe there is so much work to do that you can’t handle all by yourself. In either case, you need help, with someone you can be sure that they can handle their respective field of work with expertise without you having to babysit or whip every day. It also means that you need worthy and mature talents no matter the cost.</p><h4>8. Handing over top position to people with zero experience in related field</h4><p>This point has to be taken very seriously. This is very much related to the above point.</p><p>What’s one thing that separates top-level executives from other freshers in respective fields? The vision, expertise, knowledge, execution strategy, all of which comes from experience.</p><p>I am not saying that some fresh undergraduate can not do a startup, but I am saying is if you are hiring employees for taking care of some field in your startup(let’s say media and marketing), you need someone who knows how to do that very well, so you don’t have to be constantly worried about it and you focus on your part of work.</p><p>In many of the cases, you can end up hiring one with zero experience in a related field (maybe because of comparatively less cost/employee or for any other reason), and now they won’t be able to handle the pride of the top position assigned to them.</p><p>The team for which you have hired them looks up to certain qualities so that they can happily follow the lead. Instead, your top employee might end up simply bossing around whom none of their team members like to follow.</p><p>If you ask them why, maybe because the top-level executive doesn’t even know what he/she’s doing, the reason being zero experience.</p><h4>9. A team without proper co-ordination</h4><p>Continuing the above point, it all ends up making a huge mess.</p><p><em>The team works as its leader wants. Everything about a team reflects directly on its leader and vice-versa.</em></p><p>First, the leader has to set the standards for the team to follow and admire him/her.</p><p>Second, the leader shall never hire/keep a person in the team who doesn’t fit in appropriately, as the saying goes: <em>One rotten tomato ruins the whole basket</em>.</p><p>Third, the leader has should have proper management skills to keep the teamwork in sync with each other and get the job done in time.</p><p>Fourth but not last, it’s the responsibility of the leader to ensure job satisfaction among employees.</p><p>Now, if any of it goes wrong, it’s the leader who’s responsible. So, please make sure your top-level executives and managers are good leaders or it&#39;s never gonna happen.</p><p><em>Now that you’ve come this far reading, I know there is a spark in you to do a startup sooner or later. Please share it if you liked and give claps. And I hope you won’t let any of the above happen in your startup.</em></p><p><strong><em>Wish you all the very best for your startup!</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a85205851961" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[IPFS — learn and install]]></title>
            <link>https://medium.com/@sanishkr/ipfs-learn-and-install-c81f2a7be895?source=rss-6f750e8a226e------2</link>
            <guid isPermaLink="false">https://medium.com/p/c81f2a7be895</guid>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[ipfs]]></category>
            <category><![CDATA[internet]]></category>
            <category><![CDATA[https]]></category>
            <category><![CDATA[peer-to-peer]]></category>
            <dc:creator><![CDATA[Sanish Kumar]]></dc:creator>
            <pubDate>Sun, 19 Nov 2017 09:03:42 GMT</pubDate>
            <atom:updated>2017-11-19T10:59:34.455Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is IPFS? (Inter Planetary File System)</h3><h3>A peer-to-peer hypermedia protocol<br>to make the web faster, safer and more open.</h3><h3>What’s wrong with HTTP?</h3><p>HTTP is inefficient and expensive. HTTP downloads a file from a single computer at a time, instead of getting pieces from multiple computers simultaneously. With video delivery, a P2P approach could save 60% in bandwidth costs.</p><p>IPFS makes it possible to distribute high volumes of data with high efficiency. And zero duplication means savings in storage.</p><h3>Here’s how IPFS works</h3><p>Let’s take a look at what happens when you add files to IPFS:</p><p>Each file and all of the blocks within it are given a unique fingerprint called a <strong><em>cryptographic hash</em></strong>.</p><p>IPFS removes duplications across the network and tracks version history for every file.</p><p>Each network node stores only content it is interested in, and some indexing information that helps figure out who is storing what.</p><p>When looking up files, you’re asking the network to find nodes storing the content behind a unique hash.</p><p>Every file can be found by human-readable names using a decentralized naming system called <strong>IPNS</strong>.</p><h3><strong>A great source of motivation</strong></h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FBA2rHlbB5i0%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DBA2rHlbB5i0&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FBA2rHlbB5i0%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/609643ec8e9a34d07456612a8f045ffe/href">https://medium.com/media/609643ec8e9a34d07456612a8f045ffe/href</a></iframe><p>Towards the Permanent Web! HTTP has served us well, but its time to upgrade the way the Internet works. IPFS provides a solution for the ills of HTTP. It content addresses data instead of location addressing it, and provides more bandwidth, better latency, and more resiliency.</p><h3>IPFS — Insatllation on Windows</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FlFC9l2Za9i0%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DlFC9l2Za9i0&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FlFC9l2Za9i0%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/e854fccf0097816d3ad8b01e71f91339/href">https://medium.com/media/e854fccf0097816d3ad8b01e71f91339/href</a></iframe><ol><li>Download and Install Go from <a href="https://golang.org/dl/">https://golang.org/dl/</a></li><li>Download and extract Go IPFS from <a href="https://dist.ipfs.io/#go-ipfs">https://dist.ipfs.io/#go-ipfs</a></li><li>Copy ipfs.exe to Go/bin/</li><li>Run ipfs.exe and type “<strong><em>ipfs help”</em></strong> to check if it is working.</li></ol><p>Without further ado, let’s jump into an example of using IPFS. This demo shows you how to upload a file to IPFS node and how to see it in web browser.</p><h3>Using IPFS — Simple upload of a file on the network</h3><ul><li>Type in command: “<strong>ipfs init</strong>” to start</li><li>It gives you something like “ipfs cat /ipfs/QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG/readme”</li><li>Run the above output to check if readme is present</li><li>Run “<strong>ls /ipfs/</strong>QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG” to list all the files present in the node</li><li><strong><em>cd</em></strong> to the directory where the files you want to upload is present</li><li>“<strong>ipfs add ./PATH_TO_FILE</strong>” to add the file</li><li>Now we go online by typing “<strong>ipfs daemon</strong>” and enable the firewall if asked.</li><li>Hit “ <a href="http://localhost:5001/webui"><strong><em>http://localhost:5001/webui</em></strong></a><em>” </em>in the browser. Go to Connections, you should be able to see something like this.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CuBnv6O2tWVFgglZVNekPA.jpeg" /><figcaption>IPFS Web UI</figcaption></figure><ul><li>At any point of time if you’re connected to the network, you should be able to see the ipfs addresses of your peers by “<strong><em>ipfs swarm peers</em></strong>”</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FU7llhTZg05D8pLknjb41Q.jpeg" /><figcaption>IPFS daemon and swarm peers</figcaption></figure><p><strong>Note</strong>: <em>You have to keep the daemon process running as long as you want to use IPFS web UI and stay connected to peers and other nodes on IPFS network.</em></p><p>You can check more examples here <a href="https://ipfs.io/docs/examples/"><em>https://ipfs.io/docs/examples/</em></a></p><p>References:</p><ul><li><a href="https://ipfs.io/">https://ipfs.io/</a></li><li><a href="https://www.youtube.com/watch?v=BA2rHlbB5i0">https://www.youtube.com/watch?v=BA2rHlbB5i0</a></li><li><a href="https://www.youtube.com/watch?v=lFC9l2Za9i0">https://www.youtube.com/watch?v=lFC9l2Za9i0</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c81f2a7be895" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>