Posts

Showing posts from May, 2025

How to Push to a GitHub Repository in IntelliJ

Image
1. Initialize and Connect the Git Repository # Run in the terminal from the project root git init git remote add origin https://github.com/[user]/[repository].git 2. Configure Git in IntelliJ Select VCS → Enable Version Control Integration . Choose Git and click OK . 3. Connect Your GitHub Account Go to File → Settings (on Windows) or IntelliJ IDEA → Preferences (on macOS). Navigate to Version Control → GitHub . Click Add Account ( + ). Select Log In with Token... and enter your GitHub Personal Access Token. 4. Add and Commit Files Go to VCS → Git → Add (or use the shortcut Ctrl+Alt+A ). Select the files you want to commit. Go to VCS → Commit (or use the shortcut Ctrl+K ). Write a commit message and click Commit . 5. Push Go to VCS → Git → Push (or use the shortcut Ctrl+Shift+K ). Click the Push button. Simpler Method (Using IntelliJ's Built-in Feature) Go to VCS → Share Project on GitHub . Set the repository name to vita-user-...

How Modern Java Improves Exception Handling (Java 21)

Image
In recent Java releases, especially Java 21, exception handling mechanisms have been significantly enhanced to improve both code safety and system reliability . These improvements help developers write more robust, maintainable, and error-resilient applications. 1. switch Statements Now Handle null and Support Pattern Matching In Java versions prior to 21, passing a null value to a switch statement would throw a NullPointerException . Java 21 allows developers to explicitly handle null values inside switch , preventing unexpected crashes. switch (input) { case null -> System.out.println("Input is null."); case "YES" -> System.out.println("Yes!"); default -> System.out.println("Other input."); } Benefits Prevents NullPointerException by design Improves clarity and readability 2. Pattern Matching and when Clauses in switch Java 21 introduces pattern matching for switch , allowing developers to write m...

Spring Boot Actuator, How to Monitor Application Health with actuator-health

Image
Spring Boot Actuator provides a wide range of features to monitor and manage your application when it's deployed in a production environment. These features can be accessed via HTTP endpoints or JMX, and they automatically enable capabilities such as auditing, health checks, and metrics collection in your application. Actuator is essential in cloud-native and microservice architectures, allowing real-time monitoring of application status, metrics, and traffic data. In particular, the /actuator/health endpoint offers a basic mechanism to check if the application is running properly, making it crucial for integration with load balancers, Kubernetes, and other orchestration tools. Spring Boot Actuator Setup 1. Add Actuator Dependency pom.xml (maven) <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> </dependencies...

Managing Shared Libraries in Microservice Architecture Using GCP Artifact Registry

Image
In a microservice architecture, it's common for multiple services to share common functionality or utility classes. To handle this effectively, I manage these shared components as a reusable library (like libs.jar ) that each service can depend on. In this post, I’ll show you how I use GCP Artifact Registry to efficiently manage and distribute a shared library across microservices. Step 1: Enable the Artifact Registry API $ gcloud services enable artifactregistry.googleapis.com --project=[PROJECT_ID] Step 2: Create a Maven Repository in GCP Artifact Registry $ gcloud artifacts repositories create maven-repo \ --repository-format=maven \ --location=us-central1 \ --description="Shared Maven Repo for common libraries" $ gcloud artifacts repositories list --location=us-central1 REPOSITORY FORMAT LOCATION DESCRIPTION maven-repo MAVEN us-central1 Shared Maven repo Step 3: Configure pom.xml for the Shared Library Project In the share...

Mastering GitHub Copilot with IntelliJ

Image
If you're developing Spring Boot applications using IntelliJ and GitHub Copilot (paid plan), this post is your ultimate guide. Learn how to generate boilerplate code, auto-generate tests, refactor suggestions, and much more—all using AI-powered assistance. Supported IDEs IntelliJ IDEA (Community & Ultimate) Visual Studio Code ⚠️ Requires GitHub Copilot Chat plugin installed Summary of GitHub Copilot Usage Feature Description Example 1. Editor Autocomplete Autocomplete suggestions appear after typing comments or method signatures // Create a REST controller → Press Tab 2. Copilot Chat + Slash Commands Use commands like /explain , /doc , /test to analyze, document, or test code /explain → describes what the code does 3. Natural Language Requests Ask questions conversationally without a slash Generate a method that...

How To Install Python 3.10 on Ubuntu 24.04 for pyannote.audio Compatibility

Image
I'm currently working with pyannote.audio version 3.1.1, and for full compatibility, it requires Python 3.10—especially because it was trained with torch==1.13.1 and CUDA 11.7. But by default, Ubuntu 24.04 ships with Python 3.12, and that caused some issues with dependencies. Python 3.10 Isn’t Included in Ubuntu 24.04 Ubuntu 24.04 (codename: noble ) only comes with Python 3.12 by default. When I tried to install Python 3.10 using just sudo apt update , the package simply couldn’t be found—because it isn’t included in the official package repositories. To install Python 3.10, I had to add the deadsnakes/ppa . This is a reliable third-party repository that provides older or alternative Python versions not offered in Ubuntu’s official repositories. # Add the Deadsnakes PPA $ sudo add-apt-repository ppa:deadsnakes/ppa $ sudo apt update # Install Python 3.10 and related tools $ sudo apt install python3.10 python3.10-venv python3.10-dev \ python3.10-distutils p...

How to Install Python 3.12 on Ubuntu 22.04

Image
Ubuntu 22.04 ships with Python 3.10 by default. Since I needed Python 3.12 for newer features and compatibility, I installed it manually. Here’s how I safely set it up alongside the system Python. Step 1: Update your system sudo apt update sudo apt upgrade -y Step 2: Install Python 3.12 and tools sudo apt install -y python3.12 python3.12-venv python3.12-setuptools python3.12-dev python3.12 : The main Python 3.12 interpreter. python3.12-venv : Enables creation of virtual environments using python3.12 -m venv . python3.12-setuptools : Provides tools to build and install Python packages (replacement for deprecated distutils). python3.12-dev : Includes headers and libraries needed to build Python C extensions and compile native modules. Step 3: Set python3 to point to Python 3.12 If your system still points to an older version, you can use update-alternatives to switch. sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 2 sudo updat...

Speech-to-Text and Speaker Diarization with Wav2Vec2 and pyannote.audio 3.1 on Ubuntu 24.04

Image
In this post, I walk through how to use Wav2Vec2 for speech-to-text (STT) and pyannote.audio 3.1 for speaker diarization on Ubuntu 24.04. I'll use a Python virtual environment with Python 3.10, CUDA GPU acceleration, and Hugging Face models. Step 1: Python 3.10 Installation Ubuntu 24.04 comes with Python 3.12 by default, but since pyannote.audio 3.1.1 was trained with torch==1.13.1 and CUDA 11.7, which support Python 3.10, I need to install Python 3.10: How To Install Python 3.10 on Ubuntu 24.04 Step 2: Create Virtual Environment stt@GU502DU:~$ python3.10 -m venv wav2vec2_env stt@GU502DU:~$ source wav2vec2_env/bin/activate Step 3: Install torch 2.5.1 and cuda 12.1 My laptop is equipped with an NVIDIA GeForce GTX 1660, so I chose to install and use CUDA. Since the GPU driver reports CUDA Version 12.8, I installed the cu121 build of PyTorch, which is compatible with it. (wav2vec2_env) stt@GU502DU:~$ pip install torch==2.5.1+cu121 torchaudio==2.2.1+cu121 \ --extr...

AWS SAM Template: How to Properly Define Inline IAM Policies

AWS Serverless Application Model (SAM) is a powerful framework for defining serverless resources like Lambda functions. One commonly misunderstood part of SAM templates is the Policies section under AWS::Serverless::Function . I used to write YAML files without ever including the Version field, so I habitually left it out in the Policies section as well — this caused unexpected error when deploying, and it took me quite a while to figure out what was wrong and fix the problem. Incorrect: Using Only " - Statement:" Policies: - Statement: - Effect: Allow Action: - transcribe:GetMedicalTranscriptionJob Resource: "*" This will result in errors like: Invalid ARN: Could not be parsed! Template format error: Every policy must contain a Version field Correct: Include Full Policy Document Policies: - Version: '2012-10-17' Statement: - Effect: Allow Action: - transcribe:GetMedicalTranscrip...