teleren/devto huggingface dataset:
Quadtrees
Tags: systems, architecture, distributedsystems, beginners
Published: 2023-01-25 06:13:53

We might have heard about Octrees a few times. It is a tree data structure that is used for the partition of three-dimensional space. What most of us don’t know is that octrees also have a two-dimensional analog called Quadtrees. Where octrees had eight children for each node, quadtrees limits to four. A two-dimensional space is repeatedly divided into four quadrants where each of which acts as a node with spatial information. The longitude and latitude are represented as cartesian coordinates (x, y), and search the points efficiently.

## When we already have latitudes and longitudes, why do we need quadtrees?

This is a question many people have on their minds. Let’s see what’s the difference when we use quadtrees over longitude and latitude.

While using coordinates of latitude and longitude, we need to use Euclidean distance to calculate close location points. However, when there are large data sets, it shows CPU-intensive nature. This makes the use of coordinates in the real-time system not scalable.

Geohashing also helps us save extra computational operations because it only divides a node after a certain threshold. In addition, with the use of some mapping algorithms like the Hilbert Curve, the range query performance is also improved.

![Quadtrees](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pesy284verq1zu08eylk.jpg)

## Types of Quadtrees

The types of quadtrees depend on the data that needs to be represented like areas, points, lines, curves, etc. Some of the most common quadtrees types are listed below: -

- Edge Quadtrees
- Point Quadtrees
- Point-region (PR) Quadtrees
- Compressed Quadtrees
- Polygonal Map (PM) Quadtrees

## Use Cases of Quadtrees

Let’s view some of the use cases of quadtrees.

- Spatial Indexing
- Range Queries
- InDriver, Pathao, etc. (location-based services)
- Mesh Generation
- Computer Graphics
- Sparse Data Storage
- Image representation, processing, and compression

{% embed https://github.com/pragyaasapkota/System-Design-Concepts %}

**_I hope this article was helpful to you._**

**_Please don’t forget to follow me!!!_**

**_Any kind of feedback or comment is welcome!!!_**

**_Thank you for your time and support!!!!_**

**_Keep Reading!! Keep Learning!!!_**
Top React Libraries of 2023
Tags: react, webdev, javascript
Published: 2023-01-25 05:58:35



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

As the React library continues to grow and evolve, developers are always on the lookout for the best libraries to use in their projects. With so many options available, it can be difficult to determine which libraries are the most effective and efficient. To help make this decision easier, we’ve compiled a list of the top React libraries of 2023. 

**1. React Router:**


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

React Router is a powerful library that helps developers create single-page applications with routing capabilities. It allows developers to easily define routes, handle navigation events, and render components based on URL parameters. It also supports server-side rendering and code splitting for improved performance. 

**2. Redux:** 


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

Redux is a popular library for managing application state in React applications. It provides an intuitive way to store data in a single location and access it from anywhere in your application. Redux also makes it easy to debug your application by providing detailed logs of all state changes. 

**3. Material-UI:** 


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

Material-UI is a comprehensive library for creating user interfaces with Google’s Material Design principles in mind. It provides components that are easy to use and customize, as well as built-in support for theming and accessibility standards. 

**4. Styled Components:** 


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

Styled Components is a library that allows developers to write CSS directly within their JavaScript code using tagged template literals. This makes it easier to keep styling consistent across components while still allowing for customizations when needed. 

**5. Formik:**


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

Formik is an open source library that helps developers create forms quickly and easily in React applications. It provides built-in validation, error handling, and other features that make creating forms simpler than ever before. 

These five libraries are some of the best available for React development in 2023, but there are many more out there worth exploring as well! With so many options available, developers can find the perfect set of tools to build amazing applications with ease!
Bad practices you should avoid using Angular
Tags: angular, practice, component, rxjs
Published: 2023-01-25 05:49:31

"In this Medium article, I highlight some common bad practices that Angular developers should avoid in order to write efficient and maintainable code. 
 This article is a must-read for Angular developers looking to improve their coding skills and avoid common mistakes.
More details: https://medium.com/gitconnected/bad-practices-you-should-avoid-with-angular-development-58098e5542d5
How And Where Are Your Memories Stored?!
Published: 2023-01-25 05:44:43

I realized that people who are *__extremely in love with music__* are termed as **'UNSERIOUS'**. If that's **_NOT BEING OKAY_**, then, it's __*OKAY TO NOT BE OKAY*__...

You must be wondering, I'm saying something sooo out of point. Before you scroll pass this, ask yourself this question: *How do I feel when listening to my favorite songs???*.
Now let me ask you: *Do music give you memories and take you back in time???*

Well, yes and no. Music actually bring back past memories but the brain do the whole work.

As for me, music is the cache for most of my memories...both the good and the bad. This could be the reason why I'm **SO INTO MUSIC**

For most homo-sapiens, the circumstance or condition they tend to find themselves in while listening to a song for the first time, tends to play a very vital role as they go on in life. HOW? Take for instance; a girl who listened to **'HAPPIER'** by Billie Eilish for the first time alone in her room; probably trying to get away from something like her parents arguing and throwing stuffs at each other...Years later, when she listens to this same song, she tends to remember that fateful day with so much detail. While this song may sound very nice to some listeners, she may find it so dreadful. Another example is a young boy who loves singing a particular song with his grand ma. Years later, his grand ma passed away. He might have moved on and forgotten about her for years but just hearing the melody of that song could invoke memories into his head within a split second. In this case, he should be happy even if he misses her...those memories were special to him. This is exactly what I am talking about.


If you are the kind of person I just described in this post, I am certain you love music so much. People in this category tend to enjoy music even more than the rest around them. They get inspired by  the good memories and tend to do and achieve more. 


If you are a workaholic who falls under this category, I will recommend  you listen to your favorite songs during your leisure time. This also works for those who might not fall under this category . 

...and this is the end of today's discussion, have a blessed day!!!


Always remember that **Music_Are_Memories_Too**
How To Make Date Range Filter in React JS
Tags: react, javascript, beginners, webdev
Published: 2023-01-25 05:38:55

In this article, we are going to learn to make date range filter in react JS. So basically, we will create a filter which will filter out the data according to given date range. Here we will generate a database with some data using mockAPI which will provide number of data generated along with ID, name, key etc.

So adding this type of functionality in react application will make it more interactive. So let’s just make it step-by-step.

##Pre-requisites to Make Date Range Filter in React JS

- Basic knowledge of React props, hooks etc.
- Basic knowledge of data fetching from API.
- Not necessary, but mock uses of API.
- Axios package
- react-date-range package.

[Read More](https://reactjsguru.com/how-to-make-date-range-filter-in-react-js/)
How to Publish RSS of Hashnode blog to your WordPress and other websites?
Tags: rss, blog, hashnode, writing
Published: 2023-01-25 05:37:19

RSS feed allows users to access updates to websites. Instead of cross-posting of our articles from Hashnode to other websites and blogs like Dev.to, Medium and WordPress, we can use RSS.

Firstly, we can get RSS of our blog on Hashnode by adding **“/rss.xml”** to the domain name of your website. For example, RSS of my blog “smartrs.blog” is:

**https://smartrs.blog/rss.xml**

There is a list of WordPress plugins to get RSS feeds like “**WP RSS Aggregator**” and “**Feedzy RSS Feeds**” but we can publish our feed without plugins.

From WordPress Dashboard click on “**Add New**” Posts. We use Gutenberg, not the classic editor.

We write in the title of the post for example “SmartRS posts”.

Click on “**+**” button “Toggle block inserter”.

Inside the search area we write **RSS**, then click on the RSS result.

Then we paste our URL of RSS. For example: **https://smartrs.blog/rss.xml**

Now click on **Use URL**.

By default, 5 of the post titles are inserted inside the WordPress new post.

We can modify it by clicking on the **Settings** button on the upper right side. While the block of feeds is selected, we can change the number of items for example to 10. And activate **Display author and date and excerpts**. Also, we have the option to choose the max number of words in excerpts, for example, 50.

Finally, when we are happy with the settings, we click on **Preview** then **Publish**. We can see the feeds in the new created post.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q5wnav3n44hti27uebbd.png)
Dealing with possible job termination/layoff (part 1)
Tags: devjournal, mentalhealth, career
Published: 2023-01-25 05:36:30

People say layoffs is a universal constant that keeps the modern economy mathematically valid, but yet we try to distance ourselves from thinking about it as much as possible.

For one reason or another, if judgment day becomes imminent, we scramble to put things back together and correct every possible little things that may and will contribute to our fall from grace. 

So I turned off Netflix, sat myself in a corner, silently reflecting the ways to "cushion the blow" after the New Year holiday is over. 

### Emotionally dealing with the problem 

Needlessly, I self-questioned everything from hard skills to my own sanity, procrastinated over the chain of mistakes and errors leading to my downfall. Yet, I reminisced the times when conversations with the manager were lighter and the initial optimism after probation period ends successfully. 

In truth, I have better days checkered with worse days. And the impermanence of things in life teaches me there is always an end to the start, regardless of performance and luck. Counterintuitive that it may sound, it is the obsession of control, not perfection, that gets to me. 

> It's really easy to apply self help content from people on the same boat as you are, and while I can't deny that it's mental medicine, I'm not impervious to events that can invalidate everything I thought as right, and that will take a while for me to surface back up. But that's okay...at least for me.

### The boring part...making a failsafe plan

The most obvious thing I can do right now is to browse LinkedIn and every listings/job boards I can think of. 

But personally, the important thing to do right now is to transfer what I learned from my present job in terms of technical knowledge and soft skills to my Notion, or notebook. 

Once I have everything in one place, then should I start tinkering with my CV. 

### As a P/S, from The Book of Disquiet by Fernando Pessoa, he wrote: 

"Trying to attain full understanding of one self is like letting yourself fall into a bottomless rabbit hole, since you could be an entirely different person in different circumstances."

"Reality is just as deluded and false as our vivid dreams we had last night. Dissolved as soon as we woke up, never to be known and thought of again."
How To Validate Multiple Checkbox In jQuery
Tags: javascript, jquery, webdev, beginners
Published: 2023-01-25 05:30:00

In this article, we will see how to validate multiple checkboxes in jquery. Here, we will learn how to check whether at least one checkbox is checked or not using jquery or javascript.

On the website sometimes we required different kinds of validation in the form like radio button validation, dropdown option validation, input fields validation and etc.

In jquery, we will get the multiple check length and check the list checked checkbox and display the required validation message. Also, we will use the filter function for checkbox checking.

So, let's see jquery multiple checkboxes required validation, how to validate checkbox in javascript, and how to select at least one checkbox in jquery.

Example:
In this example, we will create language and check the array length and validate whether the checkbox is checked or not and display an error message using jquery.

```
<!DOCTYPE html>
<html>
<head>
    <title>How To Validate Multiple Checkbox In jQuery - Techsolutionstuff</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<style>
  body{
  	margin:100px;
  }
  .note{
  	color:red;
    display:none;
  }
</style>
</head>
<body>
  
<div>
    <h3>How To Validate Multiple Checkbox In jQuery - Techsolutionstuff</h3>
    <strong>Language:</strong>
  
    <input type="checkbox" value="true" class="language" name="language[]"> Laravel
    <input type="checkbox" value="true" class="language" name="language[]"> PHP
    <input type="checkbox" value="true" class="language" name="language[]"> jQuery
    <input type="checkbox" value="true" class="language" name="language[]"> Python
  	<input type="checkbox" value="true" class="language" name="language[]"> React JS
  	<p class="note">Please check at least one checkbox</p>	
  	<br>
    <button class="submit">Submit</button>
  	
</div>
  
<script type="text/javascript">
    $(".submit").click(function(){
         if ($('.language').filter(':checked').length < 1){                
           		$(".note").show();
                 return false;
         }else{
           		$(".note").hide();             
         }
    });
</script>
  
</body>
</html>
```

Output:

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

---
 
You might also like :

- **_[Read Also: Socialite Login with Facebook Account In Laravel 9](https://techsolutionstuff.com/post/socialite-login-with-facebook-account-in-laravel-9)_**
- **_[Read Also: How To Convert HTML To PDF Using JavaScript](https://techsolutionstuff.com/post/how-to-convert-html-to-pdf-using-javascript)_**
Optimize Angular bundle size with these steps
Tags: angular, performance, bundle, optimization
Published: 2023-01-25 05:26:18

"In this  article, I tried to explore  various ways to optimize the bundle size of an Angular application. The author starts by discussing the importance of bundle size optimization and then goes on to present different strategies for reducing bundle size, such as using lazy loading, implementing code splitting and tree shaking. The article also covers how to use tools like the Angular CLI and webpack to analyze and optimize the bundle size. The author concludes by providing some best practices for ongoing maintenance of the bundle size. This article is a must-read for developers working with Angular and looking to improve the performance of their applications."

Medium link: https://medium.com/gitconnected/lets-optimize-angular-bundle-size-with-these-steps-6d6b753ac256
Communication Between Microservices
Published: 2023-01-25 05:13:08


There are several ways that microservices can communicate with one another, depending on the specific requirements of the system. Some examples include:

**HTTP/REST**: One of the most common ways for microservices to communicate is through the use of HTTP/REST APIs. In this approach, microservices expose a set of endpoints that other microservices can call using standard HTTP methods (e.g. GET, POST, PUT, DELETE). For example, a service responsible for managing user accounts may expose an endpoint for creating a new user, which another service can call when a new user is signing up.

**gRPC**: gRPC is a high performance, open-source framework for building remote procedure call (RPC) APIs. It uses the Protocol Buffers data format and supports a variety of programming languages. Microservices can use gRPC to call methods on other microservices as if they were local objects, making it a good choice for high-performance, low-latency systems.

**Messaging**: Another way microservices can communicate is through the use of a message broker. In this approach, microservices send messages to a central broker (e.g. RabbitMQ, Kafka) which other microservices can consume. This allows for asynchronous communication and can be useful for decoupling microservices and handling high loads.

**Service Discovery**: A service discovery mechanism is used to dynamically discover the location of a service at runtime. Microservices can use service discovery to find the location of other microservices they need to communicate with. Examples of service discovery mechanisms include Consul, Eureka, and Zookeeper.

All these examples are technology stack specific, the best choice is based on the requirements of the specific use case.
Git) Checkout Remote Branch
Published: 2023-01-25 05:02:10

## When to checkout git remote branch?
When the remote branch already existed, and you want to pull the branch and its changes to your local environment.

<br>
<hr>

## How to checkout git remote branch?
It depends on whether there is one configured remote repository or multiple repositories.


#### With Single Remote Repository
##### 1. Fetch all remote branches
###### Start by fetching all the latest changes from remote repository

```
$ git fetch

# alternatives(depends on your remote name)
$ git fetch origin 
$ git fetch upsteam
```


##### 2. Check all branches available for checkout
###### -v(verbose): show extra info
###### -a(all): list all

```
$ git branch -v -a
```


##### 3. Checkout to the remote branch
###### Now you can checkout and  track the remote branch

```
$ git switch <branch name>
```

---

#### With Multiple Remote Repositories
##### 1. Fetch all remote branches

```
$ git fetch

# alternatives(depends on your remote name)
$ git fetch origin 
$ git fetch upsteam
```


##### 2. Check all branches available for checkout

```
$ git branch -v -a
```


##### 3. Checkout to the remote branch
###### In case where multiple remotes exist, the remote repositories should be explicitly named.
###### Checkout the branch with -c option to create new local branch
```
$ git switch -c <branch name> origin/<branch name>
```
What is the difference between == and === operators
Tags: webdev, javascript, react, beginners
Published: 2023-01-25 04:53:33

**The "==" operator** compares values for equality, after doing any necessary type conversions. 
**The "===" operator**, on the other hand, compares both value and type, and will only return true if the value and type match. In general, it is recommended to use the "===" operator, as it is less prone to unexpected behavior caused by type coercion.

For Example  : 
0 == false   // true
0 === false  // false
1 == "1"     // true
1 === "1"    // false
null == undefined // true
null === undefined // false
'0' == false // true
'0' === false // false
[]==[] or []===[] //false, refer different objects in memory
{}=={} or {}==={} //false, refer different objects in memory
Introduction to Javascript book
Tags: javascript, webdev, beginners
Published: 2023-01-25 04:53:25

JavaScript is a very popular and widely-used programming language, so knowing JavaScript is a valuable skill for a software developer to have. JavaScript is often used for building web applications and creating interactive user experiences on the front end (i.e., the client-side) of a web application.

In addition to being used for front-end web development, JavaScript is also commonly used for server-side development using runtime environments like Node.js. This allows JavaScript to be used for full-stack development, which can be beneficial for developers who want to be able to work on both the front-end and back-end of a web application.

Overall, knowing JavaScript can be very useful for a software developer, and it is a skill that is in high demand in the job market. However, the importance of any particular language or technology can vary depending on the specific job and industry, so it's always a good idea to keep up with the latest trends and developments in the field.


Find out more in my book on amazon


https://www.amazon.com/dp/B0BSL14M71

For the first 100 customers I would be willing to help out in the journey to learning javascript.
How can I return an array of struct from a function?
Published: 2023-01-25 04:50:46

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

contract AuthorizationManager{
 struct User{
 string _key;
 string userId;
 uint256 roleId;
 }
 uint256 currentIndex;

 mapping (uint256 => User[]) companyUserMap;


function addUser(uint256 seedid,string memory _key,string memory _userId, uint256 _roleId)public{
        companyUserMap[seedid].push(User(_key,_userId,_roleId));
 }


function getUssers(uint256 _seedid) public view returns(string[] memory,string[] memory,uint256[] memory) {

 string[] memory keys = new string[] (companyUserMap[_seedid].length);
 string[] memory userIds = new string[] (companyUserMap[_seedid].length);
 uint256[] memory roles = new uint256[] (companyUserMap[_seedid].length);

 for(uint256 i = 0; i <= companyUserMap[_seedid].length; i++)
 {

        keys[i] = companyUserMap[_seedid][i]._key;
        userIds[i] = companyUserMap[_seedid][i].userId;
        roles[i] = companyUserMap[_seedid][i].roleId;
 }
 return (keys, userIds, roles);
 }

 function distriBute(uint256 seedid) public view returns (string[] memory,uint256[] memory) {
        User[] storage isd =  companyUserMap[seedid];
 string[] memory bal;
 uint256[] memory user;

 for(uint256 i = 0; i < isd.length; i++)
 { 
            bal[i]=isd[i].userId;
            user[i] = isd[i].roleId;
 
 } 
 return (bal, user);

 }
}


Both functions throws error 
{
	"error": "Failed to decode output: Error: overflow (fault=\"overflow\", operation=\"toNumber\", value=\"35408467139433450592217433187231851964531694900788300625387963629091585785856\", code=NUMERIC_FAULT, version=bignumber/5.5.0)"
}
Jobdices
Published: 2023-01-25 04:48:31

The Jobdices.com website offers an extensive career database that will make it easy for you to locate your dream job. This will save you from having to spend countless hours searching through irrelevant postings. In our free job board, you can always find the most recent job postings that are specific to South Africa, the UAE, the UK, and the USA. This job board is specifically designed for job seekers in all of those countries.
                  [](https://jobdices.com/)