teleren/devto huggingface dataset:
Iniciar sesion en mongodb con usuario y contraseña | Mongodb
Tags: mongodb, connection, db, espanol
Published: 2023-10-12 20:59:20

##Hola a todos##

Hoy les traigo un nuevo minitutorial de como crear usuario y contrasena en mongodb

primero que nada entramos a la base de datos que deseamos colocarle la contreana para ello ejecutamos el comando 


```
mongo
```

o

```
mongosh
```

una vez dentro de mongo seleccionamos el nombre de la base de datos donde queremos crear el usuario

para ello ejecutamos el comando 

```

use NOMBRE_DE_LA_BASE_DE_DATOS

```

Una vez dentro ejecutamos el siguiente comando:

```
db.createUser(
{
user: "AQUI VA EL NOMBRE DEL USUARIO",
pwd: "AQUI VA LA CONTRASEÑA",
roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
}
)
```

Ahora solo resta activar la opcion para que permita usar la contrasena para ello nos vamos a la configuracion de mongo

En el caso de mac debería de estar en

```
/usr/local/etc/mongod.conf
```

en el caso de Ubuntu

```
/etc/mongodb.conf
```

agregamos las siguientes lineas:


```
security:
  authorization:enabled 
``` 

Posteriormente reiniciarmos el servicio de mongodb-community

en el caso de mac

```
brew services restart mongodb-community
```

o

```
sudo systemctl restart mongod
```

ahora para poder conectarnos ejecutamos el siguiente comando

```
mongodb://NOMBRE_DEL_USUARIO:CONTRASENA@localhost:27017/NOMBRE_DE_LA_BASE_DE_DATOS

```


ESO ES TODO 

LOS QUIERO

SALE BYE
Lab 5 - Refactoring the code
Tags: opensource, productivity, javascript
Published: 2023-10-12 20:56:25

For this lab I had to refactor the code, kind of like giving it a little makeover. The goal was to make it easier to understand and manage. First, I fixed up a function called `textToHtml`. I made the HTML template neater, so when someone looks at it, they won't scratch their heads in confusion. It's like tidying up a messy room.

Then, I worked on another part, the `markdownToHtml` function and some file stuff. I realized things were a bit scattered, so I put them into a group called `FileProcessor`. It's like putting all your toys in one box instead of having them scattered all over the room. It just makes things easier to find.

The main function was like the big boss overseeing everything. I broke it into smaller parts, like having different managers for different tasks. This made everything less chaotic and easier to follow.

During this process, I used something called an interactive rebase, which is like a tool to arrange things nicely. But, there were some hiccups, especially when dealing with file deletions. I had to fix conflicts and make sure everything still worked.

Testing was my buddy throughout this journey. It helped me catch potential bugs early on. The main takeaway? Keeping things neat and organized in code is like keeping your room tidy—it just makes life simpler!
The Importance of Separating Anchor Tags from Buttons in HTML
Tags: html, webdev, beginners, learning
Published: 2023-10-12 20:36:34


![Anchor tag inside Button tag](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jcq8yd0jf3awxpsa6bty.png)
In the world of web development, the rules and best practices for HTML and web design continue to evolve. One common practice that has raised concerns is placing anchor tags `<a>` inside button elements `<button>` . Although it may seem convenient, doing so can lead to unintended consequences and diminish the user experience. In this article, we'll explore the reasons why anchor tags shouldn't be nested within buttons.

### 1. Semantic Confusion:

The cornerstone of web development is creating well-structured, semantically meaningful code. Anchor tags `<a>` are used to create hyperlinks, allowing users to navigate between different pages or resources. On the other hand, buttons `<button>` are typically used to trigger actions or functions on the current page. Nesting an anchor tag inside a button can blur the lines between these two distinct HTML elements, creating semantic confusion.

### 2. Accessibility Issues:

Web accessibility is a crucial aspect of web design. Screen readers and other assistive technologies rely on the HTML structure to provide accurate information to users with disabilities. When anchor tags are placed inside buttons, it can be challenging for these technologies to interpret the content correctly. Users with disabilities may encounter difficulties when navigating or interacting with the page.

### 3. Unpredictable Behavior:

Combining anchor tags and buttons can lead to unpredictable behavior. For instance, when a user clicks on the combined element, it's uncertain whether they will trigger the button's action, follow the link, or both. This unpredictability can result in a frustrating user experience, leaving users unsure of what to expect.

### 4. Styling Challenges:

Styling elements is a fundamental aspect of web design. However, combining anchor tags with buttons can create styling challenges. CSS styles may behave unexpectedly when applied to a combined element, making it harder to achieve a consistent and attractive design.

### 5. Alternative Solutions:

Instead of nesting anchor tags within buttons, web developers can utilize alternative solutions that maintain a clean and semantically meaningful structure. For example, one can use buttons for actions and anchor tags for navigation. To create a button that resembles a link, CSS can be applied to style the button element. This approach ensures that both actions and navigation are clearly defined and enhances code readability.

> 
In conclusion, the practice of placing anchor tags inside button elements in HTML can lead to a host of issues, including semantic confusion, accessibility problems, unpredictable behavior, styling challenges, and more. By adhering to best practices and keeping the two elements separate, web developers can create a more accessible, predictable, and user-friendly experience for all website visitors.
DarkGDK 2D Character Rigging and Dark AI reconfiguration Coding Challenge
Tags: cpp
Published: 2023-10-12 19:50:21

This coding challenge is not for the faint of heart prepare yourself to use outdated systems outdated software as this task is not easy details below.

This Project is strictly for work sample purposes if you are looking to build your resume in software development. I can't offer payment for these tasks its entirely up to you if you choose to take them on. However it gives you a chance to show your skills and if completed I can now vouch for your skills on Jobcase.com you can also vouch for my leadership skills on Jobcase.com. So this helps you build a profile on Jobcase.com

Note: If you completed this task then reach out to me by email: devaughn.b2009@gmail.com share your Jobcase.com information that way I can support your work sample.

If you can complete these tasks what job can you possibly apply for?
C++ Tools Programmer for video games I would be able to now vouch for that if completed

You can also sell the 2D Character Rigging System yourself (granted again this is a coding challenge so if you allow me to use the system its entirely up to you). That being said you now gain someone who can test it

Coding Challenge:

Problem 1: The game engine I have is good for my project but doesn't have a 2D Character Rigging System only a 3D Character Rigging System I need the 3D Character Rigging commands converted to 2D Character Rigging commands

Problem 2: Need valid A.I. Code to be ported to directx9 and compile successfully

So what's the tasks details?
Tools Used that you will need
TheGameCreators DarkGDK, Visual Studio C++ 2008, DirectX9

Task 1: Convert the DarkGDK 3D Character Rigging commands to 2D Character Rigging Commands

download instructions for task 1: check links below




Task 2: Reprogram A.I Code to work for Directx9
Root Issue:
A.I. Code was made for Directx10 I need it converted back to Directx9

Download instructions for task 2: check links below

To do both of these tasks you can download the software and source code that I have check the downloads links if the below links don't work email me at the email above.

The full DarkGDK Source code is attached below along with the character rigging commands required in 2D and all the documentation you should need

OS System required: Windows 10 or below 
If the links don't work let me know.

Download Instruction link: https://drive.google.com/file/d/1CHniAF_DQ7Gkp3e0jXJkAw9X-hq3LNGi/view?usp=sharing


Software Documentation link:
https://drive.google.com/file/d/1i6yhuDMy9xk8yQfCfEWyCix4UON_VMv_/view?usp=sharing

DarkGDK Source Code link: https://drive.google.com/file/d/1VxCvE0y717NBrZaSOopNv9BIYkZhnpY_/view?usp=sharing

Basic 3D Commands that need to be converted to complete this task
https://drive.google.com/file/d/1eOBR2u6QKGq_j-XNWd8pcgNRBhbHNZY3/view?usp=sharing
Hello.........
Tags: cpp, beginners, basic, tutorial
Published: 2023-10-12 19:16:05

I am very grateful to be part of a community like this of developers. I may self am an author. I create basic tutorials of C++ in Hashnode as a blog post and videos on YouTube.
Here is my YouTube channel : https://www.youtube.com/@CodingwithAmmar
Here is my blog : 
https://codingwithammar.hashnode.dev
El Anuncio de Microsoft: Microsoft Build for OpenJDK 21
Tags: jdk, microsoft
Published: 2023-10-12 18:55:07

La industria tecnológica nunca deja de sorprendernos, y una de las últimas noticias emocionantes es el anuncio de Microsoft sobre la disponibilidad de su propia versión de OpenJDK 21, conocida como "Microsoft Build for OpenJDK 21". En este artículo, exploraremos esta noticia y lo que significa para la comunidad de desarrolladores.

Microsoft se une a la fiebre de Java 21:
Justo después del lanzamiento de la plataforma Java 21 por parte de Oracle, Microsoft ha dado un paso al frente al ofrecer su propia versión de OpenJDK 21 de forma gratuita. Esta noticia es un hito importante, ya que Microsoft está brindando a la comunidad de desarrolladores acceso gratuito a esta tecnología.

Características destacadas:
La versión de Microsoft Build for OpenJDK 21 trae consigo algunas características emocionantes que la diferencian de las versiones anteriores de Java. Algunas de las novedades incluyen:

Articulo completo [davdomin.blogspot.com/2023/10/microsoft-ofrece-descarga-gratuita-de.html](https://davdomin.blogspot.com/2023/10/microsoft-ofrece-descarga-gratuita-de.html)
Second Day
Published: 2023-10-12 18:39:51

>Today is a overtime day, I have a irritating work to do. Oh, I even want to scold someone who provide the interface to me. The interface is not work normally, but i even think that my params have something wrong so that the interface couldn't work. I spent much time to find the bug  that cause the interface is bad, however, the bug is not created by me. It's a wry laugh. That's the reason why I update so late if you check by china time.About CSAPP, today i have not started to read it, my brain have run continuously over 17 hours. Tired and confusion around me.Today calligraphy practice is still practice writting dot.
![day4](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dg3gxa1l0m9vba98v9xq.jpg)
Tips for programming and debugging code
Published: 2023-10-12 18:33:34

## Rubber Duck Debugging
- Try talking through the problem as if you're explaining it to someone else.

## Pseudocode
- Write out the steps in comments.

## Make the Invisible Visible
- Print to verify what each step did
```ruby
puts "My var here: #{my_var}"
```

- Make instance variables and embed them in the view.
```ruby
<%= @my_variable.inspect %>
```

- Use the interactive console to display the contents of params, variables, and experiment to find solutions for the error.

- Read the server log. (Clear with `⌘+k`)

## Try debugger
Add `debugger` to stop execution and inspect variables
`c` continue
`n` execute next line

## Restart / Refresh
- Restart server
- Hard refresh the page

## How to Solve It
1. Understand the problem
2. Make a plan
3. Carry out the plan
4. Reflect how could it be better

## Understand the problem
- What am I trying to accomplish?
- Restate the problem.
- Use a picture or a diagram.
- Gather information to find a solution.
- Understand all the words used in stating the problem.
- Ask questions.
How to reset React Component State by itself
Tags: react
Published: 2023-10-12 18:22:06

---
title: "How to reset React Component State by itself"
description: "Simple way to reset a component state on an event"
published: true
tags: react
cover_image: https://vamshi.nl/placeholder-board.jpeg
canonical_url: https://vamshi.nl/blog/how-to-reset-react-component-state

# Use a ratio of 100:42 for best results.
# published_at: 2023-10-12 18:16 +0000
---

A react component state (defined by `useState`) remains unchanged during renders and is affected only when manually changed. One common way to reset the state is to manually modify them: 

```ts
const Demo = () => {
  const [name, setName] = useState('default');
  const [address, setAddress] = useState(null);

  const reset = () => {
    setName('default');
    setAddress(null);
  }

  return (
    ...
    <button onClick={()=>reset()} >Reset</button>
  );
}

```

This is not ideal for three reasons: 
1. The initial state is repeated and we may need to extract it to another variable to prevent bugs mismatch
2. Need to keep both in sync while updating
3. If the state is added from a custom hook, we have no way to reset it directly from the component

A better way is to reset by adding a special prop called `key`. It's well known we need to pass `key` while mapping list of components. But it can also be used to reset the component state. But this involves adding a new state to parent component just for resetting child component.

```ts
  const Demo = ({reset}: {reset:()=>void})=>{
    const [name, setName] = useState('default');
    const [address, setAddress] = useState(null);

    return (
      <button onClick={()=>reset()}>Reset</button>
    );
  }

  const Parent = ()=>{
    const [resetKey, setResetKey] = useState(0);

    return (
      ...
      <Demo key={resetKey} onReset={ ()=> setResetKey(resetKey+1)} />
    )
  }
```

What we are doing here is forcefully changing the value of prop `key` which resets the component state manually. Technically its not doing it by itself but taking parent component help, but this seems to be the cleanest way to reset.
This has the disadvantage of rerendering parent component and all its children. But since no other state is changed, ideally it should not be a big deal.


Codesandbox to play with : 
{% codesandbox https://codesandbox.io/embed/black-dew-8t9vyv?fontsize=14&hidenavigation=1&theme=dark %}
Day 5: Completed The First Task "Survey Form"
Tags: webdev, javascript, beginners, programming
Published: 2023-10-12 18:18:30

Hey Dev community!

I wanted to share my recent experience of working on a real-world task after diving deep into the basics of HTML and CSS. As a coding enthusiast and a participant of the #100DaysOfCodeChallenge, I decided to challenge myself by building a survey form from scratch. Trust me, the journey from understanding the fundamental concepts to implementing them in a real project was both exciting and enriching!

Understanding the Basics:
I started by solidifying my understanding of HTML tags and CSS properties. From form, input, and <label> tags to styling elements with CSS, I felt confident in my grasp of the fundamentals. Armed with this knowledge, I was ready to take on the challenge of creating a fully functional survey form.

The Project:
The survey form I envisioned wasn’t just any form; it was interactive, user-friendly, and aesthetically pleasing. I applied my HTML skills to structure the form, using appropriate tags for each input field and employing semantic HTML to enhance accessibility. With CSS, I brought my form to life, adding colors, adjusting layouts, and ensuring it looked great on various devices.

Challenges and Learnings:
Of course, it wasn’t all smooth sailing. I encountered challenges, such as aligning elements perfectly and making the form responsive. But each challenge became an opportunity to learn. I researched, experimented, and with determination, I overcame each obstacle. This process not only enhanced my technical skills but also honed my problem-solving abilities.

The Result:
After hours of coding, testing, and refining, I proudly present my survey form. It's functional, visually appealing, and responsive – a testament to my newfound understanding of HTML and CSS. Seeing the form in action was incredibly rewarding and motivated me to delve even deeper into the world of web development. see link below:

https://survey1-form.netlify.app/
Manual Testing
Published: 2023-10-12 18:08:21

Manual Testing: It is the process in which test cases are executed manually without any automation tool. Tester executes all the test cases manually and ensures if the application is working as expected, and as mentioned in the requirement document. Test case reports are also generated manually.
Manual testing is mandatory for every newly developed software before automated testing. This testing requires great efforts and time.It does not require any knowledge of automated testing tools.
There are different types of manual testing which includes
1) White box testing : The white box testing is done by developer, where the developer checks every line of code before giving it to the Test Engineer. Since the code is visible for the developer during the testing, it is also known as White box testing.
2) Black box testing : It is done by the Test Engineer, where the tester can check the functionality of an application or the software according to the customer /client's needs. In this, the code is not visible while performing the testing. So ,it is known as black-box testing. 
3) Gray box testing : Gray box testing is a combination of white box and Black box testing. It can be performed by a person who knew both coding and testing. And if the single person performs white box, as well as black-box testing for the application, is known as Gray box testing.
4) Exploratory testing: testers explore the application or software without predefined test cases
5) Usability testing: Testers interact with the application, performing various tasks and providing feedback on the overall user experience.
6) Ad-hoc testing: Testers perform testing without following any specific test cases or scripts. They test the application based on their knowledge, experience, and target areas that might have defects.
7) Functional testing: It is a type of testing where testers check if features of the System Under Test are working as expected according to its specified requirements. The primary goal of functional testing is to ensure that the software performs the functions it was assigned to do.
8) Non-Functional testing : A type of software testing that verifies non functional aspects of the product, such as performance, stability, and usability

Benefits of Manual testing:

- It does not require programming knowledge 
- Tester interacts with software as a real user so that they are able to discover usability and user interface issues.
- Ensures if the software is 100% bug free
- Easy to learn for new testers
- It is cost effective, low maintenance cost
Drawbacks of Manual Testing include the following:
   
-  Test cases cannot be used again. Need to develop separate test 
   cases for each new software.
-  It does not provide testing on all aspects of testing.
-  It requires a large number of human resources.
-  It is very time-consuming.
-  Tester develops test cases based on their skills and 
   experience. There is no evidence that they have covered all 
   functions or not.
- Manual testing has lower learning curve than automated testing
Sublime for Python
Tags: sublimetext, python, autocomplete, import
Published: 2023-10-12 17:59:23

I believe Sublime Text is by far the most optimized and powerful "text editor".

However, for writing any code you need some IDE-like features that help you write code faster and more efficiently and that's where sublime plugins come into the picture, there are a lot of plugins using which you can use similar features like any IDE, but one thing I couldn't replicate which was `auto-generating python import statement`, I have tried many plugins LSP, conda, Jedi etc, but none of them worked and most of them are now inactive projects so if I had any issues it was harder to get resolution.

So I decided to build a plugin whose "First" objective would be to `generate Python import statements` for libraries installed in your Python virtual as well as global environment or from your project codebase, it does it all very seamlessly. So I do request anyone who works with Python and is in love with Sublime Text to try "**PyRock**".

**Update**
With the V2 release now plugin supports more features, such as:
1. Copying import statements
2. Added feature to generate and copy `django` or `pytest` supported test path
3. Added feature to run `django` or `pytest` tests

Checkout the plugin here: [PyRock Plugin](https://packagecontrol.io/packages/PyRock)
Day 4: Building a Registration Form
Tags: webdev, javascript, beginners, programming
Published: 2023-10-12 17:58:02

I am excited to share my progress as a novice web developer participating in the #100DaysOfCodeChallenge. Today marks another milestone in my journey.

Currently immersed in the fundamental concepts of HTML and CSS, I successfully constructed a registration form by applying my knowledge gained during this learning challenge. Although the task initially posed challenges, the final output filled me with immense satisfaction.

Utilizing HTML tags such as <h1>, <label>, <input>, <p>, <fieldset>, <legend>, and <textarea>, along with their respective attributes, I meticulously crafted the form's structural framework. Subsequently, CSS was employed to style the form and ensure its responsiveness across various devices.

I invite you to explore the project via the following link. 
https://formreg1.netlify.app/


Your feedback and insights would be greatly appreciated.