<?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 Oluwatunmibi Favour on Medium]]></title>
        <description><![CDATA[Stories by Oluwatunmibi Favour on Medium]]></description>
        <link>https://medium.com/@favourwrites?source=rss-8a598e097605------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*AQkj6xLfo5mRTaJBFSlyEA.jpeg</url>
            <title>Stories by Oluwatunmibi Favour on Medium</title>
            <link>https://medium.com/@favourwrites?source=rss-8a598e097605------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 15:38:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@favourwrites/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[Building a Smart Food Recommendation App with Gemini and Stability AI]]></title>
            <link>https://medium.com/gdsc-babcock-dataverse/building-a-smart-food-recommendation-app-with-gemini-and-stability-ai-74e688b34bb9?source=rss-8a598e097605------2</link>
            <guid isPermaLink="false">https://medium.com/p/74e688b34bb9</guid>
            <category><![CDATA[stability-ai]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[gemini]]></category>
            <dc:creator><![CDATA[Oluwatunmibi Favour]]></dc:creator>
            <pubDate>Tue, 22 Apr 2025 16:23:23 GMT</pubDate>
            <atom:updated>2025-04-22T16:23:23.219Z</atom:updated>
            <content:encoded><![CDATA[<h4>No Backend Required</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IVii7PLD9XLnKIgaLAqr4w.png" /><figcaption>AI Recommended Meals</figcaption></figure><p><strong>Introduction</strong></p><p>Some time ago, I worked on a fun little project that used AI to recommend meals based on user health goals. It turned out surprisingly well, so I decided to share how I built it. With just a frontend (no backend!), I combined Google’s Gemini API and Stability AI to suggest dishes and generate stunning food images (maybe not the most accurate as you can see😅).</p><p><strong>Getting Started with the APIs</strong></p><p>To follow along, you’ll need API keys from both Gemini and Stability AI:</p><ul><li><strong>Gemini API</strong> (by Google): Sign up at Google AI Studio. Once signed in, go to “API Keys” and click on “Create API Key”. Follow the prompts after that and copy your API key. Ensure you store it securely. Rate limits depend on your usage tier — free tier allows limited requests per day.</li><li><strong>Stability AI</strong>: Create an account at platform.stability.ai. After verifying your email, navigate to the API dashboard to get your key. Stability AI typically offers 25 credits on registering, after which you’ll need to purchase credits.</li></ul><p><strong>Overview of Tools Used</strong></p><ul><li><strong>Gemini API</strong> — for understanding user prompts and generating meal suggestions and recipes.</li><li><strong>Stability AI</strong> — for generating realistic images of the meals.</li><li><strong>React</strong> — to build the user interface.</li></ul><p><strong>Step 1: Setting Up the Frontend</strong></p><p>We start with a basic React setup:</p><pre>npx create-react-app food-genai<br>cd food-genai</pre><p>Inside your React project, open src/App.js and prepare the state variables:</p><pre>import React, { useState } from &#39;react&#39;;<br><br>function App() {<br>  const [prompt, setPrompt] = useState(&quot;&quot;);<br>  const [response, setResponse] = useState(null);<br>  const [loading, setLoading] = useState(false);</pre><p>This section sets up three pieces of state:</p><ul><li>prompt stores the user&#39;s food craving or query.</li><li>response stores the final dish name, recipe, and image.</li><li>loading handles UI feedback during API calls.</li></ul><p><strong>Step 2: Writing the Submit Function</strong></p><p>We then define the API keys (placeholders for now) and create the submit handler:</p><pre>   const GEMINI_API_KEY = &quot;YOUR_GEMINI_API_KEY&quot;;<br>   const STABILITY_API_KEY = &quot;YOUR_STABILITY_API_KEY&quot;;<br>  <br>   const handleSubmit = async (e) =&gt; {<br>      e.preventDefault();<br>      setLoading(true);<br>      try {</pre><p>The handleSubmit function prevents the default form submission, shows a loading message, and starts the fetch operations.</p><p><strong>Using Gemini API to Generate a Recipe</strong></p><pre>        const geminiRes = await fetch(`https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key=${GEMINI_API_KEY}`, {<br>          method: &quot;POST&quot;,<br>          headers: { &quot;Content-Type&quot;: &quot;application/json&quot; },<br>          body: JSON.stringify({<br>            contents: [{ parts: [{ text: `Suggest a dish and recipe for: ${prompt}` }] }]<br>          })<br>        });<br>        const geminiData = await geminiRes.json();<br>        const textResponse = geminiData?.candidates?.[0]?.content?.parts?.[0]?.text;<br>        const suggestionText = textResponse.replace(/```json|```/g, &#39;&#39;).trim();<br>        const dishName = suggestionText.split(&quot;\n&quot;)[0];</pre><p>We make a POST request to Gemini’s API. The prompt is sent in plain text. We then extract:</p><ul><li>The recipe (suggestionText)</li><li>The dish name (first line of the text)</li></ul><p><strong>Using Stability AI to Generate an Image</strong></p><pre>            const formData = new FormData();<br>            formData.append(&#39;prompt&#39;, dishName);<br>            formData.append(&#39;model&#39;, &#39;sd3&#39;);<br>            formData.append(&#39;output_format&#39;, &#39;webp&#39;);<br>            formData.append(&#39;aspect_ratio&#39;, &#39;1:1&#39;);<br>            formData.append(&#39;negative_prompt&#39;, &#39;blurry, text, watermark&#39;);<br>            <br>            const stabilityRes = await fetch(&#39;https://api.stability.ai/v2beta/stable-image/generate/core&#39;,<br>              {<br>                method: &#39;POST&#39;,<br>                headers: {<br>                  &#39;Authorization&#39;: `Bearer ${STABILITY_API_KEY}`,<br>                  &#39;Accept&#39;: &#39;image/*&#39;<br>                },<br>                body: formData<br>              }<br>             );<br>            <br>            const imageData = await stabilityRes.arrayBuffer();<br>            const imageUrl = imageData.artifacts[0].url;<br>        <br>            setResponse({ dish: dishName, recipe: suggestionText, imageUrl });<br>          } catch (error) {<br>            console.error(&quot;Error:&quot;, error);<br>          }<br>          setLoading(false);<br>       };</pre><p>This part:</p><ul><li>Sends the dish name to Stability AI</li><li>Requests a 1:1 image of the food</li><li>Updates the state with the image URL and recipe</li></ul><p><strong>Step 3: Creating the User Interface</strong></p><pre>    return (<br>      &lt;div className=&quot;App&quot;&gt;<br>        &lt;form onSubmit={handleSubmit}&gt;<br>          &lt;input value={prompt} onChange={(e) =&gt; setPrompt(e.target.value)} placeholder=&quot;What do you want to eat?&quot; /&gt;<br>          &lt;button type=&quot;submit&quot;&gt;Get Recommendation&lt;/button&gt;<br>        &lt;/form&gt;<br>        {loading &amp;&amp; &lt;p&gt;Loading...&lt;/p&gt;}<br>        {response &amp;&amp; (<br>          &lt;div&gt;<br>            &lt;h2&gt;{response.dish}&lt;/h2&gt;<br>            &lt;p&gt;{response.recipe}&lt;/p&gt;<br>            &lt;img src={response.imageUrl} alt={response.dish} /&gt;<br>          &lt;/div&gt;<br>        )}<br>      &lt;/div&gt;<br>    );<br>}</pre><p>This renders:</p><ul><li>A form with input and submit button</li><li>Loading message during fetches</li><li>Final result: the dish name, full recipe, and the generated image</li></ul><p><strong>Security Note</strong></p><p>This example uses API keys directly in the frontend. While it’s great for demos or learning, <strong>don’t use this approach in production.</strong> Instead, consider storing keys securely in a backend or using a serverless function.</p><p><strong>Conclusion</strong></p><p>With just a few tools and no backend, you can build an intelligent, visually rich food recommendation app powered by AI. Try tweaking the recipe prompt, changing the image dimensions, or filtering by diet. The possibilities are deliciously endless!</p><blockquote>I’m Favour Oluwatunmibi, a software engineer on a mission to <strong>solve real-world problems through code</strong>. Every line I write, every system I design, is driven by one question: How can technology make this better?</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=74e688b34bb9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/gdsc-babcock-dataverse/building-a-smart-food-recommendation-app-with-gemini-and-stability-ai-74e688b34bb9">Building a Smart Food Recommendation App with Gemini and Stability AI</a> was originally published in <a href="https://medium.com/gdsc-babcock-dataverse">GDG Babcock Dataverse</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Easily Connect Your SpringBoot Backend to Your React Frontend]]></title>
            <link>https://medium.com/@favourwrites/easily-connect-your-springboot-backend-to-your-react-frontend-a8350f2ea43f?source=rss-8a598e097605------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8350f2ea43f</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[cors]]></category>
            <category><![CDATA[axios]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Oluwatunmibi Favour]]></dc:creator>
            <pubDate>Thu, 27 Mar 2025 09:37:56 GMT</pubDate>
            <atom:updated>2025-03-27T09:37:56.515Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Overcoming CORS Errors</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n-PoyMK-L2IHJhs99ID_Ew.png" /></figure><p>If you’ve ever seen this in your browser’s console:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*W1jD4Hftdj19jJlI.png" /></figure><p>then you know how frustrating CORS errors can be. If you haven’t, you’re one of the lucky few who got it right the first time, or you just haven’t had to deal with it before. If you are in the latter category, you’re about to join the league of the lucky ones because at the end of this article, you’ll be able to easily identify, troubleshoot, and fix CORS errors.</p><h3><strong>What Exactly is CORS? </strong>(And Why Should You Care?)</h3><p>CORS stands for <strong>Cross-Origin Resource Sharing</strong>. By default, your browser prevents your frontend from making requests to a different origin other than the one it comes from. That is known as <strong>Same-Origin Policy (SOP)</strong>.</p><p>Origin = Protocol (http/https) + Domain (localhost, example.com) + Port (3000, 8080).</p><p>Using the default ports for SpringBoot and React when developing locally, we have <a href="http://localhost:8080/">http://localhost:8080</a> for our backend and <a href="http://localhost:3000/">http://localhost:3000</a> for our frontend. Yes, they have the same protocol and domain but their ports are different, which means they are not from the same origin. Configuring CORS would allow them to communicate with each other.</p><p>If CORS is a good thing, why then are we talking about it like it’s the bad guy? CORS is a security feature — but it can be a headache when you’re developing locally because if you don’t set it up properly, your frontend won’t be able to communicate with and call your backend.</p><h3>How CORS Works (Behind the Scenes)</h3><p>When your React app makes a request to Spring Boot:</p><ul><li>The browser sends a <strong>preflight request</strong> (HTTP OPTIONS) to check if the server allows the actual request.</li><li>The server must respond with headers like:</li></ul><p><em>Access-Control-Allow-Origin: http://localhost:3000 (what origin is allowed)</em></p><p><em>Access-Control-Allow-Methods: GET, POST, PUT, DELETE (what HTTP methods are allowed)</em></p><ul><li>If the headers match, the browser proceeds with the actual request.</li><li>If not, you get the <strong>CORS error</strong>.</li></ul><h3>Why Can’t You Just Disable CORS?</h3><p>You might be wondering: <em>“Why not turn off CORS completely?”</em></p><p>Well, you can’t. Technically, you can but NEVER do that because without it, any malicious website could silently send requests to your backend (e.g., stealing data, performing actions as logged-in users, etc.).</p><p>Also, CORS is <strong>not</strong> a backend restriction — it’s enforced by the browser. Even if your backend accepts requests (if you set allowedOrigins(&quot;*&quot;)<strong>)</strong>, the browser will block them unless proper CORS headers are present.</p><h3>Fixing CORS the Right Way (Back to Spring Boot + React)</h3><p>Now that you fully understand CORS, let’s fix it properly in Spring Boot:</p><p>There are 3 ways to do this and choosing what way you want to use depends on your specific use case.</p><ol><li>Global CORS Configuration (Recommended)</li></ol><p>All you have to do is add this to CorsConfig.java:</p><pre>import org.springframework.context.annotation.Bean;<br>import org.springframework.context.annotation.Configuration;<br>import org.springframework.web.servlet.config.annotation.CorsRegistry;<br>import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;<br><br>@Configuration<br>public class CorsConfig {<br><br>    @Bean<br>    public WebMvcConfigurer corsConfigurer() {<br>        return new WebMvcConfigurer() {<br>            @Override<br>            public void addCorsMappings(CorsRegistry registry) {<br>                registry.addMapping(&quot;/**&quot;) // Allow all endpoints<br>                      .allowedOrigins(&quot;http://localhost:3000&quot;) // React&#39;s default port<br>                      .allowedMethods(&quot;GET&quot;, &quot;POST&quot;, &quot;PUT&quot;, &quot;DELETE&quot;)<br>                      .allowedHeaders(&quot;*&quot;);<br>            }<br>        };<br>    }<br>}</pre><p>2. Controller-Level CORS (For Specific Endpoints)</p><p>If you only want to allow CORS on certain endpoints, use @CrossOrigin:</p><pre>import org.springframework.web.bind.annotation.CrossOrigin;<br>import org.springframework.web.bind.annotation.GetMapping;<br>import org.springframework.web.bind.annotation.RestController;<br><br>@RestController<br>public class MyController {<br><br>    @CrossOrigin(origins = &quot;http://localhost:3000&quot;)<br>    @GetMapping(&quot;/api/data&quot;)<br>    public String getData() {<br>        return &quot;Hello from Spring Boot!&quot;;<br>    }<br>}</pre><p>3. Security Filter (Alternative Approach)</p><p>If you’re using Spring Security, configure CORS in your security settings:</p><pre>@Configuration  <br>@EnableWebSecurity  <br>public class SecurityConfig {  <br>    @Bean  <br>    public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {  <br>        http.cors(cors -&gt; cors.configurationSource(request -&gt; {  <br>            CorsConfiguration config = new CorsConfiguration();  <br>            config.setAllowedOrigins(List.of(&quot;http://localhost:3000&quot;));  <br>            config.setAllowedMethods(List.of(&quot;*&quot;));  <br>            return config;  <br>        }));  <br>        return http.build();  <br>    }  <br>}</pre><p>One thing to note is that the Security Filter approach overrides the global config so make sure not to use both at the same time. I had an issue once where I was wondering why I was still getting a CORS error even after allowing the correct headers in my global config file just to realize that those headers weren’t allowed in my Security Filter.</p><p>Now that your backend is good to go, you can now call it from your frontend. You can use either axios or fetch to do that.</p><ol><li>Using axios(Recommended for React)</li></ol><p>Install axios</p><pre>npm install axios</pre><p>Then make requests:</p><pre>import axios from &#39;axios&#39;;<br><br>axios.get(&#39;http://localhost:8080/api/data&#39;)<br>  .then(response =&gt; console.log(response.data))<br>  .catch(error =&gt; console.error(&#39;Error:&#39;, error));</pre><p>2. Using fetch</p><pre>fetch(&#39;http://localhost:8080/api/data&#39;)<br>  .then(response =&gt; response.json())<br>  .then(data =&gt; console.log(data))<br>  .catch(error =&gt; console.error(&#39;Error:&#39;, error));</pre><p>Once your application is running, you can use your browser DevTools (Network tab) to verify Access-Control-Allow-Origin.</p><p>Now that you’ve conquered CORS, your Spring Boot backend and React frontend can communicate seamlessly.</p><p>If you’ve used these tips in your projects, I’d love to hear about them and any problems you may have encountered! Drop a comment below or connect with me on <a href="https://www.linkedin.com/in/favourtunmibi">LinkedIn</a>.</p><p><strong>Enjoyed this article?</strong> Give it a clap (or 50) — it fuels my passion to share more. Until next time, happy coding! 🚀</p><blockquote>I’m Favour Oluwatunmibi, a software engineer on a mission to <strong>solve real-world problems through code</strong>. Every line I write, every system I design, is driven by one question: How can technology make this better?</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8350f2ea43f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Writing Clean Code with Java]]></title>
            <link>https://medium.com/@favourwrites/writing-clean-code-with-java-af1c2b7abd78?source=rss-8a598e097605------2</link>
            <guid isPermaLink="false">https://medium.com/p/af1c2b7abd78</guid>
            <category><![CDATA[clean-code]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Oluwatunmibi Favour]]></dc:creator>
            <pubDate>Mon, 10 Mar 2025 12:49:50 GMT</pubDate>
            <atom:updated>2025-03-10T13:06:44.393Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zOnDrc6rf9h4-MYYpkih8A.jpeg" /><figcaption>Writing Clean Code with Java</figcaption></figure><p>Java has been in existence for over 20 years and is still one of the most widely used programming languages today. Why? It is object-oriented, platform-independent, and has a massive ecosystem, but one of the things that stands out to me about Java is how its syntax and structure encourage writing clean and maintainable code. As software developers, we all know how important that is — especially when your code is running in production.</p><p>Clean code is not all about writing code that looks neat (even though that’s a plus). Rather, it’s about writing code that’s easy to read, understand, and maintain. It’s about saving your future self and/or your team from the stress of deciphering a tangled mess when requirements change, or bugs pop up. As Robert C. Martin, the author of <strong>Clean Code</strong>, puts it:</p><blockquote>“Clean code is code that has been taken care of. Someone has taken the time to keep it simple and orderly.”</blockquote><p>In this article, using a movie management REST API I built using SpringBoot, I’m going to walk you through how I applied clean code principles in Java and how you can too. No matter your level of expertise in software development, I hope you’re able to get some practical takeaways from this to apply to your own projects.</p><h3><strong>Organizing the Codebase</strong></h3><p>The first step is organization. A well-structured codebase is like a well-organized toolbox — you know exactly where everything is, and you can find what you need without wasting time. For my movie API, I divided the code into clear, logical layers:</p><p>- <strong>Entities</strong>: They represent the core data models, like User and Movie. Each entity is simple and focused, sticking to the Single Responsibility Principle (SRP).<br>- <strong>Repositories</strong>: These handle database interactions. By keeping data access logic separate, I made sure the service layer could focus purely on business logic.<br>- <strong>Services</strong>: This is where the core logic lives. I used interfaces (like MovieService) and their implementations (MovieServiceImpl) to keep things flexible and testable.<br>- <strong>Controllers:</strong> These handle incoming HTTP requests, delegate work to the service layer, and return responses. They’re the gatekeepers of the API.<br>- <strong>DTOs (Data Transfer Objects):</strong> These act as messengers between layers, carrying data without exposing the internal structure of entities.<br>- <strong>Utilities:</strong> Helper classes like AuthResponse and LoginRequest live here, keeping the code DRY (Don’t Repeat Yourself).<br>- <strong>Exceptions:</strong> Custom exceptions like MovieNotFoundException and TokenExpiredException make error handling more specific and meaningful.</p><p>Here’s a snippet of what the folder structure looks like:</p><pre>com/movieflix/movieapi/<br>├── auth/<br>│ ├── config/<br>│ ├── entities/<br>│ ├── repositories/<br>│ ├── services/<br>│ └── utils/<br>├── controllers/<br>├── dto/<br>├── entities/<br>├── exceptions/<br>├── repositories/<br>├── services/<br>└── MovieApiApplication.java</pre><p>This structure isn’t just about aesthetics — it’s about making the codebase intuitive. Even if someone else picks up this project, they’ll know exactly where to find what they need.</p><h3><strong>Principles I Followed</strong></h3><p>While building this API, I kept a few key principles in mind to ensure the code stayed clean and maintainable:</p><ol><li><strong>Single Responsibility Principle (SRP):</strong> Every class and method should have one job. For example, the MovieService class handles movie-related logic, and nothing else. This makes the code easier to test, debug, and extend. Here is what my MovieService.java file looks like:</li></ol><pre>package com.movieflix.movieapi.services;<br><br>import com.movieflix.movieapi.dto.MovieDto;<br>import com.movieflix.movieapi.dto.MoviePageResponse;<br>import org.springframework.web.multipart.MultipartFile;<br><br>import java.io.IOException;<br>import java.util.List;<br><br>public interface MovieService {<br><br>    MovieDto addMovie(MovieDto movieDto, MultipartFile file) throws IOException;<br><br>    MovieDto getMovie(Integer movieId);<br><br>    List&lt;MovieDto&gt; getAllMovies();<br><br>    MovieDto updateMovie(Integer movieId, MovieDto movieDto, MultipartFile file) throws IOException;<br><br>    String deleteMovie(Integer movieId) throws IOException;<br><br>    MoviePageResponse getAllMoviesWithPagination(Integer pageNumber, Integer pageSize);<br><br>    MoviePageResponse getAllMoviesWithPaginationAndSorting(Integer pageNumber, Integer pageSize, String sortBy, String dir);<br>}</pre><p>2. <strong>Don’t Repeat Yourself (DRY):</strong> Repeated code is a breeding ground for bugs and inconsistencies. I created reusable utility methods and DTOs to keep things DRY.</p><p>3. <strong>Meaningful Naming:</strong> A well-named class or method is like a good road sign — it tells you exactly where you’re going. Instead of vague names like process() or handle(), I used descriptive names like getAllMovies() and generateOtpToken().</p><p>4. <strong>Separation of Concerns:</strong> Each layer of the application has a clear purpose. Controllers handle requests, services manage business logic, and repositories deal with data access. This separation makes the codebase easier to navigate and maintain.</p><p>5. <strong>Error Handling:</strong> I created custom exceptions like MovieNotFoundException and TokenExpiredException to make error messages more specific and actionable. This not only improves debugging but also makes the API more user-friendly.</p><h3><strong>Why Clean Code Matters</strong></h3><p>Clean code isn’t just a nice-to-have — it’s a necessity. It reduces technical debt, speeds up development, and makes collaboration smoother. It’s also a gift to your future self. Trust me, there’s nothing worse than revisiting old code and realizing you have no idea what it does.</p><p>So, the next time you write code, ask yourself: Is this clean? Is it maintainable? If I didn’t write this, would I be able to understand it? If the answer is no, take a step back and refactor. Your future self — and your team — will thank you.</p><h3><strong>Final Thoughts</strong></h3><p>Writing clean code is a skill that takes time and practice, but it’s worth the effort. By organizing your codebase, and following principles like SRP and DRY, you can create code that’s not just functional but also maintainable. That’s what makes the difference between a regular developer and an outstanding one.</p><p>You can check out the rest of the code for the movie management API <a href="https://github.com/Favourite101/springboot-movie-api">here</a>.</p><p>So, what’s your approach to writing clean code? I’d love to hear your thoughts and tips — let’s keep the conversation going!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=af1c2b7abd78" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I’m Never Volunteering for Anything Again!]]></title>
            <link>https://medium.com/@favourwrites/im-never-volunteering-for-anything-again-64528eda49f6?source=rss-8a598e097605------2</link>
            <guid isPermaLink="false">https://medium.com/p/64528eda49f6</guid>
            <category><![CDATA[leadership]]></category>
            <category><![CDATA[overwhelm]]></category>
            <category><![CDATA[volunteering]]></category>
            <category><![CDATA[lessons-learned]]></category>
            <category><![CDATA[balance]]></category>
            <dc:creator><![CDATA[Oluwatunmibi Favour]]></dc:creator>
            <pubDate>Wed, 08 Jan 2025 14:00:04 GMT</pubDate>
            <atom:updated>2025-01-08T14:00:04.339Z</atom:updated>
            <content:encoded><![CDATA[<p>Yes, you read that right but maybe not in the way you’re thinking.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A6xB41okCKxJ_QExL-8zzw.jpeg" /></figure><p>“It’s better to fully commit to one thing and give it your all than to spread yourself too thin and give less than your best everywhere.” This is something I’ve learned the hard way, and it stuck with me after the first time I heard it. Let me explain why.</p><p>We often romanticize the idea of doing it all, but what happens when “doing it all” becomes a burden? This article is a reflection on my last two semesters — the decisions I made, the good, the bad, and the lessons that are now engraved in my mind.</p><p>In 200lvl first semester, I was already asking myself what I wanted to do in 300lvl — in terms of leadership. I was so used to holding a leadership position that I just knew that I couldn’t let myself be a regular student. After serving as Head Prefect in secondary school, the closest I’d come to holding a leadership role in university was being a Course Rep in my department. I wanted more. It wasn’t power hunger, I just felt I could do more, make more impact. I considered BUCC posts, but I didn’t know which one exactly. A friend encouraged me to consider a BUSA post which I never even thought of before then. The first thing that discouraged me was the thought of it being a distraction because I didn’t see how it would contribute to my professional and career growth, but I heard they pay and so I went for it. While that may not have been the best reason to take on a leadership role, looking back, I’m glad I went for it.</p><p>Running for a BUSA post was definitely AN EXPERIENCE. I started campaigning and telling people early, so I was SO sure that I had the post secured with no opponent but to my greatest surprise, I did have competition — a strong one at that. Elections clashed with exams, and it was a lot, but I prevailed. My result that semester wasn’t my best, but I’d like to believe it wasn’t because of BUSA.</p><p>Not a lot of people know this, but I lost the election the first time. I was so pained. Thankfully, we had already vacated when we did the actual election so no one could see me break down. I think what hurt me the most was the fact that I didn’t know that anyone else was going for the same post on time. I avoid competitions and confrontations so much that if I had known, I would have dropped out of the election. My secondary school PE teacher would probably say I’m a “bad sportsman”.</p><p>That experience taught me that running away from challenges isn’t always the best option. Sometimes, putting yourself out there and believing in your abilities can lead to personal growth, even if the result isn’t what you hoped for. “Even though I didn’t win, I put in effort and had an experience not so many people are brave enough to have”, I told myself. Shortly after that, we were told that they were some issues with the voting system and that the election needed to be conducted again. Voters were angry about that and not so many people were willing to vote again.</p><p>I wasn’t willing to put any effort into the election again. After losing with such a wide gap the first time, what miracle could possibly make me win — especially when less than 50% of voters were likely to vote again? But I’m grateful for my friends who encouraged me not to give up. Taking their advice, I decided to start texting and calling anyone who could vote. After all, what’s the worst that could happen? I lose again?</p><p>To my utter surprise, I won the second time — and I was overjoyed! One of the first congratulatory messages I received was from my opponent, and that moment made me pause. I felt so bad because, when I lost the first time, I was too busy sulking to congratulate the winners. Second lesson: <em>Grace in defeat matters.</em> I learned the importance of congratulating others, even when things don’t go my way. Losing is tough, but showing respect to others in their moment of victory reflects character. I realized this when my opponent congratulated me after my win — something I failed to do when I lost the first time. After the election and reflecting on the lessons learned, it became clear that I needed to rethink how I approached responsibilities.</p><p>Fast forward to resumption in 300lvl first semester, the first sign of it being a stressful semester was having to resume before everyone else. We had a bunch of seminars and symposiums to prepare us for the journey ahead and though I didn’t see the importance of those things initially, I eventually realized why those things were necessary along the way.</p><p>You know how impressive it sounds when someone talks about all the things they’re involved in right? But have you ever seen where it stops being impressive and becomes concerning? Along with being a BUSA Senator, I had to balance it with being a Course Rep, Enactus Secretary, ShadowDevs Lead, an MLSA, Member of the BUCC Crunch Team, Member of the BUCC Dev Team. But guess what? I still kept filling Google forms and applying for more roles. I became a core team member for the GDG Data Science Track, I joined the BUCC media team, and I became the assistant HOD of the ICT department in my chapel.</p><p>Why did I keep applying for things without considering how I would manage them? I called it an addiction to filling Google forms and clicking on links — so let’s just go with that because, honestly, I have no better explanation. From the beginning of the semester, I was already anticipating the end, and honestly, I don’t think that’s the best way to live.</p><p>I performed my roles in all these positions — some better than others — but I know I could have done more if I had taken on fewer responsibilities. Don’t get me wrong, it’s not wrong to want to be involved in many things. But learning to prioritize is key, and that brings me to the third lesson:</p><p><em>Prioritize wisely and learn to say no. Taking on too much might look impressive at first, but it can easily become overwhelming.</em> I’<em>ve learnt that it is better to fully commit to a few roles and do them well than to spread myself thin and underdeliver. Saying ‘no’ to opportunities doesn’t mean you’re missing out — it means you’re choosing to excel in what you’ve already committed to. Moving forward, I’m learning to prioritize roles that align most with my goals and capacity.</em></p><p>I had other personal development goals that I wish I gave more time to. There were personal projects I had set aside, like improving my skills in areas I was passionate about, and team projects that could have benefited from my full attention. My ALX SE final project, for instance, deserved more time and focus than I gave it. Looking back, I see that I could have made better use of my time by prioritizing these goals, and I aim to do better this time.</p><p>Looking ahead to 2025, I’m focused on staying true to my values, learning from my past mistakes, and staying aligned with my goals. The next chapter — my SIWES experience — is one I’m approaching with more focus, and I’m determined to make the most of it. This year will be different because I know the importance of pacing myself, saying no when necessary, and finding balance.</p><p>If you relate to anything I have mentioned in this article, feel free to engage me in a conversation in the comments and don’t forget to leave some claps! Thank you for reading and I hope you learnt something valuable from this!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=64528eda49f6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Top 5 Generative AI Libraries for Python Beginners]]></title>
            <link>https://medium.com/gdsc-babcock-dataverse/top-5-generative-ai-libraries-for-python-beginners-4beab230b9b5?source=rss-8a598e097605------2</link>
            <guid isPermaLink="false">https://medium.com/p/4beab230b9b5</guid>
            <category><![CDATA[tensorflow]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Oluwatunmibi Favour]]></dc:creator>
            <pubDate>Sat, 23 Nov 2024 12:01:18 GMT</pubDate>
            <atom:updated>2024-11-23T12:01:18.091Z</atom:updated>
            <content:encoded><![CDATA[<p><em>“Discover the best libraries to get started with Generative AI”</em></p><figure><img alt="Python Libraries for Generative AI" src="https://cdn-images-1.medium.com/max/1024/1*s1szGV36YoP8yHNcjvVXmg.jpeg" /><figcaption>Python Libraries for Generative AI</figcaption></figure><p>Unlike traditional AI systems, which focus on analyzing data or performing specific tasks, generative AI stands out by creating entirely new content — be it text, images, or even videos — based on patterns learnt from existing data.</p><p>While the concept of generative AI is fascinating, it can feel overwhelming for beginners unsure of where to start. That’s where this guide comes in. Here are the top five Python libraries for generative AI that are perfect for beginners. Even if you already have some experience, you might discover new tools or techniques to enhance your projects.</p><h3><strong>1. PyTorch</strong></h3><p>PyTorch is one of the most popular frameworks in AI research and development, and for a good reason. Its syntax is intuitive, and it’s highly flexible, making it easy for beginners to learn while still powerful enough for advanced users.</p><p>In generative AI, PyTorch shines when building models like <strong>Generative Adversarial Networks (GANs)</strong> and <strong>Variational Autoencoders (VAEs)</strong>. These models help create everything from realistic images to new music compositions.</p><p>Here’s an example of how you might define a simple generator using PyTorch:</p><pre>import torch<br>import torch.nn as nn<br># Define a simple neural network model<br>class Generator(nn.Module):<br>    def __init__(self):<br>        super(Generator, self).__init__()<br>        self.fc = nn.Linear(100, 784)  # Example architecture<br>    <br>    def forward(self, x):<br>        return torch.sigmoid(self.fc(x))<br><br>generator = Generator()<br>print(&quot;Generator created:&quot;, generator)</pre><h3>2. TensorFlow and Keras</h3><p>If you’ve heard about AI before, there’s a high chance you’ve come across TensorFlow. It’s a powerful framework that is widely used in both research and production. The best part? It comes with Keras, a super beginner-friendly API that makes building AI models feel less intimidating.</p><p>When it comes to generative AI, TensorFlow and Keras are perfect for creating large-scale models like GANs or even tools like DALL-E. They handle the heavy lifting so you can focus on experimenting and learning.</p><p>Here’s a simple example of using Keras to create the backbone of a generator model:</p><pre>from tensorflow.keras import Sequential  <br>from tensorflow.keras.layers import Dense  <br><br># A simple generator model  <br>model = Sequential([  <br>    Dense(128, activation=&quot;relu&quot;, input_shape=(100,)),  <br>    Dense(256, activation=&quot;relu&quot;),  <br>    Dense(784, activation=&quot;sigmoid&quot;)  <br>])  <br>print(&quot;Keras model created:&quot;, model.summary())</pre><h3>3. Hugging Face Transformers</h3><p>Ever wondered how tools like ChatGPT or text-to-image generators work? That’s the role of Hugging Face Transformers. They give you access to pre-trained models, so you don’t need to start from scratch. These models are great for generating text, translating languages, or even creating images.</p><p>For example, you can use Hugging Face to create text just like this:</p><pre>from transformers import pipeline  <br><br># Generate text using GPT-2  <br>generator = pipeline(&quot;text-generation&quot;, model=&quot;gpt2&quot;)  <br>result = generator(&quot;The future of AI is&quot;, max_length=50, num_return_sequences=1)  <br>print(result[0][&quot;generated_text&quot;])</pre><h3>4. FastAI</h3><p>FastAI is perfect if you want to dive into generative AI but don’t want to deal with too much complexity. It is built on top of PyTorch and simplifies a lot of the steps needed to train and test models.</p><p>This library is great for things like generating art, modifying pre-trained models, or just quickly prototyping ideas. With FastAI, you can get started without worrying about the details of model architecture or optimization.</p><p>Here’s an example showing how easy it is to work with:</p><pre>from fastai.vision.all import *  <br><br># Load a dataset and create a learner  <br>learn = cnn_learner(dls, resnet18, metrics=error_rate)  <br>print(&quot;FastAI learner ready!&quot;)</pre><h3>5. Diffusers by Hugging Face</h3><p>The Diffusers library is another fantastic tool from Hugging Face, and it focuses on image generation. This is the go-to library if you want to explore diffusion models, which are at the core of modern tools like Stable Diffusion.</p><p>Diffusers let you create stunning images from text or tweak pre-trained models to suit your needs. They’ve made complex technology highly beginner friendly.</p><p>Here’s how easy it is to generate an image:</p><pre>from diffusers import StableDiffusionPipeline  <br><br># Load a pre-trained model for text-to-image generation  <br>pipe = StableDiffusionPipeline.from_pretrained(&quot;CompVis/stable-diffusion-v1-4&quot;)  <br>pipe.to(&quot;cuda&quot;)  # Use GPU if available  <br><br>image = pipe(&quot;A serene mountain landscape at sunset&quot;).images[0]  <br>image.show()</pre><p>Generative AI is an exciting field with endless possibilities, and these five libraries make it easier than ever to get started. While these are great starting points, there are many more libraries available that you can explore as you progress. No matter what you decide to start with or which library you choose, the key is to start small and learn as you go.</p><p>Remember, you don’t need to be an expert to create something amazing. These tools are here to help you explore, experiment, and grow your skills. So why not pick one today and dive in? Who knows what you’ll create!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4beab230b9b5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/gdsc-babcock-dataverse/top-5-generative-ai-libraries-for-python-beginners-4beab230b9b5">Top 5 Generative AI Libraries for Python Beginners</a> was originally published in <a href="https://medium.com/gdsc-babcock-dataverse">GDG Babcock Dataverse</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Future-Proof Your Career: A Review of the ALX AI Career Essentials Program]]></title>
            <link>https://medium.com/@favourwrites/future-proof-your-career-a-review-of-the-alx-ai-career-essentials-program-8123528315eb?source=rss-8a598e097605------2</link>
            <guid isPermaLink="false">https://medium.com/p/8123528315eb</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[career-essentials]]></category>
            <category><![CDATA[review]]></category>
            <category><![CDATA[lax]]></category>
            <category><![CDATA[aice]]></category>
            <dc:creator><![CDATA[Oluwatunmibi Favour]]></dc:creator>
            <pubDate>Mon, 01 Jul 2024 15:33:18 GMT</pubDate>
            <atom:updated>2025-01-08T13:18:41.474Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="ALX AICE" src="https://cdn-images-1.medium.com/max/740/0*f3NrNXr65_rWIKK3.png" /></figure><p>Ever since I was little, sci-fi movies depicting advanced AI machines always fascinated me and got me interested in how much potential AI had to change the world. As I learnt more about it, I realized how much it was already integrated into my daily life from the accuracy of social media recommendation systems to how well virtual assistants like Siri could communicate in natural languages. When ALX sponsored an event in my university and introduced their AI Career Essentials course, I knew it would be of value to me. Having taken an ALX course before, I was confident in the program’s quality. However, I underestimated the time commitment and missed the onboarding week. Thankfully, my prior experience with the Savanna platform helped me catch up quickly.</p><p>There was a mistake with my name on the Savanna platform and I contacted them about it. Their swift response and resolution of the issue was very impressive. I went through the content of the onboarding week, and it provided a strong foundation for the course and various AI concepts. The first week was probably my favorite with the third week as a close second. I learnt so much about prompt engineering, specifically the six building blocks of a good prompt: task, context, exemplars, persona, format and tone. As someone who was already experienced in using AI tools, there was a lot of improvement in my interaction with those tools after applying everything I learnt about prompting.</p><p>In the second week, I learnt a lot about the importance of crafting a strong digital persona and personal brand. It made me realize some of the mistakes I made previously in job applications, and I learnt how to correct those mistakes. There was a module where a “good” resume was compared with a “bad” one and I was able to clearly see the differences between both and what made one better than the other. I remember going to immediately make changes to my resume after completing that week’s work and honestly, I’m glad I did.</p><p>The third week which had my second favorite content, exposed me to a lot of creative AI tools like Firefly, Udio and Immersity just to name a few. I was able to create a whole song using Gemini and Udio. Looking back, that was definitely the most fun I had throughout the course of the program. The third week made me realize how advanced image and video generation with AI had gotten. I also learnt about the four stages of the creative thinking process which are: preparation, incubation, illumination and verification.</p><p>The fourth week required me to work with data and make decisions based on those data, the fifth week focused on entrepreneurship with AI, and I was able to build a professional website using Wix AI. The sixth week reflected on the content of the previous weeks and served as an outro from the course. It was quite a nostalgic moment for me rounding up with the course.</p><p>The major challenge I faced over the six weeks was the learning curve I encountered while using some tools required by the course. It took a lot of perseverance and determination and eventually, I mastered most of them.</p><p>Overall, the ALX AI Career Essentials program was an eye-opening experience, and the most amazing part is that it is designed to suit both technical and non-technical individuals. Whether you’re looking to enhance your current role, start up your own a business, or simply explore AI’s potential, this free program offers valuable tools and knowledge. I hope this review helps you decide whether or not the ALX AI Career Essentials program is right for you.</p><p>You can register for the course here: <a href="https://admissions.alxafrica.com/apply/87q7d8mmgzausufxnpcq?_gl=1*1o3hisv*_gcl_au*MTIwNTYyNTk3NC4xNzE5ODQ3Mjgx*_ga*MTU0MjM5OTkyMi4xNzE5ODQ3MjY5*_ga_Y49H7D9C6F*MTcxOTg0NzI2OC4xLjEuMTcxOTg0NzM2Ny4zMi4wLjA.">ALX AICE</a>. Feel free to share this article if you found it helpful.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8123528315eb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Portfolio Website Outage Postmortem (An ALX Project)]]></title>
            <link>https://medium.com/@favourwrites/portfolio-website-outage-postmortem-an-alx-project-8d0d59b46ae1?source=rss-8a598e097605------2</link>
            <guid isPermaLink="false">https://medium.com/p/8d0d59b46ae1</guid>
            <category><![CDATA[incident-response]]></category>
            <category><![CDATA[postmortem]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[portfolio]]></category>
            <dc:creator><![CDATA[Oluwatunmibi Favour]]></dc:creator>
            <pubDate>Tue, 25 Jun 2024 10:11:54 GMT</pubDate>
            <atom:updated>2024-06-25T11:09:19.880Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*IhnzzJZONi_ie6jgtAGgtQ.jpeg" /><figcaption>Postmortem</figcaption></figure><p>I experienced an outage yesterday, 24th June, 2024 with my portfolio website. This is a detailed incident report of the outage and the steps taken to restore it.</p><p><strong>Issue Summary</strong></p><p>From 5:27 PM to 5:39 PM WAT, access to the website was denied with a “this site cannot be reached” message. It affected 100% of traffic to the website on all devices. The root cause of this outage was an exacerbating change to a workflow file.</p><p><strong>Timeline (all times West African Time)</strong></p><ol><li>5:27 PM: Changes to the workflow file is pushed to the GitHub repository</li><li>5:28 PM: An error occurs in the “build and deploy” process</li><li>5:29 PM: Outage begins</li><li>5:30 PM: Pager alerts me</li><li>5:32 PM: Successful change rollback</li><li>5:34 PM: Repository is cloned locally, and invalid workflow file is deleted using CLI</li><li>5:35 PM: New changes are pushed directly to the main branch</li><li>5:37 PM: Successful “build and deploy” process</li><li>5:39 PM: Website is restored successfully</li></ol><p><strong>Root Cause</strong></p><p>At 5:27 PM WAT, the content of the invalid workflow file was deleted since the file itself could not be deleted from the GitHub UI and the change was committed and pushed directly to all branches. This caused the workflow for both the valid and invalid workflow files to be initiated and that resulted in an error at 5:28 PM which ultimately caused the website to shut down after synchronization with the deployment on Microsoft Azure at 5:29 PM.</p><p><strong>Resolution and Recovery</strong></p><p>The monitoring system alerted me at 5:30 PM, I identified the cause of the problem after reading through the error logs of the “build and deploy” process and immediately reverted the last commit. The commit was successfully reverted at 5:32 PM but that did not completely solve the problem. I still needed to get rid of the invalid workflow file which although was not causing the website to shut down, was causing a “build and deploy” error because it was connected to an Azure static website that had been deleted.</p><p>I cloned the repository using my RSA public key at 5:35 PM, deleted the workflow file from my CLI and pushed the changes at 5:37 PM. All the changes were deployed successfully, and the website was restored at 5:39 PM.</p><p><strong>Corrective and Preventive Measures</strong></p><p>After the incident, I have conducted an analysis of the outage. The following actions will be taken to address the underlying cause of the outage, prevent any recurrence of the incident and improve response time in the future:</p><ol><li>Ensure all changes are made locally rather than using the GitHub UI.</li><li>Configure monitoring system to detect “build and deploy” errors.</li><li>Push new changes to a testing branch to ensure everything works well before merging with the main branch.</li><li>Make reverting process automated and quicker.</li></ol><p>From now on, the downtime of my website and other websites I manage will be reduced and managed more efficiently to prevent more incidents like this.</p><p>You can check out my portfolio website here:</p><p><a href="https://favourtunmibi.me/">Hello, I&#39;m Favour</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8d0d59b46ae1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>