teleren/devto huggingface dataset:
✨Merge Intervals✨
Tags: tutorial, discuss, todayilearned, programming
Published: 2021-03-23 04:10:09

**Question :** 

Given an array of `intervals` where `intervals[i] = [starti, endi]`, merge all overlapping intervals, and return *an array of the non-overlapping intervals that cover all the intervals in the input*.

**Example 1:**

```
Input: intervals = [[1,3],[2,6],[8,10],[15,18]]
Output: [[1,6],[8,10],[15,18]]
Explanation: Since intervals [1,3] and [2,6] overlaps, merge them into [1,6].
```

**Logic :** 

1. List Approach
    - Take input as a 2-D array with fixed column length as 2 ( arr[ i ][ 2 ] )
    - pass this 2 - D array to mergeInterval method
    - ***In mergeInterval ( int[ ][ ] interval) method :***
    - if length of interval is or equal to 1 return interval
    - Else sort the interval array on the basis of the first column
    - Make a Arraylist of int[ ] outputArr
    - make int[ ] currentArray and initialize it to interval[ 0 ]
    - Now run a loop form i =1, to interval.length and make int[ ] in = interval[ i ]
    - ***in loop*** make 4 variable currentStart = currentInterval [ 0 ], currentEnd = currentInterval [ 1 ], nextStart = in[ 0 ], nextEnd = in[ 1 ]
    - if currentEnd ≥ nextEnd change currentInterval[ 1 ] to maximum between currenEnd and nextEnd
    - else currentInterval = in and add currentInterval to output list
    - return outputArr.toArray(new int[ outputArr.size( ) ] [ ])  ;
    - ***In main ( ) :***
    - Print the 2-D array

```java
import java.util.*;

public class Solution{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] arr = new int[n][2];

        for(int i = 0; i < n; i++){
            arr[i][0] = sc.nextInt();
            arr[i][1] = sc.nextInt();
        }

        int[][] matrix = mergeIntervals(arr);
        for(int row = 0; row < matrix.length; row++){
            for(int col = 0; col < matrix[row].length; col++){
                System.out.print(matrix[row][col]+" ");
            }
        }
    }
    public static int[][] mergeIntervals(int[][] intervals){
        if(intervals.length <= 1){
            return intervals;
        }
        Arrays.sort(intervals, (arr1, arr2) -> Integer.compare(arr1[0],arr2[0]));

        List<int[]> outputArr = new ArrayList<>();
        int[] currentInterval = intervals[0];
        outputArr.add(currentInterval);

        for(int[] interval : intervals){
            int currentBegin = currentInterval[0];
            int currentEnd = currentInterval[1];
            int nextBegin = interval[0];
            int nextEnd = interval[1];

            if(currentEnd >= nextBegin){
                currentInterval[1] = Math.max(currentEnd, nextEnd);
            }else{
                currentInterval = interval;
                outputArr.add(currentInterval);
            }
        }

        return outputArr.toArray(new int[outputArr.size()][]);
    }
}
```
Top Code Editors
Tags: vscode, productivity, ide, developer
Published: 2021-03-23 03:53:33

There are a lot of different editors and it largely boils down to personal preference. Most Python programmers use complex but extremely powerful IDEs (Integrated Development Environments), such as PyCharm. As a beginner, however, that's probably less suitable; our recommendations are equally powerful, but a lot simpler.

Our suggestions are below,

**Code editor**
===============

**Visual Studio Code**
----------------------

Visual Studio Code is a source code editor developed by Microsoft for Windows, Linux and macOS. It includes support for debugging, embedded Git control, syntax highlighting, intelligent code completion, snippets, and code refactoring.

[Download it here](https://code.visualstudio.com/)

**Gedit**
---------

Gedit is an open-source, free editor, available for all operating systems.

[Download it here](https://wiki.gnome.org/Apps/Gedit#Download)

**Sublime Text 3**
------------------

Sublime Text is a very popular editor with a free evaluation period and it's available for all operating systems.

[Download it here](https://www.sublimetext.com/3)

**Atom**
--------

Atom is another popular editor. It's free, open-source and available for Windows, OS X and Linux. Atom is developed by [GitHub](https://github.com/).

[Download it here](https://atom.io/)

**Why are we installing a code editor?**
----------------------------------------

You might be wondering why we are installing this special code editor software, rather than using something like **Word** or **Notepad**. The first reason is that code needs to be plain text, and the problem with programs like Word and Textedit is that they don't actually produce plain text, they produce rich text (with fonts and formatting), using custom formats like **RTF (Rich Text Format)**. The second reason is that code editors are specialized for editing code, so they can provide **helpful features** like **highlighting** code with color according to its meaning, or automatically closing quotes for you. We'll see all this in action later.

*Soon, you'll come to think of your trusty old code editor as one of your favorite tools. :)*
Instalación Mysql en Linux Ubuntu 20
Published: 2021-03-23 03:35:07

## Guía de instalación

Abrir una terminal y ejecutar los siguientes pasos:

> Actualizar los paquetes disponibles y sus versiones.
```
sudo apt update
```

> Instalar Mysql
```
sudo apt install mysql-server

```

> Instalar la secuencia de comandos de seguridad, esta opción agrega seguridad a la instalación de nuestra base de datos
```
sudo mysql_secure_installation

```

> Output
```
Output
Please set the password for root here.


New password:

Re-enter new password:
```

>  Ajustar la autenticación y los privilegios de usuario

```
sudo mysql

SELECT user,authentication_string,plugin,host FROM mysql.user;

ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'password';

```

- Ejecutamos este comando para indicar al servidor que vuelva a cargar la tabla de permisos y aplique sus nuevos cambios:
```
FLUSH PRIVILEGES;
```

## Instalación de WorkBench

- Ingresar al [Link](https://dev.mysql.com/downloads/repo/apt/)

- Descargar el archivo presionando la opción **Download**

- Presionar la opción **No thanks, just start my download**

- Arrastrar el archivo descargado a la terminal quedando de la siguiente forma 
```
sudo apt install '/home/student/Downloads/mysql-apt-config_0.8.16-1_all.deb' 

``` 

> Actualizar los paquetes disponibles y sus versiones.
```
sudo apt update
```

> Instalar MySQL Workbench
```
sudo apt install mysql-workbench-community
```

> Ejecutar desde la terminal MySQL Workbench
```
mysql-workbench
```

Fuente:  [DigitalOceans](https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-20-04-es)
Code Smell 63 - Feature Envy
Tags: codenewbie, programming, oop, webdev
Published: 2021-03-23 03:04:01

*If your method is jealous and don't trust in delegation, you should start to do it.*

> TL;DR: Don't abuse your friend objects.

# Problems

- Coupling

- Low Reuse

- Low Testability

- Bad Responsibilities Assignment

- Bijection Fault

{% post https://dev.to/mcsee/the-one-and-only-software-design-principle-3086 %}

# Solutions

1.  Move method to the appropriate class.

# Sample Code

## Wrong

[Gist Url]: # (https://gist.github.com/mcsee/62bc32206f71d61c1d0b63dcf87f8b80)
```java
class Candidate {

 void printJobAddress(Job job) {

   System.out.println("This is your position address");

   System.out.println(job.address().street());
   System.out.println(job.address().city());
   System.out.println(job.address().ZipCode());
 } 
}
```

## Right

[Gist Url]: # (https://gist.github.com/mcsee/edaade5842cdfa8ddd474c9904942e66)
```java
class Job {

 void printAddress() {

   System.out.println("This is your job position address");

   System.out.println(this.address().street());
   System.out.println(this.address().city());
   System.out.println(this.address().ZipCode());
  
  //We might even move this responsability directly to the address !
  //Some address information is relevant to a job and not for package tracking
 } 
}

class Candidate {
  void printJobAddress(Job job) {
    job.printAddress();
  }
}
```

# Detection

Some linters can detect a sequential pattern of collaborations with another object.

# Tags

- Coupling

# Conclusion

- We should assign responsibilities according to real object [mappers](https://dev.to/mcsee/what-is-wrong-with-software-5pa) and avoid abusing other objects protocol.
 
# Relations

{% post https://dev.to/mcsee/code-smell-01-anemic-models-4dg2 %}

{% post https://dev.to/mcsee/code-smell-89-math-feature-envy-5543 %}

# More info

- [Refactoring Guru](https://refactoring.guru/es/smells/feature-envy)

- [C2 Wiki](https://wiki.c2.com/?FeatureEnvySmell)

- [Wikipedia](https://en.wikipedia.org/wiki/Law_of_Demeter)

# Credits

Photo by <a href="https://unsplash.com/@lee_hisu">Hisu lee</a> on <a href="/s/photos/brothers?">Unsplash</a>
  

* * *

> We argue that design practices which take a data-driven approach fail to maximize encapsulation because they focus too quickly on the implementation of objects. We propose an alternative object-oriented design method which takes a responsibility-driven approach.

_Rebecca Wirfs-Brock_
 
* * *
 
{% post https://dev.to/mcsee/software-engineering-great-quotes-26ci %}

* * *

This article is part of the CodeSmell Series.

{% post https://dev.to/mcsee/how-to-find-the-stinky-parts-of-your-code-1dbc %}
Conversor de Farenheit para Graus
Tags: imersaodev
Published: 2021-03-23 03:03:00

{% codepen https://codepen.io/Elias_Hentz/pen/VwPwBbx %}![Fare Graus](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qzu5c67v4c4m6nzz64bz.jpg)
Question for ARKit worldmap
Tags: arkit
Published: 2021-03-23 02:56:05

Hi there, I'm a beginner of ARKit, recently I'm trying to use the worldmap. I set up everything and packaged it in my iPad then tested it in a shopping mall, but the location is not that accurate, the object I placed shows at a wrong place after I loaded the scene I saved. The margin of error was plus or minus 2 meters. I think it might be the shopping mall was too big which causes the error. Because I tried it at a storeroom which is much more smaller and everything works perfectly. So I just want ask if there is any solution for worldmap when using it in a big scene like a shopping mall with less error. Thanks in advance.
Narrowing Your Focus To Prevent Burnout
Tags: career, devjournal, mentalhealth, productivity
Published: 2021-03-23 02:55:00

> I use these posts as part of my effort to sustainably build in public for the long run. My aim is to share lessons learned, prevent burnout, and connect with other motivated builders. If you are enjoying these posts, please share or give me a [follow on Twitter](https://twitter.com/_btyler_)!

Something I have been actively struggling with is the prioritization of ideas. My ideas list has continued to grow each week while the amount of time I have available to devote to them has held constant. Not surprisingly, this growing asymmetry has been leading to feelings of great unease.

### Self-Driven Scope Creep

Something I saw all the time as a consultant and in my own freelance work is scope creep - the client asking for feature x, y, and z that was not included in the original scope of work. As I add new projects to my ideas list, I tend to ride the wave of motivation and start working on it immediately, bringing my active project count up by one. In a lot of ways, my growing products and active projects list represents self-imposed scope creep. It is fairly easy to be cognizant of this when someone else is asking for additional features and products, but so much harder to recognize when you are the one guilty of it.

At the start of this year, I had one project I was working on - Scoped, a budgeting and cost estimate planning tool for freelancers. Then I had an idea to start writing a Mapbox Developer's Handbook so I started working on this too. Next I added in Sonic Postcards in addition to a couple of other projects. So in three months I went from one project + a full time job to nearly five projects + a full time job. Not sustainable!

If I was working with a client who was pushing for so many new features and was so blatantly guilty of scope creep, I would probably fire them as a client. So it looks like I might have to fire myself...or change.

### Whittling Down Your Focus

The process of telling yourself no, especially if it is related to something(s) you are deeply passionate about can be painful. I decided I needed to whittle down the total number of projects I am working on at any given time to three. This was still too much. This week I brought this number down to one.

This mental framework is still sparkly fresh for me, but thus far it has helped put me ease. An added benefit has been that it has forced me to recognize if an idea is good, it will still be just as good of an idea whether I start on it today or a year from now. Someone else is likely not going to "steal" it either.

Anyways, I will report back on if I have the self-control to stick to this new paradigm and how it buffs out long term.

If you enjoyed this post please consider sharing it or giving me a [follow on Twitter!](https://twitter.com/_btyler_)
Instalación de VCode en Linux Ubuntu
Published: 2021-03-23 02:50:35

## Guía de instalación

Abrir una terminal y ejecutar los siguientes pasos:

> Actualizar los paquetes disponibles y sus versiones.
```
sudo apt update
```

> Instalar Vcode
```
sudo apt install software-properties-common apt-transport-https wget
```

>  Importar la clave GPG de Microsoft
```
wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add -
```

> Habilitar repositorios de Vcode
```
sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"

```

> Instalar Vcode
```
sudo apt install code

```

> Abrir Vcode, escribiendo en la barra de búsqueda de Actividades ‘Visual Studio Code‘
Customer first
Published: 2021-03-23 02:48:08

**First**, understand the problem your customer has
And then you solve that problem;

**Second**, you understand the data. What data goes from where to where, how does it look, how is it stored;

**Third**, you create the API; how does the information look that is exchanged between customer and UI, and how is it  between UI and backend;

**Fourth**
You don't need every UI detail, but you need to know which data needs to be shown how fast
Your whole solution changes depending on whether how they want to display on the interface.

**Really**
what does it mean to put the customer first?
**put yourself in their shoes!**
what's the data the user sees? 
What does he input? 
Where does the data need to go? 
How fresh does it need to be?
Manage Your Brand Reputation - AWS Comprehend
Tags: aws, ai, serverless, node
Published: 2021-03-23 02:28:46

##Motivation

In order to genuinely understand customers and increase retention, businesses need to focus a big part of their resources and manpower on customer feedback. The way someone approaches feedback can make or break their business.

The best way we can handle this is through digitization rather waiting for someone to reach the customer and get the feedback. After a customer leaves a feedback ‒ whether it’s to complain or appreciation on Twitter, email or voice there’s always an underlying emotion. With sentiment analysis, you can capture this subjective information to understand your customers better. Address the negative sentiment on priority and leverage the positive feedback for betterment of the business.

The below solution is a scaled down version of a sentiment analysis where a customer service associate exports customer feedback from Twitter, email or text from a voice call to a CSV file. As soon as this file is uploaded to a S3 bucket, sentiment analysis is done on each input and persisted into a DynamoDB table for further action.

## Technology
- AWS Lambda
- AWS Step Function
- AWS Comprehend
- DynamoDB
- Serverless Framework

## Steps

- The user uploads a CSV file with the feedback to S3
- Currently supports English(EN) & Spanish(ES) in which the customer had given their feedback
- S3 triggers a Lambda to read the file
- Step Function does batch processing of the feedback by language using AWS Comprehend
- This application inspects a batch of documents and returns an inference of the prevailing sentiment, POSITIVE, NEUTRAL, MIXED, or NEGATIVE, in each one
- The processed files are copied to another S3 bucket
- The number of documents in the request has a limit of 25
- Each document must contain fewer that 5,000 bytes of UTF-8 encoded characters

### Sample CSV file

datetime,account_number,language_code,text

- 2/12/01,333,en,you are awesome
- 2/13/01,375,es,Eres asombroso

![image](https://user-images.githubusercontent.com/14083152/109671867-74a59a00-7b42-11eb-84e0-61890c6c0d8a.png)

[Link to Github!](https://github.com/subhankarde/customer-feedback-sentiment) 

## Future enhancement

- Move the DynamoDB Put request from computeSentiment Lambda function to Step Functions
- Generate customer sentiment from the call recording with the IVR
- Use AWS Transcribe to convert it into text and then use the above flow
Instalación de Git en Linux Ubuntu
Published: 2021-03-23 02:27:14

## Guía de instalación

Abrir una terminal y ejecutar los siguientes pasos:

> Actualizar los paquetes disponibles y sus versiones.
```
sudo apt update
```

> Instalar Git
```
sudo apt install git
```

> Verificar la versión de Git instalada
```
git --version

git version 2.25.1

```


# Clonar el boilerplate de la academia react-hello
```
git clone https://github.com/4GeeksAcademy/react-hello.git

cd react-hello

npm install

npm run start
```
Ten Commandments of Git Commit Messages
Tags: git, codenewbie, github
Published: 2021-03-23 02:07:27

**0**. The git commit message shall not be empty
**1**. Separate header from body, and body from footer with a blank line
**2**. Limit the header to 72 characters
**3**. Use sentence case for the subject
**4**. Do not end the subject with a period
**5**. Use the imperative mood in the subject
**6**. Wrap the body and footer at 72 characters
**7**. Use the body to explain what and why vs. how
**8**. Use types for semantic versioning
**9**. Use footer to connect to issues and designate breaking changes

For explanations and automation means, please refer to the [original Medium article](https://itnext.io/ten-commandments-of-git-commit-messages-94bd6dcf6e0e).
Instalación Node en Linux Ubuntu 20
Published: 2021-03-23 02:03:59

## Guía de instalación

Abrir una terminal y ejecutar los siguientes pasos:

> Actualizar los paquetes disponibles y sus versiones.
```
sudo apt update
```

> Instalar Node.js
```
sudo apt install nodejs
```

> Verificar la versión de Node.js instalada
```
node -v

v10.19.0
```

> Instalar npm
```
sudo apt install npm
```

> Verificar la versión de npm instalada
```
npm -v

6.14.4
```

> Crear una App de Reactjs de ejemplo
```
npx create-react-app test

cd test

npm run start
```
mldbを使えるようにするセットアップ手順
Tags: magicleap, mldb
Published: 2021-03-23 01:55:38

---
title: mldbを使えるようにするセットアップ手順
published: true
description: mldb環境構築
tags: magicleap, mldb
//cover_image: https://direct_url_to_image.jpg
---

# MLDBとは

- Magic Leap 1 にアプリ(.mpk)をインストールしたりできるようになるWindows/macos用ツールです。（アンドロイド開発におけるadbと同じ）
- ストアにないアプリをインストールしたりできるようになります。

# 目次

1. [The Labのインストール](#c1)
2. [Package ManagerからLumin Runtimeをインストール](#c2)
3. [mldb.exeがあるフォルダにパスを通す](#c3)
4. [実機をつないで動作確認](#c4)
5. [インストール手順](#c5)


<a name="c1"></a>
# 手順1. The Labのインストール

- [Magic Leapのダウンロードページ https://developer.magicleap.com/downloads/lab](https://developer.magicleap.com/downloads/lab)をウェブブラウザで開く.
- `Download for Windows`か`Download for Mac`リンクをクリックして、インストールします.

<a name="c2"></a>
# 手順2. Package ManagerからLumin Runtimeをインストール

- The Labがインストールされたら、右上にある`Package Manager`という文字をクリックして開きます.
- `Lumin Runtime`をインストールします.

<a name="c3"></a>
# 手順3. mldb.exeがあるフォルダにパスを通す

- `Lumin Runtime`がインストール完了したら、mldbがある場所を探してそこにパスを通します.
- Windowsの場合、`C:\Users\(User Name)\MagicLeap\mlsdk\v0.25.0\tools\mldb` というような場所にあります.
- パスの通し方↓
  - コントロールパネルで「システムの詳細設定」を検索して開く.
  - 「詳細設定」タブ内にある「環境変数...」ボタンを押すと「環境変数」ウィンドウが開きます.
  - 「ユーザー環境変数」の「Path」を選択して「編集...」ボタンを押します.
  - 「新規」ボタンを押して上記パスを追加します.

<a name="c4"></a>
# 手順4. 実機をつないで動作確認

- The Labが起動している状態で、USBケーブルでMagic Leap 1を接続します.
- Magic Leap 1側に確認ボタンが表示されるので、clickすると承認され、The Labから各種情報を取得したりできるようになります.

<a name="c5"></a>
# 手順5. インストール手順

- windowsの場合、コマンドラインで、`mldb.exe install -u (path_to_app.mpk)`というような感じでインストールできます。
- 同じファイルをアップデートしたりする場合に`-u`オプションが必要となります。
The easiest way to download SVGs from a website
Tags: beginners, webdev, tutorial, todayilearned
Published: 2021-03-23 01:37:09

Usually, when adding icons to a website, I'll use [React-icons](https://react-icons.github.io/react-icons/). There are times, however, when I prefer to copy an exact SVG from a website. Downloading an SVG isn't as easy as downloading an image on a website. Fortunately, [SVG Export](https://svgexport.io/) extracted them for me.

## The problem
Ever use inspect element to download images that you're unable to right-click and either save or open? You'll likely have noticed that with SVGs it's not easy to download them from a website. - or at least I did when I was attempting to "clone" a webpage for my latest project.

Take the Dev.to logo that is visible on every page on Dev.to, for example. Right-clicking on that doesn't give you the option to open it in a new tab or save it. Moreover, using inspect element only gives you the potentially huge SVG tags, leaving you to work out where the SVG begins and ends in the page's HTML.

<figure>
  <img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g6h4aowgsjcg73hzounl.png">
  <figcaption>Unable to open or download the Dev.to icon SVG!</figcaption>
</figure>

## The solution

Enter [SVG Export](https://svgexport.io/), by [Stephen Delaney](https://twitter.com/delanebob) is a browser extension [for Google Chrome](https://chrome.google.com/webstore/detail/svg-export/naeaaedieihlkmdajjefioajbbdbdjgp/related?hl=en-GB) and [Mozilla Firefox](https://addons.mozilla.org/en-US/firefox/addon/svg-export). 

After installing the extension, clicking the extension icon will trigger SVG Export to extract all available SVGs on your current webpage, ensuring their inline styles are kept. A new tab will be opened displaying all SVGs. From there, locate the SVGs you're after and either download the SVG as a file, copy it as code or paste it into your favourite design tools like Sketch, Figma or Framer.

To download the Dev.to icon mentioned above, I simply opened any page on [Dev.to](https://dev.to), clicked the SVG Export icon to start the extract, and finally located it in the newly opened tab.

<figure>
  <img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h3lzqjvt09is8niudrsz.gif">
  <figcaption>SVG Export in action</figcaption>
</figure>

## Round up

In this post, I demonstrated how I was able to easily extract an SVG from a webpage using [SVG Export](https://svgexport.io/).

Do you have another, perhaps better, method of downloading SVGs from websites? If you do, let me know in the comments 👇

If this article has helped, drop a reaction!

Thanks for reading!