teleren/devto huggingface dataset:
Running MongoDB, Redis, MySQL, and NATS as a Docker container
Tags: docker, mongodb, mysql, redis
Published: 2021-04-10 06:50:44

Recently my laptop fan was making lots of noises. So I went to format and reinstall the operating system. This time I thought why not use docker for all the services which I was using through brew before.

Below are some of the commands which I used to start different services in Docker and persist their data. Each command you will run will pull the latest image from the docker hub if it does not exist in your local machine and run the container in the detached mode.

## MongoDB

```bash
docker run -d -n mongo -p 27017:27017 -v ~/data/mongo-data:/data/db mongo:latest
```

## Redis

```bash
docker run -d -n redis -p 6379:6379 redis:latest --dir /tmp
```

## MySQL

```bash
docker run -d -n mysql -e MYSQL_ROOT_PASSWORD=root -p 3306:3306 -v ~/data/mysql-data:/var/lib/mysql mysql
```

## NATS

```bash
docker run -d -n nats-streaming -p 4222:4222 nats-streaming:latest
```

PS: Sometimes when you restart your laptop resulting in docker shutting down all the services that are running in the Docker. To overcome this problem I used some bash aliases.

```bash
alias dockmongo="docker run -d -n mongo -p 27017:27017 -v ~/data/mongo-data:/data/db mongo:latest"
alias dockredis="docker run -d -n redis -p 6379:6379 redis:latest --dir /tmp"
alias dockmysql="docker run -d -n mysql -e MYSQL_ROOT_PASSWORD=root -p 3306:3306 -v ~/data/mysql-data:/var/lib/mysql mysql"
alias docknats="docker run -d -n nats-streaming -p 4222:4222 nats-streaming:latest"
```
Free Live Chat Support Software for Website
Published: 2021-04-10 06:48:11

Free Live Chat Support Software for Website with Chat Dove : https://www.chatdove.com/

What better way to help your customer than through a quick chat on your website? 

Add Free Live Chat Support Software for Website to Increase Your Sale, Customer Support, Boost Your Online Business with - 
<a href="https://www.chatdove.com/">free live chat software</a> 
<a href="https://www.chatdove.com/">free live chat</a> 
<a href="https://www.chatdove.com/">best live chat software</a> 
<img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/60rehs25kwtumxwhymvr.jpg" />
Hide Keyboard in Android using Kotlin in 20 second
Published: 2021-04-10 06:39:28

Write these extension function in utility class to hide the soft keyboard
```kotlin
fun Fragment.hideKeyboard() {
    view?.let { activity?.hideKeyboard(it) }
}

fun Activity.hideKeyboard() {
    hideKeyboard(currentFocus ?: View(this))
}

fun Context.hideKeyboard(view: View) {
    val inputMethodManager = getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager
    inputMethodManager.hideSoftInputFromWindow(view.windowToken, 0)
}
```

Now use this method in your activity and fragment where you want hide keyboard.
```kotlin
hideKeyboard
```
This will close the keyboard regardless of your code either in dialog fragment and/or activity etc.
Hurry Up !! Developers A new supportive community is here
Tags: react, webdev, fullstack, community
Published: 2021-04-10 06:31:41

Only developers' is an online community for both newbie coders and professional Programmers , It is the place where a newbie can ask for help, and professionals can get their project team members and also help new coders with their projects. you can share your screen and seek help from professionals Our Clear vision is to help programmers to master their skill set and tackle errors. If you join the community then it would be very beneficial to you also and other developers also, In the server there would be other developers with whom you can team up and do exciting projects and also we have voice channels where you can share the screen and take help with your error, Comm'n all developers we can create a community where we help each other and grow, hurry up join now or otherwise you will lose the opportunity, discord Link:- https://discord.gg/d2X8jxyj6y

Developers just try to join the server, I bet you will not regret it, There are specific Voice Channels where you can share your screen and ask for help ,Hope You will definitely Look after this
Zero Knowledge Proofs: Um, what?
Tags: cryptocurrency, monero, blockchain, zeroknowledgeproofs
Published: 2021-04-12 21:40:37

---
title: Zero Knowledge Proofs: Um, what?
published: true
date: 2021-04-10 06:27:36 UTC
tags: cryptocurrency,monero,blockchain,zeroknowledgeproofs
canonical_url: https://medium.com/coinmonks/zero-knowledge-proofs-um-what-a092f0ee9f28
---

[![](https://cdn-images-1.medium.com/max/812/1*Zy58hCsBiKZyrhmjcgQVRA.png)](https://medium.com/coinmonks/zero-knowledge-proofs-um-what-a092f0ee9f28?source=rss----721b17443fd5---4)

What is: Zero Knowledge? Proof? Pedersen Commitment?

[Continue reading on Coinmonks »](https://medium.com/coinmonks/zero-knowledge-proofs-um-what-a092f0ee9f28?source=rss----721b17443fd5---4)
What is first class object in python?
Tags: python, functions, decorators
Published: 2021-04-10 05:55:43

---
title: What is first class object in python?
published: true
description: 
tags: python, functions, decorators
//cover_image: https://direct_url_to_image.jpg
---
In **python**, functions are first class objects in python.

### Advantages of first class objects:
- We can treat functions like other normal objects like int, string, list etc
- We can pass functions as another function arguments, return a function in another function and assign a function to another variable
- Define a function within a function (Inner functions)
- This first class object plays a key role in python for decorator design pattern.

Examples:

```
# Simple function for adding two numbers
def add_num(num1, num2):
    return num1 + num2

# Passing function as a first argument
def add_values(fun, arg1, arg2):
    result = fun(arg1, arg2)
    return result
```
- Assigning function name to the variable:
```
fun = add_num
```

- Passing function as a parameter
```
two_num_sum = add_values(fun, 5, 8))
```
LeetCode 142. Linked List Cycle II
(javascript solution)
Tags: javascript, algorithms
Published: 2021-04-10 05:18:20

###Description:
Given a linked list, return the node where the cycle begins. If there is no cycle, return null.

There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following the next pointer. Internally, pos is used to denote the index of the node that tail's next pointer is connected to. Note that pos is not passed as a parameter.

Notice that you should not modify the linked list.

###Solution:
Time Complexity : O(n)
Space Complexity: O(1)

```javascript
var detectCycle = function(head) {
    let slow = head;
    let fast = head;
    while(fast && fast.next && fast.next.next){
        slow = slow.next;
        // Move fast pointer twice as fast as slow pointer and if there is a cycle, the fast will eventually meet slow at a node in the cycle but not necessarily the node that starts the cycle
        fast = fast.next.next;
        // Once we determine there is a cycle we must find where the cycle starts
        if(slow === fast){
            // Move slow pointer to the head
            slow = head;
            // Move both fast and slow pointer one node at a time and they will meet at the node where the cycle starts
            while(slow !== fast){
                slow = slow.next;
                fast = fast.next;
            }
            return slow;
        }
    }
    return null;
};
```
CRUD Operation with ASP.NET Core MVC, Entity Framework Core And SQL Server
Tags: aspnet, aspnetcore, efcore, sqlserver
Published: 2021-04-10 05:04:21

---
title:  CRUD Operation with ASP.NET Core MVC, Entity Framework Core And SQL Server
published: true
description: CRUD Operation with ASP.NET Core MVC, Entity Framework Core And SQL Server
tags: aspnet, aspnetcore, efcore,sqlserver
---

In this video, You will learn about ASP.NET Core MVC framework. How it's works and then create a basic Crud operation with Entity Framework core code first with SQL Server Database.

Topic discussed in this video are

➤ What is Model View Controller Pattern
➤ How MVC works
➤ Structure of ASP.NET Core MVC Application
➤ How to install Nuget packages for Entity Framework Core 
➤ How to create model classes with Annotation for validation
➤ How to create Entity Framework Context class and how to configure the database connection.
➤ How to Create Migration with Help of Entity Framework Tools Nuget package and Use of Add-Migration command. 
➤ How to apply migration with Entity Framework Core in SQL Server database with Update-Database Command
➤ How to create Scaffolding and How to create Controller and Views with Scaffolding in Visual Studio.
➤ Explanation of Code generated and How entity Framework Core works.
➤ How to do validation in Forms and how to use ASP.NET Core Tag helpers for that.






 Hope you like this video. 

{% youtube zHaMymuCBDo%}

📂 Source Code:

You can find source code from the following GitHub Repository. 
https://github.com/JalpeshVadgama/ASPNETCoreMVCEFCoreCrudOperation

If you like this video and wanted to see a similar kind of video then, please subscribe to my YouTube channel at - https://bit.ly/codewithjv
Quando usar Refs no React?
Tags: react, javascript, beginners, braziliandevs
Published: 2021-04-10 05:02:06

Ao conhecer os "refs" pensamos que é algo ótimo e que deve ser usado a todo momento para facilitar o acesso de elementos e componentes. Porém, isso é um erro grave.

Ficar criando referências é algo custoso e consome memória. É muito mais simples, leve e até melhor para a manutenção e reutilização de código se você utilizar refs apenas em situações em que não há outra solução, como:

* Executar "focus()" em um `<input>`;
* Dar "play" ou "pause" em um `<vídeo>`;
* Acessar o elemento `<canvas>` para desenhar;
* Disparar animações imperativas;
* Acessar elementos criados por uma outra biblioteca ou framework.

Fora essas situações, normalmente podemos evitar o uso de refs.

Por exemplo, ao invés de acessar o estado de um componente filho para alterar um dado dele, você pode passar dados ao filho pelas suas propriedades.

O elemento `<dialog>` do HTML exibe uma modal. Se você acessá-lo, poderá exibi-lo executando o método "showModal()" e escondê-lo executando "close()".

Porém, o `<dialog>` também pode ser controlado pelo atributo "open". Então é melhor criar uma variável no "state" para controlar o atributo "open" ao invés de criar um "ref" para executar "showModal()" e "close()".

# A Saideira

Esse post foi inspirado no conteúdo lá da [TreinaWeb](https://www.treinaweb.com.br/). Recomendo o material deles!
A natureza assíncrona do setState()
Tags: react, javascript, beginners, braziliandevs
Published: 2021-04-10 04:53:24

Usar o `console.log()` para imprimir valores é um item comum na depuração. No entanto, isso não funciona muito bem quando o código é executado de forma assíncrona. Um exemplo é o código a seguir:

```jsx
handleCounterIncrement = () => {
  const { counter } = this.state;
  console.log(`Before update: ${counter}`);
  this.setState({ counter: counter + 1 });
  console.log(`After update: ${counter}`);
};
```

Você com certeza já deve ter visto algo assim não é? E por que isso não funciona? As chamadas `setState()` são assíncronas. Não há garantia de que o código fornecido seja executado em ordem. Isso pode levar a resultados como este:

![Chamando console.log(state) antes e depois de setState()](https://miro.medium.com/max/722/1*xJljheGz6VjwwjyF-6zAqQ.jpeg "Chamando console.log(state) antes e depois de setState()")

As duas chamadas do `console.log()` são executadas antes da execução de `setState()`. Assim, ele imprime o valor do estado anterior duas vezes. Se você deseja verificar o valor do seu estado antes e depois de chamar `setState()`, passe uma função de callback como segundo parâmetro dentro de `setState()`.

```jsx
handleCounterIncrement = () => {
  const { counter } = this.state;
  console.log(`before update: ${counter}`);
  this.setState({ counter: counter + 1 }, () => {
  console.log(`after update: ${this.state.counter}`);});
};
```

A função de callback será executado após a conclusão de `setState()`, fornecendo um comportamento síncrono para o seu `console.log()`.

![Resultado com callback no setState()](https://miro.medium.com/max/718/1*8n1lNRbNSyX0_oOhrWZXxA.jpeg "Resultado com callback no setState()")

# A Saideira

Esse artigo foi inspirado num artigo do [Jeremy Aw](https://medium.com/@jeremyinelysium), recomendo muito da uma olhada nas postagens dele! 

**Até a próxima!**
Accepting all invites on LinkedIn
Tags: watercooler
Published: 2021-04-10 04:43:05

Suppose you're anything like me and get many invites after posting your LinkedIn handle on Twitter. In that case, you might be wondering if there's not a simple way to accept all of them at once.

LinkedIn used to have the option itself, but for whatever reason, it no longer does.

Luckily we as developers can leverage the power of JavaScript!

TL;DR:

```js
// Open invite page on LinkedIn and paste this in your debug console
const buttons = document.querySelectorAll('button.artdeco-button--secondary');
buttons.forEach(button => button.click());
```

## How to accept all invites on LinkedIn at once

First, we need to go to the LinkedIn website and see there are multiple open invites.

![LinkedIn multiple invites](https://cdn.hashnode.com/res/hashnode/image/upload/v1617687027675/chZI43pls.png)

The next step is to find out what makes an invite button unique, so we will be using the inspector to find this out.

- Mac: `Cmd` + `Shift` + `C`
- Windows: `Ctrl` + `Shift` + `C`

![LinkedIn invitation buttons](https://cdn.hashnode.com/res/hashnode/image/upload/v1617687299054/mkHXNEBSM.png)

Here you can see both buttons, the top one being the button to decline an invitation and the bottom one to accept.

The top one has a unique class of `button.artdeco-button--tertiary`.
The bottom one `button.artdeco-button--secondary`.

With those two selectors, we can either accept or decline all invites at once!

Let's write a selector to get all the accept buttons.

```js
const buttons = document.querySelectorAll('button.artdeco-button--secondary');
```

Then we can simply loop over the results and click them.
Making the full function we need to execute in our console tab:

```js
const buttons = document.querySelectorAll('button.artdeco-button--secondary');
buttons.forEach(button => button.click());
```

And that's it, a super simple way to accept all invites on LinkedIn at once!

![LinkedIn console click all invites](https://cdn.hashnode.com/res/hashnode/image/upload/v1617687547247/rHd5IPOAu.png)

Feel free to [add me on LinkedIn](https://www.linkedin.com/in/chrisbongers/) as well.

### Thank you for reading, and let's connect!

Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on [Facebook](https://www.facebook.com/DailyDevTipsBlog) or [Twitter](https://twitter.com/DailyDevTips1)
It's CSS not Photoshop | Dynamic Avengers City Lights
Tags: html, css, javascript, webdev
Published: 2021-04-10 03:56:44

---
title: It's CSS not Photoshop | Dynamic Avengers City Lights
published: true
description: Create dynamic backgrounds using HTML, JS, CSS
tags: HTML,CSS,javascript,WebDevelopment
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rk8hgvkrloku979gxc5c.png
---

Watch the 40-sec complete video demo in 1080p at https://youtu.be/ehDiOgNNiXk

{% youtube ehDiOgNNiXk %}

**Secret Ingredient**

```
    -webkit-text-fill-color: transparent;
    -webkit-background-clip: text;
    -webkit-text-stroke-width: 0.7px;
    -webkit-text-stroke-color: white;
```

You can also check out the video on background text clipping at https://youtu.be/6G-juiJIU8E
{% youtube 6G-juiJIU8E %}

Please like, share, and subscribe to my channel if you love the content ❤️❤️❤️.
#Day20 - Naming Conventions in Python
Tags: python, programming, 100daysofcode, codenewbie
Published: 2021-04-10 03:38:54

Today we will discuss some Naming conventions in Python. 

### Different type of naming conventions
We will name the same variable in the different conventions. Let's assume, we are trying to name a list or array which stores the marks of students.

#### Snake Case
```python
students_marks
```
The words are separated using an underscore. Each word starts with a lower case letter.

#### Pascal Case
```
StudentMarks
```
Each word starts with an upper case. They are not separated using any separator.

#### Camel Case
```python
studentMarks
```
The first word starts with a lower case letter and the following words start with an upper case letter.

#### Kebab Case
```python
student-marks
```
Each word starts with a lower case and they are separated with hyphens.

#### Hungarian Notation
```python
arrStudentMarks
```
In this variable naming convention, we add the data structure at the beginning of the name.

### Naming convention in Python
#### Packages
Use snake_case for naming packages

```python
import streamlit
import pulp
import flask_sqlalchemy
```
#### Modules
Modules are the functions you import from a package. They also use snake_case
```python
from streamlit import subheader, text, markdown, title
from datetime import datetime
from flask import jsonify
```
#### Classes
Classes should be named in "CamelCase" format.
```python
class MyClass:
    def __init__():
        pass

class Dog:
    def __init__():
        pass
```
Below is another example of importing classes from a Module
```python
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
```
####  Global (module-level) Variables
Global variables should follow snake_case
```python
variable = 1
variable_one = 2

def func():
      global variable
      global variable_one
```

#### Methods
- Public method should be named using snake_case
- By convention, private methods should be starting with an underscore ('_')

```python
class MyClass:
    '''
    This is a public method
    '''
    def  public_method():
        pass
    
    '''
    This is a private method
    '''
    def _private_method():
        pass
```

#### Instance Variables
Similar to methods, public instances should be in snake_case and private instances should begin with underscores(_)
```python
class MyClass:
    pass

public_instance = MyClass()
_private_instance = MyClass()
```

#### Functions
Functions should also follow snake_case
```python
def func():
    pass

def func_one():
    pass
```

#### Constants
Constant names must in all uppercase.
```python
PI = 3.14
CONSTANT = 10
```
It is just a naming convention. Python doesn't support constants.
5 Ways To Drive Engagement In 2021 With This One Neat Trick
Tags: grifting, grifter, grift, griftish
Published: 2021-04-10 03:24:05

## Use a Fiver
1.) Write a title with the number 5 in it. People like the number 5 because it's not too big and it's not too small.

## Set It and Forget It
2.) Write your post and then forget about that shit. Don't look at it, don't respond to comments, basically don't engage at all.

## Get Your Grifter Friends to Share Your Post
3.) It's not good grift if no one sees it. Make a deal with your friends that if they share your grift, then you'll share their grift.

## Keep It General and Worthless
4.) Don't ever give away any valuable information. Why would someone buy your course or eBook if they've read it already. Make sure not to hamper your profits by posting any ACTUAL useful information.

## Reduce, Reuse, Recycle
5.) Don't ever dispose of your grift. Keep juggling your posts over and over again. Just make a small change like changing the date from 2020 to 2021. Share 10 items instead of 5. Share 8 items. You get the picture. Don't **ever** throw anything away.

## Always Make It Look Like You're Helping
6.) Don't forget to drop that bonus tip. People will really think you care. They won't know that you're following rule 5 and you just cut a post of 10 tips down to 6. You'll be giving less but they thing they'll be getting more.

Thanks for reading and that's all y'all.
Switching between VSCode terminals using hot keys
Tags: vscode, tooling
Published: 2021-04-10 03:10:14

When I code I prefer to keep my hands on the keyboard as much as possible. For me, this keeps me more focused on the task at hand. Switching to the mouse is something try to I reserve for interacting with browsers.

By default [VSCode](https://code.visualstudio.com/) doesn't include the keybinding necessary to switch terminals via the keyboard. You are forced to use the mouse, which disrupts my flow.

Here's how you add terminal switching keybindings in VSCode:

# Step 1
Use `ctrl+p` (`cmd+p` on the Mac) and type `keybindings.json`. Select the file from the drop downlist. This will open a file that looks like this:

```json
// Place your key bindings in this file to
// override the defaults
[]
```

# Step 2

Replace the contents of `keybindings.json` with this for Windows or Linux: 
```json
// Place your key bindings in this file to
// override the defaults
[
    {
        "key": "ctrl+down",
        "command": "workbench.action.terminal.focusNext",
        "when": "terminalFocus"
    },
    {
        "key": "ctrl+up",
        "command": "workbench.action.terminal.focusPrevious",
        "when": "terminalFocus"
    }
]
```

Or this when using the Mac:

```json
// Place your key bindings in this file to
// override the defaults
[
    {
        "key": "cmd+down",
        "command": "workbench.action.terminal.focusNext",
        "when": "terminalFocus"
    },
    {
        "key": "cmd+up",
        "command": "workbench.action.terminal.focusPrevious",
        "when": "terminalFocus"
    }
]
```

Now you can use the keyboard to change terminals in VS Code.