teleren/devto huggingface dataset:
Preventing SQL Injection in PHP: A Comprehensive Guide
Tags: webdev, javascript, beginners, learning
Published: 2023-08-28 17:51:20

SQL injection is a serious security vulnerability that can compromise your database and expose sensitive information. In this comprehensive guide, we'll delve into the intricacies of SQL injection, understand the risks, and explore proven techniques to prevent it in PHP. Brace yourself for an enlightening journey through code examples and best practices.

Understanding SQL Injection:

SQL injection occurs when malicious SQL queries are injected into user inputs, tricking the database into executing unintended actions. This can lead to unauthorized data access or even data manipulation.

**1. Prepared Statements:**

Using prepared statements is one of the most effective ways to prevent SQL injection. It involves separating the SQL query from the user input.

```
// Using prepared statements
$statement = $connection->prepare("SELECT * FROM users WHERE username = ?");
$statement->bind_param("s", $username);
$statement->execute();
$result = $statement->get_result();
```

**2. Parameterized Queries:**

```
// Using parameterized queries
$username = $_POST['username'];
$sql = "SELECT * FROM users WHERE username = ?";
$result = $connection->query($sql, [$username]);
```

**3. Escaping User Inputs:**

Sanitize and escape user inputs before using them in SQL queries.

```
$username = mysqli_real_escape_string($connection, $_POST['username']);
$password = mysqli_real_escape_string($connection, $_POST['password']);
$sql = "SELECT * FROM users WHERE username='$username' AND password='$password'";
$result = $connection->query($sql);
```

**4. Use Prepared Statements for Dynamic Queries:**

```
// Using prepared statements for dynamic queries
$sql = "SELECT * FROM $tableName WHERE column = ?";
$statement = $connection->prepare($sql);
$statement->bind_param("s", $value);
$statement->execute();
$result = $statement->get_result();
```

**Best Practices:**

`Never Trust User Input:` Always sanitize and validate user inputs before using them in queries.

`Use Parameterized Queries: `Prepared statements and parameterized queries prevent SQL injection by design.

`Limit Database Permissions: `Ensure your application's database user has only the necessary permissions.

`Conclusion:`

Preventing SQL injection is a critical responsibility of any PHP developer. By mastering techniques like prepared statements, parameterized queries, and input validation, you can safeguard your application's integrity and protect user data.

`LinkedIn Account` : [LinkedIn](https://www.linkedin.com/in/matthew-odumosu/)
`Twitter Account `: [Twitter](https://twitter.com/iamcymentho)
**Credit**: Graphics sourced from [malware](https://www.malcare.com/blog/preventing-sql-injections/)
Say Hello to Frogment: Your Ultimate Browser-Based OpenAPI Spec Editor! 🚀
Tags: webdev, api
Published: 2023-08-28 17:10:33

Hey there, awesome Dev.to community!

Have you ever found yourself tangled up in a giant OpenAPI spec, desperately wishing for a tool that could simplify the whole editing process? Well, guess what? Your wish has just been granted! Allow me to introduce you to Frogment – the FREE, browser-based OpenAPI spec editor that's about to change your game!

🔗 Website: [https://www.frogment.com](https://www.frogment.com)

Why Choose Frogment?
We've all been there. Facing a massive OpenAPI spec, trying to make sense of it all. Existing tools often fall short, leaving us yearning for something better. And that's exactly why I created Frogment.

Meet Frogment: Your New Superpower
After 7 days of relentless effort, I'm thrilled to bring you Frogment – an ingenious tool built to turn OpenAPI spec editing into a delightful experience. Here's what it brings to the table:

✨ Outstanding Features:

👉 Totally Free: No catches, no fine print. Frogment is here to empower developers without costing a penny.

👉 Three Panes, Zero Hassle: Forget about constantly switching tabs. With Frogment's three-pane layout, working on multiple sections becomes a breeze.

👉 Embrace Multiple Spaces: Keep your projects organized by creating different spaces for different tasks or versions.

👉 Realtime Linting, Lightning-Fast: Instantly spot errors with Frogment's real-time linting feature. Syntax issues, be gone!

👉 Stay DRY with Code Blocks: Introducing code_blocks – a brilliant concept to keep your spec DRY (Don't Repeat Yourself). Detailed documentation coming soon!

👉 Auto Complete Search: Say goodbye to tedious schema searches. Frogment's smart auto-complete search streamlines the process.

Ready to Dive In?

---

Visit Our Website: [https://www.frogment.com](https://www.frogment.com)

Sign Up: Not required.

Unleash the Magic: Experience the transformational power of Frogment as you conquer those daunting OpenAPI specs like a pro.

Frogment isn't just a tool; it's your ally in the journey of API development. Be part of the movement that's elevating the way we tackle OpenAPI specs.

I'm thrilled to bring Frogment to this amazing community. Questions, thoughts, and feedback? Feel free to share – let's redefine the OpenAPI spec editing experience together!
Java - 📏 Measuring Up `size()`- Doubly Linked List 📖
Tags: java, computerscience, dsa, doublylinkedlist
Published: 2023-08-28 16:37:06

Hey Dev.to folks! 👋

Want to know how many nodes are in your doubly linked list? Look no further: here comes the `size()` method.

### 📘 Quick Doubly Linked List Recap:

Here’s our foundational setup:

```java
class Node {
    int data;
    Node next;
    Node prev;

    // Constructor to initialize the node
    Node(int data) {
        this.data = data;
        this.next = null;
        this.prev = null;
    }
}

class DoublyLinkedList {
    Node head;
    Node tail;

    // Constructor to initialize the doubly linked list
    DoublyLinkedList() {
        this.head = null;
        this.tail = null;
    }
}
```

Remember, in a doubly linked list, each node knows about its next and previous node. 🔄

### 🧮 Breaking Down `size()`:

Let's get counting:

```java
public int size() {
    int count = 0;          // Initialize the counter to zero
    Node current = head;    // Start at the beginning of the list

    while (current != null) {
        count++;            // Increase the counter for each node
        current = current.next; // Move to the next node in the list
    }

    return count;           // Return the total number of nodes
}
```

The gist is simple: start at the head, traverse the list, and count each node until you reach the end.

### 🔍 Why `size()` Matters:

Knowing the size of your list can be essential, especially when you're adding, removing, or accessing elements.

### 🎉 In Conclusion:

The `size()` method is a basic but essential tool for managing a doubly linked list. 🚀

In [the next article](https://dev.to/hunorvadaszperhat/java-checking-out-if-empty-with-isempty-doubly-linked-list-4k15) we will look at `isEmpty()` method


Cheers and happy coding! 🚀
How to Install and Configure Kerberos on Windows 10
Tags: kerberos, tutorial, cybersecurity, security
Published: 2023-08-28 16:23:57

Cybercrime is an unfortunate part of reality which most of have been victim to in one way or another. As a developer or cyber security specialist, it is important to keep yourself up-to-date and aware of measures you can take to prevent or reduce cyber threats to you applications.

Kerberos can be a great starting point.

Kerberos is a computer network security protocol that authenticates service requests between two or more trusted hosts across an untrusted network, like the internet. It uses secret key cryptography and third party authentication for authenticating client-server applications and verifying users' identities.

In this blog, I will show you how to install and configure Kerberos on your system.

## Installation
1. Head over to this [site](https://www.secure-endpoints.com/netidmgr/v2/#download) and navigate to the "**Downloads**" section
2. Click on the 64-bit version to download: "**Network Identity Manager 2.5.0.106 (64-bit MSI)**".
3. Once the download is done, open up the installer and select the "**Typical**" installation option.
4. Now access this [site](https://www.secure-endpoints.com/heimdal/#download) and once again navigate to the "**Downloads**" section.
5. Click on "**Heimdal 7.4.0 (64-bit and 32-bit)**" to download.
6. Once it is finished downloading, open the installer and follow the default installation steps.
7. Once everything has been installed, restart your computer.

## Configuration
Follow these steps to get your own valid Kerberos ticket.
1. Open your Start menu and search for "**Network Identity Manager**".
2. Open the application and right-click on "**My Keystore**" and then "**Obtain new credentials**".
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c8y77n6rprqd7vhsytls.png)
3. Enter in a username and default realm.
4. Enter your system's password.
5. (Optional) Set up your Keystore.
Segundo dia de projeto base Spring
Tags: java, springboot, maven, webdev
Published: 2023-08-28 16:22:20

## Introdução
Neste dia eu criei as pastas de controller, entity e service para separar a lógica no código 

## Aprendizado

- Aprendi sobre:

Como funciona as pastas e como usar o getter and Setter e como chamar um objeto usando o  @Autowired 
 

### - Código:

[controller/GeradorDeSalarios.java](https://github.com/chrisdebugger/projectSpring/blob/main/src/main/java/com/example/projectspring/controller/GeradorDeSalarios.java) 

[entity/Salarios.java](https://github.com/chrisdebugger/projectSpring/blob/main/src/main/java/com/example/projectspring/entity/Salarios.java)

[service/Salario.java](https://github.com/chrisdebugger/projectSpring/blob/main/src/main/java/com/example/projectspring/service/Salario.java)

## Dica do dia:
Siga em frente mesmo que esteja difícil pois na hora que a oportunidade aparecer você estará pronto para agarra-la.
Built this web app
Tags: javascript, webdev, career, programming
Published: 2023-08-28 16:17:23

Hello everyone Abdur here, I built this web app using vanilla JS recently. All the pages and page elements are called by using JavaScript functions.
I was learning React JS recently.
Which is the best web framework🤔? 

Give it a try by clicking here :[The App link](https://abdurrohit.github.io/ShopApp/)

[GitHub repository](https://github.com/AbdurRohit/ShopApp)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/21u268w9l3g42z1eb2j3.png)
Diversity and Inclusivity in the Hiring Process
Tags: tellmeaboutyourself, job, journey, thoughts
Published: 2023-08-28 16:16:26

Not too simple, Not too scripted, just on point , how less personal or how much formal . You are never sure what is expected of you. I feel we get lost in the process of preparation and become unaware of what to de say in the time. I wonder what if interviews could be more like discussions than stressing other person's out. While there are jobs that require high stress management but assessment performance under stress has went too far in hiring process now adays. It can negatively impact someone's abilities to outperform especially person with certain disability.  How can we ensure diversity and inclusivity with assuming accomodating requests? I recently had interviews with a very reputable organzation that has no inclusivity practices in their hirirng process. I suffer from an autoimmune disease which affects my speech and cognition (brain fog) when i have high flares. I feel misunderstood or stupid at time when words get mixed or i can't evenn form a sentence. Though it is challanging but i have abilities to work and i have skills with continous passion to grow and learn. I would continue to advocate for diversity and inclusivity in workspace. I hope better days will follow.✌🏼
1.what is software testing, what we need to know about software testing and what is the relevance of software testing?
Published: 2023-08-28 16:02:12

1.software testing is whether check the software is working properly, before that deployment complete check with client expected results 
2.software testing important of find bugs and defects. it is necessary to ensure that software works as expected before being released to the market 
3.relevance of software testing is Only quality products are disbursed to customers, which in turn elevates customer satisfaction and trust.
The Difference Between React Server Components (RSC) & Server Side Rendering (SSR)
Tags: react, reactnative, reactjsdevelopment, webdev
Published: 2023-08-28 15:58:47

Explore the difference between react server components and server-side rending. Just because they have the word server in them, doesnt make them similar. Explore their differences and particular use cases.

{% embed https://www.youtube.com/watch?v=xoi-bDY_gmU %}
12 Communication Dos and Don'ts for Managers
Tags: management, meme, communication, trust
Published: 2023-08-28 15:15:37

**1. Acknowledge employee expertise**
![Acknowledge employee expertise](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/woow2cl7g6yvo3ru88eq.jpeg)

---

**2. Consider personal challenges**
![Consider personal challenges](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y23tjqkxte3zzd0diobr.jpeg)

---

**3. Ask, don't command**
![Ask, don't command](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lawm3087982fyboiwjsv.jpeg)

---

**4. Offer support instead of blaming**
![Offer support instead of blaming](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7hyrnqmwzkljj1nibkpx.jpeg)

---

**5. Provide constructive feedback as an opportunity**
![Provide constructive feedback as an opportunity](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wcouueq6bussiulo1bc8.jpeg)

---

**6. Encourage feedback**
![Encourage feedback](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s4mdqe6bvuerojycfxgs.jpeg)

---

**7. Address sensitive issues in a friendly and supportive manner**
![Address sensitive issues in a friendly and supportive manner](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/snccadv5vr526wi0kdsc.jpeg)

---

**8. Be open to suggestions and offer autonomy**
![Be open to suggestions and offer autonomy](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0qfr502ccb4ymorhpcda.jpeg)

---

**9. Maintain transparency as much as possible**
![Maintain transparency as much as possible](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/algnti747dfbtp99coq0.jpeg)

---

**10. Pay attention to concerns**
![Pay attention to concerns](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jrs6hq1l2rlt2xa0hisr.jpeg)

---

**11. Apologise when needed**
![Apologise when needed](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bzz2ze810sp2m72todyx.jpeg)

---

**12. Take care of yourself**
![Take care of yourself](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jmmjpi4o2wxrj4fswp1h.jpeg)
Tài xỉu bóng đá là gì công thức chốt kèo hiệu quả thắng nhanh
Tags: webdev, beginners
Published: 2023-08-28 15:11:48

Tài xỉu bóng đá được đánh giá là tỷ lệ cược có khả năng thắng cao lên đến 50%. Đây là dạng soi kèo cực kỳ ăn khách tại các sân chơi trực tuyến. Tuy nhiên để cá độ thành công tiền thưởng lớn, anh em phải có kinh nghiệm đặt cược hay. Cùng học hỏi phương pháp đánh đâu thắng đó từ các cao thủ qua bài viết dưới đây.

[https://soikeo.bet/tai-xiu-bong-da-la-gi/](https://soikeo.bet/tai-xiu-bong-da-la-gi/)
Do you prefer Calculus within the service class or Creating separate classes for calculations?
Tags: coding, programming
Published: 2023-08-28 15:05:45

### Calculus within the service class:
```ts
// Calculus in service classes:
class ItemService {
    getAllAndSumary(){
         const items = this.itemRepo.all()
         const subItems = this.subItemsRepo.allBy({ parentId: In(items.map(d => d.id)) })
         return items.map(d=> ({
              ...d,
              count: this.countSubItemsBy(subItems.filter(sub => sub.parentId == d.id)),
              total: this.sumSubItemsBy(subItems.filter(sub => sub.parentId == d.id))
         }))
    }

    countSubItemsBy(subItems: SubItem[]) {
      // logic 
    }

    sumSubItemsBy(subItems: SubItem[]) {
      // logic 
    }
}
```

### Creating separate classes for calculations:
```ts
class ItemSummary {
    constructor(private _item, private _subItems) {
      Object.assign(this, _item)
    }

    get count() {
      return this._subItems.countBy({parentId: this.id })
    }

    get total() {
      return this._subItems.sumBy({ parentId:  this.id  })
    }
}

class ItemService {
    getAllAndSumary(){
         const items = this.itemRepo.all()
         const subItems = this.subItemsRepo.allBy({ parentId: In(items.map(d => d.id)) })
         return items.map(d=> new ItemSummary(d, subItems))
    }
}
```
Deployment Technique: Feature Flagging
Tags: deployment, softwaredeployment, programming, beginners
Published: 2023-08-28 15:05:02

- Feature flags are a software development technique that allows one to turn a feature on or off without modifying the source code or requiring a redeploy.
- Feature flags are used to control this traffic switching. The developer could use a feature flag to turn off the new feature for all users or a subset of users while you are testing it. Once satisfied with the new feature, you can enable the feature flag and start serving it to all users.
- They are also commonly referred to as release toggles, feature toggles or feature flippers.
- Feature flags are used in [blue-green](https://dev.to/amburi/blue-green-deployment-strategy-2212) and A/B testing deployments to control which version of the application is served to users.
- For example, you could use a feature flag to test a new pricing plan with 10% of your users. If the results of the A/B test are positive, you can then deploy the new pricing plan to all users.
Caption This! 🤔💭
Tags: watercooler
Published: 2023-08-28 15:00:00

Time to show off your captioning chops! We need your genius to bring this captivating moment to life!

![Image of a Koi fish being fed water out of a sippy cup.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/scqqk1u3iyikxpntjj4o.jpg)

---

Follow the DEVteam for more online camaraderie!

{% embed [https://dev.to/devteam](https://dev.to/devteam) %}
VSCODE THEMED PORTFOLIO USING REACT.JS AND TAILWINDCSS.
Tags: webdev, react, tailwindcss, javascript
Published: 2023-08-28 14:48:30

## Idea And Inspiration
I've been watching a lot of portfolio websites lately and came across some that were mind blowing like some were built in 3D using three.js , some with framer motion, etc. Inspired me started to build one using some of the react animation libraries and even built one or two but they were not as good looking as I thought and I was a react beginner at that time. After a while and getting some knowledge of react and building some projects I started collecting ideas to a again make a portfolio. As a coder an Idea jumped into my head why not build a portfolio that looks like vscode. Done some research to find some good design on the internet but there were'nt much but then I came across nitin ranganath's vscode portfolio and liked it so much.
{% embed https://dev.to/itsnitinr/i-built-a-vscode-inspired-developer-portfolio-418g %}
So I decided to give it a try and kinda cloned his website but using react and tailwind and made some changes in the about me page and used emailjs for sending emails turned out too be good.

Here is the link to the live website:
{% embed https://vscode-portfolio-main.vercel.app/ %}
{% embed https://github.com/manavss/vscode-portfolio-main %}

I would like to thank @itsnitinr for letting me use his icons and design as I am bit lazy to go and set them up all.😜Learned a lot from this project and glad I picked this one .
Simplify Python Packages with zpip, an irispython pip wrapper
Tags: beginners, python, tutorial, programming
Published: 2023-08-28 14:44:06

```
   _________ ___ ____  
  |__  /  _ \_ _|  _ \ 
    / /| |_) | || |_) |
   / /_|  __/| ||  __/ 
  /____|_|  |___|_|    

```

> Starting in version 2021.1, InterSystems IRIS began shipping with a python runtime in the engine's kernel. However, there was no way to install packages from within the instance. The main draw of python is its enormous package ecosystem. With that in mind, I introduce my side project zpip, a pip wrapper that is callable from the iris terminal.


# What is zpip?

zpip is a a wrapper for python pip that enables developers to quickly add packages to an instance through the InterSystems IRIS terminal.

## Features

* python pip wrapper for InterSystems IRIS
* Install/Uninstall python packages
* Installation adds `zpip` keyword to the language


## Installing zpip

```cos
%SYS> zpm "install zpip"
```

## TODO list

* [ ] Callable API with statuses returned

# Using zpip

All pip commands* are supported, however, any interactive command will require you to use the non-interactive version of the command. For example, to [uninstall](#uninstalling-a-python-package) a package you'll need to use the -y in the command to confirm the process.  

## Install python packages with zpip

```cos
// Install multiple packages
// beautiful soup and requests libraries
%SYS> zpip "install requests bs4"
```

... in action:

```cos
%SYS>zpip "install emoji"

Processing /home/irisowner/.cache/pip/wheels/ae/80/43/3b56e58669d65ea9ebf38b9574074ca248143b61f45e114a6b/emoji-2.1.0-py3-none-any.whl
Installing collected packages: emoji
Successfully installed emoji-2.1.0

%SYS>
```

### Specify a different install directory:

```cos
// Install to some other python package target
$SYS> zpip "install --target '/durable/iconfig/lib/python' emoji"
```

## Uninstalling a python package

```cos
// Requires -y!
%SYS>zpip "uninstall -y emoji"
Found existing installation: emoji 2.1.0
Uninstalling emoji-2.1.0:
  Successfully uninstalled emoji-2.1.0
```

## Other useful pip commands

### list packages

```cos
// List Packages
%SYS> zpip "list"
Package                      Version    
---------------------------- -----------
absl-py                      1.1.0      
argon2-cffi                  21.3.0     
argon2-cffi-bindings         21.2.0     
asttokens                    2.0.5      
astunparse                   1.6.3      
attrs                        21.4.0     
backcall                     0.2.0      
beautifulsoup4               4.11.1     
bleach                       5.0.0      
bs4                          0.0.1   
...
```

# Limitations

* Interactive commands are unsupported
  * use `-y` for uninstalls
* Search may not work depending on the system configuration
* Uses the underlying os's pip infrastructure so your installation is dependant on the os's pip version.