teleren/devto huggingface dataset:
First informations to know about AWS Partitionner
Tags: az, resgions, sharedresponsability, aws
Published: 2023-01-10 10:16:06

Before introducing the first article about basics service of AWS, we define Cloud computing - CC.
CC is on-demand delivery of IT resources over the internet with pay as you go pricing. That's mean that you don't need to manage and maintain your hardware in your own data center.

## AWS Global infrastructure.
The first concept to understand is the **Region**.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/utoqdajnqp602yd0e6db.png)
Region are geographic locations worldwide where AWS hosts its data center. Inside every region in a cluster of availibility zone - AZ. An AZ consist of one or more data center DC, these DC connected using redundant high speed and low latency links.

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

## Region consideration
In general, try to follow these best practices when you choose a region, to help ensure top performance and resilience:

**Compliance:** You might find that your application company or the country that you live in requires you to handle you data in a certain way.
**Latency:** Is about how close your IT resource are to your user base.
**Price:**  Certain regions will cost more than others.
**Service availibility:** Try and think about what are your most needed services.

## Shared responsability model

The AWS shared responsibility model is a concept of dividing responsibilities between AWS and a Customer( you)

- AWS's responsibilities are the security of the cloud.
AWS is responsible for protecting and securing AWS Regions, Availability Zones, and data centers, down to the physical security of the buildings. Managing the hardware, software, and networking components that run AWS services, such as the physical server, host operating systems, virtualization layers, and AWS networking components.

- Customer responsibilities are security in the cloud.
When using any AWS service, you’re responsible for properly configuring the service and your applications, as well as ensuring your data is secure.


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

I hope that you enjoyed this article. The next article will be about IAM.
props-destructuring
Published: 2023-01-10 10:01:59

```
const someObject = {
  name: 'john',
  job: 'developer',
  location: 'florida',
};

console.log(someObject.name);
const { name, job } = someObject;
console.log(job);
```
other ex

```
const Book = (props) => {
  const { img, title, author } = props;
  return (
    <article className='book'>
      <img src={img} alt={title} />
      <h2>{title}</h2>
      <h4>{author} </h4>
    </article>
  );
};
```

```
const Book = ({ img, title, author }) => {
  return (
    <article className='book'>
      <img src={img} alt={title} />
      <h2>{title}</h2>
      <h4>{author} </h4>
    </article>
  );
};
```
Manage Azure App Registrations in VS Code
Tags: azure, vscode, tooling
Published: 2023-01-10 09:59:52

If you work with Microsoft Azure and use Application Registrations to create OAuth2 scopes for your APIs, or maybe create client applications that consume scopes from other applications, then you will no doubt be managing this all in the Azure Portal. That's great, and most of the functionality is there.

If you work with large numbers of applications, or if you automate parts of your works then you might perform these tasks with PowerShell or even by calling the Microsoft Graph API directly to manage these Azure Active Directory objects.

But if you're working in Visual Studio Code building your application, wouldn't it be great to be have all of your Application Registration information and management to hand directly in Visual Studio Code? Well now you can.

As a side project I have built a new extension for Visual Studio Code to allow for the management of Application Registrations from within the IDE.

It allows for easy viewing, copying, adding, and editing of most the core application properties, such as:

- Client Id
- Application ID URI
- Sign In Audience
- Certificates and Secrets
- Redirect URIs
- API Permissions
- Exposed API Permissions
- App Roles
- Owners

It also allows for the simple creation of new applications, quickly viewing of the full application manifest in the editor, and has the ability to open the application registration directly in the Azure Portal when you need full editing control.

![Visual Studio Code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8feq77g4xbqnz2pz7kje.png)

All application properties have their own range of functionality. From the top-level application itself, down to each individual property, functionality can be accessed via a range of context menus.

![Context Menus](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r1w463izk2b5ou3n12br.png)

![Context Menus](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p12vcps30paxtlbab0pu.png)

If required functionality is not currently implemented for a particular property then you can open the application registration in the Azure portal from the context menu of the application itself.

You can install the extension directly from with Visual Studio Code, or you can find out more information about it by visiting the [Visual Studio Code Marketplace](https://marketplace.visualstudio.com/items?itemName=irarainey.applicationregistrations).
Can you create a random graph for me?
Tags: network, graph, datastructure, graphstructure
Published: 2023-01-10 09:54:58

It is pretty straightforward to ask others to generate a random number, right? Ask your friends to create a random number from 1 to 10, and they will generate a random number in the range. 

But the question is, can they create a random graph for you? 

Before jumping into the question, let's think of a scenario. Suppose, you have invited hundreds of your friends, and those friends or colleagues don't know each other earlier. When you announce start of your party, wait, you will see there will have some small clusters forming, and eventually the members will move from one clusters to another, will create a random graph for you. 

In case of above scenario, let's pick up 3 persons, Bob, Rob and Daniel. Let's assume that, Bob and Rob have met earlier. That mentioned about an edge with Bob and Rob. Some moments later, Bob have changed his place and moved to Daniel. On top of that, we assume at the time of the party, Rob and Daniel never met each other. Although they never met each other, there is a subtle path between them. That is the way the random graph is being formed. The following image will show you the scenario how a random graph generates in our real life.


![Source: http://networksciencebook.com](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e39wla4ykp0a0mq6asz7.jpg)

## Definition

We can define random graphs in two ways:

**G(N, L):** N Nodes are being connected with L randomly picked edges. 

**G(N, p):** N nodes are being connected with each other with a probability of p.

The second definition, **G(N, p)** is widely used and we will describe this in the following sections.

## Algorithm

```
def random_graph(N, p):
    graph = initialize an empty graph with isolated N nodes
    node_pairs = N * (N-1) / 2
    for every pair in node_pairs:
        random_probability = random(0,1)
        if random_probability >= p:
           graph.add_edge(pair)
    return graph    
```

## Implementation

you will find the detail implementation [here](https://github.com/AnkurLahiry/RandomGraph).

Some of the graphs of Node 10 with probability 0.3


![Graph 1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/puvinj401jsm943vvvh4.png)
![Graph 2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9b9gi1sb5w1ffpe9peyv.png)
![Graph 3](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x61p9oupx8lxovrjdvvu.png)
![Graph 4](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n96n32ni9qxg2dct6w8s.png)
![Graph 5](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/81x5p0ejai4oh45nk3ug.png)


This is how you can create a random graph.
My Visual JavaScript Array Cheatsheet That Went Viral on Linkedin 🤯🔥
Tags: javascript, webdev, react, html
Published: 2023-01-10 09:54:46

I Created this JavaScript Array Methods Cheatsheet 🤯

![JavaScript Array Visual Cheatsheet](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mfbsdw0p0phf8kl978pv.gif)

Took me almost 2 hrs to create this animated post for you guys and it went viral on Linkedin 🔥

Do Like ❤️ & Share your feedback 🙌

𝗙𝗼𝗹𝗹𝗼𝘄 me on **[Linkedin](https://Linkedin.com/in/rammcodes)** for more:
Tips💡+ Guides📜 + Resources ⚡ related to programming and Web Development 👨‍💻

Feel free to connect with me 👍

Thanks for your support 💯
Building a Mortal Kombat Website
Tags: javascript, react, replit, github
Published: 2023-01-10 09:50:59

In an attempt to put into practice, the react lessons taught by Edwin Maye of the AltSchool Africa, I built a website that gives a brief insight to the Mortal Kombat video game.
This website implements the following react elements:

- React Router

- Nested Routes

- 404 page and 

- Navigation Menu

I began by installing my react app with npx create-react-app AltSchool-react-examination using my git bash in my local machine.

I started by creating the various necessary components needed to setup the website. This is how my home page looks like:


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

This is the code for my homepage on VSCode


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



With a couple of hours spent in youtube and w3school research, I was able to design the home page that way.

## THE ABOUT PAGE


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

This is the code for my About Page from VSCode


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



The entire content of the About page was lifted from https://www.complex.com/pop-culture/mortal-kombat-video-games-ranked/.

Using Nested Routes, I am able to switch between the Home page menu and the About page menu.

## USERS
This was intended to list the users that have accounts in the website.

## Characters

This shows the list of Characters in the Mortal Kombat game.
This was made possible by applying the principles of Pagination.


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

Using Pagination, I am able to toggle between the characters of the video game by clicking the "Next" and "Previous" buttons respectively.


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


This is the code from VSCode


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



## 404 Error Page

In a situation where a wrong URL is initiated or the URL is misspelt, the following error message pops up.


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

## GitHub Repositories

2nd Semester Exam: https://github.com/nnamdikurus/AltSchool-2nd-Semester-Exam


## Live Links
https://assignment-2.nnamdikurus.repl.co/
react day 1 jsx-rules
Published: 2023-01-10 09:49:51

return single element (one parent element)

- semantics section/article
- Fragment - let's us group elements without adding extra nodes 
- camelCase property naming convention

```
<button onClick={myFunction}>click me</button>
```

- className instead of class

```
return <div className='someValue'>hello</div>;
```
------------------------

```
import React from 'react';
import ReactDOM from 'react-dom/client';

function BookList() {
  return (
    <section>
      <Book />
      <Book />
      <Book />
      <Book />
    </section>
  );
}

const Book = () => {
  return (
    <article className='book'>
      <Image />
      <Title />
      <Author />
    </article>
  );
};

const Image = () => (
  <img
    src='https://images-na.ssl-images-amazon.com/images/I/71m+Qtq+HrL._AC_UL900_SR900,600_.jpg'
    alt='Interesting Facts For Curious Minds'
  />
);
const Title = () => {
  return <h2>Interesting Facts For Curious Minds</h2>;
};
const Author = () => <h4>Jordan Moore </h4>;

const root = ReactDOM.createRoot(document.getElementById('root'));

root.render(<BookList />);
```
The Principles I Followed While Building Java Microservice
Tags: java, javamicroservice, programming
Published: 2023-01-10 09:43:59

A Java microservice is a small, independent service that performs a specific function within a more extensive system. The microservice architecture is a way to build highly scalable, resilient, and maintainable software systems. Microservices are typically made using various programming languages, with Java being one of the most popular choices due to its robust ecosystem and wide range of libraries and frameworks.

## Principles of Building Java Microservice

When building a Java microservice, it's essential to keep a few fundamental principles in mind:

**Decentralized governance:** Each microservice should be independently deployable and have its lifecycle. This allows teams to work on different microservices without interfering with one another.

**Single responsibility:** A microservice should have a single, well-defined responsibility. This makes it easy to understand and maintain and helps ensure that changes to one microservice don't inadvertently affect other parts of the system.

**Loosely coupled:** Microservices should communicate with one another over a network rather than being tightly integrated. This allows greater flexibility and makes it easier to scale and evolve the system.

**Automated deployment:** Microservices should be deployed automatically and consistently using tools like Docker and Kubernetes. This helps ensure that deployments are repeatable and reliable.

**Monitoring and logging:** It's essential to keep monitoring and logging in place to monitor the system's health and troubleshoot any issues that arise.

## Frameworks And Libraries Used To Build Java Microservices

Several popular Java frameworks and libraries can be used to build [Java microservices](https://www.bacancytechnology.com/blog/java-microservices). Some of the most popular include 

- Spring Boot 
- Dropwizard
- WildFly Swarm
 
Each framework provides tools and conventions that make it easy to develop and deploy microservices.

For example, Spring Boot is a popular choice for building microservices because it provides a set of conventions and a set of out-of-the-box functionalities for the standard requirements in a microservice. It also provides a lot of integration with other Spring projects and libraries.

## Conclusion

In summary, Java microservices are small, independent services built to be highly scalable, resilient, and maintainable. When you [hire Java developers](https://www.bacancytechnology.com/hire-java-developers) to build Java microservices, it's essential to keep in mind principles such as decentralized governance, single responsibility, loose coupling, automated deployment, and monitoring and logging.
react day 1
Tags: webdev
Published: 2023-01-10 09:36:39

```
function Greeting() {
  return <h2>My First Component</h2>;
}

// arrow function also works
const Greeting = () => {
  return <h2>My First Component</h2>;
};
```
starts with capital letter
must return JSX (html)
always close tag



-------------------------------------------
Gantt chart and histogram d3js
Tags: d3js, react, javascript, typescript
Published: 2023-01-10 09:32:39

Hello every body!.
I have an issue with building this chart by D3js
Could you show me how to build this chart or help me with some key word
This chart is so strange
I hope you guy can help me, thank you so much
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tcizwuz7u20hmncp8fhr.png)
Logical Operator
Published: 2023-01-10 09:16:14

> Bir yoki bir necha shartlarni solishtirish va ularni to'g'ri yoki noto'ri ekanligini aniqlash.

- ! - YO'Q.

- && - VA.

- || - YOKI.

- Natija har doim True yoki False. 

- True 1,False 0 qaytardi.

- 0 dan boshqa har qanday qiymat True yani Rost deb hisoblanaldi.

```cpp
#include <iostream>
using namespace std;
int main() {
  int  a = 7;
  int  b = 3 + a;
  int  c = a && b ;

  cout << c;
return 0;
  }
```

```cpp
#include <iostream>
using namespace std;
int main() {
  int  a =27;
  int  b = 67 + a;
  int  c = ++a < 5 || --b < 3 ;

  cout << c;
return 0;
  }
```
@dawroun
How to secure an AWS account
Tags: aws, iam
Published: 2023-01-10 09:15:02

In this article will describe about how to secure an AWS account .

We should enable multifactor authentication (MFA) for the root user in AWS account .It is important because the root user can perform sensitive operations in your account, so you need to add an additional layer of authentication.
 It is never a good idea to share root credentials with anyone. Implement IAM for each individual user.4. Make sure the root account hardware MFA device is kept in a secure location. Assign permissions to IAM users using groups. Enable multi-factor authentication for privileged users. Use IAM roles to grant access across accounts. Whenever possible, assign permissions based on AWS policies. Access levels are useful for reviewing IAM 
permissions.Remove the root credentials. Rotate credentials regularly .Use IAM roles to delegate access to AWS resources.

Audit IAM users and its polices frequently .Need to ensure that IAM users have most restrictive policies and least privileges assigned .Create a billing alarm to reveal your envisioned AWS fees to obtain computerized notifications whilst your invoice exceeds thresholds you define.
Create a path on your AWS account to song what credentials are used to provoke unique API calls and whilst they`re used. 

Activate resource-degree logging (for example, at the example or OS degree) and Amazon S3 default bucket encryption.
Activate Amazon GuardDuty on your AWS account in all supported Regions.
Device Recognition API
Tags: api, devops
Published: 2023-01-10 08:58:02

We are excited to have launched a space for developers - [the Developer Portal](https://dev.embedtech.lansweeper.com/?utm_source=Dev.to&utm_medium=Referral&utm_campaign=2023_EmbeddedTechnologies_API_January2023). It provides developers with everything they need for easy building with our embedded technologies such as [Device Recognition](https://embedtech.lansweeper.com/products/device-recognition/?utm_source=Dev.to&utm_medium=Referral&utm_campaign=2023_EmbeddedTechnologies_API_January2023).

Our Developer Portal in a nutshell:

- API/SDK documentation immediately accessible for easy reference and deep linking for pinpoint accuracy and support
- Quick access to libraries and downloadable documentation
- All of our documentation across all of our products is in a centralized location and continuously updated so that the latest is always available
- Ability to “try it” for different API parameters
 
[EXPLORE DEVELOPER PORTAL & TRY OUR API FOR FREE](https://dev.embedtech.lansweeper.com/?utm_source=Dev.to&utm_medium=Referral&utm_campaign=2023_EmbeddedTechnologies_API_January2023)
Jest ESM — Total Guide To More Than 100% Faster Testing For Angular⚡
Tags: jest, testing, node, angular
Published: 2023-01-10 12:22:04

---
title: Jest ESM — Total Guide To More Than 100% Faster Testing For Angular⚡
published: true
date: 2023-01-10 08:55:49 UTC
tags: jest,testing,nodejs,angular
canonical_url: https://angularexperts.io/blog/total-guide-to-jest-esm-and-angular
---

[![](https://cdn-images-1.medium.com/max/2600/1*XpWTyCDdB82ygtIQCmyssw.jpeg)](https://tomastrajan.medium.com/jest-esm-total-guide-to-more-than-100-faster-testing-for-angular-56f80890535b?source=rss-360cd444e1fc------2)

Let's learn how to speed up our Angular Jest tests by more than 100% by switching to Jest ESM (a notoriously problematic migration) and how to solve all the troublesome issues that tend to pop up along the way!

## TLDR;
* Jest is fast until it isn't therefore we have to bother with ESM
* Basic Jest ESM setup is pretty straight forward
* There is an ideal Jest ESM scenario where it would just work if libraries implemented ESM correctly
* In real life Jest ESM breaks because most libs ship incorrect ESM
* The moduleNameMapper and transformIgnorePatterns are the main tools that will help is to fix all the Jest ESM problems
*  We're going to progress through list of common problems and their solutions (please share yours to make it more complete in the comments)

[Continue reading on AngularExperts.io »](https://angularexperts.io/blog/total-guide-to-jest-esm-and-angular)
Every Day Docker Commands You Need To Learn
Tags: docker, devops, codenewbie, microservices
Published: 2023-01-10 08:43:35

## Interacting with containers

How to list all your running containers

```
docker ps
```

How to list all running and stopped containers

```
docker ps -a
```

How to run a command inside a container

```
docker exec CONTAINER_NAME_OR_ID command
```

> Cool tip: You can use the first 4 characters of the container id instead of the full name or full id. It works with all commands 😎

How to access a Linux container

```
docker exec -it CONTAINER_NAME_OR_ID bash

# in case of no bash, like alpine versions for ex., you can try
docker exec -it CONTAINER_NAME_OR_ID sh
```

How to display logs live

```
docker logs -f CONTAINER_NAME_OR_ID
```

How to launch and run a container

```
docker run CONTAINER_NAME:TAG

# use -d and will be launched in the background
docker run -d nginx:latest
```

How to stop a container

```
docker stop CONTAINER_NAME_OR_ID
```

How to restart a container

```
docker restart CONTAINER_NAME_OR_ID
```


## Managament Commands

How to list all images

```
docker image ls
```

How to delete an image

```
docker rmi IMAGE_NAME:TAG

# or
docker image rm IMAGE_NAME:TAG
```

How to delete all images

```
docker rmi -f $(docker images -qa)
```

How to remove all stopped containers (-f to force it)

```
docker container prune -f
```

How to remove all unused local volumes (-f to force it)

```
docker volume prune -f
```

How to remove all unused networks (-f to force it)

```
docker network prune -f
```

How to remove unused images (-f to force it)

```
docker image prune -f
```

How to stop all containers (-f to force it)

```
docker stop -f $(docker ps -qa)
```

How to delete all running and stopped containers (-f to force it)

```
docker rm -f $(docker ps -qa)
```

Clean up your environment by running multiple commands

```
docker stop -f $(docker ps -qa) && docker container prune -f && docker volume prune -f && docker image prune -f && docker network prune -f
```

## Extras

How to build a docker image

```
docker build -t IMAGE_NAME:TAG location/to/Dockerfile

# Ex.: Running the command inside the of directory the Dockerfile
docker build -t mydockerimg:3.11 .
```

How to display all containers stats (% CPU, Mem, I/O, PIDS..)

```
docker stats
```

*Image credit: [https://www.pexels.com/@dana-tentis-118658/](https://www.pexels.com/@dana-tentis-118658/)*