teleren/devto huggingface dataset:
What is GraphQL? - GraphQL Day1
Tags: webdev, graphql, beginners, tutorial
Published: 2022-06-26 14:26:57

GraphQL has been around since 2012(inside of Facebook😅). 

But Facebook made it public in 2015 and since then, it has become one of the most use Back-end architecture. 
 
The question is what exactly is GraphQL?
`Answer` : `GraphQL is a new API standard that provides a more efficient, powerful and flexible alternative to REST`

_Confused?_
<img src="https://media.giphy.com/media/4JVTF9zR9BicshFAb7/giphy.gif"/>

Well in simple terms, `it is used to define how requests are made to an API and how it handles the responses`.

But, how is it related to and even _BETTER_ than REST?
There are few things to consider to make this comparison.

## Single Point Of Origin
If you have ever developed a REST API, you know the work it takes to build an endpoint for the user details, another for the blog posts list, another for the followers list, the following list, and it goes on. 

With GraphQL, there is only one endpoint and it does the job. For accessing a set of data, you only need to specify the particular things you need. What a GraphQL server does is that it organizes only the specifics you need and returns the response. 

`Done. No extra data, no multiple endpoints.`

## Rapid Product Iterations
In the fast paced development cycles, there are many versions of the API. 
And every time there is new data, the endpoints have to be reconfigured, redeveloped, re something something. 
<img src="https://media.giphy.com/media/14smAwp2uHM3Di/giphy.gif"/>

With GraphQL, this problem is solved. 

Thanks to the flexible nature of GraphQL, changes on the client-side can be made without any extra work on the server. 

Since clients can specify their exact data requirements, no backend engineer needs to make adjustments when the design and data needs on the frontend change.

## Schema Based Communication
An important step in development is the Integration. And, this is where it all turns around. No integration can be completed without a list of bugs and debugging. 

I guess, bugs are not the developers best friends. Agree?
<img src="https://media.giphy.com/media/ukMiDlCmdv2og/giphy.gif"/>

Since, GraphQL works on a strong type system to define the Schema of queries, there is less chance of error. This is because both the frontend and the backend teams are aware of the definite schema. Thus, the process becomes a whole lot easier.

Now, I am not saying the GraphQL is better than REST in all the ways, but it is definitely worth exploring. 

And that is what I am doing. This was just Day 1 and I would love the support in going ahead as I share my journey with you guys. 

PS : There is no Fees in joining in the FUN.
<img src="https://media.giphy.com/media/31SjcGHQAXIoXNHRpp/giphy.gif"/>
Using an Array as Function Parameter in JavaScript
Tags: javascript, webdev, tutorial, beginners
Published: 2022-06-26 14:12:22

In Javascript, we often have data stored as arrays, and functions we want to call. Sometimes, the data in our arrays is exactly the data we want to pass to a function. Fortunately, there are ways in Javascript to use arrays as the input values for functions. **Let's look at how to use arrays as function parameters.**

## How to use arrays as function parameters

When we have a function we want to pass an array to, the most basic way to do it would be like this:
```javascript
let numbers = [ 1, 2, 3 ]
let myFunction = (x, y, z) => {
    return x + y + z;
}

// Returns 6
let getCalculation = myFunction(numbers[0], numbers[1], numbers[2]);
```

Of course, this can be quite annoying, especially when working with functions which have very long lists of properties. As such, Javascript provides us with two ways to use arrays as function parameters in Javascript - `apply()` and the **spread operator**. 

## Passing arrays to functions with the spread operator

The modern, and easiest way to pass an array to a function is to use the spread operator. The spread operator (`...`) is simply added before the array. Using our previous example, it looks like this:
```javascript
let numbers = [ 1, 2, 3 ]
let myFunction = (x, y, z) => {
    return x + y + z;
}

// Returns 6
let getCalculation = myFunction(...numbers);
```

We can also directly add the array into the function, without needing a variable. For example:
```javascript
let myFunction = (x, y, z) => {
    return x + y + z;
}

// Returns 6
let getCalculation = myFunction(...[ 1, 2, 3 ]);
```

[If you want to learn everything the spread operator can do, check out my guide on that here](https://fjolt.com/article/javascript-three-dots-spread-operator).

## Passing arrays to functions using apply()

The other way to do this, is to use `apply()`. If you're unfamiliar with the main use case of `apply()`, check out my [full guide on Javascript's this object here](https://fjolt.com/article/javascript-this-and-the-global-object).

Ultimately, `apply()` lets us take a function, and pass an array into it. The first attribute of `apply()` actually refers to the `this` object we want to use on the function. The second argument is an array of all the parameters for that function. That means you can define the structure of `this` as well as pass an array into the function itself.

This obviously has some specific benefits when compared to the spread (`...`) operator, so it may be more suitable depending on what you want to achieve. Using our previous example, we can pass an array into our function like so:
```javascript
let myFunction = (x, y, z) => {
    return x + y + z;
}

// Returns 6
let getCalculation = myFunction.apply({}, [ 1, 2, 3 ]);
```

Here, I am leaving the `this` object empty, so if we did use `this` in `myFunction`, it'd be an empty object - that's what the first argument of `apply()` does. The second is our array `[1, 2, 3]`, referring to `x`, `y`, and `z` respectively.
Used TDD approach for a Hello World rust cli app
Tags: rust, tdd
Published: 2022-06-26 14:10:33

For the first time ever in my life i wrote hello world application using [TDD (Test driven development)](https://en.wikipedia.org/wiki/Test-driven_development). Don't get me wrong here, i have practiced TDD before for larger applications but never have i done it for an hello world app.

## Problem

Write an CLI application that prints out "Hello TDD world!" in STDOUT.

## How did i do it?

- I created a project using `cargo new hello-world-tdd`
- I added a dependency `assert_cmd` which lets us test out outputs of any binary program
- Created a file `tests/cli.rs`  and I wrote the following test
```rust
use assert_cmd::Command;

#[test]
fn test_cli_app_should_print_hello_tdd_world() {
    let mut cmd = Command::cargo_bin("hello-world-tdd").unwrap();
    cmd.assert().success().stdout("Hello TDD world!\n");
}
```
- Run the test using command `cargo test`
- The above test will fail saying the following, this happens because the cargo new had generated a `src/main.rs` file which printed out "Hello world!"
```log
running 1 test
test test_cli_app_should_print_hello_tdd_world ... FAILED

failures:

---- test_cli_app_should_print_hello_tdd_world stdout ----
thread 'test_cli_app_should_print_hello_tdd_world' panicked at 'Unexpected stdout, failed diff original var
├── original: Hello TDD world!
├── diff:
│   --- 	orig
│   +++ 	var
│   @@ -1 +1 @@
│   -Hello TDD world!
│   +Hello world!
└── var as str: Hello world!
```
- Now that we have a failing test(RED), the next job is to make it green by modifying the contents of the println statement.
- Run `cargo test` again, The test now passes (Green)

The code for this is available at https://github.com/kishaningithub/hello-world-tdd

## Links

- [Command line rust OReilly book](https://learning.oreilly.com/library/view/command-line-rust/9781098109424/preface01.html#idm45828825384320)
Question about Wordpress and Gatsby
Tags: help
Published: 2022-06-26 14:01:42

Hi folks, I am just following some tutorials on building a Gatsby site with a Wordpress backend using GraphQL. I was wondering if anybody has done this kind of work for a client. Do you need two domain names and double hosting in this case, one for the WP site and one for the Gatsby site? Can you use the free hosted wordpress.com in this case? Either way, don't you just end up with a duplicate site and how do you redirect traffic to and index only your Gatsby site? Just a lot of confusion...
Creating gradient images using only Python NumPy
Tags: python, programming, tutorial, machinelearning
Published: 2022-06-26 13:24:20

## Here’s the backstory of this article:

I was working on a Computer Vision Project as a part of an internship and I needed a script which can generate custom B/W gradient images. By custom gradient, I mean images like this:

![Cross Gradient](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3iwiv7aawk645ysg0gzt.png)

![Linear Gradient](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3f2n8sutxfnahn97z429.png)

![Parabolic Gradient](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k7og1x8dqfx8od84tid7.png)
  
Along with the above structures, I also wanted to vary the spread of the gradient and combine different such structures to get the following samples:

![Combination of Cross and Parabolic Gradient](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/914qf7wxwl6bhof5752e.png)

![Combination of Linear and Parabolic Gradient](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e7vq7rjvwyq5a2jv0zq1.png)

![Combination of Two Parabolic Gradients](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9iuciae47iir9zuuec7n.png)

I tried to search online but couldn’t find the solution which I really wanted. To help others like me, I decided to write this article. I use NumPy arrays with loops to generate such gradient images.

## Code:

Gradients are essentially uneven arrays of numbers. So first, we have to write a function for uneven array creation. Refer [this](https://stackoverflow.com/questions/32504766/python-generate-unevenly-spaced-array#:~:text=Find%20a%20function%20f%20which,*(ub%2Dlb)%20.&text=Now%20with%20the%20parameter%20spacing,your%20values%20gather%20around%20ub) for explanation:

{% embed https://gist.github.com/ManishAradwad/46574efd2a141eba630e76e58417dcff %}

We can use this function for creating different types of gradients as follows:

{% embed https://gist.github.com/ManishAradwad/c2608827ba76ba693dd4b3a06d41e5bb %}

Finally, we can write a function which returns a gradient of one of the above types with random parameters:

{% embed https://gist.github.com/ManishAradwad/9b68a49f17930f0b88141bab9cb72eff %}

Finally, when we run the custom_gradient() function, it will return one of the gradient image type. Complete code is available in [this notebook](https://colab.research.google.com/drive/1v_euV4liOWx0HdY97vxDh8K0d1fhQNZP?usp=sharing).

Thanks for reading :)

Have a nice day!
What is OAS and why would you use it?
Tags: oas, blst, openapi, opensource
Published: 2022-06-26 13:24:05

OAS is a language-agnostic interface to RESTful APIs which allows both **humans and computers to discover** and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. Additionally, OAS can **help ensure that research is properly attributed** and cited, and that it meets funder mandates for open access.

OpenAPI Specification (OAS) defines a standard, language-agnostic interface to RESTful APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection.

**Why use OpenAPI Specification?**

There are many **reasons to use OpenAPI** Specification. Here are just a few:

1. OAS promotes adoption of best practices in API design

2. OAS is language-agnostic

3. OAS is easily read and understood by both humans and computers

4. OAS can be used to generate documentation for an API

5. OAS can be used to generate client code for an API

6. OAS can be used to test an API

7. OAS can be used to create a mocked version of an API for development or testing purposes

8. OAS is supported by a wide range of tools, including open source and commercial tools

9. OAS is backed by a strong community of users and contributors

Overall, OAS provides a number of benefits for researchers. By making it easier to find and use digital content, OAS can save researchers time and effort. Additionally, OAS can help ensure that research is properly attributed and cited, and that it meets funder mandates for open access.

Open source API Security testing tools
I invite you to check out our **API security GitHub** ⭐
https://github.com/blst-security/cherrybomb


![oas](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nu2decdcpibosuxyyhw0.png)

In conclusion, OpenAPI Specification is a standard, language-agnostic interface to RESTful APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. OpenAPI Specification is supported by a wide range of tools, including open source and commercial tools, and is **backed by a strong community** of users and contributors.

Thanks for reading my post. If you enjoy my content, please consider following me :)
what is programming? Summary of 10 other articles.
Tags: summary, programming, beginners
Published: 2022-06-26 13:20:18

---
title: what is programming? Summary of 10 other articles.
published: true
description: I created a summary of 10 other dev.to articles that try to answer the same question.
tags: summary,programming, beginner
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
---
Programming languages are used in computer programming to implement algorithms.

High-Level Languages are programming languages like Java, Python, C, C , etc which helps programmer to write programs which is independent with the type of computer.

"Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result." Doing SQL is considered as programming even though for sure there is no executable and its just interpreted by database engine.

Programming involves activities such as analysis, developing understanding, generating algorithms, verification of requirements of algorithms including their correctness and resources consumption, and implementation of algorithms in a target programming language.

A computer program is usually written by a computer programmer in a programming language.

Most of today's high-level languages support object oriented programming or are object oriented programming languages.

1c. STRUCTURED PROGRAMMING. The structured programming method is a simplified form of imperative programming.

You can program by writing code in a programming language using a text editor or an integrated development environment.

In computer science, an interpreter is a computer program that directly executes instructions written in a programming or scripting language, without requiring them previously to have been compiled into a machine language program- Wikipedia.
Overview of conditions in python.
Tags: beginners, programming, python, conditions
Published: 2022-06-26 13:02:31

**1.Introduction**
Conditions in python helps us in many ways as they are the block of code in which we can specify some condition in the code to be performed.
**2.If**
The if statement shows a code for a decision making statement. 'if' is the keyword and ended by ':' at the end.
**syntax**
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jgmvm5am41lkpl9pirfz.png) 
The output for above example is
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rpvdtj8yzm62l751h5f8.png) 
**3.Elif**
The elif condition means that if the previous condition is not satisfied then elif statement will be checked. The 'elif' is the keyword and ended by colon.
**syntax**
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a1t7i42sviayy03fiw45.png)  
The output for above example is
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ctrgazswf4hn2n3bmjou.png) 
**4.Else**
The else statement means that if the 'if' or 'elif' statement is not true then this will be correct.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mfjwfvri26gkg8z1g59f.png)
The output for above example is
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/egy24ppkdoyh5a8bijdn.png)
Kit Bồ Đào Nha DLS 2022-2023
Published: 2022-06-26 12:56:42

Đội bóng này cũng đã có được những thành tích nhất định từ giải quốc nội cho đến các giải đấu cấp quốc tế. Đã là fan của đội bóng này và muốn sở hữu các [Kit Bồ Đào Nha DLS](https://kitdls.com/kit-bo-dao-nha-dls/) 2022-2023 | Logo ĐTQG Dream League Soccer mới nhất để chiến trong game DLS thì nhanh tay vào đây nhận nha.
Solve cuInit: CUDA_ERROR_UNKNOWN: unkown error
Tags: tutorial, python, linux, tensorflow
Published: 2022-06-26 12:33:01

## Steps

1. Enable the following services in `systemd`:
  - `nvidia-suspend.service`
  - `nvidia-resume.service`
  - `nvidia-hibernate.service`

    Enable via `sudo systemctl enable <service name>`.

2. Create a file named `/etc/modprobe.d/nvidia-suspend.conf`.

3. Add the following line to the file:

    ```modconf
    options nvidia NVreg_PreserveVideoMemoryAllocations=1
    ```

4. Reboot

This shall prevent the `cuInit: CUDA_ERROR_UNKNOWN: unknown error`.

## If that does not work

Execute the following:

```bash
sudo modprobe -r nvidia_uvm # or: sudo rmmod nvidia_uvm
sudo modprobe nvidia_uvm
```

[Read more about the problem here.][guide]

[guide]: https://download.nvidia.com/XFree86/Linux-x86_64/510.39.01/README/powermanagement.html
🚴🏻‍♀️Build an Exercise Planner App using React Hooks and React Router
Tags: 100daysofcode, webdev, javascript, react
Published: 2022-06-26 12:30:43

In this video, let us learn React by building one FULL Project. The project is on building a simple exercise planner application using React.js, Hooks and React Router. Users will have the ability to create a list of exercises, mark them as completed or in progress as per their progress, editing of exercises along with deleting an exercise when they want.  

{% youtube iqewbHLKkQk %}

🐱‍💻 🐱‍💻 Course Links:
Complete Code - https://github.com/The-Nerdy-Dev
Visual Studio Code - https://code.visualstudio.com
Git - https://git-scm.com/downloads

--- 
Support my channel:
💜 Join the Discord community 👨‍👩‍👧‍👦: https://discord.gg/fgbtN2a 
💜 One time donations via PayPal
Thank you! 🙏

---
Follow me on:
👉 Twitter: https://twitter.com/The_Nerdy_Dev
👉 Instagram: https://instagram.com/thenerdydev
👉 My Blog: https://the-nerdy-dev.com
Testing for whether a string is a palindrome or not.
Tags: 100daysofcode, javascript, webdev, programming
Published: 2022-06-26 12:26:45

In this video, you will learn how to test whether a string is a palindrome or not. 

{% youtube NrLUknMk-1A %}

🐱‍💻 🐱‍💻 Course Links:
Complete Code - https://github.com/The-Nerdy-Dev
Visual Studio Code - https://code.visualstudio.com
Git - https://git-scm.com/downloads

--- 
Support my channel:
💜 Join the Discord community 👨‍👩‍👧‍👦: https://discord.gg/fgbtN2a 
💜 One time donations via PayPal
Thank you! 🙏

---
Follow me on:
👉 Twitter: https://twitter.com/The_Nerdy_Dev
👉 Instagram: https://instagram.com/thenerdydev
How to integrate Cypress with Database in Azure Cloud for Test cases Execution
Tags: cypress, javascript, devops, testing
Published: 2022-06-26 12:18:33

Hi, 

Please  see my latest blog “How we can integrate Cypress with Azure DB”

https://www.linkedin.com/posts/kailashpathak_how-to-integrate-cypress-with-database-in-activity-6946790823761973248-RMT0?utm_source=linkedin_share&utm_medium=member_desktop_web
Bootstrap Framework lets start learn together
Tags: webdev, css, beginners, bootstrap
Published: 2022-06-26 11:58:53

Frameworks mean easy & quick results,
I started learning the Bootstrap framework created by the Twitter company.

In bootstrap we have 
✨ Layout
✨ Typography
✨ Form Layout
✨ Buttons
✨ Icon Fonts
✨ Navigation Menu
✨ Responsiveness 
✨ Pagination
       👉 From today I share bootstrap informative tweets,
So could you stay connected with me ☕?

👉 How to use Bootstrap CSS 
We can First, visit Bootstrap's official website 
link: https://getbootstrap.com
On which website First we see current version which is 5.2 
If you want to use previous version, you can

![bootstrap](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/czzf5g6gjknjgp0w8e15.png)

We can implement bootstrap files by CDN and also download source files of Css


![Cdn link of bootstrap](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0xxrmmrm8ffzhev4ryk4.png)

We always link a bootstrap file top & below write personal CSS file then we easily rewrite bootstrap classes and change css don't make any changes in the bootstrap file.


![vsCode img link order](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8dvjxwh0k7l5hrv2zwo2.png)
    [More in the next post stay connected](https://twitter.com/FairyWsr)
What is programming <>??
Tags: programming, webdev, computerscience, discuss
Published: 2022-06-26 11:09:52

### So what is programming </> ???

Let's assume you come across IT or computer science and you have learn it with zero knowledge of anything to do with a computer and obvious along the way you meet or rather you have to come across with the word programming. Do you question yourself what is this thing called programming, or do you just follow the crowd flow with the course till the end you finish the course and still have no idea of what programming in details is about!

So in simple terms programming is basically process of creating a set of instructions using codes that tells or instructs a computer, application or software programs how to perform.

### Is programming sweet??

Well it depends, I mean we all find ourselves doing programming. Some do it for fun, some do it for passion, some do it just because they have no second option or it's their second or last option. So saying programming is sweet would be unfair to the category of those that do it for fun, and not for passion and also those that they only do it just because they had no option.

### Can you still love programming with zero knowledge??

But ofcos yes but there's a catch here if you wanna learn to love programming with zero knowledge of what programming is or coding in other words then there must be passion involved.

Programming just requires passion and try and dig more about programming not just sit around and wait for everything to flow.

```javascript
I know all these information we can get when we google!!!!
```
Thanks for reading.
You can get more of this articles on https://melbite.com

This article was originally published on [melbite.com-what-is-programming](https://melbite.com/Immaculate-Muli/VO2ObqBtAXVBaJcLBM89) by _**Immaculate-Muli**_
Как установить MySql на домашнею ubuntu
Tags: ubuntu, mysql
Published: 2022-06-26 10:15:30

Не буду тянуть кота за яй...Хвост перейдем сразу к делу.
Для начала нужно обновить индекс пакетов ubuntu:

```
sudo apt update
sudo apt install mysql-server
```
Скипаем настройку потому, что она у нас будет стоять локально для наших проектов которым не нужна никакая защита.
Заходим в mysql панель.

```
sudo mysql
```
Для того, чтобы заходить в phpMyAdmin/Workbench и т.д. нам нужно поставить аутентификацию root с помощью mysql_native_password:

```
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
```
Ставить сложный пароль нету смысла ведь это ваш личный пк, советую поставить просто `root` дабы не забыть его.

Теперь пишем `FLUSH PRIVILEGES;`, чтобы сервер перезапустился и все вошло в действие. Выходим с помощью `exit`.

Чтобы войти опять в mysql нужно прописывать `mysql -u root -p` тут вводите свой пароль и все, теперь у вас есть доступ.