teleren/devto huggingface dataset:
Python 2 VS Python 3
Tags: discuss, python
Published: 2018-07-27 06:34:29

---
title: Python 2 VS Python 3
published: true
description: There can be only one.
tags: #discuss #python 
cover_image: https://thepracticaldev.s3.amazonaws.com/i/4ohqg9zer3pu4aylcad9.jpg
---


This time we visit the topic "Should I use Python 3 as it is the latest version or should I stick to Python 2 because most of the internet says so?"

__Disclaimer: I am quite Python 3 sided and looking for more of its drawbacks, so feel free to disagree with anything.__


### Key Differences from Python 2 to Python 3

- Syntactical, best shown by the print function. 
- Division with integers now outputs decimals if needed
- Unicode as default character encoding


And with the technical stuff out of the way, let's see what divides the community.

### Libraries

The main pro Python 2 argument is that every library ever is written for it and if one switches to Python 3 won't be able to find and use any of them. I believe this argument is quite outdated as Python 3 is now 10 years old and many libraries are now updated and functional. Some teams even start a project and in case the needed library is missing they code it, document and upload it. Very kind of them, isn't it?
Right now the only libs you can't find are the really obscure and unpopular ones. But if you are lucky one of the teams mentioned above will stumble on them and make it available to the rest of us!


### Dev Support

Python 2.7 is no longer under development and in 2020 will even be discontinued. In contrary Python 3 will have new features, active support and stable releases.


### Reasons to stick with Python 2

The only reason I thought was not outdated about sticking with Python 2 is the following.
One might be in a large company and all the code is written in Py2. Refactoring to Py3 will not only halt the development but also cost money as the engineers tampering with the code must get paid.


__As quoted by the Python team:__
_"Python 2.x is legacy, Python 3.x is the present and future of the language."_


__What is your opinion on the matter?__
Steps on making a blockchain
Tags: blockchain
Published: 2018-07-27 05:40:23

---
title: Steps on making a blockchain
published: true
description: 
tags: Blockchain
---
I want to start working with Blockchain and i have been looking up and googling up but all i find is bunch of tutorials of doing somthing which eventually tells me that i have setup a blockchain. But what i really want to know is that what am i suppose to do when working with some blockchain techonology (like hyperledger, EOSIO...etc)like what are the procedures.... how does setting up the environment and stuff goes on. Please, really need help here
What does Polymer bring to the table?
Tags: help, polymer, javascript
Published: 2018-07-27 05:35:49

---
title: What does Polymer bring to the table?
published: true
description: What exactly does Polymer bring to the table that we can not already do by registering custom elements with the available APIs?
tags: help, polymer, javascript
---

*Forgive my ignorance*

I was reading the [quick start tour](https://www.polymer-project.org/3.0/start/quick-tour) of _Polymer_ and at first sight I can't really identify any new functionality or added value. Is it supposed to simplify something?

In your own words, what exactly does Polymer bring to the table here that we can not already do by registering custom elements with the available APIs?
Explain the difference between Gulp and Grunt like I am five
Tags: explainlikeimfive, grunt, gulp
Published: 2018-07-27 05:20:28

---
title: Explain the difference between Gulp and Grunt like I am five
published: true
description: Explain the difference between Gulp and Grunt and elaborate which you prefer and why.
tags: explainlikeimfive, grunt, gulp
---

> gulp and Grunt are task runners. They are different approaches to same problem. Grunt uses configuration based approach, while gulp uses streams from node to achieve result. 
Source: [StackOverflow](https://stackoverflow.com/a/34287741/4696752)

Please describe in your own words the difference(s) between _Gulp_ and _Grunt_. What (unique) features distinguish the two? What is your personal preference and more importantly why?
Explain Grunt
Tags: explainlikeimfive, help, grunt
Published: 2018-07-27 04:55:52

---
title: Explain Grunt
published: true
description: Explain and demonstrate Grunt to the best of your ability.
tags: explainlikeimfive, help, grunt
---

Hi. Please explain _Grunt_ in your own words and provide your own example that demonstrates the value of Grunt in your personal workflow.
Explain sourcemaps
Tags: explainlikeimfive, help
Published: 2018-07-27 04:23:09

---
title: Explain sourcemaps
published: true
description: Please define sourcemap and provide idiot proof example(s).
tags: explainlikeimfive, help
---

Please define _sourcemap_, describe in your own words the purpose/value of sourcemaps, demonstrate this with a real world example and elaborate further where-ever you see fit. Thank you.
Using Helm on OpenShift
Tags: helm, openshift, kubernetes, devops
Published: 2018-07-27 02:54:05

---
title: Using Helm on OpenShift
published: true
description: An article about installing Helm on OpenShift and using it to install and upgrade Kubernetes applications.
tags: helm, openshift, kubernetes, devops
cover_image: https://thepracticaldev.s3.amazonaws.com/i/s6uk2g30kvuvb2bbfemq.jpg
---

I've created an article about installing [Helm](https://helm.sh) on [OpenShift](https://openshift.com) so that you can use it to deploy [Kubernetes](https://kubernetes.io) applications:

https://blog.osninja.io/deploying-anchore-engine-on-openshift/

In my next article, I'll use it to deploy the [Anchore OpenSource Engine](https://anchore.com/opensource) on OpenShift.
Working With Webhooks in Development
Tags: tools, webdev
Published: 2018-07-26 21:47:45

---
title: Working With Webhooks in Development
published: true
description: How you can speed up your development time with this wonderful tool
tags: tools, webdev
---

I often find myself needing to integrate with an API or external service when building apps or new features. Often enough, I need to be able to fetch information in (almost) real time. Services like MailChimp and PayPal offer webhooks, which is basically a fancy way of describing and external POST request to your server ([Click here if you aren’t familiar with HTTP verbs](http://www.w3schools.com/TAGS/ref_httpmethods.asp)). Anyone who’s worked with webhooks in a development environment knows it’s quite a pain to work with them if you don't have hosting set up, because you can’t just pass in your localhost address to these services. Localhost pretty much just translates to 127.0.0.1, which is (generally) every computers home IP; telling an API to POST to localhost:3000/your_hook_path literally just tells it to post to itself (and usually APIs won’t let you enter localhost as a URL). You can see how this puts you in an awkward position during development and testing.

#### Ngrok: The Best Thing Since Sliced Bread
Ngrok is a really great tool to solve this problem, and I personally love the tool as a whole (it works with more than just webhooks). Basically, ngrok sets up a URL that routes any incoming requests to a port of your choice, which makes it really useful when working with webhooks. Setting up ngrok is super fast, too. Just download it here, cd into the directory where you installed it, and run `./ngrok http 3000`, replacing the 3000 with whatever port you want to expose. If all goes well (and it probably will) ngrok will generate a HTTP and HTTPS URL that forwards to your localhost. All you have to do now is provide the API webhook with the generated URL, and voila! You’ve got a working webhook listener in your development environment. It’s important to note that ngrok will generate a new set of URLs every time you restart the client, so you will need to swap out the URL in the APIs webhook. I also love using ngrok for demoing work while I’m developing. That way, anyone can see the current status of the app/website I’m working on without me having to set up hosting, and I can avoid deploying until it’s actually necessary. It’s also great for testing your website across multiple devices/browsers, because you can connect from pretty much anything.

#### Everyone Loves Ngrok!
Don’t just take my word for it, here are some tweets from people who love ngrok:

> “so ngrok.com is basically the greatest thing ever.“
> — @philadams
<br />

> “#ngrok is a dream for testing localhost with remote APIs!“
> — @davejlong
<br />

> “#ngrok has got to be the easiest local tunnel solution I’ve ever used.“
> — @thecodeboss


… and there’s actually [quite a bit more love](https://ngrok.com/love).
How to stay on track during Sabbatical / code retreat
Tags: discuss, help, programming, development
Published: 2018-07-26 18:36:03

---
title: How to stay on track during Sabbatical / code retreat
published: true
description: 
tags: discuss,help, programming, development
---

I'm starting my very first sabbatical which is going to be six long months atleast.

I have two questions:

I want to explore more about distributed systems. Plan is to build a KV database using Erlang.  What do you think about this?
I will be learning about existing DBs and Consistency problem, Storage optimisation etc as part of this.


How do I ensure I stay on track and won't lost focus. I know this is a broad questions. If you have done something similar would like to know the experience.

Rough plan : read books to get concepts, write code, blog, talk at relevant local meetups regarding my learning/work.

Starting off with :
Designing for scalability with Erlang/OTP

Designing Data intensive applications
Explain Encapsulation and Polymorphism Like I'm Five
Tags: explainlikeimfive, beginners
Published: 2018-07-26 20:58:37

---
title: Explain Encapsulation and Polymorphism Like I'm Five
published: true
description: What is it? When do you use it?
tags: #explainlikeimfive, beginners
---

I had trouble with the concept of "Encapsulation" and "Polymorphism" when I was learning Python a few years ago. I believe I saw a version of that with Java as well (public vs private functions?)

I need an example of how it is used and when I would use it.
Voice Recording from Microphone with a Polymer 2 App!
Tags: help
Published: 2018-07-26 20:09:41

---
title: Voice Recording from Microphone with a Polymer 2 App!
published: true
tags: help
---

Hello!

So I was wondering if anyone had gone down this path and could throw some light towards the subject.

I am building a Polymer 2 App Aimed towards Mobile.
Busy taking a bit of a "break" from it to see what cool stuff I can do.

What I'd like to do is a Voice to Text function.

I've been doing my research and I want to use the Cloud Google Speech API (Which looks amazing!)

That I can figure out as its an API hit.

So what I am left with is recording the audio first before I can send it.

I've looked at 2 ready made elements, App-Media and Voice-Elements without much success.

I figured this should be something I can do quiet easily, however examples for a polymer styled voice recorder aren't easy to come by but I have found a few short blog posts on ways to do this, but I thought I'd come here and see what you guys would suggest?
How to set up multiple Twitter accounts using only one Hotmail / Outlook / Gmail email address
Tags: tips, gmail, hotmail, twitter
Published: 2018-07-30 16:38:45

---
title: How to set up multiple Twitter accounts using only one Hotmail / Outlook / Gmail email address
published: true
cover_image: https://thepracticaldev.s3.amazonaws.com/i/9ocysfvyq2gpjds5jps0.png
tags: Tips,Gmail,Hotmail,Twitter
canonical_url: http://blog.mandarbadve.com/2018/07/26/how-to-set-up-multiple-twitter-accounts-using-only-one-hotmail-outlook-gmail-email-address/
---

Twitter don’t allow you to create multiple Twitter handles using same email address. If you want to create multiple Twitter accounts but don’t want to use different email addresses, here are some tricks you can use. 

###Hotmail / Outlook 
Recently Microsoft releases aliases feature for email address. You can add alias for your email address … [Continue reading How to set up multiple Twitter accounts using only one Hotmail / Outlook / Gmail email address](http://blog.mandarbadve.com/2018/07/26/how-to-set-up-multiple-twitter-accounts-using-only-one-hotmail-outlook-gmail-email-address/)
We're the core maintainers of Storybook, Ask Us Anything!
Tags: ama, javascript, webdev, storybook
Published: 2018-07-26 17:42:39

---
title: We're the core maintainers of Storybook, Ask Us Anything!
published: true
description: 
tags: ama, javascript, webdev, storybook
cover_image: https://thepracticaldev.s3.amazonaws.com/i/2334ckfjvv2ab50msz92.gif
---

Hey Dev.to, we’re the core maintainers of Storybook ask us anything. Here today are Norbert de Langen, Michael Shilman, Filipp Riabchun, Igor Davydkin, Daniel Duan, and Tom Coleman. We’ll be answering questions from 2pm ET on.


Storybook is the most popular tool for developing UI components. The open source project has grown to over 450 contributors, 26k GitHub stars, and 1M npm downloads/month. It’s now used by teams at Dropbox, Slack, Airbnb, Squarespace and many more. Furthermore, we just announced that [Storybook has full-time maintenance](https://medium.com/storybookjs/storybook-the-next-chapter-9d5c4939ab6).

__Common Questions__
__Why should you consider Storybook?__ 
Storybook helps you develop components in isolation. This is handy because it enables you to mock hard-to-reach states and edge cases while developing the component. In practice, you end up building durable components much faster.

__What view layers does Storybook support?__
React, React Native, Vue, Angular, Polymer, Mithril, Marko, raw HTML, and more soon.

__How do you try Storybook?__ 
[Install it here](https://storybook.js.org/)


__Are there any examples online?__
Airbnb has a lovely [datepicker](http://airbnb.io/react-dates/?selectedKind=DateRangePicker%20%28DRP%29&selectedStory=default&full=0&addons=1&stories=1&panelRight=0&addonPanel=storybook%2Factions%2Factions-panel). More examples [here](https://storybook.js.org/examples/).


__What’s a good way to learn Storybook?__ 
The [Storybook Tutorial](https://www.learnstorybook.com/) is a great start.
Generating CSS Grid Layout From Plain Text
Tags: devtips, html, css, webdev
Published: 2018-07-26 17:17:55

---
title: Generating CSS Grid Layout From Plain Text
published: true
description: Create CSS grid layout using plain text and then convert it into CSS
tags: devtips, html5, css, webdev
---

![](https://cdn-images-1.medium.com/max/1000/0*HwfzhBU_ktRi932l)

Using a nifty tool named [ASCIIFlow](http://www.asciidraw.com/), you can create plain ASCII text based grid layouts. This article explains how to convert the text based grid layout into **CSS grid layout** using a bit of **JavaScript** and **CSS Variables**.

[Read my article on Medium](https://medium.com/@jmatix/generating-css-grid-layout-from-plain-text-a06466e85dd1)
What are Some Common Use Cases for DLL's in Windows Applications
Tags: programming, help, discuss
Published: 2018-07-26 16:16:29

---
title: What are Some Common Use Cases for DLL's in Windows Applications
published: true
description: Seeking input and discussion on when to use DLL files in Windows based applications.
tags: #programming #help #discuss
---

I understand the core principle of what a DLL (Dynamic Linking Library) is, and can even implement a very basic one to use with my program. However, I'm curious to understand the rationale of them being implemented from a software engineering perspective. Are there common use cases that could help me understand their purpose better?

I notice many programs use them, yet in tutorials and even my coursework so far, DLL's never come up.
JS Performance: Perhaps We Shouldn't Always Use Arrays
Tags: javascript, performance
Published: 2018-07-26 16:05:28

---
title: JS Performance: Perhaps We Shouldn't Always Use Arrays
published: true
description: A very short post about about something that recently improved some poorly-optimised code
tags: [javascript, performance]
---

It feels like I spend quite a lot of time trying to find things that are in arrays. Almost as much time as I spend trying to locate my cats! 

Consider the following:

```javascript
const catsArray = 
  [ {name: 'Aeris', isFavourite: true}
  , {name: 'Juri'}
  , {name: 'Dante'}
  , {name: 'Frankenstein'}
  ];

const findMyCat =
  requestedCat =>
    catsArray.find(({name}) => name === requestedCat);

findMyCat('Dante'); // {name: 'Dante'}
findMyCat('Marmalade'); // undefined
```

I want to find Dante (which is a common real-world problem), and to do so I first need to check to make sure that Aeris isn't Dante, and then I have to check that Juri isn't Dante either. A bit weird, but okay. And if I want to check to see if I have a cat called Marmalade, I have to check all of my cats first, just to be sure I don't. Hm.

Perhaps my data could be represented a bit better here?

```javascript
const catsMap = new Map(
  [ ['Aeris', { name: 'Aeris', isFavourite: true }]
  , ['Juri', { name: 'Juri' }]
  , ['Dante', { name: 'Dante' }]
  , ['Frankenstein', { name: 'Frankenstein' }]
  , ['Aeris', { name: 'Aeris' }]
  ]
)

const findMyCat =
    requestedCat => catsMap.get(requestedCat)

findMyCat('Dante'); // {name: 'Dante'}
findMyCat('Marmalade'); // undefined
```

Now the next time I want to find Dante, I can just look for him. If he's there at catsMap['Dante'] like he's supposed to be, I'll find him, and if he's not, I won't - but I won't need to waste my time looking at any other cats along the way. Imagine the difference this will make when I have 10,000 cats, none of which are called Marmalade; I just saved myself 10,000 (hypothetical) operations!

## Update: 

I knew that if I posted this message here, someone would quickly offer up a better alternative, so thank you to [Weston Wedding](https://dev.to/weswedding) for pointing out that [Maps actually exist in JS now](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map)! (I've updated the example in this post to reflect this, so if you're reading this for the first time you don't need to worry about the "old" one :) )

Also thanks to [Oscar](https://dev.to/ibibgor) for the following performance test, showing the difference between the two approaches described in the original post. <3

![](https://thepracticaldev.s3.amazonaws.com/i/6o6kztplpgpz26tvlh2c.png)
Mid-Senior Front-End Engineer Job Opportunity (NYC)
Published: 2018-07-26 15:44:10

---
title: Mid-Senior Front-End Engineer Job Opportunity (NYC)
published: true
description: 
tags: 
---
Looking to add a talented mid-senior front-end developer to our team. NYC-based full time role.

<a href="https://angel.co/saftlaunch/jobs/401296-senior-front-end-engineer-product-design">View Job on Angel List</a>
How to authenticate dev.to PWA on iPhone?
Tags: discuss, pwa, iphone, safari
Published: 2018-07-26 15:36:47


---
title: How to authenticate dev.to PWA on iPhone?
published: true
description: PWA of dev.to on iPhone 7 using Safari browser
cover_image: https://practicaldev-herokuapp-com.freetls.fastly.net/assets/apple-icon-180x180-42529fd3c7608a99257d042dac2990ffd016b1475e94a6efcd45e598ce839e37.png
tags: discuss, PWA, iPhone, Safari
---


Hi All,
Recently I have installed PWA of dev.to on Safari on my iPhone 7. The app shortcut has been added to home screen.

But when I open PWA and tries to Sign In using Twitter, it redirects me to Safari again and shows Twitter app authorization page.

After successfully authentication it was suppose to open the caller application i.e. PWA of dev.to. But it redirects to dev.to website on same tab of Safari where Twitter authentication page was shown.

Am I missing something OR it is default behavior of Safari? If it's default behavior then we can say that implementation of PWA is in progress.


Does anyone facing same behavior?
Pagination in an API: page number vs start index
Tags: discuss, api, pagination
Published: 2018-07-26 13:21:16

---
title: Pagination in an API: page number vs start index
published: true
description: 
tags: #discuss #api #pagination
---

Imagine you're developing an API and have an endpoint that lists some entities. You want it to be paged because there could be a lot of entities, what would you use?

1. Page number and page size
2. Start index and limit

I usually go with the first for no specific reason, it was what was used in my first job, I got used to it and kept using it.

Anyone has any strong opinions on one being better than the other, or is this just a do whatever makes you happy kind of topic?

Note: I know a pagination token approach (if this is the correct name for it) is probably better and more scalable, but in this case I'm only considering these "old school" approaches to the problem.
TIL: Handling shell sensitive characters in URL when using curl/httpie
Tags: curl, httpie, shell, todayilearned
Published: 2018-07-26 06:34:06

---
title: TIL: Handling shell sensitive characters in URL when using curl/httpie
published: true
description: Sometimes you have to use shell sensitive characters in a url for curl or httpie etc
tags: curl, httpie, shell, todayilearned, til
---

# Handling shell sensitive characters in URL when using curl/httpie

Sometimes you want to request an URL from the command-line, but the URL contains characters bearing meaning in your shell.

```bash
$ curl --header Accept:application/json https://USERID:funkyPassMo|)@eksempel.dk/dostuff
-bash: syntax error near unexpected token '|'
```

Simply quote the URL when using curl

```bash
$ curl --header Accept:application/json \ 
"https://USERID:funkyPassMo|)@eksempel.dk/dostuff"
```

And if your special character is a quote `"`, quote differently, use  `'` for example

```bash
$ curl --header Accept:application/json \
'https://USERID:funky"PassMo|)@eksempel.dk/dostuff'
```

See also: http://wiki.bash-hackers.org/syntax/quoting

Originally posted in [my TIL collection](https://jonasbn.github.io/til/)
How to install Let's Encrypt on Nginx running Ubuntu 16.04
Tags: ssl, ubuntu, apache, nginx
Published: 2018-07-26 10:51:28

---
title: How to install Let's Encrypt on Nginx running Ubuntu 16.04

published: true
description: Just found an awesome bot to deploy LE certificates automatically on your virtual server.
tags: SSL, Ubuntu, Apache, Nginx
---

Install

```
$ sudo apt-get update
$ sudo apt-get install software-properties-common
$ sudo add-apt-repository ppa:certbot/certbot
$ sudo apt-get update
$ sudo apt-get install python-certbot-nginx
```

Get Started
Certbot has a Nginx plugin, which is supported on many platforms, and certificate installation.

```
$ sudo certbot --nginx
```

If you're feeling more conservative and would like to make the changes to your Nginx configuration by hand, you can use the certonly subcommand:

```
$ sudo certbot --nginx certonly
```

Automating renewal
The Certbot packages on your system come with a cron job that will renew your certificates automatically before they expire. Since Let's Encrypt certificates last for 90 days, it's highly advisable to take advantage of this feature. You can test automatic renewal for your certificates by running this command:

```
$ sudo certbot renew --dry-run
```
How to read dot files with PHP?
Tags: help, php, question
Published: 2018-07-26 11:31:54

---
title: How to read dot files with PHP?
published: true
description: 
tags: help, php, question
---

 Is there a practice of using dot files to store config info and constants in php? If so, how do I parse them? If not, then what would be a good way to isolate and store sensitive info like db passwords, or other config info?