Getting Started with Maven

November 28, 2017

Now that I have Maven installed (see previous post) I wanted to create a simple project and compile it.

Generate New Project

We can use Maven to generate a new project, taking a template project structure to work from. Here we're using the maven-archetype-quickstart to give us a simple ...

Maven on Mac

November 28, 2017

I wanted to install Maven, the Java build tool on my Mac. This can be done using homebrew.

Java

First I wanted to install Java 9. This can be done with:

$ brew update
$ brew cask install java

Maven

Next, to install Maven use:

$ brew install maven

To check if it ...

Fizz Buzz in LINQ

November 1, 2017

Here's a simple implementation of FizzBuzz using LINQ:

List<string> lResults = new List<string>();
IEnumerable<int> lOneToHundred = Enumerable.Range(1, 100);
lOneToHundred.ToList().ForEach(i => lResults.Add(i % 15 == 0 ? "FizzBuzz" :
                                                         i % 3 == 0 ? "Fizz" :
                                                         i % 5 == 0 ? "Buzz" :
                                                         i.ToString()));

foreach (string lValue in lResults.Take(20))
{
    Console ...

LINQ Reference

October 31, 2017

The benefits of using the LINQ approach rather than lots of foreach loops are:

  • Composability
  • Lazy Evaluation
  • Immutability
  • Parallelizable
  • Declarative

The functions available in LINQ can be split into four categories:

  • Generator Functions.- create values out of nothing
  • Statistical Functions - find out stats about the data (count, any that match ...

Tags: linq

Confluence Login Errors

September 27, 2017

I have a Confluence deployment that uses Crowd to authenticate users against Active Directory.

One of the users got a System Error at login:

org.springframework.dao.IncorrectResultSizeDataAccessException: query did not return a unique result: 2
    at org.springframework.orm.hibernate.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:590)
    at org.springframework.orm ...