Posts

Showing posts from June, 2025

Managing FastAPI Projects with Poetry: A Step-by-Step Guide

Image
This guide will walk you through how to use Poetry to manage dependencies and structure your project in FastAPI . It includes detailed explanations of Poetry's core concepts and commands to help prevent issues that can arise during team collaboration and deployment. 1. What is Poetry? Poetry is a dependency management and packaging tool for Python. It goes beyond simply installing libraries by allowing you to clearly declare the dependencies your project needs and ensuring that all developers on the project have the same library versions. Clarity in Dependency Management : Explicitly manage your project's basic information and required libraries through the pyproject.toml file. Reproducible Builds : By locking all dependency versions in the poetry.lock file, it fundamentally prevents "it works on my machine" problems. Integrated Development Environment : It automatically creates and manages isolated virtual environments for each project and handles mo...

A Guide to Automating Connections with SecureCRT Logon Scripts

Image
Developers and system administrators often repeat the daily process of connecting to multiple servers via SSH or Telnet. SecureCRT's "Logon Actions" (or "Logon Scripts") feature is a useful tool that automates these repetitive connection procedures, reducing wasted time and significantly improving work efficiency. I personally used this feature because I found the process of connecting to a PostgreSQL database to be tedious every time. In addition to database connections, this feature is also very useful when you need to connect to a final destination server through an intermediary server, often for security reasons. For example, the true value of this feature becomes apparent in a "jump server" environment, where you must first log into Server A via SSH and then, from there, initiate another Telnet or SSH connection to Server B. Step 1: Create the Python Script File Create a python code file with a .py extension. It's recommended to creat...

How to install docmost on Synology NAS (DS916+) with Docker

Image
This blog provides a comprehensive guide to installing and configuring Docmost, an open-source collaborative wiki and notion alternative, on a Synology NAS (DS916+ and similar models) environment using Docker. 1. Reverse Proxy Setup for External Access To access Docmost via an external domain (e.g.,  docmost.your-domain.i234.me ) and to fix the "Real-time editor connection lost" error, a reverse proxy setup is essential. Step 1. Navigate to Reverse Proxy Settings Go to DSM  Control Panel  >  Login Portal  >  Advanced  tab. Click the  Reverse Proxy  button and then  Create . Step 2. General Settings Step 3. (Crucial) Custom Header Settings After clicking  Create , go to the  Custom Header  tab. Click the  Create  dropdown menu and select  WebSocket . This will automatically add the two necessary headers. This step is key to resolving the real-time editing error. Click  Save  to complete...

Setting Up a Modern Vim 9.x IDE on Ubuntu or Linux

Image
This guide walks you through the process of transforming the terminal on a new Ubuntu or Linux server into a powerful, IDE-like environment. We will accomplish this by installing the latest Vim 9.x, setting up a plugin manager, and configuring essential plugins for a modern development workflow. Step 1: Create Vim Directories First, let's create the directories where Vim's settings will be stored. These folders will hold backup files, swap files, and a persistent undo history, which helps keep your project folders clean and improves data safety. # Pre-create directories for Vim settings mkdir -p ~/.vim/undodir ~/.vim/backupdir ~/.vim/swapdir Step 2: Prepare the .vimrc File Next, create Vim's configuration file, ~/.vimrc . Copy the content below and paste it into your ~/.vimrc file. This configuration includes a list of plugins, key mappings, UI settings, and more. # Save the following content as your ~/.vimrc file. " === Plugin Manager: vim-plug === ...

How to Fix Lombok's @Builder Ignoring Initial Values with @Builder.Default

Image
Lombok's @Builder is a powerful feature that replaces repetitive builder pattern code with a single annotation. However, when using @Builder , you might encounter the following warning message when you set an initial value for a field: java: @Builder will ignore the initializing expression entirely. If you want the initializing expression to serve as default, add @Builder.Default. If it is not supposed to be settable during building, make the field final. Why Does the Warning Occur? - How Lombok Works Before solving the problem, it's important to understand why Lombok ignores the initial value of the field. When a class is annotated with @Builder , Lombok generates a separate inner Builder class (e.g., UserBuilder ) at compile time. This is the class we use through the .builder() method. The key is that the fields of the original class and the fields of the Builder class exist in different spaces. import lombok.Builder; import lombok.Getter; @Getter @Builder pu...

From Audio Station to Plex Media Server, A Complete Guide for the Synology DS916+

Image
For nearly ten years, my Synology DS916+ has been a trusty workhorse for file storage. When it came to music, I relied on Synology's own Audio Station. But the experience was never quite right. The UI felt dated, and the constant need to re-enter my OTP password after it expired was a pretty annoyance. I'd heard great things about Plex, specifically that even the free version was a massive improvement. I decided it was time to make the switch. In this blog post, I'll walk you through the exact steps I took to install and configure Plex Media Server on my Synology DS916+. Step 1: Installing the Plex Media Server Package You have two main options for installing Plex. While using the Synology Package Center is simple, I strongly recommend downloading the package directly from the Plex website to ensure you have the latest features and bug fixes. Option 1: The Package Center (Easy, but may be outdated) You can find Plex in the Synology DSM Package Center under ...

System Design] Reliability vs. Availability

Software systems must provide users with reliable and continuous service . Two key concepts at the heart of this goal are Reliability and Availability . Many people confuse these terms or use them interchangeably. However, in system architecture, it is crucial to understand the difference and consider them separately . 1. Reliability How long does the system operate without failure? Definition Reliability refers to a system’s ability to operate continuously without errors . In other words, once the system starts, how long can it run without interruption or failure? Key Concepts MTBF (Mean Time Between Failures): The average time between two consecutive failures. Fault Tolerance: The system should continue to function even if one component fails. Example A server operates flawlessly for 180 out of 365 days , then experiences a critical failure and remains down for 2 days . → High reliability (long stable period), but low availability (long downtime when it fail...

Checked vs Unchecked Exceptions in Java

In Java, exceptions are categorized into Checked Exceptions and Unchecked Exceptions , depending on how the compiler and exception handling mechanisms operate. Throwable ├─ Error (Unchecked) └─ Exception ├─ CheckedException (e.g., IOException) └─ RuntimeException (Unchecked) 1. Classification Criteria Type Inheritance Hierarchy Compiler Enforcement Common Examples Checked Exception Exception (excluding RuntimeException ) Required IOException , SQLException Unchecked Exception RuntimeException and its subclasses Not Required NullPointerException , IllegalArgumentException 2. What is a Checked Exception? Subclasses of Exception , excluding RuntimeException Compiler forces exception handling You must handle them using try-catch or declare them with throws Common Examples: IOException SQLException FileNotFoundException Cl...

Java Exception Hierarchy – Throwable, Exception, and Error

Image
Java provides a robust and predictable error-handling system, and at the heart of this system lies the exception hierarchy rooted in the Throwable class. Understanding this hierarchy gives you several advantages: Write cleaner and safer code Respond appropriately and recover from errors Easier debugging and maintenance Build more reliable programs In this article, we’ll visualize the Java exception hierarchy, explain each layer, and cover practical exception handling strategies and best practices you’ll use every day. Java Exception Hierarchy at a Glance 1. Top-Level Class: Throwable At the very top is the Throwable class, which represents anything that can be thrown as an error or exception. It has two main direct subclasses: Error : Serious problems at the JVM or system level (not recoverable) Exception : Application-level issues (recoverable) 2. Error – System/JVM-Level Critical Failures Error represents severe problems that applications should not try ...