<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by M. Cheema on Medium]]></title>
        <description><![CDATA[Stories by M. Cheema on Medium]]></description>
        <link>https://medium.com/@astroporjecting?source=rss-7592577a9b0a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*p2356-jSHXVVvmiaGnjH0Q.jpeg</url>
            <title>Stories by M. Cheema on Medium</title>
            <link>https://medium.com/@astroporjecting?source=rss-7592577a9b0a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 17:42:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@astroporjecting/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[What Digital Marketing Actually Is]]></title>
            <link>https://medium.com/@astroporjecting/what-digital-marketing-actually-is-282463026000?source=rss-7592577a9b0a------2</link>
            <guid isPermaLink="false">https://medium.com/p/282463026000</guid>
            <category><![CDATA[blog]]></category>
            <category><![CDATA[digital-marketing]]></category>
            <category><![CDATA[marketing]]></category>
            <dc:creator><![CDATA[M. Cheema]]></dc:creator>
            <pubDate>Mon, 09 Feb 2026 02:58:12 GMT</pubDate>
            <atom:updated>2026-02-09T02:58:12.715Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Digital marketing </em>refers to any marketing effort that uses the internet or electronic devices to reach customers. This includes channels like search engines, social media, email, websites, online videos, and even in-app experiences. In today’s environment, nearly every interaction that happens online is a potential marketing touchpoint, which makes digital marketing <strong>one of the most important parts of modern business strategy.</strong></p><h3>Define your Audience</h3><p>Even though most people are online, businesses cannot effectively market to everyone at once. Instead, they create <em>buyer personas</em>, which are semi-fictional profiles of their ideal customers based on research and real data. These personas help teams understand <strong>who they’re trying to reach</strong>, what problems those people have, and what type of messaging will resonate with them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*nvcC5zXAOuIhx1q-.jpg" /></figure><p>For business-to-business companies, this might include job roles, company size, and operational challenges. For consumer-focused companies, it may involve age, lifestyle, and interests. When the audience is clearly defined, marketing becomes more <strong>focused and effective.</strong></p><h3>Be Present</h3><p>People spend several hours online every day, but they don’t all gather in the same places. A software engineer might scroll LinkedIn, while a teenager may spend most of their time on TikTok or YouTube. This means a single marketing channel rarely reaches everyone.</p><p>By showing up in the <strong>right places with the right message</strong>, marketing becomes more relevant and far more effective. Once a company understands where its audience spends time, it can focus its efforts there instead of trying to be everywhere at once. This usually means combining paid ads, organic posts, and partnerships with creators or communities that already have trust and attention.</p><h3>Build An Effective Funnel</h3><p>Reaching someone online is only the first step. The real goal is to guide them from being a stranger to becoming a customer. This process is usually described as a <em>funnel </em>with several stages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sq3hhOCskm4XrFs8nlmCOw.png" /></figure><p><strong>At the top</strong>, the focus is on attracting attention through content, ads, or social media. <strong>In the middle</strong>, the goal is to convert interested visitors into leads, often by offering something valuable like a free trial, discount, or downloadable resource. <strong>At the bottom of the funnel</strong>, the focus shifts to closing the deal through targeted messages, follow-ups, or special offers.</p><p>Each stage has a different purpose, and together they create a structured path toward conversion.</p><h3>Monitor and Report on Performance</h3><p>One of the biggest advantages of digital marketing is that <strong>nearly everything can be measured</strong>. Teams can track how many people see an ad, click a link, sign up for a service, or make a purchase.</p><p>This data helps marketers understand <strong>what is working and what isn’t</strong>. Instead of guessing which campaigns are effective, they can use <em>analytics</em> to make informed decisions and improve results over time. Monitoring also includes paying attention to what people are saying about the brand online, so companies can respond quickly to feedback, both positive and negative.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nE-1Qpu30HqCfHMU.png" /></figure><h3>Consistency is Key</h3><p>Digital Marketing is a <strong>two-way conversation</strong> between a brand and its audience. Companies listen, respond, adjust their strategies, and continually improve based on <strong>real data and real interactions.</strong></p><p>The more willing a brand is about understanding the changing demands of their audience, the more likely it becomes in succeeding. In the beginning, major overhauls may be needed to align with present market values but with consistency, changes become less costly and the branding becomes more consistent.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=282463026000" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Google Ads Helps Businesses Get Clients]]></title>
            <link>https://medium.com/@astroporjecting/how-google-ads-helps-businesses-get-clients-5a121e9812d7?source=rss-7592577a9b0a------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a121e9812d7</guid>
            <category><![CDATA[marketing]]></category>
            <category><![CDATA[google-analytics]]></category>
            <category><![CDATA[google-ads]]></category>
            <category><![CDATA[advertising]]></category>
            <dc:creator><![CDATA[M. Cheema]]></dc:creator>
            <pubDate>Sun, 08 Feb 2026 17:39:47 GMT</pubDate>
            <atom:updated>2026-02-08T17:39:47.432Z</atom:updated>
            <content:encoded><![CDATA[<p>Google Ads is built around a simple idea: someone searches for a solution, and your business appears at the exact moment they’re looking for it. When a user types a question or problem into Google, the search results page shows two types of content</p><ol><li><strong>Organic results</strong> (free listings)</li><li><strong>Paid ads</strong> at the top.</li></ol><p>Google Ads allows businesses to pay for that top placement so they can reach potential customers immediately.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xlMQZrJZyFLKoRXd.jpg" /></figure><h3>How it Works</h3><p>The system works on a <strong>pay-per-click (PPC)</strong> model. Businesses choose keywords that people might search for and set a bid for how much they’re willing to pay when someone clicks their ad. When multiple advertisers target the same keyword, Google runs an <strong>auction </strong>to decide which ads appear and in what order. The winning ads are then placed in the top positions on the <strong>Search Engine Results Page</strong> (<strong>SERP</strong>), increasing their visibility to potential customers. Advertisers are only charged when someone actually clicks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*ohbMwfK2l9855paHr7Z5FQ.png" /></figure><p>Google ranks ads using a metric called <strong>Ad Rank</strong>, which considers factors such as:</p><ul><li>Bid amount</li><li>Ad relevance</li><li>Expected <strong>click-through rate </strong>(<strong>CTR</strong>)</li><li>Landing page quality</li><li>Search context</li></ul><p>Only ads that meet Google’s quality thresholds are displayed. The available space on the <strong>SERP</strong> also affects how many ads appear. Featured snippets, or smaller mobile screens can reduce the number of ad slots. In practice, users often see up to four ads at the top and a few at the bottom, but the exact number varies depending on the auction and overall page layout.</p><h3>Why Businesses use it</h3><p>Businesses use Google Ads because it delivers fast, targeted, and measurable results. Instead of waiting months to climb organic rankings through <strong>Search Engine Optimization (SEO),</strong> companies can appear at the top of the SERP as soon as their ads go live. The traffic is also high intent, since users are actively searching for a specific product or solution, which often leads to stronger conversion rates.</p><p>Another key advantage is <strong>full performance visibility</strong>. This makes it easier to control budgets, test different approaches, and improve performance over time. The combination of immediate visibility, qualified traffic, and clear data makes Google Ads a practical and reliable channel for generating results.</p><h3>Is Google Ads Enough to Get Clients?</h3><p><em>In many cases, not by itself.</em></p><p>Google Ads works like a funnel. At the top, a large number of people search for a keyword, but only a<strong> </strong>small percentage will click an ad. From those clicks, an even smaller percentage will become <strong>leads </strong>or customers. This is why optimization matters. Better<strong> </strong>keyword targeting brings more qualified searches, stronger ad copy improves CTR, and a better <strong>landing page</strong> increases conversions. Even small improvements at each step of the funnel can compound into significantly better overall results.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a121e9812d7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is CAD]]></title>
            <link>https://medium.com/@astroporjecting/what-is-cad-ce4510e212c8?source=rss-7592577a9b0a------2</link>
            <guid isPermaLink="false">https://medium.com/p/ce4510e212c8</guid>
            <category><![CDATA[cad]]></category>
            <category><![CDATA[computers]]></category>
            <category><![CDATA[history]]></category>
            <dc:creator><![CDATA[M. Cheema]]></dc:creator>
            <pubDate>Fri, 06 Feb 2026 05:13:13 GMT</pubDate>
            <atom:updated>2026-02-06T05:13:13.426Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ShEgtQ9rnhZ9xBER.png" /></figure><p><strong>CAD </strong>stands for Computer-Aided Design. It’s the practice of using software to design, modify, analyze, and document real-world objects before they’re built. This can include parts, assemblies, buildings, tools, or products.</p><h3>Sketchpad</h3><p>CAD really <em>came about</em> in the early 1960s, when computers stopped being just calculators and started being interactive. The breakthrough really happened in 1963, when <strong>Ivan Sutherlan</strong>d, a PhD student in MIT, created a computer program called Sketchpad.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HF9fg_nLNtrHNe0O.png" /><figcaption>Ivan Sutherland using a light pen to interact with Sketchpad (1963), the first system to introduce constraints and parametric drawing.</figcaption></figure><p><strong>Sketchpad </strong>introduced ideas that still define CAD today: drawing directly on a screen, constraints (this line stays horizontal), relationships (this point stays attached), and parametric editing. In the 1970s and 1980s, large companies like IBM, Lockheed, and General Motors took Sutherland’s ideas and began building proprietary CAD systems around them. This was the beginning of CAD becoming commercially and industrially useful.</p><h3>AutoCAD and CATIA</h3><p>By the late 80s, two branches begin to emerge. Whenever a product is being architected, there is always a<em> drafting phase</em> before precise blueprints come about. Such was the case here: one branch focused on general-purpose drafting to capture layouts and plans quickly, while the other pushed toward exact 3D models meant to define the product itself and drive manufacturing.</p><p>The drafting-oriented branch crystallized around <strong>AutoCAD</strong>, which brought CAD to personal computers and focused on fast, flexible 2D drawings such as floor plans, schematics, layouts, and construction documents that directly replaced the drafting table. In parallel, the product-definition branch was embodied by <strong>CATIA</strong>, a high-end system built for aerospace and automotive work, where complex 3D geometry, surface modeling, and large assemblies needed to be defined precisely and carried through to manufacturing. Together, they formalized the split between drafting as representation and CAD as the<em> source of truth</em> for how a product is actually built.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*secVms4s1IXfn_vD" /><figcaption>AutoCAD</figcaption></figure><p>By running on personal computers instead of expensive workstations, AutoCAD let small firms, independent architects, contractors, and engineers use CAD without corporate or government backing. By the 90s, CAD had now started to become a standard part of professional work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-PFk2tQ2Bne9voaX.jpg" /><figcaption>CATIA</figcaption></figure><p>CATIA, on the other hand, was very special because it treated the digital model as the product itself, not just a drawing of it. It could handle complex 3D surfaces, tight tolerances, and massive assemblies in a single coherent system. That mattered for aerospace and automotive work, where a small geometric error can cascade into manufacturing failures.</p><p>Beyond being just a CAD tool, CATIA was an all-inclusive designing tool. An entire car, engine, or aircraft could be designed in CATIA before anything physical existed, and with precision too.</p><h3>SolidWorks</h3><p>The problem with CATIA was that it ran on high-end engineering workstations with dedicated graphics hardware. Naturally, this meant that CATIA was not very accessible to the public or small businesses alike. Not too long after, however, tools like <strong>SolidWorks </strong>began to emerge. A solution to the problem.</p><p>SolidWorks took CATIA-level ideas like features, constraints, <em>design intent </em>and ran them on personal computers with a focus on usability. CAD, now, became a daily design tool for mechanical engineers designing real products.</p><p>From there, CAD stabilized into what we largely still use today: parametric parts, assemblies, drawings, and downstream integration with simulation and manufacturing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ce4510e212c8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Extract All URLs from a Webpage]]></title>
            <link>https://medium.com/@astroporjecting/extract-all-urls-from-a-webpage-89432da82e8b?source=rss-7592577a9b0a------2</link>
            <guid isPermaLink="false">https://medium.com/p/89432da82e8b</guid>
            <category><![CDATA[technical-writing]]></category>
            <dc:creator><![CDATA[M. Cheema]]></dc:creator>
            <pubDate>Mon, 02 Feb 2026 02:18:13 GMT</pubDate>
            <atom:updated>2026-02-02T02:18:13.383Z</atom:updated>
            <content:encoded><![CDATA[<p>The following code <em>prints </em>all links on a given webpage. In the example, the url of the webpage is https://example.com .</p><pre>import requests<br>from bs4 import BeautifulSoup<br> <br>url = &#39;https://example.com&#39;<br>response = requests.get(url)<br>soup = BeautifulSoup(response.text, &#39;html.parser&#39;)<br> <br># Extracting data, e.g., all the links on the page<br>links = soup.find_all(&#39;a&#39;)<br>for link in links:<br>    print(link.get(&#39;href&#39;))</pre><h4>Importing Modules</h4><p>An error can occur if bs4 module is not installed:</p><pre>Traceback (most recent call last):<br>  File &quot;c:\scrape.py&quot;, line 2, in &lt;module&gt;<br>    from bs4 import BeautifulSoup<br>ModuleNotFoundError: No module named &#39;bs4&#39;</pre><p>This can be fixed by installing the modules using pip :</p><pre>pip install requests <br>pip install bs4</pre><h3>Output</h3><p>Depending on the url , the script will return a different output. Here’s the output for <a href="https://example.com/">https://example.com/</a></p><pre>https://iana.org/domains/example</pre><h4>Modifying the URL</h4><pre>url = &#39;https://google.com&#39;</pre><h4>Output of new URL</h4><pre>https://www.google.com/imghp?hl=en&amp;tab=wi<br>https://maps.google.com/maps?hl=en&amp;tab=wl<br>https://play.google.com/?hl=en&amp;tab=w8<br>https://www.youtube.com/?tab=w1<br>https://news.google.com/?tab=wn<br>https://mail.google.com/mail/?tab=wm<br>https://drive.google.com/?tab=wo<br>https://www.google.com/intl/en/about/products?tab=wh<br>http://www.google.com/history/optout?hl=en<br>/preferences?hl=en<br>https://accounts.google.com/ServiceLogin?hl=en&amp;passive=true&amp;continue=https://www.google.com/&amp;ec=GAZAAQ    <br>/advanced_search?hl=en&amp;authuser=0<br>/intl/en/ads/<br>/services/<br>/intl/en/about.html<br>/intl/en/policies/privacy/<br>/intl/en/policies/terms/</pre><blockquote>This example demonstrates the basics of fetching and parsing HTML using Python. For more complex extraction or navigation, refer to the <a href="https://www.crummy.com/software/BeautifulSoup/bs4/doc/">BeautifulSoup</a> documentation.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=89432da82e8b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[UX/UI Project: Redesigning Airbnb’s Home Page]]></title>
            <link>https://medium.com/@astroporjecting/ux-ui-project-redesigning-airbnbs-home-page-02fef3f622e3?source=rss-7592577a9b0a------2</link>
            <guid isPermaLink="false">https://medium.com/p/02fef3f622e3</guid>
            <category><![CDATA[design]]></category>
            <category><![CDATA[web-design]]></category>
            <category><![CDATA[ui-design]]></category>
            <dc:creator><![CDATA[M. Cheema]]></dc:creator>
            <pubDate>Wed, 16 Jul 2025 21:31:18 GMT</pubDate>
            <atom:updated>2025-07-16T21:31:18.668Z</atom:updated>
            <content:encoded><![CDATA[<h4>Alternative to the current high-density layout</h4><h3>Phase 1: Identify the Problem</h3><h4>Persona:</h4><p><strong>Mr. X</strong> is a creative professional who frequently travels for inspiration. He uses Airbnb on his computer to explore housing options in various international cities. His search habits are sporadic, often revisiting the platform days after initial research.</p><h4>Problem Statement:</h4><p>When Mr. X returns to Airbnb after browsing multiple locations, the homepage overwhelms him with a mix of <strong>vague location suggestions</strong> and <strong>unfamiliar place names</strong> (e.g., “Pratunam Market,” “Bang Rak”). These lack visual context or hierarchy, making it hard for him to reorient himself. As a result, he only trusts the “Recently Viewed” section, while ignoring Airbnb’s intended discovery flow, limiting engagement and undermining personalization.</p><h3>Airbnb’s Current Layout</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qOPT3ddzFcAd1_N43wGdUA.png" /></figure><p>The “Available for Similar” Dates section uses the dates from “continue searching for home” section near the search bar at the top but the user has to scroll up to find it. A minor pinch point but still worth refining.</p><h3>Phase 2: Ideation and Redesign</h3><p>Most Airbnb users already know where they want to go and how long they plan to stay. Mr. X isn’t unusual, but he isn’t the typical traveler either. He falls into a growing group of people who use Airbnb to <em>explore</em>, not just to book; digital nomads, remote workers, or creatives looking for inspiration.</p><p>The goal of this redesign isn’t to cater only to that group. It’s about making the experience better for everyone. Clearer organization, better geographic context, and smarter suggestions can help both the average traveler and the more flexible one find what they need with less friction.</p><p><strong>Low Fidelity Wireframe (Sketched)</strong></p><p>I began with hand-drawn sketches to quickly explore layout ideas without getting caught up in visual details. Sketching allowed me to focus on content hierarchy, grouping logic, and user flow before committing to structure in Figma. It also helped clarify what elements needed to change, what could stay the same, and how to reduce friction without overcomplicating the interface.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/821/1*xQrM1wRsWdeQ4bUpmRxrXA.png" /><figcaption>Sketch of a possible redesign for Airbnb</figcaption></figure><p><strong>What remains the same:</strong></p><ul><li>Header navigation</li><li>Search bar</li><li>“Continue Searching” module</li><li>“Recently Viewed” section</li><li>“Available for Similar Dates” carousel (but now includes dates)</li></ul><p><strong>Additions and Changes:</strong></p><ul><li>A new <strong>“Recently Viewed by Country / City”</strong> section has been added below “Recently Viewed.” This will be renamed in later wireframes for clarity and distinction.</li><li><strong>“Stay Near/In”</strong> sections are now grouped by city or country, based on user search patterns, offering better spatial context.</li><li><strong>Card views</strong> now feature a background image of the area and display 3 listings instead of 7 to reduce cognitive load and visual fatigue.</li></ul><p><strong>Medium Fidelity Wireframe with Refinements (Figma)</strong></p><p>After sketching out the core layout and content logic, I transitioned into Figma to bring structure and clarity to the ideas. This mid-fidelity wireframe builds directly on the sketch, expanding the layout into a more realistic format while still staying neutral on colors and styles. It helped me define spacing, alignment, and the rhythm of the page — seeing how each section flows into the next.</p><p>I also introduced visual anchors that weren’t as defined in the sketch, like using background imagery (represented here by a dark strip) to ground region-based suggestions. This added depth and a stronger sense of place to each section, which was something I wanted from the start. The wireframe became a space to refine intent: less ambiguity, more clarity, and smoother pathways for exploration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C8VJ8j_ycdcxlKc-tY3LMQ.png" /></figure><p><strong>High Fidelity Wireframe (Figma)</strong></p><p>After completing the high-fidelity wireframe, it became clear why Airbnb opts for a dense layout. Their design strategy emphasizes visual saturation, surfacing as many listings as possible above the fold. This allows users to scan a broad range of options quickly without excessive scrolling or interaction. The homepage acts not just as a search entry point, but as a roulette-style discovery surface, rewarding spontaneity and minimizing decision friction.</p><p>In contrast, my redesign focuses on clarity and segmentation. Listings are grouped into clearer, labeled sections with more whitespace, reducing cognitive load but also limiting how much content appears at once. While visually cleaner, this layout sacrifices density, which might slow down high-intent browsing.</p><p>An insight from this process: the “Available for Similar Dates” section in Airbnb’s version omits individual dates to avoid clutter, since each listing may have different availability. I initially tried to solve this by grouping more cleanly, but now I see the merit in their choice to keep listings as lightweight as possible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2qI2wc9aWN6TbiiF-BXRmA.png" /></figure><p>While the original design excels at maximizing screen real estate and exposing users to a wide range of listings, my version explores a different value — personalization, cognitive relief, and monetization potential. By stripping down visual clutter and organizing content into more focused, thematic carousels, I began to see a path for Airbnb to offer curated, high-visibility sections as part of a new subscription model for hosts.</p><p>In this model, hosts could pay to have their listings featured in a premium “Curated Picks” section at the top of the homepage. This space would prioritize clarity and simplicity, giving users an easy entry point without overwhelming them. Meanwhile, the traditional dense layout could still follow below for those who enjoy browsing a wide pool of options. This dual-structure keeps the exploratory spirit of Airbnb intact while offering a new tiered experience: curated listings for those who want focus, and the full grid for those who want volume. Future iterations could merge both philosophies, starting with curated simplicity, then expanding into content-rich discovery for power users.</p><h3>Reflection</h3><p>Overall, I still need to work on spacing. The design idea is not bad but the spacing could be tightened vertically and horizontally. This is my first go at using Figma and also designing and it has been incredibly insightful. Airbnb has a mammoth of a homepage to undertake and I did the best I could to replicate all features within the timeframe I had set for this project. I did not include the little “guest favorite” emblems that appear on some listings or provide location or further details per listing.</p><p>For future projects, the process should be much smoother now having learned masking, utilizing grids among other core fundamentals.</p><h3>Review: My Redesign vs Airbnb’s Current Home Page</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*dpibg2JNtOonW91cIdH2mQ.png" /><figcaption>Mine — left. Airbnb — right</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=02fef3f622e3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fata Morgana, Temperature Inversion, and Inferior/Superior Mirages]]></title>
            <link>https://medium.com/@astroporjecting/fata-morgana-temperature-inversion-and-inferior-superior-mirages-eb24c604b050?source=rss-7592577a9b0a------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb24c604b050</guid>
            <category><![CDATA[education]]></category>
            <category><![CDATA[science]]></category>
            <category><![CDATA[physics]]></category>
            <category><![CDATA[explore]]></category>
            <category><![CDATA[learning]]></category>
            <dc:creator><![CDATA[M. Cheema]]></dc:creator>
            <pubDate>Mon, 16 Dec 2024 12:15:16 GMT</pubDate>
            <atom:updated>2024-12-16T12:15:16.216Z</atom:updated>
            <content:encoded><![CDATA[<h4>Some wild things happening around us that you may or may not have noticed</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/0*sDqDV_1JUGHfk1ap" /><figcaption>Image taken from actionnews5’s article by Erin Thomas, view the original <a href="https://www.actionnews5.com/2021/08/06/breakdown-why-do-we-see-highway-mirages/">here</a></figcaption></figure><p>Ever wondered why the road seems to shimmer or look invisible like in the image above when the weather is really hot? Me neither, at least not for a long time. In my home country, Pakistan, where the weather was usually scorching hot, I often noticed this phenomenon. Having moved to Virginia at the age of 9 though, I had completely forgotten about it. This ‘invisible road’ effect, scientifically known as an <strong>inferior mirage</strong>, offers a fascinating glimpse into how light and temperature can delude our eyes into seeing something that is not real.</p><p>So what exactly is happening here? Inferior mirages occur when the temperature of a surface is much hotter than the air above it. The sharp temperature difference causes the trajectory of light to bend. So when we’re looking at the road, our eyes are seeing refracted light compared to the normal direct light. This basically creates an illusion of a distorted reflection even though it’s caused by the bending (refraction) of light due to temperature differences. It is common to see the horizon and nearby objects in inferior mirages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S0OAbveP4LzbwW7djx6w0w.png" /><figcaption>I created this! Notice the difference between direct light and refracted light. The refracted light bends due to temperature changes causing an inferior mirage.</figcaption></figure><p>The diagram above shows how light traveling through the air at a, somewhat, constant temperature like cool air will reach our eyes without bending, I have called this <strong>direct light</strong>. While <strong>refracted light</strong>, on the other hand, bends due to the shifting temperatures and densities. Let’s clarify one major point, we don’t shoot light out of our eyes to see things, light comes to us. So, we can safely move with the assumption that the light source, the sun in this case, will determine whether a mirage occurs or not.</p><p>Supposing that the temperature conditions are the same but the light source is the tail lights of the car rather than the sun, like at night, there won’t be any mirage. The light source is basically right next to the hot surface in that case, meaning light doesn’t have to travel through varying temperatures and densities of air to reach our eyes reducing the likelihood of a mirage.</p><p>Another thing to keep in mind is that light normally bounces off of objects before entering our eyes. For example, if you turn on a lamp at home, the light from it will bounce off the walls and then project into various paths and our eyes will be able to see the room’s wall because light bounced off of it and it’s reflected trajectory approached our eyes. In a mirage, light never bounces off of the surface, it is repelled by it because the surface’s temperature is way too hot and the density way too low for light to touch it.</p><h3>The ‘<em>Sciencey’ </em>Stuff</h3><p><em>Look, if you want to skip this section, go ahead. I just wanted to take a moment to understand what’s happening behind the scenes and the best way to do that was to write about it. The next section will be more cool stuff like superior mirages, the other end of the spectrum.</em></p><p>For any experts out there that notice fallacies or falsehoods, feel free to reach out with a more accurate description and I will update the points made below.</p><ol><li>The amount of refraction can be calculated using the <strong>refractive index</strong> of air, governed by <strong>Snell’s Law</strong>, which relates the angles of light and refractive indices of the media it travels through. In this case, the refractive index changes gradually due to the <strong>temperature gradient</strong>, causing the light to bend continuously rather than at a single boundary.</li><li>Light refracts due to the stark shifts in temperature from cool air to hot air. As the temperatures shift, so does the air’s density. The denser the air, the higher the refractive index. When moving into denser air, light bends toward the normal trajectory (direct light in the diagram), and when moving into less dense air, it bends away from the normal. Hotter air has a lower density because its molecules are more energetic and thus spaced further apart, reducing its refractive index. As light moves through these layers of air, the change in refractive index causes it to bend away from its normal path</li><li>The continuous change in refractive index causes the light to gradually bend downward, forming a curved trajectory that approaches a near-horizontal direction as it moves through the hotter, less dense air. Approaching this horizontal trajectory, light reaches its <strong>critical angle</strong>, the point where it can no longer refract because the angle of refraction reaches 90°, beyond which refraction is not possible according to Snell’s Law. Instead, the light reflects entirely back into the denser medium, a phenomenon called <strong>total internal reflection. </strong>This causes the light to curve upward as it moves back toward the cooler, denser layers of air. At this point, we are able to perceive the ‘invisible road’ illusion with our eyes.</li></ol><h3>Superior Mirages and Temperature Inversion</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*3DD9LZLo0DsCy_Pj.jpeg" /><figcaption>Image taken from PetaPixel’s article by Matt Growcoot’s, view the original <a href="https://petapixel.com/2022/08/01/bizarre-floating-tanker-ship-is-rare-superior-mirage/">here</a></figcaption></figure><p>Now that we’ve explored how inferior mirages work, let’s take a look at their wilder counterpart. Superior Mirages are even wilder than inferior mirages as you can see from the image above. The ship appears to be floating in the air, there have been many accounts of similar incidents, these are aptly named ‘ghost ships.’ For comparison, inferior mirages happen when the temperatures at the surface level are much hotter than the temperatures above. Superior mirages, on the other hand, occur when there is a <strong>temperature inversion. </strong>Where temperatures at the surface level are colder than the temperatures above.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CuKqbyjw314BDrbr3MR_MA.png" /><figcaption>Made another diagram! Refraction occurs as light approaches warmer temperatures. As light approaches colder temperatures, it somewhat gets back on its normal trajectory.</figcaption></figure><p>This diagram displays how superior mirages occur in a simplified way. The temperature inversion causes light’s trajectory to bend downwards towards the ship where the temperature is cooler. As light reaches the ship, it reflects, or bounces off, into various different paths. One or many of these paths will shoot upwards towards the hot air. As light reaches higher temperatures that are much less dense, it will approach a near horizontal trajectory, similar to inferior mirages. Eventually, as light continues to travel through the hot air, it will reach its critical angle if there is a significant difference in air density caused by the temperature gradient. At this point, light will project downwards towards the cooler air causing a mirage to appear up above due to the downward trajectory of light after it bounces off of the boat. To the viewer, it will appear as if the ship is floating above the sea, elevated in the sky.</p><h4>Fata Morgana</h4><p>Another phenomenon with superior mirages can occur when temperatures alternate repeatedly, creating multiple layers of hot and cold air from the surface to the light source (the sun in most cases). The constant shifting in temperatures creates a more intense kind of superior mirage called F<strong>ata Morgana</strong>. The inspiration for this article was actually Fata Morgana, I saw an Instagram post showcasing Chicago&#39;s skyline from Lake Michigan, which happens to be well over 50 miles away.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Tlv4mo3APy9ivPmg" /><figcaption>I can’t find the exact Instagram post but here’s something similar. Image taken from mLive’s article by Joel Bissell, view the original <a href="https://www.mlive.com/life/2020/03/michigan-photographer-captures-breathtaking-image-of-chicago-skyline-50-miles-away.html">here</a></figcaption></figure><p>The concepts of Fata Morgana are very similar to that of a normal superior mirage — objects appearing larger than they actually are, objects being inverted, objects seeming as if they are floating, etc. The key difference between a normal superior mirage and this extreme version is the amount of distortion in the object’s depiction. An object appearing much larger than it actually is, or distorted beyond comprehension at times, both of these would classify as Fata Morgana rather than a simple superior mirage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*9mT2SITfa8xiql1u.jpg" /><figcaption>Here is a much clearer depiction of Fata Morgana, the ships seem to be distorted and even upside down. Image taken from an article by Costas Saitanis, view the original <a href="https://saitanis.gr/2020/05/14/fata-morgana/">here</a></figcaption></figure><p>In short, Fata Morgana occurs when light refracts, or bends, repeatedly through alternating layers of hot and cold air. It bends in ways that stretch, stack, or even invert objects — deluding our eyes into seeing something surreal and unexplainable.</p><h3>Significance</h3><p>I’ll be honest, this article has been quite frustrating to write. It was so outside of my comfort zone that I didn’t even know how to start it off. So I just wrote about whatever I learned along the way. Inferior mirages seemed like a good place to start because I had seen this phenomenon with my own eyes when I was younger, it was kind of like reconnecting with my past self, trying to understand how light refracts and how it creates the ‘invisible road’ effect.</p><p>Then the natural next step was a simple question “what’s on the other end of the spectrum.” Which I already knew a little bit about because of the Instagram post on superior mirages. In a way this article connects my past to the present and puts sense into places I was not able to comprehend before.</p><p>When I say that this was outside of my comfort zone, here’s what I mean. I’m not an expert, nor a practitioner, in the fields of optics, meteorology, or the various kinds of physics that are at play here. So, to write about it and attempt to comprehend it was not something that I was sure I could do and, furthermore, to have it out there for others to learn from is a serious responsibility in itself. A combination of all these thoughts definitely heightened the intensity of my research and what I aimed to convey through this article.</p><p>Having reflected on what I have accomplished in this article — breaking down the science, drawing diagrams, and relating foreign concepts to personal experiences — I’ve shown myself that this is just the tip of the iceberg. Now, any other phenomenon or concept out there seems within reach of being grasped and understood.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb24c604b050" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An Introductory AWS Project: Building a Task List Application]]></title>
            <link>https://medium.com/@astroporjecting/an-introductory-aws-project-building-a-task-list-application-e7d277d97783?source=rss-7592577a9b0a------2</link>
            <guid isPermaLink="false">https://medium.com/p/e7d277d97783</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[M. Cheema]]></dc:creator>
            <pubDate>Tue, 10 Dec 2024 10:58:22 GMT</pubDate>
            <atom:updated>2026-03-26T01:09:19.447Z</atom:updated>
            <content:encoded><![CDATA[<h4>Built with S3, DynamoDB, SQS, API Gateway, and Lambda</h4><h3>Overview and Requirements</h3><ul><li>The project must use S3, DynamoDB, SQS, API Gateway, and Lambda at a minimum</li><li>Description: I have chosen to create a Task List application that leverages the aforementioned AWS services. <br>- S3: hosts index.html static web page as well as scripts.js which will hold functions to call APIs in API Gateway<br>- DynamoDB: holds a simple table called Tasks where the task items will be stored<br>- Lambda: contains functions to add, delete and view tasks/notifications<br>- API Gateway: Facilitates interaction between the frontend and Lambda functions via APIs.<br>- SQS will be used to send notifications to the frontend for each operation performed (A bit of an overkill but a requirement for the grade)</li></ul><h3>Visualization / Diagram</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*dynz7WO_0okdLrNW-3UMDw.png" /></figure><h3>Create Table in DynamoDB</h3><ul><li>Task Name: Tasks</li><li>Partition Key: TaskID</li><li>Leave the rest as default</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wVbTIXUxyVlOI7tk5efejg.png" /><figcaption>Open image in new tab to zoom</figcaption></figure><h3>Create SQS Queue</h3><ul><li>Type: FIFO</li><li>Name: TaskQueue.fifo</li><li>Access Policy: Advanced (use the access policy below for reference, add your account_id in the placeholders)</li></ul><pre>{<br>  &quot;Version&quot;: &quot;2012-10-17&quot;,<br>  &quot;Id&quot;: &quot;__default_policy_ID&quot;,<br>  &quot;Statement&quot;: [<br>    {<br>      &quot;Sid&quot;: &quot;__owner_statement&quot;,<br>      &quot;Effect&quot;: &quot;Allow&quot;,<br>      &quot;Principal&quot;: {<br>        &quot;AWS&quot;: &quot;arn:aws:iam::[account_id]:root&quot;<br>      },<br>      &quot;Action&quot;: &quot;SQS:*&quot;,<br>      &quot;Resource&quot;: &quot;arn:aws:sqs:us-east-1:[account_id]:TaskQueue.fifo&quot;<br>    },<br>    {<br>      &quot;Sid&quot;: &quot;__lambda_access&quot;,<br>      &quot;Effect&quot;: &quot;Allow&quot;,<br>      &quot;Principal&quot;: {<br>        &quot;Service&quot;: &quot;lambda.amazonaws.com&quot;<br>      },<br>      &quot;Action&quot;: [<br>        &quot;sqs:SendMessage&quot;,<br>        &quot;sqs:ReceiveMessage&quot;,<br>        &quot;sqs:DeleteMessage&quot;,<br>        &quot;sqs:GetQueueAttributes&quot;<br>      ],<br>      &quot;Resource&quot;: &quot;arn:aws:sqs:us-east-1:[account_id]:TaskQueue.fifo&quot;<br>    }<br>  ]<br>}</pre><ul><li>Leave the rest as default and create queue</li><li>Once created, copy the SQS URL into a notepad for reference</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yt5psxZa9q-vSWJXrFsuEg.png" /></figure><h3>Create Lambda Functions</h3><p>When Creating Function:</p><ul><li>Author from Scratch</li><li>Function names below</li><li>Runtime: Python 3.9</li><li>Leave the rest as default</li></ul><p>There are a total of 4 lambda functions:</p><ul><li>AddTaskFunction</li><li>DeleteTaskFunction</li><li>FetchTasksFunction</li><li>FetchMessagesFunction</li></ul><p>(Yea I know, having Function in the name is redundant, it was 3:00 in the morning)</p><h4>Creating AddTaskFunction</h4><ul><li>Create AddTaskFunction to put items in DynamoDB table (replace queue_url with your copied SQS URL)</li></ul><pre>import json<br>import boto3<br>import uuid<br><br># DynamoDB resource<br>dynamodb = boto3.resource(&#39;dynamodb&#39;)<br>table = dynamodb.Table(&#39;Tasks&#39;)<br><br># SQS resource<br>sqs = boto3.client(&#39;sqs&#39;)<br>queue_url = &#39;https://sqs.us-east-1.amazonaws.com/[account]/[sqs]&#39;  # Replace with your SQS queue URL<br><br>def lambda_handler(event, context):<br>    # Parse request body<br>    body = json.loads(event[&#39;body&#39;])<br>    task_desc = body[&#39;TaskDesc&#39;]<br>    task_id = str(uuid.uuid4())<br><br>    # Add item to DynamoDB<br>    try:<br>        table.put_item(Item={<br>            &#39;TaskID&#39;: task_id,<br>            &#39;TaskDesc&#39;: task_desc<br>        })<br>    except Exception as e:<br>        return {<br>            &#39;statusCode&#39;: 500,<br>            &#39;body&#39;: json.dumps({&#39;message&#39;: f&#39;Error adding task to DynamoDB: {str(e)}&#39;})<br>        }<br><br>    # Send message to SQS queue<br>    try:<br>        sqs.send_message(<br>            QueueUrl=queue_url,<br>            MessageBody=json.dumps({<br>                &#39;TaskID&#39;: task_id,<br>                &#39;TaskDesc&#39;: task_desc,<br>                &#39;Action&#39;: &#39;Add&#39;<br>            }),<br>            MessageGroupId=&#39;task-group&#39;,  # Required for FIFO queues<br>            MessageDeduplicationId=task_id  # Unique ID to prevent duplication<br>        )<br>    except Exception as e:<br>        return {<br>            &#39;statusCode&#39;: 500,<br>            &#39;body&#39;: json.dumps({&#39;message&#39;: f&#39;Error sending message to SQS: {str(e)}&#39;})<br>        }<br><br>    # Return response<br>    return {<br>        &#39;statusCode&#39;: 200,<br>        &#39;body&#39;: json.dumps({&#39;TaskID&#39;: task_id, &#39;TaskDesc&#39;: task_desc})<br>    }</pre><h4>Creating DeleteTaskFunction</h4><ul><li>Create DeleteTaskFunction to delete items in DynamoDB table (replace queue_url with your copied SQS URL)</li></ul><pre>import json<br>import boto3<br><br># DynamoDB and SQS resources<br>dynamodb = boto3.resource(&#39;dynamodb&#39;)<br>table = dynamodb.Table(&#39;Tasks&#39;)<br>sqs = boto3.client(&#39;sqs&#39;)<br>queue_url = &#39;https://sqs.us-east-1.amazonaws.com/[account_id]/TaskQueue.fifo&#39;  # Replace with your SQS queue URL<br><br>def lambda_handler(event, context):<br>    # Log the incoming event for debugging<br>    print(f&quot;Received event: {json.dumps(event)}&quot;)<br><br>    # Extract TaskID from query string parameters<br>    try:<br>        task_id = event[&#39;queryStringParameters&#39;][&#39;TaskID&#39;]<br>        print(f&quot;TaskID extracted: {task_id}&quot;)<br>    except KeyError as e:<br>        print(f&quot;Error extracting TaskID: {str(e)}&quot;)<br>        return {<br>            &#39;statusCode&#39;: 400,<br>            &#39;body&#39;: json.dumps({&#39;message&#39;: &#39;TaskID is required in queryStringParameters&#39;})<br>        }<br><br>    # Delete item from DynamoDB<br>    try:<br>        response = table.delete_item(Key={&#39;TaskID&#39;: task_id})<br>        print(f&quot;DynamoDB delete response: {response}&quot;)<br>    except Exception as e:<br>        print(f&quot;Error deleting task from DynamoDB: {str(e)}&quot;)<br>        return {<br>            &#39;statusCode&#39;: 500,<br>            &#39;body&#39;: json.dumps({&#39;message&#39;: f&#39;Error deleting task from DynamoDB: {str(e)}&#39;})<br>        }<br><br>    # Send message to SQS queue<br>    try:<br>        sqs_response = sqs.send_message(<br>            QueueUrl=queue_url,<br>            MessageBody=json.dumps({<br>                &#39;TaskID&#39;: task_id,<br>                &#39;Action&#39;: &#39;Delete&#39;<br>            }),<br>            MessageGroupId=&#39;task-group&#39;,  # Required for FIFO queues<br>            MessageDeduplicationId=task_id + &#39;_del&#39;  # Ensure uniqueness in FIFO queues<br>        )<br>        print(f&quot;SQS send_message response: {sqs_response}&quot;)<br>    except Exception as e:<br>        print(f&quot;Error sending message to SQS: {str(e)}&quot;)<br>        return {<br>            &#39;statusCode&#39;: 500,<br>            &#39;body&#39;: json.dumps({&#39;message&#39;: f&#39;Error sending message to SQS: {str(e)}&#39;})<br>        }<br><br>    # Return success response<br>    return {<br>        &#39;statusCode&#39;: 200,<br>        &#39;body&#39;: json.dumps({&#39;message&#39;: f&#39;Task {task_id} deleted and message sent to SQS&#39;})<br>    }</pre><h4>Creating FetchTasksFunction</h4><ul><li>Create FetchTasksFunction to fetch all items in DynamoDB table when index.html loads on your browser</li></ul><pre>import json<br>import boto3<br><br>dynamodb = boto3.resource(&#39;dynamodb&#39;)<br>table = dynamodb.Table(&#39;Tasks&#39;)<br><br>def lambda_handler(event, context):<br>    try:<br>        # Scan the DynamoDB table to fetch all tasks<br>        response = table.scan()<br>        tasks = response.get(&#39;Items&#39;, [])<br><br>        # Return the tasks as a response<br>        return {<br>            &#39;statusCode&#39;: 200,<br>            &#39;headers&#39;: {<br>                &#39;Content-Type&#39;: &#39;application/json&#39;,<br>                &#39;Access-Control-Allow-Origin&#39;: &#39;*&#39;<br>            },<br>            &#39;body&#39;: json.dumps(tasks)<br>        }<br>    except Exception as e:<br>        return {<br>            &#39;statusCode&#39;: 500,<br>            &#39;headers&#39;: {<br>                &#39;Content-Type&#39;: &#39;application/json&#39;,<br>                &#39;Access-Control-Allow-Origin&#39;: &#39;*&#39;<br>            },<br>            &#39;body&#39;: json.dumps({&#39;error&#39;: str(e)})<br>        }</pre><h4>Creating FetchMessagesFunction</h4><ul><li>Create FetchMessagesFunction to fetch all items in SQS queue when index.html loads on your browser. This is used to serve notifications. Any polled messages are deleted from the queue once they appear on the webpage (replace queue_url with your copied SQS URL)</li></ul><pre>import json<br>import boto3<br><br># Initialize SQS client<br>sqs = boto3.client(&#39;sqs&#39;)<br>queue_url = &#39;https://sqs.us-east-1.amazonaws.com/[account_id]/TaskQueue.fifo&#39;<br><br>def lambda_handler(event, context):<br>    # Receive messages from the queue<br>    response = sqs.receive_message(<br>        QueueUrl=queue_url,<br>        MaxNumberOfMessages=10,  # Number of messages to fetch (up to 10)<br>        WaitTimeSeconds=1       # Long polling to avoid empty responses<br>    )<br>    <br>    # If no messages are found<br>    if &#39;Messages&#39; not in response:<br>        return {<br>            &#39;statusCode&#39;: 200,<br>            &#39;body&#39;: json.dumps({&#39;message&#39;: &#39;No messages found in the queue&#39;})<br>        }<br>    <br>    # Extract message bodies<br>    messages = []<br>    for message in response[&#39;Messages&#39;]:<br>        messages.append(json.loads(message[&#39;Body&#39;]))<br>        # Optionally delete the message after processing it<br>        sqs.delete_message(<br>            QueueUrl=queue_url,<br>            ReceiptHandle=message[&#39;ReceiptHandle&#39;]<br>        )<br>    <br>    # Return messages as a response<br>    return {<br>        &#39;statusCode&#39;: 200,<br>        &#39;body&#39;: json.dumps(messages)<br>    }</pre><h3>Setting up APIs in API Gateway</h3><p>Now that we have the lambda functions created, we can integrate them with API gateway so they can be called via the static website running on S3.</p><ul><li>API Type: HTTP</li><li>API name: TaskAPI</li><li>Integrations (lambda)&gt; routes:<br>- AddTaskFunction &gt; addTask(POST)<br>- DeleteTaskFunction&gt; deleteTask(DELETE) <br>- FetchTasksFunction&gt; tasks(GET)<br>- FetchMessagesFunction&gt; auditLog(GET)</li><li>Stages: $default (Auto-deploy: enabled)</li><li>CORS:<br>- Access-Control-Allow-Origin: * <br>- Access-Control-Allow-Headers: content-type allow-origin<br>- Access-Control-Allow-Methods: GET POST DELETE <br>- Access-Control-Max-Age: 3600 seconds<br>- Access-Control-Allow-Credentials: no</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/430/1*v0xwYJFt-A2mJLilephegg.png" /><figcaption>Here’s the list of all the routes created</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HS528351x1rga--rNBM2_g.png" /><figcaption>Here’s the settings for CORS in API Gateway for TaskAPI</figcaption></figure><ul><li><strong>Once everything is configured, note down the </strong>Default Endpoint<strong> URL for your reference</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MBz8Jv-A0CprNe3tyqmkeA.png" /></figure><h3>S3 Setup</h3><p>Due to the restrictions imposed by AWS Academy’s lab account, bucket policies can’t be utilized so I had to find workarounds for accessing the webpage and find alternative methods to have index.html communicate with scripts.js</p><h4>Creating Bucket</h4><ul><li>Create s3 bucket with whatever name you prefer<br>- Uncheck block all public access (Yea, not a great security practice, use bucket policies instead if possible)<br>- Leave other settings as default</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/969/1*cw3e_hrwKeCWubEm9hUyiQ.png" /></figure><h4>Adding Objects</h4><p>We will be adding two objects index.html and script.js , index.html is the homepage, while script.js contains functions to communicate with API Gateway</p><p>Set up presigned URLs to allow communication between index.html and scripts.js and also to be able to visit the webpage on the browser.</p><p>You can initially upload the two files as empty so you can generate the presigned URLs, once you have the URLs, save them in a notepad for reference.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*awnKE39QkIQ-jFoMiHuY5g.png" /></figure><h4>File content</h4><p>index.html:</p><p>(add script.js&#39;s presigned url in the placeholder scripts_js_presigned_url)</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br>    &lt;meta charset=&quot;UTF-8&quot;&gt;<br>    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;<br>    &lt;title&gt;To-Do List&lt;/title&gt;<br>    &lt;style&gt;<br>        body { font-family: Arial, sans-serif; margin: 20px; }<br>        .task { margin: 5px 0; }<br>        .log { margin: 5px 0; color: grey; }<br>    &lt;/style&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>    &lt;h1&gt;To-Do List&lt;/h1&gt;<br>    &lt;form id=&quot;taskForm&quot;&gt;<br>        &lt;input type=&quot;text&quot; id=&quot;taskDesc&quot; placeholder=&quot;Enter task description&quot; required&gt;<br>        &lt;button type=&quot;submit&quot;&gt;Add Task&lt;/button&gt;<br>    &lt;/form&gt;<br>    &lt;div id=&quot;taskList&quot;&gt;&lt;/div&gt;<br><br>    &lt;h2&gt;Notification from SQS&lt;/h2&gt;<br>    &lt;div id=&quot;auditLog&quot;&gt;&lt;/div&gt;<br><br>    &lt;script src=&quot;[scripts_js_presigned_url]&quot;&gt;&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>script.js (paste your default endpoint url where it says api_url:</p><pre>// API Base URL<br>const API_BASE_URL = &quot;[api_url]&quot;;<br><br>// Fetch and store tasks<br>let tasks = [];<br>let auditLog = []; // To store audit messages<br><br>// Display tasks<br>function displayTasks() {<br>    const taskList = document.getElementById(&#39;taskList&#39;);<br>    taskList.innerHTML = &#39;&#39;;<br>    tasks.forEach(task =&gt; {<br>        const div = document.createElement(&#39;div&#39;);<br>        div.className = &#39;task&#39;;<br>        div.innerHTML = `<br>            &lt;span&gt;${task.TaskDesc}&lt;/span&gt;<br>            &lt;button onclick=&quot;deleteTask(&#39;${task.TaskID}&#39;)&quot;&gt;Delete&lt;/button&gt;<br>        `;<br>        taskList.appendChild(div);<br>    });<br>}<br><br>// Display audit log<br>function displayAuditLog() {<br>    const auditList = document.getElementById(&#39;auditLog&#39;);<br>    auditList.innerHTML = &#39;&#39;;<br>    auditLog.forEach(log =&gt; {<br>        const div = document.createElement(&#39;div&#39;);<br>        div.className = &#39;log&#39;;<br>        div.innerHTML = `&lt;span&gt;${log.Action} task with ID: ${log.TaskID}&lt;/span&gt;`;<br>        auditList.appendChild(div);<br>    });<br>}<br><br><br>// Fetch tasks from the API<br>async function fetchTasks() {<br>    try {<br>        const response = await fetch(`${API_BASE_URL}/tasks`, {<br>            method: &#39;GET&#39;,<br>            headers: { &#39;Content-Type&#39;: &#39;application/json&#39; }<br>        });<br>        tasks = await response.json(); // Populate tasks with data from API<br>        displayTasks(); // Update the UI<br>    } catch (error) {<br>        console.error(&#39;Error fetching tasks:&#39;, error);<br>    }<br>}<br><br>// Fetch audit log from SQS or API<br>async function fetchAuditLog() {<br>    try {<br>        const response = await fetch(`${API_BASE_URL}/auditLog`, {<br>            method: &#39;GET&#39;,<br>            headers: { &#39;Content-Type&#39;: &#39;application/json&#39; }<br>        });<br>        auditLog = await response.json(); // Populate audit log with data from API<br>        displayAuditLog(); // Update the UI<br>    } catch (error) {<br>        console.error(&#39;Error fetching audit log:&#39;, error);<br>    }<br>}<br><br>// Add a task<br>document.getElementById(&#39;taskForm&#39;).addEventListener(&#39;submit&#39;, async function (event) {<br>    event.preventDefault();<br>    const taskDesc = document.getElementById(&#39;taskDesc&#39;).value;<br>    if (taskDesc) {<br>        try {<br>            const response = await fetch(`${API_BASE_URL}/addTask`, {<br>                method: &#39;POST&#39;,<br>                headers: { &#39;Content-Type&#39;: &#39;application/json&#39; },<br>                body: JSON.stringify({ TaskDesc: taskDesc })<br>            });<br>            const data = await response.json();<br>            tasks.push(data); // Add the returned task to the tasks array<br>            displayTasks(); // Update the UI<br>            document.getElementById(&#39;taskDesc&#39;).value = &#39;&#39;; // Clear the input field<br>            location.reload();<br>        } catch (error) {<br>            console.error(&#39;Error adding task:&#39;, error);<br>        }<br>    }<br>});<br><br>// Delete a task<br>async function deleteTask(taskID) {<br>    try {<br>        const response = await fetch(`${API_BASE_URL}/deleteTask?TaskID=${taskID}`, {<br>            method: &#39;DELETE&#39;<br>        });<br>        const data = await response.json();<br>        console.log(data.message);<br>        location.reload();<br>        // Remove the task from the local array<br>        const index = tasks.findIndex(task =&gt; task.TaskID === taskID);<br>        if (index !== -1) {<br>            tasks.splice(index, 1);<br>            displayTasks(); // Update the UI<br>        }<br>    } catch (error) {<br>        console.error(&#39;Error deleting task:&#39;, error);<br>    }<br>}<br><br>// Initialize display<br>fetchTasks();<br>fetchAuditLog();</pre><h3>Video of Final Product</h3><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Djk8nDl1Y17M&amp;type=text%2Fhtml&amp;schema=youtube&amp;display_name=YouTube&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fjk8nDl1Y17M%3Ffeature%3Doembed" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/a8441852d51f5232ff2e8b204a22eaa6/href">https://medium.com/media/a8441852d51f5232ff2e8b204a22eaa6/href</a></iframe><h3>Deletion</h3><p>Delete everything once you‘re ready to so you don’t incur any future charges.</p><h4>SQS</h4><ul><li>Delete and Confirm</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cx6HMqJPckode8t_wfDyqw.png" /></figure><h4>Lambda</h4><ul><li>Check the 4 functions and delete</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nBAhLuj_8AGUt6w13ONw0A.png" /></figure><h4>API Gateway</h4><ul><li>Delete and Confirm</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g8najGrfs1yEzjoLX6XtXw.png" /></figure><h4>S3</h4><ul><li>Empty bucket</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eibOVRBK5Q2kTjdVe9dovQ.png" /></figure><ul><li>Delete</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HHotBEVRH0cvbtl2KCtS_g.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e7d277d97783" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>