teleren/devto huggingface dataset:
rust hashMap
Published: 2024-05-22 01:29:21

1. how to create hashmap in rust？

```
use std::collections::HashMap;
let a = HashMap::new();

let a2= HashMap::from([
("key","value"),
("key","value")
]);
```
2. how to insert ("key","value") into map instance?

```
let a2= HashMap::from([
("key","value"),
("key","value")
]);
a2.insert("dd","22")
```
3.how to remove someone out of map instance?

```
 map.remove(&String::from("color2")); 
```
4.how to update value of key?

```
     map.entry("test2").or_insert(200);
```
5.how to get value of key?

```
 let val=  map.get("test2");
```
5. how to traverse map instance?

```
let mut a2= HashMap::from([
("key","value"),
("key","value")
]);

for (key,value) in &mut a2{
   value*="213"
};
```
Data Structures and Algorithms: Breadth First Search
Tags: beginners, dsa, javascript, trees
Published: 2024-05-22 01:28:58

## Introduction

In a breadth first search, we traverse a tree one level at a time, visiting each node on a level before visiting any potential children nodes. We will use a queue to explore this data structure.  See [part three ](https://dev.to/faraib/data-structures-and-algorithms-queues-1p3f) of this series for further details on queues.  

## Breadth First Traversal
Considering the root of the tree, we add the root to the queue. We then remove the node at the front of the queue and print out its value. We also consider any children the node might have and then add them to the back of the queue, going from left to right. We repeat this process until the queue is empty. We can use the following binary tree to illustrate this. 


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

In this example we start by adding the root to our queue. 

**[a]**

We remove the node at the front of the queue, printing out its value. We then add any children that this node might have to the back of the queue. 

**[b, c]**

We repeat the process, removing the node at the front of the queue and printing its value, and then we add any of its children to the back of the queue. 

**[c, d, e]**

We continue the process until the queue is empty. The resulting breadth first traversal of our example tree will be: **a, b, c, d, e, f, g**.

A breadth first traversal can be achieved in javascript using the following code:

```
const breathFirstTraversal = (root) => {
  let queue = [root];

  while (queue.length > 0) {
    let currentNode = queue.shift();

    console.log(currentNode.val);

    if (currentNode.left !== null) {
      queue.push(currentNode.left);
    }
    if (currentNode.right !== null) {
      queue.push(currentNode.right);
    }
  }
};

```

## Breadth First Search

Knowing how to implement a breadth first traversal, we can now proceed to implement a breadth first search in order to find a target value in a tree. Here is how this can be done in javascript:

```
const breathFirstSearch = (root, target) => {
  let queue = [root];

  while (queue.length > 0) {
    let currentNode = queue.shift();

    if (currentNode.val === target) {
      return true;
    }

    if (currentNode.left !== null) {
      queue.push(currentNode.left);
    }
    if (currentNode.right !== null) {
      queue.push(currentNode.right);
    }
  }

  return false;
};
```
A breadth first traversal can also be used to add up all of the node values in a tree. 

## Conclusion 
This concludes the basics of a breadth first traversal and how this can be used as a basis for a breadth first search. As previously stated, the implicit data structure used in a breadth first traversal is a queue.
Game Development Diary #2 : GameDev.tv Course
Tags: godot, godotengine, gamedev, newbie
Published: 2024-05-22 00:19:35

22/05/2024 - Wednesday

#Day Two
## Today's Progress:

-**Interface Navigation**: Spent time navigating around Godot's interface. The split-screen view and the drag-and-drop functionality are quite user-friendly.

- **Imported Scenes**: Successfully imported my first scene into Godot. Understanding the scene system was crucial as it forms the building blocks of Godot's architecture.

- **3D Mesh Creation**: Created a new 3D mesh. It was a bit challenging at first, but the intuitive interface made the process smoother. I also learn how to transform the mesh, create a shape for this mesh.

- **3D Mesh Creation**: Created Lighting, environment, and camerafor this scene so when i run the game it will show something on the screen.


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


- **GDScript Basics**: 
    -Dived into GDScript scripting. 
    -Wrote a simple script to print strings in the console. 
    -Learn the difference between func _ready and func _process(delta).
    -Learn GDsripts variable
    -Learn about strong typing to get better performance and make code 
     more readable

```
extends Node3D


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
	if Input.is_action_pressed("ui_accept"):
		#Move the character posistion
		position.y += delta
	if Input.is_action_pressed("ui_left"):
		rotate_z(delta)
	if Input.is_action_pressed("ui_right"):
		rotate_z(-delta)
```


## Thoughts:

I'm amazed at how flexible and powerful Godot is as a game engine. The community support and documentation are incredibly helpful. The more I explore, the more I realize the potential of this engine for solo indie game developers like myself.

## Next Steps:

- Delve deeper into GDScripts. I want to make collision detection, and learn about rigidbody3d and physics

## Resources Used:

- Complete Godot 3D: Code Your Own 3D Games In Godot 4! - Course
Basic painting with Ruby: implementing a flood-fill algorithm with DragonRuby GTK
Tags: dragonruby, ruby, paint
Published: 2024-05-22 00:10:14


Continuing with my learning and experimentation with _DRGTK_, I wanted to implement a flood-fill algorithm on a canvas with some drawings.

This idea came from an old interview exercise I did some years ago.

The Flood Fill algorithm is commonly used in graphics software to fill an area with a specific color. It’s what powers the paint bucket tool.

So having a canvas and a pair of coordinates on that, the initial color is the one located in this location and the plan is to change it to another color, filling all adjacent pixels with the original color with the new one until a different one from the original one is reached.
My implementation is a recursive one:

```ruby
 def paint(x:, y:, base_color:, new_color:, sleep_time: 0)
   return if new_color == base_color

   coords_inside_matrix = y >= 0 && y < map.size && x >= 0 && x < map[0].size

   pixel_should_be_painted = coords_inside_matrix && map[y][x] == base_color

   return unless pixel_should_be_painted

   map[y][x] = new_color  # paint the cell

   paint(x: x+1, y: y, base_color: base_color, new_color: new_color)
   paint(x: x, y: y+1, base_color: base_color, new_color: new_color)
   paint(x: x-1, y: y, base_color: base_color, new_color: new_color)
   paint(x: x, y: y-1, base_color: base_color, new_color: new_color)
 end
```

I worked on my solution using TDD, with Minitest spec tests, so it was easier to start with basic scenarios and also printed it while it moved the brush position recursively.

```
# Running:

paint(2-1)
  changing x:2 y:1
[0, 0, 0, 0, 0]
[0, 0, 8, 0, 0]
[0, 0, 2, 3, 8]
[2, 2, 2, 0, 0]
[0, 0, 2, 0, 5]
paint(2-2)
  changing x:2 y:2
[0, 0, 0, 0, 0]
[0, 0, 8, 0, 0]
[0, 0, 8, 3, 8]
[2, 2, 2, 0, 0]
[0, 0, 2, 0, 5]
paint(2-3)
  changing x:2 y:3
[0, 0, 0, 0, 0]
[0, 0, 8, 0, 0]
[0, 0, 8, 3, 8]
[2, 2, 8, 0, 0]
[0, 0, 2, 0, 5]
paint(2-4)
  changing x:2 y:4
[0, 0, 0, 0, 0]
[0, 0, 8, 0, 0]
[0, 0, 8, 3, 8]
[2, 2, 8, 0, 0]
[0, 0, 8, 0, 5]
```

On the Dragon Ruby side, I drew the matrix as a canvas and queried the mouse functions to get the cell position to paint or to change the color of the brush by clicking on a color palette box.
There is no pencil functionality so the canvas starts with a default drawing to play with it:

![Application screeshot](https://i.ibb.co/XzHjV9k/Grabaci-n-de-pantalla-desde-2024-05-21-19-46-51.gif)

...and that's basically it. Not sure what will be next on this series. There is a game jam with Dragon Ruby [starting soon](https://itch.io/jam/kifass-2), maybe I could participate on it :) .

Links to the app and code:

- [Itch.io page](https://megatux.itch.io/flood-fill-example)
- [github repo](https://github.com/megatux/drgtk_floodfill)

Happy hacking!
Welcome Thread - v277
Tags: welcome
Published: 2024-05-22 00:00:00

---
published_at : 2024-05-22 00:00 +0000
---
![Cartoon of a person answering the phone and saying "Yo"](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gf02h29439htviyvt2da.gif)

---

1. Leave a comment below to introduce yourself! You can talk about what brought you here, what you're learning, or just a fun fact about yourself.

2. Reply to someone's comment, either with a question or just a hello. 👋 

3. Share your wins from this week in our weekly ["What was your win this week?](https://dev.to/t/weeklyretro) thread.
DANIEL MEULI WEB RECOVERY _ HELPED ME TO RECOVER MY LIFE SAVINGS LOST THROUGH A CRYPTO SCAM
Published: 2024-05-21 23:38:05

Contacts Info  https://danielmeulirecoverywizard.online    
Telegram: At Danielmeuli       WhatsApp:  +.3.9.3.5.1.2.0.1.3.5.2.8       As someone who fell victim to a financial scam, I understand the devastation and sense of betrayal that accompanies such an experience. In my case, I had invested all my financial assets with someone I met on MEET. me believing that my cryptocurrency investments were yielding substantial profits. However, it turned out to be nothing more than an elaborate scam, leaving me feeling helpless and financially devastated. Amidst the turmoil, I stumbled upon Daniel Meuli Web Recovery while searching for solutions. Skeptical yet desperate, I decided to enlist their services, hoping against hope that they could help me reclaim what was rightfully mine. To my immense relief and gratitude, Daniel Meuli Web Recovery proved to be a beacon of hope in my darkest hour. From the outset, Daniel Meuli Web Recovery demonstrated a level of professionalism, expertise, and dedication that instilled confidence in their ability to tackle even the most complex cases. They listened attentively to my story, empathized with my plight, and assured me they would leave no stone unturned in their pursuit of justice. Despite the intricate nature of my case, they tirelessly worked to unravel the web of deception and deceit that had ensnared me. Their team of experts meticulously analyzed the situation, leveraging their extensive knowledge and state-of-the-art resources to formulate a comprehensive strategy for recovery. Throughout the process, Daniel Meuli Web Recovery kept me informed every step of the way, providing regular updates and transparent communication. This level of transparency and accountability alleviated my anxieties and reaffirmed my trust in their capabilities. Their unwavering support served as a lifeline during what was undoubtedly one of the most challenging periods of my life. I am immensely grateful to Daniel Meuli Web Recovery for their unwavering dedication and steadfast commitment to justice. Thanks to their efforts, I was able to reclaim my stolen assets and begin the journey towards rebuilding my financial stability. But more than just recovering my funds, they restored my faith in humanity and reminded me that even in the face of adversity, there are still those willing to fight for what is right. If you find yourself in a similar situation, I wholeheartedly recommend enlisting the services of Daniel Meuli Web Recovery. Don't allow yourself to be consumed by despair and hopelessness; instead, take proactive steps to reclaim what is rightfully yours. With Daniel Meuli Web Recovery by your side, you can rest assured that your interests will be fiercely defended, and justice will prevail.
Six Basic Principles of Influence Essential for Effective Management
Tags: productivity, career, leadership, learning
Published: 2024-05-21 23:18:11

Have you ever wondered how psychology shapes our everyday communication in the workplace? 🤔

Get to know more about basic management psychology, revealing 6 common principles that influence how we interact, collaborate, and achieve results. 

Discover how to:

- Decode the unspoken messages behind your team's actions 
- Understand the unique perspectives that shape each individual's reality 
- Overcome the internal barriers that hinder communication and collaboration 
- Build trust by acknowledging the human need for self-preservation 
- And many more

👉 [**Understand more of the psychological forces at play in your workplace**](https://iwooky.substack.com/p/six-basic-principles-of-influence)


[![Six Basic Principles of Influence Essential for Effective Management](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oqavlni5bj5nztckzj9a.jpg)](https://iwooky.substack.com/p/six-basic-principles-of-influence)
📸 Disaster reporting w/Open Source LLaVA/AI for photo analysis
Tags: ai, datascience, showdev, opensource
Published: 2024-05-21 23:12:30

## ❔ Context

My country recently faced severe events: 

[![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b5hyr0lwvh1z6x8ztiti.png)](https://www.dnc.nc/dossier-retour-en-images-sur-une-semaine-de-chaos/)

## 🤔 Inception

These events generated a lot of visual contents, especially photos at an amazing pace and from a very wide variety of media sources.

These contents generated a lot of emotions while we were lacking of sleep. Still we need to be able to perform analysis.

**The purpose of this post is to show a way to analyze these contents, with Open Source software... and what we can learn from this technology in a context of social crisis and emotion overwhelm.**


## 🎯 What we'll cover

Below some keypoints I'll cover:

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

## 🎬 Demo

{% youtube b6IwQ_5coiI %}

## 📑 Demo keypoints

- [💡 Intro](https://www.youtube.com/watch?v=b6IwQ_5coiI&t=0s)
- [🪝 Pitch](https://www.youtube.com/watch?v=b6IwQ_5coiI&t=110s)
- [📜 Project workflow](https://www.youtube.com/watch?v=b6IwQ_5coiI&t=271s)
- [🤖 First image analysis](https://youtu.be/b6IwQ_5coiI?si=AsAKrRokpCvT5ZGh&t=736)
- [📕 Extracting keywords with open source AI : llama3](https://www.youtube.com/watch?v=b6IwQ_5coiI&t=1150s)
- [🔭 Teasing on `text2image` perspectives](https://youtu.be/b6IwQ_5coiI?si=CBpWJdDF_U0sjmFU&t=1507)

## 🔖 Resources

- [📜 Kaggle Notebook](https://www.kaggle.com/code/adriensales/new-caledonia-state-of-emergency-ai-photo-analysis)
- [🆓 Local & Open Source AI: a kind ollama & LlamaIndex intro](https://dev.to/adriens/local-open-source-ai-a-kind-ollama-llamaindex-intro-1nnc)
- [💰 Unleash ollama potential w. data and LLM capabilities](https://dev.to/adriens/unleash-ollama-potential-w-data-and-llm-capabilities-3ghl)
- [📑 Ollama Series' Articles](https://dev.to/adriens/series/25929)
MLOps Zoomcamp Week 1
Published: 2024-05-21 22:51:39

I recently joined the [MLOps zoomcamp](https://github.com/DataTalksClub/mlops-zoomcamp), it is a 3-months course that goes through the basic foundations of MLOps.

We began week 1 recently, and would love to record my learning process and share my knowledge publicly.

Notes:

MLOps is a set of best practices for putting machine learning in production.


The machine learning cycle involves 3 main stages: Design, Train, Operate.

As an organization matures there is need to have a structured way to track experiments, register models, avoid redundancies using ML Pipelines.

As ML needs grows, an organization's level of maturity of MLOps can be categorized under 5 levels, numbering starts from zero.

**0. No MLOps**
No automation
All code in jupyter

**1. DevOps, No MLOps**
Releases are automated
Unit and Integration Tests
CI/CD
OPS Metrics
No experiment tracking
No reproducibility
DS Separated from engineers

**2. Automated Training**
Training pipeline
Experiment tracking
Model Registry
Low Friction Deployment
DS Works with Engineer

**3. Automated Deployment**
Easy to deploy model
A/B Test

**4. Full MLOps Automation**
[Game of Purpose] Day 3
Tags: gamedev
Published: 2024-05-21 22:44:47

Today I spent some time learning how to build materials in Material Editor.
Nice thing is that we can create Material Instances and from Material expose various parameters to control how it looks on an object in realtime

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3qos6knd7iyrgd7ltu44.png)

{% youtube https://www.youtube.com/watch?v=MivMm68CkH4 %}
Cloud Resume Challenge: The Beginning
Tags: devops, webdev, aws, career
Published: 2024-05-21 21:40:52

## How I got here

Until 2 years ago, I had worked in IT since 1999. I was pretty burned out after 2021 for a lot of reasons and I needed a break, so I resigned my job as a DevOps Engineer in May of 2022. 

Fast forward almost 2 years and I am ready to get back into the workforce. Great timing huh? It appears the job market in Devops/cloud engineering is pretty tight and competitive at the moment. Quite a difference from 3-4 years ago when I would get at least 2-3 cold emails, LinkedIn messages, or calls from recruiters every week.

After two years, my skills are a little rusty. I decided to work on refreshing an AWS certification that lapsed back in 2017. Going through the courses, I realized this stuff comes back to me very quickly. Learning news tools and technologies is the standard operating procedure for IT Ops and now DevOps. Digging through documentation, figuring things out, and getting stuff to work is the name of the game. 

## Enter the CRC
Though my travels back into tech, I came across the [Cloud Resume Challenge](https://cloudresumechallenge.dev/). This was much more interesting to me. This was actual real world type work that I had done. It wasn't trying to sit through an AWS certification class and remembering what info about each service to regurgitate on a cert exam. So I decided to put the cert on hold and work on this. 

In my next few posts, I'll go over each "chunk", as listed in the CRC manual. I'm actually pretty much done, except for actually putting resume content into my resume page instead of just hosting a stub. 

It was good to work with all these pieces of tech again. More to come...
Clean docker images in Kubernetes cluster
Tags: devops, kubernetes, linux
Published: 2024-05-22 22:46:41

---
title: Clean docker images in Kubernetes cluster
published: true
date: 2024-05-21 21:40:00 UTC
tags: DevOps,kubernetes,Linux
canonical_url: https://www.ahioros.info/2024/05/clean-docker-images-in-kubernetes.html
---

A few days ago, in my Kubernetes lab, I noticed that I was running out of space. As a result, I had to delete those old Docker images.
<!-- agrega el botón leer más -->

You need go to each node and run as root:
Choose your alternartive:

* Using docker:
```bash
docker system prune
```

* Using containerd:
```bash
crctl rmi --prune
```
Gamdom Promo Code "CSGOBETTINGSS" - Get 15% rakeback
Published: 2024-05-21 21:35:35

Take your gaming up a notch! 🔥 Activate the Gamdom promo code "CSGOBETTINGSS" and get a 15% rakeback.
Here's how to get your rakeback:
Head over to the official Gamdom website.
Register via Steam.
Input the promo code "CSGOBETTINGSS"
Access the “Rewards” section to claim your rakeback.
Enjoy your 15% rakeback boost! 🔥
S
Tags: devchallenge, awschallenge, amplify, fullstack
Published: 2024-05-21 21:32:19

*This is a submission for the [The AWS Amplify Fullstack TypeScript Challenge ](https://dev.to/challenges/awschallenge)*

## What I Built
<!-- Tell us what your app does! -->

## Demo
<!-- Share a link to your deployed solution on Amplify Hosting, and include some screenshots here. -->

## Journey
<!-- Tell us about your process, the services you incorporated, what you learned, anything you are particularly proud of, what you hop to do next, etc. . -->

**Connected Components and/or Feature Full**

<!-- Let us know if you developed UI using Amplify connected components for UX patterns, and/or if your project includes all four features: data, authentication, serverless functions, and file storage. -->

<!-- Team Submissions: Please pick one member to publish the submission and credit teammates by listing their DEV usernames directly in the body of the post. -->

<!-- Don't forget to add a cover image (if you want). -->


<!-- Thanks for participating! →
Como conectar un pipeline de Azure DevOps Pipelines con DockerHub
Tags: azure, devops, docker, spanish
Published: 2024-05-23 00:05:37

---
title: Como conectar un pipeline de Azure DevOps Pipelines con DockerHub
published: true
date: 2024-05-21 21:32:00 UTC
tags: Azure,DevOps,Docker,spanish
canonical_url: https://www.ahioros.info/2024/05/como-conectar-un-pipeline-de-azure.html
---

Esta guía o manual es para enseñar como crear un pipeline en Azure DevOps que se conecte con DockerHub solamente.
Pre-requisitos:

    - Contar con una cuenta en Azure DevOps.
    - Contar con una cuenta en DockerHub.

1. Crear el proyecto en azure devops
2. En tu cuenta de dockerhub, debes crear un token:
	+ Ir a [dockerhub](https://hub.docker.com/)
	+ Crea un nuevo token
	+ Copia el token
3. Ir a project settings -> Service Connections.
	+ Click New service connection
	+ Select Docker Registry, click next
	+ Select Docker Hub, llenar campos:
    	* Docker ID: tu usuario de dockerhub
    	* Password: el token de dockerhub (que creamos previamente)
    	* service connection name: El nombre que quieras para esta conexión ejemplo: docker-hub-test
    	* Opcional una descripción.
	+ Click Verify and save.
4. Ir a pipelines
	+ Click Add pipeline.
	+ Click Azure Repos Git.
	+ Click tu repositorio.
	+ Click "starter pipeline".
	+ Copia y pega el siguiente código en el pipeline:

```yaml
pr:
  branches:
    include:
      - "*"

pool:
  vmImage: ubuntu-latest

stages:
  - stage: LoginAndLogout
    jobs:
      - job: buildandpush
        steps:
          - task: Docker@2
            displayName: Login
            inputs:
              command: login
              containerRegistry: docker-hub-test

          - task: Docker@2
            displayName: Logout
            inputs:
              command: logout
              containerRegistry: docker-hub-test
```

Listo has creado tu primer pipeline que conecta con dockerhub.

Acá te dejo el video de esta configuración por si tienes dudas:

[![01 Conectar DockerHub con Azure DevOps](https://img.youtube.com/vi/45gOYuVts_8/0.jpg)](https://youtube.com/embed/45gOYuVts_8?si=QMSBkWERxCtb93T4)
How to use React Server Components components on Storybook 8
Tags: todayilearned, webdev, frontend
Published: 2024-05-21 21:31:34

Let's say you have a NextJS page that uses React Server Components (RSC) and you have to use the `async` keyword when exporting that page

```js
// app/page.js
export default async function Home() {
  const { clients } = await getHomeContent()
  // ...code that displays clients cards on the home page
}
```

If you try to import this component/page into Storybook 8, you will get this error:
**async/await is not yet supported in Client Components, only Server Components**

To get around it, simply enable the `experimentalRSC` flag on `.storybook/main.js`

```js
/** @type { import('@storybook/nextjs').StorybookConfig } */
const config = {
  features: {
    experimentalRSC: true,
  },
  // ...other configs
}
export default config
```

Read more about it here:
https://storybook.js.org/blog/storybook-react-server-components/