teleren/devto huggingface dataset:
How to Choose a Secure Password in 2021
Tags: security, privacy
Published: 2021-01-13 06:38:16

Passwords are the doorway to our professional services, our network of companions, and all our financial applications. If a cybercriminal effectively hacks into your social media account, they can post fraudulent messages requesting money or sending out links to scammer websites.

What does a protected password look like? It is usually the one that cannot be guessed effectively or cracked using software tools. 

Here is an assortment of do's and don't on how to choose a strong password to avoid being a victim of the assaults mentioned below.

The Do's are as follows:


Use two-factor authentication (2FA),
Follow standard password rules: Short passwords are easy to crack. Use at least 10 characters.
Include a combination of numbers, capital letters, lower-case letters, and symbols to make the password hard to crack.
Choose sufficiently random blends of words

The Don’ts are as follows:

Do not use your name in your passwords in any structure - first, last, spelled reverse, or nicknames.
Do not utilize passwords that are less than eight characters.
Do not utilize the name of your pets, friends, or close family members.
Do not use uncommon dates like your birthdays and anniversaries.
Do not utilize your phone number or office number.

Top 5 Tips on How to Choose a Strong Password Manager


A lot of password managers are allowed to use and provide optional features for example synchronizing new passwords across several devices. 

So, how to pick a strong password manager? Well, it should have the following core features:

Storage
Encryption
Security
Value
Reduce Password Vulnerabilities By Using LoginRadius Password Management Solution

The CIAM platform catches the following categories of password management in the LoginRadius Admin Console:

Password Expiration: You can customize how frequently you want your consumers to reset their passwords.

Password History: You can configure the number of unique passwords a consumer should set before permitting them to reuse one of their older passwords.

Password Complexity: You can configure the password complexity for your consumer's account by driving validation rules, preventing them from utilizing common passwords and dictionary words.

Password Compliance Check: You can recognize which consumers are abiding by your password complexity prerequisites and flag those who aren't.

By using Loginradius Password Management Solution, you can decrease the Password Vulnerabilities, also see the list of 20 Worst Passwords of 2020: 

Originally Published: 
https://www.loginradius.com/blog/start-with-identity/2021/01/how-to-choose-a-secure-password/
What is the Apriori Algorithm With Example? Simplest Explanation!
Tags: machinelearning, datascience
Published: 2021-01-13 06:28:57

In this article, I will explain What is the Apriori Algorithm With Example?. I tried to explain the **Apriori Algorithm** in the easiest way so that you can understand the whole concepts of the apriori algorithm easily.

##**What is Apriori Algorithm With Example?**

Apriori algorithm is the algorithm that is used to find out the association rules between objects. That means how two objects are associated and related to each other. In simple words, the apriori algorithm is an association rule learning that analyzes that “People who bought item X also bought item Y.

The objective of the apriori algorithm is to generate the association rule between objects. And the association rule tells us how two or three objects are correlated to each other. Apriori Algorithm is also known as frequent pattern mining.

##**Where Apriori Algorithm is Used?**

The most common and popular example of the apriori algorithm is **Recommendation System.** Let’s understand with the help of the Movie Recommendation example.

Suppose this is the data of users who like some movies-
**[Click to continue reading...](https://www.mltut.com/what-is-apriori-algorithm-with-example/#where-apriori-algorithm-is-used)**
Project 32 of 100 - Ecommerce Frontend Prototype in React
Tags: react, javascript, netlify, css
Published: 2021-01-13 06:27:16

*Hey! I'm on a mission to make 100 React.js projects ending March 8th. Please follow my dev.to profile or my [twitter](https://www.twitter.com/jwhubert91) for updates and feel free to reach out if you have questions. Thanks for your support!*

Link to today's deployed app: [Link](https://100-react-projects-day-32-dolces-dollhouse-day-2.netlify.app/)
Link to the repo: [github](https://github.com/jwhubert91/100daysofreact/tree/master/day-32-dollhouse-ecommerce)

It's always fun working with a non-technical person to build a website. You realize what you've learned, and remember the challenges of the technical side of things to those outside of the development world. The other advantage is that you get exposed to ideas outside of the narrow world of prim and proper user-friendly ideas that a developer might prefer.

In this case, the client liked the aesthetic of the popular online store for young women "Dolls Kill". Here is a preview of their homepage:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/sn59xq4la99pso5ek2q9.png)

For this project I'm following Michael Siebel's (of Y Combinator) advice to just launch your MVP as fast as possible. This isn't my company, but still I wanted to deliver an e-commerce site the customer could use as fast as possible.

The client is Mexican and will be selling products internationally. For that reason it was important to hand-code the website and bypass the payment challenges that developing the website on something like Shopify would present. For payments, we are directing customers (via a chat bubble) to an already-active Whatsapp business chat where my client can receive payment directly without the hefty transaction fees imposed by payment processors such as Shopify, Stripe, or for international payments- Ebanx.

The site is now visible and usable, at a minimum level. Tomorrow I'll deliver the rest of the bells and whistles to make this a full-fledged ecommerce site with additional images and in-depth descriptions as well as prices.

Looking forward to it!
Postgres Authentication Problem
Tags: postgres
Published: 2021-01-13 06:18:33

Hello, everyone.
I'm new to this community. I don't know if my first post should have been an introduction of myself.
But currently I've got a pressing matter at hand.
I've searched stackoverflow and almost all documents google could provide. Still my problem is unsolved.
I'm trying to run a server on VPS.
The user and database is created. And I've configured the authentication method into md5 in the following file.

/etc/postgresql/12/main/pg_hba.conf

Yet, when I try to login with the following URL, I get an error
[password authentication failed for user "username"]

DATABASE_URL=postgres://username:<PASSWORD>@localhost/dbname

Please help me solve this problem.
What is Git? | Basic Git commands
Published: 2021-01-13 06:12:33

Git is a distributed version control system. The meaning of a distributed version control system is that the changes can be kept locally as well as remotely. Git is open-source, it can be used for free no license cost involved.

Basic Git commands are:

1. git init: This command is used to initialize the current folder to track its changes.

2. git status: This command displays the status of the staging area or working area and working directory. It means that which files are added or removed or modified.

3. git diff: This command shows the exact changes and with line and column number.

4. git add: This command adds the changes to the staging area. If a new file is added, this command starts tracking the file for modification.

5. git commit: This command is used to save all the changes with a unique id called commit id in the local repository.

6. git push: This command is used to send the changes to the remote repository or server.
Swapping A and B without 3rd variable
Tags: java, algorithms, programming
Published: 2021-01-13 05:55:02

So my teacher gave me a task, a simple task to swap two values in our new Java class. That was an easy task as we had a good background in the Programming language. But he stated that no more than two elements were allowed. That seems a tricky one and everyone in the class was clueless cause this was the mathematical approach for solving.
So it was a bit confusing and after finding a solution I was a bit surprised as there was indeed a better technique for swapping.
      **steps**
        * add a and b and assign to a
        * subtract a from b and assign to b
        * subtract a from b and assign to a
Now, this became our simple swapping without using the third parameter.
Here is a code in java.

```
class SwapTest {

  public static void main(String arg[]) {
    int a = 999999999;

    int b = 999999999;
    a = a + b;
    b = a - b;
    a = a - b;
    System.out.println("a=" + a + " b=" + b);
  }
}
```

> disadvantage of this method in java is that while using integer it will overflow when the number is large
ความหมายของ ~> ในการกำหนดเลข deps version ของ mix
Tags: elixir
Published: 2021-01-13 01:23:55

ปกติเวลาจะเพิ่ม library เข้ามาใช้งาน เราก็จะต้องกำหนด dependencies โดยเลือกชื่อ library แล้วก็ version ที่ต้องการใช้งานในไฟล์ `mix.exs`

แต่ส่วนใหญ่แล้วก็จะเข้าดูใน https://hex.pm/ แล้วก็ก็อปปี้เลข version มาซึ่งมักจะเห็นแบบนี้เช่น

```
{:plug, "~> 1.1.0"}
```

ทีนี้ไอ้ `~>` มันคืออะไร แล้วมันจะเอา version ไหนบ้างให้เรา ซึ่งใน document ของ Elixir บอกเอาไว้ที่นี่ https://hexdocs.pm/elixir/Version.html ว่า

`~>` เนี่ยมันจะถูกแปลงเป็น `>=` และ `<` โดยช่วงที่ได้จะขึ้นอยู่กับเลขเวอร์ชันที่กำหนดให้หลัง `~>` เช่น

| ~>           | Translation              |
|--------------|--------------------------|
| ~> 2.0.0     | >= 2.0.0 and < 2.1.0     |
| ~> 2.1.2     | >= 2.1.2 and < 2.2.0     |
| ~> 2.1.3-dev | >= 2.1.3-dev and < 2.2.0 |
| ~> 2.0       | >= 2.0.0 and < 3.0.0     |
| ~> 2.1       | >= 2.1.0 and < 3.0.0     |

คือเลขเวอร์ชันมันเป็น semantic version เลขกลางคือ minor กับเลขหลังคือ patch ถ้าเรากำหนดถึง 3 หลักคือถึง patch มันก็จะเลือกเลข version `>=` version ที่เราใส่ให้ `~>` จนไม่เกิน minor version ถัดไป

สรุปให้เข้าใจง่ายๆถ้าเราใส่ 3 หลัก มันจะอัพแค่ patch ให้เราเท่านั้นทำให้เราควบคุมให้ใช้ไม่เกิน minor version ที่เราเลือก

ถ้าใส่แค่ 2 หลัก จะได้ช่วยที่กว้างกว่า คือให้มันอัพ minor version ให้ด้วยแต่ไม่ไม่อัพ major version เช่นใส่ `~> 2.0` เป็นการควบคุมว่าถ้าสั่งอัพ จะได้ของ minor ล่าสุดแต่ major ยังคงเป็น 2 อยู่นั่นเอง

<a href="https://www.buymeacoffee.com/weerasak" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
how to internet in 2021
Tags: twitter, facebook, mentalhealth
Published: 2021-01-13 05:30:03

1. Stay secure and private. 2FA, password managers, privacy browsers and search engines like Startpage or DuckDuckGo.
2. Turn off all notifications (except for Phone, Messages, Messenger, Calendar, the essentials). If you need to use a service or to purchase a product, you’ll go to them on your own without their prodding.
3. Mute/unfollow all the assholes. Yes that includes QANON and pro-Trumpers, but it also includes annoying over-the-top leftists who have lost grips with reality.
4. *READ* ALL your news from reputable sources (AP, BBC, NYT, WP). Believe nothing at face-value, keep an open mind, consider the varied agendas at play. Do not get news from social media. Do not watch/listen to the propagandists at CNN, MSNBC, and Fox News.
5. Make an attempt to educate yourself fully on a topic and understand opposing viewpoints before the impulse to be a condescending dick takes over. Also known as don’t be an uninformed asshole.
6. Live 90-99% of your life (outside of work) free from social media. Meet other humans! Exist in the real world (Zoom and Discord works for now, you get what I’m saying). **Social media isn’t equivalent to a social life. It is a false reality.** You want respect as a human, not as a username on a website.
7. You don’t *have* to share anything, ever, with anyone, for any reason. If you find yourself in debates online, you’re the only one to blame for that. 
8. If it takes excessive mental gymnastics to prove your point, you’re probably wrong. Learn to learn, you don’t know everything. If you think you “know better than most”, that means you’re likely a narcissist, not that you’re actually correct.
9. Be kind as much as possible, assume good intent until it’s evident that it’s not. If it’s not, remember rules 6 and 7.
Creating Aliases on Linux and Mac
Tags: linux, tutorial, beginners, bash
Published: 2021-01-13 05:23:36

[If you found this article useful consider donating.](https://www.patreon.com/alanjc)

***Note: The following steps should also apply to MacOS as well.***

Are you tired of typing long commands into the terminal? Did you misremember a flag causing an error making you pull out your hair for 2 minutes only to realize that flag doesn't exist? Well worry no more because I'll be showing you how to create aliases for all of those pesky hard-to-remember commands.

## What are aliases?

An alias is just a fancy term for nicknaming a certain command.

They are very useful because instead of typing out a long command with several flags and options, you can nickname it to a shorter command (i.e. give it an alias) and simply remember the shorter command.

## Editing the ".bashrc" File

The first step in creating aliases is to open up a new terminal window and head over to your user's directory like so:

```bash
cd /home/<username>
```

***Note: By convention, you would usually define your aliases inside of the ".bashrc" file but because defining all of your aliases here can get out of hand pretty quick, we'll be creating a separate file in which we'll be defining our aliases.***

From here, you'll want to open up the ".bashrc" file like so:

```bash
sudo nano .bashrc
```

Inside of ".bashrc" you'll want to paste in the following snippet of code:

```bash
# Alias
if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi
```

The snippet of code above simply tells bash that if the file ".bash_aliases" exists then load it and run it.

Now, enter CTRL + X then Y then ENTER to save the file.

## Creating Aliases

Inside of the "/home/<username>" directory, you'll want to create a new file called ".bash_aliases." You can do so with the following command:

```bash
touch .bash_aliases
```

It's in this file that you'll want to create your aliases. Open up the ".bash_aliases" file like so:

```bash
sudo nano .bash_aliases
```

Now, to create an alias you can do the following:

```bash
# MAKING AN ALIAS
## alias <name of alias>="<bash command>"
##
## Example:
## alias l="ls -lah"
##
## To apply changes run the following:
## source ~/.bashrc

alias l="ls -lah"
```

To save your file you can do CTRL + X then Y then ENTER.

Now, enter one last command to load our aliases.

```bash
source ~/.bashrc
```

That's it!

Now, if you type in your custom alias into the terminal, it would be like if you were actually typing the longer command that you aliased.

***Note: Every time you edit the ".bash_aliases" file you will have to reload the ".bashrc" file or start a new terminal session for the changes to take effect.***

Thanks and have a good one!

[If you found this article useful consider donating.](https://www.patreon.com/alanjc)
URL Hash
Published: 2021-01-13 01:07:39

---
title: URL Hash
published: true
description: A small tidbit about the URL hash
tags: 
//cover_image: https://direct_url_to_image.jpg
---
## Many Moons Ago
When I first began to create HTML pages many many moons ago I remember being fascinated that I could have a web page scroll directly to a portion of the page by giving the element an id and then using the hash symbol  `#`  , followed by the id as the href value in an anchor tag. OR I could put that same thing at the end of the URL to have the page directly navigate to that portion of the page.  I know that doesn’t sound that exciting but at this time I was also using notepad (not notepad++) to create web pages. Random tidbit my first web page was about Kevin Garnett. 

## Many Suns Later
Fast forward many many suns later (last weekend to be exact) and the hash symbol in a URL is brought to my attention again while working with Twitch’s OAuth authentication. Without getting deep into the details when using the OAuth implicit code flow a http request is sent in order to receive a token that used in subsequent request to the Twitch API. How is the token returned? In the URL of course (sarcasm). A redirect_uri parameter is sent in the authentication request. After the user authenticates the authentication process will redirect the user’s browser to the redirect_uri with the token appended using the hash symbol. 

```
REQUEST: GET http://twitchauth?redirect_uri=http://comeback_to_this_page
RESPONSE: http://comeback_to_this_page#access_token=TOKEN_NOW_GO_HAVE_FUN
```

Well now that I have the token how do I get it so that I can use it? Since I was using javascript I simply used the `location.hash` function to get the token (of course removing the unnecessary characters also).

## So what exactly is the hash?
Well the hash is technically a URL fragment that is used to scroll the browser to predefined positions on the page.  The hash is located at the end of the url separated by the `#` symbol. I was introduced to hashes as HTML anchors.  Now they are also used to add dynamic functionality web pages. Other places that you might see the url hash in action is single-page webapps, React Router’s [HashRouter](https://reactrouter.com/web/api/HashRouter) or in URLs used to open apps or webpages on mobile phones.
LSTMs
Tags: nlp
Published: 2021-01-13 04:25:47

### LSTMs

The idea of LSTMs (Long Short-term Memory Networks) is closely related to the fact that we humans understand the context when we talk. And, there is no way a traditional neural network can help in storing this context. So Recurrent neural networks (RNNs) were invented to tackle this problem. These are networks with a recurring nature that allows information to persist.
&nbsp;
A simple RNN looks like this:
![A Simple RNN](https://dev-to-uploads.s3.amazonaws.com/i/t55na83uydypc91j4ok4.png)

It takes an input x and outputs a hidden state h. It also has another output which also goes as input to the RNN block. This way it has the ability to connect previous information to the current task. Though simple RNNs fail when it comes to understanding longer sequences of texts.

LSTMs are a special kind of RNN. It covers up the shortcomings of a simple RNN which is good for a short sequence of information.

LSTMs are capable of learning long-term dependencies. Its key part is - Cell state. The horizontal green line running in the below picture. It holds information on previous input sequences.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/7j10sdxkpfmh3dnrjn83.png)


&nbsp;
&nbsp;
The process of LSTMs can be understood in the following 4 steps:

**Step 1** - Throw away what's not needed

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/vnyx92j88aqbddwex87u.png)

The incoming Cell state contains information about the whole input sequence up to that moment. The first task is to figure out what information to be thrown away from the Cell state. This decision is taken using a sigmoid layer called the Forget gate. It looks at the incoming input and the hidden state and produces numbers between 0 and 1. Values reaching towards 0 will be the ones that should be forgotten.
&nbsp;
&nbsp;
**Step 2** - Compute and keep what's needed

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/dycnymvuq3xlccoftjex.jpg)

This is done by the part called the **Input gate**.

It has two parts, the first one is a Sigmoid layer and another is a tanh layer. Both of them figure out what information will be updated to the Cell state.
&nbsp;
&nbsp;
**Step 3** - Update the Cell State

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/5rakce3ojp4womnsz4ln.jpg)

Now is the time to update the old Cell state to a new Cell state using the values calculated in the previous step.
&nbsp;
&nbsp;
**Step 4** - Compute what to output

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/9f1pb5lsc1x42cbbs13c.jpg)
Run a sigmoid layer to decide which part of the new Cell state to output. This process happens at the Output gate.
Put the new Cell state through tanh and multiply it by the output of the sigmoid function, so that only selected parts are in the output.

Hope the blog gives you an idea of how LSTMs work!
Closures: A breakdown - Part 2
Tags: javascript, codenewbie, computerscience
Published: 2021-01-12 17:38:04

This blog will give another perspective on how closures work, it's continuation of the previous blog. So do give that one a read which will clarify most of the concepts and this will be a cherry on top.

Let's take the same example as in the previous post. But, let's write it down in a different way. The output is the same.
```
function outer() {

  function inner(a) {
    function cb() {
      console.log(a);
    }
    setTimeout(cb, a*1000);
  }
  
  for(var i=1; i<=5; i++) {
    inner(i);
  }

  console.log("I run first")
}

outer();
```
When the `for` loop is run, each time an execution context is created of `inner` function in the call stack. When the `inner` function is called, function `cb` is allocated memory and `setTimeout` is run. Even before `setTimeout` is run, there's a bond formed between `inner` and `cb` as `a` will be used in the future by `cb`. So, when `cb` is stored in the window with a timer attached to it, it also has backpack that has the value of `a`. When called after a second, it finds `a` in that backpack and that backpack is nothing but closure. Since `inner` is called 5 times and each time a new `cb` is created, the backpacks are different for each one of the `cb` with different timers.   

Now, let's tweak the code a little bit.
```
function outer() {

  function cb() {
    console.log(a);
  }

  function inner(a){
    setTimeout(cb, a*1000);
  }
  
  for(var i=1; i<=5; i++) {
    inner(i);
  }

  console.log("I run first")
}

outer();
```
Take moment and guess what will be the output. Run it using an IDE and take a look. You'll get an error saying `a` is not defined. When `cb` is ready to be executed, it cannot find `a` because its not in its parent function scope. `cb` and `inner` are totally different functions and they have no relation. That will only work if you pass the value of `a` to `cb` and define another callback function inside the `inner` function. Then you are sending the value into the scope of `cb`.
And that's all about closures.
React Hooks
Published: 2021-01-13 04:12:39

React hooks are a pretty amazing tool in Javascript. You can easily change a components state without making it a class. It is fairly simple and easy to use. It saves a lot of time and you can use them multiple times in a single component. 
I will show you a example of how react hooks will look.

import React, {useState} from 'react';

function App () {
let [currentCount, incrementCount] = useState(0);

return <><h1 onClick = {incrementCount(currentCount + 1)}>Click Me</h1>
<h1>{currentCount}</h1>
</>

}


This small function basically creates a variable with a value of 0. When you click on click me it increments the count. Which will change that variables state. This will cause the page to re render to show the correct count. I like using hooks because I believe it makes code look cleaner, you also have to write less lines of code to change the state. I feel like this is fairly popular among developers. 

Also some examples can be maybe you want to render something based if the state is true or false, with useState it is basically works as a toggle. When you click something you can toggle it to be true and then when you click it again you can toggle it to be off. If you want more complex states you may have to use a class component in order to pull it off.