Did you find yourself one or several times, copying your favourite java project, renaming it, removing files, keeping some best practice classes and so on, all that to create new projects similar to it? This is time consuming and can be very annoying… Well, you might wanna consider instead creating a maven archetype out of the template project and use to create new projects. Not only this will increase your productivity, but it help you look with a more critical view on your “best of breed” project. which is what I will show you in this blog post. In this blog post I will show how to create a maven archetype based on an existing project and how to generate a new project from this template.

Continue Reading ...

Some days ago, I presented how the code got much cleaner when I replaced Mongoose callbacks with the async-await feature from ES7, which NodeJs already support. I mentioned then, I was gonna do a post to demonstrate how async-await can also be used to make parallel calls. Here am I doing just that. I was actually blown away by its simplicity and performance gain when doing so. Let me show you what I mean.

Continue Reading ...

Jax-RS REST Client example demonstrating how to GET a resource with a query parameter. The resource is secured with Basic Authentication.

A lot has been written already about the transition from callbacks to promises and now to the new async/await1 feature in ES7.

"The purpose of `async/await` functions is to simplify the behavior of using promises synchronously and to perform some behavior on a group of `Promises`. Just as `Promises` are similar to structured callbacks, `async/await is similar to combining generators and promises."[^1]

In this blog post I present what this code “upgrade” meant for CRUD operations performed on codingmarks. I use Moongoose in an ExpressJS/NodeJS backend to perform the operations against a MongoDB database.

Continue Reading ...

This post presents the snippet from the Nginx configuration that redirects all request to https://www.codingmarks.org:

# redirect HTTP to www
server {
    listen 80 default_server;
    listen [::]:80 default_server;
    server_name codingmarks.org www.codingmarks.org;

    return 301 https://www.codingmarks.org$request_uri;
}

# redirect HTTPS to wwww
server {
    listen 443;
    server_name codingmarks.org;

    return 301 https://www.codingmarks.org$request_uri;
}

Note the missing www.codingmarks.org in the second server/server_name entry, to avoid an infinite loop

Lots of other good Nginx resources can be found if you search for the nginx tag on codingmarks: https://www.codingmarks.org?q=[nginx]

Octocat Source code for codingmarks.org is available on Github - frontend and backend.