From 7ecbb688164e0a5b7bf572ff8b82404e99ba30fe Mon Sep 17 00:00:00 2001 From: zisuu Date: Fri, 13 Sep 2024 22:51:12 +0200 Subject: [PATCH] Publii: update content --- authors/finecloud/index.html | 2 +- authors/finecloud/page/10/index.html | 2 +- authors/finecloud/page/11/index.html | 2 +- authors/finecloud/page/12/index.html | 2 +- authors/finecloud/page/13/index.html | 2 +- authors/finecloud/page/14/index.html | 2 +- authors/finecloud/page/15/index.html | 2 +- authors/finecloud/page/16/index.html | 2 +- authors/finecloud/page/2/index.html | 2 +- authors/finecloud/page/3/index.html | 2 +- authors/finecloud/page/4/index.html | 2 +- authors/finecloud/page/5/index.html | 2 +- authors/finecloud/page/6/index.html | 2 +- authors/finecloud/page/7/index.html | 2 +- authors/finecloud/page/8/index.html | 2 +- authors/finecloud/page/9/index.html | 2 +- ...dden-dependencies-in-your-dockerfiles.html | 61 ++ feed.json | 40 +- feed.xml | 543 ++++-------------- ...s-fine-grained-personal-access-tokens.html | 2 +- index.html | 2 +- page/10/index.html | 2 +- page/11/index.html | 2 +- page/12/index.html | 2 +- page/13/index.html | 2 +- page/14/index.html | 2 +- page/15/index.html | 2 +- page/16/index.html | 2 +- page/2/index.html | 2 +- page/3/index.html | 2 +- page/4/index.html | 2 +- page/5/index.html | 2 +- page/6/index.html | 2 +- page/7/index.html | 2 +- page/8/index.html | 2 +- page/9/index.html | 2 +- sitemap.xml | 4 + tags/bash/index.html | 2 +- tags/container/index.html | 2 +- tags/container/page/2/index.html | 2 +- tags/devops/index.html | 2 +- tags/docker/index.html | 2 +- tags/docker/page/2/index.html | 18 + tags/index.html | 2 +- tags/linux/index.html | 2 +- tags/linux/page/2/index.html | 2 +- tags/linux/page/3/index.html | 2 +- tags/maven/index.html | 2 +- tags/regex/index.html | 2 +- tags/renovate/index.html | 18 + tags/softwareentwicklung/index.html | 2 +- tags/softwareentwicklung/page/10/index.html | 2 +- tags/softwareentwicklung/page/11/index.html | 2 +- tags/softwareentwicklung/page/2/index.html | 2 +- tags/softwareentwicklung/page/3/index.html | 2 +- tags/softwareentwicklung/page/4/index.html | 2 +- tags/softwareentwicklung/page/5/index.html | 2 +- tags/softwareentwicklung/page/6/index.html | 2 +- tags/softwareentwicklung/page/7/index.html | 2 +- tags/softwareentwicklung/page/8/index.html | 2 +- tags/softwareentwicklung/page/9/index.html | 2 +- take-care-of-your-ssh-keys.html | 2 +- 62 files changed, 297 insertions(+), 499 deletions(-) create mode 100644 automatically-update-hidden-dependencies-in-your-dockerfiles.html create mode 100644 tags/docker/page/2/index.html create mode 100644 tags/renovate/index.html diff --git a/authors/finecloud/index.html b/authors/finecloud/index.html index 0417a02..6765584 100644 --- a/authors/finecloud/index.html +++ b/authors/finecloud/index.html @@ -1,4 +1,4 @@ -Author: Finecloud - Finecloud

Finecloud (76)

GitHub classic vs. fine-grained Personal Access Tokens

What are PATs? Personal access tokens are an alternative to using passwords for authentication to GitHub when using the GitHub API or the command line. Personal access tokens are intended to access GitHub resources on your behalf. To access resources on behalf of an organization,…

Third-party GitHub Actions

Today I came across these steps to guide our decision-making process, before using a 3rd Part GitHub Action:

GitHub Codespace

What is a Codespace? A codespace is a development environment that's hosted in the cloud. You can customize your project for GitHub Codespaces by committing configuration files to your repository (also known as configuration-as-code), which creates a repeatable codespace configuration for all users of your…

Awk and Sed

awk and sed are text manipulation programs. You can use them for example to replace strings: echo image.jpg | sed 's/\.jpg/.png/' image.png or change order of strings: echo "hello world" | awk '{print $2, $1}' world hello awk and sed are harder to learn than…

How to do a code review

This Blog post is my personal summary of Googles code review process Make sure to review every line of code you’ve been asked to review, look at the context, make sure you’re improving code health, and compliment developers on good things that they do. Look at…

Finecloud (77)

GitHub classic vs. fine-grained Personal Access Tokens

What are PATs? Personal access tokens are an alternative to using passwords for authentication to GitHub when using the GitHub API or the command line. Personal access tokens are intended to access GitHub resources on your behalf. To access resources on behalf of an organization,…

Third-party GitHub Actions

Today I came across these steps to guide our decision-making process, before using a 3rd Part GitHub Action:

GitHub Codespace

What is a Codespace? A codespace is a development environment that's hosted in the cloud. You can customize your project for GitHub Codespaces by committing configuration files to your repository (also known as configuration-as-code), which creates a repeatable codespace configuration for all users of your…

Awk and Sed

awk and sed are text manipulation programs. You can use them for example to replace strings: echo image.jpg | sed 's/\.jpg/.png/' image.png or change order of strings: echo "hello world" | awk '{print $2, $1}' world hello awk and sed are harder to learn than…

Finecloud (76)

Monitor Proxmox mit Grafana und Prometheus

Obwohl Proxmox selbst ja sehr gute Monitoring Informationen direkt auf dem eigenen WebUI anzeigt werde ich um Grafana und Prometheus besser kennen zu lernen diese Tools nutzen um meinen Proxmox Host zu überwachen. Mit der Open-Source-Software von Grafana kann man Metriken, Protokolle und Ablaufverfolgungen, visualisieren,…

Capture Groups in Java

Capture Groups Im letzten Post haben wir einen kleinen Einstieg in Regex mit Java gemacht. Nun sehen wir uns an, wie man Regex Pattern in Java mittels Capture Groups anwenden kann: String regex = "(1[-.\\s])?(\\d{3}[-.\\s]?)(\\d{3}[-.\\s]?)\\d{4}"; String phoneNumber = "12.523.231.4234"; Pattern pat = Pattern.compile(regex); Matcher mat =…

Einstieg in Regex mit Java

Was ist Regex? Regex steht für Regular expressions und ist eine Technik, Technologie und Sprache an und für sich, die verwendet werden kann zum Ausdrücken von Textmustern mit Symbolen. Und diese Symbole sind selbst Text. Damit lassen wir verschiedene Textteile und Zeichen andere Textfolgen darstellen. In…

Java Access-Modifier

Sobald ein Feld sichtbar ist, bedeutet das auch, das es gelesen und beschrieben werden kann. Die Access-Modifier steuern, von wo auf Felder und Methoden eines Objekts zugegriffen werden kann: Modifier Wer darf zugreifen? public Auf public-Objekte/Felder und Methoden darf ohne Einschränkungen von überall aus zugegriffen…

Java Namenskonventionen

In diesem Blog fasse ich die Java Namenskonventionen kurz zusammen: Typ Namenskonvention Beispiele Class Sollte mit Grossbuchstaben beginnen und sollte ein Substantiv wie Farbe, Knopf, System, Faden usw. sein. Verwenden Sie geeignete Wörter anstelle von Akronymen. public class Employee { //code snippet } Interface Sollte…

Finecloud (77)

Imperativ vs. Deklarativ

Dieser Beitrag ist meine Zusammenfassung (in meinem eigenen Interesse) des ursprünglichen Beitrags in voller Länge: https://leebriggs.co.uk/blog/2022/07/20/nobody-knows-what-declarative-is Immer wieder stösst man im Bereich Infrastructure as Code (IaC) auf die Begriffe imperativ und deklarativ. Doch was bedeuten diese Begriffe? Ist Terraform wirklich deklarativ und Ansible nicht? Diese…

Monitor Proxmox mit Grafana und Prometheus

Obwohl Proxmox selbst ja sehr gute Monitoring Informationen direkt auf dem eigenen WebUI anzeigt werde ich um Grafana und Prometheus besser kennen zu lernen diese Tools nutzen um meinen Proxmox Host zu überwachen. Mit der Open-Source-Software von Grafana kann man Metriken, Protokolle und Ablaufverfolgungen, visualisieren,…

Capture Groups in Java

Capture Groups Im letzten Post haben wir einen kleinen Einstieg in Regex mit Java gemacht. Nun sehen wir uns an, wie man Regex Pattern in Java mittels Capture Groups anwenden kann: String regex = "(1[-.\\s])?(\\d{3}[-.\\s]?)(\\d{3}[-.\\s]?)\\d{4}"; String phoneNumber = "12.523.231.4234"; Pattern pat = Pattern.compile(regex); Matcher mat =…

Einstieg in Regex mit Java

Was ist Regex? Regex steht für Regular expressions und ist eine Technik, Technologie und Sprache an und für sich, die verwendet werden kann zum Ausdrücken von Textmustern mit Symbolen. Und diese Symbole sind selbst Text. Damit lassen wir verschiedene Textteile und Zeichen andere Textfolgen darstellen. In…

Java Access-Modifier

Sobald ein Feld sichtbar ist, bedeutet das auch, das es gelesen und beschrieben werden kann. Die Access-Modifier steuern, von wo auf Felder und Methoden eines Objekts zugegriffen werden kann: Modifier Wer darf zugreifen? public Auf public-Objekte/Felder und Methoden darf ohne Einschränkungen von überall aus zugegriffen…

Finecloud (76)

Unterschiede zwischen Proxmox Containers und Docker

LXC LXC ist ein Userspace Interface zur Eindämmung des Linux-Kernels und kann verwendet werden für Systemvirtualisierung. Durch eine mächtige API und einfache Tools ermöglicht es Linux Benutzern einfache Erstellung und Verwaltung von System Container. LXC ermöglicht ein komplettes OS in einem Container zu betreiben. LXD…

Citrix ADC (NetScaler) Backup mit Ansible

Beschreibung Citrix ADC, bis vor einer Weile noch als Citrix NetScaler bekannt ist eine Netzwerk Appliance welche als Access Gateway und Proxy verwendet werden kann. In diesem Artikel werden wir ein kleines Ansible Playbook schreiben, mit welchem man einen Citrix ADC sichern kann. Als erster…

JVM und JDK unter der Haube

Woher lädt Java eigentlich seine JDK Klassen? Beim Start einer Applikation kann mit -cp ein Klassenpfad angegeben werden, in welchem sich Klassen befinden, die man verwenden möchte. Das ist das normale Vorgehen, wie man Klassen integriert. Doch woher hat das JDK seine eigenen Klassen? Um…

GUIs mit JavaFX

Einführung JavaFX ist das modernste in der Java SE integrierte GUI-Framework zum Erstellen grafischer Benutzeroberflächen (GUI: Graphical User Interface). JavaFX ist eine reine Java-Bibliothek, die zwar, auch deklarative Definitionen von GUIs über XML ermöglicht, die aber im Kern aus Java-Klassen besteht. Seit Java 8 liegt…

Kubernetes auf Proxmox mit Ansible und Terraform (Teil 2)

Dieser Post wurde aus dem Original (https://datastrophic.io/kubernetes-homelab-with-proxmox-kubeadm-calico-openebs-and-metallb/)auf Deutsch übersetzt und leicht angepasst. Nachdem wir im ersten Teil mit Terraform die VMs für unseren K8s Cluster deployed haben, werden wir nun mit Ansible die folgenden K8s Komponenten in den worker Nodes und dem Controller installieren: Die…

Finecloud (77)

Java Namenskonventionen

In diesem Blog fasse ich die Java Namenskonventionen kurz zusammen: Typ Namenskonvention Beispiele Class Sollte mit Grossbuchstaben beginnen und sollte ein Substantiv wie Farbe, Knopf, System, Faden usw. sein. Verwenden Sie geeignete Wörter anstelle von Akronymen. public class Employee { //code snippet } Interface Sollte…

Unterschiede zwischen Proxmox Containers und Docker

LXC LXC ist ein Userspace Interface zur Eindämmung des Linux-Kernels und kann verwendet werden für Systemvirtualisierung. Durch eine mächtige API und einfache Tools ermöglicht es Linux Benutzern einfache Erstellung und Verwaltung von System Container. LXC ermöglicht ein komplettes OS in einem Container zu betreiben. LXD…

Citrix ADC (NetScaler) Backup mit Ansible

Beschreibung Citrix ADC, bis vor einer Weile noch als Citrix NetScaler bekannt ist eine Netzwerk Appliance welche als Access Gateway und Proxy verwendet werden kann. In diesem Artikel werden wir ein kleines Ansible Playbook schreiben, mit welchem man einen Citrix ADC sichern kann. Als erster…

JVM und JDK unter der Haube

Woher lädt Java eigentlich seine JDK Klassen? Beim Start einer Applikation kann mit -cp ein Klassenpfad angegeben werden, in welchem sich Klassen befinden, die man verwenden möchte. Das ist das normale Vorgehen, wie man Klassen integriert. Doch woher hat das JDK seine eigenen Klassen? Um…

GUIs mit JavaFX

Einführung JavaFX ist das modernste in der Java SE integrierte GUI-Framework zum Erstellen grafischer Benutzeroberflächen (GUI: Graphical User Interface). JavaFX ist eine reine Java-Bibliothek, die zwar, auch deklarative Definitionen von GUIs über XML ermöglicht, die aber im Kern aus Java-Klassen besteht. Seit Java 8 liegt…

Finecloud (76)

Kubernetes auf Proxmox mit Ansible und Terraform (Teil 1)

Einleitung In ersten Teil werden wir ein cloud-init Template erstellen, welches wir dann mit Terraform nutzen um die K8S VMs zu erzeugen. Damit wir mit Terraform unsere Kubernetes Nodes deployen können, brauchen wir ein Template. Das kann man entweder bereits mit Ansible machen, sieh dir…

Java und DBs

Java kommt von Haus aus mit einer relationalen Open-Source-Datenbank, der Apache-Derby-Datenbank, welche in reinem Java geschrieben ist und sich dadurch nicht nur als eigener Prozess betreiben lässt, sondern auch als Embeded Bestandteil einer Java Anwendung betrieben werden kann. Das ist jedoch für den produktiven Betrieb…

HTTP Response Status Codes

Die erste Ziffer des Status-Codes definiert die Klasse der Response. Die letzten zwei Ziffern haben keine Bedeutung für die Kategorisierung. Es gibt fünf unterschiedliche Response Klassen: Nachfolgend eine Zusammenstellung der häufigsten HTTP-Codes denen man im Alltag begegnet: HTTP-Statuscode Bedeutung 200 OK Der Request wurde ohne…

HTTP Methoden - RFC9110

Was geschieht eigentlich wenn ich eine Webseite aufrufe? Wir überspringen den Ersten Teil mit DNS und gehen davon aus, dass die URL bereits im DNS Cache ist. Um diese Frage zu beantworten, müssen wir uns mit den Grundlagen des HTTP-Protokolls befassen. Der Aufruf der Webseite…

TOC in README.md erstellen mit VSCode

TOC steht für Table of Contents (aka Inhaltsverzeichnis). Jedes grössere README Markdown File in einem git Repo sollte über ein TOC verfügen. Doch die Pflege eines TOC sowie die initiale Erstellung ist nicht sehr handlich, du musst für jeden einzelnen Titel in der richtigen Einrückung…

Finecloud (77)

Kubernetes auf Proxmox mit Ansible und Terraform (Teil 2)

Dieser Post wurde aus dem Original (https://datastrophic.io/kubernetes-homelab-with-proxmox-kubeadm-calico-openebs-and-metallb/)auf Deutsch übersetzt und leicht angepasst. Nachdem wir im ersten Teil mit Terraform die VMs für unseren K8s Cluster deployed haben, werden wir nun mit Ansible die folgenden K8s Komponenten in den worker Nodes und dem Controller installieren: Die…

Kubernetes auf Proxmox mit Ansible und Terraform (Teil 1)

Einleitung In ersten Teil werden wir ein cloud-init Template erstellen, welches wir dann mit Terraform nutzen um die K8S VMs zu erzeugen. Damit wir mit Terraform unsere Kubernetes Nodes deployen können, brauchen wir ein Template. Das kann man entweder bereits mit Ansible machen, sieh dir…

Java und DBs

Java kommt von Haus aus mit einer relationalen Open-Source-Datenbank, der Apache-Derby-Datenbank, welche in reinem Java geschrieben ist und sich dadurch nicht nur als eigener Prozess betreiben lässt, sondern auch als Embeded Bestandteil einer Java Anwendung betrieben werden kann. Das ist jedoch für den produktiven Betrieb…

HTTP Response Status Codes

Die erste Ziffer des Status-Codes definiert die Klasse der Response. Die letzten zwei Ziffern haben keine Bedeutung für die Kategorisierung. Es gibt fünf unterschiedliche Response Klassen: Nachfolgend eine Zusammenstellung der häufigsten HTTP-Codes denen man im Alltag begegnet: HTTP-Statuscode Bedeutung 200 OK Der Request wurde ohne…

HTTP Methoden - RFC9110

Was geschieht eigentlich wenn ich eine Webseite aufrufe? Wir überspringen den Ersten Teil mit DNS und gehen davon aus, dass die URL bereits im DNS Cache ist. Um diese Frage zu beantworten, müssen wir uns mit den Grundlagen des HTTP-Protokolls befassen. Der Aufruf der Webseite…

Finecloud (76)

Java Serverlet mit Tomcat und Maven in VSCode

In diesem Artikel ist beschrieben, wie man Apache Tomcat direkt in VSCode nutzen kann. Voraussetzung ist, dass du auf deinem Gerät bereits eine Java JRE und Apache Maven installiert hast. Weiter brauchen wir in VSCode das Extension Pack for Java, du kannst dire in VSCode…

Java Serverlet Container installieren

Einleitung Das Serverlet-Framework Jakarta EE ermöglicht die Entwicklung von Anwendungen für eine grosse Anzahl paralleler Benutzer die über einen Web-Browser zugreifen. Dazu ist besonders die Serverlet-API von JEE von Interesse. Diese API-Klasse wartet auf eingehende Netzwerkverbindungen und reagiert mit einer entsprechenden Antwort. Für die übertragenen…

Tabby Config-Sync auf Nextcloud einrichten

A terminal for the modern age Tabby ist ein anpassbares, Platform-Übergreifendes Terminal App für die Arbeit mit Lokalen Shells sowie Serial, SSH und Telnet Verbindungen. Aus diesen Gründen ist Tabby viel praktischer und moderner als Putty: Link zum App: https://tabby.sh/ Link zum Projekt auf GitHub:…

Netzwerkkommunikation mit Java

In Java gibt es keinen nennenswerten Unterschied wischen I/O mit Daten und I/O mit Netzwerkverbindungen. In beiden Fällen basiert die Ein- und Ausgabe auf InputStream und OutputStream, der Unterschied liegt nur darin, wo diese Datenströme herkommen. Bei der Netzwerkkommunikation mit dem TCP-Protokoll kommen sie aus…

Proxmox VE 7.2 Installation

Systemanforderungen Proxmox gibt folgende minimale Systemanforderungen an: Für produktive Workloads sind diese Anforderungen aber nicht gedacht. Daher sind die empfohlenen Systemanforderungen wie folgt: Da ich meine Proxmox Infrastruktur zum Start nur als Standalone LAB installieren will und für mein kleines Budget maximal viel Leistung erhalten…

Finecloud (77)

TOC in README.md erstellen mit VSCode

TOC steht für Table of Contents (aka Inhaltsverzeichnis). Jedes grössere README Markdown File in einem git Repo sollte über ein TOC verfügen. Doch die Pflege eines TOC sowie die initiale Erstellung ist nicht sehr handlich, du musst für jeden einzelnen Titel in der richtigen Einrückung…

Java Serverlet mit Tomcat und Maven in VSCode

In diesem Artikel ist beschrieben, wie man Apache Tomcat direkt in VSCode nutzen kann. Voraussetzung ist, dass du auf deinem Gerät bereits eine Java JRE und Apache Maven installiert hast. Weiter brauchen wir in VSCode das Extension Pack for Java, du kannst dire in VSCode…

Java Serverlet Container installieren

Einleitung Das Serverlet-Framework Jakarta EE ermöglicht die Entwicklung von Anwendungen für eine grosse Anzahl paralleler Benutzer die über einen Web-Browser zugreifen. Dazu ist besonders die Serverlet-API von JEE von Interesse. Diese API-Klasse wartet auf eingehende Netzwerkverbindungen und reagiert mit einer entsprechenden Antwort. Für die übertragenen…

Tabby Config-Sync auf Nextcloud einrichten

A terminal for the modern age Tabby ist ein anpassbares, Platform-Übergreifendes Terminal App für die Arbeit mit Lokalen Shells sowie Serial, SSH und Telnet Verbindungen. Aus diesen Gründen ist Tabby viel praktischer und moderner als Putty: Link zum App: https://tabby.sh/ Link zum Projekt auf GitHub:…

Netzwerkkommunikation mit Java

In Java gibt es keinen nennenswerten Unterschied wischen I/O mit Daten und I/O mit Netzwerkverbindungen. In beiden Fällen basiert die Ein- und Ausgabe auf InputStream und OutputStream, der Unterschied liegt nur darin, wo diese Datenströme herkommen. Bei der Netzwerkkommunikation mit dem TCP-Protokoll kommen sie aus…

Finecloud (76)

Proxmox VE 7.2 Übersicht

Die Architektur Proxmox VE ist eine Plattform zum Betrieben von virtuellen Maschinen und Container. Dabei ist die gesamte Proxmox VE Plattform open source und baisert auf Debian Linux. die VE Plattform besteht aus zwei virtualisierungs-technologien: Proxmox gibt es als single node, oder als Cluster mit…

Dateien und Verzeichnisse unter Java

Dateioperationen mit java.io werden in Java immer, direkt oder indirekt, durch ein Objekt des Typs java.io.File abgebildet. Dabei kann File aber nicht selbst aus Dateien lesen, oder in sie schreiben, dazu benötigt man einen Reader oder Writer (für Textdateien) resp. einen InputStream oder OutputStream (für…

Genereische Java Methoden und beschränkte Typen

Eine Methode kann einen typisierten Parameter erzwingen und einen typisierten Wert zurückgeben: public List<Integer> parseAlleInts(List<String> strings){ List<Integer> ergebnis = new ArrayList<>(); for (String s : strings){ ergebnis.add(Integer.parseInt(s)); } return ergebnis; } So ist es möglich eine Liste von Strings als Paramter in eine Liste von…

Java Collection Iteratoren

Diese Collection Methode kann dazu verwendet werden, über alle Werte einer Collection zu iterieren: die Methode iterator, gibt ein Objekt vom Typ Iterator zurück. Mit der Methode hasNext wird geprüft, ob es noch ein weiteres Element in der Collection gibt, next gibt das nächste Element…

Java Collection Sets

Sets eignen sich für die Bearbeitung einer mathematischen Menge. Set kann somit keine identische Elemente enthalten und kann keine interneReihenfolge haben. Deshalb gibt es für Set auch keine Methoden die den direkten Zugriff auf ein Element ermöglichen. Um auf ein Element eines Set zuzugreifen muss…

Finecloud (77)

Proxmox VE 7.2 Installation

Systemanforderungen Proxmox gibt folgende minimale Systemanforderungen an: Für produktive Workloads sind diese Anforderungen aber nicht gedacht. Daher sind die empfohlenen Systemanforderungen wie folgt: Da ich meine Proxmox Infrastruktur zum Start nur als Standalone LAB installieren will und für mein kleines Budget maximal viel Leistung erhalten…

Proxmox VE 7.2 Übersicht

Die Architektur Proxmox VE ist eine Plattform zum Betrieben von virtuellen Maschinen und Container. Dabei ist die gesamte Proxmox VE Plattform open source und baisert auf Debian Linux. die VE Plattform besteht aus zwei virtualisierungs-technologien: Proxmox gibt es als single node, oder als Cluster mit…

Dateien und Verzeichnisse unter Java

Dateioperationen mit java.io werden in Java immer, direkt oder indirekt, durch ein Objekt des Typs java.io.File abgebildet. Dabei kann File aber nicht selbst aus Dateien lesen, oder in sie schreiben, dazu benötigt man einen Reader oder Writer (für Textdateien) resp. einen InputStream oder OutputStream (für…

Genereische Java Methoden und beschränkte Typen

Eine Methode kann einen typisierten Parameter erzwingen und einen typisierten Wert zurückgeben: public List<Integer> parseAlleInts(List<String> strings){ List<Integer> ergebnis = new ArrayList<>(); for (String s : strings){ ergebnis.add(Integer.parseInt(s)); } return ergebnis; } So ist es möglich eine Liste von Strings als Paramter in eine Liste von…

Java Collection Iteratoren

Diese Collection Methode kann dazu verwendet werden, über alle Werte einer Collection zu iterieren: die Methode iterator, gibt ein Objekt vom Typ Iterator zurück. Mit der Methode hasNext wird geprüft, ob es noch ein weiteres Element in der Collection gibt, next gibt das nächste Element…

Finecloud (76)

Java Collection Listen

Listen sind Collections, die am ehesten einem Array entsprechen. Die Elemente bleiben in der Reihenfolge wie sie hinzugefügt werden und sie können auf einzelne Positionen im Index der Liste zugreifen: lesen mit get(index) und schreiben mit set(index, element). Damit ist mit Listen alles möglich, was…

Java Collections

Collections sind ganz alltägliche Java Objekte. Im Gegensatz zu Arrays sind Collections nicht durch native Methoden und einem zusammenhängenden Speicherbereich optimiert, sie haben auch keine eigene Syntax. Die Vorteile von Collections sind der Benutzerkomfort, da sie über eine umfangreichere und komfortablere API verfügen. Zudem können…

Java Varargs

Varargs, auch Parameter-Listen genannt können in Java Arrays verwendet werden, um eine dynamische Anzahl von Parametern entgegenzunehmen. public static int max(int… numbers){ int result = Integer.MIN_VALUE; for (int number : numbers){ if (number > result){ result = number; } } return result; } Diese Methode…

Die for-each Schleife

Die for-each Schleife ist speziell für Arrays und Collections gedacht, denn diese Schleife enthält keine Zählvariable, enthält aber nacheinander alle Einträge des Arrays oder der Collection. Buch[] buecher = …; for (Buch buch : buecher){ System.out.println(buch.getTitel()); } Dabei wird in den Klammern der Schleife eine…

Vaultwarden Backup mit Rclone

Vaultwarden ist eine alternative Implementation der Bitwarden Server API entwickelt in Rust, kompatibel mit allen Bitwarden clients. Vaultwarden eignet sich daher perfekt für self-hosted deployments, oder überall dort wo der offizielle Bitwarden Service nicht ideal geeignet ist. Dazu gibt es einmal das Vaultwarden Docker Image…

Finecloud (77)

Java Collection Sets

Sets eignen sich für die Bearbeitung einer mathematischen Menge. Set kann somit keine identische Elemente enthalten und kann keine interneReihenfolge haben. Deshalb gibt es für Set auch keine Methoden die den direkten Zugriff auf ein Element ermöglichen. Um auf ein Element eines Set zuzugreifen muss…

Java Collection Listen

Listen sind Collections, die am ehesten einem Array entsprechen. Die Elemente bleiben in der Reihenfolge wie sie hinzugefügt werden und sie können auf einzelne Positionen im Index der Liste zugreifen: lesen mit get(index) und schreiben mit set(index, element). Damit ist mit Listen alles möglich, was…

Java Collections

Collections sind ganz alltägliche Java Objekte. Im Gegensatz zu Arrays sind Collections nicht durch native Methoden und einem zusammenhängenden Speicherbereich optimiert, sie haben auch keine eigene Syntax. Die Vorteile von Collections sind der Benutzerkomfort, da sie über eine umfangreichere und komfortablere API verfügen. Zudem können…

Java Varargs

Varargs, auch Parameter-Listen genannt können in Java Arrays verwendet werden, um eine dynamische Anzahl von Parametern entgegenzunehmen. public static int max(int… numbers){ int result = Integer.MIN_VALUE; for (int number : numbers){ if (number > result){ result = number; } } return result; } Diese Methode…

Die for-each Schleife

Die for-each Schleife ist speziell für Arrays und Collections gedacht, denn diese Schleife enthält keine Zählvariable, enthält aber nacheinander alle Einträge des Arrays oder der Collection. Buch[] buecher = …; for (Buch buch : buecher){ System.out.println(buch.getTitel()); } Dabei wird in den Klammern der Schleife eine…

Finecloud (76)

Mehrdimensionale Java Arrays

Eindimensionales Array Nebst den eindimensionalen Java Arrays gibt es auch mehrdimensionale Arrays. Hier ein Beispiel eines eindimensionalen Java Arrays: int[] zahlen = new int[]{1, 2, 3, 4}; Ein mehrdimensionales Array könnte beispielsweise ein Schachfeld sein: Schachfigur[][] schachbrett = new Schachfigur[8][8]; Mehrdimensionale Arrays sind nicht auf…

Finecloud (77)

Vaultwarden Backup mit Rclone

Vaultwarden ist eine alternative Implementation der Bitwarden Server API entwickelt in Rust, kompatibel mit allen Bitwarden clients. Vaultwarden eignet sich daher perfekt für self-hosted deployments, oder überall dort wo der offizielle Bitwarden Service nicht ideal geeignet ist. Dazu gibt es einmal das Vaultwarden Docker Image…

Mehrdimensionale Java Arrays

Eindimensionales Array Nebst den eindimensionalen Java Arrays gibt es auch mehrdimensionale Arrays. Hier ein Beispiel eines eindimensionalen Java Arrays: int[] zahlen = new int[]{1, 2, 3, 4}; Ein mehrdimensionales Array könnte beispielsweise ein Schachfeld sein: Schachfigur[][] schachbrett = new Schachfigur[8][8]; Mehrdimensionale Arrays sind nicht auf…

Finecloud (76)

Building a GraphQL service

Let's build a GraphQL Spring Application that will accept GraphQL requests at http://localhost:8080/graphql. First let's navigate to https://start.spring.io. This service pulls in all the dependencies you need for an application and does most of the setup for you. GraphQL is a query language to retrieve…

Microservices

This Post is a summary of the famous Article about Microservices: https://martinfowler.com/articles/microservices.html The text discusses the concept of "Microservice Architecture," which is an approach to designing software applications as a suite of independently deployable services. It highlights that there is no precise definition but outlines…

The Concept of API Contracts

What is it about? We define an API contract as a formal agreement between a software provider and a consumer that abstractly communicates how to interact with each other. This contract defines how API providers and consumers interact, what data exchanges looks like, and how…

Terraform Tips and Tricks

module "zland" { source = "git::ssh//git@gitlab.com/zland/module.git" version = "1.0.5" servers = 3 } Module Output Values resource "aws_instance" "appserver" { #... instance = module.servers.instance_ids } Since the resources defined in a module are encapsulated, a calling module cannot access their attributes directly. Instead, the child…

Finecloud (77)

How to do a code review

This Blog post is my personal summary of Googles code review process Make sure to review every line of code you’ve been asked to review, look at the context, make sure you’re improving code health, and compliment developers on good things that they do. Look at…

Building a GraphQL service

Let's build a GraphQL Spring Application that will accept GraphQL requests at http://localhost:8080/graphql. First let's navigate to https://start.spring.io. This service pulls in all the dependencies you need for an application and does most of the setup for you. GraphQL is a query language to retrieve…

Microservices

This Post is a summary of the famous Article about Microservices: https://martinfowler.com/articles/microservices.html The text discusses the concept of "Microservice Architecture," which is an approach to designing software applications as a suite of independently deployable services. It highlights that there is no precise definition but outlines…

The Concept of API Contracts

What is it about? We define an API contract as a formal agreement between a software provider and a consumer that abstractly communicates how to interact with each other. This contract defines how API providers and consumers interact, what data exchanges looks like, and how…

Finecloud (76)

Spring Boot on Kubernetes

Enable Kubernetes in Docker Desktop We will use Docker Desktop to provide us a Test Kubernetes Environment. Open Docker Desktop Settings, go to Tab "Kubernetes". Select "Enable Kubernetes", then "Apply & Restart". Now you should be able to see docker-desktop listed, if you run kubectl…

Building Spring Boot Docker Images

Pre-Requirements Developer Environment ready with Docker, JDK, IDE A Java Spring Boot Project with a h2 in-memory DB Docker Hub account Create Docker File Create a Dockerfile with the following content: FROM openjdk:11-jre-slim ENV JAVA_OPTS " -Xms512m -Xmx512m -Djava.security.egd=file:///dev/./urandom" WORKDIR application COPY target/myapp-0.0.1-SNAPSHOT.jar ./ ENTRYPOINT…

Data Validation Overview

What is Validation? Validation is a process of making assertions against data to ensure data integrity Is a value required? How long is a phone number? Is it a good date? What is the maximum length of a string? Some refer to data validation as…

Data Transfer Objects

Data Transfer Objects DTOs - Data Transfer Objects DTOs are simple Java POJOs DTOs are data structures, generally should NOT have behavior DTOs are objects used to transfer data between producers and consumers Controller models are typically DTOs Why Not Entities? Database Entities are also…

Spring Exception Handling

HTTP Status Codes 100 Series - Informational Responses • 200 Series - Successful Responses 300 Series - Redirection Responses 400 Series - Client Error Responses 500 Series - Server Error Responses Use of HTTP Status Codes 200 Series are used when the request completes as…

Finecloud (77)

Terraform Tips and Tricks

module "zland" { source = "git::ssh//git@gitlab.com/zland/module.git" version = "1.0.5" servers = 3 } Module Output Values resource "aws_instance" "appserver" { #... instance = module.servers.instance_ids } Since the resources defined in a module are encapsulated, a calling module cannot access their attributes directly. Instead, the child…

Spring Boot on Kubernetes

Enable Kubernetes in Docker Desktop We will use Docker Desktop to provide us a Test Kubernetes Environment. Open Docker Desktop Settings, go to Tab "Kubernetes". Select "Enable Kubernetes", then "Apply & Restart". Now you should be able to see docker-desktop listed, if you run kubectl…

Building Spring Boot Docker Images

Pre-Requirements Developer Environment ready with Docker, JDK, IDE A Java Spring Boot Project with a h2 in-memory DB Docker Hub account Create Docker File Create a Dockerfile with the following content: FROM openjdk:11-jre-slim ENV JAVA_OPTS " -Xms512m -Xmx512m -Djava.security.egd=file:///dev/./urandom" WORKDIR application COPY target/myapp-0.0.1-SNAPSHOT.jar ./ ENTRYPOINT…

Data Validation Overview

What is Validation? Validation is a process of making assertions against data to ensure data integrity Is a value required? How long is a phone number? Is it a good date? What is the maximum length of a string? Some refer to data validation as…

Data Transfer Objects

Data Transfer Objects DTOs - Data Transfer Objects DTOs are simple Java POJOs DTOs are data structures, generally should NOT have behavior DTOs are objects used to transfer data between producers and consumers Controller models are typically DTOs Why Not Entities? Database Entities are also…

Finecloud (76)

Testing with MockMVC

Why use Spring MockMVC? Spring MockMVC allows you to test the controller interactions in a servlet context without the application running in an application server. Mockito is the most popular mocking framework for testing Java Mocks (aka Test Doubles) are alternate implementations of objects to…

Project Lombok

Intro Project Lombok is a Java library that provides a set of annotations and utility classes that help to reduce boilerplate code in Java projects. It offers features such as automatic generation of getters, setters, equals, hashCode, toString, and constructors, as well as support for…

Spring Bean Lifecycle

Part 1 Of course, instantiating the class will come first. The class will populate properties after it has been created. It will therefore set up any properties you may have. Then, if they exist, we do have some interfaces that we can implement. These methods…

Spring Annotations

If you want to develop a Spring Application you need to know when to use which Annotation. Spring’s dependency injection capability includes the following annotations:

Conventional commits

What are Conventional commits Conventional Commits is a convention for writing commit messages that provides structure and consistency to a project's version control history. It's based on the idea of defining a standard format for commit messages that makes it easier for developers to understand…

Finecloud (77)

Spring Exception Handling

HTTP Status Codes 100 Series - Informational Responses • 200 Series - Successful Responses 300 Series - Redirection Responses 400 Series - Client Error Responses 500 Series - Server Error Responses Use of HTTP Status Codes 200 Series are used when the request completes as…

Testing with MockMVC

Why use Spring MockMVC? Spring MockMVC allows you to test the controller interactions in a servlet context without the application running in an application server. Mockito is the most popular mocking framework for testing Java Mocks (aka Test Doubles) are alternate implementations of objects to…

Project Lombok

Intro Project Lombok is a Java library that provides a set of annotations and utility classes that help to reduce boilerplate code in Java projects. It offers features such as automatic generation of getters, setters, equals, hashCode, toString, and constructors, as well as support for…

Spring Bean Lifecycle

Part 1 Of course, instantiating the class will come first. The class will populate properties after it has been created. It will therefore set up any properties you may have. Then, if they exist, we do have some interfaces that we can implement. These methods…

Spring Annotations

If you want to develop a Spring Application you need to know when to use which Annotation. Spring’s dependency injection capability includes the following annotations:

Finecloud (76)

CleanCode

Summary of 'Clean code' by Robert C. Martin: https://gist.github.com/wojteklu/73c6914cc446146b8b533c0988cf8d29 Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility…

JavaScript advanced features

New Features New versions of JavaScript, such as ES6, ES2016, 2017, etc., come with many new features, however it is still ECMAScript Many of the new features are syntactic sugar or extend the functionality only marginal Template Literals Template literals are string literals with support…

JavaScript and the browser

The DOM Based on the received HTML document the browser builds up a model of the document structure, the Document Object Model (DOM) The DOM has a tree structure and each node of the document is represented by an object The browser renders the page…

JavaScript objects

Object An object is a collection of properties A property has a name and a value An object can be seen as associative array (map) where the keys in the array are the names of the object’s properties // Create object as literal const bob…

Difference between heap and stack

In this Post I try to explain the difference between the heap and the stack. It's just a very high level amateur explanation, there is a lot more to read and learn about this Topics. This Drawing helps me a lot to understand the basic…

Finecloud (77)

Conventional commits

What are Conventional commits Conventional Commits is a convention for writing commit messages that provides structure and consistency to a project's version control history. It's based on the idea of defining a standard format for commit messages that makes it easier for developers to understand…

CleanCode

Summary of 'Clean code' by Robert C. Martin: https://gist.github.com/wojteklu/73c6914cc446146b8b533c0988cf8d29 Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility…

JavaScript advanced features

New Features New versions of JavaScript, such as ES6, ES2016, 2017, etc., come with many new features, however it is still ECMAScript Many of the new features are syntactic sugar or extend the functionality only marginal Template Literals Template literals are string literals with support…

JavaScript and the browser

The DOM Based on the received HTML document the browser builds up a model of the document structure, the Document Object Model (DOM) The DOM has a tree structure and each node of the document is represented by an object The browser renders the page…

JavaScript objects

Object An object is a collection of properties A property has a name and a value An object can be seen as associative array (map) where the keys in the array are the names of the object’s properties // Create object as literal const bob…

Finecloud (76)

JavaScript arrays

Array An array combines multiple values in a single variable Arrays are helpful if the number of values is huge or dynamic Each value of an array has a unique numerical index // Normal variables hold exactly one value const colorA = "blue"; const colorB…

JavaScript functions

Function Expression A function expression starts with the keyword function followed by the function arguments in parentheses and the function body in curly braces: const square = function(x) { return x * x; }; console.log(square(4)); // >> 16 Function Scope Each function defines a scope…

JavaScript basics

What JavaScript is A scripting language originally designed for web browsers Object-oriented, however prototype-based and not class-based Supporting first-class functions A multi-paradigm language, supports imperative, object-oriented and functional programming style Untyped Moving from an interpreted language to just-in-time compilation Nowadays used for server-side programming too…

Deploy your Java Web App to Heroku

Requirements and Preparation Unfortunately Heroku currently only Supports Tomcat version 9.x. As a consequence you're not able to use the Java Jakarta Servlets, since they are only supported with Tomcat version 10.x. As a consequence you need to replace all your Jakarta Servlet imports with…

Take care of your SSH identities

Did you know that your ssh Client sends the server all your public keys, one by one, until the server accepts one, when you try to authenticate via public key? Don't believe me? Try it out yourself: ssh whoami.filippo.io Someone could use this to find…

Finecloud (77)

Difference between heap and stack

In this Post I try to explain the difference between the heap and the stack. It's just a very high level amateur explanation, there is a lot more to read and learn about this Topics. This Drawing helps me a lot to understand the basic…

JavaScript arrays

Array An array combines multiple values in a single variable Arrays are helpful if the number of values is huge or dynamic Each value of an array has a unique numerical index // Normal variables hold exactly one value const colorA = "blue"; const colorB…

JavaScript functions

Function Expression A function expression starts with the keyword function followed by the function arguments in parentheses and the function body in curly braces: const square = function(x) { return x * x; }; console.log(square(4)); // >> 16 Function Scope Each function defines a scope…

JavaScript basics

What JavaScript is A scripting language originally designed for web browsers Object-oriented, however prototype-based and not class-based Supporting first-class functions A multi-paradigm language, supports imperative, object-oriented and functional programming style Untyped Moving from an interpreted language to just-in-time compilation Nowadays used for server-side programming too…

Deploy your Java Web App to Heroku

Requirements and Preparation Unfortunately Heroku currently only Supports Tomcat version 9.x. As a consequence you're not able to use the Java Jakarta Servlets, since they are only supported with Tomcat version 10.x. As a consequence you need to replace all your Jakarta Servlet imports with…

Finecloud (76)

Backup OPNsense to Nextcloud

What is OPNsense? OPNsense® is an open source, easy-to-use and easy-to-build FreeBSD based firewall and routing platform. OPNsense includes most of the features available in expensive commercial firewalls, and more in many cases. It brings the rich feature set of commercial offerings with the benefits…

Maven getting started

What is Maven? Declarative build management tool for automated builds Standardized directory structure Declarative dependency management Works with an XML control file (POM - Project Object Model) Open source, written in Java, for Java projects Pure command line tool IDEs offer integration Why Maven? Uniform…

Threema Safe backup to Nextcloud

Did you know that Threema allows you, to backup your Threema app to a custom Threema Safe server? You can for example use your Nextcloud to keep your Threema backups safe. I recommend to create a new Nextcloud user account only for the purpose of…

Handling Exceptions in Web UI

The Issue There is nothing worse than presenting a Java Stacktrace in a WebUI, full of technical Details about your Server environment of the Web App itself: So how can we avoid this? You don't want to share this informations with the users, it would…

Getting stared with the Spring Framework

What is the Spring Framework Spring is the world's most popular Java framework and makes programming Java quicker, easier, and safer for everybody. Spring’s focus on speed, simplicity, and productivity. You can select and generate your Spring Package online: https://start.spring.io/ Lets make a Gradle Project,…

Finecloud (77)

Take care of your SSH identities

Did you know that your ssh Client sends the server all your public keys, one by one, until the server accepts one, when you try to authenticate via public key? Don't believe me? Try it out yourself: ssh whoami.filippo.io Someone could use this to find…

Backup OPNsense to Nextcloud

What is OPNsense? OPNsense® is an open source, easy-to-use and easy-to-build FreeBSD based firewall and routing platform. OPNsense includes most of the features available in expensive commercial firewalls, and more in many cases. It brings the rich feature set of commercial offerings with the benefits…

Maven getting started

What is Maven? Declarative build management tool for automated builds Standardized directory structure Declarative dependency management Works with an XML control file (POM - Project Object Model) Open source, written in Java, for Java projects Pure command line tool IDEs offer integration Why Maven? Uniform…

Threema Safe backup to Nextcloud

Did you know that Threema allows you, to backup your Threema app to a custom Threema Safe server? You can for example use your Nextcloud to keep your Threema backups safe. I recommend to create a new Nextcloud user account only for the purpose of…

Handling Exceptions in Web UI

The Issue There is nothing worse than presenting a Java Stacktrace in a WebUI, full of technical Details about your Server environment of the Web App itself: So how can we avoid this? You don't want to share this informations with the users, it would…

Finecloud (76)

Java and databases use SQL joins

Introduction Let's imagine we have two Tables now, people and addresses. We want to find out how many people live at the same address. This is our current Java and SQL approach: repository/PeopleRepository.java @Override @SQL(value = FIND_BY_ID_SQL, operationType = CrudOperation.FIND_BY_ID) @SQL(value = FIND_ALL_SQL, operationType =…

Java working with databases

Introduction In this Post I will describe how you can easily learn, test and play around with Java interacting with SQL Databases. This post is a summary of my Java learning course I'm taking on udemy. The post is not intended to be spread around…

Infrastructure as Software

Summary This post is my summary (for my own sake) of the original full length post: https://www.justingarrison.com/blog/2022-06-01-infrastructure-as-software/ Writing your infrastructure in a DSL or any other general purpose coding language like Ansible, Pulumi, Terraform is not Infrastructure as Software. Any managed service to deploy infrastructure…

Java basics: Dates and Time

Local date Now Let's start with the basics, we just want to represent the date today and print that local date now: public class TimeTest { public static void main(String[] args) { LocalDate now = LocalDate.now(); System.out.println(now); } } output: 2022-08-29 Process finished with exit…

Java basics: Optionals

What are Optionals? For the the number one use case for them has to do with null values. So whenever we're dealing with objects in Java, we store references to objects in variables. And those variables may or may not actually be pointing back to…

Finecloud (77)

Getting stared with the Spring Framework

What is the Spring Framework Spring is the world's most popular Java framework and makes programming Java quicker, easier, and safer for everybody. Spring’s focus on speed, simplicity, and productivity. You can select and generate your Spring Package online: https://start.spring.io/ Lets make a Gradle Project,…

Java and databases use SQL joins

Introduction Let's imagine we have two Tables now, people and addresses. We want to find out how many people live at the same address. This is our current Java and SQL approach: repository/PeopleRepository.java @Override @SQL(value = FIND_BY_ID_SQL, operationType = CrudOperation.FIND_BY_ID) @SQL(value = FIND_ALL_SQL, operationType =…

Java working with databases

Introduction In this Post I will describe how you can easily learn, test and play around with Java interacting with SQL Databases. This post is a summary of my Java learning course I'm taking on udemy. The post is not intended to be spread around…

Infrastructure as Software

Summary This post is my summary (for my own sake) of the original full length post: https://www.justingarrison.com/blog/2022-06-01-infrastructure-as-software/ Writing your infrastructure in a DSL or any other general purpose coding language like Ansible, Pulumi, Terraform is not Infrastructure as Software. Any managed service to deploy infrastructure…

Java basics: Dates and Time

Local date Now Let's start with the basics, we just want to represent the date today and print that local date now: public class TimeTest { public static void main(String[] args) { LocalDate now = LocalDate.now(); System.out.println(now); } } output: 2022-08-29 Process finished with exit…

Finecloud (76)

Java basics: Generics

What are Generics? What if we could write a single sort method that sort the elements in an Integer array, a String array, or an array of any type that supports ordering? Java Generics enable programmers to specify, with a single method declaration, a set…

Java basics: Exceptions

What are Exceptions? An exception is an event, commonly it is a problem that arises during the execution of a program. When an Exception occurs the normal program is disrupted and the program/Application terminates abnormally, which is not recommended. Unexpected termination of an Application is…

Visualisiere deine Strava Aktivitäten mit Grafana

Was ist Strava Strava ist das soziale Netzwerk für Sportler. Du kannst deine Sport Aktivitäten aufzeichnen und diese wird deinem Strava-Feed hinzugefügt - zusammen mit jenen, die deine Freunde und Followers mit dir teilen. Auf diese Weise könnt ihr eure Wettkampf- und Trainingsaktivitäten gegenseitig verfolgen,…

ShellCheck

Beschreibung ShellCheck ist ein Tool, das Warnungen und Vorschläge für Bash/Sh-Shell-Skripte liefert. Das Tool kann verwendet werden für statische Code Analyse. Idealerweise wird das Tool in einer CI Pipeline integriert. Hier ein Beispiel einer Github Action Pipeline: name: Shellcheck on: pull_request: push: branches: - main…

Imperativ vs. Deklarativ

Dieser Beitrag ist meine Zusammenfassung (in meinem eigenen Interesse) des ursprünglichen Beitrags in voller Länge: https://leebriggs.co.uk/blog/2022/07/20/nobody-knows-what-declarative-is Immer wieder stösst man im Bereich Infrastructure as Code (IaC) auf die Begriffe imperativ und deklarativ. Doch was bedeuten diese Begriffe? Ist Terraform wirklich deklarativ und Ansible nicht? Diese…

Finecloud (77)

Java basics: Optionals

What are Optionals? For the the number one use case for them has to do with null values. So whenever we're dealing with objects in Java, we store references to objects in variables. And those variables may or may not actually be pointing back to…

Java basics: Generics

What are Generics? What if we could write a single sort method that sort the elements in an Integer array, a String array, or an array of any type that supports ordering? Java Generics enable programmers to specify, with a single method declaration, a set…

Java basics: Exceptions

What are Exceptions? An exception is an event, commonly it is a problem that arises during the execution of a program. When an Exception occurs the normal program is disrupted and the program/Application terminates abnormally, which is not recommended. Unexpected termination of an Application is…

Visualisiere deine Strava Aktivitäten mit Grafana

Was ist Strava Strava ist das soziale Netzwerk für Sportler. Du kannst deine Sport Aktivitäten aufzeichnen und diese wird deinem Strava-Feed hinzugefügt - zusammen mit jenen, die deine Freunde und Followers mit dir teilen. Auf diese Weise könnt ihr eure Wettkampf- und Trainingsaktivitäten gegenseitig verfolgen,…

ShellCheck

Beschreibung ShellCheck ist ein Tool, das Warnungen und Vorschläge für Bash/Sh-Shell-Skripte liefert. Das Tool kann verwendet werden für statische Code Analyse. Idealerweise wird das Tool in einer CI Pipeline integriert. Hier ein Beispiel einer Github Action Pipeline: name: Shellcheck on: pull_request: push: branches: - main…

Automatically update the hidden dependencies in your Dockerfiles

You have probably already heard about Renovate - the fantastic tool that helps you to keep your dependencies up to date.

But today, we want to look at an edge case: how to keep your dependencies in your dependencies up to date (also called hidden dependencies)?

Atlassian provides a Confluence image. If you want to run this with an Oracle database, you have to inject the Oracle JDBC driver yourself. But how can you ensure that you automatically always will have the most recent OJDBC driver in your Confluence image? 

FROM atlassian/confluence:8.5.15-ubuntu-jdk17
+
+# Download the ojdbc driver
+RUN curl -fSL "https://repo1.maven.org/maven2/com/oracle/database/jdbc/ojdbc10/19.23.0.0/ojdbc10-19.23.0.0.jar" \
+    -o "${CONFLUENCE_INSTALL_DIR}/confluence/WEB-INF/lib/ojdbc10.jar"
+
+

First of all, let's extract the semantic version tag from the URL into a separate ARG so that Renovate only needs to bump the version there:

FROM atlassian/confluence:8.5.15-ubuntu-jdk17
+
+ARG OJDBC_VERSION=19.24.0.0
+
+# Download the ojdbc driver
+RUN curl -fSL "https://repo1.maven.org/maven2/com/oracle/database/jdbc/ojdbc10/${OJDBC_VERSION}/ojdbc10-${OJDBC_VERSION}.jar" \
+    -o "${CONFLUENCE_INSTALL_DIR}/confluence/WEB-INF/lib/ojdbc10.jar"
+

Next, we will add a comment directly above the ARG OJDBC version, which we will later use to tell Renovate what dependency type and package this version tag is about. It's a maven package with the package name "com.oracle.database.jdbc:ojdbc10":

FROM atlassian/confluence:8.5.15-ubuntu-jdk17
+
+# renovate: datasource=maven depName=com.oracle.database.jdbc:ojdbc10 packageName=com.oracle.database.jdbc:ojdbc10
+ARG OJDBC_VERSION=19.24.0.0
+
+# Download the ojdbc driver
+RUN curl -fSL "https://repo1.maven.org/maven2/com/oracle/database/jdbc/ojdbc10/${OJDBC_VERSION}/ojdbc10-${OJDBC_VERSION}.jar" \
+    -o "${CONFLUENCE_INSTALL_DIR}/confluence/WEB-INF/lib/ojdbc10.jar"

You could write a custom regex manager in the Renovate config that updates this version tag. But what if you have multiple ARG or ENV version tags in multiple Dockerfiles within the same repo? You Probably don't want to write a regex config for each case.

Let's imagine you have something like this in your Dockerfile:

# renovate: datasource=github-tags depName=node packageName=nodejs/node versioning=node
+ENV NODE_VERSION=20.10.0
+# renovate: datasource=github-releases depName=composer packageName=composer/composer
+ENV COMPOSER_VERSION=1.9.3
+# renovate: datasource=docker packageName=docker versioning=docker
+ENV DOCKER_VERSION=19.03.1
+# renovate: datasource=npm packageName=yarn
+ENV YARN_VERSION=1.19.1

All you now need is the following regex configuration in your renovate.json config to detect and bump all of these version tags:

{
+  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
+  "extends": [
+    "config:recommended"
+  ],
+  "separateMinorPatch": true,
+  "customManagers": [
+    {
+      "customType": "regex",
+      "description": "Update _VERSION variables in Dockerfiles",
+      "fileMatch": ["(^|/|\\.)Dockerfile$", "(^|/)Dockerfile\\.[^/]*$"],
+      "matchStrings": [
+        "# renovate: datasource=(?<datasource>[a-z-]+?)(?: depName=(?<depName>.+?))? packageName=(?<packageName>.+?)(?: versioning=(?<versioning>[a-z-]+?))?\\s(?:ENV|ARG) .+?_VERSION=(?<currentValue>.+?)\\s"
+      ]
+    }
+  ]
+}

Now, you could even set up auto merge for these Renovate updates. Make sure you have some merge checks before you enable this. At least you should ensure that the Docker image can still be built before a new Renovate pull request gets auto-merged.

✨ Happy renovating! ✨

\ No newline at end of file diff --git a/feed.json b/feed.json index 67dc639..220548e 100644 --- a/feed.json +++ b/feed.json @@ -9,6 +9,29 @@ "name": "Finecloud" }, "items": [ + { + "id": "https://www.finecloud.ch/automatically-update-hidden-dependencies-in-your-dockerfiles.html", + "url": "https://www.finecloud.ch/automatically-update-hidden-dependencies-in-your-dockerfiles.html", + "title": "Automatically update the hidden dependencies in your Dockerfiles", + "summary": "You have probably already heard about Renovate - the fantastic tool that helps you to keep your dependencies up to date. But today, we want to look at an edge case: how to keep your dependencies in your dependencies up to date (also called hidden…", + "content_html": "\n

\n You have probably already heard about Renovate - the fantastic tool that helps you to keep your dependencies up to date.\n

\n\n

\n But today, we want to look at an edge case: how to keep your dependencies in your dependencies up to date (also called hidden dependencies)?\n

\n\n

\n Atlassian provides a Confluence image. If you want to run this with an Oracle database, you have to inject the Oracle JDBC driver yourself. But how can you ensure that you automatically always will have the most recent OJDBC driver in your Confluence image? \n

\n
FROM atlassian/confluence:8.5.15-ubuntu-jdk17\n\n# Download the ojdbc driver\nRUN curl -fSL \"https://repo1.maven.org/maven2/com/oracle/database/jdbc/ojdbc10/19.23.0.0/ojdbc10-19.23.0.0.jar\" \\\n    -o \"${CONFLUENCE_INSTALL_DIR}/confluence/WEB-INF/lib/ojdbc10.jar\"\n\n
\n\n

\n First of all, let's extract the semantic version tag from the URL into a separate ARG so that Renovate only needs to bump the version there:\n

\n
FROM atlassian/confluence:8.5.15-ubuntu-jdk17\n\nARG OJDBC_VERSION=19.24.0.0\n\n# Download the ojdbc driver\nRUN curl -fSL \"https://repo1.maven.org/maven2/com/oracle/database/jdbc/ojdbc10/${OJDBC_VERSION}/ojdbc10-${OJDBC_VERSION}.jar\" \\\n    -o \"${CONFLUENCE_INSTALL_DIR}/confluence/WEB-INF/lib/ojdbc10.jar\"\n
\n\n

\n Next, we will add a comment directly above the ARG OJDBC version, which we will later use to tell Renovate what dependency type and package this version tag is about. It's a maven package with the package name \"com.oracle.database.jdbc:ojdbc10\":\n

\n
FROM atlassian/confluence:8.5.15-ubuntu-jdk17\n\n# renovate: datasource=maven depName=com.oracle.database.jdbc:ojdbc10 packageName=com.oracle.database.jdbc:ojdbc10\nARG OJDBC_VERSION=19.24.0.0\n\n# Download the ojdbc driver\nRUN curl -fSL \"https://repo1.maven.org/maven2/com/oracle/database/jdbc/ojdbc10/${OJDBC_VERSION}/ojdbc10-${OJDBC_VERSION}.jar\" \\\n    -o \"${CONFLUENCE_INSTALL_DIR}/confluence/WEB-INF/lib/ojdbc10.jar\"
\n\n

\n You could write a custom regex manager in the Renovate config that updates this version tag. But what if you have multiple ARG or ENV version tags in multiple Dockerfiles within the same repo? You Probably don't want to write a regex config for each case.\n

\n\n

\n Let's imagine you have something like this in your Dockerfile:\n

\n
# renovate: datasource=github-tags depName=node packageName=nodejs/node versioning=node\nENV NODE_VERSION=20.10.0\n# renovate: datasource=github-releases depName=composer packageName=composer/composer\nENV COMPOSER_VERSION=1.9.3\n# renovate: datasource=docker packageName=docker versioning=docker\nENV DOCKER_VERSION=19.03.1\n# renovate: datasource=npm packageName=yarn\nENV YARN_VERSION=1.19.1
\n\n

\n All you now need is the following regex configuration in your renovate.json config to detect and bump all of these version tags:\n

\n
{\n  \"$schema\": \"https://docs.renovatebot.com/renovate-schema.json\",\n  \"extends\": [\n    \"config:recommended\"\n  ],\n  \"separateMinorPatch\": true,\n  \"customManagers\": [\n    {\n      \"customType\": \"regex\",\n      \"description\": \"Update _VERSION variables in Dockerfiles\",\n      \"fileMatch\": [\"(^|/|\\\\.)Dockerfile$\", \"(^|/)Dockerfile\\\\.[^/]*$\"],\n      \"matchStrings\": [\n        \"# renovate: datasource=(?<datasource>[a-z-]+?)(?: depName=(?<depName>.+?))? packageName=(?<packageName>.+?)(?: versioning=(?<versioning>[a-z-]+?))?\\\\s(?:ENV|ARG) .+?_VERSION=(?<currentValue>.+?)\\\\s\"\n      ]\n    }\n  ]\n}
\n\n

\n Now, you could even set up auto merge for these Renovate updates. Make sure you have some merge checks before you enable this. At least you should ensure that the Docker image can still be built before a new Renovate pull request gets auto-merged.\n

\n\n

\n ✨ Happy renovating! ✨\n

", + "author": { + "name": "Finecloud" + }, + "tags": [ + "software development", + "renovate", + "regex", + "maven", + "linux", + "docker", + "devops", + "container", + "bash" + ], + "date_published": "2024-09-13T17:23:46+02:00", + "date_modified": "2024-09-13T22:50:31+02:00" + }, { "id": "https://www.finecloud.ch/github-classic-vs-fine-grained-personal-access-tokens.html", "url": "https://www.finecloud.ch/github-classic-vs-fine-grained-personal-access-tokens.html", @@ -163,23 +186,6 @@ ], "date_published": "2023-09-23T13:52:33+02:00", "date_modified": "2023-09-23T13:54:08+02:00" - }, - { - "id": "https://www.finecloud.ch/terraform-tips-and-tricks-2.html", - "url": "https://www.finecloud.ch/terraform-tips-and-tricks-2.html", - "title": "Terraform Tips and Tricks", - "summary": "module \"zland\" { source = \"git::ssh//git@gitlab.com/zland/module.git\" version = \"1.0.5\" servers = 3 } Module Output Values resource \"aws_instance\" \"appserver\" { #... instance = module.servers.instance_ids } Since the resources defined in a module are encapsulated, a calling module cannot access their attributes directly. Instead, the child…", - "content_html": "\n

\n
\n

\n\n
\n

Table of contents

\n \n
\n \n\n

\n Facts about Remote State\n

\n\n \n\n

\n Remote State Storage support\n

\n\n \n\n

\n Separate Environments\n

\n\n
    \n
  1. It is good practice to separate your Terraform configurations per environment.
  2. Separate environments help with code organization, as well as allowing for better and easier CI and automation integration.
  3. Implementing a one-folder-per-environment pattern lets you copy and paste Terraform code from one folder to another. This, used with variables, allows you to quickly change only what is needed per environment.
  4. \n
\n\n
\n \"\"\n \n
\n\n

\n Use Modules\n

\n\n
    \n
  1. Modules are containers for multiple resources that are used together.
  2. Every Terraform configuration contains at least one module.
  3. Modules can call other modules. This lets you include a module’s resources in a configuration in a concise way.
  4. Modules can be called multiple times, either in the same Terraform configuration or in separate ones. This allows for resource configurations to be packaged and reused.
  5. \n
\n\n

\n Arguments to use with Modules\n

\n\n \n
module \"zland\" {\n  source = \"git::ssh//git@gitlab.com/zland/module.git\"\n  version = \"1.0.5\"\n  servers = 3\n}
\n\n

\n Module Output Values
\n

\n
resource \"aws_instance\" \"appserver\" {\n    #...\n    instance = module.servers.instance_ids\n}
\n\n

\n Since the resources defined in a module are encapsulated, a calling module cannot access their attributes directly. Instead, the child module can declare output values.\n

\n\n

\n Create a custom Module (Example)\n

\n\n

\n Create those files in the folder modules/ec2:

main.tf\n

\n
resource \"aws_instance\" \"app_server\" {\n  ami           = \"DUMMY_VALUE_AMI\"\n  instance_type = \"t3.micro\"\n  subnet_id     = \"DUMMY_VALUE_SUBNET_ID\"\n  tags = {\n    Name = \"WayneCorp\"\n  }\n}\n
\n\n

\n outputs.tf\n

\n
output \"instance_id\" {\n  description = \"ID of the EC2 instance\"\n  value       = aws_instance.app_server.id\n}\n\noutput \"instance_public_ip\" {\n  description = \"Public IP address of the EC2 instance\"\n  value       = aws_instance.app_server.public_ip\n}
\n\n

\n to use your module, add this snippet at the end of you existing ec2.tf file:

existing ec2.tf:\n

\n
terraform {\n  required_providers {\n    aws = {\n      source  = \"hashicorp/aws\"\n      version = \"~> 3.27\"\n    }\n  }\n  required_version = \">= 0.14.9\"\n}\nprovider \"aws\" {\n  profile = \"default\"\n  region  = \"us-east-1\"\n}
\n\n

\n new content to add:\n

\n
module \"ec2-module\" {\n  source = \"./modules/ec2/\"\n}\n
\n\n

\n now you can run a terraform fmt to format your code.

Now run a terraform init to initialize your terraform backend

run a terraform validate to make sure syntax is correct

finally run a terraform plan and if your happy with the output a terraform apply

To check your state you can now run terraform show or aws ec2 describe-instances\n

\n\n

\n Don’t Repeat Yourself\n

\n\n \n\n

\n Not Keeping It DRY looks like this:\n

\n\n
\n \"\"\n \n
\n\n

\n Keeping it DRY on the oder hand look like this:\n

\n\n
\n \"\"\n \n
\n\n

\n the configurations are symlinked here, this allows us to share the same configurations between those environments\n

\n\n

\n 3 Things to Use to Keep It DRY\n

\n\n \n\n

\n Conditional Example\n

\n
locals {\n  make_bucket = \"${var.create_bucket == \"true\" ? True : false}\"\n}\nresource \"google_storage_bucket” “twinkiebucket\" {\n  count = \"${local.make_bucket ? 1 : 0}\"\n  name = \"${var.bucket_name}\"\n  project = \"${var.project_name}\"\n}
\n\n

\n The create_bucket=false Conditional\n

\n\n

\n output:\n

\n\n

\n —> test-bucket terraform plan -var=‘create_bucket=false’
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be Persisted to local or remote state storage.\n

\n\n

\n No changes. Infrastructure is up-to-date.

This means that Terraform did not detect any differences between your configuration and real physical resources that exist. As a result, no actions need to be performed.\n

\n\n

\n The create_bucket=true Conditional\n

\n\n

\n output:\n

\n\n

\n —> test-bucket terraform plan -var=‘create_bucket=true’
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be Persisted to local or remote state storage.

An execution plan has been generated and is shown below. Resource actions are indicated with the following symbols:

+ create
Terraform will perform the following actions:

+ google_storage_bucket.twinkiebucket ...\n

\n\n

\n Use null_resource\n

\n\n \n\n

\n Example null_resource\n

\n
resource \"aws_instance\" \"prod_cluster\" {\n    count = 4\n    #...\n}\nresource \"null_resource\" \"prod_cluster\" {\n    triggers = {\n        cluster_instance_ids = join(\",\" aws_instance.prod_cluster.*.id)\n    }\n    connection {\n        host = element(aws_instance.prod_cluster.*.public_ip, 0)\n    }\n    provisioner \"remote-exec\" {\n        inline = [\n            \"prod_cluster.sh ${join(\" \", aws_instance.prod_cluster.*.private_ip)}\",\n        ]\n    }\n}\n
\n\n

\n Actions that are done inside a null_resource are not managed by Terraform. If you decide to call a command to create resources in your null_resource, Terraform will not know about the resource creation, and therefore can’t manage its lifecycle and state.\n

\n\n

\n you could for example add those lines to your main.tf:\n

\n
resource \"null_resource\" \"ec2_status\" {\n  provisioner \"local-exec\" {\n    command = \"./scripts/health.sh\"\n  }\n}\n
\n\n

\n and add the health.sh script to your repository:\n

\n
#!/bin/bash\necho \"   -------------------------------- \"\necho \"  --> Fetching Instance status.\"\nsleep 25\ninstance_id=$(aws ec2 describe-instances --filters \"Name=tag:Name,Values=TheFastestManAlive\" \"Name=instance-state-name,Values=running\" --query 'Reservations[*].Instances[*].InstanceId' --output text)\nsize=${#instance_id}\necho \"  --> Instance ID: $instance_id\"\nsleep 2\ninstance_state=$(aws ec2 describe-instance-status --instance-ids $instance_id --query 'InstanceStatuses[*].InstanceState.Name' --output text)\nsize=${#instance_state}\necho \"  --> Instance Status: $instance_state\"\nsleep 2\ninstance_zone=$(aws ec2 describe-instance-status --instance-ids $instance_id --query 'InstanceStatuses[*].AvailabilityZone' --output text)\nsize=${#instance_zone}\necho \"  --> Availability Zone: $instance_zone\"\nsleep 2\nfetch_instance_health=$(aws ec2 describe-instance-status --instance-ids $instance_id --query 'InstanceStatuses[*].InstanceStatus.Status' --output text)\necho \"  --> Instance health check : $fetch_instance_health\"\necho \"  -------------------------------------------\"
\n\n

\n do run some trivial heal check after the deployment of our EC2 instance.\n

\n\n

\n Use Functions\n

\n\n \n\n

\n The format Function\n

\n
#format.tf\nlocals {\nhostname = \"${format(\"%s-%s-%s-%s-%04d-%s\", var.region, var.env, var.app,\nvar.type, var.cluster_id, var.id)}\" }
\n\n

\n this Terraform code defines a local variable named hostname using the locals block. This variable is computed using the `format` function and a string template. Let's break down the components of this function:

1. `${format(...)}:` This part of the code is using Terraform's interpolation syntax `${...}` to execute the `format` function. The `format` function is used to create formatted strings by substituting values into placeholders within a template string.

2. `\"${format(\"%s-%s-%s-%s-%04d-%s\", var.region, var.env, var.app, var.type, var.cluster_id, var.id)}\"`: This is the template string used in the `format` function. It consists of several placeholders, each represented by `%s` or `%04d`, which are replaced by the values provided after the template string.\n

\n\n \n\n

\n The values to be substituted into these placeholders come from various Terraform variables:\n

\n\n \n\n

\n The `format` function combines these values using the specified template to generate a formatted hostname. The resulting hostname will be a string that includes the region, environment, application, type, cluster identifier (with leading zeros if necessary), and the additional identifier provided by `var.id`.

For example, if you have the following values for your variables:\n

\n\n \n\n

\n The `hostname` variable will be computed as follows:
\n

\n
us-west-prod-web-frontend-0042-abc123
\n\n

\n This computed hostname can then be used in your Terraform configuration as needed, such as for provisioning cloud resources with this specific hostname format.\n

\n\n

\n The matchkeys Function\n

\n\n

\n matchkeys constructs a new list by taking a subset of elements from one list whose indexes match the corresponding indexes of values in another list.

matchkeys identifies the indexes in keyslist that are equal to elements of searchset, and then constructs a new list by taking those same indexes from valueslist. Both valueslist and keyslist must be the same length.

The ordering of the values in valueslist is preserved in the result.\n

\n
#matchkeys.tf\ninstances = [ \"${matchkeys(\n  google_compute_instance.compute_instance.*.self_link,\n  google_compute_instance.compute_instance.*.zone,\n  data.google_compute_zones.available.names[0])\n}\" ]
\n\n

\n The element Function\n

\n\n

\n The `element` function in Terraform is primarily used for accessing elements within a list or an array. It's a versatile function that can be used for various purposes, including:\n

\n\n
    \n
  1. Retrieving Values: You can use `element` to retrieve specific values from a list or array. For example, you might use it to access the nth element of a list.
  2. Looping and Iteration: When combined with other Terraform constructs like `count` or `for_each`, `element` can be used to iterate over a list or array, applying the same resource configuration or operation to each element.
  3. Dynamic Resource Creation: In Terraform, you can use `element` to dynamically create multiple instances of a resource by specifying different configurations for each instance based on the elements of a list or array.
  4. Conditional Behavior: It can be used to conditionally set values or attributes in resources or variables based on the index of an element in a list.
  5. \n
\n\n

\n Here's an example of how you might use the `element` function in a Terraform configuration:\n

\n
variable \"server_names\" {\n  type    = list(string)\n  default = [\"web-server-1\", \"web-server-2\", \"web-server-3\"]\n}\n\nresource \"aws_instance\" \"example\" {\n  count = length(var.server_names)\n  ami   = \"ami-12345678\"\n  instance_type = \"t2.micro\"\n  tags = {\n    Name = element(var.server_names, count.index)\n  }\n}\n
\n\n

\n In this example, the `element` function is used to assign a unique name tag to each AWS EC2 instance being created based on the elements of the \"server_names\" list. It demonstrates how `element` can be used for dynamic resource creation and conditional behavior.

Overall, the `element` function is a fundamental tool in Terraform for working with lists and arrays, enabling you to make your configurations more dynamic and flexible.\n

\n\n

\n Test Your Code\n

\n\n \n\n

\n there are a few built-in commands to test your TF code:\n

\n\n
    \n
  1. terraform fmt
  2. terraform init
  3. terraform validate
  4. terraform plan
  5. \n
\n\n

\n Other Testing Tools\n

\n\n ", - "author": { - "name": "Finecloud" - }, - "tags": [ - "terraform", - "iac", - "devops" - ], - "date_published": "2023-09-17T14:14:00+02:00", - "date_modified": "2023-09-18T17:11:41+02:00" } ] } diff --git a/feed.xml b/feed.xml index 5f262e4..daf6793 100644 --- a/feed.xml +++ b/feed.xml @@ -3,12 +3,128 @@ Finecloud - 2024-08-05T20:11:49+02:00 + 2024-09-13T22:50:31+02:00 Finecloud https://www.finecloud.ch + + Automatically update the hidden dependencies in your Dockerfiles + + Finecloud + + + https://www.finecloud.ch/automatically-update-hidden-dependencies-in-your-dockerfiles.html + + + + + + + + + + + 2024-09-13T17:23:46+02:00 + + + + + + You have probably already heard about Renovate - the fantastic tool that helps you to keep your dependencies up to date. +

+ +

+ But today, we want to look at an edge case: how to keep your dependencies in your dependencies up to date (also called hidden dependencies)? +

+ +

+ Atlassian provides a Confluence image. If you want to run this with an Oracle database, you have to inject the Oracle JDBC driver yourself. But how can you ensure that you automatically always will have the most recent OJDBC driver in your Confluence image?  +

+
FROM atlassian/confluence:8.5.15-ubuntu-jdk17
+
+# Download the ojdbc driver
+RUN curl -fSL "https://repo1.maven.org/maven2/com/oracle/database/jdbc/ojdbc10/19.23.0.0/ojdbc10-19.23.0.0.jar" \
+    -o "${CONFLUENCE_INSTALL_DIR}/confluence/WEB-INF/lib/ojdbc10.jar"
+
+
+ +

+ First of all, let's extract the semantic version tag from the URL into a separate ARG so that Renovate only needs to bump the version there: +

+
FROM atlassian/confluence:8.5.15-ubuntu-jdk17
+
+ARG OJDBC_VERSION=19.24.0.0
+
+# Download the ojdbc driver
+RUN curl -fSL "https://repo1.maven.org/maven2/com/oracle/database/jdbc/ojdbc10/${OJDBC_VERSION}/ojdbc10-${OJDBC_VERSION}.jar" \
+    -o "${CONFLUENCE_INSTALL_DIR}/confluence/WEB-INF/lib/ojdbc10.jar"
+
+ +

+ Next, we will add a comment directly above the ARG OJDBC version, which we will later use to tell Renovate what dependency type and package this version tag is about. It's a maven package with the package name "com.oracle.database.jdbc:ojdbc10": +

+
FROM atlassian/confluence:8.5.15-ubuntu-jdk17
+
+# renovate: datasource=maven depName=com.oracle.database.jdbc:ojdbc10 packageName=com.oracle.database.jdbc:ojdbc10
+ARG OJDBC_VERSION=19.24.0.0
+
+# Download the ojdbc driver
+RUN curl -fSL "https://repo1.maven.org/maven2/com/oracle/database/jdbc/ojdbc10/${OJDBC_VERSION}/ojdbc10-${OJDBC_VERSION}.jar" \
+    -o "${CONFLUENCE_INSTALL_DIR}/confluence/WEB-INF/lib/ojdbc10.jar"
+ +

+ You could write a custom regex manager in the Renovate config that updates this version tag. But what if you have multiple ARG or ENV version tags in multiple Dockerfiles within the same repo? You Probably don't want to write a regex config for each case. +

+ +

+ Let's imagine you have something like this in your Dockerfile: +

+
# renovate: datasource=github-tags depName=node packageName=nodejs/node versioning=node
+ENV NODE_VERSION=20.10.0
+# renovate: datasource=github-releases depName=composer packageName=composer/composer
+ENV COMPOSER_VERSION=1.9.3
+# renovate: datasource=docker packageName=docker versioning=docker
+ENV DOCKER_VERSION=19.03.1
+# renovate: datasource=npm packageName=yarn
+ENV YARN_VERSION=1.19.1
+ +

+ All you now need is the following regex configuration in your renovate.json config to detect and bump all of these version tags: +

+
{
+  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
+  "extends": [
+    "config:recommended"
+  ],
+  "separateMinorPatch": true,
+  "customManagers": [
+    {
+      "customType": "regex",
+      "description": "Update _VERSION variables in Dockerfiles",
+      "fileMatch": ["(^|/|\\.)Dockerfile$", "(^|/)Dockerfile\\.[^/]*$"],
+      "matchStrings": [
+        "# renovate: datasource=(?<datasource>[a-z-]+?)(?: depName=(?<depName>.+?))? packageName=(?<packageName>.+?)(?: versioning=(?<versioning>[a-z-]+?))?\\s(?:ENV|ARG) .+?_VERSION=(?<currentValue>.+?)\\s"
+      ]
+    }
+  ]
+}
+ +

+ Now, you could even set up auto merge for these Renovate updates. Make sure you have some merge checks before you enable this. At least you should ensure that the Docker image can still be built before a new Renovate pull request gets auto-merged. +

+ +

+ ✨ Happy renovating! ✨ +

+ ]]> +
+
GitHub classic vs. fine-grained Personal Access Tokens @@ -1478,429 +1594,4 @@ Response: ]]> - - Terraform Tips and Tricks - - Finecloud - - - https://www.finecloud.ch/terraform-tips-and-tricks-2.html - - - - - 2023-09-17T14:14:00+02:00 - - - - - -
-

- -
-

Table of contents

- -
- - -

- Facts about Remote State -

- -
    -
  • Remote state is not the default; you must specify which backend to use and configure it to be used.
  • Remote state can be used by multiple team members. Terraform will write state data to a remote data store that users with access can use so there aren’t multiple state files.
  • Remote state uses a backend, which is configured in your configuration’s root module.
  • Remote state allows you to share output values with other configurations. Those configurations can then consume the exposed outputs in additional configurations.
  • -
- -

- Remote State Storage support -

- -
    -
  • Terraform Cloud
  • HashiCorp Consul
  • Amazon S3
  • Azure Blob Storage
  • Google Cloud Storage
  • Alibaba Cloud OSS
  • ...and more
  • -
- -

- Separate Environments -

- -
    -
  1. It is good practice to separate your Terraform configurations per environment.
  2. Separate environments help with code organization, as well as allowing for better and easier CI and automation integration.
  3. Implementing a one-folder-per-environment pattern lets you copy and paste Terraform code from one folder to another. This, used with variables, allows you to quickly change only what is needed per environment.
  4. -
- -
- - -
- -

- Use Modules -

- -
    -
  1. Modules are containers for multiple resources that are used together.
  2. Every Terraform configuration contains at least one module.
  3. Modules can call other modules. This lets you include a module’s resources in a configuration in a concise way.
  4. Modules can be called multiple times, either in the same Terraform configuration or in separate ones. This allows for resource configurations to be packaged and reused.
  5. -
- -

- Arguments to use with Modules -

- -
    -
  • source: This argument is mandatory for all modules.
  • version: This argument is recommended for modules from a registry.
  • meta-arguments: Arguments like for_each and count.
  • input variables: Most other arguments correspond to input variables.
  • -
-
module "zland" {
-  source = "git::ssh//git@gitlab.com/zland/module.git"
-  version = "1.0.5"
-  servers = 3
-}
- -

- Module Output Values
-

-
resource "aws_instance" "appserver" {
-    #...
-    instance = module.servers.instance_ids
-}
- -

- Since the resources defined in a module are encapsulated, a calling module cannot access their attributes directly. Instead, the child module can declare output values. -

- -

- Create a custom Module (Example) -

- -

- Create those files in the folder modules/ec2:

main.tf -

-
resource "aws_instance" "app_server" {
-  ami           = "DUMMY_VALUE_AMI"
-  instance_type = "t3.micro"
-  subnet_id     = "DUMMY_VALUE_SUBNET_ID"
-  tags = {
-    Name = "WayneCorp"
-  }
-}
-
- -

- outputs.tf -

-
output "instance_id" {
-  description = "ID of the EC2 instance"
-  value       = aws_instance.app_server.id
-}
-
-output "instance_public_ip" {
-  description = "Public IP address of the EC2 instance"
-  value       = aws_instance.app_server.public_ip
-}
- -

- to use your module, add this snippet at the end of you existing ec2.tf file:

existing ec2.tf: -

-
terraform {
-  required_providers {
-    aws = {
-      source  = "hashicorp/aws"
-      version = "~> 3.27"
-    }
-  }
-  required_version = ">= 0.14.9"
-}
-provider "aws" {
-  profile = "default"
-  region  = "us-east-1"
-}
- -

- new content to add: -

-
module "ec2-module" {
-  source = "./modules/ec2/"
-}
-
- -

- now you can run a terraform fmt to format your code.

Now run a terraform init to initialize your terraform backend

run a terraform validate to make sure syntax is correct

finally run a terraform plan and if your happy with the output a terraform apply

To check your state you can now run terraform show or aws ec2 describe-instances -

- -

- Don’t Repeat Yourself -

- -
    -
  • DRY is a principle that promotes modularization, abstraction, and code reuse and discourages repetition.
  • This principle states that “every piece of knowledge must have a single, unambiguous, authoritative representation within a system”.
  • This principle can be applied to not only programming, but to database schemas, test plans, the build system, and even documentation.
  • If applied successfully, a modification of a single piece of the system will not require a change in other logic or unrelated elements of the system.
  • -
- -

- Not Keeping It DRY looks like this: -

- -
- - -
- -

- Keeping it DRY on the oder hand look like this: -

- -
- - -
- -

- the configurations are symlinked here, this allows us to share the same configurations between those environments -

- -

- 3 Things to Use to Keep It DRY -

- -
    -
  • Terraform supports conditionals through the syntax of a ternary operator.
  • The most common use case for conditionals is to create a conditional resource based on an input variable and the meta-parameter count.
  • -
- -

- Conditional Example -

-
locals {
-  make_bucket = "${var.create_bucket == "true" ? True : false}"
-}
-resource "google_storage_bucket” “twinkiebucket" {
-  count = "${local.make_bucket ? 1 : 0}"
-  name = "${var.bucket_name}"
-  project = "${var.project_name}"
-}
- -

- The create_bucket=false Conditional -

- -

- output: -

- -

- —> test-bucket terraform plan -var=‘create_bucket=false’
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be Persisted to local or remote state storage. -

- -

- No changes. Infrastructure is up-to-date.

This means that Terraform did not detect any differences between your configuration and real physical resources that exist. As a result, no actions need to be performed. -

- -

- The create_bucket=true Conditional -

- -

- output: -

- -

- —> test-bucket terraform plan -var=‘create_bucket=true’
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be Persisted to local or remote state storage.

An execution plan has been generated and is shown below. Resource actions are indicated with the following symbols:

+ create
Terraform will perform the following actions:

+ google_storage_bucket.twinkiebucket ... -

- -

- Use null_resource -

- -
    -
  • The null_resource is useful when you need to do something that is not directly associated with the lifecycle of an actual resource.
  • Within a null_resource, you can configure provisioners to run scripts to do pretty much whatever you want.
  • Just like with provisioners, it is a good idea to use null_resource sparingly since it adds to the complexity of your Terraform usage.
  • Make sure, when you do use it, that you vet the scripts being called thoroughly.
  • -
- -

- Example null_resource -

-
resource "aws_instance" "prod_cluster" {
-    count = 4
-    #...
-}
-resource "null_resource" "prod_cluster" {
-    triggers = {
-        cluster_instance_ids = join("," aws_instance.prod_cluster.*.id)
-    }
-    connection {
-        host = element(aws_instance.prod_cluster.*.public_ip, 0)
-    }
-    provisioner "remote-exec" {
-        inline = [
-            "prod_cluster.sh ${join(" ", aws_instance.prod_cluster.*.private_ip)}",
-        ]
-    }
-}
-
- -

- Actions that are done inside a null_resource are not managed by Terraform. If you decide to call a command to create resources in your null_resource, Terraform will not know about the resource creation, and therefore can’t manage its lifecycle and state. -

- -

- you could for example add those lines to your main.tf: -

-
resource "null_resource" "ec2_status" {
-  provisioner "local-exec" {
-    command = "./scripts/health.sh"
-  }
-}
-
- -

- and add the health.sh script to your repository: -

-
#!/bin/bash
-echo "   -------------------------------- "
-echo "  --> Fetching Instance status."
-sleep 25
-instance_id=$(aws ec2 describe-instances --filters "Name=tag:Name,Values=TheFastestManAlive" "Name=instance-state-name,Values=running" --query 'Reservations[*].Instances[*].InstanceId' --output text)
-size=${#instance_id}
-echo "  --> Instance ID: $instance_id"
-sleep 2
-instance_state=$(aws ec2 describe-instance-status --instance-ids $instance_id --query 'InstanceStatuses[*].InstanceState.Name' --output text)
-size=${#instance_state}
-echo "  --> Instance Status: $instance_state"
-sleep 2
-instance_zone=$(aws ec2 describe-instance-status --instance-ids $instance_id --query 'InstanceStatuses[*].AvailabilityZone' --output text)
-size=${#instance_zone}
-echo "  --> Availability Zone: $instance_zone"
-sleep 2
-fetch_instance_health=$(aws ec2 describe-instance-status --instance-ids $instance_id --query 'InstanceStatuses[*].InstanceStatus.Status' --output text)
-echo "  --> Instance health check : $fetch_instance_health"
-echo "  -------------------------------------------"
- -

- do run some trivial heal check after the deployment of our EC2 instance. -

- -

- Use Functions -

- -
    -
  • Terraform has built-in interpolation functions that allow you to use interpolation syntax embedded within strings to interpolate other values.
  • Interpolationfunctionsarecalledwiththesyntax${name(arg, arg2, ...)}.
  • The interpolation syntax allows you to call a large list of built-in functions.
  • -
- -

- The format Function -

-
#format.tf
-locals {
-hostname = "${format("%s-%s-%s-%s-%04d-%s", var.region, var.env, var.app,
-var.type, var.cluster_id, var.id)}" }
- -

- this Terraform code defines a local variable named hostname using the locals block. This variable is computed using the `format` function and a string template. Let's break down the components of this function:

1. `${format(...)}:` This part of the code is using Terraform's interpolation syntax `${...}` to execute the `format` function. The `format` function is used to create formatted strings by substituting values into placeholders within a template string.

2. `"${format("%s-%s-%s-%s-%04d-%s", var.region, var.env, var.app, var.type, var.cluster_id, var.id)}"`: This is the template string used in the `format` function. It consists of several placeholders, each represented by `%s` or `%04d`, which are replaced by the values provided after the template string. -

- -
    -
  • `%s`: This is a placeholder for a string value.
  • `%04d`: This is a placeholder for a decimal integer value, formatted with leading zeros to ensure a total width of 4 characters.
  • -
- -

- The values to be substituted into these placeholders come from various Terraform variables: -

- -
    -
  • `var.region`: This variable is expected to contain a string representing a region.
  • `var.env`: This variable is expected to contain a string representing an environment.
  • `var.app`: This variable is expected to contain a string representing an application name.
  • `var.type`: This variable is expected to contain a string representing a type.
  • `var.cluster_id`: This variable is expected to contain a numeric cluster identifier.
  • `var.id`: This variable is expected to contain a string or value that is used in the formatted hostname.
  • -
- -

- The `format` function combines these values using the specified template to generate a formatted hostname. The resulting hostname will be a string that includes the region, environment, application, type, cluster identifier (with leading zeros if necessary), and the additional identifier provided by `var.id`.

For example, if you have the following values for your variables: -

- -
    -
  • `var.region` = "us-west"
  • `var.env` = "prod"
  • `var.app` = "web"
  • `var.type` = "frontend"
  • `var.cluster_id` = 42
  • `var.id` = "abc123"
  • -
- -

- The `hostname` variable will be computed as follows:
-

-
us-west-prod-web-frontend-0042-abc123
- -

- This computed hostname can then be used in your Terraform configuration as needed, such as for provisioning cloud resources with this specific hostname format. -

- -

- The matchkeys Function -

- -

- matchkeys constructs a new list by taking a subset of elements from one list whose indexes match the corresponding indexes of values in another list.

matchkeys identifies the indexes in keyslist that are equal to elements of searchset, and then constructs a new list by taking those same indexes from valueslist. Both valueslist and keyslist must be the same length.

The ordering of the values in valueslist is preserved in the result. -

-
#matchkeys.tf
-instances = [ "${matchkeys(
-  google_compute_instance.compute_instance.*.self_link,
-  google_compute_instance.compute_instance.*.zone,
-  data.google_compute_zones.available.names[0])
-}" ]
- -

- The element Function -

- -

- The `element` function in Terraform is primarily used for accessing elements within a list or an array. It's a versatile function that can be used for various purposes, including: -

- -
    -
  1. Retrieving Values: You can use `element` to retrieve specific values from a list or array. For example, you might use it to access the nth element of a list.
  2. Looping and Iteration: When combined with other Terraform constructs like `count` or `for_each`, `element` can be used to iterate over a list or array, applying the same resource configuration or operation to each element.
  3. Dynamic Resource Creation: In Terraform, you can use `element` to dynamically create multiple instances of a resource by specifying different configurations for each instance based on the elements of a list or array.
  4. Conditional Behavior: It can be used to conditionally set values or attributes in resources or variables based on the index of an element in a list.
  5. -
- -

- Here's an example of how you might use the `element` function in a Terraform configuration: -

-
variable "server_names" {
-  type    = list(string)
-  default = ["web-server-1", "web-server-2", "web-server-3"]
-}
-
-resource "aws_instance" "example" {
-  count = length(var.server_names)
-  ami   = "ami-12345678"
-  instance_type = "t2.micro"
-  tags = {
-    Name = element(var.server_names, count.index)
-  }
-}
-
- -

- In this example, the `element` function is used to assign a unique name tag to each AWS EC2 instance being created based on the elements of the "server_names" list. It demonstrates how `element` can be used for dynamic resource creation and conditional behavior.

Overall, the `element` function is a fundamental tool in Terraform for working with lists and arrays, enabling you to make your configurations more dynamic and flexible. -

- -

- Test Your Code -

- -
    -
  • Testing code leads to greater confidence that the code will perform as expected.
  • Terraform has built-in tools to help test your code before deployment.
  • Due to Terraform’s usefulness and popularity, there are many tools which expand upon the built-in tools.
  • -
- -

- there are a few built-in commands to test your TF code: -

- -
    -
  1. terraform fmt
  2. terraform init
  3. terraform validate
  4. terraform plan
  5. -
- -

- Other Testing Tools -

- -
    -
  • Terratest: A great, comprehensive tool by Gruntwork. This tool does not do unit testing.
  • Kitchen-Terraform: Spins up, tests, and spins down various Terraform resources.
  • Terraform-compliance: A simple tool for testing and enforcing Terraform compliance rules.
  • -
- ]]> -
-
diff --git a/github-classic-vs-fine-grained-personal-access-tokens.html b/github-classic-vs-fine-grained-personal-access-tokens.html index 844d546..e0d0fd5 100644 --- a/github-classic-vs-fine-grained-personal-access-tokens.html +++ b/github-classic-vs-fine-grained-personal-access-tokens.html @@ -4,7 +4,7 @@ .tg th{border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px; font-weight:normal;overflow:hidden;padding:10px 5px;word-break:normal;} .tg .tg-wp8o{text-align:center;vertical-align:top} -.tg .tg-73oq{text-align:left;vertical-align:top}
Classic PATFine-grained PAT
write access for public repositories that are not owned by you or an organization that you are not a member of
Outside collaborators can access organization repositories that they are a collaborator on.
Can be used with all REST API endpoints
Feature release statusstablebeta
Tokens must have an expiration date
Token can inherit all permissions of the User, incl. all repositories
within the organizations that the user has access to without any
approval/reivew
Token permissions can be defined set on repository level (fine-grained)
Organization owners can prevent token from accessing resources owned by the organization
Organization owners can require approval for each token that can access
the organization (e.g. internal Repo) from externally without any other
auth requirement

Finecloud

My public notes about various information technology topics... 

GitHub classic vs. fine-grained Personal Access Tokens

What are PATs? Personal access tokens are an alternative to using passwords for authentication to GitHub when using the GitHub API or the command line. Personal access tokens are intended to access GitHub resources on your behalf. To access resources on behalf of an organization,…

Continue reading...

GitHub Codespace

What is a Codespace? A codespace is a development environment that's hosted in the cloud. You can customize your project for GitHub Codespaces by committing configuration files to your repository (also known as configuration-as-code), which creates a repeatable codespace configuration for all users of your…

Continue reading...

Awk and Sed

awk and sed are text manipulation programs. You can use them for example to replace strings: echo image.jpg | sed 's/\.jpg/.png/' image.png or change order of strings: echo "hello world" | awk '{print $2, $1}' world hello awk and sed are harder to learn than…

Continue reading...

How to do a code review

This Blog post is my personal summary of Googles code review process Make sure to review every line of code you’ve been asked to review, look at the context, make sure you’re improving code health, and compliment developers on good things that they do. Look at…

Continue reading...

Finecloud

My public notes about various information technology topics... 

GitHub classic vs. fine-grained Personal Access Tokens

What are PATs? Personal access tokens are an alternative to using passwords for authentication to GitHub when using the GitHub API or the command line. Personal access tokens are intended to access GitHub resources on your behalf. To access resources on behalf of an organization,…

Continue reading...

GitHub Codespace

What is a Codespace? A codespace is a development environment that's hosted in the cloud. You can customize your project for GitHub Codespaces by committing configuration files to your repository (also known as configuration-as-code), which creates a repeatable codespace configuration for all users of your…

Continue reading...

Awk and Sed

awk and sed are text manipulation programs. You can use them for example to replace strings: echo image.jpg | sed 's/\.jpg/.png/' image.png or change order of strings: echo "hello world" | awk '{print $2, $1}' world hello awk and sed are harder to learn than…

Continue reading...

Finecloud

My public notes about various information technology topics... 

Monitor Proxmox mit Grafana und Prometheus

Obwohl Proxmox selbst ja sehr gute Monitoring Informationen direkt auf dem eigenen WebUI anzeigt werde ich um Grafana und Prometheus besser kennen zu lernen diese Tools nutzen um meinen Proxmox Host zu überwachen. Mit der Open-Source-Software von Grafana kann man Metriken, Protokolle und Ablaufverfolgungen, visualisieren,…

Continue reading...

Capture Groups in Java

Capture Groups Im letzten Post haben wir einen kleinen Einstieg in Regex mit Java gemacht. Nun sehen wir uns an, wie man Regex Pattern in Java mittels Capture Groups anwenden kann: String regex = "(1[-.\\s])?(\\d{3}[-.\\s]?)(\\d{3}[-.\\s]?)\\d{4}"; String phoneNumber = "12.523.231.4234"; Pattern pat = Pattern.compile(regex); Matcher mat =…

Continue reading...

Einstieg in Regex mit Java

Was ist Regex? Regex steht für Regular expressions und ist eine Technik, Technologie und Sprache an und für sich, die verwendet werden kann zum Ausdrücken von Textmustern mit Symbolen. Und diese Symbole sind selbst Text. Damit lassen wir verschiedene Textteile und Zeichen andere Textfolgen darstellen. In…

Continue reading...

Java Access-Modifier

Sobald ein Feld sichtbar ist, bedeutet das auch, das es gelesen und beschrieben werden kann. Die Access-Modifier steuern, von wo auf Felder und Methoden eines Objekts zugegriffen werden kann: Modifier Wer darf zugreifen? public Auf public-Objekte/Felder und Methoden darf ohne Einschränkungen von überall aus zugegriffen…

Continue reading...

Java Namenskonventionen

In diesem Blog fasse ich die Java Namenskonventionen kurz zusammen: Typ Namenskonvention Beispiele Class Sollte mit Grossbuchstaben beginnen und sollte ein Substantiv wie Farbe, Knopf, System, Faden usw. sein. Verwenden Sie geeignete Wörter anstelle von Akronymen. public class Employee { //code snippet } Interface Sollte…

Continue reading...

Finecloud

My public notes about various information technology topics... 

Imperativ vs. Deklarativ

Dieser Beitrag ist meine Zusammenfassung (in meinem eigenen Interesse) des ursprünglichen Beitrags in voller Länge: https://leebriggs.co.uk/blog/2022/07/20/nobody-knows-what-declarative-is Immer wieder stösst man im Bereich Infrastructure as Code (IaC) auf die Begriffe imperativ und deklarativ. Doch was bedeuten diese Begriffe? Ist Terraform wirklich deklarativ und Ansible nicht? Diese…

Continue reading...

Monitor Proxmox mit Grafana und Prometheus

Obwohl Proxmox selbst ja sehr gute Monitoring Informationen direkt auf dem eigenen WebUI anzeigt werde ich um Grafana und Prometheus besser kennen zu lernen diese Tools nutzen um meinen Proxmox Host zu überwachen. Mit der Open-Source-Software von Grafana kann man Metriken, Protokolle und Ablaufverfolgungen, visualisieren,…

Continue reading...

Capture Groups in Java

Capture Groups Im letzten Post haben wir einen kleinen Einstieg in Regex mit Java gemacht. Nun sehen wir uns an, wie man Regex Pattern in Java mittels Capture Groups anwenden kann: String regex = "(1[-.\\s])?(\\d{3}[-.\\s]?)(\\d{3}[-.\\s]?)\\d{4}"; String phoneNumber = "12.523.231.4234"; Pattern pat = Pattern.compile(regex); Matcher mat =…

Continue reading...

Einstieg in Regex mit Java

Was ist Regex? Regex steht für Regular expressions und ist eine Technik, Technologie und Sprache an und für sich, die verwendet werden kann zum Ausdrücken von Textmustern mit Symbolen. Und diese Symbole sind selbst Text. Damit lassen wir verschiedene Textteile und Zeichen andere Textfolgen darstellen. In…

Continue reading...

Java Access-Modifier

Sobald ein Feld sichtbar ist, bedeutet das auch, das es gelesen und beschrieben werden kann. Die Access-Modifier steuern, von wo auf Felder und Methoden eines Objekts zugegriffen werden kann: Modifier Wer darf zugreifen? public Auf public-Objekte/Felder und Methoden darf ohne Einschränkungen von überall aus zugegriffen…

Continue reading...

Finecloud

My public notes about various information technology topics... 

Unterschiede zwischen Proxmox Containers und Docker

LXC LXC ist ein Userspace Interface zur Eindämmung des Linux-Kernels und kann verwendet werden für Systemvirtualisierung. Durch eine mächtige API und einfache Tools ermöglicht es Linux Benutzern einfache Erstellung und Verwaltung von System Container. LXC ermöglicht ein komplettes OS in einem Container zu betreiben. LXD…

Continue reading...

Citrix ADC (NetScaler) Backup mit Ansible

Beschreibung Citrix ADC, bis vor einer Weile noch als Citrix NetScaler bekannt ist eine Netzwerk Appliance welche als Access Gateway und Proxy verwendet werden kann. In diesem Artikel werden wir ein kleines Ansible Playbook schreiben, mit welchem man einen Citrix ADC sichern kann. Als erster…

Continue reading...

JVM und JDK unter der Haube

Woher lädt Java eigentlich seine JDK Klassen? Beim Start einer Applikation kann mit -cp ein Klassenpfad angegeben werden, in welchem sich Klassen befinden, die man verwenden möchte. Das ist das normale Vorgehen, wie man Klassen integriert. Doch woher hat das JDK seine eigenen Klassen? Um…

Continue reading...

GUIs mit JavaFX

Einführung JavaFX ist das modernste in der Java SE integrierte GUI-Framework zum Erstellen grafischer Benutzeroberflächen (GUI: Graphical User Interface). JavaFX ist eine reine Java-Bibliothek, die zwar, auch deklarative Definitionen von GUIs über XML ermöglicht, die aber im Kern aus Java-Klassen besteht. Seit Java 8 liegt…

Continue reading...

Kubernetes auf Proxmox mit Ansible und Terraform (Teil 2)

Dieser Post wurde aus dem Original (https://datastrophic.io/kubernetes-homelab-with-proxmox-kubeadm-calico-openebs-and-metallb/)auf Deutsch übersetzt und leicht angepasst. Nachdem wir im ersten Teil mit Terraform die VMs für unseren K8s Cluster deployed haben, werden wir nun mit Ansible die folgenden K8s Komponenten in den worker Nodes und dem Controller installieren: Die…

Continue reading...

Finecloud

My public notes about various information technology topics... 

Java Namenskonventionen

In diesem Blog fasse ich die Java Namenskonventionen kurz zusammen: Typ Namenskonvention Beispiele Class Sollte mit Grossbuchstaben beginnen und sollte ein Substantiv wie Farbe, Knopf, System, Faden usw. sein. Verwenden Sie geeignete Wörter anstelle von Akronymen. public class Employee { //code snippet } Interface Sollte…

Continue reading...

Unterschiede zwischen Proxmox Containers und Docker

LXC LXC ist ein Userspace Interface zur Eindämmung des Linux-Kernels und kann verwendet werden für Systemvirtualisierung. Durch eine mächtige API und einfache Tools ermöglicht es Linux Benutzern einfache Erstellung und Verwaltung von System Container. LXC ermöglicht ein komplettes OS in einem Container zu betreiben. LXD…

Continue reading...

Citrix ADC (NetScaler) Backup mit Ansible

Beschreibung Citrix ADC, bis vor einer Weile noch als Citrix NetScaler bekannt ist eine Netzwerk Appliance welche als Access Gateway und Proxy verwendet werden kann. In diesem Artikel werden wir ein kleines Ansible Playbook schreiben, mit welchem man einen Citrix ADC sichern kann. Als erster…

Continue reading...

JVM und JDK unter der Haube

Woher lädt Java eigentlich seine JDK Klassen? Beim Start einer Applikation kann mit -cp ein Klassenpfad angegeben werden, in welchem sich Klassen befinden, die man verwenden möchte. Das ist das normale Vorgehen, wie man Klassen integriert. Doch woher hat das JDK seine eigenen Klassen? Um…

Continue reading...

GUIs mit JavaFX

Einführung JavaFX ist das modernste in der Java SE integrierte GUI-Framework zum Erstellen grafischer Benutzeroberflächen (GUI: Graphical User Interface). JavaFX ist eine reine Java-Bibliothek, die zwar, auch deklarative Definitionen von GUIs über XML ermöglicht, die aber im Kern aus Java-Klassen besteht. Seit Java 8 liegt…

Continue reading...

Finecloud

My public notes about various information technology topics... 

Kubernetes auf Proxmox mit Ansible und Terraform (Teil 1)

Einleitung In ersten Teil werden wir ein cloud-init Template erstellen, welches wir dann mit Terraform nutzen um die K8S VMs zu erzeugen. Damit wir mit Terraform unsere Kubernetes Nodes deployen können, brauchen wir ein Template. Das kann man entweder bereits mit Ansible machen, sieh dir…

Continue reading...

Java und DBs

Java kommt von Haus aus mit einer relationalen Open-Source-Datenbank, der Apache-Derby-Datenbank, welche in reinem Java geschrieben ist und sich dadurch nicht nur als eigener Prozess betreiben lässt, sondern auch als Embeded Bestandteil einer Java Anwendung betrieben werden kann. Das ist jedoch für den produktiven Betrieb…

Continue reading...

HTTP Response Status Codes

Die erste Ziffer des Status-Codes definiert die Klasse der Response. Die letzten zwei Ziffern haben keine Bedeutung für die Kategorisierung. Es gibt fünf unterschiedliche Response Klassen: Nachfolgend eine Zusammenstellung der häufigsten HTTP-Codes denen man im Alltag begegnet: HTTP-Statuscode Bedeutung 200 OK Der Request wurde ohne…

Continue reading...

HTTP Methoden - RFC9110

Was geschieht eigentlich wenn ich eine Webseite aufrufe? Wir überspringen den Ersten Teil mit DNS und gehen davon aus, dass die URL bereits im DNS Cache ist. Um diese Frage zu beantworten, müssen wir uns mit den Grundlagen des HTTP-Protokolls befassen. Der Aufruf der Webseite…

Continue reading...

TOC in README.md erstellen mit VSCode

TOC steht für Table of Contents (aka Inhaltsverzeichnis). Jedes grössere README Markdown File in einem git Repo sollte über ein TOC verfügen. Doch die Pflege eines TOC sowie die initiale Erstellung ist nicht sehr handlich, du musst für jeden einzelnen Titel in der richtigen Einrückung…

Continue reading...

Finecloud

My public notes about various information technology topics... 

Kubernetes auf Proxmox mit Ansible und Terraform (Teil 2)

Dieser Post wurde aus dem Original (https://datastrophic.io/kubernetes-homelab-with-proxmox-kubeadm-calico-openebs-and-metallb/)auf Deutsch übersetzt und leicht angepasst. Nachdem wir im ersten Teil mit Terraform die VMs für unseren K8s Cluster deployed haben, werden wir nun mit Ansible die folgenden K8s Komponenten in den worker Nodes und dem Controller installieren: Die…

Continue reading...

Kubernetes auf Proxmox mit Ansible und Terraform (Teil 1)

Einleitung In ersten Teil werden wir ein cloud-init Template erstellen, welches wir dann mit Terraform nutzen um die K8S VMs zu erzeugen. Damit wir mit Terraform unsere Kubernetes Nodes deployen können, brauchen wir ein Template. Das kann man entweder bereits mit Ansible machen, sieh dir…

Continue reading...

Java und DBs

Java kommt von Haus aus mit einer relationalen Open-Source-Datenbank, der Apache-Derby-Datenbank, welche in reinem Java geschrieben ist und sich dadurch nicht nur als eigener Prozess betreiben lässt, sondern auch als Embeded Bestandteil einer Java Anwendung betrieben werden kann. Das ist jedoch für den produktiven Betrieb…

Continue reading...

HTTP Response Status Codes

Die erste Ziffer des Status-Codes definiert die Klasse der Response. Die letzten zwei Ziffern haben keine Bedeutung für die Kategorisierung. Es gibt fünf unterschiedliche Response Klassen: Nachfolgend eine Zusammenstellung der häufigsten HTTP-Codes denen man im Alltag begegnet: HTTP-Statuscode Bedeutung 200 OK Der Request wurde ohne…

Continue reading...

HTTP Methoden - RFC9110

Was geschieht eigentlich wenn ich eine Webseite aufrufe? Wir überspringen den Ersten Teil mit DNS und gehen davon aus, dass die URL bereits im DNS Cache ist. Um diese Frage zu beantworten, müssen wir uns mit den Grundlagen des HTTP-Protokolls befassen. Der Aufruf der Webseite…

Continue reading...

Finecloud

My public notes about various information technology topics... 

Java Serverlet mit Tomcat und Maven in VSCode

In diesem Artikel ist beschrieben, wie man Apache Tomcat direkt in VSCode nutzen kann. Voraussetzung ist, dass du auf deinem Gerät bereits eine Java JRE und Apache Maven installiert hast. Weiter brauchen wir in VSCode das Extension Pack for Java, du kannst dire in VSCode…

Continue reading...

Java Serverlet Container installieren

Einleitung Das Serverlet-Framework Jakarta EE ermöglicht die Entwicklung von Anwendungen für eine grosse Anzahl paralleler Benutzer die über einen Web-Browser zugreifen. Dazu ist besonders die Serverlet-API von JEE von Interesse. Diese API-Klasse wartet auf eingehende Netzwerkverbindungen und reagiert mit einer entsprechenden Antwort. Für die übertragenen…

Continue reading...

Tabby Config-Sync auf Nextcloud einrichten

A terminal for the modern age Tabby ist ein anpassbares, Platform-Übergreifendes Terminal App für die Arbeit mit Lokalen Shells sowie Serial, SSH und Telnet Verbindungen. Aus diesen Gründen ist Tabby viel praktischer und moderner als Putty: Link zum App: https://tabby.sh/ Link zum Projekt auf GitHub:…

Continue reading...

Netzwerkkommunikation mit Java

In Java gibt es keinen nennenswerten Unterschied wischen I/O mit Daten und I/O mit Netzwerkverbindungen. In beiden Fällen basiert die Ein- und Ausgabe auf InputStream und OutputStream, der Unterschied liegt nur darin, wo diese Datenströme herkommen. Bei der Netzwerkkommunikation mit dem TCP-Protokoll kommen sie aus…

Continue reading...

Proxmox VE 7.2 Installation

Systemanforderungen Proxmox gibt folgende minimale Systemanforderungen an: Für produktive Workloads sind diese Anforderungen aber nicht gedacht. Daher sind die empfohlenen Systemanforderungen wie folgt: Da ich meine Proxmox Infrastruktur zum Start nur als Standalone LAB installieren will und für mein kleines Budget maximal viel Leistung erhalten…

Continue reading...

Finecloud

My public notes about various information technology topics... 

TOC in README.md erstellen mit VSCode

TOC steht für Table of Contents (aka Inhaltsverzeichnis). Jedes grössere README Markdown File in einem git Repo sollte über ein TOC verfügen. Doch die Pflege eines TOC sowie die initiale Erstellung ist nicht sehr handlich, du musst für jeden einzelnen Titel in der richtigen Einrückung…

Continue reading...

Java Serverlet mit Tomcat und Maven in VSCode

In diesem Artikel ist beschrieben, wie man Apache Tomcat direkt in VSCode nutzen kann. Voraussetzung ist, dass du auf deinem Gerät bereits eine Java JRE und Apache Maven installiert hast. Weiter brauchen wir in VSCode das Extension Pack for Java, du kannst dire in VSCode…

Continue reading...

Java Serverlet Container installieren

Einleitung Das Serverlet-Framework Jakarta EE ermöglicht die Entwicklung von Anwendungen für eine grosse Anzahl paralleler Benutzer die über einen Web-Browser zugreifen. Dazu ist besonders die Serverlet-API von JEE von Interesse. Diese API-Klasse wartet auf eingehende Netzwerkverbindungen und reagiert mit einer entsprechenden Antwort. Für die übertragenen…

Continue reading...

Tabby Config-Sync auf Nextcloud einrichten

A terminal for the modern age Tabby ist ein anpassbares, Platform-Übergreifendes Terminal App für die Arbeit mit Lokalen Shells sowie Serial, SSH und Telnet Verbindungen. Aus diesen Gründen ist Tabby viel praktischer und moderner als Putty: Link zum App: https://tabby.sh/ Link zum Projekt auf GitHub:…

Continue reading...

Netzwerkkommunikation mit Java

In Java gibt es keinen nennenswerten Unterschied wischen I/O mit Daten und I/O mit Netzwerkverbindungen. In beiden Fällen basiert die Ein- und Ausgabe auf InputStream und OutputStream, der Unterschied liegt nur darin, wo diese Datenströme herkommen. Bei der Netzwerkkommunikation mit dem TCP-Protokoll kommen sie aus…

Continue reading...

Finecloud

My public notes about various information technology topics... 

Proxmox VE 7.2 Übersicht

Die Architektur Proxmox VE ist eine Plattform zum Betrieben von virtuellen Maschinen und Container. Dabei ist die gesamte Proxmox VE Plattform open source und baisert auf Debian Linux. die VE Plattform besteht aus zwei virtualisierungs-technologien: Proxmox gibt es als single node, oder als Cluster mit…

Continue reading...

Dateien und Verzeichnisse unter Java

Dateioperationen mit java.io werden in Java immer, direkt oder indirekt, durch ein Objekt des Typs java.io.File abgebildet. Dabei kann File aber nicht selbst aus Dateien lesen, oder in sie schreiben, dazu benötigt man einen Reader oder Writer (für Textdateien) resp. einen InputStream oder OutputStream (für…

Continue reading...

Genereische Java Methoden und beschränkte Typen

Eine Methode kann einen typisierten Parameter erzwingen und einen typisierten Wert zurückgeben: public List<Integer> parseAlleInts(List<String> strings){ List<Integer> ergebnis = new ArrayList<>(); for (String s : strings){ ergebnis.add(Integer.parseInt(s)); } return ergebnis; } So ist es möglich eine Liste von Strings als Paramter in eine Liste von…

Continue reading...

Java Collection Iteratoren

Diese Collection Methode kann dazu verwendet werden, über alle Werte einer Collection zu iterieren: die Methode iterator, gibt ein Objekt vom Typ Iterator zurück. Mit der Methode hasNext wird geprüft, ob es noch ein weiteres Element in der Collection gibt, next gibt das nächste Element…

Continue reading...

Java Collection Sets

Sets eignen sich für die Bearbeitung einer mathematischen Menge. Set kann somit keine identische Elemente enthalten und kann keine interneReihenfolge haben. Deshalb gibt es für Set auch keine Methoden die den direkten Zugriff auf ein Element ermöglichen. Um auf ein Element eines Set zuzugreifen muss…

Continue reading...

Finecloud

My public notes about various information technology topics... 

Proxmox VE 7.2 Installation

Systemanforderungen Proxmox gibt folgende minimale Systemanforderungen an: Für produktive Workloads sind diese Anforderungen aber nicht gedacht. Daher sind die empfohlenen Systemanforderungen wie folgt: Da ich meine Proxmox Infrastruktur zum Start nur als Standalone LAB installieren will und für mein kleines Budget maximal viel Leistung erhalten…

Continue reading...

Proxmox VE 7.2 Übersicht

Die Architektur Proxmox VE ist eine Plattform zum Betrieben von virtuellen Maschinen und Container. Dabei ist die gesamte Proxmox VE Plattform open source und baisert auf Debian Linux. die VE Plattform besteht aus zwei virtualisierungs-technologien: Proxmox gibt es als single node, oder als Cluster mit…

Continue reading...

Dateien und Verzeichnisse unter Java

Dateioperationen mit java.io werden in Java immer, direkt oder indirekt, durch ein Objekt des Typs java.io.File abgebildet. Dabei kann File aber nicht selbst aus Dateien lesen, oder in sie schreiben, dazu benötigt man einen Reader oder Writer (für Textdateien) resp. einen InputStream oder OutputStream (für…

Continue reading...

Genereische Java Methoden und beschränkte Typen

Eine Methode kann einen typisierten Parameter erzwingen und einen typisierten Wert zurückgeben: public List<Integer> parseAlleInts(List<String> strings){ List<Integer> ergebnis = new ArrayList<>(); for (String s : strings){ ergebnis.add(Integer.parseInt(s)); } return ergebnis; } So ist es möglich eine Liste von Strings als Paramter in eine Liste von…

Continue reading...

Java Collection Iteratoren

Diese Collection Methode kann dazu verwendet werden, über alle Werte einer Collection zu iterieren: die Methode iterator, gibt ein Objekt vom Typ Iterator zurück. Mit der Methode hasNext wird geprüft, ob es noch ein weiteres Element in der Collection gibt, next gibt das nächste Element…

Continue reading...

Finecloud

My public notes about various information technology topics... 

Java Collection Listen

Listen sind Collections, die am ehesten einem Array entsprechen. Die Elemente bleiben in der Reihenfolge wie sie hinzugefügt werden und sie können auf einzelne Positionen im Index der Liste zugreifen: lesen mit get(index) und schreiben mit set(index, element). Damit ist mit Listen alles möglich, was…

Continue reading...

Java Collections

Collections sind ganz alltägliche Java Objekte. Im Gegensatz zu Arrays sind Collections nicht durch native Methoden und einem zusammenhängenden Speicherbereich optimiert, sie haben auch keine eigene Syntax. Die Vorteile von Collections sind der Benutzerkomfort, da sie über eine umfangreichere und komfortablere API verfügen. Zudem können…

Continue reading...

Java Varargs

Varargs, auch Parameter-Listen genannt können in Java Arrays verwendet werden, um eine dynamische Anzahl von Parametern entgegenzunehmen. public static int max(int… numbers){ int result = Integer.MIN_VALUE; for (int number : numbers){ if (number > result){ result = number; } } return result; } Diese Methode…

Continue reading...

Die for-each Schleife

Die for-each Schleife ist speziell für Arrays und Collections gedacht, denn diese Schleife enthält keine Zählvariable, enthält aber nacheinander alle Einträge des Arrays oder der Collection. Buch[] buecher = …; for (Buch buch : buecher){ System.out.println(buch.getTitel()); } Dabei wird in den Klammern der Schleife eine…

Continue reading...

Vaultwarden Backup mit Rclone

Vaultwarden ist eine alternative Implementation der Bitwarden Server API entwickelt in Rust, kompatibel mit allen Bitwarden clients. Vaultwarden eignet sich daher perfekt für self-hosted deployments, oder überall dort wo der offizielle Bitwarden Service nicht ideal geeignet ist. Dazu gibt es einmal das Vaultwarden Docker Image…

Continue reading...

Finecloud

My public notes about various information technology topics... 

Java Collection Sets

Sets eignen sich für die Bearbeitung einer mathematischen Menge. Set kann somit keine identische Elemente enthalten und kann keine interneReihenfolge haben. Deshalb gibt es für Set auch keine Methoden die den direkten Zugriff auf ein Element ermöglichen. Um auf ein Element eines Set zuzugreifen muss…

Continue reading...

Java Collection Listen

Listen sind Collections, die am ehesten einem Array entsprechen. Die Elemente bleiben in der Reihenfolge wie sie hinzugefügt werden und sie können auf einzelne Positionen im Index der Liste zugreifen: lesen mit get(index) und schreiben mit set(index, element). Damit ist mit Listen alles möglich, was…

Continue reading...

Java Collections

Collections sind ganz alltägliche Java Objekte. Im Gegensatz zu Arrays sind Collections nicht durch native Methoden und einem zusammenhängenden Speicherbereich optimiert, sie haben auch keine eigene Syntax. Die Vorteile von Collections sind der Benutzerkomfort, da sie über eine umfangreichere und komfortablere API verfügen. Zudem können…

Continue reading...

Java Varargs

Varargs, auch Parameter-Listen genannt können in Java Arrays verwendet werden, um eine dynamische Anzahl von Parametern entgegenzunehmen. public static int max(int… numbers){ int result = Integer.MIN_VALUE; for (int number : numbers){ if (number > result){ result = number; } } return result; } Diese Methode…

Continue reading...

Die for-each Schleife

Die for-each Schleife ist speziell für Arrays und Collections gedacht, denn diese Schleife enthält keine Zählvariable, enthält aber nacheinander alle Einträge des Arrays oder der Collection. Buch[] buecher = …; for (Buch buch : buecher){ System.out.println(buch.getTitel()); } Dabei wird in den Klammern der Schleife eine…

Continue reading...

Finecloud

My public notes about various information technology topics... 

Mehrdimensionale Java Arrays

Eindimensionales Array Nebst den eindimensionalen Java Arrays gibt es auch mehrdimensionale Arrays. Hier ein Beispiel eines eindimensionalen Java Arrays: int[] zahlen = new int[]{1, 2, 3, 4}; Ein mehrdimensionales Array könnte beispielsweise ein Schachfeld sein: Schachfigur[][] schachbrett = new Schachfigur[8][8]; Mehrdimensionale Arrays sind nicht auf…

Continue reading...

Finecloud

My public notes about various information technology topics... 

Vaultwarden Backup mit Rclone

Vaultwarden ist eine alternative Implementation der Bitwarden Server API entwickelt in Rust, kompatibel mit allen Bitwarden clients. Vaultwarden eignet sich daher perfekt für self-hosted deployments, oder überall dort wo der offizielle Bitwarden Service nicht ideal geeignet ist. Dazu gibt es einmal das Vaultwarden Docker Image…

Continue reading...

Mehrdimensionale Java Arrays

Eindimensionales Array Nebst den eindimensionalen Java Arrays gibt es auch mehrdimensionale Arrays. Hier ein Beispiel eines eindimensionalen Java Arrays: int[] zahlen = new int[]{1, 2, 3, 4}; Ein mehrdimensionales Array könnte beispielsweise ein Schachfeld sein: Schachfigur[][] schachbrett = new Schachfigur[8][8]; Mehrdimensionale Arrays sind nicht auf…

Continue reading...

Finecloud

My public notes about various information technology topics... 

Building a GraphQL service

Let's build a GraphQL Spring Application that will accept GraphQL requests at http://localhost:8080/graphql. First let's navigate to https://start.spring.io. This service pulls in all the dependencies you need for an application and does most of the setup for you. GraphQL is a query language to retrieve…

Continue reading...

Microservices

This Post is a summary of the famous Article about Microservices: https://martinfowler.com/articles/microservices.html The text discusses the concept of "Microservice Architecture," which is an approach to designing software applications as a suite of independently deployable services. It highlights that there is no precise definition but outlines…

Continue reading...

The Concept of API Contracts

What is it about? We define an API contract as a formal agreement between a software provider and a consumer that abstractly communicates how to interact with each other. This contract defines how API providers and consumers interact, what data exchanges looks like, and how…

Continue reading...

Terraform Tips and Tricks

module "zland" { source = "git::ssh//git@gitlab.com/zland/module.git" version = "1.0.5" servers = 3 } Module Output Values resource "aws_instance" "appserver" { #... instance = module.servers.instance_ids } Since the resources defined in a module are encapsulated, a calling module cannot access their attributes directly. Instead, the child…

Continue reading...

Finecloud

My public notes about various information technology topics... 

How to do a code review

This Blog post is my personal summary of Googles code review process Make sure to review every line of code you’ve been asked to review, look at the context, make sure you’re improving code health, and compliment developers on good things that they do. Look at…

Continue reading...

Building a GraphQL service

Let's build a GraphQL Spring Application that will accept GraphQL requests at http://localhost:8080/graphql. First let's navigate to https://start.spring.io. This service pulls in all the dependencies you need for an application and does most of the setup for you. GraphQL is a query language to retrieve…

Continue reading...

Microservices

This Post is a summary of the famous Article about Microservices: https://martinfowler.com/articles/microservices.html The text discusses the concept of "Microservice Architecture," which is an approach to designing software applications as a suite of independently deployable services. It highlights that there is no precise definition but outlines…

Continue reading...

The Concept of API Contracts

What is it about? We define an API contract as a formal agreement between a software provider and a consumer that abstractly communicates how to interact with each other. This contract defines how API providers and consumers interact, what data exchanges looks like, and how…

Continue reading...

Finecloud

My public notes about various information technology topics... 

Spring Boot on Kubernetes

Enable Kubernetes in Docker Desktop We will use Docker Desktop to provide us a Test Kubernetes Environment. Open Docker Desktop Settings, go to Tab "Kubernetes". Select "Enable Kubernetes", then "Apply & Restart". Now you should be able to see docker-desktop listed, if you run kubectl…

Continue reading...

Building Spring Boot Docker Images

Pre-Requirements Developer Environment ready with Docker, JDK, IDE A Java Spring Boot Project with a h2 in-memory DB Docker Hub account Create Docker File Create a Dockerfile with the following content: FROM openjdk:11-jre-slim ENV JAVA_OPTS " -Xms512m -Xmx512m -Djava.security.egd=file:///dev/./urandom" WORKDIR application COPY target/myapp-0.0.1-SNAPSHOT.jar ./ ENTRYPOINT…

Continue reading...

Data Validation Overview

What is Validation? Validation is a process of making assertions against data to ensure data integrity Is a value required? How long is a phone number? Is it a good date? What is the maximum length of a string? Some refer to data validation as…

Continue reading...

Data Transfer Objects

Data Transfer Objects DTOs - Data Transfer Objects DTOs are simple Java POJOs DTOs are data structures, generally should NOT have behavior DTOs are objects used to transfer data between producers and consumers Controller models are typically DTOs Why Not Entities? Database Entities are also…

Continue reading...

Spring Exception Handling

HTTP Status Codes 100 Series - Informational Responses • 200 Series - Successful Responses 300 Series - Redirection Responses 400 Series - Client Error Responses 500 Series - Server Error Responses Use of HTTP Status Codes 200 Series are used when the request completes as…

Continue reading...

Finecloud

My public notes about various information technology topics... 

Terraform Tips and Tricks

module "zland" { source = "git::ssh//git@gitlab.com/zland/module.git" version = "1.0.5" servers = 3 } Module Output Values resource "aws_instance" "appserver" { #... instance = module.servers.instance_ids } Since the resources defined in a module are encapsulated, a calling module cannot access their attributes directly. Instead, the child…

Continue reading...

Spring Boot on Kubernetes

Enable Kubernetes in Docker Desktop We will use Docker Desktop to provide us a Test Kubernetes Environment. Open Docker Desktop Settings, go to Tab "Kubernetes". Select "Enable Kubernetes", then "Apply & Restart". Now you should be able to see docker-desktop listed, if you run kubectl…

Continue reading...

Building Spring Boot Docker Images

Pre-Requirements Developer Environment ready with Docker, JDK, IDE A Java Spring Boot Project with a h2 in-memory DB Docker Hub account Create Docker File Create a Dockerfile with the following content: FROM openjdk:11-jre-slim ENV JAVA_OPTS " -Xms512m -Xmx512m -Djava.security.egd=file:///dev/./urandom" WORKDIR application COPY target/myapp-0.0.1-SNAPSHOT.jar ./ ENTRYPOINT…

Continue reading...

Data Validation Overview

What is Validation? Validation is a process of making assertions against data to ensure data integrity Is a value required? How long is a phone number? Is it a good date? What is the maximum length of a string? Some refer to data validation as…

Continue reading...

Data Transfer Objects

Data Transfer Objects DTOs - Data Transfer Objects DTOs are simple Java POJOs DTOs are data structures, generally should NOT have behavior DTOs are objects used to transfer data between producers and consumers Controller models are typically DTOs Why Not Entities? Database Entities are also…

Continue reading...

Finecloud

My public notes about various information technology topics... 

Testing with MockMVC

Why use Spring MockMVC? Spring MockMVC allows you to test the controller interactions in a servlet context without the application running in an application server. Mockito is the most popular mocking framework for testing Java Mocks (aka Test Doubles) are alternate implementations of objects to…

Continue reading...

Project Lombok

Intro Project Lombok is a Java library that provides a set of annotations and utility classes that help to reduce boilerplate code in Java projects. It offers features such as automatic generation of getters, setters, equals, hashCode, toString, and constructors, as well as support for…

Continue reading...

Spring Bean Lifecycle

Part 1 Of course, instantiating the class will come first. The class will populate properties after it has been created. It will therefore set up any properties you may have. Then, if they exist, we do have some interfaces that we can implement. These methods…

Continue reading...

Spring Annotations

If you want to develop a Spring Application you need to know when to use which Annotation. Spring’s dependency injection capability includes the following annotations:

Continue reading...

Conventional commits

What are Conventional commits Conventional Commits is a convention for writing commit messages that provides structure and consistency to a project's version control history. It's based on the idea of defining a standard format for commit messages that makes it easier for developers to understand…

Continue reading...

Finecloud

My public notes about various information technology topics... 

Spring Exception Handling

HTTP Status Codes 100 Series - Informational Responses • 200 Series - Successful Responses 300 Series - Redirection Responses 400 Series - Client Error Responses 500 Series - Server Error Responses Use of HTTP Status Codes 200 Series are used when the request completes as…

Continue reading...

Testing with MockMVC

Why use Spring MockMVC? Spring MockMVC allows you to test the controller interactions in a servlet context without the application running in an application server. Mockito is the most popular mocking framework for testing Java Mocks (aka Test Doubles) are alternate implementations of objects to…

Continue reading...

Project Lombok

Intro Project Lombok is a Java library that provides a set of annotations and utility classes that help to reduce boilerplate code in Java projects. It offers features such as automatic generation of getters, setters, equals, hashCode, toString, and constructors, as well as support for…

Continue reading...

Spring Bean Lifecycle

Part 1 Of course, instantiating the class will come first. The class will populate properties after it has been created. It will therefore set up any properties you may have. Then, if they exist, we do have some interfaces that we can implement. These methods…

Continue reading...

Spring Annotations

If you want to develop a Spring Application you need to know when to use which Annotation. Spring’s dependency injection capability includes the following annotations:

Continue reading...

Finecloud

My public notes about various information technology topics... 

CleanCode

Summary of 'Clean code' by Robert C. Martin: https://gist.github.com/wojteklu/73c6914cc446146b8b533c0988cf8d29 Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility…

Continue reading...

JavaScript advanced features

New Features New versions of JavaScript, such as ES6, ES2016, 2017, etc., come with many new features, however it is still ECMAScript Many of the new features are syntactic sugar or extend the functionality only marginal Template Literals Template literals are string literals with support…

Continue reading...

JavaScript and the browser

The DOM Based on the received HTML document the browser builds up a model of the document structure, the Document Object Model (DOM) The DOM has a tree structure and each node of the document is represented by an object The browser renders the page…

Continue reading...

JavaScript objects

Object An object is a collection of properties A property has a name and a value An object can be seen as associative array (map) where the keys in the array are the names of the object’s properties // Create object as literal const bob…

Continue reading...

Difference between heap and stack

In this Post I try to explain the difference between the heap and the stack. It's just a very high level amateur explanation, there is a lot more to read and learn about this Topics. This Drawing helps me a lot to understand the basic…

Continue reading...

Finecloud

My public notes about various information technology topics... 

Conventional commits

What are Conventional commits Conventional Commits is a convention for writing commit messages that provides structure and consistency to a project's version control history. It's based on the idea of defining a standard format for commit messages that makes it easier for developers to understand…

Continue reading...

CleanCode

Summary of 'Clean code' by Robert C. Martin: https://gist.github.com/wojteklu/73c6914cc446146b8b533c0988cf8d29 Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility…

Continue reading...

JavaScript advanced features

New Features New versions of JavaScript, such as ES6, ES2016, 2017, etc., come with many new features, however it is still ECMAScript Many of the new features are syntactic sugar or extend the functionality only marginal Template Literals Template literals are string literals with support…

Continue reading...

JavaScript and the browser

The DOM Based on the received HTML document the browser builds up a model of the document structure, the Document Object Model (DOM) The DOM has a tree structure and each node of the document is represented by an object The browser renders the page…

Continue reading...

JavaScript objects

Object An object is a collection of properties A property has a name and a value An object can be seen as associative array (map) where the keys in the array are the names of the object’s properties // Create object as literal const bob…

Continue reading...

Finecloud

My public notes about various information technology topics... 

JavaScript arrays

Array An array combines multiple values in a single variable Arrays are helpful if the number of values is huge or dynamic Each value of an array has a unique numerical index // Normal variables hold exactly one value const colorA = "blue"; const colorB…

Continue reading...

JavaScript functions

Function Expression A function expression starts with the keyword function followed by the function arguments in parentheses and the function body in curly braces: const square = function(x) { return x * x; }; console.log(square(4)); // >> 16 Function Scope Each function defines a scope…

Continue reading...

JavaScript basics

What JavaScript is A scripting language originally designed for web browsers Object-oriented, however prototype-based and not class-based Supporting first-class functions A multi-paradigm language, supports imperative, object-oriented and functional programming style Untyped Moving from an interpreted language to just-in-time compilation Nowadays used for server-side programming too…

Continue reading...

Deploy your Java Web App to Heroku

Requirements and Preparation Unfortunately Heroku currently only Supports Tomcat version 9.x. As a consequence you're not able to use the Java Jakarta Servlets, since they are only supported with Tomcat version 10.x. As a consequence you need to replace all your Jakarta Servlet imports with…

Continue reading...

Take care of your SSH identities

Did you know that your ssh Client sends the server all your public keys, one by one, until the server accepts one, when you try to authenticate via public key? Don't believe me? Try it out yourself: ssh whoami.filippo.io Someone could use this to find…

Continue reading...

Finecloud

My public notes about various information technology topics... 

Difference between heap and stack

In this Post I try to explain the difference between the heap and the stack. It's just a very high level amateur explanation, there is a lot more to read and learn about this Topics. This Drawing helps me a lot to understand the basic…

Continue reading...

JavaScript arrays

Array An array combines multiple values in a single variable Arrays are helpful if the number of values is huge or dynamic Each value of an array has a unique numerical index // Normal variables hold exactly one value const colorA = "blue"; const colorB…

Continue reading...

JavaScript functions

Function Expression A function expression starts with the keyword function followed by the function arguments in parentheses and the function body in curly braces: const square = function(x) { return x * x; }; console.log(square(4)); // >> 16 Function Scope Each function defines a scope…

Continue reading...

JavaScript basics

What JavaScript is A scripting language originally designed for web browsers Object-oriented, however prototype-based and not class-based Supporting first-class functions A multi-paradigm language, supports imperative, object-oriented and functional programming style Untyped Moving from an interpreted language to just-in-time compilation Nowadays used for server-side programming too…

Continue reading...

Deploy your Java Web App to Heroku

Requirements and Preparation Unfortunately Heroku currently only Supports Tomcat version 9.x. As a consequence you're not able to use the Java Jakarta Servlets, since they are only supported with Tomcat version 10.x. As a consequence you need to replace all your Jakarta Servlet imports with…

Continue reading...

Finecloud

My public notes about various information technology topics... 

Backup OPNsense to Nextcloud

What is OPNsense? OPNsense® is an open source, easy-to-use and easy-to-build FreeBSD based firewall and routing platform. OPNsense includes most of the features available in expensive commercial firewalls, and more in many cases. It brings the rich feature set of commercial offerings with the benefits…

Continue reading...

Maven getting started

What is Maven? Declarative build management tool for automated builds Standardized directory structure Declarative dependency management Works with an XML control file (POM - Project Object Model) Open source, written in Java, for Java projects Pure command line tool IDEs offer integration Why Maven? Uniform…

Continue reading...

Threema Safe backup to Nextcloud

Did you know that Threema allows you, to backup your Threema app to a custom Threema Safe server? You can for example use your Nextcloud to keep your Threema backups safe. I recommend to create a new Nextcloud user account only for the purpose of…

Continue reading...

Handling Exceptions in Web UI

The Issue There is nothing worse than presenting a Java Stacktrace in a WebUI, full of technical Details about your Server environment of the Web App itself: So how can we avoid this? You don't want to share this informations with the users, it would…

Continue reading...

Getting stared with the Spring Framework

What is the Spring Framework Spring is the world's most popular Java framework and makes programming Java quicker, easier, and safer for everybody. Spring’s focus on speed, simplicity, and productivity. You can select and generate your Spring Package online: https://start.spring.io/ Lets make a Gradle Project,…

Continue reading...

Finecloud

My public notes about various information technology topics... 

Take care of your SSH identities

Did you know that your ssh Client sends the server all your public keys, one by one, until the server accepts one, when you try to authenticate via public key? Don't believe me? Try it out yourself: ssh whoami.filippo.io Someone could use this to find…

Continue reading...

Backup OPNsense to Nextcloud

What is OPNsense? OPNsense® is an open source, easy-to-use and easy-to-build FreeBSD based firewall and routing platform. OPNsense includes most of the features available in expensive commercial firewalls, and more in many cases. It brings the rich feature set of commercial offerings with the benefits…

Continue reading...

Maven getting started

What is Maven? Declarative build management tool for automated builds Standardized directory structure Declarative dependency management Works with an XML control file (POM - Project Object Model) Open source, written in Java, for Java projects Pure command line tool IDEs offer integration Why Maven? Uniform…

Continue reading...

Threema Safe backup to Nextcloud

Did you know that Threema allows you, to backup your Threema app to a custom Threema Safe server? You can for example use your Nextcloud to keep your Threema backups safe. I recommend to create a new Nextcloud user account only for the purpose of…

Continue reading...

Handling Exceptions in Web UI

The Issue There is nothing worse than presenting a Java Stacktrace in a WebUI, full of technical Details about your Server environment of the Web App itself: So how can we avoid this? You don't want to share this informations with the users, it would…

Continue reading...

Finecloud

My public notes about various information technology topics... 

Java and databases use SQL joins

Introduction Let's imagine we have two Tables now, people and addresses. We want to find out how many people live at the same address. This is our current Java and SQL approach: repository/PeopleRepository.java @Override @SQL(value = FIND_BY_ID_SQL, operationType = CrudOperation.FIND_BY_ID) @SQL(value = FIND_ALL_SQL, operationType =…

Continue reading...

Java working with databases

Introduction In this Post I will describe how you can easily learn, test and play around with Java interacting with SQL Databases. This post is a summary of my Java learning course I'm taking on udemy. The post is not intended to be spread around…

Continue reading...

Infrastructure as Software

Summary This post is my summary (for my own sake) of the original full length post: https://www.justingarrison.com/blog/2022-06-01-infrastructure-as-software/ Writing your infrastructure in a DSL or any other general purpose coding language like Ansible, Pulumi, Terraform is not Infrastructure as Software. Any managed service to deploy infrastructure…

Continue reading...

Java basics: Dates and Time

Local date Now Let's start with the basics, we just want to represent the date today and print that local date now: public class TimeTest { public static void main(String[] args) { LocalDate now = LocalDate.now(); System.out.println(now); } } output: 2022-08-29 Process finished with exit…

Continue reading...

Java basics: Optionals

What are Optionals? For the the number one use case for them has to do with null values. So whenever we're dealing with objects in Java, we store references to objects in variables. And those variables may or may not actually be pointing back to…

Continue reading...

Finecloud

My public notes about various information technology topics... 

Getting stared with the Spring Framework

What is the Spring Framework Spring is the world's most popular Java framework and makes programming Java quicker, easier, and safer for everybody. Spring’s focus on speed, simplicity, and productivity. You can select and generate your Spring Package online: https://start.spring.io/ Lets make a Gradle Project,…

Continue reading...

Java and databases use SQL joins

Introduction Let's imagine we have two Tables now, people and addresses. We want to find out how many people live at the same address. This is our current Java and SQL approach: repository/PeopleRepository.java @Override @SQL(value = FIND_BY_ID_SQL, operationType = CrudOperation.FIND_BY_ID) @SQL(value = FIND_ALL_SQL, operationType =…

Continue reading...

Java working with databases

Introduction In this Post I will describe how you can easily learn, test and play around with Java interacting with SQL Databases. This post is a summary of my Java learning course I'm taking on udemy. The post is not intended to be spread around…

Continue reading...

Infrastructure as Software

Summary This post is my summary (for my own sake) of the original full length post: https://www.justingarrison.com/blog/2022-06-01-infrastructure-as-software/ Writing your infrastructure in a DSL or any other general purpose coding language like Ansible, Pulumi, Terraform is not Infrastructure as Software. Any managed service to deploy infrastructure…

Continue reading...

Java basics: Dates and Time

Local date Now Let's start with the basics, we just want to represent the date today and print that local date now: public class TimeTest { public static void main(String[] args) { LocalDate now = LocalDate.now(); System.out.println(now); } } output: 2022-08-29 Process finished with exit…

Continue reading...

Finecloud

My public notes about various information technology topics... 

Java basics: Generics

What are Generics? What if we could write a single sort method that sort the elements in an Integer array, a String array, or an array of any type that supports ordering? Java Generics enable programmers to specify, with a single method declaration, a set…

Continue reading...

Java basics: Exceptions

What are Exceptions? An exception is an event, commonly it is a problem that arises during the execution of a program. When an Exception occurs the normal program is disrupted and the program/Application terminates abnormally, which is not recommended. Unexpected termination of an Application is…

Continue reading...

Visualisiere deine Strava Aktivitäten mit Grafana

Was ist Strava Strava ist das soziale Netzwerk für Sportler. Du kannst deine Sport Aktivitäten aufzeichnen und diese wird deinem Strava-Feed hinzugefügt - zusammen mit jenen, die deine Freunde und Followers mit dir teilen. Auf diese Weise könnt ihr eure Wettkampf- und Trainingsaktivitäten gegenseitig verfolgen,…

Continue reading...

ShellCheck

Beschreibung ShellCheck ist ein Tool, das Warnungen und Vorschläge für Bash/Sh-Shell-Skripte liefert. Das Tool kann verwendet werden für statische Code Analyse. Idealerweise wird das Tool in einer CI Pipeline integriert. Hier ein Beispiel einer Github Action Pipeline: name: Shellcheck on: pull_request: push: branches: - main…

Continue reading...

Imperativ vs. Deklarativ

Dieser Beitrag ist meine Zusammenfassung (in meinem eigenen Interesse) des ursprünglichen Beitrags in voller Länge: https://leebriggs.co.uk/blog/2022/07/20/nobody-knows-what-declarative-is Immer wieder stösst man im Bereich Infrastructure as Code (IaC) auf die Begriffe imperativ und deklarativ. Doch was bedeuten diese Begriffe? Ist Terraform wirklich deklarativ und Ansible nicht? Diese…

Continue reading...

Finecloud

My public notes about various information technology topics... 

Java basics: Optionals

What are Optionals? For the the number one use case for them has to do with null values. So whenever we're dealing with objects in Java, we store references to objects in variables. And those variables may or may not actually be pointing back to…

Continue reading...

Java basics: Generics

What are Generics? What if we could write a single sort method that sort the elements in an Integer array, a String array, or an array of any type that supports ordering? Java Generics enable programmers to specify, with a single method declaration, a set…

Continue reading...

Java basics: Exceptions

What are Exceptions? An exception is an event, commonly it is a problem that arises during the execution of a program. When an Exception occurs the normal program is disrupted and the program/Application terminates abnormally, which is not recommended. Unexpected termination of an Application is…

Continue reading...

Visualisiere deine Strava Aktivitäten mit Grafana

Was ist Strava Strava ist das soziale Netzwerk für Sportler. Du kannst deine Sport Aktivitäten aufzeichnen und diese wird deinem Strava-Feed hinzugefügt - zusammen mit jenen, die deine Freunde und Followers mit dir teilen. Auf diese Weise könnt ihr eure Wettkampf- und Trainingsaktivitäten gegenseitig verfolgen,…

Continue reading...

ShellCheck

Beschreibung ShellCheck ist ein Tool, das Warnungen und Vorschläge für Bash/Sh-Shell-Skripte liefert. Das Tool kann verwendet werden für statische Code Analyse. Idealerweise wird das Tool in einer CI Pipeline integriert. Hier ein Beispiel einer Github Action Pipeline: name: Shellcheck on: pull_request: push: branches: - main…

Continue reading...

bash (4)

Awk and Sed

awk and sed are text manipulation programs. You can use them for example to replace strings: echo image.jpg | sed 's/\.jpg/.png/' image.png or change order of strings: echo "hello world" | awk '{print $2, $1}' world hello awk and sed are harder to learn than…

Continue reading...

Take care of your SSH identities

Did you know that your ssh Client sends the server all your public keys, one by one, until the server accepts one, when you try to authenticate via public key? Don't believe me? Try it out yourself: ssh whoami.filippo.io Someone could use this to find…

Continue reading...

ShellCheck

Beschreibung ShellCheck ist ein Tool, das Warnungen und Vorschläge für Bash/Sh-Shell-Skripte liefert. Das Tool kann verwendet werden für statische Code Analyse. Idealerweise wird das Tool in einer CI Pipeline integriert. Hier ein Beispiel einer Github Action Pipeline: name: Shellcheck on: pull_request: push: branches: - main…

Continue reading...

bash (5)

Awk and Sed

awk and sed are text manipulation programs. You can use them for example to replace strings: echo image.jpg | sed 's/\.jpg/.png/' image.png or change order of strings: echo "hello world" | awk '{print $2, $1}' world hello awk and sed are harder to learn than…

Continue reading...

Take care of your SSH identities

Did you know that your ssh Client sends the server all your public keys, one by one, until the server accepts one, when you try to authenticate via public key? Don't believe me? Try it out yourself: ssh whoami.filippo.io Someone could use this to find…

Continue reading...

ShellCheck

Beschreibung ShellCheck ist ein Tool, das Warnungen und Vorschläge für Bash/Sh-Shell-Skripte liefert. Das Tool kann verwendet werden für statische Code Analyse. Idealerweise wird das Tool in einer CI Pipeline integriert. Hier ein Beispiel einer Github Action Pipeline: name: Shellcheck on: pull_request: push: branches: - main…

Continue reading...

container (8)

Spring Boot on Kubernetes

Enable Kubernetes in Docker Desktop We will use Docker Desktop to provide us a Test Kubernetes Environment. Open Docker Desktop Settings, go to Tab "Kubernetes". Select "Enable Kubernetes", then "Apply & Restart". Now you should be able to see docker-desktop listed, if you run kubectl…

Continue reading...

Building Spring Boot Docker Images

Pre-Requirements Developer Environment ready with Docker, JDK, IDE A Java Spring Boot Project with a h2 in-memory DB Docker Hub account Create Docker File Create a Dockerfile with the following content: FROM openjdk:11-jre-slim ENV JAVA_OPTS " -Xms512m -Xmx512m -Djava.security.egd=file:///dev/./urandom" WORKDIR application COPY target/myapp-0.0.1-SNAPSHOT.jar ./ ENTRYPOINT…

Continue reading...

Monitor Proxmox mit Grafana und Prometheus

Obwohl Proxmox selbst ja sehr gute Monitoring Informationen direkt auf dem eigenen WebUI anzeigt werde ich um Grafana und Prometheus besser kennen zu lernen diese Tools nutzen um meinen Proxmox Host zu überwachen. Mit der Open-Source-Software von Grafana kann man Metriken, Protokolle und Ablaufverfolgungen, visualisieren,…

Continue reading...

Unterschiede zwischen Proxmox Containers und Docker

LXC LXC ist ein Userspace Interface zur Eindämmung des Linux-Kernels und kann verwendet werden für Systemvirtualisierung. Durch eine mächtige API und einfache Tools ermöglicht es Linux Benutzern einfache Erstellung und Verwaltung von System Container. LXC ermöglicht ein komplettes OS in einem Container zu betreiben. LXD…

Continue reading...

Kubernetes auf Proxmox mit Ansible und Terraform (Teil 2)

Dieser Post wurde aus dem Original (https://datastrophic.io/kubernetes-homelab-with-proxmox-kubeadm-calico-openebs-and-metallb/)auf Deutsch übersetzt und leicht angepasst. Nachdem wir im ersten Teil mit Terraform die VMs für unseren K8s Cluster deployed haben, werden wir nun mit Ansible die folgenden K8s Komponenten in den worker Nodes und dem Controller installieren: Die…

Continue reading...

container (9)

Spring Boot on Kubernetes

Enable Kubernetes in Docker Desktop We will use Docker Desktop to provide us a Test Kubernetes Environment. Open Docker Desktop Settings, go to Tab "Kubernetes". Select "Enable Kubernetes", then "Apply & Restart". Now you should be able to see docker-desktop listed, if you run kubectl…

Continue reading...

Building Spring Boot Docker Images

Pre-Requirements Developer Environment ready with Docker, JDK, IDE A Java Spring Boot Project with a h2 in-memory DB Docker Hub account Create Docker File Create a Dockerfile with the following content: FROM openjdk:11-jre-slim ENV JAVA_OPTS " -Xms512m -Xmx512m -Djava.security.egd=file:///dev/./urandom" WORKDIR application COPY target/myapp-0.0.1-SNAPSHOT.jar ./ ENTRYPOINT…

Continue reading...

Monitor Proxmox mit Grafana und Prometheus

Obwohl Proxmox selbst ja sehr gute Monitoring Informationen direkt auf dem eigenen WebUI anzeigt werde ich um Grafana und Prometheus besser kennen zu lernen diese Tools nutzen um meinen Proxmox Host zu überwachen. Mit der Open-Source-Software von Grafana kann man Metriken, Protokolle und Ablaufverfolgungen, visualisieren,…

Continue reading...

Unterschiede zwischen Proxmox Containers und Docker

LXC LXC ist ein Userspace Interface zur Eindämmung des Linux-Kernels und kann verwendet werden für Systemvirtualisierung. Durch eine mächtige API und einfache Tools ermöglicht es Linux Benutzern einfache Erstellung und Verwaltung von System Container. LXC ermöglicht ein komplettes OS in einem Container zu betreiben. LXD…

Continue reading...

container (8)

Tabby Config-Sync auf Nextcloud einrichten

A terminal for the modern age Tabby ist ein anpassbares, Platform-Übergreifendes Terminal App für die Arbeit mit Lokalen Shells sowie Serial, SSH und Telnet Verbindungen. Aus diesen Gründen ist Tabby viel praktischer und moderner als Putty: Link zum App: https://tabby.sh/ Link zum Projekt auf GitHub:…

Continue reading...

Proxmox VE 7.2 Installation

Systemanforderungen Proxmox gibt folgende minimale Systemanforderungen an: Für produktive Workloads sind diese Anforderungen aber nicht gedacht. Daher sind die empfohlenen Systemanforderungen wie folgt: Da ich meine Proxmox Infrastruktur zum Start nur als Standalone LAB installieren will und für mein kleines Budget maximal viel Leistung erhalten…

Continue reading...

Proxmox VE 7.2 Übersicht

Die Architektur Proxmox VE ist eine Plattform zum Betrieben von virtuellen Maschinen und Container. Dabei ist die gesamte Proxmox VE Plattform open source und baisert auf Debian Linux. die VE Plattform besteht aus zwei virtualisierungs-technologien: Proxmox gibt es als single node, oder als Cluster mit…

Continue reading...

container (9)

Kubernetes auf Proxmox mit Ansible und Terraform (Teil 2)

Dieser Post wurde aus dem Original (https://datastrophic.io/kubernetes-homelab-with-proxmox-kubeadm-calico-openebs-and-metallb/)auf Deutsch übersetzt und leicht angepasst. Nachdem wir im ersten Teil mit Terraform die VMs für unseren K8s Cluster deployed haben, werden wir nun mit Ansible die folgenden K8s Komponenten in den worker Nodes und dem Controller installieren: Die…

Continue reading...

Tabby Config-Sync auf Nextcloud einrichten

A terminal for the modern age Tabby ist ein anpassbares, Platform-Übergreifendes Terminal App für die Arbeit mit Lokalen Shells sowie Serial, SSH und Telnet Verbindungen. Aus diesen Gründen ist Tabby viel praktischer und moderner als Putty: Link zum App: https://tabby.sh/ Link zum Projekt auf GitHub:…

Continue reading...

Proxmox VE 7.2 Installation

Systemanforderungen Proxmox gibt folgende minimale Systemanforderungen an: Für produktive Workloads sind diese Anforderungen aber nicht gedacht. Daher sind die empfohlenen Systemanforderungen wie folgt: Da ich meine Proxmox Infrastruktur zum Start nur als Standalone LAB installieren will und für mein kleines Budget maximal viel Leistung erhalten…

Continue reading...

Proxmox VE 7.2 Übersicht

Die Architektur Proxmox VE ist eine Plattform zum Betrieben von virtuellen Maschinen und Container. Dabei ist die gesamte Proxmox VE Plattform open source und baisert auf Debian Linux. die VE Plattform besteht aus zwei virtualisierungs-technologien: Proxmox gibt es als single node, oder als Cluster mit…

Continue reading...

devops (3)

GitHub classic vs. fine-grained Personal Access Tokens

What are PATs? Personal access tokens are an alternative to using passwords for authentication to GitHub when using the GitHub API or the command line. Personal access tokens are intended to access GitHub resources on your behalf. To access resources on behalf of an organization,…

Continue reading...

How to do a code review

This Blog post is my personal summary of Googles code review process Make sure to review every line of code you’ve been asked to review, look at the context, make sure you’re improving code health, and compliment developers on good things that they do. Look at…

Continue reading...

Terraform Tips and Tricks

module "zland" { source = "git::ssh//git@gitlab.com/zland/module.git" version = "1.0.5" servers = 3 } Module Output Values resource "aws_instance" "appserver" { #... instance = module.servers.instance_ids } Since the resources defined in a module are encapsulated, a calling module cannot access their attributes directly. Instead, the child…

Continue reading...

devops (4)

GitHub classic vs. fine-grained Personal Access Tokens

What are PATs? Personal access tokens are an alternative to using passwords for authentication to GitHub when using the GitHub API or the command line. Personal access tokens are intended to access GitHub resources on your behalf. To access resources on behalf of an organization,…

Continue reading...

How to do a code review

This Blog post is my personal summary of Googles code review process Make sure to review every line of code you’ve been asked to review, look at the context, make sure you’re improving code health, and compliment developers on good things that they do. Look at…

Continue reading...

Terraform Tips and Tricks

module "zland" { source = "git::ssh//git@gitlab.com/zland/module.git" version = "1.0.5" servers = 3 } Module Output Values resource "aws_instance" "appserver" { #... instance = module.servers.instance_ids } Since the resources defined in a module are encapsulated, a calling module cannot access their attributes directly. Instead, the child…

Continue reading...

docker (5)

Spring Boot on Kubernetes

Enable Kubernetes in Docker Desktop We will use Docker Desktop to provide us a Test Kubernetes Environment. Open Docker Desktop Settings, go to Tab "Kubernetes". Select "Enable Kubernetes", then "Apply & Restart". Now you should be able to see docker-desktop listed, if you run kubectl…

Continue reading...

Building Spring Boot Docker Images

Pre-Requirements Developer Environment ready with Docker, JDK, IDE A Java Spring Boot Project with a h2 in-memory DB Docker Hub account Create Docker File Create a Dockerfile with the following content: FROM openjdk:11-jre-slim ENV JAVA_OPTS " -Xms512m -Xmx512m -Djava.security.egd=file:///dev/./urandom" WORKDIR application COPY target/myapp-0.0.1-SNAPSHOT.jar ./ ENTRYPOINT…

Continue reading...

Infrastructure as Software

Summary This post is my summary (for my own sake) of the original full length post: https://www.justingarrison.com/blog/2022-06-01-infrastructure-as-software/ Writing your infrastructure in a DSL or any other general purpose coding language like Ansible, Pulumi, Terraform is not Infrastructure as Software. Any managed service to deploy infrastructure…

Continue reading...

Unterschiede zwischen Proxmox Containers und Docker

LXC LXC ist ein Userspace Interface zur Eindämmung des Linux-Kernels und kann verwendet werden für Systemvirtualisierung. Durch eine mächtige API und einfache Tools ermöglicht es Linux Benutzern einfache Erstellung und Verwaltung von System Container. LXC ermöglicht ein komplettes OS in einem Container zu betreiben. LXD…

Continue reading...

Vaultwarden Backup mit Rclone

Vaultwarden ist eine alternative Implementation der Bitwarden Server API entwickelt in Rust, kompatibel mit allen Bitwarden clients. Vaultwarden eignet sich daher perfekt für self-hosted deployments, oder überall dort wo der offizielle Bitwarden Service nicht ideal geeignet ist. Dazu gibt es einmal das Vaultwarden Docker Image…

Continue reading...

docker (6)

Spring Boot on Kubernetes

Enable Kubernetes in Docker Desktop We will use Docker Desktop to provide us a Test Kubernetes Environment. Open Docker Desktop Settings, go to Tab "Kubernetes". Select "Enable Kubernetes", then "Apply & Restart". Now you should be able to see docker-desktop listed, if you run kubectl…

Continue reading...

Building Spring Boot Docker Images

Pre-Requirements Developer Environment ready with Docker, JDK, IDE A Java Spring Boot Project with a h2 in-memory DB Docker Hub account Create Docker File Create a Dockerfile with the following content: FROM openjdk:11-jre-slim ENV JAVA_OPTS " -Xms512m -Xmx512m -Djava.security.egd=file:///dev/./urandom" WORKDIR application COPY target/myapp-0.0.1-SNAPSHOT.jar ./ ENTRYPOINT…

Continue reading...

Infrastructure as Software

Summary This post is my summary (for my own sake) of the original full length post: https://www.justingarrison.com/blog/2022-06-01-infrastructure-as-software/ Writing your infrastructure in a DSL or any other general purpose coding language like Ansible, Pulumi, Terraform is not Infrastructure as Software. Any managed service to deploy infrastructure…

Continue reading...

Unterschiede zwischen Proxmox Containers und Docker

LXC LXC ist ein Userspace Interface zur Eindämmung des Linux-Kernels und kann verwendet werden für Systemvirtualisierung. Durch eine mächtige API und einfache Tools ermöglicht es Linux Benutzern einfache Erstellung und Verwaltung von System Container. LXC ermöglicht ein komplettes OS in einem Container zu betreiben. LXD…

Continue reading...

docker (6)

Vaultwarden Backup mit Rclone

Vaultwarden ist eine alternative Implementation der Bitwarden Server API entwickelt in Rust, kompatibel mit allen Bitwarden clients. Vaultwarden eignet sich daher perfekt für self-hosted deployments, oder überall dort wo der offizielle Bitwarden Service nicht ideal geeignet ist. Dazu gibt es einmal das Vaultwarden Docker Image…

Continue reading...
\ No newline at end of file diff --git a/tags/index.html b/tags/index.html index a7b1c2d..181c6a8 100644 --- a/tags/index.html +++ b/tags/index.html @@ -1,4 +1,4 @@ -All tags - Finecloud

Tags (63)

Collection of all tags

Tags (64)

Collection of all tags

linux (13)

Awk and Sed

awk and sed are text manipulation programs. You can use them for example to replace strings: echo image.jpg | sed 's/\.jpg/.png/' image.png or change order of strings: echo "hello world" | awk '{print $2, $1}' world hello awk and sed are harder to learn than…

Continue reading...

Deploy your Java Web App to Heroku

Requirements and Preparation Unfortunately Heroku currently only Supports Tomcat version 9.x. As a consequence you're not able to use the Java Jakarta Servlets, since they are only supported with Tomcat version 10.x. As a consequence you need to replace all your Jakarta Servlet imports with…

Continue reading...

Take care of your SSH identities

Did you know that your ssh Client sends the server all your public keys, one by one, until the server accepts one, when you try to authenticate via public key? Don't believe me? Try it out yourself: ssh whoami.filippo.io Someone could use this to find…

Continue reading...

Backup OPNsense to Nextcloud

What is OPNsense? OPNsense® is an open source, easy-to-use and easy-to-build FreeBSD based firewall and routing platform. OPNsense includes most of the features available in expensive commercial firewalls, and more in many cases. It brings the rich feature set of commercial offerings with the benefits…

Continue reading...

linux (14)

Awk and Sed

awk and sed are text manipulation programs. You can use them for example to replace strings: echo image.jpg | sed 's/\.jpg/.png/' image.png or change order of strings: echo "hello world" | awk '{print $2, $1}' world hello awk and sed are harder to learn than…

Continue reading...

Deploy your Java Web App to Heroku

Requirements and Preparation Unfortunately Heroku currently only Supports Tomcat version 9.x. As a consequence you're not able to use the Java Jakarta Servlets, since they are only supported with Tomcat version 10.x. As a consequence you need to replace all your Jakarta Servlet imports with…

Continue reading...

Take care of your SSH identities

Did you know that your ssh Client sends the server all your public keys, one by one, until the server accepts one, when you try to authenticate via public key? Don't believe me? Try it out yourself: ssh whoami.filippo.io Someone could use this to find…

Continue reading...

linux (13)

Java basics: Dates and Time

Local date Now Let's start with the basics, we just want to represent the date today and print that local date now: public class TimeTest { public static void main(String[] args) { LocalDate now = LocalDate.now(); System.out.println(now); } } output: 2022-08-29 Process finished with exit…

Continue reading...

ShellCheck

Beschreibung ShellCheck ist ein Tool, das Warnungen und Vorschläge für Bash/Sh-Shell-Skripte liefert. Das Tool kann verwendet werden für statische Code Analyse. Idealerweise wird das Tool in einer CI Pipeline integriert. Hier ein Beispiel einer Github Action Pipeline: name: Shellcheck on: pull_request: push: branches: - main…

Continue reading...

Monitor Proxmox mit Grafana und Prometheus

Obwohl Proxmox selbst ja sehr gute Monitoring Informationen direkt auf dem eigenen WebUI anzeigt werde ich um Grafana und Prometheus besser kennen zu lernen diese Tools nutzen um meinen Proxmox Host zu überwachen. Mit der Open-Source-Software von Grafana kann man Metriken, Protokolle und Ablaufverfolgungen, visualisieren,…

Continue reading...

Unterschiede zwischen Proxmox Containers und Docker

LXC LXC ist ein Userspace Interface zur Eindämmung des Linux-Kernels und kann verwendet werden für Systemvirtualisierung. Durch eine mächtige API und einfache Tools ermöglicht es Linux Benutzern einfache Erstellung und Verwaltung von System Container. LXC ermöglicht ein komplettes OS in einem Container zu betreiben. LXD…

Continue reading...

Kubernetes auf Proxmox mit Ansible und Terraform (Teil 1)

Einleitung In ersten Teil werden wir ein cloud-init Template erstellen, welches wir dann mit Terraform nutzen um die K8S VMs zu erzeugen. Damit wir mit Terraform unsere Kubernetes Nodes deployen können, brauchen wir ein Template. Das kann man entweder bereits mit Ansible machen, sieh dir…

Continue reading...

linux (14)

Backup OPNsense to Nextcloud

What is OPNsense? OPNsense® is an open source, easy-to-use and easy-to-build FreeBSD based firewall and routing platform. OPNsense includes most of the features available in expensive commercial firewalls, and more in many cases. It brings the rich feature set of commercial offerings with the benefits…

Continue reading...

Java basics: Dates and Time

Local date Now Let's start with the basics, we just want to represent the date today and print that local date now: public class TimeTest { public static void main(String[] args) { LocalDate now = LocalDate.now(); System.out.println(now); } } output: 2022-08-29 Process finished with exit…

Continue reading...

ShellCheck

Beschreibung ShellCheck ist ein Tool, das Warnungen und Vorschläge für Bash/Sh-Shell-Skripte liefert. Das Tool kann verwendet werden für statische Code Analyse. Idealerweise wird das Tool in einer CI Pipeline integriert. Hier ein Beispiel einer Github Action Pipeline: name: Shellcheck on: pull_request: push: branches: - main…

Continue reading...

Monitor Proxmox mit Grafana und Prometheus

Obwohl Proxmox selbst ja sehr gute Monitoring Informationen direkt auf dem eigenen WebUI anzeigt werde ich um Grafana und Prometheus besser kennen zu lernen diese Tools nutzen um meinen Proxmox Host zu überwachen. Mit der Open-Source-Software von Grafana kann man Metriken, Protokolle und Ablaufverfolgungen, visualisieren,…

Continue reading...

Unterschiede zwischen Proxmox Containers und Docker

LXC LXC ist ein Userspace Interface zur Eindämmung des Linux-Kernels und kann verwendet werden für Systemvirtualisierung. Durch eine mächtige API und einfache Tools ermöglicht es Linux Benutzern einfache Erstellung und Verwaltung von System Container. LXC ermöglicht ein komplettes OS in einem Container zu betreiben. LXD…

Continue reading...

linux (13)

Tabby Config-Sync auf Nextcloud einrichten

A terminal for the modern age Tabby ist ein anpassbares, Platform-Übergreifendes Terminal App für die Arbeit mit Lokalen Shells sowie Serial, SSH und Telnet Verbindungen. Aus diesen Gründen ist Tabby viel praktischer und moderner als Putty: Link zum App: https://tabby.sh/ Link zum Projekt auf GitHub:…

Continue reading...

Proxmox VE 7.2 Installation

Systemanforderungen Proxmox gibt folgende minimale Systemanforderungen an: Für produktive Workloads sind diese Anforderungen aber nicht gedacht. Daher sind die empfohlenen Systemanforderungen wie folgt: Da ich meine Proxmox Infrastruktur zum Start nur als Standalone LAB installieren will und für mein kleines Budget maximal viel Leistung erhalten…

Continue reading...

Proxmox VE 7.2 Übersicht

Die Architektur Proxmox VE ist eine Plattform zum Betrieben von virtuellen Maschinen und Container. Dabei ist die gesamte Proxmox VE Plattform open source und baisert auf Debian Linux. die VE Plattform besteht aus zwei virtualisierungs-technologien: Proxmox gibt es als single node, oder als Cluster mit…

Continue reading...

linux (14)

Kubernetes auf Proxmox mit Ansible und Terraform (Teil 1)

Einleitung In ersten Teil werden wir ein cloud-init Template erstellen, welches wir dann mit Terraform nutzen um die K8S VMs zu erzeugen. Damit wir mit Terraform unsere Kubernetes Nodes deployen können, brauchen wir ein Template. Das kann man entweder bereits mit Ansible machen, sieh dir…

Continue reading...

Tabby Config-Sync auf Nextcloud einrichten

A terminal for the modern age Tabby ist ein anpassbares, Platform-Übergreifendes Terminal App für die Arbeit mit Lokalen Shells sowie Serial, SSH und Telnet Verbindungen. Aus diesen Gründen ist Tabby viel praktischer und moderner als Putty: Link zum App: https://tabby.sh/ Link zum Projekt auf GitHub:…

Continue reading...

Proxmox VE 7.2 Installation

Systemanforderungen Proxmox gibt folgende minimale Systemanforderungen an: Für produktive Workloads sind diese Anforderungen aber nicht gedacht. Daher sind die empfohlenen Systemanforderungen wie folgt: Da ich meine Proxmox Infrastruktur zum Start nur als Standalone LAB installieren will und für mein kleines Budget maximal viel Leistung erhalten…

Continue reading...

Proxmox VE 7.2 Übersicht

Die Architektur Proxmox VE ist eine Plattform zum Betrieben von virtuellen Maschinen und Container. Dabei ist die gesamte Proxmox VE Plattform open source und baisert auf Debian Linux. die VE Plattform besteht aus zwei virtualisierungs-technologien: Proxmox gibt es als single node, oder als Cluster mit…

Continue reading...

maven (2)

Maven getting started

What is Maven? Declarative build management tool for automated builds Standardized directory structure Declarative dependency management Works with an XML control file (POM - Project Object Model) Open source, written in Java, for Java projects Pure command line tool IDEs offer integration Why Maven? Uniform…

Continue reading...

Java Serverlet mit Tomcat und Maven in VSCode

In diesem Artikel ist beschrieben, wie man Apache Tomcat direkt in VSCode nutzen kann. Voraussetzung ist, dass du auf deinem Gerät bereits eine Java JRE und Apache Maven installiert hast. Weiter brauchen wir in VSCode das Extension Pack for Java, du kannst dire in VSCode…

Continue reading...

maven (3)

Maven getting started

What is Maven? Declarative build management tool for automated builds Standardized directory structure Declarative dependency management Works with an XML control file (POM - Project Object Model) Open source, written in Java, for Java projects Pure command line tool IDEs offer integration Why Maven? Uniform…

Continue reading...

Java Serverlet mit Tomcat und Maven in VSCode

In diesem Artikel ist beschrieben, wie man Apache Tomcat direkt in VSCode nutzen kann. Voraussetzung ist, dass du auf deinem Gerät bereits eine Java JRE und Apache Maven installiert hast. Weiter brauchen wir in VSCode das Extension Pack for Java, du kannst dire in VSCode…

Continue reading...

regex (2)

Capture Groups in Java

Capture Groups Im letzten Post haben wir einen kleinen Einstieg in Regex mit Java gemacht. Nun sehen wir uns an, wie man Regex Pattern in Java mittels Capture Groups anwenden kann: String regex = "(1[-.\\s])?(\\d{3}[-.\\s]?)(\\d{3}[-.\\s]?)\\d{4}"; String phoneNumber = "12.523.231.4234"; Pattern pat = Pattern.compile(regex); Matcher mat =…

Continue reading...

Einstieg in Regex mit Java

Was ist Regex? Regex steht für Regular expressions und ist eine Technik, Technologie und Sprache an und für sich, die verwendet werden kann zum Ausdrücken von Textmustern mit Symbolen. Und diese Symbole sind selbst Text. Damit lassen wir verschiedene Textteile und Zeichen andere Textfolgen darstellen. In…

Continue reading...

regex (3)

Capture Groups in Java

Capture Groups Im letzten Post haben wir einen kleinen Einstieg in Regex mit Java gemacht. Nun sehen wir uns an, wie man Regex Pattern in Java mittels Capture Groups anwenden kann: String regex = "(1[-.\\s])?(\\d{3}[-.\\s]?)(\\d{3}[-.\\s]?)\\d{4}"; String phoneNumber = "12.523.231.4234"; Pattern pat = Pattern.compile(regex); Matcher mat =…

Continue reading...

Einstieg in Regex mit Java

Was ist Regex? Regex steht für Regular expressions und ist eine Technik, Technologie und Sprache an und für sich, die verwendet werden kann zum Ausdrücken von Textmustern mit Symbolen. Und diese Symbole sind selbst Text. Damit lassen wir verschiedene Textteile und Zeichen andere Textfolgen darstellen. In…

Continue reading...

renovate (1)

\ No newline at end of file diff --git a/tags/softwareentwicklung/index.html b/tags/softwareentwicklung/index.html index 8e28940..b466e64 100644 --- a/tags/softwareentwicklung/index.html +++ b/tags/softwareentwicklung/index.html @@ -1,4 +1,4 @@ -Tag: software development - Finecloud

software development (54)

GitHub Codespace

What is a Codespace? A codespace is a development environment that's hosted in the cloud. You can customize your project for GitHub Codespaces by committing configuration files to your repository (also known as configuration-as-code), which creates a repeatable codespace configuration for all users of your…

Continue reading...

How to do a code review

This Blog post is my personal summary of Googles code review process Make sure to review every line of code you’ve been asked to review, look at the context, make sure you’re improving code health, and compliment developers on good things that they do. Look at…

Continue reading...

Building a GraphQL service

Let's build a GraphQL Spring Application that will accept GraphQL requests at http://localhost:8080/graphql. First let's navigate to https://start.spring.io. This service pulls in all the dependencies you need for an application and does most of the setup for you. GraphQL is a query language to retrieve…

Continue reading...

Microservices

This Post is a summary of the famous Article about Microservices: https://martinfowler.com/articles/microservices.html The text discusses the concept of "Microservice Architecture," which is an approach to designing software applications as a suite of independently deployable services. It highlights that there is no precise definition but outlines…

Continue reading...

The Concept of API Contracts

What is it about? We define an API contract as a formal agreement between a software provider and a consumer that abstractly communicates how to interact with each other. This contract defines how API providers and consumers interact, what data exchanges looks like, and how…

Continue reading...

software development (55)

GitHub Codespace

What is a Codespace? A codespace is a development environment that's hosted in the cloud. You can customize your project for GitHub Codespaces by committing configuration files to your repository (also known as configuration-as-code), which creates a repeatable codespace configuration for all users of your…

Continue reading...

How to do a code review

This Blog post is my personal summary of Googles code review process Make sure to review every line of code you’ve been asked to review, look at the context, make sure you’re improving code health, and compliment developers on good things that they do. Look at…

Continue reading...

Building a GraphQL service

Let's build a GraphQL Spring Application that will accept GraphQL requests at http://localhost:8080/graphql. First let's navigate to https://start.spring.io. This service pulls in all the dependencies you need for an application and does most of the setup for you. GraphQL is a query language to retrieve…

Continue reading...

Microservices

This Post is a summary of the famous Article about Microservices: https://martinfowler.com/articles/microservices.html The text discusses the concept of "Microservice Architecture," which is an approach to designing software applications as a suite of independently deployable services. It highlights that there is no precise definition but outlines…

Continue reading...

software development (54)

Dateien und Verzeichnisse unter Java

Dateioperationen mit java.io werden in Java immer, direkt oder indirekt, durch ein Objekt des Typs java.io.File abgebildet. Dabei kann File aber nicht selbst aus Dateien lesen, oder in sie schreiben, dazu benötigt man einen Reader oder Writer (für Textdateien) resp. einen InputStream oder OutputStream (für…

Continue reading...

Genereische Java Methoden und beschränkte Typen

Eine Methode kann einen typisierten Parameter erzwingen und einen typisierten Wert zurückgeben: public List<Integer> parseAlleInts(List<String> strings){ List<Integer> ergebnis = new ArrayList<>(); for (String s : strings){ ergebnis.add(Integer.parseInt(s)); } return ergebnis; } So ist es möglich eine Liste von Strings als Paramter in eine Liste von…

Continue reading...

Java Collection Iteratoren

Diese Collection Methode kann dazu verwendet werden, über alle Werte einer Collection zu iterieren: die Methode iterator, gibt ein Objekt vom Typ Iterator zurück. Mit der Methode hasNext wird geprüft, ob es noch ein weiteres Element in der Collection gibt, next gibt das nächste Element…

Continue reading...

Java Collection Sets

Sets eignen sich für die Bearbeitung einer mathematischen Menge. Set kann somit keine identische Elemente enthalten und kann keine interneReihenfolge haben. Deshalb gibt es für Set auch keine Methoden die den direkten Zugriff auf ein Element ermöglichen. Um auf ein Element eines Set zuzugreifen muss…

Continue reading...

Java Collection Listen

Listen sind Collections, die am ehesten einem Array entsprechen. Die Elemente bleiben in der Reihenfolge wie sie hinzugefügt werden und sie können auf einzelne Positionen im Index der Liste zugreifen: lesen mit get(index) und schreiben mit set(index, element). Damit ist mit Listen alles möglich, was…

Continue reading...

software development (55)

Netzwerkkommunikation mit Java

In Java gibt es keinen nennenswerten Unterschied wischen I/O mit Daten und I/O mit Netzwerkverbindungen. In beiden Fällen basiert die Ein- und Ausgabe auf InputStream und OutputStream, der Unterschied liegt nur darin, wo diese Datenströme herkommen. Bei der Netzwerkkommunikation mit dem TCP-Protokoll kommen sie aus…

Continue reading...

Dateien und Verzeichnisse unter Java

Dateioperationen mit java.io werden in Java immer, direkt oder indirekt, durch ein Objekt des Typs java.io.File abgebildet. Dabei kann File aber nicht selbst aus Dateien lesen, oder in sie schreiben, dazu benötigt man einen Reader oder Writer (für Textdateien) resp. einen InputStream oder OutputStream (für…

Continue reading...

Genereische Java Methoden und beschränkte Typen

Eine Methode kann einen typisierten Parameter erzwingen und einen typisierten Wert zurückgeben: public List<Integer> parseAlleInts(List<String> strings){ List<Integer> ergebnis = new ArrayList<>(); for (String s : strings){ ergebnis.add(Integer.parseInt(s)); } return ergebnis; } So ist es möglich eine Liste von Strings als Paramter in eine Liste von…

Continue reading...

Java Collection Iteratoren

Diese Collection Methode kann dazu verwendet werden, über alle Werte einer Collection zu iterieren: die Methode iterator, gibt ein Objekt vom Typ Iterator zurück. Mit der Methode hasNext wird geprüft, ob es noch ein weiteres Element in der Collection gibt, next gibt das nächste Element…

Continue reading...

Java Collection Sets

Sets eignen sich für die Bearbeitung einer mathematischen Menge. Set kann somit keine identische Elemente enthalten und kann keine interneReihenfolge haben. Deshalb gibt es für Set auch keine Methoden die den direkten Zugriff auf ein Element ermöglichen. Um auf ein Element eines Set zuzugreifen muss…

Continue reading...

software development (54)

Java Collections

Collections sind ganz alltägliche Java Objekte. Im Gegensatz zu Arrays sind Collections nicht durch native Methoden und einem zusammenhängenden Speicherbereich optimiert, sie haben auch keine eigene Syntax. Die Vorteile von Collections sind der Benutzerkomfort, da sie über eine umfangreichere und komfortablere API verfügen. Zudem können…

Continue reading...

Java Varargs

Varargs, auch Parameter-Listen genannt können in Java Arrays verwendet werden, um eine dynamische Anzahl von Parametern entgegenzunehmen. public static int max(int… numbers){ int result = Integer.MIN_VALUE; for (int number : numbers){ if (number > result){ result = number; } } return result; } Diese Methode…

Continue reading...

Die for-each Schleife

Die for-each Schleife ist speziell für Arrays und Collections gedacht, denn diese Schleife enthält keine Zählvariable, enthält aber nacheinander alle Einträge des Arrays oder der Collection. Buch[] buecher = …; for (Buch buch : buecher){ System.out.println(buch.getTitel()); } Dabei wird in den Klammern der Schleife eine…

Continue reading...

Mehrdimensionale Java Arrays

Eindimensionales Array Nebst den eindimensionalen Java Arrays gibt es auch mehrdimensionale Arrays. Hier ein Beispiel eines eindimensionalen Java Arrays: int[] zahlen = new int[]{1, 2, 3, 4}; Ein mehrdimensionales Array könnte beispielsweise ein Schachfeld sein: Schachfigur[][] schachbrett = new Schachfigur[8][8]; Mehrdimensionale Arrays sind nicht auf…

Continue reading...

software development (55)

Java Collection Listen

Listen sind Collections, die am ehesten einem Array entsprechen. Die Elemente bleiben in der Reihenfolge wie sie hinzugefügt werden und sie können auf einzelne Positionen im Index der Liste zugreifen: lesen mit get(index) und schreiben mit set(index, element). Damit ist mit Listen alles möglich, was…

Continue reading...

Java Collections

Collections sind ganz alltägliche Java Objekte. Im Gegensatz zu Arrays sind Collections nicht durch native Methoden und einem zusammenhängenden Speicherbereich optimiert, sie haben auch keine eigene Syntax. Die Vorteile von Collections sind der Benutzerkomfort, da sie über eine umfangreichere und komfortablere API verfügen. Zudem können…

Continue reading...

Java Varargs

Varargs, auch Parameter-Listen genannt können in Java Arrays verwendet werden, um eine dynamische Anzahl von Parametern entgegenzunehmen. public static int max(int… numbers){ int result = Integer.MIN_VALUE; for (int number : numbers){ if (number > result){ result = number; } } return result; } Diese Methode…

Continue reading...

Die for-each Schleife

Die for-each Schleife ist speziell für Arrays und Collections gedacht, denn diese Schleife enthält keine Zählvariable, enthält aber nacheinander alle Einträge des Arrays oder der Collection. Buch[] buecher = …; for (Buch buch : buecher){ System.out.println(buch.getTitel()); } Dabei wird in den Klammern der Schleife eine…

Continue reading...

Mehrdimensionale Java Arrays

Eindimensionales Array Nebst den eindimensionalen Java Arrays gibt es auch mehrdimensionale Arrays. Hier ein Beispiel eines eindimensionalen Java Arrays: int[] zahlen = new int[]{1, 2, 3, 4}; Ein mehrdimensionales Array könnte beispielsweise ein Schachfeld sein: Schachfigur[][] schachbrett = new Schachfigur[8][8]; Mehrdimensionale Arrays sind nicht auf…

Continue reading...

software development (54)

Spring Boot on Kubernetes

Enable Kubernetes in Docker Desktop We will use Docker Desktop to provide us a Test Kubernetes Environment. Open Docker Desktop Settings, go to Tab "Kubernetes". Select "Enable Kubernetes", then "Apply & Restart". Now you should be able to see docker-desktop listed, if you run kubectl…

Continue reading...

Building Spring Boot Docker Images

Pre-Requirements Developer Environment ready with Docker, JDK, IDE A Java Spring Boot Project with a h2 in-memory DB Docker Hub account Create Docker File Create a Dockerfile with the following content: FROM openjdk:11-jre-slim ENV JAVA_OPTS " -Xms512m -Xmx512m -Djava.security.egd=file:///dev/./urandom" WORKDIR application COPY target/myapp-0.0.1-SNAPSHOT.jar ./ ENTRYPOINT…

Continue reading...

Data Validation Overview

What is Validation? Validation is a process of making assertions against data to ensure data integrity Is a value required? How long is a phone number? Is it a good date? What is the maximum length of a string? Some refer to data validation as…

Continue reading...

Data Transfer Objects

Data Transfer Objects DTOs - Data Transfer Objects DTOs are simple Java POJOs DTOs are data structures, generally should NOT have behavior DTOs are objects used to transfer data between producers and consumers Controller models are typically DTOs Why Not Entities? Database Entities are also…

Continue reading...

Spring Exception Handling

HTTP Status Codes 100 Series - Informational Responses • 200 Series - Successful Responses 300 Series - Redirection Responses 400 Series - Client Error Responses 500 Series - Server Error Responses Use of HTTP Status Codes 200 Series are used when the request completes as…

Continue reading...

software development (55)

The Concept of API Contracts

What is it about? We define an API contract as a formal agreement between a software provider and a consumer that abstractly communicates how to interact with each other. This contract defines how API providers and consumers interact, what data exchanges looks like, and how…

Continue reading...

Spring Boot on Kubernetes

Enable Kubernetes in Docker Desktop We will use Docker Desktop to provide us a Test Kubernetes Environment. Open Docker Desktop Settings, go to Tab "Kubernetes". Select "Enable Kubernetes", then "Apply & Restart". Now you should be able to see docker-desktop listed, if you run kubectl…

Continue reading...

Building Spring Boot Docker Images

Pre-Requirements Developer Environment ready with Docker, JDK, IDE A Java Spring Boot Project with a h2 in-memory DB Docker Hub account Create Docker File Create a Dockerfile with the following content: FROM openjdk:11-jre-slim ENV JAVA_OPTS " -Xms512m -Xmx512m -Djava.security.egd=file:///dev/./urandom" WORKDIR application COPY target/myapp-0.0.1-SNAPSHOT.jar ./ ENTRYPOINT…

Continue reading...

Data Validation Overview

What is Validation? Validation is a process of making assertions against data to ensure data integrity Is a value required? How long is a phone number? Is it a good date? What is the maximum length of a string? Some refer to data validation as…

Continue reading...

Data Transfer Objects

Data Transfer Objects DTOs - Data Transfer Objects DTOs are simple Java POJOs DTOs are data structures, generally should NOT have behavior DTOs are objects used to transfer data between producers and consumers Controller models are typically DTOs Why Not Entities? Database Entities are also…

Continue reading...

software development (54)

Testing with MockMVC

Why use Spring MockMVC? Spring MockMVC allows you to test the controller interactions in a servlet context without the application running in an application server. Mockito is the most popular mocking framework for testing Java Mocks (aka Test Doubles) are alternate implementations of objects to…

Continue reading...

Project Lombok

Intro Project Lombok is a Java library that provides a set of annotations and utility classes that help to reduce boilerplate code in Java projects. It offers features such as automatic generation of getters, setters, equals, hashCode, toString, and constructors, as well as support for…

Continue reading...

Spring Bean Lifecycle

Part 1 Of course, instantiating the class will come first. The class will populate properties after it has been created. It will therefore set up any properties you may have. Then, if they exist, we do have some interfaces that we can implement. These methods…

Continue reading...

Spring Annotations

If you want to develop a Spring Application you need to know when to use which Annotation. Spring’s dependency injection capability includes the following annotations:

Continue reading...

Conventional commits

What are Conventional commits Conventional Commits is a convention for writing commit messages that provides structure and consistency to a project's version control history. It's based on the idea of defining a standard format for commit messages that makes it easier for developers to understand…

Continue reading...

software development (55)

Spring Exception Handling

HTTP Status Codes 100 Series - Informational Responses • 200 Series - Successful Responses 300 Series - Redirection Responses 400 Series - Client Error Responses 500 Series - Server Error Responses Use of HTTP Status Codes 200 Series are used when the request completes as…

Continue reading...

Testing with MockMVC

Why use Spring MockMVC? Spring MockMVC allows you to test the controller interactions in a servlet context without the application running in an application server. Mockito is the most popular mocking framework for testing Java Mocks (aka Test Doubles) are alternate implementations of objects to…

Continue reading...

Project Lombok

Intro Project Lombok is a Java library that provides a set of annotations and utility classes that help to reduce boilerplate code in Java projects. It offers features such as automatic generation of getters, setters, equals, hashCode, toString, and constructors, as well as support for…

Continue reading...

Spring Bean Lifecycle

Part 1 Of course, instantiating the class will come first. The class will populate properties after it has been created. It will therefore set up any properties you may have. Then, if they exist, we do have some interfaces that we can implement. These methods…

Continue reading...

Spring Annotations

If you want to develop a Spring Application you need to know when to use which Annotation. Spring’s dependency injection capability includes the following annotations:

Continue reading...

software development (54)

CleanCode

Summary of 'Clean code' by Robert C. Martin: https://gist.github.com/wojteklu/73c6914cc446146b8b533c0988cf8d29 Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility…

Continue reading...

JavaScript advanced features

New Features New versions of JavaScript, such as ES6, ES2016, 2017, etc., come with many new features, however it is still ECMAScript Many of the new features are syntactic sugar or extend the functionality only marginal Template Literals Template literals are string literals with support…

Continue reading...

JavaScript and the browser

The DOM Based on the received HTML document the browser builds up a model of the document structure, the Document Object Model (DOM) The DOM has a tree structure and each node of the document is represented by an object The browser renders the page…

Continue reading...

JavaScript objects

Object An object is a collection of properties A property has a name and a value An object can be seen as associative array (map) where the keys in the array are the names of the object’s properties // Create object as literal const bob…

Continue reading...

Difference between heap and stack

In this Post I try to explain the difference between the heap and the stack. It's just a very high level amateur explanation, there is a lot more to read and learn about this Topics. This Drawing helps me a lot to understand the basic…

Continue reading...

software development (55)

Conventional commits

What are Conventional commits Conventional Commits is a convention for writing commit messages that provides structure and consistency to a project's version control history. It's based on the idea of defining a standard format for commit messages that makes it easier for developers to understand…

Continue reading...

CleanCode

Summary of 'Clean code' by Robert C. Martin: https://gist.github.com/wojteklu/73c6914cc446146b8b533c0988cf8d29 Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility…

Continue reading...

JavaScript advanced features

New Features New versions of JavaScript, such as ES6, ES2016, 2017, etc., come with many new features, however it is still ECMAScript Many of the new features are syntactic sugar or extend the functionality only marginal Template Literals Template literals are string literals with support…

Continue reading...

JavaScript and the browser

The DOM Based on the received HTML document the browser builds up a model of the document structure, the Document Object Model (DOM) The DOM has a tree structure and each node of the document is represented by an object The browser renders the page…

Continue reading...

JavaScript objects

Object An object is a collection of properties A property has a name and a value An object can be seen as associative array (map) where the keys in the array are the names of the object’s properties // Create object as literal const bob…

Continue reading...

software development (54)

JavaScript arrays

Array An array combines multiple values in a single variable Arrays are helpful if the number of values is huge or dynamic Each value of an array has a unique numerical index // Normal variables hold exactly one value const colorA = "blue"; const colorB…

Continue reading...

JavaScript functions

Function Expression A function expression starts with the keyword function followed by the function arguments in parentheses and the function body in curly braces: const square = function(x) { return x * x; }; console.log(square(4)); // >> 16 Function Scope Each function defines a scope…

Continue reading...

JavaScript basics

What JavaScript is A scripting language originally designed for web browsers Object-oriented, however prototype-based and not class-based Supporting first-class functions A multi-paradigm language, supports imperative, object-oriented and functional programming style Untyped Moving from an interpreted language to just-in-time compilation Nowadays used for server-side programming too…

Continue reading...

Deploy your Java Web App to Heroku

Requirements and Preparation Unfortunately Heroku currently only Supports Tomcat version 9.x. As a consequence you're not able to use the Java Jakarta Servlets, since they are only supported with Tomcat version 10.x. As a consequence you need to replace all your Jakarta Servlet imports with…

Continue reading...

Maven getting started

What is Maven? Declarative build management tool for automated builds Standardized directory structure Declarative dependency management Works with an XML control file (POM - Project Object Model) Open source, written in Java, for Java projects Pure command line tool IDEs offer integration Why Maven? Uniform…

Continue reading...

software development (55)

Difference between heap and stack

In this Post I try to explain the difference between the heap and the stack. It's just a very high level amateur explanation, there is a lot more to read and learn about this Topics. This Drawing helps me a lot to understand the basic…

Continue reading...

JavaScript arrays

Array An array combines multiple values in a single variable Arrays are helpful if the number of values is huge or dynamic Each value of an array has a unique numerical index // Normal variables hold exactly one value const colorA = "blue"; const colorB…

Continue reading...

JavaScript functions

Function Expression A function expression starts with the keyword function followed by the function arguments in parentheses and the function body in curly braces: const square = function(x) { return x * x; }; console.log(square(4)); // >> 16 Function Scope Each function defines a scope…

Continue reading...

JavaScript basics

What JavaScript is A scripting language originally designed for web browsers Object-oriented, however prototype-based and not class-based Supporting first-class functions A multi-paradigm language, supports imperative, object-oriented and functional programming style Untyped Moving from an interpreted language to just-in-time compilation Nowadays used for server-side programming too…

Continue reading...

Deploy your Java Web App to Heroku

Requirements and Preparation Unfortunately Heroku currently only Supports Tomcat version 9.x. As a consequence you're not able to use the Java Jakarta Servlets, since they are only supported with Tomcat version 10.x. As a consequence you need to replace all your Jakarta Servlet imports with…

Continue reading...

software development (54)

Handling Exceptions in Web UI

The Issue There is nothing worse than presenting a Java Stacktrace in a WebUI, full of technical Details about your Server environment of the Web App itself: So how can we avoid this? You don't want to share this informations with the users, it would…

Continue reading...

Getting stared with the Spring Framework

What is the Spring Framework Spring is the world's most popular Java framework and makes programming Java quicker, easier, and safer for everybody. Spring’s focus on speed, simplicity, and productivity. You can select and generate your Spring Package online: https://start.spring.io/ Lets make a Gradle Project,…

Continue reading...

Java and databases use SQL joins

Introduction Let's imagine we have two Tables now, people and addresses. We want to find out how many people live at the same address. This is our current Java and SQL approach: repository/PeopleRepository.java @Override @SQL(value = FIND_BY_ID_SQL, operationType = CrudOperation.FIND_BY_ID) @SQL(value = FIND_ALL_SQL, operationType =…

Continue reading...

Java working with databases

Introduction In this Post I will describe how you can easily learn, test and play around with Java interacting with SQL Databases. This post is a summary of my Java learning course I'm taking on udemy. The post is not intended to be spread around…

Continue reading...

Java basics: Dates and Time

Local date Now Let's start with the basics, we just want to represent the date today and print that local date now: public class TimeTest { public static void main(String[] args) { LocalDate now = LocalDate.now(); System.out.println(now); } } output: 2022-08-29 Process finished with exit…

Continue reading...

software development (55)

Maven getting started

What is Maven? Declarative build management tool for automated builds Standardized directory structure Declarative dependency management Works with an XML control file (POM - Project Object Model) Open source, written in Java, for Java projects Pure command line tool IDEs offer integration Why Maven? Uniform…

Continue reading...

Handling Exceptions in Web UI

The Issue There is nothing worse than presenting a Java Stacktrace in a WebUI, full of technical Details about your Server environment of the Web App itself: So how can we avoid this? You don't want to share this informations with the users, it would…

Continue reading...

Getting stared with the Spring Framework

What is the Spring Framework Spring is the world's most popular Java framework and makes programming Java quicker, easier, and safer for everybody. Spring’s focus on speed, simplicity, and productivity. You can select and generate your Spring Package online: https://start.spring.io/ Lets make a Gradle Project,…

Continue reading...

Java and databases use SQL joins

Introduction Let's imagine we have two Tables now, people and addresses. We want to find out how many people live at the same address. This is our current Java and SQL approach: repository/PeopleRepository.java @Override @SQL(value = FIND_BY_ID_SQL, operationType = CrudOperation.FIND_BY_ID) @SQL(value = FIND_ALL_SQL, operationType =…

Continue reading...

Java working with databases

Introduction In this Post I will describe how you can easily learn, test and play around with Java interacting with SQL Databases. This post is a summary of my Java learning course I'm taking on udemy. The post is not intended to be spread around…

Continue reading...

software development (54)

Java basics: Optionals

What are Optionals? For the the number one use case for them has to do with null values. So whenever we're dealing with objects in Java, we store references to objects in variables. And those variables may or may not actually be pointing back to…

Continue reading...

Java basics: Generics

What are Generics? What if we could write a single sort method that sort the elements in an Integer array, a String array, or an array of any type that supports ordering? Java Generics enable programmers to specify, with a single method declaration, a set…

Continue reading...

Java basics: Exceptions

What are Exceptions? An exception is an event, commonly it is a problem that arises during the execution of a program. When an Exception occurs the normal program is disrupted and the program/Application terminates abnormally, which is not recommended. Unexpected termination of an Application is…

Continue reading...

Capture Groups in Java

Capture Groups Im letzten Post haben wir einen kleinen Einstieg in Regex mit Java gemacht. Nun sehen wir uns an, wie man Regex Pattern in Java mittels Capture Groups anwenden kann: String regex = "(1[-.\\s])?(\\d{3}[-.\\s]?)(\\d{3}[-.\\s]?)\\d{4}"; String phoneNumber = "12.523.231.4234"; Pattern pat = Pattern.compile(regex); Matcher mat =…

Continue reading...

Einstieg in Regex mit Java

Was ist Regex? Regex steht für Regular expressions und ist eine Technik, Technologie und Sprache an und für sich, die verwendet werden kann zum Ausdrücken von Textmustern mit Symbolen. Und diese Symbole sind selbst Text. Damit lassen wir verschiedene Textteile und Zeichen andere Textfolgen darstellen. In…

Continue reading...

software development (55)

Java basics: Dates and Time

Local date Now Let's start with the basics, we just want to represent the date today and print that local date now: public class TimeTest { public static void main(String[] args) { LocalDate now = LocalDate.now(); System.out.println(now); } } output: 2022-08-29 Process finished with exit…

Continue reading...

Java basics: Optionals

What are Optionals? For the the number one use case for them has to do with null values. So whenever we're dealing with objects in Java, we store references to objects in variables. And those variables may or may not actually be pointing back to…

Continue reading...

Java basics: Generics

What are Generics? What if we could write a single sort method that sort the elements in an Integer array, a String array, or an array of any type that supports ordering? Java Generics enable programmers to specify, with a single method declaration, a set…

Continue reading...

Java basics: Exceptions

What are Exceptions? An exception is an event, commonly it is a problem that arises during the execution of a program. When an Exception occurs the normal program is disrupted and the program/Application terminates abnormally, which is not recommended. Unexpected termination of an Application is…

Continue reading...

Capture Groups in Java

Capture Groups Im letzten Post haben wir einen kleinen Einstieg in Regex mit Java gemacht. Nun sehen wir uns an, wie man Regex Pattern in Java mittels Capture Groups anwenden kann: String regex = "(1[-.\\s])?(\\d{3}[-.\\s]?)(\\d{3}[-.\\s]?)\\d{4}"; String phoneNumber = "12.523.231.4234"; Pattern pat = Pattern.compile(regex); Matcher mat =…

Continue reading...

software development (54)

Java Access-Modifier

Sobald ein Feld sichtbar ist, bedeutet das auch, das es gelesen und beschrieben werden kann. Die Access-Modifier steuern, von wo auf Felder und Methoden eines Objekts zugegriffen werden kann: Modifier Wer darf zugreifen? public Auf public-Objekte/Felder und Methoden darf ohne Einschränkungen von überall aus zugegriffen…

Continue reading...

Java Namenskonventionen

In diesem Blog fasse ich die Java Namenskonventionen kurz zusammen: Typ Namenskonvention Beispiele Class Sollte mit Grossbuchstaben beginnen und sollte ein Substantiv wie Farbe, Knopf, System, Faden usw. sein. Verwenden Sie geeignete Wörter anstelle von Akronymen. public class Employee { //code snippet } Interface Sollte…

Continue reading...

JVM und JDK unter der Haube

Woher lädt Java eigentlich seine JDK Klassen? Beim Start einer Applikation kann mit -cp ein Klassenpfad angegeben werden, in welchem sich Klassen befinden, die man verwenden möchte. Das ist das normale Vorgehen, wie man Klassen integriert. Doch woher hat das JDK seine eigenen Klassen? Um…

Continue reading...

GUIs mit JavaFX

Einführung JavaFX ist das modernste in der Java SE integrierte GUI-Framework zum Erstellen grafischer Benutzeroberflächen (GUI: Graphical User Interface). JavaFX ist eine reine Java-Bibliothek, die zwar, auch deklarative Definitionen von GUIs über XML ermöglicht, die aber im Kern aus Java-Klassen besteht. Seit Java 8 liegt…

Continue reading...

Java und DBs

Java kommt von Haus aus mit einer relationalen Open-Source-Datenbank, der Apache-Derby-Datenbank, welche in reinem Java geschrieben ist und sich dadurch nicht nur als eigener Prozess betreiben lässt, sondern auch als Embeded Bestandteil einer Java Anwendung betrieben werden kann. Das ist jedoch für den produktiven Betrieb…

Continue reading...

software development (55)

Einstieg in Regex mit Java

Was ist Regex? Regex steht für Regular expressions und ist eine Technik, Technologie und Sprache an und für sich, die verwendet werden kann zum Ausdrücken von Textmustern mit Symbolen. Und diese Symbole sind selbst Text. Damit lassen wir verschiedene Textteile und Zeichen andere Textfolgen darstellen. In…

Continue reading...

Java Access-Modifier

Sobald ein Feld sichtbar ist, bedeutet das auch, das es gelesen und beschrieben werden kann. Die Access-Modifier steuern, von wo auf Felder und Methoden eines Objekts zugegriffen werden kann: Modifier Wer darf zugreifen? public Auf public-Objekte/Felder und Methoden darf ohne Einschränkungen von überall aus zugegriffen…

Continue reading...

Java Namenskonventionen

In diesem Blog fasse ich die Java Namenskonventionen kurz zusammen: Typ Namenskonvention Beispiele Class Sollte mit Grossbuchstaben beginnen und sollte ein Substantiv wie Farbe, Knopf, System, Faden usw. sein. Verwenden Sie geeignete Wörter anstelle von Akronymen. public class Employee { //code snippet } Interface Sollte…

Continue reading...

JVM und JDK unter der Haube

Woher lädt Java eigentlich seine JDK Klassen? Beim Start einer Applikation kann mit -cp ein Klassenpfad angegeben werden, in welchem sich Klassen befinden, die man verwenden möchte. Das ist das normale Vorgehen, wie man Klassen integriert. Doch woher hat das JDK seine eigenen Klassen? Um…

Continue reading...

GUIs mit JavaFX

Einführung JavaFX ist das modernste in der Java SE integrierte GUI-Framework zum Erstellen grafischer Benutzeroberflächen (GUI: Graphical User Interface). JavaFX ist eine reine Java-Bibliothek, die zwar, auch deklarative Definitionen von GUIs über XML ermöglicht, die aber im Kern aus Java-Klassen besteht. Seit Java 8 liegt…

Continue reading...

software development (54)

HTTP Response Status Codes

Die erste Ziffer des Status-Codes definiert die Klasse der Response. Die letzten zwei Ziffern haben keine Bedeutung für die Kategorisierung. Es gibt fünf unterschiedliche Response Klassen: Nachfolgend eine Zusammenstellung der häufigsten HTTP-Codes denen man im Alltag begegnet: HTTP-Statuscode Bedeutung 200 OK Der Request wurde ohne…

Continue reading...

HTTP Methoden - RFC9110

Was geschieht eigentlich wenn ich eine Webseite aufrufe? Wir überspringen den Ersten Teil mit DNS und gehen davon aus, dass die URL bereits im DNS Cache ist. Um diese Frage zu beantworten, müssen wir uns mit den Grundlagen des HTTP-Protokolls befassen. Der Aufruf der Webseite…

Continue reading...

Java Serverlet mit Tomcat und Maven in VSCode

In diesem Artikel ist beschrieben, wie man Apache Tomcat direkt in VSCode nutzen kann. Voraussetzung ist, dass du auf deinem Gerät bereits eine Java JRE und Apache Maven installiert hast. Weiter brauchen wir in VSCode das Extension Pack for Java, du kannst dire in VSCode…

Continue reading...

Java Serverlet Container installieren

Einleitung Das Serverlet-Framework Jakarta EE ermöglicht die Entwicklung von Anwendungen für eine grosse Anzahl paralleler Benutzer die über einen Web-Browser zugreifen. Dazu ist besonders die Serverlet-API von JEE von Interesse. Diese API-Klasse wartet auf eingehende Netzwerkverbindungen und reagiert mit einer entsprechenden Antwort. Für die übertragenen…

Continue reading...

Netzwerkkommunikation mit Java

In Java gibt es keinen nennenswerten Unterschied wischen I/O mit Daten und I/O mit Netzwerkverbindungen. In beiden Fällen basiert die Ein- und Ausgabe auf InputStream und OutputStream, der Unterschied liegt nur darin, wo diese Datenströme herkommen. Bei der Netzwerkkommunikation mit dem TCP-Protokoll kommen sie aus…

Continue reading...

software development (55)

Java und DBs

Java kommt von Haus aus mit einer relationalen Open-Source-Datenbank, der Apache-Derby-Datenbank, welche in reinem Java geschrieben ist und sich dadurch nicht nur als eigener Prozess betreiben lässt, sondern auch als Embeded Bestandteil einer Java Anwendung betrieben werden kann. Das ist jedoch für den produktiven Betrieb…

Continue reading...

HTTP Response Status Codes

Die erste Ziffer des Status-Codes definiert die Klasse der Response. Die letzten zwei Ziffern haben keine Bedeutung für die Kategorisierung. Es gibt fünf unterschiedliche Response Klassen: Nachfolgend eine Zusammenstellung der häufigsten HTTP-Codes denen man im Alltag begegnet: HTTP-Statuscode Bedeutung 200 OK Der Request wurde ohne…

Continue reading...

HTTP Methoden - RFC9110

Was geschieht eigentlich wenn ich eine Webseite aufrufe? Wir überspringen den Ersten Teil mit DNS und gehen davon aus, dass die URL bereits im DNS Cache ist. Um diese Frage zu beantworten, müssen wir uns mit den Grundlagen des HTTP-Protokolls befassen. Der Aufruf der Webseite…

Continue reading...

Java Serverlet mit Tomcat und Maven in VSCode

In diesem Artikel ist beschrieben, wie man Apache Tomcat direkt in VSCode nutzen kann. Voraussetzung ist, dass du auf deinem Gerät bereits eine Java JRE und Apache Maven installiert hast. Weiter brauchen wir in VSCode das Extension Pack for Java, du kannst dire in VSCode…

Continue reading...

Java Serverlet Container installieren

Einleitung Das Serverlet-Framework Jakarta EE ermöglicht die Entwicklung von Anwendungen für eine grosse Anzahl paralleler Benutzer die über einen Web-Browser zugreifen. Dazu ist besonders die Serverlet-API von JEE von Interesse. Diese API-Klasse wartet auf eingehende Netzwerkverbindungen und reagiert mit einer entsprechenden Antwort. Für die übertragenen…

Continue reading...

Take care of your SSH identities

Did you know that your ssh Client sends the server all your public keys, one by one, until the server accepts one, when you try to authenticate via public key?

Don't believe me? Try it out yourself: 

ssh whoami.filippo.io

Someone could use this to find out which public keys you have installed on your Client. You don't what this, don't you? So how can we avoid the leak of our Clients Public Keys? There is an easy fix, just add this at the end of your ~/.ssh/config file:

Host *
    PubkeyAuthentication no
    IdentitiesOnly yes

Also make sure you don't use just one key for all connections. I hope don't use one password for all your logins - so why should you use one key for all your logins?

It is recommended to use one specific key for each host:

Host github.com
    PubkeyAuthentication yes
  IdentityFile ~/.ssh/github_id_ed25519

 

Take care of your SSH identities

Did you know that your ssh Client sends the server all your public keys, one by one, until the server accepts one, when you try to authenticate via public key?

Don't believe me? Try it out yourself: 

ssh whoami.filippo.io

Someone could use this to find out which public keys you have installed on your Client. You don't what this, don't you? So how can we avoid the leak of our Clients Public Keys? There is an easy fix, just add this at the end of your ~/.ssh/config file:

Host *
    PubkeyAuthentication no
    IdentitiesOnly yes

Also make sure you don't use just one key for all connections. I hope don't use one password for all your logins - so why should you use one key for all your logins?

It is recommended to use one specific key for each host:

Host github.com
    PubkeyAuthentication yes
  IdentityFile ~/.ssh/github_id_ed25519