Maciej Rakowski

Fullstack Dev with focus on Java, Anugular and Python
www.rakowski.biz

All About Bitwise Operators or How to Extract Red from RGB Like a Pro

In the realm of bytes and bits, understanding bitwise operators can elevate your prowess in coding and data manipulation. This article explores the practical applications of bitwise operations: from packing and unpacking data, like extracting color channels from RGB values, to working with flags and bitmasks. We'll also dive into using shift operators for fast multiplication and division, and uncover clever tricks for manipulating ASCII characters.

Persisting Enums in Java: Beyond ORDINAL and STRING

In Java, enums are typically persisted in a database using either their ordinal values or names (strings). While this approach is straightforward, it may not always be the best choice. Enum names are tied to the application’s code and can be prone to changes, while ordinal values are even more fragile, as modifying the enum order can break data consistency. A more flexible and database-friendly approach is needed when dealing with identifiers that don’t naturally align with Java’s enum conventions or when aiming to decouple the database structure from internal application logic.

Records in Java: Simplifying Data Classes

Records, introduced as a preview feature in Java 14 and officially released in version 16, are a powerful tool designed to simplify the creation of classes that primarily hold data. They significantly reduce boilerplate code by automatically generating commonly used methods like equals, hashCode, and toString. Ideal for creating immutable data carriers with minimal effort, records make your code more concise and easier to maintain.

Everything About Lists in Python

Python lists are a key part of the language, providing a flexible way to store, handle, and analyze groups of values. Unlike some other data structures, lists can change size as needed, which is helpful for modeling complex relationships or tracking changes over time. This article gives a thorough look at Python lists: It covers the basics of creating and indexing lists, and then moves on to more advanced techniques like slicing, joining lists, and changing them directly.

Everything About Tuples in Python

Tuples are a key data structure in Python used to group and manage collections of values. They are fixed in size, making them useful for storing data that should not change. Understanding tuples is important for any Python programmer, whether working on simple scripts or complex projects. This article explains how tuples work, their syntax, and common uses. It covers fundamental operations like indexing and slicing, as well as techniques like concatenation and replication.

Floating point number in JavaScript

JavaScript’s Number type, which is essentially IEEE 754 basic 64-bit binary floating-point, has 53-bit significands. 52 bits are encoded in the “trailing significand” field. The leading bit is encoded via the exponent field (an exponent field of 1-2046 means the leading bit is one, an exponent field of 0 means the leading bit is zero, and an exponent field of 2047 is used for infinity or NaN).