teleren/devto huggingface dataset:
SpringBoot Caffeine cache with PostgreSQL backend
Tags: springboot, caffeine, postgres
Published: 2021-04-25 13:00:52

https://grokonez.com/spring-framework/spring-boot/springboot-caffeine-cache-postgresql-backend

SpringBoot Caffeine cache with PostgreSQL backend

Performance is a big problem in software development. And Caching is one solution to speed up system. In the tutorial, <a href="https://grokonez.com">JavaSampleApproach</a> will show you how to use <strong>SpringBoot Caffeine</strong> cache with PostGreSQL backend.

Related posts:
- <a href="https://grokonez.com/spring-framework/spring-boot/cache-data-spring-cache-using-spring-boot">How to work with Spring Cache | Spring Boot</a>
- <a href="https://grokonez.com/spring-framework/spring-boot/couchbase-create-spring-cache-couchbase-application-springboot#82_Run_and_check_results">Couchbase – How to create Spring Cache Couchbase application with SpringBoot</a>
- <a href="https://grokonez.com/spring-framework/spring-boot/springboot-hazelcast-cache-postgresql-backend">SpringBoot Hazelcast cache with PostgreSQL backend</a>

<!--more-->
<h2>I. Technologies</h2>
– Java 1.8
– Maven 3.3.9
– Spring Tool Suite – Version 3.8.1.RELEASE
– Spring Boot: 1.5.6RELEASE
– Couchbase 4.6.2
<h2>II. SpringBoot Caffeine cache</h2>
What is <strong>Caffeine cache</strong>?

In the <code>org.springframework.boot.autoconfigure.cache.CacheProperties</code>, we can see:

<pre><code class="language-java">
[..]

@ConfigurationProperties(prefix = "spring.cache")
public class CacheProperties {
	[..]
	
	/**
	 * Guava specific cache properties.
	 */
	public static class Guava {
		
		@Deprecated
		@DeprecatedConfigurationProperty(reason = "Caffeine will supersede the Guava support in Spring Boot 2.0", replacement = "spring.cache.caffeine.spec")
		public String getSpec() {
			return this.spec;
		}

		@Deprecated
		public void setSpec(String spec) {
			this.spec = spec;
		}

[..]</code></pre>

-> <strong>Caffeine</strong> is a Java 8 rewrite of Guava’s cache that supersede the <strong>Guava</strong> support.

In the tutorial, we use SpringBoot and Caffeine cache with PostGreSQL backend as below architecture:

<img src="https://grokonez.com/wp-content/uploads/2017/09/Springboot-Caffeine-Cache-architecture.png" alt="Springboot Caffeine Cache - architecture" width="587" height="479" class="alignnone size-full wp-image-8117" />

For work with <strong>SpringCache Caffeine</strong>, we need dependencies:

https://grokonez.com/spring-framework/spring-boot/springboot-caffeine-cache-postgresql-backend

SpringBoot Caffeine cache with PostgreSQL backend
SpringBoot Hazelcast cache with PostgreSQL backend

Tags: springboot, hazelcast, postgres
Published: 2021-04-25 12:47:21

https://grokonez.com/spring-framework/spring-data/springboot-hazelcast-cache-postgresql-backend

SpringBoot Hazelcast cache with PostgreSQL backend

Performance is a big problem in software development. And Caching is one solution to speed up system. Hazelcast is an open source in-memory data grid. So in the tutorial, <a href="https://grokonez.com">JavaSampleApproach</a> will show you how to use <strong>SpringBoot Hazelcast</strong> cache with PostGreSQL backend.

Related posts:
- <a href="https://grokonez.com/spring-framework/spring-boot/cache-data-spring-cache-using-spring-boot">How to work with Spring Cache | Spring Boot</a>
- <a href="https://grokonez.com/spring-framework/spring-boot/springboot-caffeine-cache-postgresql-backend">SpringBoot Caffeine cache with PostgreSQL backend</a>
- <a href="https://grokonez.com/spring-framework/spring-boot/couchbase-create-spring-cache-couchbase-application-springboot#82_Run_and_check_results">Couchbase – How to create Spring Cache Couchbase application with SpringBoot</a>

<!--more-->
<h2>I. Technologies</h2>
– Java 1.8
– Maven 3.3.9
– Spring Tool Suite – Version 3.8.1.RELEASE
– Spring Boot: 1.5.7.RELEASE
- Hazelcast
<h2>II. SpringBoot Hazelcast</h2>
In the tutorial, we will create a SpringBoot project as below design:

<img src="https://grokonez.com/wp-content/uploads/2017/10/Springboot-Hazelcast-Cache-Architecture.png" alt="Springboot Hazelcast Cache - Architecture" width="587" height="479" class="alignnone size-full wp-image-8366" />

Spring Boot will auto-configure a <strong>HazelcastInstance</strong> when having Hazelcast on the classpath. And Spring Boot only configures <strong>HazelcastInstance</strong> if a <strong>Hazelcast configuration</strong> is found.

We use dependency <code>hazelcast-spring</code>:

<pre><code class="language-html">
&lt;dependency&gt;
	&lt;groupId&gt;com.hazelcast&lt;/groupId&gt;
	&lt;artifactId&gt;hazelcast-spring&lt;/artifactId&gt;
&lt;/dependency&gt;
&lt;/pre&gt;

&lt;code&gt;hazelcast-spring&lt;/code&gt; had included below dependency:

&lt;pre class=&quot;lang:xhtml&quot;&gt;
&lt;dependency&gt;
	&lt;groupId&gt;com.hazelcast&lt;/groupId&gt;
	&lt;artifactId&gt;hazelcast&lt;/artifactId&gt;
&lt;/dependency&gt;</code></pre>


We can configure Hazelcast via <code>com.hazelcast.config.Config</code> bean. Or use an <strong>hazelcast.xml</strong> configuration file.
In the <strong>application.properties</strong>, we specify <strong>hazelcast.xml</strong> configuration via:

More at:

https://grokonez.com/spring-framework/spring-data/springboot-hazelcast-cache-postgresql-backend

SpringBoot Hazelcast cache with PostgreSQL backend
Cree un README increíble para su perfil de GitHub
Tags: github, perfil, readme
Published: 2021-04-25 12:38:07

GitHub lanzó una [nueva funcionalidad](https://docs.github.com/en/github/setting-up-and-managing-your-github-profile/managing-your-profile-readme) que permite a los usuarios crear un portfolio usando un `README` en un repositorio especial con el mismo nombre que el nombre de usuario y mostrarlo en el perfil del usuario como la imagen de portada de esta publicación. Este artículo explica cómo crear ese repositorio paso a paso y agrega algunos consejos y trucos que puede usar para modificar el suyo.

## ¿Cómo creo el archivo README de mi perfil?
Como mencioné antes, el README del perfil se crea cuando el usuario crea un nuevo repositorio con el mismo nombre que su nombre de usuario. Por ejemplo, mi nombre de usuario de GitHub es charly3pins, así que creé un nuevo repositorio llamado `charly3pins`. Los pasos son los siguientes:

1. Crear un nuevo repositorio con el mismo nombre que su nombre de usuario de GitHub yendo [aquí](https://github.com/new). Marcar la opción `Agregar un archivo README`.
![crear repositorio](https://charly3pins.dev/images/github-profile-readme/new-repo.png)
2. Abrir el archivo README.md generado y verá la siguiente plantilla:
![plantilla de repositorio](https://charly3pins.dev/images/github-profile-readme/repo-template.png)
3. Descomentar los comentarios y agregar contenido como texto, GIF, imágenes, emojis, etc. Lo que se quiera mientras sea aceptado por Markdown... ¡El límite lo pone el usuario! 🚀 Consultar  [esta](https://guides.github.com/pdfs/markdown-cheatsheet-online.pdf) Hoja de referencia de Markdown si se necesita repasar la sintaxis de Markdown.
4. Comittear el nuevo archivo README. Tener en cuenta que los cambios deben estar en la rama `master` o `main`; de lo contrario, no serán visibles en el perfil hasta que se mergeen los cambios en una de esas dos ramas.
5. Pusheear los cambios a GitHub (si se realizaron los cambios localmente).

## Sea creativo

Puede consultar mi [perfil de GitHub](https://github.com/charly3pins) y el [repositorio](https://github.com/charly3pins/charly3pins) que aloja mi archivo README. Agregué mis estadísticas dinámicas de GitHub usando [este](https://github.com/anuraghazra/github-readme-stats) repositorio, hay mucha más información que puede agregar en sus perfiles. También he usado [este](https://shields.io/) sitio para hacer que las insignias se muestren para las redes sociales y las tecnologías y herramientas.
Mi recomendación es dar un vistazo al repositorio [siguiente](https://github.com/abhisheknaiidu/awesome-github-profile-readme) para ver varios perfiles de GitHub y obtener un poco de inspiración.

No dudes en comentar aquí o contactarme en mis redes sociales para cualquier comentario, pregunta o sugerencia.
Which Technology Should I Learn?
Published: 2021-04-25 12:34:39

Hello everyone, choosing a technology has been quite an headache at least for me, in my programming journey. 
I love both the frontend and the backend because starting to learn programming, I have clear idea of what I'm gonna be building. In the meantime, I've learned #django #JavaScript #css #html #bootstrap #python... I planned to build a fully functioning blog site, or a forum website like this but I've been unable to combine these technologies, then one of my tutor now said to achieve my dream, the best technologies to learn is react ND firebase firestore for database. Initially,i was gonna use django ND postgresql. I'll be happy to be enlightened by guru devs here... Thanks.
Mensajes de commit personalizados de Git
Tags: git, github, terminal
Published: 2021-04-25 12:23:54

He estado usando la herramienta [CMF](https://github.com/walmartdigital/commit-message-formatter) durante el último año y creo que su simplicidad es su potencial. Básicamente es una herramienta de terminal desarrollada en Go por [Walmart Digital](https://github.com/walmartdigital) que te ayuda a estandarizar el log de commits de tus proyectos.

Lo he estado usando durante el último año y medio aproximadamente y todo lo que puedo decir es muy útil. Acordamos con el equipo la configuración que queremos utilizar y definimos un conjunto de cambios que aplica en nuestro caso. También elegimos el [Jira flow](https://github.com/walmartdigital/commit-message-formatter#jira-flow) y cambiamos los valores para el `cambio` agregando un emojis para hacer las confirmaciones un poco más divertidas para comprobarlos en el registro.

Puede instalarlo a través de npm:
```vim
npm install -g go-cmf
``` 
o desde Go:
```vim
go install github.com/walmartdigital/commit-message-formatter
```

Después de eso, abra una terminal y navegue hasta la raíz del proyecto que desea usar. Luego escriba:
```vim
cmf init 
```

Deberá seleccionar uno de los flujos y creará un archivo `.cmf.yaml` con la plantilla del seleccionado. Puede editar ese archivo de la forma que desee. La condición única es que cualquier variable que desee utilizar debe definirse mediante `{{}}`. Ejemplo: `{{CHANGE}}` le preguntará el "CAMBIO" que hizo y mostrará las opciones que definió en la plantilla.

Aquí está el archivo `.cmf.yaml` que estoy usando en este sitio:
```
PROMPT:
    - KEY: "CHANGE"
      LABEL: "Type of change"
      OPTIONS:
        - VALUE: "feat :sparkles:"
          DESC: "A new feature"
        - VALUE: "fix :bug:"
          DESC: "A bug fix"
        - VALUE: "test :rotating_light:"
          DESC: "Adding missing tests or correcting wrong ones"
        - VALUE: "style :lipstick:"
          DESC: "A code change to improve clean code"
        - VALUE: "build-ci :construction_worker_man:"
          DESC: "Changes that affect the build system and/or CI configuration files and scripts"
        - VALUE: "refactor :hammer:"
          DESC: "A code change"
        - VALUE: "docs :books:"
          DESC: "Documentation only changes"
        - VALUE: "chore :card_index:"
          DESC: "Changes that don't fit any of the options above"
    - KEY: "MESSAGE"
      LABEL: "Commit message"
TEMPLATE: "{{CHANGE}}: {{MESSAGE}}"
```

No dude en comentar aquí o contactarme en mis redes sociales para cualquier comentario, pregunta o sugerencia.
Cómo añadir Google Analytics a su sitio con Hugo
Tags: go, hugo, blog, googleanalytics
Published: 2021-04-25 12:19:04

## Google Analytics

En primer lugar, lo que necesita es obtener un ID de seguimiento de Google Analytics. Para eso, debe registrarse en [Google Analytics](https://analytics.google.com/analytics/web/). Luego, debe crear un ID de seguimiento siguiendo los siguientes pasos:

- Haga clic en el botón `Admin` (en la esquina inferior izquierda).
- Haga clic en el botón "Crear cuenta".
- Después de completar todos los pasos, haga clic en el botón "Crear" y acepte los términos y condiciones.

Después de completar estos pasos, obtendrá su ID de seguimiento. Cópielo para agregarlo a su sitio de Hugo más tarde.

## Configuración de Hugo

Ahora es el turno de agregar el ID de seguimiento a su sitio.
La forma más sencilla de hacerlo es utilizando la [plantilla interna] de Hugo (https://gohugo.io/templates/internal/#google-analytics) proporcionada por Hugo. Solo necesita agregar una nueva variable llamada `googleAnalytics` con el `tracking ID` obtenido del paso anterior en su `config.toml` como:
```vim
googleAnalytics = "UA-123-45"
```

El siguiente paso es agregar el siguiente fragmento de código en su sitio:
```vim
{{ template "_internal/google_analytics.html" . }}
```
Debería buscar la plantilla parcial `head` y agregarla dentro de las etiquetas `<head> </head>`.

## Comprobando la integración

Antes de pasar eso a producción, puede probarlo ejecutando su sitio localmente realizando el siguiente comando:
```vim
hugo serve
```

La URL predeterminada en localhost es `http://localhost:1313`.

Vuelva a abrir o actualice [Google Analytics](https://analytics.google.com/analytics/web/) en una pestaña diferente.

Verifique el tablero y debería poder ver el número en la sección Usuarios activos en este momento como 1 como la imagen a continuación:
![active-users](http://charly3pins.dev/images/google-analytics-active-users.png)

No dude en comentar aquí o contactarme en mis redes sociales para cualquier comentario, pregunta o sugerencia.
Vue Js Form Validatation Example with Error Message
Tags: vue
Published: 2021-04-25 12:18:40

Form validation is natively supported by the browser, but sometimes different browsers will handle things in a manner which makes relying on it a bit tricky. Even when validation is supported perfectly, there may be times when custom validations are needed and a more manual, Vue-based solution may be more appropriate. Let’s begin with a simple example.

Given a form of three fields, make two required. Let’s look at the HTML first:
[Vue Js Form Validatation Example with Error Message
](https://www.codecheef.org/article/vue-js-form-validatation-example-with-error-message)
RabbitMQ – How to send/receive Java object messages with Spring RabbitMq | SpringBoot
Tags: rabbitmq, springboot, java
Published: 2021-04-25 12:06:49

https://grokonez.com/spring-framework/spring-amqp/rabbitmq-sendreceive-java-object-messages-spring-rabbitmq-springboot

RabbitMQ – How to send/receive Java object messages with Spring RabbitMq | SpringBoot

In the previous <a href="https://grokonez.com/tag/rabbitmq">posts</a>, Spring RabbitMQ applications had produced/consumed <strong>String</strong> messages. Today, <a href="https://grokonez.com">JavaSampleApproach</a> will guide how to send/receive Java object messages with RabbitMQ server.

Related posts:
- <a href="https://grokonez.com/spring-framework/spring-boot/rabbitmq-create-spring-rabbitmq-publishsubcribe-pattern-springboot">RabbitMq – How to create Spring RabbitMq Publish/Subcribe pattern with SpringBoot</a>
- <a href="https://grokonez.com/spring-framework/spring-boot/create-spring-rabbitmq-producerconsumer-application-springboot">RabbitMQ – How to create Spring RabbitMQ Producer/Consumer applications with SpringBoot</a>
- <a href="https://grokonez.com/spring-framework/spring-boot/springboot-rabbitmq-topic-exchange">SpringBoot RabbitMQ Topic Exchange</a>
- <a href="https://grokonez.com/spring-framework/spring-boot/springboot-rabbitmq-headers-exchange">SpringBoot RabbitMq Headers Exchange</a>

<!--more-->
<h2>I. Technologies</h2>
– Java 8
– Maven 3.6.1
– Spring Tool Suite: Version 3.8.4.RELEASE
– Spring Boot: 1.5.4.RELEASE
– RabbitMQ
<h2>II. RabbitMq - Produce/consume Java object messages</h2>
In the tutorial, we create 2 SpringBoot applications {<code>Producer</code>, <code>Consumer</code>} for sending/receiving Java object messages to/from <strong>RabbitMQ</strong>:

<img src="https://grokonez.com/wp-content/uploads/2017/07/Spring-RabbitMq-Send-Java-Objects-architecture.png" alt="Spring RabbitMq - Send Java Objects - architecture" width="755" height="221" class="alignnone size-full wp-image-6853" />

<div class="jsa-quote">
>>> See more at: <a href="https://grokonez.com/spring-framework/spring-boot/create-spring-rabbitmq-producerconsumer-application-springboot">RabbitMQ – How to create Spring RabbitMQ Producer/Consumer applications with SpringBoot</a>
</div>

<h3>1. Message Converter</h3>
We create a simple Java model:

More at:

https://grokonez.com/spring-framework/spring-amqp/rabbitmq-sendreceive-java-object-messages-spring-rabbitmq-springboot

RabbitMQ – How to send/receive Java object messages with Spring RabbitMq | SpringBoot
Daily Developer Jokes - Sunday, Apr 25, 2021
Tags: jokes, dailydeveloperjokes
Published: 2021-04-25 12:00:09

---
title: "Daily Developer Jokes - Sunday, Apr 25, 2021"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
cover_image: "https://private.xtrp.io/projects/DailyDeveloperJokes/thumbnail_generator/?date=Sunday%2C%20Apr%2025%2C%202021"
published: true
tags: #jokes, #dailydeveloperjokes
---

Generated by Daily Developer Jokes, a project by [Fred Adams](https://xtrp.io/) ([@xtrp](https://dev.to/xtrp) on DEV)

___Read about Daily Developer Jokes on [this blog post](https://xtrp.io/blog/2020/01/12/daily-jokes-bot-release/), and check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/).___
### Today's Joke is...
![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e1258cecd22f.png)

---
*Have a joke idea for a future post? Email ___[xtrp@xtrp.io](mailto:xtrp@xtrp.io)___ with your suggestions!*

*This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit.*

<!-- 
Joke text:
___Q:___ Why did the computer squeak?

___A:___ Because someone stepped on its mouse!
 -->
RabbitMQ – How to create Spring RabbitMQ Producer/Consumer applications with SpringBoot
Tags: springboot, rabbitmq, producer, consumer
Published: 2021-04-25 11:41:39

https://grokonez.com/java-integration/distributed-system/create-spring-rabbitmq-producerconsumer-application-springboot

RabbitMQ – How to create Spring RabbitMQ Producer/Consumer applications with SpringBoot

<strong>RabbitMQ</strong> is one of the most popular open source message broker which meets high-scale, high-availability requirements. So in the tutorial, <a href="https://grokonez.com">JavaSampleApproach</a> will guide how to create <strong>Spring RabbitMQ Producer/Consumer</strong> applications by SpringBoot.

Related articles:
- <a href="https://grokonez.com/spring-framework/spring-boot/use-spring-jms-activemq-jms-consumer-jms-producer-spring-boot">How to use Spring JMS with ActiveMQ – JMS Consumer and JMS Producer | Spring Boot</a>
- <a href="https://grokonez.com/spring-framework/spring-boot/springboot-rabbitmq-topic-exchange">SpringBoot RabbitMQ Topic Exchange</a>
- <a href="https://grokonez.com/spring-framework/spring-boot/rabbitmq-create-spring-rabbitmq-publishsubcribe-pattern-springboot">RabbitMq – How to create Spring RabbitMq Publish/Subcribe pattern with SpringBoot</a>
- <a href="https://grokonez.com/spring-framework/spring-boot/rabbitmq-sendreceive-java-object-messages-spring-rabbitmq-springboot">RabbitMQ – How to send/receive Java object messages with Spring RabbitMq | SpringBoot</a>
- <a href="https://grokonez.com/spring-framework/spring-boot/springboot-rabbitmq-headers-exchange">SpringBoot RabbitMq Headers Exchange</a>

<!--more-->
<iframe width="853" height="480" src="https://www.youtube.com/embed/QS6Glk74oYg?rel=0" frameborder="0" allowfullscreen></iframe>
<h2>I. SpringBoot RabbitMQ</h2>
In the tutorial, we create 2 SpringBoot applications {<code>Producer</code>, <code>Consumer</code>} for working with <strong>RabbitMQ</strong>:

<img src="https://grokonez.com/wp-content/uploads/2017/07/rabbitmq-architecture-copyright.png" alt="rabbitmq - architecture - copyright" width="755" height="221" class="alignnone size-full wp-image-6806" />

- <strong>Producer</strong> will send messages to <strong>RabbitMQ Exchanges</strong> with a <code>routingKey</code>. <strong>RabbitMQ</strong> uses <code>routingKey</code> to determine which queues for routing messages.
- <strong>Consumer</strong> listens on a <strong>RabbitMQ Queue</strong> to receive messages.

With SpringBoot, we use <code>spring.rabbitmq.*</code> for controlling RabbitMQ configuration:

<pre><code class="language-java">
spring.rabbitmq.host=localhost
spring.rabbitmq.port=5672
spring.rabbitmq.username=guest
spring.rabbitmq.password=guest
</code></pre>

<strong>Producer</strong> uses <code>AmqpTemplate</code> to send messages:

More at:

https://grokonez.com/java-integration/distributed-system/create-spring-rabbitmq-producerconsumer-application-springboot

RabbitMQ – How to create Spring RabbitMQ Producer/Consumer applications with SpringBoot
984 : String Without AAA or BBB - Leetcode Medium
Tags: algorithms, interview, java, leetcode
Published: 2021-04-25 11:33:35

# Statement

Given two integers a and b, return any string s such that:

* s has length a + b and contains exactly a 'a' letters, and exactly b 'b' letters,

* The substring 'aaa' does not occur in s, and

* The substring 'bbb' does not occur in s.

# Input

Example 1:

Input: a = 1, b = 2
Output: "abb"
Explanation: "abb", "bab" and "bba" are all correct answers.

Example 2:

Input: a = 4, b = 1
Output: "aabaa"

# Constraints

* 0 <= a, b <= 100

* It is guaranteed such an s exists for the given a and b.

# Approach : 

There are generally 4 conditions that may occur.

* a < 3 && b < 3

For this we simply print the string in any way we want as we will not get `aaa` or `bbb` as substring.

* a >= 3 && b < 3

For this, we put `b` whenever the last 2 characters are `aa` as there may be a substring `aaa`.

* a < 3 && b >= 3

For this, we put `a` whenever the last 2 characters are `bb` as there may be a substring `bbb`.

* a >= 3 && b >= 3

For this, whenever we see `aa` as the last 2 characters, start printing `b` and whenever we see `bb` as the last 2 characters, start print `a`.

This is the basic idea we can use to solve this problem and in Java there is `endsWith()` method which is very much handy in this case. We can use it like `endsWith("aa")` or `endsWith("bb")` in checking for the conditions.

# Code

```
class Solution {
    public String strWithout3a3b(int a, int b) {
        StringBuilder sb = new StringBuilder();
        while (a > 0 || b > 0) {
            String s = sb.toString();
            // if we have aa as the last 2 characters, then the next one is b
            if (s.endsWith("aa")) {
                sb.append("b");
                b --;
            }
            // if we have bb as the last 2 characters, then the next one is a
            else if (s.endsWith("bb")) {
                sb.append("a");
                a --;
            }
            // if a > b, append a
            else if (a > b) {
                sb.append("a");
                a --;
            }
            // if b >= a, append b
            else {
                sb.append("b");
                b --;
            }
        }
        return sb.toString();
    }
}
```

# Complexity 

Time Complexity : It will O(a + b) which is the length of the string

Space Complexity : It will be O(a + b) as we create a new string of length a + b and if we consider this into space analysis.

# Github Links : 

[Leetcodes Problems Solved](https://github.com/Rohithv07/LeetCode)

[Leetcode Daily Challenges and Other platforms problems solved](https://github.com/Rohithv07/LeetCodeTopInterviewQuestions)