<?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 Akash Patel on Medium]]></title>
        <description><![CDATA[Stories by Akash Patel on Medium]]></description>
        <link>https://medium.com/@akash.patel2520?source=rss-6a62d726c9f5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*gh8g2zLSrC1nKUfsBPruxQ.jpeg</url>
            <title>Stories by Akash Patel on Medium</title>
            <link>https://medium.com/@akash.patel2520?source=rss-6a62d726c9f5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 19:12:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@akash.patel2520/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 If AI Could Think Faster and Use Less Electricity? The Next Step Towards Energy-Efficient AI]]></title>
            <link>https://medium.com/@akash.patel2520/what-if-ai-could-think-faster-and-use-less-electricity-the-next-step-towards-energy-efficient-ai-b2594b7606a2?source=rss-6a62d726c9f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/b2594b7606a2</guid>
            <category><![CDATA[efficient-ai]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[research]]></category>
            <dc:creator><![CDATA[Akash Patel]]></dc:creator>
            <pubDate>Mon, 16 Nov 2026 14:36:46 GMT</pubDate>
            <atom:updated>2026-11-16T14:36:46.672Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Stanford researchers are exploring a different way to generate text. Their approach could change how we think about AI performance, computing costs, and the growing electricity demands of artificial intelligence.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ssOCgQXY9Ky3KspkV7fqeQ.png" /></figure><h4>Artificial intelligence is getting smarter, but there is a growing problem behind that progress: the amount of computing power required to run it.</h4><p>Every time we ask an AI assistant to write an email, analyse a document, generate code, or answer a question, powerful processors perform calculations to produce the response. At scale, these calculations require enormous amounts of electricity.</p><p>As AI adoption grows, so does the demand for data centres, GPUs, cooling infrastructure, and electricity.</p><p>The industry has spent years trying to build more powerful models. But an equally important question deserves attention:</p><p><strong>What if we could get the same quality of AI output using significantly less computation?</strong></p><p>A recent research paper from Stanford University’s Hazy Research group introduces an interesting approach that could help move in that direction.</p><p>The research is called <em>Next-Concept Modeling: Fast, Parallel Coarse-to-Fine Text Generation</em>.</p><p>And it challenges one of the fundamental assumptions behind how most language models generate text.</p><h3>The problem with generating one word at a time</h3><p>Traditional large language models use a technique called autoregressive generation.</p><p>The model predicts the next token based on everything that came before it. It then predicts another token, followed by another, continuing until the response is complete.</p><p>For example, consider the sentence:</p><p>“The future of artificial intelligence is exciting.”</p><p>A traditional language model generates this sequence step by step:</p><ol><li>The</li><li>Future</li><li>Of</li><li>Artificial</li><li>Intelligence</li><li>Is</li><li>Exciting</li></ol><p>These are simplified token boundaries. In practice, a token can represent a complete word, part of a word, or even punctuation.</p><p>The important point is that each generation step depends on the preceding context.</p><p>This sequential process creates a bottleneck. Even when modern GPUs can perform enormous numbers of calculations in parallel, the next generation step must generally wait for the previous one.</p><p>For longer responses, this can mean hundreds or thousands of sequential generation steps.</p><p>The question is whether AI needs to work this way.</p><h3>A different approach: Generate concepts before details</h3><p>Stanford’s Next-Concept Modeling (NCM) introduces a coarse-to-fine generation approach.</p><p>Instead of generating a complete sequence one token at a time, the system first learns a hierarchical representation of text.</p><p>Think of writing an article.</p><p>Before writing individual sentences, you understand the main subject. Then you organise the sections, develop the arguments, and add the details.</p><p>NCM follows a somewhat similar principle.</p><p>It works in two main stages:</p><p><strong>Stage 1: Build a hierarchical representation</strong></p><p>A specialised tokenizer converts text into multiple levels of discrete representations, moving from broad information to increasingly detailed information.</p><p><strong>Stage 2: Generate multiple representations in parallel</strong></p><p>A transformer predicts all the codes within each level simultaneously. It starts with coarse information and progressively adds finer details.</p><p>Once the hierarchy is complete, a decoder reconstructs the final text.</p><p>This is an important distinction. NCM does not simply generate five or ten ordinary words simultaneously. It generates structured representations of text in parallel, refining them through successive levels.</p><p>The result is a much shorter sequence of generation steps.</p><h3>The performance improvements are interesting</h3><p>The researchers tested NCM across several language modelling and text generation tasks.</p><p>Their reported results include:</p><ul><li><strong>21× faster</strong> generation on the LM1B benchmark compared with a strong diffusion baseline.</li><li><strong>10× faster</strong> generation on OpenWebText while maintaining competitive quality.</li><li><strong>31× faster</strong> summarisation on the XSum benchmark while matching the strongest diffusion baseline’s ROUGE-L score.</li></ul><p>The researchers also reported that NCM achieved competitive results using approximately 4–5 times fewer training tokens than strong diffusion baselines on two language modelling datasets.</p><p>These are research benchmarks, not production-scale comparisons against every commercial AI model.</p><p>Nevertheless, they demonstrate that changing the generation architecture can have a significant impact on computational efficiency.</p><h3>The bigger question: Can this reduce electricity consumption?</h3><p>This is where the research becomes particularly interesting.</p><p>AI electricity consumption is becoming an important infrastructure challenge.</p><p>A modern AI data centre can contain thousands of GPUs operating continuously. These systems consume electricity during model inference, training, data movement, and other supporting operations.</p><p>The more frequently models are used, the more important inference efficiency becomes.</p><p>If a model can produce the same quality of response with fewer computational steps, it may require less total GPU processing time.</p><p>That creates several opportunities:</p><p><strong>1. Lower inference energy consumption</strong></p><p>Reducing the amount of computation required for each response could reduce the electricity consumed per request.</p><p><strong>2. Better utilisation of existing hardware</strong></p><p>Faster generation could allow the same infrastructure to serve more users and requests.</p><p><strong>3. Reduced operating costs</strong></p><p>Electricity is a significant operating expense for large data centres. Improving computational efficiency could help reduce the cost of running AI services.</p><p><strong>4. More efficient scaling</strong></p><p>As AI adoption grows, improvements in energy efficiency could help limit how quickly computing infrastructure and electricity demand need to expand.</p><p>However, there is an important distinction.</p><p>Faster generation does not automatically mean lower electricity consumption.</p><p>Parallel computation can increase instantaneous power consumption. A system might finish a task faster but consume similar or even greater total energy.</p><p>The metric that really matters is energy per completed task, measured in watt-hours (Wh), while maintaining comparable output quality.</p><p>The Stanford research demonstrates substantial speed improvements, but it does not establish equivalent reductions in electricity consumption.</p><p>That is an important area for further research.</p><h3>Why this matters beyond electricity</h3><p>The implications extend beyond energy savings.</p><p>If AI models can generate high-quality output using fewer sequential operations, it could change how AI infrastructure is designed.</p><p>Consider the possibilities:</p><ul><li>AI assistants responding faster without requiring proportionally more hardware.</li><li>Software development tools generating and analysing code more efficiently.</li><li>Enterprise AI systems processing larger volumes of business information.</li><li>Smaller computing environments running increasingly capable AI applications.</li></ul><p>For businesses adopting AI, inference efficiency could become just as important as model intelligence.</p><p>A model that produces excellent results but requires expensive infrastructure for every request may not be practical for every organisation.</p><p>Efficiency makes advanced AI more accessible.</p><h3>What still needs to be proven?</h3><p>NCM is promising, but it is important not to confuse research progress with an established industry solution.</p><p>There are several questions that remain:</p><ol><li>How well does this architecture perform when scaled to billions of parameters?</li><li>What is its actual electricity consumption per generated response?</li><li>How does it compare with the latest autoregressive models and production inference systems?</li><li>Can it maintain quality across complex reasoning, long documents, and real-world applications?</li><li>What additional computational costs are introduced by its specialised tokenizer and decoding process?</li></ol><p>Answering these questions will help determine whether this approach can deliver meaningful improvements outside controlled research environments.</p><h3>The future of AI should be measured differently</h3><p>For years, AI progress has largely been measured through model size, benchmark scores, reasoning capabilities, and the number of parameters.</p><p>Those measurements still matter.</p><p>But as AI becomes part of everyday business operations, another measurement deserves equal attention:</p><p><strong>How much energy does it take to produce one useful AI response?</strong></p><p>The next generation of AI systems should aim to deliver better results with fewer computational resources.</p><p>Stanford’s Next-Concept Modeling research offers an interesting example of how rethinking the generation process can improve speed and reduce computational steps.</p><p>It does not yet prove that AI can achieve the same output using a fraction of the electricity. But it gives researchers another direction to explore.</p><p>Perhaps the future of AI will not be defined only by how much intelligence we can build into a model.</p><p>Perhaps it will also be defined by how efficiently we can use that intelligence.</p><p><strong>Research reference</strong></p><p>Kumbong, H., Khare, I. S., Mlauzi, I., et al. (2026). <em>Next-Concept Modeling: Fast, Parallel Coarse-to-Fine Text Generation.</em></p><p><a href="https://arxiv.org/abs/2610.14162">Read the original research paper on arXiv</a></p><p><a href="https://hazyresearch.stanford.edu/blog/2026-10-12-ncm">Read the Stanford Hazy Research announcement</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b2594b7606a2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Couldn’t Find a Mock Test for Microsoft’s AI-901 Certification, So I Built One]]></title>
            <link>https://medium.com/@akash.patel2520/i-couldnt-find-a-mock-test-for-microsoft-s-ai-901-certification-so-i-built-one-52afaead45da?source=rss-6a62d726c9f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/52afaead45da</guid>
            <category><![CDATA[azure-foundry]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[microsoft-azure]]></category>
            <category><![CDATA[microsoft-certification]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Akash Patel]]></dc:creator>
            <pubDate>Sat, 27 Jun 2026 14:56:44 GMT</pubDate>
            <atom:updated>2026-06-27T14:56:44.388Z</atom:updated>
            <content:encoded><![CDATA[<p>Preparing for a certification exam is challenging enough. Preparing for one without access to quality mock tests is even harder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xvNkRkcK-Qwmlc3YAgNwVQ.png" /></figure><p>A few weeks ago, while exploring Microsoft’s newly introduced <strong>AI-901 certification</strong>, I started looking for practice exams and exam simulators to assess my readiness. I expected to find multiple platforms offering realistic mock tests, performance analytics, and exam-style practice sessions.</p><p>To my surprise, there were almost none.</p><p>There were Microsoft Learn modules, documentation, YouTube videos, study guides, and community discussions. But when it came to a dedicated AI-901 exam simulator that could replicate the actual certification experience, the options were extremely limited.</p><p>That realization sparked an idea.</p><blockquote>If I couldn’t find a quality AI-901 mock test platform, chances are thousands of other learners were facing the same problem.</blockquote><h3>The Problem with Certification Preparation</h3><p>Most certification candidates follow a similar path:</p><ul><li>Read Microsoft documentation</li><li>Complete learning modules</li><li>Watch online tutorials</li><li>Take notes</li><li>Attempt a few practice questions</li></ul><p>While these resources are valuable, they often miss one critical component:</p><p><strong>Exam simulation.</strong></p><p>Knowing a concept and answering a question correctly under timed exam conditions are two very different things.</p><p>Many learners discover gaps in their understanding only when they sit for the actual certification exam.</p><p>Mock tests help bridge that gap by allowing candidates to:</p><ul><li><strong>Measure their readiness</strong></li><li><strong>Identify weak areas</strong></li><li><strong>Practice time management</strong></li><li><strong>Gain confidence before exam day</strong></li></ul><p>Unfortunately, for AI-901, there wasn’t a comprehensive solution available.</p><h3>Building the AI-901 Exam Simulator</h3><p>As a software engineer and someone who regularly works with Microsoft technologies, I saw an opportunity to contribute to the certification community.</p><p>The goal wasn’t simply to create another question bank.</p><p>I wanted to build a platform that could simulate the actual exam experience and help learners evaluate their knowledge in a meaningful way.</p><p>That’s how the <strong>AI-901 Exam Simulator</strong> was born.</p><p><strong>GitHub Repository:</strong></p><p><a href="https://github.com/akashp18/ai901-exam-simulator"><strong><em>https://github.com/akashp18/ai901-exam-simulator</em></strong></a></p><p>The project is completely open source and designed for anyone preparing for Microsoft’s AI-901 certification.</p><h3>What the Simulator Offers</h3><h3>Realistic Exam Experience</h3><p>The simulator recreates the environment candidates expect during a certification exam.</p><p>Users can:</p><ul><li>Attempt timed assessments</li><li>Navigate between questions</li><li>Review answers</li><li>Track progress</li><li>Receive final scores</li></ul><p>The objective is to make learners comfortable with exam-style testing before they sit for the real certification.</p><h3>Focus on Learning, Not Memorization</h3><p>Many practice platforms encourage memorizing answers.</p><p>That approach rarely leads to long-term success.</p><p>The simulator is designed to encourage understanding of:</p><ul><li>Artificial Intelligence fundamentals</li><li>Azure AI services</li><li>Machine Learning concepts</li><li>Computer Vision</li><li>Natural Language Processing</li><li>Responsible AI principles</li></ul><p>The focus is on reinforcing concepts rather than simply recognizing answers.</p><h3>Open Source for the Community</h3><p>One of the most important decisions I made was to release the project as open source.</p><p>This allows anyone to:</p><ul><li>Review the source code</li><li>Suggest improvements</li><li>Report issues</li><li>Contribute questions</li><li>Enhance the learning experience</li></ul><p>Education becomes more powerful when communities collaborate.</p><p>By making the repository publicly available, the project can continue evolving with contributions from learners and professionals around the world.</p><h3>Why Open Source Matters in Education</h3><p>One thing I’ve learned throughout my career is that access to learning resources should not be limited by budget.</p><p>Many certification preparation platforms require expensive subscriptions that aren’t affordable for students or early-career professionals.</p><p>Open-source projects help level the playing field.</p><p>When high-quality educational tools are freely available:</p><ul><li>More people can learn</li><li>More people can get certified</li><li>More people can enter the technology industry</li></ul><p>The AI-901 Exam Simulator is my small contribution toward that vision.</p><h3>Lessons Learned While Building the Project</h3><p>Building the simulator taught me several valuable lessons.</p><h4>1. Real Problems Create the Best Projects</h4><p>The most impactful projects often emerge from personal frustrations.</p><p>I built this tool because I genuinely needed it.</p><p>That made every design decision easier because I understood the user’s perspective.</p><h4>2. Learning Tools Need Great User Experience</h4><p>Educational software isn’t just about content.</p><p>Navigation, timing, scoring, and feedback all contribute to effective learning.</p><h4>3. Community Feedback Is Invaluable</h4><p>Within days of sharing the project, I received suggestions, feature requests, and encouragement from fellow learners.</p><p>The community helped validate that this was a real problem worth solving.</p><h3>The Bigger Mission</h3><p>This project isn’t just about passing a certification exam.</p><p>It’s about making AI education more accessible.</p><p>Artificial Intelligence is transforming industries across the world. More professionals are looking to build AI skills, and certifications like AI-901 provide an excellent starting point.</p><p>However, learning resources must keep pace with demand.</p><p>My hope is that this simulator helps aspiring AI professionals gain confidence, strengthen their knowledge, and move one step closer to achieving their certification goals.</p><p>If the project helps even a small percentage of the thousands of candidates preparing for AI-901, then it has already achieved its purpose.</p><h3>What’s Next?</h3><p>The roadmap includes:</p><ul><li>Additional question sets</li><li>Improved analytics and reporting</li><li>Better exam insights</li><li>Community-driven contributions</li><li>Continuous updates aligned with Microsoft’s certification objectives</li></ul><p>As the certification evolves, the simulator will continue evolving as well.</p><h3>Final Thoughts</h3><p>Sometimes the best projects start with a simple question:</p><blockquote><strong><em>“Why doesn’t this exist already?”</em></strong></blockquote><p>When I couldn’t find a dedicated mock-test platform for Microsoft’s AI-901 certification, I decided to build one myself.</p><p>What started as a personal learning project has grown into an open-source resource designed to help aspiring AI professionals prepare more effectively.</p><p>If you’re preparing for AI-901, feel free to explore the repository, contribute ideas, submit feedback, or simply use it as part of your certification journey.</p><p>⭐ Star the repository if you find it useful.</p><p>GitHub Repository:</p><p><a href="https://github.com/akashp18/ai901-exam-simulator"><strong><em>https://github.com/akashp18/ai901-exam-simulator</em></strong></a></p><p>Together, we can make certification preparation more accessible, practical, and community-driven.</p><p>Happy learning, and good luck on your AI-901 certification journey.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=52afaead45da" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ingress vs. Egress: The Silent Profit Killers in Modern Data Pipelines]]></title>
            <link>https://towardsdev.com/ingress-vs-egress-the-silent-profit-killers-in-modern-data-pipelines-07446db0373f?source=rss-6a62d726c9f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/07446db0373f</guid>
            <category><![CDATA[system-design-concepts]]></category>
            <category><![CDATA[cloud-cost-optimization]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[cloud-architecture]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Akash Patel]]></dc:creator>
            <pubDate>Fri, 08 May 2026 20:21:00 GMT</pubDate>
            <atom:updated>2026-05-08T20:21:00.623Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HMei-sWokEOZv02ZK5ESSQ.png" /></figure><p>If you’ve ever looked at a company’s monthly cloud bill from AWS, Google Cloud, or Microsoft Azure, you might have noticed something strange. You are being billed for things you easily understand — like running servers (compute) or keeping files in storage. But then, there is this other line item that quietly drains thousands of dollars: <strong>Data Egress</strong>.</p><p>For many junior data engineers or developers, the movement of data feels invisible. You run a query, a dashboard refreshes, and the data magically appears.</p><p>But in the cloud, <strong>movement isn’t free</strong>.</p><p>To build cost-effective architectures, you need to understand the two directions of cloud data travel: <strong>Ingress</strong> and <strong>Egress</strong>. Let’s break down exactly what they are, why they matter, and how to avoid the “hidden tax” of data movement.</p><h3>The Basics: Ingress vs. Egress</h3><h4>Ingress (Data Going IN)</h4><ul><li><strong>What it is:</strong> Any data flowing <strong>into</strong> a cloud provider’s infrastructure from the outside world</li><li><strong>Examples:</strong> Uploading raw CSV files from your local laptop to an Amazon S3 bucket, or migrating an on-premise database into Google Cloud SQL.</li><li><strong>The Catch:</strong> It is almost always <strong>free</strong>. Cloud providers want your data inside their ecosystem because once it is there, you will pay to store it and process it.</li></ul><h4>Egress (Data Going OUT)</h4><ul><li><strong>What it is:</strong> Any data flowing <strong>out</strong> of the cloud provider’s infrastructure.</li><li><strong>Examples:</strong> A BI tool like Tableau pulling data from your cloud data warehouse to refresh a dashboard, downloading a database backup to your local machine, or sending data from AWS over to Google Cloud.</li><li><strong>The Catch:</strong> This is <strong>not free</strong>. Cloud providers charge you a fee per gigabyte (GB) for data that leaves their network.</li></ul><h3>Why Does This Matter for Data Engineers?</h3><p>As data engineers, our primary job is to build pipelines that move massive volumes of data. If you design a pipeline without considering egress, you might accidentally create a recurring financial headache for your company.</p><p>Let’s look at a classic real-world scenario:</p><h4>The “Surprise Bill” Scenario</h4><p>Imagine you set up a pipeline where raw data is ingested into AWS S3.</p><ol><li><strong>Ingestion:</strong> You move <strong>1 TB</strong> of data from your local servers into S3. <strong>Cost: $0</strong> (Ingress is free).</li><li><strong>Storage and ETL:</strong> You use AWS Glue to clean the data. <strong>Cost: Standard compute rates</strong> (Data movement within the same region is usually free).</li><li><strong>Analytics:</strong> You connect an external Business Intelligence (BI) tool hosted on a different platform to query this data.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*02g8mCrkGCJUDSLztkC62Q.png" /></figure><p>If that BI tool pulls <strong>2 GB</strong> of data per query to refresh its charts, and your company’s analysts run <strong>500 queries a day</strong>, that equals <strong>1 TB of data egress per day</strong>.</p><p>At a standard rate of around <strong>$0.09 per GB</strong> for outgoing data, that single pipeline will cost your company roughly <strong>$90 per day</strong> — or <strong>$2,700 a month</strong> — just to move data that you already own!</p><h3>Real-World Scenarios: When to Watch Out</h3><p>Egress fees don’t just happen when sending data to the public internet. Here are the three most common scenarios where you must proactively plan for egress costs:</p><h4>Scenario A: The Multi-Cloud Architecture</h4><p>Many modern enterprises use a multi-cloud strategy to get the best tools from each provider — for example, storing data in AWS S3 but using Google Cloud’s Vertex AI for machine learning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_RSNO-Y9GPK9UJwZLbD2hQ.png" /></figure><ul><li><strong>The Problem:</strong> Every time your machine learning model reads data from AWS, you pay AWS egress fees.</li><li><strong>When to act:</strong> Before choosing a multi-cloud approach, calculate if the benefits of using a specific cross-cloud tool outweigh the recurring cost of moving the data between the providers.</li></ul><h4>Scenario B: Cross-Region Disasters</h4><p>Let’s say your main application operates in AWS us-east-1 (Virginia), but for safety and disaster recovery, you duplicate your data to us-west-2 (Oregon).</p><ul><li><strong>The Problem:</strong> Moving data <em>between regions</em> within the same cloud provider isn’t free. It typically costs around $0.01 to $0.02 per GB.</li><li><strong>When to act:</strong> While cross-region replication is a best practice for security, you should only replicate necessary, high-priority datasets — not temporary tables or raw logs.</li></ul><h4>Scenario C: Heavy External API and Web Traffic</h4><p>If you build a data product or API that allows external clients to download large files or massive query results.</p><ul><li><strong>The Problem:</strong> Your users’ data downloads directly translate to your cloud egress bill.</li><li><strong>When to act:</strong> Consider implementing rate limits, forcing data pagination, or making users pay for the data extraction compute.</li></ul><h3>Architectural Strategies to Minimize Egress Costs</h3><p>Smart data architecture isn’t just about writing fast queries; it’s about being cost-effective. Here are the four best ways to keep your egress costs down:</p><h4>1. Practice Data Locality</h4><p>Always run your compute tasks (like Spark jobs, Python scripts, or SQL transforms) in the <strong>exact same region</strong> where your data is stored. If your S3 bucket is in us-east-1, your AWS Glue or EC2 instances should be in us-east-1 too.</p><h4>2. Aggregate Data Early (The “Filter First” Rule)</h4><p>Never export massive, raw datasets to external tools. If a BI tool needs a summary of monthly sales, perform the heavy lifting inside your cloud data warehouse first.</p><ul><li><strong>Bad Practice:</strong> Sending a 100 GB table of individual transactions to an external BI tool.</li><li><strong>Good Practice:</strong> Aggregating the transactions into a 10 MB summary table and sending <em>that</em> instead.</li></ul><h4>3. Choose the Right File Formats</h4><p>Stop moving raw CSV or JSON files. By converting your data into columnar formats like <strong>Apache Parquet or ORC</strong>, you can compress file sizes by <strong>60% to 80%</strong>. Smaller files mean faster processing <em>and</em> much lower egress bills.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*He0swxCXcnUNQvUE1TwIRw.png" /></figure><pre># Writing Parquet instead of CSV in PySpark compresses the data dramatically<br>df.write.mode(&#39;overwrite&#39;).parquet(&#39;s3://my-data-lake/optimized-output/&#39;)</pre><h4>4. Consider Cloud-Native BI Tools</h4><p>Whenever possible, try to keep your analytical and visualization tools within the same cloud ecosystem. Using Amazon QuickSight on AWS, Looker on GCP, or Power BI on Azure allows the tools to query data locally without triggering major internet egress charges.</p><p>As a data engineer, managing costs is just as important as managing code. Understanding how data travels — and knowing that<strong> ingress is free but egress is paid </strong>— will completely change how you design pipelines.</p><p>By keeping your compute close to your storage, compressing your files, and pre-aggregating data before sending it outside your cloud’s walls, you can protect your company from unexpected cloud bills and build incredibly efficient systems.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=07446db0373f" width="1" height="1" alt=""><hr><p><a href="https://towardsdev.com/ingress-vs-egress-the-silent-profit-killers-in-modern-data-pipelines-07446db0373f">Ingress vs. Egress: The Silent Profit Killers in Modern Data Pipelines</a> was originally published in <a href="https://towardsdev.com/">Towards Dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[You’re Probably Not Using Python Type Hints Right]]></title>
            <link>https://medium.com/@akash.patel2520/youre-probably-not-using-python-type-hints-right-1f87d59a5f6d?source=rss-6a62d726c9f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/1f87d59a5f6d</guid>
            <category><![CDATA[data-validation]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[type-hints]]></category>
            <category><![CDATA[fastapi-pydantic]]></category>
            <category><![CDATA[pydantic]]></category>
            <dc:creator><![CDATA[Akash Patel]]></dc:creator>
            <pubDate>Sun, 12 Apr 2026 22:25:42 GMT</pubDate>
            <atom:updated>2026-04-12T22:25:42.091Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tW9OFhUC6esRn0bfmhpb-w.png" /><figcaption>Gemini</figcaption></figure><h3>Here’s How Pydantic Can Fix That.</h3><p>If you’ve written any modern Python, you’ve used type hints. They’re that great feature from typing that lets you declare name: str or user_id: int. They make your code cleaner and your IDE smarter.</p><p>But here’s the catch: By default, Python does absolutely nothing with them.</p><p>They are just… hints. A suggestion. The Python interpreter happily ignores them at runtime, allowing you to pass a list where you promised a string, leading to a cascade of confusing errors deep within your application.</p><p>This is where Pydantic enters the picture. It doesn’t just see the hints; it enforces them, transforming them from passive suggestions into a powerful runtime data validation shield.</p><h3>What Exactly is Pydantic?</h3><p>Pydantic is a data validation and settings management library for Python. At its core, it uses your type hints to parse, validate, and serialize data.</p><p>You define the “shape” of your data using a simple class that inherits from Pydantic’s BaseModel. Pydantic then does the hard work of ensuring that any incoming data conforms to that shape. If it doesn&#39;t, it raises a clear, human-readable error.</p><p>Here’s a simple example:</p><pre>from pydantic import BaseModel, ValidationError<br><br>class User(BaseModel):<br>    id: int<br>    name: str<br>    email: str<br>    is_active: bool = True # A field with a default value<br><br># --- Valid Data ---<br>valid_data = {&quot;id&quot;: 123, &quot;name&quot;: &quot;John Doe&quot;, &quot;email&quot;: &quot;johndoe@example.com&quot;}<br>user = User(**valid_data)<br><br>print(user.model_dump_json())<br># Output: {&quot;id&quot;:123,&quot;name&quot;:&quot;John Doe&quot;,&quot;email&quot;:&quot;johndoe@example.com&quot;,&quot;is_active&quot;:true}<br>print(user.id) # Access data like a normal object<br><br># --- Invalid Data ---<br>invalid_data = {&quot;id&quot;: &quot;not-a-number&quot;, &quot;name&quot;: &quot;Jane Doe&quot;} # Missing email, wrong id type<br><br>try:<br>    User(**invalid_data)<br>except ValidationError as e:<br>    print(e)<br>    &quot;&quot;&quot;<br>    Output:<br>    2 validation errors for User<br>    id<br>      Input should be a valid integer, unable to parse string as an integer [type=int_parsing, input_value=&#39;not-a-number&#39;, input_type=str]<br>    email<br>      Field required [type=missing, input_value={&#39;id&#39;: &#39;not-a-number&#39;...}, input_type=dict]<br>    &quot;&quot;&quot;</pre><p>See that? No manual if/else checks. No cryptic TypeError. Just a crystal-clear report of <em>what</em> went wrong and <em>where</em>.</p><h3>Why, Where, and When to Use Pydantic</h3><p>The “why” is simple: to bring sanity, safety, and robustness to your data handling. The “where” and “when” are anywhere your application touches data it doesn’t control.</p><p>1. API Development (The Killer Use Case)<br>This is Pydantic’s home turf. Frameworks like FastAPI are built entirely around it. When you define your request body with a Pydantic model, you get:</p><ul><li>Automatic parsing of incoming JSON.</li><li>Automatic data validation.</li><li>Clear error messages returned to the client if the data is bad.</li><li>Automatic generation of OpenAPI (Swagger) documentation.<br>It’s a game-changer. You write less code, and it’s more robust.</li></ul><p>2. Configuration Management<br>Your application needs configuration (API keys, database URLs, feature flags). Instead of manually reading environment variables and casting them, you can use Pydantic’s BaseSettings. It can read from environment variables or .env files, validate the types, and give you a clean, typed settings object.</p><p>3. Data Processing &amp; ETL Pipelines<br>Anytime you’re reading data from a file (CSV, JSON), a database, or another service, you’re making an assumption about its structure. Pydantic lets you turn that assumption into an assertion. Validate your data at the entry point of your pipeline to prevent corrupted data from causing errors downstream.</p><h3>The World Without Pydantic: A Mess of Boilerplate</h3><p>So, what happens if you don’t use it? You end up writing the same validation logic by hand, over and over again.</p><figure><img alt="Gemini" src="https://cdn-images-1.medium.com/max/1024/1*kknjVnjjTO3PjWFHlNiFuw.png" /><figcaption>Gemini</figcaption></figure><p>Without Pydantic, you might have code like this:</p><pre># Manual, brittle, and verbose validation<br>def process_user_data(data: dict):<br>    if not isinstance(data.get(&quot;id&quot;), int):<br>        raise TypeError(&quot;User &#39;id&#39; must be an integer.&quot;)<br>    if not isinstance(data.get(&quot;name&quot;), str):<br>        raise TypeError(&quot;User &#39;name&#39; must be a string.&quot;)<br>    if &quot;email&quot; not in data:<br>        raise ValueError(&quot;User &#39;email&#39; is required.&quot;)<br><br>    # ... and so on for every field<br>    <br>    # Finally, you can use the data<br>    user_id = data[&quot;id&quot;]<br>    user_name = data[&quot;name&quot;]<br>    # ...</pre><p>This approach is:</p><ul><li>Verbose: You write a lot of boilerplate code.</li><li>Brittle: It’s easy to miss a check or write one incorrectly.</li><li>Unhelpful: A TypeError doesn&#39;t tell the user <em>why</em> the data was wrong, just that the code broke.</li><li>A Maintenance Nightmare: Adding a new field requires adding more checks, and it’s easy for the validation logic to drift out of sync with your application logic.</li></ul><p>By not using a tool like Pydantic, you are essentially choosing to be your own data validation engine, and you are accepting the risk of silent failures and late-night debugging sessions caused by an unexpected None or an AttributeError on a field you thought would always be there.</p><h3>Why It’s Critical for Agentic AI and LLM-Powered Apps</h3><p>In the age of AI, your application is constantly communicating with Large Language Models (LLMs). You ask the model to generate structured data — like JSON for a user profile or a list of tasks. The problem? LLMs are notoriously unreliable at producing perfectly structured output.</p><p>An LLM might:</p><ul><li>Hallucinate a field that doesn’t exist.</li><li>Forget to include a required field.</li><li>Return a value with the wrong data type (e.g., &quot;5&quot; instead of 5).</li><li>Add conversational text before or after the JSON object.</li></ul><p>This is where Pydantic becomes your application’s immune system. By attempting to parse the LLM’s raw output into a strict Pydantic model, you can instantly fix these issues. If the parsing is successful, you have a clean, predictable Python object. If it fails, Pydantic’s ValidationError gives you a precise, structured report of what went wrong. You can then use this error report to programmatically correct the data or even automatically prompt the LLM again, saying, &quot;Your last response was invalid. The error was: [insert Pydantic error here]. Please correct it.&quot; This creates a robust, self-healing loop that turns unreliable AI output into predictable, application-ready data.</p><h3>How Pydantic Helps: Speed, Safety, and Sanity</h3><p>By embracing Pydantic, you are not just adding a dependency; you are adopting a development philosophy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lK8YbWZITV0unsm37f36nw.png" /><figcaption>Gemini</figcaption></figure><ol><li>Develop Faster: Stop writing boilerplate. Define your data’s shape once and let Pydantic handle the rest.</li><li>Fail Smarter: Errors become informative. Instead of your code breaking, Pydantic tells you precisely what was wrong with the input.</li><li>Refactor with Confidence: Your Pydantic models serve as a reliable source of truth for your data structures. Your IDE will give you better autocompletion and static analysis, catching errors before you even run the code.</li><li>Increase Security: By strictly enforcing data schemas, you reduce the attack surface for injection attacks or other exploits that rely on malformed data.</li></ol><p>In the modern Python ecosystem, Pydantic is not just a utility; it’s a foundational tool for building reliable, maintainable, and robust applications. If you’re not using it, you’re not just writing more code — you’re working too hard and leaving your application exposed.</p><blockquote>Give it a try in your next project. Your future self will thank you.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1f87d59a5f6d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stop Paying the “JSON Tax” in the AI Era]]></title>
            <link>https://medium.com/@akash.patel2520/stop-paying-the-json-tax-in-the-ai-era-2203813e6837?source=rss-6a62d726c9f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/2203813e6837</guid>
            <category><![CDATA[agentic-workflow]]></category>
            <category><![CDATA[toon]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[json]]></category>
            <dc:creator><![CDATA[Akash Patel]]></dc:creator>
            <pubDate>Sat, 11 Apr 2026 15:49:23 GMT</pubDate>
            <atom:updated>2026-04-11T15:49:23.391Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dWO8jH_6O02KuDY1Y-wjjA.png" /></figure><p>We all love JSON. It’s the reliable, universally understood lingua franca of the web. But here’s a hard truth: it was designed for web browsers, not for Large Language Models.</p><p>In the rapidly-evolving landscape of AI, every token counts. When we build RAG pipelines or feed data to LLMs, we’re often using JSON without a second thought. Yet, every curly bracket, every quote, and every comma is “syntactic noise” — a token that occupies precious space in your context window and, more importantly, adds a tangible cost to your API bill.</p><p>This is the “JSON Tax,” and we’re all paying it.</p><h3>Is There an Alternative?</h3><p>I’ve been exploring more token-efficient formats lately, and one that stands out is Toon (Token-Oriented Object Notation). The philosophy behind it is simple: strip away the syntactic bloat. By using header-based logic and minimizing redundant characters, Toon can slash token usage by a remarkable 30–60%.</p><p>Imagine what that means:</p><ul><li>Denser Context: You can fit significantly more meaningful data into each API call.</li><li>Lower Costs: Your operational expenses for AI services drop directly.</li><li>Faster Processing: Fewer tokens can lead to quicker response times.</li></ul><h3>The Hard Trade-Off</h3><p>This efficiency comes at a price, creating a classic battle between optimization and reliability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*souRXSHukeC1IAQ6KQJP1Q.png" /><figcaption>Gemini</figcaption></figure><blockquote><strong><em>On one hand:</em></strong><em> Massive Cost Savings &amp; Higher Context Density.<br>The promise of fitting more data into your models while cutting your API bill by half is incredibly compelling. It could be the competitive edge that allows a startup to scale or a project to become viable.</em></blockquote><blockquote><strong><em>On the other hand:</em></strong><em> Risk of Indentation Errors &amp; Broken Interoperability.<br>JSON’s greatest strength is its robust, predictable structure and vast ecosystem. A format like Toon, which can be sensitive to indentation, introduces a higher risk of human error. One misplaced space could break your data structure. Furthermore, you step outside a universally supported standard, which could lead to interoperability headaches down the line.</em></blockquote><h3>The Big Question</h3><p>This brings us to a crucial crossroads for developers building on AI:</p><p>Would you ditch the battle-tested reliability of the JSON ecosystem to maximize your AI’s efficiency and slash costs? Or is the risk of “indentation-based” human error too high for production applications?</p><p>I find myself torn between the allure of speed and the comfort of safety. It feels like choosing between a high-performance race car and a reliable daily driver.</p><blockquote>What’s your take? I’d love to hear how you’re approaching this in your own projects. Share your thoughts in the comments below</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2203813e6837" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What Is Generative AI? A 5-Minute Guide to the Tech Changing Everything]]></title>
            <link>https://medium.com/@akash.patel2520/what-is-generative-ai-a-5-minute-guide-to-the-tech-changing-everything-4ed1157b238d?source=rss-6a62d726c9f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/4ed1157b238d</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[vibe-coding]]></category>
            <dc:creator><![CDATA[Akash Patel]]></dc:creator>
            <pubDate>Sat, 11 Apr 2026 15:37:00 GMT</pubDate>
            <atom:updated>2026-04-11T15:37:00.914Z</atom:updated>
            <content:encoded><![CDATA[<p>Imagine you have a friend who has read millions of books, watched thousands of movies, listened to countless songs, and studied millions of images. Now imagine that friend can use all that knowledge to create something brand new — write you a story, paint you a picture, compose a song, or even write working computer code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rh-siG1QswOkzUrVP7qPzw.png" /></figure><p><strong>Generative AI</strong> is a type of artificial intelligence that doesn’t just analyze or classify things — it actually <em>creates</em> new content. Text, images, audio, video, code — all generated from scratch, but resembling things made by humans.</p><p>The “generative” part is key. Older AI could tell you “this photo is a cat.” Generative AI can draw you a cat from nothing.</p><h3>How Did We Get Here?</h3><p>For decades, AI was mostly about pattern recognition — spam filters, recommendation engines, fraud detection. Useful, but passive.</p><p>The shift happened when researchers figured out how to train AI on massive amounts of human-created content and teach it not just to recognize patterns, but to reproduce and remix them into something new. This leap was largely powered by a breakthrough computing method known as the “Transformer architecture,” which allowed AI to understand context in data more effectively than ever before.</p><p>The result? AI that can hold a conversation, paint like Monet, or build you a website in seconds.</p><h3>The 5 Main Types of Generative AI</h3><h3>1. LLMs — Large Language Models (e.g. ChatGPT)</h3><p><em>AI that reads and writes like a human.</em></p><p>This is the one most people have heard of. LLMs are trained on enormous amounts of text — books, websites, articles, forums — and learn to predict and generate human-like language.</p><p><strong>What they can do:</strong></p><ul><li>Answer questions conversationally</li><li>Write essays, emails, reports</li><li>Summarize long documents</li><li>Translate languages</li><li>Reason through problems step by step</li></ul><p><strong>Real example</strong>: You ask ChatGPT “explain quantum physics like I’m 10” — it generates a clear, simple explanation it has never written before, tailored exactly to your request.</p><p>Why it feels like magic: It’s not copying and pasting from the internet. It’s generating a unique response every single time based on patterns it learned during training.</p><h3>2. Diffusion Models for Images (e.g. Midjourney, DALL·E, Stable Diffusion)</h3><p><em>AI that paints from your words.</em></p><p>These models generate images from text descriptions. You type “a astronaut riding a horse on Mars at sunset, oil painting style” and seconds later — there it is.</p><p><strong>How it works (simply):</strong> They start with random noise (think TV static) and gradually “denoise” it, step by step, until a coherent image matching your description emerges. Like a sculpture slowly revealing itself from a block of marble.</p><p>What they can do:</p><ul><li>Create photorealistic images from text</li><li>Generate art in any style</li><li>Edit existing photos</li><li>Create product mockups, logos, illustrations</li></ul><p>Why this matters: Things that used to require a graphic designer taking hours can now be prototyped in seconds.</p><h3>3. Code Generating LLMs (e.g. CodeLlama, GitHub Copilot)</h3><p><em>AI that programs for you.</em></p><p>These are LLMs specifically trained on billions of lines of code across dozens of programming languages. They understand not just human language but <em>computer</em> language.</p><p>What they can do:</p><ul><li>Write functions and entire programs from plain English descriptions</li><li>Debug broken code</li><li>Explain what code does</li><li>Convert code from one language to another</li><li>Suggest completions as you type</li></ul><p><strong>Real example: </strong>A non-programmer types “write me a Python script that reads a CSV file and creates a bar chart of sales by month” — the model writes the complete, working code.</p><p>Why this is huge: It’s lowering the barrier to building software dramatically.</p><h3>4. Text-to-Speech Models (e.g. ElevenLabs)</h3><p><em>AI that speaks like a human.</em></p><p>TTS (Text-to-Speech) models have existed for a while — think robotic GPS voices. But modern generative TTS is completely different. These models generate human-quality speech that sounds natural, emotional, and indistinguishable from a real person.</p><p>What they can do:</p><ul><li>Clone a voice from just a few seconds of audio</li><li>Generate speech in dozens of languages and accents</li><li>Control emotion, pace, and tone</li><li>Narrate audiobooks, podcasts, videos</li></ul><p>Why this is different from old TTS: Old systems stitched together pre-recorded syllables. New systems <em>generate</em> audio waveforms from scratch, capturing the natural rhythm and emotion of human speech.</p><h3>5. Video Generation Models (e.g. Sora, Runway)</h3><p><em>AI that makes movies from text.</em></p><p>The newest and most jaw-dropping category. These models generate realistic video clips from text descriptions.</p><p>What they can do:</p><ul><li>Generate short video clips from a text prompt</li><li>Animate still images</li><li>Extend existing videos</li><li>Create realistic simulations</li></ul><p><strong>Example:</strong> Type “a golden retriever puppy playing in autumn leaves in slow motion, cinematic” — and a realistic video clip is generated.</p><p>Why it’s still early: Video generation is the hardest problem — consistency across frames, physics, lighting — but the progress in the last two years has been extraordinary.</p><h3>How Are They All Connected?</h3><p>All of these — text, image, audio, video, code — share the same fundamental idea:</p><pre>Train on massive amounts of human content<br>              ↓<br>Learn the deep patterns within it<br>              ↓<br>Use those patterns to generate new content</pre><p>The difference is just <em>what</em> they were trained on and <em>what</em> they generate.</p><h3>Why Does This Matter for You?</h3><p>Whether you’re a student, business owner, creative, or just curious — generative AI is already changing:</p><ul><li>How we write — drafting, editing, translating</li><li>How we design — logos, illustrations, mockups</li><li>How we code — building software faster than ever</li><li>How we learn — personalized explanations on any topic</li><li>How we communicate — voice, video, language barriers dissolving</li></ul><p>This isn’t a future technology. It’s here now, and understanding it — even at a basic level — puts you ahead of most people.</p><h3>The One-Line Summary for Each</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P2EC27553CpngIfBOwrANw.png" /></figure><blockquote>Generative AI isn’t one thing — it’s a family of technologies all built on the same big idea: machines that create. And we’re only at the beginning. How do you see Generative AI changing your work or hobbies? Let me know in the comments</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4ed1157b238d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Web Automation Testing with Python and Playwright]]></title>
            <link>https://medium.com/@akash.patel2520/web-automation-testing-with-python-and-playwright-984669ef68ac?source=rss-6a62d726c9f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/984669ef68ac</guid>
            <category><![CDATA[automation-testing]]></category>
            <category><![CDATA[playwrights]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[website-testing]]></category>
            <category><![CDATA[testing]]></category>
            <dc:creator><![CDATA[Akash Patel]]></dc:creator>
            <pubDate>Thu, 31 Oct 2024 17:24:06 GMT</pubDate>
            <atom:updated>2024-10-31T17:24:06.134Z</atom:updated>
            <content:encoded><![CDATA[<h4>Web automation testing is an essential skill for developers and testers to validate the functionality of websites, ensuring that forms, buttons, and user flows work as expected. Using Python with Playwright, an efficient automation framework, makes the process easier and more reliable.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NVETIx1_whgaYa71k1tlow.gif" /></figure><p>This guide walks you through automating websites with Playwright and Python, covering essential concepts, code examples, and tips for understanding the script better. We’ll dive into how to interact with web elements, handle logins, and manage dropdowns. This guide is designed for beginners and advanced users alike.</p><h4>Why Choose Playwright for Automation Testing?</h4><p>Playwright is a versatile browser automation tool that supports multiple browsers (Chromium, Firefox, WebKit), offers advanced features like parallel testing, and has an easy-to-learn API. Python, paired with Playwright, brings simplicity and flexibility, making it a preferred choice for web testing automation.</p><h4>Setting Up Playwright in Python</h4><p>Before we start writing the automation script, you need to install the required dependencies:</p><ol><li>Install Python from <a href="https://www.python.org/downloads/">Python’s official site</a>.</li><li>Install Playwright via pip:</li></ol><pre>pip install playwright</pre><p>3. Download and install the necessary browsers:</p><pre>playwright install</pre><p>With this, you’re ready to start writing your automation script!</p><h4>Understanding the Code: Automating a Login and Form Interaction</h4><p>Here’s a Python script using Playwright to automate filling out forms and interacting with elements on a webpage:</p><pre>from playwright.sync_api import sync_playwright<br><br>with sync_playwright() as p:<br>    browser = p.chromium.launch(headless=False)  # Launches the browser (not headless so you can see it)<br>    page = browser.new_page()  # Opens a new page<br>    <br>    # Navigating to the first website<br>    page.goto(&#39;https://demo.automationtesting.in/Index.html&#39;)<br>    <br>    # Interacting with the email field using its ID<br>    emailTxtBox = page.wait_for_selector(&#39;#email&#39;)<br>    emailTxtBox.type(&#39;Test@gmail.com&#39;)  # Type email into the text box<br><br>    # Clicking the login button<br>    buttonLogin = page.wait_for_selector(&#39;#enterimg&#39;)<br>    buttonLogin.click()<br><br>    page.wait_for_timeout(3000)  # Adding a delay to observe the interaction</pre><h4>Breaking Down the Code:</h4><ol><li><strong>Browser Launching</strong>: p.chromium.launch(headless=False) launches the Chromium browser. By setting headless=False, you can observe the interactions visually. If you prefer faster execution, you can run the browser in headless mode (headless=True).</li><li><strong>Navigating to Pages</strong>: page.goto() takes you to a specific URL. Here, the script navigates to a demo site.</li><li><strong>Selecting and Interacting with Elements</strong>: Playwright allows you to interact with elements through their selectors (IDs, classes, or attributes). The wait_for_selector() method ensures the element is available before you interact with it.</li><li><strong>Typing and Clicking</strong>: The .type() method simulates typing into input fields, while .click() triggers button clicks.</li></ol><p>This script handles filling out an email field and clicking a login button.</p><h4>Handling a Login Page with Form Fields</h4><p>Here’s how you can automate a login process on another website, demonstrating the use of attribute-based selectors:</p><pre>with sync_playwright() as p:<br>    browser = p.chromium.launch(headless=False)<br>    page = browser.new_page()<br><br>    # Navigating to a login page<br>    page.goto(&#39;https://opensource-demo.orangehrmlive.com/web/index.php/auth/login&#39;)<br><br>    # Filling in the username and password<br>    userNameTxt = page.wait_for_selector(&#39;input[name=&quot;username&quot;]&#39;)<br>    userNameTxt.type(&#39;Admin&#39;)  # Typing the username<br><br>    passwordTxt = page.wait_for_selector(&#39;input[name=&quot;password&quot;]&#39;)<br>    passwordTxt.type(&#39;admin123&#39;)  # Typing the password<br><br>    # Clicking the login button<br>    loginButton = page.wait_for_selector(&#39;button[type=&quot;submit&quot;]&#39;)<br>    loginButton.click()<br><br>    page.wait_for_timeout(3000)  # Adding a delay to observe the interaction</pre><h4><strong>Selectors and Actions:</strong></h4><ul><li><strong>Attribute Selectors</strong>: In the script above, we select the username and password fields using the input[name=&quot;username&quot;] and input[name=&quot;password&quot;] attribute selectors. This is useful when elements don’t have unique IDs.</li><li><strong>Waiting for Elements</strong>: Playwright intelligently waits for elements to appear before interacting, avoiding errors when the page is still loading.</li></ul><h4>Advanced Interactions: Hovering and XPath Selectors</h4><p>In addition to basic form filling, Playwright supports more advanced interactions like hovering over elements or selecting elements using XPath:</p><pre># Hover over a chart using XPath<br>chart = page.wait_for_selector(&#39;//*[contains(@class, &quot;oxd-pie-chart&quot;)]&#39;, timeout=5000)<br>chart.hover()<br><br>page.wait_for_timeout(2000)<br><br># Click on an item by text<br>txtPendingSelfReview = page.wait_for_selector(&#39;//p[text()=&quot;(1) Pending Self Review&quot;]&#39;)<br>txtPendingSelfReview.click()</pre><p><strong>XPath Selectors:<br></strong>In some cases, using CSS selectors can be limiting. XPath offers flexibility by allowing you to locate elements based on various attributes or even visible text. For example, //p[text()=&quot;(1) Pending Self Review&quot;] selects a paragraph element containing specific text.</p><h4>Working with Dropdowns: Selecting Options</h4><p>Another common interaction in web automation is selecting options from dropdown menus. Playwright simplifies this process with the select_option() method:</p><pre>page.goto(&quot;https://demo.automationtesting.in/Register.html&quot;)<br>page.wait_for_timeout(2000)<br><br># Selecting an option from a dropdown<br>page.select_option(selector=&#39;//select[@id=&quot;Skills&quot;]&#39;, label=&quot;APIs&quot;)</pre><p><strong>Dropdown Interactions:<br></strong><strong>select_option()</strong> allows you to interact with dropdowns by selecting options either by label, value, or index. In this case, we selected &quot;APIs&quot; from the &quot;Skills&quot; dropdown by its label.</p><h4>Running Tests Headlessly</h4><p>Once you’ve completed writing your tests, you may want to run them in headless mode for faster execution or when integrating into CI/CD pipelines. Simply change the headless option to True:</p><pre>browser = p.chromium.launch(headless=True)</pre><p>Using Playwright with Python offers a robust and flexible solution for web automation, enabling developers to simulate real-world user interactions and verify website behavior. Whether you’re working with forms, login pages, or more complex elements like dropdowns and charts, Playwright provides the tools to automate and test them easily.</p><ul><li>Browser automation basics</li><li>Selecting and interacting with elements using CSS and XPath selectors</li><li>Filling out forms and handling logins</li><li>Hovering over elements and selecting options from dropdowns</li></ul><blockquote>With Playwright, you can move from simple scripts to more advanced automation scenarios, making it a powerful tool for ensuring the reliability of your web applications.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=984669ef68ac" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dependency Injection in Swift: Simplifying Code with Enums and Property Wrappers]]></title>
            <link>https://towardsdev.com/streamlining-dependency-injection-in-swift-875d94c42153?source=rss-6a62d726c9f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/875d94c42153</guid>
            <category><![CDATA[property-wrapper]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios-development]]></category>
            <category><![CDATA[clean-code]]></category>
            <category><![CDATA[dependency-injection]]></category>
            <dc:creator><![CDATA[Akash Patel]]></dc:creator>
            <pubDate>Tue, 29 Oct 2024 14:54:30 GMT</pubDate>
            <atom:updated>2024-10-29T17:30:14.559Z</atom:updated>
            <content:encoded><![CDATA[<p>Dependency Injection (DI) is an essential design pattern that enhances the maintainability and testability of your Swift applications. However, implementing DI can sometimes lead to complexity and boilerplate code. This article aims to simplify DI using property wrappers and enums, making it easier to manage dependencies. We will also explore the use of an enum to define dependency scopes, highlighting its benefits.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cCv8eXzUVhbaxVB22tA2fg.png" /></figure><p>Before diving into the implementation, let’s clarify what Dependency Injection is. Simply put, DI allows a class to receive its dependencies from an external source rather than creating them internally. This promotes loose coupling between components, making your codebase more flexible and easier to test.</p><h4>Traditional Dependency Injection Example</h4><p>Consider a simple example where a ViewModel class requires an APIService to fetch data. In a traditional setup, you might inject the service through the initializer:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ASc92SMr4Qjx3BiXpF8yGw.png" /></figure><p>While this works, it can become tedious and verbose, especially when dealing with multiple dependencies or service implementations.</p><h4>Enhancing Dependency Injection with Property Wrappers</h4><p>Property wrappers simplify the management of property initialization and value storage. They allow us to encapsulate the logic for resolving dependencies, reducing boilerplate code.</p><h4>Creating the Property Wrapper</h4><p>We’ll create a property wrapper called Injected that will handle dependency resolution:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WNbRH5-4JGiGRl26krdyCg.png" /></figure><h4>Using Enums for Service Names</h4><p>To avoid string literals, we’ll define an enum that represents the different services available in our application:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yDfni1BruWEaBNefMbEpuw.png" /></figure><h4>Registering Services</h4><p>Now we can register multiple implementations of our APIService in a DependencyInjector. This class will manage the lifecycle of our dependencies, including both singleton and transient scopes.</p><p><strong>Defining Dependency Scopes<br></strong>We define the enum DependencyScope to categorize the lifecycle of services:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*74WYoXTq9T3MtGHJxRhxFA.png" /></figure><p><strong>Benefits of Using Dependency Scopes:</strong></p><ul><li><strong>Singleton:</strong> Using singleton scope ensures that a single instance of a service is used throughout the application. This can be beneficial for services that manage shared resources, such as network sessions or database connections.</li><li><strong>Transient:</strong> With transient scope, a new instance is created each time the service is requested. This is useful for stateless services or those that should not share state between different consumers.</li></ul><h4>Implementing the Dependency Injector</h4><p>Here’s how you can implement a simple dependency injector:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tu_Pu4BFn_EL3ub6nMlovw.png" /></figure><h4>Registering Services Using Enum Cases</h4><p>When registering your services, you can use the enum cases instead of string literals:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PlgWR4o-7_EHlD2v5yahKQ.png" /></figure><h4>Using the Property Wrapper in Your Classes</h4><p>Now that we have set everything up, we can easily inject dependencies using the property wrapper in our ViewModel class:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rvHaGABrkl1iUDx_sjLKbA.png" /></figure><h4>Integrating in ViewController</h4><p>Finally, let’s see how the ViewModel can be used in a ViewController:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zRK-DOfsXskEmy2v0XxQnA.png" /></figure><p>By utilizing enums for service names, property wrappers for dependency resolution, and a well-structured dependency injector, you can significantly enhance the maintainability and readability of your Swift code.</p><h4>Key Takeaways:</h4><ul><li><strong>Enums:</strong> Help eliminate hard-coded strings, reducing the risk of typos and making your code cleaner.</li><li><strong>Property Wrappers:</strong> Encapsulate the complexity of dependency resolution, promoting a simpler syntax for injecting dependencies.</li><li><strong>Dependency Scopes:</strong> Provide flexibility in managing service lifecycles, allowing for both singleton and transient service instances.</li></ul><p>This structured approach to Dependency Injection not only keeps your code organized but also aligns with best practices in software development, ensuring your Swift applications are robust, maintainable, and easy to test.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=875d94c42153" width="1" height="1" alt=""><hr><p><a href="https://towardsdev.com/streamlining-dependency-injection-in-swift-875d94c42153">Dependency Injection in Swift: Simplifying Code with Enums and Property Wrappers</a> was originally published in <a href="https://towardsdev.com/">Towards Dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OptionSet vs. enum in Swift: A Deep Dive with Use Cases]]></title>
            <link>https://towardsdev.com/optionset-vs-enum-in-swift-a-deep-dive-with-use-cases-21c9017401ca?source=rss-6a62d726c9f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/21c9017401ca</guid>
            <category><![CDATA[enum]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[optionset]]></category>
            <dc:creator><![CDATA[Akash Patel]]></dc:creator>
            <pubDate>Thu, 24 Oct 2024 13:07:39 GMT</pubDate>
            <atom:updated>2024-10-28T14:56:31.280Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/704/1*duI4DOQnqKq37E3u6N6BRQ.png" /></figure><p>There are times when you need to represent a range of values that your code can handle. This is where enum and OptionSet come into play. While both offer powerful ways to define groups of related values, they serve different purposes and shine in different scenarios. Whether you’re managing mutually exclusive states or combining multiple options in a flexible way, understanding when to use each is essential for writing clean, scalable, and maintainable Swift code.</p><p>As Swift developers, we often need to represent a set of values, such as user preferences, app configurations, or system states. Choosing between enum and OptionSet isn’t just a technical decision — it’s about writing code that is <strong>clear</strong>, <strong>efficient</strong>, and <strong>flexible</strong>.</p><p>An enum helps when you want to handle <strong>distinct, mutually exclusive</strong> states, while an OptionSet comes into play when <strong>multiple, non-exclusive</strong> options need to be combined. By the end of this article, you’ll know exactly which one to pick based on the needs of your application.</p><h3>Enum</h3><p>An enum in Swift defines a type that can hold one of several related values. It’s perfect for modeling states that are <strong>mutually exclusive</strong> — meaning, an instance of the enum can only hold <strong>one value at a time</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EXHVa9rb8doHTNFhEs7Pvw.png" /></figure><h4>Use Cases for enum</h4><ul><li>Situations where a variable can be <strong>only one value at a time</strong>, such as app states, user roles, or transport modes.</li><li><strong>Error handling</strong> is a popular use case, where each error type is represented by a case in the enum.</li></ul><h4>Benefits of enum</h4><ul><li><strong>Exhaustive handling</strong>: Swift enforces handling all possible cases in a switch, making your code safer and reducing the chance of missing a scenario.</li><li><strong>Strong typing</strong>: Since an enum can only represent one state at a time, it clearly communicates to other developers what states are available and how they are used.</li><li><strong>Cleaner code</strong>: enum provides clear, simple ways to represent exclusive states without confusion.</li></ul><h3>OptionSet</h3><p>Now, imagine you’re building a configuration panel where users can combine multiple settings. For this, OptionSet is the ideal solution. It allows you to define bitwise flags, where each flag represents a different option. These flags can be combined using <strong>bitwise OR (</strong><strong>|)</strong> and checked using <strong>bitwise AND (</strong><strong>&amp;)</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*USiMwEwLVhCs9xFWS56xBw.png" /></figure><h4>Use Cases for OptionSet</h4><ul><li>Scenarios where <strong>multiple options can be selected simultaneously</strong>.</li><li><strong>Feature flags</strong>, <strong>permissions</strong>, or <strong>configuration settings</strong> where you want flexibility in combining values.</li></ul><h4>Benefits of OptionSet</h4><ul><li><strong>Flexibility</strong>: You can combine options easily, allowing for a more dynamic and adaptable codebase.</li><li><strong>Performance</strong>: OptionSets are memory-efficient due to their use of bitwise operations, making them ideal for performance-sensitive code.</li><li><strong>Readability</strong>: While flexible, OptionSet allows you to model multiple simultaneous states clearly.</li></ul><p>Consider a <strong>streaming service</strong> where users can select different quality settings, genres, and personalized options. Here’s a scenario where an OptionSet can be used to combine various viewing options, while an enum can manage the user’s selected subscription plan.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9qKt5HlqcJZsCP-498nVAw.png" /></figure><p>This example demonstrates how OptionSet and enum can be used in a high-end app like a streaming service, where combining flexible options and handling exclusive states efficiently enhances the user experience.</p><blockquote>Understanding when to use enum and OptionSet will help you design Swift applications that are robust and maintainable. While enum handles mutually exclusive states beautifully, OptionSet provides the flexibility needed when options can be combined. Combining both in real-world apps like ride-sharing or streaming services can give your applications a clean, powerful architecture.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=21c9017401ca" width="1" height="1" alt=""><hr><p><a href="https://towardsdev.com/optionset-vs-enum-in-swift-a-deep-dive-with-use-cases-21c9017401ca">OptionSet vs. enum in Swift: A Deep Dive with Use Cases</a> was originally published in <a href="https://towardsdev.com/">Towards Dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Escaping and Non-Escaping Closures in iOS: Examples and Execution Logs]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@akash.patel2520/escaping-and-non-escaping-closures-in-ios-examples-and-execution-logs-8b3d941e7172?source=rss-6a62d726c9f5------2"><img src="https://cdn-images-1.medium.com/max/1920/1*gOOydibc2AzZd5D0DJAU0Q.png" width="1920"></a></p><p class="medium-feed-snippet">Closures are a powerful feature in Swift that allow you to encapsulate functionality and pass it around in your code. But one of the key&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@akash.patel2520/escaping-and-non-escaping-closures-in-ios-examples-and-execution-logs-8b3d941e7172?source=rss-6a62d726c9f5------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@akash.patel2520/escaping-and-non-escaping-closures-in-ios-examples-and-execution-logs-8b3d941e7172?source=rss-6a62d726c9f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/8b3d941e7172</guid>
            <category><![CDATA[closure]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[escaping]]></category>
            <category><![CDATA[ios-development]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[Akash Patel]]></dc:creator>
            <pubDate>Thu, 03 Oct 2024 14:34:46 GMT</pubDate>
            <atom:updated>2024-10-03T14:34:46.857Z</atom:updated>
        </item>
    </channel>
</rss>