<?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 Saheel Sapovadia on Medium]]></title>
        <description><![CDATA[Stories by Saheel Sapovadia on Medium]]></description>
        <link>https://medium.com/@savvysaheel?source=rss-14eed5229592------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*xbxwB1vwp1VnAVsrnK7UPg.jpeg</url>
            <title>Stories by Saheel Sapovadia on Medium</title>
            <link>https://medium.com/@savvysaheel?source=rss-14eed5229592------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 22:32:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@savvysaheel/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[Rank Top 10 Items by Views]]></title>
            <link>https://savvysaheel.medium.com/rank-top-10-items-by-views-225d01d71659?source=rss-14eed5229592------2</link>
            <guid isPermaLink="false">https://medium.com/p/225d01d71659</guid>
            <category><![CDATA[pipeline]]></category>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[mongodb-atlas]]></category>
            <category><![CDATA[aggregation]]></category>
            <dc:creator><![CDATA[Saheel Sapovadia]]></dc:creator>
            <pubDate>Wed, 10 Feb 2021 05:32:15 GMT</pubDate>
            <atom:updated>2021-02-10T06:34:18.705Z</atom:updated>
            <content:encoded><![CDATA[<h4>MongoDB Aggregation Pipeline | MongoDB Atlas | MongoDB Shell</h4><h4>Using CRUD Operations &amp; Aggregation pipelines for processing data stored in mongodb documents and collections</h4><p>To cut the long story short, I am developing a Novel reading website and want a feature similar to what Netflix has- <em>Today’s Top 10. </em>For that some sort of data processing is required which would run on all the documents of Novels Collection stored in my MongoDB database.</p><h4>Run Commands in mongosh</h4><p>For documentation of basic MongoDB operations in mongosh, see:</p><ul><li><a href="https://docs.mongodb.com/mongodb-shell/crud">Perform CRUD Operations</a></li><li><a href="https://docs.mongodb.com/mongodb-shell/run-agg-pipelines">Run Aggregation Pipelines</a></li><li><a href="https://docs.mongodb.com/mongodb-shell/reference/methods">mongosh Methods</a></li></ul><p>There are a number of ways you can perform operations and run pipelines and the one which I’ll be using is a VS Code extension. You can get the information from the below link-</p><p><a href="https://docs.mongodb.com/mongodb-vscode/">MongoDB for VS Code - MongoDB for VS Code</a></p><p>The whole process of installing, connecting and exploring all the features is very well documented.</p><h4>Lets Begin</h4><p>Our use case requires Sorting all the Novels in descending order by the views field, retrieving the top 10 from the result and storing those in another Collection.</p><p>For this we’ll use something called Aggregation Pipelines.</p><p><em>What is aggregation?</em></p><p><a href="https://docs.mongodb.com/manual/aggregation/">Aggregation - MongoDB Manual</a></p><h4>Run Aggregation Pipelines</h4><p>There are Aggregation Pipelines Stages. Documents pass through the stages in sequence. Each stage is responsible for a task of its own.</p><p>In our case we’ll use <a href="https://docs.mongodb.com/manual/reference/operator/aggregation/sort/#pipe._S_sort">$sort</a> to sort all the Novels, then <a href="https://docs.mongodb.com/manual/reference/operator/aggregation/limit/#pipe._S_limit">$limit</a> to limit the number to top 10 only and then <a href="https://docs.mongodb.com/manual/reference/operator/aggregation/out/#pipe._S_out">$out</a> to write the resulting documents of the pipeline to a collection. These all are called the <em>stages</em> of our pipeline.</p><p>My Novel document-</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/de658937514edcd9f25b2e8abeebbd64/href">https://medium.com/media/de658937514edcd9f25b2e8abeebbd64/href</a></iframe><p>MongoDB Playground file-</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/93c8cf96c5b89351825cd74715061a8b/href">https://medium.com/media/93c8cf96c5b89351825cd74715061a8b/href</a></iframe><blockquote>This code will result in <strong>[] </strong>because the output is stored in the ‘topNovels’ collection as specified in the last stage. For testing purposes /in-development stage exclude the <a href="https://docs.mongodb.com/manual/reference/operator/aggregation/out/#pipe._S_out">$out</a> stage to verify the results in Result Tab. Also, I have set the limit to 2 because currently there aren’t enough novels in the collection 😁😅</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UCRRddbD_UEvojXXdf9IfQ.png" /><figcaption>MongoDB Playground</figcaption></figure><p>This was all you need to do to get your top whatever items in any fashion you want.</p><h4>Fun Part</h4><p>In the cloud console of MongoDB Atlas in collections tab you’ll find Aggregation tab, where you can set all the stages and obtain the results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1n1n4EImftB5nibwOR_Ppg.png" /><figcaption>Mongo Atlas</figcaption></figure><ol><li><a href="https://docs.mongodb.com/manual/reference/operator/aggregation/sort/#pipe._S_sort">$sort</a> stage -</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NnKIXDsxr5Wo0oQPHB9Fvg.png" /><figcaption>sorting</figcaption></figure><p>2. <a href="https://docs.mongodb.com/manual/reference/operator/aggregation/limit/#pipe._S_limit">$limit</a> stage -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*obquCocnutDhqDF8dVmXog.png" /><figcaption>limiting</figcaption></figure><p>3. <a href="https://docs.mongodb.com/manual/reference/operator/aggregation/out/#pipe._S_out">$out</a> stage -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tYb6Mv6zVW0SiT2Qg-RUtA.png" /><figcaption>storing results to specific location</figcaption></figure><blockquote>Though you can see the ‘Add Stage’ option after the $out stage, but technically the $out stage has to be the last one in the Aggregation Pipeline.</blockquote><p>I referred a few documentations and resources to understand and complete the task. Those who are new to this, this article will definitely save you from getting lost and save your precious learning hours.</p><p><em>Thanks for reading this article! Leave a comment below if you have any questions. Make sure to give this post </em><strong><em>50 claps </em></strong><em>and a </em><strong><em>follow</em></strong><em> if it really helped you and if you want to see more.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=225d01d71659" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Most Simple C++ Program for Parity-Bit & Vertical and Longitudinal Redundancy Check]]></title>
            <link>https://savvysaheel.medium.com/most-simple-c-program-for-parity-bit-vertical-and-longitudinal-redundancy-check-9332d3027646?source=rss-14eed5229592------2</link>
            <guid isPermaLink="false">https://medium.com/p/9332d3027646</guid>
            <category><![CDATA[paritybit]]></category>
            <category><![CDATA[error-detection]]></category>
            <category><![CDATA[lrc]]></category>
            <category><![CDATA[vrc]]></category>
            <dc:creator><![CDATA[Saheel Sapovadia]]></dc:creator>
            <pubDate>Mon, 14 Sep 2020 11:08:32 GMT</pubDate>
            <atom:updated>2020-09-14T11:08:32.161Z</atom:updated>
            <content:encoded><![CDATA[<h4>Error Detection Technique in Networking</h4><h4>Error detection technique to detect errors in a received data block or frame by the receiver.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QEadcTTkuNs1kWBjcnP3Ag.jpeg" /><figcaption>unsplash</figcaption></figure><p><em>This started as an assignment of my DCN(Data and Communication Networks) lab to write a program(in C++) to add parity bit to carry out VRC and LRC on data stored in a text file in binary format. It was something real which made it kind of interesting for me, hence I thought of sharing it with you guys.</em></p><p>When a frame is transmitted from a transmitter to the receiver, there are two possibilities, either the frame is received without error or its received with error (bad frame).</p><ul><li>Error detection techniques help in detecting errors in a received block or frame by the receiver.</li><li>Once the error is detected, receiver informs the transmitter to re-transmit the same frame again.</li><li>Error detection can be made possible by adding redundant bits in each frame during transmission. Based on all the bits in the frame (i.e. data + error check bits), receiver is capable of detecting errors in the frame.</li></ul><h3><strong>Parity check or Vertical Redundancy Check (VRC) method</strong></h3><p>The parity bit can be set to 0 and 1 depending on the type of the parity required.</p><ul><li>For even parity, this bit is set to 1 or 0 such that the no. of “1 bits” in the entire word is even. Shown in fig. (a).</li><li>For odd parity, this bit is set to 1 or 0 such that the no. of “1 bits” in the entire word is odd. Shown in fig. (b).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*-n9HRSJKgHj9kq5EVepL-g.png" /></figure><p>Here is how I combined every part to get the results -</p><p>As we are dealing with some sort of data-storage(Text file in my case), we must know the arrangement and organization of the data in it. It would help us create the link to our local variables upon which the algorithm or the operation would be executed.</p><p>The basic steps into which I have divided the whole program are-</p><ol><li>Extraction of data</li><li>Processing the data</li><li>Output the data after Filtering</li></ol><h4>Extraction of data</h4><p>The getline() function on top of a while loop extracts all the data line-wise and stores it in the local data array val[].</p><h4>Processing the data</h4><p>Converting each unit of data into an integer and calculating the result(obj : res) according to our requirements i.e. either vertically or horizontally.</p><h4>Output the data after Filtering</h4><p>Using the most basic computer filtering mechanism if-else, filter out the processed data of the “res” object. Either print the temporary result or adjust any variable.</p><h4>SOME REAL CODE NOW</h4><p>Data File for VRC -</p><pre>0100110<br>1110001<br>1100101<br>0000000<br>//Each line contains one set, called as a Frame.</pre><p>C++ Code-</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a1352cb1d8f15791caa5f70ffda77512/href">https://medium.com/media/a1352cb1d8f15791caa5f70ffda77512/href</a></iframe><h3>Longitudinal Redundancy Check</h3><p>In this method Block of bits organized in tables e.g rows and columns and then the parity bit for each column is calculated. The set of this parity bit is also send along with the original data. From this block of parity we can check the redundancy.</p><p>Data File for LRC-</p><pre>01001101<br>11100011<br>11001011<br>00000001<br>//Each line contains one set, called as a Frame.</pre><p>C++ Code-</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e5696d20af59f2787082e178d00fac06/href">https://medium.com/media/e5696d20af59f2787082e178d00fac06/href</a></iframe><p><em>As I was the one who created the program and also the data file, I took the liberty to arrange the data_array line-wise to make things a little straightforward and easy but with some string handling you can modify the code according to your requirements.</em></p><p>Feel free to check out the link to my GitHub repository where I have uploaded all the necessary files -</p><p><a href="https://github.com/saheelsapovadia/Parity-Bit-VRC-LRC">https://github.com/saheelsapovadia/Parity-Bit-VRC-LRC</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9332d3027646" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>