teleren/devto huggingface dataset:
How to disable cache in Xampp and NodeJs Server
Tags: webdev, cache
Published: 2024-06-07 17:13:17

When developing frontend sometimes i use NodeJs and Xampp as servers. Sometimes Caching of static files becomes a problem such as styles dont update even though the css files are modified. So i needed to disable the caching.

## XAMPP Server

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

Edit `httpd.conf` ([xampp folder]/apache/conf/http.conf) file and add following at the end:

```conf
# Don't cache html, htm, js, css

<filesMatch "\.(html|htm|js|css)$">
  FileETag None
  <ifModule mod_headers.c>
     Header unset ETag
     Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
     Header set Pragma "no-cache"
     Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
  </ifModule>
</filesMatch>
```

## NodeJS Server

Use `nocache` module.
```shell
pnpm i nocache
```

```js
const nocache = require('nocache');
app.use(nocache());
```

OR

Use set `etag` to `false`
```js
app.set('etag', false);
```
What games are trending with players on this gaming platform ?
Tags: gamedev, mobile, games, mobilegames
Published: 2024-06-07 17:01:47

This [gaming platform](https://medium.com/@adreeshelk/nostra-games-how-to-play-many-games-on-your-lock-screen-without-downloading-anything-c66b56cfb175?utm_source=referral&utm_medium=Medium&utm_campaign=Nostra) isn't just a platform for [mobile games](https://nostra.gg/articles/Lock-Screen-Games-Are-a-Game-Changer-for-Gaming-Developers.html?utm_source=referral&utm_medium=article&utm_campaign=Nostra); it's a microcosm of the hottest trends currently captivating players. As a popular game host housing a fascinating mix of genres dominating the charts on , and here's what's resonating with audiences:

1. A Genre Buffet: Gone are the days of one-size-fits-all mobile games. This gaming platform thrives on diversity, offering a delectable spread for various gaming palates.  Strategy buffs can lose themselves in tactical battles like "CyberStrike 2050," while RPG enthusiasts like myself can embark on epic adventures in "Mystic Quest." This breadth of genres ensures there's something for everyone, and the consistent player engagement across these categories highlights ability to cater to diverse preferences.

2. This [gaming platform ](https://medium.com/@adreeshelk/playground-of-nostra-gaming-adventure-9e9828101d85?utm_source=referral&utm_medium=Medium&utm_campaign=Nostra)Knows its Players:  Understanding your audience is key to success, and excels in this.  By recognizing the personas of its player base, they've curated a library that caters to specific needs. "Skill Seekers" (52%), for instance, revel in games like "Blox Live Wallpapers" that demand mastery of mechanics.  Meanwhile, "Achievers" (55%) find their fix in games like "Falling Blocks," where completing challenges unlocks rewards and fuels their sense of accomplishment. This gaming platform provides a playground for these distinct player motivations.

3. The Power of Community:  Gaming isn't just about solitary pursuits anymore. This gaming platform fosters a vibrant community through its innovative live-streaming feature.  This allows players like you and me to showcase our prowess, share strategies, and connect with fellow gamers in real-time. It's a fantastic space to learn, compete, and forge friendships united by a love for games.

4. Keeping the Flame Alive:  This gaming platform understands that competition and fresh content are vital for a thriving gaming ecosystem. That's why they host exciting "Gaming Week" events.  These events give aspiring developers a platform to showcase their talent, while regular tournaments keep the competitive spirit alive for players. It's a win-win scenario that fuels innovation and ensures a constant stream of engaging experiences.

This gaming platform focus on fostering a diverse gaming landscape, nurturing a strong community, and keeping the competitive spirit high has propelled them to the forefront of the mobile gaming industry.  They've redefined the gaming experience by going beyond just hosting games – they're building a connected, vibrant world for gamers to explore and conquer.
Dependency Inversion Principle
Tags: dependencyinversion, solidprinciples
Published: 2024-06-10 02:20:26

---
title: Dependency Inversion Principle
published: true
date: 2024-06-07 16:59:29 UTC
tags: dependencyinversion,SOLIDprinciples
canonical_url: https://gurupalaniveltech.hashnode.dev/dependency-inversion-principle
---

The Dependency Inversion Principle (DIP) states that high level modules(Payment ) should not depend on low level modules(**UpiPayment ,CryptoPayment)**; both should depend on abstractions(PaymentGateway). Abstractions should not depend on details.

```java
public class Payment {
    public void processPayment(UpiPayment upiPayment) {
        // Implementation for processing UPI payment
    }
}

class UpiPayment {
    // UPI payment related properties and methods
}
```

Tomm you want to add CryptoPayment you need to modify the Payment class this bad .

### Good Practice Principle not followed

```java

public class Payment {
    public void processPayment(PaymentGateway paymentGateway) {
        // Implementation for processing payment via PaymentGateway
    }
}

interface PaymentGateway {
    // Payment gateway related methods
}

class UpiPayment implements PaymentGateway {
    // UPI payment related properties and methods
}

class CryptoPayment implements PaymentGateway {
    // Cryptocurrency payment related properties and methods
}
```
Fixtures do Cypress para testes
Tags: ledscommunity, cypress, fixtures
Published: 2024-06-07 16:58:53

## Conhecimentos prévios

### Cypress, Cucumber, BDD
Veja a aplicação no Slave One: 
https://dev.to/marcela_lage_094e814c6a4e/documentacao-dos-testes-do-sistema-slave-one-2kmb

### Fixtures

As fixtures do Cypress são dados estáticos que podem ser utilizados pelos testes. O arquivo é em formato JSON.

### Intercept

O intercept é um comando do Cypress que pode ser usado para capturar, vigiar ou modificar uma requisição.
[Link da documentação](https://docs.cypress.io/api/commands/intercept)

## Testes com os dados da fixture

Inicialmente, deve-se criar os arquivos de fixture que terão os dados utilizados na página. 

![Estrutura das pastas](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/58pu9377p1jyepu1w3aa.png)

A estrutura do JSON deve ser a mesma da resposta da requisição.

![Exemplo arquivo JSON da fixture com os valores de name e id de cada objeto que aparecerá na aplicação](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c9zv99vx5b0xi8cdcime.png)

Para encontrar qual requisição interceptar, execute seu teste Cypress e observe-se no passo a passo qual requisição retorna os dados que pretende substituir. 

![Exemplo de requisição no Cypress](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a4pxfm2l17ze8spwpzgp.png)

Após, deve-se capturar e alterar a resposta usando o intercept:

![Código de intercept passando primeiro o parâmetro da requisição e depois a fixture que será usada](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x3lyt8kgykbdowy6r9mt.png)

O `intercept` trocará a resposta da requisição `https://localhost:3000/api/Function` pela fixture do arquivo `Function` e o comando `as` permitirá que o Cypress acesse essa ação pelo `wait` para esperar que a mudança aconteça. 

![Resultado da mudança](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mj8rr0ak67agvq4z3a0k.png)

OBS: o intercept deve ser usado antes da requisição acontecer e o wait deve ser utilizado após. No exemplo, o clique de `elements.functionPageBtn().click()` precede a requisição.

Dessa forma, os dados das fixtures estarão sendo utilizados para aplicação. Para que funcione sem nenhum dado, utilize o intercept em todas as requisições, mesmo aquelas que não retornam dados para apresentar na tela.

Exemplos:

![Código após fazer um delete](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6hj1q3wzlzohulf4jmzm.png)

Nessa função, são feitas duas interceptações. A primeira, retorna um JSON vazio para que a página entenda que a ação de deletar foi concluída com sucesso.
FunctionDeleteComplete.json

![Arquivo json vazio](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2al461tzw44xhqaa6bmx.png)

FunctionAfterDelete.json

![Arquivo com as informações, sem o cadastro que supostamente foi deletado](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1kghe3cqyrapkyuzip6v.png)

Resultado final:

![Resultado final das ações](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/otdy8841xb6xeondk1s1.png)
Home K Custom Boxes - K Custom Boxes
Published: 2024-06-07 16:49:30

Kcustom Boxes understands that custom packaging varies from business to business. That’s why we have created categories of boxes, such as customized boxes for your food, retail, cosmetics, and CBD businesses.

In addition, we are proud to say that we excel in our printing services. We print stickers, labels, logos, business cards, invitations, and more in graceful and vibrant colors. Here is a brief introduction to our few categories:
Home K Custom Boxes - K Custom Boxes
Published: 2024-06-07 16:47:16

Kcustom Boxes understands that custom packaging varies from business to business. That’s why we have created categories of boxes, such as customized boxes for your food, retail, cosmetics, and CBD businesses.

In addition, we are proud to say that we excel in our printing services. We print stickers, labels, logos, business cards, invitations, and more in graceful and vibrant colors. Here is a brief introduction to our few categories:
CSS Animations Made EZ
Tags: webdev, ai, css, design
Published: 2024-06-07 16:15:38

I released a free AI CSS animation generator a month ago, my first software in the animation space.

As a dev/designer, I was frustrated with the annoying & tedious process of writing keyframe animations. The lack of good tools available led me to build my own solution.

After a month of intense development, it’s ready! Now, I'm reaching out to the Dev.to community for feedback and beta testers to help refine things further :)

If you're interested in making some slick animations for your site, I'd love for you to try it out and share your thoughts! Looking for harsh criticisms here, don’t hold back!

[Aicssanimations.com](https://www.aicssanimations.com/)
242. Valid Anagram
Published: 2024-06-07 16:31:46

Topic: Array & Hashing



Soln 1 (dictonary solution):

1. Compare the lengths of both strings.
2. If they are not the same length, they are not anagrams.
3. Create a new dictionary called count.
4. Loop through the characters in s:
- If the character already exists in the dictionary, then increment its value by 1.
- Else, assign the value of the key to 1.
5. Loop through the characters in t:
- If the character does not exist in the dictionary or the character count is 0, then return False.
- Else, decrement the value of the character by 1.
- Return True.


```
class Solution:
    def isAnagram(self, s: str, t: str) -> bool:
        if len(s) != len(t):
            return False
        
        count = {}

        for char in s:
            if char in count:
                count[char]+=1
            else:
                count[char] = 1

        for char in t:
            if char not in count or count[char] == 0:
                return False
            count[char]-=1
        return True 

```

Soln 2 (set solution):

1. Compare the lengths of both strings.
2. If they are not the same length, they are not anagrams.
3. Loop through the characters in the set of s (set removes the duplicates):
- If the count of any character in s is not equal to the count of the same character in t:
- then return False.
5. If all character counts match, then the strings are anagrams (return True).

```
class Solution:
    def isAnagram(self, s: str, t: str) -> bool:
        if len(s) != len(t):
            return False 
        for i in set(s): 
            if s.count(i) != t.count(i):
                return False
        return True   
```
Soln 3:
A very obvious solution:

1. Alphabetically sort both strings (s, t) and compare them. 
Returns True if they both are the same length and contain the same characters, else False if they do not. (Yes, all on the same line.)

```
class Solution:
    def isAnagram(self, s: str, t: str) -> bool:
        return sorted(s) == sorted(t)
```
Notes:
Sets & dictionaries are unordered and unique, although dictionaries can contain duplicates values
Announcing runtime-environment: A Rust Crate for Detecting Operating Systems at Runtime
Tags: rust, codenewbie, beginners, showdev
Published: 2024-06-07 16:26:07

Hey!

I am excited to announce the release of my new Rust crate as part of my learning process “runtime_environment”! 🦀 

This pack is perfect for programmers who want to detect operating systems at runtime. It also provides a flexible toolkit for this purpose which is commonly encountered in software development.

### Why is it important to detect runtime environments?

Knowing where your code runs can be crucial so as to make sure it is compatible with other platforms, run efficiently or even provide a specific functionality. With ‘runtime-environment’ you can decide if your codes are running on macOS, Windows, Linux among others quite easily.

### Introducing “runtime-environment”

The aim behind creating the rust projects with crates like “Runtime-Environment” was simply about making OS detection simpler. It comes with numerous functions that allow one to determine the runtime environment and adjust their code accordingly.

{% embed https://github.com/DhanushNehru/runtime_environment %}

⭐️ Feel free to show your support by starring the repository! ⭐️

### Getting Started

Getting started with "runtime-environment" is simple. First, install the crate via Cargo:

```rust
cargo add runtime-environment
```

For more information on how to use the crate, check out the [documentation on crates.io](https://crates.io/crates/runtime_environment). 

---- 

_Thanks for reading, please give a like as a sort of encouragement and also share this post in socials to show your extended support._

**Connect** ⬇️ 
[**Twitter**](https://twitter.com/Dhanush_Nehru) **/** [**Instagram**](https://www.instagram.com/dhanush_nehru/) **/** [**Github**](https://github.com/DhanushNehru/) **/** [**Youtube**](https://www.youtube.com/@dhanushnehru?sub_confirmation=1) **/** [**Newsletter**](https://dhanushn.substack.com/) **/** [**Discord**](https://discord.com/invite/Yn9g6KuWyA)
Day 11 of my progress as a vue dev
Tags: webdev, vue, typescript, tailwindcss
Published: 2024-06-07 16:24:55

**About today**
Let's start from past few days. I made a lot of new changes in my approach of work and my daily schedule and have been experimenting with some stuff. I missed to post here for past 2 days and do regret about breaking my streak. However I feel like doing something doesn't make a lot of sense if you're not doing it right, hence I took the time to reconfigure the whole process of my work. I made a fresh schedule which I somewhat followed for past 2 days and I feel confident that I can continue it for the next 48 days and make it consistent throughout, sort of like a 50 days challenge. Coming back to vue, I ended up finishing the functional implementation of tree structure in my DSA visualizer project and for now dealing with a basic visual approach.

**What's next?**
I'm going to focus more on the quality of work I do in a day rather than the number of hours spent and I will make sure when I sit to work I give it my 100%, at least for the next 48 days and see how I like the grind and if it becomes a part of my habit. On the project end I still need to polish it on the visual end because it is not all the way there.

**Improvements required**
Need to stay focused on achieving as I'm tired of getting lazy and giving up over and over again, I need this to work in order to get a positive change in my live. Also, I need my project to stand out so I will be giving it a push in terms of efficiency and visualization than most usual DSA projects out there.

Wish me luck!
Azure components of Azure
Published: 2024-06-07 16:13:17

Even if you've been using Azure for a while, you might not be fully aware of what the essential elements of this massive cloud provider are.

We'll examine what I think are the three essential elements of Azure's internal architecture in this article:

1. Regions
2. Availability Zones 
3. Data warehouses or centers

Let's examine each one in greater depth.

**1. Regions**

Azure regions are defined as geographical locations that house several data centers. Every region is created to give consumers the best possible security and performance.

The majority of the time, a single Region contains several datacenters that are connected to one another by a low-latency network so that they can interact.

Here are some essential details regarding Azure regions:

1. UK South
2. East Asia
3. Australia East
4. Brazil South
5. France Central

You can find out full list of Azure Regions on their official website, here. [Link](https://azure.microsoft.com/en-us/explore/global-infrastructure/geographies/#geographies) 

Almost all services inside Azure require you to specify in which Region you want the resource deployed. Now, we know that a region is simply a bunch of datacenters in the same area.

**2. Availability Zones**
A collection of datacenters makes up an Azure Availability Zone, which is smaller than an Azure Region. As a result, an Azure Region may alternatively be thought of as a collection of one or more Availability Zones.

Availability Zones' seclusion is what gives them their power. The other Zones in the Region will keep operating normally even if one goes down.

This makes an Azure Region "available," as the name implies, even in the event that several datacenters experience technical difficulties.

**3. Datacenters**
Datacenters are situated at its very core. They may be compared to enormous structures housing a separate network, power, and cooling system for each server.

Azure is a worldwide supplier, thus these big structures, or datacenters, are located all over the world. Datacenters are organized into Azure Regions to make it more secure and easier for developers to deal with.

**The main conclusions of this piece.**
A data center is made up of several servers.

An Azure Availability Zone is created by a collection of datacenters.

An Azure Region is formed from a collection of Availability Zones.

Thank you for reading and please do check out my profile for more blogs on Azure and AWS services.
Need help with GPO
Tags: computerscience
Published: 2024-06-07 15:57:00

I have developed a lab with one domain controller and a domain joined machine. Now I have implemented a group policy for folder redirection which redirects the desktop, downloads and documents folder to a SMB share on the DC. The GPO works on the desktop folder but not on the downloads and documents folder. I have done gpupdate /force command multiple times and even rebooted the machine quite a few times. The folder redirection stays in desktop but not on other folders. What should i do to troubleshoot it
Connection Pooling in Spring Boot
Tags: springboot, database, connectionpooling
Published: 2024-06-07 15:46:59

connection pooling is a method specifically designed to manage and reuse database connections, enhancing the performance of applications that interact with databases.
A database connection acts as a bridge between a Java application and a database server. Establishing and terminating these connections should be making efficient management crucial for optimal application performance.
**Connection pooling** involves creating a pre-established database connections that can be reused. This is contributes reduces the overhead of establishing new connections for each database operation, thereby enhancing application efficiency & concurrency controlling.


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

Without connection pooling, database interaction would require establishing a new connection and terminating it afterward. This repetitive task & occur the overhead, leading to additionally effort to potential resource drain. Connection pooling resolve these issues by reusing existing connections & it will be in improved efficiency, concurrency, and overall system stability.

The Spring boot introduce the HikariCP for connection pool implementation. 

HikariCP can configure in your application.properties file

`# HikariCP settings
spring.datasource.hikari.maximum-pool-size=10
spring.datasource.hikari.minimum-idle=5
spring.datasource.hikari.idle-timeout=600000
spring.datasource.hikari.connection-timeout=30000
spring.datasource.hikari.max-lifetime=1800000
spring.datasource.hikari.leak-detection-threshold=2000
spring.datasource.hikari.pool-name=MyHikariCP`

**Summery**

Connection pooling is a vital mechanism for enhancing the performance and scalability of applications that interact with databases. By maintaining a pool of reusable database connections, connection pooling minimizes the overhead associated with establishing and tearing down connections for each database operation. This approach not only optimizes resource utilization but also improves application responsiveness and stability.
FastAPI Beyond CRUD Part 8 - User Account Creation (Email & Password Auth)
Tags: fastapi, python, api, programming
Published: 2024-06-07 15:35:09

In this video, we employ the user authentication model developed in the previous segment to enable users to create accounts within our application. Our process starts with establishing the API endpoints and incorporating the required database fields. Subsequently, we implement the logic in a service file and integrate it into our API endpoints.

{%youtube iIwKWNGWtyk%}
Creating Win32 Intunewin packages
Published: 2024-06-07 15:29:18

Hi,

I would like to share a GUI based Powershell script that will help create Intunewin files for Microsoft Intune.

https://github.com/rink-turksma/IntunePrepTool

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


#Intune
#powershell

Greetings