Pull to refresh
160.2
Rating

Java *

General-purpose computer-programming language that is concurrent, class-based, object-oriented, and specifically designed to have as few implementation dependencies as possible

Show first
  • New
  • Top
Rating limit
  • All
  • ≥0
  • ≥10
  • ≥25
  • ≥50
  • ≥100

CWE Top 25 2021. What is it, what is it for and how is it useful for static analysis?

PVS-Studio corporate blog Information Security *Java *C++ *C# *

For the first time PVS-Studio provided support for the CWE classification in the 6.21 release. It took place on January 15, 2018. Years have passed since then and we would like to tell you about the improvements related to the support of this classification in the latest analyzer version.


https://import.viva64.com/docx/blog/0869_CWE_status/image1.png


Read more →
Rating 0
Views 25
Comments 0

One does not simply calculate the absolute value

Programming *Java *Mathematics *
Translation

It seems that the problem of calculating the absolute value of a number is completely trivial. If the number is negative, change the sign. Otherwise, just leave it as it is. In Java, it may look something like this:


public static double abs(double value) {
  if (value < 0) {
    return -value;
  }
  return value;
}

It seems to be too easy even for a junior interview question. Are there any pitfalls here?

Read more →
Total votes 11: ↑10 and ↓1 +9
Views 28K
Comments 4

How to make debug-friendly method references

Programming *Java *
Translation

Java 8 introduced two kinds of functional expressions: lambda expressions like s -> System.out.println(s) and method references like System.out::println. At first, developers were more enthusiastic about method references: they are often more compact, you don't need to think up the parameter name, and, as urban legends say, method references are somewhat more optimal than lambda expressions. Over time, however, the enthusiasm waned. One of the problems with method references is the difficulty in debugging.

Read more →
Rating 0
Views 2.6K
Comments 1

12 Tech Trends Every Java Developer Must Learn To Win The Game In 2021

Java *Development of mobile applications *Game development *Game design *Software

The previous year has been very distressing for businesses and employees. Though, software development didn’t get so much affected and is still thriving. While tech expansion is continuing, Java development is also going under significant transformation.

The arrival of new concepts and technologies has imposed a question mark on the potential of Java developers. From wearable applications to AI solutions, Java usage is a matter of concern for peers.

Moreover, it is high time that developers enhance their skills as to the changing demands of the industry. If you are a Java developer, surely you too would be wondering what I am talking about what things you should learn.

Read more
Rating 0
Views 3.3K
Comments 3

A tiny Rate Limiter Library for Spring MVC

Java *
Sandbox

In microservice world the problem of high load is exteremely big especially when we have a REST API which is accessed quite extensively. Why do we need throttling? The main answer is to decrease the load of the service at the moment.

Different frameworks have different solutions, mostly some additional libraries. Also there is a Guava RateLimiter and Bucket4J . What is interesting Spring MVC being one of the most popular solutions for building REST APIs (thank you Spring Boot) doesn't have any built in rate limiter. As for external solutions there not that many ways around.

Today, I would like to present a tiny experimental library specific for Spring MVC. It is called SpringRateLimitter. The library is very tiny ,works in runtime. The idea is to annotate entire rest controller or specific method , than count the number of incoming requests for the annotated URI and based on the values check if we exceed the allowed number of calls. In case of exceeding an HTTP error code 429 is thrown and after the throttling period is over , the endpoint is available again.

So How does it look like. As first step Maven dependency must be added

Read more
Total votes 3: ↑3 and ↓0 +3
Views 1.4K
Comments 0

Run MongoDB Atlas locally for testing

IT systems testing *Programming *Java *MongoDB *

What happens to your MongoDB replica set when it comes to failures like network partitioning, restarting, reconfiguration of the existing topology, etc.? This question is especially important these days because of the popularity gained by the multi-cloud model where chances of these scenarios are quite realistic.


However, is there a solution, preferably a free one, for testing such cases that would obviate the need of writing manual scripts and poring over the official documentation? As software developers, we would be better off preparing our applications in advance to survive these failures.

Read more →
Rating 0
Views 625
Comments 0

Architectural approaches to authorization in server applications: Activity-Based Access Control Framework

Information Security *Programming *Java *GitHub Software
Translation

This article is about security. I’ll focus on this in the context of web applications, but I’ll also touch on other types of applications. Before I describe approaches and frameworks, I want to tell you a story.


Background


Throughout my years working in the IT sphere, I’ve had the opportunity to work on projects in a variety of fields. Even though the process of authenticating requirements remained relatively consistent, methods of implementing the authorization mechanism tended to be quite different from project to project. Authorization had to be written practically from scratch for the specific goals of each project; we had to develop an architectural solution, then modify it with changing requirements, test it, etc. All this was considered a common process that developers could not avoid. Every time someone implemented a new architectural approach, we felt more and more that we should come up with a general approach that would cover the main authorization tasks and (most importantly) could be reused on other applications. This article takes a look at a generalized architectural approach to authorization based on an example of a developed framework.


Approaches to Creating a Framework


As usual, before developing something new, we need to decide what problems we’re trying to solve, how the framework will help us solve them, and whether or not there is already a solution to these issues. I’ll walk you through each step, starting with identifying issues and describing our desired solution.


We’re focusing on two styles of coding: imperative and declarative. Imperative style is about how to get a result; declarative is about what you want to get as a result.

Read more →
Rating 0
Views 543
Comments 0

How PVS-Studio Checked ELKI in January

PVS-Studio corporate blog Open source *Java *Data Mining *

If you feel like the New Year just came, and you missed the first half of January, then all this time you've been busy looking for tricky bugs in the code you maintain. It also means that our article is what you need. PVS-Studio has checked the ELKI open source project to show you errors that may occur in the code, how cunningly they can hide there, and how you can deal with them.


ELKI/image1.png

Read more →
Total votes 3: ↑3 and ↓0 +3
Views 425
Comments 1

Android interop with SWIG (a guide). From simple to weird. Part 1 — simple

Java *C++ *Development for Android *
Sandbox
Tutorial

SWIG is a tool for generating cross-language interfaces - it provides interoperability of C++ and other languages (C++ and Java in our case). SWIG just simplifies and automizes cross-language interaction; otherwise, you may end up with thousands of lines of handwritten JNI code - but SWIG covers this for you.

This guide is for newbies (Part 1) and for those who experienced in SWIG (part 2). I'm starting from basic setup and usage and ending with complex & weird cases encountered in development. The latter cases are not so complex, rather usual for modern languages, which SWIG doesn't support yet (as lambdas).

This guide is practical. In opposition to overcomplicated huge-volume SWIG documentation, this guide is showing the cases practically. The bits developed by myself while working on the different projects or taken from StackOverflow. This guide allows you to quick-start an Android Studio project and giving practical examples of using SWIG. The link to the Android Studio project is here.

This guide is Android-first. The goal was to make it simple to onboard for Android developers. There are many articles about SWIG, but they are mainly for desktop Java applications, and it is quite an overhead to just try them on Android to check if the solution for the particular problem is working. While this guide includes an Android Studio project, with which you can play around instantly. Of course, all the information given here applies to any Java application.

Warning! I should warn you, that nowadays cross-platform development offers powerful tools. If you are developing a new application it is much more cost-efficient in practice to use ReactNative, Flutter of Kotlin-Native than the SWIG. While SWIG is more suitable to connect the C++ library or existing C++ application core.

Read more
Total votes 3: ↑3 and ↓0 +3
Views 1K
Comments 0

Big / Bug Data: Analyzing the Apache Flink Source Code

PVS-Studio corporate blog Programming *Java *Apache *Big Data *
image1.png

Applications used in the field of Big Data process huge amounts of information, and this often happens in real time. Naturally, such applications must be highly reliable so that no error in the code can interfere with data processing. To achieve high reliability, one needs to keep a wary eye on the code quality of projects developed for this area. The PVS-Studio static analyzer is one of the solutions to this problem. Today, the Apache Flink project developed by the Apache Software Foundation, one of the leaders in the Big Data software market, was chosen as a test subject for the analyzer.
Read more →
Total votes 1: ↑0 and ↓1 -1
Views 452
Comments 0

Spring Boot app with Apache Kafka in Docker container

Programming *Java *Apache *Industrial Programming *
Translation
Tutorial

Privet, comrads!

In this article i’ll show how easy it is to setup Spring Java app with Kafka message brocker. We will use docker containers for kafka zookeeper/brocker apps and configure plaintext authorization for access from both local and external net.

Link to final project on github can be picked up at the end of the article.

Read more
Total votes 1: ↑1 and ↓0 +1
Views 11K
Comments 1

How To Build a Password Management Software Using JAVA?

Java *Personnel Management *Software

In this digital world, people prefer to work remotely. There are numerous tasks that each of us goes through every day. If I talk about an application's usage, then it has been predicted that there will be a 25% increase in global app downloads between 2018 and 2022

But it can be quite challenging for organizations to maintain and create multiple passwords. Hence, a password management software can be a great choice to manage this effectively. It is like your bank locker, where one can store numerous passwords. The users only need a master password to access the software.

Do You Know? 

Read More
Rating 0
Views 3K
Comments 10

Distributed File Systems

JetBrains corporate blog Java *Big Data *

The Big Data Tools plugin seamlessly integrates HDFS into your IDE and provides access to different cloud storage systems (AWS S3, Minio, Linode, Digital Open Space, GS, Azure). But is this the end? Have we implemented everything and now progress has stopped? Of course not.


In this short digest, we'll take a look at 15 popular distributed file systems available on the market and try to get a sense of their individual advantages.


Almost all of these systems are free or open-source, and you can find the sources on GitHub. The sites of these projects, their documentation, and online reviews provide most of the information we’ll consider here. Other than HDFS, none of these technologies have been implemented yet in Big Data Tools. But who knows? Perhaps someday we'll see them in our plugin.


Read more →
Total votes 8: ↑8 and ↓0 +8
Views 3.5K
Comments 1

Big Data Tools Update 11 Is Out

JetBrains corporate blog Java *Scala *Big Data *

EAP 11 of the Big Data Tools plugin for IntelliJ IDEA Ultimate, PyCharm, and DataGrip is available starting today. You can install it from the JetBrains Plugin Repository or inside your IDE.


Big Data Tools is a new JetBrains plugin that allows you to connect to Hadoop and Spark clusters and monitor nodes, applications, and jobs. It also brings support for editing and running Zeppelin notebooks inside IntelliJ IDEA and DataGrip, so you can create, edit, and run Zeppelin notebooks without ever having to leave your favorite IDE. The plugin offers smart navigation, code completion, inspections, quick-fixes, and refactoring inside notebooks.


Read more →
Total votes 7: ↑7 and ↓0 +7
Views 1K
Comments 0

ZTools for Apache Zeppelin

JetBrains corporate blog Java *Scala *Big Data *



Zeppelin is a web-based notebook for data engineers that enables data-driven, interactive data analytics with Spark, Scala, and more.


The project recently reached version 0.9.0-preview2 and is being actively developed, but there are still many things to be implemented.


One such thing is an API for getting comprehensive information about what's going on inside the notebook. There is already an API that completely solves the problems of high-level notebook management, but it doesn’t help if you want to do anything more complex.

Read more →
Total votes 3: ↑3 and ↓0 +3
Views 712
Comments 0

Checking WildFly, a JavaEE Application Server

PVS-Studio corporate blog Java *
image1.png

WildFly (formerly known as JBoss Application Server) is an open-source JavaEE application server developed and first released by JBoss in February, 2008. The primary goal of the project is to provide a set of tools usually required for enterprise Java applications. And since the server is used for developing enterprise applications, it is especially important to minimize the number of bugs and potential vulnerabilities in its code. Today, WildFly is being developed by the large company Red Hat, and they keep the code quality at a pretty high level. That said, our analyzer was still able to find a number of programming mistakes in the project.
Read more →
Total votes 4: ↑3 and ↓1 +2
Views 359
Comments 1

JavaCC 21 Parser Generator

Open source *Java *
Sandbox

JavaCC 21 is a continuation of work on the venerable JavaCC parser generator, originally developed at Sun Microsystems in the 1990’s and released under a liberal open source license in 2003. It is currently the most advanced version of JavaCC. It has many feature enhancements (with more to come soon) and also generates much more modern, readable Java code. Also, certain key bugs have finally been fixed. (N.B. The “21” in JavaCC 21 is not a version number. It is simply part of the project name and means that this is a JavaCC for the 21st century!)

Read more →
Total votes 8: ↑8 and ↓0 +8
Views 1.1K
Comments 0

How to write Palindrome Polyglot Quines

Abnormal programming *Java *C# *
Translation
PalidromePolyglotQuine

I offer a solution to one beautiful task — writing code that outputs its text is valid for interpreters and compilers of different languages and is correctly executed when reversing its sources.


Not so long ago I learned about code that can be both interpreted in PHP and compiled to Java: PhpJava.java. As it turned out, this idea is not new: code which is valid for several compilers or interpreters is called a polyglot. It is possible to write such code because of the peculiarities of processing strings and comments in different interpreters or compilers.

Read more →
Total votes 3: ↑3 and ↓0 +3
Views 1.5K
Comments 0

Authors' contribution