teleren/devto huggingface dataset:
4 STEPS TO CREATE AN IOT HUB, ADD A DEVICE AND TEST THE DEVICE USING RASPBERRY PI SIMULATOR.
Tags: raspberrypi, azure, webdev
Published: 2023-04-02 17:19:52

**STEP 1** Search for IoT Hub in the search panel, click on create.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8ibbp3ta0ci8z4k012y3.png)

**STEP 2** Choose any resource group you want, give the IoT hub a name. Your region can remain on default. Click on "review+create" then create.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s7ti9l1vgbo23pkkxpw1.png)

**STEP 3** Once deployment is complete, go to resource, click on "Add device" and give the  device a name. Every other detail can remain on default, click on save. You have successfully added an IoT device.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vcjzurluhw5ha16kcdb2.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5j1l669yagzze0v1qftw.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rwriyz0f74gph30dwpca.png)

**STEP 4** Click on the device you just added, copy the "primary connection string" link.
Open "Azure IoT simulator" on your google, go to number 15 and replace the placeholder (your IoT hub device connection string) with the primary device string you copied and click on Run. It should begin sending messages if there is no error.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fxu0gr3utynpetap0iau.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jjbga1erfy9r0b0iw72s.png)
The importance of pushing your codes to github always
Tags: github, git, programming, codenewbie
Published: 2023-04-02 17:15:09

Before we dive into the importance of pushing our codes to GitHub as soon as possible, I would like to inform you all about git and what GitHub is...
#Git
Git is a distributed version control system that tracks changes in any set of computer files, usually used for coordinating work among programmers collaboratively developing source code during software development. Its goals include speed, data integrity, and support for a distributed, non-linear workflow.

#GitHub
GitHub is a cloud-based hosting service that lets you manage Git repositories. So majorly GitHub is a cloud-storage system where we save our codes for future use.
To learn more about GitHub [click](https://docs.github.com/en/get-started/quickstart/hello-world).
These two are majorly important to be known to a newbie, a right attitude towards building your career as a programmer is to always push your code to GitHub. 

##Some reasons for pushing your code
1. Backup and version control: By pushing your code to GitHub, you create a backup of your work in case of data loss on your local machine. Additionally, GitHub serves as a version control system, allowing you to track changes to your code over time and easily revert to a previous version if needed.

2. Collaboration: If you're working on a project with others, pushing your code to GitHub allows your team members to see and review your changes, collaborate on code together, and catch errors or issues early on.

3. Showcase your work: GitHub is popular platform developers and employers use to showcase their work. By pushing your code to GitHub, you create a public portfolio of your work that can be viewed and shared with others.

4. Continuous integration and deployment: By pushing your code to GitHub, you can integrate it with various continuous integration and deployment (CI/CD) tools that automate testing, building, and deployment processes. This can help ensure that your code is always in a functional state and ready for deployment.

###You push to GitHub by going through the following steps 
```
    git init
    git add .
    git commit -m "commit message"
    git remote add origin 'your_url_name'
    git push -u origin master
```

#Conculsion
Pushing your code to GitHub regularly means uploading your code to a website called GitHub where it's stored safely, which is a good practice. This is important because it's like having a backup copy of your code in case your computer crashes or something goes wrong, also helps you and your team collaborate more effectively, keep track of changes, and showcase your work.

Open for review and contribution!
Thank you.
Refactoring 101: The key to developing quality software
Tags: refactoring, cleancode, beginners, programming
Published: 2023-04-02 17:13:41

Refactoring is the process of improving code without changing its external behavior. It is an essential part of software development that helps maintain and improve the quality of code over time.

In this blog post, we will explore the basics of refactoring, why it is important, and how you can get started.

**Importance of Refactoring**

As software evolves, code can become more complex and difficult to maintain. Refactoring helps prevent technical debt by improving code quality and reducing complexity. It also helps improve the performance of the software by removing unnecessary code and improving algorithms.

Refactoring also has other benefits, such as:

* Reducing the likelihood of bugs: Code that is easier to understand and maintain is less likely to contain bugs.

* Improving team productivity: Refactored code is easier to understand, so team members can work more efficiently.

* Facilitating future changes: Refactored code is more modular, making it easier to change in the future.

**How to Get Started with Refactoring**

To get started with refactoring, you need to have a good understanding of the codebase you are working with. This means understanding the structure of the code, the dependencies between different components, and the purpose of each component.

Here are some steps you can follow to get started with refactoring:

* Identify the code that needs refactoring: Look for code that is difficult to understand or maintain contains duplication, or is overly complex.

* Make a plan: Before you start refactoring, make a plan for what you want to achieve. Identify the specific areas of code that you want to improve and what changes you need to make.

* Write tests: Before making code changes, it is important to write tests to ensure that the existing functionality is not affected by the refactoring. This makes it easier to catch any bugs or errors introduced during the refactoring process.

* Make changes incrementally: Refactoring is best done in small steps, so make changes incrementally, test each change, and commit those changes periodically before moving on to the next step.

* Refactor continuously: Refactoring should be an ongoing process. Code is constantly changing, and refactoring should be part of the development process to maintain quality over time.

Thank you for reading! I hope this blog post has been helpful in understanding the importance of refactoring and how to get started. If you found this article useful, please consider following my profile to read more about refactoring and other software development topics.
28 berufliches Vorwärtskommen: Ein gerader Berufsweg – Der eigentliche Weg.
Tags: deutsch, career, austausch, 1min
Published: 2023-04-02 16:59:59

Moin Moin,

nachdem man nun also [einen guten Karriere-Start hingelegt→](https://dev.to/amustafa16421/22-berufliches-vorwartskommen-ein-gerader-berufsweg-der-anfang-552f) hat und [das Ende im Sinn→](https://dev.to/amustafa16421/25-berufliches-vorwartskommen-ein-gerader-berufsweg-das-ende-2n37) hat, geht es fortwährend darum, eine Verbindung zwischen Start- und Endpunkt herzustellen. Neben der dauerhaften Fortbildung im eigenen Fach, gibt es noch weiteres zu beachten:
- [emotionale Intelligenz→](https://dev.to/amustafa16421/comment/25k2n) / Sozialkompetenz
- Selbstwahrnehmung / Reflexion
- Eigene Projekte

Weiteres ergibt sich auf dem Weg. Das wichtigste ist, dass man _seinen_ Weg geht, aufmerksam bleibt und einen Orientierungsrahmen hat. Die drei Punkte aus der Liste sollen neben der fachlichen Fortbildung als solcher dienen.

[Ein konkretes Beispiel→](https://dev.to/amustafa16421/29-berufliches-vorwartskommen-ein-gerader-berufsweg-der-eigentliche-weg-4nid), anhand von [Donald E. Knuth→](https://dev.to/amustafa16421/29-berufliches-vorwartskommen-ein-gerader-berufsweg-der-eigentliche-weg-4nid), ist im nächsten Beitrag gegeben.

Beste Grüße,
Mustafa
Inversão de dependência com NestJS
Published: 2023-04-02 16:14:43

A inversão de dependência é um princípio importante da programação orientada a objetos, que consiste em tornar as classes independentes de outras classes específicas, e sim depender de interfaces genéricas. Isso permite uma maior flexibilidade e modularidade do código, além de facilitar o teste unitário e a manutenção.

No NestJS, é possível implementar a inversão de dependência através do uso de injeção de dependência. A injeção de dependência é um padrão de projeto que permite que as dependências de uma classe sejam fornecidas por uma fonte externa, como um contêiner de dependência.

Para implementar a injeção de dependência no NestJS, primeiro é necessário definir uma interface para a classe que será injetada. Por exemplo, se quisermos injetar uma classe UserService em outra classe, podemos definir uma interface IUserService que descreve os métodos que a classe UserService deve implementar.

```Typescript
export interface IUserService {
  getUser(id: string): Promise<User>;
  saveUser(user: User): Promise<void>;
}

```

Em seguida, é preciso criar uma classe concreta que implemente essa interface. Nesse caso, a classe UserService.


```Typescript
@Injectable()
export class UserService implements IUserService {
  async getUser(id: string): Promise<User> {
    // Lógica para buscar usuário no banco de dados
  }

  async saveUser(user: User): Promise<void> {
    // Lógica para salvar usuário no banco de dados
  }
}
```

Agora, para injetar essa classe em outra classe, basta usar o decorador @Inject() e especificar a interface que a classe implementa.

```Typescript
@Injectable()
export class UserApiController {
  constructor(@Inject('IUserService') private readonly userService: IUserService) {}

  async getUser(id: string): Promise<User> {
    return this.userService.getUser(id);
  }

  async saveUser(user: User): Promise<void> {
    return this.userService.saveUser(user);
  }
}
```

Por fim, é preciso registrar a classe UserService no módulo do NestJS, utilizando o método forProvider() do módulo.

```Typescript
@Module({
  providers: [
    { provide: 'IUserService', useClass: UserService }
  ],
  controllers: [UserApiController],
})
export class UserModule {}

```

Dessa forma, a classe UserService será injetada automaticamente na classe UserApiController sempre que for necessário, sem que a classe dependa diretamente dela.
Lưới an toàn trong đời sống hàng ngày
Published: 2023-04-02 16:53:16

Lưới an toàn là một phương tiện hữu ích để đảm bảo an toàn cho người và tài sản trong nhiều lĩnh vực, như xây dựng, thể thao, hoặc trong những nơi có nguy cơ cao. Lưới an toàn được làm từ vật liệu chắc chắn và đàn hồi như sợi thép, sợi nylon hoặc nhựa PVC, đặc biệt là các loại lưới được dệt bằng sợi thép có độ bền và độ đàn hồi cao.

Trong lĩnh vực xây dựng, lưới an toàn được sử dụng để bảo vệ công nhân trên các công trình xây dựng, giúp họ làm việc an toàn và tránh tai nạn từ việc rơi từ độ cao. Ngoài ra, lưới an toàn cũng được sử dụng để bảo vệ các khu vực công cộng, như các công viên hoặc khu vui chơi trẻ em, giúp tránh các tai nạn không đáng có.

Trong lĩnh vực thể thao, lưới an toàn được sử dụng trong các bộ môn như leo núi, trượt tuyết, roughage trượt ván, giúp bảo vệ người chơi khỏi tai nạn khi họ thực hiện các động tác mạo hiểm trên độ cao.

Lưới an toàn cũng được sử dụng để bảo vệ trong các khu vực công nghiệp có nguy cơ cao như nhà máy hóa chất, nhà máy điện, hoặc trên các tàu thuyền, giúp bảo vệ người lao động và tài sản tránh khỏi những nguy hiểm khó lường.

Tuy nhiên, để đảm bảo an toàn tối đa, việc lắp đặt **[lưới an toàn](https://dichvutannha.org/luoi-an-toan-bao-ve-ban-cong)** cần được thực hiện đúng cách, tuân thủ theo quy định kỹ thuật của từng loại lưới. Ngoài ra, việc kiểm tra và bảo dưỡng lưới an toàn cũng là điều cần thiết để đảm bảo rằng chúng luôn đáp ứng đủ yêu cầu an toàn.

Trong tình hình đang diễn ra của đại dịch Covid, lưới an toàn cũng có thể được sử dụng để tạo ra khoảng cách giữa người và người trong các sự kiện đông người, giúp tránh lây nhiễm contamination.
SSG Static Site Generation VS. SSR Server-Side Rendering?
Tags: webdev, javascript, jamstack, serverless
Published: 2023-04-02 16:45:00

SSG Static Site Generation VS. SSR Server-Side Rendering?
The two most common approaches to creating websites using modern front ends are server-side rendering (SSR) and static site generation (SSG), but they differ.

SSG is good for:                                                             SSR is good for:

SSG sites are extremely fast                                    SSR provides instantly accessible content

SSG is better for SEO                                                  There is no content rebuilding

Empowered security                                                   Content sharing

SSG is cost-effective                                                   Integration with proprietary tech stacks

Rendering frameworks for each mode

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

So, SSG or SSR - which one to use? Find out here ➡️ [https://thebcms.com/blog/static-site-generation-vs-server-side-rendering] (https://thebcms.com/blog/static-site-generation-vs-server-side-rendering)
Becoming Frontend Developer in 41 DAYS!
Tags: beginners, programming, frontend
Published: 2023-04-02 16:38:01

Imagine having a superpower that lets you create amazing websites that everyone loves! With this guide, you can do just that! It's like having a secret map that shows you how to become a Junior Developer in just 41 days!

Check the tweet, get your notion template!

[Tweet](https://twitter.com/NotionGags/status/1642528039983521793?s=20
)
How to USE API with Javascript?
Tags: javascript, api
Published: 2023-04-02 16:33:16

## What is API?
API stands for "Application Programming Interface." It is a set of protocols, routines, and tools for building software applications. An API specifies how software components should interact with each other, allowing different software programs to communicate and share data with each other.

APIs are commonly used in web development to allow different applications to interact with each other, such as retrieving data from a database or accessing a third-party service. APIs are also used in software development for creating libraries or frameworks, allowing developers to build on top of existing code and functionality without having to reinvent the wheel.

## How to integrate?

1. Find the API documentation: Before you can integrate an API, you need to find its documentation. The documentation will provide you with the API endpoint URL, the parameters you can pass, and the data format of the response.

2. Make an HTTP request: In JavaScript, you can make HTTP requests using the built-in fetch() method or a third-party library like axios or jQuery. You will need to construct the URL with any necessary parameters, specify the HTTP method (e.g. GET, POST, PUT), and include any necessary headers.

3. Handle the response: Once you send the HTTP request, the API will respond with data in a particular format (e.g. JSON, XML). You will need to parse the response and extract the relevant information for your application.

Here is an example of how to integrate an API in JavaScript using the fetch() method:

```
// API endpoint URL
const apiUrl = 'https://api.example.com/data';

// Construct the URL with query parameters
const queryParams = new URLSearchParams({
  'param1': 'value1',
  'param2': 'value2',
});
const url = `${apiUrl}?${queryParams.toString()}`;

// Make the HTTP request using fetch()
fetch(url)
  .then(response => response.json()) // Parse the response as JSON
  .then(data => {
    // Handle the data
    console.log(data);
  })
  .catch(error => {
    // Handle any errors
    console.error(error);
  });

```
Note that the above example assumes that the API returns data in JSON format. If the API returns data in a different format, you will need to adjust your code accordingly.
Dual Boot Windows 11 - Arch Linux with different drives
Published: 2023-04-02 16:24:24

First you should create the partition in windows

Then, install arch using archinstall script, and select grub bootloader.

Once that is done, if the grub bootloader does not recognize the windows partition you should do this:

## Part 1
Partitions usage:
`df -h`

Install os-probe:
`sudo pacman -S os-prober`

Set GRUB_DISABLE_OS_PROBER=false:
`vim /etc/default/grub`
> uncomment GRUB_DISABLE_OS_PROBER=false


Update GRUB configuration:

`sudo grub-mkconfig -o /boot/grub/grub.cfg`

## Part 2
Install ntfs-3g:
`sudo pacman -S ntfs-3g`


Mount nvme partition:
`sudo mount -t ntfs-3g /dev/nvme0n1p1 /mnt`

Partitions usage:
`df -h`

Update GRUB configuration:
`sudo grub-mkconfig -o /boot/grub/grub.cfg`

## Part 3
Install grub-customizator:
`sudo pacman -S grub-customizer`

Edit names and order of partitions unsing grub-customizer
Build a Responsive Admin Dashboard Using HTML CSS & JS & Bootstrap
Tags: webdev, tutorial, javascript, beginners
Published: 2023-04-02 16:21:56

Every web developer needs to build a Admin Dashboard Application. Learn how to create the best and most modern one simply by watching this course. This Admin Panel includes one Dashboard, Three Pages, Four Apps, and Seven fully functional charts!




🔔 Subscribe for more! 

https://bit.ly/3UbNw7F

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

❤ Get template 

https://www.buymeacoffee.com/webmonster/e/127536

💙 Get template by PayPal 

https://ko-fi.com/s/d373f647c5

🔗 Source code 

➤ https://www.buymeacoffee.com/webmonster/e/127536

➤ https://ko-fi.com/s/d373f647c5

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

🔥 Follow me! 

Facebook https://bit.ly/3IMfk04

Instagram https://bit.ly/3GHoQyT

Twitter https://bit.ly/3IOBEqc

Linkedin https://bit.ly/3INnwNY

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

☕️ Support me 

buymeacoffee.com/webmonster 

💙 Support me by PayPal 

https://ko-fi.com/webmonster01 

👍 Thanks for watching, I appreciate it Made with ❤ by Web Monster 

Tags: #responsivedashboard #dashboard #htmlcssjs #webmonster #html #css #javascript #webdesign #website #react #bootstrap



➤Link of The Video => https://youtu.be/-8I-r6_TSvs


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0jk3nia6o7cgv57lav9g.jpg)
Multiple git accounts in one computer (ssh)
Published: 2023-04-02 16:17:25

First we need to create the ssh keys for each account

`ssh-keygen -t rsa -C "your@email.com"`

```shell
cd .ssh
code .
// copy ssh ky from id_rsa.pub and paste it in a new ssh key in github
```

if error chech https://stackoverflow.com/questions/18683092/how-to-run-ssh-add-on-windows

```shell
ssh-add /ssh/id_rsa
```

if its not working: 

```shell
ssh-agent -s
````

repeat this steps with the other account

Then create a config file, that should look loke this:

---


Host github.com
	HostName github.com
	User git
	IdentityFile ~/.ssh/id_rsa_Account1


Host github2.com
	HostName github.com
	User git
	IdentityFile ~/.ssh/id_rsa_Account2

Match Host github.com exec "git config --get user.name | grep 'name_Account_1' > /dev/null"
	IdentityFile ~/.ssh/id_rsa_Account1

Match Host github.com exec "git config --get user.name | grep 'name_Account_2' > /dev/null"
	IdentityFile ~/.ssh/id_rsa_Account2


---

Then create 2 folders where you will create and work with your git projects

The .gitconfig file should look like this



```shell
[user]
        email = Account1@gmail.com
        name = Account1
[core]
        editor = nvim

[includeif "gitdir:/media/pau/564548676397F900/main/"]
    path = ./path/to/Account1/folder/.gitconfig
[includeif "gitdir:/media/pau/564548676397F900/UPC/"]
    path = /path/to/Account2/folder/.gitconfig

[credential "https://github.com"]
        helper = 
        helper = !/usr/bin/gh auth git-credential
[credential "https://gist.github.com"]
        helper = 
        helper = !/usr/bin/gh auth git-credential


```


Then, in each Account folder, create a .gitconfig, that should look like this:


```shell
[user]
        email = Account1@mail.com
        name = Account1
        signingkey = DEADBEEF

[core]
		sshCommand = "ssh -i ~/.ssh/id_rsa_Account1"
```

make the same for the other folder, and you should have configured well you double git account using ssh







I've made all this using git cmd


some usefull references

https://www.youtube.com/watch?v=2MGGJtTH0bQ
https://gist.github.com/rahularity/86da20fe3858e6b311de068201d279e3
Customisimg windows powershell
Published: 2023-04-02 16:14:19

First, install [Oh-My-Posh ](https://ohmyposh.dev/)

`winget install JanDeDobbeleer.OhMyPosh -s winget`

Create $SPROFILE variable

`New-Item -Path $PROFILE -Type File -Force`

And execute:
`notepad $PROFILE`

Add this in the file

> oh-my-posh init pwsh | Invoke-Expression


Install Nerd Fonts

Install Themes

`Get-PoshThemes`

Change the $PROFILE file content to:


> oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\amro.omp.json" | Invoke-Expression

Install icons:

`Install-Module -Name Terminal-Icons -Repository PSGallery`

add to the $PROFILE file:

> Import-Module -Name Terminal-Icons
Applying OCR in receipt reading to prevent fraud
Published: 2023-04-02 15:50:52

Every day, Riders photograph and submit a large number of bills (or receipts) to store on the system according to our Rider Operations process. Currently, this type of information is processed by OCR. From the uploaded images, OCR helps to identify, annotate the bounding boxes, and extract content.

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

There are many advantages when applying OCR to process bills. On the technical side, OCR helps to systematically store and retrieve data, while from the organizational perspective it also significantly enhances drivers’ compliance with our operating procedure.

So how did we implement OCR? Instead of building a model from scratch, the Data team used PaddleOCR’s algorithms - a toolkit that provides high-quality pretrained models that can be customized easily.

Why use a pretrained model instead of building it from scratch? There are some common challenges in building a model from scratch, such as small dataset, imbalanced dataset, not to mention that it’s not easy to design a model with compatible architecture. Therefore, our Data team used pre-trained models provided by PaddleOCR and then customized it to improve its accuracy, saving costs and time.

The customization of pre-trained models in this use case is called Transfer Learning: applying the knowledge that the model has learned from one field to a new related field. By using Transfer Learning, the Data team has avoided many pitfalls that can occur when training the model in isolation, such as the knowledge that the model has learned is not maintained, accumulated and inherited. Transfer Learning helps the model learn faster, with less training data, higher initial performance (higher start), and higher accuracy.

In this particular problem:
- Extract the strings in the photograph
- Check if the last 4 digits match the code recorded on the system

The team customized PaddleOCR’s pre-trained model with the real dataset to increase its accuracy. When it reached acceptable performance, the refined model was deployed in production.

Just because a model is in production doesn’t mean the job is done. In fact, no model works well forever, despite our careful and frequent data scrubbing. A common cause of model degradation is data drift. This phenomenon occurs when the input data has a change in distribution, reducing the model’s accuracy. Therefore, it is necessary to continuously monitor the model in production to retrain it with new data or check the appropriate logic.