Browsed by
Tag: Java

Generate QR codes (Java)

Generate QR codes (Java)

A QR code (Quick Response code) is a type of a barcode invented in 1994 by the Japanese automotive company Denso Wave. In this article, we’ll get a basic information about QR codes in general and will learn how to generate QR codes in a Java application.

N+1 select: JOIN FETCH (Hibernate)

N+1 select: JOIN FETCH (Hibernate)

Using object-relational mapping tools like Hibernate can significantly simplify and speed up the development process. For a developer, it’s easier to operate with object entities rather than switching to relational tables every time he needs to access a database. Nevertheless, it has its disadvantages. The main disadvantage is a high chance to ruin the performance if used without a good understanding of how it works under the hood. This tutorial covers the common problem called “N+1 select” and describes one of the solutions – JOIN FETCH.

JSON Web Token (JWT) and Java

JSON Web Token (JWT) and Java

JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. This information can be verified and trusted because it is digitally signed.

One of the mostly used use-cases for JWT is authorization. A client authenticates and a server returns a generated token in response. The client stores the token and sends it with every further request.

Reduce Java boilerplate (Lombok)

Reduce Java boilerplate (Lombok)

Have you ever had a feeling that a significant amount of code you write is redundant? It’s not a secret that Java can be quite verbose and often you just follow a contract of this programming language. Luckily, you’re not the only one who worries about it. As a result, a great solution to deal with it appeared to reduce Java boilerplate – Lombok.

Java Bean Validation

Java Bean Validation

Overview Data validation is a crucial process in software development. Invalid data may easily break the application. So, ideally, the input data should be validated as soon as possible and handled in a corresponding way. Since data validation is one of the most common programming logic, it makes sense to find a way to reduce code duplication. Bean Validation 2.0, defined by JSR 380, is a specification of the Java API for bean validation. It defines a way to validate…

Read More Read More

Aspect-oriented programming (AOP) with Spring Boot

Aspect-oriented programming (AOP) with Spring Boot

Overview Aspect-oriented programming (AOP) is a programming paradigm that aims to increase modularity by allowing the separation of cross-cutting concerns. Cross–cutting concerns are parts of a program that rely on or must affect many other parts of the system. Commonly used cross-cutting concerns are: logging transaction management performance monitoring security checks etc. AOP concepts Aspect: The concern that cuts across multiple classes or modules. Transaction and security are examples. Spring Transaction is implemented as Aspects. Join point: A point during the execution of the program at which you…

Read More Read More

Speech recognition: voice control (Java, Kaldi)

Speech recognition: voice control (Java, Kaldi)

Speech recognition is a field of computer science and computational linguistics that develops methodologies and technologies that enable the recognition and translation of spoken language into text by computers. The first speech recognition applications you may think of are Google Assistant, Alexa, Siri. It’s used in various fields: banking, e-commerce, workplace, IOT, language learning, etc. To be honest, this topic is not something you would easily dive in without a strong theoretical foundation. Though there are ready-to-use solutions with noticeable accuracy that may…

Read More Read More

PhantomJS scraping on word translation example

PhantomJS scraping on word translation example

In the previous article, we’ve shown an example of web scraping using Jsoup. You may be interested in how it is different from PhantomJS scraping. Jsoup parses HTML content that is available on a page load. In most cases, it’s enough, but in some cases, modern websites have content that is loaded dynamically via JavaScript. Hence Jsoup may receive just an empty page without loaded data (e.g. products). In such cases, headless browsers are a way to go and PhantomJS…

Read More Read More

Web scraping using Jsoup (Java)

Web scraping using Jsoup (Java)

Web scraping is data extraction from websites and Jsoup is quite a popular tool to do it in a convenient way. It is is an open-source Java library designed to parse, extract, and manipulate data stored in HTML documents. There are lots of use-cases. For example, you may be looking for a new apartment to rent on a website or monitoring discounts on an e-commerce store. If the website does not have a feature to subscribe to newly added records,…

Read More Read More