teleren/devto huggingface dataset:
Use pip3 to install awscli
Tags: python
Published: 2019-06-25 15:19:42

> NOTE: AWS provides [bundled installer](https://docs.aws.amazon.com/cli/latest/userguide/install-bundle.html).  It is much better than `pip install awscli`, especially when you are installing awscli on EC2.

As you know, Python 2 will be EOL at 2020-01-01.

But more than 50% of downloads from PyPI are still from Python 2.7.  This graph is copied from [PyPI Stats](https://pypistats.org/packages/__all__).

![](https://thepracticaldev.s3.amazonaws.com/i/gy9c0zcl9rwyy57hhj5o.png)

This huge number of download from Python 2 put pressure on library authors to keep supporting Python 2.  I want to reduce this pressure by Python 2 EOL.

Who uses Python 2 to `pip install` so much?  This is a hint.

![](https://thepracticaldev.s3.amazonaws.com/i/5a6ukhhl2r63a3b3tg36.png)

Most downloads are from Linux, although most Python users are using macOS or Windows.  We can assume most `pip install` executions are for CI/CD/server deployment.

Then which packages are most downloaded?  This is ranking from PyPI Stats:

![](https://thepracticaldev.s3.amazonaws.com/i/c3vxl7yjo2dtbaww7hyh.png)

All packages in the top 20 are pip, awscli, and those dependencies!

![](https://thepracticaldev.s3.amazonaws.com/i/j5ntq7jalzr6k7vc91et.png)

And 80% of `pip install awscli` are using Python 2!

If you know some document or template uses Python 2 to install awscli, please suggest using Python 3 to the author.

May Python 2 rest in peace.
Moving in Vim
Tags: vim, beginners, explainlikeimfive, productivity
Published: 2019-06-25 15:10:55

# Moving in Vim

Everyone who’s tried Vim learns about the wonky `hjkl` keys to move around a file. These usually make a new user feel one of the only two emotions we need: anger and confusion.

![A scene from the sitcom The Good Place where a character says "You humans have so many emotions! You only need two - Anger and Confusion!"](https://camilopayan.com/img/thegoodplace-anger-confusion.gif)

What if I told you that there was a way to make moving around your code feel as smooth as a swan dive and as fast as thought, while making editing a cinch? That’s where Vim movements come in.

Vim movements are commands that move the cursor in some direction. The `hjkl` keys are all examples of movement commands. In their case, movements that go left, down, up, and right. Vim also has other motions built around text objects as well as the direction you want to go in. If you’d like to go to your next code block, instead of mashing the `j` key a few times, you can hit `}` to get to the next empty line, landing you right before your next block of code (you are spacing out your code for readability, right?). Swapping out several hits on the `j` button with a single `}` is both a time saver and a finger saver. It helps you get to where you need to be in the code as quickly as you can think.

You can learn about all the available Vim motions in the Vim help file `motion.txt` accessible by running `:help motion.txt` in command mode.

If we were only eliminating keystrokes, it would already be worth your time to learn. But Vim motions are composable. This means they can combine movements with Vim’s editing actions to make changes to your file.

Let's go back to our example about moving to a new code block. What if you wanted to delete everything up until your next code block? We already know that moving to the next blank line is `}`, so we can combine that with the delete command `d` to create `d}`. This will delete every line from where our cursor is up until the next blank line.

Now you aren’t only moving faster, you’re editing your file faster, too!

Motions and commands aren't only Vim and Neovim. Vim emulation layers like the [IDEAVim](https://plugins.jetbrains.com/plugin/164-ideavim) plugin for JetBrains IDEs also have motions. The support for all motions might not always be there. My last experience with PHPStorm, for example, meant losing out on some motions. I missed those motions, and I went back to using Vim.

Vim motions and commands in normal mode are the language of Vim. When you learn to speak it, you’ll find that you can jump around files quicker than you ever thought possible.
Front-end components/features names
Tags: webdev, frontend, discuss
Published: 2019-06-25 14:49:53

As a front-end developer, quite often I need to deal with components and/or features naming conventions. I'm not talking about variables' names, functions and all of this...

I'm talking about components - _alert_, _modal_, _dialog_, _popup_, _dropdown_... And I believe this may be a struggle to many people whose are working with non-dev/non-technical people.

Constantly I hear people talking _"we need to create a new popup (...)"_ - so, do you mean a _prompt_ or a _confirm_?
Or, when you're using a tool like HubSpot, you have a component called _leadflows_ (now called _popup forms_)...

If you're using Bootstrap, Foundation, Material Design... This confusion with names can increase.

In fact, they don't need to know the "correct name", or the "fanciest name" for a specific component; but, sometimes, this may create a misunderstanding.

Obviously, after some time talking about the new component/feature with your teammate(s), you can call it in a more friendly name when developing (`modal.js`, `steps-controller.js`...)

Whatever... I'd like to hear your thoughts about this and how do you deal with those requirements, or even what do you consider to name a component.
How to make simple form validator in Swift
Tags: swift, validator, ios
Published: 2019-06-25 14:24:13

---
title: How to make simple form validator in Swift
published: true
description: 
tags: swift,validator,ios,
---

Sometimes we want to validate forms with many fields, for example name, phone, email, and with different rules. If validation fails, we show error message.

We can make simple `Validator` and `Rule`

```swift
class Validator {
    func validate(text: String, with rules: [Rule]) -> String? {
        return rules.compactMap({ $0.check(text) }).first
    }

    func validate(input: InputView, with rules: [Rule]) {
        guard let message = validate(text: input.textField.text ?? "", with: rules) else {
            input.messageLabel.isHidden = true
            return
        }

        input.messageLabel.isHidden = false
        input.messageLabel.text = message
    }
}

struct Rule {
    // Return nil if matches, error message otherwise
    let check: (String) -> String?

    static let notEmpty = Rule(check: {
        return $0.isEmpty ? "Must not be empty" : nil
    })

    static let validEmail = Rule(check: {
        let regex = #"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,64}"#

        let predicate = NSPredicate(format: "SELF MATCHES %@", regex)
        return predicate.evaluate(with: $0) ? nil : "Must have valid email"
    })

    static let countryCode = Rule(check: {
        let regex = #"^\+\d+.*"#

        let predicate = NSPredicate(format: "SELF MATCHES %@", regex)
        return predicate.evaluate(with: $0) ? nil : "Must have prefix country code"
    })
}
```

Then we can use very expressively

```swift
let validator = Validator()
validator.validate(input: inputView, with: [.notEmpty, .validEmail])
```

Then a few tests to make sure it works

```swift
class ValidatorTests: XCTestCase {
    let validator = Validator()

    func testEmpty() {
        XCTAssertNil(validator.validate(text: "a", with: [.notEmpty]))
        XCTAssertNotNil(validator.validate(text: "", with: [.notEmpty]))
    }

    func testEmail() {
        XCTAssertNil(validator.validate(text: "onmyway133@gmail.com", with: [.validEmail]))
        XCTAssertNotNil(validator.validate(text: "onmyway133", with: [.validEmail]))
        XCTAssertNotNil(validator.validate(text: "onmyway133.com", with: [.validEmail]))
    }

    func testCountryCode() {
        XCTAssertNil(validator.validate(text: "+47 11 222 333", with: [.countryCode]))
        XCTAssertNotNil(validator.validate(text: "11 222 333", with: [.countryCode]))
        XCTAssertNotNil(validator.validate(text: "47 11 222 333", with: [.countryCode]))
    }
}
```

---

❤️ Support my apps ❤️ 

- [Push Hero - pure Swift native macOS application to test push notifications](https://onmyway133.com/pushhero)
- [PastePal - Pasteboard, note and shortcut manager](https://onmyway133.com/pastepal)
- [Quick Check - smart todo manager](https://onmyway133.com/quickcheck)
- [Alias - App and file shortcut manager](https://onmyway133.com/alias)
- [My other apps](https://onmyway133.com/apps/)

❤️❤️😇😍🤘❤️❤️
What is the role of a product manager in a development team?
Tags: discuss, productmanagement, career
Published: 2019-06-25 14:06:02

It was a great saying he is the CEO of a product he is making. That was a truth for a while. Not anymore.  
In most of the teams right now PM has no leverage except his expert weight. It's while trying to find a balance between business, development, and user happiness. So who we are, what we do, and what is our role? 
 
We are the ones who collect knowledge about industry, development, user, and stakeholder expectation. Ones who know how to find information via various kind of research (market, UX any means needed)

We provide this accumulated knowledge to the dev team as documents and answers. 

It's not our role to rule. Our purpose is to lead the knowledge provided. What we don't know and what experiments we need to do to know more? What are the numbers and best practices? By being an expert, you take the cognitive load from fellow team members. And if you are knowledgeable and can defend your arguments, the team will support you. 

(hint: both developers and business are good with numbers)
What is the best config for a Vue project?
Tags: help, vue, javascript, productivit
Published: 2019-06-25 14:01:01

I work with VSCode and I can't make the debugging work properly with vue files. No matter if it's a vue-cli or a nuxt based project.

I can only manage to work with `debugger` statements wich is very annoying and time consuming.

I need recommendations or examples. Thanks in advance.

PS: I know I can debug through Chrome DevTools. I just want the full XP of debugging all inside the IDE, like I do with React or Angular
Video Design Critique: James Quick's Learn. Build. Teach. website
Tags: ux, design, beginners, critique
Published: 2019-06-25 13:45:10

This design critique is a special one for me. It features my friend James Quick and his educational resource site Learn. Build. Teach. I'm excited to share insights about improving the design, but also to share this amazing resource to learn more about development.


Site: https://learnbuildteach.com
Check out James on YouTube here: https://www.youtube.com/channel/UC-T8W79DN6PBnzomelvqJYw

Want a critique? Head to https://peerreviews.dev

In this series, I hope to examine many different websites, apps and projects to find common ground that all designers and developers can learn from. We'll be taking a look a lot at what I call "microdesign." Lots of little changes that can add loads of polish to your project. We'll also talk a bit about "macrodesign" and talk about the UX of various layout types. Check out all the videos and sign up at https://peerreviews.dev

Want to see it on YouTube instead of Dev.to?

{% youtube hne1AsSmaX8 %}
My Personal Kanban - Keep track of your tasks
Tags: tools, productivity, opensource
Published: 2019-06-25 08:49:01

---
title: My Personal Kanban - Keep track of your tasks
published: true
description: Manage your tasks with My Personal Kanban offline and with ease
tags: tools, productivity, opensource
---

# The Struggle

In some meetings I found myself not having done all the tasks I was told to finish. Not because I'm lazy or I didn't found time but mainly because I just forgot about it. 

# My Attempts

## No notes

That's where I came from. Forget it. With a decent amount of context switching during the day, you'll soon lose track of the most of your tasks and so did I.

## Notebook

I started writing down my personal tasks to paper but soon I got in trouble. I forgot looking in the notebook, the pages got messed up with tasks and notes, there was not enough space to add additional notes. It was a mess. 

## Markdown File

I don't know why, but after the notebook attempt I started arranging my daily work in a markdown file. This was not as messy as the notebook but soon I found myself cutting and pasting lines around, improvising ways to mark tasks for their different states. It worked but I put a lot of effort in arranging tasks.. it could have been better.

# Solution

## Requirements

My filthy attempts in managing my tasks didn't work out but I learned what I NOT need. So based on this I put together requirements for a new tool to find or else write by myself.

- **Offline**, for company security reasons
- Reliable (being able to create backups)
- Simple and fast Task management
- Everything at a glance
- Dark theme would be great

With that in mind and the knowledge about the SCRUM-Board, also knowing about kanban, I was looking for a simple kanban solution. I found many online application like Trello and stuff but FINALLY found the solution to all of my task managing problems. 

# My Personal Kanban

[My Personal Kanban on Github](https://greggigon.github.io/my-personal-kanban/)

![My Personal Kanban Screenshot](https://thepracticaldev.s3.amazonaws.com/i/46f6djy6ldfhqb9yknwr.jpg)

With that awesome piece of angular based software, you can manage your tasks in cards, quickly create new ones, grab them to switch their state and sort them by color. And all that **locally**! If you wish, you can create an online backup to the cloud. Exactly what I needed.

Now, that I'm managing my personal work tasks in this software for about a month now, I realize that I'm getting more reliable and have all my stuff done (except there's a lack of time, of course).

If you consider using this be always sure to make a backup as the data is stored in your browsers cache. Therefore you can hit the export button and store a json file.

Additionaly it's open source! 

That's what I call a solution.
Seo is my worst skill, what’s yours?
Tags: discuss, seo, webdev
Published: 2019-06-25 13:45:03

---
title: Seo is my worst skill, what’s yours? 
published: true
description: 25 years building sites, and I’ve always been horrible at seo and getting traffic 
tags: discuss, seo, webdev
---

So I’ve been coding for 25 years. By far my worst skill is seo. 

I’ve never been able to get traffic to any of my personal websites. Like the most I ever got was 1000 in a day. But typical it’s 10 to 0. 

I don’t know why I struggle so much, I’ve read up on it. Did the basics. But it so much work and I get bored because it’s not my passion. 

What is/are your worst skill/s
How to Change Default DotNet SDK Version
Tags: dotnet
Published: 2019-06-25 13:19:24

When I installed ".Net Core 3 SDK (preview 6)", default version of *dotnet core sdk* on my system is changed to this new version. Then I needed to revert the default version to "2.x.x" in some places. So I followed the steps below. 

See [Official Documentation](https://docs.microsoft.com/en-us/dotnet/core/tools/global-json)

####See Installed DotNet Core SDK and Runtime Versions####
In order to see all installed **dotnet SDK** versions (and currently used default version), run:
`dotnet --version`
`dotnet --list-sdks`
![](https://thepracticaldev.s3.amazonaws.com/i/x392pgbd9wpg0g6dim84.PNG)

In order to see all installed **dotnet Runtime** versions, run:
`dotnet --list-runtimes`
![](https://thepracticaldev.s3.amazonaws.com/i/q7wjub3ggdmgu9bitayl.PNG)

####Change Default DotNet SDK Version using global.json File####
In order to change default *dotnet SDK version*, place a global.json file in the current folder or any parent folder with the contents below. You can create the global.json file manually, or use the dotnet cli command `dotnet new globaljson`. 
{% gist https://gist.github.com/polarbit/a2dbd8228328f440982ceabb50cbe30a %}

Now *dotnet core sdk* version is reverted back in the folder which *global.json* resides, or in it's subfolders.

![](https://thepracticaldev.s3.amazonaws.com/i/5d94w574jea7gorbvqzv.PNG)

**Note:** By default `dotnet new globaljson` cli command sets the SDK version using the current effective version. You can change this behaviour by adding optional `--sdk-version=2.2.300` parameter.

{% gist https://gist.github.com/polarbit/4c071d69652e78cc8a58793ad9e93c3e %}
What does your Junior interview process involve?
Tags: discuss
Published: 2019-06-25 13:10:37

---
title: What does your Junior interview process involve?
published: true
description: Explain what your junior interview process involves and what you look for in junior candidates.
tags: discuss
---

I recently got a lot of questions about what to expect from a junior interview and what I look for. Since I have a very narrow view I wanted to open it up to the community. No need to be overly specific about problems, just a general idea of the sessions you do and what makes a candidate stand out for you would be hugely helpful for those trying to prep!
What professionals think about Clean Code ?
Tags: discuss
Published: 2019-06-25 13:03:16

So I recently started reading [CleanCode](https://www.oreilly.com/library/view/clean-code/9780136083238/) by *Robert C Martin* .
He raises some exceptionally strange points about writing professional clean code which I didn't knew at all.
Like minimising comments in our code, keeping function arguments to less than 3 and many more.

On the other hand I found this article somewhere in my social media.

[Casey Muratori on 'clean' code](http://www.opowell.com/post/casey-muratori-on-clean-code/)

I know there are tone of professionals on DEV, would like to read their insights about this 👀

 > **What do you think how much should one focus on writing Clean Code?
Does it matter?**
Understanding Array.prototype.flatMap
Tags: javascript, webdev, learning, productivity
Published: 2019-06-25 12:53:46

---
title: Understanding Array.prototype.flatMap
published: true
description: ES2019 added a new function called flatMap for manipulating arrays. In this post we're going to learn all about it.
tags: javascript, webdev, learning, productivity
series: Demystifying ES2019
cover_image: https://thepracticaldev.s3.amazonaws.com/i/spm1o5cva031gjhnyaw3.png
canonical_url: https://tenmilesquare.com/understanding-array-prototype-flatmap/
---

Last week we talked about [the new flat method](https://dev.to/laurieontech/demystifying-array-prototype-flat-gi9) available in ES2019.

This week, we're going to dive into `flatMap`!

# Let's start with map

In JavaScript arrays a have a built-in function called `map`. It takes a function and uses that function to operate on each item in the array. Something like this.

```javascript
let arr = [1, 2, 3]

let result = arr.map((item) => item * 2);
```

`result` is then an array with each item from `arr` multiplied by two.

```javascript
[2, 4, 6]
```

# Another way to work with map

You can also use `map` to create a data structure inside each array element! Let's look at this example.

```javascript
let arr = [1, 2, 3]

let result = arr.map((item) => [item, item * 2]);
```

In this case, our result is this.
```javascript
[[1, 2],[2, 4],[3, 6]]
```
It's common to want to flatten this.

So you have 

```javascript
let arr = [1, 2, 3]

let result = arr.map((item) => [item, item * 2]).flat();

[1, 2, 2, 4, 3, 6]
```

# But not with flatMap!

With the addition of `flatMap` this becomes simpler!

```javascript
let arr = [1, 2, 3]

let result = arr.flatMap((item) => [item, item * 2]);

[1, 2, 2, 4, 3, 6]
```

It's the same thing.

#Important

The default argument for `flat` is 1, NOT Infinity. This is important because `flatMap` is the same way. Let's look at an example.

```javascript
let arr = [1, 2, 3]

let result = arr.flatMap((item) => [item, [item]]);

[ 1, [1], 2, [2], 3, [3] ]
```

The array is not fully flattened because `flatMap` only flattens one level.

#Conclusion

flatMap is a great built-in function for this popular pattern! Check it out and let me know what you think.
React tldr; React Native Performance: Do and Don't. 
Tags: reactnative
Published: 2019-06-25 12:51:31

• Do read the docs of React, React Native and every library you are using.
• Using remote Images can be painful: use a library. Some patterns can be 
  harmful.
• Be careful with PureComponents and HOCS. 
• Keep your libraries up to date. 
• Give some love to your app and your users.

Source: https://hackernoon.com/react-native-performance-do-and-dont-1198e97b730a?fbclid=IwAR2uTIxlCZxBi9O2BEoRylYNlALSOGipJMno2ZzgXYMB3wHJmJ5wyjYJias
You don’t owe social media anything!
Tags: health, socialmedia, webdev, productivity
Published: 2019-06-25 12:28:28

---
title: You don’t owe social media anything!
published: true
description: Thoughts from my short break from social media.
tags: health, socialmedia, webdev, productivity
canonical_url: https://rizwanjavaid.com/blog/2019/6/25/you-dont-owe-social-media-anything
cover_image: https://cl.ly/3c8dc44288cf/Image%2525202019-06-25%252520at%25252012.01.46%252520PM.png
---

Recently I took a short break from social media. I didn’t feel like posting anything anywhere. I did not plan it, I just fell out of it for a while. After a few days of staying off of Twitter, LinkedIn, and Facebook, and Instagram, I felt a calmness come over me. I was able to focus on the important things in my life instead of always looking for the next photo or post to share and then checking to see how many likes my post received. I guess it was time to take a break and think about my relationship with social media. I’m not saying social media is all bad. It has a good side too. I learn new ideas, voices, and viewpoints I wouldn’t otherwise but the negative effects are strong and can be damaging. 

Taking a break from social media helped me understand the power it has. It consumes our time, energy, and our actions. But it doesn’t have to be that way. 

You don’t owe social media anything. 

You don’t owe it your time.

You don’t owe it your energy.

You don’t owe it your attention.

You don’t owe it your health.

You don’t owe it your self-esteem.

You don’t owe it your mental health.

You don’t owe it your privacy.

Spend your time, energy, and attention on your loved ones and most importantly take care of yourself first.
6 Tools I always install
Tags: productivity, mac, tools
Published: 2019-06-25 12:14:07

### 1. Xcode

Basically, I use Xcode to write code for `openFrameworks` and sometimes write `Swift`. In addition, rarely use to build a lib from source code

https://developer.apple.com/xcode/

### 2. Homebrew
Homebrew is a free and open-source software package management system that simplifies the installation of software on Apple's macOS operating system and Linux. 

I cannot live without this lol. I also use this on my Ubuntu machine.

https://brew.sh/

### 3. Visual Studio Code

I have tried sublime, atom and bracket. Eventually, keep using vscode.
I think the biggest reason was `code` command. Actually, we can add a command to open an app from `iTerm`/Terminal, but vscode doesn't need any settings which are easy. I like markdown preview function which doesn't need to install any plugins.

https://code.visualstudio.com/


### 4. iTerm + oh-my-zsh
This isn't necessary, but I prefer iTerm to Terminal.

https://www.iterm2.com/ 
https://github.com/robbyrussell/oh-my-zsh

### 5. Clipy
Clipboard extension app for macOS. 

This is very useful to me since I have many snippets on this app. In addition, when I use my friends' machine to help them, I always think why you don't have Clipy lol.

https://clipy-app.com/
https://github.com/Clipy/Clipy

### 6. Boostnote
An open source markdown editor for Mac, Windows and Linux app.

I always use markdown instead of txt since my note is including some codes. This app doesn't have a sharing function via the internet so basically for local use.


### Others
GitKraken
https://www.gitkraken.com/
Recently, started using Glo Boards.


VirtualBox
http://virtualbox.org/

AppCleaner
https://freemacsoft.net/appcleaner/