teleren/devto huggingface dataset:
PHP: Installing,Switching between Multiple PHP versions on Linux
Tags: backend, php, laravel, linux
Published: 2023-08-07 15:36:56

As a beginner working in production, you will be facing many problems that you were unaware of while you were doing personal projects, one of them being having to deal with older projects which used an older version of PHP but also work with latest PHP version at the same time. It is not just PHP but happens with every programming language so I decided to write this article for those who are starting out and have this problem.
The most easiest way would be running it on docker but that is not the topic for now , so let's begin.

This tutorial uses Ubuntu but **it works on any other distro.**

## Installing multiple version
On Ubuntu LTS you need to add ondrej repository to install older versions:

```
sudo add-apt-repository ppa:ondrej/php
```
For this example i'll be installing php7.3

```
sudo apt install php7.3
```
If you don't specify PHP version then, the latest version of PHP will be installed from the Ubuntu default repository

```
sudo apt install php
```
Now on terminal , if you check your PHP version, by default it will be from Ubuntu's default repository

```
php -v
PHP 8.2.8 (cli) (built: Jul  8 2023 07:10:21) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.8, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.8, Copyright (c), by Zend Technologies
```
Now to use older PHP version we will create a symbolic link, so lets move the default PHP version into a folder with it's version name.

```
sudo mv /usr/bin/php /usr/bin/php8.2
```
Now if you try to use `php -v` , it won't work because now it has been changed to `php8.2`

To use older version as PHP command, you will now create a symbolic link, which calls your desired PHP version when `php` is called.

```
sudo ln -s /usr/bin/php7.3 /usr/bin/php
```

Now if you try `php -v` , the version of PHP which you specified when creating symbolic link should run.

```
php -v
PHP 7.3.33-11+ubuntu22.04.1+deb.sury.org+1 (cli) (built: Jun  8 2023 15:22:14) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.33, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.33-11+ubuntu22.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
```

Now to switch back to any other php version you have to unlink to in order to create another symbolic link,

```
sudo unlink /usr/bin/php
```
And just repeat the linking and unlinking to switch and forth between multiple versions of PHP

```
sudo ln -s /usr/bin/php8.2 /usr/bin/php
```
Thank you for making it up to here , please feel free to share your thoughts and problems
Syntax parser
Tags: javascript
Published: 2023-08-07 15:27:19

If we need to simplify this word
We can explain that you write a code and there is a program 
translate this code from a human-readable code to machine code which the computer can understand



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2qdnijumf04vydibf2dl.png)
Setup your personal cloud
Published: 2023-08-07 15:26:39

This article shows you how to install your own Nextcloud on Ubuntu 23.X or 22.X LTS!

If you like this article, we would be very happy about a like and a comment! :heart:

---

# updating 
`apt update && apt upgrade -y`

# Installing apache
`apt install apache2`

# Install PHP 8.2 
`apt install software-properties-common
add-apt-repository ppa:ondrej/php
apt update`

# Install PHP & Moduls
`apt install apt install libapache2-mod-php php php-zip php-dompdf php-xml php-mbstring php-gd php-curl php-imagick libmagickcore-6.q16-6-extra php-intl php-bcmath php-gmp php-cli php-json php-mysql php-pear unzip nano php-apcu redis-server ufw php-redis php-smbclient php-ldap
`

If you are asked to confirm something during any installation, you must also do this.
# adjust PHP.ini file

```
nano /etc/php/8.2/apache2/php.ini

memory_limit = 2048M
upload_max_filesize = 20G
post_max_size = 20G
date.timezone = Europe/Berlin
output_buffering = Off
```


# Install Databse Server
`apt install mariadb-server`

# Maria DB Server Konfiguration
`mysql_secure_installation`

# open SQL dialoge
`mysql`

# create database calles nextcloud
`CREATE DATABASE nextcloud;` 

# create database user with password
`CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'password_here';`

# grant accesss to databse
`GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextclouduser'@'localhost';`

# save changes and exit

`FLUSH PRIVILEGES;
`
`EXIT;
`

# Download lastest nextcloud version

`cd /tmp && wget https://download.nextcloud.com/server/releases/latest.zip
unzip latest.zip
`
`mv nextcloud /var/www/
`

#adjust apache conf
`nano /etc/apache2/sites-available/000-default.conf`

-> change `/var/www/html` to `/var/www/nextcloud`
 
# Enable the NextCloud and Rewrite Module


`a2enmod rewrite
a2enmod headers
a2enmod env
a2enmod dir
a2enmod mime
`

# restart apache
`service apache2 restart`

# prepare data folder

`mkdir /home/data/
chown -R www-data:www-data /home/data/
``chown -R www-data:www-data /var/www/nextcloud/
chmod -R 755 /var/www/nextcloud/
`
Curso | Solidity | modifier
Tags: solidity, ethereum, remix, spanish
Published: 2023-08-07 15:23:03

#Hola a todos#


Hoy les traigo un minitutorial del curso de solidity que estoy tomando, al finalidad de esto es que aprendamos juntos ya que no soy experto en solidity si no que estoy apenas aprendiendo y la idea es explicar lo que he entendido con el objetivo de aprender-enseñando

##modifier

El término "modifier" se refiere a una característica que te permite definir una serie de comprobaciones o condiciones que deben cumplirse antes de que una función pueda ser ejecutada. Los modificadores son una forma de modularizar y reutilizar lógica en tus contratos inteligentes, lo que hace que el código sea más claro y fácil de mantener.

Los modificadores son particularmente útiles para aplicar lógica de verificación o validación antes de permitir que una función realice su tarea. Pueden utilizarse para verificar que ciertas condiciones se cumplan antes de que una función cambie el estado del contrato o realice alguna acción importante. Al utilizar modificadores, puedes evitar la duplicación de código y garantizar que ciertas validaciones se apliquen consistentemente en diferentes partes de tu contrato.

Aquí hay un ejemplo simple para ilustrar cómo se utiliza un modifier en Solidity:


```
pragma solidity ^0.8.0;

contract Ejemplo {
    address public owner;

    constructor() {
        owner = msg.sender;
    }

    modifier soloOwner() {
        require(msg.sender == owner, "¡Solo el propietario puede ejecutar esta función!");
        _;  // Esta línea indica dónde se ejecutará el cuerpo de la función una vez que se valide el modifier.
    }

    function hacerAlgo() public soloOwner {
        // El código de la función se ejecutará solo si el modifier "soloOwner" valida.
        // Hacer algo interesante aquí...
    }
}
```

En este ejemplo, el modifier **soloOwner** verifica si la dirección que llama a la función es la misma que la dirección del propietario del contrato. Si no lo es, la función no se ejecutará y arrojará una excepción. Si la comprobación del **modifier** pasa, la función **hacerAlgo** se ejecutará normalmente.

En resumen, los modificadores en **Solidity** son una herramienta poderosa para agregar condiciones de validación y lógica reutilizable a tus funciones de contrato inteligente, lo que ayuda a mejorar la seguridad y la claridad del código.
Setup your personal cloud
Tags: tutorial, cloud, ubuntu
Published: 2023-08-07 15:19:03

[This is the german tutorial for it.](https://technik.xn--schchner-2za.de/blog/2023/03/29/nextcloud-26-hub-4-installieren-2023)
This article shows you how to install your own Nextcloud on Ubuntu 23.X or 22.X LTS!

If you like this article, we would be very happy about a like and a comment! :heart:

---

# updating 
`apt update && apt upgrade -y`

# Installing apache
`apt install apache2`

# Install PHP 8.2 
`apt install software-properties-common
add-apt-repository ppa:ondrej/php
apt update`

# Install PHP & Moduls
`apt install apt install libapache2-mod-php php php-zip php-dompdf php-xml php-mbstring php-gd php-curl php-imagick libmagickcore-6.q16-6-extra php-intl php-bcmath php-gmp php-cli php-json php-mysql php-pear unzip nano php-apcu redis-server ufw php-redis php-smbclient php-ldap
`

If you are asked to confirm something during any installation, you must also do this.
# adjust PHP.ini file

```
nano /etc/php/8.2/apache2/php.ini

memory_limit = 2048M
upload_max_filesize = 20G
post_max_size = 20G
date.timezone = Europe/Berlin
output_buffering = Off
```


# Install Databse Server
`apt install mariadb-server`

# Maria DB Server Konfiguration
`mysql_secure_installation`

# open SQL dialoge
`mysql`

# create database calles nextcloud
`CREATE DATABASE nextcloud;` 

# create database user with password
`CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'password_here';`

# grant accesss to databse
`GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextclouduser'@'localhost';`

# save changes and exit

`FLUSH PRIVILEGES;
`
`EXIT;
`

# Download lastest nextcloud version

`cd /tmp && wget https://download.nextcloud.com/server/releases/latest.zip
unzip latest.zip
`
`mv nextcloud /var/www/
`

#adjust apache conf
`nano /etc/apache2/sites-available/000-default.conf`

-> change `/var/www/html` to `/var/www/nextcloud`
 
# Enable the NextCloud and Rewrite Module


`a2enmod rewrite
a2enmod headers
a2enmod env
a2enmod dir
a2enmod mime
`

# restart apache
`service apache2 restart`

# prepare data folder

`mkdir /home/data/
chown -R www-data:www-data /home/data/
``chown -R www-data:www-data /var/www/nextcloud/
chmod -R 755 /var/www/nextcloud/
`
Why Developers Should Stop Using ISO 8601 for Date-Time
Tags: architecture, programming, documentation
Published: 2023-08-07 15:07:42

When documenting APIs, developers often link to **ISO 8601** as the standard for computer-readable date and date-time format.

Dates and times (and time zones!) are complicated. There are so many edge cases and pitfalls. I’m sure every developer has a battle story about them. It’s good to delegate that hard work to somebody else. So when an international body that everybody knows and trusts publishes such a standard, it’s no surprise all the API designers start referring to it.

This is what an **ISO 8601** date and date-times look like:

* `2023‐08‐07`

* `2023‐08‐07T13:25:38Z`

This is what we want to receive.

### The ISO allows too much variability and it’s paid to read

Do you know what is also a valid **ISO 8601** date-time?

* `2023-W32-1T15:38+02:00` (= Monday of the 32nd week in my local time zone)

How sure are you that your API will accept such a string? For example, JavaScript’s `Date.parse` will fail. There are many more allowed formats in the standard. And support for these is not guaranteed at all.

If you are thinking about creating a library that will understand all of them, I have bad news for you. There are four versions of the standard, released in the years 1988, 2000, 2004, and 2019, and they are not fully compatible with each other! Plus, you need to pay (about $190) to receive a copy of the standard.

Fortunately, there is a better way:

### **There are two better-suited (and free) standards**

In your documentation, refer to either of these two standards:

* **RFC 3339**

* **HTML** (who would’ve guessed?)

Each of those allows just a small variation of that date-time we want: allowing space instead of `T` or not providing some parts. To my knowledge, all of those variations are generally supported. Moreover, the standards are precise and free to read for anybody.

If you want to be truly strict, I’d also include the format like so:

* `RFC3339 date-time in %Y-%M-%DT%h:%m:%sZ format`

This is a very clear way to document your API.

### **Next time, just write RFC 3339 instead**

When you find yourself typing ISO 8601 in your code or documentation, just replace it with RFC 3339 and continue knowing you made dates a tiny bit easier for you and your API users.
Choisir un hébergement Joomla : Les critères essentiels pour une présence en ligne réussie
Tags: webdev, beginners, cms, joomla
Published: 2023-08-07 14:59:28

Lorsque vous envisagez de créer un site web avec Joomla, le choix d'un hébergement adapté est une étape cruciale pour assurer le bon fonctionnement et la performance de votre site. Un hébergement de qualité est essentiel pour garantir une expérience utilisateur optimale et éviter les problèmes techniques qui pourraient nuire à votre présence en ligne. Voici les critères essentiels à prendre en compte pour choisir un [hébergement Joomla](https://hebergement-joomla-maroc.com/) adapté à vos besoins :

- Compatibilité Joomla : Assurez-vous que l'hébergeur que vous choisissez prend en charge Joomla. Recherchez un hébergement spécifiquement optimisé pour les CMS, ce qui garantira une meilleure compatibilité et une installation plus facile.

- Performance et vitesse : Un site web rapide est essentiel pour une expérience utilisateur satisfaisante et pour le référencement. Optez pour un hébergement avec des serveurs performants, une bande passante généreuse et des disques SSD, qui offrent une vitesse de chargement optimale.

- Sécurité : La sécurité est primordiale pour protéger vos données et celles de vos visiteurs. Choisissez un hébergement qui offre des mesures de sécurité robustes, comme des pare-feux, des certificats SSL gratuits, et des sauvegardes automatiques.

- Support technique : Assurez-vous que l'hébergeur propose un support technique réactif et compétent. Vous pourriez rencontrer des problèmes techniques ou des questions spécifiques à Joomla, et il est essentiel d'avoir une équipe de support capable de vous assister rapidement.

- Facilité d'utilisation : Si vous êtes débutant en gestion de sites web, recherchez un hébergeur proposant des interfaces conviviales et des outils facilitant l'installation et la gestion de Joomla.

- Évolutivité : Anticipez l'avenir de votre site et choisissez un hébergement qui offre des options d'évolutivité, comme la possibilité de passer à un plan supérieur lorsque votre site se développe.

- Prix : Comparez les différents plans d'hébergement et trouvez un équilibre entre la qualité des services offerts et votre budget. Méfiez-vous des offres trop alléchantes, car la qualité du service peut en souffrir.

En résumé, le choix d'un [hébergement Joomla](https://hebergement-joomla-maroc.com/) est un élément crucial pour la réussite de votre site web. Prenez le temps de rechercher un hébergeur fiable, performant, sécurisé, et adapté à vos besoins spécifiques. Avec le bon hébergement, vous pourrez offrir une expérience utilisateur optimale et garantir la stabilité de votre présence en ligne.
MSWord - figure caption
Tags: sep490
Published: 2023-08-07 14:34:49

Dành cho mấy bạn đang cày đồ án những ngày cuối cùng, và dành cho mấy bạn chuẩn bị vào mùa 😃 
Để tạo 1 cái bảng danh sách các figures (Image / Table) thì dùng chức năng của Word Insert Figures chứ đừng gõ tay

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

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/enjcdyiis84m0wcaqnai.png)
What are your goals for the week of August 7?
Tags: motivation, discuss
Published: 2023-08-07 14:27:59

## What are your goals for this week?

It's back to School week. Here classes start Tuesday. So back to dropping off the kid at early hours. 

- What are you building? 
- What will be a good result by week's end?
- Are you attending any events this week? 
  * Any suggestions of events to attend?
- Did you meet your goals last week?


### Last Week's Goals


- [:white_check_mark:] Continue Job Search.
- [:white_check_mark:] Blog wrote about this series. Realized I's been running it for a year. 
- [:white_check_mark:] Code Challenges. Did daily CSS Challenges.
- [:x:]Project work. just some minor touches.
- Events
  * [:white_check_mark:]Attend [Virtual Coffee(VC)](https://dev.to/virtualcoffee) Thursday.
  * [:x:] Other VC events if I can.
- [:x:] Build some LEGO sets. 
- [:white_check_mark:] Launch a weekly Slack thread similar to this post. Gonna motivate the community.



### This Week's Goals

- Continue Job Search.
- Blog.
- Code Challenges
- Project work
- Events
  * Attend [Virtual Coffee(VC)](https://dev.to/virtualcoffee) Thursday.
  * Other VC events if I can.
  * Job Fair/ company info session later in week.
- Build some LEGO sets. Maybe add images of those builds here.
- Run a weekly Slack thread similar to this post. Gonna motivate the community.
- Rewatch Rebels before Ahsoka series starts at the end of August. Also read A New Dawn A rebels related Novel.

### Your Goals for the week


You've read my goals so I'll throw the questions back to you.


- What are you building? 
- What will be a good result by week's end?
- Are you attending any events this week? 
  * Any suggestions of events to attend?
- Did you meet your goals last week?



```html
-$JarvisScript git push
```
Faster horses and flying cars
Tags: innovation, database
Published: 2023-08-07 14:14:01

> If I had asked people what they wanted, they would have said faster horses. - Henry Ford

Most people didn’t see the need for a car when everything depended on horses. 

I’m sure Henry Ford heard a lot of this back in his day:

“ Why are you spending so much time on this useless car idea, cars will never become as reliable as horses. Just stick to what works, you don’t have to reinvent the wheel! “

Now we all know that Henry Ford did not give up and, for all intents and purposes, did reinvent the wheel in terms of changing how the world does transportation.

Now my question is: why don’t we have flying cars?

Have we, just like our ancestors, settled for faster cars instead of taking the next step into the future of transportation?

Let’s bring this home to us, SurrealDB is a database company, not a car maker. However, there are plenty of similarities between our vision for the future of databases and Henry Ford’s vision for the future of transportation.

In our case, Henry’s famous quote would say 

> If I would have asked people what they wanted, they would have said a faster Postgres

Right? 

It certainly feels like that at times:

“ Why are you spending so much time on this useless database idea, SurrealDB will never become as reliable as Postgres. Just stick to what works, you don’t have to reinvent the wheel! “

Therefore the question is, will we give up?
This question is on the minds of a lot of people that want to adopt our technology.

And I’m here to assure you that the answer is no, we will not give up!

Why am I so sure of this? 

> The people who are crazy enough to think they can change the world are the ones that do. - Steve Jobs

This company is made up of people who have overcome a lot to get where we are today therefore, we know we can make a change and are not afraid to overcome the challenges ahead!

We are daring to reinvent the wheel and take the next step into the future of databases. 

If you want to join us, then I encourage you to sign up for our [version 1.0 launch event on September 13](https://surrealdb.world/) to see what the future holds! 

And, of course, join us on [Discord](https://surrealdb.com/discord), we’d love to hear from you!
Three ways you can vertically center an element with CSS
Tags: webdev, programming, react, productivity
Published: 2023-08-07 13:59:20

The timeless query remains: How can one vertically center a DIV using CSS? This task can prove to be quite demanding, particularly when contending with varying screen sizes and dynamic content. Thankfully, several contemporary methods exist to successfully attain this desired outcome.
Here's the HTML we will use in our examples:

```
<div class="container">
  <div class="content">
    
    <p>It can be a real challenge, especially when dealing with dynamic content and varying screen sizes.</p>
  </div>
</div>
```

## FLEXBOX
Flexbox is a straightforward and highly efficient technique for vertically centering a DIV using CSS. This method involves defining the container element with the properties display: flex and align-items: center.

```
.container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
  }
  .content {
    text-align: center;
    padding: 20px;
    background-color: #f0f0f0;
  }

```

## Position and Transform
Another approach is to use position: absolute and transform: translate. This method requires you to set a fixed height on the container element.
```
.container {
    position: relative;
    width: 100%;
    height: 300px; /* Adjust the height as needed */
  }

.content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    padding: 20px;
    background-color: #f0f0f0;
   
  }
```

**the html code**

```
<div class="container">
  <div class="content">
    <h1>Centering a DIV with position: absolute and transform</h1>
    <p>This method requires setting a fixed height on the container element.</p>
  </div>
</div>
```

## GRID
you can use CSS Grid to center a DIV vertically. This method involves creating a two-column grid, with the first column set to auto and the second column set to 1fr.

```
.container {
    display: grid;
    place-items: center;
    height: 100vh;
  }

  .content {
    text-align: center;
    padding: 20px;
    background-color: #f0f0f0;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }
```
CSS Grid provides a versatile way to center content vertically and horizontally. The two-column grid is structured with the first column set to auto (which takes the content's width) and the second column set to 1fr (which takes up the remaining available space), achieving the vertical centering effect.

```
<div class="container">
  <div class="content">
    <h1>Centering a DIV with CSS Grid</h1>
    <p>This method involves creating a two-column grid, with the first column set to auto and the second column set to 1fr.</p>
  </div>
```
Depending on your use case, any of these 3 options should work for you to vertically center that pesky element and keep your layout rendering the way you desire.