Java Articles by Foojay.io

July, 2024

  • 11 July

    Structured Concurrency is More Than ShutdownOnFailure

    Since Java 21, structured concurrency has been added as a preview feature. Structured concurrency is a way to manage sub-tasks that are run in parallel within a given scope. If you’ve ever seen a presentation about structured concurrency, you’ve probably seen the use of the ShutdownOnSuccess or ShutdownOnFailure classes.These classes will stop the scope and the still running sub-tasks within …

    Read More »
  • 11 July

    Unsafe is Finally Going Away: Embracing Safer Memory Access with JEP 471

    Java, being a safe language, doesn’t usually allow direct low-level access. Memory is primarily managed on the heap, so developers don’t typically deal with memory directly. However, library developers are occasionally required to manipulate memory outside the heap for performance or specific use cases. This is where the controversial sun.misc.Unsafe comes in.  While undeniably powerful, sun.misc.Unsafe is a double-edged sword. …

    Read More »
  • 10 July

    Dynamic watermarking with imgproxy and Apache APISIX

    I described how to add a dynamic watermark to your images on the JVM. I didn’t find any library, so I had to develop the feature, or, more precisely, an embryo of a feature, by myself. Depending on your tech stack, you must search for an existing library or roll up your sleeves. For example, Rust offers such an out-of-the-box …

    Read More »
  • 10 July

    9 Best Java Profilers to Use in 2024

    In this article, I will share why my team decided to start a Java profiler, the list of profilers we found that are suited for profiling Java apps, and how to analyze the data from the profiler to draw conclusions faster. Recently, one of our team members was working on a third-party Linux application, and started encountering instances where he …

    Read More »
  • 9 July

    Dynamic watermarking on the JVM

    Displaying images on your website makes for an interesting problem: on one side, you want to make them publicly available; on the other, you want to protect them against undue use. The age-long method to achieve it is watermarking: A digital watermark is a kind of marker covertly embedded in a noise-tolerant signal such as audio, video or image data. …

    Read More »
  • 8 July

    Wireshark & tcpdump: A Debugging Power Couple

    Introduction to Wireshark Browser Network Monitors Installation and Getting Started Navigating Through Noise with Filters Deep Dive into Data Analysis Beyond Basic Usage The Basics of HTTPS Encryption Methods for Decrypting HTTPS in Wireshark Pre-Master Secret Key Logging Using a Proxy Integrating tcpdump with Wireshark for Enhanced Network Analysis The Role of tcpdump in Network Troubleshooting Key Scenarios for tcpdump …

    Read More »
  • 8 July

    Foojay Podcast #56: Vectors in Java Code, Databases, and LLMs

    In this Foojay podcast, we enter the world of mathematics by discussing Vectors and how they are crucial for AI and machine learning.  As ChatGPT explains: “A Vector is a mathematical structure that holds numerical values. Vectors are fundamental to the field of Artificial Intelligence, as they allow mathematical operations to be performed efficiently and form the basis of many …

    Read More »
  • 5 July

    Java: Demystifying The Stream API – Part 3

    In our earlier articles part1 and part2, we have previously explored the significance of functional programming, Lambda Calculus, as well as various features such as Functional Interfaces, Lambda Expressions, and Method References. This article delves into a crucial aspect, namely the Stream API, which JDK1.8 incorporated. It also covers how to utilize Lambda Expressions, Method References, and Functional Interfaces within …

    Read More »
  • 5 July

    The Best Way to Handle Phone Numbers

    Processing phone numbers seems complicated at first glance because of the many different formats. In this post, I’ll show you that with libphonenumber, it becomes child’s play. I’ll also recommend how to store the phone number in the database. Introduction Google’s libphonenumber According to the GitHub repository https://github.com/google/libphonenumber/ libphone number is: Google’s common Java, C++ and JavaScript library for parsing, formatting, and …

    Read More »
  • 4 July

    What’s wrong with createDirectories() – A Beginner’s Guide to IntelliJ Profiler

    Sometimes your app works, but you want to increase performance by boosting its throughput or reducing latency. Other times, you just want to know how code behaves at runtime, determine where the hot spots are, or figure out how a framework operates under the hood. This is a perfect use case for profilers. They offer a bird’s eye view of …

    Read More »