<?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"><channel><title><![CDATA[Arnab Sen's Technical blogs]]></title><description><![CDATA[Software Developer @ Google • Tech blogger 

Read more about me: arnabsen.dev/about
Resume: resume.arnabsen.dev]]></description><link>https://arnabsen.dev</link><generator>RSS for Node</generator><lastBuildDate>Tue, 14 Apr 2026 18:27:02 GMT</lastBuildDate><atom:link href="https://arnabsen.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Genesis of Google's Web Ranking Dynasty]]></title><description><![CDATA[Hi, glad you landed on this blog. I am Arnab Sen, a Software Engineer at Google. In our previous blog, we delved into the intriguing world of Graph Databases and their inner workings. Today, we'll take a detour from the technical details to explore a...]]></description><link>https://arnabsen.dev/pagerank</link><guid isPermaLink="true">https://arnabsen.dev/pagerank</guid><category><![CDATA[Tutorial]]></category><category><![CDATA[Google]]></category><dc:creator><![CDATA[Arnab Sen]]></dc:creator><pubDate>Sat, 29 Jun 2024 17:39:07 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1719682493972/334d8445-6e87-4d62-b415-ba44deaac2e0.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hi, glad you landed on this blog. I am Arnab Sen, a Software Engineer at Google. In our previous blog, we delved into the intriguing world of Graph Databases and their inner workings. Today, we'll take a detour from the technical details to explore a practical application of Graphs – PageRank, the algorithm that powers Google Search!</p>
<h2 id="heading-introduction">Introduction</h2>
<p>Imagine the internet before Google. It was a bit like a sprawling, uncharted territory. When <strong>Sir Tim Berners-Lee</strong> first created the World Wide Web, he actually kept a list in the back of his notebook, of which new websites that came online.</p>
<p><img src="https://cds.cern.ch/images/CERN-GE-9407011-31/file?size=large" alt="Tim Berners-Lee" /></p>
<p>Then search engines emerged to make it easy to find relevant websites. Early search engines like Yahoo! relied on humans to categorize websites, resulting in often inaccurate or incomplete results.</p>
<p><img src="https://www.researchgate.net/publication/225284426/figure/fig1/AS:302806805303299@1449206176271/Yahoo-Search-Engine.png" alt="Yahoo Search Engine | Download Scientific Diagram" /></p>
<p>Searching for information was a tedious and often frustrating process. It was clear that a better way was needed to navigate the ever-growing expanse of the web.</p>
<p><img src="https://media.wired.com/photos/5de6deca453df400086ddd80/master/pass/Biz-google-524309146.jpg" alt="Larry Page and Sergey Brin Hand Over Alphabet's Reins | WIRED" /></p>
<p>Enter Larry Page and Sergey Brin, two Stanford PhD students with a radical idea. They envisioned a search engine that would rank websites not just by keywords, but by their importance and relevance within the vast network of the web. This was the birth of PageRank, a trillion dollar algorithm that would propel Google to become the dominant force it is today.</p>
<p><img src="https://cdn.statcdn.com/Infographic/images/normal/29267.jpeg" alt="Chart: Google's Search Dominance | Statista" /></p>
<p><a target="_blank" href="https://www.cis.upenn.edu/~mkearns/teaching/NetworkedLife/pagerank.pdf">Link to the paper: The PageRank Citation Ranking</a></p>
<h2 id="heading-mapping-the-web"><strong>Mapping the Web</strong></h2>
<p>Most webpages link to other <em>relevant</em> webpages. For example, this page links to the original paper. When the paper was written, the web had 150 million pages and 1.7 billion links. Each page can be seen as a node, and the links as edges connecting one node to another.</p>
<p>So, if webpages A and B links to webpage C it should look something like this:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719677943108/dbb77578-26f9-49ae-926b-cdbb74c22bce.png" alt class="image--center mx-auto" /></p>
<p>Here A and B are called backlinks of C.</p>
<p><strong>Why are these backlinks important?</strong> The idea is that "<mark>highly linked pages are more important than pages with few links.</mark>" For example, many blogs and articles about PageRank will link to the original paper, supporting the hypothesis that the original paper is more important. This is similar to citations in academic research; usually, the more impactful a publication is, the more it gets cited.</p>
<p>Another observation the authors pointed out is that any <mark>outgoing links from these relatively important pages should also be given higher importance</mark>. PageRank tries to determine how well the importance of a page can be estimated from its link structure.</p>
<p>PageRank's brilliance lies in its smart use of a mathematical concept called the Markov Chain.</p>
<p>Mathematically, a <strong>Markov Chain</strong> is a model that describes a sequence of possible events where the probability of each event depends only on the state attained in the previous event. It's like a random walk where your next step is determined by a set of probabilities associated with your current location.</p>
<p>First, let's understand how the author of the papers defines <strong>PageRank</strong>.</p>
<h2 id="heading-defining-pagerank"><strong>Defining PageRank</strong></h2>
<p>If a webpage A has 4 outgoing links, the <code>Rank(A)</code> is divided equally among the 4 links. So, if webpage C has backlinks from 2 different webpages, then the <code>Rank(C)</code> will be the sum of the ranks from each link.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719678250800/362c8de3-de36-4b49-90b6-24c05ba85cc5.png" alt class="image--center mx-auto" /></p>
<p>More formally:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719678757791/7a5f7c0b-fc0e-44e7-b9e5-eae489050616.png" alt class="image--center mx-auto" /></p>
<blockquote>
<p>The paper includes a constant factor but let's keep things simple for now.</p>
</blockquote>
<p>But then how do we get the Ranks of <code>a.com</code> and <code>b.com</code>? Well, we do the same process, recursively.</p>
<p>What if there is an outgoing link from <code>c.com</code> to <code>a.com</code>? Then once we get the rank of <code>c.com</code> we have to recompute the rank of <code>a.com</code>? This is a stochastic process, and we can use the mathematical model of Markov Chains for that.</p>
<p>And the PageRank formula described above can be represented using matrices as follows. At any point we can define A as a square matrix with the rows and columns corresponding to the web pages.</p>
<pre><code class="lang-c"><span class="hljs-keyword">if</span> (page u <span class="hljs-keyword">and</span> v are connected):
    A[u][v] = <span class="hljs-number">1</span>/N[u]; <span class="hljs-comment">// N(u): is the number of outgoing links from u</span>
<span class="hljs-keyword">else</span>:
    A[u][v] = <span class="hljs-number">0</span>
</code></pre>
<p>If R is a vector over all the webpages then we can describe it as:</p>
<p><strong>R = cAR</strong></p>
<p>Here c is a normalization factor, to ensure that the total rank of all webpages is constant. And we can keep computing this until we don’t see any change in the value of the vector R. That final value is called the <strong>Stationary Distribution of a Markov Chain</strong>. But will that always exist? To know we first have to understand a few more terms:</p>
<h3 id="heading-reducible-markov-chains"><strong>Reducible Markov Chains</strong></h3>
<p>A Markov chain is considered reducible if its states can be divided into two or more disjoint sets, where it's impossible to move from one set to another. In other words, there are "barriers" within the chain that prevent transitions between certain groups of states.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719679409655/5f9e7954-a96e-4e6e-95f7-7eba66c1196c.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-periodic-markov-chains"><strong>Periodic Markov Chains</strong></h3>
<p>A Markov chain is considered periodic if there is a fixed pattern or cycle in the way it revisits certain states.</p>
<p>In both these cases, finding a stationary distribution becomes tricky.</p>
<h3 id="heading-problem-of-rank-sink"><strong>Problem of Rank Sink</strong></h3>
<p>But we have another problem. Consider this case, <code>b.com</code> points to <code>a.com</code>. But <code>a.com</code> points only to <code>c.com</code> and <code>c.com</code> points only to <code>a.com</code>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719679545298/83234534-7de0-42c3-8f2f-e3a7864bce1c.png" alt class="image--center mx-auto" /></p>
<p>What will eventually happen is all the rank from the entire chain will get trapped in this cycle b/w <code>a.com</code> and <code>b.com</code>. The loop forms a trap which is called the <strong>rank sink</strong>.</p>
<p>The authors tackled these ingeniously by a method called...</p>
<h2 id="heading-random-surfer-model"><strong>Random Surfer Model</strong></h2>
<p>Sounds fancy, but it's simple. Just think from what you would do in such a scenario. If you visit a webpage that has just one link to another webpage, and that page then links to the original webpage. Will you keep clicking and going in loops? Obviously not, you will just go to a different page. This is what a random surfer model will do. Occasionally a random surfer will get bored and then jump to a random page chosen based on a distribution.</p>
<p>This super simple solution is enough to tackle all the problems we described above. </p>
<p>Mathematically, we can assume that there is an outgoing node from every node to every other node. And then to compensate for this extra link, we can tweak the factor <code>c</code> to again normalize the metrics.</p>
<h2 id="heading-lets-dive-into-the-implementation"><strong>Let's dive into the Implementation</strong></h2>
<p>So, there are two parts of this search engine problem. First we need to have the database of all the links to create the Markov Chain in the first place. This is done by a program called <strong>Crawler</strong>.</p>
<p>Then comes the actual PageRank implementation. And here the steps:</p>
<ol>
<li><p>Convert each URL to an unique integer ID and store the mapping in a database.</p>
</li>
<li><p>Sort the link structure by Parent ID.</p>
</li>
<li><p>Remove all the dangling links. (Dangling links are those pages that have no outgoing link. Removing these links have no effect on the final distribution)</p>
</li>
<li><p>Have an initial assignment of ranks.</p>
<ul>
<li>The initial assignment won’t really affect the final results as we saw that Ergodic Theorem guarantees an unique stationary distribution, but it will affect how quickly we can reach the final state i.e the rate of convergence.</li>
</ul>
</li>
<li><p>The original implementation used single precision floating point values at 4B each. So, for 75 million URLs it amounted to 300 MB.</p>
<ul>
<li>In terms of scalability, if a point comes where memory available is insufficient to hold the weights, the previous weights can be stored in disk and then accessed linearly.</li>
</ul>
</li>
<li><p>Finally once convergence is reached, the dangling links are attached back.</p>
</li>
</ol>
<p>When the paper was released this whole process took around 5 hrs.</p>
<p>On a large 322 million link database the convergence took around 52 iterations. The convergence on half the data took around 45 iterations, which shows that this PageRank algorithm can scale very well even for large collections as the scaling factor is roughly linear in <em>logn</em>. The authors admitted that the cost required to compute the PageRank is far insignificant compared to the cost required to build a full text index.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719681737552/f2a0943e-1198-46b8-86ed-b0b57b9689ec.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-early-results"><strong>Early Results</strong></h2>
<p>To initially test the usefulness of PageRank the authors implemented a search engine which used just 16 million web pages and performed just title based search and then sorted the results by PageRank.</p>
<p>Here is an example of the search result for the term “University”. On the left we have the PageRank algorithm and on the right we have another popular search engine at that time, Altavista.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1719681806943/ba6af2fc-f45a-4086-95c7-4380858fa824.png" alt class="image--center mx-auto" /></p>
<p>PageRank returns the home page of Stanford as the top result (since the initial PageRank was built from Stanford, it is understandable that most webpages had outgoing links to the Stanford homepage). You can also see the PageRank value normalized to 100% as the red progress bar next to each link. In contrast, Altavista returned random-looking webpages that matched the query "University."</p>
<h2 id="heading-the-story-behind-the-name"><strong>The story behind the name</strong></h2>
<p><img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTDQsQYLiTdolE0YOkbMHfiVnGDHOyJgmsVeg&amp;s" alt="Before Facebook became Meta, Google was BackRub, Amazon was Cadabra..." class="image--center mx-auto" /></p>
<p><strong>BackRub</strong> was the initial name given to the search engine that would later become Google. The name "BackRub" actually reflects the core mechanism behind the search engine's algorithm, can you guess?</p>
<p>Yes, "backlinks".</p>
<p>The name "BackRub" was eventually dropped in favor of "Google" in 1997. The new name was inspired by the mathematical term "googol," which represents the number 1 followed by 100 zeros, symbolizing the vast amount of information that the search engine aimed to organize and make accessible.</p>
<p>In one of the <a target="_blank" href="https://googleblog.blogspot.com/2008/07/we-knew-web-was-big.html">blogs</a> published by Google in 2008, they mentioned that “by 2000 the Google index reached the one billion mark. Recently, even our search engineers stopped in awe about just how big the web is these days -- when our systems that process links on the web to find new content hit a milestone: 1 trillion (as in 1,000,000,000,000) unique URLs on the web at once!”.</p>
<h2 id="heading-conclusion"><strong>Conclusion</strong></h2>
<p>The tale of PageRank is a fascinating journey through the early days of the web, where two Stanford PhD students laid the foundation for what would become the world's most powerful search engine.</p>
<p>I'm still constantly amazed by the sheer scale at which this algorithm operates, processing trillions of webpages and billions of searches every day. PageRank's legacy continues to shape how we access information, discover new ideas, and connect with others across the globe.</p>
<p>I hope this exploration into the inner workings of PageRank has shed light on the brilliance behind this groundbreaking algorithm. It's a story of how a simple idea, combined with rigorous mathematical principles, revolutionized the way we navigate the vast landscape of the World Wide Web which we kind of take for granted.</p>
<p>If you like my blogs, do follow me and subscribe to my newsletter for more such informative bits.</p>
]]></content:encoded></item><item><title><![CDATA[Graph Databases 101: Guide to Understanding Connected Data]]></title><description><![CDATA[Traditional databases often struggle to model and query complex interconnected data. This is where graph databases come in, offering a powerful way to represent and navigate relationships. In this blog series, we will dive into a high level idea of w...]]></description><link>https://arnabsen.dev/graph-databases-101-guide-to-understanding-connected-data</link><guid isPermaLink="true">https://arnabsen.dev/graph-databases-101-guide-to-understanding-connected-data</guid><category><![CDATA[Tutorial]]></category><category><![CDATA[System Design]]></category><category><![CDATA[Databases]]></category><category><![CDATA[backend]]></category><dc:creator><![CDATA[Arnab Sen]]></dc:creator><pubDate>Sun, 02 Jun 2024 16:32:26 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1717345772687/92fba269-2936-4180-b6a5-68e844656afa.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Traditional databases often struggle to model and query complex interconnected data. This is where graph databases come in, offering a powerful way to represent and navigate relationships. In this blog series, we will dive into a high level idea of what's all the fuss about graph databases.</p>
<p>A quick disclaimer: Don't worry if you're not a graph theory expert. You can still follow and discover the potential of this technology.</p>
<h2 id="heading-traditional-databases-a-world-of-records-and-transactions"><strong>Traditional databases: a world of Records and Transactions</strong></h2>
<p>The early days of computing were dominated by structured data like inventory records and financial transactions. Relational databases, with their tables and rows, were the perfect tool for this kind of information. These data were mainly discrete and traditional relational databases would suffice such kind of data.</p>
<p>However, the internet revolutionized the data landscape. Today, major players like Google, Meta, and X deal with vast amounts of interconnected data. </p>
<p>Take Facebook, for example. The entire platform is built on a social graph, a web of relationships where Alice is friends with Bob, Bob is friends with Charlie, etc. Similarly, the "follows" relationship on Instagram/X forms another kind of graph. Google's search engine relies on a knowledge graph to understand the connections between websites and the information they contain.</p>
<p><img src="https://www.kbhaskar.com/project/facebook/featured.png" alt class="image--center mx-auto" /></p>
<p>While relational databases are still incredibly useful, they struggle when it comes to modeling and querying these intricate relationships. We’ll take a closer look at these cases.</p>
<h2 id="heading-representing-relationships"><strong>Representing Relationships</strong></h2>
<p>Relationships within interconnected data are best described using graphs.</p>
<p>Let's illustrate this with a simple Twitter example: </p>
<ul>
<li><p>Alice follows Bob</p>
</li>
<li><p>Alice follows Charlie</p>
</li>
<li><p>Bob follows Charlie</p>
</li>
<li><p>Charlie follows Bob</p>
</li>
<li><p>Alice follows Dave</p>
</li>
<li><p>Dave follows Charlie</p>
</li>
<li><p>Bob follows Dave</p>
</li>
</ul>
<p>If we were to ask, <em>"How many people does Bob follow?"</em>, we'd have to scan through all the records to count them. </p>
<p>But if we visualize this data as a graph: The answer becomes immediately clear.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1717344771980/edd95881-a4b7-4572-b9f3-a89325de6779.png" alt class="image--center mx-auto" /></p>
<p>We can also see that Charlie is the most followed person in this dataset. Graphs provide a powerful way to visualize and analyze relationships, making them a natural fit for representing interconnected data.</p>
<p>While graph theory has existed since the 18th century (with contributions from mathematicians like Euler), it wasn't until the early 2000s that graph databases started gaining traction in the commercial world. Companies like <strong>Neo4j</strong> were among the first to offer graph database solutions, paving the way for wider adoption. Today, many popular graph databases are available, including <strong>Amazon Neptune</strong> and <strong>ArangoDB</strong>. Beyond social networks, graph databases are used in various applications like fraud detection, recommendation engines, and knowledge graphs.</p>
<p><img src="https://images.datacamp.com/image/upload/v1696507403/image3_de75a57877.png" alt /></p>
<h2 id="heading-terminologies-for-graph-database"><strong>Terminologies for Graph Database</strong></h2>
<p>Graph databases are based on a model called Labeled Property Graphs.</p>
<p>Let's explore the key components of this model</p>
<h3 id="heading-nodes"><strong>Nodes</strong></h3>
<p>Nodes represent individual entities in the data. They can be people, places, things, or any other object you want to model. Each node can have an optional set of properties stored as key-value pairs. For example, a node representing a user might have properties like:</p>
<pre><code class="lang-json">{
    id: <span class="hljs-number">1001</span>
    name: Alice,
    handle: alice123
}
</code></pre>
<h3 id="heading-labels"><strong>Labels</strong></h3>
<p>Nodes can also have one or more labels, which categorize them based on their characteristics.  For example, in a social network graph, some nodes might be labeled as "user," while others might be labeled as "post." Labels are essential for querying and filtering data efficiently.</p>
<p><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXf0ANqYsLwESvUrKx5SuDK8GY-39pqO1FIMNdKdi5yZMlfZzV0SBRVGKDgU2b0hWKUQr7rfK0fA8WSJJvbvs_KhmzzON2VUOXsLuMYjktwogLrve4OzBCfz9a1pWJPQbYjSSzDWjZU16FCHOrm8_4BqdEQWeaIGfIQLDS6nudBrVJhL5PzGWX_hJXezFgZ2LAQ?key=Y6lA456BfUkVrrrGXLGCqg" alt /></p>
<h3 id="heading-relationships"><strong>Relationships</strong></h3>
<p>Relationships define how nodes are connected. They are inherently directional, meaning that "Alice follows Bob" is not the same as "Bob follows Alice." Relationships can also have optional properties. In our Twitter example, a "follows" relationship might have a property like <code>{ created_at: 2024-05-01 }</code> signifying that the person started following from 1st May 2024.</p>
<h2 id="heading-where-graph-databases-shine"><strong>Where Graph Databases Shine</strong></h2>
<p>Imagine trying to answer the following query using our Twitter example in a relational database: "How many people does Alice follow who have at least 100 followers and have all posted at least 3 tweets with more than 10 likes?"  The SQL query would be a nightmare of multiple joins and subqueries, likely taking a significant amount of time to execute.</p>
<p>In contrast, a graph database could answer this question with a simple traversal, following the relationships from Alice's node to her followers, then to their followers, and finally to their tweets. This traversal could be orders of magnitude faster than the equivalent relational query.</p>
<p><strong><mark>Graph databases also excel at uncovering unexpected insights</mark></strong>. While relational databases are optimized for structured queries based on a predefined schema, graph databases allow for more exploratory analysis. They're not just about answering known questions; they're about discovering relationships and patterns you didn't even know existed.</p>
<p>Furthermore, <strong><mark>graph databases offer flexibility</mark></strong>. Making changes to the schema or adding new types of relationships is often much easier than in a relational database, where complex migrations might be required.</p>
<p>In essence, graph databases are the tool of choice when relationships between data points are as crucial as the data itself. If your data is highly interconnected and you need to perform <strong><mark>complex relationship-centric queries</mark></strong> or explore your data in new ways, graph databases might be the perfect fit. But if it’s not the case, then relational databases should be your goto choice.</p>
<h2 id="heading-native-graph-processing"><strong>Native Graph Processing</strong></h2>
<p>This way of modeling data is consistent across various graph database implementations, but there are different ways to encode and represent graphs in a database engine’s main memory. A graph database can have native processing capabilities if it exhibits a property called <mark>index-free adjacency</mark>.</p>
<p>How do we represent which nodes are adjacent to each other? In a graph, two nodes are adjacent if they are directly connected by a relationship. In non-native graph processing, an index might be used to look up adjacent nodes, similar to how a relational database uses indexes for faster query performance. However, this introduces overhead and can limit the speed of graph traversals.</p>
<p>So, even on the surface it is still a graph based model, it’s just that there exists a global index to fetch the adjacent nodes. </p>
<p><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXdQaBORwfY3rAVy9ANdx0nU9ciTQOHUp08TzUkLMqfc06csJEFtaw1VhahUrjiOu2jnijct8eg4pKWZ8Gaf1N58GdGrwfjJD1q5mhMZQPx16NTaa_GIxXhySAHeH9R6_-LNYwgqN2ywOakyF7csGeYLNv5W8E1p1881EUusvz3Xx_I9jvT9_RJ169_XvOrQiA?key=Y6lA456BfUkVrrrGXLGCqg" alt /></p>
<p>In contrast, native graph processing engines use index-free adjacency. Each node directly stores references (like pointers) to its neighboring nodes. Think of it like a linked list where each element points to the next.  This allows for extremely fast traversal, as there's no need to consult a global index.</p>
<p><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXetonksNt6FA_JmHfosZ8my99nxgEkU6yFqGps61YXKtVuIL4lFexIheNKU6ZPeivWgwAQgG6TMOvYRjIaVGaD3AA2Ii7iO08UO8sYyrsyrBzNpMxQ2iqsn-gM7El3qzMQNdntBpEg9onWY9uP29Pp7evw_vVqLJoixOX3i_ImWvYsADWP9_2b869opyWDn1A?key=Y6lA456BfUkVrrrGXLGCqg" alt /></p>
<p>There are multiple advantages of having index-free adjacency</p>
<h3 id="heading-faster-lookups">Faster Lookups</h3>
<p>Depending on the implementation, index lookups could be <code>O(log n)</code> in algorithmic complexity versus <code>O(1)</code> for looking up immediate relationships. To traverse a network of m steps, the cost of the indexed approach, at O(m log n), dwarfs the cost of <code>O(m)</code> for an implementation that uses index-free adjacency.</p>
<h3 id="heading-simpler-queries">Simpler Queries</h3>
<p>Furthermore if we were to ask “how many followers does node B have?” In non-native graph processing we have to iterate through all the indices to get the count. To avoid that, we have to instead maintain a reverse-index.<br />Whereas with native graph processing we can just look into the incoming edges to node B and we will know the answer.</p>
<p>While index-free adjacency offers significant advantages, it's worth noting that it can lead to higher memory usage for dense graphs where nodes have many connections.  However, for many real-world use cases, the performance benefits far outweigh this potential drawback.</p>
<h2 id="heading-conclusion"><strong>Conclusion</strong></h2>
<p>In this introduction to graph databases, we've explored how they differ from traditional relational databases, their core terminology (nodes, relationships, properties), and the concept of native graph processing. In the upcoming posts, we'll delve deeper into the inner workings of graph databases, exploring how Neo4j and other systems store and manage graph data on disk.  </p>
<hr />
<p>If you found this post helpful, please like and follow for more insights into the exciting world of graph databases.</p>
]]></content:encoded></item><item><title><![CDATA[Leaping into Lempel-Ziv Compression Schemes]]></title><description><![CDATA[Hey everyone! In this blog, we're going to continue our discussion on data compression, but this time, we're diving into some real-world algorithms that make it all happen.
Here was my previous blog which builds the intuition behind compression:
http...]]></description><link>https://arnabsen.dev/lz-compression-algorithm</link><guid isPermaLink="true">https://arnabsen.dev/lz-compression-algorithm</guid><category><![CDATA[algorithms]]></category><category><![CDATA[Computer Science]]></category><category><![CDATA[Tutorial]]></category><dc:creator><![CDATA[Arnab Sen]]></dc:creator><pubDate>Sun, 14 Apr 2024 15:58:10 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1713109505626/d230dbf9-1470-4869-b098-4baadca22b75.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hey everyone! In this blog, we're going to continue our discussion on data compression, but this time, we're diving into some real-world algorithms that make it all happen.</p>
<p>Here was my previous blog which builds the intuition behind compression:</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://arnabsen.dev/compression-conundrum">https://arnabsen.dev/compression-conundrum</a></div>
<p> </p>
<p><em>A quick recap…</em></p>
<p>In the previous blog, we dove into the world of compression algorithms! We explored the fascinating idea that compressing data can, in some cases, actually make the file size bigger. We talked about how every compressed data set has a counterpart that expands when compressed. This is because compression relies on finding patterns within the data.</p>
<h1 id="heading-idea-behind-a-practical-compression-scheme">Idea behind a practical Compression Scheme</h1>
<p>One way to deterministically achieve compression would be to have symbols for repeated chars or bits. Let’s take the example of the phrase <code>to be or not to be</code>. If we use a particular symbol <code>X</code> as a replacement for the <code>to be</code> part it will be encoded as: <code>X or not X</code>. This has reduced the number of symbols, hence we can say compression is achieved.</p>
<p>But wait, hold on a sec!! This raises a few questions:</p>
<ol>
<li><p>What if we had the char <code>X</code> in the stream itself? Or a better question would be how to effectively differentiate between actual characters and symbols used as replacements?</p>
</li>
<li><p>How will the decompressor know that <code>X</code> refers to <code>to be</code>?</p>
</li>
</ol>
<p><strong>Solution #1</strong>: Let’s say our input is made up of 8-bit ASCII codes. Then in our compression scheme we can agree upon some kind of contract that after compression, the compressed data will be made up of 9-bit ASCII code instead. The decompressor will have to keep this information in mind. So, with 8 bit ASCII we have values from 0-255, with and additional bit we can have extra values from 256-511 that can be used for our symbols. This way we can very easily differentiate between symbols and input chars.</p>
<p><em>But wait, what kind of compression scheme is this, where we are taking the input is made up of 8-bit but the compressed data is made up of 9-bit? Won't that just increase the size of the data? Will compression be achieved at all?</em></p>
<p>That’s a really good question. Let’s tackle the 2nd question first and come back to this.</p>
<p><strong>Solution #2</strong>: How will the decompressor know that <code>X</code> refers to <code>to be</code>? One approach would be to maintain a table/mapping for every symbol and what characters they represent. And the decompressor should also have this table/mapping information to refer to while performing the decompression.</p>
<p>Here let me callout an important piece of information to keep in mind while developing compression schemes. When we compare compression algorithms we just can’t compare the compressed text with the original text. We need to take into account all the data that the decompressor needs, to be able to accurately decompress the compressed data to our original text (mind you we are still talking about lossless compression as mentioned in my earlier blog). So, in our case we will have to consider the compressed text + metadata (which can be the table/map that were talking) while comparing the performance of compression algorithms.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1713105850671/8f5fa683-bea0-4ae2-a3c6-8a2d3b81c47d.png" alt class="image--center mx-auto" /></p>
<p>Now, let's tackle that tricky question.</p>
<p>From my previous blog we got an intuition that compression algorithms should be able to compress effectively, those inputs that are commonly used, at the expense of maybe expanding inputs which resembles random noise. So, when we use 9-bits or more in our compression scheme, we are hoping that with the extra 256 symbols we will be able to reduce the size so much that even with 9-bits we are able to get an effective compression. Let’s do that math with an example string: <code>to be or not to be</code>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1713106226904/c91aa116-b077-49f3-8d75-9018bb575582.png" alt class="image--center mx-auto" /></p>
<p>The original string has 18 chars, each char is of 8-bits i.e <code>18*8</code> = <code>144</code> bits in total.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1713106250211/adc3507f-b29d-4417-9fe5-30719668d6b7.png" alt class="image--center mx-auto" /></p>
<p>If we replace the <code>to be</code> with the symbol 256 (<code>0b100000000</code>) then the string itself gets compressed to just 10 symbols, with each symbol taking 9-bits according to our agreement i.e <code>10*9</code> = <code>90</code> bits.</p>
<p>But, also we need to take into account the additional mapping for the decompressor to know that symbol 256 refers to <code>to be</code>, that will take another <code>48 bits</code>. So, effectively we have <code>90 + 48</code> bits = <code>138</code> bits and we achieve a compression ratio of <code>1.043</code>. Although this compression is trivial, but this is a good example that supports our hypothesis.</p>
<blockquote>
<p><strong>Note</strong>: Trying to judge the compression schemes on smaller inputs is not ideal. Compression is all about saving space on large data. So, we should see if the compression scheme has the potential to scale with larger inputs. If the data to be compressed is itself very small, there is not much requirement to compress it anyways. But here, we will still stick to smaller inputs for easier understanding.</p>
</blockquote>
<p>To draw some conclusion, to make a good compression algorithm, it needs to be able to <strong><mark>find repeated patterns in the string and substitute them</mark></strong>. But the tradeoff being, we have to somehow flow this information to the decompressor.</p>
<p><em>But is there any way we can make this even better? What if we can save the extra over-head to send the metadata to the decompressor?</em></p>
<h1 id="heading-idea">Idea</h1>
<p>One approach might be to traverse the input stream and build a dictionary simultaneously with all the information that we have so far. In other words, if the table/mapping can be built deterministically we don’t have to send that information to the decompressor and that will save us some extra overhead. The decompressor can use the same logic to build the table itself.</p>
<p>This is actually the hallmark of the <strong>LZ Scheme of Compression Algorithms</strong>. The LZ family of data compression algorithms trace back to the work of <strong>Abraham Lempel</strong> and <strong>Jacob Ziv</strong>, who published two influential papers in 1977 and 1978. These algorithms, LZ77 and LZ78, laid the groundwork for many variations that are still used today, including LZW, LZSS, and LZMA.</p>
<p>This article will focus on the <strong><mark>LZW scheme</mark></strong>. <strong>Terry Welch</strong> published it in 1984 (the W in the LZW) as a significant improvement to LZ78. The LZW algorithm quickly gained widespread use due to its efficiency and adaptability. It became the compression method of choice in the popular GIF image format. In 1985, Sperry Corporation (which had acquired Lempel and Ziv's employer) obtained a patent on LZW. Later, Unisys acquired Sperry and began enforcing licensing fees on the use of LZW in software. But developers weren’t happy with this but that hatred fueled the creation and adoption of other compression algorithms like DEFLATE (which is used in the gzip tool). But, the classic Unix command <code>compress</code> utilizes a modified version of the LZW algorithm.</p>
<p>It’s a little hard to explain the algorithm in a blog but I have given my best:</p>
<h1 id="heading-getting-hands-dirty">Getting hands dirty</h1>
<h2 id="heading-setup">Setup</h2>
<p>The compressor and decompressor maintain a symbol table. The symbol table is initially populated with the first 256 ASCII characters. As we process the input string we will create new symbols and they will take the index 256 onwards. So, we can say symbol 256 is for <code>to be</code> and so on.</p>
<p>In the LZW compression algorithm, whenever we add something to the compressed data result, there must exist corresponding symbol in the symbol table.</p>
<p>We also have to maintain something called the <strong>Working String</strong> which stores a new symbol. At every step we either try to make the working string longer or add the current working string to the symbol table.</p>
<p>And, How do we build the working string? We use the <strong>Current Character</strong> while iterating the string. Once we add the current working string to the symbol table we reset the working string to just include the current character. So, effectively the working string is never empty except at the beginning of the compression.</p>
<h2 id="heading-compression">Compression</h2>
<p>Let’s consider an example string <code>banana</code>.</p>
<p>When we check if the working string is in the symbol table we append the current character at the end of it. Let’s define it as <strong>Augmented Working String</strong> (AWS) for easier understanding.</p>
<p>Let’s start with our first character: <code>b</code>.</p>
<pre><code class="lang-plaintext">Working String: "&lt;empty&gt;"
Current Character: "b"
Augmented Working String: “b”
</code></pre>
<p>Is AWS in the Symbol table? Yes, as we mentioned before, all the single character ASCII values are already in the table.</p>
<p>Now, the new working string becomes this augmented working string. And we don’t output anything in this step.</p>
<p>---</p>
<p>Let’s go to our next character: <code>a</code>.</p>
<pre><code class="lang-plaintext">
Working String: “b”
Current Character: “a”
Augmented Working String: “ba”
</code></pre>
<p>Is AWS in the Symbol Table? No, currently we don’t have any extra symbols except the first 256 ASCII characters in the symbol table.</p>
<p>So, we will add this augmented working string in the symbol table with the next available index, which in this case is <code>256</code>. So our symbol table now has this extra symbol:</p>
<pre><code class="lang-json">symbol_table: {
    256: “ba”
}
</code></pre>
<p>At this point we will output the existing working string i.e “b”. So we got our first character in the compressed data.</p>
<p>---</p>
<p>Let’s go to our next character: <code>n</code>.</p>
<pre><code class="lang-json">Working String: “a”
Current Character: “n”
Augmented Working String: “an”
</code></pre>
<p>Is AWS in the Symbol Table? No. So, we add it with the next available index i.e 257. Now our symbol table becomes:</p>
<pre><code class="lang-json">symbol_table: {
    256: “ba”,
    257: “an”
}
</code></pre>
<p>And we output our current working string i.e “a”. So our compressed data is now <code>ba</code>.</p>
<p>---</p>
<p>Let’s go to our next character: <code>a</code>.</p>
<pre><code class="lang-json">Working String: “n”
Current Character: “a”
Augmented Working String: “na”
</code></pre>
<p>Is AWS in the Symbol Table? No. So, we add it with the next available index i.e 257. Now our symbol table becomes:</p>
<pre><code class="lang-json">symbol_table: {
    256: “ba”,
    257: “an”,
    258: “na”
}
</code></pre>
<p>And we output our current working string i.e “n”.  So our compressed data is now <code>ban</code>.</p>
<p>---</p>
<p>Our next character: <code>n</code>.</p>
<pre><code class="lang-json">Working String: “a”
Current Character: “n”
Augmented Working String: “an”
</code></pre>
<p>Is this in the Symbol Table? Well yes !! It’s index is 257. So, we move to our next step.</p>
<p>---</p>
<p>Our next character: <code>a</code>.</p>
<pre><code class="lang-json">Working String: “an”
Current Character: “a”
Augmented Working String: “ana”
</code></pre>
<p>Is this in the Symbol Table? No. So, we add it with the next available index i.e 259. Now our symbol table becomes:</p>
<pre><code class="lang-json">symbol_table: {
    256: “ba”,
    257: “an”,
    258: “na”,
    259: “ana”
}
</code></pre>
<p>And we output our current working string i.e “an” in fact the index for this symbol.  So our compressed data is now <code>ban&lt;257&gt;</code>. </p>
<p>And our working string for the next iteration is “a”.</p>
<p>This is interesting to see that with this algorithm, we are even building up on the symbols that we already saw previously, in the hope that if it occurs again we can use this new symbol. This shows how compression schemes like this can benefit from repeated patterns in long input.</p>
<p>Now we are done with the input character, but we still have some data left in the working string. So, we need to flush them to the compressed data, so it becomes: <code>ban&lt;257&gt;a</code>.</p>
<p>As you can see we were building the symbol table as we were traversing the input. Another good observation is that we solved the problem of what a symbol represents. In the compressed string where we used <code>257</code> as a replacement for <code>an</code>; the substring <code>an</code> already exists in the string before the symbol has been used.</p>
<h2 id="heading-decompression">Decompression</h2>
<p>For decompression the important objective is to build the symbol table by the time it reaches the symbol, so that it can use the substitution.</p>
<p>So, if the decompressor follows the same logic, by the time it reaches the symbol 257 it should be able to learn that 257 represents the character “an”. Let’s go through the decoding process too.</p>
<p>Now, we have the compressed data <code>ban&lt;257&gt;a</code>.</p>
<p>The logic to fill the symbols table remains the same. </p>
<p>Let’s go to the first symbol: <code>b</code>.</p>
<pre><code class="lang-json">Working String: “&lt;empty&gt;”
Current character: “b”
Augmented working string: “b”
</code></pre>
<p>Since we already have the symbol in the table, we will continue and we can simply output the decompressed result <code>b</code>.</p>
<p>---</p>
<p>Next, our symbol is <code>a</code>.</p>
<pre><code class="lang-json">Working String: “b”
Current Character: “a”
Augmented Working String: “ba”
</code></pre>
<p>We don’t have it in the symbol table so we will insert it:</p>
<pre><code class="lang-json">symbol_table: {
    256: “ba”
}
</code></pre>
<p>And we will append “a” to the decompressed result: <code>ba</code>.</p>
<p>---</p>
<p>Our next symbol is <code>n</code>.</p>
<pre><code class="lang-json">Working String: “a”
Current Character: “n”
Augmented Working String “an”
</code></pre>
<p>We don’t have it in the symbol table so we will insert it:</p>
<pre><code class="lang-json">symbol_table: {
    256: “ba”,
    257: “an”
}
</code></pre>
<p>And we will append “n”  to the decompressed result and it will be <code>ban</code>.</p>
<p>---</p>
<p>Next our symbol is <code>257</code> .</p>
<p>As soon as we come across a symbol we check if there is any substitution, and it does. We have “an” for 257. So, instead we will replace 257 with “an”. And treat each char individually like we were doing so far.</p>
<p>---</p>
<p>So, the next symbol is <code>a</code> (from the "an").</p>
<pre><code class="lang-json">Working String: “n”
Current Character: “a”
Augmented Working String “na”
</code></pre>
<p>We don’t have it in the symbol table so we will insert it:</p>
<pre><code class="lang-json">symbol_table: {
    256: “ba”,
    257: “an”,
    258: “na”
}
</code></pre>
<p>And we will append “a”  to the decompressed result and it will be <code>bana</code>.</p>
<p>---</p>
<p>Then our next symbol will be <code>n</code> (We will still have a “n” from the substitution we performed earlier)</p>
<pre><code class="lang-json">Working String: “a”
Current Character: “n”
Augmented Working String “an”
</code></pre>
<p>We have the symbol in the table, so we will continue with that augmented working string.</p>
<p>And we will append <code>n</code> to the decompressed result and it will be <code>banan</code>.</p>
<p>---</p>
<p>Now our final symbol is <code>a</code>.</p>
<pre><code class="lang-json">Working String: “an”
Current Character: “a”
Augmented Working String “ana”
</code></pre>
<p>We don’t have it in the symbol table so we will insert it:</p>
<pre><code class="lang-json">symbol_table: {
    256: “ba”,
    257: “an”,
    258: “na”,
    259: “ana”
}
</code></pre>
<p>Finally we will have our decompressed result: <code>banana</code>.</p>
<p>Also notice how we arrived at the same symbol table that we saw during the compression process. This is the beauty of the LZW compression algorithm.</p>
<h3 id="heading-edge-case">Edge Case :)</h3>
<p>But there is a small caveat !! Try to follow this same algorithm to compress the string <code>another_banana</code> and then decompress it. While compression you won’t find any issue and if you do it correctly you should get <code>another b&lt;256&gt;&lt;265&gt;</code> as the compressed data. But there will be a small edge case when you perform the decompression. </p>
<p>But it can be resolved with a little trick.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>"The art of compression is the art of finding patterns." </p>
<p>That was all for this blog. While LZW marked a significant milestone in compression algorithms, it's important to note that data compression continues to evolve. Modern techniques often combine LZW with other algorithms or use more sophisticated dictionary-building mechanisms to achieve even higher compression rates. Just like <a target="_blank" href="https://deepmind.google/discover/blog/alphadev-discovers-faster-sorting-algorithms/">Google’s DeepMind AI AlphaDev</a> found “faster” sorting algorithms, maybe someday they will come up with better and more efficient compression algorithms, until then let’s add more creativity to this field.</p>
]]></content:encoded></item><item><title><![CDATA[The Compression Conundrum]]></title><description><![CDATA[Couple of days back I was reading about compression and how different compression algorithms work and realized that I had a flawed understanding of the fundamentals of compression algorithms. So here I am noting down what I learnt.
I will not cover a...]]></description><link>https://arnabsen.dev/compression-conundrum</link><guid isPermaLink="true">https://arnabsen.dev/compression-conundrum</guid><category><![CDATA[algorithms]]></category><category><![CDATA[Computer Science]]></category><category><![CDATA[Blogging]]></category><dc:creator><![CDATA[Arnab Sen]]></dc:creator><pubDate>Sun, 24 Mar 2024 14:40:27 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1711291036781/312f413a-3c58-4d04-8cc9-85e874488a9d.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Couple of days back I was reading about compression and how different compression algorithms work and realized that I had a flawed understanding of the fundamentals of compression algorithms. So here I am noting down what I learnt.</p>
<p>I will not cover any compression algorithm in this blog, will keep that for future blogs. But what I will do cover is if you want to create your own compression algorithm what should the starting point be like.</p>
<p>Let's step back a little</p>
<h2 id="heading-what-hath-god-wrought"><strong>“What hath God wrought”</strong></h2>
<p><img src="https://sheridanvoice.com/blog/wp-content/uploads/2022/05/Morse-What-Hath-God-Wrought-2000x559.jpg" alt="Morse Code: What Hath God Wrought! – By Daniel Sheridan – Sheridan Voice" /></p>
<p>So our protagonist is <strong>Samuel F Morse</strong>, a successful portrait artist. But he got hooked on the idea of an electric telegraph way back in 1832. The problem at the time was that other telegraph systems needed multiple wires – a mess to manage over long distances. So Morse came up with the idea of sending electrical pulses through wire with an electromagnet attached at the end of it. A springy metal bar (the armature) is attached to the electromagnet. When the magnet pulls, the armature makes a satisfying "click" as it hits a contact.</p>
<p><img src="https://cdn.britannica.com/18/146618-050-B398A5DB/telegraph-transmitter-Morse-Code.jpg" alt="Morse Code original telegraph key" /></p>
<p>After years of tinkering and getting partners on board (shoutout to Alfred Vail!), Morse strung a telegraph line between Washington D.C. and Baltimore. In 1844, he tapped out the now famous  message, "What hath God wrought!" It wasn't just a test; imagine the hype, like sending the first ever tweet!</p>
<p><img src="https://scoutlife.org/wp-content/uploads/2007/02/morsecode-1.jpg" alt="Morse code for English Alphabets" /></p>
<p>Morse's real genius wasn't just the tech; it was the code itself. Instead of a whole alphabet, he figured you could represent everything with just dots and dashes. He assigned the most common letters the shortest codes.</p>
<p><img src="https://pi.math.cornell.edu/~mec/2003-2004/cryptography/subs/frequency.jpg" alt="English alphabet frequency distribution" /></p>
<p>The most frequently occurring letter in the English alphabet is the letter "e," and its corresponding Morse code representation is a single dot. Similarly, the second most common letter, "t," is represented by a single dash in Morse code.</p>
<p>But letter’s like "z" are represented by two dashes followed by two dots. So if you had to say something like "Jazz" in Morse it would become</p>
<p><code>dot dash dash dash  dot dash  dash dash dot dot  dash dash dot dot</code></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1711286769007/6f9fc4ee-fffc-4252-9b8e-728848c3469c.png" alt class="image--center mx-auto" /></p>
<p>But here is my question, can we call this a “compression” algorithm? Like in the last case is it performing any compression?</p>
<p>So, let’s understand what qualifies as a compression algorithm.</p>
<h2 id="heading-what-is-a-compression-algorithm">What is a compression algorithm?</h2>
<p>Let’s say <code>s</code> is a string of bits of length <code>n</code>, and then <code>C(s)</code> is a function that returns a stream of bits which is a "compressed" version of <code>s</code>.</p>
<p>For a compression algorithm to work, we should be able to decompress it. It would be stupid to have an algorithm that just compresses stuff and there is no way to get back the original.</p>
<p>Hence, there should also exist an inverse of <code>C(s)</code>, let’s call it <code>D(s)</code> such that <code>D(C(s)) = s</code>.</p>
<p>One small thing to note here is that after decompression if we get the exact uncompressed data it’s called <strong>loss-less compression</strong>.</p>
<p>There is another kind of compression where we expect that some information can be selectively discarded that is of less importance or less noticeable to the human eye or ear to achieve much smaller file sizes. They are called <strong>lossy compression</strong> (e.g. JPEG). Let’s just focus on loss-less compression for now.</p>
<h2 id="heading-what-makes-a-compression-algorithm-good">What makes a compression algorithm good?</h2>
<p>So, how do we know if it's a good compression algorithm? Let’s define a formula for that.</p>
<p>Let’s call it the compression ratio: the length of the original data divided by the length of the compressed data.</p>
<p>$$\text{Compression Ratio} = \frac{\text{Length of Original String}}{\text{Length of Compressed String}}$$</p><p>$$\text{i.e } \text{CR} = \frac{|s|}{|C(s)|}$$</p><p>So, if our original data is <code>100</code> bits long and after compression it becomes 50 bits long then the compression ratio is <code>100/50</code> i.e <code>2</code>.</p>
<h3 id="heading-case-1-when-cr-1">Case #1: When CR = 1</h3>
<p>If the compression ratio is 1 then it means that the length of the data before compression is the same as the length of the data after compression. Well, then what’s the point of calling it a compression.</p>
<h3 id="heading-case-2-when-cr-gt-1">Case 2: When CR &gt; 1</h3>
<p>This is only possible when the compressed data has length less than original data. Which is supposed to be the case right? Well here is the catch.</p>
<p>Let’s say we have a compression algorithm <code>C(s)</code> which has a compression ratio greater than 1.</p>
<p>In the worst case:</p>
<p>If <code>|s| = n</code>, the <code>|C(s)|</code> will be <code>n-1</code> i.e we are saying that the compression algorithm is only able to save 1 bit of space which sounds very inefficient but let’s hold on to that.</p>
<p>What if we apply the same compression algorithm again? Then</p>
<p>$$|C(C(s))| = n-2$$</p><p>If we continue doing that:</p>
<p>$$|C(C(C(s)))| = n-3$$</p><p>Now you see where we are leading to? Effectively after applying the same compression algorithm again and again we will be able to compress any data to 0 bits. Which is impossible, and here lies the fallacy.</p>
<p><strong>Example:</strong></p>
<p>Let’s take an example to understand this deeper. Let’s say we want to compress 2 bits of data. And we want to achieve at least some compression so the compressed data should be of 1 bit.</p>
<p>So, one possible input is <code>10</code> and we want to compress it to <code>1</code> and let’s say we want to compress <code>01</code>to <code>0</code>. But? What about <code>11</code>or <code>00</code>? We cannot compress it to <code>1</code> cause we are using <code>10</code> for that, nor can we use <code>0</code> cause we are using <code>01</code> for that.</p>
<p>We can actually prove this with a theorem which is one of my personal favorites: <strong>Pigeonhole Theorem</strong>.</p>
<p>So, for some integer <code>n &gt;= 1</code> and consider the set <code>S</code> of <code>2^n</code> strings of length exactly <code>n</code>. Let's define</p>
<p>$$S_c = \{C(s):s \in S\}$$</p><p>$$\text{Note that, } |S_c| = |S| = 2^n$$</p><p>So, if every string in <code>S_c</code> has length at most <code>n-1</code> then size of <code>S_c</code> can be at most:</p>
<p>$$|Sc| \leq 2^0 + 2^1 + ... + 2^{n - 1} = \sum_{i=0}^{n-1} 2^i = 2^n - 1 \text{ (contradiction)}$$</p><p>$$\text{Therefore, there exists } s \in S \text{ such that } |C(s)| &gt; n - 1.$$</p><h2 id="heading-conclusion">Conclusion</h2>
<p>The conclusion from this proof is that <strong><em><mark>"Compression is a Zero-Sum game"</mark></em></strong>. For some input to be compressed to something smaller there will be some input that will be compressed to something larger.</p>
<p>Don’t believe me? Try this online tool (<a target="_blank" href="https://beautifycode.net/deflate-compression">link</a>) to compress the following text using DEFLATE, the algorithm behind gzip which kind of runs the entire internet as of now.</p>
<pre><code class="lang-plaintext">ykjNyclXKMnILFYAosSivMQkheLUPIWMUXFyxAEAAAD
</code></pre>
<p>You will see the compressed string is larger than the original string.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1711288506404/b099950f-0a69-44ba-bea3-0baee8349843.png" alt class="image--center mx-auto" /></p>
<p>Whereas if you give an input something like a text shown in the image below; we get a really good compressed result. Most of the compression algorithm used nowadays are very good at getting rid of redundancy which occurs a lot in our day to day lives. Which is why some characters in the English alphabet has higher frequency than others.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1711288528728/61071cf7-190a-4851-af04-b6024bca5e68.png" alt class="image--center mx-auto" /></p>
<p>And this is the truth, most of the compression algorithms focusses on compressing inputs that are more generally available than any random stream of noise.</p>
<p>Therefore if you are planning to create a new compression algorithm you should ensure that your algorithm is able to achieve good compression of actual data at the expense of bad compression of random noisy data because we rarely care about them.</p>
<h2 id="heading-getting-back-to-where-we-started">Getting back to where we started...</h2>
<p>So, getting back to the question we started with, can something like Morse code be considered a compression algorithm? Well, in my opinion, it sure can. We can represent letters that show up a lot with less effort, but we have to make do with longer codes for the letters that don't show up as often, like Z, Q, and so on. And that's basically what compression is all about, as we just saw.</p>
<p>That spirit of squeezing the most meaning into the fewest bits? That's the heart of compression, even with today's fancy algorithms.</p>
]]></content:encoded></item><item><title><![CDATA[One Instruction to Rule Them All: Exploring OISC]]></title><description><![CDATA[Background
As software developers, our daily routine revolves around crafting programs in familiar languages such as JavaScript, C++, Python, Rust, Java, and more. We immerse ourselves in mastering the syntax of these languages and then put the keywo...]]></description><link>https://arnabsen.dev/exploring-oisc</link><guid isPermaLink="true">https://arnabsen.dev/exploring-oisc</guid><category><![CDATA[Tutorial]]></category><category><![CDATA[Computer Science]]></category><category><![CDATA[Developer]]></category><dc:creator><![CDATA[Arnab Sen]]></dc:creator><pubDate>Mon, 13 Nov 2023 03:27:01 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1699845930166/9b0c021c-814c-415b-bc88-c432b303e589.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1 id="heading-background">Background</h1>
<p>As software developers, our daily routine revolves around crafting programs in familiar languages such as JavaScript, C++, Python, Rust, Java, and more. We immerse ourselves in mastering the syntax of these languages and then put the keywords such that it achieves our business logic. But the question is: <strong>How does the computer comprehend this diverse array of languages?</strong></p>
<p>Most of the languages that we usually come under the category of High-Level Language. They are high-level in the sense they provide a higher level of abstraction and allow us to write more "human-readable" code.</p>
<p>Let's take a look at this super fancy C Code, which most of you have written at some point in your career as a developer:</p>
<pre><code class="lang-c"><span class="hljs-meta">#<span class="hljs-meta-keyword">include</span> <span class="hljs-meta-string">&lt;stdio.h&gt;</span></span>

<span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">main</span><span class="hljs-params">()</span> </span>{
    <span class="hljs-built_in">printf</span>(<span class="hljs-string">"hello world"</span>);
}
</code></pre>
<p>A computer doesn't understand these words like "printf", "void", "main". They are meant for us humans to write code faster and more efficiently. Once the compiler compiles the code into Machine Language it looks like this:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1699840572578/c0147791-9bf3-4590-bb95-75e3011da7e2.png" alt class="image--center mx-auto" /></p>
<blockquote>
<p>Note: This assembly code is for Linux using the x86 architecture. The actual machine code can vary based on the target system.</p>
</blockquote>
<p>You can notice the words like <code>push</code>, <code>mov</code>, <code>call</code>, <code>nop</code>, <code>pop</code> etc. These are commands that the CPU can understand and they all belong to something called an <strong>instruction set</strong>.</p>
<p><img src="https://miro.medium.com/v2/resize:fit:1400/1*8j2PmhExz4q87OoddaH7ag.png" alt class="image--center mx-auto" /></p>
<p>It serves as an interface between the hardware and the software, allowing us to write software that can run on a specific architecture.</p>
<p>The instruction set of a processor typically includes a variety of instructions that can perform operations such as arithmetic, logic, data movement, control flow, and more. Here are some common types of instructions found in an instruction set:</p>
<ol>
<li><p><strong>Arithmetic Instructions:</strong></p>
<ul>
<li>Addition (<code>ADD</code>), subtraction (<code>SUB</code>), multiplication (<code>MUL</code>), division (<code>DIV</code>), etc.</li>
</ul>
</li>
<li><p><strong>Logic Instructions:</strong></p>
<ul>
<li>Logical AND (<code>AND</code>), logical OR (<code>OR</code>), logical XOR (<code>XOR</code>), bitwise operations, etc.</li>
</ul>
</li>
<li><p><strong>Data Movement Instructions:</strong></p>
<ul>
<li>Load (<code>LOAD</code>), store (<code>STORE</code>), move (<code>MOV</code>), etc.</li>
</ul>
</li>
<li><p><strong>Control Flow Instructions:</strong></p>
<ul>
<li>Jump (<code>JMP</code>), conditional jump (<code>JZ</code> for zero, <code>JNZ</code> for not zero, etc.), subroutine call and return, etc.</li>
</ul>
</li>
<li><p><strong>Comparison Instructions:</strong></p>
<ul>
<li>Compare (<code>CMP</code>), test for equality (<code>EQ</code>), test for greater than (<code>GT</code>), etc.</li>
</ul>
</li>
<li><p><strong>Input/Output Instructions:</strong></p>
<ul>
<li>Input (<code>IN</code>), output (<code>OUT</code>), system calls, etc.</li>
</ul>
</li>
</ol>
<p>The specific instructions available in an instruction set can vary between different CPU architectures. For example, x86 and ARM are two different instruction set architectures commonly used in today's processors, and they have distinct sets of instructions.</p>
<p>In today's world, we have it easy, we just have to write the high-level code and the compiler translates the high-level code into the machine code instructions that the processor understands, based on the instruction set architecture.</p>
<p>Although, understanding the instruction set is essential for low-level programming, optimization, and when working with assembly language or writing programs that directly interact with hardware.</p>
<p>In this blog, I will talk about one specific kind of Instruction Set which I found really fascinating.</p>
<h1 id="heading-oisc">OISC</h1>
<p>OISC stands for One Instruction Set Compiler (OISC). It is also called Single Instruction Programming Language or Ultimate Reduced Instruction Set Computer (URISC).</p>
<p>As the name suggests, this instruction set has just one instruction.</p>
<p><em>Okay, but you might think, what's so special about that? Anyone can create an instruction set that has just one instruction and call it an OISC.</em></p>
<p>Well, not really. Most mainstream programming languages are able to solve such a wide variety of problems and computations because they are all <strong>Turing Complete.</strong> If a programming language is Turing complete, it means that it can theoretically compute anything that is computable, given enough time and resources. (I'll do a separate blog on Turing Completeness, but for the time being, you can understand it like a test for programming languages)</p>
<blockquote>
<p>Here is a movie recommendation: "The Imitation Game" based on the life of Alan Turing.</p>
</blockquote>
<p><img src="https://tfipost.com/wp-content/uploads/2022/12/The-Imitation-Game.jpg" alt="Review: If you haven't watched 'The Imitation Game' Watch now" /></p>
<p>The OISC that I am going to talk about is also Turing complete, but the best part is unlike the Turing machine it doesn't need to have an infinite memory model. Hence, it is equivalent to a real computer than a Turing machine. And the instruction is <code>subleq</code> (<strong>Subtract and branch if less than or equal to zero</strong>).</p>
<p>For any instruction to be Turing Complete (or in simple words be able to compute most complex computations) it needs to have some sort of conditional branching. You can imagine this to be something like</p>
<pre><code class="lang-bash"><span class="hljs-keyword">if</span> &lt;condition&gt;
goto &lt;branch&gt;
</code></pre>
<p>Now, these machines can be categorized into 3 types:</p>
<ol>
<li><p>Bit manipulating machines</p>
</li>
<li><p>Transport triggered machines</p>
</li>
<li><p>Arithmetic-based machines</p>
</li>
</ol>
<p><code>mov</code> is another such instruction. The <code>mov</code> instruction copies the data item referred to by its second operand (i.e. register contents, memory contents, or a constant value) into the location referred to by its first operand (i.e. a register or memory).</p>
<pre><code class="lang-c">mov a, b
</code></pre>
<pre><code class="lang-c"><span class="hljs-comment">//it is equivalent to</span>
*a = *b;
</code></pre>
<p>This <code>mov</code> instruction is Turing complete and comes under <strong>2. Transport Triggered Machine</strong>. There is an amazing repo that showcases the fact that any C program can be compiled into a program written only using <code>mov</code> instructions. You can check it out <a target="_blank" href="https://github.com/xoreaxeaxeax/movfuscator">here</a>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1699843933062/d64abd2a-370b-4439-b3dc-233424a9ee47.png" alt class="image--center mx-auto" /></p>
<p>On the left, you have the code in Assembly, and on the right, you have the same code which does the exact same thing but it only contains the instruction <code>mov</code>.</p>
<p>Arithmetic-based Turing-complete machines use an arithmetic operation and a conditional jump. This is what <code>subleq</code> does.</p>
<p>Let's simplify the <code>subleq</code> operation. If we do <code>subleq a, b, c</code> it comes down to:</p>
<pre><code class="lang-c">Mov[b] = Mov[b] - Mov[a];
<span class="hljs-keyword">if</span> (Mov[a] &lt;= <span class="hljs-number">0</span>) <span class="hljs-keyword">goto</span> c;
</code></pre>
<p>So, you can see there is a basic arithmetic operation and one conditional branching, (we already mentioned that it is required to be Turing complete). There is a syntactic sugar for the same which goes like this</p>
<pre><code class="lang-c"> subleq a, b   ; Mem[b] = Mem[b] - Mem[a]
               ; <span class="hljs-keyword">goto</span> next instruction
</code></pre>
<p>Here we basically drop the <code>c</code> which means we aren't branching anywhere but rather moving on to the next instruction. Now the big question. <strong>Is this instruction enough?</strong> Well as it turns out. Yes, it is.</p>
<p>Let's look at some programs using this instruction:</p>
<h2 id="heading-example-1">Example 1</h2>
<pre><code class="lang-c">; initially *z = <span class="hljs-number">0</span>
subleq a, z
subleq z, b
subleq z, z
</code></pre>
<p>let's break this down</p>
<pre><code class="lang-c"><span class="hljs-comment">//initally</span>
*z = <span class="hljs-number">0</span>;

<span class="hljs-comment">//line 1</span>
*z = *z - *a <span class="hljs-comment">// since *z=0, this line boils down to</span>
*z = -*a

<span class="hljs-comment">//line 2</span>
*b = *b - *z <span class="hljs-comment">// *z = -*a, this line boils down to</span>
*b = *b - (- *a)
*b = *b + *a

<span class="hljs-comment">//line 3</span>
*z = *z - *z
*z = <span class="hljs-number">0</span> <span class="hljs-comment">//we started with *z=0 and ended with *z=0</span>
</code></pre>
<p>What we see is <code>*b = *b + *a</code> i.e. this 3-line instruction performs addition.</p>
<blockquote>
<p>The reason we use (*) before a, b, z is because those represent memory addresses and *a represents the value in that particular memory block</p>
<p>The reason the last line is important is because we have to ensure we do not end up changing the values that we are not dealing with, here we were just dealing with a and b. z was initially 0 and finally should also be 0. In other words, there shouldn't be any side effects.</p>
</blockquote>
<p>Not just addition other instructions can also be implemented with <code>subleq</code> instruction as well.</p>
<h2 id="heading-example-2">Example 2</h2>
<pre><code class="lang-c">; initially *z=<span class="hljs-number">0</span>
subleq b, b
subleq a, z
subleq z, b
subleq z, z
</code></pre>
<p>You can work these out and you will come to the conclusion that it ends up assigning the value of a to b.</p>
<p>Or you can apply <em>200IQ</em> and notice that this is exactly the same as the previous one, only a new instruction <code>subleq b, b</code> was added to the beginning, we know the other 3 lines implement this <code>*b = *b + *a</code> and the first line is basically <code>*b=0</code> , hence what we finally get is <code>*b= 0+*a</code> i.e. <code>*b=*a</code>.</p>
<h2 id="heading-example-3">Example 3</h2>
<pre><code class="lang-c">subleq z, z, c
</code></pre>
<p>This is very basic, it will just jump to the branch <code>c</code>.</p>
<p>The interesting thing is this programming language with this one instruction is <strong>equally powerful</strong> to any other programming language like C++, Java .etc.</p>
<p>It may not be very efficient and easy to write but in the end, all of these come under the class of Turing Complete. Yet there are some interesting benefits to employing a one-instruction computer. For example, hardware-level functionality is simplified when implemented around a single instruction. This greatly simplifies the underlying implementation, as the same functional element is repeatedly used to form the processor core. Another advantage is that since all the instructions are the same, the instruction decoder circuitry and complexity can be eliminated.</p>
<h1 id="heading-why-bother-about-oisc">Why bother about <strong>OISC?</strong></h1>
<p>OISC architectures provide an excellent paradigm for implementing traditional von Neumann computers using non-traditional materials. Simply put, a practical computer can be built by massive scaling of simple, single instruction elements. Embracing OISC challenges us to strip away the layers of abstraction, inviting a deeper exploration of the foundational principles that govern all programming.</p>
<p><img src="https://www.researchgate.net/publication/329842259/figure/fig1/AS:706304234491904@1545407460536/The-von-Neumann-Architecture.png" alt="The von Neumann Architecture | Download Scientific Diagram" class="image--center mx-auto" /></p>
<hr />
<p>I hope you found my blog informative. If you have any feedback share it in the comments. You can sign up for the Hashnode newsletter to get notified every time I post a blog. Learn more about me at <a target="_blank" href="http://arnabsen.dev/about"><strong>arnabsen.dev/about</strong></a>. Have a nice day.</p>
]]></content:encoded></item><item><title><![CDATA[Row, Row, Raft Your Nodes: A Guide to Consensus in Distributed Systems]]></title><description><![CDATA[Introduction
I have been recently diving into the world of Distributed systems and I came across a rather interesting paper: "In Search of an Understandable Consensus Algorithm". What caught my attention was the paper's primary objective of creating ...]]></description><link>https://arnabsen.dev/raft-algorithm</link><guid isPermaLink="true">https://arnabsen.dev/raft-algorithm</guid><category><![CDATA[distributed system]]></category><category><![CDATA[System Design]]></category><dc:creator><![CDATA[Arnab Sen]]></dc:creator><pubDate>Sun, 22 Oct 2023 17:40:50 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1697996382544/3c32ce45-c344-46c2-9933-16bd309e00f5.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1 id="heading-introduction">Introduction</h1>
<p>I have been recently diving into the world of Distributed systems and I came across a rather interesting paper: <a target="_blank" href="https://raft.github.io/raft.pdf"><em>"In Search of an Understandable Consensus Algorithm"</em></a><em>.</em> What caught my attention was the paper's primary objective of creating a consensus algorithm that is <strong>easy to understand</strong>. Typically, in the realm of new research, we tend to emphasize factors like efficiency, correctness, and conciseness while overlooking how accessible a concept is for others to grasp and apply in practical scenarios.</p>
<p>We often neglect how easy it for someone is to grasp the concept and use it to build practical stuff or solve real problems. Sometimes we do the opposite, if something works but is very hard to understand and is confusing we consider it to be very "clever" and end up rewarding complexity. That's why I appreciate the approach taken by the authors, Diego Ongaro and John Ousterhout, in prioritizing the algorithm's comprehensibility.</p>
<p>With many major corporations transitioning to distributed systems, having an algorithm that is both easy to understand and intuitive can empower developers to create systems more seamlessly and devise more efficient implementations."</p>
<h1 id="heading-so-what-is-consensus">So, what is Consensus</h1>
<p>Let's start with a simple analogy:</p>
<p>You have been invited to a party and you have dressed up all nice and good. Then you ask your 4 friends if you are looking good (if you don't have so many friends just imagine you do, at this point, you must be good at it). Two of them say that you are looking good, and the rest say you are not. What are you supposed to do?</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1697975592643/8d8e522a-d77b-4b86-9fda-04b0ccb1b633.png" alt class="image--center mx-auto" /></p>
<p>But if 3 of them said that you do look good (quite unusual right?) then you can go with the majority decision.</p>
<p>This is consensus !!</p>
<p>In distributed systems, we know that we have multiple nodes, and consensus refers to coming to an agreement.</p>
<blockquote>
<p>Consensus simply means to get all the nodes in distributed computing to agree on a common value or decision, despite the presence of faults, delays, or unreliable communication. This agreement is crucial for ensuring that the distributed system functions correctly and consistently.</p>
</blockquote>
<p>Even though it sounds simple, many broken systems have been built in the mistaken belief that this problem is easy to solve.</p>
<p>There is a pattern in most of the fault-tolerant systems. For example, in MapReduce, the computation is replicated but the whole thing is controlled by a single master. Similarly, we have GFS which replicates the data and has a single master to determine who the primary is for the piece of data. The benefit of having such a single master system is that there will be no disagreement. But at the same time, it makes it a single point of failure. So we need some sort of consensus to avoid such failures.</p>
<div data-node-type="callout">
<div data-node-type="callout-emoji">💡</div>
<div data-node-type="callout-text">It's fine if you don't have an understanding of MapReduce or GFS, they were just examples. You can read my blog on MapReduce</div>
</div>

<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://arnabsen.dev/understanding-mapreduce">https://arnabsen.dev/understanding-mapreduce</a></div>
<p> </p>
<h1 id="heading-history-of-consensus-protocols">History of Consensus Protocols</h1>
<p>Well, now that I think "history" is an overstatement cause there is just one very popular protocol called "Paxos" which has been the gold standard for a long long time. First submitted in 1989 by <strong>the Leslie Lamport</strong>, the Paxos protocol is named after a fictional legislative consensus system on the island of Paxos in Greece.</p>
<p><img src="https://charlesxu.io/assets/images/sys-design/cover.jpg" alt="System Design Interview: Scaling Single Server" /></p>
<blockquote>
<p>FYI Leslie Lamport was the creator of LaTeX. He also won the Turing Award which is like the Nobel Prize for Computer Science.</p>
</blockquote>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://youtu.be/rkZzg7Vowao">https://youtu.be/rkZzg7Vowao</a></div>
<p> </p>
<p>The problem with Paxos was it was really hard to wrap our minds around. It only solved a portion of the problem and hence made it difficult to build systems around Paxos.</p>
<h1 id="heading-raft-algorithm">Raft Algorithm</h1>
<p>As mentioned before the authors' primary design goal when building Raft was "understandability".</p>
<div data-node-type="callout">
<div data-node-type="callout-emoji">🤓</div>
<div data-node-type="callout-text">Even the author of Raft found it difficult to understand Paxos and he once said that it took him building a new consensus algorithm to really understand how Paxos worked and its correctness.</div>
</div>

<p>Now this doesn't mean that Raft is very very easy to understand, there are still a lot of intricacies and edge cases to cover, but I will try my best to give a brief overview of the entire thing. So let's start.</p>
<h2 id="heading-what-are-we-dealing-with">What are we dealing with?</h2>
<p>We have a client, which can be a user or a service etc. And it tries to fetch some data from the server we have which is nothing but a cluster of nodes.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1697979457327/2dee5b50-4dc0-4198-b872-d0703b805528.png" alt class="image--center mx-auto" /></p>
<p>Now, to ensure consensus we need the nodes to agree on a particular value and then send that to the client.</p>
<p><strong>How do we ensure that all the nodes have the same value?</strong> Raft achieves that through something called a <strong>"Replicated Log".</strong></p>
<p>It ensures that all the commands (or operations) that need to be performed are replicated across the nodes in the same order. So, let's say you have a variable <code>X</code> initially, the value is <code>0</code> and then you perform some operations like:</p>
<ul>
<li><p><code>add 5</code></p>
</li>
<li><p><code>mul 10</code></p>
</li>
<li><p><code>sub 15</code></p>
</li>
</ul>
<p>If these commands were logged in the same order then the final value of <code>X</code> will be the same for all the nodes assuming the fact that the operations in the nodes (which are also referred to as state machines) are deterministic.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1697981500138/7195a039-5805-4547-a346-4a590fb4781c.png" alt class="image--center mx-auto" /></p>
<p>So, when a new command gets proposed, it first gets logged on all the nodes (at least most of the nodes) at the end of their logs. Only when the log gets properly replicated, does the node perform its computation and send the result to the original client.</p>
<p>The idea behind this is if the logs get replicated properly the cluster can continue functioning as long as the majority of the nodes are up (Yes, it's more like democracy, the majority wins).</p>
<h2 id="heading-who-will-instruct-the-nodes-on-what-to-do">Who will instruct the nodes on what to do?</h2>
<p>Again similar to democracy, here also we have a leader node elected by other nodes. The leader node is responsible for talking to the client, giving commands to the other nodes, etc.</p>
<p>Before diving deep into the functioning of the leader let's see how the nodes become a leader.</p>
<h3 id="heading-server-states">Server States</h3>
<p>The nodes/server have 3 states:</p>
<ul>
<li><p>Follower</p>
</li>
<li><p>Candidate</p>
</li>
<li><p>Leader</p>
</li>
</ul>
<p>In normal service, there will be just one Leader and all the other servers will be Followers.</p>
<p>Followers are passive, they issue no requests and can only respond to requests from Leaders and Candidates.</p>
<p>The Leader handles all the client requests. It also sends regular heartbeats (empty requests) to the Followers to maintain authority. <em>More like it's saying "Don't get too excited, I am still your leader".</em></p>
<p>If a Follower receives no communication over a time period (called <strong>election timeout</strong>) it assumes that no Leader is available and starts the process of <strong>Leader Election</strong>.</p>
<h3 id="heading-leader-election">Leader Election</h3>
<p>Let's talk about <strong>term</strong> before diving into Leader Election. To have consensus we need to have a mechanism to detect obsolete information. Like if a particular server was a leader and then it stopped responding, and a new leader was appointed. We need to ensure that the other servers don't take instructions from the old leader anymore. Raft achieves this by dividing the time into terms or arbitrary lengths called <strong>term.</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1697989611948/05a6e6a7-ed55-498b-8a50-7081d31c6c71.png" alt class="image--center mx-auto" /></p>
<p>Each term starts with an election of the leader and then if the election is successful the leader rules for some period of time which is represented in green in the above diagram.</p>
<blockquote>
<p>You can see how this is similar to the administrative process of a country where each leader has a term like 5 years and then post that election happens to elect a new leader.</p>
</blockquote>
<p>In Raft, now the interesting thing is there is no global concept of <strong>term</strong> among the servers. Each server starts with its own terms.</p>
<p>When the election process starts the follower increments its current term index and becomes a candidate. It votes itself and then sends specific requests to the other nodes requesting to be a leader in other words asking for their vote. This happens by a special kind of request called <code>RequestVote RPCs</code>.</p>
<p>Whenever the server communicates with the other it includes what it thinks the current term index is. Then the other server responds by including its term index.</p>
<p>Now if there is a mismatch the server with the lower-term starts having an identity crisis and falls back to being a follower. And the other server just ignores it.</p>
<p>A Server is entitled to vote only one server and that happens on a first come first serve basis. So by the end of the process, the Candidate server with the most votes becomes the leader and then sends heartbeat messages to all of the other servers to establish its authority and prevent new elections.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1697991199037/c1093f81-f805-45d0-b9d3-027985d3dd1b.png" alt class="image--center mx-auto" /></p>
<p>Here I had a doubt, what if all the server realizes that the leader no longer exists or the current term is over, votes themselves, and requests a vote at the same time? They will just end up waiting indefinitely to get majority votes. Or what if two candidates receive the same number of votes (this is called a split vote)?</p>
<p>Raft solves this by using randomized election timeouts, which means election timeouts are chosen randomly from a fixed interval (e.g., 150-300 ms). This way in most cases only one server will timeout at a time, become a candidate, and will request a vote before the other server times out. Even in case of a split vote, each candidate restarts its randomized election timeout at the start of an election and it waits for that timeout to elapse before starting the next election. This randomness drastically reduces the chances of another split vote.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1697991568136/26dbcb95-8cd0-4355-8644-cae2ed4a7ace.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-how-does-the-normal-operation-happen">How does the normal operation happen?</h2>
<p>Let's go through how a normal operation will take place with consensus in Raft.</p>
<p>First, the client sends a command to the leader. Wait, how will the client know who the leader is? Well, the client can send it to any server and if the server is a follower it will simply redirect it to the leader.</p>
<p>The Leader appends the command to its log and sends another request (called <code>AppendEntries RPC</code> request to all its followers). The followers on receiving this request just append the new log to their existing logs record. Note, at this point they just append it and don't actually perform any computation. It's the leader who decides when it is safe to apply the log entry i.e. when the entry has to be committed. This is actually called 2PC (Two Phase Commit).</p>
<p>The append request contains two identifiers, one is the term index which I already mentioned before, and another is the log index which is the position of the new entry in the log. The leaders use these two index values to determine if the majority of the servers have the logs up to date and then issue a commit.</p>
<p>In any case, the logs become inconsistent, the leader forces the followers to duplicate the leader's log. To bring a follower’s log into consistency with its own, the leader finds the latest log entry where the two logs agree, deletes any entries in the follower’s log after that point, and sends the follower all of the leader’s entries after that point.</p>
<p>This is how the Leader ensures that every server (or at least the majority) has the same order of the logs i.e. consensus is reached, performs the computation, and then responds to the client.</p>
<p>This is how we can build a system with high data consistency with Raft and many distributed consistent database like CockroachDB uses Raft.</p>
<hr />
<p>This was a very brief overview of Raft. There are many more aspects to this that couldn't be covered in a blog and I urge you to go through the original paper. I hope you found my blog useful. If you have any feedback share it in the comments. You can sign up for the Hashnode newsletter to get notified every time I post a blog. Learn more about me at <a target="_blank" href="https://arnabsen.dev/about">arnabsen.dev/about</a>. Have a nice day.</p>
]]></content:encoded></item><item><title><![CDATA[Understanding MapReduce]]></title><description><![CDATA[MapReduce is a programming paradigm that helps us perform large-scale computation across computing clusters.

DISCLAIMER: In this blog, I will take a very simple overview of this topic. If this blog actually spikes your interest and you want to delve...]]></description><link>https://arnabsen.dev/understanding-mapreduce</link><guid isPermaLink="true">https://arnabsen.dev/understanding-mapreduce</guid><category><![CDATA[Tutorial]]></category><category><![CDATA[System Design]]></category><category><![CDATA[mapreduce]]></category><dc:creator><![CDATA[Arnab Sen]]></dc:creator><pubDate>Sat, 30 Sep 2023 07:25:48 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1700986739771/03687b9c-8ec8-45c0-9bfd-05b45fd9d2e5.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote>
<p>MapReduce is a programming paradigm that helps us perform large-scale computation across computing clusters.</p>
</blockquote>
<p><strong>DISCLAIMER:</strong> In this blog, I will take a very simple overview of this topic. If this blog actually spikes your interest and you want to delve into the technical nitty-gritty then I would urge you to read the original paper: <a target="_blank" href="https://static.googleusercontent.com/media/research.google.com/en//archive/mapreduce-osdi04.pdf"><strong>"MapReduce: Simplified Data Processing on Large Clusters"</strong></a> (It was written by the Top-Gs in the programming world: <a target="_blank" href="https://www.informatika.bg/jeffdean">Jeff Dean</a> and Sanjay).</p>
<h1 id="heading-background">Background</h1>
<p>Let's start with a little bit of background.</p>
<p>Currently at Google, I am working on a project that requires me to process a large amount of logs, perform some computations, and then write the computed results in a database. This has to happen on a daily basis and the output is then consumed by downstream teams for further operation.</p>
<p>One might think, what's the big deal in that? Just take the log file as input, implement the logic, and write the results to an output file. That's what we have always been doing.</p>
<p>Well, one thing we should take into consideration is the size of the file that we are dealing with. It is actually in the multiple of Terabytes. Taking our traditional path for problems like this would cause a lot of issues like:</p>
<ol>
<li><p><strong>Performance Issue:</strong> the entire thing would probably take a whole lot of time and it can have a lot of potential bottlenecks.</p>
</li>
<li><p><strong>Memory Issue:</strong> How are we even going to load the entire TBs of data into memory? We have to implement some partitioning ourselves to do it effectively.</p>
</li>
<li><p><strong>Scalability Issue:</strong> Very difficult to actually scale it to multiple machines.</p>
</li>
<li><p><strong>Fault Tolerance:</strong> Let's say you somehow managed to overcome all the problems above, what if at the last moment, something crashes, how are we going to recover?</p>
</li>
</ol>
<p>This is why Google came up with the MapReduce paradigm. There is also an open-source implementation of the same called <strong>"Apache Hadoop"</strong>.</p>
<p><img src="https://hadoop.apache.org/hadoop-logo.jpg" alt="hadoop-logo" class="image--center mx-auto" /></p>
<p>Link: <a target="_blank" href="https://github.com/apache/hadoop">https://github.com/apache/hadoop</a></p>
<h1 id="heading-whats-mapreduce">What's MapReduce?</h1>
<p>You must have already noticed that the name <strong>MapReduce</strong> is made up of two parts: <strong>Map</strong> and <strong>Reduce</strong>.</p>
<p>You might have often used these functions in Python, JavaScript, etc. Something like this:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1695550417835/76197584-24c1-45bc-a9fd-f84545c9ed39.png" alt="Map and Reduce function in JS over an array" class="image--center mx-auto" /></p>
<h2 id="heading-map-function">Map Function</h2>
<p>The <strong>Map</strong> function applies a given function to each element in a collection (such as a list or array) and produces a new collection of transformed values. It is often used to perform element-wise operations on data.</p>
<h2 id="heading-reduce-function">Reduce Function</h2>
<p>The <strong>Reduce</strong> function takes a collection and combines its elements into a single result by repeatedly applying a binary operation. It reduces a collection to a single value.</p>
<p>Here is a visualization to help you understand it better:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1695550846214/69628440-7a1d-4c20-ab9b-710cc8f8eaf6.png" alt class="image--center mx-auto" /></p>
<p>These two methods are fundamental to the Functional Programming Paradigm. I came across these when I started learning functional programming languages like OCaml, Lisp, and Rescript. The main idea is to process the data in a functional, declarative manner.</p>
<p>Inside the map function, we provide the transformational logic and in the reduce function we provide the aggregator logic, and no need to specify any logic for the looping, etc.</p>
<p>A large number of problems can actually be split into two broad logic: <strong>Map phase</strong> and <strong>Reduce phase</strong>. Some examples mentioned in the paper are:</p>
<ul>
<li><p>Distributed Grep</p>
</li>
<li><p>Counting URL access frequency</p>
</li>
<li><p>Reverse Web-Link Graph</p>
</li>
<li><p>Term-Vector per host</p>
</li>
</ul>
<p>Let me give a simple example, let's say you are working on a Music Recommendation Algorithm. Before you can actually use the data for the recommendation algorithm you will have to do some pre-processing. Usually, logs contain everything, and we may not need all of them, so we have to modify the logs to a form that is relevant to us. To further simplify things, let's say we just need the Genre of the music from the log data. We can use a map function for that.</p>
<p>Then let's say our recommendation algorithm also needs the number of music the user has listened to for each genre. A reduce function can do this. Here is a sample Python code to help you understand better:</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> functools <span class="hljs-keyword">import</span> reduce

logs = [
  {
    <span class="hljs-string">'name'</span>: <span class="hljs-string">'Shape of You'</span>,
    <span class="hljs-string">'singer'</span>: <span class="hljs-string">'Ed Sheeran'</span>,
    <span class="hljs-string">'genre'</span>: <span class="hljs-string">'pop'</span>
  },
  {
    <span class="hljs-string">"name"</span>: <span class="hljs-string">"Uptown Funk"</span>,
    <span class="hljs-string">"singer"</span>: <span class="hljs-string">"Mark Ronson ft. Bruno Mars"</span>,
    <span class="hljs-string">"genre"</span>: <span class="hljs-string">"pop"</span>
  },
  {
    <span class="hljs-string">"name"</span>: <span class="hljs-string">"Bohemian Rhapsody"</span>,
    <span class="hljs-string">"singer"</span>: <span class="hljs-string">"Queen"</span>,
    <span class="hljs-string">"genre"</span>: <span class="hljs-string">"rock"</span>
  },
  {
    <span class="hljs-string">"name"</span>: <span class="hljs-string">"Friends in Low Places"</span>,
    <span class="hljs-string">"singer"</span>: <span class="hljs-string">"Garth Brooks"</span>,
    <span class="hljs-string">"genre"</span>: <span class="hljs-string">"country"</span>
  }
]

<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">update_frequency_count</span>(<span class="hljs-params">freq_dict, num</span>):</span>
    <span class="hljs-keyword">if</span> num <span class="hljs-keyword">in</span> freq_dict:
        freq_dict[num] += <span class="hljs-number">1</span>
    <span class="hljs-keyword">else</span>:
        freq_dict[num] = <span class="hljs-number">1</span>
    <span class="hljs-keyword">return</span> freq_dict

<span class="hljs-comment"># Map operation</span>
<span class="hljs-comment"># {name, singer, genre} -&gt; genre</span>
genres = list(map(<span class="hljs-keyword">lambda</span> log: log[<span class="hljs-string">'genre'</span>], logs))
<span class="hljs-comment"># genres: ['pop', 'pop', 'rock', 'country']</span>

<span class="hljs-comment"># Reduce operation</span>
frequency_count = reduce(update_frequency_count, genres, {})

print(frequency_count)
<span class="hljs-comment"># {'pop': 2, 'rock': 1, 'country': 1}</span>
</code></pre>
<p>Both of these functions are deterministic. Also, the map operation on one element doesn't depend on the result of another operation. In other words, they are independent of each other as well.</p>
<p>So we can <strong>parallelize the operations</strong> of Map and Reduce. We can further extend the same thought process by breaking the input data into several chunks of data and having one map function for each chunk of data. This can also solve our <strong>Fault Tolerance issue</strong>, if something breaks on operation, it won't affect the others cause now they are all running independently in a parallel fashion. We can just re-run the broken process with the small chunk of data. You can see the big picture now as to why the Map and Reduce functions were considered specifically to solve this kind of problem.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1695564417789/694494d8-be8b-4775-ad30-b29d93468d57.png" alt class="image--center mx-auto" /></p>
<p>To quote the paper:</p>
<blockquote>
<p>"Our use of functional model with user specified map and reduce operation allows us to paralelize large computations easily and to use re-execution as the primary mechanism for fault tolerance."</p>
</blockquote>
<p>Let's dive into the programming model deeper and then we will take another very popular example to understand the programming model.</p>
<p>With MapReduce, we usually deal with key/value pairs cause it's pretty generic. The <strong>Map</strong> takes an input pair and produces a set of intermediate key/value pairs. The MapReduce library groups all the intermediate values associated with the intermediate key <code>I</code> and passes them to the <strong>Reduce</strong> function.</p>
<p>The <strong>Reduce</strong> function then accepts the intermediate key <code>I</code> and a set of values for that key and then merge together values to form a possibly smaller set of values (it can be one as well).</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1695570829503/da6f97fa-8bb0-43a4-9a0e-6ffb57e2e849.png" alt class="image--center mx-auto" /></p>
<h1 id="heading-stages-of-mapreduce">Stages of MapReduce</h1>
<p>Now let's dive into the actual working of MapReduce.</p>
<h2 id="heading-splitting-the-input">Splitting the Input</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1695740855203/59d6634a-c930-420e-aa06-bbaa478a853b.png" alt class="image--center mx-auto" /></p>
<p>The input data is actually partitioned into smaller chunks, typically 16 MB or 64 MB. Let's say the number of chunks/splits is <code>M</code>. Then there will be <code>M</code> map operations in total.</p>
<p><strong><em>Why 64MB?</em></strong> That can be a whole separate topic of discussion but you can think of it like these large amounts of data are usually stored on local disks of the machine that make up the cluster. <strong>Google File System (GFS)</strong> divides each file into 64MB blocks, so having the input data of the same size will ensure that the map function just has to read data from one block thus reducing I/O latency.</p>
<p>The Reduce invocations are also distributed by partitioning the intermediate key space into <code>R</code> pieces using a partitioning function (we will discuss this later in this blog). The number <code>R</code> is also set by the user.</p>
<h2 id="heading-building-the-army">Building the army</h2>
<p>When we start the MapReduce function, it first starts a special process called <strong>"master"</strong>. The master as you might have already guessed does a lot of management-related work like assigning Map and Reduce operations, handling exceptions, etc.</p>
<p>The program also starts up many copies of the program on the other machines. These are done by the <code>fork</code> system call. All the other programs except the master are called "worker nodes" or simply "workers". Each of the workers will be assigned a task from the <code>M</code> map tasks and <code>R</code> reduce tasks which is determined by the master.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1696057820302/4229a66d-b7cd-4641-901b-f82a398a39ff.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-map-stage">Map Stage</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1695742705418/3d64be6a-e0d9-4f51-b2a3-8bf9dd5b34ff.png" alt class="image--center mx-auto" /></p>
<p>A worker who is assigned a map task reads the contents of the corresponding input split. It parses key/value pairs out of the input data and passes each pair to the user-defined Map function. The intermediate key/value pairs produced by the Map function are buffered in memory. Since the map operation doesn't depend on any other worker, all the map workers can parallelly perform this, thus allowing us to linearly scale the performance of the task of extracting data.</p>
<p>Before the workers with Reduce task assigned can work, these buffered pairs are written to the local disk which is partitioned into R partitions by the partitioning function. Once the partitioning is completed, the master is informed, who then signals the location to the Reduce workers to get the rest of the job done.</p>
<h2 id="heading-reduce-phase">Reduce Phase</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1696049156179/44877af8-7aaa-4346-9f4d-af1cb1f77023.png" alt class="image--center mx-auto" /></p>
<p>The Reduce workers then read the intermediate data by using RPC calls. Once it has read all the intermediate data, it performs a sort based on the keys. Why?</p>
<blockquote>
<p>So that all the occurrences of the same key are grouped together. The sorting is needed because typically many different keys map to the same reduce task.</p>
</blockquote>
<p>Let me be frank, it took me some time to wrap my head around this, and I am still not sure if I got it correctly. So if you think my understanding is wrong please don't hesitate to correct me.</p>
<p>Previously we saw that we have <code>M</code> map operations and <code>R</code> reduce operations. Sometimes the same worker is assigned multiple Reduce jobs. Sorting the data makes it easier for the worker to distinguish between the new intermediate data and the old intermediate data. Once the worker finds that the partition has some new data it starts the reduce job again.</p>
<p>In the reduce step it also performs a merge of all the values corresponding to a particular key. So, sorting the keys makes it easier to merge. This will get clear once we go through the steps again taking the example of a word counter.</p>
<p>Finally, the reduce worker goes through the sorted intermediate data and for each unique intermediate key, it passes the key and the set of intermediate values to the user's Reduce function. The output is then appended to the final output file.</p>
<h2 id="heading-last-stage">Last stage</h2>
<p>When all the Reduce workers have completed execution, the master passes control back to the user program. The output of MapReduce is stored in the <code>R</code> output files that the <code>R</code> reduce workers created.</p>
<h1 id="heading-partitioning-function">Partitioning Function</h1>
<p>Let's understand what the partitioning function is all about. As a user, you can define the number of output files you want your data to split between. That number is denoted as <code>R</code> and MapReduce will assign the same number of Reduce workers. So if <code>R = 10</code>, it means that MapReduce will partition the data from the map workers into 10 splits. Each split will be assigned to one Reduce worker which means that there will be 10 Reduce workers. And then each Reduce worker will write the output to a file so the user will have their processed data split into 10 files.</p>
<p>By default, the partitioning algorithm that is used is <code>hash(key) mod R</code>. This usually gives a fairly balanced partition. In some situations, you might want to use a custom function as well. Taking the example from the paper, if your keys are a bunch of URLs and you want them to be partitioned based on the hostname, then you can use a function that extracts the hostname and then applies the hash and mod. So something like: <code>hash(getHostName(key)) mod R</code>.</p>
<h1 id="heading-example">Example</h1>
<p>Let's take the example of the Character Count. We have an input text file with a bunch of words and we have to calculate the frequency of all the characters appearing in the input.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1696054925752/e9ad81cd-4648-4843-beff-ef692f96a83b.png" alt class="image--center mx-auto" /></p>
<p>So, first, we have the input data being split into M partitions. In our case M = 5. So the master worker will assign 5 map workers to map each of these input partitions using the user-defined map function which can be something like this.</p>
<pre><code class="lang-python">map(String key, String value):
    // key: document name
    // value: document content
    <span class="hljs-keyword">for</span> each char c <span class="hljs-keyword">in</span> value:
        EmitIntermediate(c, <span class="hljs-string">"1"</span>);
</code></pre>
<p>So, for the text "apple" our map function will return:</p>
<pre><code class="lang-python">a: <span class="hljs-number">1</span>
p: <span class="hljs-number">2</span>
l: <span class="hljs-number">1</span>
e: <span class="hljs-number">1</span>
</code></pre>
<p>Now, the intermediate output will be "shuffled" by using our partitioning algorithm. Since we are going to consider only the lowercase English alphabet we can have R = 26 for our partitioning algorithm. That way each output will contain the count of one letter. Simply put, our partitioning function will group all the <code>a</code>'s and then pass it to our reducer function.</p>
<p>So, in our case, the reducer function will get the following input:</p>
<pre><code class="lang-python">a: [<span class="hljs-number">1</span>, <span class="hljs-number">3</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>]
</code></pre>
<p>Since we want the total count, we can have a reducer function like this:</p>
<pre><code class="lang-python">reduce(String key, Iterator values):
    // key: a word
    // values: a list of counts
    int result = <span class="hljs-number">0</span>;
    <span class="hljs-keyword">for</span> each v <span class="hljs-keyword">in</span> values:
        result += v;
        Emit(AsString(result));
</code></pre>
<p>This will give us the final result: <code>a: 6</code>.</p>
<p>So this was a very basic overview of the MapReduce workflow. Keep in mind, that this is not a very generic parallel programming paradigm but only applies to problems that fit into these map-reduce paradigms. But from my work experience, I have seen that a lot of the data analysis work does actually fall into this category. Otherwise, why would Google come up with this in the first place xD.</p>
<p>There are many more technical concepts of MapReduce that I didn't cover in this blog. Do go through the research paper for an even more in-depth analysis. In case you have any doubts, feel free to ping me or put them in the comments.</p>
<hr />
<p>I hope you found my blog useful. If you have any feedback share it in the comments. You can sign up for the Hashnode newsletter to get notified every time I post a blog. Learn more about me at <a target="_blank" href="https://arnabsen.dev/about">arnabsen.dev/about</a>. Have a nice day.</p>
]]></content:encoded></item><item><title><![CDATA[My university experience]]></title><description><![CDATA[Intro

Heads up: I initially wrote this blog at the end of my 3rd year, now that I have successfully graduated I figured why not take a stroll down memory lane and spill the beans on my last year too. Unlike my usual techy blogs, this one's more like...]]></description><link>https://arnabsen.dev/my-university-experience</link><guid isPermaLink="true">https://arnabsen.dev/my-university-experience</guid><category><![CDATA[#universityexperience]]></category><category><![CDATA[BlogsWithCC]]></category><category><![CDATA[#BlogsWithCC on Hashnode]]></category><dc:creator><![CDATA[Arnab Sen]]></dc:creator><pubDate>Mon, 21 Aug 2023 18:30:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1700986712386/f4abdf4e-7067-4b4c-a1cd-cbf7e4165b84.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-intro">Intro</h2>
<blockquote>
<p><strong>Heads up:</strong> I initially wrote this blog at the end of my 3rd year, now that I have successfully graduated I figured why not take a stroll down memory lane and spill the beans on my last year too. Unlike my usual techy blogs, this one's more like the adventure of a super curious nerd trying to do it all! 😅</p>
</blockquote>
<p>Hi there 👋</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1697923640250/e4488a4b-d92e-4add-921c-72f468e9dea7.jpeg?auto=compress,format&amp;format=webp" alt /></p>
<p>Let me start with a brief introduction. I am <strong>Arnab Sen</strong>, <s>currently, a </s> <strong><s>final year undergraduate</s></strong> <s>at </s> <strong><s>IIEST Shibpur</s></strong> <s>pursuing my</s> graduate with <strong>B.Tech</strong> in Computer Science. In this article, I will share my 4 years of experience as an undergrad exploring various technologies. It includes:</p>
<ol>
<li><p><em>What</em> technologies have I learned? <em>When? Why? How?</em> resources that I referred to.</p>
</li>
<li><p>My journey from <strong>CP</strong> → <strong>CTF</strong> → <strong>Open Source</strong> → <strong>Google Intern</strong> → Multiple Startups → Google (presently).</p>
</li>
<li><p>The various communities I am currently a part of. And many more...</p>
</li>
</ol>
<h2 id="heading-before-joining-college">Before Joining College</h2>
<p>As a kid, I have always been into computers. I would always tinker with the PC that I got in my 5th standard. And when I say <em>"tinker"</em>, I mean breaking stuff by installing pirated games that had a lot of viruses and you know what I mean 🤷‍♂️.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1659713618972/LwE3mNzB2.png" alt="image.png" class="image--center mx-auto" /></p>
<p>So, every month or so my dad had to call this Tech guy who would then "format" my PC and install a pirated Windows 7 and charge my dad 500 Rs. At one point, I got pretty frustrated because my dad would restrict my PC usage and at the same time felt a bit sad that he had to pay 500 Rs every time for my misdeeds (to a kid 500 was a lot of money). So I started looking for a free alternative. That's when I came across Linux for the first time.</p>
<p>I remember installing <strong>Ubuntu 14</strong> by myself and I felt like I am going to become the next Bill Gates. To be honest, on the first try, I ended up wiping the entire hard disk. So it was actually after a bunch of tries that I was able to successfully install it. This kind of sparked my interest in computers and I ended up taking CS as my stream in College.</p>
<p>I even wrote another blog sharing my very initial days of programming here (but don't jump there directly, first complete this one and maybe then you can decide if it's worth it).</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://arnabsen.dev/my-tech-journey#heading-where-it-all-started">https://arnabsen.dev/my-tech-journey#heading-where-it-all-started</a></div>
<p> </p>
<h2 id="heading-1st-year">1st Year</h2>
<p>By this time I had very basic knowledge about <strong>C++</strong> since we had it on our CBSE Boards. And the first thing that I was exposed to was <strong>Competitive Coding</strong>. I practised my <strong>Data Structures and Algorithms</strong> from:</p>
<ul>
<li><p><a target="_blank" href="https://www.youtube.com/watch?v=HtSuA80QTyo&amp;list=PLUl4u3cNGP61Oq3tWYp6V_F-5jb5L2iHb&amp;ab_channel=MITOpenCourseWare">MIT 6.006 Introduction To Algorithms</a>.</p>
</li>
<li><p><a target="_blank" href="http://www.cs.ucf.edu/~sharma/Algorithms_notes.pdf">CLRS (The Bible of Algorithms and Data Structures)</a> and its <a target="_blank" href="https://sites.math.rutgers.edu/~ajl213/CLRS/CLRS.html">solutions</a>.</p>
</li>
</ul>
<p>For problem-solving, I used to refer to:</p>
<ul>
<li><p><a target="_blank" href="https://www.hackerrank.com/">Hackerrank</a></p>
</li>
<li><p><a target="_blank" href="https://codeforces.com/">Codeforces</a></p>
</li>
<li><p><a target="_blank" href="https://www.codechef.com/">Codechef</a></p>
</li>
<li><p><a target="_blank" href="https://atcoder.jp/">Atcoder</a></p>
</li>
<li><p><a target="_blank" href="https://cses.fi/">CSES</a></p>
</li>
<li><p><a target="_blank" href="https://projecteuler.net/">Project Euler</a></p>
</li>
</ul>
<p>My main motive at that time was to prepare for <a target="_blank" href="https://icpc.global/">ICPC</a> and improve my general coding skills and my knowledge of C++.</p>
<p>By the end of the 1st year, I became pretty good at CP and even reached <strong>Experts</strong> in <a target="_blank" href="https://codeforces.com/profile/arnab1729">Codeforces</a>. But I started losing interest in this field, cause they were mainly about solving abstract problems. I wanted to tackle some real-world problems and came across Cybersecurity.</p>
<h2 id="heading-2nd-year">2nd Year</h2>
<p>This is when COVID happened, I had a lot of free time to explore. With my interest in CP declining, I wanted to know more about computer internals and its fundamental workings. So I started solving CTF Challenges.</p>
<p>Since not many people may know about this, let me explain CTFs. CTF stands for <strong>Capture The Flag</strong>. You will be given a security challenge, it can be an encrypted text or a vulnerable website. You have to bypass the security or decrypt the ciphertext to get a token which is called the <strong>flag</strong>. Finding the flag wins some points and finally, the team/individual with the most points wins. This category of CTF is called <strong>Jeopardy style</strong>.</p>
<p>There is another style of CTF called <strong>Attack-N-Defense</strong>. Here we have two teams one <em>Red team</em> and another <em>Blue team</em>. The Red team's job is to break into a machine/system by finding loopholes and security flaws, while the Blue team's job is to fix those loopholes and patch those vulnerabilities before the Red team is able to enter the system.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://www.youtube.com/watch?v=Lus7aNf2xDg&amp;ab_channel=LiveOverflow">https://www.youtube.com/watch?v=Lus7aNf2xDg&amp;ab_channel=LiveOverflow</a></div>
<p> </p>
<p>The reason these CTF challenges intrigued me was that they are based on more real-life scenarios. To solve CTF challenges I had to learn:</p>
<ul>
<li><p>Assembly Language</p>
</li>
<li><p>Reversing</p>
</li>
<li><p>Binary Exploitation</p>
</li>
<li><p>Web Vulnerabilities like CSRF, XSS, SQL Injection</p>
</li>
<li><p>Cryptography like RSA, Symmetric and Asymmetric key encryption</p>
</li>
<li><p>Computer Networking dealing with network packet capture</p>
</li>
<li><p>Steganography, learning how PNGs work, how zip compression works, etc</p>
</li>
<li><p>Writing scripts in bash, python, C .etc and many more</p>
</li>
</ul>
<p>My knowledge of computer fundamentals grew and I learned how to use tools like gdb, tcpdump, burpsuite, etc.</p>
<p>With rigorous practice and participating in a bunch of CTF challenges my team (which included me and my friend) ranked <strong>67th in CTFTime</strong> in India.</p>
<p>There are no one-place resources for CTFs cause it is a huge domain. To even understand the vulnerabilities of a particular technology you have to be proficient in that technology first. For example, to understand the weakness of RSA, one needs to know how RSA works and what is the significance of exponent (e) and the primes (p and q).</p>
<p>But these are some of the YouTube channels I followed:</p>
<ul>
<li><p><a target="_blank" href="https://www.youtube.com/c/LiveOverflow">LiveOverflow</a></p>
</li>
<li><p><a target="_blank" href="https://www.youtube.com/c/JohnHammond010">John Hammond</a></p>
</li>
<li><p><a target="_blank" href="https://www.youtube.com/c/ippsec">ippsec</a></p>
</li>
<li><p><a target="_blank" href="https://www.youtube.com/c/GynvaelEN">GynvaelEN</a></p>
</li>
</ul>
<p>However the best way to learn is to participate in the CTF challenges and then read the writeups or have discussions with other teams after the CTF is over.</p>
<p>By the end of 2nd year, I got into a fellowship program called <a target="_blank" href="https://fullstack.pupilfirst.org/">Pupilfirst Coronasafe Fellowship</a>. I was in the top <strong>24 out of 50k</strong> applicants. So, for the rest of the 2nd year, I was learning technologies like <em>Ruby on Rails</em>, and <strong>Rescript React</strong> and started my open source journey. As a Pupilfirst Coronasafe Fellow, I contributed to two open source health care projects called <a target="_blank" href="https://github.com/coronasafe/arike/commits?author=arnabsen1729">Arike</a> and <a target="_blank" href="https://github.com/coronasafe/life/commits?author=arnabsen1729">Life</a>. Through this experience, I learned about:</p>
<ul>
<li><p>Building and <strong>designing</strong> software, the workflow of the applications, and understanding the user experience</p>
</li>
<li><p><strong>Pair programming</strong>, is a cool way to learn and work. <a target="_blank" href="https://martinfowler.com/articles/on-pair-programming.html">Read more</a>.</p>
</li>
<li><p>The importance of <strong>networking</strong> and having 1:1s with industry experts</p>
</li>
<li><p><strong>Open-source</strong> best practices</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1659719318433/x8kv4ZQyo.png" alt="image.png" class="image--center mx-auto" /></p>
<h2 id="heading-3rd-year">3rd Year</h2>
<p>This is when my internship prep started. I got rejected by Microsoft for both Engage program and the on-campus drive. It was a bit disheartening.</p>
<p>But then I came across <a target="_blank" href="https://www.summerofbitcoin.org/">Summer of Bitcoin</a>. It was an open-source opportunity and since I knew open-source won't dishearten me I applied. And guess what? I got selected. I was among the <strong>51 mentees</strong> for the first ever batch of Summer of Bitcoin. My project was to improve support for <strong>User Statically Defined Tracing</strong> (USDT) in <a target="_blank" href="https://github.com/bitcoin/bitcoin">Bitcoin core</a> by adding new tracepoints and scripts, leveraging <strong>eBPF (extended Berkeley Packet Filter)</strong> technology. But what's more interesting is that during this mentorship, I had to work with:</p>
<ul>
<li><p>C++ (which I did in my <em>1st year for CP</em>)</p>
</li>
<li><p>gdb for debugging (which I did during my <em>2nd year for CTFs</em>)</p>
</li>
<li><p>Github and Open Source practices (which I gained from the <em>coronasafe fellowship experience</em>)</p>
</li>
</ul>
<p>My point is you might not see a direct advantage of what you are learning right now, but knowledge never goes to waste.</p>
<p>There is this very popular story of <strong>Steve Jobs</strong>. Jobs took a calligraphy class at Reed College based on campus posters he saw after dropping out. He knew the class would earn him no credit towards a degree but he still did it anyway. This knowledge of calligraphy, later on, inspired Jobs during his Apple days to include multiple typefaces in Macintosh.</p>
<blockquote>
<p>"If I had never dropped in on that single course in college, the Mac would have never had multiple typefaces or proportionally spaced fonts. And since Windows just copied the Mac, it’s likely that no personal computer would have them.” ~ Steve Jobs</p>
</blockquote>
<p>The takeaway is <strong>to be curious and keep learning</strong>.</p>
<p>I have shared my Summer of Bitcoin journey in detail in my other blog.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://arnabsen.hashnode.dev/my-experience-of-summer-of-bitcoin21">https://arnabsen.hashnode.dev/my-experience-of-summer-of-bitcoin21</a></div>
<p> </p>
<p>A couple of days later, I saw there was an opening at Google for SWE Internship. I asked my senior to refer me and I applied. After a week I got a mail saying that I have 10 days before my interviews. So, I just got back into interview prep. I mostly referred to these resources:</p>
<ul>
<li><p>Leetcode and Leetcode discuss</p>
</li>
<li><p>CLRS</p>
</li>
<li><p>MIT Lectures</p>
</li>
<li><p>Gave a bunch of mock interviews at <a target="_blank" href="https://www.pramp.com/#/">pramp</a>.</p>
</li>
</ul>
<blockquote>
<p>I am not a big fan of practicing from different resources and platforms. I like to keep things simple 😇</p>
</blockquote>
<p>Both of my Google interviews went really well, and after a long wait of 2 months, I heard back that I got the internship. I was on cloud nine because at that point I was starting to get a bit depressed about having no internships even after working really hard.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://media.giphy.com/media/1ThndC5odGuUU/giphy.gif">https://media.giphy.com/media/1ThndC5odGuUU/giphy.gif</a></div>
<p> </p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://arnabsen.dev/landing-a-google-swe-internship">https://arnabsen.dev/landing-a-google-swe-internship</a></div>
<p> </p>
<h2 id="heading-my-first-corporate-internship">My first corporate internship</h2>
<p>Luckily, I got a really interesting and impactful project. It had to be built from scratch. So, a lot of time was spent writing design docs, making sequence diagrams, brainstorming the component workflows, and designing models. I worked for Google Ads.</p>
<p>The main codebase was in <strong>Java</strong> and at Google, we have a lot of private frameworks and technologies for internal usage. But some of my key learnings were:</p>
<ul>
<li><p><strong>Communication</strong> is the key. It doesn't matter if you have a solution in your head if you can't explain it to the other person.</p>
</li>
<li><p><strong>Reach out</strong> for doubts. No one knows everything, so don't shy away from asking doubts. But while asking doubts make sure you have <strong>researched</strong> properly, provide enough <strong>information</strong> regarding the doubts, your thought process, your <strong>approaches</strong>, etc.</p>
</li>
<li><p>Always keep your manager/host <strong>updated</strong> about your work.</p>
</li>
<li><p><strong>Meet new people</strong>, ask them about their project, their work what they like the most, etc. Getting insights from people who are more experienced than you helps a lot in gaining a new perspective which is really important as a fresher. The more you network the more you grow. At Google, we have this Lunch Ninja where we are paired with a random Googler to have a 1:1 discussion. I met so many amazing people that way, people from different roles like DevRel, SRE, UI/UX Designer, etc.</p>
</li>
<li><p>Writing <strong>high-quality code</strong>. In most of our personal projects, we don't care much about the code quality, but in industry, it's the code that is readable and is working that get's merged. So writing code that follows the readability standards and the style guides was a big takeaway.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1659720329863/4FAqBGeBy.png" alt="image.png" class="image--center mx-auto" /></p>
<p>I also wanted to add, that after the successful completion of my 10-week internship, I even got a pre-placement offer from Google and will be joining them next year 😊.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://twitter.com/ArnabSen1729/status/1551660735440179201">https://twitter.com/ArnabSen1729/status/1551660735440179201</a></div>
<p> </p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://arnabsen.dev/important-tips-on-bagging-ppo-during-internship-and-securing-a-full-time-role">https://arnabsen.dev/important-tips-on-bagging-ppo-during-internship-and-securing-a-full-time-role</a></div>
<p> </p>
<h2 id="heading-4th-year">4th Year</h2>
<p>Having the PPO at hand gave me some confidence to try out even more stuff. Even during my internship my entire team at Google praised me for my blogs. So, my first thought was to take up blogging.</p>
<h3 id="heading-codedamn">Codedamn</h3>
<p>I got the opportunity to write technical content for <a target="_blank" href="https://www.youtube.com/@codedamn">Codedamn</a>. I worked with them for like 2 months and got a lot of articles published. You can find them here: <a target="_blank" href="https://codedamn.com/news/author/arnabsen">https://codedamn.com/news/author/arnabsen</a>.</p>
<p>The issue I had with blogging for someone else was that I had very limited freedom to decide on the topics to research and blog. It went against the very essence of why I started blogging in the first place. So, even after leaving Codedamn, I continued to blog about random stuff on my personal website.</p>
<h3 id="heading-cypherock">Cypherock</h3>
<p>But I still felt the need to do something more challenging, so I started applying for various startups and interviewed a bunch of them. Finally, I decided to start another internship with <a target="_blank" href="https://www.cypherock.com/">Cypherock</a>.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://twitter.com/ArnabSen1729/status/1583496781131763712">https://twitter.com/ArnabSen1729/status/1583496781131763712</a></div>
<p> </p>
<p>In the next 6 months, I learned a lot about firmware and embedded systems development, various cryptographic, hashing, and encryption algorithms and how fast-paced startups work.</p>
<h3 id="heading-xros-fellowship">XROS Fellowship</h3>
<p>Again the curiosity in me sparked and I found another perfect opportunity. Meta, Digital India and FICCI came up with a fellowship opportunity to train young devs in the field of Augmented Reality/Virtual Reality. It was called XROS Fellowship and I applied and was among the 100 devs who were selected for this opportunity. I worked for an org called GMetriXR.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://arnabsen.dev/xros-fellowship">https://arnabsen.dev/xros-fellowship</a></div>
<p> </p>
<p>While doing this I was also working as a Teaching Assistant at Pupilfirst, reviewing the submissions of the students in the cohort, conducting sessions and solving doubts.</p>
<h2 id="heading-outro">Outro</h2>
<p>As you might have seen I have tried out different stuff throughout my college days and still doing. I have also participated in hackathons, kept sessions at our GDSC, and facilitated campaigns. I love sharing my knowledge through blogs.</p>
<p>My approach remains the same for everything, <strong>"no matter what you are doing, give your best and try to go the extra mile".</strong></p>
<p>Feel free to connect with me on any of my social handles.</p>
]]></content:encoded></item><item><title><![CDATA[My XROS Fellowship Experience]]></title><description><![CDATA[What does XROS even stand for? It stands for "XR Open Source".
Ok, but what is XR? XR refers to Extended Reality.
Umm, and what's that?....
Understanding "Extended Reality"
Extended Reality (XR) is a term that encompasses the entire spectrum of compu...]]></description><link>https://arnabsen.dev/xros-fellowship</link><guid isPermaLink="true">https://arnabsen.dev/xros-fellowship</guid><category><![CDATA[internships]]></category><category><![CDATA[mentorship]]></category><category><![CDATA[Augmented Reality]]></category><dc:creator><![CDATA[Arnab Sen]]></dc:creator><pubDate>Sun, 20 Aug 2023 06:58:24 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1700988047509/9b3457f4-883f-445d-8a1a-e39f29957ae7.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong>What does XROS even stand for?</strong> It stands for "XR Open Source".</p>
<p><strong>Ok, but what is XR?</strong> XR refers to Extended Reality.</p>
<p><strong>Umm, and what's that?....</strong></p>
<h2 id="heading-understanding-extended-reality">Understanding "Extended Reality"</h2>
<p>Extended Reality (XR) is a term that encompasses the entire spectrum of computer-generated environments, including both <strong>virtual reality (VR)</strong> and <strong>augmented reality (AR)</strong>, as well as <strong>mixed reality (MR)</strong> and other related technologies. XR combines real and virtual elements to create immersive experiences that go beyond the physical world.</p>
<p><strong>Virtual Reality (VR)</strong> refers to a simulated environment that is completely computer-generated, allowing users to be fully immersed in a digital world. Users typically wear a VR headset that tracks their head movements and provides a visual and auditory experience that feels like being in a different reality.</p>
<p><img src="https://media-cldnry.s-nbcnews.com/image/upload/newscms/2018_11/2362571/180314-virtual-reality-headset-ew-1243p.jpg" alt="This is what Virtual Reality looks like" /></p>
<p><strong>Augmented Reality (AR)</strong> overlays virtual elements onto the real world. AR technology superimposes computer-generated images, videos, or information onto the user's view of the physical environment. This can be experienced through devices like smartphones, tablets, or smart glasses.</p>
<p>You might have heard about AR from the game that went viral (for a lot of reasons 🥲) in 2016. Remember the game? Yes, it is <strong>Pokemon Go</strong>.</p>
<p><img src="https://images.theconversation.com/files/245627/original/file-20181114-194494-1p82jkx.jpg?ixlib=rb-1.1.0&amp;q=45&amp;auto=format&amp;w=1200&amp;h=1200.0&amp;fit=crop" alt="Augmented Reality being implemented in Pokemon Go." /></p>
<p><strong>Mixed Reality (MR)</strong> is just a blend of AR and VR. In other words in mixed reality, virtual objects, and the real world coexist and interact in real-time, enabling users to engage with both simultaneously.</p>
<p>Now that you know what XR means, let's get back to XROS Fellowship.</p>
<h2 id="heading-xros-fellowship">XROS Fellowship</h2>
<p>Here's a snippet from their website, which pretty much covers everything about what XROS Fellowship is.</p>
<blockquote>
<p>XROS Fellowship Program is a uniquely curated initiative aimed at supporting Indian developers working on XR technologies by providing fellowships which will include a stipend and mentoring by industry experts. The Program will support developers to make contributions to open-source projects related to XR technology.</p>
<p>The Program aims to give developers a platform to work with the best resources to create digital public goods and further support their careers by facilitating fellowships in organisations working in the domain of AR, VR, MR, 3D Modelling, etc.</p>
<p>XROS Fellowship will provide a learning cohort for 100 developers and selected developers will work on projects with partner organisations and industry mentors.</p>
</blockquote>
<p>The initiative was taken by <a target="_blank" href="https://ficci.in/"><strong><em>FICCI (Federation of Indian Chambers of Commerce &amp; Industry)</em></strong></a> which is the largest and oldest apex business organization in India and was established in 1927. And the fellowship is further supported by <a target="_blank" href="https://www.meta.com/"><strong><em>Meta</em></strong></a> and implemented by <a target="_blank" href="https://reskilll.com/"><strong><em>Reskilll</em></strong></a><strong><em>.</em></strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684659222002/9d258eb8-2891-4356-a481-9d9287068152.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-perks-of-this-fellowship">Perks of this fellowship</h3>
<ul>
<li><p>💼 3 months of practical experience on live industry projects.</p>
</li>
<li><p>🤝 Networking with industry experts.</p>
</li>
<li><p>💰 Fellowship stipends of <strong>₹ 4 Lakhs</strong>.</p>
</li>
</ul>
<h3 id="heading-eligibility-for-this-fellowship">Eligibility for this fellowship</h3>
<ol>
<li><p>The applicant should be <strong>18+ years of age</strong>.</p>
</li>
<li><p>The applicant should be in the pre-final or final year of graduation.</p>
</li>
<li><p>The applicant should be a resident of India.</p>
</li>
</ol>
<h2 id="heading-my-journey">My Journey</h2>
<h3 id="heading-initial-application">Initial Application</h3>
<p>The initial step of the fellowship involved completing a form that requested basic details. This stage aimed to assess whether applicants met the eligibility criteria for the fellowship.</p>
<p>Following this round, I received an email notifying me that my profile had been approved. Additionally, I was provided with a link to the Slack channel, where project mentors and other approved candidates can have a discussion.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684659676115/0a19f6f4-f2f8-4e79-8ca7-953b4d269fe0.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-proposal-round">Proposal Round</h3>
<p>There were approximately 31 organizations listed. Each organization had its own projects, and candidates will need to submit a proposal for the project they wish to work on during their fellowship. A single candidate can only submit a maximum of 4 proposals.</p>
<p>I intended to submit 4 proposals as it would enhance my chances of being selected. Therefore, I would thoroughly review each organization, conduct some research on them, and then examine their respective projects.</p>
<p>My approach involved submitting proposals in the following categories:</p>
<ol>
<li><p>One proposal would focus on a project that genuinely piques my interest, regardless of my familiarity with the associated technology stack.</p>
</li>
<li><p>Another proposal would target a project aligned with a technology stack in which I possess considerable proficiency.</p>
</li>
<li><p>An additional proposal would be directed towards a project that showed minimal candidate activity, indicating reduced competition.</p>
</li>
<li><p>Lastly, I would submit a proposal for a project considered highly challenging. This choice would ensure limited competition and thus increase my chances of success.</p>
</li>
</ol>
<p>Subsequently, I prepared a Notion document accordingly and commenced working on my proposals.</p>
<p>Here is a glimpse of the doc:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684660908341/f852178c-6d6a-4aaf-89d6-0c73a6332f59.png" alt class="image--center mx-auto" /></p>
<p>The Reskilll team also organized AMA sessions with the project mentors, which I would attend. During these sessions, the mentors addressed all the questions and these sessions provided me with a more comprehensive understanding of the project and the organization.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684661127649/af60e66d-28a9-4374-980d-ec0d794c301f.png" alt class="image--center mx-auto" /></p>
<p>So, I finally sat and wrote 4 proposals. We were also given a very basic proposal template. These were the different sections of my proposal template:</p>
<ol>
<li><p><strong>Basic Personal Details.</strong></p>
</li>
<li><p><strong>What excited me to work at &lt;org-name&gt;?</strong></p>
</li>
<li><p><strong>Understanding &lt;project-name&gt;.</strong> <em>(I tried to deep dive as much as possible and covered possible approaches. This particular section will be the determining factor)</em></p>
</li>
<li><p><strong>Proposed Timeline.</strong></p>
</li>
<li><p><strong>Past Work Experience.</strong></p>
</li>
<li><p><strong>Previous Open Source Contribution.</strong></p>
</li>
<li><p><strong>Accomplishments.</strong></p>
</li>
<li><p><strong>Projects.</strong></p>
</li>
</ol>
<h3 id="heading-the-interviews">The Interviews</h3>
<p>After the shortlisting of proposals, we needed to choose a time slot for the interviews. I received interview invitations from 2 out of the 4 organizations I applied to. In preparation for the interviews, I thoroughly reviewed the research I conducted to understand the project. Additionally, I dedicated time to practicing technical questions related to the technology stack.</p>
<p>In my view, these preparations are sufficient for the interviews. Both of my interviews went exceptionally well, and I was really excited about the final results.</p>
<h3 id="heading-the-results">The Results</h3>
<p>After a long wait (it wasn't very long, but I was so much excited it felt long) I finally got a mail saying that I got into the XROS Fellowship Program for the organization <a target="_blank" href="https://www.gmetri.com/"><strong>GMetriXR</strong></a><strong>.</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684663965635/1f131ae7-d653-489a-a4e6-9984ee4b1d31.png" alt class="image--center mx-auto" /></p>
<p>After the AMA, I found myself genuinely intrigued by the GMetri project and its vision. I devoted significantly more time to reviewing the GMetri proposal than to any other. It is often said that diligent efforts yield fruitful results, and in my situation, it came true.</p>
<blockquote>
<p>I am really proud that I was one of the 100 developers selected out of 10,000 applications.</p>
</blockquote>
<h3 id="heading-the-work-at-gmetri">The work at GMetri</h3>
<p><img src="https://s.vrgmetri.com/gb-web/webflow/editor_resized.webp" alt="Create in minutes, not months" /></p>
<p>GMetri in simple words is a toolkit designed for no-code construction of the metaverse. In recent days, we've observed the remarkable influence that Artificial Intelligence (AI) - particularly large Language Models like GPT - has had on everyday life. Its capacity to compose poems, craft music, and generate images is just phenomenal. My project at GMetri was aimed at leveraging the prowess of AI to simplify the process of metaverse creation for users.</p>
<p>For an effective generation of Metaverse Scenes, it is crucial that the AI model possesses an adequate understanding of the context. We called this knowledge base the "AI Brain". My primary responsibility entailed designing the user frontend experience to facilitate the creation of these AI Brains. This involved allowing users to upload information in the form of URLs, documents, and even raw text, which would subsequently be uploaded to the AI Brain. And once the AI Brain is trained the users can query the brain and use those results in the metaverse scene creation.</p>
<h3 id="heading-final-thoughts">Final Thoughts</h3>
<p>This was my last stint during college, cause I graduated after the fellowship period. I learned a lot about AR, VR, and XR through this experience and seeing how much the big techs like Apple, Meta are invested in this field we can expect some amazing innovations happening soon.</p>
<p>Do let me know if this article helped you and follow me for more technical content. Have a nice day.</p>
<hr />
<h2 id="heading-xros-summit">XROS Summit</h2>
<p>Recently all the selected XROS devs were also invited to attend the XROS Summit at New Delhi. It was truly an amazing experience meeting the amazing folks I worked with and networking with others.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1700988487864/ddf85ebb-8828-4994-9323-f60af3b47ef0.png" alt class="image--center mx-auto" /></p>
]]></content:encoded></item><item><title><![CDATA[Breaking Captchas with Golang: Leveraging the Power of 2captcha]]></title><description><![CDATA[Understanding the Role of Captchas in Digital Security
In today's digital landscape, where cyber threats lurk around every virtual corner, safeguarding sensitive information is of paramount importance. One crucial tool that plays a pivotal role in en...]]></description><link>https://arnabsen.dev/breaking-captchas-with-golang-leveraging-the-power-of-2captcha</link><guid isPermaLink="true">https://arnabsen.dev/breaking-captchas-with-golang-leveraging-the-power-of-2captcha</guid><category><![CDATA[golang]]></category><category><![CDATA[technology]]></category><category><![CDATA[Tutorial]]></category><dc:creator><![CDATA[Arnab Sen]]></dc:creator><pubDate>Mon, 29 May 2023 09:30:39 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1684833817754/d4616400-d235-434d-8e17-da289c04f6e0.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-understanding-the-role-of-captchas-in-digital-security">Understanding the Role of Captchas in Digital Security</h2>
<p>In today's digital landscape, where cyber threats lurk around every virtual corner, safeguarding sensitive information is of paramount importance. One crucial tool that plays a pivotal role in enhancing digital security is <strong>captchas</strong>. Captchas, short for "Completely Automated Public Turing tests to tell Computers and Humans Apart," act as a gatekeeper, effectively distinguishing human users from malicious bots. They were invented in 2000 by Luis von Ahn, Manuel Blum, Nicholas Hopper, and John Langford at Carnegie Mellon University. The original CAPTCHAs were text-based and required users to identify distorted words or letters.</p>
<p>These ingenious puzzles serve a lot of purposes. They help prevent a variety of attacks like:</p>
<ul>
<li><p><strong>Spam:</strong> Spam is unsolicited electronic messages, typically sent in bulk. CAPTCHAs can be used to prevent spam bots from creating accounts or sending messages by requiring users to solve a CAPTCHA before they can create an account or send a message.</p>
</li>
<li><p><strong>DDoS attacks:</strong> A DDoS attack is a distributed denial-of-service attack. This type of attack is designed to overwhelm a website or online service with so much traffic that it becomes unavailable to legitimate users. CAPTCHAs can be used to prevent DDoS attacks by making it more difficult for attackers to generate large numbers of requests.</p>
</li>
<li><p><strong>Credential stuffing:</strong> Credential stuffing is a type of attack where attackers try to use stolen login credentials to access multiple accounts. CAPTCHAs can be used to prevent credential stuffing attacks by making it more difficult for attackers to try login credentials on multiple websites.</p>
</li>
<li><p><strong>Phishing:</strong> Phishing is a type of attack where attackers send fraudulent emails that appear to be from a legitimate source. The goal of phishing is to trick the recipient into clicking on a malicious link or providing personal information. CAPTCHAs can be used to prevent phishing attacks by making it more difficult for attackers to create realistic-looking phishing emails.</p>
</li>
<li><p><strong>Click fraud:</strong> Click fraud is a type of attack where attackers click on ads without human interaction. This type of attack is used to generate revenue for the attacker. CAPTCHAs can be used to prevent click fraud by making it more difficult for attackers to click on ads without human interaction.</p>
</li>
</ul>
<p>By incorporating captchas, website owners can fortify their defense against various cyber threats, such as spam, fraud, and unauthorized access. The utilization of visual or audio-based challenges, often involving distorted characters or logical tasks, impedes automated programs' ability to infiltrate online platforms.</p>
<h2 id="heading-how-did-captchas-even-come-into-the-picture">How did Captchas even come into the picture?</h2>
<p>Well, this dates back to a paper titled <a target="_blank" href="https://en.wikipedia.org/wiki/Computing_Machinery_and_Intelligence">"Computing Machinery and Intelligence"</a> that was published in 1950 by the famous and legendary computer scientist, mathematician, logician, cryptanalyst, philosopher, and theoretical biologist 🤯.</p>
<p>Are you able to guess who I am talking about?</p>
<p>Well here is a hint 💡: <em>He is famously regarded as the father of modern computer science</em>.</p>
<p><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/a1/Alan_Turing_Aged_16.jpg/220px-Alan_Turing_Aged_16.jpg" alt="Alan Turing" class="image--center mx-auto" /></p>
<p>Yes, none other than <strong>Alan Turing</strong>.</p>
<p>He asked a question "Can a computer talk like a human?". This question led to an idea for measuring artificial intelligence that would famously come to be known as the Turing test. Turing proposed the following game. A human judge has a text conversation with unseen players and has to evaluate their responses. To pass the test, a computer must be able to replace one of the players without substantially changing the results. In other words, a computer would be considered intelligent if its conversation couldn't be easily distinguished from a human's.</p>
<p>Believe it or not, this same principle is used today to differentiate between a real human and a bot. You can think of captchas as simplified and automated Turing Test and every time you are able to solve a captcha you are basically passing a mini Turing Test.</p>
<blockquote>
<p>P.S: If you are also a movie buff I would highly encourage you to watch the movie The Imitation Game where Benedict Cumberbatch played the role of Alan Turing.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684776262621/be312263-73c8-4114-89d6-fada37acf8f3.png" alt /></p>
</blockquote>
<p>Now, that you know a brief about how captchas came into the picture, let's learn the different types of captchas.</p>
<h2 id="heading-what-are-the-different-types-of-captchas">What are the different types of captchas?</h2>
<p>You might have across different types of captchas while surfing the internet, here are the broad categories of captchas:</p>
<ol>
<li><p><strong>Text CAPTCHA:</strong> The oldest and most common type of CAPTCHA, this involves inputting text from a distorted or obscured image. The logic here is that humans can interpret obscured text while bots cannot.</p>
</li>
<li><p><strong>Image CAPTCHA:</strong> This type of CAPTCHA involves identifying specific types of objects or patterns in an image. For instance, a user might be asked to select all squares of a grid containing traffic lights or buses.</p>
</li>
<li><p><strong>Audio CAPTCHA:</strong> For users with visual impairments, audio CAPTCHAs are used. In this case, a short audio clip is played and the user is asked to type the words or numbers that they hear.</p>
</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684777052166/fa154d16-6121-46a3-9342-acd7f80333e9.png" alt class="image--center mx-auto" /></p>
<p>There are a bunch of service providers available who allow you to use their captcha services on your websites. Some of the most popular ones include:</p>
<ul>
<li><p><a target="_blank" href="https://www.google.com/recaptcha/about/">Google reCAPTCHA</a></p>
</li>
<li><p><a target="_blank" href="https://www.hcaptcha.com/">hCaptcha</a></p>
</li>
<li><p><a target="_blank" href="https://www.geetest.com/en/">GeeTest</a></p>
</li>
<li><p><a target="_blank" href="https://www.keycaptcha.com/">KeyCaptcha</a></p>
</li>
<li><p><a target="_blank" href="https://www.leminnow.com/">Lemin Captcha</a></p>
</li>
</ul>
<p>Now, from a personal point of view I kind of hate solving these captchas, and finding the traffic lights.</p>
<p><img src="https://static.boredpanda.com/blog/wp-content/uploads/2020/09/5f6349d7ca79f-png__700.jpg" alt="16 Times People Struggled With These Captchas So Much, They Shared It  Online | Bored Panda" class="image--center mx-auto" /></p>
<p>So, I started looking if there were any ways to bypass these irritating captchas and I landed upon a goldmine <a target="_blank" href="https://2captcha.com/">2captcha</a>. Turns out, these captchas weren't as secure as I used to believe. Today we will look at a demo of how I ended up writing a script to bypass these captchas.</p>
<p>But, before that, let's learn about 2Captcha.</p>
<h2 id="heading-what-is-2captcha">What is 2Captcha?</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684779056073/89c0c0ec-4019-4f15-be63-8e43d7e94880.svg" alt class="image--center mx-auto" /></p>
<p>2Captcha operates as a real-time CAPTCHA decoding service, proficient in distinguishing and interpreting captchas with accuracy. It leverages human intellect for image recognition tasks, ensuring high levels of precision. Offering compatibility with a wide range of programming languages through its API, 2Captcha can identify and solve a diverse variety of CAPTCHA types. In fact, 2Captcha can actually solve all the captcha types I mentioned above.</p>
<p>So, without further ado, let's use the Golang module of 2Captcha and build ourselves a CLI tool. You will be amazed to see how easy it is to use this service.</p>
<h2 id="heading-building-the-golang-cli-tool">Building the Golang CLI tool</h2>
<p>So, the first step would be to create an account in 2Captcha and get our API key.</p>
<h3 id="heading-1-creating-our-2captcha-account">1. Creating our 2Captcha account</h3>
<p>Visit their website <a target="_blank" href="https://2captcha.com/">https://2captcha.com/</a> and then sign in with your method of choice. After that, you will land on a page like this:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684782650167/fcb286ab-f53a-46f1-a800-c55d92c2b939.png" alt class="image--center mx-auto" /></p>
<p>Select the left option of "I'm a customer" and then you will be redirected to the dashboard where you can see your API key.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1684782897650/e2ac15f2-f318-426a-bd6a-c947687d74c2.png" alt class="image--center mx-auto" /></p>
<p>Now, to further move ahead with our project make sure that you have Golang installed in your machine. To check that simply run <code>go version</code> in the terminal and it should show the version of Golang that is installed. If it gives an error, you will have to install Golang.</p>
<p>Once you are done with all these we can finally initialize our Golang Project.</p>
<h3 id="heading-2-initialize-our-golang-project">2. Initialize our Golang Project</h3>
<p>To get started, let's initialize a new Golang project. Open your terminal or command prompt and follow the steps below:</p>
<ol>
<li><p>Create a new directory for your project:</p>
<pre><code class="lang-bash"> mkdir captcha-solver
 <span class="hljs-built_in">cd</span> captcha-solver
</code></pre>
</li>
<li><p>Initialize the Go module:</p>
<pre><code class="lang-bash"> go mod init github.com/your-username/captcha-solver
</code></pre>
<p> Replace <code>your-username</code> with your actual GitHub username or any other relevant identifier.</p>
</li>
<li><p>Create a new Go source file named <code>main.go</code>:</p>
<pre><code class="lang-bash"> touch main.go
</code></pre>
</li>
</ol>
<p>You have now set up the basic structure for your Golang project.</p>
<h3 id="heading-3-installing-required-modules">3. <strong>Installing Required Modules</strong></h3>
<p>To interact with the 2Captcha service, we need to install the 2captcha-go library. Run the following command to install the required module:</p>
<pre><code class="lang-bash">go get github.com/2captcha/2captcha-go
</code></pre>
<p>The module will be downloaded and added to your project's <code>go.mod</code> file.</p>
<p>Finally, we will write the code for our captcha solver.</p>
<h3 id="heading-4-building-the-captcha-solver">4. <strong>Building the Captcha Solver</strong></h3>
<p>Now let's proceed with building the captcha solver. Open the <code>main.go</code> file in a text editor and add the following code:</p>
<pre><code class="lang-go"><span class="hljs-keyword">package</span> main

<span class="hljs-keyword">import</span> (
    <span class="hljs-string">"flag"</span>
    <span class="hljs-string">"fmt"</span>
    <span class="hljs-string">"io/ioutil"</span>
    <span class="hljs-string">"log"</span>
    <span class="hljs-string">"os"</span>

    <span class="hljs-string">"github.com/2captcha/2captcha-go"</span>
)

<span class="hljs-keyword">const</span> apiKey = <span class="hljs-string">"&lt;API-KEY&gt;"</span> <span class="hljs-comment">// Replace with your actual API key</span>

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">main</span><span class="hljs-params">()</span></span> {
    <span class="hljs-comment">// Parse input arguments</span>
    captchaImagePath := flag.String(<span class="hljs-string">"image"</span>, <span class="hljs-string">""</span>, <span class="hljs-string">"Path to the captcha image file"</span>)
    flag.Parse()

    <span class="hljs-comment">// Verify that the captcha image path is provided</span>
    <span class="hljs-keyword">if</span> *captchaImagePath == <span class="hljs-string">""</span> {
        fmt.Println(<span class="hljs-string">"Please provide the captcha image path."</span>)
        flag.PrintDefaults()
        os.Exit(<span class="hljs-number">1</span>)
    }

    <span class="hljs-comment">// Load the captcha image</span>
    _, err := ioutil.ReadFile(*captchaImagePath)
    <span class="hljs-keyword">if</span> err != <span class="hljs-literal">nil</span> {
        fmt.Printf(<span class="hljs-string">"Failed to read captcha image: %v\n"</span>, err)
        os.Exit(<span class="hljs-number">1</span>)
    }

    <span class="hljs-comment">// Initialize the 2Captcha client</span>
    client := api2captcha.NewClient(apiKey)

    <span class="hljs-comment">// Use the 2Captcha client to solve the captcha</span>
    <span class="hljs-built_in">cap</span> := api2captcha.Normal{
        File: *captchaImagePath,
    }

    captchaText, err := client.Solve(<span class="hljs-built_in">cap</span>.ToRequest())
    <span class="hljs-keyword">if</span> err != <span class="hljs-literal">nil</span> {
        <span class="hljs-keyword">if</span> err == api2captcha.ErrTimeout {
            log.Fatal(<span class="hljs-string">"Timeout"</span>)
        } <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> err == api2captcha.ErrApi {
            log.Fatal(<span class="hljs-string">"API error"</span>)
        } <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> err == api2captcha.ErrNetwork {
            log.Fatal(<span class="hljs-string">"Network error"</span>)
        } <span class="hljs-keyword">else</span> {
            log.Fatal(err)
        }
    }

    <span class="hljs-comment">// Output the solved captcha text</span>
    fmt.Printf(<span class="hljs-string">"Solved captcha: %s\n"</span>, captchaText)
}
</code></pre>
<p>Now, let's break down the code and understand each section's functionality.</p>
<h4 id="heading-parsing-input-arguments">Parsing Input Arguments</h4>
<pre><code class="lang-go">captchaImagePath := flag.String(<span class="hljs-string">"image"</span>, <span class="hljs-string">""</span>, <span class="hljs-string">"Path to the captcha image file"</span>)
flag.Parse()
</code></pre>
<p>This code uses the <code>flag</code> package to parse input arguments provided when running the program. We define a flag named <code>image</code> that represents the path to the captcha image file. The <code>flag.Parse()</code> function is then called to parse the input arguments.</p>
<h4 id="heading-loading-the-captcha-image">Loading the Captcha Image</h4>
<pre><code class="lang-go">_, err := ioutil.ReadFile(*captchaImagePath)
<span class="hljs-keyword">if</span> err != <span class="hljs-literal">nil</span> {
    fmt.Printf(<span class="hljs-string">"Failed to read captcha image: %v\n"</span>, err)
    os.Exit(<span class="hljs-number">1</span>)
}
</code></pre>
<p>In this section, we use the <code>ioutil.ReadFile()</code> function to load the contents of the captcha image file specified by the user. If there is an error while reading the file, an error message is printed, and the program exits.</p>
<h4 id="heading-initializing-the-2captcha-client">Initializing the 2Captcha Client</h4>
<pre><code class="lang-go">client := api2captcha.NewClient(apiKey)
</code></pre>
<p>Here, we initialize the 2Captcha client by creating a new instance of api2captcha.Client with the provided API key. Remember to replace the API key with the key that you saw in your dashboard.</p>
<h4 id="heading-solving-the-captcha">Solving the Captcha</h4>
<pre><code class="lang-go"><span class="hljs-built_in">cap</span> := api2captcha.Normal{
    File: *captchaImagePath,
}

captchaText, err := client.Solve(<span class="hljs-built_in">cap</span>.ToRequest())
</code></pre>
<p>To solve the captcha, we create a <code>Normal</code> struct instance from the <code>api2captcha</code> package and pass the captcha image file path to it. Then, we call the <code>Solve()</code> method of the 2Captcha client, passing the <code>ToRequest()</code> method's result from the <code>cap</code> struct as an argument. This method sends the captcha image to the 2Captcha service for solving and returns the solved captcha text.</p>
<h4 id="heading-outputting-the-solved-captcha-text">Outputting the Solved Captcha Text</h4>
<pre><code class="lang-go">fmt.Printf(<span class="hljs-string">"Solved captcha: %s\n"</span>, captchaText)
</code></pre>
<p>Finally, we output the solved captcha text to the console using <code>fmt.Printf()</code>.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Congratulations! You have successfully built a captcha solver using the 2Captcha service in Golang. You can now run the program by executing the following command:</p>
<pre><code class="lang-bash">go run main.go --image /path/to/captcha.png
</code></pre>
<p>Replace <code>/path/to/captcha.png</code> with the actual path to your captcha image file. The program will send the image to the 2Captcha service, solve the captcha, and display the solved text.</p>
<p>Feel free to explore the 2Captcha Go client library documentation (<a target="_blank" href="https://pkg.go.dev/github.com/2captcha/2captcha-go"><strong>https://pkg.go.dev/github.com/2captcha/2captcha-go</strong></a>) for more advanced usage and options.</p>
<p>That's it! You can now integrate this captcha solver into your own projects or applications to automate captcha solving using the 2Captcha service.</p>
]]></content:encoded></item><item><title><![CDATA[A beginner-friendly introduction to Docker and Containers]]></title><description><![CDATA[What is a Container?

You might be familiar with these containers.
These are used for storing stuff and shipping from one place to another. In DevOps, containers have similar applications as well.
A Container is a way to package an application with a...]]></description><link>https://arnabsen.dev/introduction-to-docker-and-containers</link><guid isPermaLink="true">https://arnabsen.dev/introduction-to-docker-and-containers</guid><category><![CDATA[Docker]]></category><category><![CDATA[Devops]]></category><category><![CDATA[Tutorial]]></category><category><![CDATA[Programming Blogs]]></category><dc:creator><![CDATA[Arnab Sen]]></dc:creator><pubDate>Sat, 27 May 2023 06:54:26 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1685170401979/979c86af-a961-445a-9c83-d84f1e29a150.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-what-is-a-container">What is a Container?</h2>
<p><img src="https://arnabsen.dev/images/docker-and-containers/cover.jpg" alt="img" /></p>
<p>You might be familiar with these containers.</p>
<p>These are used for storing stuff and shipping from one place to another. In DevOps, containers have similar applications as well.</p>
<p><strong>A Container is a way to package an application with all the necessary dependencies and configuration.</strong></p>
<p>And that package can be portable easily, which makes the process of development and the job of a developer easier.</p>
<p><strong>What happens in these containers?</strong> Nothing much, just a couple of processes run in isolation on a shared kernel.</p>
<p><strong>How is it isolated?</strong> The isolation of containers is provided by a Linux feature called <em>namespaces</em>. Namespaces partitions kernel resources such that one set of processes sees one set of resources while another set of processes sees a different set of resources. They give the group of running processes an isolated view of the kernel. For example,</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Namespaces</td><td>Description</td></tr>
</thead>
<tbody>
<tr>
<td><code>PID</code></td><td>process IDs</td></tr>
<tr>
<td><code>USER</code></td><td>user and group IDs</td></tr>
<tr>
<td><code>UTS</code></td><td>hostname and domain name</td></tr>
<tr>
<td><code>NS</code></td><td>mount points</td></tr>
<tr>
<td><code>NET</code></td><td>Network devices, stacks, ports</td></tr>
</tbody>
</table>
</div><p>You can use the command <code>lsns</code> to get lists of all the currently accessible namespaces.</p>
<pre><code class="lang-bash">$ lsns
        NS TYPE   NPROCS   PID USER    COMMAND
4026531835 cgroup     85  1571 seth /usr/lib/systemd/systemd --user
4026531836 pid        85  1571 seth /usr/lib/systemd/systemd --user
4026531837 user       80  1571 seth /usr/lib/systemd/systemd --user
4026532601 user        1  6266 seth /usr/lib64/firefox/firefox [...]
4026532928 net         1  7164 seth /usr/lib64/firefox/firefox [...]
</code></pre>
<p>Another feature of the <strong>kernel</strong> is <em>control groups</em> (a.k.a <code>cgroups</code>) which monitors, limits, accounts for, and isolates the resource usage of a collection of processes (also known as containers)</p>
<h2 id="heading-virtual-machine-vs-containers">Virtual Machine VS Containers</h2>
<p>An operating system has two main layers:</p>
<ol>
<li><p><strong>OS Kernel:</strong> It communicates with hardware like memory, CPU .etc.</p>
</li>
<li><p><strong>Applications Layer:</strong> They run on the Kernel.</p>
</li>
</ol>
<p>Linux is a kernel. There are many Linux distributions each looking different from one another because the applications are different. But under the hood, they use the same kernel i.e. Linux.</p>
<p>Coming back to the difference between VM and Containers:-</p>
<p><img src="https://arnabsen.dev/images/docker-and-containers/containers-vs-virtual-machines.jpg" alt="img" class="image--center mx-auto" /></p>
<p>VM runs on something called <em>Hypervisor</em>. Each virtual machine includes a full-blown OS and its process, which are very heavy and slow to start.</p>
<p>Containers on the other hand don't include full-blown OS, only include a set of OS-specific files. They are just processes that share the same kernel with other containers and the isolation by the containers is provided by the Linux namespaces. So since they run on top of the kernel they are very fast and also light-weight. So, we are getting the benefits of isolation by VM without the heaviness that comes with VM</p>
<p>But remember:</p>
<blockquote>
<p>Containers don't replace VMs. Both have their own purpose.</p>
</blockquote>
<h2 id="heading-what-is-docker">What is Docker?</h2>
<p>An early implementation of container technology was added to <strong>FreeBSD</strong> in <strong>2001</strong>. Whereas Docker debuted to the public in <strong>Santa Clara at PyCon in 2013</strong> and was made open source in <strong>March 2013</strong>. The tooling for using Linux Containers was really lacking and that's where docker comes into play. Basically, <strong>docker is tooling to manage containers.</strong></p>
<p><strong>Docker allows developers to package their applications into containers and directly use them in their CI/CD pipeline.</strong></p>
<p>It helps achieve:</p>
<blockquote>
<p>Build once, run everywhere</p>
</blockquote>
<h2 id="heading-why-should-we-at-all-bother">Why should we at all bother?</h2>
<p>There are a number of advantages of using Docker and Containerisation: (No wonder it is very popular)</p>
<ol>
<li>You can't say "But... It works on my machine" anymore. Good Luck with that. Because we are packaging the application with all the dependencies and the configurations required, even if it is running on a different machine it will still behave the same way.</li>
</ol>
<p><img src="https://arnabsen.dev/images/docker-and-containers/works-on-my-machine.jpeg" alt="Meme" class="image--center mx-auto" /></p>
<ol>
<li><p><strong>They are very lightweight and fast.</strong> Already discussed this, just adding one thing. The fact that dockers are lightweight is the main reason behind them being so portable. <em>Obvious</em></p>
</li>
<li><p><strong>Docker has its own ecosystem</strong> provided by the community and has many tools that come with it, which helps solve a lot of issues.</p>
</li>
</ol>
<hr />
<p>Let's get our hands dirty now.</p>
<p>To install docker you can look into the <a target="_blank" href="https://docs.docker.com/">official docs</a>. Else if you want to just try your hands first, then you can use this: <a target="_blank" href="https://labs.play-with-docker.com/">https://labs.play-with-docker.com/</a></p>
<h2 id="heading-practical-1">Practical 1</h2>
<p>Let's go through some popular docker commands. The docker commands are the same for all environments so it won't be an issue.</p>
<h3 id="heading-run-a-container">Run a container</h3>
<p>Run this command</p>
<pre><code class="lang-bash">docker container run -t ubuntu ls
</code></pre>
<p><code>docker container run</code> will run the image that your provided, in this case, it is <code>Ubuntu</code>. Now if you are running this command for the first time high chances are that the image is not downloaded, so it will show something like this:</p>
<pre><code class="lang-bash">Unable to find image <span class="hljs-string">'ubuntu:latest'</span> locally
latest: Pulling from library/ubuntu
</code></pre>
<p>If you notice something here we just mentioned <code>ubuntu</code> not <code>ubuntu:latest</code>. If we didn't specify any version it will take the latest version. But if you wanted to use <code>ubuntu 18.04</code> you can specify it like this:</p>
<pre><code class="lang-bash">docker container run -t ubuntu:18.04 ls
</code></pre>
<p>It will again show:</p>
<pre><code class="lang-bash">Unable to find image <span class="hljs-string">'ubuntu:18.04'</span> locally
latest: Pulling from library/ubuntu
</code></pre>
<p>But this time notice the version. Also in both cases you see an output like this</p>
<pre><code class="lang-bash">bin   dev  home  lib64  mnt  proc  run   srv  tmp  var
boot  etc  lib   media  opt  root  sbin  sys  usr
</code></pre>
<p>Basically, it is the output of the <code>ls</code> command.</p>
<p>Now let's run this command</p>
<pre><code class="lang-bash">docker container run -t ubuntu top
</code></pre>
<p>And open a new shell and continue. If you are using Play with Docker. Then create a new instance, and then ssh into the previous instance.</p>
<p><img src="https://arnabsen.dev/images/docker-and-containers/practical-11.png" alt="img" class="image--center mx-auto" /></p>
<p>Now type this command</p>
<pre><code class="lang-bash">$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
6d2a990df65d        ubuntu              <span class="hljs-string">"top"</span>               3 seconds ago       Up 2 seconds                            blissful_austin
</code></pre>
<p>This command shows you the containers and all the necessary information about it.</p>
<p>Usually, containers are used for running a process, maybe a server or some application, and soon as the main process exits the container will stop too. So let's create a very simple process.</p>
<p>So run this command</p>
<pre><code class="lang-bash">docker run -d ubuntu sleep 300
</code></pre>
<p>Yeah, this is our process, we will ask the container to sleep for 300 secs.</p>
<p>Every container has a unique container id. So in most of the commands which deal with a particular container, we have to provide the container id. Now let's hop into the <em>sleeping container</em>.</p>
<pre><code class="lang-bash">docker <span class="hljs-built_in">exec</span> -it 6d2a990df65d bash
</code></pre>
<blockquote>
<p><strong>Note:</strong> <code>6d2a990df65d</code> is the docker container id in my case. Just do <code>docker ps</code> look at the container id and paste it there.</p>
</blockquote>
<p>It will spawn a bash terminal inside the container. You can run all the basic commands of Ubuntu.</p>
<p>To get the list of all the containers (even the ones that exited) run</p>
<pre><code class="lang-bash">docker ps -a
</code></pre>
<h3 id="heading-stop-a-container">Stop a container</h3>
<p>To stop the container we need to use <code>docker stop &lt;container-id-1&gt; &lt;container-id-2&gt;</code>.</p>
<pre><code class="lang-bash">docker stop 6d2a990df65d d9da0526d987
</code></pre>
<p>To remove containers you can use <code>docker system prune</code></p>
<p>There is a nice collection of important docker commands by <a target="_blank" href="https://gist.github.com/garystafford">garystafford</a> <a target="_blank" href="https://gist.github.com/garystafford/f0bd5f696399d4d7df0f">here</a> which I find very helpful.</p>
<h3 id="heading-debugging-container">Debugging container</h3>
<p>Usually, for debugging, we need to look at the logs. For that use the command:</p>
<pre><code class="lang-bash">docker logs &lt;container-id&gt;
</code></pre>
<p>Also, <code>docker exec</code> sometimes helps in the debugging process.</p>
<blockquote>
<p><strong>Remember</strong> that containers use kernel-level features to achieve isolation and that containers run on top of the kernel. Your container is just a group of processes running in isolation on the same host, and you can use the command <code>docker exec</code> to enter that isolation with the bash process. After you run the command <code>docker exec</code>, the group of processes running in isolation (in other words, the container) includes <code>sleep</code> and <code>bash</code>.</p>
</blockquote>
<hr />
<h2 id="heading-where-are-all-these-images-stored">Where are all these images stored?</h2>
<p>Docker maintains a public repository of all the images called <a target="_blank" href="https://hub.docker.com/">Dockerhub</a>.</p>
<p>Also, you can run more than one container simultaneously.</p>
<p>While running containers you can do a lot more stuff, like</p>
<ul>
<li><p><code>--name</code> tag will allow you to name the container.</p>
</li>
<li><p><code>--detach or -d</code> will allow you to run the docker in detached mode i.e. in the background.</p>
</li>
<li><p><code>--publish or -p</code> to publish the ports to the host (very important)</p>
</li>
</ul>
<p>You can the list of all the options <a target="_blank" href="https://docs.docker.com/engine/reference/commandline/run/#options">here</a></p>
<p>Containers are self-contained and isolated, which means you can avoid potential conflicts between containers with different systems or runtime dependencies. You can run multiple NGINX containers that all have port <code>80</code> as their default listening ports. If you're exposing the host by using the --publish flag, the ports selected for the host must be unique. Isolation benefits are possible because of Linux namespaces. Running multiple containers on the same host gives us the ability to use the resources (CPU, memory, and so on) available on a single host. This can result in huge cost savings for an enterprise.</p>
<p>Although running images directly from the Docker Store can be useful at times, it is more useful to create custom images and refer to official images as the starting point for these images.</p>
<h2 id="heading-docker-images-and-docker-containers">Docker Images and Docker Containers</h2>
<p>Now, if you are confused let's look into the differences between <strong>Docker Images</strong> and <strong>Docker containers</strong>. A docker image is a tar file or an archive of the filesystem or the container. It contains the metadata of the filesystem.</p>
<p>Whereas Container is the running environment of the image. It's the process (isolated process to be specific). The filesystem of the container is virtual, i.e. it has its own abstraction.</p>
<p>Images are used to create containers (more than one). You can consider it as a blueprint. We can share our Docker Image and then we can create containers using the image. We can also push images to the Docker Hub.</p>
<h2 id="heading-how-to-create-docker-image">How to create Docker Image?</h2>
<p>To create a Docker image, we use a special file called <code>Dockerfile</code> (no extension), which consists of a list of commands to build our image. After we have created our image we can pass it to <code>docker build</code> which will build the image.</p>
<pre><code class="lang-bash">docker build -f Dockerfile
</code></pre>
<p>A Docker Image is a set of layers where each layer represents an instruction from the Dockerfile. The layers are stacked on top of each other. Each new layer is only a set of differences from the previous one.</p>
<p><img src="https://arnabsen.dev/images/docker-and-containers/image-layer.png" alt="img" class="image--center mx-auto" /></p>
<p>The best part of the image layer is that they are cached. If you change say the 5th line then the docker engine will reuse the first 4 layers and then start building from the 5th line. This improves the time during build and also in the context of CI/CD once the base is pushed, the subsequent pushes will be very fast. To optimize the caching, we need to organize the Dockerfile in a way that the line that will change the most is located at the bottom of the Dockerfile.</p>
<p>Let's dive into this.</p>
<h2 id="heading-practical-2">Practical 2</h2>
<h3 id="heading-creating-flask-application">Creating flask application</h3>
<p>We are going to create a simple Flask application.</p>
<ul>
<li><p>Download this Python script <a target="_blank" href="https://gist.github.com/arnabsen1729/1fa19228e4451963bbb64563da98f880">https://gist.github.com/arnabsen1729/1fa19228e4451963bbb64563da98f880</a> and save it as <code>app.py</code>.</p>
</li>
<li><p>Install the package <code>flask</code> by <code>pip3 install flask</code> and run the app <code>python3 app.py</code>.</p>
</li>
<li><p>When the app is running you can visit your <code>0.0.0.0:5000</code>, you will see <code>hello world!</code>.</p>
</li>
</ul>
<p>Hence we have set up a basic Flask server. To close this process press <code>Ctrl+C</code>.</p>
<p>Now we will dockerize this flask app.</p>
<h3 id="heading-building-dockerfile">Building Dockerfile</h3>
<p>So create a file <code>Dockerfile</code> and open your text editor and paste this</p>
<pre><code class="lang-dockerfile"><span class="hljs-keyword">FROM</span> python:<span class="hljs-number">3.6</span>.<span class="hljs-number">1</span>-alpine
<span class="hljs-keyword">RUN</span><span class="bash"> pip install flask</span>
<span class="hljs-keyword">CMD</span><span class="bash"> [<span class="hljs-string">"python"</span>,<span class="hljs-string">"app.py"</span>]</span>
<span class="hljs-keyword">COPY</span><span class="bash"> app.py /app.py</span>
</code></pre>
<p>Let's go through this line by line</p>
<h3 id="heading-from-python361-alpine"><code>FROM python:3.6.1-alpine</code></h3>
<p>This is the starting point for your Dockerfile. Every Dockerfile typically starts with a <code>FROM</code> line that is the starting image to build your layers on top of. In this case, you are selecting the <code>python:3.6.1-alpine</code> base layer because it already has the version of Python and pip that you need to run your application. The Alpine version means that it uses the Alpine distribution, which is significantly smaller than an alternative flavour of Linux. A smaller image means it will download (deploy) much faster, and it is also more secure because it has a smaller attack surface.</p>
<blockquote>
<p><em>It is highly recommended to only use official images found in the Docker Hub, or noncommunity images found in the Docker Store.</em></p>
</blockquote>
<h3 id="heading-run-pip-install-flask"><code>RUN pip install flask</code></h3>
<p>The <code>RUN</code> the command executes commands needed to set up your image for your application, such as installing packages, editing files, or changing file permissions. In this case, you are installing Flask. The <code>RUN</code> commands are executed at build time and are added to the layers of your image. Usually for node applications, this will involve installing all the <code>node_modules</code>, if it was a larger Python application, you will have to install those as well.</p>
<p><code>CMD ["python", "app.py"]</code></p>
<p><code>CMD</code> is the command that is executed when you start a container. Here, you are using CMD to run your Python application. There can be only one <code>CMD</code> per Dockerfile.</p>
<blockquote>
<p><em>If you specify more than one CMD, then the last CMD will take effect.</em></p>
</blockquote>
<h3 id="heading-copy-apppy-apppy"><code>COPY app.py /app.py</code></h3>
<p>This line copies the <code>app.py</code> file in the local directory (where you will run the docker image build) into a new layer of the image. This instruction is the last line in the Dockerfile. Layers that change frequently, such as copying source code into the image, should be placed near the bottom of the file to take full advantage of the Docker layer cache. This allows you to avoid rebuilding layers that could otherwise be cached. For instance, if there was a change in the FROM instruction, it will invalidate the cache for all subsequent layers of this image. You'll see this a little later in this lab</p>
<p>But, how can the CMD command run if we are copying the <code>app.py</code> later? <strong>CMD is the command that is executed when you start a container</strong>, until and unless you run the container it is not executed. Also since the command to run the application will not change, we have placed it higher.</p>
<p>Here is the list of <a target="_blank" href="https://docs.docker.com/engine/reference/builder/">all commands</a></p>
<p>Now to build the image with the <code>Dockerfile</code> run</p>
<h3 id="heading-running-the-container">Running the container</h3>
<pre><code class="lang-bash">$ docker build -t flask-app . <span class="hljs-comment"># if the Dockefile is in that directory</span>
<span class="hljs-comment">#or</span>
$ docker build -t flask-app -f /path/to/Dockerfile
</code></pre>
<p>It will pull the <code>Python:3.6.1-alpine</code>, and go through the process. In the end it will output something like this</p>
<pre><code class="lang-bash">Successfully built 38f35dd1d2a4
Successfully tagged flask-app:latest
</code></pre>
<p>Now run the command <code>docker images</code> and you will see <code>flask-app</code> or whatever name you mentioned in the list. So now you have successfully created the image.</p>
<p>For the final part let's run the container with this image.</p>
<pre><code class="lang-bash">docker run -p5001:5000 -d --name flask-container flask-app
</code></pre>
<p>What are we doing here?</p>
<ul>
<li><p><code>docker run</code> to run the container</p>
</li>
<li><p><code>-p5001:5000</code> to map port 5000 of our container with 5001 of the host machine</p>
</li>
<li><p><code>--name flask-container</code> giving the name of my container</p>
</li>
<li><p><code>flask-app</code> the image we want to build</p>
</li>
</ul>
<p>Now do <code>docker ps</code> you will see</p>
<pre><code class="lang-bash">CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                    NAMES
940f215ceea0        flask-app           <span class="hljs-string">"python app.py"</span>     2 seconds ago       Up 2 seconds        0.0.0.0:5000-&gt;5001/tcp   flask-container
</code></pre>
<p>Now go to <code>localhost:5001</code>, if everything was correct you will see <code>hello world!</code></p>
<p>To check the logs we can run <code>docker logs</code></p>
<pre><code class="lang-bash">$ docker logs flask-container
 * Serving Flask app <span class="hljs-string">"app"</span> (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it <span class="hljs-keyword">in</span> a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
172.17.0.1 - - [03/Jan/2021 14:55:58] <span class="hljs-string">"GET / HTTP/1.1"</span> 200 -
172.17.0.1 - - [03/Jan/2021 14:55:59] <span class="hljs-string">"GET / HTTP/1.1"</span> 200 -
</code></pre>
<p>Docker images contain all the dependencies that they need to run an application within the image. This is useful because you no longer need to worry about environment drift (version differences) when you rely on dependencies that are installed on every environment you deploy to. You also don't need to follow more steps to provide these environments. Just one step: install docker, and that's it.</p>
<p>Now if you change the <code>app.py</code> only the last step in Dockerfile needs to be updated the rest is already cached.</p>
<p>And you have successfully dockerized your application.</p>
<h2 id="heading-docker-compose">Docker Compose</h2>
<p>Sometimes the docker run command becomes very long and very tedious like sometimes we even need to specify lots of environment variables and stuff. Running those long commands every single time becomes difficult. Also if you are working with let's say 3 or 4 containers then you have to write such long-run commands every single time you want to start the container. So there is a simple way to express the commands in a structured way, save it in a file and simply run that file.</p>
<p>That file is the <code>docker-compose.yml</code>. The file is a YAML file. (<em>Fun fact: full form of YAML is 'YAML Ain't Markup Language' recursive huh!!</em>)</p>
<p>Writing a <code>docker-compose</code> file is not very difficult, you just need to know how to structure it. This article written by Gabriel Tanner explains it nicely.</p>
<p>Link to the article: <a target="_blank" href="https://gabrieltanner.org/blog/docker-compose">gabrieltanner.org/blog/docker-compose</a></p>
<p>If you have reached this far and you have understood Docker, it's also important that you keep the best practices in mind. Here is a good guide for that: <a target="_blank" href="http://spacelift.io/blog/dockerfile#dockerfile-best-practices">spacelift.io/blog/dockerfile#dockerfile-best-practices</a></p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>In this article, we learned about Docker and how to dockerize a simple application. We also learned about Docker Compose and how to use it.</p>
<p>A really nice collection of Docker study material is available here: <a target="_blank" href="https://docker.farhan.info/">Docker Handbook 2021 Edition</a></p>
<p>Hope you liked my article, do follow me on Hashnode and on Twitter (handle: @ArnabSen1729) for updates.</p>
]]></content:encoded></item><item><title><![CDATA[Quick HTML tips: Enhancing UX and Accessibility with `enterkeyhint`.]]></title><description><![CDATA[In the world of web development, creating a delightful user experience (UX) goes hand in hand with ensuring accessibility for all users. Accessibility, often referred to as "a11y" (short for "accessibility" and the 11 letters between the "a" and "y")...]]></description><link>https://arnabsen.dev/quick-html-tips-enterkeyhint</link><guid isPermaLink="true">https://arnabsen.dev/quick-html-tips-enterkeyhint</guid><category><![CDATA[HTML5]]></category><category><![CDATA[Accessibility]]></category><category><![CDATA[tips]]></category><dc:creator><![CDATA[Arnab Sen]]></dc:creator><pubDate>Thu, 25 May 2023 10:04:14 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1685008669874/d33adcde-9325-4492-97fb-c11fe1bb4d10.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In the world of web development, creating a delightful user experience (UX) goes hand in hand with ensuring accessibility for all users. <strong>Accessibility</strong>, often referred to as "<strong>a11y</strong>" (short for "accessibility" and the 11 letters between the "a" and "y"), focuses on making web content usable by individuals with disabilities. While major accessibility considerations involve things like proper semantic structure and alternative text for images, even small details can significantly impact the overall user experience. One such detail is the <code>enterkeyhint</code> attribute in HTML.</p>
<p>While using various apps on your smartphones, you might have noticed that the button where we usually have "enter", sometimes gets replaced with terms like "search", "next", etc. This small thing might be insignificant but still gives a lot of clarity about what's going to happen next. Ever wondered how that is implemented?</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685000903849/c013279d-539c-4248-b8fc-dbf029da143e.png" alt="3 different keywords showing 3 different actions" class="image--center mx-auto" /></p>
<p>It's through the <code>enterkeyhint</code> attribute in HTML.</p>
<p>The <code>enterkeyhint</code> attribute provides a means for developers to communicate the expected action to the browser when the user presses the Enter key within a form. By utilizing this attribute effectively, developers can enhance both the UX and accessibility of web forms. By guiding the browser to understand the intended action, users can navigate forms more easily, without relying solely on mouse or touch input.</p>
<p>So, let's dive in and explore how this seemingly minor attribute can contribute to a more inclusive and user-friendly web!</p>
<h2 id="heading-what-is-the-enterkeyhint-attribute">What is the <code>enterkeyhint</code> attribute?</h2>
<p>The <code>enterkeyhint</code> attribute is an HTML attribute that can be added to form input elements such as <code>&lt;input&gt;</code> and <code>&lt;textarea&gt;</code>. It is used to suggest to the browser the type of action that should be taken when the user presses the Enter key while the input element has focus.</p>
<h2 id="heading-how-does-enterkeyhint-work">How does <code>enterkeyhint</code> work?</h2>
<p>The <code>enterkeyhint</code> attribute accepts a few predefined values that represent different actions. Here are the possible values:</p>
<ul>
<li><p><code>enter</code>: Indicates that the default action for the Enter key should be performed. This is the default value if the attribute is not specified.</p>
</li>
<li><p><code>done</code>: Suggests that pressing Enter should submit the form or perform the action that signifies completion.</p>
</li>
<li><p><code>go</code>: Suggests that pressing Enter should initiate a "go" operation, such as navigating to a URL or starting a search.</p>
</li>
<li><p><code>next</code>: Indicates that pressing Enter should move the input focus to the next input field or control in the form.</p>
</li>
<li><p><code>previous</code>: Suggests that pressing Enter should move the input focus to the previous input field or control in the form.</p>
</li>
<li><p><code>search</code>: Indicates that pressing Enter should initiate a search operation.</p>
</li>
</ul>
<p>The browser may use this hint to display an appropriate keyboard layout or provide other UI cues to the user.</p>
<h2 id="heading-example-usage">Example usage</h2>
<p>Let's consider a simple example of a login form to demonstrate the usage of the <code>enterkeyhint</code> attribute. We have two input fields: one for the username and another for the password. Here's how we can use the <code>enterkeyhint</code> attribute effectively:</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">form</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">label</span> <span class="hljs-attr">for</span>=<span class="hljs-string">"username"</span>&gt;</span>Username:<span class="hljs-tag">&lt;/<span class="hljs-name">label</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"text"</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"username"</span> <span class="hljs-attr">enterkeyhint</span>=<span class="hljs-string">"next"</span>&gt;</span>

  <span class="hljs-tag">&lt;<span class="hljs-name">label</span> <span class="hljs-attr">for</span>=<span class="hljs-string">"password"</span>&gt;</span>Password:<span class="hljs-tag">&lt;/<span class="hljs-name">label</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"password"</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"password"</span> <span class="hljs-attr">enterkeyhint</span>=<span class="hljs-string">"done"</span>&gt;</span>

  <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"submit"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"Login"</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">form</span>&gt;</span>
</code></pre>
<p>In this example, we set the <code>enterkeyhint</code> attribute for the username input field to <code>"next"</code> and for the password input field to <code>"done"</code>. This provides a hint to the browser about the expected action when the user presses the Enter key.</p>
<p>By setting the <code>enterkeyhint</code> to <code>"next"</code> for the username field, we suggest that pressing Enter should move the input focus to the password field. This helps users navigate through the form easily without having to use the mouse or touch input.</p>
<p>For the password field, we set the <code>enterkeyhint</code> to <code>"done"</code>. This indicates that pressing Enter should submit the form or perform the action that signifies completion, which, in this case, is logging in.</p>
<h2 id="heading-browser-support">Browser support</h2>
<p>The <code>enterkeyhint</code> attribute is supported by all the browsers.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685000008048/ccfba274-e20b-4c68-ae16-0dd44c4d76c0.png" alt class="image--center mx-auto" /></p>
<blockquote>
<p>Source: <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/enterkeyhint#browser_compatibility">developer.mozilla.org/enterkeyhint#browser_compatibility</a></p>
</blockquote>
<p>Here is how all of them look:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685008949747/31b281f7-33a7-4cf6-a534-f3142db9c14a.gif" alt class="image--center mx-auto" /></p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Hope you learned something new through this blog. Do check out my other blogs and follow me on Twitter at <a target="_blank" href="https://twitter.com/ArnabSen1729">ArnabSen1729</a> for more such interesting updates. You can also subscribe to my Hashnode newsletter to get updates every time I publish a new article.</p>
<p>Have a nice day 😄 👋.</p>
]]></content:encoded></item><item><title><![CDATA[Google I/O 2023 Highlights: Unveiling Google's Latest Innovations and Improvements]]></title><description><![CDATA[In this blog, I will cover all the latest developments happening within Google, as presented at Google I/O. I won't delve deeply into the workings and technology, as that would make the blog excessively long. Instead, I will provide an overview of th...]]></description><link>https://arnabsen.dev/google-io-2023-highlights</link><guid isPermaLink="true">https://arnabsen.dev/google-io-2023-highlights</guid><category><![CDATA[Google]]></category><category><![CDATA[Developer]]></category><category><![CDATA[technology]]></category><category><![CDATA[news]]></category><dc:creator><![CDATA[Arnab Sen]]></dc:creator><pubDate>Fri, 12 May 2023 06:06:28 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1683870146621/6ea2eab7-437f-48cc-b410-d967be935afa.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In this blog, I will cover all the latest developments happening within Google, as presented at Google I/O. I won't delve deeply into the workings and technology, as that would make the blog excessively long. Instead, I will provide an overview of the topics discussed and explain them as concisely as possible.</p>
<blockquote>
<p>I will mainly cover the new software developments in the field of AI and not the hardware and android updates.</p>
</blockquote>
<h2 id="heading-tldr">TL;DR</h2>
<p>Google I/O 2023 showcased AI advancements such as LaMDA, PaLM2, Imagen, and new AI features in Google Search. They also introduced AI integrations in products like Gmail, Google Maps, and Google Photos, along with the launch of Bard, an AI chatbot. Other announcements include AI tools for developers like Vertex AI and Project Tailwind, an AI-first notebook.</p>
<p>Let's learn what Google I/O is all about.</p>
<h2 id="heading-what-is-google-io">What is "Google I/O"?</h2>
<p>Google I/O is an annual developer conference held by Google in Mountain View, California. The name "I/O" is taken from the number <strong>googol</strong>, with the "I" representing the <code>1</code> in googol and the "O" represents the first <code>0</code> in the number.</p>
<blockquote>
<p>A <strong>googol</strong> is the large number <strong>10<sup>100</sup></strong>. In decimal notation, it is written as the digit 1 followed by one hundred zeroes: <strong>10,​000,​000,​000,​000,​000,​000,​000,​000,​000,​000,​000,​000,​000,​000,​000,​000,​000,​000,​000,​000,​000,​000,​000,​000,​000,​000,​000,​000,​000,​000,​000,​000,​000.</strong></p>
</blockquote>
<p>The conference also features a number of educational sessions and workshops, where developers can learn about the latest technologies and best practices.</p>
<p>In addition to being a valuable resource for developers, Google I/O is also a great opportunity for Google to connect with its users and get feedback on its products. The conference is open to the public, and there are a number of activities and events that are available to all attendees.</p>
<p><strong>Google I/O 2023</strong> was a two-day event held on <strong>May 11-12, 2023</strong>, at the Shoreline Amphitheatre in <strong>Mountain View, California</strong>. The event was attended by over <strong>50,000</strong> developers from around the world.</p>
<p>A keynote was addressed by <strong>Sundar Pichai</strong>, CEO of Google, where he announced new products and features for Google's various platforms.</p>
<p><img src="https://storage.googleapis.com/gweb-uniblog-publish-prod/images/hero-1.width-1200.format-webp.webp" alt="Sundar Pichai at the front left of a large stage with a colorful I/O logo behind him." /></p>
<h2 id="heading-what-were-my-expectations-from-google-io-2023">💡 What were my expectations from Google I/O 2023?</h2>
<p>We all know that Google has been a leader in the field of artificial intelligence (AI) for decades. In 2017, they released the revolutionary transformer model, which is now widely used in natural language processing (NLP) tasks such as machine translation, text summarization, and question-answering.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683818052782/1af441c4-65bc-4ed7-8517-839633384ae4.png" alt class="image--center mx-auto" /></p>
<blockquote>
<p>You can checkout the amazing paper by folks at Google titled "Attention is All You Need" from <a target="_blank" href="https://arxiv.org/pdf/1706.03762.pdf">here</a>.</p>
</blockquote>
<p>It was therefore no surprise that Google's annual developer conference, Google I/O 2023, was full of announcements about new AI advancements.</p>
<p>Some of the most notable announcements included:</p>
<ul>
<li><p>The release of <strong>PaLM2</strong>, a 540-billion parameter LLM that can generate text, translate languages, write different kinds of creative content, and answer your questions in an informative way.</p>
</li>
<li><p>The release of <strong>Imagen</strong>, a new AI model that can generate realistic images from text descriptions.</p>
</li>
<li><p>The announcement of new AI features for <strong>Google Search</strong>, including the ability to answer your questions in more natural language and to provide more relevant results.</p>
</li>
<li><p>The launch of new <strong>AI tools for developers</strong>, including the Google AI Platform and the Google AI Test Kitchen.</p>
</li>
</ul>
<p>These are just a few of the many AI advancements that were announced at Google I/O 2023. It is clear that Google is committed to leading the way in the field of AI, and these advancements are sure to have a significant impact on the way we live and work.</p>
<p>A significant part of Google I/O focused on integrating Generative AI into their products. So, what exactly is Generative AI?</p>
<h2 id="heading-understanding-generative-ai">🤖 Understanding Generative AI</h2>
<p>Generative AI as the name suggests is a type of artificial intelligence (AI) model called Large Language Model (LLM) that <strong>can create new content</strong>, such as text, images, audio, and video. Generative AI models are trained on large datasets of existing content, and they use this data to learn the patterns and rules that govern how that content is created. Once a generative AI model has been trained, it can use this knowledge to create new content that is similar to the content it was trained on.</p>
<p>Here is a nice video on the recent updates in Generative AI by Google.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://youtu.be/628ANvH1jH0">https://youtu.be/628ANvH1jH0</a></div>
<p> </p>
<h2 id="heading-ai-integrations-in-google-products">📲 AI integrations in Google products</h2>
<h3 id="heading-gmails-new-help-me-write">📪 Gmail's new "Help me write"</h3>
<p>This AI feature will generate the entire email for you. All you have to do is specify the details of the email in the prompt. It can further pull context from the previous email.</p>
<p>This is something I will personally use quite often. Currently, there are some excellent tools in the form of browser extensions built on OpenAI's GPT model that serve the same purpose. However, it appears that this new feature from Google could be detrimental to those tools.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://youtube.com/clip/Ugkxf9r4MA7Fztdkgzi6MjvJrh_Baz5ze8dt">https://youtube.com/clip/Ugkxf9r4MA7Fztdkgzi6MjvJrh_Baz5ze8dt</a></div>
<p> </p>
<h3 id="heading-immersive-view-for-routes-in-maps">🌍 Immersive View for routes in Maps</h3>
<p>Google Maps' Immersive View is being expanded to allow users to see their entire route in advance, whether they're walking, cycling, or driving. This will allow users to get a better feel for their route and make informed decisions about where to go. Immersive View will begin to roll out over the summer and will be available in 15 cities by the end of the year.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://youtube.com/clip/UgkxcxMUAvh_dh2v1vf-QCk_W8bl2pf42mBb">https://youtube.com/clip/UgkxcxMUAvh_dh2v1vf-QCk_W8bl2pf42mBb</a></div>
<p> </p>
<h3 id="heading-magic-eraser-for-google-photos">✏️ Magic Eraser for Google Photos</h3>
<p>It is an AI-powered tool that allows users to remove unwanted distractions from photos. Magic Editor is a new AI-powered tool that will allow users to do much more with their photos, such as repositioning objects, changing the sky, and more. Magic Editor is expected to roll out later this year.</p>
<p><img src="https://storage.googleapis.com/gweb-uniblog-publish-prod/original_images/I-0_MM_BALLOONS_Updated_Disclaimer.gif" alt="https://blog.google/technology/ai/google-io-2023-keynote-sundar-pichai/#helpful-ai" /></p>
<h2 id="heading-the-second-gen-palm-model-palm-2">✨ The second-gen PaLM model: PaLM 2</h2>
<p>PaLM is a large language model (LLM) from Google AI, but it is not the only LLM that Google has developed. Other LLMs from Google include LaMDA, Meena, and T5. PaLM is the largest and most powerful LLM that Google has developed to date, but it is still under development.</p>
<p>And in this I/O, Google announced a more advanced version of that called PaLM2.<br />PaLM2 is a second-generation large language model (LLM) from Google AI. It is built on the same architecture as PaLM, but it is trained on a larger dataset of text and code.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://youtu.be/yAANQypgOo8">https://youtu.be/yAANQypgOo8</a></div>
<p> </p>
<p>PaLM2 is a family of models, each with its own strengths and weaknesses. Here are some of the different models in PaLM2:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683825768659/c6df367f-3fd0-4080-b568-506fefe6e31c.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p><strong>Gecko:</strong> Gecko is the smallest model in PaLM2. It is fast and efficient, but it is not as powerful as the other models.</p>
</li>
<li><p><strong>Otter:</strong> Otter is a medium-sized model in PaLM2. It is more powerful than Gecko, but it is not as powerful as the larger models.</p>
</li>
<li><p><strong>Bison:</strong> Bison is a large model in PaLM2. It is more powerful than Otter, but it is not as powerful as the largest model.</p>
</li>
<li><p><strong>Unicorn:</strong> Unicorn is the largest model in PaLM2. It is the most powerful model in PaLM2, but it is also the slowest and least efficient.</p>
</li>
</ul>
<p>PaLM2 is particularly good at:</p>
<ol>
<li><p><strong>Math:</strong> It can solve math problems, such as algebra, calculus, and geometry. It can also generate mathematical proofs.</p>
</li>
<li><p><strong>Coding:</strong> PaLM2 can generate code that is both correct and efficient. It can write code in a variety of programming languages, and translate between them.</p>
</li>
<li><p><strong>Learning &amp; Reasoning:</strong> PaLM2 is able to learn new tasks and concepts quickly. It can be trained on a new task with just a few examples.</p>
</li>
<li><p><strong>Translating languages:</strong> PaLM2 can translate languages with high accuracy. It can translate between any pair of languages that it has been trained on.</p>
</li>
</ol>
<p>PaLM2 models perform even better when fine-tuned for particular applications. Some of my favorite fine-tuned models are Sec-PaLM and Med-PaLM2. Sec-PaLM can explain the behavior of potentially malicious scripts, and better detect which scripts are actually threats to people and organizations. Med-PaML2 can answer questions and summarize insights from a variety of dense medical texts.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683826123107/4007da7c-6efa-4183-bd2e-661f5f1007d5.gif" alt class="image--center mx-auto" /></p>
<p>Google is also working on another next-generation foundation model called <strong>Gemini.</strong> Gemini is being designed to be multimodal, which means that it will be able to process and understand information from a variety of sources, such as text, code, images, and audio. This will make Gemini much more versatile than previous AI models, and it will allow it to be used in a wider range of applications.</p>
<h2 id="heading-bard">💬 Bard</h2>
<p>The part of Google I/O that I was most excited about was the launch of Bard. It was initially rolled out to only US and UK, but now it's publicly available and I am really loving it.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683827214728/e082c306-431c-4e09-81b2-7c99ab366904.png" alt class="image--center mx-auto" /></p>
<p>A very popular alternative that we all know is ChatGPT. Here are some of the features that Bard is providing which is not yet available in ChatGPT:</p>
<ul>
<li><p><strong>Information Cutoff:</strong> The information cutoff for ChatGPT is September 2021. Whereas Bard can perform an internet search and give a response accordingly. This allows you to get the latest information and updates.</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683827746292/d2e4940b-6855-4b8e-8635-abab165ed1ee.png" alt class="image--center mx-auto" /></p>
</li>
<li><p><strong>Export options:</strong> Bard allows you to export the response as Docs or a Draft in Gmail. If it detects code then it also gives an option to "Export to Colab" but ChatGPT doesn't have any such functionality yet.</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683828156525/9cf966d9-35a8-4a29-b20b-7b2929b6a085.png" alt class="image--center mx-auto" /></p>
</li>
<li><p><strong>Citations:</strong> Bard can also cite sources, something which ChatGPT still can't do.</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683828366830/cdd7630b-2f3c-4e03-b122-301aaab30ce8.png" alt class="image--center mx-auto" /></p>
</li>
</ul>
<p>Further, Google is promising that in the next few weeks, Bard will become more visual. Bard will also be integrated with Google Lens, where it can analyze the photos and then respond according to your prompt.</p>
<h3 id="heading-bard-x-adobe-firefly">🎨 Bard x Adobe Firefly</h3>
<p>This collaboration will allow Bard users to generate images directly from their text descriptions, using Firefly's state-of-the-art technology.</p>
<p>To use this feature, Bard users will simply need to type a description of the image they want to generate into the chatbot. Firefly will then use its AI to create an image that matches the description. Users will be able to edit the image as needed, and they can even share it directly on social media.</p>
<p><img src="https://storage.googleapis.com/gweb-uniblog-publish-prod/original_images/Bard_Demo_03_Image_Generation_v10_.gif" alt="Bard prompt asking to create an image of a unicorn with birthday cake" /></p>
<h2 id="heading-workspaces">💼 Workspaces</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683830425929/8d2cd0b1-6ee8-43b9-9374-05da08c64299.png" alt class="image--center mx-auto" /></p>
<p>Some of the popular tools available in Google Workspaces like Docs, and Sheets will have options for users to prompt specific requirements. From generating job descriptions, and creating tables with data inserted, to creating images with specific styles everything can be done with just a simple prompt directly from these tools. You can do these with a side panel called "sidekick" which will keep track of the context and then provide relevant information. This will make prompting very easy.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683830922641/287d624f-991e-4a05-b60c-5d84c70d7fc6.png" alt class="image--center mx-auto" /></p>
<p>All of this will be generally available to business and consumer Workspace users later this year via a new service called <strong>Duet AI</strong> for Workspace.</p>
<h2 id="heading-generative-ai-in-search">🔍 Generative AI in Search</h2>
<p>A typical Google Search can be quite challenging, to be honest. To obtain very specific information, you must break down the text you are searching for and then skim through the results to find the precise answer.</p>
<p>But with this new integration of Generative AI, you don't have to do so anymore. It will automatically take care of extracting the information, getting relevant results and then compiling the results to give you the perfect response.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683864157787/10c3205b-0081-447a-9c89-73487e6194d5.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-vertex-ai">✳️ Vertex AI</h2>
<p><img src="https://miro.medium.com/v2/resize:fit:549/1*g-YZo7s0j46lDQfMmQ955A.png" alt class="image--center mx-auto" /></p>
<p>Vertex AI is a managed machine learning (ML) platform that helps you build, deploy, and scale ML models. It offers a unified experience for managing the entire ML lifecycle, from data preparation to model training and deployment. Vertex AI also provides a variety of tools and services to help you accelerate your ML projects.</p>
<p>Other big techs are already availing this functionality in their apps, like:</p>
<ul>
<li><p>replit</p>
</li>
<li><p>Uber</p>
</li>
<li><p>Canva</p>
</li>
<li><p>character.ai</p>
</li>
</ul>
<p>Vertex has the support of 3 new models, in addition to PaLM2.</p>
<ol>
<li><p><strong>Imagen:</strong> which powers image generation, editing, and customization from text inputs.</p>
</li>
<li><p><strong>Codey:</strong> for code completion and generation, which can be trained on code base to help build applications faster.</p>
</li>
<li><p><strong>Chirp:</strong> universal speech model which brings speech-to-text accuracy for over 300 languages.</p>
</li>
</ol>
<p>All of these features are already in Preview and can be used.</p>
<h2 id="heading-project-tailwind">📔 Project Tailwind</h2>
<p>Project Tailwind is an experimental AI-first notebook that learns from your documents and helps you learn faster. You can upload the docs using Google Drive and that creates a custom fine-tuned model for you to interact with.</p>
<p>It can be used:</p>
<ul>
<li><p>to create study guides</p>
</li>
<li><p>find sources</p>
</li>
<li><p>generate quizzes</p>
</li>
<li><p>do a quick Google search to get more information.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683868215514/593378d7-0e8c-4930-bbfe-b12fd0129178.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Google I/O 2023 unveiled groundbreaking AI advancements and integrations, showcasing the power of AI to revolutionize the way we live, work, and interact with technology. These innovations promise to make our lives more efficient, connected, and inspired as we move toward a brighter future.</p>
<p>As we embrace the future of AI, let's harness its power to innovate, improve our lives, and create a world where technology is a catalyst for positive change, empowering us to reach new heights and achieve our greatest potential.</p>
<h2 id="heading-references">References</h2>
<ul>
<li><p><a target="_blank" href="https://blog.google/technology/ai/google-io-2023-keynote-sundar-pichai/">Google I/O 2023: Keynote</a></p>
</li>
<li><p><a target="_blank" href="https://blog.google/technology/ai/google-palm-2-ai-large-language-model/">Introducing PaLM 2</a></p>
</li>
</ul>
<hr />
<p>If you found this blog useful, do leave a comment and like this blog, it really motivates me to put forward more such content. You can follow me on Twitter for further updates. My Twitter handle: <a target="_blank" href="https://twitter.com/ArnabSen1729">@ArnabSen1729</a>.</p>
<p>You can find the rest of my social links at <a target="_blank" href="https://arnabsen.dev/links">arnabsen.dev/links</a>. Thank you and have a wonderful day.</p>
]]></content:encoded></item><item><title><![CDATA[Unlocking the Power of the Cloud: A Beginner’s Guide to Google Cloud]]></title><description><![CDATA[As software developers, we are constantly on the lookout for solutions that will allow us to publicize our projects and work for people all over the world to use and benefit from. The thought of managing our own servers and infrastructure, on the oth...]]></description><link>https://arnabsen.dev/unlocking-the-power-of-the-cloud</link><guid isPermaLink="true">https://arnabsen.dev/unlocking-the-power-of-the-cloud</guid><category><![CDATA[Cloud]]></category><category><![CDATA[GCP]]></category><category><![CDATA[Beginner Developers]]></category><dc:creator><![CDATA[Arnab Sen]]></dc:creator><pubDate>Mon, 08 May 2023 01:30:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1683288152481/ea9e4009-8224-4211-9640-867c287a3cbc.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>As software developers, we are constantly on the lookout for solutions that will allow us to publicize our projects and work for people all over the world to use and benefit from. The thought of managing our own servers and infrastructure, on the other hand, can be intimidating and exhausting. Fortunately, companies like Google recognized this need and provided a solution in the form of <strong>Google Cloud Platform (GCP)</strong>. With GCP, we can easily leverage the power of the cloud to bring our projects to the masses.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683288095581/74753aa0-90f8-49e7-b1da-1130405d1ff6.png" alt /></p>
<p><strong>Google Cloud is a comprehensive suite of cloud computing services that can assist you in easily building, running, and scaling your applications.</strong> Google Cloud provides a wide range of solutions to help you achieve your goals, from data storage and analysis to machine learning and artificial intelligence.</p>
<p>In this blog, we’ll go over the fundamentals of Google Cloud, such as what it is, how it works, and why it’s such a valuable tool for both businesses and developers. We’ll go over the various Google Cloud services and provide real-world examples of how businesses are using Google Cloud to achieve their goals.</p>
<h3 id="heading-a-little-introduction-about-me">A little introduction about me</h3>
<p>Hi, I am <strong>Arnab Sen</strong>. A Software Developer from India. I was an <strong>SWE Intern</strong> at Google and will be joining them as a Full Time Engineer. I was also a <strong>Google Cloud Facilitator</strong> where I taught 150+ students about Google Cloud and its tools. Feel free to reach out to me on my social handles at <a target="_blank" href="https://www.arnabsen.dev/links">arnabsen.dev/links</a></p>
<h3 id="heading-getting-a-brief-idea">Getting a brief idea</h3>
<p>Before starting out, I urge you to watch this video by Google Cloud Tech once. It will really inspire you to learn about this new domain of technology.</p>
<iframe src="https://www.youtube.com/embed/pF08WX0IMGY?feature=oembed" width="700" height="393"></iframe>

<p>Wow, after watching that video, it’s clear that Google Cloud is the bomb! It’s like a Swiss Army knife for building innovative solutions that can do some seriously cool stuff. Whether you’re trying to build a chatbot that can talk to customers or a machine learning model that can predict the future, Google Cloud has got your back.</p>
<p>One of the things that really stood out to me was how easy it is to use Google Cloud. The video showed how you can set up a machine-learning model with just a few clicks, and I was blown away by how simple it was. With Google Cloud, you don’t have to worry about all the nitty-gritty details of setting up servers and managing infrastructure. <strong>You can focus on building your application and let Google Cloud handle the rest.</strong></p>
<h3 id="heading-what-is-cloud-technology-after-all">What is Cloud Technology after all?</h3>
<blockquote>
<p>Cloud computing is the delivery of different services through the Internet, including data storage, servers, databases, networking, and software.</p>
</blockquote>
<p>Ehh !! That sounds complicated.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683288097457/2d48880d-0bcc-4e9b-b70a-bb4e4d24f8cd.gif" alt class="image--center mx-auto" /></p>
<p>So, let’s imagine you have a lot of toys but your room is small and you can’t keep them all. So you approach a friend and ask if you can keep some of your toys in their room. You can still play with your toys whenever you want, but they won’t take up as much space in your room.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683288099284/b1a3f339-5d89-4410-b229-281c94eb4012.png" alt class="image--center mx-auto" /></p>
<p><strong>Where do Cloud Platforms come into the picture?</strong></p>
<p>Cloud computing is similar in this regard. You have a lot of computer stuff instead of toys, such as pictures, videos, and documents, but your computer doesn’t have enough storage space to keep everything. So you ask the cloud (which is similar to your friend’s room) if you can store your belongings there.</p>
<h3 id="heading-lets-rewind-a-little-bit">Let’s rewind a little bit</h3>
<p>How do you think Cloud became mainstream? There were 3 stages to this. Let’s go through them one by one.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683288101082/23fee0d5-54ad-4e86-912d-7cee3d975fa1.png" alt class="image--center mx-auto" /></p>
<h4 id="heading-stage-1-on-premise"><strong>Stage 1: On-Premise</strong></h4>
<p>Back in the day, let’s say you created an e-commerce platform. It had 5 users and you had just one server on your desk and you are managing everything. Everything is doing great. All of a sudden someone tweets about your platform and now you have 1000s of users. But your poor server can’t handle those many users so it starts crashing. So you had to do one thing called “Scaling”. Basically, you had to buy a bigger, more powerful computer to handle all the users. Can you imagine how tedious it was back in the day?</p>
<h4 id="heading-stage-2-time-sharing"><strong>Stage 2: Time Sharing</strong></h4>
<p>That led to the 2nd stage. Now, big companies like IBM would buy out a million computers cause someday they would definitely need them. But sometimes there might be some computers which are sitting idle and not being used. So what did they do? They started to rent those out, to other companies and small startups. That way it will be cheaper and more affordable for them and companies like IBM started making passive income, which is awesome.</p>
<h4 id="heading-stage-3-cloud"><strong>Stage 3: Cloud</strong></h4>
<p>This became more and more popular and it got more mainstream for startups to rent out servers. Then bigger companies like Google, and Amazon saw an opportunity to make more active money by providing additional services along with resources. And this is what is called Cloud.</p>
<h3 id="heading-career-prospects-in-cloud">Career Prospects in Cloud</h3>
<p>Cloud is a really booming technology, with the big and small tech companies now shifting to Cloud-based architecture. And this shift has generated the requirement for skilled Cloud engineers, who are proficient with cloud technologies and platforms like GCP.</p>
<p>In fact, the Cloud Computing Market is estimated to hit USD <strong>791.48 Billion</strong> by <strong>2028</strong>. So, if you’re looking to build a career in cloud computing, <em>there’s never been a better time to do so.</em></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683288103870/914f7aa5-d455-470b-8891-e33b3551bc27.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683288105697/d0a3cc43-1368-4a37-8bb0-55997d86a580.png" alt class="image--center mx-auto" /></p>
<p>Salary? Let’s see how much a Cloud architect makes in Bangalore India:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683288107346/2836b432-14ad-4e0d-9672-dfce5ecbc415.png" alt class="image--center mx-auto" /></p>
<p>Yes, <strong>21L per annum</strong> 🤑.</p>
<h3 id="heading-googles-philosophy">Google’s philosophy</h3>
<p>Google has this very interesting philosophy:</p>
<blockquote>
<p>“Every Company is a Data Company”</p>
</blockquote>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683288108879/6c4566e3-5720-45a2-97af-c1f8ca454379.png" alt class="image--center mx-auto" /></p>
<p>In the future, every company regardless of its size and technology will differentiate itself from its competitors through technology. And that technology will be in a form of software and <em>great software always revolves around data</em>. So, every company in some way will be a data company. And cloud gives you the services to manage large volumes, velocity, and variations of data.</p>
<p>With platforms like GCP, you can further analyze those data and gain further insights. By leveraging the power of data analytics and machine learning, businesses can gain valuable insights into customer behavior, market trends, and internal operations. <em>This data-driven approach can help companies identify opportunities for growth, improve efficiency, and ultimately drive business success.</em></p>
<h3 id="heading-how-do-people-use-the-cloud">How do people use the cloud?</h3>
<p>Cloud is usually broken down into 3 different umbrellas.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683288111018/654615c3-d12e-46d9-97f2-db637f48f8c1.png" alt class="image--center mx-auto" /></p>
<h4 id="heading-infrastructure-as-a-service-iaas">Infrastructure as a Service (IaaS)</h4>
<p>This is basically <strong>Time-Sharing</strong>. In simple terms, it allows users to access computing infrastructure, such as servers, storage, and networking, without having to purchase and maintain physical hardware themselves.</p>
<h4 id="heading-platform-as-a-service-paas">Platform as a Service (PaaS)</h4>
<p>This takes it one step further. Previously if you had to add 10 more servers, you could reach out to those IaaS providers and ask for more 10 servers. After that, you will have to manually handle the deployment and setup. But with this PaaS, all they need is the code of the application. The providers will take care of handling the load, setting up the OS, and everything and you only have to focus on the business logic.</p>
<h4 id="heading-software-as-a-service-saas">Software as a Service (SaaS)</h4>
<p>For SaaS, you can think of simple software that is available for users to use like this blog hosting tool which is providing a service for users to publish and read blogs.</p>
<p>In the SaaS model, the software provider is responsible for maintaining the application, including security, availability, and performance. Customers typically pay for SaaS on a subscription basis, with fees based on usage or the number of users.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683288113883/05c1950d-a2b6-40c6-8787-bd1ef39ececb.png" alt class="image--center mx-auto" /></p>
<p><strong>Where does GCP fall in these categories?</strong> Well with GCP you can get your own servers, storage disks, and everything. But at the same time, it has features that handle them for you. <em>So it covers both IaaS and PaaS domains</em>.</p>
<h3 id="heading-lets-dive-into-some-of-the-gcp-tools">Let’s dive into some of the GCP tools</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683288115855/ccbe031b-4fa5-4772-bb49-b3299728d43f.png" alt class="image--center mx-auto" /></p>
<h4 id="heading-compute-engine">Compute Engine</h4>
<p>Compute Engine is a service that allows users to run virtual machines (VMs) on Google’s infrastructure. In simple words, it lets you run any code on Google servers. If let’s say you have a giant script that takes a couple of hours or days to run. Instead of doing it on your laptop and worrying about your battery dying, etc, you can create a VM instance for yourself and run the code over there.</p>
<h4 id="heading-cloud-storage">Cloud Storage</h4>
<p>A scalable and highly available object storage service for storing and accessing data on GCP. In other words, Google Cloud Storage is like your very own storage unit in the cloud, where you can keep all your digital “stuff” — like files, photos, videos, and more — safe and sound. But here’s the really cool part — Google Cloud Storage is designed to be super reliable and secure. It’s backed up across multiple servers and data centers, so even if one server goes down, your files will still be safe and accessible. Plus, you can control who has access to your files, so you can make sure only the right people can see and edit them.</p>
<h4 id="heading-cloud-load-balancing">Cloud Load Balancing</h4>
<p>Cloud Load Balancing in GCP is a tool that will help you distribute the incoming network traffic to multiple virtual machines (VMs) or zonal or regional managed instance groups across different regions, zones, or across multiple regions. It balances the network traffic in real-time so that no single instance or zone gets overwhelmed, resulting in faster response times and better reliability.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683288117468/e3484408-58be-405c-a677-e3f10cadb0fc.png" alt class="image--center mx-auto" /></p>
<p>In simple terms, let’s say you have an online store that is getting a lot of traffic. Without load balancing, all the traffic would hit a single server, potentially causing it to slow down or crash. But with Cloud Load Balancing, the traffic is distributed evenly across multiple servers, ensuring that the website stays up and running even during peak traffic times.</p>
<h4 id="heading-bigquery">BigQuery</h4>
<p>Big Query allows you to analyze massive amounts of data quickly and efficiently using a fully-managed, serverless cloud data warehouse. With BigQuery, you can easily load and query data sets, perform data transformations, and visualize your results using Google Data Studio or other third-party tools. It is highly scalable, secure, and easy to use, making it a popular choice for businesses of all sizes that need to analyze large volumes of data.</p>
<h4 id="heading-iam-and-admin-tools">IAM and Admin Tools</h4>
<p>IAM (Identity and Access Management) enables you to manage access control by defining who (identity) has what type of access (role) to which resource. It provides a centralized view of permissions and access for all cloud resources, including Google Cloud Storage, BigQuery, and Compute Engine. IAM allows you to create and manage service accounts, grant permissions to users, and set up custom roles to meet specific business needs.</p>
<p>And there are many more such tools. These tools have been used by companies to drive their software and manage the data that they receive.</p>
<p>Take Spotify for example. Spotify launched a music-streaming service in late 2008, surpassed 1 million customers in early 2011, and today offers 248 million monthly active users in 79 markets access to more than 50 million songs and podcasts. How are they handling this massive user base? Yes, with Google Cloud.</p>
<blockquote>
<p>“Google Cloud removes a lot of the operational complexity from our ecosystem. That frees up time,” said <strong>Tyson Singer</strong>, vice president of technology and platform at Spotify.</p>
<p>“We can iterate quicker on key needs, like data insights and machine learning. Having infrastructure managed for us, with the lower-value details taken away, streamlines our ability to concentrate on what’s important to our users and give them the experiences they know and love about Spotify.”</p>
</blockquote>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683288120090/5c2b8684-022b-4c9c-bc73-229505fb1ec1.jpeg" alt /></p>
<p>Here is a great video on the Spotify case study:</p>
<iframe src="https://www.youtube.com/embed/55xgR_o4PGs?feature=oembed" width="700" height="393"></iframe>

<p>The video teaches us a valuable lesson: “Why waste time building something that is already done?” Google is the world’s largest search engine, and it also happens to build the best data centers. And it makes sense; why would a company waste time building a data center when they can simply use a platform like GCP and focus on the business logic and idea they are developing?</p>
<p>Take a quick glance at the scale that Google Cloud works at:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683288121963/f31671e7-24a3-4ebb-874c-615c30f6bb47.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-how-can-you-as-a-student-use-gcp">How can you as a student use GCP?</h3>
<p>As we say in the first video, you as a student can fully leverage the various tools that GCP provides for a variety of applications like training ML models, starting a server, and many more. Let’s get our hands dirty and learn how to use the Google Cloud Console.</p>
<p>Let’s go through it step by step:</p>
<ol>
<li><p>Visit the <a target="_blank" href="https://console.cloud.google.com/home/dashboard">Google Cloud Console</a> and log in and check the terms and conditions.</p>
</li>
<li><p>Once you are in, you will see a dashboard something like this:</p>
</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683288124391/63ff235b-bd45-44b5-b3ba-03ef0be05461.png" alt /></p>
<p>Currently, it’s pretty empty but once you start working on your project you will be able to see some stats.</p>
<p>Let’s dig into the Project Details section. Here we have:</p>
<ul>
<li><p><strong>Project Name:</strong> This is to make it easy for you to differentiate between the projects that you have. It is not globally unique.</p>
</li>
<li><p><strong>Project ID and Project Number:</strong> These are in fact globally unique and different for different projects.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683288126277/c16d1401-c19b-40c5-a859-ea9d29a73e58.png" alt /></p>
<p>Now, let’s build a resource. Let’s create our own Virtual Machine. If you don’t know what a VM is, it’s like a computer inside a computer. It’s a software-based representation of a computer that can run its own operating system and applications just like a physical computer.</p>
<p>So, now click on the hamburger menu at the top-left. Look for <strong>“Compute Engine”</strong> and then click on <strong>“VM Instances”</strong>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683288128592/3f03eb4b-62ee-49b7-a9c8-5b15698bdbb7.png" alt /></p>
<p>This will open up another dashboard that will show us all the instances that we have created. In my case, I don't have any and will create one so click on <strong>“Create Instance”</strong>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683288131514/8e933034-7968-4f49-8472-3eebf39cddfe.png" alt /></p>
<p>That will open up a form for us where we will have to provide details regarding our VM instance.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683288133408/7ebd25ba-4ee2-40fd-9ad6-246562c2674b.png" alt /></p>
<p>First, we have to choose the name of our instance. You can name it anything you want, I will be leaving it as “instance-1”.</p>
<p><img src="https://cdn-images-1.medium.com/max/800/1*0PkK-e2L0rpkovgMkg7y4g.png" alt /></p>
<p>Then we have <strong>Region</strong> and <strong>Zone</strong>. This means where in the world our instance will be located. We already talked about how Google has its data centers spread across the world. We can leverage that scale and set up our VM anywhere we want. This way you can set up your VM closer to your user base which will reduce the latency. I will choose <strong>“asia-south1”</strong> cause that is closer to where I am right now.</p>
<p>Scrolling down you can select the Machine Type that would suffice your requirements.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683288139469/10ae4784-1b02-494c-97b3-02312b27d0d4.png" alt /></p>
<p>I will just go with the e2-micro cause this is just for demo purposes. Next, in the Boot Disk section, you can choose the type of OS you want your VM to have.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683288142030/4fc76730-3771-4268-b618-0e2cbf4e1232.png" alt /></p>
<p>You can skip the rest of it and then go to the bottom and click on “Create”. That will take you back to your dashboard and you can see the status of your VM instance.</p>
<p><img src="https://cdn-images-1.medium.com/max/800/1*D0Z3jaCYuYEAzh-ONQQlcg.png" alt /></p>
<p>Once the setup is complete you will see a ✅ in the status. And then click on SSH.</p>
<p><img src="https://cdn-images-1.medium.com/max/800/1*J6rqHJwIzYm8kDP0FKfynA.png" alt /></p>
<p>Basically, it will now open up a console and you can literally use the VM like your own machine, set up a server, run some scripts, etc. I created a Python Hello World program and executed it as you can see:</p>
<p><img src="https://cdn-images-1.medium.com/max/800/1*S8kPVydaMl79RRnPqfqXxw.png" alt /></p>
<p>Once you are done with the work, it’s always a good practice to clean up the resources. So, let’s delete our VM instance. Head back to the VM instances dashboard. Click on the 3 dots and choose Delete.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1683288149283/f2b50168-be60-47f9-956d-8d05c38e9d22.png" alt /></p>
<p>It will ask for confirmation and then after some time, the VM instance that was assigned to you will be wiped out.</p>
<h3 id="heading-whats-next">What’s next?</h3>
<p>Now you must be very interested in learning more about Google Cloud. Well, Google has tonnes of great resources for you. Here are some of them:</p>
<ol>
<li><p><a target="_blank" href="https://www.cloudskillsboost.google/journeys">https://www.cloudskillsboost.google/journeys</a> This is a great place to learn Google Cloud. You will have step-by-step milestones to cover and learn about a particular tool.</p>
</li>
<li><p>Take part in events like 30 days of Google Cloud where you also earn cool swags along with learning about Google Cloud.</p>
</li>
<li><p><a target="_blank" href="https://youtu.be/kzKFuHk8ovk?list=PLIivdWyY5sqKh1gDR0WpP9iIOY00IE0xL">https://youtu.be/kzKFuHk8ovk?list=PLIivdWyY5sqKh1gDR0WpP9iIOY00IE0xL</a> A playlist of Google Cloud Essentials.</p>
</li>
</ol>
<h3 id="heading-conclusion">Conclusion</h3>
<p>So, now you have learned what cloud is, what GCP is, and how to use the platform to build resources. In conclusion, the Google Cloud Platform has revolutionized the way we approach computing and data management. With its vast array of tools and services, businesses of all sizes can harness the power of the cloud to scale their operations, improve efficiency, and drive innovation. From startups to global enterprises, GCP offers a world of possibilities, and with the right knowledge and skills, anyone can leverage it to unlock their potential.</p>
<p><strong>So, don’t be afraid to explore, experiment, and learn. Who knows, maybe the next big thing will be built on the cloud, and it could be yours!</strong></p>
]]></content:encoded></item><item><title><![CDATA[$ whoami]]></title><description><![CDATA[Hi, I am Arnab
I currently work as a Software Engineer at Google in the Ads team.
I did my B.tech in 2023 in Computer Science and Engineering from the Indian Institute of Engineering Science and Technology, Shibpur.
I've always had a strong enthusias...]]></description><link>https://arnabsen.dev/about</link><guid isPermaLink="true">https://arnabsen.dev/about</guid><dc:creator><![CDATA[Arnab Sen]]></dc:creator><pubDate>Sun, 30 Apr 2023 18:30:00 GMT</pubDate><content:encoded><![CDATA[<h1 id="heading-hi-i-am-arnab">Hi, I am Arnab</h1>
<p>I currently work as a <strong>Software Engineer</strong> at <strong>Google</strong> in the Ads team.</p>
<p>I did my <a target="_blank" href="http://B.tech"><strong>B.tech</strong></a> in 2023 in <strong>Computer Science and Engineering</strong> from the <strong>Indian Institute of Engineering Science and Technology, Shibpur</strong>.</p>
<p>I've always had a strong enthusiasm for technology, education, and problem-solving. I also enjoy using my blogs and tweets to share my knowledge.</p>
<p>My interest in coding peaked during my 11th when I had Computer Science in my curriculum. I wanted to do more than just pattern printing problems that used to come in school exams. And that's how I came across <strong>Competitive Programming</strong>. I attempted for INOI (Indian National Olympiad in Informatics) in my 12th standard with around 3 months of CP experience, and it was a disaster. But even after that, I continued with CP. I reached "Expert" in <a target="_blank" href="https://codeforces.com/">Codeforces</a> by the end of my 1st year.</p>
<p>During the COVID lockdown, I found more interest in <strong>Ethical Hacking</strong> and participated in lots of CTFs with <a class="user-mention" href="https://hashnode.com/@sadn1ck">Anik Das</a> and we were ranked 65th all India according to <a target="_blank" href="https://ctftime.org/">CTFTime</a>.</p>
<p>Then I started delving into <strong>Development</strong> and <strong>Open Source</strong>. I got the Coronasafe Pupilfirst Fellowship. Then I was also selected for the first cohort of Summer of Bitcoin.</p>
<p>In my pre-final year, I interned at Google as a SWE Intern and by the end of the internship, I was able to get a PPO (Pre-Placement Offer).</p>
<p>Even in my final year, I interned at a bunch of different startups:</p>
<ul>
<li><p>Cypherock in the field of web3 and blockchain</p>
</li>
<li><p>GMetriXR in the field of AR/VR</p>
</li>
</ul>
<p>To summarise these are the fields I have worked on:</p>
<ul>
<li><p>Competitive Programming</p>
</li>
<li><p>Ethical Hacking</p>
</li>
<li><p>Open Source</p>
</li>
<li><p>Development</p>
<ul>
<li><p>Web Development</p>
</li>
<li><p>Web3 and Blockchain</p>
</li>
<li><p>Embedded Systems</p>
</li>
<li><p>AR/VR</p>
</li>
</ul>
</li>
</ul>
<p>... and I still looking forward to learning more.</p>
<h2 id="heading-achievements">Achievements</h2>
<p>Here are some of my achievements (most of them were during my college times):</p>
<ul>
<li><p>Ranked <strong>2nd</strong> position among <strong>22k</strong> participants in the Cybersecurity Hackathon conducted by RISE. Got featured in <a target="_blank" href="https://theprint.in/ani-press-releases/get-set-hack-by-rise-marks-massive-success-with-more-than-22k-participants/1113059/?amp"><strong>ThePrint</strong></a> , <a target="_blank" href="https://www.theweek.in/news/sci-tech/2022/10/18/why-hackathons-are-a-competitive-but-fun-way-of-getting-students-tech-ready-for-the-future.html"><strong>TheWeek</strong></a> , <a target="_blank" href="https://www.news18.com/news/education-career/delhi-boy-wins-cryptography-hackathon-hosted-by-ap-govt-top-5-winners-get-placement-offers-5950933.html"><strong>News18</strong></a> , <a target="_blank" href="https://www.aninews.in/news/business/business/get-set-hack-by-rise-marks-massive-success-with-more-than-22k-participants20220902131355/"><strong>ANI News</strong></a> , <a target="_blank" href="https://www.mid-day.com/brand-media/article/driving-holistic-learning-edtech-startup-rise-enriching-students-through-hackathons-23258081"><strong>Mid-day</strong></a> .</p>
</li>
<li><p>Was among the top <strong>100</strong> candidates selected out of over <strong>10,000</strong> applications and <strong>2,500</strong> project proposals for the <em>XROS Fellowship Program 2023</em>, an initiative of FICCI, supported by <em>Meta</em>, and implemented by <em>Reskilll</em>.</p>
</li>
<li><p>Ranked <strong>98</strong> globally among <strong>136,054</strong> students (from 34 countries) in Round 2 of <strong>Codevita 2022</strong>.</p>
</li>
<li><p>Ranked <strong>25 in India</strong> and <strong>311</strong> globally in <em>Google Hashcode 2021</em>.</p>
</li>
<li><p>Selected for <a target="_blank" href="http://summerofbitcoin.org/"><strong>Summer of Bitcoin 2021</strong></a> . Around <strong>55</strong> were selected from <strong>4800+</strong> applicants.</p>
</li>
<li><p>Ranked <strong>72</strong> among 200+ teams in <strong>ICPC Asia Kanpur-Mathura Regionals 2020</strong>.</p>
</li>
<li><p><strong>Best Hardware Hack</strong> in SnakesNHackers Hackathon by <strong>MLH</strong>. The project link: <a target="_blank" href="https://github.com/arnabsen1729/HackersNLadders"><strong>arnabsen1729/HackersNLadders</strong></a> .</p>
</li>
<li><p>Secured a rank in the <strong>top 24 out of 50,452</strong> applications in <em>CoronaSafe Engineering Fellowship Program by AICTE</em>.</p>
</li>
<li><p><em>Leetcode</em> Rating 2006 (top 2.31%) (handle: <a target="_blank" href="https://leetcode.com/arnabsen1729/"><strong><em>arnabsen1729</em></strong></a> ) solved <strong>800+ problems</strong>.</p>
</li>
<li><p><em>Leetcode</em> ranked <strong>431th out of 15000+</strong> in India.</p>
</li>
<li><p><em>Codeforces</em> Rating <strong>Expert</strong> 1614 (handle: <a target="_blank" href="https://codeforces.com/profile/arnab1729"><strong><em>arnab1729</em></strong></a> )</p>
</li>
<li><p><em>Codechef</em> Div1 4star 1802 (handle: <a target="_blank" href="https://www.codechef.com/users/arnab1729"><strong><em>arnab1729</em></strong></a> )</p>
</li>
<li><p><strong>1003th out of 17k+</strong> in <em>Credit Suisse Global Coding Contest</em>.</p>
</li>
<li><p><strong>1st Position in CodeRush 2020</strong> by <em>IEEE-MIT</em> out of 70+ teams.</p>
</li>
<li><p>Ranked <strong>103</strong> in <em>rgbCTF2020</em> out of 1034</p>
</li>
<li><p>My CTF Team <strong>0xw3bs3c</strong> was ranked <strong>65th in India</strong> according to <em>CTFTime</em>.</p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[The Evolution of a Tech Enthusiast: My Tech Journey]]></title><description><![CDATA[I've been working in this domain for a while now and intend to continue. One thing that has always fascinated me, is how other people got into this magical world of Tech. And here's my story.
Why did I use the term "magical"? ✨
To me, coding is like ...]]></description><link>https://arnabsen.dev/my-tech-journey</link><guid isPermaLink="true">https://arnabsen.dev/my-tech-journey</guid><category><![CDATA[WeMakeDevs]]></category><category><![CDATA[software development]]></category><category><![CDATA[journey into tech]]></category><dc:creator><![CDATA[Arnab Sen]]></dc:creator><pubDate>Sun, 23 Apr 2023 14:36:13 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1682260430948/e145b010-9a4c-4573-b3e0-5c14538ab412.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>I've been working in this domain for a while now and intend to continue. One thing that has always fascinated me, is how other people got into this magical world of Tech. And here's my story.</p>
<p><strong>Why did I use the term "magical"?</strong> ✨</p>
<p>To me, coding is like casting a magical spell, through every line of code that brings a digital creation to life.</p>
<p>Believe it or not, a few lines of code propelled humanity to the moon, an unimaginable feat. The Apollo 11 mission that landed humans on the moon in 1969 was powered by a computer with a processor speed of just 1.024 MHz, which is slower than most modern calculators. The computer had only <strong>4</strong> KB of memory, which is less than what we use to store a single photo today. But the code that powered this computer was nothing short of miraculous.</p>
<p><img src="https://media.wired.com/photos/5954741abe605811a2fdd19d/191:100/w_1280,c_limit/001_3-featured.jpg" alt="Her Code Got Humans on the Moon—And Invented Software Itself | WIRED" /></p>
<blockquote>
<p>Let me know in the comments if you know who this lady in the picture above is? Hint: she played a very crucial role in the Apollo 11 mission.</p>
</blockquote>
<h2 id="heading-lets-introduce-ourselves-first">👋 Let's introduce ourselves first</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682258192902/25443f28-56ce-4c13-874b-69585c23e156.png" alt class="image--center mx-auto" /></p>
<p>I am Arnab Sen, a Software Developer from India. Currently while writing this, I have just 1 more month left for my college. In these 4 years, I have learned a lot and grown as a software developer. There are some achievements of mine that I am really proud of:</p>
<ul>
<li><p>Was one of the <strong>24</strong> people selected for the <strong>Coronasafe Fellowship by AICTE</strong> out of <strong>50,000+</strong> applicants and built an open-source healthcare platform.</p>
</li>
<li><p>Selected for the <strong>Summer of Bitcoin</strong> project and spend the summer of 2021 contributing to Bitcoin-Core.</p>
</li>
<li><p>Selected for <strong>SWE Internship at GOOGLE</strong>, and on top of that ended up with a PPO opportunity.</p>
</li>
<li><p>Was selected for the <strong>XROS Fellowship</strong> which is powered by FICCI and supported by Meta.</p>
</li>
<li><p>Interned at multiple remote startups: <strong>Dynopii, Cypherock, GMetriXR</strong>.</p>
</li>
</ul>
<h2 id="heading-where-it-all-started">🏗️ Where it all started</h2>
<p><img src="https://www.drury.edu/wp-content/uploads/2021/04/HemSheela.jpg" alt="Hem Sheela Model School | Elementary | Secondary School" class="image--center mx-auto" /></p>
<p>The first time I did something close to programming was <strong>LOGO</strong> in class 4. For those who aren't aware, LOGO is an educational programming language designed to teach the basic concepts of programming. There is a turtle and we can give directions to the Turtle with keywords like <strong>"FORWARD"</strong>, <strong>"RIGHT"</strong>, etc and it will draw the path.</p>
<p><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/7/76/IBM_LCSI_Logo_Circles.png/640px-IBM_LCSI_Logo_Circles.png" alt class="image--center mx-auto" /></p>
<p>As a kid, I always loved creating different kinds of patterns in LOGO. Then in class 5, we had QBASIC in our syllabus. That's it, that kind of sparked a little fire in me, that maybe I should pursue Software Development in the future, cause I uncovered the magic beneath.</p>
<p><img src="https://upload.wikimedia.org/wikipedia/en/0/01/QBasic_Opening_Screen.png" alt="QBasic - Wikipedia" class="image--center mx-auto" /></p>
<p>Luckily, I had internet access (the max speed was 500 kbps, but that was still a lot during those days). So I started learning a few other programming languages. My dad's colleague used to give computer science tuition to 11-12th standard students. He asked me if I was interested in joining his classes and I started doing so in class 6.</p>
<p>By the time I was in class 8, I already had the fundamentals of C and C++ strong. But after class 8 I joined an IITJEE coaching center, and just like everyone, I too had to leave behind my creative knacks to run in this rat race. With the JEE preparation pressure, I lost all interest in programming 🥺. That should have been the end, but...</p>
<p>In 11 standard I had computer science again in my course, and that rekindled the fire in me. During that time I also watched movies like, <strong>The Social Network</strong>, <strong>Jobs</strong>, <strong>Snowden</strong>, and many more, and I became passionate about coding more than ever.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682233545647/7ec729de-202e-4a98-8f36-38f51955cc05.png" alt class="image--center mx-auto" /></p>
<p>I came across an olympiad competition called <strong>IOI (Internation Olympiad In Informatics)</strong>, it's like <strong>IMO (International Mathematical Olympiad)</strong> but for Programming.</p>
<p><img src="https://ioinformatics.org/icons/ioi-logo-2020.png" alt="International Olympiad in Informatics (IOI)" class="image--center mx-auto" /></p>
<p>To be eligible for IOI, one has to qualify for <strong>INOI (Indian Olympiad of Informatics)</strong>, and to get into that one has to qualify for either <strong>ZOI (Zonal Olympiad of Informatics)</strong> or <strong>ZCO (Zonal Computing Olympiad)</strong>. But when I was in class 11, I already missed the <strong>ZCO</strong> or <strong>ZOI registration</strong> date. So I prepared for class 12th ZIO and ZCO. Qualified them and then went to INOI, but failed miserably. I left the exam center 1 hour before because I was unable to solve any questions. But that didn't stop me, cause I knew it was just the beginning.</p>
<p>So, far I did programming as a hobby or whenever I had a break. But after JEE I opted for CS in IIEST Shibpur, and now I was able to give my full attention to programming.</p>
<h2 id="heading-college-life">🎓 College Life</h2>
<p>In the initial few days, I was really interested in building small games. Here are some of them.</p>
<p>Built a small TicTacToe game built with Python3 with one of my hostel mates.</p>
<blockquote>
<p>Here is a fun fact: the logic behind Computer Moves is just a bunch of if-else statements 🤣🤣🤣🤣</p>
</blockquote>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682236912863/5d64cb77-b2a3-4701-8728-fe41e9c1100f.gif" alt class="image--center mx-auto" /></p>
<p>Here is another beautiful yet very simple project that I built with simple HTML, CSS, and JS. It's based on Chaos Theory, it shows how pure randomness generates such beautiful patterns.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682237143983/a1177d85-4f2d-4c3d-9be6-9db0587965c2.gif" alt class="image--center mx-auto" /></p>
<p>But as time passed, I started to focus on building stuff that could be useful to some extent. Like, a Discord bot for IPL Scores, a simple website to pdf converter, markdown to pdf generator.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682238210809/10fde85a-0738-406b-998d-de4bab36cac0.png" alt class="image--center mx-auto" /></p>
<p>For learning, I never really paid for any courses. There are so many great folks online who share their knowledge and are such amazing teachers. For learning web development especially I followed these channels and I feel they helped me strengthen my fundamentals:</p>
<ul>
<li><p><a target="_blank" href="https://www.youtube.com/@freecodecamp">https://www.youtube.com/@freecodecamp</a></p>
</li>
<li><p><a target="_blank" href="https://www.youtube.com/@TraversyMedia">https://www.youtube.com/@TraversyMedia</a></p>
</li>
<li><p><a target="_blank" href="https://www.youtube.com/@akshaymarch7">https://www.youtube.com/@akshaymarch7</a></p>
</li>
<li><p><a target="_blank" href="https://www.youtube.com/@WesBos">https://www.youtube.com/@WesBos</a></p>
</li>
<li><p><a target="_blank" href="https://www.youtube.com/@academind">https://www.youtube.com/@academind</a></p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682406093916/87906cb7-430b-41e1-a77d-3a1e52ea7c20.png" alt class="image--center mx-auto" /></p>
<p>For theoretical topics related to computer science like Data Structures and Algorithms, Operating Systems, and Database Management Systems, I always preferred the MIT Open Courseware Courses. I think they are just goldmines for anyone looking to dive deep into these topics.</p>
<p><img src="https://i.pinimg.com/originals/6c/b3/51/6cb351d785d6786158ec59ec63c0988f.png" alt="MIT OpenCourseWare (@MITOCW) | Twitter | Free courses, Learning and  development, Science and nature" class="image--center mx-auto" /></p>
<h2 id="heading-met-open-source">🤍 Met Open Source</h2>
<p>When I was in my 2nd year of college, I came across open-source software and realized that through OSS I could make more impact with my knowledge. I was a part of the Coronasafe Fellowship where I got to work on multiple open-source healthcare projects.</p>
<p>One of the projects is <a target="_blank" href="https://github.com/coronasafe/arike">Arike</a> which is a software system for palliative care. The other project is called <a target="_blank" href="https://github.com/coronasafe/life">Life</a> which acted as verified crowd-sourced emergency services during the peak of covid second wave. I am grateful to be a part of such a great cause and take my development skills to help people.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682240201508/e3157fdc-694d-4d93-a55c-4038a4cb8b7d.png" alt class="image--center mx-auto" /></p>
<p>My other contributions can be found on my <a target="_blank" href="https://github.com/arnabsen1729">GitHub</a> profile. Through contributing to open source, I have been able to gain valuable experience in real-world software development problems, collaborate with other talented developers, and learn new programming languages, tools, and frameworks. Contributing to open source has also allowed me to receive feedback from other developers and improve my ability to communicate my ideas effectively.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682248351081/00630606-b825-4521-85be-d3994537374b.png" alt class="image--center mx-auto" /></p>
<p>Open Source went on to change my career and brought me even better opportunities in the future.</p>
<p>Even though everything seems smooth, like every other thing in life there are always ups and downs.</p>
<p><img src="https://live.staticflickr.com/8642/30524599555_bc86ec20e0_b.jpg" alt="Maysix_failure success path | Failure success paths | Flickr" /></p>
<p>If you are also interested to pursue a career in this domain of Software Development. Here are a few things to keep in mind, that I learned from my personal experience:</p>
<h3 id="heading-start-with-the-basics">📚 Start with the basics</h3>
<p>Before you jump into coding and building cool stuff, it's important to have a solid foundation of the basics. So, what are the basics? Well, at a minimum, you should have a solid understanding of at least one programming language. There are many languages to choose from, but some of the most popular ones include Python, Java, C++, and JavaScript. Each language has its own strengths and weaknesses, and choosing the right one for you will depend on your personal preferences and the type of projects you want to work on.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682248965290/4f0823dc-fa7d-49c4-bb2e-1a24a6d3d94c.png" alt class="image--center mx-auto" /></p>
<p>Also, it's worth noting that learning the basics isn't a one-and-done task. As you progress in your career, you'll continue to build on your knowledge of programming languages, data structures, and algorithms. The key is to start with a strong foundation and continue to learn and grow from there.</p>
<h3 id="heading-keep-learning">🧠 Keep Learning</h3>
<p>The field is constantly evolving, and there are always new technologies and tools being developed. As a result, it's crucial to stay up-to-date with the latest trends and developments to remain competitive and relevant.</p>
<p>Reading industry blogs and publications is a great way to stay informed about the latest trends and developments. Many tech publications offer daily or weekly newsletters that summarize the latest news and events in the industry. Following these publications can help you stay informed about the latest advancements in the field, and help you identify emerging trends that may be relevant to your work. If you prefer learning from videos more then my suggestion would be to start watching conference talks.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682406258408/bf3e3ff0-4298-44c7-9f04-fc5baf1195a4.png" alt class="image--center mx-auto" /></p>
<p>I also love to watch documentaries like the ones by <a target="_blank" href="https://www.youtube.com/playlist?list=PLtEPUaeDclku1ECmuN3IsUimHApukWIOf">Honeypot.io</a>. The amount of insights that are shared in these 30 mins Netflix-styled documentaries is just crazy, and trust me you will never get bored.</p>
<p><img src="https://pbs.twimg.com/media/FgSoltjVEAAoh2-?format=jpg&amp;name=large" alt="Image" /></p>
<h3 id="heading-embrace-challenges">🏔️ Embrace Challenges</h3>
<p>Challenges are a natural part of any career, but in the tech industry, they can be particularly prevalent due to the constantly evolving nature of technology. However, it's important to embrace these challenges as opportunities for growth and development.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682253092815/2ea39282-06fb-4438-a962-04948add3802.png" alt class="image--center mx-auto" /></p>
<p>One way to embrace challenges is to take on projects that push you outside of your comfort zone. By taking on projects that are unfamiliar or challenging, you'll be forced to learn new skills and adapt to new situations, which can help you grow both personally and professionally.</p>
<h3 id="heading-dealing-with-imposter-syndrome">🎭 Dealing w/ Imposter Syndrome</h3>
<p>This is a very very prevalent topic, especially in the software development domain.</p>
<p><img src="https://softwareengineeringdaily.com/wp-content/uploads/2019/09/what-is-imposter-syndrome-1024x506.jpg" alt="Finding the Benefits of Imposter Syndrome - Software Engineering Daily" /></p>
<p>Imposter syndrome is a nasty little bugger that can creep up on anyone in the tech industry. It's that feeling that you're not qualified or good enough for your job, even when all evidence points to the contrary. But here's the thing: you're not alone. Lots of successful people in the tech industry have felt imposter syndrome at some point in their careers. It's a pretty common experience.</p>
<p>So, the next time you start feeling like a fraud, remember that you're not alone, and remind yourself of all the awesome things you've accomplished. Seek out a mentor or coach for guidance, and connect with others who have gone through the same experience. With these strategies, you can kick imposter syndrome to the curb and achieve success in the exciting and dynamic world of tech!</p>
<p>Here is a great video by Ted-Ed on Imposter Syndrome:</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://youtu.be/ZQUxL4Jm1Lo">https://youtu.be/ZQUxL4Jm1Lo</a></div>
<p> </p>
<h3 id="heading-share-your-learnings">🤝 Share your learnings</h3>
<p>Sharing knowledge as a software developer is one of the most rewarding things you can do! Not only does it help you solidify your own understanding of a topic, but it also benefits the wider community and can even lead to new career opportunities.</p>
<p>Blogging is a great way to share your knowledge and experiences with others. By writing about your insights, tips, tricks, or lessons learned on a particular topic, you can help others who are facing similar challenges or looking to learn new skills.<br />One of my blogs where I shared my resources and how I prepared to land a job at Google got featured on Hashnode and has around 1k views (even Hashnode's cofounder commented on the blog).</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682257077749/faaca0ee-2288-429e-b040-f3a40bd2b479.png" alt class="image--center mx-auto" /></p>
<p>Link to the blog 👇</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://arnabsen.hashnode.dev/landing-a-google-swe-internship">https://arnabsen.hashnode.dev/landing-a-google-swe-internship</a></div>
<p> </p>
<p>Plus, blogging can help you establish yourself as an authority in your field and even lead to opportunities for speaking engagements or consulting gigs. My blogs on Bitcoin helped me get a web3-based internship.</p>
<p>Speaking at conferences or community events is another fantastic way to share your knowledge and connect with others in the industry. Not only do you get the chance to present your ideas and insights to a live audience, but you also get to network with other professionals and learn from their experiences as well. Plus, speaking engagements can be a great addition to your resume and help you stand out when you're looking for new job opportunities.</p>
<p><img src="https://miro.medium.com/v2/resize:fit:940/1*s05HQAVGGXH4VfnA9vwJnQ.jpeg" alt="How to tackle public speaking as a software developer? | by Jakub Kapuscik  | Level Up Coding" /></p>
<h2 id="heading-the-end">🎬 The End</h2>
<p>As I reflect on my tech journey, I realize that it's been a rollercoaster ride with its fair share of ups and downs. But it's also been a journey filled with wonder, innovation, and creativity. I've learned that being a software developer isn't just about writing code. It's about problem-solving, collaboration, and being passionate about making a difference in the world.</p>
<p>If you're just starting your own tech journey, remember that it's never too late to start. Whether you're fresh out of school or a seasoned professional, there's always something new to learn. Be open-minded, stay curious, and never stop exploring. And always remember to keep your eye on the end goal: creating something that can change the world.</p>
<p>And always remember "YOU GOT THIS !!"</p>
<p><img src="https://upload.wikimedia.org/wikipedia/en/f/ff/SuccessKid.jpg" alt="Success Kid - Wikipedia" class="image--center mx-auto" /></p>
]]></content:encoded></item><item><title><![CDATA[Landing a Google SWE Internship: Interview Experience and preparation journey]]></title><description><![CDATA[Even though, there is a plethora of articles on Google SWE Internship interview experience online, I am still frequently asked the following questions:

How did you crack Google SWE Internship?

Which resources did you follow?

Can you share some int...]]></description><link>https://arnabsen.dev/landing-a-google-swe-internship</link><guid isPermaLink="true">https://arnabsen.dev/landing-a-google-swe-internship</guid><category><![CDATA[Google]]></category><category><![CDATA[internships]]></category><category><![CDATA[tips]]></category><category><![CDATA[software development]]></category><dc:creator><![CDATA[Arnab Sen]]></dc:creator><pubDate>Tue, 04 Apr 2023 17:52:34 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1680630626315/2a50ef76-3810-4513-8853-a243c5dec24b.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Even though, there is a plethora of articles on Google SWE Internship interview experience online, I am still frequently asked the following questions:</p>
<ul>
<li><p>How did you crack Google SWE Internship?</p>
</li>
<li><p>Which resources did you follow?</p>
</li>
<li><p>Can you share some interview tips for my upcoming interview?</p>
</li>
<li><p>Was it on-campus or off-campus?</p>
</li>
</ul>
<p>... and many more. So, I decided to pen down my thoughts so that I can share this article next time someone asks me anything about my SWE Internship.</p>
<h1 id="heading-what-can-you-expect-from-this-blog">What can you expect from this blog?</h1>
<p>These are the few things that I would like to cover in this blog</p>
<ul>
<li><p>How I optimized my resume.</p>
</li>
<li><p>How I approached (or, usually approach) referrals.</p>
</li>
<li><p>Resources I referred to while preparing for DSA.</p>
</li>
<li><p>Interview tips</p>
</li>
</ul>
<blockquote>
<p>NOTE: Although this article is about Google, the recommendations will be useful if you apply to other product-based companies.</p>
</blockquote>
<h1 id="heading-introduction">Introduction</h1>
<p>Hi, I am Arnab Sen, a Software Developer from India 🇮🇳. I interned at Google as an SWE for the summer of 2022 and even grabbed a Pre-Placement Opportunity. I will join Google India as a Full Time, in July 2023. When I was in my third year Google, unfortunately, didn't visit our campus. So I had to take the <mark>off-campus</mark> route to land at Google and here is my journey:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1680630458023/7280cea2-1be5-45ad-b8bf-c07b427764d0.jpeg" alt class="image--center mx-auto" /></p>
<h1 id="heading-decoding-the-google-application-process">Decoding the Google Application Process</h1>
<p>Let's understand how Google usually hires candidates for the Software Engineering Role:</p>
<ol>
<li><p>Resume Shortlisting</p>
</li>
<li><p>Online Aptitude Round</p>
</li>
<li><p>Telephonic Round</p>
</li>
<li><p>Technical Interviews</p>
</li>
<li><p>Hiring Committee</p>
</li>
</ol>
<p>I'll go through each round and talk about what happened and how I prepared.</p>
<blockquote>
<p>The same rounds are usually followed by most of the Product based companies like Microsoft, Amazon, Meta .etc.</p>
</blockquote>
<h2 id="heading-round-1-resume-shortlisting">Round 1: Resume Shortlisting</h2>
<p>It was in <mark>Aug 2021</mark> that I came across the Google India SWE Intern opening in <a target="_blank" href="https://careers.google.com/jobs">Google's career portal</a> and I applied with a referral from one of my seniors.</p>
<h3 id="heading-resume-building-tips">Resume building tips</h3>
<p>Your resume is the first thing that creates an impression. Even if you are super talented and skilled, a poor resume can negate all your abilities. So, you need to create a kickass resume that showcases your talents and impresses everyone!</p>
<p>Originally I used to create my resume in <strong>LaTeX</strong> but later on, it became a hassle to maintain and make updates. Hence I moved on to this website called <a target="_blank" href="https://flowcv.com/">flowcv.com</a>.</p>
<p>Their interface is <strong>user-friendly</strong> and offers <strong>pre-defined templates</strong> while allowing ample options for personalizing your resume. Check out the template I personally used.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1680369059904/a00be9ab-5325-4961-b1ed-2d762e03f50b.png" alt="I used the right most template to create my resume" class="image--center mx-auto" /></p>
<p>I prefer a <strong>single-column</strong> resume. If you want to stick to <strong>LaTeX</strong> and you are looking for a resume template, my suggestion would be to use <a target="_blank" href="https://www.overleaf.com/latex/templates/deedy-cv/bjryvfsjdyxz">DeedyCV</a>. It looks very professional and compact.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1680630800547/cfbfe964-0a20-4710-85c2-aeb8d93923cd.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-resume-tips-to-keep-in-mind">Resume tips to keep in mind</h3>
<p>Here are some of my tips for your resume:</p>
<ul>
<li><p>If you wanna look like a pro, make sure your stuff <strong>doesn't have any spelling or grammar mistakes</strong>. You can use tools like Google Docs spelling check or Grammarly to help you out.</p>
</li>
<li><p>Just get <strong>straight to the point</strong> and don't use fancy words. Nobody cares about your language skills, they just want to know what you can do as a developer.</p>
</li>
<li><p>It would be great if you could <strong>add some proof to your work</strong>. If you have built a project, published a paper, or completed a certification, you must provide a link for the respective work.</p>
</li>
<li><p><strong>Don't stuff everything</strong> into one page of your resume. Leave some space to breathe. It's totally fine to use 2 pages if you need to. I checked with some Google peeps and recruiters and they all said it's all good to have a 2-page resume if one page just ain't cutting it.</p>
</li>
</ul>
<p>Now, let me share with you some hacks that can use:</p>
<ul>
<li><p><strong>If you don't have achievements</strong>, try to take part in Leetcode, GFG, Hackerrank, or HackerEarth contests or contests of college fests. You can put those ranks in your achievements. To know the upcoming contests, check out <a target="_blank" href="https://clist.by/">clist.by</a>.</p>
</li>
<li><p><strong>If you don't have projects</strong>, try to take part in hackathons with your peers. "I can't think of a good project" is what I hear from a lot of my juniors. Right now, if I ask you to think of anything, you won't be thinking of anything. But if I asked you to think of a fruit, you might be thinking of a banana, apple, mango, etc. Every hackathon has a unique theme, so by the end of the hackathon you will have a somewhat unique project. You can find such hackathons at <a target="_blank" href="https://devpost.com/">Devpost</a>.</p>
</li>
<li><p><strong>If you don't have enough work experience</strong>, pick up a good open-source project from GitHub and try to make contributions to that for like 1-2 months. By the end of it, you will have enough experience and contributions that you can put it under the "Open Source Experience" category.</p>
</li>
</ul>
<p>If you are interested to know what my resume looks like, check out: <a target="_blank" href="https://arnabsen.dev/resume">arnabsen.dev/resume</a>.</p>
<h3 id="heading-elevate-your-referral-game">Elevate your referral game</h3>
<p>Companies like Google actually let their own employees refer potential candidates. Although a referral doesn't <strong>necessarily guarantee you a job</strong> offer, it does mean your <strong>application will stand out</strong> from the rest of the applicants, which can only mean one thing - your chances of getting hired just got a whole lot higher. In some cases, a <strong>Good Resume + Referral</strong> can fast forward in the application rounds. In my case, I was directly skipped to the Technical Interview rounds.</p>
<p>Now few things to keep in mind:</p>
<ul>
<li><p><strong>The number of referrals doesn't matter.</strong> It's the quality of the referral that makes the difference. I'm familiar with Google's internal referral portal. Employees must respond to questions such as, why do you believe this candidate is a good fit, have you previously worked with the candidate, and so on. Hence, if the person referring you understands your strengths and weaknesses, the referral will be stronger, and your chances will be better.</p>
</li>
<li><p>I was lucky enough to have a senior in my college who was ready to refer me. We knew each other since day 1 of my college so he was able to write a good referral for me. Shoutout to <a target="_blank" href="https://www.linkedin.com/in/surikumkaran/">Suryansh Gupta</a> ✨. So you can always reach out to your seniors regarding referrals.</p>
</li>
<li><p>If you don't have such seniors in your college, no worries, you can get referrals over <strong>LinkedIn</strong>, <strong>Twitter</strong>, etc. When asking for referrals make sure you provide all the necessary information:</p>
<ul>
<li><p>The <strong>job id</strong> of the role you are applying for.</p>
</li>
<li><p>Your <strong>resume</strong>.</p>
</li>
<li><p>Your <strong>achievements</strong> and <strong>relevant skills</strong>.</p>
</li>
<li><p>Why do you think you are a good fit for the role?</p>
</li>
</ul>
</li>
</ul>
<blockquote>
<p>College tip: active interaction with seniors in your college can have a positive effect on your career. So, don't be shy.</p>
</blockquote>
<p>Now, let's say your resume got shortlisted. Then what?</p>
<h2 id="heading-round-2-online-aptitude-round">Round 2: Online Aptitude Round</h2>
<p>Even though I skipped the OA round, here are some preparation tips:</p>
<ul>
<li><p>Google usually asks pretty standard questions which are of the Leetcode Medium-Hard difficulty. So don't just solve easy questions. Also, no need to waste time by solving very difficult questions either.</p>
</li>
<li><p>Make sure you know all the standard algorithms, I will share the list after this.</p>
</li>
<li><p>I also prepared by participating in Competitive Programming contests, especially from <a target="_blank" href="https://atcoder.jp/">Atcoder</a> and <a target="_blank" href="https://leetcode.com">LeetCode</a>. This was done to ensure that I could answer the questions swiftly and within the time limit, exactly like an actual OA.</p>
</li>
</ul>
<p>My advice would be to go through the past OA rounds questions. Here is the list I referred to for Google's questions:</p>
<ul>
<li><p><a target="_blank" href="https://leetcode.com/discuss/interview-question/352460/Google-Online-Assessment-Questions">https://leetcode.com/discuss/interview-question/352460/Google-Online-Assessment-Questions</a></p>
</li>
<li><p><a target="_blank" href="https://algo.monster/problems/google_online_assessment_questions">https://algo.monster/problems/google_online_assessment_questions</a></p>
</li>
<li><p><a target="_blank" href="https://www.codingninjas.com/codestudio/problem-lists/top-google-coding-interview-questions">https://www.codingninjas.com/codestudio/problem-lists/top-google-coding-interview-questions</a></p>
</li>
<li><p><a target="_blank" href="https://www.interviewbit.com/google-interview-questions/">https://www.interviewbit.com/google-interview-questions/</a></p>
</li>
</ul>
<p>You can find similar collections of questions for other companies as well.</p>
<h3 id="heading-standard-topics-to-prepare-for-oas">Standard topics to prepare for OAs</h3>
<ul>
<li><p>Binary search</p>
</li>
<li><p>BFS/DFS/Flood fill</p>
</li>
<li><p>Tree traversals</p>
</li>
<li><p>Hash tables</p>
</li>
<li><p>Linked list, Stacks, Queues, Two pointers/Sliding window</p>
</li>
<li><p>Binary heaps</p>
</li>
<li><p>Dynamic programming</p>
</li>
<li><p>Union find</p>
</li>
<li><p>Ad hoc/string manipulations</p>
</li>
<li><p>Trie <em>(good to know)</em></p>
</li>
<li><p>Segment trees/Fenwick trees <em>(good to know)</em></p>
</li>
<li><p>Bitmasks <em>(good to know)</em></p>
</li>
</ul>
<p>Once you are done with the OA you will be taken to the 3rd round.</p>
<h2 id="heading-round-3-telephonic-round">Round 3: Telephonic Round</h2>
<p>So, for this round, they're gonna call you up and hit you with some theoretical Data Structures and Algorithms questions. Some might even have multiple-choice answers. They might throw in some programming language questions too. Here are some examples of questions that you can expect to get an idea:</p>
<ul>
<li><p>What are the pros and cons of using an adjacency list over an adjacency matrix for a graph problem?</p>
</li>
<li><p>What is the data structure used in a priority queue?</p>
</li>
<li><p>What is the difference between Binary Search Tree and Heap?</p>
</li>
<li><p>How is a C++ <code>map</code> different from <code>unordered_map</code> from an implementation point of view?</p>
</li>
<li><p>Which algorithm would you use for a network flow problem?</p>
</li>
<li><p>What are the time complexities of Bellman-Ford and Dijkstra's algorithm?</p>
</li>
</ul>
<p>If you have a strong fundamental understanding of Data Structures and Algorithms then these won't be very difficult for you.</p>
<h3 id="heading-resources-to-study-dsa">Resources to study DSA</h3>
<p>I studied DSA mainly from these two sources:</p>
<ol>
<li><a target="_blank" href="https://sd.blackball.lv/library/Introduction_to_Algorithms_Third_Edition_(2009).pdf">Introduction to Algorithm by CLRS (a.k.a the Bible of DSA)</a></li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1680610732770/afd6849a-e717-4220-8660-86f46d41632a.png" alt class="image--center mx-auto" /></p>
<ol>
<li><p><a target="_blank" href="https://www.youtube.com/playlist?list=PLUl4u3cNGP61Oq3tWYp6V_F-5jb5L2iHb">MIT 6.006 Introduction to Algorithms, Fall 2011</a></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1680610861206/e2c4a5ee-c526-41e6-9c14-70aa166435f1.png" alt class="image--center mx-auto" /></p>
</li>
</ol>
<p>So, I made sure to take notes while watching those videos and reading the book chapters. And when I got stuck with any problem, I just Googled it and checked out the first link - be it an article or a video.</p>
<p>Once you complete the telephonic round you will be invited for the technical interview rounds.</p>
<h2 id="heading-round-4-interview-rounds">Round 4: Interview Rounds</h2>
<p>It was on <mark>13th September</mark> I received a mail stating that I have my interview lined up after a week. I freaked out a little. Because first, I didn't expect to hear back from them. And second, how am I supposed to prepare for a Google interview in 7 days?</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1680611208993/dd626c79-24d1-4cff-881a-9ca080407529.png" alt class="image--center mx-auto" /></p>
<p>I took a smart approach. I checked out other people's experiences with Google Interviews and saw that they like to ask about DP, Graphs, Binary Search, Lazy Sum, and Sliding Windows stuff. I went back and reviewed all the notes I took from that MIT course and honed in on those types of questions. I practiced topic-wise from LeetCode itself.</p>
<blockquote>
<p>Another question I get is if LeetCode premium is really worth it. To be honest, in today's time it isn't anymore. There are tonnes of other platforms which have similar questions for free that are only available in LeetCode premium. But 2 years back, I felt spending Rs 10.5k for 1 year of LC premium might be worth it. Because if I am able to crack a job like Google, that amount invested will be just a fraction of the monthly salary. So, I got 1 year of LC premium.</p>
</blockquote>
<h3 id="heading-my-style-of-practicing-for-interview">My style of practicing for interview</h3>
<p>After discussing with my seniors I realized that solving a question in an interview setting is completely different than practicing questions by myself. Most of these Google interviews happen on an editor-based portal where you cannot run the code and it also doesn't support intellisense. So, I would create a Google doc where I would solve all the questions and write code. This way I didn't have the privilege of syntax highlighting or intellisense. As they say, <em>"Hope for the best, Prepare for the worst".</em></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1680611571331/b349c1fc-bda6-4903-ad35-04394cc293fa.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-the-strategy-of-breaking-down-google-interviews">The strategy of breaking down Google interviews</h3>
<p>A Google Interview happens for 45 mins and they usually ask 2 questions. So, I divided the total time into (20 + 20 + 5) mins. 20 mins for each question and 5 mins as a buffer (for an emergency like network issues or Q&amp;A at the end).</p>
<p>Within those 20 mins, I would spend 3-5 mins understanding the question asking clarifying questions, and explaining my approach. 10 mins for implementing the optimized solution and 5 mins for dry running or debugging. Note that you have to come up with the optimal solution as quickly as possible. So, I would insist on not wasting time trying to implement the brute-force solution.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1680612063934/3ed32d8a-003a-4021-a47f-e4e5e026de48.png" alt class="image--center mx-auto" /></p>
<p>So, even during practice when I was solving the questions myself I followed the same strategy. I would pretend that I am in an interview setting. I would try to read my thoughts out loud and explain everything. I even made the habit of doing a dry run every time I wrote the final code for a problem.</p>
<h3 id="heading-mock-interviews-are-an-absolute-necessary">Mock Interviews are an absolute necessary</h3>
<p>To succeed in any field, preparation is key. Just as astronauts undergo rigorous training to prepare for the unique conditions of zero gravity, so too must job seekers prepare for the challenge of a job interview. One effective way to do this is by practicing mock interviews. That way you can know your weakness, and you can prepare for them before the actual interview.</p>
<p>I also watched a lot of Mock Interview videos on Youtube to give me an idea of what it would be like during an interview setting. I created a playlist of all the videos that I referred to.</p>
<p><a target="_blank" href="https://www.youtube.com/playlist?list=PLeXWGmu4fYL76f_nnnGyCu9Tr9k5NYtko">Link to the playlist 📼.</a></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1680612908848/af5630e9-e9b0-4d51-a684-4caf97898c74.png" alt class="image--center mx-auto" /></p>
<p>I gave a bunch of mock interviews (around 5-6) by taking the help of my seniors and using online free platforms like <a target="_blank" href="https://www.pramp.com/invt/lYAEXB2Pa1Hxra4p3zMP">Pramp</a>.</p>
<h3 id="heading-importance-of-clarifying-questions">Importance of clarifying questions</h3>
<p>The initial question that will be given to you, will be intentionally very vague. They will expect you to ask some clarifying questions to identify the fine details of the question. Let's take a very simple example, you are given an array of n numbers, and you have to find the subarray with the maximum sum.</p>
<p>Now, your first thought might be using Kandane's Algorithm. But wait, what if all the numbers are positive? In that case, the answer is simply the entire array. As you can see one small change in the constraints, had a big effect on the final solution. So always practice asking clarifying questions.</p>
<h3 id="heading-interview-tips-to-keep-in-mind">Interview tips to keep in mind</h3>
<ul>
<li><p>Treat the interview more like a conversation with a fellow software developer and not like a viva. This will also help you tackle your nervousness.</p>
</li>
<li><p>During the interviews, you should also think about other ways to improve the solution. Share the different options or tradeoffs that you're considering.</p>
</li>
<li><p>Think out loud because that way the interviewer will know your thought process and can give you signals if you are going in the wrong direction.</p>
</li>
<li><p>Discuss tradeoffs if possible. How would you improve your solution? How do you make it faster? How to optimize the space complexity? Know the time and space tradeoffs of the solution/data structures that you are picking.</p>
</li>
<li><p>Try to avoid taking hints, but always remember solving with hints is much better than not solving at all.</p>
</li>
<li><p>Avoid syntactical errors like missing semicolons, not closing parenthesis, wrong indentation, etc. Even though they are not deal-breakers, writing high-quality code can showcase your skills as a developer.</p>
</li>
<li><p>Finally, use proper variable names and if required add meaningful comments. But remember you have limited time so just don't spend minutes trying to come up with an appropriate variable name.</p>
</li>
<li><p>Make it a habit to always calculate the Time and Space complexity of your solution.</p>
</li>
</ul>
<blockquote>
<p>If you don't remember the exact syntax of a library class or method, that is fine. You can just let the interviewer know, and replace it with a meaningful substitute.</p>
</blockquote>
<p>All of these points might be hard to keep in mind during the interview, which is why the more mock interviews you give, the better you get at remembering these subtle points.</p>
<p>Here are some more resources that I referred to:</p>
<ul>
<li><a target="_blank" href="https://www.bigocheatsheet.com/">Big-O-Cheatsheet</a></li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1680614967428/1ac9e05e-b247-4408-b4c6-d203619806fd.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1680615018778/0809eacd-3a5d-45e9-9d80-fb1f129ed7f8.png" alt class="image--center mx-auto" /></p>
<p>For some last-minute revision, I also followed this collection of LC questions.</p>
<p><a target="_blank" href="https://seanprashad.com/leetcode-patterns/">https://seanprashad.com/leetcode-patterns/</a></p>
<h3 id="heading-my-interview-experience">My interview experience</h3>
<p>I cannot reveal the actual questions because of NDA, but in my first interview, I had a question on Sliding Windows and Dynamic Programming.</p>
<p>In my second interview which was held the next day, I had 3 questions. One was a Scheduling Problem based on the heap, the second was again a DP question. I was able to quickly answer these 2 questions, and there were around 10-12 mins left. So the interviewer gave me another DP question for which he just asked me to write the recursive function and how I would memoize it. I was able to do that as well.</p>
<p>Both my interviews went well from my end, I didn't take any hints, wrote high code quality, and was able to successfully dry run all my solutions with edge cases.</p>
<h2 id="heading-round-5-hiring-committee">Round 5: Hiring Committee</h2>
<p>After I finished my interviews, I had a long wait. According to what I've heard, there is a hiring committee that comprises four to five persons that have prior interview experience and are familiar with the hiring standards. They would review your resume, your code during interviews, and the feedback from the interviewers before making a final decision.</p>
<p>For me, it was a long long wait. I very clearly remember the day. It was Maha Shasthi (the onset of Durga Puja), I woke up to a mail saying:</p>
<p><mark>"Congratulations on your SWE Summer Intern offer with Google India!"</mark></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1680617576127/fcacca0a-ef4b-4c7a-9127-fc2d9345b183.png" alt class="image--center mx-auto" /></p>
<p>It was a perfect blessing to me. I was ecstatic and overjoyed. It was an absolute dream come true moment for me and my family. Looking back I remember I felt very depressed when I was rejected by Microsoft twice. I gave my best in the Microsoft Engage Aptitude round yet wasn't even selected for the project building round. Then again when Microsoft came on-campus I was rejected after the OA round which still baffles me. But as they say "Whatever happens, happens for Good".</p>
<p>So whenever something unexpected or bad happens to you, remember these lines:</p>
<p><img src="https://qph.cf2.quoracdn.net/main-qimg-c1e71c29e562ff5498718a64c3d287f0-lq" alt="What was the 'Connecting the dots theory' of Steve Jobs? - Quora" class="image--center mx-auto" /></p>
<hr />
<p>I hope you liked my blog, do follow me for more such content. I wrote another blog sharing some tips on how to convert your internship to PPO.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://arnabsen.hashnode.dev/important-tips-on-bagging-ppo-during-internship-and-securing-a-full-time-role">https://arnabsen.hashnode.dev/important-tips-on-bagging-ppo-during-internship-and-securing-a-full-time-role</a></div>
<p> </p>
<p>You can learn more about me at <a target="_blank" href="https://www.arnabsen.dev/about">arnabsen.dev/about</a>. Have a nice day !!</p>
]]></content:encoded></item><item><title><![CDATA[From Burnout to Balance: How I recovered from burnout]]></title><description><![CDATA[Have you experienced a sudden loss of motivation, a lack of energy to complete tasks, a decrease in inventiveness, and a drop in productivity?
It happened to me, and after speaking with one of my seniors, I discovered that this condition is known as ...]]></description><link>https://arnabsen.dev/from-burnout-to-balance</link><guid isPermaLink="true">https://arnabsen.dev/from-burnout-to-balance</guid><category><![CDATA[WeMakeDevs]]></category><category><![CDATA[Developer]]></category><category><![CDATA[software development]]></category><dc:creator><![CDATA[Arnab Sen]]></dc:creator><pubDate>Mon, 13 Mar 2023 15:10:24 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1678714028993/1f64dd91-3698-4342-88b2-7bb4b7dc8ea3.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Have you experienced a sudden loss of motivation, a lack of energy to complete tasks, a decrease in inventiveness, and a drop in productivity?</p>
<p>It happened to me, and after speaking with one of my seniors, I discovered that this condition is known as burnout. Then I began investigating this particular topic, and it turns out that it's a rather common occurrence that can impact anyone, particularly those in high-stress professions like software development. However many individuals are unaware of it and fail to take the required steps to recover from it. The sooner you recuperate, the more energized you will feel about your task, which will eventually result in better results and increased productivity.</p>
<p>In this article, I'll try to go over some of the indicators that you might be burnt out, and then I'll provide some suggestions that helped me get back on track. It should be noted that burnout can progress to depression, in which case you should consult a medical expert.</p>
<blockquote>
<p>A little note: Because I am a Software Developer, my thoughts on dealing with Burnout will be slightly skewed and will be more relevant towards this profession.</p>
</blockquote>
<h1 id="heading-my-burnout-experience">My burnout experience</h1>
<p>I was attempting to achieve several things at the same time in the second half of 2021.</p>
<ol>
<li><p>I was a mentee at Summer of Bitcoin and I was working on adding USDT (User Statically-Defined Tracing) tracepoints to the UTXO (Unsigned Transaction Output) set of Bitcoin. Furthermore, I had no prior knowledge of Bitcoin, tracepoints, or working with a huge C++ codebase.</p>
</li>
<li><p>My internship placements were ongoing, and I was being turned down both on and off campus. I was devastated when I was denied Microsoft's Engage program and then again from their OA round.</p>
</li>
</ol>
<p>But at the time, I was all about having a decent internship, so I went all in. Ended up cracking Wells Fargo SDE Internship and Google SWE Internship. Also after completing my Summer of Bitcoin project got an internship opportunity at Chaincode Labs.</p>
<p>But then I changed from being a highly driven, hyperactive person to someone who had very little ambition to accomplish anything and felt sluggish all day. My productivity dropped, which made me feel even worse, and I became trapped in a vicious loop.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678707975384/efb5eae5-4f03-4f65-8d06-0c93ee23a6d5.png" alt="Burnout Cycle" class="image--right mx-auto mr-0" /></p>
<h1 id="heading-signs-of-burnout-how-to-recognize-them-early">Signs of Burnout: How to Recognize Them Early</h1>
<p>These will be some of the early signs that you will notice:</p>
<ol>
<li><p><strong>Decreased productivity:</strong> You will find yourself struggling to complete tasks or meet deadlines.</p>
</li>
<li><p><strong>Lack of motivation:</strong> There is a feeling of disengagement or lack of interest in your work. You might not even find your work pleasurable anymore.</p>
</li>
<li><p><strong>Chronic fatigue:</strong> You're constantly tired, despite getting enough sleep.</p>
</li>
<li><p><strong>Irritability:</strong> Burnout can lead to feelings of frustration, anger, and irritability.</p>
</li>
<li><p><strong>Decreased quality of work:</strong> Burnout can cause you to make more mistakes or produce lower-quality work than you normally would.</p>
</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678713346441/b3aca953-9115-4917-8b97-f13ada452630.png" alt="Image generated with Dall-E" class="image--center mx-auto" /></p>
<p>Now, let's understand the causes of Burnout and how to avoid them.</p>
<h1 id="heading-avoiding-burnout">Avoiding Burnout</h1>
<h2 id="heading-maintaining-balance"><strong>Maintaining balance</strong></h2>
<p>In life, balance is crucial. It's incredibly easy for software engineers to work longer hours because all we need is a laptop and an internet connection. As a result, we occasionally forget our limits and push ourselves. It may produce short results, but it is hazardous in the long run. If we spend all our time and energy at work and neglect our personal life and self-care, it can lead to physical, mental, and emotional exhaustion.  </p>
<p>As a result, we must strike a good and sustainable balance between many aspects of our lives, such as jobs, hobbies, family, and friends. This varies from person to person, therefore you must reflect and establish ground rules for yourself.</p>
<ul>
<li><p>Post 6 pm, no work-related calls/talks.</p>
</li>
<li><p>Go outside to play some sports with friends.</p>
</li>
<li><p>Taking a vacation once in a while and travelling.</p>
</li>
<li><p>Having dinners with family or friends.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678713722372/93b1d9d3-5aca-49d3-ac10-27aa2589951f.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-taking-breaks">Taking Breaks</h2>
<p>Taking breaks is incredibly important in avoiding burnout. Breaks allow us to rest, recharge, and reset, which can help us manage stress and prevent exhaustion. When we continuously work without breaks, we can become overwhelmed, stressed, and exhausted, leading to burnout.</p>
<p>Breaks can take many forms, from short breaks throughout the day to longer vacations. Short breaks, such as taking a few minutes to stretch, walk around, or chat with a colleague, can help us refocus and re-energize during the workday. Longer breaks, such as weekends, holidays, or vacations, allow us to disconnect from work and engage in activities that bring us joy and relaxation.</p>
<p>Next time when you are stuck fixing a bug, go ahead take a walk and come back. 8 out of 10 times you will be able to fix it.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678714142108/e898a35f-628d-49a1-8f57-2b76a1129323.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-having-a-clear-understanding-of-your-work">Having a clear understanding of your work</h2>
<p>Employees can experience stress, dissatisfaction, and burnout when they are confused about their tasks and responsibilities or are given ambiguous expectations.</p>
<p>Employees who lack clear direction may struggle to prioritize their tasks or become overwhelmed by competing requests. This can lead to feelings of powerlessness and a lack of control over their work, which can lead to burnout. Workers may also feel that they are not fulfilling expectations or that their efforts are not being recognized, leading to feelings of discontent and disengagement.</p>
<p><strong>Clear communication is the solution.</strong> If you have any questions about the tasks, you should speak with your manager, senior, or leader. If you believe you will have problems completing the work, mention this as well. This will be beneficial in two ways. One, your manager will have a clear knowledge of your comprehension and will be able to provide extra resources to assist you. Two, you will feel relieved, which will lower your stress levels.</p>
<h2 id="heading-self-care">Self-Care</h2>
<p>Finally, you must take care of yourself. By practicing self-care, individuals can reduce stress levels and promote overall well-being, which can help prevent burnout. Some self-care practices that can help prevent burnout include:</p>
<ol>
<li><p><strong>Prioritizing sleep:</strong> Getting enough sleep is crucial for overall health and well-being and can help individuals manage stress levels. Consistently getting 7-8 hours of sleep per night can help prevent burnout.</p>
</li>
<li><p><strong>Engaging in physical activity:</strong> Regular exercise can help reduce stress levels, promote relaxation, and improve overall health. Engaging in activities such as walking, jogging, or yoga can help prevent burnout.</p>
</li>
<li><p><strong>Practicing mindfulness:</strong> Mindfulness practices, such as meditation or deep breathing, can help individuals manage stress and improve emotional well-being. By staying present at the moment and reducing distractions, individuals can prevent burnout.</p>
</li>
<li><p><strong>Eating a healthy diet:</strong> Eating a balanced diet that includes whole foods, fruits, and vegetables can help individuals maintain physical and mental health. A healthy diet can help individuals manage stress levels and prevent burnout.</p>
</li>
<li><p><strong>Engaging in leisure activities:</strong> Engaging in activities that bring joy and relaxation, such as reading, painting, or spending time with friends, can help individuals manage stress and prevent burnout.</p>
</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1678713685990/026e90ea-2715-456e-85a7-b13877aa0cec.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-seeking-professional-help">Seeking professional help</h2>
<p>If things are getting out of hand, it's always a good idea to seek expert assistance. Counseling or therapy can offer individuals assistance and guidance in dealing with stress and avoiding burnout. The faster you recuperate, the better you will be able to focus on your task, leading to an increase in total productivity.</p>
<h2 id="heading-final-thoughts">Final Thoughts</h2>
<p>I have been following these few advices that I received from my seniors and leads at Google, and to be honest the outcomes have been fantastic.</p>
<ul>
<li><p>I completed my Google internship securing a PPO.</p>
</li>
<li><p>I worked as a Technical Content Writer for Codedamn and authored few high-quality posts. You can find them right here.</p>
</li>
<li><p>I won Showwcase's Develevate event.</p>
</li>
<li><p>I joined a Singapore-based web3 startup called Cypherock as an SDE Intern.</p>
</li>
<li><p>I joined Pupilfirst as a Teaching Assistant.</p>
</li>
<li><p>At the same time, I've been taking care of myself by going to the gym on a regular basis and eating healthily.</p>
</li>
</ul>
<p>Yet I didn't experience any burnout along the process. I hope these few tips will assist you in increasing your work productivity and avoiding burnout.</p>
<h1 id="heading-tldr">TLDR;</h1>
<p>Maintaining balance, taking breaks, having a clear understanding of work responsibilities, practicing self-care, and seeking professional help if needed are all effective strategies to prevent and recover from burnout. Prioritizing our well-being and seeking help when necessary is essential to achieving long-term success and productivity. Remember, taking care of ourselves is not a luxury but a necessity, and it is essential to make self-care a priority in our daily lives.</p>
<blockquote>
<p>All the images in this article were generated by Dall-E.</p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[Important tips on bagging PPO during Internship and securing a Full-Time Role]]></title><description><![CDATA[If you are here after you have got an internship, then a big congratulations to you for getting an internship. I hope you are enjoying it and learning a lot. I am sure you are. But now you want to make sure that you get a PPO at the end of it. So, le...]]></description><link>https://arnabsen.dev/important-tips-on-bagging-ppo-during-internship-and-securing-a-full-time-role</link><guid isPermaLink="true">https://arnabsen.dev/important-tips-on-bagging-ppo-during-internship-and-securing-a-full-time-role</guid><category><![CDATA[internships]]></category><category><![CDATA[Career]]></category><category><![CDATA[software development]]></category><category><![CDATA[learning]]></category><dc:creator><![CDATA[Arnab Sen]]></dc:creator><pubDate>Sun, 29 Jan 2023 17:33:10 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1675013292252/d7a1a44b-34da-44d7-8fa2-899c16121e5b.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>If you are here after you have got an internship, then a big congratulations to you for getting an internship. I hope you are enjoying it and learning a lot. I am sure you are. But now you want to make sure that you get a PPO at the end of it. So, let's get started.</p>
<p>I have been wanting to write this blog for a long time, I will try to include all the important points that I followed and have learned during my internship which helped me bag a PPO. I will break them down into 2 parts mainly, <strong>Technical</strong> and <strong>Non-Technical</strong>. Before that let me give you a little background.</p>
<h1 id="heading-background">Background</h1>
<p>I applied for Google Summer SWE Intern Opening on the <a target="_blank" href="https://careers.google.com/">Google's careers portal</a> with a referral. <a target="_blank" href="https://arnabsen.dev/resume.pdf">My Resume</a> got selected and I was called for 2 Rounds of Interviews. After that, I got the offer and interned at Google for 10 weeks remotely with the Google Ads team. And finally, I was able to crack the PPO and got a full-time offer from Google as an SWE. I am planning to join them in July 2022.</p>
<p>From</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://twitter.com/ArnabSen1729/status/1528345010164613123">https://twitter.com/ArnabSen1729/status/1528345010164613123</a></div>
<p> </p>
<p>To</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://twitter.com/ArnabSen1729/status/1551660735440179201">https://twitter.com/ArnabSen1729/status/1551660735440179201</a></div>
<p> </p>
<h1 id="heading-conversion-process">Conversion Process</h1>
<p>Before sharing the pieces of advice, I feel it's important to learn about the conversion steps. This will vary from company to company but overall the process remains the same.</p>
<ol>
<li><p>Every Intern is assigned a <strong>project</strong> and a mentor (at Google we call them <strong>host</strong>) and a <strong>co-host</strong>. The project is usually a part of the product that the team is working on. The mentor is a senior engineer who will be your guide throughout the internship. You will be working with your mentor and other engineers on the team.</p>
</li>
<li><p>There will be two evaluations during the internship. The first evaluation called <strong>Mid Evaluation</strong> happens after 5 weeks (since my internship period was 10 weeks) and the <strong>Final Evaluation</strong> happens in the last week of your internship. The Mid Evaluation is more of a check-in to see how you are doing and if you are on track. The Final Evaluation is more of a review of your work and the project. The host and co-host also get to give feedback on your performance and your project progress. This feedback plays a huge role in the final conversion.</p>
</li>
</ol>
<h1 id="heading-technical-advice">Technical Advice</h1>
<h2 id="heading-1-learn-the-basics">1. Learn the basics</h2>
<p>You must have strong problem-solving abilities to work on the project that will be assigned to you. There are some basic Computer Science concepts that one should be familiar with. I will list them down below.</p>
<h3 id="heading-a-version-control-systems">a. Version Control Systems</h3>
<p>No matter which company you are working at, you will be using a version control system. You must be familiar with the basics of version control systems. I would recommend you learn Git and GitHub. You can learn it from here.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://youtu.be/RGOj5yH7evk">https://youtu.be/RGOj5yH7evk</a></div>
<p> </p>
<p>At Google, we didn't use <code>git</code>, instead, we used Mercurial. But the fundamental concepts are the same. If you know how <code>git</code> works, learning a new version control system will just require you to learn the commands specific to that version control system.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1675005971140/1da0047e-f988-49ba-8471-75bf637bf95c.jpeg" alt="git logo" class="image--center mx-auto" /></p>
<h3 id="heading-b-basic-commandline"><strong>b. Basic Commandline</strong></h3>
<p>There is a high chance that you will be working in a cloud environment and you must be comfortable with the terminal. You should be able to navigate through the file system, create directories, create files, delete files, etc. You should also be able to use basic commands like <code>cat</code>, <code>grep</code>, <code>sed</code>, <code>awk</code>, etc. You can learn about these commands from the man pages. For example, to learn about the <code>cat</code> command, you can run <code>man cat</code> in your terminal.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://youtu.be/ZtqBQ68cfJc">https://youtu.be/ZtqBQ68cfJc</a></div>
<p> </p>
<h3 id="heading-c-data-structures-and-algorithms"><strong>c. Data Structures and Algorithms</strong></h3>
<p>You should be familiar with the basic data structures and algorithms. You should be able to implement them in your language of choice and most importantly be aware of when to use which data structure and algorithm.</p>
<blockquote>
<p><strong>Note:</strong> You don't need to be an expert in these topics. You just need to be familiar with them. But most of these companies have DSA questions in their interviews. So, you must be familiar with them.</p>
</blockquote>
<p>I love the MIT 6.006 Introduction to Algorithms lectures, they have helped me build the foundation of algorithms. You can find the playlist <a target="_blank" href="https://youtu.be/HtSuA80QTyo?list=PLUl4u3cNGP61Oq3tWYp6V_F-5jb5L2iHb">here</a>:</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://youtu.be/HtSuA80QTyo">https://youtu.be/HtSuA80QTyo</a></div>
<p> </p>
<h2 id="heading-2-knowing-the-syntax-of-the-language-you-will-be-using">2. Knowing the syntax of the language you will be using</h2>
<p>Sometimes you can ask the recruiter about the tech stack that you will be using. But most of the time, you won't be able to know the tech stack beforehand. But, you can still learn the basics of the language that is popularly used in the company. For example, I knew that Google uses C++, Java, and Golang a lot in their backend. I already knew C++ and Golang. So I learned the basics of Java before joining Google. This helped me save a lot of time during the internship picking up the language.</p>
<h2 id="heading-3-learn-design-patterns">3. Learn Design Patterns</h2>
<p>Design patterns are important for developers to understand because they provide proven solutions to common software design problems. By using design patterns, developers can improve the quality, reusability, and maintainability of their code.</p>
<p>While you don't need to know every design pattern in existence, it's helpful to have a good understanding of the most common design patterns and when to use them. This knowledge can save a lot of time and effort by allowing you to reuse tried-and-true solutions to common problems, rather than having to reinvent the wheel every time you encounter a new challenge.</p>
<p><img src="https://project-assets.showwcase.com/56320/1673195309976-design-pattern.png" alt="23 Design Patterns" /></p>
<h2 id="heading-4-write-clean-code">4. Write clean code</h2>
<p>I can't stress this enough. Writing clean code is very important especially if you are interning at a big organization like Google. Every change you make goes through a rigorous review process. If your code is not clean, it will be rejected. So, you must write clean code. Here are some points that you should keep in mind while writing clean code.</p>
<ul>
<li><p><strong>Keep it simple:</strong> When writing code, it's important to avoid unnecessary complexity. Simple, easy-to-understand code is usually easier to maintain and debug.</p>
</li>
<li><p><strong>Use clear and descriptive names:</strong> Choosing clear and descriptive names for variables, functions, and other elements of the code can make it much easier to read and understand. Avoid using abbreviations or single-letter names, unless they are well-known and widely understood.</p>
</li>
<li><p><strong>Use comments:</strong> Comments can be a helpful tool for explaining the purpose and functionality of different parts of the code. However, it's important to use comments sparingly and only when they are truly necessary, as too many comments can make the code harder to read.</p>
</li>
<li><p><strong>Follow a consistent style:</strong> Consistency is key when it comes to writing clean code. Using a consistent style for indentation, spacing, and other elements of the code can make it easier to read and understand. It's also a good idea to follow established coding standards and guidelines, such as those provided by the programming language's community or the company you work for.</p>
</li>
</ul>
<p><img src="https://project-assets.showwcase.com/56320/1673195372005-clean-code-image.png" alt="Code Quality Meme" class="image--center mx-auto" /></p>
<h2 id="heading-5-learn-testing">5. Learn testing</h2>
<p>Testing is an important part of software development. It's important to test your code to make sure it works as expected and to catch any bugs that might have been introduced during development. Testing can also help you to ensure that your code is clean and easy to understand. There are different types of testing like unit testing, integration testing, etc. Knowing these testing types will help you a lot.</p>
<p>Here is a free course on <a target="_blank" href="https://thoughtbot.com/upcase/fundamentals-of-tdd">Test Driven Development</a>.</p>
<h2 id="heading-6-know-how-to-write-a-design-doc">6. Know how to write a Design Doc</h2>
<p>At Google, we heavily focus on the Design Doc. Even before we write a piece of code for a particular implementation we have to make sure we have analyzed every possible edge case, and technical and non-technical requirements. Design documents also help with communication among team members and can serve as a reference for future maintenance and updates to the software.</p>
<p>Certain key points need to be covered in a Design Doc like Architecture, Requirements, Design, User Interface, Testing .etc.</p>
<p><a target="_blank" href="https://www.industrialempathy.com/posts/design-docs-at-google/">Here</a> is a great post that talks in depth about Design Docs.</p>
<p>This is a <a target="_blank" href="https://docs.google.com/document/d/1pgMutdDasJb6eN6yK6M95JM8gQ16IKacxxhPXgeL9WY/edit">sample template of a Design Document</a>.</p>
<h1 id="heading-non-technical-advice">Non-Technical Advice</h1>
<p>In addition to the technical advice, I would also like to share some non-technical advice that I followed during my internship.</p>
<h2 id="heading-1-be-proactive">1. Be proactive</h2>
<p>This was something my host pointed out in my mid-evaluation. I was being too dependent initially on my mentor, waiting for her to tell me the next steps. But later I took the advice. So I started planning my work, assigning tasks to myself, and taking the initiative to solve the problems. But obviously, I kept my mentor in the loop. This takes me to the next point.</p>
<h2 id="heading-2-keep-your-mentor-host-and-co-host-in-the-loop">2. Keep your mentor (host and co-host) in the loop</h2>
<p>Remember, your host and co-host will be evaluating you at the end of your internship. Also, they have their deadline and they will be busy with their work. So, you must keep them in the loop. You should be able to communicate with them and tell them what you are working on and what problems you are facing. This will help them to guide you better.</p>
<p>We had a weekly meeting with our host and co-host but even then I would update them on my progress every alternate day so that they are aware of what I am working on. I would also disclose the problems I faced and the solutions I found.</p>
<p>There is a really good article on <a target="_blank" href="https://jvns.ca/blog/brag-documents/?utm_source=pocket_mylist">Writing a brag document</a> that I would recommend you read.</p>
<h2 id="heading-3-be-open-to-feedback">3. Be open to feedback</h2>
<p>No matter how big a company you are interning at, you should remember that you are still very new to this field and there is a lot to improve. Feedback from your host/co-host or other team members can help you identify areas of their work that needs improvement. It might be difficult to accept the feedback at first but you should be open to it. You should be able to take the feedback positively and work on improving yourself.</p>
<p>Not always your mentor will reach out to you to give you feedback. If required you might have to reach out to them and ask for feedback. You can ask them to give you feedback on your code, your communication skills, your problem-solving skills, etc. This also shows that you are proactive and you are willing to make improvements.</p>
<p>A good place to get feedback from your host/co-host is through 1:1 meetings. Here is a good video on <a target="_blank" href="https://youtu.be/ADWkkJtZna4">The Art Of The 1:1 Meeting</a>.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://youtu.be/ADWkkJtZna4">https://youtu.be/ADWkkJtZna4</a></div>
<p> </p>
<h2 id="heading-4-time-management">4. Time management</h2>
<p>Plan out the tasks that you will have to do, assign priority to them and then start working on them. This will help you to manage your time better. You should also be able to estimate the time that you will need to complete a task. Initially, you may end up overestimating or underestimating the time but as you gain more experience, you will be able to estimate the time better.</p>
<h2 id="heading-5-ask-questions">5. Ask questions</h2>
<p>An internship usually lasts 10-12 weeks, which is not a lot of time. So if you are stuck at something, you can't afford to lose time. You should be able to ask questions to your mentor and other team members. But before that make sure you have done a fair amount of research on your end as well.</p>
<p>You have to ask the right questions to get quick answers. If you came across an error message, explain properly how to reproduce the error, and what the error message is. Share the code snippet that might be causing the error, or share the files you are working on. Further, the approaches you have already taken to solve the problem. This will help the person you are asking the question to understand the problem better. Also, make sure you are asking the question in the right channel. For example, if you are stuck on a coding problem, you should ask your mentor or other team members. But if you are stuck in a process, you should ask your host/co-host.</p>
<p>Here is a great article on <a target="_blank" href="https://jvns.ca/blog/good-questions/?utm_source=pocket_mylist">How to ask questions the smart way</a>.</p>
<h1 id="heading-podcast-w-aniket">Podcast w/ Aniket</h1>
<p>I was recently on a podcast where we went through some of these points in more depth. Watch the video here:</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://youtu.be/0EB-np28BZU">https://youtu.be/0EB-np28BZU</a></div>
<p> </p>
<h1 id="heading-conclusion">Conclusion</h1>
<p>These are some of the things that I followed during my internship. I hope this article will help you to prepare for your internship. One thing you should also keep in mind is to enjoy the internship. It is a great opportunity to learn and grow, network with people and build your resume. Don't burnout yourself before or during the internship. Take breaks, go out with your friends, play games, watch movies, etc. This will help you to stay motivated and perform better.</p>
<p>If you have any questions, feel free to ask in the comments. I will try my best to answer them. Also, if you have any other advice that you would like to share, feel free to do so in the comments.</p>
]]></content:encoded></item><item><title><![CDATA[Step by Step learning Redis]]></title><description><![CDATA[In this blog, we will take a look at what Redis is, how it works, and how to use it.
Introduction

Redis stands for REmote DIctionary Server.
In simple words, Redis is an in-memory data structure store and is mainly popular for its very low-level lat...]]></description><link>https://arnabsen.dev/step-by-step-learning-redis</link><guid isPermaLink="true">https://arnabsen.dev/step-by-step-learning-redis</guid><category><![CDATA[Tutorial]]></category><category><![CDATA[Redis]]></category><category><![CDATA[Beginner Developers]]></category><category><![CDATA[Blogging]]></category><dc:creator><![CDATA[Arnab Sen]]></dc:creator><pubDate>Sat, 28 Jan 2023 12:22:10 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1674908437454/e1797651-6757-4ca6-8b14-7c128117c048.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In this blog, we will take a look at what Redis is, how it works, and how to use it.</p>
<h2 id="heading-introduction">Introduction</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1674908134263/9c3989cd-36d0-428d-9022-8158fc4bec00.svg" alt="Redis Logo" /></p>
<p>Redis stands for <strong>RE</strong>mote <strong>DI</strong>ctionary <strong>S</strong>erver.</p>
<p>In simple words, Redis is an in-memory data structure store and is mainly popular for its very low-level latency. The fact that it is in-memory means that the time taken to access the data is very low compared to in-disk databases. This can be useful for applications that require fast data access and manipulation, such as real-time bidding systems or gaming servers.</p>
<p>Redis was created by <strong>Salvatore Sanfilippo</strong>, also known as <code>"antirez"</code>, in order to provide a fast, in-memory database that could be used for a variety of purposes. It has since become widely popular for its performance, reliability, and flexibility.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1674908212333/6bde5f21-f4e5-44f0-9e0f-7ef8592f6794.webp" alt class="image--right mx-auto mr-0" /></p>
<p>It is because of its low latency and high performance that Redis is used by a lot of major companies, such as:</p>
<ul>
<li><p>Twitter</p>
</li>
<li><p>Snapchat</p>
</li>
<li><p>GitHub</p>
</li>
<li><p>Pinterest</p>
</li>
<li><p>Craigslist</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1674908213031/a933d439-f1d5-49c2-957b-a47998decbc8.jpeg" alt="Companies that use Redis" /></p>
<h2 id="heading-how-does-redis-work">How does Redis work?</h2>
<p>Redis is a key-value store, which means that it stores data in the form of key-value pairs. The key is used to access the value, and the value can be of any type, such as a <code>string</code>, a <code>list</code>, a <code>set</code>, a <code>sorted set</code>, a <code>hash</code>. These data types are supported natively by Redis and provide a rich set of commands for manipulating and querying the data.</p>
<p>In addition to these data types, Redis can be extended with Redis Modules. Some of these modules are provided by Redis Labs, and some are provided by the community. Some of the modules provided by Redis Labs are:</p>
<ul>
<li><p><strong>RediSearch</strong>: This module provides full-text search capabilities for Redis, allowing users to index, search, and query text data stored in Redis similar to Elasticsearch.</p>
</li>
<li><p><strong>RedisGraph</strong>: This module provides graph database capabilities for Redis, allowing users to store, query, and manipulate graph data structures similar to Neo4j.</p>
</li>
<li><p><strong>RedisTimeSeries</strong>: This module provides time series data management capabilities for Redis, allowing users to store, query, and visualize time series data similar to InfluxDB.</p>
</li>
<li><p><strong>RedisJSON</strong>: This module provides native support for JSON data in Redis, allowing users to store, manipulate, and query JSON data using Redis commands similar to MongoDB.</p>
</li>
<li><p><strong>RedisBloom</strong>: This module provides probabilistic data structures for Redis, allowing users to store and query data using bloom filters, count-min sketches, and other data structures that can approximate data sets.</p>
</li>
</ul>
<p>These are just a few examples of the many Redis Modules that are available. There are many more modules that provide a wide range of additional functionality for Redis. For a complete list of available modules, you can visit the Redis Modules registry at the following URL: <a target="_blank" href="http://redis.io/resources/modules">redis.io/resources/modules</a>.</p>
<p>This makes Redis a <strong>multi-model database</strong>.</p>
<h2 id="heading-installing-redis">Installing Redis</h2>
<p>Redis can be installed on Linux, Windows, and macOS using the following steps:</p>
<h3 id="heading-linux">Linux</h3>
<p>Begin by updating your local package index with the latest package information:</p>
<pre><code class="lang-bash">curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg

<span class="hljs-built_in">echo</span> <span class="hljs-string">"deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb <span class="hljs-subst">$(lsb_release -cs)</span> main"</span> | sudo tee /etc/apt/sources.list.d/redis.list

sudo apt-get update
sudo apt-get install redis
</code></pre>
<h3 id="heading-windows">Windows</h3>
<p>Redis is not officially supported on Windows. However, you can install Redis on Windows for development by following the instructions mentioned in the <a target="_blank" href="https://redis.io/docs/getting-started/installation/install-redis-on-windows/">website</a>.</p>
<h3 id="heading-macos">MacOS</h3>
<p>Install the Redis server and command-line tools using Homebrew:</p>
<pre><code class="lang-bash">brew install redis
</code></pre>
<p>Once the installation is complete, you can start the Redis server using the following command:</p>
<pre><code class="lang-bash">brew services start redis
</code></pre>
<p>To enable Redis to start automatically when the system boots, you can use the following command:</p>
<pre><code class="lang-bash">brew services <span class="hljs-built_in">enable</span> redis
</code></pre>
<p>Once, you have Redis installed, you can start it by running the following command:</p>
<pre><code class="lang-bash">redis-server
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1674908266357/00d538ef-618a-4fe8-90cc-14d9580b0097.png" alt="redis-server command on terminal" /></p>
<h2 id="heading-using-redis">Using Redis</h2>
<p>Redis provides a command-line interface (CLI) that can be used to interact with the Redis server. You can start the Redis CLI using the following command:</p>
<pre><code class="lang-bash">redis-cli
</code></pre>
<h2 id="heading-basic-redis-commands">Basic Redis Commands</h2>
<p>You can set a key-value pair in Redis using the <code>SET</code> command. For example, to set the key <code>name</code> to the value <code>John</code>, you can use the following command:</p>
<pre><code class="lang-bash">SET name John
</code></pre>
<p>It will return <code>OK</code> if the operation is successful.</p>
<p>Now, to get the value of the key <code>name</code>, you can use the <code>GET</code> command:</p>
<pre><code class="lang-bash">GET name
</code></pre>
<p>It will return <code>John</code>.</p>
<pre><code class="lang-sql">127.0.0.1:6379&gt; <span class="hljs-keyword">SET</span> <span class="hljs-keyword">name</span> John
OK
<span class="hljs-number">127.0</span><span class="hljs-number">.0</span><span class="hljs-number">.1</span>:<span class="hljs-number">6379</span>&gt; <span class="hljs-keyword">GET</span> <span class="hljs-keyword">name</span>
<span class="hljs-string">"John"</span>
</code></pre>
<p>You can also delete a key using the <code>DEL</code> command:</p>
<pre><code class="lang-bash">DEL name
</code></pre>
<p>It will return <code>1</code> if the operation is successful. Now, if you try to get the value of the key <code>name</code>, it will return <code>(nil)</code>.</p>
<pre><code class="lang-sql">127.0.0.1:6379&gt; <span class="hljs-keyword">SET</span> <span class="hljs-keyword">name</span> John
OK
<span class="hljs-number">127.0</span><span class="hljs-number">.0</span><span class="hljs-number">.1</span>:<span class="hljs-number">6379</span>&gt; <span class="hljs-keyword">GET</span> <span class="hljs-keyword">name</span>
<span class="hljs-string">"John"</span>
<span class="hljs-number">127.0</span><span class="hljs-number">.0</span><span class="hljs-number">.1</span>:<span class="hljs-number">6379</span>&gt; DEL <span class="hljs-keyword">name</span>
(<span class="hljs-built_in">integer</span>) <span class="hljs-number">1</span>
<span class="hljs-number">127.0</span><span class="hljs-number">.0</span><span class="hljs-number">.1</span>:<span class="hljs-number">6379</span>&gt; <span class="hljs-keyword">GET</span> <span class="hljs-keyword">name</span>
(nil)
<span class="hljs-number">127.0</span><span class="hljs-number">.0</span><span class="hljs-number">.1</span>:<span class="hljs-number">6379</span>&gt;
</code></pre>
<p>To get a list of all the keys in the database, you can use the <code>KEYS</code> command:</p>
<pre><code class="lang-bash">KEYS *
</code></pre>
<p>Here is what it looks like:</p>
<pre><code class="lang-sql">127.0.0.1:6379&gt; <span class="hljs-keyword">SET</span> fname John
OK
<span class="hljs-number">127.0</span><span class="hljs-number">.0</span><span class="hljs-number">.1</span>:<span class="hljs-number">6379</span>&gt; <span class="hljs-keyword">SET</span> lname Doe
OK
<span class="hljs-number">127.0</span><span class="hljs-number">.0</span><span class="hljs-number">.1</span>:<span class="hljs-number">6379</span>&gt; <span class="hljs-keyword">SET</span> age <span class="hljs-number">30</span>
OK
<span class="hljs-number">127.0</span><span class="hljs-number">.0</span><span class="hljs-number">.1</span>:<span class="hljs-number">6379</span>&gt; <span class="hljs-keyword">KEYS</span> *
<span class="hljs-number">1</span>) <span class="hljs-string">"lname"</span>
<span class="hljs-number">2</span>) <span class="hljs-string">"age"</span>
<span class="hljs-number">3</span>) <span class="hljs-string">"fname"</span>
</code></pre>
<p>To get the number of keys in the database, you can use the <code>DBSIZE</code> command:</p>
<pre><code class="lang-bash">DBSIZE
</code></pre>
<p>It will return <code>3</code> in this case.</p>
<h2 id="heading-setting-expiration-time">Setting Expiration Time</h2>
<p>The expiration time of a key refers to the amount of time that the key will remain in the database before it is automatically deleted. We can set the expiration time of a key using the <code>EXPIRE</code> command. For example, to set the expiration time of the key <code>name</code> to 10 seconds, you can use the following command:</p>
<pre><code class="lang-bash">EXPIRE name 10
</code></pre>
<p>It will return <code>1</code> if the operation is successful. Now, if you try to get the value of the key <code>name</code>, it will return <code>(nil)</code> after 10 seconds.</p>
<p>To find out the remaining time before the key expires, you can use the <code>TTL</code> command:</p>
<pre><code class="lang-bash">TTL name
</code></pre>
<p>It will return <code>-2</code> if the key does not exist, <code>-1</code> if the key does not have an expiration time or the number of seconds remaining before the key expires.</p>
<pre><code class="lang-sql">127.0.0.1:6379&gt; <span class="hljs-keyword">SET</span> <span class="hljs-keyword">id</span> <span class="hljs-number">1001</span>
OK
<span class="hljs-number">127.0</span><span class="hljs-number">.0</span><span class="hljs-number">.1</span>:<span class="hljs-number">6379</span>&gt; <span class="hljs-keyword">GET</span> <span class="hljs-keyword">id</span>
<span class="hljs-string">"1001"</span>
<span class="hljs-number">127.0</span><span class="hljs-number">.0</span><span class="hljs-number">.1</span>:<span class="hljs-number">6379</span>&gt; <span class="hljs-keyword">EXPIRE</span> <span class="hljs-keyword">id</span> <span class="hljs-number">10</span>
(<span class="hljs-built_in">integer</span>) <span class="hljs-number">1</span>
<span class="hljs-number">127.0</span><span class="hljs-number">.0</span><span class="hljs-number">.1</span>:<span class="hljs-number">6379</span>&gt; TTL <span class="hljs-keyword">id</span>
(<span class="hljs-built_in">integer</span>) <span class="hljs-number">7</span>
<span class="hljs-number">127.0</span><span class="hljs-number">.0</span><span class="hljs-number">.1</span>:<span class="hljs-number">6379</span>&gt; TTL <span class="hljs-keyword">id</span>
(<span class="hljs-built_in">integer</span>) <span class="hljs-number">6</span>
<span class="hljs-number">127.0</span><span class="hljs-number">.0</span><span class="hljs-number">.1</span>:<span class="hljs-number">6379</span>&gt; TTL <span class="hljs-keyword">id</span>
(<span class="hljs-built_in">integer</span>) <span class="hljs-number">4</span>
<span class="hljs-number">127.0</span><span class="hljs-number">.0</span><span class="hljs-number">.1</span>:<span class="hljs-number">6379</span>&gt; TTL <span class="hljs-keyword">id</span>
(<span class="hljs-built_in">integer</span>) <span class="hljs-number">3</span>
<span class="hljs-number">127.0</span><span class="hljs-number">.0</span><span class="hljs-number">.1</span>:<span class="hljs-number">6379</span>&gt; TTL <span class="hljs-keyword">id</span>
(<span class="hljs-built_in">integer</span>) <span class="hljs-number">1</span>
<span class="hljs-number">127.0</span><span class="hljs-number">.0</span><span class="hljs-number">.1</span>:<span class="hljs-number">6379</span>&gt; TTL <span class="hljs-keyword">id</span>
(<span class="hljs-built_in">integer</span>) <span class="hljs-number">-2</span>
<span class="hljs-number">127.0</span><span class="hljs-number">.0</span><span class="hljs-number">.1</span>:<span class="hljs-number">6379</span>&gt; <span class="hljs-keyword">GET</span> <span class="hljs-keyword">id</span>
(nil)
</code></pre>
<h2 id="heading-handling-lists">Handling Lists</h2>
<p>Redis provides a data structure called a list that can be used to store a collection of strings. You can create a list using the <code>RPUSH</code> command. For example, to create a list named <code>colors</code> and add the values <code>red</code>, <code>green</code>, and <code>blue</code> to it, you can use the following command:</p>
<pre><code class="lang-bash">RPUSH colors red green blue
</code></pre>
<p>Here <code>RPUSH</code> refers to the right push operation. It will return <code>3</code> (the number of elements pushed) if the operation is successful.</p>
<blockquote>
<p><strong>Note:</strong> Like <code>RPUSH</code> there are other commands like <code>LPUSH</code> (left push), <code>LPOP</code> (left pop), and <code>RPOP</code> (right pop) that can be used to push and pop elements from the list.</p>
</blockquote>
<p>To get all the elements in the list, you cannot use the <code>GET</code>. This is because you are dealing with lists, so you have to use the <code>LRANGE</code> command:</p>
<pre><code class="lang-bash">LRANGE colors 0 -1
</code></pre>
<p>Here 0 refers to the starting index and -1 refers to the ending index. It will return all the elements in the list.</p>
<pre><code class="lang-sql">127.0.0.1:6379&gt; RPUSH colors red green blue
(integer) 3
127.0.0.1:6379&gt; GET colors
(error) WRONGTYPE Operation against a key holding the wrong kind of value
127.0.0.1:6379&gt; LRANGE colors 0 -1
1) "red"
2) "green"
3) "blue"
127.0.0.1:6379&gt;
</code></pre>
<h2 id="heading-handling-sets">Handling Sets</h2>
<p>Sets are similar to lists, but they do not allow duplicate elements. You can create a set using the <code>SADD</code> command. For example, to create a set named employee_ids and add the values 1001, 1002, and 1003 to it, you can use the following command:</p>
<pre><code class="lang-bash">SADD employee_ids 1001 1002 1003
</code></pre>
<p>To get all the elements in the set, you can use the <code>SMEMBERS</code> command:</p>
<pre><code class="lang-bash">SMEMBERS employee_ids
</code></pre>
<p>If you try to add an element that already exists in the set, it will be ignored. For example, it will be ignored if you try to add the value 1001 to the set <code>employee_ids</code>.</p>
<pre><code class="lang-sql">127.0.0.1:6379&gt; SADD employee_ids 1001 1002 1003
(integer) 3
127.0.0.1:6379&gt; SMEMBERS employee_ids
1) "1001"
2) "1002"
3) "1003"
127.0.0.1:6379&gt; SADD employee_ids 1001
(integer) 0 
127.0.0.1:6379&gt; SMEMBERS employee_ids
1) "1001"
2) "1002"
3) "1003"
</code></pre>
<p>In the case of sets, to check if an element exists in the set, you can use the <code>SISMEMBER</code> command:</p>
<pre><code class="lang-bash">SISMEMBER employee_ids 1001
</code></pre>
<pre><code class="lang-sql">127.0.0.1:6379&gt; SISMEMBER employee_ids 1002
(integer) 1
127.0.0.1:6379&gt; SISMEMBER employee_ids 1005
(integer) 0
</code></pre>
<p>To remove an element from the set, you can use the <code>SREM</code> command:</p>
<pre><code class="lang-bash">SREM employee_ids 1001
</code></pre>
<pre><code class="lang-sql">127.0.0.1:6379&gt; SMEMBERS employee_ids
1) "1001"
2) "1002"
3) "1003"
127.0.0.1:6379&gt; SREM employee_ids 1001
(integer) 1
127.0.0.1:6379&gt; SMEMBERS employee_ids
1) "1002"
2) "1003"
</code></pre>
<h2 id="heading-handling-hashes">Handling Hashes</h2>
<p>Hashes are also key-value pairs. So, using hashes in Redis is like using key-value pairs inside key-value pairs.</p>
<p>To create a hash, you can use the <code>HSET</code> command. For example, to create a hash named <code>employee</code> and add the values <code>id</code>, <code>fname</code>, and <code>lname</code> to it, you can use the following command:</p>
<pre><code class="lang-bash">HSET employee id 1001 fname John lname Doe
</code></pre>
<p>And to get the value of a field in the hash, you can use the <code>HGET</code> command:</p>
<pre><code class="lang-bash">HGET employee id
</code></pre>
<pre><code class="lang-sql">127.0.0.1:6379&gt; HSET employee id 1001 fname John lname Doe
(integer) 3
127.0.0.1:6379&gt; HGET employee id
"1001"
127.0.0.1:6379&gt; HGET employee fname
"John"
127.0.0.1:6379&gt; HGET employee lname
"Doe"
</code></pre>
<p>To get all the fields in the hash, you can use the <code>HKEYS</code> command:</p>
<pre><code class="lang-bash">HKEYS employee
</code></pre>
<p>To get all the values in the hash, you can use the <code>HVALS</code> command:</p>
<pre><code class="lang-bash">HVALS employee
</code></pre>
<p>To get everything in the hash, you can use the <code>HGETALL</code> command:</p>
<pre><code class="lang-bash">HGETALL employee
</code></pre>
<pre><code class="lang-sql">127.0.0.1:6379&gt; HGETALL employee
1) "id"
2) "1001"
3) "fname"
4) "John"
5) "lname"
6) "Doe"
127.0.0.1:6379&gt; HKEYS employee
1) "id"
2) "fname"
3) "lname"
127.0.0.1:6379&gt; HVALS employee
1) "1001"
2) "John"
3) "Doe"
</code></pre>
<p>To delete a field from the hash, you can use the <code>HDEL</code> command:</p>
<pre><code class="lang-plaintext">HDEL employee id
</code></pre>
<p>To check if a field exists in the hash, you can use the <code>HEXISTS</code> command:</p>
<pre><code class="lang-bash">HEXISTS employee id
</code></pre>
<pre><code class="lang-sql">127.0.0.1:6379&gt; HEXISTS employee id
(integer) 1
127.0.0.1:6379&gt; HDEL employee id
(integer) 1
127.0.0.1:6379&gt; HEXISTS employee id
(integer) 0
</code></pre>
<p>You can see initially the field id exists in the hash employee so the output was 1. After deleting it, it no longer exists and hence the value is 0.</p>
<p>Another very useful command is <code>flushall</code>. It will delete all the keys in the database. So, if you want to delete all the keys in the database, you can use the following command:</p>
<pre><code class="lang-sql">127.0.0.1:6379&gt; KEYS *
1) "name"
2) "age"
3) "employee"
127.0.0.1:6379&gt; flushall
OK
127.0.0.1:6379&gt; KEYS *
(empty array)
</code></pre>
<h2 id="heading-conclusion">Conclusion</h2>
<ul>
<li><p>In conclusion, Redis is a popular and robust data management tool that is widely used by organizations for a variety of purposes.</p>
</li>
<li><p>Its key features and benefits include high performance, flexibility, and support for a wide range of data structures.</p>
</li>
<li><p>Once you have installed it, you can use a variety of basic Redis commands, such as <code>SET</code>, <code>GET</code>, <code>DEL</code>, and <code>KEYS</code>, to manage and manipulate data in Redis. By understanding and using these commands effectively, you can unlock the full potential of Redis to support your specific use cases.</p>
</li>
</ul>
<p>I would encourage you to experiment with Redis and explore its capabilities to gain a deeper understanding of how it can help your organization.</p>
<p>If you like this article, please share it with your friends and colleagues who are interested in Redis. If you have any questions or comments, please feel free to leave them below. I will be happy to answer them.</p>
<p>My Website: <a target="_blank" href="http://arnabsen.dev">arnabsen.dev</a></p>
<p>My Twitter: <a target="_blank" href="https://twitter.com/ArnabSen1729">@ArnabSen1729</a></p>
]]></content:encoded></item></channel></rss>