teleren/devto huggingface dataset:
Text to speech using Python gTTS in 5 lines of Code
Tags: gtts, python
Published: 2020-05-19 14:27:41

Google text to speech is a life saver when it comes to converting text to speech. Today,we will learn the recipe to cook the above title using Python.You can have a look at the youtube video also.
First of all, we need to have a pan,in this case, it will be gTTS module, To install gTTS and to use it, we need to type the below command.
```python
pip install gTTS
```
Once you are done with this ,I will suggest to install playsound ,so as to directly play the mp3/wav file.
```
pip install playsound
```
Now the installation part is done and pan is ready to cook. Type in the below code in your jupyter notebook code cell.
```python
from gtts import gTTS 
from playsound import playsound 
text = “ This is in english language” 
var = gTTS(text = text,lang = ‘en’) 
var.save(‘eng.mp3’) playsound(‘.\eng.mp3’)
```
I know that I said that we will do it in 5 lines,and indeed we can, We can directly pass the string (text) in the gTTS function! But thats not important,whats important is to understand what is happening under the hood. The beauty of most python modules is that they are self explaning, I am pretty sure that you must have understood all of it if you have basic knowledge of Python.

We also have some additional parameters which we can pass to make the mp3/wav file more intresting. Some of them are:

slow (bool, optional) — Reads text more slowly. Defaults to False.

lang_check (bool, optional) — Strictly enforce an existing lang, to catch a language error early. If set to True, a ValueError is raised if lang doesn’t exist. Setting lang_check to False skips Web requests (to validate language) and therefore speeds up instanciation. Default is True.

lang (string, optional) — The language (IETF language tag) to read the text in. Default is en.

To pay sound in hindi, all we need is hindi text and we can specify like

```python
gTTS(text="यह हिंदी में एक उदाहरण है",lang='hi')
```

and that all !

I will be back again but for now, “Stay safe and learn”.
If you have any doubt then watch this youtube video:
{% youtube BuMonMxrb4Q %}
Daily Challenge #244 - Search for Letters
Tags: challenge
Published: 2020-05-19 14:06:04

---
title: Daily Challenge #244 - Search for Letters
published: true
series: Daily Challenge
description: Which letters can you find in these strings.
tags: challenge
---
Create a function which accepts one arbitrary string as an argument, and return a string of length 26. The objective is to set each of the 26 characters of the output string to either '1' or '0' based on the fact whether the Nth letter of the alphabet is present in the input (independent of its case).

So if an 'a' or an 'A' appears anywhere in the input string (any number of times), set the first character of the output string to '1', otherwise to '0'. if 'b' or 'B' appears in the string, set the second character to '1', and so on for the rest of the alphabet.

For instance:
`"a   **&  cZ"`  => ` "10100000000000000000000001"`
`'Abc e  $$  z'` => `"11101000000000000000000001"`

####Tests
`change("!!a$%&RgTT")`
`change("")`
`change("abcdefghijklmnopqrstuvwxyz")`
`change("aaaaaaaaaaa")`

Good luck!
***
_This [challenge](https://www.codewars.com/kata/52dbae61ca039685460001ae) comes from Roy Gardiner on CodeWars. 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!_
All the latest news updates at your fingertips : NCRMedia
Tags: latestnewsupdates, hindisamchar, todaynewsupdatesinhindi
Published: 2020-05-19 13:57:30

Get all the latest news updates from all over the world in your regional language.
NCRMedia covers all the news updtaes across the world in all categories like Business, Politics, Health and lifestyle, Live stocks, covid19, crime news etc.
Visit NCRMedia for more news updates.
Using Dictionaries to refactor
Tags: refactorit, codequality
Published: 2020-05-18 22:12:28

About one year and a half ago, I joined an awesome team of developers which had set up a very efficient environment from which I have learned a lot.



One of the many ideas which arose in such a thriving environment is to use Dictionaries as configuration files. In order to explain what I mean, and let's start from some bad code:



```csharp
switch(foo.fooType) {
  case fooType.a: {
    bar(anEnum.aValue, foo, true);
  }
  case fooType.b: {
    bar(anEnum.bValue, foo, true);
  }
  case fooType.c: {
    bar(anEnum.cValue, foo, true);
  }
  default: {
    throw new ArgumentOutOfRangeException();
  }
}
```

Just by looking at this code it looks like it is very complex: in the `switch` we are calling a function depending on `foo`... but this is not true!
What is actually happening is that we are just configuring the first parameter (`anEnum`).



##Let's fix this

```csharp
anEnum myValue;
switch(foo.fooType) {
  case fooType.a: {
    myValue = anEnum.aValue
  }
  case fooType.b: {
    myValue = anEnum.bValue
  }
  case fooType.c: {
    myValue = anEnum.cValue
  }
  default: {
    throw new ArgumentOutOfRangeException();
  }
}

bar(myValue, foo, true);
```

This surely looks more understandable: it is immediate to see that we are not calling different functions, but we are just using a different value for `myValue`... but we can improve it a bit more with the use of a `Dictionary`.

fooConfigurator.cs:

```csharp
public static Dictionary<fooType, anEnum> fooConfigurator = new Dictionary<fooType, anEnum>() {
  { fooType.a, anEnum.aValue },
  { fooType.b, anEnum.bValue },
  { fooType.c, anEnum.cValue },
}
```

ourFile.cs
```csharp
if(!fooConfigurator.Contains(foo.fooType){
  throw new ArgumentOutOfRangeException();  
}
anEnum myValue = fooConfigurator.get(foo.fooType);
bar(myValue, foo, true);
```

This allows for some benefits in our code:
1. O(1) access time instead of O(n) if you are using interpreted languages (partially compiled languages as java or c# and compiled languages usually adopt access tables, making it already O(1)... compilers are awesome!) 
2. The code is more readable: we can clearly see we just configure `myValue` depending on `foo.fooType`, and nothing else.
3. This allows for simple configuration by updating our dictionary.



##Can we do more with dictionaries?

Sure!
The cool thing about using `Dictionaries` as configuration files is that, if you use it with care, you can also pass functions or multiple parameters (just use objects) with a dictionary, allowing for a lot of flexibility!

What do you think about this approach? Let me know in the comments!
7 Musings on Minion Management
Tags: management, leadership, career
Published: 2020-05-26 22:00:14

---
title: 7 Musings on Minion Management
published: true
date: 2020-05-19 13:35:57 UTC
tags: Management, Leadership, Career
canonical_url: https://mckerlie.com/posts/seven-musings-on-minion-management/
---

So, you’ve just been promoted to the dark side of management but you don’t know how to lead your minions? Here are a few tips on keeping your plebeians in line.

## Make Your Minions Do the Dirty Work

You shouldn’t worry yourself about work that’s underneath you, you get paid way to much. You’ve hired coder monkeys to handle everything from downed servers at 3 am to documentation to those pesky clients. All you have to do is sit back and make sure they don’t lose focus.

## Don’t Give Any Praise

Your minions just put in 100 hour weeks to get the feature launched on time? They get paid to do that work so there’s really no need to tell them they’re doing their job. Work horses don’t need to be told they’re doing a good job every time so why should your employees? As soon as you’re done you should give them more work since that’s what they need.

## Belittle Your Minions

You’re the manager so that makes you better than everyone else. If they were as good as you, they’d be managing people themselves. This means you’ve earned the right to make the others know that they aren’t as good as you.

## Always Leave Before Your Minions

Your time is way more valuable and you don’t want to wear yourself out. This means you should come to work later and leave earlier than your team. Besides, as long as you’re doing a good job guiding your newbies they should be able to carry on their work when you’re gone.

## Avoid All Responsibility

If your staff messes something up it’s their fault, not yours. Why should you be held responsible for something they’ve done. When the top brass asks you what happened make sure they know exactly who screwed up. This also secures your position because you’ll never do anything wrong.

## Believe That Your Job Is More Valuable

Obviously the people underneath you wouldn’t be able to do their job without you. Who would lead them? You get paid more so that means you’re way more valuable than them. Make sure that they know you’re more valuable to the company.

## Always Think You Are Right

Again, you’ve probably been there longer and you get paid more so that means you’re always right. When someone tries to tell you otherwise make sure you make them look bad to their co-workers; this will show them who’s boss.

* * *

If you’ve gotten to this point and haven’t realized you shouldn’t do any of these things you probably shouldn’t be managing people. If you realized that you should be doing exactly the opposite than go forth and manage!

The post [7 Musings on Minion Management](https://procrastinatingdev.com/7-musings-on-minion-management/) appeared first on [Procrastinating Developer](https://procrastinatingdev.com).
On Deno: Exploring New Tech Isn't a Distraction, It's a Necessity
Tags: webdev, deno, programming, node
Published: 2020-05-19 13:26:54

---
title: "On Deno: Exploring New Tech Isn't a Distraction, It's a Necessity"
published: true
description: Laced within the influx of Deno articles are the Deno detractors. This article offers the counterpoint that new tech is a distraction, it's a necessity.
tags: webdev, deno, programming, node
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/expzufcvynbpnxsnovr4.jpeg
---

Laced within the influx of Deno articles are the Deno detractors. This article offers the counterpoint to those detractors: new tech is not a distraction, it's a necessity.

# New Tech is Evolution

In evolution, not every new mutation sticks: some are disadvantageous and, due to natural selection, get culled from the gene pool. A select few traits, however, are advantageous. These traits propagate and become commonplace for that animal. It takes a whole lot of permutations before the right traits are found.

Tech evolution is the same way. Detractors argue that Deno is the "next shiny thing" in tech and cite many reasons why they would never use Deno. I think some of these criticism are correct&mdash;I don't understand how Deno imports can be more secure than node without an integrity SHA and I don't like that there's no obvious way to manage indirect dependencies.

# Criticism is Good

I'm not knocking articles that are critical of Deno's implementation details. These articles are actually incredibly important to determining if Deno is truly viable! But I will be a little harsher on articles that say the ecosystem is fine as-is and that attempts like Deno shouldn't even be made. Articles that discourage experimentation altogether are unhelpful for advancing tech.

# The Only Way We Move Forward is By Trying

Any issues with Deno will either be worked out or Deno will fall by the wayside. The only way we figure it out, however, is by trying. So whether or not you want to be on the "bleeding edge" of new tech attempts, just remember that the only reason you're not coding in Fortran right now is because some developers put in the time to explore, and fail with, all sorts of new tech.
Angular App and Spring Boot Api for Country, State and City
Tags: angular, springboot, api
Published: 2020-05-19 13:13:47

---
title: Angular App and Spring Boot Api for Country, State and City
published: true
description: Api for displaying country, state and city
tags: angular, spring-boot, api
---
### Introduction

Address WebApi and test example to display 
Country, State and City

### Prerequisite
- Java SDK
- node.js 

### Building Backend

```
https://gitlab.com/address-api/api-server.git
```

Create Database in mysql `create database address_api_db;`

Export Env variable

```sh
MYSQL_HOST=localhost
MYSQL_PORT=3306
MYSQL_SECRET=my_super_secret_password
```

Execute maven command to run project
```
./mvnw spring-boot:run
```

API Details

| Name        | Path           
| ------------- |:-------------:
| All Countries | http://localhost:8080/country/all
| State By Country | http://localhost:8080/state/all?countryId={countryId}
| City By State | http://localhost:8080/city/all?stateId={stateId}


### Building Frontend

```
https://gitlab.com/address-api/frontend.git
```

Build
```
ng build
```

Run
```
ng serve
```

Navigate to http://localhost:4200

## Demo

{% youtube ykxosCUoUTQ %}

## Ref:

Thanks to https://github.com/hiiamrohit/Countries-States-Cities-database 🙇 


Source
https://silentsudo.gitlab.io/post/angular/2020-05-19-api-country-state-city/
Mongo DB in Azure ( IaaS) v/s Cosmos DB API for Mongo DB ( PaaS ) 
Tags: mongodb, azure, iaas, pass
Published: 2020-05-19 13:11:06

Hi All,

Could you please share your thoughts which is the best option for Mongo DB 
1) Mongo DB in Azure ( IaaS ) 
2) Cosmos DB API for Mongo DB ( PaaS ) 

I know it depends on the required application functionality, In case if we have to evaluate  w.r.to cost and generic DB functionality related evaluation which one is recommended.

Many thanks in advance. 

Regards
Chandana D M
Supercharge your front-end skills by building real projects
Tags: html, frontend, javascript, github
Published: 2020-05-19 12:56:35

Gain real experience of building websites and providing code reviews. Build your portfolio and help others achieve their goals.
visit site 👇👇
https://www.frontendmentor.io

Frontend Mentor offers a range of challenges that aim to mimic a real-world workflow for a front-end developer. Each free challenge includes:

✅ Mobile & desktop designs in JPG format
✅ A front-end style guide for colors, fonts, etc
✅ A basic project brief, which mentions any expected functionality
✅ Pre-optimised assets
✅ A skeleton HTML file with pre-written content, but no structure

If you want to practice using the original Sketch design file, there is an option to buy that as well, although it's not a requirement to start the free challenges.

As well as the free challenges we also have premium challenges. Premium challenges offer you the chance to build some seriously impressive portfolio pieces and include:

✅ Multi-page and fully-functional project ideas
✅ Mobile, tablet & desktop designs in both JPG and Sketch format
✅ A professional design system providing common styles
✅ Custom APIs to work with so that you can practice with JS libraries/frameworks like React, Vue, Svelte, Angular, etc
Using React Hooks "useState"
Tags: react, javascript, codenewbie
Published: 2020-05-19 12:55:02

Hooks came as a new addition in React 16.8 and they let us use state and other React features without writing a class component. In this article, we are going to be discussing the `useState` hook. This basically allows us use state within function components.

Within class components, in order to declare state, we would do the following:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/hn7d23f66efa809w0vos.png)


And to update the state:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/12ijrvxlz7g7ucouk0et.png)


We could not use states outside class components. However using react hooks we can how use states within function components.

First we import `useState` from "react";

Then within the function component, we define our `useState` which returns two values, a variable for initialising the state and a function for updating state.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/py0wwooahlgbezv8jx5j.png)

The syntax `const [text, setText] = useState("")` is how we use the `useState` hooks through ES6 destructuring to return two values

1) `text` which is how we initialise the state and is equivalent in function to ` state = {text: ""}` and basically means we are initailising our state of text to an empty string.

2) `setText` is how we update the state using hooks and is eqivalent to 
`this.setState({text: "This is a state"})` and here we update the value of our state `text` to `"This is a state"`.


In order to use our state, where the syntax would previously have been
`<div>{this.state.text}</div>`, using hooks, we can just call our state variable directly `<div>{text}</div>`

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/4t7a3sl6lm3gdaxvy7sb.png)

In summary, this destructed syntax using React hooks helps us to write cleaner and better code and helps us use state within function components.
How to Input Special Characters in Vim (Foreign Letters / Symbols / Emojis) [Video]
Tags: vim, tutorial, terminal, bash
Published: 2020-05-19 11:39:57

## FYI - Skip to content...
The main content of this post is a video (found lower down...)
If you would like to skip the preamble in the video and get straight to the topic then jump to this timestamp: [01:16](https://youtu.be/Za5GRXP1ycM?t=76)


## Vim Tips Series
I am creating a (hopefully fun/energetic) YouTube series about Vim Tips. In particular small easily consumable Tips & Tricks in Vim to help you become a better Vim-er. This series is for Beginners & Intermediate Vim users alike and will hopefully expose/highlight some of Vim's massive (maybe even lesser known) functionality with explanations & examples.

The main aim of this series is to help people learn about the POWER that Vim gives you, which more often than not is somewhat difficult to find on your own, so this series is about pointing out that (& more) functionality...

Check out all the currently released episodes here:
[Vim Tips Playlist](https://www.youtube.com/watch?v=dVIP72Uwt2A&list=PL3Y9MECuxct01Qol3kWK0fB5AXh3NFThZ)


## This Episode
This episode shows you how to input special characters into Vim. Those are the characters that you can't normally type out-right on a traditional keyboard, for example foreign language letters, mathematical symbols, weird & wonderful shapes and even Emojis/Emoticons...

In this video I explain the concept of Character encoding (where in a computer each letter/character has a numerical value associated with it) and how you can actually use those values to enter in any character you like. So I start with a boring letter 'e' to showcase the concept and then move onto the characters you can usually type.

I then show you the incredibly powerful functionality that already exists within vim to help you input a vast array of special characters. This functionality is called Digraphs and removes the need for you to remember strange unicode numbers and to even copy and paste characters from the internet.

I hope you enjoy this video, please let me know if you do and if you would want more of it...


## The Video
{% youtube Za5GRXP1ycM%}


## Onwards
If you have ANY feedback or questions at all please let me know in the comments below or reach out to me on twitter:

[My Twitter (@ben_kadel)](https://twitter.com/ben_kadel)

Or if you want to see more videos from my channel then here you go:

[My Youtube Channel](https://youtube.com/BenKadel)


Thanks for reading and possibly watching!
What is Design Thinking and Why it Works?
Tags: webdev, design, ux, uiweekly
Published: 2020-05-19 12:40:42

Design thinking definition describes it as a methodology of finding a solution to a specific problem that is linked to the design of your future product. This process is closely linked to innovation and allows to solve complex problems by putting customers first. The ideas are generated with the help of brainstorming sessions. And by introducing the prototyping and testing to the decision-making process. The most successful companies actively use design thinking for idea-generating and business transformation. So let’s take a closer look at the whole process in our latest article and explore how to apply it in your company. https://pixetic.com/blog/design-thinking/
Are you excited about Deno?
Tags: discuss, javascript, node
Published: 2020-05-19 12:40:05

---
title: Are you excited about Deno?
published: true
description: Deno is out, and a lot of people are happy about it, how about you?
tags: #discuss, #javascript, #nodejs
---
Have you read anything about Deno during the last few days? (in case you haven't: https://blog.bitsrc.io/what-is-deno-and-will-it-replace-nodejs-a13aa1734a74 )

Which of the new features added by Deno has you more excited? Is it the added security layer? Or maybe the fact that it's dropping the need for npm? Or perhaps the out of the box integration with TypeScript?
Daily Developer Jokes - Tuesday, May 19, 2020
Tags: jokes, dailydeveloperjokes
Published: 2020-05-19 12:00:12

---
title: "Daily Developer Jokes - Tuesday, May 19, 2020"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
cover_image: "https://private.xtrp.io/projects/DailyDeveloperJokes/thumbnail_generator/?date=Tuesday%2C%20May%2019%2C%202020"
published: true
tags: #jokes, #dailydeveloperjokes
---

Generated by Daily Developer Jokes, a project by [Fred Adams](https://xtrp.io/) ([@xtrp](https://dev.to/xtrp) on DEV)

___Read about Daily Developer Jokes on [this blog post](https://xtrp.io/blog/2020/01/12/daily-jokes-bot-release/), and check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/).___
### Today's Joke is...
![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e125997196ca.png)

---
*Have a joke idea for a future post? Email ___[xtrp@xtrp.io](mailto:xtrp@xtrp.io)___ with your suggestions!*

*This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit.*

<!-- 
Joke text:
___Q___: Why are keyboards always working so hard?

___A___: Cause they have two shifts!
 -->