teleren/devto huggingface dataset:
Explorando o Mundo dos Middlewares no ASP.NET Core: Uma Jornada pela Camada Intermediária
Tags: dotnet, programming
Published: 2024-02-28 13:12:32

## Introdução

No vasto ecossistema do ASP.NET Core, os Middlewares desempenham um papel crucial, muitas vezes operando como a camada intermediária entre a requisição do cliente e a resposta do servidor. Neste artigo, embarcaremos em uma jornada para entender o que são os Middlewares, como funcionam e por que são uma parte essencial do desenvolvimento de aplicações web modernas.

## O que é Middleware do ASP.NET Core

Os Middlewares são componentes que podem processar requisições HTTP, modificando-as, adicionando funcionalidades, ou até mesmo curvando o fluxo da requisição. Eles formam uma corrente de processamento, onde cada elo (Middleware) executa uma tarefa específica. No ASP.NET Core, a implementação modular e flexível dos Middlewares permite a construção de pipelines personalizados para atender às necessidades específicas de uma aplicação.

## Como Funciona

O pipeline de Middlewares no ASP.NET Core funciona de forma sequencial, com a requisição passando por cada Middleware na ordem em que foram configurados. Cada Middleware pode decidir passar a requisição adiante, encerrá-la, ou modificar tanto a requisição quanto a resposta. Isso proporciona um controle granular sobre o fluxo da aplicação e a capacidade de injetar funcionalidades em pontos específicos do ciclo de vida da requisição.

## Para que Serve

Os Middlewares servem para uma variedade de propósitos, desde autenticação e autorização até logging, compressão de resposta, e manipulação de erros. Eles oferecem uma abordagem modular para construir e estender funcionalidades, permitindo que os desenvolvedores personalizem o comportamento da aplicação de acordo com as necessidades específicas do projeto.

## Quando Usar

A utilização de Middlewares é recomendada sempre que há a necessidade de manipular ou estender o processamento de requisições HTTP. Eles são particularmente úteis para adicionar funcionalidades globais à aplicação, como autenticação, logging e tratamento de erros, sem acoplar essas responsabilidades diretamente ao código dos controladores.

Vamos criar um exemplo simples de um Middleware no ASP.NET Core que adiciona um cabeçalho personalizado a cada resposta. Este é um Middleware de exemplo para ilustrar o conceito.


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

Agora, para usar esse Middleware, você o registraria no método Configure no arquivo Startup.cs:


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6727ih93nsnr1cbib7u0.PNG)

## Conclusão

Em resumo, os Middlewares no ASP.NET Core representam uma ferramenta poderosa para a construção de aplicações web flexíveis e eficientes. Ao compreender como eles funcionam e para que servem, os desenvolvedores podem criar pipelines robustos que atendem às demandas específicas de seus projetos. Ao incorporar Middlewares de maneira inteligente, é possível alcançar um código mais modular, manutenível e adaptável às mudanças no cenário de desenvolvimento de software.
Wednesday Links - Edition 2024-02-28
Tags: java, jvm, 1brc, loom
Published: 2024-02-28 13:01:43

12 Lessons Learned From Doing The One Billion Row Challenge (6 min)🎓
https://foojay.io/today/12-lessons-learned-from-doing-the-one-billion-row-challenge/

The Billion Row Challenge (1BRC) - Step-by-step from 71s to 1.7s (30 min)🦶
https://questdb.io/blog/billion-row-challenge-step-by-step/

When should a compiler expand garbage collection barriers? (3 min)🗑️
https://robcasloz.github.io/blog/2024/02/14/when-should-a-compiler-expand-garbage-collection-barriers.html

java-httpserver-vthreads (1 min)🧵
https://github.com/ebarlas/java-httpserver-vthreads

Increase Test Fidelity By Avoiding Mocks (2 min)👕
https://testing.googleblog.com/2024/02/increase-test-fidelity-by-avoiding-mocks.html
Aplicație ce afișează citate în limba română
Tags: webdev, java, javascript, programming
Published: 2024-02-28 13:00:36

#### LINK PUBLIC APLICAȚIE: [AICI](https://quotes.fadevox.com/)

## Tehnologii utilizate:

**Backend:** Java, Spring Boot (Hostat pe [Render.com](https://render.com/))

**Frontend:** Node.js, Next.js 14, Axios (Hostat pe [Vercel.com](https://vercel.com/))

**Baza de date:** PostgreSQL (Hostat pe [Supabase.com](https://supabase.com/))

## Structura proiectului:

### Backend:

- `src/main/java/com.fadevox.quoteapp`:
    - `controller`: Controlere REST pentru gestionarea cererilor HTTP.
    - `service`: Clase de servicii pentru logică.
    - `repository`: Interfețe de depozit pentru interacțiunea cu baza de date.
    - `model`: Clase de entități reprezentând structuri de date.
    - `exception`: Excepție personalizată.
- `QuotesappApplication.java`: Controller-ul principal.

### Frontend:

- `app`: Conține fișierele pentru randarea layout-ului și landing page-ului.
- `public`: Conține resursele publice ale proiectului.
- `services`: Conține fișierele pentru preluarea datelor din REST API.
- Restul fișierelor de configurare din Next.js 14.

## Funcționalități:

- Afișarea unui citate aleator.
- Adăugare de noi citate (automat).

## Licență:

Acest proiect este licențiat sub licența GPL-3.0.


## Utilizare:

1. Accesați adresa URL https://quotes.fadevox.com/ în browserul dvs. web.
2. Veți vedea interfața grafică ce afișează un citat aleator.

## Notă:

Această aplicație este un exemplu simplu și poate fi extinsă cu ușurință pentru a include mai multe funcționalități.

## Contribuții:

Sunt binevenite contribuțiile la acest proiect. Puteți trimite pull request-uri pe GitHub (urmează a fi făcut public codul sursă).

## Mulțumiri:

- Proiectul Spring Boot
- Proiectul Next.js
- Comunitatea Java
- Comunitatea Node.js
Video — Deep dive: Compiling deep learning models, from XLA to PyTorch 2
Tags: compilers, ai, deeplearning, opensource
Published: 2024-02-29 15:44:24

---
title: Video — Deep dive: Compiling deep learning models, from XLA to PyTorch 2
published: true
date: 2024-02-28 12:52:17 UTC
tags: compilers,ai,deeplearning,opensource
canonical_url: https://julsimon.medium.com/video-deep-dive-compiling-deep-learning-models-from-xla-to-pytorch-2-f370c5a96a57
---

### Video — Deep dive: Compiling deep learning models, from XLA to PyTorch 2

![](https://cdn-images-1.medium.com/max/1024/1*uXT2EWuppeuMBOrqRxfRpw.png)

Compilation is an excellent technique to accelerate the training and inference of deep learning models, especially if it can be completely automated!

In this video, we discuss deep learning compilation, from the early days of TensorFlow to PyTorch 2. Along the way, you’ll learn about key technologies such as XLA, PyTorch/XLA, OpenXLA, TorchScript HLO, TorchDynamo, TorchInductor, and more. You’ll see where they fit and how they help accelerate models on a wide range of devices, including custom chips like Google TPU and AWS Inferentia 2.

Of course, we’ll also share some simple examples, including how to easily accelerate Hugging Face models with PyTorch 2 and torch.compile().

{% youtube Oo07fFb-aH0 %}
How AI Toolhouse can help you find the best AI Tools for Free?
Tags: aitools, productivity, discuss
Published: 2024-02-28 12:44:00

[AI Toolhouse](https://www.aitoolhouse.com/) emerges as a leading directory in the realm of artificial intelligence, offering an extensive array of over 3,600 AI tools and more than 2,100 GPTs. This platform distinguishes itself through its commitment to daily updates, ensuring the inclusion of the newest, thoroughly vetted AI tools and GPTs for its users. The directory is thoughtfully categorized, simplifying the search for tools tailored to specific needs, whether for development, business analytics, or AI art generation.

**Why Choose AI Toolhouse?**

AI Toolhouse is designed to serve as a bridge to the future of technology, presenting a well-organized, easily navigable database that caters to professionals and enthusiasts alike. Its diverse collection aims to support users in identifying the most suitable tools for their projects, fostering innovation across various sectors.

**Join the AI Toolhouse Community**

AI Toolhouse values the participation and feedback of its visitors, viewing it as essential to the platform’s continuous improvement and alignment with user needs. The team behind AI Toolhouse extends an invitation to explore their offerings and contribute insights, which are instrumental in shaping the platform’s evolution.

**Stay Informed with AI Toolhouse Newsletter**

Subscribing to the [AI Toolhouse newsletter](https://aitoolhouse.com/newsletter) enables individuals to become part of a growing community of over 6,000 enthusiasts. The newsletter offers updates on the latest AI tools and GPTs, alongside expert insights and exclusive content, all curated to enrich knowledge and inspire innovation.

AI Toolhouse Blog

They have recently released their blogs, they publish super awesome blogs on LLMs, RAG, AI Tools, Machine Learning, etc. Do check it out ➡️[AI Toolhouse Blog](https://blog.aitoolhouse.com/)
King Cobra Red
Tags: beginners, react, discuss
Published: 2024-02-28 12:27:38

Königskobra Rot ist eine faszinierende und beeindruckende Schöpfung der Natur. Diese exotische Schlange, auch bekannt als "**[King Cobra Red](https://pillenpalast.to/king-cobra-red/)**", zieht sofort die Aufmerksamkeit durch ihre leuchtend rote Farbgebung an. Ihr majestätisches Erscheinungsbild verleiht ihr einen königlichen Charme, der die Herzen von Reptilienliebhabern auf der ganzen Welt erobert. Die Königskobra Rot zeichnet sich nicht nur durch ihre auffällige Farbe aus, sondern auch durch ihre beeindruckende Größe und ihre eindrucksvolle Haltung. Diese Schlange ist dafür bekannt, zu den größten Giftschlangen der Welt zu gehören und kann Längen von bis zu fünf Metern erreichen. Ihr muskulöser Körper und ihre markante Kopfform verleihen ihr ein imposantes Erscheinungsbild. In ihrem natürlichen Lebensraum, vorwiegend in den tropischen Wäldern Südostasiens, ist die Königskobra Rot sowohl gefürchtet als auch respektiert. Ihr rotes Schuppenmuster dient nicht nur der Tarnung, sondern unterstreicht auch ihre Einzigartigkeit in der Welt der Reptilien. Als faszinierendes Beispiel für die Vielfalt der Natur fasziniert die Königskobra Rot Liebhaber von exotischen Tieren und symbolisiert die Schönheit und Gefahr, die in der Wildnis existieren.
style.json from Apple Pkl #2
Tags: pkl, json, maplibre
Published: 2024-02-28 12:20:09

Started to generate style.json...

## `1.pkl`
```
// my first attempt to generate style.json from a pkl file.

version = 8
center { -122.42 37.80 }
zoom = 10.42
sources = import("sources.pkl")
sprite = "https://tile.openstreetmap.jp/styles/maptiler-toner-en/sprite"
glyphs = "https://tile.openstreetmap.jp/fonts/{fontstack}/{range}.pbf"
layers = new Listing {
    import("background.pkl")
}
```

## `sources.pkl`
```
module sources

openmaptiles {
    type = "vector"
    url = "https://tile.openstreetmap.jp/data/planet.json"
}
```

## `background.pkl`
```
module background

id = "background"
paint { background_color = "#fff" }
```

## `Makefile`
```
use_color: 
	pkl eval -f json use_color.pkl
1: 
	pkl eval -f json 1.pkl
```

## Result
```
% make 1
pkl eval -f json 1.pkl
{
  "version": 8,
  "center": [
    -122.42,
    37.8
  ],
  "zoom": 10.42,
  "sources": {
    "openmaptiles": {
      "type": "vector",
      "url": "https://tile.openstreetmap.jp/data/planet.json"
    }
  },
  "sprite": "https://tile.openstreetmap.jp/styles/maptiler-toner-en/sprite",
  "glyphs": "https://tile.openstreetmap.jp/fonts/{fontstack}/{range}.pbf",
  "layers": [
    {
      "id": "background",
      "paint": {
        "background_color": "#fff"
      }
    },
    {
      "id": "cde"
    }
  ]
}
hfu@smart pkl-test % make 1
pkl eval -f json 1.pkl
{
hfu@smart pkl-test % make 1
pkl eval -f json 1.pkl
{
  "version": 8,
  "center": [
    -122.42,
    37.8
  ],
  "zoom": 10.42,
  "sources": {
    "openmaptiles": {
      "type": "vector",
      "url": "https://tile.openstreetmap.jp/data/planet.json"
    }
  },
  "sprite": "https://tile.openstreetmap.jp/styles/maptiler-toner-en/sprite",
  "glyphs": "https://tile.openstreetmap.jp/fonts/{fontstack}/{range}.pbf",
  "layers": [
    {
      "id": "background",
      "paint": {
        "background_color": "#fff"
      }
    }
  ]
}
```

## Repository
https://github.com/hfu/pkl-test
Top 3 AI trends in software development
Tags: ai, softwaredevelopment, webdev, beginners
Published: 2024-02-28 12:20:04

Machine learning and AI tools are being developed to solve specific challenges and automate a wide range of manual tasks. There will only be an increase in these investments in the future. According to Facts & Factors, AI and ML spending is expected to reach **$299.64 billion in 2026.**
 
These technologies offer endless possibilities for deployment and experimentation. Below, we have mentioned the three major trends that will evolve the software development. 

### Customer experience connects with AI

The COVID-19 crisis prompted enterprises to adapt their working arrangements and consumer habits in response to AI and analytics. In response, AI is increasingly being used to create interactive, engaging, and action-driven customer experience (CX) designs that are human-centric.

Analytics and artificial intelligence can help organizations accelerate innovation. Introducing a new chatbot to handle a growing percentage of common inquiries was a primary motivation for a leading benefits card company.

### Automated ML gains traction
As AI and machine learning evolve, they are automating themselves, making AI-based software development faster, even for users who are not experts in the field. As a result, many companies across a wide range of industries are experimenting with and adopting the technology.

The use of new techniques, such as automated machine learning (AutoML), is becoming increasingly popular, helping companies that may not have the necessary computing resources to deploy ML and achieve better results.

### NLP will Evolve
NLP means Natural Language Processing. As part of AI and machine learning, it allows a computer program to understand and respond to human language. With NLP, chatbots, translators, and voice assistants have been developed.

The availability of pre-trained models makes NLP continue to improve over time. The goal of NLP is to identify patterns in unstructured data in order to determine user behavior. Companies can use it in call centers, for instance, to interpret audio signals, translate them into text, and then analyze the text.
Steps To Remove/Delete Domain Name from cPanel?
Tags: beginners, cpanel, tutorial
Published: 2024-02-28 12:19:10

You can delete or erase a domain name from cPanel if you decide you no longer want to use it. 

The procedures listed below must be followed to erase the domain name from cPanel. 

1. Enter your username and password to access your cPanel. 
2. Navigate to the Domains area. A list of domains connected to your hosting account will be visible to you. 
3. Select the domain you wish to delete from the list by clicking on it, and then select Manage. A list of domain names connected to your hosting account will now appear.
4. Lastly, select the Remove Domain option. 

Thus, you can take the domain name out of your web hosting account in this way.
แชร์ไฟล์ Prettier ง่ายๆ แค่ปลายนิ้ว!
Tags: prettier, codeformatting, cleancode, webdev
Published: 2024-02-28 12:15:54

เคยไหม? เขียนโค้ดเสร็จ แต่ format ไม่สวย อ่านยาก 😩

Prettier ช่วยคุณได้! 🪄

Prettier เป็นตัวจัดรูปแบบโค้ดอัตโนมัติ ช่วยให้โค้ดของคุณสวยงาม อ่านง่าย และเป็นระเบียบ โดยไม่ต้องเสียเวลาจัด format เอง

เมื่อสร้างโปรเจ็กต์มากขึ้นเรื่อยๆ ฉันได้มองหาวิธีที่จะแบ่งปันไฟล์กำหนดค่า `Prettier `โชคดีที่ `Prettier `รองรับฟีเจอร์นี้แล้ว

คุณต้องเผยแพร่โมดูลที่มีการตั้งค่า Prettier ที่ปรับแต่งเองเท่านั้น

วิธีทำ

## 1.สร้างไฟล์

- `package.json` เก็บข้อมูลโมดูล
- `index.json` เก็บการตั้งค่า `Prettier`

## 2.ใส่ข้อมูลในไฟล์

package.json

```json
{
  "name": "@your-name/prettier-config",
  "version": "1.0.1",
  "description": "Prettier Config",
  "main": "index.json",
  "license": "MIT",
  "keywords": [
    "prettier",
    "prettier-config"
  ],
  "repository": {
    "type": "git",
    "url": "https://github.com/"
  },
  "homepage": "https://github.com/"
}
```

index.json

```json
{
  "semi": true,
  "singleQuote": true,
  "tabWidth": 2,
  "trailingComma": "none",
  "printWidth": 100
}
```

## 3. publish โมดูล


## 4. ใช้ในโปรเจ็กต์อื่น

หากคุณต้องการใช้การตั้งค่า Prettier ที่แชร์ไว้ในโปรเจ็กต์อื่น คุณต้องอ้างอิงถึงมันในไฟล์ manifest package.json ของโปรเจ็กต์ของคุณโดยเพิ่มพารามิเตอร์ prettier:

**ตัวอย่าง**

```json
{
  "name": "my-cool-library",
  // ...
  "prettier": "@your-name-here/prettier-config"
  // ...
}
```
แค่นี้ก็เรียบร้อย!

ลองใช้ `Prettier `เพื่อจัดรูปแบบโค้ดให้สวยงามและอ่านง่าย
The runtime parameter of nodejs14.x is no longer supported for creating or updating AWS Lambda functions
Published: 2024-02-28 12:12:46

On the 25th of February, 2024, AWS made a change:

> Starting January 25, 2024, you will no longer be able to update existing functions using the Node.js 14 runtime.

and if you attempt to do so, you hit this error:

> InvalidParameterValueException: The runtime parameter of nodejs14.x is no longer supported for creating or updating AWS Lambda functions

But I'm not using nodejs14.x to create or update lambda functions. 

Or am I?

I didn't think I was, my runtimes in AWS CodeBuild and Serverless Framework were all set to 16.. but I was using an extra component with serverless framework.. that component was [https://www.npmjs.com/package/@sls-next/serverless-component](https://www.npmjs.com/package/@sls-next/serverless-component)

and internally somewhere.. this component uses lambda. And those Lambda functions were trying to be created with nodejs 14. 

Thanks to an awesome comment I found on [github](https://github.com/serverless-nextjs/serverless-next.js/issues/2600#issuecomment-1947781835) I learned you can simply change your internal serverless-component runtime to nodejs20.x and it should fix your issues. It did for me. 


```
blah:
  component: "@sls-next/serverless-component"
  stage: dev
  inputs:
    bucketName: ${env.AWS_S3_BUCKET}
    bucketRegion: ap-southeast-2
    cloudfront:
      distributionId: ${env.AWS_CFID}
    runtime:
      defaultLambda: 'nodejs20.x'
```

Deploy, and the problem goes away.
Writting Simple OnceCell
Tags: rust, typesystems, demo
Published: 2024-02-28 12:02:42

Always been interested in how rust handles mutability internally and started reading up on UnsafeCell and MaybeUinit. 

Decided to write a simple OnceCell, will try to make it static in the future.

{% embed https://github.com/StaticallyTypedAnxiety/SimpleCell  %}
How to create a Notion Blog
Published: 2024-02-28 12:00:57

I always wanted to create a blog, but I didn’t know how, or what to write.

Should I go with Wordpress? Or build something myself? Which Techstack do I choose?

Yesterday, I found this **awesome** repository on Github (https://github.com/transitive-bullshit/nextjs-notion-starter-kit).

 It takes a published Notion site and turns it into a blog. The site itself runs with NextJS which means you can just fork the repo, create a new project on Vercel & upload it.

I wanted to show you how ease it is, to create a notion blog. And how good it can be. 

But before I want to mention some downsides:

You cannot control the time of publishing or read through it after you finished it. 

Probably this article was accessibly while writing it. 

Also there is no comment section.

For me this is not necessary, that’s why I go with it.

Here is how you do it:

1. Create a new Notion Site called Blog. 
2. Inside of this Site create a new Site with your Blog name and publish it.


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



*That was the Notion site. You can now add sub pages to your public page and write articles.* 

If you like to draft articles instead of writing live I suggest you to write your articles outside of the public accessable blog site which is named after your blog.

Now let’s setup the rest.

1. Fork the repository above
2. Create a new Vercel project with your forked project.
3. Now change the site.config.ts and put in your data:


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



1. The Notion page id is the alphanumeric combination in your page’s url if you open it in a browser:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fdmggo7oluoa9j74w3ap.png)

1. Fill out basic site info and comment/uncomment the social networks you want to link on your new blog.
2. **Done!**

Lastly you can connect your own domain to the Vercel page and then your own Notion blog is ready to take off!
TW Elements - Arbitrary values. Free UI/UX design course
Tags: webdev, ui, uxdesign, ux
Published: 2024-02-28 12:00:00

**Arbitrary values**

Arbitrary value support in Tailwind CSS allows you to use any custom value with any utility where it makes sense. It's a powerful feature introduced in Tailwind CSS v2.2. This means you're no longer limited by the values defined in your configuration file and can use any value you need right in your HTML.

For example, if you want to set a width that isn't available in Tailwind CSS classes, you can now do so like this; HTML:

```
<div class="w-[123px]">[...]</div>
```

In the above example, [123px] is an arbitrary value that sets the width of the element to 123px.

**Arbitrary values with modifiers**

You can also use arbitrary values with responsive design, hover state, etc:

```
<div class="hover:w-[123px] md:w-[456px]">[...]</div>
```

In this example, the width of the element will be 456px on medium screens (md:w-[456px]), and the width will change to 123px on hover (hover:w-[123px]).

This feature also supports other units, not just pixels. You can use rem units, percentages, etc. Additionally, you can use this feature with most of the utility classes in Tailwind CSS, such as padding, margin, translate, scale, rotate, skew, grid, etc.

Arbitrary values give you a lot more flexibility and power when using Tailwind CSS. They allow you to have the benefits of utility-first CSS while still being able to use any value you need, right in your markup.

**Fixing the Hero Image using arbitrary values** 

In the previous lesson, we finished our full screen Hero Image. On large screens, it fills the available space perfectly, down to the pixel.

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

However, there is a problem in the mobile view - there is a small, empty space at the bottom.

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

That's because Navbar is a flexible component and adapts to its content. In the mobile view, the Navbar collapses and hides most of its elements, which reduces its height.

And as you remember, we set our Hero Image margin-top: -56px; , because that's the height of the Navbar on large screens.

So we need to make sure that on other screen sizes the height of the Navbar stays the same, which is 56px.

This is the perfect opportunity to use arbitrary values.

Add min-h-[56px] to Navbar.

The min-h- class defines the minimum height for a given element, and [56px] is the height given in the form of arbitrary values that we want to maintain on all screens.

```
<!-- Navbar -->
<nav
  class="flex-no-wrap relative flex min-h-[56px] w-full items-center justify-between bg-white py-2 shadow-md shadow-black/5 dark:bg-neutral-600 dark:shadow-black/10 lg:flex-wrap lg:justify-start lg:py-4"
  data-te-navbar-ref>
  [...]
</nav>
```

Now it's pixel-perfect on every screen size 🤩

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

**[Demo and source code for this lesson](https://tw-elements.com/snippets/tailwind/ascensus/5324520)**