teleren/devto huggingface dataset:
How to Publish API Route File in Laravel 11
Tags: laravel, webdev, beginners, programming
Published: 2024-06-16 21:01:27

In Laravel 11, API route management takes a slightly different approach compared to earlier versions. New projects lack a dedicated API route file by default, streamlining the setup for applications without public-facing APIs. But fret not! If your project demands an API, publishing the necessary file and setting up Laravel Sanctum for authentication is a breeze.

**1. Install the API Package**

Open your terminal and navigate to your Laravel project's root directory. Run the following Artisan command:

`php artisan install:api`

What this command does:

    `Creates the routes/api.php file, where your API routes will reside.
    Installs Laravel Sanctum, a package offering token-based authentication for your API.
    Generates relevant migrations for Sanctum.
    Adds a configuration file (config/sanctum.php) for Sanctum settings.`

**2. Define Your API Routes**

With the routes/api.php file in place, you can start defining your API endpoints using Laravel's routing mechanisms. Here's an example:

```
<?php
  
use Illuminate\Auth\Middleware\Authenticate;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
  
Route::get('/user', function (Request $request) {
    return $request->user();
})->middleware(Authenticate::using('sanctum'));
```

By following these steps, you've successfully published the API route file in your Laravel 11 application and laid the foundation for building secure and efficient API endpoints. This approach not only simplifies the initial setup but also ensures a well-structured and organized codebase for your project.
Pyenv para Iniciantes.
Tags: pyenv, python, ptbr
Published: 2024-06-17 01:19:47

O Pyenv é uma ferramenta que simplifica o uso do Python no seu computador, especialmente quando você trabalha em diferentes projetos que podem exigir versões distintas do Python.

Com apenas alguns comandos no terminal, você pode instalar várias versões do Python e alternar facilmente entre elas. Isso garante mais consistência e estabilidade em seus projetos, permitindo que cada projeto utilize a versão específica do Python necessária.

**COMO INSTALAR:**

Para começar, abra o PowerShell como administrador e certifique-se de que o Windows permita a execução de scripts. Cole este comando no PowerShell:

```
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
```

Agora vamos instalar o Pyenv. Cole o seguinte comando:

```
Invoke-WebRequest -UseBasicParsing -Uri "https://raw.githubusercontent.com/pyenv-win/pyenv-win/master/pyenv-win/install-pyenv-win.ps1" -OutFile "./install-pyenv-win.ps1"; .\install-pyenv-win.ps1
```

Em alguns computadores Windows, pode surgir uma mensagem de erro dizendo que o Windows não conseguiu adicionar as variáveis de ambiente. Caso isso aconteça, cole este comando:

```
$pyenvPath = "$HOME\.pyenv\pyenv-win\bin"
$shimsPath = "$HOME\.pyenv\pyenv-win\shims"

```

```
[System.Environment]::SetEnvironmentVariable('PYENV', "$HOME\.pyenv\pyenv-win\", [System.EnvironmentVariableTarget]::User)
[System.Environment]::SetEnvironmentVariable('Path', "$pyenvPath;$shimsPath;" + [System.Environment]::GetEnvironmentVariable('Path', [System.EnvironmentVariableTarget]::User), [System.EnvironmentVariableTarget]::User)
```

Pronto, feche o PowerShell e abra novamente. Verifique se o Pyenv foi instalado corretamente com o comando:

```
pyenv --version
```


Ele irá retornar a versão atual do Pyenv se estiver tudo funcionando corretamente.

Para atualizar o Pyenv e seus plugins, primeiro use:

```
pyenv update
```


Agora podemos listar todas as versões do Python disponíveis para download:

```
pyenv install --list
```

Isso retornará algo semelhante a isso:
```
:: [Info] ::  Mirror: https://www.python.org/ftp/python
3.12.1
3.12.2-win32
3.12.2-arm
3.12.2
3.12.3-win32
3.12.3-arm
3.12.3
3.13.0a1-win32
3.13.0a1-arm
3.13.0a1
3.13.0a2-win32
3.13.0a2-arm
3.13.0a2
```

Para instalar uma versão específica, use:

```
pyenv install 3.12.3
```


Para usar esta versão globalmente:

```
pyenv global 3.12.3
```

Ou, se quiser definir uma versão apenas para seu projeto específico, entre na raiz do projeto e use o comando:
```
pyenv local 3.12.3
```

Para ver as vesões que você ja baixou:

```
pyenv versions
```

Nesse link você encontra a documentação completa do Pyenv caso tenha mais dúvidas:

> 
https://pypi.org/project/pyenv-win/

E é isso, até a proxima e bons estudos.
Building a Weather Application with OpenWeatherMap API
Tags: javascript, beginners, programming, tutorial
Published: 2024-06-17 00:34:40

## Introduction

In today's fast-paced world, having access to accurate and up-to-date weather information is crucial. Whether you are planning a trip or simply want to know what to wear for the day, a weather application can be an essential tool. With the OpenWeatherMap API, building a weather application has become easier and more efficient. Let's explore the advantages, disadvantages, and features of using this API for your weather application.

## Advantages of Using OpenWeatherMap API

1. **Ease of Integration:** The OpenWeatherMap API provides a simple and user-friendly interface, making it easy for developers to incorporate weather data into their applications.
2. **Comprehensive Weather Data:** It offers a wide range of weather data, including current weather conditions, daily and hourly forecasts, historical data, and more.
3. **Support for Multiple Programming Languages:** This makes it accessible to a larger developer community, enhancing its usability across different platforms.

## Disadvantages of Using OpenWeatherMap API

1. **Limitations on API Calls:** The free version of the API has a limit on the number of calls that can be made per minute, which can be a hindrance for applications that require frequent updates.

## Features of OpenWeatherMap API

1. **Location-Based Weather Data:** Provides weather updates based on specific geographic locations.
2. **Diverse Meteorological Information:** Includes data on precipitation, wind, UV index, and air quality index.
3. **Customization Options:** Allows users to choose the type of data they want to receive, such as Celsius or Fahrenheit for temperature.
4. **Multilingual Support:** Offers data in multiple languages, catering to a global audience.

### Example of Integrating OpenWeatherMap API in JavaScript

```javascript
// Fetch weather data using OpenWeatherMap API
fetch('https://api.openweathermap.org/data/2.5/weather?q=London&appid=YOUR_API_KEY')
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));
```

This simple JavaScript code snippet demonstrates how to make a basic API call to OpenWeatherMap to retrieve current weather data for London. Make sure to replace `YOUR_API_KEY` with your actual API key from OpenWeatherMap.

## Conclusion

In conclusion, the OpenWeatherMap API is a valuable tool for building a weather application. It offers easy integration, a diverse range of weather data, and useful features to enhance user experience. However, it's important to consider the limitations of the free version when incorporating it into your application. Overall, with the OpenWeatherMap API, you can create a user-friendly and accurate weather application that meets the needs of your users.
Install PHP 8.3 and config Apache in Ubuntu 22.04
Published: 2024-06-17 00:33:48

## Install PHP:
```
sudo apt install php8.3
```

## Install PHP module of Apache:
```
apt install libapache2-mod-php
```
## Config PHP Module of Apache
By default, the PHP module is automatically enabled, if for some reason it is not enabled, you should run: 
```
a2enmod php8.3
```

To update the PHP module configuration you must modify the files `/etc/apache2/mods-enabled/php8.3.conf` and `/etc/apache2/mods-enabled/php8.*.load`. Then you must restart the apache server by running the following command:
```
systemctl restart apache2.service
```

## Confirm Installation 
```
php -v
```

## Optional Packages
### PHP-CLI
Run PHP scripts via the CLI
```
apt install php-cli
```
### PHP-CGI
Execute PHP scripts without installing the Apache PHP module
```
sudo apt install php-cgi
```
### PHP-MySQL
```
apt install php-mysql
```
### PHP-PgSQL
```
apt install php-pgsql
```
Twilio Challenge: Can You Beat Gemini? AI-Powered Game of Tic Tac Toe
Tags: devchallenge, twiliochallenge, ai, twilio
Published: 2024-06-17 00:20:22

*This is a submission for the [Twilio Challenge ](https://dev.to/challenges/twilio)*

## What I Built
I built an interactive AI-powered game of Tic-Tac-Toe called "Can You Beat Gemini?" This project allows players to test their Tic-Tac-Toe skills against Gemini AI, providing a challenging and fun experience.

### Features
**AI Integration**: The game uses the Gemini AI model to analyse the game state and predict the best possible moves to challenge the player effectively.

**Real-Time Interaction**: Players interact with the game through digits (1-9). The game captures the player's move and processes it. The AI then responds with its move. This interaction is facilitated using Twilio's Programmable Voice capabilities, making the gameplay seamless and engaging.

**Dynamic Game Board**: The game state is visually represented, updating in real-time as moves are made. This ensures players can keep track of their and the AI's moves.

## Demo

You can try it out by scanning the QR Code in the image or by texting the code **join front-trace** to the number **+14155238886** on WhatsApp. Next call number **+1 (806) 615-3056** to play the Tic Tac Toe game.

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

### Video of How it Works

{% embed https://vimeo.com/960750355?share=copy %}

In the video description above, a call is made to **+1 (806) 615-3056** to begin the game. The user selects any number between (1-9) to make their move. Gemini AI then analyzes the game state and responds with its move. The game continues with the user and AI taking turns until a winner emerges.

### Source Code

{% github ThatCoolGuyyy/Tic-Tac-Toe-Gemini-Twilio %}

## Twilio and AI
I used Twilio to get input from the user in digits (1-9), each representing a cell on the Tic-Tac-Toe board. Then, I used **Gemini AI** to play against the human user. Finally, I used the **Twilio Programmable Messaging (WhatsApp Sandbox)** to send the updated board when both AI and human players make their moves. I also used **Twilio Functions** to host the code.

## Additional Prize Categories

**Twilio Times Two** - The project uses **Twilio Programmable Messaging (WhatsApp Sandbox)**, **Twilio Programmable Voice** and, **Twilio Functions.**

**Entertaining Endeavors** - The project creatively combines a classic game with advanced AI technology, making it not just a simple Tic Tac Toe game but an engaging battle of wits against an AI opponent. By leveraging Twilio to receive user inputs and send real-time game updates via WhatsApp, the project ensures continuous engagement and keeps the players entertained throughout the game.
🥙 Callgentive UI - Home-Cooked Software Development
Tags: industrytrends, architecturepatterns, productdesign
Published: 2024-06-17 06:22:09

---
slug: generative-ui-home-cooked-software-development
title: 🥙 Callgentive UI - Home-Cooked Software Development
published: true
description: Think of every each of APP as a chat-box, but not in text format. The responses are all `widgets`, and requests are just clicks, scrolls and inputs...
keywords: [Home-Cooked Software, Generative UI, Generative Design, Callgentive UI]
date: 2024-06-17 00:00:00 UTC
tags: IndustryTrends,ArchitecturePatterns,ProductDesign
canonical_url: https://docs.callgent.com/blog/generative-ui-home-cooked-software-development
---

AI Large Language Models (LLMs) are ushering in a new golden age of [Home-Cooked Software](https://maggieappleton.com/home-cooked-software). and callgent is providing the solid infrastructure and solutions to make it happen. Let's take a look at how.

## What is Generative UI?

From now on, forget the traditional software paradigm.

Imagine if we treated every interaction between a user and an app as a chat, with the only difference being that the content of the chat is not text, but rather a collection of widgets.

![textual chat => widget chat](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gr0gfpcl747ah8x4ii4d.png)

Users interact with widgets to send chat requests to AI agents, which then decide how to process the request, encapsulate the result in widgets, and present it to the user in a certain way.

The underlying layer of the chat is still textual + agents, but the interaction between the user and the app will now take place through a visual widget UI instead of text.

:::tip
From the end-user's perspective, a Generative App is no different from a traditional app (although a Generative App may appear more personalized).
:::

## Callgentive UI

How does callgent leverage generative UI, as we name it `Callgentive UI`.

A picture is worth a thousand words:

![Callgentive UI](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fnqp9p7wnvea5v44l735.png)

With predefined business services and standard widgets, the `Home-Cooked Software` works as follows,

- The landing pages are generative UI of widgets generated from some initializing Agent prompts.
- As user interacts with the widgets, the interactions are transformed into a chat request.
- The backend Callgent maps the chat requests to business service invocations, and gets response data from services.
- The Callgent makes the response data into a set of widgets, and presents it to the user.

### How does it work?

Callgent's core functionality is to do native function-calling to orchestrate business services.

Callgent has server endpoints and client endpoints to adapt various invocation scenarios.

Specifically, widget based User Interface, is just one more type of client endpoints, to adapt human interactions.
2 Tips to make your Github Repository Stand Out
Tags: tips, beginners
Published: 2024-06-16 23:52:17

Have you ever wondered "How can I make my GitHub Repository Stand Out?"? Well Here are 2 tips to do just that

### Tip One  Get Rid of everything you are not using

Getting rid of things you are not using will help people not click on something and then just leave.

### Tip Two Have a Brief but in depth description

Having a Brief but in depth description will help more people come to your Repository and Star and Fork it.

Well That's it,

See You next time,

Bye
Making a Multiplayer WEB RPG - Part 10: Customizing Characters
Tags: gamedev, babylonjs, colyseus
Published: 2024-06-16 23:37:38

Hi All,

I've been working on character customization systems. It is nearly complete and includes a big performance boost compare to previous method.

---

I have 2 types of items (I’m sure none of this is new to you guys, but sharing is caring :slight_smile: ):

- **dynamic items** that I attached via code to the relevant bone (weapon, hat, shields, etc…)
- **embedded items** which are rigged item in blender (head & armor currently), not much choice there as a skirt for example needs to move with the legs (not possible with the dynamic method)

So I now have one single VAT running that is used by all my “humanoid” characters.

Currently, I can mix and match the following very easily:

- 20 materials,
- 6 heads,
- 3 dynamic items (weapon/shield/helm,head)
- 2 embedded items (white robe, purple robe)

Next step is being able to customize the material for the “embedded” items, currently I apply one material to the full mesh (including the embedded items).

Performance are still good (50-60fps / 40 draw calls approx)

Here are a few shots:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/68r1rffxm159va91g3i9.jpeg)

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

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f8tka15tn61r3mmy6wpn.png)
[Game of Purpose] Day 29
Tags: gamedev
Published: 2024-06-16 23:02:32

Today I was trying to recreate helicopter flying with my drone. I had many problems. First was that I wanted to separate the mesh from the flying funcitonality, but it turned out that `Child Actor` made so many problems that I had to abandon the separation.

I also imported the Drone model to Blender and it turned out that I had to export it swapped axes. When I imported Drone model downloaded from the Internet it was weirdly rotated, so I created a Blueprint for that mesh and fixed it manually in Unreal. In Blender I could reexport the same mesh, but with fixed axes, so Blueprint was not that needed.
Vite vs. Create React App (CRA): Qual Escolher?
Tags: vite, react, javascript
Published: 2024-06-16 23:02:16

Desenvolvedores que começam um novo projeto em React muitas vezes enfrentam a decisão entre Vite e Create React App (CRA). Ambos têm seus méritos, mas qual é o mais adequado para você? Vamos explorar!

##⚡ Vite: A Nova Geração
Vite é um bundler moderno que oferece uma experiência de desenvolvimento ultrarrápida. Desenvolvido pelo criador do Vue.js, Vite utiliza a ESM (EcmaScript Module) para proporcionar uma experiência de desenvolvimento ágil.

Vantagens do Vite:

- **Carregamento Rápido**: Graças ao HMR (Hot Module Replacement) ultrarrápido, Vite recarrega apenas os módulos alterados, tornando o desenvolvimento muito mais ágil.
- **Build Eficiente**: Usa Rollup sob o capô para produções otimizadas.
- **Simplicidade:** Menos configuração e mais produtividade.
- **Suporte Nativo ao ESM**: Aproveita o suporte nativo ao ESM em browsers modernos para uma performance superior no desenvolvimento.


## Quando Usar:

- Projetos que exigem velocidade de desenvolvimento.
- Aplicações que se beneficiam de um build mais otimizado.
- Desenvolvimento moderno com suporte ao ESM.


## ⚙️ Create React App: O Clássico

**Create React App (CRA)** é uma ferramenta amplamente utilizada para configurar projetos em React sem a necessidade de configuração manual de Webpack e Babel. É mantida pela equipe do React e é ideal para iniciantes.


**Vantagens do CRA:**


- Facilidade de Uso: Configuração mínima. Ideal para iniciantes em React.
- Padrão: Mantido pela equipe do React, garantindo compatibilidade.
- Ampla Documentação: Recursos abundantes para aprendizado e suporte.


## Quando Usar:


- Iniciantes que estão aprendendo React.
- Projetos onde a simplicidade inicial é mais importante do que a performance máxima no desenvolvimento.
- Equipes que precisam de um setup confiável e bem documentado.


Espero que este post ajude você a escolher a ferramenta que melhor se adapta às suas necessidades. Bora codar!
Creation of Resource Group in MS Azure
Tags: cloud, beginners, computerscience, azure
Published: 2024-06-16 22:24:54

## Steps to Create a Resource Group on Azure

1. Login to MS Azure 
2. Search for resource group

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

Then select resource group.

3. Click on **+ Create**

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

The following create box comes up.

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

4. Type the name of your resource group and select your region, then click on **review and create**

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

5. Click on **create** to complete the creation of your resource group.

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



6. Click on **Go to resource group** to lunch your resource group.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vhmqrbm97i5moim5qpqz.png)
Elanat Brings Web-Forms Back to ASP.NET Core!
Tags: news, dotnet, backend, frontend
Published: 2024-06-16 21:49:54

The [Elanat team](https://elanat.net) will soon bring back the former Microsoft Web-Forms in ASP.NET Standard with a new and powerful architecture to ASP.NET Core. New Web-Forms will be added to the [CodeBehind Framework](https://github.com/elanatframework/Code_behind).

Over time, the Web-Forms architecture for developing websites using ASP.NET was out of fashion due to its problems and limitations. But Elanat team wants to bring Web-Forms back to ASP.NET Core by presenting a new revolutionary architecture. Elanat has incorporated new improvements to the former Web-Forms architecture and will surprise web developers. It has been tried to revive this architecture in a new and efficient way. The Elanat team has done comprehensive studies to eliminate all the weaknesses of the former Web-Forms; so, significant improvements can be seen in web-forms. With the addition of new Web-Forms to ASP.NET Core, you will see another revolutionary idea from the Elanat team. This is an important step in the evolution of web development!

Problems that existed in the former Web-Forms:

- The volume of data sent to the server was large
- The problem of constantly returning data from the server (Postback)
- The problem of enlarging the page with ViewState as a result of lower loading speed and more bandwidth usage
- Lack of control over HTML
- High pressure on the server due to the presence of web controls

The new Web-Forms that the Elanat team will provide will be combined with the MVC architecture and will give developers high maneuverability. This structure gives new and more flexible solutions in the development of websites and allows them to control their view pages more effectively and with higher quality without worrying about the performance of new Web-Forms.

In this new Web-Forms architecture, the front-end is completely abandoned and will give a new meaning to the web.

**Wait for this big surprise!**

### Related links

CodeBehind on GitHub:
https://github.com/elanatframework/Code_behind

CodeBehind in NuGet:
https://www.nuget.org/packages/CodeBehind/

CodeBehind page:
https://elanat.net/page_content/code_behind
Newsletter "What's up devs ?" is born !
Tags: webdev, newsletter, developers
Published: 2024-06-16 21:35:38

Hi devs, 

You may know that I publish a weekly French dev newsletter called "[Quoi de neuf les devs ?](https://happytodev.substack.com)".

**But today, I'm delighted to announce that its English version is born.**

It's called **"[What's up devs?](https://go.itanea.fr/wud1)"** and it's in the same spirit as its French sister: to give you the latest development news every week.

I'll try to keep the same rhythm as the French version, so I'll publish it every Friday. Occasionally, the newsletter may be published on Saturday, depending on how tired I am ;-)

So I leave you with this newsletter, which I'm very proud to present to you.

I hope you enjoy reading it as much as I enjoyed writing it.

Don't hesitate to give your opinion on the topics and content. I'll be reading your comments very carefully to improve this newsletter.

In this first issue, we'll be talking about  
✅ Go, 
✅ PostgreSQL, 
✅ CSS, 
✅ HTTP/3, 
✅ Laravel, 
✅ Python, 
✅ SQLite
and much more...

Take care and see you next friday !!
Grub-customizer:Install to MBR - NVME Disk
Published: 2024-06-16 21:34:07

I have multiple OS installed. Each have it's own bootloader/grub. I had done customization in grub-customizer. I want to make my current os bootloader default.

Find the nvme disk name
`df -h`

I see few entries like `/dev/nvme0n1p1`. I can understand last `p1` stands for partition. I removed it, `/dev/nvme0n1`. This value, `/dev/nvme0n1` is used successfully along with `File -> Install to MBR ...`.