teleren/devto huggingface dataset:
Understanding Identity Access Management (An analogy)
Tags: beginners, webdev, cloud, programming
Published: 2023-03-11 20:43:37

---
title: Understanding Identity Access Management (An analogy)
published: true
description: A Foundational building block in any cloud infrastructure
tags: beginners, webdev, cloud, programming
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-03-11 20:38 +0000
---


![Image Identity Access Management, a foundational building block](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/utck1ooej4racdahn6r8.png)

What is this IAM thing ?

and… why do I need to know about it ?

**It’s a must know! It’s a major key when working in the cloud 🔑**

Here is a good way to think about it.

Imagine you are going to a conference, and within the venues there are security personnel in different areas checking people’s passes.

**The passes may have the following groups:**

**Staff** - The people working there (Organizers, equipment, catering etc)

**Speakers** - The people speaking at the conference

**General** - The general admission for the attendees

Each of these groups will be allowed to enter with their pass, and have access to different parts of the venue.

Identity Access Management (IAM) works in a very similar fashion.

It identifies who is trying to access what then grants access if they have the appropriate permissions.

The only difference is that IAM is controlling the access to cloud resources.

These resources may include things like storage, network, compute services and much more in any of the cloud vendors.

All of which are very common building blocks for most cloud infrastructures.

Since all these services rely on IAM, I consider it a foundational piece.

Just like with our example of the conference, IAM is the security personnel.

It determines who can access what based on a defined policy or a configuration.

Before we part, let’s do a review!

### 💡 Review

► IAM is the security personnel within the cloud, it controls who and what for access control in all of the services (The technical term for this is Authentication & Authorization)

► IAM is the building block in which all others services build on top of

► IAM is one of the core pieces for security in the cloud

And… That’s all.

If you are in the process of learning about the cloud, I highly encourage you to start with IAM.

Like I said, it’s such a foundational piece; and once you learn it, it’ll make learning other services that much easier.

Do you agree ? or should someone learn something else to start ?

Let me know in the comments 👇
So,
Tags: startingoff, webdev
Published: 2023-03-11 20:36:22

I started learning how to "code" or simply wrote my first real code about 2 years ago. Although now I feel I know less than when I started cause coding is just like the universe. I has no end, right? Anyway, but I learned a thing or two I'd like to share.
Really try to enjoy the process. Embrace it. Think of it as a startup you're building totally from zero "scratch". You can grow it your way. And remember that moment when you'll just see the result and say: Wow. Can't imagine I actually built this!
Obviously you are gonna run into some bugs and problems from here and there. Sometimes it'll get to a point where you totally believe that there's no way it doesn’t work as it should. Well, I know it’s NOT easy to handle. But, just know in your mind that this process however long it takes is in your favour. You will in fact learn more from your mistakes "bugs" than any successful project you will ever build. That's the beauty of it, isn’t it?
At the end, nothing is easy. 0s and 1s had no meaning before we gave 'em a meaning and frankly a value in our lives. So, the more you love, the more you thrive, the more you'll LEARN.
Mastering Eager Loading and Beyond! Rails 7
Tags: ruby, rails, beginners, webdev
Published: 2023-03-11 20:26:04

If you're building a web application using Ruby on Rails, you might find that your queries are becoming slow as the size of your database grows. One way to improve performance is to use eager loading, which allows you to load associated records upfront instead of making separate queries for each record.

## Table of contents

1. [Eager Loading](#eager)
2. [Lazy Loading](#lazy)
3. [Preloading](#preloading)
4. [Include vs Joins](#include-vs-joins)

<h2 id="eager">Eager Loading</h2>

Eager loading is a technique that allows you to load associated records in a single query instead of querying the database multiple times. This can significantly improve the performance of your application by reducing the number of database calls.

For example, let's say you have a User model that `has_many` posts. If you were to retrieve all the users and their associated posts, you could use eager loading like this:

```
@users = User.includes(:posts)
```

This will retrieve all the users and their associated posts in a single query, rather than making a separate query for each user's posts.

**Other Types of Loading**

In addition to eager loading, Rails also provides other types of loading that you can use to optimize your queries:

<h2 id="lazy">Lazy Loading</h2>

Lazy loading is the opposite of eager loading. Instead of loading associated records upfront, lazy loading loads them when they are needed. This can be useful when you have a large number of associations and don't want to load them all at once.

```
@user = User.find(1)
@posts = @user.posts # Posts are loaded when called
```

<h2 id="preloading">Preloading</h2>

Preloading is similar to eager loading, but instead of joining the associated records in a single query, it makes a separate query for each association. This can be useful when you need to modify the association's query, or when the associated records are not needed in every query.

```
@users = User.preload(:posts)
```

<h2 id="include-vs-joins">Include vs Joins</h2>

Both includes and joins can be used for eager loading, but they behave differently, `.includes` will load the associated records using separate queries, while joins will join the associated records into a single query.

```
# Includes
@users = User.includes(:posts)

# Joins
@users = User.joins(:posts)
```

Use includes when you don't need the associated records in every query, and joins when you do.

### Conclusion

Optimizing database queries is an important part of building high-performance web applications. Eager loading, lazy loading, preloading, and other types of loading can help you achieve this goal. By understanding these techniques and when to use them, you can improve the performance of your Ruby on Rails application.
What to Do If You've Been Scammed!
Tags: cybersecurity, productivity, security, protectionfromscammers
Published: 2023-03-11 19:55:38

It might be frustrating and stressful if you have been scammed by a firm that has now disappeared and left no evidence behind. You can still try to get your money back by taking a few steps, though. Here are some options for you:

![how to protect yourself from scammers](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q935xqv1e7q91g6m1al4.jpg)

- Speak with your bank or credit card provider: Contact them and report the fraudulent transaction if you used your bank or credit card to make the purchase. They can file a chargeback on your behalf or reverse the payment.

- Complain to the authorities: You should complain to the Federal Trade Commission (FTC) or the consumer protection organization in your area. This will help spread awareness of the fraud and possibly prevent others from falling for it.

- Research the business: Even if it is no longer around, you should still try to discover everything possible. Check their website on the Wayback Machine, look for any online reviews, and see if there are any news stories regarding the business. When making a complaint or attempting to find the culprit, this information may be useful.

- Get legal counsel: If you have suffered a large financial loss, it might be worthwhile to do so. A lawyer may be able to help you recover your funds through legal action.

Be cautious in the future: Please be careful because scams are sadly all too widespread and you should always be on the lookout for them when shopping online. Always do your research on a business before entrusting them with your money, and be skeptical of any offers or discounts that seem too good to be true.

In conclusion, there are still procedures you may take to attempt and get your money back if you were defrauded by a business. It's important to note that recovering your money in these situations can be difficult, and there is no guarantee of success. However, taking these steps can help increase your chances of getting your money back. I sincerely hope that this post has been useful in advising you on how to respond to such a situation. Please think about giving this material a like or forwarding it to a friend if you found it beneficial. I appreciate your reading.
Google I/O 2023 announced !
Tags: news, google, googlecloud, webdev
Published: 2023-03-11 19:00:11

Like the last year, let's discuss together what could be announced. Are you going to participate?

> Starting the **May 10 2023**.

[Website ✨](https://io.google/2023) 

{% embed https://twitter.com/sundarpichai/status/1633232047170007041 %}

___

You can see the recap of Google I/O 2022 in this video.

{% embed https://youtu.be/CWTm0ccfZe4 %}
AWS: Route Table Association & Security Group
Tags: aws, webdev, cloud, devops
Published: 2023-03-11 18:31:42

##AWS ROUTE TABLE ASSOCIATION 

AWS Route Table Association is the process of connecting a subnet in a Virtual Private Cloud (VPC) to a route table. A route table contains a set of rules called routes that are used to determine where network traffic is directed. When a subnet is associated with a route table, the routes in that table determine where the traffic to and from the subnet is routed.

```
/* AWS ROUTE TABLE ASSOCIATION */
resource "aws_route_table_association" "main_assoc" {
  subnet_id      = aws_subnet.main_publlc_subnet.id
  route_table_id = aws_route_table.main_route_table.id
}
```
Once a subnet is associated with a route table, the routes in that table determine where traffic is directed to and from the subnet. You can associate a subnet with only one route table at a time, and a route table can be associated with multiple subnets.


##AWS SECURITY GROUP

An AWS Security Group acts as a virtual firewall that controls inbound and outbound traffic for one or more Amazon Elastic Compute Cloud (EC2) instances. It acts as a filter that allows certain traffic to enter or leave the EC2 instances while blocking all other traffic.

Each security group has a set of inbound and outbound rules that define the type of traffic that is allowed to enter or leave the associated EC2 instances. You can configure the rules to allow traffic based on the protocol, port number, and IP address range.

```
resource "aws_security_group" "main_security" {
  name        = "main_security"
  description = "Allow Main inbound Traffic"
  vpc_id      = aws_vpc.main_vpc.id

  ingress {
    from_port   = 0
    to_port     = 0
    protocol    = "-1"
    cidr_blocks = ["0.0.0.0/0"]
  }
  egress {
    from_port   = 0
    to_port     = 0
    protocol    = "-1"
    cidr_blocks = ["0.0.0.0/0"]
  }
}
```
The `ingress` block is used to define the inbound rules while the `egress` block is used to define the outbound rules. This is not a secure configuration and should not be used in a production environment. In production, it is important to limit the traffic allowed by a security group to only the necessary protocols, ports, and IP addresses.
Daily UX Writing Challenge Day 8 + 9
Tags: beginners, ux, uxwriting
Published: 2023-03-11 18:26:36

[Day 1](https://dev.to/fuwa/daily-ux-writing-challenge-day-1-50la) | [Day 2](https://dev.to/fuwa/daily-ux-writing-challenge-day-2-4d6p) | [Day 3](https://dev.to/fuwa/daily-ux-writing-challenge-day-3-3cog) | [Day 4](https://dev.to/fuwa/daily-ux-writing-challenge-day-4-5cg8) | [Day 5](https://dev.to/fuwa/daily-ux-writing-challenge-day-5-2hac) | [Day 6 + 7](https://dev.to/fuwa/daily-ux-writing-challenge-day-6-7-1730)

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

One of those messages where I made sure it contains all the information the user would be interested in and then give them an option to choose what to do. In reality the 2 links will go to the same page...but just different parts of the page. 


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

I kept this one short and direct, but feel it might be lacking a little in empathy.
Google Keep – Recipe Organizer
Tags: life, travel, google, googleassistant
Published: 2023-03-21 18:33:58

---
title: Google Keep – Recipe Organizer
published: true
date: 2023-03-11 18:11:26 UTC
tags: life,travel,Google,googleassistant
canonical_url: https://greenido.wordpress.com/2023/03/11/google-keep-recipe-organizer/
---

Google Keep is a great tool for organizing your recipes. It’s free, easy to use, and available on both desktop and mobile devices. With Google Keep, you can store all of your recipes in one place and easily access them whenever you need them. You can create separate notes for each recipe, and add **tags** (=label in Keep terminology) to them to make them easier to find. You can also add images and notes to each recipe to help you remember how to make them. And if you want to share a recipe with someone, you can easily do that too.

Google Keep also makes it easy to search for recipes. You can search for recipes by name, ingredients, or tags.   
This makes it easy to find the recipe you’re looking for quickly and easily.

Google Keep also allows you to share recipes with others. You can share recipes with friends, family, or even with the public. This makes it easy to share your favorite recipes with others, and get feedback on them.

## Steps

To use Google Keep as a recipe organizer, you can follow these steps:

1. Open Google Keep in your web browser or on your smartphone.
2. Click the plus sign (+) in the bottom right corner to create a new note.
3. Type the name of the recipe in the title field.
4. In the body of the note, type the ingredients and instructions for the recipe. You can also use bullet points to make the list easier to read.
5. If you have a photo of the recipe, you can attach it to the note by clicking the camera icon in the bottom left corner.
6. You can organize your recipes by creating labels for them. To create a **label** , click the three dots in the top right corner of the note and select “Label.” Then, choose a label from the list or create a new one.
7. To search for a specific recipe, click the search icon in the top right corner and type in a keyword or label.

Enjoy your next meal ![🥂](https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/72x72/1f942.png)
PHP WebP Thumbnailer
Tags: webdev, php, webp
Published: 2023-03-11 17:51:18


![PHP thumbnailer with WebP support](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r0bwarujj2k8ofsb1j9m.png)

**WebpThumbnailer** is a thumbnail helper which allows you to generate and cache image thumbnails in your PHP application on the fly.

## Installation


```
php composer.phar require "maximal/php-webp-thumbnailer" "*"
```

## Checking the environment

You will need WebP coder (cwebp command) installed in your system.

For instance in Ubuntu/Debian it is included in webp package:

`sudo apt install webp`

Check the command:
`cwebp -version`

You should get an output with version number (like 0.6.1).

If you have installed cwebp to a different command or path, configure the static property 

```
WebpThumbnailer::$cwebpCommand 
```
before using the helper (see the example below).

More info about WebP: https://developers.google.com/speed/webp/

## Generating thumbnails

Use this thumbnailer in your PHP application:

`use maximal\thumbnail\WebpThumbnailer;

echo WebpThumbnailer::picture('/path/to/img/image.png', $width, $height);`

More options (outbound instead of default inset; alt and class attribute added):

`use maximal\thumbnail\WebpThumbnailer;`

```
echo WebpThumbnailer::picture(
	'/path/to/img/image.png',
	$width,
	$height,
	false,
	['alt' => 'Alt attribute', 'class' => 'img-responsive']
);
```

Custom **cwebp** command:


`use maximal\thumbnail\WebpThumbnailer;`

```
WebpThumbnailer::$cwebpCommand = '/usr/local/bin/cwebp';
echo WebpThumbnailer::picture('/path/to/img/image.jpg', $width, $height);
```

The helper’s **picture()** method uses modern <picture> HTML tag as follows:

`<picture data-cache="hit|new">
	<source srcset="/assets/thumbnails/...image.png.webp" type="image/webp" />
	<img src="/assets/thumbnails/...image.png" other-attributes="" />
</picture>`

Here you have image/webp source for browsers which support WebP images and traditional (PNG, JPEG, TIFF, GIF) image fallback.

Useful for photo articles: https://www.delgarm.com/


**Author**

Websites: https://maximals.ru and https://sijeko.ru
github: https://github.com/hsa599
PostgreSQL parameter log_min_duration_statement
Tags: postgres, sql, database, devops
Published: 2023-03-11 17:31:46

The `log_min_duration_statement` is configuration parameter of PostgreSQL.

It sets the minimum execution time in milliseconds (ms) above which all statements will be logged.

The default value for the `log_min_duration_statement` parameter is -1, which disables logging statements.

Setting the PostgreSQL parameter `log_min_duration_statement` to 0 will prints all statements durations.

Note. Setting this parameter on Production environments can lead to high volume of logs and significant disk storage allocation.

Usage Examples.

Assume I have created table abc:

```
postgres=# \d abc
                Table "public.abc"
 Column |  Type  | Collation | Nullable | Default
--------+--------+-----------+----------+---------
 a      | bigint |           |          |

postgres=#
```

and populated it with data:

```
postgres=# insert into abc SELECT * FROM generate_series(1,10000000);
INSERT 0 10000000
```

`#1 Example. How to log all the queries that take more than 1ms?`

```
postgres=# set log_min_duration_statement=1;
SET
postgres=# show log_min_duration_statement;
 log_min_duration_statement
----------------------------
 1ms
(1 row)

postgres=# insert into abc values(1);
INSERT 0 1
postgres=# insert into abc values(2);
INSERT 0 1
postgres=# insert into abc values(3);
INSERT 0 1
postgres=# select count(1) from abc;
  count
----------
 10000003
(1 row)

postgres=#
```

PostgreSQL log file (fragment):

```
...
2023-03-11 17:20:27.262 UTC [119] LOG:  duration: 5.477 ms  statement: insert into abc values(1);
2023-03-11 17:20:29.281 UTC [119] LOG:  duration: 8.656 ms  statement: insert into abc values(2);
2023-03-11 17:20:34.151 UTC [119] LOG:  duration: 7.263 ms  statement: insert into abc values(3);
2023-03-11 17:20:40.473 UTC [119] LOG:  duration: 336.449 ms  statement: select count(1) from abc;
...
```

`#2 Example. How to disable logging statements?`

```
postgres=# set log_min_duration_statement=-1;
SET
postgres=# show log_min_duration_statement;
 log_min_duration_statement
----------------------------
 -1
(1 row)

postgres=# select count(1) from abc;
  count
----------
 10000003
(1 row)

postgres=# insert into abc values(2);
INSERT 0 1
postgres=#
```

PostgreSQL log file (fragment):

There is no information about the queries.

`#3 Example. How to log all the queries that take more than 100ms?`

```
postgres=# set log_min_duration_statement=100;
SET
postgres=# show log_min_duration_statement;
 log_min_duration_statement
----------------------------
 100ms
(1 row)

postgres=# select count(1) from abc;
  count
----------
 10000006
(1 row)

postgres=# insert into abc values(5);
INSERT 0 1

postgres=# select count(1) from abc where a > 10234;
  count
---------
 9989768
(1 row)

postgres=# insert into abc values(2);
INSERT 0 1
```

PostgreSQL log file (fragment):

```
...
2023-03-11 17:18:50.287 UTC [119] LOG:  duration: 301.261 ms  statement: select count(1) from abc;
2023-03-11 17:18:54.134 UTC [119] LOG:  duration: 388.595 ms  statement: select count(1) from abc where a > 10234;
...
```
The Process.WaitForExit() method has been unavailable for the last decade.
Tags: dotnet, csharp, programming
Published: 2023-03-11 17:29:49

The Process.WaitForExit() method is a commonly used method in .NET. It waits until a process has finished executing. However, in the last decade or so, this method has been reported to be unavailable and throwing the error "System.ComponentModel.Win32Exception: 'Access is denied.'" in some cases.

This is due to changes in the security model of Windows. All the way back to Windows Vista, User Account Control (UAC) was introduced, which restricted certain privileges to only administrators or applications that were run as an administrator. This included the ability to wait for a process to exit.

An attempt was made to fix this is, there was a new method called Process.Exited event. This event is raised when the process has exited. The Exited event also has most of the features as the Process.WaitForExit() method has.

{% embed https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.process.waitforexit?view=net-8.0 %}
Why useEffect stop working after 5 button click ?
Published: 2023-03-11 17:19:15

I have a project with ReactJS - MySQL - NodeJS. 

I fetch a list of posts from database with Axios.

When I want to add a like to a post, I update the post with axios.put and I set a variable "updated" to true. 

Every time the variable "updated" change, it triggers useEffect to fetch again all posts.

But after 5 click (5 updates), it stop to update and the list is no more fetched. There is no errors on the console.

Thank you very much
Development environment for the Python requests package
Tags: python, programming, github, osdc
Published: 2023-03-11 17:14:10

---
title: Development environment for the Python requests package
published: true
description: Setting up the development environment and running the tests is the first step you need to do before contributing to an open source project.
tags: python, programming, github, osdc
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-03-11 10:08 +0000
canonical_url: https://code-maven.com/development-environment-for-python-requests
---

To make it easier to start to contribute to an open source project, one needs to know how to set up a development environment locally and how to run the tests of the project locally.

As I did not find this information for the [requests](https://requests.readthedocs.io/) Python library I am now trying to describe it myself.

## Clone the repository

This part can be found in the README of the [GitHub repository](https://github.com/psf/requests).

You need to have Python installed and some libraries. You can run it natively on your operating system in a virtual environment or you can run it in a Docker container.

## Start Docker

```
docker run -it --rm --workdir /opt -v$(pwd):/opt python:3.11 bash
```

```
make init
```

That basically runs

```
pip install -r requirements-dev.txt
```

To run the tests you could type

```
make test
```

but it needs <a href="">tox</a> so first you'll have to run

```
pip install tox
```

then you can run

```
make test
```

That will actually run

```
tox -p
```

I also like to be able to run the tests and generate code-coverage report and run the tests in random order.

```
pip install pytest-random-order pytest-coverage

pytest -svv --random-order --cov-config .coveragerc --cov=requests --cov-report html --cov-report term --cov-branch
```

## Virtualenv

```
virtualenv -p python3 venv
. venv/bin/activate
```


```
pip install pytest-coverage
pytest --cov-config .coveragerc --verbose --cov-report term --cov-report xml --cov-report html --cov=requests --cov-branch tests
```

## Adding this to the project

Ideally this and more information about contribution would be included either in the README file or in the CONTRIBUTIONS file of the project. So I opened an [issue](https://github.com/psf/requests/issues/6378) asking if they would be interested in it.