teleren/devto huggingface dataset:
UNION-FIND
Published: 2022-02-09 16:31:17

## Dynamic connectivity

```

```

**_<u>Connected components</u>_**
* Maximal set of objects that are mutually
connected.

`connected(x,y)`
* Find/connected query: is there a path connecting the two objects?

`union(x,y)`
* Union command: connect two objects.

## Quick-find 
is too slow for big problem
* initialize: N
* union:  N
* find: 1

_<u>find:</u>_ Check if p and q have the same id.
Number of array accesses (for read or write):            

_<u>Union:</u>_ To merge components containing p and q, change all entries whose id equals id[p] to id[q].
It takes **N^2** array accesses to process a sequence of N union commands on N objects.

> The maximum number of #id[] array entries that can change (from one value to a different value) during one call to union when using the quick-find data structure on n elements is **n**

## Quick-Union 
is also slow
* initialize: N
* union:  N (includes cost of finding roots)
* find: **N**

_<u>find:</u>_ Check if p and q have the same **root**
Number of array accesses (for read or write):            

_<u>Union:</u>_ To merge components containing p and q,
set the id of p's **root** to the id of q's **root**.


## Weighted quick-union: (Improvement 1)
_<u>find:</u>_Check if p and q have the same **root** (Identical to quick-union)
_<u>Union:</u>_ Modify quick-union to:
・**Link root of smaller tree to root of larger tree.**
・Update the sz[] array.

> KEY POINT:
Increases by 1 when tree T1 containing x is merged into another tree T2.
- The size of the tree containing x at least doubles since | T 2 | ≥ | T 1 |.
- Size of tree containing x can double at most lg N times.

* initialize: N
* union:  N (includes cost of finding roots)
* find: **lgN** (lg = base-2 logarithm)
JWT
Published: 2022-02-09 15:58:51

## JWT

JSON Web Token structure: 
In its compact form, JSON Web Tokens consist of three parts separated by dots (.), which are:

1. Header
2. Payload
3. Signature

So, a JWT typically looks like the following: `xxxxxx.yyyyyy.zzzzzz`

**Header: **

The header typically consists of two parts: the type of the token, which is JWT, and the signing algorithm being used, such as HMAC SHA256 or RSA. 

For example: 

```
{
    “alg”: “HS256, 
    “typ”: “JWT”
}
```

Then this JSON IS Base64Url encoded to form the first part of the JWT. 

**Payload: **

The second part of the token is the payload, which contains the claims. Claims are statements about an entity (typically, the user) and additional data. There are three types of claims: registered, public, and private claims. 

**Registered claims:** These are a set of predefined claims which are not mandatory but recommended, to provide a set of useful, interoperable claims. Some of them are: iss (issuer), exp (expiration time), sub (subject), aud (audience), and others.

**Public claims:** These can be defined at will by those using JWTs. But to avoid collisions they should be defined in the IANA JSON Web Token Registry or be defined as a URI that contains a collision resistant namespace.

**Private claims:** These are the custom claims created to share information between parties that agree on using them and are neither registered or public claims.


An example payload could be:

```
{
    “sub”: “131242134”,
    “name”: “Sadique Habibullah”,
    “admin”: true
}
```

The payload is then Base64Url encoded to form the second part of the JSON Web Token. 

**Signature: **

To create the signature part you have to take the encoded header, the encoded payload, a secret, the algorithm specified in the header, and sign that.

For example if you want to use the `HMAC SHA256` algorithm, the signature will be created in the following way: 

```
HMACSHA256(
  base64UrlEncode(header) + "." +
  base64UrlEncode(payload),
  secret)
```

The signature is used to verify the message wasn't changed along the way, and, in the case of tokens signed with a private key, it can also verify that the sender of the JWT is who it says it is.

**Putting it altogether: ** 

The output is three Base64-URL strings separated by dots that can be easily passed in HTML and HTTP environments, while being more compact when compared to XML-based standards such as SAML.


Finally it becomes something like this: 

```
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTY0NDQxNzA1NCwiZXhwIjoxNjQ0NDIwNjU0fQ.GiJsRD3463h80YlAYG92UupWcot7jWRHNhnNpnBV2bQ 
```
What would your tech stack of choice be for a new web dev project?
Tags: discuss, webdev, javascript
Published: 2022-02-09 15:43:58

Let's say you are hired to create a web app for a company that describes itself as "Etsy for dogs" (whatever that means).

You'll be the only developer on the project for a while so you get to make all your own choices, but if the project succeeds, it will need to live on indefinitely.

What is _your_ tech stack of choice?
Django Internationalization
Tags: djangointernationalization, webpagetranslation, python, django
Published: 2022-02-09 15:27:36

---
### `Information about Tutorial structure & Nomenclature`

We know how vastly popular Django framework for python is, and it supports a lot of battery-inclusion. One of the built-in features of Django is i18n i.e., Internationalization: Below 4 tutorials shows how to utilize i18n to remove language barriers in web applications, with user choose language. 

This tutorial series show how to setup translation using Django framework, that means translate the whole web page based on user chosen language, for blog purpose used 2 languages first and default English(en-us) and second one is Portugues(pt-pt), will start project from scratch, before that please go with few nomenclatures to understand easily, and for this blog using Django 2.2 on python 3.7 and all tutorial applicable for later version also


## Nomenclature

**Django Internationalization** = The goal of internationalization and localization is to allow a single web application to offer its content in different languages and formats tailored to the audience, [Read more .](https://docs.djangoproject.com/en/4.0/topics/i18n/) 

**USE_I18N**   =   If this is set to False, Django will make some optimizations so as     not to load the translation machinery, [Read more ](https://docs.djangoproject.com/en/4.0/ref/settings/#use-i18n). 

**USE_L10N** = A Boolean that specifies if localized formatting of data will be enabled by default or not. If this is set to True, e.g., Django will display numbers and dates using the format of the current locale. [Read more ](https://docs.djangoproject.com/en/4.0/ref/settings/#use-l10n)
Do we need AWS RDS?
Tags: aws, cloudnative, architecture
Published: 2022-02-09 15:17:23

Like many AWS services, AWS RDS is built on top of AWS EC2. This leads to the question that why would we opt for RDS when we can run our own DB in a memory optimized EC2 instance with high performance volume attached? Using EC2 and our custom DB install will save us extra cost of RDS, right?

- **Yes**, when our system is not sensitive to high availability.
- **No**, when our system is sensitive to high availability and performance.

RDS provides many critical capabilities required for an highly available architecture. With RDS, we don't need to worry about:

- Automated provisioning
- Database engine & OS patching
- Continuous backup and restore in exact point in time
- Read replicas for increased read performance
- Monitoring dashboards
- Multi AZ setup for disaster recovery
- Vertical and horizontal scalability.
CAP Theorem
Tags: database, mysql, postgres, mongodb
Published: 2022-02-09 15:15:42


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tvhptxo7517o7kiszond.jpeg)**What is the CAP Theorem?**
The CAP theorem is a theorem about distributed computing systems; it has been stated in various forms over the years. The original statement of the theorem by Eric Brewer states that a computer system can at best provide two of the three properties from the following list:


- Consistency: means that the nodes will have the same copies of a replicated data item visible for various transactions. A guarantee that every node in a distributed cluster returns the same, most recent, successful write. Consistency refers to every client having the same view of the data. There are various types of consistency models. Consistency in CAP refers to sequential consistency, a very strong form of consistency. 

- Availability means that each read or write request for a data item will either be processed successfully or will receive a message that the operation cannot be completed. Every non failing node returns a response for all read and write requests in a reasonable amount of time.

- Partition tolerance means that the system can continue operating if the network connecting the nodes has a fault that results in two or more partitions, where the nodes in each partition can only communicate among each other. That means, the system continues to function and upholds its consistency guarantees in spite of network partitions. Network partitions are a fact of life. Distributed systems guaranteeing partition tolerance can gracefully recover from partitions once the partition heals. 

we can use this data model options for :
1- Consistency and Availability: sqlserver, mysql, postgre.
2- Consistency and Partition tolerance: mangodb,redis.
2- Partition tolerance and Availability: cassandra,couchdb.
Earnapp: New payment threeshold
Tags: raspberrypi
Published: 2022-02-09 15:14:11

I previously writtent about [earnapp](https://earnapp.com/i/dp64i9n) (in post ["How to earn money with your raspberry pi"](https://dev.to/gpenverne/how-to-earn-money-with-your-raspberry-pi-2l83)

A new update about this service (which allows you to rent your unused bandwith to earn passive income, ~ 0,5cts/day): the payment threeshold is now 2$50 (it was 5$ previously).

A faster way to test it ^^
I can't fill bottom of the page
Tags: css, html
Published: 2022-02-09 15:03:51


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


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

Is this problem about divs?
What are Props in React?
Tags: react, prop
Published: 2022-02-09 15:01:33


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/60yg47bfiflw3ad5eeff.png)
We have already seen what Props in React are, in our previous blogs when we compared props and states and how to use them in functional and class components.

In this blog, we will understand how important props are in React when it comes to making the flow of our app dynamic.

Let’s begin…

## What are props in React?
Props are the short form of properties that we can pass between the parent and the child component and can use it as we want but cannot change its values as they are read-only properties.

As told above, they can easily make the flow of the app dynamic.

We can pass everything as props to the child component, especially functions that will help in updating the state of the parent component.

Let’s understand props with a simple React code –
We will make two reusable components Example.js and Tool.js, where the Example Component is the parent Component, and the Tool Component is the child component as shown.

![Parent and the child Component](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1fvjxn4zhcfxrdaafe8p.png)
 
Now, import the Tool Component in the Example Component and pass a prop — name=”Ateev” in the with the Tool Component.

```
import React from "react";
import Tool from "./Tool";
const Example = () => {
return (
<>
<div className="app">
<Tool name="Ateev" />
</div>
</>
);
};
export default Example;
```

And we will use this prop in our Tool Component like this
```
import React from "react";
const Tool = (props) => {
return (
<div className="bg-dark text-white">
<h1 className="px-5 pt-5">My name is {props.name}.</h1>
<p className="fs-5 px-5 pb-5">I am a front-end developer.</p>
</div>
);
};
export default Tool;
```

We will get something like this –

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

We have passed the name from the Example Component as props to the Tool Component where we have used this in our Tool Component as props.name as shown, and we have our value in the above.

There are various ways of passing the props and using them inside our child component.

Let’s first discuss how we can use props in our child component. There are mainly three ways of doing it –

1. With destructuring
2. Without destructuring
3. Using defaultProps

You can read the full article [here](https://tekolio.com/what-are-props-in-react-and-how-to-use-them/).
Error - Bing Webmasters
Published: 2022-02-09 14:49:52

Hello!

While Google has slowly been indexing and add adding my pages to the index, Bing refuses to index more than just my homepage, returning the error shown below on every page except the homepage.

>The inspected URL is known to Bing but has some issues which are preventing indexation. We recommend you to follow Bing Webmaster Guidelines to increase your chances of indexation.

Is there any way to know exactly what the issue is, as the [article the error message links to](https://www.bing.com/webmasters/help/webmasters-guidelines-30fba23a) does not really give a specific answer?

And yes, I did read the document, and nothing jumps out at me for being the reason.

Thanks!
How Histogram Equalization can help to auto-correct image for OCR
Tags: productivity, webdev, algorithms
Published: 2022-02-09 14:32:30

Histogram Equalization algorithm is an image correction method that evenly distributes pixel's color intensity across the image. It makes too light regions darker, too dark regions lighter and adjusts the contrast. It can help to normalize low-contrast images and also images, which have both too dark and too light regions which make it impossible to correct them using either Brightness or Contrast filter. In particular, this can be important to adjust the image this way before the optical text recognition procedure, to make the text more readable. The next video shows how the "Equalize" filter is implemented in the Image Reader online text recognition service and how it can be used for an image, on which other filters could not help:

{% youtube 7ZLIPp9YDSg %}

The definition of Histogram Equalizaton: https://en.wikipedia.org/wiki/Histogram_equalization
Nevertheless, Promise Coded in 2021!👩‍💻
Tags: wecoded, womenintech, webdev
Published: 2022-02-09 14:22:02

**How it started**👩‍💻
If on this day last year, someone told me that I would have accomplished this much into my journey in tech, I would not have believed them. After my high school in 2019, I was still wondering which course im going to study at compass,I had a friend who was in tech and I had always wanted to get into tech. Therefore, in October 2020 I was introduced to the programe called codeHive run by AkiraChix the "leading source of African female tech talent", I applied and got into the programe,I was introduced to many programing languages including Javascript,Python and Kotlin, as time went by I fell into Web Development. The programe lasted for one year and thereafter, I decided to continue learning as a self-taught developer. Here I am 3 months later!

**My most recent achievement🏆 was...**
Learning and building mini projects in JavaScript. I've been struggling with JavaScript since it is my favourite programming language but I'm proud that I've tackled that, and built mini-projects.

**Advocating for myself looks like…**
Self-affirmations 😊
Taking breaks when necessary.
Reminding myself that an expert in their field was once a beginner.

**My biggest goal is…**
Grow career-wise and support other women transitioning into the tech industry and even those in the industry. The first few months can be tough. I am thankful to all the women that continued to encourage me to get going. There were days where I felt so demotivated and wasn't sure if I'd get to achieve what I had set out to do, but watching or listening to other women's stories about how they got to navigate similar obstacles really motivated me.

**My advice for allies to support underrepresented folks who code is...**
Give them a chance.
Here's How The US Navy Can Help Your Internet Business
Tags: javascript, beginners, programming, webdev
Published: 2022-02-09 14:20:24

Have you ever heard of the KISS principle?

KISS, an acronym for Keep It Simple, Stupid, is a design principle noted by the U.S. Navy in 1960. The KISS principle states that most systems work best if they are kept simple rather than made complicated, and this is 100% true when it comes to Internet Marketing.

For example, if you are creating a squeeze page then 'Keep It Simple', all you need is an attention-grabbing headline with an image and opt-in form. You don't need anything else. 

And this is one of the reasons Easy Page Builder was created as it uses the KISS principle that is so popular with those who 'know'.

With Easy Page Builder you can create a complete funnel very easily, such as…

Sales Pages

Affiliate Pages

OTO Pages

Squeeze Pages

Webinar Pages

And a whole lot more.

This really could not get any simpler, if you can point a mouse, click and type, then you've already mastered Easy Page Buildr.

https://tinyurl.com/3m4rw6ar

Check out the video on this page and you'll see why it's called 'Easy Page Builder' and remember to 'Keep It Simple, Stupid' :-)

[YOUR AFFILIATE LINK]

Remember that right now you grab this for a single payment and you can get started for under $10, I am told that they will be switching to recurring billing soon so now is the time to check this out.
Function Arguments Object in JS and how to use it
Tags: javascript, fn
Published: 2022-02-09 14:14:50

Assuming we all know what arguments are in JS functions

## Function.arguments 
The arguments object is a local variable available within all non-arrow functions.You can refer to a function's arguments inside that function by using its arguments object.
It has entries for each argument the function was called with, with the first entry's index at 0.

Example: 
```js
function exampleFunction(a, b, c) {
   console.log(arguments) // Arguments {0: 1, 1: 2}
  if (arguments.length !== 3) {
    throw new Error(`Invalid amount of arguments. Must be 3 and was ${arguments.length}`);
  }
}

exampleFunction(1,2) // Error: Invalid amount of arguments. Must be 3 and was 2
```
Khobor is The New Financial News Directory by ZeroBizz for Bengali Investors
Tags: startup, productivity, news
Published: 2022-02-09 14:13:19

Khobor is an initiative by ZeroBizz to collect daily financial news in native Bengali language from multiple trusted sources and put them all together in one place.

##What is Khobor?
Khobor is the new online place launched by ZeroBizz to provide their Bengali users from West Bengal, Bangladesh & other Bengali spoken areas. To reduce news spams in fintech industry, ZeroBizz created Khobor to provide a great experience while browsing financial news.

Not just news, team ZeroBizz is working one cool new features for making their platform engaging for all kinds of users.

##Why you should use Khobor?
Khobor by ZeroBizz is the only place where your can read financial news in Bengali. Before publishing any news on their platform, ZeroBizz team checks multiple parameters & verifies them one by one.

##Conclution:
If you're and investor & know the Bengali language, you can bookmark [Khobor](https://zerobizz.github.io/khobor/) for getting daily fresh financial updates right on your smartphone feed.

You can also subscribe their [daily finance hub](https://khobor.zerobizz.com/) to get financial news directly to your email.
Helping Junior Developers Break In w/ Alex Booker
Tags: beginners, webdev, podcast
Published: 2022-02-09 14:05:57

{% spotify spotify:episode:4Lx8w1sCaqftg8TOTEBjeF %}

## What is HTML All The Things

HTML All The Things is a [web development podcast](https://podcast.htmlallthethings.com/) and [discord community](https://discord.com/invite/jweMCx9) which was started by Matt and Mike, developers based in Ontario, Canada. 

The podcast speaks to web development topics as well as running a small business, self-employment and time management. You can join them for both their successes and their struggles as they try to manage expanding their Web Development business without stretching themselves too thin.

## What's This One About?

In this episode Matt and Mike sit down with the host of the Scrimba podcast, Alex Booker for a conversation on junior developers, social media, and much more. Alex is a self-taught developer that transitioned into developer advocacy where he helps junior developers break into the industry for the first time. Additionally with that group the guys discuss using social media and feeling at odds with posting, or promoting, yourself.

## Guest Introduction

Alex Booker is the host of the Scrimba podcast. He started his self taught career as a developer and transitioned quickly to developer advocacy with multiple companies. Alex uses his experience breaking into the industry to help others do the same. His podcast focuses on interviewing junior devs that have just broken in, as well as industry leaders to give listeners a wide spectrum of information to help with their journey.

[The Scrimba Podcast](https://scrimba.com/podcast/)
[Alex Booker's Twitter](https://twitter.com/bookercodes) 

## Show Notes
* Tell us about your journey into the industry, what was it like being a junior developer when you broke in vs now?
* Is there one piece of advice that helps all or is it always dependent on the person?
* When talking to Junior developers that have just broken in, is there something common between them all? (in terms process, tenacity, personality)
* Are there any stories that stand out from the juniors you’ve spoken to?
* We like to provide a real outlook on the industry, what are the negatives of the job searching process that juniors should be aware of?
* Scrimba seems to be focused on helping people break in. What drew you to joining them?

## Links

* [https://www.notonlycode.org/nobody-hires-juniors/](https://www.notonlycode.org/nobody-hires-juniors/)


## Thank you!

If you're enjoying the podcast consider giving us a review on [Apple Podcasts](https://podcasts.apple.com/us/podcast/html-all-things-web-development-web-design-small-business/id1412209136) or checking out our Patreon to get a shoutout on the podcast. 

**[Support us on Patreon](https://www.patreon.com/htmlallthethings)**


You can find us on all the podcast platforms out there as well as

[Instagram (@htmlallthethings)](https://www.instagram.com/htmlallthethings/)
[Twitter (@htmleverything)](https://twitter.com/htmleverything)
[TikTok (Html All The Things)](https://www.tiktok.com/@htmlallthethings)
Paracetamol.js💊| #49: Explica este código JavaScript
Tags: javascript, webdev, spanish, beginners
Published: 2022-02-09 13:52:48

## **Explica este código JavaScript**

```js
const person = {
  name: "Lydia",
  age: 21
}

for (const [x, y] of Object.entries(person)) {
  console.log(x, y)
}
```

-     A: `name` `Lydia` y `age` `21`
-     B: `["name", "Lydia"]` y `["age", 21]`
-     C: `["name", "age"]` y `undefined`
-     D: `Error`

Respuesta en el primer comentario.

---