teleren/devto huggingface dataset:
My experience on the Public Speaking Challenge
Tags: beginners, writing, publicspeaking, techtalks
Published: 2024-04-26 00:22:39

Last year I discovered the DEV Community and since then this has been my favorite place to learn, share my learning journey, participate in challenges, and meet new people. I love to spend time in #discussion, debating about something, on "Welcome Thread" and moderating some novices and beginners posts too. On April 1st, @bekahhw from Virtual Coffee made a [post inviting anyone in the community to join a challenge of Public Speaking](https://dev.to/virtualcoffee/step-into-the-spotlight-join-our-public-speaking-monthly-challenge-52kl). The main idea was to choose a topic, develop a well-structured and engaging talk, and present it at the end of the month, all the process was guided by the community with tips and tasks for each week. I loved the idea and was so excited about it.
For the first week, I've chosen my topic, I'd like to talk a bit about Linux and open-source projects. Things like studying OS, testing a new distro on my desktop, and completely diving into the [OSSU](https://github.com/ossu/computer-science) (Open Source Society University) influenced my choices directly.
Then, I had to face one of my biggest difficulties, writing an outline with an introduction, development, and conclusion. For this presentation, each participant had 5-10 minutes to a lighting talk and I was afraid of writing something so superficial without connection or with big jumps between subtopics. As a non-native English speaker, I made an immersive month to get even more used to the language, listen to more music, watching even more videos (especially with my boyfriend whose have helped me so much with this and our long talks about OS and Kernels).
In the last week, the focus was on delivering and I did my best to don't get nervous and just try to face this as a normal talk. I have to admit that I loved to spend time creating a slide presentation like I did a lot in my Physics Bachelor for countless experiments and projects.
I have searched a lot about the Virtual Coffee community and I loved the main idea of mutual support and the meeting styles. Also, I'm on the waiting list and I hope to be in the Lightning Talks in the next year and join more and more challengers.
As how I promised, here's my presentation video:

{% embed https://www.youtube.com/watch?v=siCY1-E-BTY&lc=UgxVeMMKLrkW6RX-INx4AaABAg %}

I love this experience and I'll surely continue with this. 
For now, I can't deliver such a good webcam image quality but I'll improve it very soon.
Also, feel free to connect with me, I'd love to extend the conversation or to receive some feedback.
Data Structures and Algorithms: Trees
Tags: beginners, trees, datastructures
Published: 2024-04-26 00:14:30

Trees are a hierarchical data structure represented by nodes. Each node will have a value and possible children. 

## Terminology
 

**Root** - The first node in a tree.

**Height** - The length of the longest path from the root to the furthest child node.

**Leaves** - Nodes without children.


![Binary tree](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9gj95t2piqtr3ggj9tnu.png)


**Binary Tree** - A tree that has at most 2 children. Usually described as left or right. 

**General Tree** -  any tree with 0 or more children.

**Binary Search Tree** - a tree which has a specific ordering and at most 2 children nodes.

**Balanced** -  a tree is considered to be balanced when the left and right children are of the same height.

**Branching Factor** - the amount of children that a tree has, for example, a binary tree has a branching factor of 2.

**Traversal** - The process by which each node in a tree is visited. The two main methods for tree traversal are Depth First Traversal and Breadth First Traversal. 

## Conclusion
The aim of this article was to serve as an introduction to trees. The next articles will go into detail about the types of tree traversal.
Gestión de Entidades en la DPE (parte 4)
Published: 2024-04-26 00:13:02

En este post vamos a revisar cómo enviar a guardar el formulario.

- Enviar el formulario vía POST usando Ajax:

```
$('#form-entidad').submit(function(event) {
        event.preventDefault();  // Evitar que el formulario se envíe de forma convencional

        let csrfToken = $('input[name="csrfmiddlewaretoken"]').val();

        // Obtener los datos del formulario
        let formData = new FormData($(this)[0]);

        // Agregar el token CSRF a los datos del formulario
        formData.append('csrfmiddlewaretoken', csrfToken);

        // Enviar los datos al servidor mediante AJAX
        $.ajax({
            url: '/',
            type: 'POST',
            data: formData,
            processData: false,
            contentType: false,
            success: function(response) {
                alert('El registro de la entidad se procesó exitosamente.');
            },
            error: function(xhr, textStatus, errorThrown) {
                console.error('Error al enviar el formulario:', errorThrown);                
            }
        });
});
```

Como del lado del servidor pueden venir errores de validación, esos mensajes se manejarán y presentarán como 'invalid-feedback' en el campo correspondiente. Para ello se debe refactorizar la función de manejo de error en la petición ajax:

```
error: function(xhr, textStatus, errorThrown) {
    console.error('Error al enviar el formulario:', errorThrown);

    if (xhr.responseJSON) {
        let errores = JSON.parse(xhr.responseJSON.msg_error); // Obtener el JSON de errores de validación
        
        // Iterar sobre los mensajes de error y agregarlos a los elementos HTML correspondientes
        $.each(errores, function(campo, detalles) {

            let mensajesError = ''; // Inicializar la cadena de mensajes de error
            // Iterar sobre cada detalle de error para concatenar los mensajes
            $.each(detalles, function(index, detalle) {
                mensajesError += detalle.message + '<br>'; // Concatenar el mensaje de error con un <br>
            });

            let $campoInput = $('[name="' + campo + '"]'); // Seleccionar el elemento de formulario por su atributo name                        
            // Agregar el mensaje de error al elemento de formulario
            $campoInput.addClass('is-invalid'); // Marcar el campo como inválido
            $campoInput.next('.invalid-feedback').html(mensajesError); // Agregar el mensaje de error
        });
    } else {
        console.error('La respuesta no es un JSON de errores.'); // Manejar el caso en que la respuesta no sea un JSON
    }
}
```

El manejo del reset del fomulario debe considerar remover las clases 'is-invalid' y 'was-validated' de los inputs y del formulario, respectivamente:

```
$('#form-entidad').on('reset', function(event) {
    $(this).find('select, input').removeClass('is-invalid');
    $(this).removeClass('was-validated');
});
```
🤿 Looking for Waterpolo API for Research Consultant Project? 🌊
Tags: nextjs, react, mongodb
Published: 2024-04-26 00:00:50

I am working on a research consultant project and need to integrate a waterpolo API. Does anyone have recommendations for a reliable Waterpolo API that I can use for my project? I have come across the SportDevs API, has anyone used it before? Any insights would be greatly appreciated. Thank you!
Modules Status Update
Tags: puppet, community
Published: 2024-05-03 18:14:21

---
title: Modules Status Update
published: true
date: 2024-04-26 00:00:00 UTC
tags: puppet,community
canonical_url: https://puppetlabs.github.io/content-and-tooling-team/blog/updates/2024-04-26-modules-status-update/
---

## Hello Again!!

Happy Friday! We hope this message finds you well and thriving in your endeavors.

While this week may not have seen major developments from the Modules team, we’re thrilled to announce that a new wave of enhancements and features has just been unleashed on the Forge! Our dedicated team has been working tirelessly behind the scenes to bring you an array of exciting updates and improvements.We understand that the heart of our community lies in innovation and progress, and we’re committed to delivering nothing short of excellence. With each release, we strive to empower you with tools and resources that elevate your experience on the Forge platform.

Whether you’re a seasoned contributor or just beginning your journey with us, now is the perfect time to dive in and explore the latest offerings. Discover new functionalities, streamline your workflows, and unlock the full potential of the Forge ecosystem.Your feedback and contributions are invaluable to us as we continue to evolve and grow together. We encourage you to share your thoughts, suggestions, and experiences with us. Together, we’ll shape the future of Forge and pave the way for even greater achievements.

Stay tuned for more updates and announcements in the coming weeks. Exciting times lie ahead, and we can’t wait to embark on this journey with you!

## Community Contributions

Your contributions are the driving force behind our shared success. Thank you for your dedication, passion, and unwavering commitment to making the Forge community thrive.

Let’s continue to collaborate, innovate, and grow together as we embark on this journey towards new heights of achievement. Together, we can achieve anything!
DevX Status Update
Tags: puppet, community
Published: 2024-04-26 19:33:29

---
title: DevX Status Update
published: true
date: 2024-04-26 00:00:00 UTC
tags: puppet,community
canonical_url: https://puppetlabs.github.io/content-and-tooling-team/blog/updates/2024-04-26-devx-status-update/
---

## Spring Has Sprung!

Hello good people!

I don’t know about you but I am in a pretty good mood. The weather has warmed to the point where I was able to get a good Sunday cycle done last week and I am looking forward to another this Sunday as well, fingers crossed the weather stays good for it.

Either way it is time to do our round up, lets see whats been happening.

## VSCode Release

For some exciting news to start with, thanks to the tireless efforts of our own [Jordan](https://github.com/jordanbreen28) a new v1.5.3 release has gone out for the Puppet VSCode extension!! This release contains several requested fixes and should prove a boon to everyone who is using it, I hope everyone takes the time to check it out, a low of work has went into it and will continue to do so in the future.

## Expanding PDK Support

For some PDK news, which we know you all love, we have been working on expanding our supported Operating Systems with Mac OSX 13 and Debian 12 having been added already and Windows 11 being worked on currently. With a release planned for the near future you should see this expansion soon.

## Community Contributions

We’d like to thank the following people in the Puppet Community for their contributions over this past week:

- [`pdk#1342`](https://github.com/puppetlabs/pdk/pull/1342): “Support package testing with Docker”, thanks to [h0tw1r3](https://github.com/h0tw1r3)
- [`pdk-vanagon#354`](https://github.com/puppetlabs/pdk-vanagon/pull/354): “(CAT-1790) add debian 12 support”, thanks to [h0tw1r3](https://github.com/h0tw1r3)
- [`ruby-pwsh#309`](https://github.com/puppetlabs/ruby-pwsh/pull/309): “Add support for unit testing via Unix OS”, thanks to [chambersmp](https://github.com/chambersmp)

## New Gem Releases

- [`puppetlabs_spec_helper`](https://rubygems.org/gems/puppetlabs_spec_helper) (`7.2.0`)
Snag the Current URL in SvelteKit (2024 Edition)
Tags: sveltekit, routing, svelte, webdev
Published: 2024-04-25 23:51:15

**Hey Svelte developers!** Need to dynamically access the current URL in your SvelteKit apps? Look no further! This guide explores various methods to efficiently grab that URL goodness, keeping things fresh for 2024.

**Evolving with SvelteKit: A 2024 Refresh**

This article builds upon the valuable insights presented in the previous 2023 version: {% embed https://dev.to/dev_michael/grab-current-url-in-svelte-1np9 %}

ensuring you have the most up-to-date information on URL handling techniques in SvelteKit. As the framework continues to evolve, this refreshed guide empowers you to stay ahead of the curve.

**Mastering URL Access in SvelteKit**

Whether you're building dynamic dashboards, crafting social media integrations, or simply displaying the current page path, effectively working with URLs is crucial in SvelteKit applications. This article equips you with the essential techniques to tackle these tasks with ease.

**The Old Faithful: `$page.url`**

The tried-and-true `$page.url` store remains a cornerstone for URL access in SvelteKit. It provides access to the current page's URL object, allowing you to extract various components:

* **Pathname:** Identify the specific page or section (e.g., `/about`)

```html
<script>
  import { page } from '$app/stores';
</script>

<p>Current path: {$page.url.pathname}</p>
```

* **Search Parameters:** Dynamically handle query strings (e.g., `/products?category=electronics`)

```html
<script>
  import { page } from '$app/stores';
</script>

<p>Current category: </p>
{#if $page.url.searchParams.has('category')}
  <p>{$page.url.searchParams.get('category')}</p>
{#else}
  <p>No category specified.</p>
{/if}

```

* **Full URL String:** Access the complete URL for social sharing or external integrations

```html
<script>
  import { page } from '$app/stores';
</script>

<p>Current Full URL: {$page.url.href}</p>
```

**Needing the Route ID: `$page.route.id`**

For complex routing scenarios, SvelteKit provides the `$page.route.id` store. This delivers a string representing the route definition, useful for conditional rendering or specific logic based on the current route.

```html
<script>
  import { page } from '$app/stores';
</script>

<p>Current Route: {$page.route.id}</p>

{#if $page.route.id === '/blog/[slug]'}
  <p>You're on a blog post details page!</p>
{/if}
```




**Rock Your SvelteKit Apps with Dynamic URLs!**

There you have it, Svelte comrades! Now you've got the magic touch when it comes to grabbing URLs on the fly in your SvelteKit projects. This opens the door to all sorts of cool stuff, from building fancy dashboards that update based on the current page to making those social media integrations a breeze. 

SvelteKit is constantly evolving, so keep your eyes peeled for upcoming features that might make URL wrangling even easier. In the meantime, go forth and conquer the SvelteKit world with your newfound URL superpowers! Happy coding (and keep building awesome stuff)!
Golang - Singleton Design pattern
Published: 2024-04-25 23:42:36

Conceitualmente o padrão singleton define que somente uma instância deve existir em todo o sistema.
É como ter um guardião solitário que garante que apenas uma única cópia de si mesma esteja presente, independentemente de quantas vezes seja chamado.

Estou avançando nos estudos em golang e decidi mergulhar na implementação deste padrão tão debatido e controverso. 
É aquele tipo de padrão que desperta paixões e críticas, amado por alguns como uma solução elegante e odiado por outros como um antipadrão a ser evitado a todo custo.

singleton.go
```
package main

import (
    "fmt"
    "sync"
)

var lock = &sync.Mutex{}

type singleton struct {
}

var singleInstance *singleton

func getInstance() *singleton {
    if singleInstance == nil {
        lock.Lock()
        defer lock.Unlock()
        if singleInstance == nil {
            fmt.Println("create singleton")
            singleInstance = &singleton{}
        } else {
            fmt.Println("singleton already created.")
        }
    } else {
        fmt.Println("singleton already created.")
    }

    return singleInstance
}
```



main.go
```
package main

import (
    "fmt"
)
func main() {
    for i := 0; i < 3; i++ {
        go getInstance()
    }
    fmt.Scanln()
}
```


Saída esperada

```
create singleton
singleton already created.
singleton already created.
```
Declaring to resign Barcelona Remain virtually confirmed
Tags: 스포츠토토핫, 토토사이트, 토토, 스포츠토토
Published: 2024-04-25 23:25:29

"Sabbi will remain with Barcelona. He plans to sign a contract until 2025. He will continue to accompany Bordjean in the next season. He has been confirmed to lead Barcelona in the next season as well. After saying goodbye to Barcelona at the end of this season, he has decided to stay with his lifelong club, the team," Spain's Lelevo reported.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e862to1xyqdx7qsk0h1e.jpg)


Barcelona legend Xavi retired from playing in Al-Sad, Qatar. He became the coach immediately after his retirement from Al-Sad and served as the coach until 2021. Surprisingly, Barcelona approached Xavi, who made achievements such as winning the Qatar Stars League. He came to Barcelona to replace Ronald Koeman.

He led Spain's La Liga title in the 2022-23 season, and as a player and manager, he will remain as the winner of the La Liga title in Barcelona. He was criticized for showing disappointing performance and performance this season, and declared that he will be the coach until this season. With many people curious about his replacement, he made a remarkable achievement.

After announcing his resignation, he remained undefeated and advanced to the quarterfinals of the UEFA Champions League. Despite his failure to advance to the semifinals, he was clearly still in good shape. Public opinion has changed on Xavi. There were talks about the possibility of staying in office even though Xavi said, "No changes will be made."

Meanwhile, a Spanish media outlet reported that Sabi is drawing attention from the Korean national team. While Korea is looking for a replacement for Jurgen Klinsmann, in reality, it is assumed that Xavi will come to Korea only at 0%. Leaving behind lame rumors, Xavi is close to accompanying Barcelona.

"Everyone trusts Coach Savi and he is still the Barcelona coach," Barcelona vice president Yuste said. "He is happy because he believes in the Barcelona project. We share the same sentiment. I want to win the title and we trust Coach Savi. We still stay together. I have never thought about appointing another coach," he said, effectively becoming official.

BY: **[스포츠토토핫](https://www.sportstotohot.com)**
O que me motivou a criar uma plataforma de negociação em criptomoedas
Tags: programming
Published: 2024-04-25 23:06:04


Entrar no mundo do trading é como embarcar em uma jornada cheia de desafios e descobertas. 
Desde o início, percebi que para prosperar nesse universo dinâmico, precisava de mais do que apenas intuição, eu precisava de uma ferramenta que pudesse me guiar e validar minhas estratégias com precisão.

As dificuldades que enfrentei não foram poucas. 
A constante busca por validar expectativas de retorno, a necessidade de arriscar em operações reais para colher resultados concretos e a limitação de monitorar apenas alguns ativos simultaneamente eram apenas alguns dos obstáculos que surgiam no meu caminho.

Foi então que decidi agir. implementei um sistema de backtest que se tornou meu aliado fundamental nessa jornada desafiadora. 
Com ele, pude finalmente validar minhas estratégias de forma precisa, selecionando ativos, períodos, e avaliando riscos e recompensas com segurança.


![Criptix ultimate trading](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0kso9hxlynxmjm1nt1jw.png)


Desenvolvi essa ferramenta com uma stack
- Golang
- Javascript
- HTML 
- TailwindCss

E tudo integrado através de Websockets. 

Essa combinação não apenas me poupou tempo precioso, mas também me proporcionou uma nova perspectiva no mercado. Agora, recebo alertas instantâneos sobre oportunidades e não preciso mais ficar grudado na tela, permitindo-me viver mais e aproveitar as pequenas coisas da vida.

E aí, ficou empolgado com essa solução? Eu certamente estou! Afinal, tornar o trading mais acessível e eficiente é um passo gigantesco rumo ao sucesso no mercado financeiro.
2370. Longest Ideal Subsequence
Tags: php, leetcode, programming, algorithms
Published: 2024-04-25 22:53:14

2370\. Longest Ideal Subsequence

Medium

You are given a string `s` consisting of lowercase letters and an integer `k`. We call a string `t` **ideal** if the following conditions are satisfied:

- `t` is a **subsequence** of the string `s`.
- The absolute difference in the alphabet order of every two **adjacent** letters in `t` is less than or equal to `k`.

Return _the length of the **longest** ideal string_.

A **subsequence** is a string that can be derived from another string by deleting some or no characters without changing the order of the remaining characters.

**Note** that the alphabet order is not cyclic. For example, the absolute difference in the alphabet order of `'a'` and `'z'` is `25`, not `1`.

**Example 1:**

- **Input:** `s = "acfgbd", k = 2`
- **Output:** `4`
- **Explanation:** The longest ideal string is `"acbd"`. The length of this string is `4`, so `4` is returned.
Note that `"acfgbd"` is not ideal because `'c'` and `'f'` have a difference of `3` in alphabet order.

**Example 2:**

- **Input:** `s = "abcd", k = 3`
- **Output:** `4`
- **Explanation:** The longest ideal string is `"abcd"`. The length of this string is `4`, so `4` is returned.

**Constraints:**

- <code>1 <= s.length <= 10<sup>5</sup></code>
- <code>0 <= k <= 25</code>
- s consists of lowercase English letters.


**Solution:**

```
class Solution {

    /**
     * @param String $s
     * @param Integer $k
     * @return Integer
     */
    public function longestIdealString($s, $k) {
        // dp[$i] := the longest subsequence that ends in ('a' + $i)
        $dp = array_fill(0, 26, 0);

        for ($i = 0; $i < strlen($s); $i++) {
            $c = $s[$i];
            $charIndex = ord($c) - ord('a');
            $dp[$charIndex] = 1 + $this->getMaxReachable($dp, $charIndex, $k);
        }

        return max($dp);
    }

    private function getMaxReachable($dp, $i, $k) {
        $first = max(0, $i - $k);
        $last = min(25, $i + $k);
        $maxReachable = 0;
        for ($j = $first; $j <= $last; $j++) {
            $maxReachable = max($maxReachable, $dp[$j]);
        }
        return $maxReachable;
    }
}
```


**Contact Links**

- **[LinkedIn](https://www.linkedin.com/in/arifulhaque/)**
- **[GitHub](https://github.com/mah-shamim)**