Welcome to the Basement of Knowledge
Exploring Linux, Java, and Open Source technologies through practical guides and tutorials
Featured Articles
Creating Embeddings with OpenAI, Saving Them in ChromaDB, and Searching Them with Java
In the realm of natural language processing (NLP), embeddings play a pivotal role in representing textual data in a numerical format that machine l...
Read Article βCreating and Searching Embeddings in Java with Hugging Face API
In the field of natural language processing (NLP), embeddings play a crucial role in representing text data in a numerical format that machine lear...
Read Article βAll Articles
How to Convert WordPress to Jekyll
Creating Embeddings with OpenAI, Saving Them in ChromaDB, and Searching Them with Java
In the realm of natural language processing (NLP), embeddings play a pivotal role in representing textual data in a numerical format that machine learning models can understand. Embeddings capture ...
In the field of natural language processing (NLP), embeddings play a crucial role in representing text data in a numerical format that machine learning models can understand. Embeddings capture sem...
In the realm of networked storage solutions, NFS (Network File System) stands out as a robust and efficient option for sharing files and directories across a network of Linux-based systems. NFS all...
Javelin is a powerful static site generator that allows you to create fast, modern, and highly customizable websites with ease. With its intuitive syntax, flexible templating system, and extensive ...
Vim, short for Vi IMproved, is a powerful and highly customizable text editor that has been a favorite among developers, sysadmins, and power users for decades. Known for its efficiency, extensibil...
In the realm of system administration, data analysis, and software development, the Linux command line is a powerful tool for text processing. With a wide array of utilities and commands at your di...
In today's interconnected world, instant messaging and real-time communication have become integral parts of both personal and professional interactions. Whether it's team collaboration, customer s...
In the realm of operating systems, memory management is a fundamental aspect that directly impacts system performance, resource utilization, and overall stability. Linux, being one of the most wide...
In today's fast-paced digital landscape, ensuring high availability and optimal performance of web applications is paramount. Load balancing plays a critical role in achieving these goals by distri...
Introduction Welcome to our beginner's guide on how to use the Vi text editor effectively. If you're new to the world of programming or system administration, you've probably heard about Vi. It's a...
Introduction Welcome to the world of Linux, a powerful, open-source operating system that powers a significant portion of the internet, corporate servers, and even Android phones. At the heart of t...
Introduction In the world of networking, the Domain Name System (DNS) plays a pivotal role in ensuring seamless communication between computers. It translates human-friendly domain names into IP ad...
Introduction In today's digital age, privacy and security are paramount. One of the most effective ways to protect your online privacy is by using a Virtual Private Network (VPN). This blog post wi...
Introduction In the world of networking, Linux has carved a niche for itself due to its robustness, security, and versatility. One of the most powerful tools in Linux is the command line interface ...
Introduction In the world of networking, file sharing is a fundamental aspect that enhances collaboration and productivity. One of the most popular methods of file sharing between Linux and Windows...
Introduction Welcome to our comprehensive guide on understanding and using the Linux boot process. If you're a beginner in the world of Linux, this post is designed specifically for you. We'll brea...
A Beginner's Guide to Configuring a DHCP Server
Introduction Welcome to our comprehensive guide on configuring a Dynamic Host Configuration Protocol (DHCP) server. If you're a beginner in the world of networking, this guide is perfect for you. W...
Introduction In the digital age, having a web presence is crucial for businesses and individuals alike. One of the key components of this presence is a web server. Today, we will guide you through ...
Introduction Linux system logs provide a wealth of information about your computer's activities. They are essential for system administrators and developers to troubleshoot issues, monitor system p...
Introduction Welcome to our comprehensive guide on setting up a database server with MySQL. If you're a beginner in the world of databases, this post is designed specifically for you. We'll walk yo...
Introduction In the digital age, privacy and security are paramount. One way to ensure these is by using a proxy server. A proxy server acts as an intermediary between your computer and the interne...
Introduction Linux, an open-source operating system, is renowned for its robustness, flexibility, and security. One of the key aspects that contribute to its efficiency is Linux Process Management....
Introduction FTP, or File Transfer Protocol, is a standard network protocol used for the transfer of computer files between a client and server on a computer network. One of the most secure and fas...
Introduction Welcome to our comprehensive guide on using the Linux command line for file management. If you're a beginner, you might find the Linux command line, also known as the terminal, a bit i...
Introduction Docker is a revolutionary tool that has transformed the way we develop, deploy, and distribute software applications. It allows developers to package an application with all its depend...
A Beginner's Guide to Creating Your Own Ubuntu Container with Podman on Mac and Persisting Changes
Introduction Containers have revolutionized the way we develop, package, and deploy applications. They provide a consistent and reproducible environment, making it easier to manage dependencies and...
A Beginner's Guide to Creating and Persisting Changes in Docker Containers Introduction Docker is a revolutionary open-source platform that allows developers to automate the deployment, scaling, an...
A Beginner's Guide to Setting Up a Mail Server with Postfix Introduction In the digital age, email communication has become a vital part of our daily lives. Whether it's for personal or business pu...
A Beginner's Guide to Setting Up a Secure SSH Server Introduction Secure Shell (SSH) is a cryptographic network protocol that allows secure remote login from one computer to another. It provides a ...
A Beginner's Guide to Understanding and Using Linux File Permissions Introduction Linux, a powerful and versatile operating system, is known for its high level of security. One of the key elements ...
A Beginner's Guide to Using the Linux Terminal Introduction The Linux terminal, also known as the command line, is a powerful tool that can seem daunting to beginners. However, with a basic underst...
A Beginner's Guide to Configuring a Firewall Using iptables Introduction In the world of network security, a firewall is a crucial component that helps protect your system from unauthorized access....
A Beginner's Guide to Installing and Configuring a LAMP Stack Introduction In the world of web development, the term "LAMP" is an acronym that stands for Linux, Apache, MySQL, and PHP. These four o...
In Spring Boot, beans are managed objects that are instantiated, assembled, and otherwise managed by the Spring IoC (Inversion of Control) container. To use a bean in Spring Boot, you typically fol...
In Java, mutable members (variables whose values can change after object creation) should not be stored or returned directly from a class when dealing with encapsulation and maintaining object int...
Quartz is a popular Java library for scheduling and managing jobs or tasks in applications. It allows you to schedule jobs to run at specific times or intervals. Here's a basic overview of how Qua...
To create an application in Java for preventing stressful moments in life, we can integrate ChatGPT to provide users with helpful tips, techniques, and advice to manage stress and promote relaxati...
Choosing the best Linux distribution depends on your specific needs and preferences. In the following view I explain how 20+ years of experience with Linux have shaped my views. Here are so...
In Java, a Provider is a class or interface that provides a way to obtain or create instances of a specific type or service. It is a concept that is often used in the context of dependency injecti...
In Java, a supplier is a functional interface from the Java.util.function package that represents a supplier of results. It does not take any arguments and returns a value of the specified type. T...
To create an RPM package from a directory such as /opt/asd in SuSE, you can follow these general steps: First, you need to install the RPM build tools on your SuSE system. You can do this by ru...
AtomicStampedReference is a class in Java that provides atomic operations on a reference object along with a stamp or version number. It is typically used in concurrent programming scenarios where...
How to Create and Use a Private Docker Registry
Using a private Docker registry offers several benefits: Improved security: With a private Docker registry, you have full control over the container images that are stored and distributed withi...
What are Docker Image Registries
Docker image registries are central repositories that store and distribute Docker container images. Docker container images are the building blocks of Docker containers, containing all the necessa...
What is Docker Swarm
Docker Swarm is a native container orchestration solution provided by Docker for managing and scaling containerized applications across a swarm of Docker nodes. It enables you to create and manage...
What is Docker Compose
Docker Compose is a tool that allows you to define, configure, and run multi-container Docker applications using a YAML file. It provides an easy way to define the services, networks, and volumes ...
What are Docker Volumes
Docker volumes are a way to persist and manage data in Docker containers. A Docker volume is a directory or a named volume that is stored outside of the container's file system and is used to stor...
What are Docker Networks
Docker networks are virtual networks that provide communication channels for Docker containers to communicate with each other and with the host system, allowing containers to communicate securely ...
What is a Port Mapping (Forwarding) in Docker
In Docker, port mapping (also known as port forwarding) is the process of associating a port on the host system with a port on a Docker container, allowing network traffic to be directed to and fr...
What is a Filesystem Mapping in Docker
In Docker, a file system mapping refers to the process of associating a directory or a file from the host system with a directory or a file inside a Docker container. This allows the container to ...
Reflection in Java is a mechanism that allows you to inspect and modify the behavior of classes, methods, interfaces, and fields at runtime, even if you do not have access to their source code dur...
H2Database (or simply H2) is an open-source, lightweight, and fast relational database management system written in Java. It is a pure Java database that can be used as an embedded database, or as...
The static keyword is often overused in Java and this can lead to several risks, including: Tight Coupling: When you declare a member (variable or method) as static, it becomes a global entity ...
How to Write a Simple Linux Bash Honeypot
The first step in a malicious hacker attack is scanning. This means that an attacker will scan its target for open ports and vulnerabilities. So, the best approach is to block an attacker who trie...
Lambdas are a concise way to define and use functional interfaces in Java. Here are some guidelines on how to use lambdas effectively in Java: Know when to use lambdas: Lambdas are best used wh...
In Java, a predicate is a functional interface from the java.util.function package that represents a function that takes in one argument and returns a boolean value. The functional interface is de...
In Maven, you can manage dependencies using a pom.xml file. Here's how you can add dependencies to your pom.xml file: Open your pom.xml file in a text editor or an integrated development enviro...
Polymorphism in Java is a concept that allows objects of different classes to be treated as if they were of the same type. It allows you to write code that can work with objects of multiple classe...
The removeIf() method is a default method introduced in Java 8 for the Collection interface. It is used to remove all elements from the collection that satisfy a given condition. The removeIf() ...
The AutoCloseable interface is a functional interface introduced in Java 7 that defines a single method called close(). This interface is used to ensure that resources are closed automatically whe...
How to Prevent Resources From Leaking in Java
In Java, a resource leak occurs when a program fails to properly release system resources after they are no longer needed. This can lead to a range of problems, such as reduced system performance,...
Reasons to Make Methods Final in Java
Making methods final in Java can provide several benefits, including: Preventing method overriding: When a method is marked final, it cannot be overridden by subclasses. This can help ensure th...
Serializing and deserializing data in Java can introduce several security risks if not implemented properly. Here are some of the main risks: Remote code execution (RCE): If untrusted data is i...
In Java, a PreparedStatement is a feature of the JDBC API that allows you to execute parameterized SQL statements. A PreparedStatement is a precompiled SQL statement that can be executed multiple ...
Hystrix is a library created by Netflix that provides fault tolerance and latency tolerance for distributed systems. It is particularly useful in microservices architecture where failures in one s...
Distributed maps provide a way for applications to store and access data in a distributed environment, where the data is automatically distributed across multiple nodes in a cluster. There are sev...
Optional in Java is a container object that is used to represent the presence or absence of a value. It is a powerful tool that can help to avoid null pointer exceptions and make code more robust....
In Java, generics provide a way to specify a type parameter for a class, method, or interface. A type parameter is a placeholder for a type that is specified at runtime, allowing code to be writte...
The diamond operator in Java, also known as the empty angle bracket (<>) syntax, was introduced in Java 7 and provides several benefits: Improved readability: The diamond operator can imp...
In Java, a method reference is a shorthand notation for referring to a method as a lambda expression. Method references provide a way to pass a reference to a method without actually invoking the ...
In Java, annotations are a form of metadata that provide additional information about program elements such as classes, methods, fields, and parameters. Annotations are defined using the '@' symbo...
Why Python Replaced Perl
Both Perl and Python are powerful scripting languages that are used extensively in software development, system administration, and data analysis. Here are some key differences between the two lan...
Here's a Linux bash script that performs the following tasks: Prompts the user to enter a directory path. Checks if the directory exists and if not, creates it. Prompts the user to enter a ...
The Java 8 Stream API is the best choice when it comes to working with collections. Here's an example of how to use it to perform filtering, mapping, and reduction operations on a collection of ob...
Custom exceptions should be used when you want to handle specific error scenarios in your application that are not covered by the built-in exception classes in Java. When you throw a custom exce...
Static variables and methods are shared among all instances of a class and can be accessed without creating an object of that class. While static variables and methods can be useful in certain sit...
Why is Proper Exception Handling Important in Java
A common bad practice in Java programming is not properly handling exceptions. Java has a robust exception handling mechanism, but not using it properly can lead to unexpected behavior and errors ...
Using if statements to solve Java problems is not necessarily a bad idea, as if statements are a fundamental part of the language and are used extensively in programming. However, it can become a ...
Lambda expressions were introduced in Java 8, and they provide several benefits over traditional anonymous inner classes. Some of the benefits of lambdas in Java include: Concise code: Lambdas ...
In Java, when you pass a parameter to a method, a copy of the value of that parameter is passed to the method, rather than the original object itself. This is what is meant by "Java is pass by val...
What are Varargs in Java and How to Use Them
In Java, varargs (variable-length arguments) are a feature that allows a method to accept an arbitrary number of arguments of the same type. The varargs feature was introduced in Java 5 and is den...
What are Java's Access Modifiers and How to Use Them
In Java, access modifiers are keywords that determine the accessibility of classes, methods, and variables in an object-oriented program. There are four access modifiers in Java: public: Classe...
Common Mistakes Which Leave a Linux Vulnerable
Securing a Linux system can be a complex task, and there are many potential pitfalls and mistakes that can compromise the system's security. Here are some of the most common mistakes with examp...
When and How to Use Iptables and Ipsets
iptables and ipsets are both tools that are commonly used in Linux-based operating systems for managing network traffic. However, they serve different purposes and have different capabilities. i...
To create a WordPress plugin which shows a random value from an array, such as quote or fact, follow these steps. Open your editor and create a file called fun_facts.php (the name does not reall...
Java Performance on Linux vs Windows
Java is a cross-platform language, which means that Java applications can run on a variety of operating systems, including Linux and Windows. The performance of Java applications can depend on a v...
The performance of PHP and Java can depend on a variety of factors, including the specific implementation, the hardware and software environment, and the workload of the application. In general,...
How to Develop Securely In Java
There are several good security practices to follow when developing Java applications. Here are some of the most important ones: Keep your Java runtime environment up to date: Make sure that yo...
How to Rewrite JSP Pages In Java
SP (JavaServer Pages) pages are essentially HTML files with embedded Java code. To rewrite JSP pages in Java, you will need to extract the Java code from the JSP pages and refactor it into Java co...
Orcacle releases new Java versions quite often and the current one is 19. However, plenty of production code is still running on older Java versions as even Java 8 is still supported. That's why i...
There are several quick wins that can be achieved through refactoring Java code: Removing duplicate code: Duplicate code can make the codebase harder to maintain and increase the risk of introd...
In one of our previous articles How to Mock Variables for Interfaces and Casts in Java we described how to use the method withSettings().extraInterfaces() in order to add more interfaces / impleme...
Maven profiles are a way to define a set of configuration options for a Maven build. Profiles are used to specify different build configurations for different environments or situations. For examp...
Retry logic can be implemented in Java using various libraries and frameworks, but the general idea is to have a block of code that can potentially fail, and then wrap that code in a loop that wil...
In Java, objects can be classified as either mutable or immutable based on whether their state can be changed or not. A mutable object is one whose state can be modified after its creation. For ...
In Java, both Boolean and AtomicBoolean are used to represent Boolean values, but they have different characteristics and use cases. Boolean is a wrapper class that represents a Boolean value as...
One common issue when writing JUnit tests is how to create a mock when the variable is an an interface / implementation or a casting. For example, in the case of casting: public PaymentGateway...
How to Back Up A MySQL Database With Java
In case you have wondered how to back up a MySQL database using Java code, here is one way to do it: import java.io.File; import java.io.IOException; import java.text.SimpleDateFormat; import ja...
Console programs in Java can be easily written using System.out.println for output and Scanner for input. For example, here is a simple guessing game which runs in the console: import java.ut...
How to Write Clean, Unobfuscated Code in Java
Writing clean, easy-to-read code in Java is important for improving code readability, maintainability, and overall quality. Here are some tips for writing clean, unobfuscated code in Java: Use ...
To some people obfuscating programming code, including Java, means: Job security. If no one can understand their code, they are irreplaceable. Smartness. They are so smart, that they can wri...
If you still run your Java code with JVM 8, it's probably high time to move on and starting using a newer JVM version such as 11. For this reasons, you have to ensure your Java code is Java 11 com...
If for some reasons you have decided that you don't like Lombok any longer, you can follow these steps to remove it: Remove Lombok annotations from your code: Replace any Lombok annotations in ...
In programming, boilerplate refers to sections of code that are repeated in many places throughout a project or across multiple projects. This code may be necessary, but it is often repetitive and...
Code analysis tools are software tools that analyze source code for potential issues, errors, and vulnerabilities. These tools can help developers identify and fix issues before they become proble...
A common dilemma while writing unit tests in Java is whether to use Mockito's when/thenReturn or doReturn/when stubbings. Both when/thenReturn and doReturn/when are used in Mockito, a popular Ja...
One of our latests posts was how to become a better programmer with the help of OpenGPT. Still, even without the help of AI, there are things you can do to become a better programmer and the most ...
Test driven development is the standard nowadays but sometimes somehow there appears a class before the test is written. This is especially true for legacy projects and legacy code. The most unp...
OpenGPT is very popular lately. If you haven't heard about it yet, it is a language model developed by OpenAI that can generate human-like text based on a given prompt. While OpenGPT can be a usef...
One of the fastest ways to advance in Java programming is using SolarLint's IDE extension. It helps you avoid common problems and ensures your code is clean. SonarLint is a linting tool for code...
A common interview question for Java developers is to write some code inside a try / catch / finally statement so that the finally statement is not reached. At first glance, this is not possible. ...
A deadlock is a situation in computer programming where two or more processes are blocked, each waiting for the other to release a resource that they need in order to continue executing. As a resu...
You might want to have more than one JDK on your Mac and run different programs with different JDK versions as it is with me. The easiest and safest way I've found is as follows. First, downlo...
How to make Hazelcast's cluster replication more resilient
Hazelcast is an open source in-memory data grid. It is written in Java and naturally it is popular for Java applications but not only. In simple words, Hazelcast is like a shared map which you ...
A Singleton class is a class of which only one instance exists. There is a need for such a design pattern for loggers, database connections and other scenarios. The main challenge comes when you...
Concurrency problems appear when your code is executed by more than one thread. Then, in contrast to a single-threaded execution, your code might behave differently depending on when and which thr...
Period, Duration and Instant are three different classes introduced since Java 8 to help us deal better with time. Period measures the time with days granularity. In other words, there are no ...
Why and How to Use Optional in Java
The Optional object type in Java was introduced with version 8 of Java. It is used when we want to express that a value might not be known (yet) or it's not applicable at this moment. Before Java ...
Introduction to Tengine Web Server
Tengine seems to be a popular web server for Chinese websites. I've come upon it while browsing through Aliexpress and stumbling upon a 404 error: This error and more specifically its footer ...
Streams are a wonderful feature in Java allowing you to write clean, efficient and powerful code. If you haven't consumed the output of the stream, you will probably want to collect it. That's w...
In order to use lambda expressions in Java 8, you need a functional interface. For most of your needs, you can use the already built ones in Java which are as follows: Supplier - generate outp...
Generics in Java and especially such with upper and lower bounds can be confusing even though they are otherwise very useful. Here is an example which explains it all well: import java.util.Ar...
The Telescoping anti-pattern is widely-spread, just like a virus. It starts with good intentions. For example, a class that has two properties like this: public class Example { private int x; ...
Being able to create an immutable object in Java is one of the most essential skills for any Java programmer. Such objects are needed when you want to rest assured that a created object cannot cha...
A functional interface is an interface that contains a single abstract method. It is used as the basis for lambda expressions in functional programming. Such an interface may contain also other...
Another useful feature introduced since Java 8 is the possibility to use lambdas instead of anonymous classes. Here is an example: Imagine you have the following list of names: List<String>...
There is a relatively simple challenge to extend the vowels in a string. Here is a way to do it in Java 8: import java.util.function.Function;
Java 8 introduced streams, among other things, and one of my favourite features is the reduce() method. It combines a stream into a single method. Before Java 8 and streams, such a reduction had...
A friend asked me to help him with the following in Bash - delete all files but a whitelisted and use mix / max depth for directory traversal. It's probably possible in Bash with some crazy find, ...
I've had the following challenge yesterday. A friend of mine had an old Joomla 2.5 with a bunch of customization - additional components installed, custom theme, etc. It was hosted somewhere and h...
I am sure that there are plenty of honeypots for logging remote intruders but none yet has been done on Spring Boot. So I decided to write a simple one while exploring Spring Boot: https://githu...
Mockito is a popular Java framework which comes to great help in Unit testing. In Unit testing it's important to get to a state where you can concentrate on testing a specific functionality or ...
Connecting to Elasticsearch and executing queries is generally considered easy. In fact, in many cases a simple curl query like this one is all you need: curl http://localhost:9200/_search?q=my...
Using Maven to maintain and build your Java projects has a lot of advantages including automatically resolving dependencies, running tests and packaging. In this article you will learn about a ...
Chef (the systems integration framework) provides a standalone tool called chef-solo. With chef-solo you can run locally chef recipes without the need for a centralised server (Chef master). This i...
AppArmor Php-Fpm Configuration with ChangeHat
AppArmor is the default Mandatory Access Control module on Ubuntu, SuSE and other Linux distributions. Thanks to it, you can limit the filesystem access of a process. There are already some good h...
A great security feature of Php FastCGI Process Manager (Php-fpm) is its ability to run Php scripts with different users. This in addition to its other merits such as performance and many fine grai...
The best way to terminate a Java thread is with a switch such as a boolean property, .e.g abort. As soon as a condition is met, usually a timeout, you can change the value of abort to true and thus...
Referencing a child object to a variable of type parent in Java can be real confusing. Here is an example of two classes Person and Student and an overriden method whatAmI: class Person { Strin...
Working with time and date in Java is essential to any project. There are three important classes you can use: java.time.LocalTime - working only with time. java.time.LocalDate - working only with...
To parse time in Java, the most trouble-free and programatic way is using the parse method of the LocalTime class like this: import java.time.LocalTime; import java.time.format.DateTimeFormatter;
How to Install and Configure SuPHP
Notice: This article was written when Β SuPHP was the most popular choice for running multiple PHP sites on the same Apache server. Now, php-fpm with different users is a better choice. But still, i...
How To Secure Your MongoDB Database Server on Ubuntu 14.04
The MongoDB database server is well-known for its unmatched capabilities for processing large NoSQL data. Its latest performance improvements are always under the spotlights and probably not a sing...
How To Configure SSL In Tomcat
To secure the communication and increase the level of privacy to and from your Tomcat servlet container you should use SSL. Usually there's an Apache or Nginx in front of Tomcat to serve external c...
SSH tunneling is very useful when the network access to a remote network is restricted. Thus, to gain remote network access you can use a tunnel to a remote host which would act as an intermediary....
Almost every piece of information contains sensitive and private data. Exposing publicly such data could lead to serious financial losses, legal issues and personal inconveniences. Thatβs why data ...
You can install Azure Python package either for Python 2 or Python 3 using pip (Python package index). Before you are able to install it though you have to: First, make sure pip is installed, of co...
How to Change JVM Xms and Xmx for Tomcat on Windows
Changing Tomcat's initial (Xms) and maximum (Xmx) memory turns out to be counter-intuitive on Windows, especially when Tomcat is installed as a service. That's because when running under a service ...
Working with root (admin privileged user) in CentOS is not a good idea because you can easily make a costly mistake. Instead, it's much better to grant the special sudo privileges which allow a re...
Docker Error response from daemon: Get https://... remote error: access denied
This is an error which you may get when you don't have an internet connection and you try to use a Docker functionality which needs internet access. For example: docker search ubuntu With no Inter...
Introduction Getting a site running on a MEAN (MongoDB, Node.js, Express, and AngularJS) server can be a challenge for beginners. In this article we'll guide you through all the steps necessary for...
Working with root (admin privileged user) in Ubuntu is not a good idea because you can easily make a costly mistake. Instead, it's much better to grant the special sudo privileges which allow a reg...