teleren/devto huggingface dataset:
Why are you not using HTTPS?
Tags: security
Published: 2019-09-19 14:25:16

It's 2019 and I still see websites not utilizing HTTPS on their websites. 

I see websites with the _option_ for HTTPS, but they don't force HTTPS.

Look, I get it. SSL certificates used to be a bit more out of reach for the common web developer.

It's easier now. You can get a Let's Encrypt certificate pretty much anywhere, any time. You can easily pop a few lines of code and force HTTPS. Hell, most web hosts can do this _for you_.

Why? [Because your site is not secure with http](https://www.cloudflare.com/learning/ssl/why-is-http-not-secure/).

Get a certificate and get your site secure.

You don't want to be the person who regrets not doing it sooner.
Better Console Debug in Javascript
Tags: javascript
Published: 2019-09-19 14:04:34

When debugging an object in Javascript, you usually do something like:

```react
console.log(myObject);
```

Or even:
```jsx
console.debug(myObject);
```

<!--more-->

If we create the object with:
```jsx
myObject = {
    name: 'test',
    size: 1234,
}
```
And you do a console.debug from somewhere in the code, in the console you'll see:
<p style="text-align:center"><img alt="" src="https://josemdev.com/images/better-console-debug-js.png" class="alignnone" width="720" /></p>

So it might not be clear which object you're dealing with. To solve this you can do:

```jsx
console.debug({myObject});
```

The result is the name of the object and the full object printed:

<p style="text-align:center"><img alt="" src="https://josemdev.com/images/better-console-debug-js-2.png" class="alignnone" width="720" /></p>


This comes from ES6, it's usually called [shorthand property names](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#Property_definitions) and it works because the key and the object variable has the same name.

It's the same thing that saying:

```jsx
console.debug({myObject: myObject});
```

But more convenient as you can see. 😉
Learn to be a better leader and team member with pair-programming
Tags: career, productivity, beginners
Published: 2019-09-19 13:50:04

Pair Programming is a great way to work together to solve a problem.  You might think that having another person there will slow you down, or that it will be frustrating having to watch somebody else fumble around on the keyboard without knowing all your fancy shortcuts, but it’s worth it.

## Idea #1
### Pair programming is a chance to learn how to be a good team *member*  

When you program with a partner, do you always have to be one “driving” the keyboard and mouse? Are you able to sit and watch someone else take the lead?  

You should try this. 

Even if you’re the faster coder, nary a moment when your hands come off the keyboard, super-fast clickity-clack mechanical keys, you should REALLY try sitting back and letting your brain do the talking instead of your fingers.

-  See how someone else processes a task. 
-  Wait a little longer than normal to interrupt their flow. 
-  Resist the urge to reach for the mouse. 
-  Take notes on a piece of paper.

1 person working on a project is alone, 2 people make it a team. If you are a good team member, you’ll not only get twice as much work done, it should also be done with much higher quality.

When it’s your turn to drive, think about how much you’d really like your team-mate to resist grabbing your mouse or pointing at the monitor.  Now you know what it feels like to have someone actually helping the team instead of trying to *dominate* the team.

At this point, it’s time to start thinking like a leader.


## Idea #2
### Pair programming is a chance to learn how to be a *leader*

In a team with two people, the moment you start to wonder about how the other person is feeling, you start to become a *leader*.

If you’ve noticed that your team-mate has a really hard time sitting there watching you type, and you are wondering how to help them with that, you’re a leader.

When you see your team-mate struggle with a coding problem, and you hesitate a moment before blurting out the “answer” to them, you’re a leader.

You see, on a team, a leader is anyone who is thinking about what other people need to be successful.  They try to be sensitive to how team-mates are feeling, and often they aren’t necessarily the loudest people on the team.  

As you are working with someone, think to yourself: *what does this person need from me right now?* That kind of empathy will help both of you be more productive in a pair programming situation.
Daily Challenge #71 - See you next Happy Year
Tags: challenge
Published: 2019-09-19 13:48:56

---
title: Daily Challenge #71 - See you next Happy Year
published: true
series: Daily Challenge
description: Write a function that will return the next year with only distinct digits. 
tags: challenge
---

You're saying goodbye to your friend when they say to you, "See you next happy year!" You smile and wave, saying you'll see them then. But wait, when's the next happy year anyway? 

Given a year, write a function that will return the closest year you'll see your friend, _the next year with all unique digits_. 

Years will always be represented as positive integers. It is not necessary for the year passed through the function to be a Happy one. 

**Examples:**
`nextHappyYear(7712) ==> 7801`
`nextHappyYear(1001) ==> 1023`
`nextHappyYear(2018) ==> 2019`

***
_This [challenge](https://www.codewars.com/kata/5ae7e3f068e6445bc8000046) by MrZizoScream on CodeWars was used for inspiration. Thank you to [CodeWars](<https://codewars.com/>), who has licensed redistribution of this challenge under the [2-Clause BSD License](<https://opensource.org/licenses/BSD-2-Clause>)!_

_Want to propose a challenge idea for a future post?  Email **yo+challenge@dev.to** with your suggestions!_
Feedback on Small Java Package
Tags: showdev, java, help
Published: 2019-09-19 13:38:24

I just finished a small package built to intelligently infer schemata ("schemas") of CSV files:

{% github awwsmm/scheme %}

I'm looking for feedback on it! Let me know if the layout is unclear or if the documentation could use some work, etc. I tested it on a few different versions of Java and I haven't had any problems.

[Javadoc available here](https://awwsmm.github.io/scheme/).

Anything you like about what I did? Anything you hate? Anything you'd change?

Let me know in the comments! And thanks for your help!
My approach to testing documentation
Tags: workflow, testing
Published: 2019-09-19 13:35:55

---
title: My approach to testing documentation
published: true
description: This is something I have been thinking, in order to document the manual testing process
tags: workflow, testing
---

Hi everyone,

I was thinking, in the last couple of weeks, about a good testing workflow for non automated tests. Mainly, acceptance tests, since a big part of my team's workflow consists in testing with users after the development is ended.
So, I have a little software in-house software that I use to keep track of activities with customers. Requirements, living contracts, tickets, etc..
So some months ago, I developed a place to record tests. There you record the customer, the contract, the customer's accountable for that test, the bussiness transaction under test, and then you log:

1. Test cases under test
2. Issues detected related to each case

Then, the issues have a follow up workflow.

This is currently in use, but I kept wondering if this is a good approach, since it is basically plain text stored in a structured fashion, in a relational database.

This is a little screen-capture of a test:

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/wplc8m67jv6m0tvn15gb.jpg)

So, as I was saying, I was wondering if I could improve this record in order to give it some more structure, and specially, the ability to provide validations for the user working and for my bussiness. So, I linked this manual practice with automated testing, and figured it out.

I was not mapping anywhere my assertions. So, I think the right approach, or at least a better one, would be:

1. Each test still has information about the customer, the contract, the customer's accountable for that test, the bussiness transaction under test

2. In the following step of the test design, you declare the assertions that reflect the acceptance criteria of the test

3. Then you start logging each test case. For each test case and assertion combination, you declare if it passes or doesn't pass

4. If a test case and assertion doesn't pass, then you add one or several issues

I have this in mind:

||Test case 1|Test case 2|Test case 3|
|---|---|---|---|
|Assertion 1|✓|✓|✓|
|Assertion 2|✓|X|✓|
|Assertion 3|✓|✓|X|
|Assertion 4|✓|X|✓|

And then the test document has the list of issues detected.

Have you ever seen something like this in action? To be honest, I developed this but for a boiler certification small bussines, several years ago. It runs in tablet. It is about now that I realize that pattern is useful for software implementation.

Saludos,

P.S.: I'm not an english speaker, so if the text is hard to read please let me know and I'll try to make it clearer.
Change your Visual Studio / Visual Studio Code Font
Tags: visualstudio, visualstudiocode, windows, font
Published: 2019-09-19 13:23:15

---
title: Change your Visual Studio / Visual Studio Code Font
published: true
description: Change fonts in your IDE and the new Cascadia Code font
tags: Visual Studio, Visual Studio Code, Windows, Font
---

# The new Cascadia Code font

As part of the new Windows Terminal development, Microsoft provides an original open-source monospaced font, Cascadia Code. 
It is recommended to be used with console applications and development text editors. 
This new font supports programming ligatures! 
Programming ligatures creates new glyphs by combining characters. 
This helps make code more readable.
![Image](https://i.imgur.com/FASMN0A.png)

## Installing the Cascadia Code font in your windows system
- Download the .ttf file from the [github repo](https://github.com/microsoft/cascadia-code/releases) to any folder on your computer
- Open the context menu for the downloaded file and select the Install option

![Image](https://i.imgur.com/DWJAuMu.png)

# Change fonts in your IDE

Tired of the same font day after day? Follow this steps to have a new look and feel in your IDE!

## Change editor fonts in Visual Studio 2019 for Windows

- You have access to the font settings in the Tools > Options menu, under Environment > Fonts and Colors (After changing your font, reopen Visual Studio 2019)

![Image](https://i.imgur.com/XUJDcxx.png)


## Change editor fonts in Visual Studio Code
- Open your Settings and look for User > Text Editor > Font and change it to your desired Font (After changing your font, reopen Visual Studio Code)

![Image](https://i.imgur.com/iJAkA2Q.png)

References
- [Cascadia Code](https://devblogs.microsoft.com/commandline/cascadia-code/)
My first whiteboard challenge
Tags: career, javascript
Published: 2019-09-19 13:17:51

Yesterday I had the opportunity to take part in a job interview's process which presented a challenge to solve on a whiteboard.

It was my first coding-on-a-whiteboard experience and what seemed simple at first, actually had several details to pay attention.

## The Challenge

Given the following input, the expected output should be:
```javascript
// Input
[
  {
    id: "futebol",
    parent: "null"
  },
  {
    id: "bola",
    parent: "futebol"
  }
]

// Output
{
  futebol: {
    bola: {}
  }
}
```

Being an array as input, immediately I thought about using the [map](https://www.w3schools.com/jsref/jsref_map.asp) high order function, but then realized the output should be a single object, so I've changed it to the [reduce](https://www.w3schools.com/jsref/jsref_reduce.asp) HoF.

By the time I was figuring out on how to create a new object when **parent**'s value was null, I've got stuck in such abstraction given by reduce HoF that made me change the strategy to a simpler javascript loop with [for](https://www.w3schools.com/js/js_loop_for.asp).

After completing the code, the interviewer added another challenge by giving an extra input object `{ id: "chuteira", parent: "futebol"}` and asked if the code would still work as intended.
That moment I've felt that wouldn't and some kind of object [destructuring](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment) was needed to not override an object, however we've followed along. 

## The solution

What I've learned from this experience was some cool Javascript tricks and concepts, such as [Dynamic Properties Keys](https://www.samanthaming.com/tidbits/37-dynamic-property-name-with-es6) (ES6) and accessing nested properties in objects. I've also practiced how to present ideas and logic on a whiteboard and communication. 

Below it's the final code and the ES6 approach which I was initially going to use. Notice how longer, but more declarative is the first approach.

```javascript
// Using Reduce, Spread Operator and Dinamic Property Keys
const reducedCategories = products.reduce((prevProduct, product) => {
  if (product["parent"] === "null") {
    return {
      ...prevProduct,
      [product["id"]]: {}
    };
  } else {
    return {
      ...prevProduct,
      [product["parent"]]: {
        ...prevProduct[product["parent"]],
        [product["id"]]: {}
      }
    };
  }
}, {});

// Using classic javascript
var classicCategories = {};
for (var i = 0; i < products.length; i++) {
  if (products[i]["parent"] === "null") {
    classicCategories[products[i]["id"]] = {};
  } else {
    var parent = products[i]["parent"];
    classicCategories[parent][products[i]["id"]] = {};
  }
}

```

Which one do you prefer?
Creating a Bash Command
Tags: bash, terminal, command, script
Published: 2019-09-10 20:01:39

---
title: Creating a Bash Command
published: true
description: How to add a script file as an executable command in your bash terminal.
tags: bash, terminal, command, script 
---

Let's walk through the process of adding a fresh baby bash script as a command that you can run in your terminal.

Say you have a super rad script that does mega cool things somewhere on your computer:

### hello-world

```bash
#!/bin/bash


echo Hello world
```

Allowing your bash terminal to run this script file as a command just takes a few simple steps.

## 1. Place your script somewhere that scripts go.

I recommend creating a directory at `~/` called `bin` or `.bin`.  The bin folder is typically where commands go, so I'm going to replicate this:

`$ cd ~/`

`$ mkdir .bin/`

`$ mv path/to/script ~/.bin/YOUR-SCRIPT-NAME`

## 2. Add this Directory to your PATH.

Add a line to your .bash_profile that will make sure your bash terminal has a path to this file when running your command.

If you don't have one create one with

`$ touch ~/.bash_profile`

### .bash_profile
```bash
#Here's the line you should add:
export PATH=$PATH:/Users/YOUR-USERNAME/.bin
```

Now you can either restart your terminal at this point or source this file:

`source ~/.bash_profile`

## 3. Add Permissions for Users to run this command.

We'll use the illusive `chmod` command to let users run this newly created command:

`$ chmod u+x ~/.bin/YOUR-SCRIPT-NAME`

And that's it! You should now be able to run your script from anywhere in your terminal.
Why Use Serverless Programming? (Use Cases & Live Example)
Tags: webdev, tutorial, serverless, aws
Published: 2019-09-19 14:28:18

---
title: Why Use Serverless Programming? (Use Cases & Live Example)
published: true
tags: webdev, tutorial, serverless, aws
canonical_url: https://snipcart.com/blog/why-serverless-example
---

![A Serverless Function Example: Why & How to Get Started](https://snipcart.com/media/204683/serverless-og.jpg)

There’s one thing that will always fascinate me about the worldwide dev community:

Our ability to come up with solutions that consistently make our job less painful.

Because let’s be honest, some tasks that come with being a developer are… tedious.

Personally, something like maintaining servers always seems to be a pain in my a**. Not what I signed for at all.

That’s why I’m pretty pumped today **to write about serverless architectures and why it’s a programming trend worth learning about.**

As we already did for [APIs](https://snipcart.com/blog/apis-integration-usage-benefits) and [webhooks](https://snipcart.com/blog/what-are-webhooks-explained-example), this post serves as an introduction to the concepts behind serverless programming. I also crafted a small serverless app example to get a better understanding of it all.

I’ll cover:

- What does “serverless” mean
- Why serverless deserves your attention (benefits & limitations)
- What are the best use cases & tools
- How does it work (with Serverless & AWS Lambda example)

If you’re new to this, you should have a much stronger grasp on what the serverless “revolution” means to web development by the end of this post. 

Let’s do this!

## What does “serverless“ mean?

The first thing we have to get out of the way is understanding that serverless programming isn’t technically “serverless”. 

![what?](https://media.giphy.com/media/CDJo4EgHwbaPS/giphy-downsized.gif)
  

→ Read the full post [here](https://snipcart.com/blog/why-serverless-example)
🚀 We've just launched FileKit on ProductHunt!
Tags: showdev, javascript, filetransfer
Published: 2019-09-19 12:18:52

Hello everyone,

[Last week]((https://dev.to/tanker/we-created-filekit-the-end-to-end-encrypted-cloud-storage-service-3hbf)) we told you about our latest product: an end-to-end encrypted file transfer toolkit for Javascript.

Today we're thrilled to announce the [launch of FileKit on Product Hunt](https://www.producthunt.com/posts/filekit-by-tanker).

We wish to empower you, fellow developers, with the technology to build end-to-end encrypted applications.

FileKit comes with the following features:

 * Upload, download and share files up 2GB
 * Simple and modern API
 * Easy to integrate in your app
 * Builtin UI component for user’s identity verification

Here is an example of a file transfer application built with FileKit: https://share.tanker.io/

Go check it out and tell us what you think!
git stash for dummy’s
Tags: git, beginners, stash, commit
Published: 2019-09-19 12:16:21

---
title: git stash for dummy’s
published: true
description: stash as a temporary commit
tags: git, beginner, stash, commit
---

git stash for dummy’s or dirty & temporary commit



I strongly believe in learning the core of something with simple steps and then broaden the knowledge by exploring options.

I encountered "git stash" just yesterday and here is the simple steps towards it and.

Scenario: I have worked on a task and in middle of it read on team slack that 

`the develop branch has been updated. please update your branches`

But I'm still in middle of my work. I have written lines of codes on my own branch. I don't want to commit or delete my code. Deleting is waste of time. If I do commit, it would be a bad commit because I'm not sure about my work. But I want my develop branch to be updated. what should I do?

The way to go is STASH. by stashing we save our dirty work and easily switch to other branches, update them and get back to our work.

lets call it dirty & temporary commit.

first thing to do is to do this dirty commit. instead of normal git commit message this is the command.
```git
git stash
```

to have a message like commit message we can choose save option like below.
```git
git stash save "message"
```

now we are free to go to other branches and do any kind of update. in my case: checking out develop branch + pulling from origin + merging it to my Task branch:
```git
git checkout develop

git pull origin develop

git checkout my_Task_Branch_Name

git merge develop
```

now our project is up to date. but we miss codes that we have written. to see all the stashed (or our little secrete ;) temporary committed)
```git
git stash list 
```
you will see one or more stash. it is strongly recommended not to have more than one stash.
anyway you need your code back, to bring back your stashed code you have to apply it using this command.
```git
git stash apply stash@{number}
```
so far you are done. congrats. you are both updated and have your code back. if the list of stashes bothers you as it bothers me try the pop option to apply and delete.
```git
git stash pop stash@{number}
```
or to clear all of it
```git
git stash clear
```git

Also it's good to note that by using `drop` option you can delete specific or all of your git stashed codes. One may say that `pop` option is much better because it applies and drops at the same time. So `pop` is somehow the combination of those two. It can be good but I'm personally not fan of it. It might cause you problems. At least at beginning it's good Idea to use `apply` & `drop` separately.


you may also encounter ~WIP~ a lot and is good to know that it stands for ~Work In Progress~.

to see more options and possibilities check [here](https://git-scm.com/docs/git-stash)
How to compare two images in C# .NET
Tags: imagecomparison, csharp, pixeltopixel, dotnet
Published: 2019-09-19 11:51:59

GroupDocs.Comparison is a document comparison API that correlates content and style, it detects number of inserted/deleted or style changed items and generates a summary.

**How GroupDocs.Comparison works for Image Comparison?**
The comparison starts with the upper left corner and compares the entire image **pixel by pixel**. If the pixels are the same, it moves on to the next one and so on until it finds a difference. The changed pixels are given an ID. It is defined as dabbed, deleted or changed. They are highlighted in a specific color (blue, red or green according to the standard settings).

Source Image 
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/1g3i2kb0nlbjgpjff5hc.jpg)

Target Image is same as source image except it has some extra objects on the table and some new code lines in the text editor.
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/ej764wcrft0ql2mphao6.jpg)

Comparison Result
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/nsdk5byp29z02k3k4m4o.jpg)

API successfully detects the changes and highlights them in the output/resultant image. In this case it highlighted the inserted items (e.g glasses, mug and some changes in the code).
This is how you do image comparison using GroupDocs.Comparison for .NET

{% gist https://gist.github.com/GroupDocsGists/457b98e1aee333ee8fe08c25d88bd823 %}

Get access to the API [resources](https://products.groupdocs.com/comparison).