Articles

With the rapid development of cloud computing technology, an increasing number of developers are deploying applications to Alibaba Cloud Elastic Compute Service (ECS) instances. This tutorial describes how to deploy a Java application developed locally to an Alibaba Cloud ECS instance using Cloud Toolkit.

Develop an Application Locally

The coding method is similar — no matter whether you compile Java applications that run on the cloud or locally. Therefore, this article takes a Java servlet for printing "Hello World" on a web page as an example to explain the deployment method.

Source de l’article sur DZONE


What Is HATEOAS?

Hypermedia as the Engine of Application State, or HATEOAS for short, is a flavor of REST that uses hypermedia to describe what future actions are available to the client. Allowable actions are derived in the API based on the current application state and returned to the client as a collection of links.  The client then uses these links to drive further interactions with the API.

Do I Need HATEOAS to Do REST?

In my opinion, no. Now that’s a potentially controversial point of view, as many will argue that that only hypermedia enabled services are truly RESTful. I base my opinion on experience in the real world and the fact that I’ve built numerous REST APIs over the years that didn’t use HATEOAS but served their purpose well. HATEOAS certainly has its place but it shouldn’t be considered mandatory for RESTful APIs.

Source de l’article sur DZONE

If you are developing an event-based application that handles many requests from different users, you most likely want to count distinct user action within a sliding window or a specified time range.

One of the quickest ways to count distinct user is to prepare an SQL like SELECT count(distinct user) from ACTION_TABLE. But, this might be expensive if there are millions of records produced in real time.

Source de l’article sur DZONE

In a previous post, we learned about setting the value of options attribute to nowrap on listing and literal blocks, so the lines in the block are not wrapped. In the comments, a user suggested another option to disable line wrapping for all listing and literal blocks in the document by using the document attribute prewrap. We must negate the document attribute, :prewrap!:, to disable all wrapping. If we place this document attribute at the top of our Asciidoctor document, it is applied for the whole document. We can also place it at other places in the document to change the setting for all listing and literal blocks following the prewrap document attribute. To enable wrapping again, we set :prewrap: (leaving out the exclamation mark).

In the following example, we have markup with a listing, literal, and example block, and we use the document attribute :prewrap!: to disable the wrapping for the listing and literal blocks:

Source de l’article sur DZONE

Today, we’re going to talk about JUnit and unit testing, one of the key skills for any software developer. You may already know that JUnit and Mockito are two of the most popular testing libraries for Java applications, and you will find them in almost every Java application classpath. I often meet and work with Java developers who know Java well but haven’t written a single unit test. When I ask them why don’t you write unit tests, they come up with many excuses like they don’t have time for writing unit tests, there is always deadline pressure, and some of the honest guys will tell you that they tried writing but give-up after 10-15 minutes due to difficulty in testing their code.

Whatever your reason for not writing a unit test, I don’t think it’s going to work anymore because, in today’s world of DevOps and automation, there is increased focus on code reviews, unit testing, and integration testing, and you just can’t get away with not writing tests.

Source de l’article sur DZONE

Java is considered to be the heart of the Android operating system, and so, for every Android developer, there is hardly any alternative than Java. Well, at last, a superb alternative to Java has appeared with a lot of value packed within. Kotlin is a programming language that comes as a better and more effective alternative to Java for Android development.

At this moment even, the Android community is abuzz with the discussion on Kotlin. This is precisely why we are going to explain the five key features of Kotlin.

Source de l’article sur DZONE

Sorting a Stream instance is straightforward and involves just a single API method call — achieving the opposite is not that easy.

In this article, we’ll see how to shuffle a Stream in Java both eagerly and lazily using Stream Collectors factories and custom Spliterators.

Source de l’article sur DZONE

This post is the continuation of a previous blog on functional programming and implementing safety restrictions on object orientation to focus on the resulting functional frameworks. So, just to recap, here are some important functional programming concepts. Functional programming:

In Java, a modifier has a reserved keyword that is included in the definition of class, method, and variables. A modifier adds some meanings to these definitions. Modifiers are also called specifiers.

These modifiers are classified into two categories. Some of the modifiers are called access modifiers and some are called non-access modifiers.

Source de l’article sur DZONE

Java is a general-purpose language that follows the object-oriented programming style with a Write-Once-Run-Anywhere approach to development. It was designed for an interface with Internet-enabled devices, and over the course of the last two decades, this particular design choice has ensured Java’s relevance in the developer community.

Even now, in 2019, Java is ubiquitous and often used to develop virtually everywhere and on every platform; from smartphones and Android devices to websites, video games, cars, and even IoT devices.

Source de l’article sur DZONE