ubuntu – rename server

My first job after Ubuntu (Armbian) server installation is to rename server:
~$ sudo hostnamectl set-hostname 'exm'
To have full effect also need do changes on /etc/hosts
~$ sudo vi /etc/hosts
change line
127.0.0.1 localhost orangepipc2
to
127.0.0.1 exm exm.e7e.eu localhost

And now all you need to do is logoff and login.

Dynamic Markers reload on Google Maps with PrimeFaces

I rely like using PrimeFaces as UI framework. but some times Is gets little bit messy. One of such a example would be dynamically reload markers on  Google Maps. For that I came with quite elegant solution:

+ Loading Google Map with standart JavaScript code

var map;
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: 54.681682, lng: 25.261852},
zoom: 11
});
}

+ Creating function for dynamic markers reload

function refreshMarkers(xhr, status, args) {
for (var marker in args.markers) {
if (markers.indexOf(marker.title) !== -1) {
var latLng = {lat: marker.lat, lng: marker.lng};
var marker = new google.maps.Marker({
position: latLng,
map: map,
title: marker.title
});
markers.push[marker.title]
}
}
}

+ Creating Poll for dynamic date reloading and remote command for immidiate markers load and poll initiation

[/coce]

+

Java 8. Joining list of string.

I know that Java 9 is already around the corner, but since I just started my blog, I am gonna write about my favorite Java 8 feature – Streams.

My favorite usage of streams is joining list of string with separator.

public void daysOfTheWeek() {
    List<String> list = Arrays.asList(new String[]{"Monday", "Tuesday", "Wednesday", "Fourthday", "Friday", "Saturday", "Sunday"});
    String string = list.stream().collect(Collectors.joining(", "));
    System.out.println("Days of the week: " + string);
}