Java Lobby Announcements

Subscribe to Java Lobby Announcements feed
Recent posts in Java on DZone.com
Updated: 12 hours 59 min ago

Simple Form Login Page With Apache Sling

Thu, 2016-07-28 15:31

In this post we will show a simple example on how to create a login page with Apache Sling and define which paths will ask for the user to login to the site using our login page.

In order to execute this, we need to have the Sling Lauchpad running on our machine. For this we can download the binary from the Apache Sling website in Downloads Section. If you have Docker installed on your machine you can use the Sling docker image.

Categories: Java

Signing Java Code With Certum Open Source Certificates

Thu, 2016-07-28 10:31

Recent versions of Java have tightened the security around code that is run from the web, which is good news for end users, but a pain for developers. These new requirements forced users of a new web start Java project that I have worked on to manually add exceptions for the location of the JAR files being downloaded. This sounds like a simple thing to do, but turned out to be quite cumbersome, so I decided to get a real certificate.

Certum offers reasonably priced certificates for those working on open source projects. This is a great service for those who can’t justify hundreds of dollars a year on a certificate for code that they give away, and I bought one of these certificates for my own project.

Categories: Java

Queries and Aggregations With Scala: Part 2

Thu, 2016-07-28 10:01

As we saw in part 1, it took 2+ minutes, on my laptop, to run an aggregation across 6+ million crime cases.

However, since Hazelcast is a cluster library, it only makes sense to take advantage of that. Let’s run this on a 3-node cluster. That will require a few code changes to CrimeNode:

Categories: Java

How The Java Community Process Has Changed and Where It's Headed

Thu, 2016-07-28 09:01

To gather insights on the state of the Java ecosystem today for DZone's Java Ecosystem research guide to be published in September, we spoke with 15 executives who are familiar with the Java ecosystem.

Here’s who we talked to:

Categories: Java

Java Code Challenge: Chemical Symbol Naming-Part One

Thu, 2016-07-28 08:31

Java Code Challenge is a new regular segment taking the best challenge from Reddit's dailyprogrammer. Things are a little different here as we're focused on Java. A working solution is not enough; we're looking for the cleanest Java code with tests. 3rd party libraries are welcome but if you can do it without it will be easier for others to comprehend.

If you can fit your solution in the comments then go for it, but preferably put your answer in GitHub and link in the comments. Next week we'll be sharing the best solutions and sharing the best code practices we see!

Categories: Java

Pattern Implementations

Thu, 2016-07-28 06:31
Goals

The “implementation” or “examples” section of any pattern discussion holds several goals (and a few “anti-goals”):

  • Be able to put a concrete-ish example in front of people seeking such. It’s hard to understand exactly how the pattern is supposed to work without pictures or code. I am not great with graphical tools, so for me it’s easier to use code to provide that demonstration.
  • NOT to expect “ready-made code” for reuse. Patterns are not drop-in building blocks that can save you time and energy when doing your own implementation. These examples are here to demonstrate a few techniques around implementation, but attempts to re-use the code directly will probably always meet with failure at some level.
  • Demonstrate how to do certain things idiomatically within a particular language. Each language brings with it a particular idiomatic style or feature set that may shape how one might use a particular pattern. I am not an expert with all of these languages below, but part of this exercise (for me) is to learn (and document) how to exercise the idioms of a particular language using the pattern as a scaffold upon which to hang it.
  • Provide a mechanism by which to concretely compare and contrast one pattern against another. Is a Strategy really all that close to a Command? Having concrete examples of each allows for a certain amount of comparison-and-contrast, and hopefully sparks some good discussion around when to use each.
  • NOT to suggest that one language is “better” than another. Any such qualitative judgment around one language over another is entirely in the eyes of the beholder; no such judgement is intended from me, and any attempt to use this exercise as a means to judge one language more harshly than another will quickly earn this author’s scorn. Different languages chose to do things in different ways for very good reasons; if you cannot explain the reasons, then you have no business offering up the judgement.
Languages

In general, there’s a long list of languages I will use to define some example implementations of the patterns in the catalog. Note that while this isn’t an “ordered” list, meaning I will probably do implementations in a seemingly-random order, the hope is that when this is all said and done, the list of pattern implementations will range across the following:

Categories: Java

Gradle Goodness: Set VCS for IntelliJ IDEA in Build File [Snippet]

Wed, 2016-07-27 15:31

When we use the IDEA plugin in Gradle we can generate IntelliJ IDEA project files. We can customise the generated files in different ways. One of them is using a simple DSL to configure certain parts of the project file. With the DSL it is easy to set the version control system (VCS) used in our project.

In the next example build file we'll customize the generated IDEA project file and set Git as the version control system. The property is still incubating, but we can use it to have a proper configuration.

Categories: Java

What’s New in Intellij Idea 2016.2 for Spring Developers

Wed, 2016-07-27 12:31

If you’re a heavy user of Spring and IntelliJ IDEA, you’ll find the IntelliJ IDEA 2016.2 update very interesting. Besides many important bugfixes, the update adds support for Spring 4.3 and Spring Security 4.0 features and cache abstraction, improves support for Spring MVC, and further tunes performance. Before reading about this in more detail, make sure you’ve registered for our webinar dedicated to the new release and Spring framework.

OK, now back to the update. First of all, the IDE now supports generics types as qualifiers and provides navigation for them:

Categories: Java

Programmer Stereotypes By Language Community

Wed, 2016-07-27 12:31

In the recent article Humble Lisp Programmers, author John Cook mentions that a stereotypical Lisp programmer "does look down on everyone", but clarifies that this trait may be more accurately attributed to those who write about Lisp programming and not necessarily those who are Lisp programmers. The article got me thinking about other stereotypes held by the industry pertaining to specific language camps, and my interactions over the years with members of those camps. I spent most of my career focusing on recruiting Java talent, but for the last several years I have had searches across a wide range of skills.

Y Combinator founder Paul Graham has published several posts that at least allude to stereotypes and/or the relationships between programmers and the languages they use. Notably, Graham's Java's Cover and The Python Paradox touch on these subjects. His later piece Great Hackers asserts that language choice for a project is a "social decision" as much as a technical one, and reiterates his earlier suggestion that Python projects will attract better talent than Java projects. Perhaps Graham, who is not-so-coincidentally synonymous with Lisp, was on Cook's mind while musing the stereotype. 

Categories: Java

Testing Java Libraries From ScalaCheck

Wed, 2016-07-27 10:31

In this article I would like to show you how to integrate ScalaCheck into a Maven project in order to test your Java classes. I will use as an example the PhoneNumber class as seen in Item 9 in the book Effective Java. The idea will be to test that the equals method implementation on that class conforms to the equals contract according to the Java Specification (more on that later). Also, we will be testing a couple of Netty handlers that could be used to Encode/Decode a PhoneBook object in order to send it on the network.

The finished project can be found on this GitHub repo: https://github.com/videlalvaro/phone-guide

Categories: Java

Java 8's Impact to Date

Wed, 2016-07-27 09:01

To gather insights on the state of the Java ecosystem today for DZone's Java Ecosystem research guide to be published in September, we spoke with 15 executives who are familiar with the Java ecosystem.

Here’s who we talked to:

Categories: Java

When Things May Get Out of Control: Circuit Breakers in Practice

Wed, 2016-07-27 08:31

In the previous post we have started the discussion about circuit breakers and why this pattern gained so much importance these days. We have learned about Netflix Hystrix, the most advanced circuit breaker implementation for JVM platform, and its typical integration scenarios. In this post we are going to continue exploring the other options available, starting from Apache Zest library.

Surprisingly, Apache Zest being certainly a gem, is not well-known and widely used. It is a framework for domain centric application development which aims to explore composite-oriented programming paradigm. Its roots go back to 2007, where it was born under another name, Qi4j (and became Apache Zest in 2015). It would require a complete book just to go through Apache Zest features and concepts, but what we are interested in is the fact that Apache Zest has simple circuit breaker implementation.

Categories: Java

StackOverflow: Seven of the Best Java Answers That You Haven’t Seen

Wed, 2016-07-27 07:16

This post is by Henn Idan on the Takipi blog.

StackOverflow is a gold mine for developers. It helps us find the most useful answers to specific issues we encounter, and we always find ourselves learning new things from it.

Categories: Java

Biggest Change to the Java Ecosystem: New Blood

Tue, 2016-07-26 20:44

DZone's Tom Smith recently posted a piece about the most significant changes to the Java ecosystem from the past year, where 15 execs tied to Java were polled. I wasn't among those questioned (I'm not offended), but a major change and my main concern regarding Java's future was not addressed in the answers provided by the panel.

Although the question was asked in the context of the past year, the biggest change to the Java ecosystem over the past few years is that the Java community is aging faster than other language camps due to a lack of interest or training in Java among our newest programmers. 

Categories: Java

Lessons Learned While Writing Our New Logback Appender

Tue, 2016-07-26 15:31

Here at Logz.io, we take logs seriously. (If not us, who will?)

We run mainly on Dockerized Java microservices, and until recently, we had another Docker container that collected logs from our microservices.

Categories: Java

Java 8 Top Tips

Tue, 2016-07-26 10:31

I’ve been working a lot with Java 8 code over the last couple of years, for both new applications and migrating existing ones, and it feels like the right time to write down some of the “best practices” I’ve found useful. I personally dislike the term “best practices” as it implies a “one size fits all” solution, and of course coding doesn’t work that way – it’s down to us as developers to figure out what will work in our situation. But I have discovered I have particular preferences for Java 8 code that I find makes my life a little easier, and I thought I’d start a discussion on this topic.

Optional

Optional is a highly underrated feature, and one that has the potential to remove a lot of those NullPointerExceptions that can plague us. It’s particularly useful at the boundaries of code (either APIs you’re using or APIs you’re exposing) as it allows you and your calling code to reason about what to expect.

Categories: Java

The Most Significant Changes To The Java Ecosystem

Tue, 2016-07-26 09:01

To gather insights on the state of the Java ecosystem today for DZone's Java Ecosystem research guide to be published in September, we spoke with 15 executives who are familiar with the Java ecosystem.

Here’s who we talked to:

Categories: Java

Normalizing a Date String in the Scala Way

Tue, 2016-07-26 08:31

I have a problem that is a bit challenge to solve it efficiently in a functional way. Scala is nice because it allows you to use an imperative style if you want. Some people may not agree with this, and that’s totally okay. I just love to have an alternative option when I need it. However, my code often end up having 100% immutable most of the time. So, please don’t judge me because I said that it is good to have options. :P

Let’s look at the problem and see how can we solve it.

Categories: Java

Java Code Challenge: Play the Stockmarket Solution

Tue, 2016-07-26 06:31

For the original challenge, please check out the article at this link.

As always with these programming challenges I've been bowled over by the sheer variation in the solutions. For what sounds like a fairly simple challenge (finding the min/max pairing in a list of numbers) has produced a series of very interesting solutions.

Categories: Java

How to Debug Java with IntelliJ: Breakpoints, Evaluate Expression, Watches, and Variable View

Mon, 2016-07-25 15:31

I have deliberately created a failing test. Obviously deliberately since I would never ever create such simple issues in code. I’m far too experienced for that. :)

Even though these issues were created deliberately I still need to know how to debug code. In this blog post I’ll describe how I debug Java using IntelliJ.

Categories: Java

Pages