teleren/devto huggingface dataset:
Change The Configuration On The Go With LambdaTest’s New Switch Feature
Tags: testing, softwareengineering, automation, testers
Published: 2023-09-21 14:30:01

We believe that innovation is a never ending process so we, at LambdaTest are continuously innovating to ease the life of our users. In response to the feedback of one of our users, Eva Tallaksen we have introduced a new feature, Switch.

With the all new ‘Switch’ feature you can change the configuration on which you want to test your web application or website for cross browser compatibility in real time testing with just one click. With this update, now you don’t need to fire up virtual machines again and again by ending sessions. All you need to do is to click on switch and then select the next configuration on which you want to test and within seconds you’ll be testing on the next configuration.

## Get Started

The new switch feature can be found inside the VM on the left utility toolbar. When you’ll click on info icon, the second icon from up, you’ll find info on the current configuration along with the switch button.

![](https://cdn-images-1.medium.com/max/2000/0*JiA7Z8mOG-bBhMeB.jpg)

When you’ll click on it, you’ll see this popup where you can select the next configuration.

![](https://cdn-images-1.medium.com/max/2674/0*eI48CriMsZ2Bg5AN.png)

Here, you can enter the URL and select the configuration. And test for the next configuration.

![](https://cdn-images-1.medium.com/max/2534/0*8Hh2r9e7g7EKakBS.png)

So, don’t you feel that your testing has become easier now?

Go ahead and try this new feature now!

Happy Testing!
Managing JSON Configuration Files in Angular
Tags: angular, typescript, configuration, webdev
Published: 2023-09-21 14:00:24

---
title: Managing JSON Configuration Files in Angular
published: true
description: Learn how to manage JSON configuration files in Angular applications. This guide covers creating a JSON file, mapping it to a TypeScript object, and utilizing it in Angular services
tags: angular, typescript, configuration, webdev
# cover_image: https://kinsta.com/wp-content/uploads/2022/06/angular-logo.png
# Use a ratio of 100:42 for best results.
# published_at: 2023-09-21 13:37 +0000
---
####Introduction
Managing configurations in any application is crucial for its scalability and maintainability. In Angular applications, one common approach is to use a JSON file to hold configuration settings. This article will guide you through the process of creating, reading, and utilizing a JSON configuration file in Angular.

####Prerequisites
* Basic understanding of Angular and TypeScript.
* Node.js and Angular CLI installed.

####Creating a JSON Configuration File
First, let's create a config.json file in the assets folder of your Angular project.
```json
{
  "apiBaseUrl": "https://example.com/api/"
}
```

####Mapping JSON File to TypeScript Object
To map this JSON file to a TypeScript object, we'll create an interface named Configuration.
```typescript
export interface Configuration {
  apiBaseUrl: string;
}
```

####Reading the Configuration File in Angular
We'll use Angular's HttpClient to read the JSON file and store it in a configuration object. In your AppModule, add the following code:
```typescript
import { InjectionToken } from '@angular/core';

export const configurationToken = new InjectionToken('Configuration');

// In your providers array
{
  provide: configurationToken,
  useValue: settings // Assume settings is the object read from config.json
}
```

####Utilizing Configuration in Services
To use this configuration in other Angular services, you can inject it into the service constructor.
```typescript
import { Inject } from '@angular/core';

constructor(@Inject(configurationToken) private configuration: Configuration) {
  console.log(this.configuration.apiBaseUrl); // Outputs: https://example.com/api/
}
```

####Conclusion
By following these steps, you can easily manage configurations in your Angular application, making it more maintainable and scalable.

####References
[Angular Documentation](https://angular.io/docs)
Sloan's Inbox: Striving to be a T-shaped developer... how to find my specialization?
Tags: discuss
Published: 2023-09-21 14:00:00

Hello! Sloan, DEV Moderator and resident mascot, back with another question submitted by a DEV community member. 🦥

For those unfamiliar with the series, this is another installment of Sloan's Inbox. You all send in your questions, I ask them on your behalf anonymously, and the community chimes in to offer advice. Whether it's career development, office politics, industry trends, or improving technical skills, we cover all sorts of topics here. If you want to send in a question or talking point to be shared anonymously via Sloan, that'd be great; just scroll down to the bottom of the post for details on how.

So, let's get down to business...

### Today's question is:

> I've been honing my skills as a software dev, but still consider myself a beginner. I've heard folks talking about T-shaped developers and it seems like it's a common goal to specialize in a specific area, but then also nurture a wide range of basic skills that aren't necessarily tied to tech. I feel like I'm getting to the point where I need to specialize, but I'm not really sure which area to move into. How do you go about discovering your specialization? Any tips or things to consider when looking to specialize in something?
>

Share your thoughts and lets help a fellow DEV member out! Remember to keep kind and stay classy. 💚

---

*Want to submit a question for discussion or ask for advice? [Visit Sloan's Inbox](https://docs.google.com/forms/d/e/1FAIpQLSc6wgzJ1hh2OR4WsWlJN9WHUJ8jV4dFkRDF2TUP32urHSAsQg/viewform)! You can choose to remain anonymous.*
To stop a Docker container and then remove both the container and the associated image:
Tags: docker, aws, devops, linux
Published: 2023-09-21 13:43:34

To stop a Docker container and then remove both the container and the associated image, you can use the following commands:

1. First, find the container ID or name of the container you want to stop and remove. You can use the `docker ps` command to list all running containers:

   ```bash
   docker ps
   ```

   This command will display a list of running containers along with their details.

2. Once you identify the container you want to stop and remove, you can use the `docker stop` command to stop it:

   ```bash
   docker stop CONTAINER_ID
   ```

   Replace `CONTAINER_ID` with the actual ID or name of the container you want to stop.

3. After stopping the container, you can remove it and its associated image using the `docker rm` and `docker rmi` commands. First, remove the container:

   ```bash
   docker rm CONTAINER_ID
   ```

4. Finally, remove the Docker image associated with the container:

   ```bash
   docker rmi IMAGE_NAME:TAG
   ```

   Replace `IMAGE_NAME:TAG` with the name and tag of the image you want to remove. You can find the image name and tag in the output of the `docker images` command.

If you want to remove all containers and their associated images, you can use the following commands:

1. Stop all running containers:

   ```bash
   docker stop $(docker ps -q)
   ```

2. Remove all stopped containers:

   ```bash
   docker rm $(docker ps -a -q)
   ```

3. Remove all unused images (images not associated with any containers):

   ```bash
   docker image prune -a
   ```

   This command will remove all images that are not associated with a container, which can help you clean up your system.

Be cautious when using the `docker rmi` and `docker rm` commands, especially when removing images and containers, as this action is irreversible, and you may lose data if you delete containers without proper backups or data management.


Author:
Muthu Kumar K
#10 Introduction to Views & View groups |Android Studio Tutorial| #softwaretechit
Tags: android, programming, java, beginners
Published: 2023-09-21 13:41:00

{% embed https://www.youtube.com/watch?v=Y7RBkcY2Rao&list=PLmwJLue37PZfiGUAwQ6uhh5bbYkeFUOpj&index=10&ab_channel=SoftwareTechIT %}


Subscribe Channel SoftwareTechIT 
And Visit:- https://SoftwareTechIT.com
More Here:- https://home.softwaretechit.com
Buy Anything From Here :-https://shop.softwaretechit.com

{% embed https://softwaretechit.com/introduction-to-views-view-groups-android-studio-tutorial-softwaretechit/ %}

Questions:- 
What is views and view groups in android ?
Why We Use views and view groups in android studio?
How to Create views in android?
How to Create view groups in android ?
How We Create Android views and view groups?
What is android views and view groups?
What does android views and viewgroups use?
What is An views and viewgroups?
How to Code views and viewgroup?
how does android views and viewgroups work ?

Download Our App:- https://play.google.com/store/apps/details?id=com.softwaretechit
Read More Here :- https://softwaretechit.com/top-10-quetions-on-ai-and-chatgpt-ai-tool-can-ai-is-new-future-of-world/
https://softwaretechit.com/what-is-chatgpt-develope-chatgpt-11-things-you-can-do-with-chatgpt/
Watch Other Video:-https://youtube.com/shorts/7MmZi6GHizM?feature=share
🌎 Website :- https://softwaretechit.com
📰 Blog:- https://blog.softwaretechit.com
🛒 Shopping :- https://shop.softwaretechit.com 
📑 Product Review :- https://productsellermarket.softwaretechit.com
🔎 Business & More:- https://golbar.net/
🏡 https://home.softwaretechit.com

💬 https://instagram.com/softwaretechit

LeetCode Playlist :- https://www.youtube.com/playlist?list=PLmwJLue37PZeATQcUaHddx4-TJ5cjkT0t
Angular Project Playlist :- https://www.youtube.com/playlist?list=PLmwJLue37PZfQTgu-AXNee3EDj7oIlqeh
Android Playlist :-https://www.youtube.com/playlist?list=PLmwJLue37PZcEUyMLhaa3jnfyq3lETiSe
Python Flask Project Playlist :- https://www.youtube.com/playlist?list=PLmwJLue37PZdqqr9wj6c5uY2iXQsSVxZK
Java Project Link :- https://www.youtube.com/playlist?list=PLmwJLue37PZcvpGWO8tjlFzXCRS7FDfwA
Installation Tutorial Playlist :- https://www.youtube.com/playlist?list=PLmwJLue37PZeRGo1hOc3Mh4QcHVSIKQ9Y
Kali Linux Installation:- https://youtu.be/7uqH2om9itY

Thank You... #softwaretechit #2023 #tech
#9 Example Of Fragment in android | Android Studio Tutorial| #SoftwareTechIT
Tags: android, development, programming, tutorial
Published: 2023-09-21 13:36:00

{% embed https://www.youtube.com/watch?v=U9xKgQOPKlY&list=PLmwJLue37PZfiGUAwQ6uhh5bbYkeFUOpj&index=9&ab_channel=SoftwareTechIT %}

{% embed https://softwaretechit.com/example-of-fragment-in-android-android-studio-tutorial-softwaretechit/ %}

Subscribe Channel SoftwareTechIT 
And Visit:- https://SoftwareTechIT.com
More Here:- https://home.softwaretechit.com
Buy Anything From Here :-https://shop.softwaretechit.com

Questions:- 
what is fragment in android ?
what is fragment in android with example
What is another meaning of fragment?
How do you use fragment in a sentence?
What is a sentence fragment definition?
What are small fragments?
why we use fragment in android
why we need fragmentation
why we use fragments
why we use fragment instead of activity
Why We Use fragment?
how to create fragment in android
how to create fragment in android kotlin

Download Our App:- https://play.google.com/store/apps/details?id=com.softwaretechit
Read More Here :- https://softwaretechit.com/top-10-quetions-on-ai-and-chatgpt-ai-tool-can-ai-is-new-future-of-world/
https://softwaretechit.com/what-is-chatgpt-develope-chatgpt-11-things-you-can-do-with-chatgpt/
Watch Other Video:-https://youtube.com/shorts/7MmZi6GHizM?feature=share
🌎 Website :- https://softwaretechit.com
📰 Blog:- https://blog.softwaretechit.com
🛒 Shopping :- https://shop.softwaretechit.com 
📑 Product Review :- https://productsellermarket.softwaretechit.com
🔎 Business & More:- https://golbar.net/
🏡 https://home.softwaretechit.com

💬 https://instagram.com/softwaretechit

LeetCode Playlist :- https://www.youtube.com/playlist?list=PLmwJLue37PZeATQcUaHddx4-TJ5cjkT0t
Angular Project Playlist :- https://www.youtube.com/playlist?list=PLmwJLue37PZfQTgu-AXNee3EDj7oIlqeh
Android Playlist :-https://www.youtube.com/playlist?list=PLmwJLue37PZcEUyMLhaa3jnfyq3lETiSe
Python Flask Project Playlist :- https://www.youtube.com/playlist?list=PLmwJLue37PZdqqr9wj6c5uY2iXQsSVxZK
Java Project Link :- https://www.youtube.com/playlist?list=PLmwJLue37PZcvpGWO8tjlFzXCRS7FDfwA
Installation Tutorial Playlist :- https://www.youtube.com/playlist?list=PLmwJLue37PZeRGo1hOc3Mh4QcHVSIKQ9Y
Kali Linux Installation:- https://youtu.be/7uqH2om9itY
From Self-Taught to Hyper Island: Advancing My Frontend Journey
Tags: newbie, firstpost
Published: 2023-09-21 13:35:23

Hey hey, Dev community! I’m Elena, and this is my very first post here.

I’ve never really been into blogging, but lately, I’ve felt the urge to jot down some of my thoughts.

The world of frontend development always fascinated me, and I’ve spent countless hours learning and experimenting on my own. However, since August, I’ve decided to take my passion a step further by enrolling at a school in Stockholm called Hyper Island (akin to a vocational college or “yrkenhögskola” in Swedish).

It’s this new chapter in my life that has propelled me to share my journey. Honestly, before Hyper Island, while I was passionate about frontend, I didn’t have as many noteworthy experiences to share.

My aim is to document the things I’ve learned, both independently and at Hyper Island, and to accumulate my thoughts in this space.

This blog is primarily for me — a place to reflect and grow. But I hope that my experiences and insights might resonate with some of you out there.

_A new chapter, but the story of passion continues.
_
P.S. I’d appreciate any feedback on [my portfolio](https://elen-oz.site/) and [GitHub repository](https://github.com/elen-oz).
Your insights and critiques will help me grow and improve. Thanks in advance!
Como é formado um Token JWT?
Published: 2023-09-21 13:34:38



Fala Pessoal,

Gostaria de compartilhar com vocês o que aprendi na construção da autenticação em uma api e a importância de entender o que está por trás de um Token JWT (JSON Web Token) no processo de autenticação utilizando o protocolo OAuth 2.0 que voce pode conferir como funciona nesse [link](https://auth0.com/pt/intro-to-iam/what-is-oauth-2)

O que é um Token JWT?

Token JWT é uma representação compacta de informações que é usado para autenticar um usuário em um sistema. Eles são frequentemente utilizados no contexto do protocolo OAuth 2.0 que é muito utili

Mas porque entender o que é um token jwt ?

Isso permite que você verifique a autenticidade do token. Isso é essencial para garantir que o token não tenha sido manipulado ou forjado por terceiros mal-intencionados.

Autorização: Tokens JWT podem conter informações sobre os níveis de autorização do usuário, como permissões e papéis. Saber como extrair essas informações pode ajudar a controlar com precisão o acesso às suas APIs e recursos.

Validação: Tokens JWT têm um prazo de validade. Conhecendo a data de expiração do token, você pode gerenciar melhor o ciclo de vida da autenticação do usuário, evitando o uso de tokens expirados.

A imagem abaixo ilustra como as informações estão contidas em um token jwt


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

A ferramenta acima faz a depuração do token e mostra as informações contidas no cabeçalho(tipo do token e o algoritmo),payload(informações ref ao usuário que foi autorizado e os papeis que ele pode exercer na aplicação) e a assinatura do token(que contém as informações da geração do token) 

Conhecer sobre Token JWT e o uso de uma ferramenta de leitura podem facilitar muito processo de construção da autenticação e a depuração de erros.
Python: Creating Objects with Variable Class Names
Tags: python, webdev, beginners, coding
Published: 2023-09-21 13:33:05

In Python, classes are used to create objects. Typically, class names are fixed, but there are scenarios where you might want to dynamically change the class name to create objects. In this article, we'll explore how to use variable class names in Python to create objects.

## 1. Understanding Classes

Let's start by understanding the basics of classes. A class serves as a blueprint for objects and defines how objects of that class should be structured and behave. To define a class, you do the following:

```python
class MyClass:
    def __init__(self, param1, param2):
        self.param1 = param1
        self.param2 = param2

    def some_method(self):
        # Method content
```

In the above example, we've defined a class `MyClass` that includes a constructor `__init__` and some methods.

## 2. Using Variable Class Names

When you want to use variable class names, Python provides a way to dynamically create classes using the built-in `type` function. Here's how you can do it:

```python
class_name = "MyClass"

# Create a class dynamically using the type function
MyDynamicClass = type(class_name, (object,), {"param1": "value1", "param2": "value2"})

# Create an object
my_object = MyDynamicClass()
```

In the code above, we store the class name in the `class_name` variable and use the `type` function to dynamically create a class. This class can be used just like any other class. For example:

```python
print(my_object.param1)  # Prints "value1"
print(my_object.param2)  # Prints "value2"
```

## 3. Leveraging Variable Class Names

Using variable class names can enhance the flexibility of your programs. It allows you to implement patterns like the factory pattern or dynamically create objects of different classes as needed.
SQL 50–1148. Article Views I
Tags: leetcode, sql, mysql, interviewquestions
Published: 2023-09-21 13:04:42

It’s an [easy](https://leetcode.com/problems/article-views-i/) problem from [SQL 50](https://leetcode.com/studyplan/top-sql-50/) with the description being:

```
Table: Views

+---------------+---------+
| Column Name   | Type    |
+---------------+---------+
| article_id    | int     |
| author_id     | int     |
| viewer_id     | int     |
| view_date     | date    |
+---------------+---------+
There is no primary key (column with unique values) for this table, the table may have duplicate rows.
Each row of this table indicates that some viewer viewed an article (written by some author) on some date. 
Note that equal author_id and viewer_id indicate the same person.
Write a solution to find all the authors that viewed at least one of their own articles.

Return the result table sorted by id in ascending order.

The result format is in the following example.

Example 1:

Input: 
Views table:
+------------+-----------+-----------+------------+
| article_id | author_id | viewer_id | view_date  |
+------------+-----------+-----------+------------+
| 1          | 3         | 5         | 2019-08-01 |
| 1          | 3         | 6         | 2019-08-02 |
| 2          | 7         | 7         | 2019-08-01 |
| 2          | 7         | 6         | 2019-08-02 |
| 4          | 7         | 1         | 2019-07-22 |
| 3          | 4         | 4         | 2019-07-21 |
| 3          | 4         | 4         | 2019-07-21 |
+------------+-----------+-----------+------------+
Output: 
+------+
| id   |
+------+
| 4    |
| 7    |
+------+
```

A way to know if the author is the viewer is basically comparing both in the conditions.

The output requested is the “all the authors that viewed at least one of their own articles.” since you are comparting both either way would be fine, also the column in the output needs an alias as id, which can be done using [AS](https://www.w3schools.com/sql/sql_ref_as.asp).

They don’t want duplicated ids in the output, to get sorted out use of [distinct](https://www.w3schools.com/sql/sql_ref_distinct.asp) is a great way to avoid duplications.

And last but not least, the order needs to be ascending so using [order by](https://www.w3schools.com/sql/sql_ref_order_by.asp) asc (order by is asc by default but you can add if you want) would get this done as expected:

```sql
SELECT DISTINCT(viewer_id) AS id FROM Views WHERE viewer_id = author_id ORDER BY id ASC;

OR

SELECT DISTINCT author_id AS id FROM Views WHERE viewer_id = author_id ORDER BY id;
```
> Runtime: 815 ms, faster than 77.65% of MySQL online submissions for Article Views I.
> Memory Usage: 0B, less than 100.00% of MySQL online submissions for Article Views I.

---

That’s it!

If there is anything thing else to discuss feel free to drop a comment, if I missed anything let me know so I can update accordingly.

Until next post! :)
Upload image to an entry on Strapi
Published: 2023-09-21 13:00:32

Strapi is great but their document is really confusing. I spent about 2 hours trying to achieve this. When you create a new entry from REST API, you may also want to upload image to that entry. 
### 1. REST API
Try make a POST request to
```
https://STRAPI_URL/api/upload
```
with the form-data:
```
ref: the table ID (ex: `api::submission.submission`)
refId: the entry ID
field: the field to upload
files: the file to upload
```

This is how we do it in Postman
![Postman](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/psnyc9cvh81kgcjnd2l9.png)

### 2. Javascript SDK
[strapi-js-sdk](https://github.com/stun3r/strapi-sdk-js) haven't supported upload file. Luckily, we can do it with a workaround.
```
const formData = new FormData();
formData.append(
    "files",
    blobFile,
    "file-name.jpg"
);
formData.append("ref", "api::submission.submission");
formData.append("refId", entryId);
formData.append("field", "speakingAudio");

const response = await strapi.request("POST", "/upload", {
    headers: {
        "Content-Type": "multipart/form-data",
    },
    data: formData,
});
```
If you have a question, don't hesitate to comment below.
Dotenv: Python app environment variable vs. Linux environment variable
Tags: python, linux, dotenv, environment
Published: 2023-09-21 12:48:49

When it comes to usage of `dotenv` inside our python scripts there is one important caveat: if you use Linux you can not use env names like HOME or NAME or LOGNAME. Because your app variables from `.env` file (in currently working directory) will be overwritten by the global one (from Linux).

For example: in case you put in `.env` `NAME=Michale` and you are logged in as user Daniel, inside your python script `os.getenv("NAME")` will return Daniel instead of Michael. And most probably this is not something you want in your app....

I guess there is different ways to resolve this but most obvious for me is to avoid this names entirely and to use some convention like APP_NAME or APP_HOME_DIR....

Example:

`local .env` used in our Python script

```
NAME=Michale
USER=Michale
```

Linux `NAME` and `USER` var for currently logged user (you can check with for example `os.environ.keys()`)

```
NAME=Daniel
USER=Daniel

```
`test_env.py`


```
import os
from dotenv import load_dotenv

load_dotenv()

name = os.getenv("NAME")
user = os.getenv("USER")

print(name, user)

```
`$ Daniel, Daniel`

At this point inside your script you will have something you don't want and potentially break your program...
Android Application(Shot badges notification)
Tags: android, javascript, programming
Published: 2023-09-21 12:41:39


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jowovvl1d48g2rzkge1j.jpg)Is there any permission through which I could get shot badge notification permission?

Is there any permission through which I could get shot badge notification permission?

Is there any permission through which I could get shot badge notification permission?

Is there any permission through which I could get shot badge notification permission?
prueba de post
Published: 2023-09-21 12:36:05

```
<div className="grid grid-cols-1 md:grid-cols-2 gap-4 py-8 text-white">
      {posts.map((post, index) => (
        <Link key={index} href={`/blog/${post.slug}`}>
          {post.title}
        </Link>
      ))}
    </div>
```