Archives de l’auteur : davidhxxx

Spring Cloud

Spring Boot version and Spring Cloud versions You cannot use any Spring Cloud version with any Spring Boot version.Table 1. Release train Spring Boot compatibilityRelease TrainRelease Train2022.0.x aka Kilburn3.0.x2021.0.x aka Jubilee2.6.x, 2.7.x (Starting with 2021.0.3)2020.0.x aka Ilford2.4.x, 2.5.x (Starting with 2020.0.3)Hoxton2.2.x, 2.3.x (Starting … Continuer la lecture

Publié dans Non classé | Laisser un commentaire

Python basics

Themes Namming styles Truthly and Falsy Loop Exception handling Python command line Shell Args Variables declaration Environment variables Execute shell process with subprocess module (Python 3.5) String String flavors String Declaration String formatting Functions Built-in functions print() function Function definition … Continuer la lecture

Publié dans Non classé | Laisser un commentaire

Redis with Spring Boot

Configuration Dependency <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency> Specify the redis instance host/port spring.redis.host=foohost spring.redis.port=6379 Enable Redis and set the configuration import java.util.Collections;   import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.convert.KeyspaceConfiguration; import org.springframework.data.redis.repository.configuration.EnableRedisRepositories; import org.springframework.data.redis.serializer.StringRedisSerializer;   @EnableRedisRepositories @Configuration public … Continuer la lecture

Publié dans Non classé | Laisser un commentaire

Redis Repository – Spring Boot

Redis with Spring-data repository allows to use complex model to persist/load out of the box while we don’t use complex object as map keys or map values that contain collection. Common structures for our examples pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 … Continuer la lecture

Publié dans Non classé | Laisser un commentaire

Spring Boot and Tests

Personal note : I wrote multiple posts on Stackoverflow about  Spring Boot and Tests.  For example that answer about difference between @Mock and @MockBean  or still that question-answer on the general approach to test ours components with Spring Boot. But from … Continuer la lecture

Publié dans Non classé | Laisser un commentaire

Mongodb

Mongo shell mongo : executable. Flags : –eval « javascript code » Mongo shell commands Switch db: use foodb Find all elements in default collection : db.myCollection.find() Command mixing linux shell and mongo shell to insert : for v in $(seq 1 … Continuer la lecture

Publié dans Non classé | Laisser un commentaire

Spring Boot hints

Run a spring boot app : Spring boot app via maven : the base command It specifies the spring boot profile and it enables the remote debug : mvn spring-boot:run -Dspring-boot.run.jvmArguments= »-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5000″ -Dspring-boot.run.profiles=local Pass spring properties and application args to … Continuer la lecture

Publié dans Non classé | Laisser un commentaire

Python 3 some code

Program that fixes srt delay according to a number of second to add or remove Here the srt format : 1 00:00:04,584 –> 00:00:09,609 Hello you !   2 00:00:18,393 –> 00:00:23,064 Hello you too Here the code to add/remove … Continuer la lecture

Publié dans Non classé | Laisser un commentaire

Python 3 Installation

Windows Mainly two flavors on the Python web site. Embeddable zip file That is a portable installation that I don’t advise I tried it with Python 3.9 and many issues. Several Python libraries are missing or fail to work(ex: traceback, … Continuer la lecture

Publié dans Non classé | Laisser un commentaire

Docker Registry

Create a secure private registry (2.0) docker run -d \ -p 5000:5000 \ -p 443:443 \ –restart=always \ –name registry \ -v /var/lib/docker/volumes/my-registry/_data:/var/lib/registry \ -v /srv/registry:/srv/registry \ -e REGISTRY_HTTP_TLS_CERTIFICATE=/srv/registry/domain.crt \ -e REGISTRY_HTTP_TLS_KEY=/srv/registry/domain.key \ -e REGISTRY_HTTP_ADDR=0.0.0.0:443 \ registry:2 Some notes : … Continuer la lecture

Publié dans Non classé | Laisser un commentaire