teleren/devto huggingface dataset:
RTK Query Vs React Query Which one is Better?
Published: 2023-10-30 14:03:45

RTK Query and React Query are two popular libraries used in the React ecosystem to manage data fetching, caching, and state management. Each of these libraries has its own unique features and advantages. Here's a comparison of the three:

1. RTK Query (Redux Toolkit Query):
  Redux Toolkit Query is an extension of the Redux Toolkit library that provides a set of tools for managing data fetching and caching. It integrates seamlessly with Redux, making it a good choice for projects already using Redux.

  Key Features:
  - Built on top of Redux Toolkit, so it works well with Redux-based applications.
  - Automatic caching and background data synchronization.
  - Integrated error handling and retries.
  - Powerful querying syntax with support for pagination, sorting, and filtering.
  - Optimistic updates for optimistic UI rendering.
  - Integration with the Redux store, allowing data to be easily accessed and updated through Redux slices.
  - Built-in support for TypeScript.

2. React Query:
  React Query is a standalone library focused on data fetching and caching, without requiring Redux. It aims to simplify data fetching in React applications and provides a clean and declarative API.

  Key Features:
  - Built-in caching with automatic background data synchronization.
  - Flexible and declarative API for defining queries, mutations, and invalidations.
  - Granular control over query invalidation and cache management.
  - Supports various data sources like REST, GraphQL, and more.
  - Integration with Suspense for concurrent rendering.
  - Optimistic updates for optimistic UI rendering.
  - Built-in support for server-side rendering (SSR).
  - Great TypeScript support.

3. Redux Toolkit Query (RTK Query) vs. React Query:
  - Redux Toolkit Query is more tightly integrated with Redux and might be preferred in projects where Redux is already a core part of the state management.
  - React Query is a standalone library and doesn't require Redux. It can be a good fit for projects that want to keep state management separate from data fetching concerns.
  - Both libraries offer automatic caching, background synchronization, and optimistic updates.
  - React Query provides a more flexible and declarative API for query invalidation and cache management.
  - RTK Query leverages Redux slices and stores for data access and updates, which might be more comfortable for developers familiar with Redux concepts.
  - React Query has a strong focus on concurrency and supports Suspense, which can lead to a smoother user experience during data loading.

In summary, the choice between RTK Query, React Query, and Redux Toolkit Query depends on your project's requirements and existing architecture. If you're heavily invested in Redux, RTK Query might be a good fit. If you're looking for a standalone data-fetching solution with a clean API, React Query is a strong contender.
What is the useMemo Hook in React?
Published: 2023-10-30 14:01:30

`useMemo` is a hook in React that is used to memorize the output of a function. It helps in performance optimization by ensuring that expensive computations don't run unless necessary.

When you use `useMemo`, you provide it with a function and a list of dependencies. React will call that function and memorize its return value whenever the dependencies have changed between renders. If the dependencies haven't changed, React will skip the function call and reuse the memorized value from the previous render.

Here's a basic example:

```javascript
import React, { useState, useMemo } from 'react';

function ExpensiveComputationComponent({ num }) {
const computeExpensiveValue = (n) => {
console.log('Computing...');
return n * n; // For demonstration. Replace this with any expensive computation.
};

const expensiveValue = useMemo(() => computeExpensiveValue(num), [num]);

return <div>Expensive value: {expensiveValue}</div>;
}

function App() {
const [number, setNumber] = useState(0);

return (
<div>
<button onClick={() => setNumber(number + 1)}>Increment</button>
<ExpensiveComputationComponent num={number} />
</div>
);
}

export default App;
```

In the above example, `computeExpensiveValue` will only be called when `num` changes. On subsequent renders with the same `num`, the previously computed value will be used, and the expensive function won't be called again.

Keep in mind that `useMemo` should be used judiciously. Not every computation needs memoization, and overusing it can lead to unnecessary complexity and even reduce performance in some cases.
How to Write Code Using Hidden Methods
Published: 2023-10-30 14:00:58

`
//
@ type{...}
*/

When working with the DOM in JavaScript and handling events, it's common to write the event handler function outside the addEventListener method for simplicity. However, doing so can cause the loss of the this context, making it difficult to access methods and properties that are supported by the this object.
How to use it when accessing, how should I write param @type
To install Firewall Command In Centos_linux
Tags: centos, linux, firewall
Published: 2023-10-30 13:59:18

## **STEP 1:**
Update your package repository 
```
sudo yum update
```

## **STEP 2:**
install **firewalld**
```
sudo yum install firewalld
```

## **STEP 3:**
## Start the firewalld service and enable it to start at boot:
```
sudo systemctl start firewalld
sudo systemctl enable firewalld
```

## **STEP 4:**
## You can check the status of the firewalld service:

```
sudo systemctl status firewalld
```

- That's it! You now have firewalld installed and running on your CentOS system. You can configure your firewall rules using the firewall-cmd command. Here are a few examples of how to use firewall-cmd to configure your firewall:

## **STEP 5:**
## Allow incoming traffic on a specific port (e.g., port 80 for HTTP):

```
sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
```

## **STEP 6:**
## Reload the firewall to apply the changes:
bash:

```
sudo firewall-cmd --reload
```

## **STEP 7:**
## List all open ports in the default zone (usually "public"):

```
sudo firewall-cmd --list-ports
sudo firewall-cmd --list-all
```

## **STEP 8:**
## List all the services currently allowed through the firewall:

```
sudo firewall-cmd --list-services
```
basic Linux commands you should know
Tags: linux, script, ubuntu, bash
Published: 2023-10-30 13:56:47

Here's a simple illustration about basic Linux commands every information technology related jobs should know

command line syntax 
command {option} {argument}

getting help 

```
-- help 
man command 

```
navigate between directories 

```
pwd  
print working directory 
```
cd change directory 
```
cd /Desktop
cd .. one level up
cd ~ telda = home directory  
```
List directory content 

```
ls 
ls -h 
ls -a 
ls -lha /documents 
```
create files & directories 


```
touch filename 

mkdir dir-name 
```
Reading file content

```
cat filename
head filename
tail filename
more filename
less filename
```

copying 

```
cp filename /destination 
```
remove files & directory 

```
rm filename
rmdir dir-name 
```

user permission 

read (r) write (w) execute (x)

```
chmod +w or chmod 2
chmod +r or chmod 4
chmod +x or chmod 1
chmod 7 for giving r+w+x permisions
```
process management 

```
ps 
ps -ef 
ps -aux 
top 

```
adding users

```
useradd username 
passwd username for creating a password to a specific user
usermod for modified 

## 
```
JSON PRETTIFY
Published: 2023-10-30 13:36:52

https://jsonprettify.net/

JSON, which stands for "JavaScript Object Notation," is a lightweight data interchange format. It is a text-based format used for structuring data in a way that is easy for humans to read and write, and it is also easy for machines to parse and generate. JSON is often used to transmit data between a server and a web application, as well as for configuration files and data storage.

How does json prettifier work? 

JSON (JavaScript Object Notation) works by providing a structured way to represent and exchange data between different systems, typically in text format. It's designed to be both human-readable and machine-parseable. Here's how JSON works:

{
  "name": "John Doe",
  "age": 30,
  "isStudent": false,
  "hobbies": ["reading", "playing guitar", "hiking"],
  "address": {
    "street": "123 Main St",
    "city": "Exampleville",
    "zipCode": "12345"
  }
}

Json prettify main functionally - 

Instant New your Record.
Temporary JSON Data Store.
Easy Copy and Paste JSON Prettify Data.
One Click Download JSON Data.
Share Temporary Stored Data anywhere.
Load JSON URL directly into Editor.
Editing time Redo and Undo facility.
Validator for Online Changes of JSON Data.
Minify or Compact JSON Data to reduct its Size.
In Treeview, You can Search highlight, and Sorting Data.


What’s the benefit of JSON?

JSON is easy for humans to read and write. It uses a simple and intuitive syntax with key-value pairs, making it easier to understand than other data formats XML.JSON is a lightweight format, which means it doesn't add a lot of overhead to the data it represents. This makes it efficient for data transmission over networks and storage is language-independent, meaning it can be used with virtually any programming language. It has libraries and parsers available for a wide range of programming languages, making it a versatile choice for data exchange. JSON can represent complex data structures, including nested objects and arrays. This flexibility allows you to model a wide variety of data types and relationships. Parsing JSON data in most programming languages is straightforward, thanks to the availability of built-in or third-party libraries. This simplifies data extraction and manipulation and supports Unicode characters, making it suitable for representing data in multiple languages and character sets. JSON is a de facto standard for data interchange on the web. It's supported by many web APIs, making it a natural choice for web development. JSON data can be easily validated using schemas like JSON Schema. This allows you to ensure the data adheres to a specific structure or set of rules. JSON is often used for logging data because of its human-readable format. This makes it easier for developers to debug and analyze logs.
Running out of disk space? Delete node_modules
Tags: development, javascript, automation, tools
Published: 2023-10-30 13:25:04

**`node_modules` are the closet of your developer life.** And just like that closet, it's packed to the brim with things you might never use again. Ever wondered how much digital real estate they're hogging? 

Let's find out.

---

## Visualizing the clutter

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

---

> **Pro Tip**: Make sure you're in the right neighborhood. `cd` into the directory where most of your projects live, like `documents` or `documents/github`.

---

### For the Mac and Linux folks
Want to know how much space you're dealing with? This command has got you covered:

```bash
cd documents
find . -name "node_modules" -type d -prune | xargs du -chs
```

#### Example output
```
255M ./Github/Trilon.io/node_modules
482M ./Github/Some_Demo/node_modules 
707M total
```

{% cta https://github.com/webcrumbs-community/webcrumbs %} If you like Nodejs, see our GitHub {% endcta %}

---

### If you're on Windows

Run this baby right here:

```bash
cd documents 
FOR /d /r . %d in (node_modules) DO @IF EXIST "%d" echo %d"
```

This will show you the plethora of `node_modules` you’ve been collecting. A digital hoarder’s dream!

{% cta https://github.com/webcrumbs-community/webcrumbs %} Join the conversation about open source in React, explore WebCrumbs {% endcta %}

---

## Time to take out the trash

---

> **Heads up**: Don't just pull the trigger. Double-check your aim by running the above scripts to know exactly what you're about to delete.

---

### For the Mac and Linux crew

Execute this to wipe `node_modules` off the face of your drive:

```bash
cd documents 
find . -name "node_modules" -type d -prune -exec rm -rf '{}' +
```

{% cta https://github.com/webcrumbs-community/webcrumbs %} Want to be a part of our community? Dive into code {% endcta %}

---

### And for the Windows warriors

```bash
cd documents 
FOR /d /r . %d in (node_modules) DO @IF EXIST "%d" rm -rf "%d"
```

{% cta https://github.com/webcrumbs-community/webcrumbs %} Join our open-source movement and become a maker {% endcta %}

---

## The afterparty
I usually free up about 40-60GB doing this. Your results may vary, but hey, free space is free space!

---

## Wrapping it up
1. Check before you wreck — list all `node_modules` first.
2. Proceed with caution; this operation's got no Ctrl-Z.
3. Remember to run `npm install` on projects you'll be revisiting.

[![Take a Bow](https://dabuttonfactory.com/button.png?t=Take+a+Bow&f=Open+Sans-Bold&ts=26&tc=fff&hp=45&vp=20&c=11&bgt=unicolored&bgc=0000EE)](https://github.com/webcrumbs-community/webcrumbs)

And there you have it. You just decluttered your digital world. 

**Follow me for more tips.**

---

[![WebCrumbs](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d4wgcd1a7bwsemxn05ug.png)
](https://webcrumbs.org)

{% cta https://webcrumbs.org %} Check it out at webcrumbs.org {% endcta %}

{% cta https://github.com/webcrumbs-community/webcrumbs %} Star our GitHub if you haven't yet ;) {% endcta %}
Learning Union-Find
Published: 2023-10-30 13:32:35

## What is Union-Find?
Union-Find is a **data structure to manage groups in a tree structure**.
When grouping in a tree structure, the advantage is that the following two points can be done quickly

1. Check if `x` and `y` exist in a same group or not.
2. If `x` and `y` exist in the same group, the affiliations of group `x` and group `y` can be easily merged.

## Try to make Union-find Structure with Rust
```rust
struct UnionFind {
    par: Vec<usize>,
}

impl UnionFind {
    fn new(n: usize) -> Self {
        let mut par = vec![0; n];
        for i in 0..n {
            par[i] = i;
        }
        return Self { par };
    }

    fn root(&mut self, x: usize) -> usize {
        if self.par[x] == x {
            return x;
        }
        self.par[x] = self.root(self.par[x]);
        self.par[x]
    }

    fn unite(&mut self, x: usize, y: usize) {
        let rx = self.root(x);
        let ry = self.root(y);
        if rx == ry {
            return;
        }
        self.par[rx] = ry;
    }

    fn same(&mut self, x: usize, y: usize) -> bool {
        let rx = self.root(x);
        let ry = self.root(y);
        rx == ry
    }
}
```

- `par`: 
`par[a] = b` means "a's parent is b"
- `new`:
This function initializes everything as roots.
- `root`:
This function returns root.

**For examples**
- When data `x` is a root, it returns `x`
- When data `x` is not a root, `par` recursively traces back to the parent and return parental with

- `unite`: 
This function merges two trees that don't have the same root.
- `same`:
This function return `true` if `x` and `y` have the same root.
Hacktoberfest: A Journey of Continuous Learning
Tags: hack23contributor
Published: 2023-10-30 13:30:00

### Intro

I'm excited to be taking part in Hacktoberfest for the third time, just like I was the first time. I adore the chance to broaden my horizons professionally, meet individuals from all around the world, and contribute to open-source projects.

### Highs and Lows

Working on several open-source projects was for me one of the pleasures of this year's Hacktoberfest. By examining other codebases and observing how other programmers addressed issues, I was able to gain a lot of knowledge. Additionally, I was able to contribute to initiatives about which I am quite passionate, and it was gratifying to see my efforts have an impact.

This year, finding the time to contribute to so many various initiatives was one of my problems. It was occasionally challenging for me to balance my employment with open-source efforts because I work a full-time job. However, I made it a point to dedicate some time to work on open-source projects.

### Growth

The last three Hacktoberfests have taught me a lot. I've picked up new coding techniques, new technologies, and new methods for working with other engineers. In addition, I now know a lot more about who I am and what I am capable of.

### Conclusion

For software programmers of all expertise levels or freshers getting into tech, Hacktoberfest is an excellent opportunity. It's a fantastic way to expand your knowledge, make a difference in open-source initiatives, and make new friends. I strongly recommend that you attend Hacktoberfest the following year if you're interested in developing or learning about open-source software.

For a list of the projects I worked on during this Hacktoberfest, visit [my GitHub profile](https://github.com/DhanushNehru)

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

I'm appreciative to the Hacktoberfest community for fostering an atmosphere that is so kind and encouraging. I also appreciate the patience and advice that the maintainers of the projects I contributed to have given me.

Connect with me via [Twitter](https://twitter.com/home) / [Instagram](https://www.instagram.com/dhanush_nehru/) /  [Github](https://github.com/DhanushNehru/) & subscribe to my [Youtube Channel](https://www.youtube.com/@dhanushnehru?sub_confirmation=1)
2023 Hacktoberfest Recap
Published: 2023-10-30 02:44:12

Finally, I successfully finished `Hacktoberfest`, and it was a really good experience to learn how open-source projects are created and contributed. In the first week, I had lots of concerns and worried about how to contribute to open-source projects because I'm just junior-level and I thought there was nothing to fix from my end. However, I searched the issue with a couple of labels like `good first issue` or `Hacktoberfest` and I easily found simple issues like dealing with `Typo in Readme.md`,`Installing Prettier` and `Linting`. 

I tried to fix simple issues from the project, and when I created the first PR, I felt a sense of accomplishment and I became confident in open-source projects. After that, I gradually looked for more complicated projects and harder issues that I could handle. During the `Hacktoberfest` I found two interesting projects, those are written in `typescript` that I got interested in. 

One is [Codu](https://github.com/codu-code/codu) and this is a kind of web platform for coders and people can share articles and their thoughts. There are over 50 contributors on the project, and the author responds quickly and there's `Discord` channel for the project. I already contributed twice, and working on another issue for now. This project is not that small not that complicated, and it's a good chance to learn `typescript` and `Next.js` together. 

Another is [MoveX](https://github.com/movesthatmatter/movex) and this is serverless real-time data-sharing infrastructure for frontend developers. This project has 27 contributors and I already contributed to the project twice, and keep an eye on issue sections to solve issues. I haven't really looked into the project in detail, but I guess this project is also written in `typescript` and I see there are lots of things to learn from the project. 

Even though `Hacktoberfest` is done, I really got interested into open-source projects and I'll keep contributing to those projects whenever I'm available. And this is my updated [github profile](https://github.com/seog-jun), feel free to reach out to me and please follow me!
Mastering the Art of Running a Successful Virtual Meeting
Published: 2023-10-30 13:26:46

Learn the essential strategies and techniques for hosting virtual meetings that truly make an impact. From flawless technical setup to fostering active participation and ensuring effective communication, this guide has you covered. Elevate your virtual meeting game and boost productivity and collaboration within your team. 
Visit - [](https://www.workstatus.io/workforce-management/virtual-meeting)
Troubleshooting Wi-Fi Adapter Detection in Kali Linux
Published: 2023-10-30 13:26:11

Introduction:
In this guide, we'll walk you through the steps to resolve the issue of a Wi-Fi adapter not being detected in Kali Linux. We'll start by downloading and installing the necessary drivers to enable your Wi-Fi adapter. This process involves unloading and reloading services and installing compatible drivers to ensure you can connect to available Wi-Fi networks.

Step 1: Download the Compatible Drivers
Visit the following website to download a suitable version of compatible drivers for your system: dev.gateworks.com/sources.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1s1ag208iaca3y0kq77z.png)
Step 2: Open the Terminal and Navigate to the Download Directory
After downloading the drivers, open your terminal and navigate to the directory where the downloaded file is located. You can use the 'ls' command to list the files in that folder:

```
cd /path/to/your/download/directory
ls
```
Step 3: Decompress the Downloaded File
Decompress the downloaded file using the 'tar' command. Replace <name of the file> with the actual filename. For example:

```
tar -jxvf <name of the file>
# For example:
tar -jxvf compat-wireless-2010-07-06.tar.bz2
```
Step 4: Move to the Decompressed Directory
Navigate to the directory where the files have been decompressed. Replace <name of the directory> with the actual directory name. For example:

```
cd <name of the directory>
# For example:
cd compat-wireless-2010-07-06

```
Step 5: Unload Services
To prepare for driver installation, unload the services using the following command:

```
sudo make unload
```
Step 6: Load Services
Activate the services again with the following command:

```
sudo make load
```
Step 7: Install Required Packages
To ensure proper functionality, install the necessary packages using the following command:

```
sudo apt install -y linux-headers-$(uname -r) build-essential dkms git libelf-dev
```
Step 8: Clone the Git Repository
Clone the Git repository containing the drivers you need for your Wi-Fi adapter:

```
git clone https://github.com/morrownr/8814au
cd 8814au
```
Step 9: Make the Installation Script Executable
Locate the 'install-drivers.sh' file in the directory, make it executable, and run it:

```
sudo chmod +x install-drivers.sh
sudo ./install-drivers.sh
```
Step 10: Driver Configuration and Reboot
During the driver installation process, you may be asked if you want to edit driver options. Type 'n' for no and press Enter. After the installation is complete, you will be prompted to reboot. Type 'Y' and press Enter to restart your system.

Conclusion:
After completing these steps, your Kali Linux machine should detect nearby Wi-Fi networks. You can now connect to available Wi-Fi networks and enjoy a fully functional Wi-Fi adapter.
Feature announcement : Attack Path
Tags: kubernetes, security, devops, news
Published: 2023-10-30 13:19:48

Whether you call it Attack Path or Attack Chain it is how an attacker accesses and moves about in your Kubernetes installation.

Introducing a graphic map to show you how an attack on your installation can unfold. It also shows you the weak points and provides advice on what to patch or how to remeidate.

[Learn more here](https://www.armosec.io/blog/blocking-kubernetes-attack-paths/)
Aimfortech Solutions | Gaming Development | App Development
Tags: gamingdevelopment, appdevelopment, socialmediamarketing, degitalmarketing
Published: 2023-10-30 13:10:39

Aimfortech Solution is providing various kinds of services to their clients like Web Development, Software Development, Digital Marketing, Social media agency and many more services. So, don’t waste the time and visit our website - http://aimfortech.com/