teleren/devto huggingface dataset:
How to Run Any Script in Laravel
Tags: laravel, webdev, php, productivity
Published: 2023-05-04 17:08:43

Do you find yourself constantly opening up a terminal window to run Laravel's tinker console or other command-line scripts? With this simple code snippet, you can run any script directly from within your code editor or IDE.

First, make sure you have Laravel installed and have included the necessary autoload and bootstrap files at the top of your script. Then, add the following code into the file, let's call it `_ide_helper_tinker.php`

```php
use Illuminate\Contracts\Console\Kernel;

require __DIR__ . '/vendor/autoload.php';
$app = require_once __DIR__ . '/bootstrap/app.php';
$kernel = $app->make(Kernel::class);
$kernel->bootstrap();
```

This code initializes Laravel's console kernel and boots up the application, allowing you to run any command-line script just as you would in a regular terminal window.

To run your script, simply add the code snippet above to your script and then call the script's command. For example:

```php
use Illuminate\Contracts\Console\Kernel;

require __DIR__ . '/vendor/autoload.php';
$app = require_once __DIR__ . '/bootstrap/app.php';
$kernel = $app->make(Kernel::class);
$kernel->bootstrap();

// Run script command
$people = DB::table('people')->get();
foreach ($people as $person) {
    echo $person->full_name . PHP_EOL;
}
```

If you are using PHPStorm or Jetbrain IDE, you can easily execute the script by right click on the file and selecting "Run PHP script"


![_ide_helper_tinker](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sa690xwyhasiidi7esjn.png)



That's it! Now you can run any command-line script from within your code editor or IDE, making it easier to debug and test your Laravel application.

One thing to keep in mind is that you may not want to track your script file changes using Git. To exclude your script file from Git tracking, add the file name to the `.gitignore` file in the root directory of your project.
Help! I'm a complete beginner and getting a 'Failed to compile' error when running 'npm start' for my React app
Tags: react, terminal, beginners
Published: 2023-05-04 16:55:28

Hey everyone, I'm completely new to using frameworks and I'm having trouble getting started with React. I'm trying to run my app using npm start, but I keep getting a 'Failed to compile' error message. I'm not sure what's going wrong, and I could really use some help. Also that after I hit npm start the react app actually launches to the browser but it won't refresh automatically so I think one of the effects of the error message.



Here's what the error message looks like:

`Failed to compile.

Module not found: Error: Can't resolve 'D:\#code\React Exercise\my-first-react\node_modules\webpack-dev-server\client\index.js?protocol=ws%3A&hostname=0.0.0.0&port=3000&pathname=%2Fws&logging=none&overlay=%7B%22errors%22%3Atrue%2C%22warnings%22%3Afalse%7D&reconnect=10&hot=true&live-reload=true' in 'D:\#code\React Exercise\my-first-react'
ERROR in Module not found: Error: Can't resolve 'D:\#code\React Exercise\my-first-react\node_modules\webpack-dev-server\client\index.js?protocol=ws%3A&hostname=0.0.0.0&port=3000&pathname=%2Fws&logging=none&overlay=%7B%22errors%22%3Atrue%2C%22warnings%22%3Afalse%7D&reconnect=10&hot=true&live-reload=true' in 'D:\#code\React Exercise\my-first-react'

webpack compiled with 1 error
`
I've tried looking up solutions online, but I'm having trouble understanding some of the technical jargon. I'm not even sure where to start looking for the problem. Could someone help me out and explain what might be causing this error, and how I can fix it?

I'd really appreciate any help or guidance that you could offer. Thanks in advance!
A New Beginning: My First Steps into the World of Software Engineering
Tags: software, webdev, programming, careerdevelopment
Published: 2023-05-04 16:46:39

Reflections on my journey from physics to software engineering

Hi everyone,

My name is Angie, and I’m 28 years old. I graduated in Physics in 2019, and this is my first post to introduce myself. (I couldn’t help but start singing to myself, “Please allow me to introduce myself, I’m a man of wealth and taste…”)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/16d60wg8jver4kqjb9ga.jpg)

From as far back as I can remember, I always loved to study. As a little girl, I dreamed of becoming a cardiologist, inspired by someone who greatly influenced me. I worked from the age of 15 to pay for my education, but unfortunately, I had to abandon my dream of becoming a doctor and started to explore other professional paths.

After high school, I began studying Chemical Engineering, which I soon realized wasn’t what I had imagined it to be. I stayed in the course for just over a year and then decided to pursue one of my biggest obsessions in life: studying the Universe. That’s why I chose to start my degree in Physics.

As a young, innocent, and positive person, I dreamt of studying the Universe and making significant discoveries in that field. I applied for a research fellowship at my university and worked there for almost four years, but it wasn’t in the Universe field. I studied Non-Linear Dynamical Systems and published four articles in scientific journals, which was a great accomplishment.

However, I didn’t like how theoretical the field was, and it made me realize that I didn’t enjoy studying things that were little or almost nothing practical.

After I graduated, I found myself in a very confused state of mind. I tried a few things until, with the help of my psychologist, I decided to try the tech field. It was terrifying because I always doubted myself, but I’ve always been hardworking, so I decided to give it a try. I’ll talk about why I chose IT in another post.

I started studying on April 05, 2022, and on December 12, 2022, I began working as a software engineer trainee in a Brazilian company.

I know I have a lot to learn, a lot to improve, and an enormous highway to walk through. But that makes me so happy and excited about the future. I truly believe that I’ve found my professional path, and I’m eager to do my best.

Living through this process is incredibly rewarding, and I hope to become better every day.

See you soon.
create html , css and js - without code
Tags: html, css, javascript
Published: 2023-05-04 16:22:24

[Apirze studio](https://apirze-test.onrender.com/studio) , the ultimate web tool for creating HTML, CSS, and JavaScript code visually! you can create beautiful websites and web applications without having to write a single line of code.  easy-to-use interface allows you to design your pages and components visually, and the powerful JavaScript code generation feature lets you create simple functionality by simply connecting blocks together.

you'll also be able to see the JavaScript code that's generated as you create your designs. This means you can learn how things work under the hood and become a better developer by seeing the code in action

check this [video](https://www.youtube.com/watch?v=GFjQZD25RJI&t=3s&ab_channel=Amrel-dessouki)


While the app is still in development, we invite you to try it out and provide us with your valuable feedback. Your input will help us to improve the app and make it even better for everyone.


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


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


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

you can download your html file as it show in the below image

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

In the next version, each node will have documentation on how to use it. Additionally, you will be able to generate an Android APK, App Bundle, and Key Store, and preview your app before generate to android app.
Using a Custom Template to Deploy a Linux Virtual Machine
Tags: virtualmachine, customtemplate, azureresourcemanager, quickstarttemplate
Published: 2023-05-04 16:03:48

There are different ways or options of creating a virtual machine. While Azure portal is most widely used, other options include Azure PowerShell, Azure Mobile app, Command Line Interface(CLI), Azure REST API, Azure Cloud Shell and Azure Resource Manager Templates. An example of Azure Resource Manager Templates is Quickstart Template.
This article will show how a virtual machine can be created with the use of Quickstart template.

Let's get started

**Step 1**
Log in to Azure portal and type "Deploy a custom template" into the search box. Then click on it on the dropdown menu

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



Leave the Template Source on Quickstart
Then Select "Create a Linux Virtual Machine" under Common Templates

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



**Step 2**
Complete the Project Details and Instance Details.
I will create a new Resource group named Mayresource.
My User name is **Azureuser** while the Password is **Password123***

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

Leave other parameters at default

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


**Step 3**
Click on "Review and Create"

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


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



**Step 4**
After validation has been passed, click on "Create" and wait for it to be fully deployed

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


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



**Step 5**
Go to the Resource group where you have everything that is needed for a virtual machine to be created

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


Click on the Virtual Machine

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


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


The Linux Virtual Machine is running!
Auto import Components en React sin archivos abiertos
Published: 2023-05-04 15:54:24

Esta guía simple para vscode, nos sirve para poder importar los componentes de React en cualquier punto de la App **sin la necesidad de tenerlos abiertos**.
Para eso tendremos que crear un archivo llamado jsconfig.js en la raiz de la aplicación y colocar el siguiente código:

```javascript
{
    "compilerOptions": {
        "target": "es6",
        "allowSyntheticDefaultImports": true
    }
}
```
A importância dos testes automatizados desde o princípio
Tags: programming, testing, javascript, braziliandevs
Published: 2023-05-04 15:52:08

Você concordaria se eu dissesse que os teste automatizados são importantes desde o princípio e que eles garantem a qualidade e integridade da aplicação, além de economizar o tempo e evitar bugs ao longo do desenvolvimento?

Uau. Tantos benefícios assim fica difícil recusar, não é mesmo? 😂

Mas calma, não estou querendo "prematurizar" o desenvolvimento do projeto. "Prematurizar" um projeto e como uma faca de dois gumes, tem um lado bom e o outro nem tanto.

Vamos focar no lado bom por enquanto, ok?

O lado bom: Os testes ajudam a identificar e corrigir erros com mais facilidade, antes que eles tornem uma grande dor de cabeça no futuro. 🤪

Dito isso, os testes podem ser executados de forma rápida e "no modo wacth" para que você identifique problemas em tempo real.

Não tenho medo de investir tempo e recurso na criação de testes automatizados. Ele é e será um investimento precioso para seu projeto.

O lado ruim:

Muitos desenvolvedores novatos ou pouco experientes (incluindo eu) podem se sentir sobrecarregados ao achar que precisam testar tudo e não entendem a importância dos testes ou como implementá-las corretamente. Acham uma tarefa tediosa e demorada, e acaba atrasando o processo de desenvolvimento e o lançamento.

Mas essa visão é limitada e equivocada!

Além de comprometer a qualidade da aplicação, você pode acabar gastando muito mais tempo corrigindo bugs que podem surgir.

É importante ter noção que criar testes poder ser uma tarefa desafiadora. Alguns testes são mais importantes do que outros.

Por exemplo, eu deveria mesmo criar um teste para ver se minha função de calcular X mais Y está retornando mesmo o valor correto?

Se é uma parte crucial do seu projeto e afeta diretamente o resultado, então sim. É importante. Mas caso, não afeta o resultado, então talvez não seja necessário criar um teste automatizado para ela.

No final cabe a você ou sua equipe decidir e encontrar um equilíbrio entre criar testes suficientes, mas sem gastar tempo e recursos desnecessários.
Gerenciamento de estado em React: Redux vs Context API
Tags: redux, contextapi, react, javascript
Published: 2023-05-04 15:40:32

O gerenciamento de estado é uma parte fundamental de qualquer aplicação em React. Como sua aplicação cresce em tamanho e complexidade, pode ser difícil gerenciar o estado de todos os componentes. É aí que entram as ferramentas de gerenciamento de estado, como o Redux e a Context API.

O Redux é uma biblioteca de gerenciamento de estado externa que se integra bem com o React. Ele mantém o estado em uma única store, o que torna o estado globalmente acessível. 

Além disso, o Redux oferece uma abordagem de fluxo de dados unidirecional, onde as alterações no estado são feitas através de ações e reduzidas por reducers. Isso torna o gerenciamento de estado mais previsível e mais fácil de depurar.

Por outro lado, a Context API é uma API nativa do React que permite o compartilhamento de estado entre componentes sem a necessidade de passar props manualmente. 

Com a Context API, você pode criar um contexto que contém o estado e, em seguida, fornecer esse contexto a qualquer componente que precise acessar o estado.

Ambas as abordagens têm seus prós e contras, e a escolha entre elas depende das necessidades do seu projeto.

### Vantagens do Redux:

- Estado globalmente acessível;
- Fluxo de dados unidirecional, tornando o gerenciamento de estado mais previsível;
- Possui devtools que facilitam a depuração do estado.
- Estado globalmente acessível;


### Desvantagens do Redux:

- Adiciona uma camada extra de complexidade à aplicação;
- Pode levar mais tempo para configurar e aprender a usar.


### Vantagens da Context API:

- Não é necessário passar props manualmente;
- Fácil de configurar e usar.

### Desvantagens da Context API:

- O estado não é globalmente acessível por padrão;
Pode levar a uma sobrecomplicação do código se usado incorretamente.
- Em geral, se você está trabalhando em um projeto maior e precisa de um gerenciamento de estado mais complexo, o Redux pode ser a melhor opção. 

No entanto, se você está trabalhando em um projeto menor e precisa apenas compartilhar estado entre alguns componentes, a Context API pode ser suficiente.

Em resumo, o gerenciamento de estado é uma parte crucial do desenvolvimento de aplicativos React, e o Redux e a Context API são duas opções viáveis para gerenciar o estado da sua aplicação. 

Ao escolher entre as duas opções, leve em consideração as necessidades do seu projeto e escolha aquela que melhor atenda às suas necessidades.
Ezoic’s Objectionable Content — Problem Solved
Tags: ezoi, devops, php, wordpress
Published: 2023-05-04 15:39:20

Ezoic’s Objectionable Content refers to the types of content that violate Ezoic’s policies and may result in the termination of Ezoic services or accounts. This includes, but is not limited to, content that is illegal, promotes hate or discrimination, contains explicit sexual material, promotes violence or harm, contains malware or phishing links, or violates intellectual property rights. Ezoic has strict policies in place to ensure a safe and appropriate online environment for its users, and monitors websites for objectionable content to maintain its standards.

Here is the code i have created to solve the Ezoic’s Objectionable Content

```
///Content Censor code

function censor_content($content) {
// Array of words to censor
$censored_words = array(‘vagina’, ‘porn’, ‘fucking’, ‘vagina’, ‘cumshot’, ‘cock’, ‘fuck’, ‘fucked’, ‘fuck’, ‘fucking’, ‘porn’, ‘slut’, ‘fucks’, ‘cock’, ‘blowjobs’, ‘gangbang’, ‘clitoris’, ‘ejaculation’, ‘ejaculating’, ‘semen’, ‘ejaculated’, ‘orgasm’, ‘ejaculate’, ‘semen’, ‘ejaculated’, ‘ejaculation’, ‘ejaculate’, ‘duche’, ‘fuckin’, ‘orgasm’, ‘orgasms’, ‘porn’, ‘tits’, ‘semen’, ‘vagina’, ‘blowjob’, ‘buttplug’, ‘clitoris’, ‘cock’, ‘cunt’, ‘dildo’, ‘fag’, ‘feck’, ‘fellate’, ‘fellatio’, ‘felching’, ‘fuck’, ‘fudgepacker’, ‘jizz’, ‘knobend’, ‘nigger’, ‘nigga’, ‘sh1t’, ‘slut’, ‘smegma’, ‘vagina’, ‘whore’, ‘beastiality’, ‘bestiality’, ‘tits’, ‘clit’, ‘cocks’, ‘cumshot’, ‘cunnilingus’, ‘ejaculation’, ‘faggot’, ‘fuckin’, ‘fucking’, ‘gangbang’, ‘goatse’, ‘masturbate’, ‘motherfucker’, ‘orgasm’, ‘porn’, ‘semen’, ‘titties’);

// Loop through each word to censor
foreach ($censored_words as $word) {
// Create a regular expression pattern to match the word
$pattern = ‘/\b’ . $word . ‘\b/i’;

// Replace the word with censored version
$content = preg_replace_callback($pattern, function($matches) {
$word = $matches[0];
$censored_word = substr($word, 0, 2) . str_repeat(‘*’, strlen($word) — 3) . substr($word, -1);
return $censored_word;
}, $content);
}

// Return the censored content
return $content;
}

// Add the censor_content function to the WordPress content filter
add_filter(‘the_content’, ‘censor_content’);
```

This code contain an array of bunch of bad words which provided by ezoic, Now, this code will automatically detect the bad words from your content and will chnage them to “Va***a”

Here is the demo you can check this content:

https://microbiologynote.com/human-male-reproductive-system/
🧙‍♂️✨ Welcome to the magical world of indentation! 🌟📜
Tags: indentation, beginners, programming, 2v4spaces
Published: 2023-05-04 15:36:01

🔮 Ever found yourself in a mystic quest to decide if 2 or 4 spaces is best for your new code adventure? You've come to the right place!

I could cast a spell 🪄 and tell you which of the two is the ultimate choice. But as you probably know, it's a matter of individual preference for personal/solo quests, and coding guidelines if you're embarking on an epic journey with an organization (assuming they have coding guidelines).

As a code wizard 🧙‍♂️, my choice is to wield 2-space indentation for front-end spells and 4-space indentation for backend enchantments. However, 4-space indentation can sometimes create more margin than needed. On the other hand, 2-space indentation may not provide enough space, reducing the readability of your magical incantations.

Why not harness the power of both realms? Embrace 3 spaces/tab! ⚡️ It's a no-brainer, right? The 2 and 4 space conventions have been widely adopted across the enchanted coding kingdoms. Don't waste time debating whether 3-space indentation is valid for coding. I've been using 3 spaces in my new projects, and I make sure to share this secret with my fellow adventurers at the start of each new quest.

For those interested, you can find my ESLint configuration and read about the epic battle between Prettier and ESLint in this thrilling tale: [Prettier - A Double-Edged Sword for Code Formatting](https://dev.to/nyxb/prettier-a-double-edged-sword-for-code-formatting-29o9) 🗡️

That said, I'll save the space vs tab indentation comparison for another thrilling tale.

I'd be delighted to hear your thoughts on 3 space/tab indentation in the comments section below! 📣 Thanks for joining me on this fantastic journey! 🌈
System's Dependency on Entity Component System
Tags: gameengine
Published: 2023-05-04 15:19:21

Hello, I'm Junior Game Engine dev.



In few days, I have studied ECS, and I tried to set up for my project.

But, I wondered how to manage system on ECS.



A few systems need dependency, like RenderSystem must run after MoveSystem.

Then, On ECS, the Systems have specific sequence?? or just set up dependency systems?



I Simply thought, just make linked list that connect Systemslike, using System's Interface pointer.



But, It's expected to be complex and difficult on bigger project.

And, linked list cannot use parrellel method for multiple systems.

Cause, just run single systems step by step.



Finally, I thougth, just use Directed Acyclic Graph

that look like the system's attributes are Sequencial and Dependencial.



## ISystem - System's Interface, all of system inheritance this object.

Linked List

Just Connect Prev ISystem's Pointer with Next ISystem's Pointer

Vector

Register System the last index, and access using index

Graph - Directed Acyclic Graph

Just Register dependencial System on other System.

run by dependencial distance which is zero or smaller



Then, What do you think about managing Systems on ECS??
Microservices May Not Always Be the Answer: Lessons from Amazon Prime Video
Tags: aws, cloud, devops, developer
Published: 2023-05-04 15:19:20

Amazon Prime Video recently shared a case study about their decision to replace their serverless, microservices architecture with a monolith. The result? A 90% reduction in operating costs and a simpler system. This is a big win and it highlights a larger point for our industry: microservices may not always be the answer.

The Prime Video team initially designed their system as a distributed system using serverless components, with the idea that they could scale each component independently. However, they hit a hard scaling limit at around 5% of the expected load.

This experience shows that in practice, microservices can actually complicate your system unnecessarily. While service-oriented architectures like microservices make perfect sense at the scale of Amazon, it can wreak havoc when it's pushed into the internals of a single-application architecture.

It's important to note that microservices are not a one-size-fits-all solution. Instead, we should evaluate our options and choose what works best for our specific use case. In many cases, a monolith may be the way to go.

This doesn't mean we should abandon microservices altogether, but rather approach them with a critical eye. We should consider the complexity of our system, the scalability needs, and the maintenance costs when making architecture decisions.

Let's not get caught up in buzzwords or the latest trends. Instead, let's focus on finding the best solution for our unique challenges. The lessons from Amazon Prime Video show that sometimes, a simpler approach can be more effective.

Reference : 
Reference : 
[https://www.primevideotech.com/video-streaming/scaling-up-the-prime-video-audio-video-monitoring-service-and-reducing-costs-by-90](https://www.primevideotech.com/video-streaming/scaling-up-the-prime-video-audio-video-monitoring-service-and-reducing-costs-by-90)

[https://www.primevideotech.com/video-streaming/scaling-up-the-prime-video-audio-video-monitoring-service-and-reducing-costs-by-90](https://world.hey.com/dhh/even-amazon-can-t-make-sense-of-serverless-or-microservices-59625580)