<?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 Bishwendu Kundu on Medium]]></title>
        <description><![CDATA[Stories by Bishwendu Kundu on Medium]]></description>
        <link>https://medium.com/@bishwenduk029?source=rss-58afda06e7f2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*B_VL_zCXKF_PWMqZ.</url>
            <title>Stories by Bishwendu Kundu on Medium</title>
            <link>https://medium.com/@bishwenduk029?source=rss-58afda06e7f2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 21:53:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bishwenduk029/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[Parcelify <MyComponent /> onto OpenFaas (serverless)]]></title>
            <link>https://medium.com/@bishwenduk029/parcelify-mycomponent-onto-openfaas-serverless-ca107d5d680d?source=rss-58afda06e7f2------2</link>
            <guid isPermaLink="false">https://medium.com/p/ca107d5d680d</guid>
            <category><![CDATA[server-side-rendering]]></category>
            <category><![CDATA[openfaas]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[parcel-js]]></category>
            <category><![CDATA[serverless]]></category>
            <dc:creator><![CDATA[Bishwendu Kundu]]></dc:creator>
            <pubDate>Sat, 09 Jun 2018 13:05:02 GMT</pubDate>
            <atom:updated>2018-06-09T23:04:15.851Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*2rgRm6hAqLu4jfl0u9vFYA.jpeg" /></figure><p>OpenFaas allows one to deploy their own serverless stack. The process of deploying the stack as a single node cluster is astonishingly easy and fast. Also the community provides templates in a majority of languages to clone from and build-deploy your own functions in your language of choice onto the serverless stack. No paying by hour, or by bytes, or by data, or by function invocation or by line of code executed or by beer per glass or whatever unit of pay one can think of to fill pockets/banks/swiss accounts etc. Your own serverless stack.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/356/1*SgmA4jjed80UmFSK825Vpw.gif" /></figure><p>To every DevOps guy’s amazement, OpenFaas is supported on both Docker Swarm and Kubernetes yes. So please refer the deployment guide <a href="http://docs.openfaas.com/deployment/docker-swarm/">here</a>. Also install the command line interface for faas <a href="https://docs.openfaas.com/cli/install/">from here</a>.</p><p>Now onto the coding</p><p>mkdir faas-trials</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WoX73xrFYYf8IaT4jyGHaQ.png" /></figure><p>The folder structure looks this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/1*wwwW9l9tqQHHPM8t4W_KaQ.png" /></figure><p>The function exported in handler.js, is actually executed in the docker container. Each request to the function will fork a new process inside the container to execute a nodeJS script(index.js) whose sole purpose is to call only the function exported from handler.js. The below file will be modifed going forward.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lg1X5g5hzh1IJf3eBB2asg.png" /></figure><p>The idea is that, this handler.js will be containing the minified version of our component and all it’s dependencies to produce a valid DOM string. Thus, on executing the handler function, we should get DOM version of the component.</p><p>In the grids folder let’s create our component’s folder as gridInStyle</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*sabcD9l4VgEpGE60riZWgQ.png" /></figure><p>Now we will code our component</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R-eq0wjyYet9w0OgDIu5yA.png" /></figure><p>style.js — Styled Components</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V82KgRDnPDWxr5NfgSAdJg.png" /></figure><p>The final index.js which will be used to build our handler.js</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*18zKILT80uaftcbvMSuzeg.png" /></figure><p><strong><em>Parcel.js</em></strong> to rescue, without any configuration or hi-fi setups, just build your component into handler.js. Below is our package.json</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*26JnAOzpN7uJeSnUt49yqQ.png" /></figure><p>Let’s build our component with yarn run build</p><p>If you have deployed OpenFaas docker swarm stack on same machine as the one you are developing your component on, then all you have to do is build and deploy onto the serverless stack.</p><p>Make sure you are in directory with the .yml file</p><p>faas-cli build -f grids.yml</p><p>After a couple of build steps, your image will be ready to be deployed</p><p>faas-cli deploy -f grids.yml</p><p>Hope you get 200 ok. Notice the URL in the message. It can now be used for hitting your function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cHaThIdSMihaTyzSOHdoLA.png" /></figure><p>The complete source code can be found at this <a href="https://github.com/bishwenduk029/react-faas.git">github repository</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ca107d5d680d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting greedy with JavaScript Reduce…. :)]]></title>
            <link>https://medium.com/@bishwenduk029/getting-greedy-with-javascript-reduce-363e43e30460?source=rss-58afda06e7f2------2</link>
            <guid isPermaLink="false">https://medium.com/p/363e43e30460</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[es6]]></category>
            <category><![CDATA[reducer]]></category>
            <dc:creator><![CDATA[Bishwendu Kundu]]></dc:creator>
            <pubDate>Sun, 19 Nov 2017 05:56:31 GMT</pubDate>
            <atom:updated>2017-11-19T05:56:31.549Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*J7rTsPMBGge-8YQpuIcNqw.gif" /></figure><p><em>Greedy approach </em>to problem solving in computer science can significantly improve the performance of the programs. If I target only one kind of problems say always keeping track of the best answer(which will depend on the context of a problem) over a single pass over an array of objects, then the solution will always have a<em> complexity of O(n)</em>. This is good given a few set of problems in which normal or brute-force approach would give us a solution of <em>complexity O(n²)</em>.</p><p>So basic idea is,</p><ol><li>) Iterate over each element in the array.</li><li>For each iteration, calculate the best possible answer based on current element and the previous best possible answer already calculated.</li><li>Also initialise, the best possible answer at the start of iterations.</li></ol><p>Wait but Array.prototype.reduce(), does all of that, except for point #2 which will depend upon the context of the problem. Ok so let’s consider the classical problem of maximising the profits from selling of stocks in a single day. Say we have stocks prices at particulars times of the market. The times of the market can be indices and values as stock prices. So say we have stockPrices as 10, 7, 5, 8, 11, 9 — then we know by buying at 5 and then selling at 11 we can get the maximum profit of 6. Also, the condition applied that you have to buy before selling no shorting.</p><blockquote>[some_array].<strong><em>reduce</em></strong>(some_function(accumulator, current_value), initial_value_of_accumulator);</blockquote><p>Now for the one-liner solution to the problem:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ffeb6c4764815b38264621e1fca84c2e/href">https://medium.com/media/ffeb6c4764815b38264621e1fca84c2e/href</a></iframe><p>So in a single pass and over each iteration, we are maintaining the best possible answer in the accumulator and finding the solution. Damn! that is beauty.</p><p>Let me know your thoughts on this, good or bad. If the approach sucks, or is useful in minimising code footprint. Until we meet again, take life one code at a time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=363e43e30460" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Async/Await into React……]]></title>
            <link>https://codeburst.io/async-await-into-react-79f154ea84b7?source=rss-58afda06e7f2------2</link>
            <guid isPermaLink="false">https://medium.com/p/79f154ea84b7</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[async]]></category>
            <category><![CDATA[asyncawait]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Bishwendu Kundu]]></dc:creator>
            <pubDate>Sun, 16 Jul 2017 06:30:14 GMT</pubDate>
            <atom:updated>2017-07-17T13:01:11.680Z</atom:updated>
            <content:encoded><![CDATA[<p>Magic is what Async/Await bring to the table for handling asynchronous requests. If we ponder more on asynchronous requests, they are requests made <strong><em>from</em></strong> our web page <strong><em>to</em></strong> some activity which is going to take it’s own time to respond. Sort of like a free willed activity, not caring for our application but responding at it’s own will at some later time. Our react component would be running in full energy .After mounting the described UI to the DOM, it goes ahead and asks the free willed activity : — -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*ADffRs8fT7QiDDnRJepvmQ.gif" /><figcaption>Requesting the Free Willed Activity</figcaption></figure><p>And meanwhile our free willed activity is like</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/354/1*IbWoJT22msXdgVqXAq69qQ.gif" /></figure><p>Unfortunately, our highly energetic react component will have to depend on promises. Thus, begins our journey of .then() &amp; .then() &amp; .then() &amp; .then() oh wait .catch() wait what .throw() &amp; finally .crazy().</p><p>But no worries now as Async/Await are here to rescue:</p><p>Let us first set up a local mock server which when requested will return some fake data like if the request is <a href="http://localhost:3000/HAPPY">http://localhost:3000/HAPPY</a> will return an array as [“PASSION”, “PEACE”, “COOL”]</p><p>So we are going to use a pre-built component network-vis which is based on vis.js to build another component which is going to fetch the fake data asynchronously and represent them as a set of nodes and edges. Each of those nodes when clicked can produce more nodes by fetching more data from server.</p><p>Package dependencies</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f6cb272606a63734499453a0156e3848/href">https://medium.com/media/f6cb272606a63734499453a0156e3848/href</a></iframe><p>Now our new component</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c3c0b61c0c30c65eb8d76d6ca29de9c3/href">https://medium.com/media/c3c0b61c0c30c65eb8d76d6ca29de9c3/href</a></iframe><p>So handleNodeClick is the method which is invoked every time a node is clicked in the Network component.We have defined the function to be asynchronous by adding the keyword <strong><em>async </em></strong>before the function definition. Inside the function definition we are using try/catch block. We are trying to to do something, but in the event that something is not triggered we log the failure to console in the catch block. The keyword <strong><em>await </em></strong>is used to wait for the activity which here is a promise of fetching data from remote server. So it seems as if the function execution stops here and waits for the promise fulfilled before continuing with the execution.</p><p>The above explanation is not what is actually happening on the inside. But to developer this explanation suffice. The function is asynchronous and it waits for a promise to complete and then continues with normal execution. Where did the callback? It is happening on the inside now I as a developer <strong><em>Don’t Care!!!. </em></strong>Our final output after clicking on HAPPY</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*YjHWTnR7aR5b6nmivdm-Yg.png" /></figure><p>Now click Peace</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*xxnWF5h0DJFxN5tWGTG1GQ.png" /></figure><p>Git repo for the code is at <a href="https://github.com/bishwenduk029/arsenal">https://github.com/bishwenduk029/arsenal</a></p><p>Please do leave your comments and if you think my understanding is wrong do help me out. I am just a beginner fiddling with magic, quite possible some of them may backfire.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=79f154ea84b7" width="1" height="1" alt=""><hr><p><a href="https://codeburst.io/async-await-into-react-79f154ea84b7">Async/Await into React……</a> was originally published in <a href="https://codeburst.io/">codeburst</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[EkApp — One app for all your needs]]></title>
            <link>https://medium.com/@bishwenduk029/ekapp-one-app-for-all-your-needs-https-play-google-com-store-apps-details-id-ekrupiya-5ea8d1b02cbe?source=rss-58afda06e7f2------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ea8d1b02cbe</guid>
            <category><![CDATA[maps]]></category>
            <category><![CDATA[community]]></category>
            <category><![CDATA[crowdfunding]]></category>
            <category><![CDATA[payments]]></category>
            <category><![CDATA[navigation]]></category>
            <dc:creator><![CDATA[Bishwendu Kundu]]></dc:creator>
            <pubDate>Sat, 15 Jul 2017 04:20:54 GMT</pubDate>
            <atom:updated>2017-07-15T04:30:31.191Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://play.google.com/store/apps/details?id=ekrupiya.sombrerotech.in">https://play.google.com/store/apps/details?id=ekrupiya.sombrerotech.in</a></p><p>India in past few years has witnessed a sudden explosion of mobile users. This exponential growth in mobile users has also given birth to an ecosystem of mobile application startups. With Indian government, providing an economic support to this ecosystem, has allowed many startups to nurture their ideas into full blown apps solving the everyday problems of our lives.</p><p>In fact, Indian government has embraced this culture of innovation and depending upon mobile applications to solve common problems. NPCI has designed a new payments platform that enables any two persons to transact money instantaneously in real time by only knowing each other’s UPI address. This just plain awesome. No more asking for each other’s bank details or adding into a beneficiary list then waiting for x-number of business days before you could start transacting with your beneficiary.</p><p>Now imagine if any two people can transact money in an instant, then these transactions don’t have to be on a one to one basis. They can also be conducted on a many to one basis. Voila!! CROWDFUNDIND. Now a group of people send money in an instant to any one individual without any third party involvement. The money goes from one bank account into another and there are no intermediary accounts.</p><p>A perfect use case of crowdfunding. This is what EkApp offers. Raise a request. The request by default will be of Rs. 1 Lakh. Once the request goes live, it will be displayed in the App to whole India. People can then contribute to your request in denominations of Rs. 5. Only one request goes live at a time while the rest wait in queue for the live request to complete. The requests are queued on a first come first serve basis. In order to be eligible for raising a request you have to contribute to one request at least Rs.5. Crowdfunding with community sharing of wealth</p><p>The App also allows users to share their location with public. Let’s say for example you are travelling in a bus. You could share your location as bus by providing the bus number. So now anyone within their 5 miles radius can now view the bus and know whether it is coming towards him/her or has already passed. Thus, the stress, if the bus is coming or has already crossed the stop is now over. Live bus tracking achieved with community sharing of live location.</p><p>In future App will allow users to share their locations as various service providers like plumbers, mechanics, carpenters , beauticians etc. Local vendors can even share location based offers as and when they provide discounts and all. Just waiting on funding to take the App to the next level. Live offers and services which are rated by community reviews, this establishing the credibility of the offered services and offers..</p><p>Please do leave your comments about what you think, and if we need such an app which is powered by community or if such an app has any future?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ea8d1b02cbe" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>