Simple HTTP server in Java using only Java SE API

Since Java SE 6, there’s a builtin HTTP server in Sun Oracle JRE. The com.sun.net.httpserver package summary outlines the involved classes and contains examples. Here’s a kickoff example copypasted from their docs (to all people trying to edit it nonetheless, because it’s an ugly piece of code, please don’t, this is a copy paste, not mine, moreover you should never edit quotations … Read more

Configure active profile in SpringBoot via Maven

The Maven profile and the Spring profile are two completely different things. Your pom.xml defines spring.profiles.active variable which is available in the build process, but not at runtime. That is why only the default profile is activated. How to bind Maven profile with Spring? You need to pass the build variable to your application so that it … Read more

System.out.println function syntax in C++

As larsmans already pointed out, java has overloads on the operator +. So you can concat strings with integer. This is also possible in C++ but not out of the box for all types. You could use a templated functions like this. But I would recommend to take a look at boost::format. I guess this library … Read more

Any shortcut to initialize all array elements to zero?

A default value of 0 for arrays of integral types is guaranteed by the language spec: Each class variable, instance variable, or array component is initialized with a default value when it is created (§15.9, §15.10) […] For type int, the default value is zero, that is, 0.   If you want to initialize an one-dimensional array to a different … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)