Oscars RAGtime!

Lights, Cameras, and… Action!

For a short period of time, we are transported to a world created by the imagination of screenwriters, envisioned by directors, performed by actresses and actors. Whether that period is five minutes or two and a half hours, we are not sitting in a movie theater; we are elsewhere, since escaping from a horde of monsters on a land of fantasy, or even in a real city of the world, in some historic moment. Pure magic.

But to transport us to another place, movies have a big team, with people taking care of the scenario, wardrobe, music, sound, and special effects, among others. There is a huge team of professionals doing their work to transport us where we must be. When one thing is not done well, we feel uncomfortable, and we remember that we are sitting in a movie theater again. The fantasy is broken, and the veil of reality falls like a stone upon us. They must do their work well. They must be the best.

And to be recognized, there are movie festivals where a small sample of all produced movies is selected during a certain period of time (commonly one year). There are a lot of festivals nowadays, and one of them is the Oscars. It started small, in 1929, at lunchtime, with 270 people in a hotel, and delivered a few statues for movies starring in 1928. It evolved and became one of the most important ceremonies in the world.

Many happened in the movie industry (and to The Oscars) from the first edition to the lates in 2026 (my dataset is from 1929 to 2026): the advent of sound in movies, the advent of colors in movies, war and other conflicts inspired people, people and culture influenced moviemakers, books and other media (like comics) were important source of inspiration, a lot of other things happened since the first edition.

The intention of this article is to use RAG (Retrieval-Augmented Generation) with the Spring Boot AI framework to create an interface in natural language asking questions for the Oscars dataset, which has a huge amount of data that can be discovered using those questions, and not with a mechanical API offering some selected methods. Enjoy

CUT TO:

Read more

Tools, Tools, and Tools

Imagine that you have a toolbox. You need to assemble furniture, and no tools have been provided. What do you do? Certainly, you get your toolbox. Inside it, you have:

  • Screwdrivers
  • Hammer
  • Wrenches
  • Handsaw
  • Spirit Level
  • Needle nose pliers
  • Lineman’s pliers
  • Tape measure
  • etc

But you are an Object-Oriented programmer, and to get one tool from the Toolbox, a single 5mm screwdriver, you think:

Tool tool = ToolBox.getInstance().getTool("screewdriver-5mm");

There’s a ToolBox class (probably a Singleton), which contains a map of Tool indexed by its name. It will return an implementation of the Tool interface that is the tool that I want to get.

And it’s good when you are learning Object-Oriented Programming. With the advent of AI, people are thinking of using natural language:

English: Give me a 5 mm screwdriver
Portuguese: Me dê uma chave de fenda de 5 mm
Spanish: Dame un destornillador de 5 mm

And with that, you can get a 5 mm screwdriver anywhere English, Portuguese, or Spanish is spoken.

In this article, I will show the development of two AI toolboxes using Spring Boot AI: a QR Code Toolbox and a NASA Astronomy Picture of the Day (APOD) Toolbox.

Read more

The Poet and the AI

A haikai is a traditional Japanese poem with a 5-7-5 syllable format. Commonly, it contains themes like nature, capturing a moment or a landscape. Its message is simple and must be expressed in a few words. No title, no rhyme, only feelings of the moment.

Old mountain / Goes up in the sky / Getting old

Today, they are used in Pop Culture for anything, and even AI has the knowledge to create them. Of course, they will not observe nature or capture the moment and the landscape, but they know which themes are more commonly used.

This article’s example is based on the Baeldung article (thanks).

This article will show the basic use of Spring Boot AI with Haikus, an actor filmography, and MongoDB memory.

Read more

OpenCode, Spring Boot, and Spec-Driven Development, an experience

Humanoid robot typing code and reading documents at computer desk

AI is finally here, and it’s here to stay. Hurray!

In this article, I want to share my experience building a backend project with AI, guided by Spec-Driven Development. I want to tell the steps, the decisions, my feelings, the mistakes, and the whole process of building a system this way.

To develop this project, I used Spring Boot, PostgreSQL database, OpenCode CLI, subagents, and Spec-Driven Development. This project is not production-ready as it lacks security and multi-user support. It is a basic entry-level project, created to understand the power of AI-Guided development.

You can find the project on my GitHub and download it for testing. You’ll need Docker to start a dedicated database for it.

Read more

What will happen here? Question 2

Read the code below. What do you think will happen here?

import java.util.function.Supplier;
import java.util.stream.Stream;

public class Question2 {
    public static void main(String[] args) {
        Supplier<Integer> randomSupplier = () -> (int) (Math.random() * 3999) + 1;
        Stream.generate(randomSupplier).map(Question2::convertToRoman).forEach(System.out::println);
    }

    public static String convertToRoman(int number) {
        String[] thousands = { "", "M", "MM", "MMM" };
        String[] hundreds = { "", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM" };
        String[] tens = { "", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC" };
        String[] units = { "", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX" };

        return thousands[number / 1000] +
                hundreds[(number % 1000) / 100] +
                tens[(number % 100) / 10] +
                units[number % 10];
    }
}
  • A) Java will complain that it’s an infinite stream and will not run
  • B) It’ll run perfectly normally in an infinite loop
  • C) The stream will be closed after the first run, and an IllegalAccessException will be raised
  • D) Nothing will be printed
  • E) After 42 minutes, it will stop running
Read more

Programming Challenges

I have a channel of Programming Challenges on WhatsApp. I tried to find a channel like this, but without success, and I thought: Why don’t I create one?

Do here it is: The Programming Challenges WhatsApp Channel. Enjoy!

How often will I publish? Well, when a challenge comes to mind.

About what? Well, about everything: mathematical challenges, OO challenges, functional programming, REST API consuming projects, etc.

What programming language do I need to implement: anyone.

Do I need to deliver this for someone? No, it’s only for you.

What I ask you is to follow the channel and this blog.

Thanks and be challenged!

Lazy Evaluation

Java is a hybrid programming language that allows developers to write code in object-oriented, imperative, and functional styles.

Functional programming offers a set of features that enable developers to write code in a declarative style. These are the concepts:

  • Immutability
  • Pure functions
  • Higher-order functions
  • First-class functions
  • Recursion
  • Lazy evaluation
  • Tail recursion
  • etc…


In this article, we will explain how to simulate Lazy Evaluation in Java, the trade-off, and a glimpse of the future of Java.

Read more

What will happen here?

Read the code below. What will happen with it?

public class ClassA {
   private int myAttribute;

   private void multiply(int factor) {
       myAttribute *= factor;
   }

   public void doProcess(ClassA classA, int attributeValue, int factor) {
       classA.myAttribute = attributeValue;
       classA.multiply(factor);
   }

   public void printMyAttribute() {
      System.out.println(myAttribute);
   }

   public static void main(String[] args) {
       ClassA instance1 = new ClassA();
       ClassA instance2 = new ClassA();

       instance1.doProcess(instance2, 2, 3);
       instance2.doProcess(instance1, 4, 5);

       instance1.printMyAttribute();
       instance2.printMyAttribute();
   }
}
  • A) The code will not compile
  • B) The code compiles but won’t run
  • C) The code runs, but a stack overflow happens
  • D) The code prints
    • 20
    • 6
  • E) None of the above
Read more

Terraform Best Practices

introduction

Nowadays, Cloud Computing is a de-facto standard adopted by companies or individuals to create their applications. Companies that offer solutions, that could be one of the main three models (IaaS – Infrastructure as a Service, PaaS – Platform as a Service, and Software as a Service) are called cloud providers, or simply providers.

Providers offer resources that are like building blocks for DevOps people to create suitable infrastructure for their applications. The number, type, and cost of resources may vary from provider to provider. There should be a study before choosing what provider better fits the project

To create those resources, providers offer a web console that DevOps can manage them. The problem of managing the resources on the web console is to keep track of what was created. That’s nothing that a plain text file or an Excel sheet can solve, right? Nope!

Then providers created a more fun way (yeah, fun!) to create the resources: a command-line interface (CLI). Now DevOps can create scripts (Shell or Power Shell Script) to manage when creating, modifying, or destroying a resource. The problem is when adding some new resources, that are not in the scripts, a new script should be created only for this to manage its lifecycle.

Don’t worry, there is a solution that can be adopted: Terraform, which is a provider agnostic CLI that interprets its own programming language (HCL – HashiCorp Configuration Language) that describes Cloud Computing Provider resources. With this tool, it’s possible to manage the infrastructure without taking notes on Excel or Notepad or even creating Scripts to manage the infrastructure. Ok, it can do more than this as it’ll be explained here.

In this article, I will list some tips best practices I reunited during my experience with Terraform.

Read more

Folding Hash

Sometimes, it’s needed to implement a different algorithm to solve problems in the developing system. All the algorithms are challenging. Some are used to improve the system because they represent a structure that repeats with a certain frequency. They are called patterns. Others are business algorithms, that dictates the way that received data should be treated inside a system. Anyway, there’s a lot of categories of algorithms.

This article is about the implementation of the Folding Hash Algorithm. It’s based upon another article, providing an implementation.


Read more