teleren/devto huggingface dataset:
API Key use in REST APIs
Published: 2023-02-03 04:40:33

## What is API key?

An API key is a code passed in by a computer program to identify the calling program and provide access to its resources, such as retrieving or updating a particular resource in a REST API. It acts as a secret authentication token passed between the client and the server to identify the calling program and provide access to the resources it requests.

## What is the relationship between API key and REST APIs?

API keys are used in REST APIs to authenticate and authorize access to resources. When a client requests a REST API, it passes the API key as a parameter in the request. The server then uses the API key to identify the calling client and determine what level of access it should be granted. For example, an API key might be used to control access to specific resources, limit the rate at which requests can be made, or track usage statistics. By using API keys, REST APIs can enforce security and access control policies and help prevent unauthorized access to resources.

## How can client provide apikey to REST API?

The client can pass the API Key in the following ways in REST APIs:

- **As a query parameter:** The API Key can be passed as a query parameter in the URL of the REST API request. For example: https://api.example.com/resources?apikey=xyz123.
- **In the request header:** The API Key can be passed in the request header of the REST API request. This is typically the most secure method of passing an API Key as it is not visible in the URL.
- **In a cookie:** The API Key can also be passed in a cookie, but this is less common in REST APIs.

It's important to note that the method of passing the API Key should be agreed upon between the client and the API provider, as this will affect how the API Key is validated and authorized.

## What are the pros and cons of apikey?

_**Pros of using API key in REST APIs:**_

- Easy to implement: API key is simple to implement and does not require much effort.
- Scalability: API key can handle a large number of requests and can be easily scaled up as required.
- Easy to manage: API keys can be easily managed and revoked in case of security breaches.

_**Cons of using API key in REST APIs:**_

- Security: API keys can be easily shared or leaked and there is a potential security risk if the keys are not kept confidential.
- Limited access control: API keys provide limited access control and it is not possible to restrict specific actions or endpoints.
- No user context: API keys do not provide any user context, making it difficult to implement user-based access control.
ReactPlay presents #2PlaysAMonth for Web Developers
Tags: react, beginners, codenewbie, hackathon
Published: 2023-02-03 04:36:31

Hey There 👋

  
ReactPlay presents an exciting event `#2PlaysAMonth` for ReactJS/Web Developers to learn, build, and share. Oh yeah! Also to win some exciting prizes, too.

The event starts `Feb 1st 2023` and ends on `Feb 28th 2023`. You will be building 2 projects in these 28 days on any ideas of your choice! You need to follow a few rules that you can find here:

> [#2PlaysAMonth Event from ReactPlay](https://hustles.reactplay.io)

## How to Participate?

* You must complete two plays(React Projects) on ReactPlay between February 1st to February 28th 2023.
    
* You must follow the [Create a Play](https://github.com/reactplay/react-play/blob/main/CREATE-PLAY.md) steps to create the play. Please [create an issue](https://github.com/reactplay/react-play/issues/new?assignees=&labels=%232PlaysAMonth&template=%232PlaysAMonth.yml&title=%5B%232PlaysAMonth%5D%3A+) on the ReactPlay repository for each pull request.
    
* Your play must have `#2PlaysAMonth` tag added to it while creating.
    
* You can build any project of your choice. If you are looking for ideas, [here are some you can get inspired by](https://reactplay.io/ideas).
    
* You must register on [stackstream](https://www.stack-stream.com/).
    
* Create a demo on [stackstream](https://www.stack-stream.com/) explaining your work and add the recording link to your play by editing it.
    
    That's it, and you are all set to go.
    

## About `ReactPlay`

`ReactPlay` is an Open Source platform that helps anyone learn ReactJS faster with a hands-on practice model. It is a collection of ReactJS projects you can use to learn ReactJS.

Is that all? Nope. You can also create your projects and share them with the world. The best part is that ReactJS `experts` will review your project code before it gets part of the ReactPlay platform. Isn't that a pure WIN-WIN?

## Important Links

* [ReactPlay Website](https://reactplay.io/)
    
* [ReactPlay Org on GitHub](https://github.com/reactplay)
    
* [ReactPlay on Twitter](https://twitter.com/ReactPlayIO)
    
* [ReactPlay Community on Discord](https://discord.gg/vrTxWUP8Am)
    
* [ReactPlay Blog](https://blog.reactplay.io/)
What is Google Web Stories ?
Published: 2023-01-21 12:29:04

Google Web Stories is a component that permits site distributers to make outwardly rich, full-screen stories for the web utilizing a blend of text, pictures, and recordings. These accounts can be handily shared and found through Google search, and can likewise be installed on different sites. They are intended to be connecting with and intelligent, and can incorporate highlights, for example, movements, scroll impacts, from there, the sky is the limit. The objective of Google Web Stories is to give a better approach to distributers to recount stories and draw in with their crowd on the web.

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

Individuals presently really like to see posts (material) as slideshows, short movies, or video reels. that is truly easy to tap. As a result of their prosperity, various stages have now been created, and Google has even delivered its own, known as Google Web Stories.

A visual story design is called Google Web Stories (like we see stories in Instagram). Along these lines, Google Web Stories are currently apparent to everybody in query items. We can see this story in full screen mode by addressing it.

AMP innovation abilities Google Web Stories. You can have a full-screen insight on your site or blog thanks to it.

You can likewise incorporate Google Adsense, connections, and suggestions to take action in your Google Web Stories.

With the assistance of video, movement, illustrations, and different devices, you might recount various stories. By tapping on us to encounter the story we wish to tell, you can utilize these highlights to share your own story.

for reading more click on the link below
[Link](https://digitalhubdot.com/what-is-google-web-stories/)
Avoid using () => void in 2023
Tags: javascript, typescript, programming, react
Published: 2023-02-03 04:16:08

Hey, all! We all use `() => void` in typescript when we want to declare a function without arguments.

But do you know that this declaration can lead to bugs on runtime?

Let's consider the next example:

```javascript
const verify = (address?: string) => address?.toLowerCase()
const verifyEmpty: () => void = verify
const onClick: (event: object) => void = verifyEmpty

onClick({ this: 'is not a string'})
```

In the example above we assign `verify` function with optional argument to the function without arguments. And then reassign `verifyEmpty` to `onClick`. 

But `verify` and `onClick` functions have different signatures of arguments: `verify` accepts a string, while `onClick` an object. 

Does typescript allow this assignment through the third function `verifyEmpty` without arguments? 

Yes! And on runtime we'll get the error:
`address.toLowerCase is not a function`.

Check it out on [playground](https://www.typescriptlang.org/play?#code/MYewdgzgLgBAbgUwE4EsBmBPGBeGAKAQwBMikEIIB+ALhmlTAHMBKHAPhmNPKoDooQAGRAB3ZAGECEBHmYAoUJFiJUmAKIBbAA5QMtWe3ggURHPGToMC8NBjhxAGxTAA1voSIwUWiABGAKwRgKFZsDjhjU1wVS00dKzl7J1c8AG8YKAALFAhaAHIcmDAQWAI6KAZGPIBfZiA)

So, how can we avoid that? How can we explicitly say, that function should have zero arguments?

The solution is pretty simple. 

**Let's just replace `() => void` with `(...args: undefined[]) => void;`**:

```javascript
const verify = (address?: string) => address?.toLowerCase()
const verifyEmpty: (...args: undefined[]) => void = verify
const onClick: (event: object) => void = verifyEmpty

onClick({ this: 'is not a string'})
```

Now, the typescript tells us that `verifyEmpty` can't be assigned to `onClick` function: [playground](https://www.typescriptlang.org/play?#code/MYewdgzgLgBAbgUwE4EsBmBPGBeGAKAQwBMikEIIB+ALhmlTAHMBKHAPhmNPKoDooQAGRAB3ZAGECEBHmYAoUJFiJUmAKIBbAA5QMtPL0MEkjCLQCuYIgjQowCIgG0Auq2wc4IFERzxk6DAVwaBhwcQAbFGAAa30ERDAoWhAAIwArBGAoNw8vH1wVAM0dQLkwyJi8AG8YKAALFDMYAHJGmDAQWAI6KAZGZoBfZiA). The code won't compile and you won't see annoying bug on runtime. 

Thanks for reading, hope it will help someone! 

Happy coding and stay safe!
How I Use GitHub
Tags: git, github, beginners
Published: 2023-02-03 04:14:01

When you see a repository that needs some simple work done and as a beginner you want to contribute it can be a bit overwhelming to know *what* to do exactly. So I wanted to make a post about how I personally contribute to a repo. 

**FORK_IT**
Click on the fork icon in GitHub and it will create a local repo for you on your account. Once you have a copy (fork) of the repo, you click on the "CODE" button and copy the .git URL. 

**LOAD_EDITOR**
No matter if you use VS Code, emacs, nano, or any number of others load it up, I use VS Code so I will be using that as an example of what to do locally on your computer. In VS Code you press:
`Ctrl + Shift + P`
to open the command pallete. Then type: 
`gitcl`
to open the "Git Clone" tool included in VS Code.

**PASTE_GIT_URL**
Paste the .git URL you copied earlier. Choose your destination for the repo locally and clone it. 

**MAKE_YOUR_CHANGES**
Make whatever changes you need to and push your changes to GitHub that will be on your account. 

**CREATE_BRANCH**
Im doing this a little backwards, but I prefer it for orderly commits. Name your branch something that will indicate your changes to the code owners. "bug-fix", "feature", "enhancements", "web-layout-fixes" etc... 

**SUBMIT_PULL_REQUEST**
Click on Pull Request and compare across forks, compare your new brnach to the owners `main` branch and there should be changes that can be merged. 

That isn't the entire process, because now you have to wait and the owner will communicate with you in the PR thread about any issues they have. Be kind, be respectful, and enjoy. Let me know if this worked for you. I even have a few beginner repos with open "Good-First-Issues" for new contributors and I break stuff all the time to keep them active. Connect with me on Github and Discord and let's work together to create something amazing. I love building Discord bots and other service workers for various chat clients.
6. Leetcode Solution in Javascript
Tags: javascript
Published: 2023-02-03 03:49:00

==============================================================

Description:
The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)

P   A   H   N
A P L S I I G
Y   I   R
And then read line by line: "PAHNAPLSIIGYIR"

Write the code that will take a string and make this conversion given a number of rows:

string convert(string s, int numRows);
 

Example 1:

Input: s = "PAYPALISHIRING", numRows = 3
Output: "PAHNAPLSIIGYIR"
Example 2:

Input: s = "PAYPALISHIRING", numRows = 4
Output: "PINALSIGYAHRPI"
Explanation:
P     I    N
A   L S  I G
Y A   H R
P     I
Example 3:

Input: s = "A", numRows = 1
Output: "A"
 

Constraints:

1 <= s.length <= 1000
s consists of English letters (lower-case and upper-case), ',' and '.'.
1 <= numRows <= 1000

==============================================================
Solution:
```javascript
let convert = function(s, numRows) {

    if (numRows === 1 || numRows > s) return s;

    let res = [];

    for (let i = 0; i < numRows; i++){

        let down = true;

        helper(down,i,numRows);

    }

    function helper (toDown,row, numberOfRows){

        if (row+1 === numberOfRows) toDown = false;

        let distance = 0;

        res.push(s[row])

        while (s[row + distance]){

            if (toDown){
                distance +=2 * (numRows - (row +1));
            }else {
                distance += 2 * ((row+1) -1);
            }
            if (s[row+distance]) res.push(s[row+distance]);

            if (row !== 0 && row !== numberOfRows -1){
                toDown = !toDown;
            }
        }
    }

    return res.join("");

};
```
==============================================================
#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/zigzag-conversion/
CI / CD pipeline
Tags: webdev, tutorial, vietnameseblogs
Published: 2023-02-03 03:47:24

CI/CD pipeline là tập hợp các quy trình xây dựng và triển khai sản phẩm ứng dụng.
CI/CD là viết tắt của Continuous Integration(tích hợp liên tục) và Continuous Delivery(triển khai liên tục).
Trong tích hợp liên tục có các quy trình sau:
- Plan, Code, Build, Test
Continuous delivery bao gồm các quy trình:
- Release, Deploy, Operate
Trong đó:
- Plan stage: Lên kế hoạch và triển khai bắt đầu dự án.
- Code stage: Lập trình viên sẽ code và thay đổi code liên tục
trên source code.
- Build stage: Code được build và triển khai qua Docker. Nếu xảy ra lỗi thì các lập trình viên phải sửa trước khi qua bước tiếp theo
- Test stage: sẽ có unit test và integration test. Việc test thực hiện để đảm bảo chương trình chạy được và đúng với thiết kế ban đầu.
- Release stage: Phần code đó đã có thể triển khai cho thành sản phẩm việc chạy thử(release môi trường staging) để các bạn testers kiểm tra các flow chính của chương trình. Nếu có feedback thì các lập trình viên điều chỉnh code phù hợp với nghiệp vụ.
- Deploy stage: Sau khi testers kiểm tra xong thì triển khai sản phẩm trên môi trường production cho người dùng cuối sử dụng.
- Operate stage: Bảo trì và phát triển hệ thống phần mềm.

Happy reading!
REST API Testing: A Comprehensive Guide
Tags: rest, api, testing
Published: 2023-02-03 03:34:30

Testing REST APIs is an essential part of the development process to ensure that the API is working as expected and meets the requirements. This blog post will discuss the steps involved in testing REST APIs and the different things that need to be tested.

## Steps for Testing REST APIs:

**Planning:** Determine the scope of the testing, identify the resources that need to be tested, and create a test plan.

**Preparation:** Set up the testing environment, including the API endpoint, authentication, and any required data.

**Testing:** Execute the test cases, verifying that the API responses are correct and meet the requirements.

**Analysis:** Evaluate the testing results and identify any issues that need to be fixed.

**Documentation:** Document the testing results, including any issues and their resolution.

## Things to be tested in REST APIs:
**Resource Availability:** Check that the API endpoint is available and responding to requests.

**HTTP Methods:** Verify that the API supports the correct HTTP methods for each resource, such as GET, POST, PUT, and DELETE.
Resource Representation: Ensure that the API returns the correct data format, such as JSON or XML, and that it meets the requirements for the resource representation.

**Validation:** Test that the API performs validation on incoming data, such as checking that required fields are present or that data is within a specified range.

**Error Handling:** Verify that the API returns appropriate error codes and messages for various error conditions.

**Security:** Test that the API implements proper security measures, such as authentication and authorization.

## Tools for Testing REST APIs:

**cURL:** A command-line tool for making HTTP requests to an API.
Postman: A popular graphical tool for testing APIs that allows you to create and execute test cases.

**SoapUI:** A tool for testing web services that support REST APIs.

**Apache JMeter:** A load-testing tool that can also be used to test REST APIs.

## Conclusion 

Testing REST APIs is an important step in the development process to ensure that the API works as expected and meets the requirements. You can ensure that the API is reliable and secure by testing various aspects of the API, such as resource availability, HTTP methods, resource representation, validation, error handling, and security. By using tools such as cURL, Postman, SoapUI, or Apache JMeter, you can automate the testing process and improve the efficiency and accuracy of your testing.
How to Crack Any Manual Testing Interview | Manual Testing Interview
Tags: webdev, javascript, beginners, tutorial
Published: 2023-02-03 03:17:56

Manual Testing Interview: In this video, we are going to learn about the How to crack any Manual Testing Interview. We will discuss the Manual Testing Process, Projects and Things you should Know before Interview.

{% embed https://youtu.be/1wJuCHqtR6I %}

👉Manual Tester Blueprint Live Classes
https://sdet.live/manual


I will share the Handy things that you need to have in your PC to crack Manual Testing easily.

👉 Download Manual Testing Templates
✅ Test Case -  https://sdet.live/tc-template

✅ Test plan -  https://sdet.live/notes

✅ Download RTM -  https://scrolltest.com/rtm

✅ Bug Report -  https://sdet.dorik.io/bug-report-temp...


✅ Download Notes -  https://sdet.live/notes

✅ New Batch - https://go.scrolltest.com/manual


✅ Join Facebook Group :  http://bit.ly/learntesting2019

✅ Website:   https://scrolltest.com

✅ Website:   https://thetestingacademy.com

✅ Twitter: https://twitter.com/itstechmode

🚀 Tools and services I recommend:
Some of the courses that I recommend to become better Automation Tester 🙌🙌

✅API Testing - 
https://www.learnapitesting.com


✅Cypress Tutorial with LIVE Projects -
http://cypresstutorial.com


#manualtestinginterview #manualtestinginterviewquestionsandanswersforexperienced #manualtestinginterviewquestions #manualtestinginterviewquestionsandanswersforfreshers #manualtestinginterviewquestionsandanswers #manualtestinginterviewquestionsfor3yearsexperience
Introducing a Translation Tool using GPT-3
Tags: gpt3, openai, translate
Published: 2023-02-03 03:03:52

I created a translation tool that can be operated from the command line using the GPT-3 model. 

This tool is easy to use with OpenAI API access and configuration, and there is no need to connect to Google Translate or DeepL to translate languages. 

It can be downloaded here: https://github.com/fukumone/gt
Unleash the Power of Decoupled Design: The Essential Guide to the Service Locator Pattern for Software Developers
Tags: softwaredevelopment, designpatterns, programming, techtutorials
Published: 2023-02-03 02:59:23

Excited to share my latest article on the Service Locator design pattern, now available on dev.to! In this article, I provide an in-depth look at this powerful design pattern and its benefits for software development. From understanding the basics to exploring real-world use cases, this article has everything you need to know about the Service Locator pattern. Whether you're a seasoned software developer or just starting out, I guarantee that you'll find this article informative and useful. So, what are you waiting for? Head over to dev.to and check it out now! And if you like what you see, don't forget to clap and follow me for more great content. 😃 #ServiceLocator #DesignPatterns #SoftwareDevelopment #Programming

Link: https://aaron-janes.medium.com/software-architecture-inversion-of-control-part-2-1bc1aeb36353
Central tenet of DevOps
Tags: devops, developers, devjournal, culture
Published: 2023-02-03 02:33:00

A central tenet of DevOps is the idea of a blameless culture: 

Rather than focusing on who “caused” an issue, 

Engineers reflect on how the system itself can be made more reliable and resilient.

Thanks for reading this.

If you have an idea and want to build your product around it, schedule a call with [me](https://calendly.com/pragyanatvade).

If you want to learn more in DevOps and Backend space, [follow me](https://dev.to/pragyanatvade).

If you want to connect, reach out to me on [Twitter](https://twitter.com/pragyanatvade) and [LinkedIn](https://www.linkedin.com/in/pragyanatvade/).
What's @SpringBootApplication Annotation?
Tags: springboot, java, beginners, tutorial
Published: 2023-02-03 02:21:52

In a nutshell, **@SpringBootApplication** is a convenience annotation that is equivalent to declaring three separate annotations @Configuration, @EnableAutoConfiguration, and @ComponentScan with their default attributes. It is typically used on the main class of a Spring Boot application to enable auto-configuration, component scanning, and to define the application context.

- <u>**@Configuration**</u>: Indicates that the class is a source of bean definitions for the application context.

- <u>**@EnableAutoConfiguration**</u>: Enables Spring Boot's auto-configuration mechanism, which automatically configures the application based on the dependencies that are added in the classpath.

- <u>**@ComponentScan**</u>: Enables component scanning so that the annotated components are automatically discovered and registered as beans in the application context.

By using the @SpringBootApplication annotation, developers can write less code and make their code easier to read and understand. 

ex:
```
package com.example.myapplication;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication // same as @Configuration @EnableAutoConfiguration @ComponentScan
public class Application {

	public static void main(String[] args) {
		SpringApplication.run(Application.class, args);
	}

}
```