Changing the CTRL + SHIFT + F settings in STS or Eclipse

I’m a big fan of clean well indented code but I’ve found the CTRL + SHIFT + F setting in STS & Eclipse to wrap lines way too soon.

Most people develop at 1080p resolution these days so it makes no sense to wrap lines so soon.

To change the line wrapping rules go to Window > Preferences > Java > Code Style > Formatter

Now create a new profile based off the current one, in my case this was Eclipse [built-in].

Click on Edit.. and go to the Line Wrapping tab, I set the Maximum line width to 240 but you can change it to whatever suits.

line wrapping 2

line wrapping

Source: Possible to change settings for CTRL + SHIFT + F in Eclipse?

Spring Security web classes are not available error

Another random error/bug I came across playing around with Spring MVC, when implementing security I kept getting an error in my security context xml file telling me that required spring security web classes are not available.

While I had spring-security-config in my pom.xml file it seems one of the benefits of Maven had again sh*t itself and a required dependency was not being pulled in.

You need to manually add spring-security-web which solved the issue for me, seems to be a known bug.


Make sure you update the version to match your spring-security-config dependency.


Dmaven multiModuleProjectDirectory system propery is not set

This error just drove me mad in STS/Eclipse.

You need to add the Default VM argument -Dmaven.multiModuleProjectDirectory=$M2_HOME.

You do this by going to Window > Preference > Java > Installed JREs > Edit


This assumes you have the Environment variable M2_HOME set up correctly (this should be done when installed Maven).

Source: Stack Overflow

Getting the Selenium session id when using Protractor

This was actually a rather tricky thing to find any information so here’s how to output the Selenium session id into the console when using Protractor. I needed to do this in order for Bamboo to pick up on the Sauce Labs jobs running.

function printSessionId(jobName){
  browser.getSession().then(function(session) {
    console.log('SauceOnDemandSessionID=' + session.getId() + ' job-name=' + jobName);

POSTing JSON data using HttpClient

Recently I’ve been putting together a POC in C# that uses a RESTfull service and while there are tons of examples on how to GET data back there is very little info on how to POST data, specially if you want to POST back JSON content.

So here is a simple example, note I’ve used JSON.NET and I’m making use of the dynamic variable only available in C# 4 and above.

using (var client = new HttpClient())
    var request = new CreateAppRequest()
        userAgent = "myAgent",
        endpointId = "1234",
        culture = "en-US"

    var response = client.PostAsync("", 
        new StringContent(JsonConvert.SerializeObject(request).ToString(), 
            Encoding.UTF8, "application/json"))

    if (response.IsSuccessStatusCode)
        dynamic content = JsonConvert.DeserializeObject(

        // Access variables from the returned JSON object
        var appHref = content.links.applications.href;

Source: POSTing JsonObject With HttpClient From New REST API (preview release 4)

UCMA 4.0 and the missing SIPEPS DLL

Ran into this very frustrating issue of the missing DLL SIPEPS when doing some Lync development with the UCMA library.

Turns out your project needs to be set to x64 as a x86 version of the DLL does not exist in the GAC.

So in the properties of your application set the target platform to x64, problem solved.


Source: Error about SIPEPS DLL with UCMA 4.0