teleren/devto huggingface dataset:
Show and kill running processes in MySQL
Tags: mysql
Published: 2020-05-26 08:10:14

The KILL command terminates a connection thread by ID along with the related active query, if there is one. Then, to identify queries for deletion, you need to see processes on the server - and the SHOW PROCESSLIST command will be a fine solution. It's not an elegant way to fix database issues, but rather an effective last resort tool. There are 4 major reasons for that:
* If a long-running query holds other transactions from executing your more relevant query
* If a large number of faulty queries block viable queries
* If there are orphan processes after a client was disconnected from a server
* 'Too many connections' message

None of these scenarios are great, so before executing KILL, make sure other solutions have been tried. But once you know the KILL method is necessary, you will have a few different options. But in this particular guide, we will focus on the more 'intuitive' way of showing and killing faulty queries using simple commands. You should keep in mind that KILL has two modifiers - CONNECTION and QUERY. KILL CONNECTION is essentially the same as KILL, while KILL QUERY terminates only the query for the specified connection ID and leaves the connection itself intact. [https://www.devart.com/dbforge/mysql/studio/show-running-queries-in-processlist.html](https://www.devart.com/dbforge/mysql/studio/show-running-queries-in-processlist.html)
素集合データ構造 (Disjoin-set または Union-Find)
Tags: 素集合, disjointset, unionfind
Published: 2020-05-26 07:59:32

{% youtube WexAp-YHhOw %}

コード

```js
const Node = function (val) {
  this.val = val
  this.parent = this
  this.rank = 1
}

const DisjointSet = function () {
  this.m = []
}

DisjointSet.prototype.add = function (val) {
  this.m[val] = new Node(val)
}

DisjointSet.prototype.union = function (val1, val2) {
  const p1 = this.find(this.m[val1].val)
  const p2 = this.find(this.m[val2].val)
  if (p1 === p2) {
    return
  }
  if (p1.rank === p2.rank) {
    p2.rank++
    p1.parent = p2
  } else if (p1.rank < p2.rank) {
    p1.parent = p2
  } else {
    p2.parent = p1
  }
}

DisjointSet.prototype.find = function (val) {
  let cur = this.m[val]
  if (cur.parent != cur) {
    cur.parent = this.find(cur.parent.val)
  }
  return cur.parent
}

let input = require('fs').readFileSync('/dev/stdin', 'utf8');
const lines = input.trim().split("\n")
let n, q, d

for (let i = 0; i < lines.length; i++) {
  if (i === 0) {
    [n, q] = lines[i].split(" ")
    d = new DisjointSet()
    for (let i = 0; i < n; i++) {
      d.add(i)
    }
  } else {
    const [com, x, y] = lines[i].split(" ").map(v => parseInt(v))
    switch (com) {
      case 0:
        d.union(x, y)
        break;
      case 1:
        console.log(d.find(x) === d.find(y) ? 1 : 0)
        break;
      default:
        throw Error('invalid com')
    }
  }
}
```

## 問題

* https://onlinejudge.u-aizu.ac.jp/courses/library/3/DSL/all/DSL_1_A
TypeScript - Asersiones de tipo
Tags: typescript, beginners
Published: 2020-05-26 07:19:30

### Tipo: Aserciones de Tipo

---

Cuando el dev conoce más que el compilador de TS es necesario un mecanismo que permita hacer una conversión de tipos de datos. En tal caso le estamos diciendo al compilador ***"confía en mi, sé lo que estoy haciendo"***.

Usa dos sintaxis:
`<Angle Bracket>` : dentro debemos definir un tipo
`(variable as tipo)` 

> Se parece al ***casting*** de otros lenguajes de programación de alto nivel. Pero este no tiene ningún impacto a nivel de ejecución.

**Caso práctico:**
Tenemos una variable de tipo any a la que le asignamos un texto.

```tsx
let username: any;
username = 'anbreaker';
```

Creamos otra variable con tipo string, a la que le asignamos el texto que contiene `username` . Pero para poder asignarlo debe cumplir una condición; que el texto sea mayor a 5 caracteres. ¿Cómo lo sacaremos?

Debido a que `username` es de tipo `any` no podemos usar la función `.length`. Así que debemos decirle a TS que trate la variable como si tuviera el tipo `string`. Esto se llama hacer una ***"Aserción de tipos"***

```tsx
let message: string =
  (<string>username).length > 5 ? `Welcome ${username}` : `username is too short`;
console.log('Message ->', message);
```

La otra manera que pudo hacerse la aserción fue: 
`(username as string).length`

Si utilizas Typescript con ReactJS asegurate de usar el tipo de asersión con `as`. Esto porque hay conflicto con JSX al usar la forma `<tipo>variable`

Estas notas fueron tomadas al realizar el curso de Platzi - [Curso de Fundamentos de TypeScript](https://platzi.com/clases/typescript/)
Why do we need HTTPS?
Tags: https, websecurity, webprotocols, beginners
Published: 2020-05-26 07:12:06

---
title: Why do we need HTTPS?
published: true
description: Know about the purpose of making your websites use HTTPS protocol.
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/73jexn9ekew0ne2ixu32.png
tags: #https #websecurity #webprotocols #beginners
---

# Hyper Text Transfer Protocol Secure (HTTPS)

- It is the `secure` version of HTTP, the protocol over which data is sent between your browser and the website that you are connected with. The 'S' at the end of HTTPS stands for 'Secure'. Therefore, all communications between your browser and the website are encrypted.
- Also known as ‘HTTP over SSL’, ‘HTTP Secure’, or ‘HTTP over Transport Layer Security’.


## Reasons for using HTTPS:

- Privacy
- Integrity
- Identification.


1. Privacy

    It means that no one can `eavesdrop` on your messages.

    When server send a message to browser which is not encrypted, i.e. you browse to a website without HTTPS, someone could be eavesdropping on your password or private information.

    The green padlock on the URL bar of your browser tells you that there is no one watching over your message/data.

2. Integrity

    It means that the message is not manipulated on the way to its
    destination.

    When the message is not encrypted - before it reaches to the client, someone can intercept the message.

    This is often called a `man-in-the-middle attack`. The green padlock make sure that your communication is not being tampered with.

3. Identification

    It means that you can check that this message is coming from the real server/source.

    A `digital signature` attached to a message can identify the sender.

    When you are browsing the web, identification means that the site that you are visiting is indeed the one you think it is.

    `HTTPS, via SSL certificates, ensures you are connected exactly with the receiver you would expect.`

    This SSL certificate is valid and has been issued by a legitimate Certificate Authority.
___________________________________

The article gives a short explanation regarding the purpose of https.
Why VoIP Is Best For Remote Teams?

Tags: wfh, development
Published: 2020-05-26 06:46:28

These days most of the IT employees are working remotely and this results in the need for the best communication tool that provides flexibility, Smartphone Compatibility, Workflow Efficiency, and so on. Here comes the VoIP in focus. According to your organization’s size and calling needs, you can choose the best VoIP tool and save your monthly bill. It is obvious that VoIP is consuming a market of over 15% per year. You can take advantage of high reliability when VoIP is bundled with other business tools like fiber-optic Internet connectivity.

**What Is VoIP? How Does It Work?** 
VoIP – is an abbreviation of Voice over Internet Protocol. It is a way to make a phone call through the internet instead of a traditional phone line. It sends and receives digital audio “packets” of data between any two places through IP connection. VoIP uses WiFi and doesn’t rely on specific desktop equipment to operate. Hence businesses of all sizes across the U.S are shifting with this “less is more” idea and accepting it as the best business phone system.

**Advantages Of VoIP Over Traditional Phone Systems-**
Some organizations choose hosted VoIP, which is known as “hosted PBX”, whereas other organizations prefer to host their VoIP internally, which is generally known as “on-premises” VoIP. This offers an opportunity for more control and hence requires technical expertise and upfront investment.

*1. Employee Benefits-*
When a company allows employees to work from home, this opens the doors for international employees who may be more hardworking than local ones. Employees love to work remotely because they can work while dressed comfortably, take care of their kids, work while eating and take a break whenever they want. They can effectively work with their teams with VoIP for hassle-free communication.

*2. Compatible With Smartphone-*
Those old days are gone when you require various electric platforms to communicate externally and internally, access business information, and maintain productivity too. The significant benefit of VoIP is-  it allows us to use personal phones for work. The increase in the use of smartphones for a business solution makes sense- it streamlines all your work processes into one easy-to-navigate platform. VoIP systems use WiFi to route calls hence they’re smartphone-compatible. Currently, near about  36% of U.S. businesses are doing communication by choosing VoIP as their telephone service.  

Know more at- [https://solaceinfotech.com/blog/why-voip-is-best-for-remote-teams/]
Graduation Post
Published: 2020-05-26 06:36:54

[Note]: #githubsdp (DigitalOcean credits!)

## My Final Project
NARMADA - Needs and Available Resource Matching Assistant for Disasters and Adversities


## Demo Link
https://osm-dm-kgp.github.io/Narmada/

## Link to Code
https://github.com/OSM-DM-KGP/Narmada-dlnlp/

## How I built it (what's the stack? did I run into issues or discover something new along the way?)

My work was on the backend server. The major services provided by the backend server include classification and categorisation of the tweets in the system. It also provides support for the addition of new information and their automatic categorisation. Facilities have been provided for marking resources once their need is fulfilled or the availability gets exhausted.

The server side uses NodeJS framework and is written in Javascript. Nginx is used as an HTTP server to make the frontend accessible to the public. However, the NLP-related extraction tasks are handled better in Python.
The server partly uses a Flask-based Python backend, a micro web framework.
The Flask server makes API calls to the deep learning classifiers, featuring BERT, which returns the output. The output is further reflected in the frontend. The server sends information requested by the user interface via _RESTful API_, which supports cached responses on the frontend and enables the system to be scalable, thus allowing more users to use this service. 

API endpoints are publicly available, which would allow programmatic access to the server's functionalities (see https://osm-dm-kgp.github.io/Narmada/). 

## Additional Thoughts / Feelings / Stories
The main objective of our project is to assist and facilitate the coordination of post-disaster relief operations. The work is to be presented at the SocialNLP workshop to be held along with the 2020 Annual Conference of the Association for Computational Linguistics (ACL 2020).

[Final Note]: # (CONGRATULATIONS!!! You are amazing!)
Graduation quote: Tamaso Maa Jyotirgamaya (Lead me from darkness to light)
List of top Open Source alternatives to popular products.
Tags: webdev, javascript, programming, opensource
Published: 2020-05-26 06:24:58

---
title: List of top Open Source alternatives to popular products.
published: true
description: A list of open source alternatives to proprietary software
tags: webdev, javascript, programming, opensource
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/fdm5qik2s4jf1icth5hj.png
---
So I am collecting new and amazing tools for a directory app I am making, v2 of [Appydev](https://appydev.co/).

I found out there are some great alternatives to some very popular products. Here's a list of some interesting things people pay for.

Although, the title say's don't pay, most of these OSS projects are made by independent developers on their free time, consider donating them on github sponsors or opencollective etc.


### Shopify

1. [WooCommerce](https://woocommerce.com/)
2. [Magento](https://magento.com/)
3. [Prestashop](https://www.prestashop.com/en)

### Slack/Microsoft Teams

1. [Rocketchat](https://rocket.chat/)
2. [Wire](https://wire.com/en/)

### Firebase

1. [Appwrite](https://appwrite.io/)

### ngRok

1. [Localtunnel](https://github.com/localtunnel/localtunnel)

### Postman

1. [Insomnia](https://insomnia.rest/)
2. [Hoppscotch (prev Postwoman)](https://hoppscotch.io/)

### Sendgrid, Mailchimp

1. [Mail For Good](https://mail-for-good.netlify.app/)

### Bitly

1. [Polr](https://polrproject.org/)
2. [Zero Width Shortner](https://zws.im/)

### Google analytics

1. [Fathom](https://usefathom.com/)
2. [Matomo](https://matomo.org/)
3. [Plausible](https://plausible.io/)
4. [Ackee](https://ackee.electerious.com/)

### Github/Bitbucket

1. [Gitlab](https://about.gitlab.com/)

### Intercom/Livechat

1. [Chatwoot](https://www.chatwoot.com/)
2. [Chaskiq](https://github.com/chaskiq/chaskiq)

### Salesforce

1. [Odoo](https://www.odoo.com/page/crm)
2. [SuiteCRM](https://suitecrm.com/)
3. [Crust CRM](https://www.crust.tech/products/crust-crm/)

### Trello/Asana

1. [Wekan](https://wekan.github.io/)
2. [Taiga](https://taiga.io/)
3. [Kanboard](https://kanboard.org/)

### Zapier

1. [n8n](https://n8n.io)
2. [Huginn](https://github.com/huginn/huginn)

### Algolia

1. [MeiliSearch](https://www.meilisearch.com/)
2. [Elastic Search](https://www.elastic.co/)

### Typeform

1. [Oh My Form](https://ohmyform.com/)
2. [Super Easy Forms](https://supereasyforms.com/)

### Filmora/Adobe Audition

1. [Audacity](https://www.audacityteam.org/)

### MS Office/Google Doc

1. [Open Office](https://www.openoffice.org/).
2. [Libre Office](https://www.libreoffice.org/)

### Lastpass

1. [Bitwarden](https://bitwarden.com/)

### Google maps

1. [Openstreet maps](https://www.openstreetmap.org/#map=19/34.47481/132.45155) - ([Leaflet.js](https://leafletjs.com/) wrapper)

### Google Chrome

1. [Brave](https://brave.com/)
2. [Firefox](https://www.mozilla.org/en-US/firefox/)

### Google Drive/Dropbox

1. [NextCloud](https://nextcloud.com/)

### Wix

1. [Grapejs](https://grapesjs.com/)
Basic Developer Path
Tags: developer, roadmap, learning
Published: 2020-05-26 06:21:55

Today I want to make a slightly different approach; I see many new aspiring developers struggle with the same question: How do I become a good developer?

They ask what languages they should learn. When should they learn what? And how fast it will go.

There is not a one size fits all, but I hope to give my 10 cents about this topic.

## Basic development path

My recommendation for a path to follow would be the following:

- HTML
- CSS
- Vanilla JavaScript
- Now Stop learning and start creating
- SASS
- Advance JS -> React/Angular/Vue/Whatever is hip

So my main thing is, don't overdo yourself. When learning to become a developer, it's so essential your basis is perfect!

You can be a React Star, and that's perfect, but if you don't understand HTML, you will have such a disadvantage.

## Must I become a front & back-end developer?

That is one question I've seen many times, and it's tough to answer. It depends on what makes you happy. I started as a front-end developer; I had no clue what back-end meant and didn't like it. Nowadays, I'm considered a full-stack developer, but I like the back-end part way more.
I found it to come naturally to me.

## So, How do I become a good developer?

The main tip here is: "Start developing things!". Yes, easy said, but ok, let's say you only know HTML/CSS. You can build basic websites. Take a website you like and rebuild it!
Now at one stage, you know JavaScript, find yourself a challenging subject, and again recreate it.

Even better, invent your project. Find something that inspires you like movies/sports/animals and create an interactive web experience with that.

### Ask away

I love to help aspiring developers complete their goals.
Let me know in the comments or on the socials what your questions are, and I will try my best to answer them!

### 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)
Python in a nutshell [Part-1](Recap)
Tags: python, tutorial, abstractlearning, beginners
Published: 2020-05-26 06:14:36

### Recap
Before jumping to next part let us quickly recall what we have learned last time.
In last part we discussed about using *print* and *input* function to print and to get input from user respectively. We also studied about the *help* function which should by now become your best friend to get to information. We also learned about *type* function which could be used to get type of different objects.

The next question that might be coming to your mind is how to take input from the user and the print it.
```python
>>> name = input("Enter your name: ")
Enter your name: Ramesh Kumar
>>> print(name)
Ramesh Kumar
```
You might be thinking cool, what about adding some text for eg, printing, 
*Hello \<name\>, how are you?*
For that we have two good solution and one crappy one.
Lets check out the crappy one first.
```python
>>> name = input("Enter your name: ")
Enter your name: Ramesh Kumar
>>> print("Hello ", name, ",how are you?")
Hello Ramesh Kumar,how are you?
```
See why this is crappy?Never do like this! It might be a pain for you later to make changes and even understand the output.

#### Old style:
```python
>>> name = input("Enter your name: ")
Enter your name: Ramesh Kumar
>>> print("Hello {},how are you?".format(name))
Hello Ramesh Kumar,how are you?
```
Here the {} acts as a place holder and is substituted by the variable  *name*.Don't worry too much if you don't get it. Learn the syntax and try it.When you try yourself you understand better and may arise with many questions like, now if I have to put two variables in a sentence, say name and age how can I do that?
```python
>>> name = input("Enter your name: ")
Enter your name: Ramesh Kumar
>>> age = input("Enter your age: ")
Enter your age: 55
>>> print("Hi, I am {} and I am {} years old".format(name, age))
Hi, I am Ramesh Kumar and I am 55 years old
```
Here we have two placeholders and are substituted by the values of variable name and age respectively.

A problem with this is if the number of place holders get larger it might be confusing where to substitute which. And it is also harder to understand what the sentence is printing in one go.
The new style was introduced in Python3.6, called f-strings, which I believe stands for formatted strings.  
#### New style:
```python
>>> name = input("Enter your name: ")
Enter your name: Ramesh Kumar
>>> print(f"Hello {name},how are you?")
Hello Ramesh Kumar,how are you?
```
The string is prefixed with 'f' and anything in {} is treated as a python object to say.
```python
>>> name = input("Enter your name: ")
Enter your name: Ramesh Kumar
>>> print(f"Hello {name.upper()}")
Hello RAMESH KUMAR
```
Now just try different things and if any doubts arises google it and if you couldn't solve it then comment below.And if you solve your doubt then too comment below with your question and findings so that others could learn. 

Hope you enjoyed reading.

Takeaways:
1. Practice with what you have learnt so far.
2. Use f-strings more often.(Check your Python version, 3.6 or higher is required).
Nullish Coalescing Operator
Tags: javascript
Published: 2020-07-10 19:03:30

---
title: Nullish Coalescing Operator
published: true
date: 2020-05-26 06:00:00 UTC
tags: javascript
canonical_url: https://www.prestonlamb.com/blog/nullish-coalescing-operator
---

## [tldr;](#tldr)

The nullish coalescing operator is a relatively new operator in JavaScript. It’s use is similar to the OR operator, but with a minor difference that can be useful in many situations. With the OR operator, JavaScript uses the first truthy value it finds in the statement. If a part of the statement is falsy, JavaScript moves on. The nullish coalescing operator is similar, except it doesn’t move on to the next part of the JavaScript statement on every falsy value. It only moves on for `null` and `undefined`.

## [Nullish Coalescing Operator](#nullish-coalescing-operator)

The nullish coalescing operator is denoted by two question marks `??`. When using it, what you’re saying is that you want to use the left value in the statement is if it’s not `null` or `undefined`. If so, move on to the right value in the statement. This is similar to the OR operator, except that with the OR operatorJavaScript moves to the right side of the statement on any falsy value. Here’s an example of the two operators in use:

```js
const result1 = 0 || 5;
console.log(result1); // 5
const result2 = 0 ?? 5;
console.log(result2); // 0
```

In the first part of the above example the statement says to use 0 or 5, whichever one first gives a truthy value as the result. 0 is falsy, so it moves on to the 5. 5 is truthy, so that’s the result. In the second part of the example, the statement again says to use 0 or 5, but in this case it uses the nullish coalescing operator. 0 is falsy, but since it’s not `null` or `undefined`, it’s a valid result for the statement. 0 is returned as the result of the statement.

That’s all there is to the nullish coalescing operator. It’s pretty straight forward, and will be really helpful going forward in JavaScript applications. There are times when a falsy value like 0 is a valid result. For example, if you’re writing code for a game, a score of 0 is valid. But the following statement with the OR operator wouldn’t give us the result we want:

```js
const score = 0 || 10;
console.log(score); // 10
```

But with the nullish coalescing operator we can set a score to 0:

```js
const score 0 ?? 10;
console.log(score); // 0
```

We no longer need to write out entire if statements or complicated ternary statements to check for just `null` or `undefined`.

## [Conclusion](#conclusion)

This new operator will help out a lot in JavaScript applications going forward. It should be familiar to use, as it’s similar to other logical operators in JavaScript. But the difference in purpose is very nice and it solves a real problem in our code.