Fading Coder

One Final Commit for the Last Sprint

Handling Optional Values in Go Using the samber/mo Library

The samber/mo library brings functional programming abstractions, specifically monads like Option, to Go. A monad can be visualized as a wrapper that holds a value and defines a standard way to chain operations. This chain stops immediate if any step fails to produce a value, lifting the burden of r...

Lessons Learned: Extracting Page Numbers from PDF.js

When working on a project that required retrieving the current page number from an embedded PDF viewer, I encountered several obstacles that took considerable time to resolve. This article documents the challenges I faced and the solutions I eventually implemented. Initial Setup The PDF viewer was h...

CSP-J2019 Jiangxi Province Problem Solutions

This problem requires comparing the area of a square with side length a against the area of a rectangle with sides b and c. The solution involves straightforward calculation with attention to equal area cases. #include<iostream> using namespace std; int main() { long long side, width, height;...

C++ Const and Mutable Modifiers Explained

Understanding C++ Const and Mutable Modifiers In C++, the const keyword is used to declare constants or immutable values. It can be applied to variables, pointers, function parameters, member functions, and more. Using const enhances code safety and readability by preventing accidental modifications...

Academic Assistance Management System Built with Spring Boot and Vue

System Overview This project implements a comprehensive platform designed to facilitate academic support activities. The architecture leverages a modern separation of concerns, utilizing a robust backend API coupled with a dynamic frontend interface to manage tuotring relationships and student progr...

CSS Fundamentals: Understanding Styles, Layouts, and Visual Formatting

Core CSS Concepts CSS serves as the presentation language for web pages. It encompasses two primary areas: (1) Style computation involving declarations, cascading, inheritance, and default values. (2) Visual formatting model, which governs layout rules determining how page boxes arrange themselves t...

Union-Find Data Structure for Efficient Connectivity Queries in Python

The Union-Find (or Disjoint Set Union) data structure efficiently manages a collection of disjoint sets, suppporting two core operations: determining which set an element belongs to (find) and merging two sets (union). It is particularly useful for modeling connectivity in graphs, networks, and dyna...

Advanced Java Design Patterns: Memento and State Patterns

In the previous article, we explored the Strategy and Template patterns within behavioral design patterns. This article will delve into two additional behavioral patterns: the Memento Pattern and the State Pattern. Memento Pattern Overview The Memento Pattern is used to capture and externalize an o...

Deploying Elasticsearch on Kubernetes Using the Operator

The cpu request value directly afffects the Elasticsearch node.processors configuraton. For example, with resources.requests.cpu: 1, Elasticsearch effectively uses a single core. Table 1. Default resource limits set by the operator Type Requests Limits APM Server 512Mi 512Mi Elasticsearch 2Gi 2Gi Ki...

Python Function Implementation with Decorators and Generators

def compute_value(input_num): ''' Calculate 2*input_num + 1 :param input_num: integer value :return: computation result ''' result = 2 * input_num + 1 return result output = compute_value(3) print(output) Function components: def: keyword for function declaration Function name: identifier used to ca...