teleren/devto huggingface dataset:
Great Things Laravel 10.9 Released
Tags: php, laravel, programming, beginners
Published: 2023-04-26 14:14:23

In this release I found two great features and other things that I want to share with you to use in our next projects

- Named Static Methods for Middleware
https://github.com/laravel/framework/pull/46362

alternative more "PHPish" ways to define route middleware
```php
Route::get('users', UserController::class)
    ->middleware([
        Authenticate::class, // default.
        Authenticate::using('web'), // specify a guard.
        Authenticate::using('web', 'another'), // specify multiple guards.
 
        Authorize::using('store', Post::class),
 
        EnsureEmailIsVerified::class, // default.
        EnsureEmailIsVerified::redirectTo('route.name'),
    ]);
```

- New HTTP Status Assertions

three new HTTP status assertions for writing feature tests in Laravel
https://github.com/laravel/framework/pull/46841
```php
$response->assertGone(); // 410
$response->assertInternalServerError(); // 500
$response->assertServiceUnavailable(); // 503
```

- Make rules method in FormRequest optional
https://github.com/laravel/framework/pull/46846

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


I hope you enjoyed with me and to learn more about this release visit the sources and search more. I adore you who search for everything new.
Source :- https://laravel-news.com/laravel-10-9-0
Source :- https://www.youtube.com/watch?v=t_w3G2qsHic
Source :- https://www.youtube.com/watch?v=IkRXKRCPWeU
Source :- https://www.youtube.com/watch?v=B4p5thI_RjY
Source :- https://www.youtube.com/watch?v=nRojeQMA6R8
How to Create an Init Script for Tailscaled in Linux
Tags: initscript, linux, networkingsecurity, tailscale
Published: 2023-04-28 14:54:13

---
title: How to Create an Init Script for Tailscaled in Linux
published: true
date: 2023-04-26 14:13:11 UTC
tags: initscript,linux,networkingsecurity,tailscale
canonical_url: 
---

If you are using a Linux distribution that does not use Systemd, you may need to create an init script to manage Tailscaled, the network daemon for the Tailscale VPN.

Here are the steps to create an init script for Tailscaled:

### Step 1:

Determine the location of the Tailscaled binary The Tailscaled binary is typically installed in /usr/bin/tailscaled. Use the which command to determine the location of the tailscaled binary:

```
which tailscaled
```

If tailscaled is not in your PATH, you may need to provide the full path to the binary in your init script.

### Step 2:

Create the init script Create a new file in the /etc/init.d directory with a name that reflects the purpose of the script. In this case, tailscaled would be a good name:

```
sudo nano /etc/init.d/tailscaled
```

Add the following script to the tailscaled file:

```
#!/bin/sh
### BEGIN INIT INFO
# Provides: tailscaled
# Required-Start: $local_fs $network $syslog
# Required-Stop: $local_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: tailscaled daemon
# Description: tailscaled daemon
### END INIT INFO

DAEMON=/sbin/tailscaled
PIDFILE=/var/run/tailscaled.pid
USER=tailscale
GROUP=tailscale
test -x $DAEMON || exit 0
case "$1" in
  start)
    echo "Starting Tailscaled"
    start-stop-daemon --start --background --pidfile $PIDFILE --make-pidfile --chuid $USER:$GROUP --startas $DAEMON -- start
    ;;
  stop)
    echo "Stopping Tailscaled"
    start-stop-daemon --stop --pidfile $PIDFILE --retry 10
    ;;
  *)
    echo "Usage: /etc/init.d/tailscaled {start|stop}"
    exit 1
    ;;
esac
exit 0
```

This script provides basic functionality for starting and stopping tailscaled. You may need to modify it based on your specific needs, such as adding command-line arguments to tailscaled or changing the user and group that the daemon runs under.

Save the file and exit the text editor.

### Step 3:

Make the init script executable Make the tailscaled init script executable with the following command:

```
sudo chmod +x /etc/init.d/tailscaled
```

### Step 4:

Test the init script Test the init script by starting and stopping tailscaled with the following commands:

```
sudo /etc/init.d/tailscaled start
sudo /etc/init.d/tailscaled stop
```

### Step 5:

Configure the init script to start automatically Configure the tailscaled init script to start automatically on system boot with the following command:

```
sudo update-rc.d tailscaled defaults
```

This will create the necessary symlinks in the /etc/rc?.d directories to start tailscaled during the boot process.

You now have an init script for tailscaled that can be used on Linux distributions that do not use Systemd.
Security Audit on WordPress Site and Fix Vulnerabilities
Tags: wordpress, programming, webdev, security
Published: 2023-04-26 14:07:45

As a website owner, the security of your [WordPress](https://user-meta.com/) site should be a top priority. However, performing a security audit on your site can help you identify and fix vulnerabilities. In this blog post, we will discuss how to perform a security audit on your WordPress site and fix any vulnerabilities.

**UPDATE WORDPRESS CORE, THEMES, AND PLUGINS**
Outdated software is a common cause of security vulnerabilities. Besides, start your security audit, and make sure your WordPress core, themes, and plugins are up-to-date.

**INSTALL A SECURITY PLUGIN**
Installing a security plugin can help you identify potential vulnerabilities on your site. However, some popular security plugins for WordPress are Wordfence, iThemes Security, and Sucuri Security. Also, these plugins can scan your site for malware, vulnerabilities, and other security issues.

**CHECK USER PERMISSIONS**
Make sure your users have the appropriate permissions to access your site. Even so, only grant administrator access to users who need it.

**USE STRONG PASSWORDS AND TWO-FACTOR AUTHENTICATION**
Encourage your users to use strong passwords and enable two-factor authentication to add an extra layer of security to their accounts.

**LIMIT LOGIN ATTEMPTS**
Limiting the number of login attempts can help prevent brute-force attacks on your site. Moreover, you can use a plugin like Login LockDown to limit login attempts and block IP addresses after a certain number of failed login attempts.

**SECURE YOUR WEBSITE’S FILE PERMISSIONS**
Ensure your website’s file permissions are secure. Incorrect file permissions can allow hackers to modify your site’s files. So, use a plugin like WP Security Audit Log to check your file permissions.

**USE HTTPS**
Using HTTPS can help secure data transfer between your site and users. Besides, install an SSL certificate on your site to enable HTTPS.

Performing a [security audit](https://user-meta.com/blog/perform-security-audit-wordpress-site/) on your WordPress site is essential for ensuring the security of your site and protecting your users’ data. By following the steps, you can identify and fix any vulnerabilities on your site and keep it safe from potential security breaches.
Disagree and Commit. How it works? [With real-life example]
Tags: leadership, beginners, softskills, aws
Published: 2023-04-26 13:22:28

How does "Disagree and Commit" principle work? What are the challenges of applying this leadership principle to group decision-making? 

"Disagree&Commit" is an extremely important leadership principle. At the same time, It is often misunderstood and misused.

Disagree and commit isn't about forcing people to accept and "commit" to the decision they didn't make or supported.

Quite the opposite! "Disagree and commit" allows making effective group decisions, while accepting and encouraging everyone to express their views and concerns.

If you want to know how it is done - you should check this video!

{% embed https://www.youtube.com/watch?v=RYGuUHYGdUU %}
Supabase And Angular: A Powerful Combination For Building Web Applications
Tags: angular, supabase, baas, firebase
Published: 2023-04-26 13:18:00

Supabase is a cloud-based backend as a service (BaaS) platform that provides developers with a set of tools and services for building scalable and secure web applications.
It’s much like Firebase but Supabase provides a PostgreSQL database which solves some of the inconveniences with a NoSQL database such as Firestore.
For that reason, Supabase has now become my favorite BaaS and I use them for my own projects.

In this blog post, we will learn how to get started with Supabase and how to create a todo app with Supabase, Angular, and Nx. In the end, we will further dive into how to get the app production ready.

Read it [here](https://christianlydemann.com/supabase-and-angular-a-powerful-combination-for-building-web-applications/).
GitHub Action for Commit Message Validation
Tags: github, actions, devops
Published: 2023-04-26 12:57:07

---
title: GitHub Action for Commit Message Validation
published: true
description: Validate your commit messages with user provided regex pattern
tags: GitHub, Actions, DevOps
---
### What is it about

Have you been in a situation where commit message does not convey the detail of what the code is intended for?
well we can have a validation for that at the repository itself.

Using GitHub actions we can validate commit messages if they have relevant details like story numbers for which the code is being added and so on.

### How it works

have published a GitHub Action that helps in validating https://github.com/marketplace/actions/commit-meessage-check 

use this in your workflow as step, with your regex of required validation

here is a sample to check if the message has Jira story id

```yaml
on: [push]

jobs:
  hello_world_job:
    runs-on: ubuntu-latest
    name: commit-message-validation
    steps:
      - uses: actions/checkout@v3
      - id: foo
        uses: uptownaravi/verify-commit-message-action@v2
        with:
          regex: '(?i)jira-[0-9]{3,}'
```

![commit message success](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1h8s1dzf1bsdt95oo547.png)

if not then the job fails with exit code 1

![commit check failure](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/98zb0chwy9n1gg4h67h7.png)

The validation happens on the python file https://github.com/uptownaravi/verify-commit-message-action/blob/main/commitcheck.py
Programming languages Paradigm
Tags: javascript, python, c, go
Published: 2023-04-26 12:50:58

A programming language is a computer language programmers use to develop software programs, scripts, or other sets of instructions for computers to execute.

Although many languages share similarities, each has its own syntax. Once a programmer learns the language's rules, syntax, and structure, they write the source code in a text editor or IDE. Then, the programmer often compiles the code into machine language that can be understood by the computer. Scripting languages do not require a compiler and use an interpreter to execute the script.


## 5 Major types of programming languages

There are lots of ways to classify various programming languages, they mainly come down under five major categories.

## i. Procedural programming languages
Procedural language follows a sequence of statements or commands to achieve a desired output. Each series of steps is called a procedure, and a program written in one of these languages will have one or more procedures within it. Common examples of procedural languages include:

C and C++

Java

## ii. Functional programming languages
Rather than focusing on the execution of statements, functional languages focus on the output of mathematical functions and evaluations. Each function–a reusable module of code–performs a specific task and returns a result. The result will vary depending on what data you input into the function. Some popular functional programming languages include:

Scala

Erlang


## 

## iii. Object-oriented programming languages

This type of language treats a program as a group of objects composed of data and program elements, known as attributes and methods. Objects can be reused within a program or in other programs. This makes it a popular language type for complex programs, as code is easier to reuse and scale. Some common object-oriented programming (OOP) languages include:

Java

Python

C++

## iv. Scripting languages

Programmers use scripting languages to automate repetitive tasks, manage dynamic web content, or support processes in larger applications. Some common scripting languages include:

Ruby

Python

Node.js


## v. Logic programming languages


Instead of telling a computer what to do, a logical programming language expresses a series of facts and rules to instruct the computer on how to make decisions. Some examples of logic languages include:

Prolog

Absys

Datalog

This is not an exhaustive list there are many programming languages beyond the ones listed above.
My “What is Coding?” Class
Tags: webdev, helloworld, introduction, sharing
Published: 2023-04-26 12:50:37

About 8 weeks ago I decided to start teaching coding/programming in the homeschool co-op I am a part of. I am a student myself and trying to understand coding was challenging for me. 

One day I told myself I wanna give back to the coding community and share my perspective on what coding is, but I wanted to teach kids.

I sat down and came up with an 8-week introduction to coding. The class was only 50 minutes long so I had to find a way for them to receive the information but not overload with information.

My curriculum I came up with was:
Week 1: What is coding?
Week 2: Languages
Week 3: World Wide Web
Week 4: Web Browsers
Week 5: Web Servers
Week 6: Web Pages
Week 7: IDE's
Week 8: GitHub

It was a tremendous 8 weeks and the kids learned so much. I shared with the my resources and showed them how they could learn to code for free but with these free resources they were only learn the basics.

I encouraged them to research as there are many sites out there for them to learn from, don’t just copy and paste code you find to create your projects, learn and understand how your code works so you can fix it and grow as a coder. 

I encouraged to share their work because there way of explaining something can help someone else who is trying to figure something out. No one coder learns the same way as they do, so help to inspire.

I am taking all my curriculum and creating web pages for them to go back and reference. 

My hope is to help inspire children to follow their dreams by giving them a basic understanding.
NoSQL x SQL
Tags: beginners, sql, nosql, database
Published: 2023-04-26 12:44:30

**Bancos de dados SQL (relacionais)**
- Dados são armazenados em tabelas.
- Como é necessário que os dados sejam armazenados em tabelas, eles precisam ser estruturados (ter formatos e tipos fixo).
- Cada registro da tabela possui um identificador único para acesso ao dado;
- Principais vantagens:
 * Garante o padrão ACID nas transações (Atomicidade, Consistência, Isolamento e Durabilidade);
 * Não permite dados duplicados;
 * Normalização (os dados estarão em uma forma onde as anomalias serão reduzidas ou inexistentes);
 * "Fácil" para recuperar os dados.
- Principais desvantagens:
 * Não é escalável;
 * O esquema de dados é rígido e mudanças nesses esquema são custosas.

---
**Bancos de dados NoSQL**
- Os dados podem ser utilizados de diversas formas, com esquemas não rígidos. 
- Tipos de dados que podem ser armazenados em bancos NoSQL:
 * Documentos: formato JSON;
 * Chave-valor;
 * Grafos;
 * Wide-column: tabelas onde as linhas e colunas não são iguais. Como se fosse um banco chave-valor multidimensional.
 * Tabela fornecida pelo site do MongoDB com cada as propriedades de cada tipo de banco de dados:
![Tabela com comparativo de estruturas de dados NoSQL](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jd79z857dqynwcttadgz.png)

---
**Quando usar um banco de dados NoSQL**
- Como eles tem vários tipos, o uso em cada situação precisa ser estudada qual é a necessidade;
- Para aplicações onde o esquema do dado pode variar bancos NoSQL são boas opções;
- Outro bom uso é para aplicações que podem precisar ser escaladas de forma rápida;
- Aplicações de big data também podem se beneficiar desse tipo de banco;
- Também aplicações que precisem apresentar alta performance no gerenciamento dos dados.
The Magical QuerySelector(#/.)
Published: 2023-04-26 12:25:25

Hello, my name is Harrison Quamily. I am currently a student at Flatiron School for software engineering. I have prior experience in healthcare, carpentry, audio engineering, music production, and real estate. I'm looking to switch my career field to software engineering in order to make a positive impact in the world using the creativity, integrity, and morals I've acquired through my previous work experiences. Since enrolling in Flatiron, I have been learning about new opportunities that skilled engineers have every day. Although I'm not an expert yet, I feel that I have made a breakthrough.

Previously, I would use document.getElementById() to reference elements when I needed to access them. However, after working through some problems, I now find document.querySelector('') and using # or . to differentiate between IDs and other element names much easier.

With document.getElementById(), you can only access elements if they have an ID. In contrast, with document.querySelector(), you can access any element by using # when referring to an ID or . when referring to something else.

`let cakeName = document.querySelector('#food-name');
let cakeDescription = document.querySelector('.cake-description');
`

In the beginning, I used to rush through code challenges and try to complete them as quickly as possible. However, by doing so, I would often overlook minor details that caused major malfunctions in the code. When I got stuck on a problem, I would become frustrated and lose motivation to find a solution. Most of the time, the issue was calling the element by the wrong name or ID. Upon reviewing the renamed elements or the names of elements in the HTML or JSON, I would usually find the error there.

For more time than I would like to admit, I was confused about the functionality of textContent and src when it came to putting data on the DOM. It wasn't until I switched to using document.querySelector('#' or '.') instead of document.getElementById('') that I understood the source of my confusion between textContent and src.

Initially, I used document.getElementById() because it seemed easier. However, I am now starting to see that there are limitations to using document.getElementById() that document.querySelector() overcomes. When elements become more nested, it can be almost impossible to access the element using document.getElementById().

The 15-week boot camp at Flatiron has been challenging, with its fair share of ups and downs. However, it has not diminished my passion and excitement in my journey to learn and improve my proficiency in coding languages and algorithms with Flatiron.
Why use PHP 8.1 enums?
Tags: php, programming, beginners
Published: 2023-04-26 12:40:26

**PHP 8.1** introduced Enums, a new data structure developers can leverage for better typing and readability.

## Enums in short

[Enums](https://www.php.net/manual/en/language.types.enumerations.php) allow defining a short list of values:

```PHP
enum PostStatus: string
{
    case Published = 'publish';
    case Draft = 'draft';
    case Expired = 'expired';
    case Future = 'scheduled';
}
```

I strongly recommend the blog post by [stitcher.io](https://stitcher.io/blog/php-enums) to understand the technique.

I'd like to focus on the why and how I understand this new type.

## Enums vs. constants

Dev teams often use contants to define such statuses (see example above):

```PHP
class PostStatus {
    const PUBLISHED = 'publish';
    const DRAFT = 'draft';
    const EXPIRED = 'expired';
    const FUTURE = 'scheduled';
}
```
While it can totally work, it's prone to human errors and there's now a better way to implement the same feature with better typing: PHP enums.

Mistakes like the following may happen with the old syntax:

```PHP
class PostStatuses {
    const PUBLISHED = 'publish';
    const DRAFT = 'publish';
}
```

With PHP enums, it's impossible to attribute the same value to two different cases.

However, that's not the only benefit. You can use the following to ensure you are processing a valid status:

```PHP

public function myHelper(PostStatus $status) 
{
    // some code
}
```

This way, you don't have to implement a defensive strategy by yourself to check whether your variable is a valid status every time you need it.

It's now built-in, so you don't have to throw an error manually.

## Catch them all

No need to implement any custom method to list all valid statuses:

```PHP
PostStatus::cases();
```

It's now built-in, and you can get all cases with the static `cases()`.

## Enums are final and values are objects

According to stitcher.io, enum values are singleton objects, so you can't instanciate them, but any value is an instance of the Enum:

```PHP
$draft = PostStatus::DRAFT;
$draft instanceof PostStatus; // true
```

It's worth mentioning PHP enums are final, so you cannot extend them. They aren't meant to hold any state, so you won't be able to use most magic methods, but all of that's fine, because the purpose of PHP enums is **type safety**.

## Wrap up

This new PHP type is pretty cool. In my experience, it's very convenient to use and test.
Introducing Passkey by SoundAuth
Tags: webdev, security, backend, api
Published: 2023-04-26 12:38:55

Hi All, 
I am a developer at SoundAuth. I am developing a product of passwordless login based on a very user-friendly and secure standard called Passkeys. Passkeys are being promoted  by big companies like Google, Microsoft and Apple as a replacement for passwords.

This is the demo link. (http://Passkeylab.com). Please try it out and give your feedback.
Our low-code/no-code product will enable any developer to go passwordless within one day for all platforms (iOS, Android and web). We are inviting developers to join the developer partnership program. If you are interested in earning extra bucks, please enroll. https://docs.google.com/forms/d/e/1FAIpQLScsTV4J-cTciLOIg9avAQLYDkXs1pQAov1PGXaMFhTT0Ao15Q/viewform