Skip to content

Using Regular Expressions

I am having problems trying to use the regular expression that I used in JavaScript. On a web page, you may have: Renewal Date: 03 May 2010

I just want to be able to …

What does the Java assert keyword do, and when should it be used?

What are some real life examples to understand the key role of assertions? Answer Assertions (by way of the assert keyword) were added in Java 1.4. They are used to verify the correctness of an invariant in the code. They should never be triggered in production code, and are indicative of a bug or misuse of a code path. They

What is the “owning side” in an ORM mapping?

What exactly does the owning side mean? What is an explanation with some mapping examples (one to many, one to one, many to one)? The following text is an excerpt from the description of @OneToOne in …

Alternatives to JSP for Spring MVC view layer [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations. Closed 6 months ago. The community reviewed whether to reopen this question 6 months ago and left it

log4j vs. System.out.println – logger advantages?

I’m using log4j for the first time in a project. A fellow programmer told me that using System.out.println is considered a bad style and that log4j is something like standard for logging matters nowadays. We do lots of JUnit testing – System.out stuff turns out to be harder to test. Therefore I began utilizing log4j for a Console controller class,

XML Schema to Java Classes with XJC

I am using xjc to generate Java classes from the XML schema and the following is an excerpt of the XSD. For the most part the generated classes are fine but for the above block I would get something like: with the following comment above it: I have placed a comment at the end of the two line in question.

Why would an Enum implement an Interface?

I just found out that Java allows enums to implement an interface. What would be a good use case for that? Answer Enums don’t just have to represent passive sets (e.g. colours). They can represent more complex objects with functionality, and so you’re then likely to want to add further functionality to these – e.g. you may have interfaces such

Turning a string into a Uri in Android

I have a string, ‘songchoice’. I want it to become a ‘Uri’ so I can use with MediaPlayer.create(context, Uri) How can I convert songchoice to the Uri? Answer Here’s the doc