teleren/devto huggingface dataset:
Best Python Resources Available On The Internet in 2021
Tags: python, computerscience, devops, machinelearning
Published: 2021-06-28 17:51:17

(#python #programming #language #coding #learning #education)

https://medium.com/analytics-vidhya/best-python-resources-available-on-the-internet-in-2020-3f6204c9ab0e

Python is an interpreted, high-level and general-purpose programming language. Python’s design philosophy emphasizes code readability with its notable use of significant whitespace.

In today’s article, we will talk about 6 of the best open-source Python Resources available online to get you started with this fantastic tool.

Just a basic one but really helpful for beginners new to this programming environment.
MySQL database management using the terminal
Tags: mysql, terminal, cheatsheet
Published: 2021-06-28 17:42:42

To log in to MySQL server via terminal, use login credentials and hostname.

```bash
mysql -h localhost -u username -p
```
MySQL server will prompt for the password. The `-h` hostname flag is optional use only when the host is different from the default value `localhost`.

Once logged in, you can run any SQL query in the MySQL console. However, select the database first.
```sql
show databases;
```

The above command will display a list of all databases. Run the `use` command to select a database.

```shell
use database_name;
```
Now you can run any `SELECT`, `UPDATE`, `DELETE` query on the table. You can `CREATE` and `DROP` the tables.

To see the list of all tables, run this command.
```sql
show tables;
```

Describe table command shows the columns and their attributes like names, data types, collation, primary key, index nullability.

```sql
describe table_name;
DESC table_name;
```

Similarly, describe user command displays user details and privileges.
```sql
describe user_name;
```

### Things to remember in MySQL command-line 
Before moving to the user and database creation command, there are a few things to remember.
- Use a terminator`;` after every query.
- For a multi-line query, hit enter to go to the new line.
- To clear the SQL query without running it, use the clear `\c` flag.
- To get more help, use the help `\h` flag.
- To exit from MySQL, use the quit `\q` flag.

### Root user VS non-root user

The MySQL root user has full access to the database server. Using root can seriously mess things up or delete critical stuff on the server without even warnings. It would be insecure to access MySQL as a root user from a website.

To create a non-root new MySQL user and give it only needed privileges and access to a database, follow these steps.

**1. Create a new MySQL user**

Create a new MySQL user with a password.
```sql
CREATE USER 'new_user'@'localhost' IDENTIFIED BY 'user_password';
```
**2. Grant Database access to new user**

```bash
GRANT ALL ON new_database.* TO 'new_user'@'localhost';
```
**3. Reload MySQL privileges**

To activate newly assigned privileges run
```bash
FLUSH PRIVILEGES;
```
To give privileges to a table only, use `database.table_name` notation. To see the `privileges` of new user run,
```bash
SHOW GRANTS FOR 'new_user'@'localhost'
```

**Create a new MySQL Database**

Log into MySQL shell using your credentials and run the following command to create a new database. 

```sql
create database new_database;
```
The Myth of 10x Programmer Productivity
Tags: programming, productivity, developers
Published: 2021-06-28 17:37:29

Study published by William Nichols at the Software Engineering Institute, Carnegie Mellon University challenges the myth that elite Programmers are inherently more productive than the average ones.

👏 In most cases the difference between good and great Programmers isn’t as dramatic as you might think! 

https://ieeexplore.ieee.org/document/8804291
Kubernetes underlying infra monitor
Tags: kubernetes, docker, monitoring
Published: 2021-06-28 17:32:53

Recently I followed a tutorial on Kubernetes. That time I realized the Kubernetes also runs on the physical infra.
When I was doing some homework, I found that there are much tools to monitor the states of the containers in the Kube. Cluster. When a container becomes unhealthy it can be easily monitored. 
Little while ago, I was searching for the network monitoring tools to monitor my Raspberry Pi based infra. Found several tools including PRTG Monitor and Zabbix. When I was doing some deeper research on the tools found that the PRTG monitor free tier exceeds after adding 100 sensors or devices. 
Then I focused on the Zabbix. Zabbix is an opensource network monitoring tools which uses the agent architecture to monitor the devices. I was bit trouble to install the Zabbix since it has several parts 
* Server 
* Frontend (Apache or Nginx)
* Java Gateway 
* database server (MySQL or Postgres).
However I managed to install the Postgres DB based Zabbix version. Also I came up with a docker compose file for those installation.
```
version: "3"
services:
    pgsql-server:
        image: postgres:latest
        ports: 
            - "5434:5432"
        environment:
            - POSTGRES_USER=root
            - POSTGRES_PASSWORD=password
            - APP_DB_USER=zabix
            - APP_DB_PASS=zabix
            - APP_DB_NAME=zabix

    zabix-server:
        image: zabbix/zabbix-server-pgsql
        environment:
            - DB_SERVER_HOST=pgsql-server
            - POSTGRES_USER=root
            - POSTGRES_PASSWORD=password
        ports: 
            - "10051:10051"

    zabix-frontend:
        image: zabbix/zabbix-web-nginx-pgsql
        environment: 
            - DB_SERVER_HOST=pgsql-server
            - POSTGRES_USER=root
            - POSTGRES_PASSWORD=password
            - ZBX_SERVER_HOST="zabix-server"
            - PHP_TZ=Asia/Colombo
        links: 
            - pgsql-server:postgres
        ports: 
            - "80:8080"


    zabix-java-gateway:
        image: zabbix/zabbix-java-gateway
        links: 
            - zabix-server:zabbix-server
```

So, my theory is that we can use Zabbix to monitor the underlying infra in a Kube. cluster. 
Highly appreciate your thoughts on this since I'm a rookie to the DevOps.
10 Linux Commands For Beginners
Tags: linux
Published: 2021-06-28 17:17:34

> Note: If there is a command ls then you need to only type `ls` but not to type `Ls`.   Linux and Unix Commands are case-sensitive..

### 1. pwd
**pwd is a command that shows you the path where you are currently is.**


### 2. ls
**ls is a command that shows you the list of directories or files in the current directory.**

### 3. cd
**cd command lets you change the directory.**

***Usage*** `cd [Directory name]`

### 4. cat 
**cat command lets you see the content of the file.**

***Usage*** `cat [File name]`

### 5. mkdir
**mkdir command lets make a new directory in the current directory.**
***Usage*** `mkdir [Directory name (You wanna give it to]`

### 6. rmdir
**rmdir command lets you delete a directory.**

***Usage*** `rmdir [Directory name]`

### 7. touch
**touch command lets you create a new file.**

***Usage*** `touch [File name (You wanna give it to]`

### 8. uname
**The uname command, short for Unix Name, will print detailed information about your Linux system like the machine name, operating system, kernel, and so on.**

### 9. history
**history command shows you the history of your commands that you typed so far.**

### 10. man
**man command lets you see the manual of any command.**

***Usage*** `man [command]`
Today I Learn About CSS Position Property
Tags: css, webdev, html
Published: 2021-06-28 17:04:27

By using CSS `position` property, we can set the position of the document element.

Below are the property value. We can use any of the mentioned values for an element. 

For setting  a specific location to the element we have to use offset (`top`, `left`, `bottom`, `right`) property with the position property. This four property will set the exact location of the element.

```css
{
    position: static;
    position: relative;
    position: absolute;
    position: fixed;
    position: sticky;
}
```

Let's determine the position property one by one.

## Static
This is the default value of an HTML document. If we set any element position to static (we don't need to), we will not get any effect. The offset (`top`, `left`, `bottom`, `right`) property also has no effect with static position.

Let's try a CSS code.

{% codepen https://codepen.io/prosenghosh25/pen/OJmLaEa %}

From the above snippet we can see that the static box has no effect. We used the property value to `100px` left, but it didn't move from its default position.

## Relative

Relative property works on the normal flow of an HTML document unless we set the offset of the element using (`top`, `left`, `bottom`, `right`). The offset will change the position of the element from the default position of that elelement. 

Setting offset property for that element does not affect the position of any other elements;


{% codepen https://codepen.io/prosenghosh25/pen/LYyPMYd %}

## Absolute
When the document position set to absolute then the element removed from the normal document flow. 

No space is created for the element in the page layout. It is positioned to its closest ancestor unless we set the offset value for that element using (`top`, `left`, `bottom`, `right`).

{% codepen https://codepen.io/prosenghosh25/pen/eYWObLy %}

Uncomment the offset property of the `.absolute` class and see the effect in action for the absolute position.

We can see that the absolute box element does not take any space from the container layout it sit over the static box element. We can set the location if the absolute box layout by setting the offset value.

## Fixed

When the document position set to fixed, then the element removed from the normal document flow. 

No space is created for the element in the page layout. It is positioned relative to the initial containing block established by the viewport, unless we set the offset value for that element using (`top`, `left`, `bottom`, `right`).

{% codepen https://codepen.io/prosenghosh25/pen/MWmgZLO %}

Uncomment the offset property from `.fixed` class and scroll down the page then we will see that the fixed box not going to scroll up it is sitting the exact position. 

## Sticky
Sticky position property works on the normal flow of an HTML document and then offsets relative to its nearest scrolling ancestor and containing block. The offset does not affect the position of any other elements.

{% codepen https://codepen.io/prosenghosh25/pen/ZEKzVgx %}

See the above code example.

> That's for today. We will continue tomorrow. Happy Coding 🎉.
CSS :placeholder-shown
Tags: javascript, webdev, css
Published: 2021-06-28 17:03:13

---
title: CSS :placeholder-shown
published: true
tags: javascript, webdev, css
cover_image: https://res.cloudinary.com/dzynqn10l/image/upload/v1631846510/JS%20Bits/css_placeholder_shown_aiwjjx.webp
---

The `:placeholder-shown` pseudo-class represents any `<input>` or `<textarea>` element that is displaying placeholder text.

With this rule, we can do this type of styling that would otherwise require the aid of JavaScript:
<img src="https://res.cloudinary.com/dzynqn10l/image/upload/v1624899200/JS%20Bits/placeholder-shown_itx2fy.gif" alt="placeholder-shown" />

```html
<input name="food" placeholder=" " />
<label for="food">Favorite food</label>
```

```js
const input = document.querySelector('input');

input.addEventListener('focus', () => {
  // Add parent class to move label above input
});

input.addEventListener('blur', () => {
  // Check if input has value
  // Remove parent class to reset label
});
```

But instead of all this overhead, we can leverage the `:focus` and `:placeholder-shown` CSS rules:

```css
input:focus + label,
input:not(:placeholder-shown) + label {
  top: 14px;
  left: 6px;
  font-size: 12px;
  color: #fff;
}
```

Here we check if the input has focus OR if it does *not* have the placeholder shown (meaning there *is* a text value). If either of these states apply, we have the label float to the top left. 

A hell of a lot easier than JS event handlers! 😉

### Here's a video using this in action:
<a href="https://www.tiktok.com/@js_bits/video/6978841329723870469?lang=en&is_copy_url=1&is_from_webapp=v1" target="_blank">
  <img src="https://res.cloudinary.com/dzynqn10l/image/upload/v1631846510/JS%20Bits/css_placeholder_shown_aiwjjx.webp" alt="CSS placeholder-shown" width ="190" />
</a>

----------
Check out more #JSBits at my blog, [jsbits-yo.com](http://jsbits-yo.com/). Or follow me on [Twitter](https://twitter.com/JS_Bits_Bill) and [TikTok](https://www.tiktok.com/@js_bits?lang=en).
What Is the Best Thing About Learning to Code?
Tags: discuss, coding, codenewbie
Published: 2021-06-28 16:35:52

One of the best things about learning to code is that it helps me learn and practice problem-solving skills. It helps me think about problems from a high level, break them down into smaller pieces, and address each piece once at a time. 

What is the best thing about learning to code, in your opinion?
Ensuring Code Quality that Fits Your Business w/ Erika Chestnut of Calendly
Tags: qualityassurance, scalingup, codequality, teamculture
Published: 2021-06-28 16:24:22

Modern businesses run on code - and ensuring code quality is crucial to success.

To get the inside scoop on Quality Assurance (QA), [Dev Interrupted](https://devinterrupted.com/podcast/ensuring-quality-code-that-fits-your-business/) host Dan Lines talks with Erika Chestnut, Head of QA at Calendly about what you need to do to set up QA that works for your business needs, how to socialize the right values for your team, what not to do, and how to adapt these processes when necessary.

#**Listen to the full episode**
{% spotify spotify:episode:2W08rB4cqXvopdMDqWv1X1 %}

#**Episode Highlights include:**
* How to decide your QA strategy
* What Calendly's team culture does to ensure quality code
* Why QA and business goals have to be aligned
* Pitfalls to avoid when [scaling up an engineering organization](https://linearb.io/how-to-intelligently-scale-your-software-team/) - and in instituting QA at your org


#**Join the Dev Interrupted Discord Server**
With over 1200 members, the Dev Interrupted Discord Community is the best place for Engineering Leaders to engage in daily conversation. No sales people allowed. [Join the community >>](https://discord.gg/tpkmwM6c3g)
![Join the Dev Interrupted Discord Community!](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/19j3dzgz4r4kzav3w6z8.png)
Challenges Facing New Web Developers 

Tags: webdevelopmentcodinglearning
Published: 2021-06-28 16:21:14

As a newbie web developer, I have faced numerous challenges in my journey of learning web development. Web development is a skill that is not common; hence it requires consistent effort and pragmatism.

From my experience, I have noted some recurring problems and challenges.

1. Lack of Universal Topics

There are so many schools of thought on what is the best approach to learning web development. In addition, there are many upcoming and emerging Technologies that add more confusion to a newbie period for rentals. There are many frameworks such as good boo and react just name of you.

2. Lack of Mentors

Due to the nature of web development, most developers work as employees, contractors freelancers. As a result, the experience or seen developers cannot help or guide newbies during their early times of learning. Moreover, the disconnect between the expert developer and a newbie is excabated by inefficient communication.

3. Distractions

The internet is offering a whole universe of entertainment education and some other material between the two. Thus it is very tempting for a newbie to look for entertainment at the expense of education. For example, it is easy to serve or scroll the Facebook feeds instead of practicing coding while online.

4. Coast of Learning

Here we are talking about cost in terms of time and money. Learning web development requires a lot of time and some money. For example, for a newbie to master any language necessary for web development, they must spend considerable time studying the material and practicing. On the other hand, getting relevant material from the internet will require some investment in money.

Conclusion

As a newbie, it is essential to note that these challenges are valid depending on your location, age, ambition, and, most importantly, drive. As you have seen, most of these challenges can be overcome as it is the responsibility of a newbie to understand that mastering web development is not a walk in the park.
Quick Introduction to header files in C++
Tags: cpp, programming, tutorial, headerfiles
Published: 2021-06-28 16:19:09

Using a variable (or function or a class and so on) without declaring it, is an error in C++; more specifically, this error:

```
In function 'int main()':
error: 'x' was not declared in this scope
  x = 2;
  ^
[ERROR in Compilation]
```

which means, it is important to declare an element before using it or assigning it a value, in C++.

(The word `element` refers to functions, classes, structs, variables etc throughout this article.)

We might end up declaring and defining various `elements` repeatedly in our different `C++` programs if they're useful in varied cases. This would result in a lot of code repetition throughout our code-base; and making one change in an `element` would result in copying the same change over and over again in different files.

**sounds scary !**

Therefore, it makes sense to declare and define commonly used `elements` that are predicted to be of use often before hand and use them later without worrying about their declaration. To keep our code modular, it fits to combine such 'utility' `elements` in one single file and keep importing it in other `c++` programs. 

Enter `header files`; these are declarations and definitions of various `elements` which are ready to be used in a `c++` program. Header files have a `.h` extension instead of a `.cpp` one; this tells everyone that `my_file.h` is a header file that contains declarations and definitions of various 'utility' `elements`. A header file can than be included in a `cpp` program as such :

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

Want to write good a header file? Keep the following points in mind while writing one :

1. Do not bring complete `namespaces` into scope with the `using` directive (read more about `using` [here](https://dev.to/guptaaastha/quick-introduction-to-using-in-c-4n73)) as this might conflict with other `elements` present in the file where this header is being `included` into.

2. Use `const` variable definitions to make sure a program `including` this header file cannot change it.

3. Use `inline` function definitions and named `namespaces`.

Standard library header files enable various useful functionalities in our C++ programs. Moreover, we can write our own header files to make our code-base modular and thus, more understandable.

This article was a short introduction and if you want to know more about various header files in C++, I encourage you to head over [here](https://en.cppreference.com/w/cpp/header).

Thanks for giving this article a read and I'll see you in the next one 😄

>PS: This is an article in my series Quick Introduction to a concept in C++. You can find all the articles in this series [here](https://dev.to/guptaaastha/quick-introduction-to-a-concept-in-c-15n6).
Add an input field in Angular
Published: 2021-06-28 15:50:45

Lets walk through adding a simple input form to an Angular application.
To get started we need to import Reactive Forms module into our NG module.  We can open our app.module.ts file and add the following.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b4fn4b9xxxs3d0yai1ug.JPG)

While we are in this file we can also update our imports array.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/suxsuedv65im3pcz5435.JPG)

Now lets jump over to the component that we would like to add the form to.  We will first need to import FormBuilder from angular/forms.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l5lioft2xsvxc0k9n1yg.JPG)
Then build a model on our component.
We need to add a property to our class that will represent that model in the Reactive form. Let’s name it todo form.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d8hqhy4780d6i3m93sjf.JPG)

Now jump down to the constructor and we can add something that Reactive Forms provides us called form building. We can add private FormBuilder, and that's going to be of the type FormBuilder.  We will also need to define a group of controls for our form.

Next we add this.todoForm  equal to this.formBuilder.group. Next we add an object, title and set it to an empty string.  
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dx0nwhqwy4uaozyw68cv.JPG)
Now that we have our model set up, we can start to work on template in our template HTML. We are going to create a basic form with a text input to add a new todo and a submit button. 

Just a few remaining steps.  Our reactive form needs to be bound to a form group. We can also pass in our existing todoForm.
 We also need to bind our text field to the title field. 
Next we need to bind to the submit event of the form using an Angular event called ngSubmit and pass in a function.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/48bmkb85rp1s2g7n0zjs.JPG)
Define our function and push our new todo to the array.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jecti1escbz84qzvwtc5.JPG)

And that's it.  You've just created a reactive form in Angular.
Day 125
Tags: 100daysofcode, programming
Published: 2021-06-28 15:43:51

Day 125/200 of #200DaysOfCode #100DaysOfCode  

- Solved five problems on Codewars.

1 - Replicate `new` (5 kyu)
2 - Merged Objects. (6 kyu)
3 - Mirror object - tcejbo rorriM (6 kyu)
4 - Shopping List (6 kyu)
5 - TV channels (6 kyu)