teleren/devto huggingface dataset:
How To Install PHP 8.1 on CentOS 7
Tags: php
Published: 2023-08-30 23:30:49

What’s New in PHP 8.1?

- Enums have been integrated
- Readonly properties (Class properties can be marked as read-only and thus can only be written once.
- Never keyword (A new return type hint named Never was added in PHP 8.1)
- DNS over HTTPS (DoH) support.
- Support AVIF Image format.
- Added support for Fibers (Low-level mechanism for parallel management).
- The PHP Curl extension now supports HTTP(S) requests with File upload.
- Support for new fdatasync() and fsync() functions.
- PHP 8.1 adds array_is_list as a built-in function.
- Speed ​​efficiency improved from 5% to 8% compared to the old version
- Unpack the array using string keys.


**Step 1: Add EPEL and REMI Repository**
Run the commands below to add required repositories.

```
yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
```

**Step 2: Install PHP 8.1 on CentOS 7**

```
yum -y install yum-utils
yum-config-manager --enable remi-php81
```

Use the next command to install additional packages:

yum install php-xxx

// Example

```
yum install php  php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json
```

The current PHP version should be 8.1.

`php -v`
Now you have PHP 8.1
What is disadvantage of Caprover
Tags: caprover
Published: 2023-08-30 22:46:30

CapRover is a great platform for deploying and managing applications, but it does have some disadvantages. Here are a few of them:

Limited support for persistent data: CapRover only supports persistent data on disk, which means that it cannot be scaled horizontally. This can be a problem for applications that need to store large amounts of data.
Scaling on multiple nodes can be difficult: CapRover does not have a built-in way to scale applications across multiple nodes. This can be a challenge for applications that need to handle a lot of traffic.
Not as mature as some other platforms: CapRover is a relatively new platform, so it is not as mature as some of the other options available. This means that there may be fewer features and documentation available.
Can be complex to set up: CapRover can be complex to set up, especially if you are not familiar with Docker Swarm.
Overall, CapRover is a great platform for deploying and managing applications. However, it is important to be aware of its limitations before you use it.

Lastly, **in Front-end of Caprover, we are unable to limit resources of a container**. Therefore sometime the App got bugs, it consumes all the resources of our Host! Docker get crashed!, what the heck. (However, you can manually adjust resources with caption config file. They call it 'Service Update Override https://caprover.com/docs/service-update-override.html)

Here are some alternatives to CapRover that you may want to consider (but they are not Free! :):

Heroku: Heroku is a cloud-based platform that makes it easy to deploy and scale applications. It is a good option for applications that need to be highly available and scalable.
AWS Elastic Beanstalk: AWS Elastic Beanstalk is a service that makes it easy to deploy and manage web applications on Amazon Web Services (AWS). It is a good option for applications that need to be hosted on AWS.
Google App Engine: Google App Engine is a service that makes it easy to deploy and manage web applications on Google Cloud Platform (GCP). It is a good option for applications that need to be hosted on GCP.
The best platform for you will depend on your specific needs and requirements.
Hetzner Cloud: My honest review
Tags: hetzner, cloud
Published: 2023-08-30 22:39:18

Hetzner Online GmbH is a German hosting provider that offers a wide range of services, including shared, cloud, and dedicated server hosting. Hetzner is known for its affordable prices and high-performance infrastructure.

Hetzner was founded in 1997 and is headquartered in Gunzenhausen, Germany. The company has two data centers, one in Falkenstein and one in Nuremberg. Hetzner has over 1 million customers worldwide.

Hetzner's shared hosting plans start at €1.60 per month and include features such as unlimited traffic, cPanel, and SSH access. Hetzner's cloud hosting plans start at €3.90 per month and include features such as SSD storage, KVM virtualization, and DDoS protection. Hetzner's dedicated server hosting plans start at €34.00 per month and include features such as Intel Xeon processors, ECC RAM, and 1 Gbps networking.

Hetzner is a good choice for businesses and individuals who are looking for affordable and reliable hosting services. The company offers a wide range of features and plans to suit all needs.

I have been using Hetzner's services for more than 5 years and it is getting better and better, at a very affordable price.

**Here is a my ref. link. You can claim your 20 Euro when you sign up new account : https://tapthislink.com/hetzner**

Here are some of the pros and cons of Hetzner:

**Pros:**
Affordable prices
High-performance infrastructure
Good customer support
Wide range of features and plans
The control panel is very easy to use

**Cons:**
Some plans have limited resources

The data centers are located in Germany, which can be a disadvantage for businesses with international customers
Overall, Hetzner is a good value for money hosting provider. If you are looking for affordable and reliable hosting services, Hetzner is a good option to consider.

Here are some additional things to know about Hetzner:

Hetzner offers a 99.9% uptime guarantee for all of its hosting plans.
Hetzner has a good reputation for customer support.
Hetzner is a popular choice for developers and businesses that need high-performance hosting services.
If you are considering using Hetzner, I recommend reading some reviews from other customers to get a better idea of the company's strengths and weaknesses.
Day 816 : At The Door
Tags: hiphop, code, coding, lifelongdev
Published: 2023-08-30 22:19:55

_liner notes_:
- Professional : Had a couple of meetings and sat in on a talk prep session. Other than that, I worked on this Web Component. Think I got it to a pretty good minimal viable state. I've been creating it in an online IDE to test things out. I'm going to see if I can get a test component published and create a quick demo to show the team. There's a team meeting tomorrow. Wonder if I can have something to demo.

- Personal : I went through a BUNCH of tracks for the radio show last night. Also finished ironing all the clothes (I think), that I'll be taking on my trip. Made some progress on the Web Component. Pretty productive.

![Coastline of Sandwich Harbour, Namibia with waves from the blue water crashing into the large orange dunes under a cloudless blue sky.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ebd519u406dxg4bla42u.jpg)

Going to work on getting a demo working for the Web Component I made. I also want to test out my system for live streaming a meetup tomorrow for Orlando Devs. Maybe go through some tracks and watch an episode of "Zom100" depending on how far I get with the coding stuff. This trip is right at the door and I'm so not ready! haha I'll probably be doing a few late nights to finish up some stuff to make sure I really enjoy this vacation.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube AthKXcCgjIs %}
CapRover has just released a new version 1.11.0 - and yet they added PRO version !
Tags: caprover, paas, nginx, https
Published: 2023-08-30 21:48:33

**What Is Caprover ?**
Homepage: https://caprover.com

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

If you managed a server on your own you know that configuring everything correctly is a very hard job to do.
Handling Nginx configuration, issuing SSL Certifications securing the services, etc. I remember back then I had to memorized all the SSL certificate expiry date, renew it manually, hell no.... i hate that. It's all automatically get renewed with Caprover.

Now imagine if you want to run more than one service on a server or you want to load balance your incoming requests between multiple servers and spin up more than one instance of a service on your servers. That's a hard job, right?

With Caprover, You can manage multiple services like your NodeJS, Python, PHP, ASP.NET, and Ruby Apps or your Databases like MySQL, MongoDB, Postgres, etc. on a single server or a cluster of servers.
It will load balance your app using a customizable Nginx proxy server and it can create free SSL certifications using Let's Encrypt.

CapRover has a nice WEB GUI that helps you manage your services. you can also manage your services using the CLI of the CapRover.

Another awesome feature of CapRover is the rollback feature if you shipped a bad version on production you can easily roll back to any version of your APP with a single click.

**How does it work?**
Under the hood, CapRover uses Docker to containerize your applications. An Nginx Reverse Proxy will manage your load balancing, the Reverse Proxy will also route the incoming requests to the specified services in your server(s).
And for clustering, Caprover uses Docker Swarm.
In the picture below you can see how CapRover works:

**Is It Safe?**
Yes, it is safe. I have used it for more than three years and it is very stable, plus it is open source.

CapRover might not be a good option for big teams and companies but it's a really good option for individuals or small to medium teams that want to reduce expenses.
Trust Summit 2024
Published: 2023-08-30 21:30:56


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6it77x70x01hhx2ymla2.jpg)[GetTrusted](https://trust-summit.com/) is the leading ratings and reviews platform for IT, marketing and business service providers. It will allow representatives of IT companies, startups, engineers, investors and interested public to participate in the exhibition from anywhere in the world. Explore the latest technologies, share knowledge and create valuable business connections. Here are a few key highlights of the Trust Summit 2024.
This is a virtual exhibition that is held on a special online platform. Exhibitors can register and access the exhibition's features from anywhere in the world. Network communication. Exhibition visitors can communicate with company representatives, ask questions and establish contacts for future cooperation. Accessibility and time savings as virtual exhibitions provide accessibility for exhibitors from all over the world without the need for a physical presence. This saves time and resources. Analytics and Reporting: [Trust Summit 2024](https://trust-summit.com/) organizers will provide analytics on attendance, engagement, and attendee interests, useful for business analysis.
🥳 Celebrate endoflife.date's 250th product with ArgoCD
Tags: devops, k8, kubernetes, gitops
Published: 2023-08-30 21:18:14

## ❔ About

Recently on our K8S journey I started to use ArgoCD to deploy (HELM packaged) applications to K8S.
Quite naturally, we choose [`Argo CD`](https://argo-cd.readthedocs.io/en/stable/).

Still, while adding a new tool to our stack, I wanted to **stay on track with maintenance concerns** (with automation thanks to [API](https://endoflife.date/docs/api)).

By this I mean:

- 🛡️ Security
- 🛍️ Features
- 🗓️ End of Life (LTS, ...)

👉 Therefore I **contributed a [`[new product]`](https://github.com/endoflife-date/endoflife.date/labels/new-product)** to [`endoflie.date`](https://endoflife.date/):

{% embed https://github.com/endoflife-date/endoflife.date/pull/3337 %}

Then it is easier than ever to get its lifecycle:

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


## 📈 KPIs & milestone success celebration

[![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yug871xa5vb39yd0f7g3.png)](https://github.com/endoflife-date/endoflife.date/discussions/870#discussioncomment-6760377)

Time to look back on new products implementation rate:

[![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/680q5jx568461jxpme7f.png)](https://github.com/endoflife-date/endoflife.date/discussions/870#discussioncomment-6779402)

### 🏆 Top growing products on `endoflife.date`

There is a dedicated page about analytics:

[![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dn5tkw7c6w140ffmnxkx.png)](https://github.com/endoflife-date/endoflife.date/discussions/382#discussioncomment-6464474)


## 📚 `Argo CD` resources

Below some very cool (and free) worthwhile eBooks about GitOPS, K8S & Argo CD:

- [🔗 ArgoCD and GitOps: What’s next?](https://www.redhat.com/en/blog/argocd-and-gitops-whats-next)
- [📕 The Path to GitOps](https://developers.redhat.com/e-books/path-gitops)
- [📕 GitOps Cookbook: Kubernetes Automation in Practice](https://developers.redhat.com/e-books/gitops-cookbook)
Closure in Javascript - Revisiting Counter Example
Tags: javascript
Published: 2023-08-30 21:04:31

In my precedent post I presented an  example which was not optimal.

A nice suggestion from Eckehard leaded me to the new version, which is more better as it does not create 'hidden global variables' when using "id's"...

The idea is to not use any external libraries.

[ClosureRevisited](https://flems.io/#0=N4IgtglgJlA2CmIBcBWA7AOgBxYDQgGcBjAJwHtZZkBtABl1oF18AzCBAm0AOwEMxESEBgAWAFzBV8RMtzHw5yECAC+uHv0HCAVp2mz5ioSwCu3ImIiyABAGEyZ+SWsAKAJTXgAHW7XrCMWsZR2sAXmtaHz8A63hYMVsSeF55MNcxXgBzD1CAPmsoMiITATkMUmT5AFEEUrEXDOyo61NzSxsANQh4AHdXD29fP394QN5KRoI06i8QKAgAN1nca1mRAGZl1ZAAIxMxMVkt2b2Do5BGZujR62p5hZWNlZ2xbghzZ9eoeCJGNPHYDUxFNwgDJhgwLwAA4uOIJJIpeBuK4jQLvIg7ACeaRc6PgJBy+XcYXyGww724+IAKvAAB6BcIAajJFOpdMCjOseJIKIBQIIGAIsAgRHgLgAjG4MCwyCQqrwiCIXIr2FASQVFhhoVCFFBlSJVW5kUM-CzuJSSDT6WlgnIUS83uZyea2dbwrMAJIAOVsswA3NYHeiMLIiMKiABrNLorESjz2r4-Z0Wq0M7YAESqvpAAYd3yIIfM4aj4RjmJcAFpJSikmITCRfPdmipmrX674ur1+j4W9xqBgBwBBEgkXjllBuRjS2XyxUuYl5ApFEoKMQYHZkKCYrVQnXcPX2Rz49xGvw+HwgfAEOI-drcThCcUAJiQ61U6hAfAESnKBD0IBkORVyUDZPGaGRYFlJBrCSKA-R7S9CBvCwrHvJRxSQcU3xURgVCAA)

```js
function Counter () {
  let count = 0
  let eltCreate = (tag) => document.createElement(tag)
  function View () {
    let alltags = ["div", "h3", "button", "button"]
    let [div, h3, btninc, btndec] = allElts = alltags.map(eltCreate)
    let incby = (incer) => () => h3.innerText = +h3.innerText + incer
    allElts.slice(1).forEach(child => div.append(child))
    h3.innerText = count
    btninc.innerText = "INC"; btninc.onclick = incby(1) 
    btndec.innerText = "DEC"; btndec.onclick = incby(-1)
    return div
  }
  return View ()
}
[...Array(5)].forEach(() => document.body.append(Counter()))  

```
Using caret and tilde in package.json dependencies
Tags: javascript, npm, programming
Published: 2023-08-30 21:03:05

By default `npm install` will use the caret (^) notation when installing a dependency. For example, if you run:

```
npm i jsonwebtoken
```

**npm** will add the following dependency to your `package.json`:

```
"jsonwebtoken": "^9.0.0"
```

which is equivalent to `"jsonwebtoken": "^9"` (why are they wasting valuable characters?).

This means that npm can install any version greater or equal than `9.0.0` but less than `10.0.0`.

In theory this should work because the [SemVer](https://semver.org/) specification says that the minor version (second number) should be backwards compatible.

In practice, however, library authors don't follow this rule strictly and can cause a lot of headaches.

Another option would be to use tilde (~), which only allows the patch version (third number to change):

```
"jsonwebtoken": "~9.0"
```

In this case npm can install versions greater or equal than `9.0.0` but less than `9.1.0`.

This is safer and the option I would suggest. You can configure npm to use this option with the following command:

```
npm config set save-prefix "~"
```

However, keep in mind that newer patch versions can also introduce other bugs, so if you want to be completely safe you should use an exact version:

```
"jsonwebtoken": "9.0.0"
```

And use a tool such as [Renovate](https://github.com/renovatebot/renovate) to update your dependencies.
React Custom Hook: useTimeout
Tags: webdev, javascript, programming, react
Published: 2023-08-30 21:00:00

In this article series, we embark on a journey through the realm of custom React hooks, discovering their immense potential for elevating your development projects. Our focus today is on the "useTimeout" hook, one of the many carefully crafted hooks available in the collection of React custom hooks.

Github: https://github.com/sergeyleschev/react-custom-hooks
```javascript
import { useCallback, useEffect, useRef } from "react"

export default function useTimeout(callback, delay) {
    const callbackRef = useRef(callback)
    const timeoutRef = useRef()
    useEffect(() => {
        callbackRef.current = callback
    }, [callback])
    const set = useCallback(() => {
        timeoutRef.current = setTimeout(() => callbackRef.current(), delay)
    }, [delay])
    const clear = useCallback(() => {
        timeoutRef.current && clearTimeout(timeoutRef.current)
    }, [])
    useEffect(() => {
        set()
        return clear
    }, [delay, set, clear])
    const reset = useCallback(() => {
        clear()
        set()
    }, [clear, set])
    return { reset, clear }
}
```
The "**useTimeout**" hook encapsulates the logic for setting, clearing, and resetting timeouts within a React component. It takes two parameters: a callback function and a delay duration in milliseconds. Whenever the specified delay elapses, the provided callback function is executed.

One of the significant advantages of this custom hook is that it ensures the callback function remains up to date even if it changes during component re-renders. By using a useRef to store the callback reference, the hook guarantees that the latest version of the function is always called.

Moreover, the "useTimeout" hook optimizes performance by utilizing useCallback to memoize the "set" and "clear" functions. This means that the functions are only recreated when their dependencies change, preventing unnecessary renders and enhancing efficiency.
```javascript
import { useState } from "react"
import useTimeout from "./useTimeout"

export default function TimeoutComponent() {
    const [count, setCount] = useState(10)
    const { clear, reset } = useTimeout(() => setCount(0), 1000)
    return (
        <div>
            <div>{count}</div>
            <button onClick={() => setCount(c => c + 1)}>Increment</button>
            <button onClick={clear}>Clear Timeout</button>
            <button onClick={reset}>Reset Timeout</button>
        </div>
    )
}
```
The "_useTimeout_" hook can be utilized in various scenarios where timed actions are required. For example, in a countdown component like the "TimeoutComponent" showcased above, you can easily implement a timer that resets after a specific duration. By using the "useTimeout" hook, you can effortlessly update the countdown value and manage the timeout without worrying about complex timeout management code.

Full Version | React Custom Hooks:
https://dev.to/sergeyleschev/supercharge-your-react-projects-with-custom-hooks-pl4
Types vs Interfaces in TypeScript
Published: 2023-08-30 20:34:27

Even though there's a lot of information about this subject on the Internet, I haven't seen a single one mentioning that having two similar concepts was a mistake from the designers of the language.

Even though you can interchange types and interfaces in TypeScript most of the time, I will argue that **unless you are going to implement an interface you should always use a type**.

```typescript
interface Configurable {
  configure(): void
}

class Task implements Configurable {
  configure(): void {
    // do some configuration
  }
}
```

Remember that an interface is basically a contract, so they should include only method declarations.

In conclusion, I suggetst you should use **types** most of the time, and only use **interfaces** if you are planning to write implementations.
Como fazer qualquer pessoa entender o que é uma API.
Tags: api, programming, backend, webdev
Published: 2023-08-30 20:17:02

Um conceito bastante difundido no ramo do desenvolvimento web há um bom tempo são os das API’s (**Application Programming Interface**).  [Segundo a documentação do MDN](https://developer.mozilla.org/pt-BR/docs/Glossary/API), pode-se entender como um conjunto de características e regras em uma aplicação que possibilitam interações com a mesma através de um software, ou seja, esse recurso faz com que aplicações com responsabilidades completamente diferentes possam conversar e trocar informações mediante características e regras desse elemento. 

Um exemplo excelente é um presente na [documentação da AWS](https://aws.amazon.com/pt/what-is/api/) sobre o assunto. Um celular conversa a todo momento com softwares de medição de dados meteorológicos via API’s para poder atualizar a tela dos celulares com as informações de temperatura, previsão de chuva, velocidade de ventos e possibilidades até de alertas de situações de possíveis riscos às pessoas. Os smartphones não precisam ter um sensor que capte tudo isso nem precisa saber como obter as informações meteorológicas. Ele precisa de um intermediador, para quem ele possa solicitar as informações que precisa, seguindo determinadas características e obedecendo regras, para assim receber as informações e, se tudo estiver conforme solicitado, exibi-las em tela.

Se observarmos direito, uma API funciona tal qual um garçom de um restaurante, onde fazemos o pedido e ele anota tudo que estamos pedindo e as demais observações. Aqui, a cozinha funciona como se fosse um servidor, que recebe o pedido através do garçom e o prepara. Assim que estiver pronto o garçom coleta o que foi preparado e entrega o prato ao cliente. É possível notar uma clara semelhança ao exemplo do celular buscando dados do servidor meteorológico. O cliente não precisa falar diretamente para a cozinha o seu pedido e como o quer, nem precisa saber como vai ser feito. Precisa apenas passar o que deseja ao garçom e esperar receber o seu prato.

![Imagem representando diversos tipos de aparelhos se comunicando a um servidor através de uma API](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wzaaou0u334x92lfbz8u.jpg)
_Imagem disponível em: [https://ecdisis.com/que-es-rest-api/](https://ecdisis.com/que-es-rest-api/)_

API’s estão presentes, em larga escala, em todo o universo web. Tudo o que fazemos no dia-a-dia que necessite de comunicação com servidores, seja ver um episódio de série em um streaming, consultar uma plataforma de estudo, olhar determinada notícia em um portal, fazer um pagamento de algo que você está comprando, e até o que a não fazemos diretamente, como receber informações meteorológicas no celular, passam por API’s.

Nos conceitos e nos exemplos foi dito que as API’s seguem características e obedecem regras. Abordarei mais sobre esse tópico nos próximos artigos. Um abraço!!