teleren/devto huggingface dataset:
Introduction to CRUD Functions with Procedural PHP...
Tags: webdev, php, programming, tutorial
Published: 2023-01-01 13:58:34

**CRUD** stands for **Create**, **Read**, **Update**, and **Delete**, and these are the four basic functions of persistent storage, such as databases. In the context of PHP, CRUD typically refers to the creation and management of websites or web applications that can create, read, update, and delete data stored in a database.

**Procedural PHP** is a programming style in which functions and code are organized into procedures, or blocks of code that perform a specific task. It is a simpler and more traditional style of programming compared to object-oriented programming, which organizes code into objects that can interact with one another.

Here is an introduction to CRUD functions using procedural PHP:

## Create

To create a new record in a database using PHP, you can use the **INSERT **statement. This statement takes a set of values and inserts them into a table in the database. For example:

```
$query = "INSERT INTO users (name, email) VALUES ('John', 'john@example.com')";
mysqli_query($connection, $query);

```

This will insert a new row into the users table with the values 'John' and 'john@example.com' for the name and email columns, respectively.

## Read

To read data from a database using PHP, you can use the **SELECT **statement. This statement retrieves data from a table in the database and returns it as a result set. For example:

```
$query = "SELECT * FROM users WHERE name='John'";
$result = mysqli_query($connection, $query);
while ($row = mysqli_fetch_assoc($result)) {
  echo $row['name'] . ': ' . $row['email'] . '<br>';
}

```
This will select all rows from the users table where the name column is 'John', and then it will loop through the result set and print out the name and email values for each row.

## Update

To update a record in a database using PHP, you can use the **UPDATE **statement. This statement modifies the values of a set of existing rows in a table. For example:

```
$query = "UPDATE users SET name='Jane' WHERE email='john@example.com'";
mysqli_query($connection, $query);

```

This will update all rows in the users table where the email column is 'john@example.com' and set the name column to 'Jane'.

## Delete

To delete a record from a database using PHP, you can use the **DELETE **statement. This statement removes a set of rows from a table. For example:

```
$query = "DELETE FROM users WHERE email='john@example.com'";
mysqli_query($connection, $query);

```

This will delete all rows from the users table where the email column is 'john@example.com'.

**Conclusion:**
This is just a brief introduction to **CRUD **functions using procedural **PHP**.

> There are many other details and considerations to keep in mind when working with databases in PHP, such as security, performance, and error handling.

You will be able to begin working with databases in your future PHP projects once you have learned these basic coding techniques.
Why transform:translate(-50%, -50%) to center element?
Tags: css, html, javascript, webdev
Published: 2023-01-01 13:48:34

Centering div or any element is the mostly asked question in CSS interviews. I am not going to write what are the different ways to achieve this. But, While I was doing this I observed that `transform:translateY(-50%, -50%)` is used. I was little curious and wanted to know what it is actually doing.

Here is what I observed:

centering any element includes parent and child elements where child element is centered w.r.t parent.  

```html

<div class="parent">
  <div class="child"></div>
</div>

```

```css
.parent {
    position: relative;
    border: 1px solid green;
    display: inline-block;
    padding: 25px;
  }

  .child {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
```

Without `transform: translate(-50%, -50%);`

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

Here parent div is circle and the child is number 1.

As we set top and left is 50% for child resulting in placing 50% from parent top and 50% from parent left. It will show like above because starting of child starts after 50%, 50% but to make it center we need to apply `transform: translate(-50%, -50%);`. **This moves the child element back up a distance of half of the height and width. As it will make child element matches exactly to the middle of parent.**

After adding `transform: translate(-50%, -50%);`

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


 Thanks,
[Vishwak](https://twitter.com/urstrulyvishwak)
Day 1/100 | Working on Rock Paper Scissors Challenge
Tags: beginners, codenewbie, 100daysofcode
Published: 2023-01-01 13:47:01

Day 1/100 

Today I worked on the Frontend Mentor Rock Paper Scissors Challenge. 

I have the game working, but struggling on the CSS. 
Watching some Youtube to learn how to do _those things_ properly.

Its been a good first day. 

**Code and live demo for current unfinished project**

Code:[ https://github.com/ofthewildfire/rockpaperscissorsfm](https://github.com/ofthewildfire/rockpaperscissorsfm)
Live site:[ https://ofthewildfire.github.io/rockpaperscissorsfm/](https://ofthewildfire.github.io/rockpaperscissorsfm/)
ImageView
Published: 2023-01-01 13:29:59

ImageView can be defined as an object that can display the images on the interface of the iOS applications. It is the instance of the UIImageView class, which inherits UIView.

**Create UIImage**
   
```
  UIImage(named:"a-lion.jpeg")!, Name:"Lion")
```
**create UIImageView**

```
DisplayView=UIImageView(image: modelList[indexPath.row].image)
        DisplayView.frame=CGRect(x: 100, y: 300, width: 200, height: 200)
        DisplayView.backgroundColor = .red
        DisplayView.clipsToBounds=true
        DisplayView.layer.borderWidth = 5
        DisplayView.layer.cornerRadius = 100
        view.addSubview(DisplayView)
```


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hfiim31dxfr6y4dwsn6z.png)
Working with distributed teams in a remote-first environment
Tags: distributedteams, remote, collab
Published: 2023-01-01 13:12:58

Working with a distributed team can be a rewarding and fulfilling experience, but it's not without its challenges. With the right tools and mindset, however, these challenges can be overcome and the benefits of working with a distributed team can be fully realized.

One of the main benefits of working with a distributed team is the ability to tap into a wider pool of talent. With team members located all over the world, you have the opportunity to assemble the best and brightest from different locations and time zones. This can lead to a more diverse and dynamic team that brings a variety of perspectives and experiences to the table.

Another benefit of working with a distributed team is the ability to be more flexible and responsive. With team members in different time zones, you can have someone working on a project at all hours of the day, which can be especially helpful when tight deadlines are involved. Additionally, being able to work from anywhere can be a huge advantage for team members who may have other commitments or simply prefer to work remotely.

Of course, working with a distributed team also comes with its own set of challenges. Communication is often cited as the biggest challenge, as it can be difficult to coordinate and collaborate with team members who are not in the same location. Time zone differences can also be a challenge, as it can be difficult to find a time that works for everyone to meet or have a video call.

To overcome these challenges, it's important to have the right tools in place. Communication tools like Slack, Teams, and Google Meet can make it easier for team members to stay in touch and collaborate in real-time. Project management tools like Asana and Trello can help team members stay organized and track the progress of their work. And tools like Google Docs and Dropbox can make it easy for team members to share and collaborate on documents and files.

In conclusion, working with a distributed team can be a rewarding and fulfilling experience that allows you to tap into a wider pool of talent and be more flexible and responsive. While there are challenges to be overcome, with the right tools and mindset, these challenges can be managed and the benefits of working with a distributed team can be fully realized.
I'm on the Honours List! 🎉
Tags: opensource, award, recognition, career
Published: 2023-01-01 13:06:04

Last year was certainly a rollercoaster for me - I got [a lot of good things done](https://dev.to/andypiper/what-ive-been-doing-in-2022-so-far-28ma), started a bunch of new projects, and made new connections... but then, [I got laid off](https://buttondown.email/andypiper/archive/andys-discoveries-and-musings-issue-8-advocate/) amid the turbulence that came with the new ownership of the company I was working at... so, it definitely had both ups and downs, highs and lows.

I'm excited to have been named in the [OpenUK New Years Honours List for 2023](https://openuk.uk/openuks-2023-new-years-honours-list/), alongside some _incredible_ folks from across the industry in the UK, as a top influencer in Open Technology. They even sent us each a nice medal to mark our recognition 🏅 

I'm surprised to receive the award, humbled to look at the other folks on the list that I'm in, and also, really inspired to contribute more in the coming year.

![A medal in a box, inscribed "OpenUK Generation Next Honouree 2023 - Andy Piper"](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lu9sib1n9jocjx72a8am.jpeg)

Happy 2023, friends! I wish you a productive and enjoyable year ahead.
Why To-Do List should be your first web-app
Tags: webdev, javascript, programming, beginners
Published: 2023-01-01 12:36:13

If you have just started to venture into the world of JavaScript projects, you must have come across a lot of tutorials that explain how to make a To-Do list app. The same can be said even if you are looking for beginner-friendly project ideas for either frontend or backend javascript framework\\library projects.

Based on my experiences (and mistakes) so far I would recommend that you start with a To-Do-List. A To-Do-List app is the most uncomplicated, straightforward, no-frills way to learn how CRUD operations are performed in the framework/library you are trying to learn. This is a good project to start with even if you are trying to become a fullstack developer.

# What are CRUD operations?

"CRUD" is an acronym for  
C - Create  
R - Read  
U - Update  
D - Delete.

CRUD operations form the basis of every web app whether it is the frontend or the backend.

In the next section, crud operations will be explained with real-life examples of a social media website

# Examples of CRUD operations in the frontend and backend

Let us suppose you are an avid reader of a social media platform. As soon as you decide to make a new post you are creating new content i.e. uploading either text or media. You are adding to the list of UI elements that render posts. Also, a POST request is sent to the backend to add media or text to the database. This is an example of the create operation.

When you decide to modify any post that you have made in the past you are changing either the text or the media rendered on your screen. As soon as you hit save a PUT request is made to the backend to edit the data in the database, this is an example of the update operation.

When you decide to take down a post, you delete an entry from the list of UI layouts that render the posts accompanied by a DELETE request to the backend which deletes the data from the database Thus we can say it is an example of delete operations.
10 Java Frameworks & Libraries
Tags: java, beginners, programming, tutorial
Published: 2023-01-01 12:30:00

## 1. Spring
Spring is a widely used Java framework that provides a comprehensive set of features for building applications and systems. Spring is particularly well-suited for building web applications and provides features such as dependency injection, data access, and web MVC.

## 2. Hibernate
Hibernate is a popular object-relational mapping (ORM) framework that makes it easier to work with databases in Java. Hibernate allows you to map Java objects to database tables and provides features such as caching, lazy loading, and transaction management.

## 3. Apache Commons
The Apache Commons project is a collection of widely used libraries for Java that provide a variety of utility functions and features. The Apache Commons libraries include libraries for tasks such as data manipulation, file handling, and mathematics.

## 4. Apache log4j
log4j is a popular logging library for Java that allows you to easily log messages and errors in your applications. log4j is highly configurable and can be used to send logs to various destinations, such as files, databases, and the console.

## 5. Google Guava
Google Guava is a collection of libraries for Java that provides a wide range of utility functions and features. Google Guava includes libraries for tasks such as data manipulation, caching, and concurrency.

{% embed https://youtu.be/svNSYW7CMI0 %}

## 6. Apache Spark
Apache Spark is a fast, in-memory data processing engine for large-scale data processing. Spark is well-suited for tasks such as batch processing, stream processing, and machine learning.

## 7. Apache Tomcat
Apache Tomcat is a widely used web server and servlet container that allows you to run Java web applications. Tomcat is lightweight and easy to use, making it a popular choice for developing and deploying Java web applications.

## 8. Mockito
Mockito is a popular testing library for Java that allows you to create mock objects for use in unit tests. Mockito makes it easy to write tests that are isolated from the rest of your code, allowing you to test individual components in isolation.

## 9. Apache Maven
Apache Maven is a build automation tool for Java projects. Maven allows you to manage dependencies, build, test, and package your applications, and is widely used in the Java ecosystem.

## 10. Junit
JUnit is a widely used testing framework for Java that allows you to easily write and run unit tests for your code. JUnit is simple to use and integrates well with other tools and frameworks.
How to Fill NA values in Pandas
Tags: help, python, pandas, beginners
Published: 2023-01-01 12:26:30

In the dataset, in the age column there are some NA values and I want to fill them like if Survived is 0, I want to fill it by mean of all Survived = 0 values and similarly if Survived is 1, I want to fill it by mean of all Survived = 1 values

I am trying to write:
df[df.Survived==1].Age.fillna(df[df.Survived==1].Age.mean(),inplace=True) 
but this is not working


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ws4xc9na6ke0v83ime5c.jpg)
On your mark
Published: 2023-01-01 12:16:01

get, set, go!
하이룽
**Bold 볼드체**
_Italic 이태릭_
[leeegit](https://github.com/leeegit)

# markup
## markup
### markup

> cite

`hello`

```
import pandas as pd
import numpy as np
import tensorflow as tf

print("Actually I'm in Semiconductor")
```
{% embed https://github.com/leeegit %}


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pqvm23sbn7fvpoi3t9ml.JPG)
How to fetch data using Axios in React
Tags: webdev, javascript, react, api
Published: 2023-01-01 11:35:46

I'm sure almost all Frontend developers at some point might encountered have a need to fetch some data from an API to display on the UI, and today i will be teaching you how to do that in a React Application and we will be using a popular Javascript library called Axios. 


Axios is a popular library for making HTTP requests in JavaScript. It's often used with React to fetch data from an API and populate a website with the fetched data. Here's a brief tutorial on how to use Axios to fetch data in a React app

- First, you'll need to install Axios in your React project. You can do this by running the following command in your terminal:

Using npm:
```
$ npm install axios 
```

Using yarn:

```
$ yarn add axios 
```

- Next, you'll need to import Axios into your React component. You can do this by adding the following line to the top of your file:

```
import axios from 'axios';
```

- Now you can use Axios to make HTTP requests from your React component. Here's an example of how to fetch data from an API using Axios:

```
axios.get('https://my-api.com/endpoint')
  .then(response => {
    // handle success
    console.log(response.data);
  })
  .catch(error => {
    // handle error
    console.log(error);
  });
```

- In the example above, we're using the _**GET**_ method to send a GET request to the specified endpoint. You can also use Axios to send POST, PUT, and DELETE requests. 
 
- Once you've received the data from the API, you can use it to update the state of your React component. Here's an example of how to do this:

```
class MyComponent extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      data: []
    };
  }

  componentDidMount() {
    axios.get('https://my-api.com/endpoint')
      .then(response => {
        this.setState({ data: response.data });
      })
      .catch(error => {
        console.log(error);
      });
  }

  render() {
    return (
      <div>
        {this.state.data.map(item => (
          <div key={item.id}>{item.name}</div>
        ))}
      </div>
    );
  }
}
```
- In the example above, we're using the componentDidMount lifecycle method to make the API request when the component is mounted. The data that we receive from the API is then stored in the component's state, which we can access using this.state.data. Finally, we use the map function to iterate over the data and render a list of items.

I hope this helps! Let me know if you have any questions.
Learn Test Driven Development With Django Part 15 - User Profile Creation
Tags: django, testing, python, webdev
Published: 2023-01-01 11:28:37

In this video, we will build a user profile page using Django and test-driven development. We will explore one to one relationships and signals in Django, and integrate these features into our application. By the end of the video, you will have a better understanding of these concepts and how to use them in your own Django projects.

{%youtube xTK_xfgAdf4%}
Connect GCP Compute Engine Via SSH Termius
Tags: googlecloud, webdev, beginners, programming
Published: 2023-01-01 11:26:15

To connect to a Google Cloud Platform (GCP) Compute Engine instance using SSH and Termius, you will need to follow these steps:

## Steps to Generate and Register SSH Key 

### Generate an SSH key pair on your local machine.

```bash
ssh-keygen -t rsa -f ~/.ssh/KEY_FILENAME -C USERNAME -b 2048
```

   - KEY_FILENAME: This is the name of the SSH key pair. You can use any name you want, but it is recommended that you use a name that is unique to the Compute Engine instance you are connecting to.

   - USERNAME: This is the username you want to use to log in to the Compute Engine instance.

   - The default location for the SSH key pair is ~/.ssh. If you would like to change the location, you can use the -d option.

   - The default size for the SSH key pair is 2048 bits. If you would like to change the size, you can use the -b option.

### Register your Public Key to Compute Engine Instance

1. Copy the public key to the clipboard by running the following command:

```bash
cat ~/.ssh/id_rsa.pub
```

2. Navigate to the "Metadata" section of the Compute Engine instance in the GCP Console.
3. Click the "Edit" button.
4. Click the "SSH Keys" tab.
5. Click the "Add Item" button.
6. Paste the public key into the "Key" field.
7. Click the "Save" button.
    
![Add public key](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/93naqou6zllm5rfd9ph1.png)

## Steps to Connect to Compute Engine Instance

1. Open Termius on your local machine.
2. In the Termius dashboard, click the "Add Host" button.
3. In the "Add Host" window, enter the following information:
    
    ![Add Host](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q9plb00zai24dl3jyqld.png)
    - Address: This should be the external IP address of your Compute Engine instance. You can find the external IP address in the GCP Console by navigating to the "Networking" section and clicking on the "External IP addresses" tab.
    - Port: The default SSH port is 22, so you can leave this field set to 22 unless you have changed the default port for your instance.
    - Username: This should be the username you want to use to log in to the Compute Engine instance.
    - Set a Key: Use the private key from ssh key we generated previously.

4. Click the "Save" button in the "Add Host" window.

5. Click the "Connect" button next to the host you just created.

6. You should now be connected to the Compute Engine instance.

Note: If you are having trouble connecting to your Compute Engine instance, make sure that the firewall rules for the instance allow incoming connections on port 22 (the default SSH port) and that the instance has a public IP address. You can also check the logs for the instance in the GCP Console to see if there are any error messages that can help troubleshoot the issue.
Learn Test Driven Development With Django Part 14 Protecting Views with the Login Required Decorator
Tags: django, python, webdev, testing
Published: 2023-01-01 11:25:29

In this video, we explore how to use the login-required view in Django to protect certain views from being accessed by unauthorized users. We'll walk through an example of implementing this feature in a Django application using Test Driven Development (TDD). This is the latest video in our series on TDD with Django, where we cover best practices and techniques for building reliable and maintainable web applications. Whether you're a beginner or an experienced developer, this video is sure to have something for you. Stay tuned for more content on this topic and other web development topics in the future.
{%youtube 0hK1cfRzPLA%}
100 Days Of Cloud
Tags: aws, cloud, awscommunity, 100daysofcloud
Published: 2023-01-01 11:23:19

[1/100] #100DaysOfCloud Today, all I did was copy the 100DaysOfCLoud journey template and set up my own GitHub repo, make a few changes and I'm ready to start strong tomorrow!

[GitHub](https://github.com/aaditunni/100DaysOfCloud)
Learn Test Driven Development With Django Part 13 Styling with Bootstrap And Crispy Forms
Tags: django, python, webdev, testing
Published: 2023-01-01 11:22:29

In this video, we'll be styling our Django application using Bootstrap, Django crispy forms, and Django. First, we'll install the Bootstrap library and integrate it into our Django project. Then, we'll use Bootstrap's styles and components, along with Django crispy forms, to give our application a professional and modern look. Finally, we'll customize the styles to fit the specific needs of our project.

{%youtube XpPFrSpcgGo%}