<?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 Linda Olela on Medium]]></title>
        <description><![CDATA[Stories by Linda Olela on Medium]]></description>
        <link>https://medium.com/@lindaolela?source=rss-3e5a9311025a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*1EcIY-Q1xORsSncuTGBOlQ.png</url>
            <title>Stories by Linda Olela on Medium</title>
            <link>https://medium.com/@lindaolela?source=rss-3e5a9311025a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 16:46:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@lindaolela/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[Pivot Mondays: My journey into Python]]></title>
            <link>https://medium.com/@lindaolela/change-career-mondays-my-journey-into-python-5de7e4a4229f?source=rss-3e5a9311025a------2</link>
            <guid isPermaLink="false">https://medium.com/p/5de7e4a4229f</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[motivation]]></category>
            <category><![CDATA[careers]]></category>
            <category><![CDATA[learning]]></category>
            <dc:creator><![CDATA[Linda Olela]]></dc:creator>
            <pubDate>Mon, 03 Feb 2025 06:52:51 GMT</pubDate>
            <atom:updated>2025-02-03T06:59:36.711Z</atom:updated>
            <content:encoded><![CDATA[<p>If you had told me a few years ago that I’d be diving headfirst into Python, I probably would have laughed. Not because I wasn’t interested in tech — but because, like many career changers, I had that little voice in my head saying, <em>“Isn’t it too late to start?”</em> Spoiler alert: It’s never too late.</p><p>I started learning Python with a mix of curiosity, excitement, and (let’s be real) a bit of fear. After all, I was coming from a completely different professional background — sales. But as I started, I realized something: coding is a lot like problem-solving, something I’ve always enjoyed.</p><h3>The First Steps: From ‘Hello, World’ to ‘Oh, That’s How It Works!’</h3><p>Like any beginner, my first taste of Python was printing Hello, World!. Simple, yet oddly satisfying. But the real magic happened when I started understanding how functions, loops, and conditions work. I remember writing my first function to replace :) with 🙂 and :( with 🙁. Such a small program, yet it felt like I had unlocked a whole new way of thinking.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/1*d4dTJ_DRJXxvLcSvtTyTYA.png" /></figure><p>Then came the deeper concepts: variables, data types, and string manipulation. I was introduced to the command line (which once looked intimidating but now feels like a secret weapon) and started using VS Code to write my scripts. With every small project, I gained more confidence.</p><h3>Challenges? Oh, Plenty!</h3><p>Learning a new skill, especially one as vast as programming, isn’t all smooth sailing. There were moments when I felt stuck, moments when a simple bug would drive me crazy, and moments when I questioned if I was making any progress at all. But here’s the thing: every challenge was an opportunity to grow.</p><p>One of the biggest lessons I’ve learned? <strong>Debugging is part of the process.</strong> At first, seeing errors felt discouraging. Now, I see them as clues. Each mistake teaches me something new, and each solved problem boosts my confidence.</p><h3>Why I’m Sticking With It</h3><p>I love the logic behind programming, the sense of accomplishment when my code runs successfully, and the endless possibilities it unlocks. But beyond that, I see the bigger picture: I want to transition into tech, and Python is my stepping stone.</p><p>I know this journey is just beginning, and I still have a long way to go. But if there’s one thing I want to share with anyone thinking about making a career change into tech, it’s this: <strong>You don’t have to be perfect to start. You just have to start.</strong></p><p>So, here’s to <strong>Pivot Mondays!</strong> If you’re learning something new, making a transition, or just considering a leap — keep going. The best things happen when we step outside our comfort zones. 🚀</p><p>Are you also learning something new? Drop a comment and let’s share experiences!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5de7e4a4229f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I saved 2 Workdays in Just Minutes: Automating File Updates with Python]]></title>
            <link>https://medium.com/@lindaolela/how-i-saved-2-workdays-in-just-minutes-automating-file-updates-with-python-d0d90b43dbc1?source=rss-3e5a9311025a------2</link>
            <guid isPermaLink="false">https://medium.com/p/d0d90b43dbc1</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[work]]></category>
            <category><![CDATA[time-management]]></category>
            <category><![CDATA[automation]]></category>
            <dc:creator><![CDATA[Linda Olela]]></dc:creator>
            <pubDate>Wed, 13 Nov 2024 15:25:22 GMT</pubDate>
            <atom:updated>2024-11-13T15:25:22.131Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dPGNfuOpf6jfOCI2" /><figcaption>Photo by <a href="https://unsplash.com/@fakurian?utm_source=medium&amp;utm_medium=referral">Milad Fakurian</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Introduction</h3><p>Automating routine tasks can save significant time and reduce human error, especially when working with client-specific requirements. Recently, I encountered a task at work where a client required that all product measurement data be consistently added to their PDF documents. To streamline this process and ensure accuracy, I wrote a Python script to automate the updates.</p><h3>The Challenge</h3><p>The client needed PDFs that included detailed product measurements for each item they purchased. Not only that, the client wanted the information in a very specific manner. This was a time-consuming process when done manually, involving opening each PDF, editing it to add the necessary data, and ensuring the format was consistent across files.</p><h3>The Solution</h3><p>Using Python and the PyMuPDF library, I created a script that automated this process, saving time on a task that would have otherwise taken 2 entire workdays. Below is a breakdown of how the script works:</p><ol><li><strong>Reading and Editing PDFs</strong>: The script uses the PyMuPDF library (imported as fitz) to read and edit PDF files.</li><li><strong>Automated Updates</strong>: It scans a directory for PDFs, opens each file, adds the required product measurements in the specified position, and saves the modified version in a designated output folder.</li></ol><h3>The Script</h3><p>Here’s a code snippet of the Python script I used to automate this process:</p><p>Click <a href="https://github.com/olela28/pdf-measurements-script/tree/main">here</a> for detailed information in the README file.</p><pre>import os<br>import fitz  # PyMuPDF</pre><pre>def add_measurements_to_pdf(input_pdf, output_pdf, measurements):<br>    pdf_document = fitz.open(input_pdf)<br>    page = pdf_document[0]</pre><pre>    text_blocks = page.get_text(&quot;blocks&quot;)<br>    declaration_block = None</pre><pre><br>    for block in text_blocks:<br>        if &quot;Declaration&quot; in block[4]:  <br>            declaration_block = block<br>            break</pre><pre>    # If the &quot;Declaration&quot; block was found, position &quot;Size&quot; directly below it<br>    if declaration_block:<br>        y = declaration_block[3] + 15  <br>        x_key = declaration_block[0]  </pre><pre>        # Offset for the value to align it with other values<br>        x_value = declaration_block[2] + 12  </pre><pre>        font_size = 10</pre><pre>        size_text = &quot;Size&quot;<br>        page.insert_text((x_key, y), size_text, fontsize=font_size, color=(0, 0, 0))</pre><pre>        <br>        remaining_text = measurements.split(&quot;Size&quot;)[1].strip()<br>        page.insert_text((x_value, y), remaining_text, fontsize=font_size, color=(0, 0, 0))</pre><pre>    # Save the updated PDF files<br>    pdf_document.save(output_pdf)<br>    pdf_document.close()</pre><pre>def process_pdfs(input_directory, output_directory):<br>    # Create the output directory if it doesn&#39;t exist<br>    os.makedirs(output_directory, exist_ok=True)</pre><pre>    for filename in os.listdir(input_directory):<br>        input_path = os.path.join(input_directory, filename)</pre><pre>        # Check the product name to decide which measurements to add<br>        if &quot;Teastar&quot; in filename.upper() or &quot;BAG@100&quot; in filename.upper():<br>            measurements = &quot;Size    1 BAG@100 GR&quot;<br>        elif &quot;5 x 20 BAGS&quot; in filename:<br>            measurements = &quot;Size    5x20 BAGS&quot;<br>        elif &quot;5 x 15 BAGS&quot; in filename:<br>            measurements = &quot;Size    5x15 BAGS&quot;<br>        elif &quot;LEAFCUP&quot; in filename:<br>            measurements = &quot;Size    1 TEABAG, CASE = 90 BAGS&quot;<br>        elif &quot;BAG@250&quot; in filename or &quot;BAG@ 250 GR&quot; in filename:<br>            measurements = &quot;Size    1 BAG@250 GR&quot;<br>        else:<br>            continue  # Skip files that don&#39;t match</pre><h3>How It Works</h3><p>The core of the script was built using Python libraries like PyMuPDF. Here’s a high-level overview of what the script did:</p><ul><li><strong>File Directory Setup</strong>: The script scans a specified directory (pdf_files) for PDF files.</li><li><strong>Adding Measurements</strong>: For each PDF, the script inserts the product measurements at a specified location on the first page of the file.</li><li><strong>Save the Updated File</strong>: The modified PDFs are then saved in a designated directory (updated_files) after the necessary updates are applied.</li></ul><h3>Benefits</h3><p>Automating the process and implementing this solution provided several key benefits:</p><ul><li><strong>Time Savings</strong>: I reduced what would have taken 2 working days into a task completed in less than an hour . This frees up time allowing you to focus on tasks that you actually enjoy.</li><li><strong>Consistency</strong>: The script ensures that the format and placement of the text are uniform across all PDFs and eliminates human error.</li><li><strong>Scalability</strong>: The solution can be adapted to include additional or variable data as needed.</li></ul><h3>Final Thoughts</h3><p>Automating PDF updates with Python is an efficient way to handle repetitive tasks, improve productivity, and enhance the accuracy of document modifications. By eliminating manual work, we not only save time and resources but also set the stage for further process optimizations. I hope this script inspires others facing similar challenges to explore Python-based automation solutions.</p><p>Feel free to reach out or comment if you have questions or want more details about this implementation!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0d90b43dbc1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Research Chaos to Chrome Extension Developer: A Journey of Growth]]></title>
            <link>https://medium.com/@lindaolela/from-research-chaos-to-chrome-extension-developer-a-journey-of-growth-d832f5474b3f?source=rss-3e5a9311025a------2</link>
            <guid isPermaLink="false">https://medium.com/p/d832f5474b3f</guid>
            <category><![CDATA[gi̇t]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[growth-mindset]]></category>
            <category><![CDATA[upskilling]]></category>
            <dc:creator><![CDATA[Linda Olela]]></dc:creator>
            <pubDate>Mon, 28 Oct 2024 11:32:22 GMT</pubDate>
            <atom:updated>2024-10-28T11:32:22.589Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZxLmpTouezMurtVW" /><figcaption>Photo by <a href="https://unsplash.com/@hesterqiang?utm_source=medium&amp;utm_medium=referral">Hester Qiang</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>If someone had told me a year ago that I would be programming and developing software, I would have thought they were talking about someone else. Never did I imagine I’d be in this position — yet here I am, building Google Chrome extensions.</p><p>If you’re anything like me, when you’re deep in research or learning something new, you tend to perform a quick Google search, hop onto a few websites, and before you know it, you’ve got 10 or 20 tabs open. Each tab holds valuable information, and the thought of closing any of them feels like losing essential pieces of the puzzle. But when you finally come back to your research, it’s overwhelming to remember where everything fits.</p><p>That’s been my experience since I began learning computer science and programming. Recently, I thought, “What if there was an extension that could summarize my searches at the end of the day or week, giving me an overview of all the information I gathered?”</p><p><strong>The Idea: Simplifying Online Research</strong></p><p>With this thought, I set out to build a Chrome extension that tracks my search history and provides summaries, allowing me to close tabs without losing key information. This tool gives me an organized snapshot of my research, making the entire process less chaotic and more productive.</p><p>I started coding in my local environment on VS Code, and I pushed my work to a GitHub repository, which helped me practice my skills in Git. Each step was a learning opportunity, bringing me closer to creating a tool that genuinely solves a problem I face.</p><p><strong>Celebrating Growth and New Skills</strong></p><p>Today is my birthday, and as I reflect on the past year, I feel grateful for the lessons I’ve learned, the skills I’ve gained, and the experiences that have shaped me. I never thought I’d be capable of writing a program or creating a Chrome extension, and yet, here I am.</p><p>So if you’re considering taking on a new challenge or learning something completely different, I encourage you to go for it. You’ll be surprised at just how much you can achieve.</p><p>#happycoding #happyweek…. And happy birthday to me! :-)</p><p><strong>Looking Ahead</strong></p><p>By simplifying how we manage online information, I aim to enhance productivity and create a more organized browsing experience. I’m excited to continue this journey and see how this tool evolves. If you’re interested, feel free to connect and share your thoughts on how you approach online research!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d832f5474b3f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Secrects to Web Development: Why Design is Key]]></title>
            <link>https://medium.com/@lindaolela/secrects-to-web-development-why-desing-is-key-6282421de29a?source=rss-3e5a9311025a------2</link>
            <guid isPermaLink="false">https://medium.com/p/6282421de29a</guid>
            <category><![CDATA[design]]></category>
            <category><![CDATA[website]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Linda Olela]]></dc:creator>
            <pubDate>Wed, 02 Oct 2024 04:07:20 GMT</pubDate>
            <atom:updated>2024-10-02T05:25:29.184Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jg1W-Mbgot-Ef18UitykUg.jpeg" /></figure><p>Recently, I’ve been learning so much about web application programming, and it’s been an eye-opening journey. One of the most valuable lessons I’ve learned since I started coding is that programming is more than just writing code — it’s about problem-solving and constantly challenging yourself to find better, faster, and more efficient solutions.</p><p>That’s the beauty of learning to code: it transforms how you approach challenges. You see a task, come up with a solution, and then ask, “Is there a better way?” This mindset has been key for me in my development journey. And lately, it has been paying off while I have been working on building a web application. After completing a project that’s been on my mind for a while: my portfolio website, I took the lessons learnt, and implemented them on my next project.</p><h3>Building My Portfolio:</h3><p>Creating a portfolio website was a rewarding experience. It’s not just about showcasing your skills — it’s a problem-solving exercise in itself. I wanted to make it easier for others looking to build their own portfolios, so I created a ready-to-use <strong>portfolio website template</strong>. With it, you can have your personal site up and running in no time! If you’re interested, let me know — you can also check out my own portfolio <a href="https://olela28.github.io/olela-website/">here</a>.</p><h3>The Power of Design in Web Development</h3><p>Now, as I work on my next web app, I’ve realized that there’s one crucial aspect of web development that often gets overlooked: <strong>design</strong>. Before I even write a single line of code, I start with the design. Why? Because it’s the backbone of how your users will experience and interact with your software.</p><p>Here’s what I’ve learned: the design process starts with mapping out the <strong>user journey</strong>. Ask yourself, “What is the main problem my users are trying to solve?” and “How can I guide them through that solution efficiently?” Every page, every section should serve a clear purpose.</p><p><strong>Break it down:</strong></p><ul><li>What problem does this section solve?</li><li>What information does this section provide?</li></ul><p>By answering these questions early on, you’ll be able to craft both the content and layout of your website or app in a way that resonates with users. Good design is more than aesthetics — it’s about <strong>usability</strong>.</p><h3>A Simple Formula for Choosing Colors and Fonts</h3><p>Once you’ve nailed down your design, it’s time to think about your <strong>color scheme</strong> and <strong>typography</strong>. Here’s a tip that has saved me hours of guesswork: stick with four core colors. Two of these should be <strong>black and white</strong> (or variations thereof), and the other two should be your <strong>accent colors</strong>. One will be your <strong>primary</strong> brand color, and the other, your <strong>secondary</strong>.</p><p>Don’t get too caught up in the details here — keep it simple. By using <strong>global variables</strong> for your colors and fonts in your code, you can easily make adjustments later without rewriting everything. This small trick will make your life so much easier as your project grows and evolves.</p><h3>Time to Build: Choosing Your Tech Stack</h3><p>With the design and branding decisions out of the way, you’re more than halfway to your goal. Now it’s time to choose the right <strong>tech stack</strong> for your project. Once you have a clear vision of what you’re building, selecting the right tools and starting to write code becomes a breeze.</p><p>And here’s the fun part: <strong>keep it simple</strong>. Remember, your users are coming to your site to solve a problem — don’t distract them with fluff. Focus on a clean user experience, have a clear <strong>call to action</strong> (CTA), and prioritize your users’ needs every step of the way.</p><h3>The Secret Sauce: Design, Design, Design</h3><p>At the end of the day, if I’ve learned anything, it’s that <strong>design</strong> is at the heart of successful web development. Whether you’re just getting started or looking to take your skills to the next level, always put design at the forefront of your process.</p><p>And here’s a <strong>pro tip</strong> for those looking to get serious about web development: learn about <strong>web APIs</strong>. They’re a game-changer, but that’s a topic for another day. For now, happy coding — and even happier designing! 😄</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6282421de29a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Built My Developer Portfolio Website from Scratch]]></title>
            <link>https://medium.com/@lindaolela/how-i-built-my-developer-portfolio-website-from-scratch-d6c14445ca62?source=rss-3e5a9311025a------2</link>
            <guid isPermaLink="false">https://medium.com/p/d6c14445ca62</guid>
            <category><![CDATA[portfolio-website]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[html-css]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[personal-branding]]></category>
            <dc:creator><![CDATA[Linda Olela]]></dc:creator>
            <pubDate>Thu, 19 Sep 2024 09:05:09 GMT</pubDate>
            <atom:updated>2024-09-19T09:05:09.877Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5_giECMJ5QgM3Ka4" /><figcaption>Photo by <a href="https://unsplash.com/@clarktibbs?utm_source=medium&amp;utm_medium=referral">Clark Tibbs</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>As a developer, having a well-crafted portfolio website is crucial for showcasing your skills, projects, experience, and, perhaps most importantly, your growth. Whether you’re applying for jobs or building your personal brand, a portfolio gives you the edge in a competitive field. Recently, I took on the challenge of building my own portfolio website, and I’d love to share the journey, challenges, and solutions I encountered along the way.</p><p>In this article, I’ll walk you through how I designed and developed a modern, responsive portfolio website from scratch using HTML, CSS, Bootstrap, and JavaScript.</p><h3><strong>Why Build a Portfolio?</strong></h3><p>I’ve recently been transitioning into software engineering and as someone who loves learning and exploring different technologies, I needed a space that would not only display my skills but also tell my story. A personal portfolio allows you to do just that. It’s a place where I can:</p><ul><li><strong>Showcase my projects</strong>: Whether it’s a Flask stock trading app, automated Python scripts, or IoT-based solutions, I wanted potential employers and collaborators to see the work I’ve done.</li><li><strong>Share my writing</strong>: I enjoy sharing insights through blog posts on platforms like Medium, and my portfolio serves as an anchor point for all my articles.</li><li><strong>Connect with potential clients</strong>: Since I offer services like building portfolios for other developers, my website acts as a hub for inquiries.</li></ul><h3>Planning the Website Structure</h3><p>The first step was deciding what sections to include on the website. I knew I wanted the following:</p><ol><li><strong>Home</strong> — An introduction and a welcoming section.</li><li><strong>Projects</strong> — A gallery of the various projects I’ve worked on.</li><li><strong>Skills</strong> — A list of technologies and tools I’m proficient in.</li><li><strong>Blog</strong> — A section where my latest Medium articles are displayed dynamically.</li><li><strong>About Me</strong> — A brief biography, focusing on my career goals and journey.</li><li><strong>Contact</strong> — A simple form to allow visitors to get in touch with me.</li></ol><h3>Choosing the Tech Stack</h3><p>For this project, I went with a stack that was easy to manage and well-documented:</p><ul><li><strong>HTML5</strong> for the structure of the site.</li><li><strong>CSS3</strong> and <strong>Bootstrap</strong> for styling and responsive design.</li><li><strong>JavaScript</strong> for functionality, especially in the Blog section where posts are loaded dynamically from my Medium feed.</li><li><strong>GitHub Pages</strong> to host the site.</li></ul><h3>Implementing the Design</h3><p>I wanted a dark theme for my portfolio to give it a modern, sleek look. I initially tried using a Bootswatch theme, but later decided to custom-tailor the design to fit my personal style.</p><h4>Home Section</h4><p>The home section is minimalist, with a welcoming headline and a call-to-action button that directs visitors to my About Me section. One challenge I faced early on was ensuring that the content wasn’t hidden behind the navigation bar when viewed on a phone. After tweaking the CSS and adding padding to the top of the home section, I resolved the issue.</p><h4>Projects Section</h4><p>For the Projects section, I used Bootstrap’s grid system to display cards that showcase my work. I customized the size of the images and cards for better visibility, especially on mobile devices.</p><p>One highlight of this section is how easy it was to integrate responsiveness using Bootstrap. The grid layout allowed me to neatly organize the projects, ensuring they look great on both large and small screens.</p><h4>About Me Section</h4><p>This is where I share my journey, including my shift to full-stack development and my passion for data analytics. However, I encountered a small issue: on smaller screens, the content was spilling over the width of the device. After some troubleshooting, I added Bootstrap’s responsive utilities and CSS max-width properties to ensure the section adjusts smoothly on mobile.</p><p>Here’s a snippet of my CSS for the About Me section:</p><pre>#about {<br>    background-color: #1e1e1e;<br>    padding: 60px 0;<br>    color: #e0e0e0;<br>}<br><br>#about h2 {<br>    color: #ffcc00;<br>    font-size: 36px;<br>    margin-bottom: 20px;<br>    text-align: center;<br>}<br><br>#about .bio {<br>    font-size: 18px;<br>    line-height: 1.8;<br>    margin: 0 auto;<br>    max-width: 800px;<br>    text-align: center;<br>}</pre><h4>Blog Section</h4><p>The most interesting part of my website is the dynamic <strong>Blog</strong> section. I wanted my latest Medium posts to load automatically onto my website. To achieve this, I integrated Medium’s RSS feed using JavaScript.</p><p>Initially, I loaded all posts at once, but later refined the functionality to load two blog posts at a time when a “Load More” button is clicked. Here’s the JavaScript I used to implement the button:</p><pre>document.addEventListener(&#39;DOMContentLoaded&#39;, function() {<br>    const loadMoreBtn = document.getElementById(&#39;load-more&#39;);<br>    const blogContainer = document.getElementById(&#39;blog-container&#39;);<br>    let page = 1;<br>    const postsPerLoad = 2;<br><br>    function loadBlogPosts() {<br>        fetch(`https://api.rss2json.com/v1/api.json?rss_url=https://medium.com/feed/@myMediumUsername&amp;page=${page}`)<br>        .then(response =&gt; response.json())<br>        .then(data =&gt; {<br>            if (data.items &amp;&amp; data.items.length &gt; 0) {<br>                let postBatch = data.items.slice(0, postsPerLoad);<br>                postBatch.forEach(post =&gt; {<br>                    const postElement = document.createElement(&#39;div&#39;);<br>                    postElement.className = &#39;col-md-4 mb-4&#39;;<br>                    postElement.innerHTML = `<br>                        &lt;div class=&quot;card blog-card&quot;&gt;<br>                            &lt;img src=&quot;${post.thumbnail}&quot; class=&quot;card-img-top&quot; alt=&quot;${post.title}&quot;&gt;<br>                            &lt;div class=&quot;card-body&quot;&gt;<br>                                &lt;h5 class=&quot;card-title&quot;&gt;${post.title}&lt;/h5&gt;<br>                                &lt;p class=&quot;card-text&quot;&gt;${post.description}&lt;/p&gt;<br>                                &lt;a href=&quot;${post.link}&quot; class=&quot;btn btn-primary&quot; target=&quot;_blank&quot;&gt;Read More&lt;/a&gt;<br>                            &lt;/div&gt;<br>                        &lt;/div&gt;<br>                    `;<br>                    blogContainer.appendChild(postElement);<br>                });<br>            }<br>        })<br>        .catch(error =&gt; console.log(&#39;Error loading blog posts:&#39;, error));<br>    }<br><br>    loadMoreBtn.addEventListener(&#39;click&#39;, loadBlogPosts);<br>});</pre><h3>Going Live on GitHub Pages</h3><p>Finally, I deployed my website to GitHub Pages, which was surprisingly easy. GitHub Pages provides free hosting and is perfect for simple static websites like portfolios.</p><h3>Lessons Learned</h3><p>Every project is a learning experience, and building my portfolio was no different. I have learnt a lot during this process, from CSS responsiveness to dynamic JavaScript implementations. Some of the key takeaways include:</p><ul><li><strong>Start Simple</strong>: The first version of your site doesn’t need to be perfect. Get a foundation in place and keep improving.</li><li><strong>Responsiveness matters</strong>: With mobile browsing on the rise, ensuring your website looks good on all devices is crucial.</li><li><strong>Iterate &amp; Optimize</strong>: It’s easy to fall into the trap of endlessly tweaking, but setting goals for each iteration keeps things manageable.</li><li><strong>Modularize your code</strong>: Writing clean, reusable code made debugging and feature updates much easier.</li><li><strong>Dynamic content is key</strong>: Integrating my blog dynamically allows me to focus on content creation while my website updates itself.</li></ul><h3>What’s Next?</h3><p>The work doesn’t end here. As I continue to grow as a developer, my portfolio will evolve. I’m planning to add more features, like integrating a contact form with email notifications. I also want to experiment with animation libraries to make the user experience more engaging.</p><p>Lastly, I plan to create a template based on my portfolio and offer my services to others looking to build their own developer websites. Stay tuned for that!</p><h3>Conclusion</h3><p>Building a portfolio website was a rewarding experience. It serves as a live demonstration of my skills while giving me full control over my personal brand. As I focus on full-stack development and continue exploring new areas like IoT software, my portfolio will be a testament to my growth and versatility.</p><p>If you’re considering building your own portfolio, my advice is simple: <strong>embrace the process. </strong>It might feel overwhelming at times, but every challenge is an opportunity to learn and improve. You’ve got this! And the joy of seeing your work come to life, is absolutely worth it.</p><p>Want to see the website live? Check it out <a href="https://olela28.github.io/olela-website/#">here</a>.</p><p>Let me know in the comments if you have any questions or if you’re working on your own portfolio. I’d love to help!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d6c14445ca62" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I automated the Renaming of PDF files with Python]]></title>
            <link>https://medium.com/@lindaolela/how-i-automated-the-renaming-of-pdf-files-with-python-ce8fbca92ac3?source=rss-3e5a9311025a------2</link>
            <guid isPermaLink="false">https://medium.com/p/ce8fbca92ac3</guid>
            <category><![CDATA[problem-solving]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[self-taught]]></category>
            <dc:creator><![CDATA[Linda Olela]]></dc:creator>
            <pubDate>Thu, 12 Sep 2024 13:07:01 GMT</pubDate>
            <atom:updated>2024-09-12T13:07:01.247Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yTB-g5e_kq0YtT9U" /><figcaption>Photo by <a href="https://unsplash.com/@omilaev?utm_source=medium&amp;utm_medium=referral">Igor Omilaev</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Have you ever been assigned a task so repetitive that it drains your energy after just a few minutes? Recently, I was tasked with renaming 96 PDF files for a client. The thought of renaming each file manually had me questioning my life choices. Five files in, I paused and thought, “Surely, there’s a better way to do this!”</p><p>That’s when I turned to Python, a programming language that’s quickly becoming my go-to tool for automation. In this article, I’ll walk you through how I used Python to automate the entire process of renaming 96 files in just a few seconds.</p><h3>The Problem: A tedious task</h3><p>Imagine receiving 96 PDF files, each of which has to be renamed. I started by creating a neatly organized Excel file with the old names in one column and the new names they wanted in another. My task was to rename each file to match the new names.</p><p>After renaming just a few files manually, I could already feel the tedium setting in. That’s when I realized: I’ve learned Python for exactly this kind of situation. It was time to automate.</p><h3>The Solution: Python to the Rescue</h3><p>Python is excellent for automating repetitive tasks, and with a few key libraries, I knew I could handle this in no time. Here’s how I tackled it:</p><ol><li><strong>Reading the Excel File</strong>: After creating the excel file, I used the pandas library, which is great for handling data in Python to access this data.</li><li><strong>Renaming Files</strong>: Using Python’s built-in os module, I could easily rename files on my computer by providing the current name and the new name from the Excel sheet.</li><li><strong>Error Handling</strong>: Of course, I added some checks to make sure the files existed before renaming them and handled any potential errors gracefully.</li></ol><pre>import os<br>import pandas as pd<br><br># Load the Excel file containing the old and new file names<br>df = pd.read_excel(&#39;Temp.xlsx&#39;)  # Assuming the file is named &#39;Temp.xlsx&#39;<br><br># Loop through the rows in the Excel file<br>for index, row in df.iterrows():<br>    old_name = row[&#39;Old Name&#39;]  # Column name with the current file names<br>    new_name = row[&#39;New Name&#39;]  # Column name with the new file names<br><br>    # Renaming the files<br>    if os.path.exists(old_name):<br>        os.rename(old_name, new_name)<br>        print(f&#39;Renamed: {old_name} -&gt; {new_name}&#39;)<br>    else:<br>        print(f&#39;File {old_name} not found.&#39;)<br><br>print(&quot;Renaming completed!&quot;)</pre><h3>How the Code Works:</h3><ul><li><strong>Reading the Excel File</strong>: The pandas library allows you to read Excel files with the read_excel() function, which creates a DataFrame containing all the data from the Excel file.</li><li><strong>Iterating Through the Data</strong>: The iterrows() function loops through each row in the DataFrame, where I accessed both the old and new file names.</li><li><strong>Renaming Files</strong>: The os.rename() function handles the actual renaming. The script checks if the old file exists using os.path.exists() before attempting the rename.</li></ul><p>Within seconds, all 96 files were renamed. The task that I dreaded was done in a flash.</p><h3>Why This Matters: The Power of Automation</h3><p>This experience reminded me of why I’ve been investing time in learning to code. Automating tedious tasks frees up time for what matters most — whether it’s more interesting work or simply reclaiming some mental energy.</p><p>Imagine the time savings if you could automate repetitive processes in your own workflow. Instead of spending hours renaming files, running reports, or doing other repetitive tasks, you could focus on solving bigger problems or being creative.</p><h3>Key Takeaways:</h3><ul><li><strong>Identify Repetitive Tasks</strong>: Not every task needs to be automated, but if you find yourself doing something repetitive often, it’s worth considering.</li><li><strong>Learn Python</strong>: Python is one of the most versatile and beginner-friendly programming languages for automation.</li><li><strong>Make Use of Libraries</strong>: With Python libraries like pandas and os, you can automate many types of file-related tasks, saving hours of manual effort.</li></ul><h3>Conclusion</h3><p>Automation doesn’t just make you more efficient — it empowers you to tackle more complex and fulfilling challenges. Thanks to Python, I was able to save myself from a mind-numbing task and focus on more interesting work. If you’re curious about automation, I highly recommend giving Python a try. The tools are already out there, and the possibilities are endless.</p><p>Feel free to share your own automation stories or ask questions in the comments!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ce8fbca92ac3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Journey from Concept to Real-Time Price Updates]]></title>
            <link>https://medium.com/@lindaolela/my-journey-from-concept-to-real-time-price-updates-e0cc755517c6?source=rss-3e5a9311025a------2</link>
            <guid isPermaLink="false">https://medium.com/p/e0cc755517c6</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[full-stack]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[database-management]]></category>
            <dc:creator><![CDATA[Linda Olela]]></dc:creator>
            <pubDate>Sun, 08 Sep 2024 13:39:16 GMT</pubDate>
            <atom:updated>2024-09-08T13:39:16.036Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*PSUK6vt22o2dNNFeeh4OTw.png" /></figure><p>As someone eager to put my newly acquired skills to the test and also challenge myself, I decided to build a stock trading app using a microframework called Flask. This project taught me so much about web development, using APIs, and working with real-time data. In this post, I’ll walk you through my development process, highlighting key features challengest and lessons learnt along the way.</p><p><strong>Understanding the Project’s Core: Flask framework and Real-time Updates</strong></p><p>For this project, I chose Flask as my web framework. Flask’s simplicity and flexibility made it an ideal choice, especially since I wanted to focus on building a functional app without the complexity of a larger framework like Django.</p><p>The core functionality of my app involves fetching real-time stock data for users to view and trade. To achieve this, I used the yfinance Python library, which pulls data directly from Yahoo Finance. This made it easy to get stock prices, symbols, and historical data without needing to deal with overly complex APIs.</p><pre>import yfinance as yf<br><br>def lookup(symbol):<br>    try:<br>        stock = yf.Ticker(symbol)<br>        price = stock.history(period=&quot;1d&quot;)[&quot;Close&quot;][0]<br>        return {&quot;price&quot;: round(price, 2), &quot;symbol&quot;: symbol.upper()}<br>    except Exception:<br>        return None</pre><p>With just a few lines of code, I could retrieve the latest stock price for any given symbol. This was a huge win and made the core functionality of the app possible.</p><h3>Key Features of the App</h3><p>The app I built allows users to:</p><ol><li><strong>Look up stock prices</strong>: Users can search for a stock symbol to get its latest price.</li><li><strong>Buy stocks</strong>: Users can buy shares of a stock with their available cash balance.</li><li><strong>Sell stocks</strong>: Users can sell shares they own.</li><li><strong>View portfolio</strong>: The portfolio page displays all the stocks a user owns, along with the total value and available cash.</li><li><strong>View transaction history</strong>: The history page shows all the user’s past transactions.</li></ol><pre>@app.route(&quot;/buy&quot;, methods=[&quot;GET&quot;, &quot;POST&quot;])<br>@login_required<br>def buy():<br>    &quot;&quot;&quot;Buy shares of stock&quot;&quot;&quot;<br><br>    if request.method == &quot;POST&quot;:<br>        symbol = request.form.get(&quot;symbol&quot;)<br>        if not symbol:<br>            return apology(&quot;must provide symbol&quot;)<br>        stock = lookup(request.form.get(&quot;symbol&quot;))<br>        if stock is None: <br>            return apology(&quot;Invalid stock&quot;)<br>        shares = request.form.get(&quot;shares&quot;)<br>        if not shares or not shares.isdigit() or int(shares) &lt;= 0:<br>            return apology(&quot;must provide valid number of shares&quot;)<br>        <br>        user_id = session[&quot;user_id&quot;]<br><br>        rows = db.execute(<br>            &quot;SELECT cash FROM users WHERE id = ?&quot;, user_id<br>        )<br><br>        cash = rows[0][&quot;cash&quot;]<br><br>        total_cost = stock[&quot;price&quot;] * int(shares)<br><br>        if cash &lt; total_cost:<br>            return apology(&quot;Insufficient funds for this purchase&quot;)<br>        <br>        db.execute(<br>            &quot;UPDATE users SET cash = cash - ? WHERE id = ?&quot;, total_cost, user_id<br>        )<br><br>        db. execute(&quot;&quot;&quot;<br>            INSERT INTO transactions (user_id, symbol, shares, price, total, transaction_type)<br>            VALUES(?, ?, ?, ?, ?, ?)&quot;&quot;&quot;,<br>                   user_id, symbol, int(shares), stock[&quot;price&quot;], total_cost, &quot;BOUGHT&quot;<br>        )<br>        flash(&quot;Bought!&quot;)<br>        return redirect(&quot;/&quot;)<br>    return render_template(&quot;buy.html&quot;)</pre><p>This process of validating the stock symbol, checking available funds, and recording the transaction was essential to making the app functional and user-friendly.</p><h3>The Tools &amp; Technologies That Helped Me Succeed</h3><p>This project wouldn’t have been possible without a solid stack of tools:</p><ul><li><strong>Flask:</strong> A lightweight Python framework that allowed me to rapidly prototype and implement core features like routing, authentication, and session management.</li><li><strong>yfinance:</strong> To retrieve up-to-date stock price information seamlessly, I used this Python library, which simplified the process of querying stock data.</li><li><strong>Jinja2 Templating Engine:</strong> This allowed me to dynamically render HTML and display portfolio and transaction data based on user inputs.</li><li><strong>SQLite Database:</strong> This allowed for data management and tracking of data as the user interacts with the web application.</li></ul><p><a href="https://www.canva.com/design/DAGQKx5d598/iVfDeVTsBqwjpN30D0K2Cw/watch">https://www.canva.com/design/DAGQKx5d598/iVfDeVTsBqwjpN30D0K2Cw/watch</a></p><h3>What’s Next?</h3><p>This project helped me understand how to build secure, real-time web applications. Next, I considering about exploring deployment of the app on platforms like Heroku or Microsoft Azure. I would like to learn more about containerization using Docker.</p><p>I am also looking forward to expanding the functionality of the app, possibly by integrating more complex financial data, such as performance graphs or predictive analytics.</p><p>If you’re working on a similar project, my advice is to start small — identify key areas where dynamic updates can improve usability and focus on implementing those first. This leads to more engaging and user-friendly applications.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e0cc755517c6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Step-By-Step Guide: Building a Stock Portfolio Web Application]]></title>
            <link>https://medium.com/@lindaolela/step-by-step-guide-building-a-stock-portfolio-web-application-00f654bd9753?source=rss-3e5a9311025a------2</link>
            <guid isPermaLink="false">https://medium.com/p/00f654bd9753</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[mvc-architecture]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[sql]]></category>
            <dc:creator><![CDATA[Linda Olela]]></dc:creator>
            <pubDate>Sat, 31 Aug 2024 00:55:30 GMT</pubDate>
            <atom:updated>2024-08-31T00:55:30.212Z</atom:updated>
            <content:encoded><![CDATA[<p>Ever wondered what it takes to build a full-fledged web application? Recently, I worked on a project to develop a stock portfolio management web app. The project required integrating multiple components and technologies. Also, it was important for me to provide a seamless user experience. In this post, I walk you through how I went about designing, coding, and implementing this application.</p><h4>The Concept: Managing a Stock Portfolio</h4><p>Goal: create a web application that allows users to manage a portfolio of stocks (pretend stock trading). This meant implementing several core features:</p><ul><li>User registration and authentication.</li><li>Ability to look up stock quotes in real-time.</li><li>Buying and selling stocks (Again, not really!).</li><li>Displaying a portfolio summary and transaction history.</li></ul><h4>Breaking Down the Structure: Model-View-Controller</h4><p>The Model-View-Controller (MVC) architecture really comes in handy when you want to break down the complexity of the app structure into different components. This design pattern helped separate concerns, making the codebase more maintainable and scalable.</p><ul><li><strong>Model</strong>: This is the backbone of the application. The Model handles the business logic and data storage. Here, I used an SQLite database (finance.db) to manage user data, stock transactions, and account balances.</li><li><strong>View</strong>: The user interface, or the View, is where users interact with the application. Using HTML, CSS, and a bit of JavaScript, I created intuitive templates for actions like registering, logging in, checking stock quotes, and more.</li><li><strong>Controller</strong>: The Controller bridges the gap between the Model and the View. It processes user input from the View, updates the Model, and then refreshes the View to reflect any changes. For this project, the app.py file served as the main Controller, defining routes for each feature.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*Nf51nD-PuovMR23XRTysWg.png" /><figcaption>Model-View-Controller Infographic</figcaption></figure><h4>Step-by-Step Implementation</h4><p><strong>1. User Registration and Authentication</strong></p><p>The first challenge was to create a secure and efficient registration system. Here’s how I programmed it:</p><ul><li><strong>Registration Route</strong>: When a user attempts to register, the register route first checks if all required fields (username, password, confirmation) are filled. It then verifies that the password and confirmation match, and that the username isn’t already taken.</li><li><strong>Password Security</strong>: Instead of storing plain text passwords, I used the generate_password_hash function to securely hash passwords before storing them in the database.</li><li><strong>Session Management</strong>: Once registered, the user is logged in automatically, and their session is tracked to ensure smooth navigation throughout the app.</li></ul><p><strong>2. Stock Quote Lookup</strong></p><p>The next feature was allowing users to look up real-time stock quotes:</p><ul><li><strong>Quote Route</strong>: Users can input a stock symbol, which is then passed to the lookup function. This function interacts with an external API to fetch the latest stock prices. If successful, it returns the stock’s name, symbol, and price, which are then displayed to the user.</li></ul><pre>@app.route(&quot;/quote&quot;, methods=[&quot;GET&quot;, &quot;POST&quot;])<br>@login_required<br>def quote():<br>    &quot;&quot;&quot;Get stock quote.&quot;&quot;&quot;<br>    # User reached route via POST<br>    if request.method == &quot;POST&quot;:<br>        # Require that a user input a stock symbol<br>        symbol = request.form.get(&quot;symbol&quot;)<br>        if not symbol:<br>            return apology(&quot;Must provide symbol&quot;)<br><br>        # Lookup the stock quote<br>        quote = lookup(symbol)<br><br>        # Check if the symbol is valid<br>        if quote is None:<br>            return apology(&quot;Invalid symbol&quot;)<br><br>        price = usd(quote[&quot;price&quot;])<br><br>        # If symbol is valid render the quoted template<br>        return render_template(&quot;quoted.html&quot;, quote=quote, price=price)<br>    else:<br>        return render_template(&quot;quote.html&quot;)</pre><p><strong>3. Buying Stocks</strong></p><p>With the quote feature in place, users needed the ability to purchase stocks:</p><ul><li><strong>Buy Route</strong>: Users enter the stock symbol and the number of shares they wish to purchase. The app checks if the user has sufficient funds and then updates the database accordingly. The user’s cash balance is also adjusted to reflect the purchase.</li></ul><p><strong>4. Portfolio Management</strong></p><p>Viewing all owned stocks in one place is crucial for portfolio management:</p><ul><li><strong>Index Page</strong>: The index page displays a table of all the stocks a user owns, including the number of shares, current price, and the total value of each holding. The user’s cash balance and the total value of their portfolio are also shown.</li></ul><p><strong>5. Selling Stocks</strong></p><p>The ability to sell stocks was another feature of the application:</p><ul><li><strong>Sell Route</strong>: Similar to buying, users can specify the stock and the number of shares to sell. The app verifies that the user owns enough shares, processes the sale, and updates the user’s cash balance.</li></ul><p><strong>6. Transaction History</strong></p><p>Finally, I added a history feature to track all transactions:</p><ul><li><strong>History Route</strong>: This route displays a detailed list of every stock purchase and sale the user has made, providing a clear record of their trading activity.</li></ul><h4>Challenges and Learnings</h4><p>I’ve come to accept that syntax errors will be a companion in my coding journey for some time. Debugging may not be the most enjoyable part of the process, but it’s essential — and it’s where real learning happens. A key takeaway for me has been the importance of properly validating user input and securely storing sensitive data. These are not just technical details; they’re critical for building robust applications.</p><p>When the app finally worked as intended, seeing all the features — registration, buying, selling, and transaction history — come together was incredibly satisfying. Despite the occasional frustration coding can bring, the sense of accomplishment makes all the late nights worth it. It’s that rewarding moment when your hard work pays off and you see the tangible results of your efforts.</p><h4>Wrapping Up</h4><p>Building this stock portfolio web application was more than just a coding exercise; it was a deep dive into full-stack development. From setting up the database to designing user-friendly interfaces, and writing Python code to manage everything behind the scenes — I had the chance to hone my skills across the board.</p><p>For anyone interested in web development, I highly recommend taking on a project like this. It’s challenging, but the rewards are worth every line of code.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=00f654bd9753" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Simple To-do List Application with Python and SQLite]]></title>
            <link>https://medium.com/@lindaolela/building-a-simple-to-do-list-application-with-python-and-sqlite-a91062f12b9f?source=rss-3e5a9311025a------2</link>
            <guid isPermaLink="false">https://medium.com/p/a91062f12b9f</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[database]]></category>
            <dc:creator><![CDATA[Linda Olela]]></dc:creator>
            <pubDate>Sun, 18 Aug 2024 14:48:42 GMT</pubDate>
            <atom:updated>2024-08-18T14:48:42.340Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oz-5nKMbYBwK22jyk6yKFQ.png" /><figcaption>Improve your SQL &amp; Python Skills</figcaption></figure><p>Creating practical projects is one of the best ways to reinforce your programming skills. A to-do list application is a classic beginner project that combines Python scripting with database management. In this article, I’ll walk you through building a simple command-line to-do list application using Python and SQLite.</p><h3>Why Build a To-Do List Application?</h3><p>A to-do list app may seem simple, but it offers a great introduction to essential programming concepts. By building this project, you’ll learn how to:</p><ul><li>Interact with a SQLite database using SQL.</li><li>Implement a command-line interface (CLI) for user interaction.</li><li>Structure a Python project that integrates multiple components.</li></ul><p>This project is ideal for anyone looking to build a foundational understanding of Python and database management.</p><h3>Step 1: Setting Up Your Project</h3><p>Before we dive into coding, it’s important to set up your environment and tools.</p><h3>1.1 Creating a GitHub Repository</h3><p>Start by creating a GitHub repository for your project. This will help you manage your code with version control, making it easy to track changes and collaborate.</p><h3>1.2 Setting Up Your Python Environment</h3><p>Ensure that Python 3 is installed. If you’re working locally, create a virtual environment to isolate your project dependencies.</p><h3>Step 2: Building the Command-Line Interface (CLI)</h3><p>The CLI will be the core of our to-do list application. It allows users to add, view, update, and delete tasks using a simple text-based interface.</p><h3>2.1 Creating the SQLite Database</h3><p>First, let’s define the structure of our SQLite database. We’ll create a tasks table with columns to store each task’s details:</p><pre>CREATE TABLE tasks (<br>    id INTEGER PRIMARY KEY,<br>    task_name TEXT NOT NULL,<br>    description TEXT,<br>    status TEXT DEFAULT &#39;pending&#39;,<br>    date_added TEXT<br>);</pre><p>This table will hold the task ID, name, description, status (like “pending” or “complete”), and the date the task was added.</p><h3>2.2 Implementing the Python Script</h3><p>With the database schema ready, we can now implement the CLI in Python. Here’s the core script:</p><pre>import sqlite3<br>from datetime import datetime<br>from colorama import Fore, Style<br><br># Connect to the SQLite database<br>conn = sqlite3.connect(&#39;todo_list.db&#39;)<br>cursor = conn.cursor()<br><br>def add_task(task_name, description):<br>    date_added = datetime.now().strftime(&#39;%Y-%m-%d %H:%M:%S&#39;)<br>    cursor.execute(&#39;&#39;&#39;<br>                   INSERT INTO tasks (task_name, description, status, date_added)<br>                   VALUES (?, ?, &#39;pending&#39;, ?)<br>                   &#39;&#39;&#39;, (task_name, description, date_added))<br>    conn.commit()<br>    print(Fore.GREEN + f&quot;Task, &#39;{task_name}&#39;, added successfully.&quot; + Style.RESET_ALL)<br><br>def view_tasks():<br>    cursor.execute(&#39;SELECT * FROM tasks&#39;)<br>    tasks = cursor.fetchall()<br>    print(&quot;\nCurrent Tasks:&quot;)<br>    for task in tasks:<br>        print(Fore.CYAN + f&quot;ID: {task[0]}, Name: {task[1]}, Status: {task[3]}, Added: {task[4]}&quot; + Style.RESET_ALL)<br><br>def update_task_status(task_id, new_status):<br>    cursor.execute(&#39;UPDATE tasks SET status = ? WHERE id = ?&#39;, (new_status, task_id))<br>    conn.commit()<br>    print(Fore.YELLOW + f&quot;Task ID {task_id} updated to &#39;{new_status}&#39;.&quot; + Style.RESET_ALL)<br><br>def delete_task(task_id):<br>    cursor.execute(&#39;DELETE FROM tasks WHERE id = ?&#39;, (task_id,))<br>    conn.commit()<br>    print(Fore.RED + f&quot;Task ID {task_id} deleted.&quot; + Style.RESET_ALL)<br><br># Main loop<br>while True:<br>    print(&quot;\nOptions: 1) Add Task 2) View Tasks 3) Update Task 4) Delete Task 5) Exit&quot;)<br>    choice = input(&quot;Choose an option: &quot;)<br>    if choice == &#39;1&#39;:<br>        task_name = input(&quot;Enter task name: &quot;)<br>        description = input(&quot;Enter task description: &quot;)<br>        add_task(task_name, description)<br>    elif choice == &#39;2&#39;:<br>        view_tasks()<br>    elif choice == &#39;3&#39;:<br>        task_id = input(&quot;Enter the ID of the task to update: &quot;)<br>        new_status = input(&quot;Enter new status (pending, in-progress, complete): &quot;)<br>        update_task_status(task_id, new_status)<br>    elif choice == &#39;4&#39;:<br>        task_id = input(&quot;Enter the ID of the task to delete: &quot;)<br>        delete_task(task_id)<br>    elif choice == &#39;5&#39;:<br>        break<br>    else:<br>        print(&quot;Invalid option. Please try again.&quot;)<br><br>conn.close()</pre><h3>2.3 Key Features of the CLI</h3><ol><li><strong>Adding a Task:</strong> Users can add a new task with a name and description. Each task is automatically given a status of “pending” and a timestamp.</li><li><strong>Viewing Tasks:</strong> The view_tasks function displays all current tasks, showing their ID, name, status, and the date they were added.</li><li><strong>Updating Task Status:</strong> Users can update the status of a task to reflect progress, such as marking it “in-progress” or “complete.”</li><li><strong>Deleting a Task:</strong> If a task is no longer needed, users can delete it by specifying its ID.</li></ol><p>The script uses the colorama library to add color to the output, making the CLI more visually appealing.</p><h3>Step 3: Running and Using the Application</h3><p>To run the application, simply execute the Python script. You can interact with the application by choosing options from the menu. Each option corresponds to a function — whether adding, viewing, updating, or deleting tasks.</p><h3>Example Usage</h3><ol><li><strong>Adding a Task: </strong>Choose option 1, then enter the task name and description.</li><li><strong>Viewing Tasks: </strong>Choose option 2 to see a list of all tasks.</li><li><strong>Updating a Task:</strong>Choose option 3, then enter the task ID and the new status.</li><li><strong>Deleting a Task: </strong>Choose option 4, then enter the task ID to remove it.</li></ol><h3>Conclusion</h3><p>Building a to-do list application using Python and SQLite is a great way to practice essential programming concepts. This project covers database management, command-line interaction, and basic Python scripting — all skills that are widely applicable across different areas of software development.</p><p>You can extend this project further by adding features like task prioritization, due dates, or even categorizing tasks by project. The possibilities are endless, making this a solid foundation for more advanced projects in the future.</p><p>Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a91062f12b9f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Solved the Mystery of the Stolen CS50 Duck]]></title>
            <link>https://medium.com/@lindaolela/how-i-solved-the-mystery-of-the-stolen-cs50-duck-9f08805db692?source=rss-3e5a9311025a------2</link>
            <guid isPermaLink="false">https://medium.com/p/9f08805db692</guid>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[programming-languages]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Linda Olela]]></dc:creator>
            <pubDate>Sun, 11 Aug 2024 19:10:03 GMT</pubDate>
            <atom:updated>2024-08-14T07:06:16.597Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*wHFjkchCIERG9In4Mez4Kg.png" /></figure><p>Imagine this: the town of Fiftyville is in turmoil. The beloved CS50 Duck has been stolen, and it’s up to you to solve the mystery. The clock is ticking, and the authorities believe that the thief fled the town with the help of an accomplice, making the case even more complex. Armed with nothing but a SQLite database and some SQL skills, I took on the challenge. Here’s how I unraveled the mystery of the stolen duck and solved the case of the century!</p><h3>Setting the Scene: The Crime and the Clues</h3><p>The theft took place on July 28, 2023, on Humphrey Street — a seemingly ordinary day turned extraordinary by the crime. The authorities had gathered as much data as they could from around the town and compiled it into a SQLite database called fiftyville.db. This database was my starting point, containing various tables with data related to the time of the crime.</p><p>My goal was to identify three key pieces of information:</p><ol><li><strong>Who the thief is,</strong></li><li><strong>What city the thief escaped to,</strong> and</li><li><strong>Who the thief’s accomplice is who helped them escape.</strong></li></ol><h3>First Lead: Crime Scene Reports</h3><p>Given the details provided by the authorities, I knew the theft occurred on Humphrey Street on July 28, 2023. Next, I needed to hear what the townspeople had to say. I queried the interviews table to see who was interviewed on the day of the crime.</p><pre>-- List the names and transcripts of the interviews conducted on July 28, 2023<br>SELECT name, transcript<br>FROM interviews<br>WHERE year = 2023<br>AND month = 7<br>AND day = 28;</pre><p>By analyzing the interview transcripts, I could start piecing together a narrative, identifying potential suspects and witnesses who might have seen something crucial.</p><h3>Tracking the Suspect’s Communication</h3><p>One of the names that came up in the investigation was Bruce. It was crucial to understand if Bruce made any suspicious communications on the day of the theft. I crafted a query to find any calls made by Bruce that lasted less than a minute.</p><pre>-- List of people who received a call from Bruce on July 28, 2023, that lasted less than a minute<br>SELECT name<br>FROM people<br>WHERE phone_number IN (<br>    SELECT receiver<br>    FROM phone_calls<br>    WHERE caller = (<br>        SELECT phone_number<br>        FROM people<br>        WHERE name = &#39;Bruce&#39;<br>        AND year = 2023<br>        AND month = 7<br>        AND day = 28<br>        AND duration &lt; 60<br>    )<br>);</pre><p>This query helped identify who Bruce might have contacted in haste, providing a potential link to the accomplice.</p><h3>Following the Trail to the Airport</h3><p>The next logical step was to determine where the thief might have fled. The authorities believed the thief left town shortly after the crime, possibly by plane. I queried the database to find flights leaving Fiftyville on July 28, 2023, before 9 AM.</p><pre>-- Name of city that has a flight arriving from Fiftyville on July 28, 2023, before 9 AM<br>SELECT city<br>FROM airports<br>WHERE id IN (<br>    SELECT destination_airport_id<br>    FROM flights<br>    WHERE origin_airport_id = (<br>        SELECT id<br>        FROM airports<br>        WHERE city = &#39;Fiftyville&#39;<br>    )<br>    AND year = 2023<br>    AND month = 7<br>    AND day = 29<br>    AND hour &lt; 9<br>);</pre><p>This query revealed that the thief likely escaped to New York City, narrowing down the search for both the thief and the accomplice.</p><h3>Identifying the Thief</h3><p>The final step was to pinpoint the thief. By now, I had enough information to cross-reference different data points: phone records, flight manifests, ATM transactions, and security logs. I constructed a complex query that would reveal the identity of the person whose actions matched the thief’s profile.</p><pre>-- Name of thief: person whose passport number is on a flight from Fiftyville to New York<br>-- and whose phone number made a call on July 28, 2023, that lasted less than a minute<br>-- and whose bank account made a withdrawal on an ATM on Leggett Street on July 28, 2023<br>-- and license plate was logged in the bakery security logs between 10:15 and 10:25 AM on July 28, 2023<br>SELECT name<br>FROM people<br>WHERE passport_number IN (<br>    SELECT passport_number<br>    FROM passengers<br>    WHERE flight_id IN (<br>        SELECT id<br>        FROM flights<br>        WHERE origin_airport_id = (<br>            SELECT id<br>            FROM airports<br>            WHERE city = &#39;Fiftyville&#39;<br>        )<br>        AND destination_airport_id = (<br>            SELECT id<br>            FROM airports<br>            WHERE city = &#39;New York City&#39;<br>        )<br>    )<br>    AND phone_number IN (<br>        SELECT caller<br>        FROM phone_calls<br>        WHERE year = 2023<br>        AND month = 7<br>        AND day = 28<br>        AND duration &lt; 60<br>    )<br>    AND name IN (<br>        SELECT name<br>        FROM people<br>        WHERE id IN (<br>            SELECT person_id<br>            FROM bank_accounts<br>            WHERE account_number IN (<br>                SELECT account_number<br>                FROM atm_transactions<br>                WHERE year = 2023<br>                AND month = 7<br>                AND day = 28<br>                AND atm_location = &#39;Leggett Street&#39;<br>                AND transaction_type = &#39;withdraw&#39;<br>            )<br>            AND license_plate IN (<br>                SELECT license_plate<br>                FROM bakery_security_logs<br>                WHERE year = 2023<br>                AND month = 7<br>                AND day = 28<br>                AND hour = 10<br>                AND minute &gt;= 15<br>                AND minute &lt;= 25<br>            )<br>        )<br>    )<br>);</pre><p>This final query brought together all the pieces of the puzzle. It identified the thief as someone who flew to New York, made a quick call, withdrew money from an ATM, and drove past a bakery with security cameras.</p><h3>The Big Reveal: Solving the Mystery</h3><p>After hours of digging through data and writing SQL queries, I finally had the answers:</p><ul><li><strong>The thief:</strong> [Insert Name]</li><li><strong>The city they escaped to:</strong> [Insert City]</li><li><strong>The accomplice:</strong> [Insert Name]</li></ul><p>With this information, I completed my answers.txt file and submitted the case report to the authorities. Click <a href="https://github.com/code50/130731715/blob/main/week7/fiftyville/log.sql">here</a> to view the code.</p><h3>Final Thoughts: The Power of SQL in Problem-Solving</h3><p>Through systematic and logical queries, I was able to solve the mystery of the stolen CS50 Duck. This project was a fascinating exercise in how data analysis can be used to solve real-world problems — even in a fictional setting like Fiftyville.</p><p>The process not only required technical SQL skills but also a strategic approach to data analysis. Each query served a specific purpose, building upon the previous one to reveal the complete picture.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9f08805db692" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>