<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
<title>Rohan Rajpal</title>
<link>https://www.rohanrajpal.com</link>
<description>Rohan Rajpal is the co-founder and CTO of Spur, a bootstrapped, profitable company building AI agents for sales and support on WhatsApp, Instagram, Messenger, live chat and email, used by 1,000+ brands in 70+ countries. Writes about building with AI, bootstrapping from India, and shipping fast.</description>
<language>en</language>
<atom:link href="https://www.rohanrajpal.com/rss.xml" rel="self" type="application/rss+xml"/>
<lastBuildDate>Wed, 02 Dec 2026 03:30:00 GMT</lastBuildDate>
<item>
<title>My journey: from Moto G kernels to Spur and 1,000+ brands</title>
<link>https://www.rohanrajpal.com/blog/my-journey</link>
<guid isPermaLink="true">https://www.rohanrajpal.com/blog/my-journey</guid>
<pubDate>Wed, 02 Dec 2026 03:30:00 GMT</pubDate>
<description>How custom Android ROMs, VideoLAN GSoC, IIIT Delhi, a viral CoWIN vaccine bot, and turning down Goldman Sachs led Royal Tomar and me to build Spur, a bootstrapped AI agent platform used across 70+ countries.</description>
<category>Founder notes</category><category>Building Spur</category><category>AI</category><category>Engineering</category>
<content:encoded><![CDATA[<p>If you landed on the <a href="https://www.rohanrajpal.com/">home page</a>, you probably saw the pixel runner and the 3D city first. Both games trace the same ten chapters of how I went from flashing Android kernels in school to co-founding <a href="https://www.spurnow.com">Spur</a> with Royal Tomar and running engineering, AI, and product there.</p>
<p>This is the full written version of that journey: what happened at each turn, why we stayed 100% bootstrapped, and what actually compounded along the way.</p>
<h2 id="2014-flashing-moto-g-kernels-for-strangers">2014: Flashing Moto G kernels for strangers<a class="anchor" aria-label="Link to this section" href="#2014-flashing-moto-g-kernels-for-strangers">#</a></h2>
<p>My first real taste of shipping software had nothing to do with startups. Back in school in 2014, I got obsessed with Android internals, forked the <a href="https://www.rohanrajpal.com/achievements/moto-g-cyanogenmod-kernel">CyanogenMod device tree and kernel for the Motorola Moto G</a>, and put custom builds online for strangers flashing their daily phones.</p>
<p>When someone bricks their phone because of a bad commit, you learn very quickly to read logs carefully, test before pushing, and respect the people running your code.</p>
<h2 id="2017-to-2020-iiit-delhi-videolan-and-real-codebases">2017 to 2020: IIIT Delhi, VideoLAN, and real codebases<a class="anchor" aria-label="Link to this section" href="#2017-to-2020-iiit-delhi-videolan-and-real-codebases">#</a></h2>
<p>I joined <a href="https://www.rohanrajpal.com/achievements/btech-cse-iiit-delhi">IIIT Delhi for a BTech in Computer Science and Engineering</a> in 2017. Campus gave me strong systems fundamentals, close mentors, and my co-founder Royal Tomar.</p>
<p>Four things from those college years shaped almost everything I built afterward:</p>
<ol>
<li><strong>Production open source at VideoLAN (2019).</strong> Through <a href="https://www.rohanrajpal.com/blog/gsoc-with-vlc">Google Summer of Code 2019</a>, I built the drag-and-drop controlbar editor in Qt and QML for the redesigned VLC interface. Maintainer reviews inside a decades-old codebase used by hundreds of millions of people taught me what clean, durable engineering looks like.</li>
<li><strong>Research discipline at Precog.</strong> I spent roughly two years as an <a href="https://www.rohanrajpal.com/achievements/precog-research-lab-iiit-delhi">undergraduate researcher at the Precog lab</a>. That habit of measuring before claiming anything carried straight into how I later built AI evaluation pipelines at Spur.</li>
<li><strong>Community and campus shipping.</strong> I served as <a href="https://www.rohanrajpal.com/achievements/google-dsc-lead-iiit-delhi">Google Developer Student Clubs (DSC) Lead at IIIT Delhi</a> (running GSoC, Outreachy, and DevFest workshops), co-built <a href="https://www.rohanrajpal.com/blog/dmrc-connect">DMRC Connect</a> (a Delhi Metro commuter design project that made the news), and worked as a <a href="https://www.rohanrajpal.com/achievements/ta-valuation-portfolio-management-iiit-delhi">Teaching Assistant for Valuation and Portfolio Management</a>.</li>
<li><strong>Enterprise vs startup internships (2020).</strong> In summer 2020, I interned remotely in cloud and data engineering at <a href="https://www.rohanrajpal.com/blog/expedia-internship-experience">Expedia Group</a> and also spent time at a <a href="https://www.rohanrajpal.com/achievements/medical-imaging-vr-startup-intern">medical-imaging VR startup</a>. Seeing both worlds back to back made it obvious that I wanted to build inside a small, fast-moving product team.</li>
</ol>
<p><img alt="Rohan with the DMRC Connect team at IIIT Delhi" src="https://www.rohanrajpal.com/_img/photos/iiitd-dmrc-team-1024.webp" srcset="/_img/photos/iiitd-dmrc-team-96.webp 96w, /_img/photos/iiitd-dmrc-team-240.webp 240w, /_img/photos/iiitd-dmrc-team-480.webp 480w, /_img/photos/iiitd-dmrc-team-960.webp 960w, /_img/photos/iiitd-dmrc-team-1024.webp 1024w" sizes="(min-width: 760px) 700px, 100vw" width="1024" height="683" loading="lazy" decoding="async"></p>
<h2 id="2021-hackathons-cowin-alerts-and-150000-people-in-chat">2021: Hackathons, CoWIN Alerts, and 150,000+ people in chat<a class="anchor" aria-label="Link to this section" href="#2021-hackathons-cowin-alerts-and-150000-people-in-chat">#</a></h2>
<p>In 2021, things accelerated fast. Royal and I built SevaShop, won <a href="https://www.rohanrajpal.com/achievements/inout-7-winner-sevashop">Hack InOut 7.0</a>, were picked for the first cohort of <a href="https://www.rohanrajpal.com/achievements/build-india-fellowship-devfolio">Devfolio's Build India Fellowship</a> (where SevaShop was featured as one of four teams from 2,500+ applications), and completed <a href="https://www.rohanrajpal.com/achievements/incubate-iit-madras-sevashop">I-NCUBATE at GDC, IIT Madras</a>.</p>
<p>Then India's second COVID-19 wave hit in May 2021. Vaccine slots on the CoWIN portal vanished within seconds of opening. Together with IIIT Delhi teammates Paras Mehan, Sidhant S Sarkar, and Royal Tomar, I built a free Telegram bot (<a href="https://www.rohanrajpal.com/achievements/cowin-alerts-bot">CoWIN Alerts</a>) that watched open slots and pinged people the instant appointments went live.</p>
<p>Word of mouth took over immediately:</p>
<ol>
<li><strong>40,000+ users</strong> within three weeks.</li>
<li><strong>60,000 users</strong> in its first month and <strong>150,000+ users</strong> by June 2021.</li>
<li><strong>National coverage</strong> across the <a href="https://www.rohanrajpal.com/achievements/cowin-alerts-national-press">Times of India, NDTV, News18, The Tribune, and Mid-day</a>.</li>
<li><strong>Institutional recognition:</strong> placed on the Dean's List for Innovation Research and Development with the <a href="https://www.rohanrajpal.com/achievements/dean-ird-research-excellence-award-iiit-delhi">IIIT Delhi Dean IRD Research Excellence Award</a> at Foundation Day 2021.</li>
</ol>
<p><img alt="IIIT Delhi Foundation Day 2021 Certificate of Appreciation and plaque for CoWIN Alerts" src="https://www.rohanrajpal.com/_img/photos/deans-award-cowin-1280.webp" srcset="/_img/photos/deans-award-cowin-96.webp 96w, /_img/photos/deans-award-cowin-240.webp 240w, /_img/photos/deans-award-cowin-480.webp 480w, /_img/photos/deans-award-cowin-960.webp 960w, /_img/photos/deans-award-cowin-1280.webp 1280w" sizes="(min-width: 760px) 700px, 100vw" width="1280" height="834" loading="lazy" decoding="async"></p>
<p>CoWIN Alerts changed my trajectory for good. At 22, we learned two things at once: we could keep real-time messaging infrastructure upright under sudden spikes, and an entire country was already comfortable taking serious action inside chat.</p>
<h2 id="turning-down-goldman-sachs-for-headout">Turning down Goldman Sachs for Headout<a class="anchor" aria-label="Link to this section" href="#turning-down-goldman-sachs-for-headout">#</a></h2>
<p>Graduating in 2021, I had an offer from Goldman Sachs, but I <a href="https://www.rohanrajpal.com/achievements/headout-software-engineer-bengaluru">turned it down to join Headout</a> as a software engineer in Bengaluru. I wanted to work close to shipping consumer software.</p>
<p>At Headout, I focused hard on developer velocity: cutting the local change feedback loop <a href="https://www.rohanrajpal.com/achievements/headout-dev-feedback-loop-12x">from 120 seconds down to 10 seconds (a 12x speedup)</a> and trimming <a href="https://www.rohanrajpal.com/achievements/headout-ci-pipeline-speedup">CI build time from 10 minutes to 3 minutes</a>. On nights and weekends, Royal and I completed the <a href="https://www.rohanrajpal.com/achievements/y-combinator-build-sprint">Y Combinator Build Sprint</a> in September 2021.</p>
<p>Then a merchant who had seen our CoWIN bot asked us for a bot that could sell to customers. That question turned into Spur.</p>
<h2 id="2021-to-2023-co-founding-spur-from-zero">2021 to 2023: Co-founding Spur from zero<a class="anchor" aria-label="Link to this section" href="#2021-to-2023-co-founding-spur-from-zero">#</a></h2>
<p>In December 2021, Royal and I incorporated Spurtastic Technologies Private Limited (<a href="https://www.rohanrajpal.com/achievements/spur-incorporation-iiitd-incubation">Spur</a>), earned DPIIT Startup India recognition, and joined the IIIT-Delhi Innovation &#x26; Incubation Center in February 2022. From the first day, we decided to stay 100% bootstrapped and fund engineering directly from paying customers.</p>
<p>The early milestones came one launch at a time:</p>
<ol>
<li><strong>2022 launches:</strong> Co-launched <a href="https://www.rohanrajpal.com/achievements/early-stage-os-product-hunt-3">Early-Stage OS</a> (hunted by Ben Lang, #3 Product of the Day on Product Hunt with 274+ upvotes), then in September 2022 went live on the Shopify App Store and hit <a href="https://www.rohanrajpal.com/achievements/spur-shopify-app-store-product-hunt-3">#3 Product of the Day on Product Hunt</a> (390+ upvotes) with our first Instagram DM automation tool.</li>
<li><strong>January 2023:</strong> Showcased Spur at the <a href="https://www.rohanrajpal.com/achievements/iisf-2022-startup-conclave-bhopal">IISF 2022 Startup Conclave in Bhopal</a>.</li>
<li><strong>June 2023:</strong> Met OpenAI CEO <a href="https://www.rohanrajpal.com/achievements/sam-altman-openai-india-qa">Sam Altman in person during his India visit</a> at IIIT Delhi and asked live Q&#x26;A questions right as we began rethinking Spur around LLM agents.</li>
<li><strong>December 2023:</strong> Selected as 1 of 10 startups from 1,000+ applicants on <a href="https://www.rohanrajpal.com/achievements/mission-start-ab-prime-video">Amazon Prime Video's <em>Mission Start Ab</em></a>, featured on a billboard, hosted a 500-seat screening back at IIIT Delhi that brought us our earliest hires, and ranked <a href="https://www.rohanrajpal.com/achievements/product-hunt-4-spur-2023">#4 Product of the Day on Product Hunt</a>.</li>
</ol>
<p><img alt="Rohan Rajpal and Royal Tomar pitching Spur on Prime Video&#x27;s Mission Start Ab" src="https://www.rohanrajpal.com/_img/photos/mission-start-ab-pitch-1024.webp" srcset="/_img/photos/mission-start-ab-pitch-96.webp 96w, /_img/photos/mission-start-ab-pitch-240.webp 240w, /_img/photos/mission-start-ab-pitch-480.webp 480w, /_img/photos/mission-start-ab-pitch-960.webp 960w, /_img/photos/mission-start-ab-pitch-1024.webp 1024w" sizes="(min-width: 760px) 700px, 100vw" width="1024" height="576" loading="lazy" decoding="async"></p>
<h2 id="2024-to-2025-rebuilding-spur-around-actionable-ai-agents">2024 to 2025: Rebuilding Spur around Actionable AI Agents<a class="anchor" aria-label="Link to this section" href="#2024-to-2025-rebuilding-spur-around-actionable-ai-agents">#</a></h2>
<p>By 2024, static keyword bots were clearly not enough. Merchants did not want chatbots that repeated FAQ paragraphs; they wanted agents that could check live orders, edit addresses, recover carts, confirm COD orders, and hand off cleanly to a human when needed.</p>
<p>Over 2024 and 2025, we rebuilt the platform from the ground up:</p>
<ol>
<li><strong>Commerce ecosystem:</strong> Listed on Razorpay Rize Marketplace, expanded to WooCommerce, and shipped <a href="https://www.rohanrajpal.com/achievements/spur-razorpay-rize-woocommerce-cod">Spur x Razorpay COD-to-Prepaid inside WhatsApp</a>.</li>
<li><strong>Meta partnership:</strong> Listed in the <a href="https://www.rohanrajpal.com/achievements/meta-partner-directory-incubate-program">Meta Partner Directory</a> in June 2024 as a Meta Business Partner (Technology Partner) and joined the Meta Incubate Partner Program in 2025.</li>
<li><strong>Actionable AI Agents &#x26; Delivery Boost:</strong> I architected <a href="https://www.rohanrajpal.com/achievements/spur-actionable-ai-agents-delivery-boost">Spur's Actionable AI Agents</a> with typed, permissioned commerce tools, multi-LLM routing across OpenAI, Anthropic, Google, and xAI, and an adversarial multi-judge CI evaluation pipeline so changes cannot silently regress in production. Alongside it, we shipped Delivery Boost, lifting WhatsApp campaign delivery from roughly 30% to over 70%.</li>
<li><strong>Team and AI community:</strong> Ran 30-day bootstrapped team workations in <a href="https://www.rohanrajpal.com/achievements/spur-team-workations-bali-bangkok">Bali (2024) and Bangkok (September 2025)</a>, met Turing Award laureate <a href="https://www.rohanrajpal.com/achievements/yann-lecun-meta-ai-meeting">Dr. Yann LeCun and Meta VP of AI Manohar Paluri</a> with IIIT Delhi alumni, returned to <a href="https://www.rohanrajpal.com/achievements/iiit-delhi-guest-lecture-nit-rourkela-mentor">IIIT Delhi to guest-lecture the entrepreneurship course</a> I took as a student, and mentored NIT Rourkela's hackathon with real AI and MCP problem statements.</li>
<li><strong>Meta HQ summits &#x26; viral education:</strong> Co-hosted India's first Instagram-only business summits inside <a href="https://www.rohanrajpal.com/achievements/insta-ai-summit-meta-hq-gurgaon">Meta HQ Gurgaon</a> (September 19, 2025: 483 registrations, 139 approved, 4.9/5 attendee rating) and <a href="https://www.rohanrajpal.com/achievements/insta-ai-summit-meta-hq-mumbai-real-estate">Meta HQ Mumbai, One BKC</a> (September 25, 2025: 398 registrations, 251 approved at max capacity, keynote by Ravi Kewalramani), and kicked off our organic video education engine with <a href="https://www.rohanrajpal.com/achievements/spur-educational-reels-viral-755k-views">our first viral reel in Thailand</a> (187,903 views and 4,502 shares on WhatsApp deliverability, scaling past 755,000 organic views with 97% non-followers).</li>
</ol>
<p><img alt="Rohan presenting on stage at Meta HQ Gurgaon during the Insta AI Summit" src="https://www.rohanrajpal.com/_img/photos/meta-insta-ai-summit-1024.webp" srcset="/_img/photos/meta-insta-ai-summit-96.webp 96w, /_img/photos/meta-insta-ai-summit-240.webp 240w, /_img/photos/meta-insta-ai-summit-480.webp 480w, /_img/photos/meta-insta-ai-summit-960.webp 960w, /_img/photos/meta-insta-ai-summit-1024.webp 1024w" sizes="(min-width: 760px) 700px, 100vw" width="1024" height="771" loading="lazy" decoding="async"></p>
<h2 id="2026-1000-brands-spur-mcp-and-global-scale">2026: 1,000+ brands, Spur MCP, and global scale<a class="anchor" aria-label="Link to this section" href="#2026-1000-brands-spur-mcp-and-global-scale">#</a></h2>
<p>Today, Spur is an agentic CRM built in New Delhi by a 12-person bootstrapped team, profitable every year since day one:</p>
<ol>
<li><strong>Global scale:</strong> <a href="https://www.rohanrajpal.com/achievements/spur-global-scale-1000-brands">1,000+ brands across 70+ countries</a> (from two-person D2C shops to Jaipur Rugs and Golden Tree) running 72M+ conversations a year across e-commerce, real estate, education, healthcare, and travel.</li>
<li><strong>Production AI performance:</strong> Our <a href="https://www.rohanrajpal.com/achievements/spur-ai-agents-70-percent-resolution">AI agents resolve roughly 70% of conversations autonomously</a> and cut human escalations by up to 88%, while holding a <a href="https://www.rohanrajpal.com/achievements/spur-shopify-app-store-5-stars">5.0-star rating across 118+ reviews on the Shopify App Store</a>.</li>
<li><strong>Spur Sidekick &#x26; Spur MCP:</strong> I built <a href="https://www.rohanrajpal.com/achievements/spur-mcp-claude-chatgpt">Spur Sidekick and Spur MCP</a> with 40+ commerce and messaging tools so brands can build segments, launch WhatsApp campaigns, and check analytics straight from Spur, Claude, or ChatGPT. After launching Spur MCP live on stage at Meta Bengaluru HQ in April 2026, 36 paying brands connected in the first four weeks, and roughly 1 in 10 customers now operate Spur over MCP.</li>
<li><strong>Ecosystem milestones:</strong> Five Spur teammates passed Meta's official Business Messaging certifications in November 2026 (including my <a href="https://www.rohanrajpal.com/achievements/meta-certified-whatsapp-technical-implementation">Meta Certified WhatsApp for Business Technical Implementation Professional</a> credential), qualifying Spur for the official <a href="https://www.rohanrajpal.com/achievements/meta-business-partner-nvidia-inception">Meta Business Partner (Technology Partner) badge</a> on November 24, 2026 (alongside joining NVIDIA Inception), plus <a href="https://www.rohanrajpal.com/achievements/meta-golden-tree-success-story">Meta's published Golden Tree success story</a> in October 2026 (quoting me on our Spur-designed A/B test that lifted ROAS from 1.36x to 2.5x).</li>
<li><strong>Events and global tour:</strong> Co-hosted <a href="https://www.rohanrajpal.com/achievements/operator-circle-bangalore-meta-hq">Operator Circle Bangalore at Meta HQ</a> (862 registrations, 169 approved at max capacity with Meta, Shopify South Asia, and Razorpay Rize), <a href="https://www.rohanrajpal.com/achievements/operator-circle-jaipur-meta">Operator Circle Jaipur</a> (212 registrations, 101 approved at max capacity; 1,955+ registrations across our four in-person Meta events), the <a href="https://www.rohanrajpal.com/achievements/meta-spur-global-webinar-2026">Meta x Spur Global Webinar</a> (200+ attendees worldwide), and the <a href="https://www.rohanrajpal.com/achievements/meta-bid-based-marketing-messages-beta">Inside WhatsApp Bidding webinar</a> with Razorpay Rize (1,272 registrations, 120-seat cap reached) as an early-access pilot partner on Meta's bid-based marketing messages beta. In June 2026, I attended <a href="https://www.rohanrajpal.com/achievements/meta-conversations-london-uk-2026">Meta Conversations in London and traveled through Scotland</a>, and in July we ran <a href="https://www.rohanrajpal.com/achievements/whatsapp-business-summit-bengaluru-booth-9">Booth 9 at Meta's WhatsApp Business Summit in Bengaluru</a> as the only bootstrapped team on the floor (101 demos booked).</li>
<li><strong>New capabilities and press:</strong> Moved into <a href="https://www.rohanrajpal.com/achievements/spur-first-office-whatsapp-groups-calling">Spur's first private office</a>, shipped WhatsApp Groups API and native WhatsApp Calling with automated call transcripts, and were profiled by <a href="https://www.rohanrajpal.com/achievements/digital-trends-profile-2026">Digital Trends</a> in November 2026.</li>
</ol>
<p><img alt="Rohan moderating a WhatsApp marketing fireside at Meta Bengaluru HQ" src="https://www.rohanrajpal.com/_img/photos/operator-circle-bangalore-1024.webp" srcset="/_img/photos/operator-circle-bangalore-96.webp 96w, /_img/photos/operator-circle-bangalore-240.webp 240w, /_img/photos/operator-circle-bangalore-480.webp 480w, /_img/photos/operator-circle-bangalore-960.webp 960w, /_img/photos/operator-circle-bangalore-1024.webp 1024w" sizes="(min-width: 760px) 700px, 100vw" width="1024" height="576" loading="lazy" decoding="async"></p>
<h2 id="full-circle-judging-mentoring-and-ieee-peer-review">Full circle: judging, mentoring, and IEEE peer review<a class="anchor" aria-label="Link to this section" href="#full-circle-judging-mentoring-and-ieee-peer-review">#</a></h2>
<p>One of the best parts of 2026 has been sitting on the other side of the table from where I started:</p>
<ol>
<li><strong>IIT Kanpur:</strong> Judged <a href="https://www.rohanrajpal.com/achievements/techkriti-26-pitch-premier-judge-iit-kanpur">Techkriti'26 Pitch Premier</a> across 200+ startup pitches in March 2026.</li>
<li><strong>IIIT Delhi:</strong> Returned to campus to mentor and judge <a href="https://www.rohanrajpal.com/achievements/hack4impact-judge-esummit-iiit-delhi">Hack4Impact at E-Summit</a> (24-hour hackathon, 800+ registrations) in April 2026.</li>
<li><strong>IIIT Allahabad:</strong> Judged the <a href="https://www.rohanrajpal.com/achievements/oosc-4-hackathon-judge-iiit-allahabad">OOSC 4.0 open-source hackathon at IIIT Allahabad</a> in August 2026.</li>
<li><strong>Academic peer review:</strong> Completed two certified peer reviews for the <a href="https://www.rohanrajpal.com/achievements/ieee-internet-of-things-journal-peer-reviewer">IEEE Internet of Things Journal</a> (November 7 and November 28, 2026; two IEEE Certificates of Reviewer Contribution publicly verified on Web of Science under ResearcherID <code>RPD-6688-2026</code>).</li>
</ol>
<h2 id="five-things-that-actually-compounded">Five things that actually compounded<a class="anchor" aria-label="Link to this section" href="#five-things-that-actually-compounded">#</a></h2>
<p>Looking back across twelve years of building, the same five habits drove almost every leap:</p>
<ol>
<li><strong>Ship into real traffic early.</strong> Moto G kernels, VLC patches, and CoWIN Alerts taught more in weeks of real user load than years of private side projects.</li>
<li><strong>Shrink feedback loops relentlessly.</strong> Whether cutting Headout's dev loop 12x or building adversarial CI evals for Spur's AI agents, faster verified feedback beats working longer hours.</li>
<li><strong>Let customers fund the roadmap.</strong> Staying 100% bootstrapped forced every feature to prove its worth in live merchant retention instead of pitch decks.</li>
<li><strong>Pair AI with deterministic systems.</strong> LLMs shine when grounded in typed, permissioned actions and strict evaluation gates rather than open-ended prompts.</li>
<li><strong>Show up in person.</strong> Campus hackathons, Meta HQ rooms, Operator Circle cities, and Booth 9 built relationships and product clarity that cold emails never touch.</li>
</ol>
<p>If you want to explore the interactive version of this story, <a href="https://www.rohanrajpal.com/">play the game on the home page</a>. If you want the structured archive with primary sources for every milestone, browse all <a href="https://www.rohanrajpal.com/achievements">55 achievement pages</a>.</p>]]></content:encoded>
</item>
<item>
<title>OS Interview Prep Resources</title>
<link>https://www.rohanrajpal.com/blog/os-interview-resources</link>
<guid isPermaLink="true">https://www.rohanrajpal.com/blog/os-interview-resources</guid>
<pubDate>Wed, 15 Jul 2020 03:30:00 GMT</pubDate>
<description>Some resources to learn more about the fundamentals of Operating Systems</description>
<category>Engineering</category><category>Interview prep</category>
<content:encoded><![CDATA[<h2 id="concepts">Concepts<a class="anchor" aria-label="Link to this section" href="#concepts">#</a></h2>
<ul>
<li><a href="https://nptel.ac.in/courses/106/102/106102132/">NPTEL Link</a></li>
<li><a href="https://www.youtube.com/playlist?list=PLTtjs-HViBW6525-_a8QL3meFIlP31gGE">Youtube playlist link</a></li>
</ul>
<div class="video"><iframe src="https://www.youtube.com/embed/videoseries?list=PLTtjs-HViBW6525-_a8QL3meFIlP31gGE" title="YouTube video" loading="lazy" allow="accelerometer; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div>
<h2 id="questions">Questions<a class="anchor" aria-label="Link to this section" href="#questions">#</a></h2>
<ul>
<li><a href="https://www.sanfoundry.com/operating-system-questions-answers/">Topic wise questions</a></li>
</ul>]]></content:encoded>
</item>
<item>
<title>The Virtual Internship: My Experience</title>
<link>https://www.rohanrajpal.com/blog/expedia-internship-experience</link>
<guid isPermaLink="true">https://www.rohanrajpal.com/blog/expedia-internship-experience</guid>
<pubDate>Mon, 13 Jul 2020 03:30:00 GMT</pubDate>
<description>These summers, I interned at one of the largest travel companies of the world, Expedia Group™️. Who knew during a pandemic when travel is at an all time low, Expedia had a great intern program planned for us!</description>
<category>Learning</category><category>Design</category>
<content:encoded><![CDATA[<p>These summers, I interned at one of the largest travel companies of the world, Expedia Group™️. Who knew during a pandemic when travel is at an all time low, Expedia had a great intern program planned for us!</p>
<p>Luckily, my <a href="https://www.rohanrajpal.com/blog/gsoc-with-vlc">previous intern</a> was remote too, so I was kind of used to work from home. In this internship, I majorly worked on cloud and data engineering.</p>
<p><img alt="Our kickoff call on the first day" src="https://www.rohanrajpal.com/_img/expedia/expediaPreview-1600.webp" srcset="/_img/expedia/expediaPreview-96.webp 96w, /_img/expedia/expediaPreview-240.webp 240w, /_img/expedia/expediaPreview-480.webp 480w, /_img/expedia/expediaPreview-960.webp 960w, /_img/expedia/expediaPreview-1600.webp 1600w" sizes="(min-width: 760px) 700px, 100vw" width="1920" height="1080" loading="lazy" decoding="async"></p>
<h2 id="the-induction-week">The induction week<a class="anchor" aria-label="Link to this section" href="#the-induction-week">#</a></h2>
<p>Expedia organized an induction week for us, and it involved workshops on various topics: how to become a better leader, designer, and we even got to know how Expedia operates.
We kept on having workshops throughout our intern, and there was a lot to learn from each session.</p>
<h2 id="my-setup">My setup<a class="anchor" aria-label="Link to this section" href="#my-setup">#</a></h2>
<div class="py-8 px-4 text-center">
	<div class="flex -mx-4 mb-4 items-center px-8">
		<div class="mr-4">
			<img alt="setup with the laptop" src="https://www.rohanrajpal.com/_img/expedia/experience/setup-1-719.webp" srcset="/_img/expedia/experience/setup-1-96.webp 96w, /_img/expedia/experience/setup-1-240.webp 240w, /_img/expedia/experience/setup-1-480.webp 480w, /_img/expedia/experience/setup-1-719.webp 719w" sizes="(min-width: 760px) 700px, 100vw" width="719" height="1091" loading="lazy" decoding="async">
		</div>
		<div class="w-[58.5%]">
			<img alt="setup with water and chai" src="https://www.rohanrajpal.com/_img/expedia/experience/setup-2-720.webp" srcset="/_img/expedia/experience/setup-2-96.webp 96w, /_img/expedia/experience/setup-2-240.webp 240w, /_img/expedia/experience/setup-2-480.webp 480w, /_img/expedia/experience/setup-2-720.webp 720w" sizes="(min-width: 760px) 700px, 100vw" width="720" height="1475" loading="lazy" decoding="async">
		</div>
	</div>
	<p class="italic">Not the fanciest setup out there, but enough to get the work done :)</p>
</div>
<h2 id="my-team---vrbo-stayx-dot-net-modernization-pod">My Team - Vrbo: Stayx dot net modernization pod<a class="anchor" aria-label="Link to this section" href="#my-team---vrbo-stayx-dot-net-modernization-pod">#</a></h2>
<p>I was a part of the Stay Experience team, which looks after the post-booking experience for a traveller. The team was divided into pods, and I worked on the .Net Stack Modernisation pod. My work involved making a microservice and figuring out how to deploy it to the cloud.<br>
I worked with a manager and a buddy. We synced up every week and discussed work updates every day. It motivated me to stay on track. I also synced up with our project sponsor a few times. I enjoyed such one on one sessions. They helped me connect with the team better.<br>
All the Vrbo interns together had a weekly sync with the Vrbo managers. We socialized, played some games, get help on some issues. It was nice to have someone for support throughout the program, and these calls also helped me get to know the other interns better.</p>
<h2 id="the-project">The project<a class="anchor" aria-label="Link to this section" href="#the-project">#</a></h2>
<h3 id="motivation">Motivation<a class="anchor" aria-label="Link to this section" href="#motivation">#</a></h3>
<p>We have a database which stores the notifications for guests of guests in a homestay. Now we wanted a way in which we can store the data in S3 and keep it updated.</p>
<ul>
<li>Why are you storing the data in two different places?
<ul>
<li>This data is not only used to send a notification but also by an analyst or data scientist. The MongoDB database also backs the GoG API, and if everyone does their operations on MongoDB, it might severely affect the API.</li>
</ul>
</li>
</ul>
<p>We finally came up with the idea to use a Spark Job. This job would take the data from MongoDB and store it in an S3 bucket.</p>
<ul>
<li>Why a spark job?
<ul>
<li>Spark and Scala are the industry standard for data management. The jobs will be able to manage huge amounts of data without any hiccups.</li>
</ul>
</li>
</ul>
<h3 id="aim-create-a-spark-job-to-sync-data-from-mongodb-to-s3">Aim: Create a spark job to sync data from MongoDB to S3<a class="anchor" aria-label="Link to this section" href="#aim-create-a-spark-job-to-sync-data-from-mongodb-to-s3">#</a></h3>
<!-- [The ticket SE-2854](https://jira.homeawaycorp.com/browse/SE-2854) -->
<h3 id="a-quick-revision">A quick revision<a class="anchor" aria-label="Link to this section" href="#a-quick-revision">#</a></h3>
<p>This blog is going to get more technical now, just keeping this for a quick reference if you have a doubt.</p>
<p><strong>What's MongoDB?</strong> It's a NoSQL database.<br>
<strong>What's scala?</strong> It's a programming language widely used for data management. I did all my coding in the Scala language.<br>
<strong>What's Apache spark?</strong> It's a fast and general-purpose cluster computing system for large scale data processing. Some important things to know about spark are:</p>
<ul>
<li>Dataframe: This is data in the form of a table, just like a relational database table.</li>
<li>Dataset: Extension of Dataframes, they provide the functionality of being type-safe and an object-oriented programming interface.</li>
<li>SparkSession vs SparkContext: Spark session is a unified entry point of a spark application from Spark 2.0. It provides a way to interact with various spark’s functionality with a lesser number of constructs. Instead of having a spark context, hive context, SQL context, now all of it is encapsulated in a Spark session</li>
<li>Prior Spark 2.0, Spark Context was the entry point of any spark application and used to access all spark features and needed a sparkConf which had all the cluster configs and parameters to create a Spark Context object</li>
</ul>
<p><strong>What's a spark job?</strong> In a spark application, when you invoke an action on RDD, a job is created. It's the main function that has to be done and submitted to spark.<br>
<strong>What's a vault?</strong> Hashicorp Vault is a tool for secrets management, encryption as a service, and privileged access management.<br>
<strong>What's an S3 bucket?</strong> Just a simple distributed file storage system, think of it like the hard disk on your computer</p>
<p><img alt="the tech stack" src="https://www.rohanrajpal.com/_img/expedia/techStack-1600.webp" srcset="/_img/expedia/techStack-96.webp 96w, /_img/expedia/techStack-240.webp 240w, /_img/expedia/techStack-480.webp 480w, /_img/expedia/techStack-960.webp 960w, /_img/expedia/techStack-1600.webp 1600w" sizes="(min-width: 760px) 700px, 100vw" width="2000" height="1600" loading="lazy" decoding="async"></p>
<h3 id="approach">Approach<a class="anchor" aria-label="Link to this section" href="#approach">#</a></h3>
<p><img alt="job" src="https://www.rohanrajpal.com/_img/expedia/experience/datasyncJob-1600.webp" srcset="/_img/expedia/experience/datasyncJob-96.webp 96w, /_img/expedia/experience/datasyncJob-240.webp 240w, /_img/expedia/experience/datasyncJob-480.webp 480w, /_img/expedia/experience/datasyncJob-960.webp 960w, /_img/expedia/experience/datasyncJob-1600.webp 1600w" sizes="(min-width: 760px) 700px, 100vw" width="1866" height="837" loading="lazy" decoding="async"></p>
<p>The spark job</p>
<ul>
<li>Authenticates the vault and gets the secrets</li>
<li>Reads the updated data from MongoDB</li>
<li>Reads the data stored as parquet in S3 bucket</li>
<li>Does a left anti join on s3 and mongo data, you now have the data that did not change</li>
<li>Merge the data that didn't change with the new data with the new data</li>
<li>Write the data as parquet in S3 bucket</li>
</ul>
<p>The authentication was a little better than just sending a saved token:</p>
<ul>
<li>Grab the EC2 metadata and nonce</li>
<li>Send the metadata and nonce to Vault</li>
<li>Vault checks if the EC2 instance is allowed and the nonce is correct</li>
<li>Obtain secrets like AWS access and secret key, and MongoDB password</li>
<li>Send a nonce to the Vault server and get the token</li>
<li>Get the secrets via the token</li>
</ul>
<p>Here's a nice example explaining everything:</p>
<pre class="shiki shiki-themes github-light github-dark-dimmed" style="--shiki-light:#24292e;--shiki-dark:#adbac7;--shiki-light-bg:#fff;--shiki-dark-bg:#22272e" tabindex="0"><code><span class="line"><span>Mongo</span></span>
<span class="line"><span>id author book updateTime</span></span>
<span class="line"><span>1 A1     B1     T1</span></span>
<span class="line"><span>2   A2     B2     T2</span></span>
<span class="line"><span>3   A3     B3     T3</span></span>
<span class="line"><span>4   A4     B4     T4</span></span>
<span class="line"><span>S3</span></span>
<span class="line"><span>1   A1     B1     T1</span></span>
<span class="line"><span>2   A2     B2     T2</span></span>
<span class="line"><span>3   A3     B3     T2.1</span></span>
<span class="line"><span>Step 1:</span></span>
<span class="line"><span>get all docs from mongoDb between updateTime1 and updateTime2 where T2 &#x3C; updateTime1 &#x3C; updateTime2</span></span>
<span class="line"><span>fetched records:</span></span>
<span class="line"><span>3   A3     B3     T3</span></span>
<span class="line"><span>4   A4     B4     T4</span></span>
<span class="line"><span>Step 2:</span></span>
<span class="line"><span>read all records from S3.</span></span>
<span class="line"><span>fetched records:</span></span>
<span class="line"><span>1   A1     B1     T1</span></span>
<span class="line"><span>2   A2     B2     T2</span></span>
<span class="line"><span>3   A3     B3     T2.1</span></span>
<span class="line"><span>Step 3:</span></span>
<span class="line"><span>Left anti join on id between S3 and mongo data so that we have the data that did not change</span></span>
<span class="line"><span>1   A1     B1     T1</span></span>
<span class="line"><span>2   A2     B2     T2</span></span>
<span class="line"><span>Step 4:</span></span>
<span class="line"><span>Merge results of Step 3 with data fetched in Step 1:</span></span>
<span class="line"><span>new data set:</span></span>
<span class="line"><span>1   A1     B1     T1</span></span>
<span class="line"><span>2   A2     B2     T2</span></span>
<span class="line"><span>3   A3     B3     T3</span></span>
<span class="line"><span>4   A4     B4     T4</span></span>
<span class="line"><span>This can be put back to S3. You can see how this data is in sync with Mongo data</span></span></code></pre>
<h3 id="challenges-and-how-i-tackled-them">Challenges (and how I tackled them)<a class="anchor" aria-label="Link to this section" href="#challenges-and-how-i-tackled-them">#</a></h3>
<div class="float-right w-[30%]">
	<img alt="meme on intellij ram usage" class="object-contain" src="https://www.rohanrajpal.com/_img/expedia/experience/intellijMeme-500.webp" srcset="/_img/expedia/experience/intellijMeme-96.webp 96w, /_img/expedia/experience/intellijMeme-240.webp 240w, /_img/expedia/experience/intellijMeme-480.webp 480w, /_img/expedia/experience/intellijMeme-500.webp 500w" sizes="(min-width: 760px) 700px, 100vw" width="500" height="1113" loading="lazy" decoding="async">
</div>
<ul>
<li><strong>VPN Issues:</strong> The VPN I was using did not support Linux or <a href="https://github.com/microsoft/WSL/issues/5068">WSL</a>, so I had to work on windows. Windows is not at all developer-friendly. It was challenging to find a workaround for one-line commands in Linux.
<ul>
<li>However, I found a hack for this. I created an EC2 instance on the Expedia network and shifted all my work to that. Not only I could access all the links, but the scripts ran much faster than on my computer.</li>
</ul>
</li>
<li><strong>RAM Issues:</strong> I initially was using IntelliJ since it was easier to setup a scala project with it. Intellij was terribly slow and took a lot of RAM.
<ul>
<li>I later switched to VSCode plus Metals. Although it was a little more time consuming to setup, once understood, all RAM issues were solved, additionally using bloop instead of sbt decreased compile time.</li>
<li>Having a local MongoDB server for testing was also quite RAM hungry, MongoDB Atlas helped me a lot here. I deployed a free cluster in the cloud, and my work was done :)</li>
</ul>
</li>
<li><strong>Spark and MongoDB</strong>
<ul>
<li>Spark has some underlying concepts which were a little nontrivial to understand, at least for a first-timer like me. Above that the documentation of MongoDB-Spark connector was following old spark conventions at one place and new ones somewhere else. The documentation confused me a bit.</li>
</ul>
</li>
<li><strong>Understanding Vault EC2 authentication</strong>
<ul>
<li>Authentication took most of the time, being a college student, I really didn't worry about securing my applications in projects. Since we really didn't put something into production.</li>
<li>I learned about Hashicorp Vault(Store secrets), Terraform(Build instances from code) and Consul(Backend for Vault)</li>
<li>Rather than having a token to authenticate vault and get the secrets, a better method would be to use the ec2 metadata in which the spark job will be running to authenticate vault.</li>
<li>Making EC2 instances with Terraform and Consul</li>
</ul>
</li>
<li><strong>Setting up EC2 instances</strong>
<ul>
<li>I had some trouble finding the correct configurations so that I am able to SSH into an instance and make sure the instance can access all VPN links.</li>
</ul>
</li>
</ul>
<!-- ## References

### Generic

- [WSL2 , problem with network connection when VPN used (PulseSecure) · Issue #5068 · microsoft/WSL](https://github.com/microsoft/WSL/issues/5068)
- [Stop and remove all docker containers and images \| The humble developer](https://blog.baudson.de/blog/stop-and-remove-all-docker-containers-and-images)
- [Creating a MongoDB replica set using Docker 🍃](https://www.sohamkamani.com/blog/2016/06/30/docker-mongo-replica-set/)
- [Slack/Jira integration: How do I post comments to issues, from Slack?](https://community.atlassian.com/t5/Jira-Core-questions/Slack-Jira-integration-How-do-I-post-comments-to-issues-from/qaq-p/951175)

### Task1 : Mongo change streams to S3 via Kafka

- [What is Apache Kafka®? (A Confluent Lightboard by Tim Berglund)](https://www.youtube.com/watch?v=06iRM1Ghr1k)
- [What is Database Sharding?](https://www.youtube.com/watch?v=5faMjKuB9bc)
- [edenhill/kafkacat: Generic command line non-JVM Apache Kafka producer and consumer](https://github.com/edenhill/kafkacat)
- [Mongo Kafka connector docs](https://docs.mongodb.com/kafka-connector/master/kafka-source/)
- [Getting Started with the MongoDB Connector for Apache Kafka and MongoDB](https://www.confluent.io/blog/getting-started-mongodb-connector-for-apache-kafka-and-mongodb/)
- **Kafka Demo**: [Confluent Platform Demo (cp-demo) — Confluent Platform](https://docs.confluent.io/current/tutorials/cp-demo/docs/index.html?utm_source=github&amp;utm_medium=demo&amp;utm_campaign=ch.cp-demo_type.community_content.cp-demo)
- **What are change streams?**
  - Change streams, a feature introduced in MongoDB 3.6, generate event documents that contain changes to data stored in MongoDB in real-time and provide guarantees of durability, security, and idempotency. You can configure change streams to observe changes at the **collection** , **database** , or **deployment** level. See [An Introduction to Change Streams](https://www.mongodb.com/blog/post/an-introduction-to-change-streams) for more information.
- [Using Change Streams to Keep Up with Your Data](https://www.youtube.com/watch?v=eBGC6z1fPs0)
- **MongoDB kafka guide**
  - [Getting Started with the MongoDB Connector for Apache Kafka and MongoDB](https://www.confluent.io/blog/getting-started-mongodb-connector-for-apache-kafka-and-mongodb/)
  - [Getting started with the MongoDB Connector for Apache Kafka and MongoDB Atlas](https://www.mongodb.com/blog/post/getting-started-with-the-mongodb-connector-for-apache-kafka-and-mongodb-atlas)
  - [https://stackoverflow.com/questions/57544201/implement-dockerized-kafka-sink-connector-to-mongo/57629665#57629665](https://stackoverflow.com/questions/57544201/implement-dockerized-kafka-sink-connector-to-mongo/57629665#57629665)
  - [mongodb/mongo-kafka: MongoDB Kafka Connector](https://github.com/mongodb/mongo-kafka)

### Task2: Create a scala job

- [What is a spark session?](https://medium.com/@achilleus/spark-session-10d0d66d1d24#:~:text=Spark%20session%20is%20a%20unified,encapsulated%20in%20a%20Spark%20session.)
- [What is Scala?](https://www.youtube.com/watch?v=CTRBv45F5I0)
- [Apache Spark™ - Unified Analytics Engine for Big Data](https://spark.apache.org/)
- [Running scala code](http://joelabrahamsson.com/learning-scala-part-three-executing-scala-code/#:~:text=The%20easiest%20way%20to%20execute,folder%20where%20Scala%20is%20installed.)
- [Scala Tutorial 2 - Introduction to SBT (Scala Build Tool)](https://www.youtube.com/watch?v=GD4qyXACuTc)
- [Setup Spark Development Environment – IntelliJ and Scala \| Kaizen](https://kaizen.itversity.com/setup-development-environment-intellij-and-scala-big-data-hadoop-and-spark/)
- [Reference code:](https://github.homeawaycorp.com/AnalyticsEngineering/ae-fast-data-analytics/blob/master/jobs/booking_fact/src/main/scala/com/homeaway/analyticsengineering/task/BookingLifetimeFactLoad.scala#L102-L106)
- [nscala-time/nscala-time: A new Scala wrapper for Joda Time based on scala-time](https://github.com/nscala-time/nscala-time)
- [how can I save an isodate field using MongoSpark.save from mongodb spark connector v2.1?](https://stackoverflow.com/questions/48889946/how-can-i-save-an-isodate-field-using-mongospark-save-from-mongodb-spark-connect)
- [https://spark.apache.org/docs/latest/sql-programming-guide.html#data-types](https://spark.apache.org/docs/latest/sql-programming-guide.html#data-types)
- [How to Master Anti Joins and Apply Them to Business Problems](https://mode.com/blog/anti-join-examples/)
- [MongoDB and Apache Spark - Getting started tutorial](https://www.raphael-brugier.com/blog/mongodb-apache-spark-getting-started-tutorial/)
- [https://docs.databricks.com/data/data-sources/read-parquet.html#reading-parquet-files-notebook](https://docs.databricks.com/data/data-sources/read-parquet.html#reading-parquet-files-notebook)
- [Spark Read and Write Apache Parquet file — Spark by {Examples}](https://sparkbyexamples.com/spark/spark-read-write-dataframe-parquet-example/)
- [Left Anti join in Spark?](https://stackoverflow.com/questions/43186888/left-anti-join-in-spark)
- [Spark DataFrame Union and UnionAll — Spark by {Examples}](https://sparkbyexamples.com/spark/spark-dataframe-union-and-union-all/)
- [SQL A left join B, just A?](https://stackoverflow.com/questions/53949197/isnt-sql-a-left-join-b-just-a/53949327)
- [Install hadoop in 5 steps](http://www.praveenkumarg.com/install-hadoop-with-spark-on-windows-in-just-5-steps/)
- [Spark s3](https://docs.cloudera.com/documentation/enterprise/latest/topics/spark_s3.html)
- [PaaS](https://www.channelfutures.com/strategy/a-multi-paas-strategy-have-your-paas-and-eat-it-too)
- [Setup scala project with Metals and Bloop (Much better than intellij!)](https://scalameta.org/metals/docs/editors/vscode.html#gitignore-projectmetalssbt-metals-and-bloop)
- [blog for scala and bloop](https://medium.com/@afsal.taj06/scala-with-bloop-and-metals-7bfc411502a6)
- [Scala and Sbt using the command line](https://docs.scala-lang.org/getting-started/sbt-track/getting-started-with-scala-and-sbt-on-the-command-line.html)
- [Overwrite a parquet file you just read](https://stackoverflow.com/questions/58013126/how-to-overwrite-a-parquet-file-from-where-dataframe-is-being-read-in-spark)
- [https://github.expedia.biz/scala-platform/ha-scala-commons/tree/master/container/config/config-server-aws-vault/src/main/scala/com/homeaway/hascala/container/config/aws](https://github.expedia.biz/scala-platform/ha-scala-commons/tree/master/container/config/config-server-aws-vault/src/main/scala/com/homeaway/hascala/container/config/aws)
- [https://stackoverflow.com/questions/41253309/connect-to-spark-running-on-vm](https://stackoverflow.com/questions/41253309/connect-to-spark-running-on-vm)
- [What is Qubole?](https://www.youtube.com/watch?v=SBxNXKhwEX8)
- [What is data lake?](https://www.youtube.com/watch?v=v3yv88h68GY)
- [Vault secrets-Wiki](https://wiki.homeawaycorp.com/display/PTA/Vault+Secrets+Integration+for+Qubole+Spark+Jobs)
- [https://www.vaultproject.io/api-docs/auth/aws](https://www.vaultproject.io/api-docs/auth/aws)
- [Ec2 auth vault](https://blog.gruntwork.io/a-guide-to-automating-hashicorp-vault-2-authenticating-with-instance-metadata-c3f9eaeaba53)
- [Vault docs AWS](https://www.vaultproject.io/docs/auth/aws)
- [Link local addresses](https://en.wikipedia.org/wiki/Link-local_address)
- [MicroNugget: What are AWS EC2 Key Pairs?](https://www.youtube.com/watch?v=lMdin-L08p4)
- [Vault on AWS: Creating an EC2 Key Pair](https://www.youtube.com/watch?v=F1KC0khe4SU&amp;t=31s)
- [terraform variable configuration](https://www.terraform.io/docs/configuration/variables.html)
- [terraform setup](https://www.youtube.com/watch?v=RA1mNClGYJ4&t=887s)
- [Spark master slave ec2](https://stackoverflow.com/a/31900096/10114752) -->]]></content:encoded>
</item>
<item>
<title>DBMS Interview Prep Resources</title>
<link>https://www.rohanrajpal.com/blog/dbms-interview-resources</link>
<guid isPermaLink="true">https://www.rohanrajpal.com/blog/dbms-interview-resources</guid>
<pubDate>Fri, 10 Jul 2020 03:30:00 GMT</pubDate>
<description>Some of the best Youtube resources to learn and practice DBMS</description>
<category>Interview prep</category><category>Engineering</category>
<content:encoded><![CDATA[<h2 id="concepts">Concepts<a class="anchor" aria-label="Link to this section" href="#concepts">#</a></h2>
<h3 id="basic-of-dbms-relational-algebra-and-sql">Basic of DBMS, Relational Algebra and SQL<a class="anchor" aria-label="Link to this section" href="#basic-of-dbms-relational-algebra-and-sql">#</a></h3>
<ul>
<li><a href="https://www.youtube.com/playlist?list=PLx5CT0AzDJCnO9k98RsrPY9WGAXj8yeKL">Playlist link</a></li>
</ul>
<iframe title="basics of dbms" width="560" height="315" src="https://www.youtube.com/embed/videoseries?list=PLx5CT0AzDJCnO9k98RsrPY9WGAXj8yeKL" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<h3 id="transaction-management">Transaction Management<a class="anchor" aria-label="Link to this section" href="#transaction-management">#</a></h3>
<ul>
<li><a href="https://www.youtube.com/playlist?list=PLcV9HJoLZqnSlySIzXxAWoAsoRyqUCReg">Playlist link</a></li>
</ul>
<iframe title="transaction management video" width="560" height="315" src="https://www.youtube.com/embed/videoseries?list=PLcV9HJoLZqnSlySIzXxAWoAsoRyqUCReg" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<h2 id="b-trees">B+ Trees<a class="anchor" aria-label="Link to this section" href="#b-trees">#</a></h2>
<iframe title="video explaining B+ trees" width="560" height="315" src="https://www.youtube.com/embed/aZjYr87r1b8" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<h2 id="problems">Problems<a class="anchor" aria-label="Link to this section" href="#problems">#</a></h2>
<ul>
<li><a href="https://www.sanfoundry.com/1000-database-management-system-questions-answers/">Topic wise DBMS questions</a></li>
</ul>]]></content:encoded>
</item>
<item>
<title>Competitive Programming: C++ Cheat Sheet</title>
<link>https://www.rohanrajpal.com/blog/cp-cheat-sheet</link>
<guid isPermaLink="true">https://www.rohanrajpal.com/blog/cp-cheat-sheet</guid>
<pubDate>Sat, 20 Jun 2020 03:30:00 GMT</pubDate>
<description>Snippets I use while doing competitive programming that might help you too!</description>
<category>Engineering</category><category>Interview prep</category>
<content:encoded><![CDATA[<h2 id="improve-speed">Improve speed<a class="anchor" aria-label="Link to this section" href="#improve-speed">#</a></h2>
<h3 id="leetcode">Leetcode<a class="anchor" aria-label="Link to this section" href="#leetcode">#</a></h3>
<pre class="shiki shiki-themes github-light github-dark-dimmed" style="--shiki-light:#24292e;--shiki-dark:#adbac7;--shiki-light-bg:#fff;--shiki-dark-bg:#22272e" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">    static</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067"> int</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> fastio </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">=</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> []() {</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50">        ios</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">::</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB">sync_with_stdio</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF">false</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">);</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">        cin.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB">tie</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF">NULL</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">);</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">        cout.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB">tie</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF">0</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">);</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">        return</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF"> 0</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">;</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">    }();</span></span></code></pre>
<h3 id="normal-compile">Normal compile<a class="anchor" aria-label="Link to this section" href="#normal-compile">#</a></h3>
<pre class="shiki shiki-themes github-light github-dark-dimmed" style="--shiki-light:#24292e;--shiki-dark:#adbac7;--shiki-light-bg:#fff;--shiki-dark-bg:#22272e" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">#define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB"> fast</span><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50"> ios_base</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">::</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB">sync_with_stdio</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF">false</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">),cin.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB">tie</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF">NULL</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">)</span></span></code></pre>
<h2 id="header-template">Header Template<a class="anchor" aria-label="Link to this section" href="#header-template">#</a></h2>
<pre class="shiki shiki-themes github-light github-dark-dimmed" style="--shiki-light:#24292e;--shiki-dark:#adbac7;--shiki-light-bg:#fff;--shiki-dark-bg:#22272e" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">#include</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF">&#x3C;bits/stdc++.h></span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">#define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB"> ll</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067"> long</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067"> long</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">#define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB"> ld</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067"> long</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067"> double</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">#define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB"> vll</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> vector</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">&#x3C;</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">ll</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">></span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">#define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB"> vii</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> vector</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">&#x3C;int></span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">#define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB"> vvll</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> vector</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">&#x3C;</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> vll </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">></span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">#define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB"> pll</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> pair</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">&#x3C;</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">ll ,ll </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">></span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">#define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB"> MOD</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF"> 1000000007</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">#define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB"> rall</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(</span><span style="--shiki-light:#E36209;--shiki-dark:#F69D50">v</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">) v.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB">rbegin</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(),v.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB">rend</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">()</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">#define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB"> fst</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> first</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">#define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB"> mp</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> make_pair</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">#define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB"> pb</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> push_back</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">#define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB"> fast</span><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50"> ios_base</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">::</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB">sync_with_stdio</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF">false</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">),cin.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB">tie</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF">NULL</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">)</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">#define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB"> int</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067"> long</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067"> long</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">#define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB"> endl</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF"> "</span><span style="--shiki-light:#005CC5;--shiki-dark:#F47067">\n</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF">"</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">#define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB"> all</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(</span><span style="--shiki-light:#E36209;--shiki-dark:#F69D50">v</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">) v.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB">begin</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(),v.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB">end</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">()</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">#define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB"> scd</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> second</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">#define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB"> for1</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(</span><span style="--shiki-light:#E36209;--shiki-dark:#F69D50">i</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">,</span><span style="--shiki-light:#E36209;--shiki-dark:#F69D50">n</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">for</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB">ll</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> (i) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF"> 1</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> ; (i) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">&#x3C;=</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> (n) ; </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">++</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(i))</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">#define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB"> forr</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(</span><span style="--shiki-light:#E36209;--shiki-dark:#F69D50">i</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">,</span><span style="--shiki-light:#E36209;--shiki-dark:#F69D50">n</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">for</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB">ll</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> (i) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">=</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> (n)</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">-</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF">1</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> ; (i)</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">>=</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF">0</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> ; </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">--</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(i))</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">#define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB"> forn</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(</span><span style="--shiki-light:#E36209;--shiki-dark:#F69D50">i</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">,</span><span style="--shiki-light:#E36209;--shiki-dark:#F69D50">n</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">for</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB">ll</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> (i) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF"> 0</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> ; (i) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">&#x3C;</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> (n) ; </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">++</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(i))</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">#define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB"> forab</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(</span><span style="--shiki-light:#E36209;--shiki-dark:#F69D50">i</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">,</span><span style="--shiki-light:#E36209;--shiki-dark:#F69D50">a</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">,</span><span style="--shiki-light:#E36209;--shiki-dark:#F69D50">b</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">,</span><span style="--shiki-light:#E36209;--shiki-dark:#F69D50">c</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">for</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB">ll</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> (i) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">=</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> a ; (i) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">&#x3C;=</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> (b) ; (i)</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">+=</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(c))</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">#define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB"> mst</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(</span><span style="--shiki-light:#E36209;--shiki-dark:#F69D50">A</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">) </span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB">memset</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">( (A) , </span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF">0</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> , </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">sizeof</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(A) );</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">#define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB"> tc</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">() </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">int</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> t; cin </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">>></span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> t ; </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">while</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> (t</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">--</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">)</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">using</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067"> namespace</span><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50"> std</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">;</span></span></code></pre>
<h2 id="comparators">Comparators<a class="anchor" aria-label="Link to this section" href="#comparators">#</a></h2>
<pre class="shiki shiki-themes github-light github-dark-dimmed" style="--shiki-light:#24292e;--shiki-dark:#adbac7;--shiki-light-bg:#fff;--shiki-dark-bg:#22272e" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">class</span><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50"> Solution</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> {</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">public:</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">    int</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB"> twoCitySchedCost</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(</span><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50">vector</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">&#x3C;</span><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50">vector</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">&#x3C;</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">int</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">>></span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">&#x26;</span><span style="--shiki-light:#E36209;--shiki-dark:#F69D50"> costs</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">) {</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB">        sort</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(costs.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB">begin</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(),costs.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB">end</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(),[](</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">auto</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067"> &#x26;</span><span style="--shiki-light:#E36209;--shiki-dark:#F69D50">i1</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">,</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">auto</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067"> &#x26;</span><span style="--shiki-light:#E36209;--shiki-dark:#F69D50">i2</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">) -> </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">bool</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> {</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">return</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> i1[</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF">0</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">-</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> i1[</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF">1</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">&#x3C;</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> i2[</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF">0</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">-</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> i2[</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF">1</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">];});</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">        int</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> sum</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF">0</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">;</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">        for</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">int</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> i</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF">0</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">;i</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">&#x3C;</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">costs.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB">size</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">()</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">/</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF">2</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">;i</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">++</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">){</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">            sum </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">+=</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> costs[i][</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF">0</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">+</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> costs[costs.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB">size</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">()</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">-</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF">1</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">-</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">i][</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF">1</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">];</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">        }</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">        return</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> sum;</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">    }</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">};</span></span></code></pre>
<h2 id="pointers-and-addresses">Pointers and Addresses<a class="anchor" aria-label="Link to this section" href="#pointers-and-addresses">#</a></h2>
<p>A pointer stores a memory address.</p>
<p>Some ways to do the same thing</p>
<pre class="shiki shiki-themes github-light github-dark-dimmed" style="--shiki-light:#24292e;--shiki-dark:#adbac7;--shiki-light-bg:#fff;--shiki-dark-bg:#22272e" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">ListNode </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">*</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">root</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">=new</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB"> ListNode</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(),</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">*</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">node</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">=</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">root;</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">ListNode root,</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">*</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">node</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">=&#x26;</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">root;</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390">//node is the same above</span></span></code></pre>
<h2 id="hashmap">Hashmap<a class="anchor" aria-label="Link to this section" href="#hashmap">#</a></h2>
<h3 id="map-of-pairs">Map of pairs<a class="anchor" aria-label="Link to this section" href="#map-of-pairs">#</a></h3>
<pre class="shiki shiki-themes github-light github-dark-dimmed" style="--shiki-light:#24292e;--shiki-dark:#adbac7;--shiki-light-bg:#fff;--shiki-dark-bg:#22272e" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">struct</span><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50"> hash_pair</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> {</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">    template</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> &#x3C;</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">class</span><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50"> T1</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">, </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">class</span><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50"> T2</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">></span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">    size_t</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067"> operator</span><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50">()</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">const</span><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50"> pair</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">&#x3C;</span><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50">T1</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">, </span><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50">T2</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">></span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">&#x26;</span><span style="--shiki-light:#E36209;--shiki-dark:#F69D50"> p</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">const</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">    {</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">        auto</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> hash1 </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">=</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> hash</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">&#x3C;</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">T1</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">></span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">{}(p.first);</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">        auto</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> hash2 </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">=</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> hash</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">&#x3C;</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">T2</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">></span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">{}(p.second);</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">        return</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> hash1 </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">^</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> hash2;</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">    }</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">};</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">unordered_map</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">&#x3C;</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">pair</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">&#x3C;int</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">, </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">int></span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">, </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">bool</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">, hash_pair</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">></span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> um;</span></span></code></pre>
<h3 id="increase-map-speed">Increase map speed<a class="anchor" aria-label="Link to this section" href="#increase-map-speed">#</a></h3>
<pre class="shiki shiki-themes github-light github-dark-dimmed" style="--shiki-light:#24292e;--shiki-dark:#adbac7;--shiki-light-bg:#fff;--shiki-dark-bg:#22272e" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">umap.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB">reserve</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(n)</span></span></code></pre>
<h3 id="string-stuff">String stuff<a class="anchor" aria-label="Link to this section" href="#string-stuff">#</a></h3>
<p>int to string</p>
<pre class="shiki shiki-themes github-light github-dark-dimmed" style="--shiki-light:#24292e;--shiki-dark:#adbac7;--shiki-light-bg:#fff;--shiki-dark-bg:#22272e" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">class</span><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50"> Solution</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> {</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">public:</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50">    vector</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">&#x3C;</span><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50">string</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">> </span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB">fizzBuzz</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">int</span><span style="--shiki-light:#E36209;--shiki-dark:#F69D50"> n</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">) {</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50">        vector</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">&#x3C;</span><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50">string</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">> </span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB">ans</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(n);</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">        for</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">int</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> i</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">=</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF">1</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">;i</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">&#x3C;=</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">n;i</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">++</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">){</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">            if</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(i</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">%</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF">3</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">==</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF">0</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067"> and</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> i</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">%</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF">5</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">==</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF">0</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">) ans[i</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">-</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF">1</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">]</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">=</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF">"FizzBuzz"</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">;</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">            else</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(i</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">%</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF">3</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">==</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF">0</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">) ans[i</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">-</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF">1</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">]</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">=</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF">"Fizz"</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">;</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">            else</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(i</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">%</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF">5</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">==</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF">0</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">) ans[i</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">-</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF">1</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">]</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">=</span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF">"Buzz"</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">;</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">            else</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> ans[i</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">-</span><span style="--shiki-light:#005CC5;--shiki-dark:#6CB6FF">1</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">]</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">=</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB">to_string</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">(i);</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">        }</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">        return</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> ans;</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">    }</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">};</span></span></code></pre>
<h3 id="priority-queue">Priority Queue<a class="anchor" aria-label="Link to this section" href="#priority-queue">#</a></h3>
<pre class="shiki shiki-themes github-light github-dark-dimmed" style="--shiki-light:#24292e;--shiki-dark:#adbac7;--shiki-light-bg:#fff;--shiki-dark-bg:#22272e" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390">//max heap</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">priority_queue </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">&#x3C;int></span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> g </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">=</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> gq;</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#768390">//min heap</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">priority_queue </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">&#x3C;int</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">, vector</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">&#x3C;int></span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">, greater</span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">&#x3C;int>></span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7"> gquiz;</span></span></code></pre>]]></content:encoded>
</item>
<item>
<title>DMRC Connect: Improve your daily commute</title>
<link>https://www.rohanrajpal.com/blog/dmrc-connect</link>
<guid isPermaLink="true">https://www.rohanrajpal.com/blog/dmrc-connect</guid>
<pubDate>Fri, 15 Nov 2019 03:30:00 GMT</pubDate>
<description>While DMRC is putting in full efforts to relay this information to riders, is it really reaching the intended audience? Are complaints being solved fast enough for affected riders to benefit from it? Do all complaints be it from Twitter, or from their helplines come with complete information?</description>
<category>Open source</category><category>Design</category>
<content:encoded><![CDATA[<p>From July-November 2019, my team and I worked on an application. This project was a part of the course: CSE501-Designing Human-Centered Systems.</p>
<div class="text-center">
	<img alt="logo of our app"  class="mx-auto mb-4" src="https://www.rohanrajpal.com/_img/dmrc/logo-276.webp" srcset="/_img/dmrc/logo-96.webp 96w, /_img/dmrc/logo-240.webp 240w, /_img/dmrc/logo-276.webp 276w" sizes="(min-width: 760px) 700px, 100vw" width="276" height="310" loading="lazy" decoding="async">
	<p class="italic">DMRC-Connect</p>
</div>
<h2 id="media-coverage">Media Coverage<a class="anchor" aria-label="Link to this section" href="#media-coverage">#</a></h2>
<p>We were glad that our project was covered by various news channels. Click on any of the images below to read more:</p>
<!-- {% include flexgallery id="media-coverage" caption="Our project featured in news"%} -->
<h2 id="motivation">Motivation<a class="anchor" aria-label="Link to this section" href="#motivation">#</a></h2>
<p>The metro has been the backbone of transport in Delhi NCR, with daily ridership in excess of 5 million riders. It is famous for providing world-class transit with reach to almost all corners of the city with a reputation of punctuality and quality. At the core of these values lie the vision and mission of DMRC that aim to have the best possible experience for riders from all walks of life and have that with trust and reliability.</p>
<p>DMRC has always tried to take an extra step ahead to connect better with the riders and provide them with the best experience. Social media plays an important role in their endeavour to build this connection, with DMRC being active on all social media platforms and constantly engaging with the riders.</p>
<!-- {% twitter https://twitter.com/OfficialDMRC/status/1158191977617227776?s=20 %} -->
<!-- {% twitter https://twitter.com/OfficialDMRC/status/1271368741285060608?s=20 %} -->
<p>However, the question remains, do all Delhi metro users really use Twitter? While DMRC is putting in full efforts to relay this information to riders, is it really reaching the intended audience? Are complaints being solved fast enough for affected riders to benefit from it? Do all complaints be it from Twitter, or from their helplines come with complete information?</p>
<p>Unfortunately, a general trend after rolling out small surveys and talking to users at various metro stations and in and around Delhi, we got to know that this wasn't the case. Not only was social media outreach restricted to those who followed DMRC on Twitter, but this sort of engagement also was never advertised or encouraged by any official metro source.</p>
<h2 id="problem-statement">Problem Statement<a class="anchor" aria-label="Link to this section" href="#problem-statement">#</a></h2>
<h3 id="what-does-dmrc-connect-do">What does DMRC Connect do?<a class="anchor" aria-label="Link to this section" href="#what-does-dmrc-connect-do">#</a></h3>
<p>We create an application that facilitates interaction between DMRC officials and DMRC users and bridges the gap created earlier due to less outreach.</p>
<h3 id="what-are-the-features">What are the features?<a class="anchor" aria-label="Link to this section" href="#what-are-the-features">#</a></h3>
<p>Sticking to the theme of the user and official interaction, the features of DMRC Connect are:</p>
<ol>
<li>Announcements</li>
<li>Complaint registration</li>
<li>Complaint tracking</li>
<li>Quick access helplines</li>
<li>FAQs</li>
</ol>
<h2 id="the-design-process">The Design Process<a class="anchor" aria-label="Link to this section" href="#the-design-process">#</a></h2>
<h3 id="contextual-enquiry">Contextual Enquiry<a class="anchor" aria-label="Link to this section" href="#contextual-enquiry">#</a></h3>
<p>To help understand the problem better and get the user's perspective on it, we set out to interview general metro users about their usage patterns and general behaviour when it comes to complaints. Our aim was to understand the kind of behaviour users have while interacting with current systems and understand whether the current modes of communication were effective or not.</p>
<p>The target audience was any general rider of the metro who was not a minor, and questions ranged from general ones that helped us understand their general behaviour towards tackling issues they faced, to more specific ones that asked the user about their experiences specific to the metro.</p>
<p>A few of the questions were:</p>
<ol>
<li>How often do you face "issues" or "problems" in services offered to you? It could be in an app, it could be during transportation like railway/metro/bus, it could be college or conferences?</li>
<li>Have you ever come across official announcements from Delhi metro? Where did you hear about them?</li>
<li>What problems have you faced in the metro till now? Can you describe any one instance?</li>
</ol>
<p><img alt="affinity diagram" src="https://www.rohanrajpal.com/_img/dmrc/affinityDiagram-1600.webp" srcset="/_img/dmrc/affinityDiagram-96.webp 96w, /_img/dmrc/affinityDiagram-240.webp 240w, /_img/dmrc/affinityDiagram-480.webp 480w, /_img/dmrc/affinityDiagram-960.webp 960w, /_img/dmrc/affinityDiagram-1600.webp 1600w" sizes="(min-width: 760px) 700px, 100vw" width="1600" height="1200" loading="lazy" decoding="async"></p>
<h3 id="lo-fidelity-prototypes">Lo-Fidelity Prototypes<a class="anchor" aria-label="Link to this section" href="#lo-fidelity-prototypes">#</a></h3>
<p>Based on the affinity mapping, we came up with the initial paper prototypes of our application and took them to users for testing through Task Analysis.</p>
<p><img alt="lofi" src="https://www.rohanrajpal.com/_img/dmrc/lofiPrototypes-721.webp" srcset="/_img/dmrc/lofiPrototypes-96.webp 96w, /_img/dmrc/lofiPrototypes-240.webp 240w, /_img/dmrc/lofiPrototypes-480.webp 480w, /_img/dmrc/lofiPrototypes-721.webp 721w" sizes="(min-width: 760px) 700px, 100vw" width="721" height="711" loading="lazy" decoding="async"></p>
<p>Key Findings from v0 and v1:</p>
<ol>
<li>Users went to "Help Centre" to do most tasks related to getting help from DMRC, very few users went to the actual intended target location.</li>
<li>"Contact Us" seemed to be a way to contact the developers rather than DMRC helplines.</li>
<li>Some people went to the complaint section in v2 to find women's helpline.</li>
<li>In helplines, instead of direct calls, users wanted phone numbers to pop-up instead.</li>
</ol>
<h3 id="hi-fidelity-prototypes">Hi-Fidelity Prototypes<a class="anchor" aria-label="Link to this section" href="#hi-fidelity-prototypes">#</a></h3>
<p>After 3 iterations of user testing through Task analysis on the lo-fidelity prototypes, we arrived at the first version of the hi-fidelity prototype and conducted testing on it.</p>
<!-- {% include flexgallery id="hifed-photo" caption="High Fidelity prototypes"%} -->
<p>One of the major changes after user testing on the Hi-Fidelity prototype was to change the colour scheme to one with less hue, i.e primarily blue-based instead of red-based, and to shift from side navigation to bottom navigation instead.</p>
<h3 id="final-color-scheme-and-typography">Final Color Scheme and Typography<a class="anchor" aria-label="Link to this section" href="#final-color-scheme-and-typography">#</a></h3>
<p>The typography used throughout was Roboto, as it is standardly used by Google and the colour scheme is mentioned below.</p>
<img class="dmrc-colorscheme"  alt="dmrc app color scheme" src="https://www.rohanrajpal.com/_img/dmrc/colorScheme-448.webp" srcset="/_img/dmrc/colorScheme-96.webp 96w, /_img/dmrc/colorScheme-240.webp 240w, /_img/dmrc/colorScheme-448.webp 448w" sizes="(min-width: 760px) 700px, 100vw" width="448" height="197" loading="lazy" decoding="async">
<h3 id="final-application">Final Application<a class="anchor" aria-label="Link to this section" href="#final-application">#</a></h3>
<p>The final application, made with help of Android Studio and a Flask backend, was made live on the play store for users to use. The application is available <a href="https://bit.ly/2NVhIEV">here</a>. However, due to lack of resources, we have closed the backend for now.</p>
<!-- {% include flexgallery id="finalapp-photo" caption="The final application"%} -->
<h2 id="dmrc-connect-is-now-open-source">DMRC Connect is now Open Source!<a class="anchor" aria-label="Link to this section" href="#dmrc-connect-is-now-open-source">#</a></h2>
<p>We have released the source code on github. Feel free to clone and play around with it!
<a href="https://github.com/gupta-meghna64/DMRC-Connect">https://github.com/gupta-meghna64/DMRC-Connect</a></p>
<h2 id="building-better-interfaces-bbi2019">Building Better Interfaces #BBI2019<a class="anchor" aria-label="Link to this section" href="#building-better-interfaces-bbi2019">#</a></h2>
<div class="dmrc-container">
  <img class="w-[50%]"  alt="the DMRC team" src="https://www.rohanrajpal.com/_img/dmrc/BBI/them-bois-1024.webp" srcset="/_img/dmrc/BBI/them-bois-96.webp 96w, /_img/dmrc/BBI/them-bois-240.webp 240w, /_img/dmrc/BBI/them-bois-480.webp 480w, /_img/dmrc/BBI/them-bois-960.webp 960w, /_img/dmrc/BBI/them-bois-1024.webp 1024w" sizes="(min-width: 760px) 700px, 100vw" width="1024" height="683" loading="lazy" decoding="async">
  <img class="dmrc-station"  alt="the bbi team" src="https://www.rohanrajpal.com/_img/dmrc/BBI/bbi-station-1280.webp" srcset="/_img/dmrc/BBI/bbi-station-96.webp 96w, /_img/dmrc/BBI/bbi-station-240.webp 240w, /_img/dmrc/BBI/bbi-station-480.webp 480w, /_img/dmrc/BBI/bbi-station-960.webp 960w, /_img/dmrc/BBI/bbi-station-1280.webp 1280w" sizes="(min-width: 760px) 700px, 100vw" width="1280" height="960" loading="lazy" decoding="async">
  <img class="dmrc-prop"  alt="props used during bbi" src="https://www.rohanrajpal.com/_img/dmrc/BBI/bbi-mainprop-720.webp" srcset="/_img/dmrc/BBI/bbi-mainprop-96.webp 96w, /_img/dmrc/BBI/bbi-mainprop-240.webp 240w, /_img/dmrc/BBI/bbi-mainprop-480.webp 480w, /_img/dmrc/BBI/bbi-mainprop-720.webp 720w" sizes="(min-width: 760px) 700px, 100vw" width="720" height="1280" loading="lazy" decoding="async">
  <img class="dmrc-director"  alt="with the director of IIITD" src="https://www.rohanrajpal.com/_img/dmrc/BBI/director-1024.webp" srcset="/_img/dmrc/BBI/director-96.webp 96w, /_img/dmrc/BBI/director-240.webp 240w, /_img/dmrc/BBI/director-480.webp 480w, /_img/dmrc/BBI/director-960.webp 960w, /_img/dmrc/BBI/director-1024.webp 1024w" sizes="(min-width: 760px) 700px, 100vw" width="1024" height="683" loading="lazy" decoding="async">
  <img class="dmrc-with-pk"  alt="with pk" src="https://www.rohanrajpal.com/_img/dmrc/BBI/with-pk-960.webp" srcset="/_img/dmrc/BBI/with-pk-96.webp 96w, /_img/dmrc/BBI/with-pk-240.webp 240w, /_img/dmrc/BBI/with-pk-480.webp 480w, /_img/dmrc/BBI/with-pk-960.webp 960w" sizes="(min-width: 760px) 700px, 100vw" width="960" height="720" loading="lazy" decoding="async">
</div>
<h2 id="team-members">Team members<a class="anchor" aria-label="Link to this section" href="#team-members">#</a></h2>
<ul>
<li>Rohan Rajpal <a href="https://github.com/rohanrajpal">https://github.com/rohanrajpal</a></li>
<li>Meghna Gupta <a href="https://github.com/gupta-meghna64">https://github.com/gupta-meghna64</a></li>
<li>Saatvik Jain <a href="https://github.com/saatvikj">https://github.com/saatvikj</a></li>
<li>Tanya Gupta <a href="https://github.com/Tanya16107">https://github.com/Tanya16107</a></li>
<li>Siddharth Yadav <a href="https://github.com/sedflix">https://github.com/sedflix</a></li>
</ul>]]></content:encoded>
</item>
<item>
<title>My GSoC experience with VideoLAN: Redesigning the VLC media player</title>
<link>https://www.rohanrajpal.com/blog/gsoc-with-vlc</link>
<guid isPermaLink="true">https://www.rohanrajpal.com/blog/gsoc-with-vlc</guid>
<pubDate>Mon, 12 Aug 2019 03:30:00 GMT</pubDate>
<description>My Google Summer of Code experience of working with VideoLAN.</description>
<category>Engineering</category><category>Open source</category>
<content:encoded><![CDATA[<h2 id="introduction">Introduction<a class="anchor" aria-label="Link to this section" href="#introduction">#</a></h2>
<div class="flex items-center">
    <p>
    This summer, I participated as a <a href="https://summerofcode.withgoogle.com/">Google Summer of Code</a> student under VideoLAN. GSoC is undoubtedly one of the best summer programs out there. From designing interfaces and interactions to writing production-level code, I've learned tons of exciting stuff!
    I was blessed to have great mentors and learned a lot about the open-source community.
    </p>
    <img alt="profile" class="w-32" src="https://www.rohanrajpal.com/_img/gsoc/videoLANLogo-300.webp" srcset="/_img/gsoc/videoLANLogo-96.webp 96w, /_img/gsoc/videoLANLogo-240.webp 240w, /_img/gsoc/videoLANLogo-300.webp 300w" sizes="(min-width: 760px) 700px, 100vw" width="300" height="300" loading="lazy" decoding="async">
</div>
<h3 id="project-and-proposal">Project and Proposal<a class="anchor" aria-label="Link to this section" href="#project-and-proposal">#</a></h3>
<p>The VLC media player has an Editor which enables you to customize the player controlbar UI; you can arrange buttons like the play button as per your liking. My main task was to implement this Editor functionality in the new UI for VLC.</p>
<p>You can have a look at my <a href="https://summerofcode.withgoogle.com/projects/#5519642150305792">project page</a> on the GSoC website. Feel free to check out my <a href="https://docs.google.com/document/d/1h6ABFFuIs7gJh4_zwkN23aYkeuDNsn3GkMUPgzeB7OI/edit">proposal.</a></p>
<h3 id="patches">Patches<a class="anchor" aria-label="Link to this section" href="#patches">#</a></h3>
<p>I made an account on <a href="https://code.videolan.org">VideoLAN's Gitlab</a> and worked on <a href="https://code.videolan.org/rohanrajpal/vlc-qml">this</a> repository. I used to push all my commits there to get them reviewed. Then made patches out of them and sent commits to the VLC-developer mailing list. A few other people would then review the patches. Finally, after making the required changes, the patches would get merged.</p>
<p><a href="https://patches.videolan.org/project/vlc-devel/list/?submitter=908&#x26;state=*">Here is a list of all my patches.</a></p>
<h2 id="the-team">The Team<a class="anchor" aria-label="Link to this section" href="#the-team">#</a></h2>
<p>A big thanks to the team and my mentors who helped me with my endless doubts!</p>
<ul>
<li><a href="https://code.videolan.org/AbelTesfaye">Abel Tesfaye</a> (GSoC Student)</li>
<li><a href="https://mail.google.com/mail/u/0/?view=cm&#x26;fs=1&#x26;tf=1&#x26;source=mailto&#x26;to=kohli.sagar2@gmail.com">Sagar Kohli</a> (GSoC Student)</li>
<li><a href="https://code.videolan.org/jbk">Jean-Baptiste Kempf</a> (VideoLAN president)</li>
<li><a href="https://code.videolan.org/chub">Pierre Lamot</a> (Software engineer at Videolabs)</li>
<li><a href="https://code.videolan.org/alexandre-janniaux">Alexandre Janniaux</a> (Software engineer at Videolabs)</li>
<li><a href="https://code.videolan.org/rohanrajpal">Rohan Rajpal</a> (Me)</li>
</ul>
<p>Our communication was mainly via emails and #vlc-gsoc on IRC.</p>
<h2 id="the-project">The Project<a class="anchor" aria-label="Link to this section" href="#the-project">#</a></h2>
<h3 id="what-work-was-done">What work was done?<a class="anchor" aria-label="Link to this section" href="#what-work-was-done">#</a></h3>
<p>I had made some contributions towards the player controlbar and further wanted to work on it. Jean then suggested I should work on the Editor. Making the Editor was a big task to do, we divided it into the following parts:</p>
<ol>
<li>Create a model of all the buttons/widgets on the player ControlBar.</li>
<li>Load the player buttons from the model instead of hardcoding them.</li>
<li>Make a simple drag and drop interface which changes the model by dragging and dropping and updates the config</li>
<li>Make a View from which you can drag and add buttons to the player ControlBar.</li>
<li>Add profiles combobox via which you can load, make and delete configurations for the player.</li>
<li>Populate the miniplayer from the model</li>
<li>Make miniplayer editable and add a tab for it in the editor</li>
</ol>
<p>I have also worked on a few other things</p>
<ol>
<li>Add all the missing buttons and widgets. I've added the following:
<ul>
<li>Volume Widget<br>
<img loading="lazy" decoding="async" src="https://www.rohanrajpal.com/gsoc/volumeDemo.gif" alt="volume"></li>
<li>Teletext Widget<br>
<img alt="teletext" src="https://www.rohanrajpal.com/_img/gsoc/teletextPopup-405.webp" srcset="/_img/gsoc/teletextPopup-96.webp 96w, /_img/gsoc/teletextPopup-240.webp 240w, /_img/gsoc/teletextPopup-405.webp 405w" sizes="(min-width: 760px) 700px, 100vw" width="405" height="152" loading="lazy" decoding="async"></li>
<li>Aspect Ratio widget<br>
<img alt="aspect" src="https://www.rohanrajpal.com/_img/gsoc/aspectRatioWidget-138.webp" srcset="/_img/gsoc/aspectRatioWidget-96.webp 96w, /_img/gsoc/aspectRatioWidget-138.webp 138w" sizes="(min-width: 760px) 700px, 100vw" width="138" height="70" loading="lazy" decoding="async"></li>
<li>Record button</li>
<li>Spacer widget</li>
<li>Extended Spacer widget</li>
<li>FullScreen button</li>
<li>Record button</li>
<li>AB Loop button</li>
<li>Snapshot button</li>
<li>Stop button</li>
<li>Media Info button</li>
<li>Frame by frame button</li>
<li>Faster button</li>
<li>Slower button</li>
<li>Open media button</li>
<li>Extended settings button</li>
<li>Step forward button</li>
<li>Step backward button</li>
<li>Quit button</li>
</ul>
</li>
<li>Create a topbar for non editable buttons
<img alt="topBar" src="https://www.rohanrajpal.com/_img/gsoc/topBar-1295.webp" srcset="/_img/gsoc/topBar-96.webp 96w, /_img/gsoc/topBar-240.webp 240w, /_img/gsoc/topBar-480.webp 480w, /_img/gsoc/topBar-960.webp 960w, /_img/gsoc/topBar-1295.webp 1295w" sizes="(min-width: 760px) 700px, 100vw" width="1295" height="84" loading="lazy" decoding="async"></li>
</ol>
<h3 id="whats-left-to-do">What's left to do?<a class="anchor" aria-label="Link to this section" href="#whats-left-to-do">#</a></h3>
<p>Although I completed every task I was assigned, below-mentioned tasks are best suited as a follow-up for my work done:</p>
<ol>
<li>If too many widgets come on one side the center buttons don't remain in the center anymore. This has to be fixed.</li>
<li>The design of the Teletext and a few other widgets isn't final and work needs to be done.</li>
</ol>
<h2 id="demo">Demo<a class="anchor" aria-label="Link to this section" href="#demo">#</a></h2>
<p>Have a look on how the VLC Editor works below:</p>
<div class="video"><iframe src="https://www.youtube.com/embed/xOE-sx4Gark" title="YouTube video" loading="lazy" allow="accelerometer; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div>
<h2 id="highlights-and-challenges">Highlights and Challenges<a class="anchor" aria-label="Link to this section" href="#highlights-and-challenges">#</a></h2>
<h3 id="make-a-generic-player-controlbar">Make a generic player controlbar<a class="anchor" aria-label="Link to this section" href="#make-a-generic-player-controlbar">#</a></h3>
<p>The first task was to make a model that had all the button and widget data. Then I had to use that model to populate the player ControlBar. Loaders are quite helpful when you have to load a component in QML.</p>
<pre class="shiki shiki-themes github-light github-dark-dimmed" style="--shiki-light:#24292e;--shiki-dark:#adbac7;--shiki-light-bg:#fff;--shiki-dark-bg:#22272e" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">Loader {</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">id: myLoader</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">source: </span><span style="--shiki-light:#032F62;--shiki-dark:#96D0FF">"MyItem.qml"</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">}</span></span></code></pre>
<p>After making the buttons model. The next step was to make a QtAbstractListModel to maintain a list of the buttons in current config. This is how the player ControlBar is populated now:</p>
<ul>
<li>The model would load the config from VLC Core API.</li>
<li>The player controlbar model would then add the respective buttons to the list.</li>
<li>The main controlbar would then use this model to get the list and ids which would then load the button from the buttons model.</li>
</ul>
<h3 id="make-sure-vlc-is-accessible-via-keyboard">Make sure VLC is accessible via keyboard<a class="anchor" aria-label="Link to this section" href="#make-sure-vlc-is-accessible-via-keyboard">#</a></h3>
<p>One had to make sure that VLC is easily useable via the Keyboard as well. KeyNavigation and Focuscope are the critical things you'll work with when you are working with Focus.</p>
<p>With a lot of documentation reading, experimenting, and Pierre's help, I successfully got the KeyNavigation right.</p>
<h3 id="drag-and-drop">Drag and Drop<a class="anchor" aria-label="Link to this section" href="#drag-and-drop">#</a></h3>
<p>We all use drag and drop interfaces quite frequently. Making such interfaces made me understand the design and the logic behind it.</p>
<p>To make an item draggable, you have to set it as a drag target. Similarly, to make it possible to drop a draggable, you need to declare a DropArea.</p>
<p>I also had to add functionalities like move, insert and delete to the model, because Drag and Drop involve all these actions.<br>
Have a look at some of the actions below:<br>
<img loading="lazy" decoding="async" src="https://www.rohanrajpal.com/gsoc/DNDDemo.gif" alt="dnd demo"></p>
<p>The next task was to code the cancel and close buttons. The player controlbar should only be updated when the user presses the close button. To implement this, I used signals.</p>
<p>When you press the close button, the toolbarConfUpdated signal emits, and the playerControlBar is updated.</p>
<p><a href="https://doc.qt.io/archives/qt-4.8/signalsandslots.html">Signals and Slots</a> are used for communication between objects in Qt. Here's the signal sent when toolbar is updated:</p>
<pre class="shiki shiki-themes github-light github-dark-dimmed" style="--shiki-light:#24292e;--shiki-dark:#adbac7;--shiki-light-bg:#fff;--shiki-dark-bg:#22272e" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">if</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">( toolbarEditor-></span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB">exec</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">() </span><span style="--shiki-light:#D73A49;--shiki-dark:#F47067">==</span><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50"> QDialog</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">::Accepted )</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#F69D50">emit</span><span style="--shiki-light:#6F42C1;--shiki-dark:#DCBDFB"> toolBarConfUpdated</span><span style="--shiki-light:#24292E;--shiki-dark:#ADBAC7">();</span></span></code></pre>
<h3 id="hinting-the-user">Hinting the user<a class="anchor" aria-label="Link to this section" href="#hinting-the-user">#</a></h3>
<p>For the user to easily use the drag and drop interface, we have to provide some hints.<br>
When you hover over a draggable item, the cursor changes to an open hand cursor. If you click and hold over it, the cursor changes to a closed hand cursor.<br>
<img alt="cursor shape" src="https://www.rohanrajpal.com/_img/gsoc/cursorShape-134.webp" srcset="/_img/gsoc/cursorShape-96.webp 96w, /_img/gsoc/cursorShape-134.webp 134w" sizes="(min-width: 760px) 700px, 100vw" width="134" height="79" loading="lazy" decoding="async"><br>
The cursor changes to ForbiddenCursor if you take the draggable to a place where it's not possible to drop.</p>
<h3 id="profiles">Profiles<a class="anchor" aria-label="Link to this section" href="#profiles">#</a></h3>
<p>Profiles help someone easily save their preferences. For this, I kept the configs of both the player and the mini-player controlbar and split them using a delimiter.
<img loading="lazy" decoding="async" src="https://www.rohanrajpal.com/gsoc/profileDemo.gif" alt="profile demo"></p>
<h3 id="different-parts-of-the-editor">Different parts of the Editor<a class="anchor" aria-label="Link to this section" href="#different-parts-of-the-editor">#</a></h3>
<p>One interesting thing about this editor is that it is a mix of QML and Qt/C++. The window, profiles section and action buttons are coded in Qt. The whole drag and drop part is in QML.</p>
<p>Why use Qt when all can be done in QML? Because:</p>
<ul>
<li>qml takes more ram</li>
<li>qml accessibility is hard to get</li>
<li>qml is harder to debug, and helps doing some big qml files, which we want to avoid at all cost.</li>
</ul>
<p>The picture below shows the division.
<img alt="Alt Text" src="https://www.rohanrajpal.com/_img/gsoc/EditorDivision-800.webp" srcset="/_img/gsoc/EditorDivision-96.webp 96w, /_img/gsoc/EditorDivision-240.webp 240w, /_img/gsoc/EditorDivision-480.webp 480w, /_img/gsoc/EditorDivision-800.webp 800w" sizes="(min-width: 760px) 700px, 100vw" width="800" height="624" loading="lazy" decoding="async"></p>
<h3 id="things-i-learned">Things I learned<a class="anchor" aria-label="Link to this section" href="#things-i-learned">#</a></h3>
<ul>
<li>Git
<ul>
<li><a href="https://fle.github.io/git-tip-keep-your-branch-clean-with-fixup-and-autosquash.html">Tricks</a> like fixup and autosquash help a lot in keeping the commits clean.</li>
<li>Rebase and reset is quite helpful when you need to edit or rearrange commits.</li>
<li>How to work with patches, send emails from git directly.</li>
<li>Handling merge conflicts like a pro.</li>
<li>How to split commits? A nice trick is if the commit message has bullet points, it can further be split.</li>
</ul>
</li>
<li>Code
<ul>
<li>Avoid writing <a href="https://www.youtube.com/watch?v=-AQfQFcXac8">over-engineered</a> code</li>
<li>How to work on a huge codebase. Things like Memory leaks, ram consumption, learned how to use the VLC Core API.</li>
<li>Design patterns like the <a href="https://wiki.qt.io/D-Pointer">D-pointer strategy</a> and <a href="https://doc.qt.io/qt-5/qtquick-modelviewsdata-modelview.html">Model View Delegate</a>.</li>
<li>Qt/C++, QML and writing production-level code in them.</li>
<li>QtCreator, one of the best IDEs I've used.</li>
</ul>
</li>
<li>Design
<ul>
<li>Learned design concepts like form follows the flow.</li>
<li>Prototyping, brainstorming on interactions.</li>
<li>Clipping</li>
<li>Thinking design solutions keeping the code in mind.</li>
</ul>
</li>
</ul>]]></content:encoded>
</item>
</channel>
</rss>